| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9"> |
| 5 | <title>log scale</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 | </head> |
| 16 | |
| 17 | <body> |
| 18 | <center> |
| 19 | <input id='log' type="button" value="log scale" onclick="setLogScale(true)"> |
| 20 | <input id='linear' type="button" value="linear scale" onclick="setLogScale(false)"> |
| 21 | </center> |
| 22 | |
| 23 | <h2>X axis of dates</h2> |
| 24 | <div id="div_g0" style="width:600px; height:300px;"></div> |
| 25 | |
| 26 | <h2>X axis of numbers</h2> |
| 27 | <div id="div_g1" style="width:600px; height:300px;"></div> |
| 28 | |
| 29 | <script type="text/javascript"> |
| 30 | function data0() { |
| 31 | return "Date,A\n" + |
| 32 | "20101201,5\n"+ |
| 33 | "20101202,10\n"+ |
| 34 | "20101203,-1\n"+ |
| 35 | "20101204,250\n"+ |
| 36 | "20101205,1000\n"+ |
| 37 | "20101206,30\n"+ |
| 38 | "20101207,80\n"+ |
| 39 | "20101208,100\n"+ |
| 40 | "20101209,500\n"+ |
| 41 | ""; |
| 42 | }; |
| 43 | function data1() { |
| 44 | return "X,A\n" + |
| 45 | "1,0.000001\n"+ |
| 46 | "2,10\n"+ |
| 47 | "3,100\n"+ |
| 48 | "4,250\n"+ |
| 49 | "5,1000\n"+ |
| 50 | "6,30\n"+ |
| 51 | "7,0\n"+ |
| 52 | "8,100\n"+ |
| 53 | "9,500\n"+ |
| 54 | "101,500\n"+ |
| 55 | ""; |
| 56 | }; |
| 57 | |
| 58 | var g0 = new Dygraph(document.getElementById("div_g0"), |
| 59 | data0, { logscale : true }); |
| 60 | var g1 = new Dygraph(document.getElementById("div_g1"), |
| 61 | data1, { logscale : true }); |
| 62 | function setLogScale(val) { |
| 63 | g0.updateOptions({ logscale: val }); |
| 64 | g1.updateOptions({ logscale: val }); |
| 65 | document.getElementById("linear").disabled = !val; |
| 66 | document.getElementById("log").disabled = val; |
| 67 | } |
| 68 | </script> |
| 69 | |
| 70 | </body> |
| 71 | </html> |