Warnings
The plugin never throws on bad options or data. It falls back to a valid setting and prints a warning to the console, such as:
chartjs-chart-histogram: dataset 0: bins must be a positive number, a rule name, a function or an edge array, got -3; 'auto' is used. (invalid-bins)In a chart, each code is printed once per chart, not on every update. computeBins and computeDensity report every warning through their onWarn option, or through console.warn without it.
| Code | When | What happens |
|---|---|---|
invalid-bins | bins is not a positive number, a rule name, a function or an array | 'auto' is used |
invalid-edges | bins is an array with fewer than two distinct finite numbers | The array is ignored |
duplicate-edges | bins repeats an edge | The repeats are ignored |
invalid-bin-width | binWidth is not a positive finite number | It is ignored |
callback-failed | A bins function threw, or returned something other than a positive number | 'auto' is used |
max-bins | The bins asked for exceed maxBins | The count is capped at maxBins |
precision | Bins would be narrower than the floating-point resolution of the values | Fewer bins are used |
domain-swapped | domain has its larger bound first | The bounds are swapped |
invalid-option | Another option has an invalid value, such as stat: 'sum' | Its default is used |
invalid-weights | A weight is missing, negative or not finite, or weights is not an array | Those values are left out; a weights that is not an array is ignored |
invalid-prebinned | A pre-binned record overlaps the one before it | The record is left out |
density-degenerate | A density curve has fewer than two distinct values, a bandwidth out of range, or a pre-binned source | No curve is drawn |
unequal-widths | stat: 'count' on bins of different widths | A hint: bar areas are not proportional to counts; stat: 'density' is usually meant |
source-missing | source names no other dataset (for a density dataset, no histogram dataset) | The histogram or the curve is empty |
group-options | A dataset of a binGroup sets binning options of its own that differ from the first dataset's | The first dataset's options are used |
density-scale | The source of a density curve is cumulative, or has bins of different widths with a stat other than 'density' | No curve is drawn: no single factor scales it to the bars |
The last four come from the chart only; computeBins and computeDensity do not raise them.