-
-
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
Cannot pass in struct to ChartDataEntry #954
Comments
well why you want to use struct or tuple for data? you can convert it to Object and move on. |
@liuxuan30 Let's see a example: struct CarSalesHistoryItem {
var profit:Double
var date: NSDate
var numberOfCarsSold:Int
//...
} In the chart, I get a array of CarSalesHistoryItem. I use profit as yAxis value and date as xAxis value. When I tap on a point, I want it to display all the information of that history item. You may say, changing |
yeah, then it's your duty to take care of them. It's very easy for you to sub class the entry class that can take a struct and send back to you, or write an extension to convert between struct and class, or at least you can add a new init method for ChartDataEntry |
Fair enough |
I'm not sure but I believe it might be anyobject for technical reasons. I don't think any translates to objc |
In the class
ChartDataEntry
:The initialiser is
For the third parameter, I can only pass in a class type object. That makes it impossible to pass in a struct or a tuple. So I recommend changing the type or
data
toAny?
The text was updated successfully, but these errors were encountered: