imaNNeo / imaNNeo/fl_chart

Line Chart Overlap and Repeat Points by Loading Data from Future

Open
#986 11 comments 0 reactions 0 assignees View on GitHub
Line Chart Needs Reproducible Code
Dominant language
Dart
Stars
7.6k
Forks
2k
Avg merge
9d 1h
Merged PRs (30d)
2

Description

Hello, I have a problem the chart repeats itself and overlaps random by Hot Reload my App

here you can see what i mean
https://imgur.com/a/xGct2NN

I load Data from Sqflite and add to my list, here is my Code

```
builder() {
return FutureBuilder>(
future: myFuture,
builder: (context, snapshot) {
return snapshot.hasData
? ListView.builder(
shrinkWrap: true,
itemCount: snapshot.data!.length,
itemBuilder: (BuildContext context, int i) {
return adder(
snapshot.data![i],
snapshot.data!.length,
);
},
)
: const SizedBox.shrink();
});
}
```
```
adder(Note note, int index) {
double steps = 12 / (index - 1);

mySpots.add(FlSpot(points, note.value));
points = points + steps;

return const SizedBox.shrink();
}
```

```
════════ Exception caught by rendering library ═════════════════════════════════
LateInitializationError: Field 'mostLeftSpot' has not been initialized.
The relevant error-causing widget was
LineChart
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the LineChart error using the provided FutureBuilder, Sqflite-loaded data, and mySpots accumulation. Inspect how the chart receives repeated points and determine whether the failure is in the example usage or the fl_chart LineChart; done means identifying a reproducible cause and a verified correction.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
data-visualization, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.