4 <meta http-equiv=
"X-UA-Compatible" content=
"IE=EmulateIE7; IE=EmulateIE9">
7 <script type=
"text/javascript" src=
"../excanvas.js"></script>
10 For production (minified) code, use:
11 <script type=
"text/javascript" src=
"dygraph-combined.js"></script>
13 <script type=
"text/javascript" src=
"../dygraph-dev.js"></script>
15 <script type=
"text/javascript" src=
"data.js"></script>
18 <h3>Click the buttons to change the zoom level or just use the normal
19 click-and drag. While zoom typically works by click-and-drag, the
20 buttons are useful for testing.
</h3>
21 <h4>Window coordinates (in dates and values):
</h4>
22 <div id=
"xdimensions"></div> <div id=
"ydimensions"></div>
23 <div style=
"float: right">
24 <p>Zoomed:
<span id=
"zoomed">False
</span><p/>
25 <p>Zoomed X:
<span id=
"zoomedX">False
</span><p/>
26 <p>Zoomed Y:
<span id=
"zoomedY">False
</span><p/>
28 <div id=
"div_g" style=
"width:600px; height:300px;"></div>
31 <p><b>Zoom operations:
</b></p>
33 <input type=
"button" value=
"Y (3,5)" onclick=
"zoomGraphY(3,5)">
34 <input type=
"button" value=
"Y (0,4)" onclick=
"zoomGraphY(0,4)">
35 <input type=
"button" value=
"Y (2,4)" onclick=
"zoomGraphY(2,4)">
36 <input type=
"button" value=
"Y (0,2)" onclick=
"zoomGraphY(0,2)">
37 <input type=
"button" value=
"Y (0,1)" onclick=
"zoomGraphY(0,1)">
39 <input type=
"button" value=
"Oct 8-13" onclick=
"zoomGraphX(1160261979962, 1163905694248)">
40 <input type=
"button" value=
"Oct 22-28" onclick=
"zoomGraphX(1161489164461 , 1162008465957)">
41 <input type=
"button" value=
"Oct 23-24" onclick=
"zoomGraphX(1161575878860, 1161660991675)">
42 <input type=
"button" value=
"Oct 26 6AM-noon" onclick=
"zoomGraphX(1161770537840, 1161792063332)">
44 <input type=
"button" value=
"Unzoom" onclick=
"unzoomGraph()">
46 <input type=
"button" value=
"pan frame null" onclick=
"panEdgeFraction(null)">
47 <input type=
"button" value=
"pan frame 0.1" onclick=
"panEdgeFraction(0.1)">
48 <input type=
"button" value=
"pan frame 0.5" onclick=
"panEdgeFraction(0.5)">
52 <script type=
"text/javascript">
54 document.getElementById(
"div_g"),
57 zoomCallback : function(minDate, maxDate, yRange) {
58 showDimensions(minDate, maxDate, yRange);
60 drawCallback: function(me, initial) {
61 document.getElementById(
"zoomed").innerHTML =
"" + me.isZoomed();
62 document.getElementById(
"zoomedX").innerHTML =
"" + me.isZoomed(
"x");
63 document.getElementById(
"zoomedY").innerHTML =
"" + me.isZoomed(
"y");
68 // TODO(konigsberg): Implement a visualization that verifies that initial
69 // displays also show correctly.
71 // Pull an initial value for logging.
72 var minDate = g.xAxisRange()[
0];
73 var maxDate = g.xAxisRange()[
1];
74 var minValue = g.yAxisRange()[
0];
75 var maxValue = g.yAxisRange()[
1];
76 showDimensions(minDate, maxDate, [minValue, maxValue]);
78 function showDimensions(minDate, maxDate, yRanges) {
79 showXDimensions(minDate, maxDate);
80 showYDimensions(yRanges);
83 function showXDimensions(first, second) {
84 var elem = document.getElementById(
"xdimensions");
85 elem.innerHTML =
"dateWindow : [" + first +
", "+ second +
"]";
88 function showYDimensions(ranges) {
89 var elem = document.getElementById(
"ydimensions");
90 elem.innerHTML =
"valueRange : [" + ranges +
"]";
93 function zoomGraphX(minDate, maxDate) {
95 dateWindow: [minDate, maxDate]
97 showXDimensions(minDate, maxDate);
100 function zoomGraphY(minValue, maxValue) {
102 valueRange: [minValue, maxValue]
104 showYDimensions(g.yAxisRanges());
107 function unzoomGraph() {
114 function panEdgeFraction(value) {
115 g.updateOptions({ panEdgeFraction : value });