HumbleSoftware / Flotr2

Graphs and Charts for Canvas in JavaScript.
http://www.humblesoftware.com/flotr2/
MIT License
2.45k stars 528 forks source link

erratic autoscaling #198

Closed jcw closed 3 years ago

jcw commented 11 years ago

When the data is supplied as strings, it looks like automatic scaling something works and sometimes is so far off that nothing is shown in the Y axis. I suspect that it has to do with whether the variation in the data includes a varying number of digits in the string.

My reason for passing strings such as "12.0" instead of 12 as numeric value, is that I'd prefer to see the decimal when showing the value under the mouse cursor, since that is an indication of the measurement precision. It's not a show-stopper, though.

Note that values do get auto-converted to floats, i.e. I'm using the default config for graphs.

See http://jsfiddle.net/jcwippler/TfFkM/ - it scales d1 differently due to the quotes.

cesutherland commented 11 years ago

Interesting. There's got to be a bug where I'm not parsing float correctly. It's also possible I removed this for performance reasons. I'll check into it.

In the mean time, maybe something like this? http://jsfiddle.net/cesutherland/TfFkM/2/

jcw commented 11 years ago

I'm afraid that doesn't fix it - the blue line still runs off the chart.

cesutherland commented 11 years ago

I'm sorry... I didn't remove the string values. The change was 2 parts:

  1. use numeric data values
  2. use a custom track formatter to display data as you wish

http://jsfiddle.net/cesutherland/TfFkM/3/

jcw commented 11 years ago

Ok, thanks - that's what I'm doing now. Just wanted to flag the issue that string input doesn't work 100% with autoscaling (just that bit - the graph is fine), even with the default parse-to-float setting.