imaNNeo / imaNNeo/fl_chart

[BarGraph] | Flickers when hover using `touchCallback` and `touchedIndex` concept

Open
#1,849 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
7.6k
Forks
2k
Avg merge
9d 1h
Merged PRs (30d)
2

Description

** Don't make a duplicate issue.
You can search in issues to make sure there isn't any already opened issue with your concern.
Yup, there were few old issues that got closed but now it's happening again. (Close Issue #676)

**Describe the bug**
Implemented the BarGraph and when implementing a hovering concept via `touchCallBack` and use of `touchedIndex` to change the colors, the graph starts flickers. As per previous closed issue #676 it was issue with PieChart, so maybe now its occurring with BarGraph too.

**To Reproduce**
- Install latest version: `0.70.2` (Because I need the `rotationQuarterTurns` param)
- Utilize the below code as example

```dart
touchCallback: (event, touch) {
setState(() {
if (!event.isInterestedForInteractions ||
touch == null ||
touch.spot == null) {
touchedIndex = -1;
return;
}
touchedIndex = touch.spot!.touchedBarGroupIndex;
});
}),
```

- Now hover over any rod and it will flicker. (See recording below)

**Screenshots**
https://github.com/user-attachments/assets/aa913d6b-250d-4e65-a397-7909cd81aa64

**Versions**
- which version of the Flutter are you using? `0.3.27`
- which version of the FlChart are you using? `0.70.2`

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue in a BarGraph using the reported touchCallback and touchedIndex pattern on fl_chart 0.70.2, then compare the hover behavior with the related PieChart issue #676. Trace the BarGraph touch and color-update path; done means hovering a rod no longer flickers while touchedIndex-based coloring still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.