Subversion-Projekte lars-tiefland.cienc

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
9 lars 1
<!DOCTYPE html>
2
 
3
<html>
4
<head>
5
 
6
    <title>Error Bands and Confidence Intervals</title>
7
 
8
    <link class="include" rel="stylesheet" type="text/css" href="../jquery.jqplot.min.css" />
9
    <link rel="stylesheet" type="text/css" href="examples.min.css" />
10
    <link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shCoreDefault.min.css" />
11
    <link type="text/css" rel="stylesheet" href="syntaxhighlighter/styles/shThemejqPlot.min.css" />
12
 
13
    <!--[if lt IE 9]><script language="javascript" type="text/javascript" src="../excanvas.js"></script><![endif]-->
14
    <script class="include" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
15
 
16
 
17
</head>
18
<body>
19
    <div id="header">
20
        <div class="nav">
21
            <a class="nav" href="../../../index.php"><span>&gt;</span>Home</a>
22
            <a class="nav"  href="../../../docs/"><span>&gt;</span>Docs</a>
23
            <a class="nav"  href="../../download/"><span>&gt;</span>Download</a>
24
            <a class="nav" href="../../../info.php"><span>&gt;</span>Info</a>
25
            <a class="nav"  href="../../../donate.php"><span>&gt;</span>Donate</a>
26
        </div>
27
    </div>
28
    <div class="colmask leftmenu">
29
      <div class="colleft">
30
        <div class="col1" id="example-content">
31
 
32
 
33
<!-- Example scripts go here -->
34
<p>Bands (like confidence intervals or error bands) can be added to line charts through the "bands" option of the line renderer.  The band data can be automatically computed or manually assigned.  If assigned manually, the simpliest approach is to set the "rendererOptions: { bandData: [] }" array on the series.  Note that band data is taken into account when axes scale themselves so bands will not get clipped.</p>
35
 
36
 
37
<p>Band data can be supplied as arrays of [x,y] values.  One array for the upper band line and one for the lower band line.</p>
38
 
39
 <div id="chart01" style="height:300px; width:600px;"></div>
40
    <pre class="code brush:js"></pre>
41
 
42
 
43
<p>The number of points in the band data arrays does not have to correspond to the number of points in the data series.  Also, band data will be drawn as smoothed lines if the data series is smoothed.</p>
44
 
45
 <div id="chart02" style="height:300px; width:600px;"></div>
46
    <pre class="code brush:js"></pre>
47
 
48
<p>In this example, band data is supplied as an array of arrays of y values for the low and hi bands.  X values for the bands are taken from the x values of the series.  The band data is of the form:  [ [y low 1, y hi 1], [y low 2, y hi 2], ... ] and there must be a corresponding array of low/hi y values for each x value in the data series.</p>
49
 
50
 <div id="chart1" style="height:300px; width:600px;"></div>
51
    <pre class="code brush:js"></pre>
52
 
53
<p>The band data can also be supplied as an array of [low y values], [hi y values].  In this case there must also be an equal number of low y values and hi y values as there are data points in the series.  X values for the low and hi bands will be taken from the series data.  Additionally, the order of low/hi values does not matter as long as they are consistent.  jqPlot will figure out which is the low values and which are the high values.</p>
54
 
55
 <div id="chart2" style="height:300px; width:600px;"></div>
56
    <pre class="code brush:js"></pre>
57
 
58
<p>Band data does not have to be provided.  By default, jqPlot will compute +/- 3% band intervals if the "rendererOptions: { bands: { show: true } }" option is set.  The band intervals can be customized as well through the "rendererOptions: { bands: { interval: [number|string|arry] } }" option.  Valid intervals are:</p>
59
 
60
<ul>
61
<li> '1.7' - will add bands at y +/- 1.7 above and below the line.</li>
62
<li> '10%' - will compute +/- 10% interval bands.</li>
63
<li> [3, '-10%'] - will add bands at y + 3 and y - 10% above and below the line.</li>
64
</ul>
65
 
66
<p>Examples of such interval specifications are shown below:</p>
67
 
68
 <div id="chart3" style="height:300px; width:600px;"></div>
69
    <pre class="code brush:js"></pre>
70
 <div id="chart4" style="height:300px; width:600px;"></div>
71
    <pre class="code brush:js"></pre>
72
 
73
 <div id="chart5" style="height:300px; width:600px;"></div>
74
    <pre class="code brush:js"></pre>
75
 
