ripper234
ripper234

Reputation: 230376

Getting HighCharts to show fewer data points

I'm plotting a chart where the x axis is a datetime. My data contains lots of sample from each day, and the resulting chart is jittery.

Is there an easy way to get highcharts to only display 1 or 2 datapoints from each day, to make the chart smoother?

http://jsfiddle.net/RjPRd/72/

var data = [[1354282654000,13],[1354285785000,13],[1354289387000,14],[1354292990000,15],[1354296592000,13],[1354419090000,20],[1354422692000,21],[1354426295000,20],[1354435425000,19],[1354438087000,19],[1354538087000,24]];

var options = {
    chart: { renderTo: 'graph' },
    xAxis: { type: 'datetime' },
    series: [{data: data}]
};

var chart = new Highcharts.Chart(options);
​

Upvotes: 2

Views: 2797

Answers (1)

wergeld
wergeld

Reputation: 14462

If you are asking if HighCharts can do interpolation/projections then the answer is no. What you can do is pre-process your data or use HighStock with dataGrouping. Here is a very basic example.

This is the code that does it:

plotOptions: {
    series: {
        dataGrouping: {
            approximation: 'average', //default
            units: [[
                'day',
                [1]
                ]]
        }
    }

Upvotes: 4

Related Questions