4 <title>log scale
</title>
6 For production (minified) code, use:
7 <script type=
"text/javascript" src=
"dygraph-combined.js"></script>
9 <script type=
"text/javascript" src=
"../dist/dygraph.js"></script>
15 <input id='ylog'
type=
"button" value=
"y log scale" onclick=
"setLogScale('y', true)">
16 <input id='ylinear'
type=
"button" value=
"y linear scale" onclick=
"setLogScale('y', false)">
17 <input id='xlog'
type=
"button" value=
"x log scale" onclick=
"setLogScale('x', true)">
18 <input id='xlinear'
type=
"button" value=
"x linear scale" onclick=
"setLogScale('x', false)">
19 <div>Current scales:
<span id=
"description"></span></div>
22 <h2>X axis of dates
</h2>
23 <div id=
"div_g0" style=
"width:600px; height:300px;"></div>
24 <div style=
"font-style: italic; margin-left: 40px;">(Note: when the x-axis is dates, logscale is ignored on that axis.)
</div>
26 <h2>X axis of numbers
</h2>
27 <div id=
"div_g1" style=
"width:600px; height:300px;"></div>
29 <script type=
"text/javascript">
63 var g0 = new Dygraph(document.getElementById(
"div_g0"), data0, {});
64 var g1 = new Dygraph(document.getElementById(
"div_g1"), data1, {});
65 var graphs = [ g0, g1 ];
66 var scales = { x : false, y : false };
67 function setLogScale(axis, val) {
69 for (var idx =
0; idx < graphs.length; idx++) {
70 graphs[idx].updateOptions({ logscale: val });
73 for (var idx =
0; idx < graphs.length; idx++) {
74 graphs[idx].updateOptions({ axes : { x : { logscale : val } } });
78 var text =
"y: " + (scales.y ?
"log" :
"linear") +
", x: " + (scales.x ?
"log" :
"linear");
79 document.getElementById(
"description").innerText = text;
82 setLogScale('y', true);