76
<p>You can also customize the fill color of the bands and turn on/off band lines.  By default, bands respond to the mouse over event, but they can be set to respond to mouse down as well.</p>
77
 <div id="chart6" style="height:300px; width:600px;"></div>
78
    <pre class="code brush:js"></pre>
79
 
80
<p>Note, the plots on this page all extend the following pre-defined theme:</p>
81
 
82
    <pre class="code brush:js"></pre>
83
 
84
 
85
<script class="code" type="text/javascript">
86
$(document).ready(function(){
87
    // Band data in arrays of [x,y] values.
88
    bdat = [[['7/1/2011', 8], ['7/2/2011', 9], ['7/3/2011', 8], ['7/4/2011', 13], ['7/5/2011', 11], ['7/6/2011', 13]],
89
    [['7/1/2011', 12], ['7/2/2011', 13], ['7/3/2011', 12], ['7/4/2011', 17], ['7/5/2011', 15], ['7/6/2011', 17]]];
90
 
91
    dat = [['7/1/2011', 10], ['7/2/2011', 11], ['7/3/2011', 10], ['7/4/2011', 15], ['7/5/2011', 13], ['7/6/2011', 15]];
92
 
93
    plot01 = $.jqplot('chart01', [dat], $.extend(true, {}, myTheme, {
94
        series: [{
95
            rendererOptions: {
96
                bandData: bdat
97
            }
98
        }],
99
        axes: {
100
            xaxis: {
101
                renderer: $.jqplot.DateAxisRenderer,
102
                min: '7/1/2011',
103
                max: '7/6/2011',
104
                tickInterval: '1 day'
105
            }
106
        }
107
    }));
108
});
109
</script>
110
 
111
<script class="code" type="text/javascript">
112
$(document).ready(function(){
113
    // Band data in arrays of [x,y] values.
114
    // Here the low band line (1st array) has 5 points and the hi band line has 4 points.
115
    bdat = [[['7/1/2011', 9], ['7/3/2011', 7], ['7/4/2011', 13], ['7/5/2011', 11], ['7/6/2011', 13]],
116
    [['7/1/2011', 12], ['7/3/2011', 14], ['7/4/2011', 18], ['7/6/2011', 16]]];
117
 
118
    dat = [['7/1/2011', 10], ['7/2/2011', 11], ['7/3/2011', 10], ['7/4/2011', 15], ['7/5/2011', 13], ['7/6/2011', 15]];
119
 
120
    plot02 = $.jqplot('chart02', [dat], $.extend(true, {}, myTheme, {
121
        series: [{
122
            rendererOptions: {
123
                bandData: bdat,
124
 
125
                // turn on smoothing
126
                smooth: true
127
            }
128
        }],
129
        axes: {
130
            xaxis: {
131
                renderer: $.jqplot.DateAxisRenderer,
132
                min: '7/1/2011',
133
                max: '7/6/2011',
134
                tickInterval: '1 day'
135
            }
136
        }
137
    }));
138
});
139
</script>
140
 
141
<script class="code" type="text/javascript">
142
$(document).ready(function(){
143
    // data points for line.
144
    dat = [[0, 10], [1, 11], [2, 10], [3, 15], [4, 13], [5, 15]];
145
 
146
    // band data in [[low_y_1, hi_y_1], [low_y_2, hi_y_2],...] format
147
    bdat = [[7, 13], [8, 14], [7, 13], [12, 18], [10, 16], [12, 18]];
148
 
149
    plot1 = $.jqplot('chart1', [dat], $.extend(true, {}, myTheme, {
150
        series: [{
151
            rendererOptions: {
152
                // Set the band data on the series.
153
                // Bands will be turned on automatically if
154
                // valid band data is present.
155
                bandData: bdat,
156
                smooth: true
157
            }
158
        }]
159
    }));
160
});
161
 
162
</script>
163
 
164
 
165
<script class="code" type="text/javascript">
166
 
167
$(document).ready(function(){
168
    // here band data specified as an array of [low y values] and [hi y values]
169
    bdat = [[7, 8, 7, 12, 10, 12], [13, 14, 13, 18, 16, 18]];
170
 
171
    // Same plot as before with different band data specification and smoothed lines.
172
    plot2 = $.jqplot('chart2', [dat], $.extend(true, {}, myTheme, {
173
        series: [
174
        {
175
            rendererOptions: {
176
                bandData: bdat,
177
                smooth: true
178
            }
179
        }]
180
    }));
181
});
182
 
183
</script>
184
 
