Skip to content

Number formats ​

Tooltip ranges and values follow the chart's locale option. In locales where the comma is the decimal mark, the two edges of a range are separated by a semicolon, as in [5,25; 6,03).

ts
// Tooltip ranges and values in the chart's locale.
import type {ChartConfiguration} from 'chart.js';
import {classA} from './data/index.js';

const config: ChartConfiguration<'histogram'> = {
  type: 'histogram',
  data: {
    datasets: [{label: 'Studierende', data: classA.map((v) => v / 10), bins: 8, stat: 'percent'}]
  },
  options: {
    // Tooltip ranges and values follow the chart's locale: [5,25; 6,03) and 12,5 %.
    locale: 'de-DE',
    scales: {
      x: {title: {display: true, text: 'Note'}},
      y: {title: {display: true, text: 'Anteil (%)'}}
    }
  }
};

export default config;

Released under the MIT License.