1

I use chart js for make a graph like this,

var myChart = new Chart(ctx, {
                    type: 'line',
                    data: {
                        //labels: new Date(items).toLocaleString(),
                        labels: items,
                        datasets: [{
                            label: 'Total Sale',
                            data: item_val,
                            datasetIndex: 1,
                            //backgroundColor: bgColor,
                            borderColor:'rgba(255,99,132,1)',
                            scaleFontColor: "#000000",
                        }]
                    },
                    options: {
                        scales: {
                            yAxes: [{
                                ticks: {
                                    beginAtZero: true,
                                    stepSize: 10,
                                    autoSkip: false
                                }
                            }],
                            xAxes: [{
                                ticks: {
                                    autoSkip: false
                                }
                            }]
                        },

                    }
                });

and the result is like this,

enter image description here

In the red box that I marked there was a number but colored gray.

The question is how do I change the color of the text that I marked with the red box?

Misdan
  • 149
  • 1
  • 5
  • 15
  • Perhaps the number that you're referring to is the tooltip. If so, you can modify the tooltip colours using the tooltips object. For example Chart.defaults.global.tooltips.mode = 'label'; Chart.defaults.global.tooltips.bodyColor = '#FF0000'; – Michael Whinfrey Aug 05 '19 at 03:02
  • But where do they come from... I tried using chartjs, and your config, and i dont have those points label showing... – François Huppé Aug 05 '19 at 03:13
  • My mistake, I couldn't see the numbers on the lines and thought you were referring to the popup / tooltip. I think it's data point text you're referring to. There already seems to be a post regarding this here https://stackoverflow.com/questions/28159595/chartjs-different-color-per-data-point – Michael Whinfrey Aug 05 '19 at 03:22

0 Answers0