-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Can't set ChartViewBase's data property back to nil to clear out data #771
Comments
ospr
added a commit
to ospr/ios-charts
that referenced
this issue
Feb 23, 2016
Changed ChartViewBase's _data property declaration from _data! to _data? to allow for setting the chart's data back to nil. Updated the code base to property handle _data as an optional value.
ospr
added a commit
to ospr/ios-charts
that referenced
this issue
Feb 23, 2016
Changed ChartViewBase's _data property declaration from _data! to _data? to allow for setting the chart's data back to nil. Updated the code base to property handle _data as an optional value.
ospr
added a commit
to ospr/ios-charts
that referenced
this issue
Feb 28, 2016
Added a "Toggle Data" option to each of the view controllers in the charts demo project. This option will either set the chart's data property to nil if toggled off or to the default data if toggled on.
danielgindi
added a commit
that referenced
this issue
Feb 28, 2016
Make ChartViewBase's _data optional. (Fixes #771)
danielgindi
added a commit
that referenced
this issue
Feb 28, 2016
Add "Toggle Data" option to demo charts. (#771 Support)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ChartViewBase
's_data
property is defined as an implicitly unwrapped optional when really it should be a plain optional. The value starts off as nil, but then once it has been set you can no longer set it back to nil to clear out the data in the graph. By making the_data
property optional that will allow for clearing the chart data (which will allow thenoDataText
to be shown again) and will make use of_data
safer because its not implicitly unwrapped (eg could cause a runtime error if the property is nil and is accessed).Right now this code exists to prevent you from setting the
_data
property back to nil.Note that if
_data
is changed fromdata!
todata?
that we'll need to handle all of the optional cases properly throughout the code base.The text was updated successfully, but these errors were encountered: