Hi, i want to change label color in my chart in mobile, how to convert code below into String (for Highchart), because it always give me an error in ParseJSON.

return '<span style="fill: #ffd500;">' + this.value + '</span>';

Thanks, 

Hi Ervin,


It depends on which Axis Label you want to change color.

In any case, you can find here an example for changing the color on AxisLabel style in HighCharts JSON syntax.


If you're looking for other options, you can also check HighCharts documentation here. They usually have examples for every scenario which are quite useful to understand the syntax and test it (on JSFiddle examples like the one above, you can adapt the JSON and test it immediately using the Run option on the left top corner).


Hope it helps.

Hi Joao,

Sorry for not explain it first, but i want to change every label with different color. i tried to convert it, but it always give me an error. this is the json that i want to convert to Text String 

xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
        labels: {
            formatter: function () {
                if ('Jan' === this.value) {
                    return '<span style="fill: blue;">' + this.value + '</span>';
                } else {
                    return this.value;
                }
            }
        }
    },

It always give me an error in the saying that it was invalid. looks like the error was made by this code 

return '<span style="fill: blue;">' + this.value + '</span>';

This is the converted String that i made. Do i make some mistake?

SyntaxEditor Code Snippet

XAxisJSON: "
    categories: ['Jan', 'Feb', 'Mar', 'Apr'],
    labels: {
            formatter: function () {
        if ('Feb' === this.value) {
            return '<span style=""fill: blue;"">' + this.value + '</span>';
        } else {
         return this.value;
        }
    }
        }"

Thanks

Ervin Winardo Toepak