4 <title>Series highlighting
</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>
11 <style type='text/css'
>
12 .few .dygraph-legend
> span.highlight { border:
1px solid grey; }
13 .many .dygraph-legend
> span { display: none; }
14 .many .dygraph-legend
> span.highlight { display: inline; }
18 <h2>Series highlighting demo
</h2>
19 <script type='text/javascript'
>
21 var getData = function(numSeries, numRows, isStacked) {
24 for (var j =
0; j < numRows; ++j) {
27 for (var i =
0; i < numSeries; ++i) {
29 for (var j =
0; j < numRows; ++j) {
33 val += Math.random() -
0.5;
41 var makeGraph = function(className, numSeries, numRows, isStacked) {
42 var div = document.createElement('div');
43 div.className = className;
44 div.style.display = 'inline-block';
45 document.body.appendChild(div);
48 for (var i =
0; i < numSeries; ++i) {
50 label = 's' + '
000'.substr(label.length) + label;
51 labels[i +
1] = label;
55 getData(numSeries, numRows, isStacked),
59 labels: labels.slice(),
60 stackedGraph: isStacked,
62 highlightCircleSize:
2,
64 strokeBorderWidth: isStacked ? null :
1,
66 highlightSeriesOpts: {
69 highlightCircleSize:
5,
72 g.setSelection(false, 's005');
76 makeGraph(
"few",
20,
50, false);
77 makeGraph(
"few",
10,
20, true);
78 makeGraph(
"many",
75,
50, false);
79 makeGraph(
"many",
40,
50, true);