Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing color of specific chartjs point

Tags:

chart.js

Is it possible to change specific point color with dx chartjs? I know how to change point colors for the whole series, but I can't find anything on changing specific points.

like image 665
Anri Avatar asked Nov 01 '22 20:11

Anri


1 Answers

You can use

customizePoint 

callback.

$("#container").dxChart({
    dataSource: dataSource,
    ...
    customizePoint: function() {
        if(this.value > highAverage) {
            return { color: '#ff4500', hoverStyle: { color: '#ff4500' } };
        } else if(this.value < lowAverage) {
            return { color: '#00ced1', hoverStyle: { color: '#00ced1' } };
        }
    },
    ....
}

});

You can find find documentation and demo

like image 197
Andrey Kuleshov Avatar answered Jan 04 '23 14:01

Andrey Kuleshov