Charts icon indicating copy to clipboard operation
Charts copied to clipboard

Crash using highlighted value in combined charts

Open barabashd opened this issue 1 year ago • 1 comments

What did you do?

  1. I created a combined chart with scatter and bar charts.
  2. Highlighted a scatter value.

What did you expect to happen?

No crashes

What happened instead?

App crashes

Reason?

The bar chart will have the same index as the scatter, and instead of highlighting the scatter, it tries to highlight the bar chart.

DGCharts Environment

DGCharts version/Branch/Commit Number: 5.0.0 / master Xcode version: 15.0.1 (15A507) Swift version: 5.9 Platform(s) running DGCharts: Simulator iPhone 15 iOS 17.0.1 macOS version running Xcode: Sonoma 14.0

Demo Project

https://github.com/danielgindi/Charts/assets/24472528/3a53c4e2-25a9-417a-8152-574c82d0e8e4

https://github.com/barabashd/Charts/tree/combined_data_crash_example

barabashd avatar Oct 22 '23 22:10 barabashd

I had a similar array out of bounds crash in a groupedBarChart/LineChart setup. (2 Bars, 1 line) and I ended up creating my own Renderer class inheriting from CombinedChartRenderer and overriding the drawHighlighted() function to only use the default BarChartRenderer.

TKZwo avatar Jan 06 '24 07:01 TKZwo