Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios-charts: Is it possible to show more values in marker

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.

LineChart that I need

like image 226
Amir Shabani Avatar asked Oct 20 '25 12:10

Amir Shabani


1 Answers

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

like image 96
Amir Shabani Avatar answered Oct 23 '25 04:10

Amir Shabani