
Bar Chart | Chart.js
Apr 15, 2025 · A bar chart provides a way of showing data values represented as vertical bars. It is sometimes used to show trend data, and the comparison of multiple data sets side by side.
Chart.js | Open source HTML5 Charts for your website
Mix and match bar and line charts to provide a clear visual distinction between datasets.
Vertical Bar Chart
Apr 15, 2025 · const config = { type: 'bar', data: data, options: { responsive: true, plugins: { legend: { position: 'top', }, title: { display: true, text: 'Chart.js Bar Chart' } } }, };
Bar Chart | Chart.js
Apr 15, 2025 · '#F46300' : v < 50 ? '#0358B6' : '#44DE28'; return opaque ? c : Utils.transparentize (c, 1 - Math.abs (v / 150)); }; } const config = { type: 'bar', data: data, options: { plugins: { …
Stacked Bar Chart
Apr 15, 2025 · const config = { type: 'bar', data: data, options: { plugins: { title: { display: true, text: 'Chart.js Bar Chart - Stacked' }, }, responsive: true, scales: { x: { stacked: true, }, y: { stacked: true } } } };
Step-by-step guide | Chart.js
Apr 15, 2025 · We just need to provide a chart type (bar) and provide data which consists of labels (often, numeric or textual descriptions of data points) and an array of datasets (Chart.js supports multiple datasets for most chart types).
Chart.js | Chart.js
Apr 15, 2025 · Chart.js provides a set of frequently used chart types, plugins, and customization options. In addition to a reasonable set of built-in chart types, you can use additional community-maintained chart types.
Chart.js Samples
Apr 15, 2025 · Chart.js Samples You can navigate through the samples via the sidebar. Alternatively, you can run them locally. To do so, clone the Chart.js repository from GitHub, run pnpm ci to install all packages, then run pnpm run docs:dev to build the documentation. As soon as the build is done, you can go to localhost:8080/samples to see the samples.
Horizontal Bar Chart
Apr 15, 2025 · const config = { type: 'bar', data: data, options: { indexAxis: 'y', // Elements options apply to all of the options unless overridden in a dataset // In this case, we are setting the border of each horizontal bar to be 2px wide elements: { bar: { borderWidth: 2, } }, responsive: true, plugins: { legend: { position: 'right', }, title: { display ...
Mixed Chart Types
Apr 15, 2025 · With Chart.js, it is possible to create mixed charts that are a combination of two or more different chart types. A common example is a bar chart that also includes a line dataset.