google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawBarChart);
function drawBarChart() {
var bardata = google.visualization.arrayToDataTable([
['Genre', 'Accepted', {'type': 'string', 'role': 'tooltip', 'p': {'html': true}}, 'Pending', {'type': 'string', 'role': 'tooltip', 'p': {'html': true}}],
['Egg Baskets', 4325, createCustomHTMLContent(234, 434), 4324, createCustomHTMLContent(234, 434)],
['Cheese Wedges', 43, createCustomHTMLContent(234, 434), 434, createCustomHTMLContent(234, 434)],
['Bannanasanan', 43, createCustomHTMLContent(234, 434), 434, createCustomHTMLContent(234, 434)]
]);
var view = new google.visualization.DataView(bardata);
var options = {
series: [
{color: '#b3d657', visibleInLegend: false},
{color: '#c1c2c3', visibleInLegend: false}
],
legend: {
position: 'bottom',
alignment: 'left'
},
chartArea: {
left: 16,
top: 10,
width: '95%',
height: '80%',
},
isStacked: true,
bar: { groupWidth: '60%' },
tooltip: {isHtml: true},
};
var barChart = new google.visualization.ColumnChart(document.getElementById("container-div"));
barChart.draw(view, options);
}
function createCustomHTMLContent(accepted, pending) {
return '<div class="chart-tooltip-header container">' +
+ '<div class="row">'
+ '<div class="col-12">'
+'Custom Title'
+ '</div>'
+ '</div>'
+ '<div class="row">'
+ '<div class="col-6">'
+ 'Suggested'
+ '</div>'
+ '<div class="col-6 pull-right">'
+ pending
+ '</div>'
+ '</div>'
+ '<div class="row">'
+ '<div class="col-6">'
+ 'Accepted'
+ '</div>'
+ '<div class="col-6 pull-right">'
+ accepted
+ '</div>'
+ '</div>'
+ '</div>'
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="container-div"></div>