4 <meta http-equiv=
"X-UA-Compatible" content=
"IE=EmulateIE7; IE=EmulateIE9">
5 <title>log scale
</title>
7 <script type=
"text/javascript" src=
"../excanvas.js"></script>
10 For production (minified) code, use:
11 <script type=
"text/javascript" src=
"dygraph-combined.js"></script>
13 <script type=
"text/javascript" src=
"../dygraph-dev.js"></script>
19 <input id='ylog'
type=
"button" value=
"y log scale" onclick=
"setLogScale('y', true)">
20 <input id='ylinear'
type=
"button" value=
"y linear scale" onclick=
"setLogScale('y', false)">
21 <input id='xlog'
type=
"button" value=
"x log scale" onclick=
"setLogScale('x', true)">
22 <input id='xlinear'
type=
"button" value=
"x linear scale" onclick=
"setLogScale('x', false)">
23 <div>Current scales:
<span id=
"description"></span></div>
26 <h2>X axis of dates
</h2>
27 <div id=
"div_g0" style=
"width:600px; height:300px;"></div>
28 <div style=
"font-style: italic; margin-left: 40px;">(Note: when the x-axis is dates, logscale is ignored on that axis.)
</div>
30 <h2>X axis of numbers
</h2>
31 <div id=
"div_g1" style=
"width:600px; height:300px;"></div>
33 <script type=
"text/javascript">
34 Dygraph.Interaction.DEBUG = true;
69 var g0 = new Dygraph(document.getElementById(
"div_g0"), data0, {});
70 var g1 = new Dygraph(document.getElementById(
"div_g1"), data1, {});
71 var graphs = [ g0, g1 ];
72 var scales = { x : false, y : false };
73 function setLogScale(axis, val) {
75 for (var idx =
0; idx < graphs.length; idx++) {
76 graphs[idx].updateOptions({ logscale: val });
79 for (var idx =
0; idx < graphs.length; idx++) {
80 graphs[idx].updateOptions({ axes : { x : { logscale : val } } });
84 var text =
"y: " + (scales.y ?
"log" :
"linear") +
", x: " + (scales.x ?
"log" :
"linear");
85 document.getElementById(
"description").innerText = text;
88 setLogScale('y', true);