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=
"../dygraph-dev.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">
30 Dygraph.Interaction.DEBUG = true;
65 var g0 = new Dygraph(document.getElementById(
"div_g0"), data0, {});
66 var g1 = new Dygraph(document.getElementById(
"div_g1"), data1, {});
67 var graphs = [ g0, g1 ];
68 var scales = { x : false, y : false };
69 function setLogScale(axis, val) {
71 for (var idx =
0; idx < graphs.length; idx++) {
72 graphs[idx].updateOptions({ logscale: val });
75 for (var idx =
0; idx < graphs.length; idx++) {
76 graphs[idx].updateOptions({ axes : { x : { logscale : val } } });
80 var text =
"y: " + (scales.y ?
"log" :
"linear") +
", x: " + (scales.x ?
"log" :
"linear");
81 document.getElementById(
"description").innerText = text;
84 setLogScale('y', true);