Skip to content

Instantly share code, notes, and snippets.

@condotti
Last active January 9, 2020 07:14
Show Gist options
  • Save condotti/73e410f410c11068701eb9d6e1c470c2 to your computer and use it in GitHub Desktop.
Save condotti/73e410f410c11068701eb9d6e1c470c2 to your computer and use it in GitHub Desktop.
Dual-Y Annotated Timeline of Google Chart Tools
<div id="target"></div>
<script src="https://www.gstatic.com/charts/loader.js"></script>
<script>
(function() {
'use strict';
function drawChart() {
var query = new google.visualization.Query('https://docs.google.com/spreadsheets/d/1BzKIB93LvvdmWmxdKAk99V7vWDKBOq6P3HqQeQnwLpI/edit?usp=sharing');
query.send(handleQueryResponse);
}
function handleQueryResponse(response){
var target = document.getElementById('target');
var data;
var options = {
title: 'Weight & Fat Timeline',
width: 500,
height: 300,
scaleColumns: [0, 1]
};
var chart = new google.visualization.AnnotatedTimeLine(target);
data = response.getDataTable();
chart.draw(data, options);
}
google.charts.load('current', {packages: ['annotatedtimeline']});
google.charts.setOnLoadCallback(drawChart);
})();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment