stimpyjcat
Posts: 8
Joined: Thu Nov 23, 2017 5:55 am

How to change a single category on x axis

Tue Feb 13, 2018 1:41 am

...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

daniel_s
Posts: 737
Joined: Fri Sep 01, 2017 11:01 am

Re: How to change a single category on x axis

Tue Feb 13, 2018 12:24 pm

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!
Daniel Studencki,
Highcharts Developer

Return to “Highcharts Cloud”