I have the following code to make a line chart using google charts:
google.charts.load('current', {'packages':['line']});
google.charts.setOnLoadCallback(drawChart);
var stream = {{ stream }}
var maximum = {{ maximum }}
var minimum = {{ minimum }}
var unit = {{ unitlabel }}
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'Timestamp');
data.addColumn('number', 'Actual value');
data.addRows(stream);
var options = {
width: 1500,
height: 500,
isStacked: false,
title: "kWh",
axes: {
title: "kWh",
y: {
title: "kWh",
all: {
title: "kWh",
format: { pattern: 'decimal'},
range: {
max: maximum,
min: minimum
}
}
}
},
};
var chart = new google.charts.Line(document.getElementById('curve_chart'));
chart.draw(data, options);
}
I'm trying to label my y axis as kWh so people know what the unit is. As you can see I've added title: "kWh" in several places, yet none of them yield the desired result. What else can I try?
Thanks.
use following option...
see following working snippet...
EDIT
to set the title in Material charts,
first name the axis, then set the
label
option for the named axissee following working snippet, here i use
kWh
for both the name and the label...