chartjs / chartjs/Chart.js

Wrong max y-axis value when x-axis limited with min/max

Open
#11,195 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
67.7k
Forks
11.9k
Avg merge
7h 39m
Merged PRs (30d)
5

Description

### Expected behavior

When using the min/max value on the x-axis and a dataset is not visible, the max y-axis should show the max value of the visible data.

### Current behavior

- See following use case https://stackblitz.com/edit/eng-1353-chartjs?file=index.ts which is a bar chart with min/max value and x-axis of type "day"
- When x (day) value is larger than the max x value:
- the value is still visible, but this could be due to the rouding of the min/max?
- the y-axis shows the max of the visible bar (in this case 50) instead of 100

So, the visible bars do not match with the max y-value

### Reproducible sample

https://stackblitz.com/edit/eng-1358-2-chartjs-s32m4s?file=index.ts

### Optional extra steps/info to reproduce

_No response_

### Possible solution

_No response_

### Context

_No response_

### chart.js version

4.2.1

### Browser name and version

Chrome 111

### Link to your project

https://stackblitz.com/edit/eng-1358-2-chartjs-s32m4s?file=index.ts

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.