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

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

Open
sid-Dbot opened this issue Mar 6, 2024 · 3 comments

Comments

@sid-Dbot
Copy link

sid-Dbot commented Mar 6, 2024

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,
)
]),
),
),
),
),
);

@iamnabink
Copy link

Flutter version? Package version? Steps to reproduce..? Add more detailed information please

@sid-Dbot
Copy link
Author

fl_chart: ^0.66.2
Flutter 3.19.0
the exception occurs every time the indicator in the chart is moved or intereracted with.

@imaNNeo
Copy link
Owner

imaNNeo commented Apr 15, 2024

Hi, can you please provide us with a reproducible code? (a main.dart file content that runs without any dependency)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants