maximum: Number

Sets the maximum value permitted on Axis. Values greater than maximum are clipped. maximum also set the upper limit while panning chart.


Default: Automatically Calculated based on the data
Example: 100, 350..

Notes
  • If maximum value is not set, it is automatically calculated.
  • While setting maximum, it should be taken care that maximum should be greater than minimum.


var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 axisY:{
   maximum: 150,
 },
 .
 .
});
chart.render();


Try it Yourself by Editing the Code below.

  Also See:    



If you have any questions, please feel free to ask in our forums.Ask Question

Comments 9

  1. Hi,
    What if the difference between my minimum and maximum value is just .01? My graph shows no significant changes. I want to automatically change the points to like .01 to see the significant change in my graph. help please.

  2. Hello, I am trying to display two charts side-by-side. mainChart displays the entire dataset with auto-scaled Y-axis. subChart shows a subset of the data but I would like its Y-axis to have the same scaling that was calculated for the mainChart, like this:

    var mainChart = new CanvasJS.Chart(“container”,
    {
    axisY:{
    // maximum not set (automatic scaling)
    }, },
    });
    mainChart.render();

    var subChart = new CanvasJS.Chart(“container”,
    {…
    },
    });
    subChart.options.axisY.maximum = mainChart.options.axisY.maximum,
    subChart.render();

    But mainChart.options.axisY.maximum is not defined. Is there another way to retrieve the axis range that was calculated?

    • Phil,
      It is not possible to set the axis maximum from one chart to another chart directly. As a workaround you can calculate the maximum of Y-axis data and then assign the axisY maximum for both the charts using
      chart1.options.axisY.maximum = chart2.options.axisY.maximum = maxValue(chart1.options.data[0].dataPoints);

      Here is an example that will help you.

If you have any questions, please feel free to ask in our forums. Ask Question