ChartsOrg / ChartsOrg/Charts

Highlight sync

Open
#2,285 14 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
28k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Please refer to old issue [#1424](https://github.com/danielgindi/Charts/issues/1424)

I am getting the -1 dataIndex problem again with 3.0.1

This is the print out from clicking in the combined chart (upper chart):

> Highlight, x: 2019.0, y: 2371.375, dataIndex (combined charts): 1, dataSetIndex: 0, stackIndex (only stacked barentry): -1

This is the print from highlight when clicking in the (lower) line chart:

> Highlight, x: 1977.0, y: 39.6849736241028, dataIndex (combined charts): -1, dataSetIndex: 0, stackIndex (only stacked barentry): -1

dataIndex for the line chart is -1... =[

Clicking in the line chart then throws a "fatal error: Index out of range"

code is now:

```
func chartValueSelected(_ chartView: ChartViewBase, entry: ChartDataEntry, highlight: Highlight) {

if chartView == combinedChartView {
print(highlight)
lineChartView.highlightValue(highlight)

} else {
print(highlight)
combinedChartView.highlightValue(highlight)
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the combined-chart and line-chart interaction described in the issue, then compare the Highlight values printed by each callback path. Review old issue #1424 for prior context. Done means synchronized highlighting no longer produces an invalid dataIndex or a fatal out-of-range error.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
data-visualization, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.