4 <title>Multiple y-axes with valueRange
</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>
13 <h2>Multiple y-axes with valueRange
</h2>
14 <p>The same data with both different valueRanges. Two-axis old y[
40,
70] valueRange:
</p>
15 <div id=
"demodiv" style=
"width: 640; height: 350; border: 1px solid black"></div>
16 <p>Two-axis new valueRange y[
40,
80] set:
</p>
17 <div id=
"demodiv_one" style=
"width: 640; height: 350; border: 1px solid black"></div>
18 <p>Two-axis new valueRange y[
40,
80]
& y2[
1e6,
1.2e6] set:
</p>
19 <div id=
"demodiv_two" style=
"width: 640; height: 350; border: 1px solid black"></div>
20 <script type=
"text/javascript">
22 for (var i =
1; i <=
100; i++) {
24 if (d
> 31) { m =
"02"; d -=
31; }
25 if (m ==
"02" && d
> 28) { m =
"03"; d -=
28; }
26 if (m ==
"03" && d
> 31) { m =
"04"; d -=
31; }
27 if (d <
10) d =
"0" + d;
28 // two series, one with range
1-
100, one with range
1-
2M
29 data.push([new Date(
"2010/" + m +
"/" + d),
32 1e6 * (
1 + i * (
100 - i) / (
50 *
50)),
33 1e6 * (
2 - i * (
100 - i) / (
50 *
50))]);
37 document.getElementById(
"demodiv"),
40 labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
48 // set axis-related properties here
52 ylabel: 'Primary y-axis',
53 y2label: 'Secondary y-axis'
58 document.getElementById(
"demodiv_one"),
61 labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
71 // set axis-related properties here
75 ylabel: 'Primary y-axis',
76 y2label: 'Secondary y-axis',
82 document.getElementById(
"demodiv_two"),
85 labels: [ 'Date', 'Y1', 'Y2', 'Y3', 'Y4' ],
95 // set axis-related properties here
96 valueRange: [
1e6,
1.2e6],
100 ylabel: 'Primary y-axis',
101 y2label: 'Secondary y-axis',