josejaner / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 1 forks source link

Adding back autoscaleSkipPointsOutside #102

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The attached patch adds back the autoscaleSkipPointsOutside option that was
in SVN a little while ago, with a couple of adjustments.

The basic algorithm is the same - when calculating datamin and datamax, it
discards points that lie outside the range for the given axis.

However, it now searches for lines that would cross the minimum/maximum and
interpolates the relevant value. For instance, if xaxis.min == 5, and we
have two consecutive points [4, 0], [6, 20], we consider the pseudo-point
[5, 10] when finding datamin/datamax for y.

I've only tested this on simple examples with ordered data, and only with
line charts, so other testing is needed. 

Original issue reported on code.google.com by mikerwil...@yahoo.co.uk on 13 Jan 2009 at 10:52

Attachments:

GoogleCodeExporter commented 8 years ago
Oh, I forgot to mention - the code I've written is full of duplication, so 
ideas on
how to get rid of that duplication are highly appreciated.

Original comment by mikerwil...@yahoo.co.uk on 13 Jan 2009 at 10:54

GoogleCodeExporter commented 8 years ago
Here's a refactored patch, it should still do the same thing.

Original comment by mikerwil...@yahoo.co.uk on 14 Jan 2009 at 12:41

Attachments:

GoogleCodeExporter commented 8 years ago
It's great that you're working on this!

I was thinking myself that it would be easier to solve this by preprocessing 
the data
(removing the outside points except the closest ones), but now I'm not sure. 
I'll see
if I can give your patch a spin later today.

I'm a little bit worried about performance. The inner loop is one of the places 
where
the algorithm is O(n) in the number of data points. I think it's dwarfed by the
actual drawing code. But I'd like to be sure. :)

If it turns out fine, we might be able to reuse the little utility functions to
improve readability of the clipping code for drawing lines. It's terribly 
complicated
right now. But there's another patch on the mailing list for making line 
drawing more
generic that I need to look at before that could happen.

Original comment by olau%iol...@gtempaccount.com on 14 Jan 2009 at 1:05

GoogleCodeExporter commented 8 years ago
I did consider doing preprocessing, but I decided against it because using the
closest point may cause too large a scale.

For instance, say all the points in the given range have a maximum y value of 
10, and
the next point after x-max has a y value of 100. We don't want to scale the 
y-axis up
to 100 - we only want it to go up to whatever the y value is at x-max.

If I get time, I'll see if I can do some more testing to see if performance is
affected much.

Original comment by mikerwil...@yahoo.co.uk on 14 Jan 2009 at 1:50

GoogleCodeExporter commented 8 years ago

Original comment by dnsch...@gmail.com on 8 May 2012 at 8:57

GoogleCodeExporter commented 8 years ago
Can anybody re-issue the patch for the current version of flot? or at least 
give information for which version this patch was intended? I would download 
and use that version of a program instead of the latest version. 

Unfortunately for me this software is USELESS without proper autoscaling of 
graphs and it is completetly weird for me that this software lacks such a basic 
thing. 

Original comment by dama...@gmail.com on 5 Oct 2014 at 9:46