sgm
sgm

Reputation: 101

How to specify specific tick positions for highcharts when loading dynamic data?

I am building a small multiples line charts in Highcharts. I am dynamically pulling in data from google sheets. The y axis ticks marks vary and I would like to set them to go from -8 to 8 (a client request).

I have tried tickPositions: [-8, -6, -4, -2, 0, 2, 4, 6, 8], various tickFormatter functions, nothing seems to work. The data I am pulling in seems to overrride everything I try to do.

How do I set my own start and end tick positions in highcharts? or better yet how do I set specific ticks on the y-axis in highcharts?

Upvotes: 1

Views: 760

Answers (1)

Sebastian Wędzel
Sebastian Wędzel

Reputation: 11633

You should be able to achieve it by using the min, max and TickAmount features.

Demo: https://jsfiddle.net/BlackLabel/bej8o7gn/

yAxis: {
    min: -8,
    max: 8,
    tickAmount: 9
},

API: https://api.highcharts.com/highcharts/yAxis.min

API: https://api.highcharts.com/highcharts/yAxis.tickAmount

If this config wouldn't help please reproduce your case on some online editor with the sample of your data.

Upvotes: 1

Related Questions