I'm trying to display a default, empty chart when no data has been passed in. The configuration is provided by:
const getEmptyChartConfig = (componentProps: SelectedItemsChartProps) => ({
xAxis: {
min: 0,
max: 5,
allowDecimals: false,
},
yAxis: {
min: 0,
max: 30,
allowDecimals: false,
},
});
The component I am passing it into is:
export const ItemsChart: React.FC<ItemsChartProps> = withTheme<
React.NamedExoticComponent<ItemsChartProps>
>(
React.memo((props) => {
const options = props.points.length
? {
series: getAllSeries(props.points, props.items),
}
: getEmptyChartConfig(props);
console.log('App options=' + JSON.stringify(options));
return <HighchartsReact highcharts={Highcharts} options={options} />;
}),
);
I am able to see the log line run with the updated options
when props.points.length > 0
. But the rendered chart is displaying axes with min/max of 0-5 for x-axis and 0-30 for y-axis. I can't see why this is the case since the updated options
object doesn't contain this configuration anymore. Seems like HighCharts is cacheing the old configuration? Do I need to do something to force an update?
Cheers