imaNNeo / imaNNeo/fl_chart

Exception: indicatorsData and touchedSpotOffsets size should be same. need help pls.

Open
#1,601 3 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

Getting Exception: indicatorsData and touchedSpotOffsets size should be same.
here's my code:

return MaterialApp(
home: Scaffold(
backgroundColor: Color(0xFFF0F2F6),
body: Center(
child: Container(
padding: const EdgeInsets.all(10),
width: double.infinity,
height: 200,
child: LineChart(
// curve: Curves.easeInCubic,
LineChartData(
lineTouchData: LineTouchData(
getTouchLineEnd: (barData, spotIndex) =>
barData.spots[spotIndex].y + 1000000,
getTouchLineStart: (barData, spotIndex) => 0,
getTouchedSpotIndicator: (barData, spotIndexes) => [
TouchedSpotIndicatorData(
FlLine(
dashArray: [4, 4],
color: Colors.grey,
),
FlDotData())
],
touchTooltipData: LineTouchTooltipData(
maxContentWidth: 150,
tooltipRoundedRadius: 8,
fitInsideHorizontally: true,
fitInsideVertically: true,
tooltipBgColor: Colors.white,
getTooltipItems: (touchedSpots) {
return [
LineTooltipItem(
'May 9, 2023',
TextStyle(
color: Colors.grey,
fontSize: 10,
fontWeight: FontWeight.w400),
children: [
TextSpan(text: '\nBalance'),
TextSpan(
text:
"\nRs. ${touchedSpots[0].y.toString()}",
style: TextStyle(
color: Colors.black,
fontSize: 12,
fontWeight: FontWeight.w500))
]),
];
},
)),
titlesData: FlTitlesData(show: false),
gridData: FlGridData(show: false),
borderData: FlBorderData(show: false),
lineBarsData: [
LineChartBarData(
// preventCurveOverShooting: true,
dotData: FlDotData(show: false),
isCurved: true,
color: Color(0xff0B72EB),
spots: data,
)
]),
),
),
),
),
);

Contributor guide

Open the contributing guide

Research direction

Start with the LineChart configuration in issue #1601, especially getTouchedSpotIndicator and the single TouchedSpotIndicatorData returned for spotIndexes. Reproduce the reported exception with the provided data and configuration, then trace the chart's touched-spot indicator handling. Done means the mismatch is understood and the report has a verified fix or clarified usage guidance.

Written by the indexing model from the issue text.

Assessment

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