Skip to content

Instantly share code, notes, and snippets.

@genesisbertiz
Last active July 20, 2018 11:02
Show Gist options
  • Save genesisbertiz/9b38c2a169736bafa0ad265e33417cf8 to your computer and use it in GitHub Desktop.
Save genesisbertiz/9b38c2a169736bafa0ad265e33417cf8 to your computer and use it in GitHub Desktop.
3 bar chart
license: mit
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<style>
</style>
</head>
<body>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {packages: ['corechart']});
function drawChart() {
// Define the chart to be drawn.
var data = google.visualization.arrayToDataTable([
['Month', 'Sales',
{ role: 'annotation'} ,'Sales Return',
{ role: 'annotation'}, 'Actual Sales',
{role: 'annotation'}, {role : 'tooltip'}],
['07-20-18',
-900,'-900',
390, '390',
390, '390',
'07-01-2018\n\nSales: -900'],
['07-21-18',
1000,'1000',
400,'400',
390, '3390',
'y'],
['07-22-18',
1170,'1170',
440,'440',
390, '390',
''],
['07-23-18',
1250,'1250',
480,'480',
390, '390',
''],
['07-24-18',
1530,'1530',
540,'540',
390, '390',
'']
]);
var options = {
};
// Instantiate and draw the chart.
var chart = new google.visualization.BarChart(document.getElementById('barchart_material'));
chart.draw(data, options);
}
google.charts.setOnLoadCallback(drawChart);
</script>
<div id="barchart_material" style="width: 900px; height: 500px;"></div>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment