Timeline Example

An example of a Google Timeline.

by AMS7

HTML

<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['timeline']}]}"></script>
       <div id="timeline" style="width: 800px; height: 250px;"></div>

JavaScript

google.setOnLoadCallback(drawChart);

      function drawChart() {
        var container = document.getElementById('timeline');
        var chart = new google.visualization.Timeline(container);
        var dataTable = new google.visualization.DataTable();

           dataTable.addColumn({ type: 'string', id: 'Name' });
        dataTable.addColumn({ type: 'string', id: 'President' });
        dataTable.addColumn({ type: 'date', id: 'Start' });
        dataTable.addColumn({ type: 'date', id: 'End' });

        dataTable.addRows([
            [ 'Jesse Matthews', 'Accused of sexual assault at Liberty University', new Date(2002, 9, 17), new Date(2002, 9, 17) ],[ 'Jesse Matthews', 'Attends CNU, leaves after charges of sexual assault', new Date(2003, 0), new Date(2003, 9)],[ 'Jesse Matthews', 'Woman raped in Fairfax County', new Date(2005, 8, 24), new Date(2005, 8, 24)],[ 'Jesse Matthews', 'Works as taxi driver', new Date(2003, 9), new Date(2009, 9)],[ 'Morgan Harrington', 'Morgan Harrington disappears', new Date(2009, 9, 17), new Date(2010, 0, 27)],[ 'Hannah Graham', 'Hannah Graham disappears', new Date(2014, 8, 13), new Date(2014, 9, 18)],[ 'Jesse Matthews', 'Charged with intent to defile; extradited from Texas', new Date(2014, 8, 23), new Date(2014, 8, 24)],[ 'Hannah Graham', 'Human remains confirmed as Hannah Graham', new Date(2014, 9, 25), new Date(2014, 9, 25)],[ 'Jesse Matthews', 'Investigation closed; charged with intent to defile', new Date(2015, 1, 10), new Date(2015, 1, 10)]
          ]);

        chart.draw(dataTable);
      }