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
Min value is not well calculated #52
Comments
I found a workaround, but it is rather temporary I would say, since it is not elegant at all.
Then, I created a simple plugin that is forcing the update of my component once at the beginning, and that does the trick:
So this is maybe just a React related issue, I'm not sure. If you think that this issue is not related to your plugin, I can of course delete it, no problem! |
Hi @TheTisiboth , thanks for the issue and a reproducible example :) |
This is expected behavior, but made negative scale variable. <Bar data={data} options={{ plugins: { stacked100: { enable: true, fixNegativeScale: false } } }} /> Thanks for your pointing :) |
Oh great, that is exactly what I was expecting, thank you a lot for your quick fix, that was really fast!!! |
Hello everyone, and first of all, thanks for the work, this plugin is really useful.
I am using it in a React project, and I managed to make it work with typescript as well (it took me some days haha)
But now, I observe that the minimum value of my X axis is "wrong:
Actually, it's not totally wrong, because this min value is the overall min value for the whole datasets. I can verify this by hiding the dataset
packaging
:So is there a way to recompute the min value, everytime we show/hide a dataset, not to display the overall min, but to have the min according to the showed dataset? So in my example, the effective min in the first example should be -20%, and if I hide the dataset
packaging
, it should be recomputed, to be -100%It would avoid to have the chart shown on just half of the screen, like on the first screenshot
Thanks for your help!
EDIT:
I can see that this -100% is actually maybe not linked to the values itself, but simply because I have negative values, as this comments suggests: #30
But anyway, I'm still interested for some hints about this !
EDIT 2: I also observed that if I update my code, by just adding a blank line (for instance), then save, It will update my react website, and then it will have the wanted behavior (with dynamic min value computed each time a dataset is hidden/shown).
So it is not a fix, but I imagine that having the wanted behavior by default should be easy
Here is a reproducible example (it's maybe a bit messy since this is under development, but If you need me to comment something, let me know)
The text was updated successfully, but these errors were encountered: