updateCommonChart method
void
updateCommonChart()
inherited
Updates the common.BaseChart
based on changes in the widget properties.
This method is called when the chart widget is updated, allowing the chart to be reconfigured based on the new widget properties.
chart
The common.BaseChart
instance to update.
oldWidget
The previous BaseChart widget, if any.
chartState
The current BaseChartState
instance.
Implementation
@override
void updateCommonChart(
common.BaseChart<D> chart,
BaseChart<D>? oldWidget,
BaseChartState<D> chartState,
) {
super.updateCommonChart(chart, oldWidget, chartState);
final prev = oldWidget as CartesianChart?;
final cartesianChart = chart as common.CartesianChart;
if (flipVerticalAxis != null) {
cartesianChart.flipVerticalAxisOutput = flipVerticalAxis!;
}
if (domainAxis != null && domainAxis != prev?.domainAxis) {
cartesianChart.domainAxisSpec = domainAxis!;
chartState.markChartDirty();
}
if (primaryMeasureAxis != prev?.primaryMeasureAxis) {
cartesianChart.primaryMeasureAxisSpec = primaryMeasureAxis;
chartState.markChartDirty();
}
if (secondaryMeasureAxis != prev?.secondaryMeasureAxis) {
cartesianChart.secondaryMeasureAxisSpec = secondaryMeasureAxis;
chartState.markChartDirty();
}
if (disjointMeasureAxes != prev?.disjointMeasureAxes) {
cartesianChart.disjointMeasureAxisSpecs = disjointMeasureAxes;
chartState.markChartDirty();
}
}