Charts advanced usage
Bootstrap 5 Charts advanced usage
This documentation provides examples of advanced chart usage.
Note: Read the API tab in the basic chart docs to find all available options and advanced customization
Options
In most cases, working with advanced charts is related to the handling of options.
MDB provides default options for each chart - you can easily change that by passing an object with your custom options to the Chart component.
Mixed
With MDB 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.
Data labels
Set datalabels
option to true to display values directly
on a graph.
Double Y axis
In the example below we created chart with double Y axis with 2 datasets, each one with completely different data range.
Such a construction requires a scale adjustment, so the left axis is assigned and adjusted to the first dataset, and the right axis to the second dataset.
Funnel
Example of horizontal bar chart with custom options and labels formatting (calculating integers numbers into percentages).
This data visualization is often used to visualize the flow of the website traffic.
Formatting values on the Y axes
In the example below we simply add "$" before each value on the Y axis.
Formatting values in the tooltips
In the example below we simply add "$" before each value displayed in the tooltips.
Hover the line of the chart to see the tooltip.
Double datasets in a bar chart
Example of the double datasets in a bar chart.
Async data
Example of the fetching data from the JSON file.