LiveCharts2 icon indicating copy to clipboard operation
LiveCharts2 copied to clipboard

IsVisible = false Axes will inevitably ThrowInfiniteSeparators()

Open BHandle opened this issue 1 year ago • 10 comments

With the rc versions of the library, the new ThrowInfiniteSeparators is being thrown for even simple plots if axes are hidden. This is because _stepCount is modified in Invalidate, but hidden axes never call that, despite having GetBounds called (and thus incrementing through each call to GetPossibleMaxLabelSize)

I have a setup (using WPF hosted WinForms due to https://github.com/beto-rodriguez/LiveCharts2/issues/1237) with a main chart that can zoom and an overview chart (can't zoom, hidden axes), fairly similar to your own example.

I downloaded the source and modified it to print out the current _stepCount at the start of each call that modifies it, and I get the following (stopped when it hit the 10000 and blew up):

GetPossibleMaxLabelSize - 9700 GetPossibleMaxLabelSize - 9970 GetPossibleMaxLabelSize - 9725 GetPossibleMaxLabelSize - 9996

If I make the overview axes visible, Invalidate is called, which clears the count. I think this should be replicable by hiding the axes of any live data chart, but if you're having trouble I can try to replicate with one of the built-in samples.

BHandle avatar Dec 06 '23 19:12 BHandle

I temporarily fixed this by resetting the _stepCount in GetPossibleMaxLabelSize, which is obviously a no-go and defeats the whole point of the check. However, I believe this is the first stack frame the code is entering the Axis class from the GetTick() that is being called. I'm unsure what the correct fix is here, otherwise I would have just submitted a PR.

BHandle avatar Dec 08 '23 04:12 BHandle

Any thing new on this? I am have the same issue.

kendragoni avatar Jan 23 '24 14:01 kendragoni

I'm currently working around it by building the library myself with the following change:

image

It isn't perfect and defeats the point of the check, but it allows me to proceed for now.

BHandle avatar Jan 23 '24 14:01 BHandle

I'm currently working around it by building the library myself with the following change:

image

It isn't perfect and defeats the point of the check, but it allows me to proceed for now.

Do you have some solution? I think I have the same or similar problem too: https://github.com/beto-rodriguez/LiveCharts2/issues/1464

Diddlik avatar Mar 19 '24 19:03 Diddlik

I'm currently working around it by building the library myself with the following change: image It isn't perfect and defeats the point of the check, but it allows me to proceed for now.

Do you have some solution? I think I have the same or similar problem too: #1464

Do you found solution?

Klinkas avatar Apr 16 '24 12:04 Klinkas

No, unfortunately ;(

Diddlik avatar Apr 16 '24 13:04 Diddlik

Only "solution" I have is the change described. By injecting that line into CoreAxis.cs, the count is reset and it avoids the kill condition. Not a perfect solution, but it works around the problem for now.

BHandle avatar Apr 16 '24 17:04 BHandle

that means, I should compile the solution inside if projekt and do not use a package... Ok, hope it will be fixed in the release

Diddlik avatar Apr 16 '24 17:04 Diddlik

I get this error when I try to do the following -> "Add a secondary axis, remove it and add it again"

Klinkas avatar Apr 17 '24 06:04 Klinkas

This fixed it for me: https://github.com/beto-rodriguez/LiveCharts2/issues/1495#issuecomment-2088313998

Hopefully there is soon a new release that ships a fix.

erdmenchen avatar Aug 09 '24 10:08 erdmenchen