Dark Light
System
Default LBBW Jira Confluence Source Code
Share
Playground

Charts #

Charts turn complex data into clear visuals, revealing trends and comparisons at a glance.

Due to the complexity of charting needs, there is no single reusable component provided; instead, using Chart.js is recommended. Below are a short instruction and examples on how to get started with Chart.js presented.


Chart.js #

Chart.js is a free JavaScript library for making HTML-based charts. It is one of the simplest visualization libraries for JavaScript, and comes with the many built-in chart types:

For more detailed information see the official documentation.


Installation #

To use the package in a project with a bundler, install it via npm:

npm install chart.js

Optionally, you can include Chart.js from a CDN by adding the following to the beginning of your HTML file:

<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>

Usage #

Chart.js renders into an HTML <canvas> element. Add a canvas where you want the chart to appear:

<canvas id="myChart"></canvas>

Typical Chart Syntax (Bar Chart in this case):

const myChart = new Chart("myChart", {
    type: "bar",
    data: {},
    options: {}
});

The data property contains the labels as well as one or more datasets and the options property configures plugins (e.g., legend, title, tooltip), scales, interaction behavior, and more.


Examples #

In the following, several chart types and features are shown using Chart.js. Note that all values are fictitious and only displayed for visual purposes.

Bar chart Scatter chart Line chart Multi-axis line chart Line chart from generated data

Practical tips #

Share
Create a link with a predefined theme that is automatically applied when the generated link is opened. Default LBBW Presentation Mode
Abort Copy Link