savinger
savinger

Reputation: 6714

Plotting a segment of data with Flot

I'm plotting simple stripcharts with Flot. How might I implement a scrolling window?

jsFiddle

So say in ten minutes time, I have ~1000 data points, but I only want to display the most recent 100. How do I go about doing that? It needs to be nondestructive, because I want to implement a scroll bar so I can scroll through the data, while only seeing 100 data points at a time.

I tried adjusting the xaxis... no good.

// Why doesn't this work?
var options = plot.getOptions();
options.xaxis.min = data[i].length - 100;
options.xaxis.max = data[i].length;

Upvotes: 0

Views: 587

Answers (1)

Mark
Mark

Reputation: 108512

Cool plots.

You are looking for:

    var options = plot.getOptions();
    options.xaxes[0].min = data[i].length - 100;
    options.xaxes[0].max = data[i].length;

Updated fiddle here.

Upvotes: 1

Related Questions