Bar chart with Multiple grouped datasets
See original GitHub issueI have to create the same graph as shown in the attached picture which I created on excel. I have following through the documentation and tried multiple times different approaches but couldn’t be succeeded in setting x-axis labels and values like in the attached picture. What am I doing wrong?
Here is my code which I tried but failed to set year wise total Expenditure and total Budget values which are grouped on codes “SC21106” and “SC21108”
var barChartData = {
labels: [
["SC21106",
"SC21108",],["2016",2017","2018","2019"]
],
datasets: [
{
label: "Total Expenditure",
backgroundColor: "Red",
data: [300000000, 555555555,555555554,666666665]
},
{
label: "Total Budget",
backgroundColor: "pink",
data: [500000000, 77777555,566666654,666666665]
},
]
};
var chartOptions = {
responsive: true,
scales: {
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
Target to achieve:
P.S : I am new to Chart js and the code I tried has rough values. In short, I just want a chart js bar graph like the picture I attached.
Any help would be highly appreciated.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
A Complete Guide to Grouped Bar Charts | Tutorial by Chartio
Like a standard bar chart, the grouped bar chart is built for showing a distribution of data points or making comparisons across different...
Read more >Grouped Bar Chart in Excel - How to Create? (10 Steps)
1. u003cbr/u003eu003cimg alt=u0022Grouped-Bar-Chart-Example-1.0.1u0022 src=u0022https://www.wallstreetmojo.com/wp-content/uploads/2019/08/Grouped-Bar-Chart ... 2. u003cbr/u003eu003cimg alt=u0022Grouped-Bar-Chart-Example-1.0.1.5u0022 src=u0022https://www.wallstreetmojo.com/wp-content/uploads/2019/08/Grouped-Bar-Chart ... 3. u003cbr/u003eu003cimg alt=u0022Grouped-Bar-Chart-Example-1.2.0u0022 src=u0022https://www.wallstreetmojo.com/wp-content/uploads/2019/08/Grouped-Bar-Chart ...
Read more >Grouped bar with multiple series : Chart Gallery - FusionCharts
The multi-series 2D bar chart is used for comparing data from multiple datasets. It is also used to analyze data grouped in sub-categories....
Read more >Grouped Bar Chart - Data Viz Project
Grouped Bar Charts are used when two or more data sets are displayed side-by-side and grouped together under categories on the same axis....
Read more >How to create a grouped bar chart - Datawrapper Academy
The bar chart is probably the most all-rounder chart type out there. But sometimes, your bars fall into categories (like continents, regions or ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ByteMates as @etimberg wrote (thanks!), there is a plugin which can do something close to what you want.
Anyway I spent some minutes to create a dedicated plugin to have the same representation of your picture. It’s not a generic plugin but something dedicated for this use case.
https://codepen.io/stockinail/pen/vYLyXop
@stockiNail has a good solution. https://github.com/sgratzl/chartjs-plugin-hierarchical also works. We are not planning on adding this functionality to the core library.