actually draw the graph
[dygraphs.git] / tests / numeric-axis.html
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-canvas.js"></script>
9 <script type="text/javascript" src="../dygraph.js"></script>
10 <script type="text/javascript" src="http://www.google.com/jsapi"></script>
11 </head>
12 <body>
13 <p>CSV data source:</p>
14 <div id="div_g" style="width:600px; height:300px;"></div>
15
16 <p>GViz data source:</p>
17 <div id="gviz" style="width:600px; height:300px;"></div>
18
19 <script type="text/javascript">
20 g = new Dygraph(
21 document.getElementById("div_g"),
22 function() {
23 var ret = "X,Y1,Y2\n";
24 for (var i = 0; i < 100; i++) {
25 ret += i + "," + i + "," + (i * (100-i) * 100/(50*50)) + "\n";
26 }
27 return ret;
28 },
29 { }
30 );
31
32 google.load('visualization', '1', {packages: ['linechart']});
33 function addGViz() {
34 data = new google.visualization.DataTable();
35 data.addColumn('number', 'X');
36 data.addColumn('number', 'Y1');
37 data.addColumn('number', 'Y2');
38 data.addRows(100);
39 for (var i = 0; i < 100; i++) {
40 data.setCell(i, 0, i);
41 data.setCell(i, 1, i);
42 data.setCell(i, 2, i * (100-i) * 100/(50*50));
43 }
44
45 new Dygraph.GVizChart(
46 document.getElementById('gviz')).draw(data,
47 {
48 });
49 }
50
51 google.setOnLoadCallback(addGViz);
52 </script>
53 </body>
54 </html>