Topic: CHART DOUBLE BAR ASYNC DATA
KODOKA priority asked 1 year ago
Hello, I would like to create a double bar graph that updates depending on what I choose in a select. The update works but I can't put my columns next to each other, instead the columns are stacked.
const chart = document.getElementById('chartMonth'); const chartInstance = new mdb.Chart(chart, { type: 'bar' }); const labels = ['Oct.', 'Nov.', 'Déc.', 'Janv.','Févr.','Mars','Avr.','Mai','Juin','Juill.','Août','Sept.']; chartInstance.update({
labels,
datasets: [
{
color: '#ba2520',
data: [resultat[0][1], resultat[1][1], resultat[2][1], resultat[3][1], resultat[4][1], resultat[5][1], resultat[6][1], resultat[7][1], resultat[8][1], resultat[9][1], resultat[10][1], resultat[11][1]],
label: 'Débit',
},
{
color: '#ba2520',
data: [resultat[0][1], resultat[1][1], resultat[2][1], resultat[3][1], resultat[4][1], resultat[5][1], resultat[6][1], resultat[7][1], resultat[8][1], resultat[9][1], resultat[10][1], resultat[11][1]],
label: 'Débit',
},
],
});
Kamila Pieńkowska staff answered 1 year ago
Here is an example of how to pass data to get double bars: https://mdbootstrap.com/docs/standard/data/charts-advanced/#section-double-datasets-in-a-bar-chart
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Priority
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 6.4.2
- Device: MAC MINI
- Browser: CHROME
- OS: MAC OS
- Provided sample code: No
- Provided link: No