-
Notifications
You must be signed in to change notification settings - Fork 897
Closed
Description
Hi, I have a chart which is plotting AAPL for the last 2 weeks with a daily candle resolution. It is working beautifully, except for one thing. The weekends and holidays leave empty gaps in the chart. I would like my app to be continuous such that the weekends and holidays which have no data are simply not plotted, which would make my x-axis a bit weird where it would skip days.
How would you suggest modifying my data or plot to make Fridays seamlessly connect to Mondays?
@freezed
class Candle with _$Candle {
Candle._();
factory Candle(
double close,
double high,
double low,
double open,
DateTime timestamp,
double volume,
) = _Candle;
List<double> get spread => [low, close, open, high];
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Chart'),
),
body: SfCartesianChart(
primaryXAxis: DateTimeAxis(),
primaryYAxis: NumericAxis(
minimum: plotMinimum.roundToDouble(),
maximum: plotMaximum.roundToDouble(),
interval: 1,
),
series: <ChartSeries<Candle, DateTime>>[
widget.candles.candleSeries,
],
),
);
}
return CandleSeries<Candle, DateTime>(
xValueMapper: (c, _) => c.timestamp,
dataSource: this,
openValueMapper: (c, _) => c.open,
highValueMapper: (c, _) => c.high,
closeValueMapper: (c, _) => c.close,
lowValueMapper: (c, _) => c.low,
bearColor: Colors.red,
bullColor: Colors.green,
);
Metadata
Metadata
Assignees
Labels
No labels