2017-01-15 6 views
0

dataGroupingを有効にしたハイストック列の範囲が正しくdataAggregationを計算していないようです。highstock列範囲のデータグループ値に一貫性がありません

範囲を変更すると、集計値が変化するようです。 2014年3月には、右方向にスクロールすると異なる値が表示されます。 issue highlighted

コードとjsfiddle:

dataGrouping: { 
      enabled: true, 
      approximation: function() { 
      const indices = _.range(this.dataGroupInfo.start, this.dataGroupInfo.start + this.dataGroupInfo.length); 
      const low = _.min(indices.map(i => this.options.data[i][1])); 
      const high = _.max(indices.map(i => this.options.data[i][2])); 

      return [low, high]; 
      }, 
      groupPixelWidth: 50 
     } 

は列がナビゲーターをbegginingから起動しない場合にのみ、変更されたjsfiddle

答えて

1

を参照してください - との方法は、あなたが近似コールバックを定義したので、それが起こります。

dataGroupInfoが見える点に係る情報を含むグラフにおける(x軸の範囲に分類される、ポイントをトリミング)、全ての点ではない - ので、初期データのための適切なインデックスを持っている、あなたがthis.cropStartを追加する必要がある - それは点が目に見えるインデックス。

approximation: function() { 
       const start = this.cropStart + this.dataGroupInfo.start; 
       const stop = start + this.dataGroupInfo.length; 

       const indices = _.range(start, stop); 
       const low = _.min(indices.map(i => this.options.data[i][1])); 
       const high = _.max(indices.map(i => this.options.data[i][2])); 

       return [ low, high ]; 
       }, 

例:https://jsfiddle.net/12o4e84v/8/

それとももっと簡単:

approximation: 'range', 

は、同じ機能を簡単に

approximation: function(low, high) { 
    return [ _.min(low), _.max(high) ]; 
} 

例を実装することができます3210

しかし、デフォルトで列の近似はrangeに設定されているため、手動で行う必要はありません。

例:https://jsfiddle.net/12o4e84v/9/

関連する問題