How to set Highcharts chart maximum yAxis value with JavaScript?

Sometimes, we want to set Highcharts chart maximum yAxis value with JavaScript.

In this article, we’ll look at how to set Highcharts chart maximum yAxis value with JavaScript.

How to set Highcharts chart maximum yAxis value with JavaScript?

To set Highcharts chart maximum yAxis value with JavaScript, we set the yAxis.max property.

For instance, we write

const chart = new Highcharts.Chart({
  chart: {
    renderTo: "container",
  },
  xAxis: {
    categories: [
      "Jan",
      "Feb",
      "Mar",
      "Apr",
      "May",
      "Jun",
      "Jul",
      "Aug",
      "Sep",
      "Oct",
      "Nov",
      "Dec",
    ],
  },
  yAxis: {
    max: 200,
    min: -200,
  },
  series: [
    {
      data: [2, 4, 5, 6, 7, 8, 9, 0, 21, 3, 3, 4],
    },
  ],
});

to set the yAxis.max property to set the max value of the y-axis.

Conclusion

To set Highcharts chart maximum yAxis value with JavaScript, we set the yAxis.max property.