score:2

Accepted answer

i've found the answer!
based in the code from the link i put in the question.

you need the names of the values given in the series. this is my series array right now:

$scope.series = ['low blue', 'blue', 'strong blue'];

we need to add a function to the datalabels.color, and in the function we'll indicate how to color the labels of the ones corresponding to "strong blue":

plugins: {
    datalabels: {
         color: function(context) {
             var index = context.dataindex;
             var value = context.dataset.data[index];

             //inside the "dataset" we look for the "labels" we are using
             //and store them in a variable
             var valuewhite = context.dataset.label;

             //we make the condition: if a value of the label is "strong blue"
             //then we color this label 'white'
             if(valuewhite === 'strong blue') {
                 return value = 'white';
             } else {
                 //if it's any other label, we color it 'black'
                 return value = '#000';
             }
         }
}

this way all the sections with a strong blue as background will have color white, and the rest will be black.


Related Query

More Query from same tag