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

Added Safe index subscript logic for ChartData #5200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tringbhagya
Copy link

Issue Link 🔗

Crash Issue

  • We face a crash when we attempt to highlight the values for the combined chart.

Implementation Details 🚧

  • Added safe subscript logic.

Steps to Reproduce:

  • Add this code snippet to demo project's CombinedChartViewController class.
func selectHighLights() {
        var highlight: [Highlight] = []
        chartView.data?.dataSets.enumerated().forEach { index, dataSet in
          dataSet.entriesForXValue(0.5).forEach { entry in
            highlight.append(Highlight(x: entry.x, y: entry.y, dataSetIndex: index))
          }
        }
        chartView?.highlightValues(highlight)
    }
      
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        DispatchQueue.main.asyncAfter(deadline: .now() + 2.0, execute: {
          self.selectHighLights()
        })
    }

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

Successfully merging this pull request may close these issues.

1 participant