Skip to content
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

LiveChartsCore.SkiaSharpView.Avalonia 2.0.0-beta.800-11.0.0-rc1.1 freezes #1076

Closed
Developer-Alexander opened this issue Jun 19, 2023 · 7 comments
Labels
bug Something isn't working has workaround

Comments

@Developer-Alexander
Copy link

Describe the bug
Avalonia app freezes, when you zoom very deeply into chart. It seems to happen only when only a few points are visible or when the visible interval on the x axis is very small.

Additional Info:

  • The source collection of the chart is updated very frequently in the background.
  • The source collection is used as SyncContext.
  • Point type is DateTimePoint.
  • ZoomMode is ZoomAndPanMode.X.
  • LiveChartsCore.SkiaSharpView.Avalonia: 2.0.0-beta.800-11.0.0-rc1.1
  • Avalonia: 11.0.0-rc1.1

To Reproduce
See attached minimal app.
ChartTest_freeze.zip

Expected behavior
The app should not freeze.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
@Developer-Alexander
Copy link
Author

This is a real blocker for me. I would be thankful for any feedback.

@beto-rodriguez
Copy link
Owner

Thanks for the project.

The app is not freezing for me, it gets sluggish when you have around 20k points.

This is the expected behavior, you can remove the points that you do not longer need, you could also compute your data before adding it to reduce the number of points, or you could wait for the official release of the high-performance package, I mean in general the performance seems nice, about 20k points, we can zoom in/out but to get more performance you need to run a virtualization algorithm, for more info see: https://github.com/beto-rodriguez/LiveCharts2/releases/tag/v2.0.0-beta.350

Am I missing something?

@beto-rodriguez beto-rodriguez added the not verified It is probably an issue, but we have not enough evidence to mark this as a bug. label Jul 11, 2023
@beto-rodriguez
Copy link
Owner

beto-rodriguez commented Jul 11, 2023

Never mind, I got the issue.

This happens because when you zoom so deep then the double type has not enough precision to handle the current range, the axis is for sure stuck at an infinite loop.

I think I can fix this internally, while this is fixed you can set a limit in the axis zoom, for example in this case I force the zoom to stop at 1ms:

        XAxes = new Axis[]
        {
            new Axis
            {
                MinZoomDelta = TimeSpan.FromMilliseconds(1).Ticks,
            }
        };

@beto-rodriguez beto-rodriguez added bug Something isn't working has workaround and removed not verified It is probably an issue, but we have not enough evidence to mark this as a bug. labels Jul 11, 2023
beto-rodriguez added a commit that referenced this issue Jul 11, 2023
@beto-rodriguez
Copy link
Owner

For now there is just a warning, in the next versions of the library, we will throw when we detect this issue, A possible solution is to set the MinZoomDelta to a significant value depending on the case.

In cases where setting where MinZoomDelta is not enough (because the chart has values that the double precision can't handle) you could try to scale your chart using mappers similar to what we do in the Logarithms example.

@Developer-Alexander feel free to reply or reopen the issue if the issue persists.

@Developer-Alexander
Copy link
Author

When will the internal fix be available?

Limiting MinZoomDelta is no valif workaround for me as I don't know the value at compile time.

@beto-rodriguez beto-rodriguez reopened this Sep 6, 2023
@beto-rodriguez
Copy link
Owner

The referenced commit fixes this, I think it is a smart way to prevent this issue, in the next version of the library, setting a min limit will not be a requirement.

@jpgarza93
Copy link

jpgarza93 commented Feb 27, 2024

I am getting the same error:

  • I have my CartesianChart ZoomMode set to NONE.
  • I have no more than 15 points at a time, 1 gets added every 500ms and 1 gets removed. I use an observablecollection for the values.
<lvc:CartesianChart
           AnimationsSpeed="0"
           AutoUpdateEnabled="True"
           EasingFunction="{x:Null}"
           Series="{Binding PositionSeries}"
           XAxes="{Binding XAxes}"
           YAxes="{Binding YAxes}"
           ZoomMode="None" />

Any tips on how to debug the number of separators that are being created?

More importantly, if my data range changes all of a sudden because units are changed in the application, how can i deal with this? Users in my app often change units and i am seeing this error arise. and Even though I only change 15 points at a time, when the user changes units the next point will have a new range far from previous point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has workaround
Projects
None yet
Development

No branches or pull requests

3 participants