javascript - Highcharts: Custom dataGrouping approximation: dataGroups cropped by chart area -
see example custom approximation provided highcharts: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/stock/plotoptions/series-datagrouping-approximation
datagrouping: { approximation: function () { return this.datagroupinfo.length; }, forced: true },
scroll selection left right.
notice datagroupinfo.length
increases , decreases datagroup
enters , exits chart area. believe due datagroup
being cropped chart area.
i have attempted resolve issue setting cropthreshold
infinity without success (it seems unrelated).
i need create custom approximation not cropped chart area.
to complicate things bit, custom approximation series[0]
, average. in case, result of series[0]
divided series[1]
.
my current attempt following:
http://jsfiddle.net/rbwc217s/
approximation: function(arr) { var numerator = 0, denominator = 0; if (arr.length !== 0) { var start = this.xdata.indexof(this.processedxdata[0]) + this.datagroupinfo.start, slicedarr = this.chart.series[1].ydata.slice(start, start + (arr.length)); (var in arr) { numerator += arr[i]; denominator += slicedarr[i]; }; }; return denominator !== 0 ? math.round((numerator / denominator) * 1000) / 1000 : null; },
it works expected - except on edge of chart area. again, believe due datagroup
being cropped chart area.
any appreciated.
thank you.
Comments
Post a Comment