The Pie and Radar chart deselected is not work
- Dominant language
- Swift
- Stars
- 28k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
First Change Code:
```PieRadarChartViewBase.swift```
```
@objc private func tapGestureRecognized(_ recognizer: NSUITapGestureRecognizer)
{
if recognizer.state == NSUIGestureRecognizerState.ended
{
if !isHighLightPerTapEnabled { return }
let h = getHighlightByTouchPoint(recognizer.location(in: self))
//we need use the lastHighlighted property
if h === nil || h == self.lastHighlighted
{
lastHighlighted = nil
highlightValue(nil, callDelegate: true)
}
else
{
lastHighlighted = h
highlightValue(h, callDelegate: true)
}
}
}
```
The second change
```ChartViewBase.swift```
```
/// Highlights the value selected by touch gesture.
@objc open func highlightValue(_ highlight: Highlight?, callDelegate: Bool)
{
var high = highlight
guard
let h = high,
let entry = data?.entry(for: h)
else
{
high = nil
highlighted.removeAll(keepingCapacity: false)
//if the high is nil, need reload the chart view
setNeedsDisplay()
if callDelegate
{
delegate?.chartValueNothingSelected?(self)
}
return
}
// set the indices to highlight
highlighted = [h]
if callDelegate
{
// notify the listener
delegate?.chartValueSelected?(self, entry: entry, highlight: h)
}
// redraw the chart
setNeedsDisplay()
}
```
Contributor guide
Research direction
Start by reading the tap handler in PieRadarChartViewBase.swift and highlightValue in ChartViewBase.swift, focusing on how a repeated or missing highlight is handled. Verify that deselecting a pie or radar value clears the highlight, notifies the delegate, and redraws the chart without affecting selection of another value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100