Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

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

Open bdorninger opened this issue 3 years ago • 0 comments

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

bdorninger avatar Oct 04 '22 09:10 bdorninger