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