Search code examples
iosswiftios-charts

Show selectedchartValue in ios-charts


Don't know where to go from here.

I have a function:

func chartValueSelected(chartView: ChartViewBase, entry: ChartDataEntry, dataSetIndex: Int, highlight: ChartHighlight) {
    print("\(entry.value) in \(months[entry.xIndex])")
}

but can't imagine how to show only selected value. How?

Thanks.


Solution

  • there are many ways to do it.

    Take a look at ChartsDemo, click line chart, and there is a chart marker can show it;

    If you want to do it, you can override drawHighlighted method, to draw the text you want.