1

I am using highcharts gantt for one of my requirement. I am trying to figure out how scroll position can be at the start of the chart. Later it can be scrolled to the end.

For demo purpose, I created a fiddle https://jsfiddle.net/jon_a_nygaard/t0bjo6dq/

  scrollbar: {
  enabled: true
  },

I will try to explain with an image.I want this scroll to be on left

This can be a general case for any highcharts chart.

I tried setExtremes, but the way chart loaded is different with this.

Please help. Thanks

srikanth_k
  • 2,807
  • 3
  • 16
  • 18
  • Would you like to achieve something like is done in this demo? https://jsfiddle.net/BlackLabel/3uw621L4/ – Sebastian Wędzel Jan 21 '21 at 18:45
  • https://jsfiddle.net/0ugsewhd/ you can see scroll to be on right in this demo of yours. I want scroll to be on the left, if chart is loaded – srikanth_k Jan 22 '21 at 03:56

1 Answers1

0

According to the comments - thanks for the clarification! Try to setExtremes at xAxis in this way:

  chart: {
    events: {
      load: function() {
                const chart = this,
                            series = chart.series,
                            min = series[series.length -1].processedXData[0],
                            max = min + 60 * 60 * 24 * 175 * 1000; //half year
                
                chart.xAxis[0].setExtremes(min, max)
      }
    }
  },

Demo: https://jsfiddle.net/BlackLabel/qLrjtuwh/

API: https://api.highcharts.com/class-reference/Highcharts.Axis#setExtremes

Sebastian Wędzel
  • 11,417
  • 1
  • 6
  • 16