-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not possible to set min/max for timeseries axis #11842
Comments
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. #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. |
I just encountered this bug too. I'd appreciate it if someone could look into this. |
Now that I have looked into it again I have come to the conclusion, that the current behaviour is exactly, what the purpose of the time-series scale is in comparison to the time scale, to have the same distance between any data point independent of the time difference between the data points.
So if you need a linear scale that does not depend on the data, you should use the time scale. The issue should be closed. |
My use-case is a bit different: I'm implementing panning with a timeseries on a candlestick chart. Overscrolling on the left should load new data from a server. But since overscrolling a timeseries is impossible, this feature is basically impossible to implement. I think there should be an additional way to set min/max in a linear fashion on a timeseries. For example by index of a dataset. |
I was also using candlestick charts when reported this bug. I just wanted to make my report as simple as possible, so I used scatter charts and did not go into too many details. Basically, my original problem was that I wanted to display candlestick chart with no weekends/holidays and with extra space (1 month or so) on the right. I was able to make that extra space using time chart and min/max properties, but then weekends/holidays were shown as blank points in the chart. If I used timeseries, weekend/holiday problem was gone, but now I was not able to make a space on a right hand side using min/max properties because of how timeseries works. Havent received any feedback regarding my bug report, so I came up with a workaround myself. I simply added more fake data to the candlestick data, where open price was set to "undefined" and high, low and close was set to the latest real close price. In this way, those fake bars were not showing on a chart, but the chart space was still reserved for them and my chart got extended to the right by the number of fake bars the way I wanted. I am not sure if min/max should work for timeseries or not, but I hope that my usage scenario might help to make decision. |
I had the same idea but couldn't figure out how to hide those datapoints. Thank you for that workaround! |
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
The text was updated successfully, but these errors were encountered: