chartjs / chartjs/Chart.js

chart.js 3.9.1: Curves / Axes rendered awkwardly when axis boundaries incorrectly configured

Open
#10,745 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

We are using chart.js in a highly dynamic environment, where axes and curve data are delivered from a server.
It happened, that e.g. for the X axis the values for min and max are swapped (i.e. min > max).
In that case, it would be nice if chart.js threw an error (or chart.js provides any other means of easily spotting a misconfiguration)

### Current behavior

chart.js does not complain at all, but curves are not displayed or only partially (e.g. being rendered partially on the bottom line of the Y-dimension, if Xmin and Xmax are incorrect). Axes are rendered incomplete (e.g. ticks only for min and max values, no grid)

I know it is debateable, if this is an issue for chart.js at all (providing illegal values was our fault). However, it would be nice, if chart.js would provide a means to detect such misconfigurations.

### Reproducible sample

https://codepen.io/bdorninger/pen/YzLvvWR

### Optional extra steps/info to reproduce

_No response_

### Possible solution

throw an error?

### Context

Highly dynamical app, which adds/removes curves and respective axes via user interaction and/or automatically from configurations.
Fault was on our side, but some config validation feedback from chart.js would definitly be nice to have.

### chart.js version

v3.9.1

### Browser name and version

Chrome 106.0.5249.91

### Link to your project

_No response_

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.