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

[Fix] 110 Unchecking BeginAtZero Resets Chart #111

Merged
merged 2 commits into from
Jul 22, 2024

Conversation

Conundraah
Copy link
Contributor

  • fixed a bug in Chart.razor.cs

- fixed a bug in Chart.razor.cs
@Conundraah Conundraah linked an issue Jun 20, 2024 that may be closed by this pull request
@Conundraah Conundraah requested a review from Apollo3zehn June 20, 2024 08:10
@Conundraah Conundraah self-assigned this Jun 20, 2024
Copy link
Member

@Apollo3zehn Apollo3zehn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the chart is only re-rendered when BeginAtZero equals true it will not be re-rendered when the user unchecks the checkbox while no zoom is being applied. But in that case (no zoom applied) it must re-render.

So I think it is necessary to check if _zoomBox equals new SKRect(0, 0, 1, 1);. Since it is a struct (= value type), the following should work:

if (_zoomBox == new SKRect(0, 0, 1, 1))

To make it a bit prettier we could define a class variable like private static readonly _defaultZoomBox = new SKRect(0, 0, 1, 1) (or maybe constant instead of static readonly) and then reuse that one in the if (x == y) statement as well as here:

_oldZoomBox = new SKRect(0, 0, 1, 1);
_zoomBox = new SKRect(0, 0, 1, 1);

@Conundraah Conundraah merged commit febdf61 into dev Jul 22, 2024
3 checks passed
@Conundraah Conundraah deleted the 110-unchecking-beginatzero-resets-chart branch July 22, 2024 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unchecking BeginAtZero resets chart
3 participants