-
-
Notifications
You must be signed in to change notification settings - Fork 372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poor series focus performance with noisy data #787
Comments
thanks for the info. currently on phone but if your attached data looks like the screenshot in the linked issue, then i wonder if it makes sense to offer some kind of median, geomean, or custom fn mode for focus that can do some reduce op on surrounding points of each series and then use that smoothed value to determine cursor proximity. that should be much more stable and reduce redraw bouncing while still maintaining focus highlight. |
i didn't realize there were 100 series here, with most of them concentrated at the bottom 20% of the range. whatever we do to improve this, it will still lag badly when hovering anything below 25k, and may be also not great above 25k, since it will require averaging ~10pts of more on every at some point you need to do something else. e.g. turning a scatter plot with millions of points in an aggregated heatmap with 10k cells. some kind of anomaly detection and smoothing would be good here. can you try doing this smoothing in advance? this way you won't have a null-filled ocean, and the series will be smoothed and and aligned enough for the default focus to work better. see ASAP here: https://leeoniya.github.io/uPlot/demos/data-smoothing.html, or you can do it server-side. i'll keep this open just to experiment in the future, but i dont think this will solve this case adequately. original ASAP code: http://www.futuredata.io.s3-website-us-west-2.amazonaws.com/asap/ |
horizon plots are better for things like this. they give you a dedicated, fixed height hover area for each series. https://datavis.blog/2022/04/30/horizon-charts-in-tableau/ could be interesting to do something like this in a uPlot demo. i have a y-shifted demo, which is close but not the same: https://leeoniya.github.io/uPlot/demos/y-shifted-series.html |
I am a fan of horizon plots too and am thinking about how we can incorporate them quite often :-) The problem here is that our project provides a UI for interactive data exploration (in fact, this is its main mode of operation), where users control how much data is shown. We provide an ability to |
Also, I am personally quite agains data smoothing, and consider it to be an antipattern (at least as the default). We do select the aggregation interval based on the plot width (targeting to have 1 value every several pixels), however, so the screenshot above is probably near the worst case of data density. Most plots are much closer to this: |
i dont have a lot of free time this month, so you might need to get your hands dirty and make a PR so we can test it out. maybe add a setting for sampling surrounding values like Lines 513 to 516 in 9b6888c
then update around here to invoke Lines 2485 to 2494 in 9b6888c
|
i added you as a collaborator so you can create new branches that we can both push to. make something like |
Thanks! Unfortunately can't promise right now when I'll be able to find time to dig into this. |
I've made a bit of progress: I am able to reproduce the problem with very little data: only 3 series, 1 of which is very sparse. I am not very proficient with Chrome's profiler, but it shows that almost all the time is spent in "System", with no way to dig into it (?): I've tried the Firefox profiler and it so so much more helpful: Looks like a lot of slow redraw is happening, for some reason. |
it's not a question of how many series, but how many series are overlapping each other, and how much noise and take a look at the last commit in the cursor.focus.value-2 branch. it tries to do a local 20-point average to stabilize the focus proximity. as i expected, it helps, but does not solve this in cases when the series are too densly packed or too noisy, so their local averages alternate. the question was never why or where there was a problem, but how you expect a solution to work with such data. do you have an example in another charting library that works as you expect with the same data? |
Can we avoid the redraw completely for cases where we don't want focused and de-focused series to be styled differently, and only want to update the legend and the overlay with the crosshair and highlighted points closest to the cursor? I think that would be a great compromise between speed and functionality. |
i'll look into adding selective alpha for for series, legend, and hover points. something like |
We have such proprietary library which I want to get rid of. uplot have the closest performance but still have two bottlenecks: focus and resizing. We are doing focus on different canvas |
Following VKCOM/statshouse#134, as promised.
Note that we use a hack/workaround of setting
focus.alpha = 1.1
, this way the plot is not redrawn every time focus changes (which can happen every frame for dense data, and will tank the performance completely). Instead, we simply highligh the focused series in the legend.Here is a self-contained file that reproduces the problem: uplot-focus-perf.zip, using real production data. Hovering over the plot is janky and slow with series focus enabled, and smooth otherwise.
The text was updated successfully, but these errors were encountered: