faklyasgy
faklyasgy

Reputation: 848

How to enable pop-up for lineChart when chartValueSelected using ios-chart API in Swift?

I started to learn how to use iOS-charts-API from appcoda.com

I create a LineChart and I don't know how to enable a small pop-up, with the value of the selected entry. Here is two example picture what I am trying to implement: https://raw.githubusercontent.com/PhilJay/MPChart/master/screenshots/simpledesign_barchart3.png

linechart entry selected

If I tap on an entry I want to create a popup over it with its value. I implemented chartValueSelected function:

func chartValueSelected(chartView: ChartViewBase, entry: ChartDataEntry, dataSetIndex: Int, highlight: ChartHighlight){
print(entry.value)
print(highlight.xIndex)}

If I run this and tap on an entry, this code is working, so I can see the value on Console, but I think to create a pop-up is a built in function in the API, just I don't know what function should I call or property set.

Upvotes: 0

Views: 2214

Answers (1)

Wingzero
Wingzero

Reputation: 9754

This popup can be implmented by ChartMarker. Check out ChartsDemo's code, there is a BalloonMarker to demonstrate.

You should walk through ChartMarker class to know what can be done, like directly using a UIImage.

Upvotes: 3

Related Questions