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