0

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?

4

1 回答 1

2

要设置极端值,我建议使用 min 和 max 作为轴。这就是存在的原因,请参阅:http: //jsfiddle.net/J8jKQ/3/

第二个问题是您的日期是 Date 对象,而应该是时间戳:

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

例如:http: //jsfiddle.net/J8jKQ/4/

于 2013-04-19T10:03:21.897 回答