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

Stacked line chart does not auto-adjust y-axis minimum value #9037

Closed
ti-lei opened this issue Apr 25, 2021 · 6 comments · Fixed by #9045
Closed

Stacked line chart does not auto-adjust y-axis minimum value #9037

ti-lei opened this issue Apr 25, 2021 · 6 comments · Fixed by #9045

Comments

@ti-lei
Copy link

ti-lei commented Apr 25, 2021

Hi thanks for this amazing tool, I tried to induce it into my line chart though i found out i cant have my y-axis auto-adjusted. it will set the y axis to start from zero as i import the plugging
i don't know if it's because the following setting( stacked: true) somehow disables the auto-adjusting function. how could i have my y-axis back to auto-adjusted mode?
// Core options
scales: {
y: {
stacked: true
}
}

@kurkle

This comment has been minimized.

@ti-lei
Copy link
Author

ti-lei commented Apr 29, 2021

HI thanks for your reply
it's like this, those fig's y-axis all starts from zero, but I want it to be auto-adjusted by the values in the charts.
CxMqTv7

@kurkle
Copy link
Member

kurkle commented May 5, 2021

So, this does not need to have the annotations in the chart, moving this issue over to core repo.

@kurkle kurkle transferred this issue from chartjs/chartjs-plugin-annotation May 5, 2021
@kurkle kurkle changed the title y-axis can't auto adjust on the line chart Stacked line chart does not auto-adjust y-axis minimum value May 6, 2021
@kurkle
Copy link
Member

kurkle commented May 6, 2021

@etimberg
Copy link
Member

etimberg commented May 7, 2021

Probably due to || stacked in https://github.com/chartjs/Chart.js/blob/master/src/scales/scale.linearbase.js#L165 but unsure if removing that breaks anything

@kurkle
Copy link
Member

kurkle commented May 7, 2021

The expectation for stacked min value was changed here: #1963

It looks like the expectation is to start a stacked bar chart from zero. This is handled today by having beginAtZero default to true for bar charts, so I think we can quite safely enable this use case too. I'll create a PR and leave the decision to @etimberg :)

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

Successfully merging a pull request may close this issue.

3 participants