Hi there everyone,
I have some charts on a form that I'm trying to clear if there is no data to be passed to the chart so that the chart does not retain the data from the previous dataset.
This is the chart field
@Order(50)
public class AgeRangeOfVisitorsChartField extends AbstractChartField<IChart> {
@Override
protected int getConfiguredGridH() {
return 10;
}
@Override
protected byte getConfiguredLabelPosition() {
return LABEL_POSITION_TOP;
}
public class Chart extends AbstractChart {
@Override
protected IChartConfig getConfiguredConfig() {
return super.getConfiguredConfig().withType(IChartType.BAR).withLegendDisplay(false)
.withTransparent(true).withColorScheme(ColorScheme.ALTERNATIVE);
}
}
}
I've tried the following:
getVisitsBox().getFieldByClass(AgeRangeOfVisitorsChartField.class).getChart()
.setData(new ChartData());
getVisitsBox().getFieldByClass(AgeRangeOfVisitorsChartField.class).getChart().reinit();
getVisitsBox().getFieldByClass(AgeRangeOfVisitorsChartField.class).reinit();
But nothing seems to work.
Can anyone please show me how to clear/reset a chart?
Thanks a million,
JD
[Updated on: Tue, 15 October 2024 03:47] by Moderator