Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flot time series, too many data points

Tags:

flot

I've plotted win rate on a Flot chart here: http://jsfiddle.net/xR66k/

The x-axis displays the week number, but I don't want the points between these ticks (for example between week 37 and 38, and between week 41 and 42) – how can I remove these?

I'm creating the ticks with the following code:

var data = [[1382911200000,7.6805],[1382306400000,27.4607],[1381701600000,13.0376],[1381096800000,-26.3855],[1380492000000,-11.9624],[1379887200000,-5.018],[1379282400000,-11.0009],[1378677600000,50.5376],[1378072800000,0],[1377468000000,0]];

var ticks = [];

for (var i = 0; i < data.length; i++) {
    ticks.push(data[i][0]);
}

Why does Flot plot extra data points?

like image 314
glen-84 Avatar asked Oct 31 '13 09:10

glen-84


1 Answers

As I said in my comment this is a known limitation of the threshold plugin, so, let's work around it. In this fiddle, I've simply created two series one with just points and one with just lines. The "just lines" will get threshold properly without the addition of point markers.

enter image description here

    data = [
        { label: 'Win Rate', data: data, points: {show:false} },
        { label: null, data: data, points: {show:true},  lines: {show:false} }
    ];
like image 199
Mark Avatar answered Jan 02 '23 11:01

Mark