Skip to content
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

Distinguish LineGraph callback. #1448

Closed
anishparajuli555 opened this issue Sep 15, 2016 · 3 comments
Closed

Distinguish LineGraph callback. #1448

anishparajuli555 opened this issue Sep 15, 2016 · 3 comments

Comments

@anishparajuli555
Copy link

i have a CombinedChartView with multiple linegraphs and a scatter graph.

 let data: CombinedChartData = CombinedChartData(xVals: xAxisdateTimeArr)
 data.lineData = self.setLineData(foreCastData,highlightTime: highlightTime)
 data.scatterData = self.getScatterData(foreCastData,highlightTime: highlightTime)
 chartView.data = data

DataSource for line graph is as below

  func setLineData() ->LineChartData{
          ..........
        var dataSets : [LineChartDataSet] = [LineChartDataSet]()
        dataSets.append(set1)
        dataSets.append(set2)
        dataSets.append(set3)
        let data: LineChartData = LineChartData(xVals: xAxisdateTimeArr, dataSets: dataSets)
        return data
    }

I need to show a popup only when 1st line graph is selected.
But the delegate method is called for each line graph in chartView.
func chartValueSelected(chartView: ChartViewBase, entry: ChartDataEntry, dataSetIndex: Int, highlight: ChartHighlight){}

how do i distinguish the callback of a line graph?

@liuxuan30
Copy link
Member

it tells you which entry and dataSetIndex and highlight, I think it's enough

@danielgindi
Copy link
Collaborator

It tells you exactly what you need for that, as @liuxuan30 said

@iArsalanshah
Copy link

i handled delegate using below condition
if let data = chartView.data, data.isKind(of: PieChartData.self) { ... }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants