Hi,
Thank you for your great site and examples. It is really helpful!
Can you show an example of google stacked column chart with labels on each column and totals on top of each stack (total outside of column)?
thank you!
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(drawChart);
function drawChart() {
var options = {
title: 'TEST',
width: '100%',
height: 400,
ColumnChart: { groupWidth: "95%" },
legend: { position: "none" },
legend: {
position: 'top',
maxLines: 3,
textStyle: {
color: 'black',
fontSize: 16
}
},
isStacked: true,
};
$.ajax({
type: "POST",
url: "Default2.aspx/GetChartData",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
var data = google.visualization.arrayToDataTable(r.d);
var chart = new google.visualization.ColumnChart($("#chart")[0]);
chart.draw(data, options);
},
failure: function (r) {
alert(r.d);
},
error: function (r) {
alert(r.d);
}
});
}
</script>
<div id="chart" style="width: 900px; height: 500px;">
</div>