Skip to content

Demo project to show a bug where Swift Charts highlighting doesn't work

Notifications You must be signed in to change notification settings

gavynriebau/DemoChartsBug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Charts - Highlighting Selection Bug

Actions Taken

  • Run the app on simulator iPad Air (4th Generation) 14.4
  • Tap various points along the chart

Expected Result

  • The entry closest to the tap point should be highlighted

Actual Result

  • The majority of the time no entry is highlighted even after tapping all around the chart
  • Rarely an entry actually is highlighted but given hightlighting fails the majority of the time the overall behavior is very poor

The Chart

Figure 1: The chart that is rendered when this project is run


Technical Details

Figure 2 shows a stack trace which highlights the problem area.

This stack trace was generated by tapping a point just after the 5th chart entry.

In the debug window it can be seen that the variable i is set to 11 indicating the partitionIndex func did not correctly find the index of the first item that matches the predicate on line 199.

Given the argument xValue having value 6 the expected return for i should be 6.

The values contained within the ChartDataSet, along with their indexes, are printed in the bottom right of figure 2.

The overall result is that the entriesForXValue func returns an empty array and the chart highlighting / selection fails for that tap.

Stack

Figure 2: Call stack showing where filtering goes wrong

About

Demo project to show a bug where Swift Charts highlighting doesn't work

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages