Search code examples
highcharts

Highcharts Heatmap: Why is the Y axis not respecting limits?


I have the following chart: https://jsfiddle.net/fujigoko/3j9f8mw7/1/

In this chart I am trying to limit the axis to go from September 1st to October 31st:

                      xAxis: {
                        type: 'datetime',
                        min: Date.UTC(2023, 8, 1),
                        max: Date.UTC(2023, 9, 31)
                      },
                      yAxis: {
                        type: 'datetime',
                        min: Date.UTC(2023, 8, 1),
                        max: Date.UTC(2023, 9, 31)
                      },

but the limits are not respected on the Y axis: enter image description here

Is there a way to force it to do so? Thanks!


Solution

  • From Highcharts API:

    min: number, null

    The minimum value of the axis. If null the min value is automatically calculated.

    If the startOnTick option is true (default), the min value might be rounded down.

    ...

    You need to disable startOnTick and endOnTick options.

      yAxis: {
        ...,
        startOnTick: false,
        endOnTick: false
      }
    

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

    API Reference:

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

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