Using Highstock to chart a sorted time serie: [[timestamp, value], ...]
The datasource is sampled at irregular intervals. As result the distances between two points (in the time axis) varies.
If two adjacent points are separated for more than 5 minutes I want to show a gap in the chart.
Using the gapSize
option doesn't work, because it doesn't allows to specify the 'size' of the gap as a function of time.
Showing gaps is already a part of Highstock, I just need a way to specify it as a fixed amount of time (5 minutes). Ideas?
Btw, beside that the plot works great.
Halvor Strand function wrapper did not work for me as long as getSegments is not part of highstock source code anymore to calculate that gap. Anyway, you can find an approximation to solve the problem combining this other topic and the previows answer like this:
setting gapSize in plotOptions to the desired size (in ms) like Halvor said:
Here's a slightly unclean way to "manipulate"
gapSize
to work so that it's value is the amount of milliseconds required to create a gap.This utilizes that
gapSize
is only used within thegetSegments
function (see source), and it works based on theclosestPointRange
of the axis. It wraps thegetSegments
, setsclosestPointRange
to1
, calls the original method and then resetsclosestPointRange
to its original value.With the code above you could do gaps for 5 minutes like this:
See this JSFiddle demonstration of how it may work.