| 1 | <html> |
| 2 | <head> |
| 3 | <title>log scale</title> |
| 4 | <!--[if IE]> |
| 5 | <script type="text/javascript" src="../excanvas.js"></script> |
| 6 | <![endif]--> |
| 7 | <script type="text/javascript" src="../strftime/strftime-min.js"></script> |
| 8 | <script type="text/javascript" src="../rgbcolor/rgbcolor.js"></script> |
| 9 | <script type="text/javascript" src="../dygraph-canvas.js"></script> |
| 10 | <script type="text/javascript" src="../dygraph.js"></script> |
| 11 | </head> |
| 12 | |
| 13 | <body> |
| 14 | <h1>Log scale demo - work in progress</h1> |
| 15 | <div id="div_g" style="width:600px; height:300px;"></div> |
| 16 | |
| 17 | <input type="button" value="log scale" onclick="logScale()"> |
| 18 | <input type="button" value="linear scale" onclick="linearScale()"> |
| 19 | <script type="text/javascript"> |
| 20 | function Data() { |
| 21 | return "Date,A\n" + |
| 22 | "20101201,5\n"+ |
| 23 | "20101202,10\n"+ |
| 24 | "20101203,100\n"+ |
| 25 | "20101204,250\n"+ |
| 26 | "20101205,1000\n"+ |
| 27 | "20101206,30\n"+ |
| 28 | "20101207,80\n"+ |
| 29 | "20101208,100\n"+ |
| 30 | "20101209,250\n"+ |
| 31 | ""; |
| 32 | } |
| 33 | var g = new Dygraph(document.getElementById("div_g"), |
| 34 | Data, { logscale : true }); |
| 35 | Dygraph.addEvent(g.canvas_, '_mousemove', function(e) { |
| 36 | var y = Dygraph.pageY(e) - Dygraph.findPosY(g.canvas_); |
| 37 | console.log(y, g.toDataYCoord(y)); |
| 38 | }); |
| 39 | |
| 40 | function logScale() { |
| 41 | g.updateOptions({ logscale : true }); |
| 42 | } |
| 43 | function linearScale() { |
| 44 | g.updateOptions({ logscale : null }); |
| 45 | } |
| 46 | </script> |
| 47 | |
| 48 | </body> |
| 49 | </html> |