Commit | Line | Data |
---|---|---|
d955e223 DV |
1 | <html> |
2 | <head> | |
3 | <title>numeric axis</title> | |
4 | <!--[if IE]> | |
5 | <script type="text/javascript" src="excanvas.js"></script> | |
6 | <![endif]--> | |
7 | <script type="text/javascript" src="../dygraph-combined.js"></script> | |
8 | <script type="text/javascript" src="../dygraph.js"></script> | |
9 | <script type="text/javascript" src="http://www.google.com/jsapi"></script> | |
10 | </head> | |
11 | <body> | |
12 | <p>CSV data source:</p> | |
13 | <div id="g" style="width:600px; height:300px;"></div> | |
14 | ||
15 | <p>GViz data source:</p> | |
16 | <div id="gviz" style="width:600px; height:300px;"></div> | |
17 | ||
18 | <script type="text/javascript"> | |
19 | g = new DateGraph( | |
20 | document.getElementById("g"), | |
21 | function() { | |
22 | var ret = "X,Y1,Y2\n"; | |
23 | for (var i = 0; i < 100; i++) { | |
24 | ret += i + "," + i + "," + (i * (100-i) * 100/(50*50)) + "\n"; | |
25 | } | |
26 | return ret; | |
27 | }, null, | |
28 | { | |
29 | xValueParser: function(x) { return parseFloat(x); }, | |
30 | xValueFormatter: function(x) { return x; }, | |
31 | xTicker: DateGraph.prototype.numericTicks | |
32 | } | |
33 | ); | |
34 | ||
35 | google.load('visualization', '1', {packages: ['linechart']}); | |
36 | function addGViz() { | |
37 | data = new google.visualization.DataTable(); | |
38 | data.addColumn('number', 'X'); | |
39 | data.addColumn('number', 'Y1'); | |
40 | data.addColumn('number', 'Y2'); | |
41 | data.addRows(100); | |
42 | for (var i = 0; i < 100; i++) { | |
43 | data.setCell(i, 0, i); | |
44 | data.setCell(i, 1, i); | |
45 | data.setCell(i, 2, i * (100-i) * 100/(50*50)); | |
46 | } | |
47 | ||
48 | new DateGraph.GVizChart( | |
49 | document.getElementById('gviz')).draw(data, | |
50 | { | |
51 | xValueParser: function(x) { return parseFloat(x); }, | |
52 | xValueFormatter: function(x) { return x; }, | |
53 | xTicker: DateGraph.prototype.numericTicks | |
54 | }); | |
55 | } | |
56 | ||
57 | google.setOnLoadCallback(addGViz); | |
58 | </script> | |
59 | </body> | |
60 | </html> |