Yes,it is possible to do grouped bar charts of this sort in chart.js and so easy
Step by Step:-
Step1:-
First of all add the script link of charts.js:-
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script>
Step2:-
Add div in body of html'
<body>
<table>
<tr>
<td>
<div id="chart_div" style="width: 800px; height: 300px;">
</div>
</td>
</tr>
</table>
</body>
Step3:-
<script>
var densityCanvas = document.getElementById("densityChart");
var Data1 = {
label: 'A',
data: [3.7, 8.9, 9.8, 3.7, 23.1, 9.0, 8.7, 11.0],
backgroundColor: 'rgba(99, 132, 0, 0.6)',
borderColor: 'rgba(99, 132, 0, 1)',
yAxisID: "y-axis-gravity"
}
var Data2 = {
label: 'B',
data: [3.7, 8.9, 9.8, 3.7, 23.1, 9.0, 8.7, 11.0],
backgroundColor: 'rgba(99, 132, 0, 0.6)',
borderColor: 'rgba(99, 132, 0, 1)',
//yAxisID: "y-axis-gravity"
}
var Data3 = {
label: 'C',
data: [3.7, 8.9, 9.8, 3.7, 23.1, 9.0, 8.7, 11.0],
backgroundColor: 'rgba(99, 132, 0, 0.6)',
borderColor: 'rgba(99, 132, 0, 1)',
//yAxisID: "y-axis-gravity"
}
Note-:You can make multiple Var data which you want to display and only give the yAxisID to one var Data which then display as one group yaxis
var planetData = {
labels: ["A", "B", "C"],
datasets: [Data1,Data2, Data3 ]
};
var chartOptions = {
scales: {
xAxes: [{
barPercentage: 1,
categoryPercentage: 0.4
}],
yAxes: [{
id: "y-axis-Registered"
}
]
}
};
var barChart = new Chart(densityCanvas, {
type: 'bar',
data: planetData,
options: chartOptions
});
</script>
Note:-
When I am trying to use this offline Chart.js library and create chart for my case then this pretty solution helps me a lot :-
In picture Last Look:-
In picture Last Look