简体   繁体   中英

how to change size of point in ChartJS

I'd like to change a size of the point in my chart. 在此处输入图片说明

The point should be as small as possible. Was trying to use

pointHoverRadius: 1

But it doesn't work.

Thanks in advance,

You would have to set the pointRadius property to 1 as well (so the point becomes small initially) , along with the pointHoverRadius (remains small on hover)

pointRadius: 1,
pointHoverRadius: 1

It indeed needs to go in the dataset, like so:

{
    type: 'scatter',
    data: {
        labels: ['2015', '2016', '2017', '2018', '2019', '2020'],
        datasets: [
            {
                label: 'Cars',
                data: [{x:-10,y:0}, {x:0,y:10}, {x:10,y:5}, {x:4,y:8}],
                pointRadius: 10,
                ....
            },
            {
                label: 'Bikes',
                data: [{x:10,y:3}, {x:-2,y:6}, {x:9,y:3}, {x:11,y:6}],
                pointRadius: 10,
                ...
            }
        ]
    },
    options: {
       ...
    }

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM