JavaScript
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {
'packages': ['corechart']
});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
var array = [
['Categoria', 'Lead', 'Proposta', 'Oportunidade',{ role: 'style' }, { role: 'annotation' }],
['Luis B', 1000, 7000, 10000, 'opacity: 0.2', 'total'],
['Goncalo', 2000, 3000, 12000,'opacity: 0.2', 'total'],
['Jaime', 2000, 5000, 12000,'opacity: 0.2', 'total'],
['Raquel', 6000, 2000, 10000,'opacity: 0.2', 'total'],
['Luis G', 10000, 4000, 9000,'opacity: 0.2', 'total']
];
function drawChart() {
// Create the data table.
var data = new google.visualization.arrayToDataTable(array);
var view = new google.visualization.DataView(data);
view.setColumns([0, 1, 2, 3, 4, {
type: 'number',
calc: function (dt, row) {
// set offset to determine how far you want to move the labels
var offset = 300;
return dt.getValue(row, 1) + dt.getValue(row, 2) + dt.getValue(row, 3) + offset;
}
}, 5]);
// Set chart options
var options = {
title:"Pontos por Jogador",
width:400, height:300,
hAxis: {
textStyle: {'color': 'white'}
},
animation:{
duration: 3000,
easing: 'out'
},
isStacked: true,
series: {
3: {
type: 'line',
color: 'grey',
lineWidth: 0,
pointSize: 0,
visibleInLegend: false
}
}
};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.ColumnChart(document.getElementById('visualization'));
chart.draw(view, options);
}