user2318307
user2318307

Reputation:

How to show/hide labels customizely in highcharts

I have drawn a graph using highcharts.js library. I want the xAxis a little bit customized. I want to show labels in xAxis but I want to show and hide alternate lables. I mean I want to show labels like 1,3,5 etc. Number 2.4.6 will be drawn but just the label won't be shown for this.

Upvotes: 0

Views: 616

Answers (2)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

You can also set tickInterval as 2.

Upvotes: 1

Gopinagh.R
Gopinagh.R

Reputation: 4916

You have an option called step in the x-axis label property, To show only every n th label on the axis, set the step to n.

In your case, Setting the step to 2 (just like below) shows every other label.

xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr'],
            labels: {
                step: 2
            }
        }

Find an example here and help yourself with the API here.

Upvotes: 0

Related Questions