joewalnes / smoothie

Smoothie Charts: smooooooth JavaScript charts for realtime streaming data
http://smoothiecharts.org
Other
2.25k stars 234 forks source link

TimeSeries chops off data if client width is 0 #13

Open joewalnes opened 12 years ago

joewalnes commented 12 years ago

(Reported by Rob Knapp)

I just discovered something about smoothie charts that I wanted to point out.

In render, you chop off the TimeSeries data based on age. If it happend more than the clientWidth*MillisPerPixel millis ago, it gets dropped.

At least on Chrome, the clientWidth of a canvas can be 0 under some circumstances.

For example, I have some smoothie charts on a JQuery tab. If I move to a different tab, the clientWidth goes to zero and all the data gets chopped off.

I've gotten around this by adding dimension.width>0 as a condition on the while loop that culls the data... but I'm sure there is a better solution... perhaps an option that grabs the dimension array once and reuses it?

jimux commented 10 years ago

I've also run into this problem when displaying graphs in jQuery tabs.

DmitryEfimenko commented 8 years ago

+1 Looks like the library is not maintained. Last commit two years ago. Would anyone even be able to perform a PR merge if there was one?

drewnoakes commented 8 years ago

Yes, PRs are reviewed and merged. How would your proposed solution work?

On 2 September 2016 at 00:27, Dmitry A. Efimenko notifications@github.com wrote:

+1 Looks like the library is not maintained. Last commit two years ago. Would anyone even be able to perform a PR merge if there was one?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/joewalnes/smoothie/issues/13#issuecomment-244242601, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVa41RTr3OZK5gB1rWR83U3n4M80lOHks5ql19sgaJpZM4CkIH0 .

DmitryEfimenko commented 8 years ago

I don't have a proposed solution for this yet. Similar thing happens if you apply display: none to the chart. For the moment I just apply position: absolute; top: -1000px but that has its own issues.

On the topic of PRs... what about existing PRs? PR for tooltips and LineDash seem legit. I didn't look at others.

DmitryEfimenko commented 8 years ago

it appears that the chart option maxDataSetLength can help with retaining data even after chart's width is changed to 0. Set it to something high. However, this might lead to performance issue