Search code examples
javascripthighchartspanning

Panning in Highcharts will not allow to go back to the max of the xAxis


I have a Highcharts chart which uses panning: true and sets min and max on the xAxis to provide the initial view together with historical data in the past as part of the data-series.

Initially panning works fine and I can go back in time, nice. However when I pan back to "now", it only allows to pan back to the last data-point, but not back to max, which is set higher on purpose here as I also have plotLines in the chart.

Relevant parts from the JS as follows, see http://jsfiddle.net/centic/efej646r/

There is a line for "Now" and you can pan to the left, but when you pan back to the right, the plotLine does not appear again.

Is there a way I can get this to work or is it a bug/limitation in highcharts?

    chart: {
        type: 'scatter',
        panning: true
    },

    xAxis: {
        type: 'datetime',
        min: 1417161437595,
        max: 1418435999999,
    ...
    series: [
        {
        marker: {
            enabled: true
        },
        data: [
            { x: 1410444900022, y: 0}, 
            { x: 1410786746435, y: 0}, 
            { x: 1410788673693, y: 0}, 
            { x: 1410945014300, y: 0}, 
            { x: 1410945194162, y: 0}, 
            { x: 1410952366889, y: 0}, 
            { x: 1410954169041, y: 0}, 
            { x: 1410966771659, y: 0}, 
            { x: 1411144973005, y: 0}, 
            { x: 1411371815266, y: 0}, 
            ...

Solution

  • You could add invisible series that will be disabled from mouse tracking. Example: http://jsfiddle.net/efej646r/2/

    Added series:

    {data:[{ x: 1418435999999, y: 0}], color: 'rgba(0,0,0,0)',enableMouseTracking:false}