How can I center the title in a Line Chart from Google Charts API (Not Google Chart Images)
I don't see any options like titlePosition: 'center'
Thanks!
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['xValues', 'yValues'],
[0, 34.92],
[389, 39.44],
[488, 52.11],
[652, 55.4]
]);
var options = {
curveType: 'none', // 'function'
title: 'Title',
titleTextStyle: {
color: '333333',
fontName: 'Arial',
fontSize: 10
},
legend: 'none',
enableInteractivity: false
};
var chart = new google.visualization.LineChart(document.getElementById('visualization'));
chart.draw(data, options);
}
What I would do is remove the title from the chart and add a header above the chart which would allow you to center it using CSS. To remove the title from the chart use titlePosition: 'none' . For more info: Google Chart Documentation - Configuration Options. Agree, there is no other option to centre the title.
Plot area is a window with in the Chart area. It contains the actual chart itself, and includes plotted data, data series, category, and value axis.
The easiest way to exclude x-axis labels from a chart if the corresponding y-axis values are 0 or blank is by simply hiding the rows containing the 0/null values.
This option is not provided by the API; you simply cannot do this.
I use: titlePosition: 'none'
And insert a title with normal HTML
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With