Commit | Line | Data |
---|---|---|
54425b14 | 1 | <!DOCTYPE html> |
d955e223 DV |
2 | <html> |
3 | <head> | |
fd6b8dad | 4 | <link rel="stylesheet" href="../dist/dygraph.css"> |
d955e223 | 5 | <title>numeric axis</title> |
fbd6834a | 6 | <script type="text/javascript" src="../dist/dygraph.js"></script> |
7e5ddc94 | 7 | |
d955e223 DV |
8 | <script type="text/javascript" src="http://www.google.com/jsapi"></script> |
9 | </head> | |
10 | <body> | |
11 | <p>CSV data source:</p> | |
d16579a0 | 12 | <div id="div_g" style="width:600px; height:300px;"></div> |
d955e223 DV |
13 | |
14 | <p>GViz data source:</p> | |
15 | <div id="gviz" style="width:600px; height:300px;"></div> | |
16 | ||
17 | <script type="text/javascript"> | |
285a6bda | 18 | g = new Dygraph( |
d16579a0 | 19 | document.getElementById("div_g"), |
d955e223 DV |
20 | function() { |
21 | var ret = "X,Y1,Y2\n"; | |
22 | for (var i = 0; i < 100; i++) { | |
23 | ret += i + "," + i + "," + (i * (100-i) * 100/(50*50)) + "\n"; | |
24 | } | |
25 | return ret; | |
285a6bda DV |
26 | }, |
27 | { } | |
d955e223 DV |
28 | ); |
29 | ||
30 | google.load('visualization', '1', {packages: ['linechart']}); | |
31 | function addGViz() { | |
32 | data = new google.visualization.DataTable(); | |
33 | data.addColumn('number', 'X'); | |
34 | data.addColumn('number', 'Y1'); | |
35 | data.addColumn('number', 'Y2'); | |
36 | data.addRows(100); | |
37 | for (var i = 0; i < 100; i++) { | |
38 | data.setCell(i, 0, i); | |
39 | data.setCell(i, 1, i); | |
40 | data.setCell(i, 2, i * (100-i) * 100/(50*50)); | |
41 | } | |
42 | ||
285a6bda | 43 | new Dygraph.GVizChart( |
d955e223 DV |
44 | document.getElementById('gviz')).draw(data, |
45 | { | |
d955e223 DV |
46 | }); |
47 | } | |
48 | ||
49 | google.setOnLoadCallback(addGViz); | |
50 | </script> | |
51 | </body> | |
52 | </html> |