Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am working with the synchronised chart of Highchart. Pretty cool. However, I would like to »dictate« the min and max values for the yAxis. I added these two parameters into the JSON file, but they are not being accepted unfortunately.

JSON file:

    "unit": "km/h",
    "type": "line",
    "min": -2,
    "max": 16,

yAxis definition:

     yAxis: {
        title: {
           text: null
        min: dataset.min,
        max: dataset.max

but that doesn't work. Any idea why? Here is the original graphic I am working with. Here is a fiddle.

As a solution disable startOnTick and endOnTick options or use tickPositioner function to calculate and set tick postion manually, for example:

            yAxis: {
                tickPositioner: function(){
                    var ticks = [],
                    step = (dataset.max - dataset.min) / 4;
                  for (var i = dataset.min; i <= dataset.max; i += step) {
                    ticks.push(i);
                  return ticks;

Live demo: https://jsfiddle.net/BlackLabel/ev5hz0pk/

API Reference:

https://api.highcharts.com/highcharts/yAxis.max

https://api.highcharts.com/highcharts/yAxis.tickPositioner

Great. Thanks so much! Just a small thing: It should be »enable StartOnTick and endOnTick« and not »disable«. – luftikus143 Feb 19, 2020 at 6:58

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.