I’ll take another screenshot when I’ve updated to 4.52 (I don’t remember the command to trigger the update, so I’m waiting
)
But the improvement I’m waiting for isn’t the shape of the graph, it’s just the choice of values on the y-axis. And in my second example, 18-19-20-21 is still more readable than 18.62-19.26-19.90-20.53! And in the last one 69000-69100-69200-69300 rather than 68950-69020-69090-69160-69230-69300!
In fact that won’t help since I rolled back the changes, it didn’t work. So I rebased the PR, the frontend is up to date without the modifications I had made: https://fix-chart-min-max.gladys-plus.pages.dev
Oh I didn’t understand!
But then, is it just a rounding issue?
And what you propose — is it general-purpose or too specific to your dataset? Because we have users who have small-step data (in 0.50 increments, for example), does your algorithm make sense in their case as well?
"It’s just a rounding issue" in the sense that you have to choose minY and maxY that are rounded and well placed relative to the values.
My algorithm should be robust in all cases :
- if you display values between 0.023 and 0.037, it will set a min and max to 0.02 and 0.04, with a step of 0.005
- if you display values between 0.023 and 537.12, it will set a min and max to 0 and 600, with a step of 100
- if you display values between 482.325 and 537.12, it will set a min and max to 480 and 540, with a step of 10
And it also works with negative values only, or with negative and positive values.
The only remaining drawback (but that’s already the case today) is that zero won’t necessarily be included in the tick marks if the graph has negative and positive values…
1 Like
@pierre-gilles I was thinking again about the issue reported by @GBoulvin a bit earlier: the fact that the y-axis no longer adjusts in this PR when you disable curves… It’s odd because the adjustment does happen when you change the time period (1h, 24h, 7d,…).
I don’t know how it works technically, but might there be something applied when you change the period that could be added to also be applied when you remove a curve?
No, it’s normal — when we change the time period we re-create a new component and re-request a redraw of the chart
When you select one of the graphs, it happens inside ApexChart, and since we code a custom behavior, you have to re-code the custom behavior that dynamically recalculates the y-axis 
1 Like