185
<script class="code" type="text/javascript">
186
$(document).ready(function(){
187
    plot3 = $.jqplot('chart3', [dat], $.extend(true, {}, myTheme, {
188
        series: [{
189
            rendererOptions: {
190
                bands: {
191
                    // draw bands at 1.7 "units" above and below line.
192
                    interval: 1.7
193
                },
194
                smooth: true
195
            }
196
        }]
197
    }));
198
});
199
 
200
</script>
201
 
202
<script class="code" type="text/javascript">
203
$(document).ready(function(){
204
    plot4 = $.jqplot('chart4', [dat], $.extend(true, {}, myTheme, {
205
        series: [{
206
            rendererOptions: {
207
                bands: {
208
                    // draw interval at 10% above and below line.
209
                    interval: '10%'
210
                },
211
                smooth: true
212
            }
213
        }]
214
    }));
215
});
216
</script>
217
 
218
<script class="code" type="text/javascript">
219
$(document).ready(function(){
220
    plot5 = $.jqplot('chart5', [dat], $.extend(true, {}, myTheme, {
221
        series: [{
222
            rendererOptions: {
223
                bands: {
224
                    // draw interval at 3 units above and 10% below line.
225
                    interval: [3, '-10%']
226
                },
227
                smooth: true
228
            }
229
        }]
230
    }));
231
});
232
</script>
233
 
234
<script class="code" type="text/javascript">
235
$(document).ready(function(){
236
    plot6 = $.jqplot('chart6', [dat], $.extend(true, {}, myTheme, {
237
        series: [{
238
            rendererOptions: {
239
                bands: {
240
                    // draw interval at 3 units above and 10% below line.
241
                    interval: 4,
242
                    fillColor: 'rgba(198, 88, 88, 0.6)',
243
                    showLines: true
244
                },
245
 
246
                // highlight the band on mouse down, not on mouse over.
247
                highlightMouseDown: true,
248
                smooth: true
249
            }
250
        }]
251
    }));
252
});
253
</script>
254
 
255
<script class="code" type="text/javascript">
256
///////
257
// A default set of reusable plot options.  Note that line
258
// smoothing is turned on.  Bands will be drawn with the same
259
// smoothing as the line.
260
//////
261
myTheme = {
262
  grid: {
263
      drawBorder: false,
264
      shadow: false,
265
      background: 'rgba(255, 255, 255, 0.0)'
266
  },
267
  seriesDefaults: {
268
    shadow: false,
269
    showMarker: false
270
  },
271
  axes: {
272
      xaxis: {
273
          pad: 1.0,
274
          tickOptions: {
275
              showGridline: false
276
          }
277
      },
278
      yaxis: {
279
          pad: 1.05
280
      }
281
  }
282
};
283
</script>
284
<!-- End example scripts -->
285
 
286
<!-- Don't touch this! -->
287
 
288
 
289
    <script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
290
    <script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
291
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
292
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
293
<!-- Additional plugins go here -->
294
 
295
    <script class="include" type="text/javascript" src="../plugins/jqplot.highlighter.min.js"></script>
296
    <script class="include" type="text/javascript" src="../plugins/jqplot.cursor.min.js"></script>
297
    <script class="include" type="text/javascript" src="../plugins/jqplot.pointLabels.min.js"></script>
298
    <script class="include" type="text/javascript" src="../plugins/jqplot.dateAxisRenderer.min.js"></script>
299
 
300
<!-- End additional plugins -->
301
 
302
        </div>
303
         <div class="col2">
304
 
305
           <div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
306
           <div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
307
           <div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
308
           <div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
309
           <div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
310
           <div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
311
           <div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
312
           <div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
313
           <div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
314
           <div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
315
           <div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
316
           <div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
317
           <div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
318
           <div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
319
           <div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
320
           <div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
321
           <div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
322
           <div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
323
           <div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
324
           <div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
325
           <div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
326
           <div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
327
           <div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
328
           <div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
329
           <div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
330
           <div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
331
           <div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
332
           <div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
333
           <div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
334
           <div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
335
           <div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
336
           <div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
337
           <div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
338
           <div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
339
           <div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
340
           <div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
341
           <div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
342
           <div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
343
           <div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
344
           <div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
345
           <div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
346
           <div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
347
           <div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
348
           <div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
349
           <div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
350
           <div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
351
           <div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
352
           <div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
353
           <div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
354
           <div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
355
           <div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
356
           <div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
357
           <div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
358
           <div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
359
           <div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
360
           <div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
361
 
362
         </div>
363
               </div>
364
    </div>
365
    <script type="text/javascript" src="example.min.js"></script>
366
 
367
</body>
368
 
369
 
370
</html>