4 <meta http-equiv=
"X-UA-Compatible" content=
"IE=EmulateIE7; IE=EmulateIE9">
5 <title>Highlighted Region
</title>
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 <p>Should draw a time series with an unusual region highlighted:
</p>
19 <div id=
"div_g" style=
"width:600px; height:300px;"></div>
21 <p>When you zoom/pan, the region should remain highlighted.
</p>
23 <script type=
"text/javascript">
24 // A basic sinusoidal data series.
26 for (var i =
0; i <
1000; i++) {
27 var base =
10 * Math.sin(i /
90.0);
28 data.push([i, base, base + Math.sin(i /
2.0)]);
31 // Shift one portion out of line.
32 var highlight_start =
450;
33 var highlight_end =
500;
34 for (var i = highlight_start; i <= highlight_end; i++) {
40 document.getElementById(
"div_g"),
43 labels: ['X', 'Est.', 'Actual'],
44 underlayCallback: function(canvas, area, g) {
45 var bottom_left = g.toDomCoords(highlight_start, -
20);
46 var top_right = g.toDomCoords(highlight_end, +
20);
48 var left = bottom_left[
0];
49 var right = top_right[
0];
51 canvas.fillStyle =
"rgba(255, 255, 102, 1.0)";
52 canvas.fillRect(left, area.y, right - left, area.h);