4 <link rel=
"stylesheet" href=
"../dist/dygraph.css">
5 <title>log scale
</title>
6 <script type=
"text/javascript" src=
"../dist/dygraph.js"></script>
12 <input id='ylog'
type=
"button" value=
"y log scale" onclick=
"setLogScale('y', true)">
13 <input id='ylinear'
type=
"button" value=
"y linear scale" onclick=
"setLogScale('y', false)">
14 <input id='xlog'
type=
"button" value=
"x log scale" onclick=
"setLogScale('x', true)">
15 <input id='xlinear'
type=
"button" value=
"x linear scale" onclick=
"setLogScale('x', false)">
16 <div>Current scales:
<span id=
"description"></span></div>
19 <h2>X axis of dates
</h2>
20 <div id=
"div_g0" style=
"width:600px; height:300px;"></div>
21 <div style=
"font-style: italic; margin-left: 40px;">(Note: when the x-axis is dates, logscale is ignored on that axis.)
</div>
23 <h2>X axis of numbers
</h2>
24 <div id=
"div_g1" style=
"width:600px; height:300px;"></div>
26 <script type=
"text/javascript">
60 var g0 = new Dygraph(document.getElementById(
"div_g0"), data0, {});
61 var g1 = new Dygraph(document.getElementById(
"div_g1"), data1, {});
62 var graphs = [ g0, g1 ];
63 var scales = { x : false, y : false };
64 function setLogScale(axis, val) {
66 for (var idx =
0; idx < graphs.length; idx++) {
67 graphs[idx].updateOptions({ logscale: val });
70 for (var idx =
0; idx < graphs.length; idx++) {
71 graphs[idx].updateOptions({ axes : { x : { logscale : val } } });
75 var text =
"y: " + (scales.y ?
"log" :
"linear") +
", x: " + (scales.x ?
"log" :
"linear");
76 document.getElementById(
"description").innerText = text;
79 setLogScale('y', true);