I want to simply set the marked place legend on top of the graph.
The following is the Google Chart code which does not work:
var wrapper = new google.visualization.ChartWrapper({
chartType: 'ColumnChart',
dataTable: Dydata,
containerId: 'visualization',
legend: { position: 'bottom', alignment: 'start' },
width: 520,
height: 350
});
wrapper.draw();
If you want the legend at the top of your chart, you need to set the legend.position
option to "top":
legend: { position: 'top', alignment: 'start' }
and when using a ChartWrapper, your options need to be inside the "options" parameter:
var wrapper = new google.visualization.ChartWrapper({
chartType: 'ColumnChart',
dataTable: Dydata,
containerId: 'visualization',
options: {
legend: { position: 'top', alignment: 'start' },
width: 520,
height: 350
}
});
wrapper.draw();
we need to add the code inside option section eg. as below :
chart1.options = {
legend: { position: 'top', alignment: 'end' },
"title": "Sales per month",
"isStacked": "true",
// "fill": 20,
"displayExactValues": true,
"vAxis": {
"title": "Sales unit",
"gridlines": {
"count": 10
}
},
"hAxis": {
"title": "Date"
}
};
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