Ticks
The bin axis ends exactly on the first and last bin edges. Its ticks are round values inside that range: on an axis from 134.7 to 195.5, they are 140, 150, …, 190. The outer edges get no label of their own, so no label lands on top of another.
Chart.js's own ticks come back when you set ticks.stepSize or ticks.count on the axis, when you set bounds: 'ticks' (the axis then grows to round values outside the bins), or when you give the axis an afterBuildTicks callback of your own.
Ticks on bin edges
Round-number ticks fall inside bins when the edges are not round. binEdgeTicks puts one tick on every edge instead. See also BinEdgeTicksPlugin in the API.
ts
// Ticks on the bin edges, instead of round numbers.
import type {ChartConfiguration} from 'chart.js';
import {binEdgeTicks} from 'chartjs-chart-histogram';
import {responseTimes} from './data/index.js';
const config: ChartConfiguration<'histogram'> = {
type: 'histogram',
data: {
datasets: [
{
label: 'Requests',
data: responseTimes,
bins: [0, 100, 150, 200, 300, 500, 1000],
stat: 'density'
}
]
},
options: {
scales: {
// One tick on every bin edge.
x: {afterBuildTicks: binEdgeTicks, title: {display: true, text: 'Response time (ms)'}},
y: {title: {display: true, text: 'Density'}}
}
}
};
export default config;