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

Fixed label drawing bug #740

Closed
wants to merge 1 commit into from

Conversation

leoMehlig
Copy link
Contributor

For some reason the Y-Axis labels where disappearing when no data was
displayed in the LineChart.
This could happen, for example, if all currently visible data entries
where nil.

** I am not that familiar with all this CGContext stuff and find it vey
strange, that not calling a method in one renderer (LineChartRenderer)
has an affect on an other renderer (AxisYRenderer), but maybe someone
can explain and/or find a better solution then this one **

For some reason the Y-Axis labels where disappearing when no data was
displayed in the LineChart.
This could happen, for example, if all currently visible data entries
where nil.

** I am not that familiar with all this CGContext stuff and find it vey
strange, that not calling a method in one renderer (LineChartRenderer)
has an affect on an other renderer (AxisYRenderer), but maybe someone
can explain and/or find a better solution then this one **
@leoMehlig
Copy link
Contributor Author

Turned out this issue was caused by the LineChartsRenders drawLiniar method. This method saved the context but didn't release it when returning from the method earlier because of missing entries.
But I still think this fix is valuable, because bug like this can happen very easily and are hard to detect.

@liuxuan30
Copy link
Member

Is there an issue id to track this? Or screenshot? I don't understand the problem.

@danielgindi
Copy link
Collaborator

Are you sure this fixes anything? Seems like a push/pop for nothing, as we change nothing on the context...

@leoMehlig
Copy link
Contributor Author

It did fix it in my special case, but I think the better fix would be to change the LineChartRenderer. I'll submit a PR for this soon.

The problem is that the LineChartRenderer doesn't restore the context when not displaying any data (only in drawLiniar).

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.

3 participants