Charts
Bootstrap 5 Line Chart
Line charts show trends and changes over time. Chart.js and ApexCharts examples that follow light and dark mode.
Chart.js example
adminkit.chartjs() creates the Chart.js chart from a function of the theme colors and calls it again when the color mode changes.
<div class="chart">
<canvas id="chartjs-line"></canvas>
</div>
<script>
adminkit.chartjs("#chartjs-line", function (theme) {
return {
type: "line",
data: {
labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
datasets: [{
label: "Sales ($)",
fill: true,
backgroundColor: "transparent",
borderColor: theme.primary,
data: [2115, 1562, 1584, 1892, 1487, 2223, 2966, 2448, 2905, 3838, 2917, 3327]
}, {
label: "Orders",
fill: true,
backgroundColor: "transparent",
borderColor: "#adb5bd",
borderDash: [4, 4],
data: [958, 724, 629, 883, 915, 1214, 1476, 1212, 1554, 2128, 1466, 1827]
}]
},
options: {
maintainAspectRatio: false,
plugins: {
legend: {
display: false
},
tooltip: {
intersect: false
},
filler: {
propagate: false
}
},
scales: {
x: {
grid: {
color: "rgba(0,0,0,0.05)"
},
border: {
color: "rgba(0,0,0,0.05)"
}
},
y: {
ticks: {
stepSize: 500
},
grid: {
color: "transparent"
}
}
}
}
};
});
</script>ApexCharts example
This feature is only available in AdminKit PRO. Learn more.
adminkit.apexcharts() renders the chart and updates it when the color mode changes.
<div id="apexcharts-line"></div>
<script>
var options = {
chart: {
height: 350,
type: "line",
zoom: {
enabled: false
},
},
dataLabels: {
enabled: false
},
stroke: {
width: [5, 7, 5],
curve: "straight",
dashArray: [0, 8, 5]
},
series: [{
name: "Session Duration",
data: [45, 52, 38, 24, 33, 26, 21, 20, 6, 8, 15, 10]
},
{
name: "Page Views",
data: [35, 41, 62, 42, 13, 18, 29, 37, 36, 51, 32, 35]
},
{
name: "Total Visits",
data: [87, 57, 74, 99, 75, 38, 62, 47, 82, 56, 45, 47]
}
],
markers: {
size: 0,
},
xaxis: {
categories: ["01 Jan", "02 Jan", "03 Jan", "04 Jan", "05 Jan", "06 Jan", "07 Jan", "08 Jan", "09 Jan", "10 Jan", "11 Jan", "12 Jan"],
},
tooltip: {
y: [{
title: {
formatter: function(val) {
return val + " (mins)"
}
}
}, {
title: {
formatter: function(val) {
return val + " per session"
}
}
}, {
title: {
formatter: function(val) {
return val;
}
}
}]
},
grid: {
borderColor: "#f1f1f1",
}
}
adminkit.apexcharts("#apexcharts-line", function () {
return options;
});
</script>Last updated on
Doughnut chart
Doughnut charts show parts of a whole as percentages and ratios, with an empty center. Chart.js and ApexCharts examples that follow light and dark mode.
Pie chart
Pie charts show parts of a whole as percentages and ratios. Chart.js and ApexCharts examples that follow light and dark mode.