Chartjs-Chart JS – Points and Tooltips Only at Specific Data Values

0👍

options.elements.point has a prop called radius. Radius can take either a number or an array of numbers. A single number will determine the radius for all of the points in your chart but the array will be able to determine each element’s radius. This way you are able to selectively determine each point’s radius with full control.

A solution for your example might look like this:

const options = {
    elements: {
        radius: allPoints.map(point => {
            const maxPoint = Math.max(allPoints)
            // return radius 0 for every point that is not the max and radius 1 (or bigger if needed) for the maximum point 
            return point == maxPoint ? 1 : 0
        })
    }
}

Leave a comment