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

Render Crash Due to Rect NAN from rectValueToPixel in BarChartRenderer.swift #177

Closed
ghost opened this issue Jun 27, 2015 · 1 comment
Closed
Labels

Comments

@ghost
Copy link

ghost commented Jun 27, 2015

I'd offer a fix for this but this is my very first look at ios-charts and I've only got about 20 minutes in on this project. With that said, the bug is exposed in the ChartsDemo using the Sinus Bar Chart but reducing the element count to 1 by dragging the control at the bottom of the chart as far to the left as possible.

BarChartRenderer.drawDataSet attempts to pixelize the rect to be drawn on line 124 by calling trans.rectValueToPixel(&barRect). When there is only one element to be drawn, barRect is (-0.3, 0.0, 0.6, 0.0) before the call and (nan, nan, nan, nan) after the call. Apparently, the affine transform performed in rectValueToPixel does not like something about the incoming rect.

None of the other charts allow less than two elements to be presented so, without some additional futzing, I was unable to see if this bug is manifest for single-element bar charts.

(If I get time, I'll research further.)

@pmairoldi pmairoldi mentioned this issue Jun 28, 2015
danielgindi added a commit that referenced this issue Jun 29, 2015
DBL_MIN is not the minimum... -DBL_MIN is!
And of course we need to also account for a case where we are looping over zero elements.
@danielgindi
Copy link
Collaborator

Fixed! Thanks guys :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant