I'm experimenting with syncfusion
and trying to obtain a candlestick graph like shown in the documentation. Unfortunately when I try my code instead of seeing a candle a see an horizontal green line and I cannot understand why. I used the following code:
ChartData
class ChartData {
double x;
double open;
double high;
double low;
double close;
ChartData({this.x, this.open, this.high, this.low, this.close});
}
build method in my stateful widget
@override
Widget build(BuildContext context) {
return Scaffold(
// appBar: AppBar(),
body: SafeArea(
child: Row(
children: [
Expanded(
child: ListView(
physics: BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(20.0),
child: Container(
width: MediaQuery.of(context).size.width * 3,
child: SfCartesianChart(
title: ChartTitle(text: "Candlesticks"),
primaryXAxis: NumericAxis(),
series: <ChartSeries>[
CandleSeries<ChartData, double>(
showIndicationForSameValues: true,
dataSource: <ChartData>[
ChartData(
// Open and close values are same
x: 5,
open: 86.3593,
high: 88.1435,
low: 84.3914,
close: 86.3593),
],
xValueMapper: (ChartData data, _) => data.x,
highValueMapper: (ChartData data, _) =>
data.high,
lowValueMapper: (ChartData data, _) => data.low,
openValueMapper: (ChartData data, _) =>
data.open,
closeValueMapper: (ChartData data, _) =>
data.close,
)
]),
)),
],
),
)
],
),
),
);
}
Thanks for the help