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