Page 1 of 1

How to change a single category on x axis

Posted: Tue Feb 13, 2018 1:41 am
by stimpyjcat
...without the categories being incorrectly rendered/recognised. Is there a simple way to do this?

On this chart: https://cloud.highcharts.com/show/HJa31DqLf I'd like the last category "2017" to read "June 2017".

Tried to also put an asterisk "2017*" but that also didn't work.

Thank you

Re: How to change a single category on x axis

Posted: Tue Feb 13, 2018 12:24 pm
by daniel_s
hi stimpyjcat,

You could achieve this effect by adding some code in Custom code field in Customize Chart section of your chart configuration. Please take a look at code below:

Code: Select all

Highcharts.merge(true, options, {
    xAxis: {
    	labels: {
            formatter: function() {
            	return this.value === 2017 ? '2017 June' : this.value 
            }
        }
    }
});
It changes your "2017" label to "2017 June" and only that one.

API Reference: https://api.highcharts.com/highcharts/x ... .formatter

Best regards!