google.charts.load('current', {packages: ['corechart', 'bar']});
google.charts.setOnLoadCallback(drawAxisTickColors);
var options = {
title: "Chart Title",
titleTextStyle: {
bold: true,
italic: true,
fontSize: 18,
},
width: 600,
height: 400,
legend: { position: 'top', maxLines: 3 },
bar: { groupWidth: '75%' },
isStacked: true,
};
function drawAxisTickColors() {
var data = google.visualization.arrayToDataTable([
['Genre', 'Fantasy & Sci Fi', 'Romance', 'Mystery/Crime', 'General',
'Western', 'Literature', { role: 'annotation' } ],
['2010', 10, 24, 20, 32, 18, 5, ''],
['2020', 16, 22, 23, 30, 16, 9, ''],
['2030', 28, 19, 29, 30, 12, 13, '']
]);
var myChart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
google.visualization.events.addListener(myChart, 'ready', titleCenter);
myChart.draw(data, options);
}
function titleCenter() {
var $container = $('#chart_div');
var svgWidth = $container.find('svg').width();
var $titleElem = $container.find("text:contains(" + options.title + ")");
var titleWidth = $titleElem.html().length * ($titleElem.attr('font-size')/2);
var xAxisAlign = (svgWidth - titleWidth)/2;
$titleElem.attr('x', xAxisAlign);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>