Commit | Line | Data |
---|---|---|
54425b14 | 1 | <!DOCTYPE html> |
a685723c DV |
2 | <html> |
3 | <head> | |
ec7ce8a2 | 4 | <!-- |
7e5ddc94 | 5 | For production (minified) code, use: |
ec7ce8a2 DV |
6 | <script type="text/javascript" src="dygraph-combined.js"></script> |
7 | --> | |
fbd6834a | 8 | <script type="text/javascript" src="../dist/dygraph.js"></script> |
a685723c DV |
9 | |
10 | <script type='text/javascript' src='http://www.google.com/jsapi'></script> | |
11 | <script type='text/javascript'> | |
12 | google.load('visualization', '1', {'packages':['annotatedtimeline']}); | |
13 | google.setOnLoadCallback(drawChart); | |
14 | function drawChart() { | |
15 | var data = new google.visualization.DataTable(); | |
16 | data.addColumn('date', 'Date'); | |
17 | data.addColumn('number', 'Sold Pencils'); | |
18 | data.addColumn('string', 'title1'); | |
19 | data.addColumn('string', 'text1'); | |
20 | data.addColumn('number', 'Sold Pens'); | |
21 | data.addColumn('string', 'title2'); | |
22 | data.addColumn('string', 'text2'); | |
23 | data.addRows([ | |
5829af3d | 24 | [new Date(2008, 11 ,1), 30000, undefined, undefined, 40645, undefined, undefined], |
25 | [new Date(2008, 11 ,2), 14045, undefined, undefined, 20374, undefined, undefined], | |
26 | [new Date(2008, 11 ,3), 55022, undefined, undefined, 50766, undefined, undefined], | |
27 | [new Date(2008, 11 ,4), 75284, undefined, undefined, 14334, 'Out of Stock','Ran out of stock on pens at 4pm'], | |
28 | [new Date(2008, 11 ,5), 41476, 'Bought Pens','Bought 200k pens', 66467, undefined, undefined], | |
29 | [new Date(2008, 11 ,6), 33322, undefined, undefined, 39463, undefined, undefined] | |
a685723c DV |
30 | ]); |
31 | ||
5829af3d | 32 | for (var i = 1; i < 14; i++) { |
33 | data.addRows([ | |
34 | [new Date(2008, 11 , 6 + i), i * 1000, 'title1-' + i, 'text1 ' + (i * 1000 - i), (i * 2000 + i), 'title2-' + i, 'text2' + i * 1000], | |
35 | ]); | |
36 | } | |
37 | ||
a685723c DV |
38 | var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('gviz_div')); |
39 | chart.draw(data, {displayAnnotations: true}); | |
40 | ||
41 | var g = new Dygraph.GVizChart(document.getElementById("dg_div")); | |
42 | g.draw(data, {displayAnnotations: true, labelsKMB: true}); | |
43 | } | |
44 | </script> | |
45 | </head> | |
46 | ||
47 | <body> | |
48 | <h3>Google AnnotatedTimeline:</h3> | |
49 | <div id='gviz_div' style='width: 700px; height: 240px;'></div> | |
50 | ||
51 | <h3>Dygraph.GVizChart:</h3> | |
52 | <div id='dg_div' style='width: 700px; height: 240px;'></div> | |
53 | </body> | |
54 | </html> |