Aleksander Korovin
Aleksander Korovin

Reputation: 349

Highcharts time range

is it possible to set highcharts to show data only in specific time range, like 2 hours for example, without any zooming.

For example at the beginning i have data for 2 hours from now. And is it possible not to show some points if they do not fit 2 hours from now?

for example, on the highcharts x-axis labels will be always constant like: [12:00, 12:30, 13:00, 13:30, 14-00] even without any data that is related with this time.

And when the new data comes, labels of time shift to new values like: [12:30, 13:00, 13:30, 14:00, 14:30]

I tried to do like:

     this.chart = new Highcharts.Chart({
            chart: {
                reflow: false,
                type: 'line',
                renderTo: newSensor.get('id')
            },
            title: {
                text: newSensor.get('name')
            },
            xAxis: {
                               minRange : 1

                            },
            yAxis: {
                title: {
                    text: 'Values'
                },
                plotLines: [{
                    value: 0,
                    width: 1,
                    color: '#808080'
                }]
            },
            series: dataToChart,
            plotOptions: {
                series: {
                    lineWidth: 1,
                    turboThreshold: 0,
                    threshold: null
                }
            }
        });

But minRange is not right property for this.

Upvotes: 0

Views: 758

Answers (1)

Paweł Fus
Paweł Fus

Reputation: 45079

I think you should set min and max for xAxis. Then, when new point is added (using addPoint() ) you should set new extremes using

chart.xAxis[0].setExtremes( newMin, newMax )

Upvotes: 1

Related Questions