sk2212
sk2212

Reputation: 1722

Highcharts plotBands do not work with setExtremes function

I am using latest Highcharts version (3.0) and I have a problem with using plotBands and setExtremes() function.

 chart: {
      renderTo: "chart01",
      defaultSeriesType: 'line',
      zoomType: 'x',
      events: {
          load: function(event) {
              this.xAxis[0].setExtremes(myStartDate, myEndDate);
              this.yAxis[0].setExtremes(0,largest);
          }
      }
    }

When using this, Highcharts does not display defined plotBands. If I comment out the two setExtremes functions the plotBands are displayed (red color spaces).

See following (working) fiddle example: http://jsfiddle.net/J8jKQ/

See following (not working) fiddle example: http://jsfiddle.net/J8jKQ/1/

Whats the problem here? Did the setExtremes functions remove the plotBand infos?

Upvotes: 0

Views: 823

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

To set extremes I advice using min and max for axis. That's why this exists, see: http://jsfiddle.net/J8jKQ/3/

Second issue is that your dates are Date objects, while should be timestamps:

myStartDate.getTime();
myEndDate.getTime();

And example: http://jsfiddle.net/J8jKQ/4/

Upvotes: 2

Related Questions