Closed TeemozZ closed 6 months ago
Hi @TeemozZ ,
We would like to let you know that the reported issue is fixed and rolled out in our patch release. We kindly request you to upgrade the syncfusion_flutter_charts package to the latest version below.
Version: https://pub.dev/packages/syncfusion_flutter_charts/versions/24.1.45+2
Regards, Preethika Selvam.
Hi @PreethikaSelvam,thank you, but there is still a bug in this version. This bug causes multiple RangeAreaSeries to stack together when using DateTimeCategoryAxis, and they are not arranged correctly.
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';
import 'package:intl/intl.dart';
void main() {
return runApp(_ChartApp());
}
class _ChartApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: false),
home: _MyHomePage(),
);
}
}
class _MyHomePage extends StatefulWidget {
// ignore: prefer_const_constructors_in_immutables
_MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<_MyHomePage> {
List<_SalesData> data = [
_SalesData("20010101", 35),
_SalesData("20010102", 35),
];
List<_SalesData> data2 = [
_SalesData("20010104", 20),
_SalesData("20010105", 20),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Syncfusion Flutter chart'),
),
body: Column(children: [
//Initialize the chart widget
SfCartesianChart(
enableSideBySideSeriesPlacement: false,
// crosshairBehavior: crosshairBehavior,
primaryXAxis: DateTimeCategoryAxis(
// labelPlacement: LabelPlacement.onTicks,
intervalType: DateTimeIntervalType.days,
dateFormat: DateFormat.yMd(),
majorGridLines: MajorGridLines(width: 1),
),
// Chart title
title: ChartTitle(text: 'Half yearly sales analysis'),
// Enable legend
// Enable tooltip
series: <CartesianSeries<_SalesData, DateTime>>[
RangeAreaSeries<_SalesData, DateTime>(
dataSource: data,
xValueMapper: (_SalesData sales, _) => DateTime.parse(sales.day),
highValueMapper: (_SalesData sales, _) => sales.sales,
lowValueMapper: (_SalesData sales, _) => sales.sales - 10,
// Enable data label
),
RangeAreaSeries<_SalesData, DateTime>(
dataSource: data2,
xValueMapper: (_SalesData sales, _) => DateTime.parse(sales.day),
highValueMapper: (_SalesData sales, _) => sales.sales,
lowValueMapper: (_SalesData sales, _) => sales.sales - 10,
// Enable data label
),
]),
]));
}
}
class _SalesData {
_SalesData(this.day, this.sales);
final String day;
final double sales;
}
Hi @TeemozZ,
Thank you for your patience. We would like to let you know that the reported issue regarding "Axis range and segment is not updated correctly when using two RangeAreaSeries" is fixed and rolled out in our patch release. We kindly request you to upgrade the syncfusion_flutter_charts package to the latest version below.
Version: https://pub.dev/packages/syncfusion_flutter_charts/versions/24.2.3+1
Regards, Lokesh P.
Exception caught by gesture library The following RangeError was thrown while dispatching a pointer event: RangeError (index): Invalid value: Not in inclusive range 0..4: 7
When the exception was thrown, this was the stack:
0 List.[] (dart:core-patch/growable_array.dart:264:36)
1 RangeAreaSegment.trackballInfo (package:syncfusion_flutter_charts/src/charts/series/range_area_series.dart:542:29)
2 TrackballBehavior._generateAllPoints. (package:syncfusion_flutter_charts/src/charts/interactions/behavior.dart:3269:25)
3 ContainerRenderObjectMixin.visitChildren (package:flutter/src/rendering/object.dart:4343:14)
4 TrackballBehavior._generateAllPoints (package:syncfusion_flutter_charts/src/charts/interactions/behavior.dart:3247:23)
5 TrackballBehavior.show (package:syncfusion_flutter_charts/src/charts/interactions/behavior.dart:2938:7)
6 RenderBehaviorArea._showTrackball (package:syncfusion_flutter_charts/src/charts/interactions/behavior.dart:642:24)
7 RenderBehaviorArea.handlePointerHover (package:syncfusion_flutter_charts/src/charts/interactions/behavior.dart:417:7)
my code: