5 title
: 'Graph edge padding and axis position',
6 setup
: function(parent
) {
10 " <input type='radio' name='mode'>use {x,y}RangePad</input>" +
11 " <input type='radio' name='mode'>original</input>" +
12 " <br /><b>Settings:</b>" +
13 " <input type='checkbox' id='yrange'>valueRange=[-2,2]</input>" +
15 "<div id='demodiv'></div>"
19 var parent
= document
.getElementById("demodiv");
24 for (var oy
= -2; oy
<= 2; ++oy
) {
25 for (var ox
= -1; ox
<= 1; ++ox
) {
26 var gdiv
= document
.createElement('div');
27 gdiv
.style
.display
= 'inline-block';
28 gdiv
.style
.margin
= '2px';
29 parent
.appendChild(gdiv
);
32 for (var row
= 0; row
< nrows
; ++row
) {
33 var x
= row
* 5 / (nrows
- 1);
34 data
.push([ox
* 2.5 + x
- 2.5,
36 oy
+ Math
.round(Math
.cos(x
))]);
39 var g
= new Dygraph(gdiv
, data
, {
40 labels
: ['x', 'A', 'B'],
42 gridLineColor
: '#ccc',
49 parent
.appendChild(document
.createElement('br'));
52 var updateGraphOpts
= function(opts
) {
53 for (var i
= 0; i
< graphs
.length
; ++i
) {
54 graphs
[i
].updateOptions(opts
);
58 var mode
= document
.getElementsByName('mode');
59 mode
[0].onchange
= function() {
64 drawAxesAtZero
: true})};
65 mode
[1].onchange
= function() {
70 drawAxesAtZero
: false})};
71 mode
[0].checked
= true;
74 var yrange
= document
.getElementById('yrange');
75 yrange
.onchange
= function(ev
) {
77 valueRange
: ev
.target
.checked
? [-2, 2] : null});