Categories
JavaScript Answers

How to set Highcharts chart maximum yAxis value with JavaScript?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *