Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

LineChart disappears while zooming in if spanGaps: true and non-null datapoints are out of bounds

Open ale-coe opened this issue 2 years ago • 2 comments

When using a dataset that has spanGaps: true and several null values in its data and the user zooms in, the lineChart disappears. The reason seems to be that the non-null values have no representation on the x-axis anymore. See this codepen.

I would expect that there is some interpolation going on internally that addresses this issue but this isn't the case. I tried modifying the dataset by interpolating "missing" values but there were visible jumps when rendering the line during zoom events which makes it not applicable for my use case.

Is there any workaround for this?

ale-coe avatar Nov 07 '23 20:11 ale-coe

This is an issue in the main repo, where (for optimization) only the points needed for the visible segment are updated/drawn. And it goes wrong.

kurkle avatar Nov 17 '24 17:11 kurkle

@ale-coe and @kurkle I have fixed this bug in https://github.com/chartjs/Chart.js/pull/11984, please have a look.

marisst avatar Jan 01 '25 23:01 marisst