fillBetweenLines.html
4.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<head>
<title>Charts with Fill Between Lines</title>
<link class="include" rel="stylesheet" type="text/css" href="../jquery.jqplot.min.css" />
<link rel="stylesheet" type="text/css" href="examples.min.css" />
<link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shCoreDefault.min.css" />
<link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shThemejqPlot.min.css" />
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="../excanvas.js"></script><![endif]-->
<script class="include" type="text/javascript" src="../jquery.min.js"></script>
</head>
<body>
<div class="logo">
<div class="nav">
<a class="nav" href="../../../index.php"><span>></span>Home</a>
<a class="nav" href="../../../docs/"><span>></span>Docs</a>
<a class="nav" href="../../download/"><span>></span>Download</a>
<a class="nav" href="../../../info.php"><span>></span>Info</a>
<a class="nav" href="../../../donate.php"><span>></span>Donate</a>
</div>
</div>
<div class="example-content">
<div class="example-nav">
<a href="dateAxisRenderer.html">Previous</a> <a href="./">Examples</a> <a href="hiddenPlotsInTabs.html">Next</a></div>
<!-- Example scripts go here -->
<style type="text/css" media="screen">
.jqplot-axis {
font-size: 0.85em;
}
.jqplot-title {
font-size: 1.1em;
}
</style>
<div id="chart1" style="margin-top:20px; margin-left:20px; width:600px; height:400px;"></div>
<p>Enter 2 series to fill between:</p>
<label for="series1">First Series: </label>
<input type="text" name="series1" value="1" />
<label for="series2"> Second Series: </label>
<input type="text" name="series2" value="3" />
<button name="changeFill">Change Fill</button>
<pre class="code brush:js"></pre>
<script class="code" type="text/javascript" language="javascript">
$(document).ready(function(){
var l0 = [6, 11, 10, 13, 11, 7];
var l1 = [3, 6, 7, 7, 5, 3];
var l2 = [4, 8, 9, 10, 8, 6];
var l3 = [9, 13, 14, 16, 17, 19];
var l4 = [15, 17, 16, 18, 13, 11];
var plot1 = $.jqplot("chart1", [l0, l1, l2, l3, l4], {
title: "Fill between 2 lines",
axesDefaults: {
pad: 1.05
},
//////
// Use the fillBetween option to control fill between two
// lines on a plot.
//////
fillBetween: {
// series1: Required, if missing won't fill.
series1: 1,
// series2: Required, if missing won't fill.
series2: 3,
// color: Optional, defaults to fillColor of series1.
color: "rgba(227, 167, 111, 0.7)",
// baseSeries: Optional. Put fill on a layer below this series
// index. Defaults to 0 (first series). If an index higher than 0 is
// used, fill will hide series below it.
baseSeries: 0,
// fill: Optional, defaults to true. False to turn off fill.
fill: true
},
seriesDefaults: {
rendererOptions: {
//////
// Turn on line smoothing. By default, a constrained cubic spline
// interpolation algorithm is used which will not overshoot or
// undershoot any data points.
//////
smooth: true
}
}
});
// bind a function to the change button to update the plot's fillBetween series
// and replot().
$("button[name=changeFill]").click(function(e) {
plot1.fillBetween.series1 = parseInt($("input[name=series1]").val());
plot1.fillBetween.series2 = parseInt($("input[name=series2]").val());
plot1.replot();
});
});
</script>
<!-- End example scripts -->
<!-- Don't touch this! -->
<script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
<script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
<script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
<script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
<!-- End Don't touch this! -->
<!-- Additional plugins go here -->
<!-- End additional plugins -->
</div>
<script type="text/javascript" src="example.min.js"></script>
</body>
</html>