hoist-react icon indicating copy to clipboard operation
hoist-react copied to clipboard

When Highcharts `xAxis.ordinal: true`, updating data requires fully re-rendering the chart

Open PeteDarinzo opened this issue 2 years ago • 1 comments

Changing data while the Highcharts ordinal property is true causes data points to become misaligned with the x-axis. The problem is resolved when the chart is manually resized, or after approximately 30 seconds. This implies that a re-render of the chart is required to keep data points in sync with the x-axis when data is modified.

The Highcharts xAxis.ordinal property makes data points equally spaced across the chart when set to true. This could be beneficial when removing certain points from a chart, e.g. removing weekends from a timeseries, but the x-axis must remain in sync with the data points. See Highcharts documentation

image Chart after normal render.

image Chart after modifying data (removing weekends). Note mismatch between hovered-over data point and x-axis label, and data points descending below the x-axis.

image Chart after manual resize, causing a re-render that then syncs the x-axis to the data points.

PeteDarinzo avatar Aug 05 '22 15:08 PeteDarinzo