using highstock chart sorted time serie: [[timestamp, value], ...]
the datasource sampled @ irregular intervals. result distances between 2 points (in time axis) varies.
if 2 adjacent points separated more 5 minutes want show gap in chart.
using gapsize
option doesn't work, because doesn't allows specify 'size' of gap function of time.
showing gaps part of highstock, need way specify fixed amount of time (5 minutes). ideas?
btw, beside plot works great.
here's unclean way "manipulate" gapsize
work it's value amount of milliseconds required create gap.
(function (h) { // wrap getsegments change gapsize functionality work based on time (milliseconds) h.wrap(h.series.prototype, 'getsegments', function (proceed) { var cpr = this.xaxis.closestpointrange; this.xaxis.closestpointrange = 1; proceed.apply(this, array.prototype.slice.call(arguments, 1)); this.xaxis.closestpointrange = cpr; }); }(highcharts));
this utilizes gapsize
used within getsegments
function (see source), , works based on closestpointrange
of axis. wraps getsegments
, sets closestpointrange
1
, calls original method , resets closestpointrange
original value.
with code above gaps 5 minutes this:
plotoptions: { line: { gapsize: 300000 // 5 minutes in milliseconds } }
see this jsfiddle demonstration of how may work.
Comments
Post a Comment