chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
64.36k stars 11.89k forks source link

Not possible to set min/max for timeseries axis #11842

Open mp3500 opened 1 month ago

mp3500 commented 1 month ago

Expected behavior

I have 2 exactly the same charts showing same data with the only difference, that one chart is "time" and the other one is "timeseries". Both charts have min/max dates set on x axis to display full year. Both charts's axis should start with Jan and end with Dec.

Current behavior

"time" chart works as expected, but "timeseries" chart does not show full year on the x axis. It looks like the data between "min" and the first data point and between the last data point and "max" is removed as a part of timeseries functionality.

Reproducible sample

https://codepen.io/mp3500/pen/GRbqJwY

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

v4.4.1

Browser name and version

Chrome 126.0.6478.128 64bit

Link to your project

No response

Mairu commented 1 month ago

This was changed with v4.3.1, we also stumbled over that problem and had to fix versions, to be able to use zoom plugin with time series.

https://github.com/chartjs/Chart.js/pull/11388 -> https://github.com/chartjs/Chart.js/pull/11388/files#diff-f646705ee87e1da4be6cb4fca41e8322ba91e9db6f31ff76b2a868d9ff7f35e5R114

From my point of view, min and max should not be ignored or the behavior should be configurable.