It is currently Thu Aug 16, 2018 6:38 am Advanced search

How to change a single category on x axis

Support and discussion for cloud.highcharts.com.

How to change a single category on x axis

Postby stimpyjcat » Tue Feb 13, 2018 3: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
stimpyjcat
 
Posts: 8
Joined: Thu Nov 23, 2017 7:55 am

Re: How to change a single category on x axis

Postby daniel_s » Tue Feb 13, 2018 2: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/xAxis.labels.formatter

Best regards!
Daniel Studencki,
Highcharts Developer
daniel_s
 
Posts: 737
Joined: Fri Sep 01, 2017 1:01 pm


Return to Highcharts Cloud

Who is online

Users browsing this forum: No registered users and 0 guests

cron