Skip to content
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

Allow min / beginAtZero for category axes #8495

Closed
michahell opened this issue Feb 22, 2021 · 2 comments
Closed

Allow min / beginAtZero for category axes #8495

michahell opened this issue Feb 22, 2021 · 2 comments

Comments

@michahell
Copy link

michahell commented Feb 22, 2021

Feature Proposal

First off, I do not consider this feature request a viable plugin or extension, as I perceive this as a non-sane default and inflexibility of the chartJs library, that should be addressed in the chartJs library, and not in a plugin or extension.

Currently, in ChartJs version 2.9.3 it is not possible to define axis defaults for Category axis:

"For both the min and max properties, the value must be in the labels array"

https://www.chartjs.org/docs/latest/axes/cartesian/category.html#min-max-configuration

This feature request is that, precisely this, does not need to apply and that this becomes overrideable again.

Feature Use Case

What this feature request tries to accomplish is to empower the library user to make this decision for themselves: why would they not be allowed to?

Suppose I have 2 categories, both with arbitrary values > 0, I can not seem to make my graph start at 0.

by default 2021-02-22 at 11 29 00

In the screenshot above, the Y-axis starts at the minimum value from values present in the data, which is 5.
I can not override this.

It seems to me that this is both:

a) not a sane-default, as it skews the perception of data, i.e. 2 categories with values 11.000 and 10.999 would make the y-axis start at 10.999 giving a wholly wrong impression of the data, anyone might miss.
b) Inflexible, as this default can not be overridden. The documentation seems to make this explicit, which is all the more weirder... why was this done, as it seems to be a purposeful decision given the quote from the documentation?

Possible Implementation

N/A

@kurkle
Copy link
Member

kurkle commented Feb 22, 2021

Looks like a duplicate of #5939, resolved by #6917 and released in v3 beta releases.

@michahell
Copy link
Author

Apart from my initial thought that this was not possible to override, this is indeed a duplicate 👍
It seems I made a mistake and did not make sure the correct configuration was actually passed to ChartJs: it is possible to override this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants