-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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
[Bug] BarChart does not respect yAxis.min when all data is below min (and max is undefined) #19187
Comments
A very thorough analysis and bug confirmed.
|
Our use-case is that customers can create custom dashboards and add many charts side-by-side or below each other. And now we have this special case, where all 3 channels return an error and in this case, the yAxis scale is different: The biggest issue with that is that the customers will check the config of chart 2 and see that they have set the min correctly, but the chart is not okay. This causes confustion and a lot of wasted support time on our side. BTW: I just noticed that the label of bar B in the 3rd chart is missing: I created a separate issue for that: #19196 |
This issue is labeled with Please have a look at How to debug ECharts if you'd like to give a try. 🤓 |
@helgasoft Your proposal is for sure nice, but just a workaround for the bug. BTW: an easier workaround would be to simply check if all data are below 0 and then set max to the threshold plus some constant, e.g. |
@tmtron const data = [-1, -2, -3]; // Example data // Check if all data points are below zero // Dynamically set yAxis.max based on the condition const option = { This adjustment allows for a more dynamic setting of the yAxis.max based on the data provided, ensuring the chart accommodates the range while avoiding hard-coded values. It keeps the configuration adaptable and avoids unnecessary complexity in the input dialogs or source code. |
@tmtron
I am currently testing if it breaks anything else by checking with the other test html files. How does this solution look for you, I would appreciate the feedback. |
Version
5.4.3
Link to Minimal Reproduction
https://echarts.apache.org/examples/en/editor.html?code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVpZaAXRIBfPunI58RVKTKUasWgDdGAGwCuVXv1gBbCNCIBWOQth4qHCFUKxRZtethCwIjwBaAEYABlCpB3UKajoAI0YOWjNZEhlZAG4gA
Steps to Reproduce
Current Behavior
The bar-chart ignores the yAxis.min setting (
5
) and instead seems to use the auto-calculated value (100)Expected Behavior
5
, as specifiedEnvironment
Any additional comments?
it works as expected when
6
: Example-5
asyAxis.min
, ExampleyAxis.min
: exampleThe text was updated successfully, but these errors were encountered: