Skip to content

Migrating to 2.0 ​

Version 2.0 renames the density dataset type and changes the default ticks of the bin axis. Nothing else changes.

The density dataset type ​

The dataset type that draws a density curve over a histogram is now histogramDensity, and its exports carry the Histogram prefix, like the other chart components:

1.12.0
type: 'density'type: 'histogramDensity'
DensityControllerHistogramDensityController
DensityDatasetOptionsHistogramDensityDatasetOptions
DensityControllerOptionsHistogramDensityControllerOptions
ChartConfiguration<'histogram' | 'density'>ChartConfiguration<'histogram' | 'histogramDensity'>
js
import {HistogramController, HistogramDensityController, HistogramElement} from 'chartjs-chart-histogram';

Chart.register(HistogramController, HistogramElement, HistogramDensityController);

// in the datasets
{type: 'histogramDensity', source: 0}

Chart types share one registry across every Chart.js plugin, so the old name, density, was left free for others. The options of the dataset, computeDensity and the warning codes are unchanged. The UMD bundle registers the new type.

Ticks of the bin axis ​

The bin axis still ends on the first and last bin edges, but its ticks are now round values inside that range. Before, Chart.js counted the ticks from the first edge (134.7, 144.7, …) and added the last edge as a tick of its own, whose label could land on top of the one before it. See Ticks for how to get Chart.js's own ticks back, or a tick on every edge.

Released under the MIT License.