xValueMapper property
Value mapper to map the x values with technical indicators.
Defaults to 'null'.
Widget build(BuildContext context) {
return SfCartesianChart(
indicators: <TechnicalIndicator<ChartData, num>>[
StochasticIndicator<ChartData, num>(
dataSource: chartData,
xValueMapper: (ChartData data, _) => data.x,
lowValueMapper: (ChartData data, _) => data.low,
highValueMapper: (ChartData data, _) => data.high,
openValueMapper: (ChartData data, _) => data.open,
closeValueMapper: (ChartData data, _) => data.close,
),
],
);
}
final List<ChartData> chartData = <ChartData>[
ChartData(1, 23, 50, 28, 38),
ChartData(2, 35, 80, 58, 78),
ChartData(3, 19, 90, 38, 58)
];
class ChartData {
ChartData(this.x, this.low, this.high, this.open, this.close);
final double x;
final double low;
final double high;
final double open;
final double close;
}
Implementation
final ChartIndexedValueMapper<D>? xValueMapper;