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>
11 <script type=
"text/javascript" src=
"data.js"></script>
14 <h3>Click the buttons to change the zoom level or just use the normal
15 click-and drag. While zoom typically works by click-and-drag, the
16 buttons are useful for testing.
</h3>
17 <h4>Window coordinates (in dates and values):
</h4>
18 <div id=
"xdimensions"></div> <div id=
"ydimensions"></div>
19 <div style=
"float: right">
20 <p>Zoomed:
<span id=
"zoomed">False
</span><p/>
21 <p>Zoomed X:
<span id=
"zoomedX">False
</span><p/>
22 <p>Zoomed Y:
<span id=
"zoomedY">False
</span><p/>
24 <div id=
"div_g" style=
"width:600px; height:300px;"></div>
27 <p><b>Zoom operations:
</b></p>
29 <input type=
"button" value=
"Y (3,5)" onclick=
"zoomGraphY(3,5)">
30 <input type=
"button" value=
"Y (0,4)" onclick=
"zoomGraphY(0,4)">
31 <input type=
"button" value=
"Y (2,4)" onclick=
"zoomGraphY(2,4)">
32 <input type=
"button" value=
"Y (0,2)" onclick=
"zoomGraphY(0,2)">
33 <input type=
"button" value=
"Y (0,1)" onclick=
"zoomGraphY(0,1)">
35 <input type=
"button" value=
"Oct 8-13" onclick=
"zoomGraphX(1160261979962, 1163905694248)">
36 <input type=
"button" value=
"Oct 22-28" onclick=
"zoomGraphX(1161489164461 , 1162008465957)">
37 <input type=
"button" value=
"Oct 23-24" onclick=
"zoomGraphX(1161575878860, 1161660991675)">
38 <input type=
"button" value=
"Oct 26 6AM-noon" onclick=
"zoomGraphX(1161770537840, 1161792063332)">
40 <input type=
"button" value=
"Unzoom" onclick=
"unzoomGraph()">
42 <input type=
"button" value=
"pan frame null" onclick=
"panEdgeFraction(null)">
43 <input type=
"button" value=
"pan frame 0.1" onclick=
"panEdgeFraction(0.1)">
44 <input type=
"button" value=
"pan frame 0.5" onclick=
"panEdgeFraction(0.5)">
48 <script type=
"text/javascript">
50 document.getElementById(
"div_g"),
53 zoomCallback : function(minDate, maxDate, yRange) {
54 showDimensions(minDate, maxDate, yRange);
56 drawCallback: function(me, initial) {
57 document.getElementById(
"zoomed").innerHTML =
"" + me.isZoomed();
58 document.getElementById(
"zoomedX").innerHTML =
"" + me.isZoomed(
"x");
59 document.getElementById(
"zoomedY").innerHTML =
"" + me.isZoomed(
"y");
64 // TODO(konigsberg): Implement a visualization that verifies that initial
65 // displays also show correctly.
67 // Pull an initial value for logging.
68 var minDate = g.xAxisRange()[
0];
69 var maxDate = g.xAxisRange()[
1];
70 var minValue = g.yAxisRange()[
0];
71 var maxValue = g.yAxisRange()[
1];
72 showDimensions(minDate, maxDate, [minValue, maxValue]);
74 function showDimensions(minDate, maxDate, yRanges) {
75 showXDimensions(minDate, maxDate);
76 showYDimensions(yRanges);
79 function showXDimensions(first, second) {
80 var elem = document.getElementById(
"xdimensions");
81 elem.innerHTML =
"dateWindow : [" + first +
", "+ second +
"]";
84 function showYDimensions(ranges) {
85 var elem = document.getElementById(
"ydimensions");
86 elem.innerHTML =
"valueRange : [" + ranges +
"]";
89 function zoomGraphX(minDate, maxDate) {
91 dateWindow: [minDate, maxDate]
93 showXDimensions(minDate, maxDate);
96 function zoomGraphY(minValue, maxValue) {
98 valueRange: [minValue, maxValue]
100 showYDimensions(g.yAxisRanges());
103 function unzoomGraph() {
110 function panEdgeFraction(value) {
111 g.updateOptions({ panEdgeFraction : value });