This is a plugin that implements a different type of autoscaling.

Flot comes with an autoscaler that calculates the maximum y value based on all the the data points.

On graphs that allow multiple series to be shown and hidden, it is useful to autoscale based only on series that are currently visible on the graph.

This plugin simply, loops over all of the datapoints for the series that are visible, finds the maximum value and multiplies it by the autoscale margin.

// limit to visible serie if (series.lines.show || series.points.show) { var max = Number.NEGATIVE_INFINITY; for (var i = 0; i < data.length; i++) { max = Math.max(max, data[i][1]); } max += max * options.yaxis.autoscaleMargin * 10; return Math.max(_max, max); }

Could you please provide an example on how to use this module? I’m new to flot and am having problems figuring this out.

Thank you!

Sure, I have added an example to show how it works.

http://joeloughton.com/blog/testing/flot-plugin-collection/examples/autoscale.html

WOW! Thank you!

Hello from Russia 🙂

Thank you. You helped me a lot. I have half a day trying to do it correctly.

No problem 🙂

Greetings from Russia one more time! Thanks for plugin. Nice job!