I am using ios-charts in swift language. I need to show more data when clicking on every circle in LineChart. I can only show one value (Y axis - in image : price without dollar sign). Is it possible to implement below image? More values, empty circles, and fill circle when clicking.
Asked
Active
Viewed 3,344 times
3
-
Can you share your code? – DevB2F Oct 17 '17 at 16:58
-
@DevB2F do you need answer? – Amir Shabani Oct 17 '17 at 19:44
1 Answers
9
Yes, you can. Marker can show anything you want as long as you prepare the data. You need to figure out how to pass them into marker. e.g. subclass chart marker and modify draw() to draw your values. ChartDataEntry has an initializer with 3 parameters (x, y, data). You can pass more values in data, when clicking on an item refreshContent from BalloonMarker will call. entry parameter is all of your needs.
open override func refreshContent(entry: ChartDataEntry, highlight: Highlight)
{
setLabel("\(entry.data as! String)\n \(String(entry.y))")
}
Visit BalloonMarker.swift on github

Amir Shabani
- 690
- 2
- 14
- 36
-
is there a tutorial on this anywhere? I went through the official git project and all the charts but couldn't find how to modify this to include extra "data". Thanks for the above answer. Upvoted. – BriOnH Sep 03 '18 at 21:21
-
Thanks a lot. Unfortunately there isn't any tutorial. This library is based on [MPAndroidChart](https://github.com/PhilJay/MPAndroidChart/wiki). You should study it's doc or study the ios library to find understand how it works. – Amir Shabani Sep 04 '18 at 05:40