Subversion-Projekte lars-tiefland.ci

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
875 lars 1
<!DOCTYPE html>
2
 
3
<html>
4
<head>
5
 
6
    <title>Pyramid Charts</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
 
35
 
36
  <link class="include" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/smoothness/jquery-ui.css" rel="Stylesheet" />
37
 
38
 
39
    <style type="text/css">
40
        .chart-container {
41
            border: 1px solid darkblue;
42
            padding: 30px;
43
            width: 600px;
44
            height: 700px;
45
        }
46
 
47
        #chart1 {
48
            width: 96%;
49
            height: 96%;
50
        }
51
 
52
        .jqplot-datestamp {
53
          font-size: 0.8em;
54
          color: #777;
55
    /*      margin-top: 1em;
56
          text-align: right;*/
57
          font-style: italic;
58
          position: absolute;
59
          bottom: 15px;
60
          right: 15px;
61
        }
62
 
63
        td.controls li {
64
            list-style-type: none;
65
        }
66
 
67
        td.controls ul {
68
            margin-top: 0.5em;
69
            padding-left: 0.2em;
70
        }
71
 
72
        pre.code {
73
            margin-top: 45px;
74
            clear: both;
75
        }
76
 
77
        div.tooltip {
78
            border: 1px solid #aaa;
79
            margin-right: 10px;
80
        }
81
 
82
    </style>
83
 
84
    <table class="app">
85
        <td class="controls">
86
 
87
            <div style="margin-bottom: 15px;">
88
                Axes:
89
                <select name="axisPosition">
90
                    <option value="both">Left &amp; Right</option>
91
                    <option value = "left">Left</option>
92
                    <option value = "right">Right</option>
93
                    <option value = "mid">Mid</option>
94
                </select>
95
            </div>
96
 
97
            <div>
98
                Background Color:
99
                <ul>
100
                    <li><input name="backgroundColor" value="white" type="radio" checked />Default</li>
101
                    <li><input name="backgroundColor" value="#efefef" type="radio" />Gray</li>
102
                </ul>
103
            </div>
104
 
105
            <div>
106
                Pyramid Color:
107
                <ul>
108
                    <li><input name="seriesColor" value="green" type="radio" checked />Green</li>
109
                    <li><input name="seriesColor" value="blue" type="radio" />Blue</li>
110
                </ul>
111
            </div>
112
 
113
            <div>
114
                Grids:
115
                <ul>
116
                    <li><input name="gridsVertical" value="vertical" type="checkbox" checked />Vertical</li>
117
                    <li><input name="gridsHorizontal" value="horizontal" type="checkbox" checked />Horizontal</li>
118
                    <li><input name="showMinorTicks" value="true" type="checkbox" />Only major</li>
119
                    <li><input name="plotBands" value="true" type="checkbox" />Plot Bands</li>
120
                </ul>
121
            </div>
122
 
123
            <div>
124
                <ul>
125
                    <li><input name="barPadding" value="2" type="checkbox" checked />Gap between bars</li>
126
                    <!-- value for showContour is speed at which to fade lines in/out -->
127
                    <li><input name="showContour" value="500" type="checkbox" checked />Comparison Line</li>
128
                </ul>
129
            </div>
130
 
131
            <div class="tooltip">
132
                <table>
133
                    <tr>
134
                        <td>Age: </td><td><div class="tooltip-item" id="tooltipAge">&nbsp;</div></td>
135
                    </tr>
136
                    <tr>
137
                        <td>Male: </td><td><div class="tooltip-item"  id="tooltipMale">&nbsp;</div></td>
138
                    </tr>
139
                    <tr>
140
                        <td>Female: </td><td><div class="tooltip-item"  id="tooltipFemale">&nbsp;</div></td>
141
                    </tr>
142
                    <tr>
143
                        <td>Ratio: </td><td><div class="tooltip-item"  id="tooltipRatio">&nbsp;</div></td>
144
                    </tr>
145
                </table>
146
            </div>
147
        </td>
148
 
149
        <td class="chart">
150
            <div class="chart-container">
151
                <div id="chart1"></div>
152
                <div class="jqplot-datestamp"></div>
153
            </div>
154
        </td>
155
 
156
    </table>
157
 
158
    <pre class="code brush:js"></pre>
159
 
160
 
161
 
162
    <script class="code" type="text/javascript" language="javascript">
163
    $(document).ready(function(){
164
 
165
        // the "x" values from the data will go into the ticks array.
166
        // ticks should be strings for this case where we have values like "75+"
167
        var ticks = ["0", "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+", ""];
168
 
169
        // The "y" values of the data are put into seperate series arrays.
170
        var male = [0.635441, 1.066868, 0.889602, 0.816883, 1.016458, 0.916705, 0.79569, 0.970443, 1.046451, 1.335686, 0.926962, 0.936646, 0.919405, 0.722027, 0.896342, 0.993397, 0.613794, 0.916921, 0.828748, 0.43487, 0.391652, 0.517303, 0.507104, 0.336168, 0.554176, 0.691826, 0.66553, 0.686232, 0.7097, 0.356915, 0.756028, 0.430155, 0.420597, 0.608589, 0.609348, 0.83607, 0.79871, 0.63388, 0.866719, 0.711042, 1.160429, 0.439268, 0.659694, 0.468406, 0.340002, 0.996662, 0.371047, 0.638918, 0.462334, 0.467053, 0.545638, 0.463275, 0.480992, 0.515747, 0.499415, 0.287639, 0.520332, 0.443779, 0.334986, 0.43161, 0.474405, 0.179186, 0.620127, 0.219074, 0.411669, 0.495684, 0.315231, 0.275056, 0.157341, 0.113926, 0.24991, 0.128113, 0.175297, 0.103093, 0.253292, 0.988836];
171
        var female = [0.767078, 0.679554, 1.064493, 0.915063, 0.860792, 0.785728, 0.892471, 0.687886, 1.055313, 0.921839, 0.659624, 1.14516, 0.910735, 1.279864, 0.714669, 0.873929, 0.928453, 0.595752, 1.093534, 0.501142, 0.52829, 0.411606, 0.633309, 0.616121, 0.621781, 0.621598, 0.638378, 0.703724, 0.742589, 0.48523, 0.735727, 0.898816, 0.740614, 0.991105, 1.48909, 1.226996, 1.020624, 0.737742, 0.946817, 0.69129, 0.933744, 0.957472, 0.793112, 0.581121, 0.767528, 1.031739, 1.202133, 0.626926, 0.959522, 0.594303, 1.202145, 0.611707, 0.480779, 0.383338, 0.532876, 0.849878, 0.52453, 0.660183, 0.25419, 0.137567, 0.762322, 0.490294, 0.463194, 0.566921, 0.353006, 0.730591, 0.34669, 0.271638, 0.309785, 0.152756, 0.478111, 0.177234, 0.269302, 0.396318, 0.194934, 1.683044];
172
        var male2 = [0.230476, 0.175917, 0.225027, 0.40564, 0.408617, 0.495873, 0.441314, 0.282774, 0.47483, 0.393433, 0.580612, 0.220204, 0.514281, 0.32985, 0.514933, 0.507871, 0.398236, 0.362535, 0.603625, 0.528885, 0.550904, 0.87645, 0.857331, 0.713371, 0.703566, 0.703473, 0.858118, 0.751679, 0.832039, 0.752134, 1.202689, 1.069239, 1.051431, 0.732728, 0.992696, 0.828825, 0.723044, 0.857868, 1.088298, 0.86951, 0.914989, 0.549574, 0.672405, 0.637425, 0.530195, 0.706179, 0.941525, 0.576152, 0.913033, 0.647477, 0.734785, 0.441276, 0.583452, 0.537074, 0.7625, 0.662768, 0.307013, 0.384606, 0.470416, 0.22771, 0.470173, 0.152773, 0.338433, 0.348797, 0.10273, 0.285215, 0.139796, 0.186955, 0.143478, 0.178882, 0.141022, 0.1435, 0.146959, 0.056583, 0.05317, 0.784258];
173
        var female2 = [0.203297, 0.298698, 0.452947, 0.783013, 0.50033, 0.53629, 0.451817, 0.69927, 0.741356, 0.545433, 0.559643, 0.334842, 0.443899, 0.437309, 0.584658, 0.451757, 0.509258, 0.73483, 0.640501, 0.698825, 0.803701, 1.018148, 1.504918, 0.701318, 0.781324, 1.792142, 0.968484, 1.3288, 1.059729, 1.079985, 2.245553, 1.080526, 1.122927, 1.512428, 1.296163, 1.047212, 0.988065, 1.239462, 1.521174, 1.05187, 1.253013, 0.983437, 1.181799, 1.090029, 0.718064, 1.578813, 1.121987, 1.010202, 1.438581, 1.051654, 1.656156, 0.732428, 0.719311, 0.742441, 0.623806, 0.643911, 0.579092, 0.472909, 0.683453, 0.39008, 0.437458, 0.464595, 0.385552, 0.520029, 0.240536, 0.457316, 0.339587, 0.203276, 0.282141, 0.19517, 0.283663, 0.12404, 0.147211, 0.141153, 0.177653, 1.193951];
174
 
175
        // Custom color arrays are set up for each series to get the look that is desired.
176
        // Two color arrays are created for the default and optional color which the user can pick.
177
        var greenColors = ["#526D2C", "#77933C", "#C57225", "#C57225"];
178
        var blueColors = ["#3F7492", "#4F9AB8", "#C57225", "#C57225"];
179
 
180
        // To accomodate changing y axis, need to keep track of plot options, so they are defined separately
181
        // changing axes will require recreating the plot, so need to keep
182
        // track of state changes.
183
        var plotOptions = {
184
            // We set up a customized title which acts as labels for the left and right sides of the pyramid.
185
            title: '<div style="float:left;width:50%;text-align:center">Male</div><div style="float:right;width:50%;text-align:center">Female</div>',
186
 
187
            // by default, the series will use the green color scheme.
188
            seriesColors: greenColors,
189
 
190
            grid: {
191
                drawBorder: false,
192
                shadow: false,
193
                background: 'white',
194
                rendererOptions: {
195
                    // plotBands is an option of the pyramidGridRenderer.
196
                    // it will put banding at starting at a specified value
197
                    // along the y axis with an adjustable interval.
198
                    plotBands: {
199
                        show: false
200
                    }
201
                }
202
            },
203
 
204
            // This makes the effective starting value of the axes 0 instead of 1.
205
            // For display, the y axis will use the ticks we supplied.
206
            defaultAxisStart: 0,
207
            seriesDefaults: {
208
                renderer: $.jqplot.PyramidRenderer,
209
                rendererOptions: {
210
                    barPadding: 2,
211
                    offsetBars: true
212
                },
213
                yaxis: 'yaxis',
214
                shadow: false
215
            },
216
 
217
            // We have 4 series, the left and right pyramid bars and
218
            // the left and rigt overlay lines.
219
            series: [
220
                // For pyramid plots, the default side is right.
221
                // We want to override here to put first set of bars
222
                // on left.
223
                {
224
                    rendererOptions:{
225
                        side: 'left',
226
                        synchronizeHighlight: 1
227
                    }
228
                },
229
                {
230
                    yaxis: 'y2axis',
231
                    rendererOptions:{
232
                        synchronizeHighlight: 0
233
                    }
234
                },
235
                // Pyramid series are filled bars by default.
236
                // The overlay series will be unfilled lines.
237
                {
238
                    rendererOptions: {
239
                        fill: false,
240
                        side: 'left'
241
                    }
242
                },
243
                {
244
                    yaxis: 'y2axis',
245
                    rendererOptions: {
246
                        fill: false
247
                    }
248
                }
249
            ],
250
 
251
            // Set up all the y axes, since users are allowed to switch between them.
252
            // The only axis that will show is the one that the series are "attached" to.
253
            // We need the appropriate options for the others for when the user switches.
254
            axes: {
255
                xaxis: {
256
                    tickOptions: {},
257
                    rendererOptions: {
258
                        baselineWidth: 2
259
                    }
260
                },
261
                yaxis: {
262
                    label: 'Age',
263
                    // Use canvas label renderer to get rotated labels.
264
                    labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
265
                    // include empty tick options, they will be used
266
                    // as users set options with plot controls.
267
                    tickOptions: {},
268
                    tickInterval: 5,
269
                    showMinorTicks: true,
270
                    ticks: ticks,
271
                    rendererOptions: {
272
                        category: false,
273
                        baselineWidth: 2
274
                    }
275
                },
276
                yMidAxis: {
277
                    label: 'Age',
278
                    // include empty tick options, they will be used
279
                    // as users set options with plot controls.
280
                    tickOptions: {},
281
                    tickInterval: 5,
282
                    showMinorTicks: true,
283
                    ticks: ticks,
284
                    rendererOptions: {
285
                        category: false,
286
                        baselineWidth: 2
287
                    }
288
                },
289
                y2axis: {
290
                    label: 'Age',
291
                    // Use canvas label renderer to get rotated labels.
292
                    labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
293
                    // include empty tick options, they will be used
294
                    // as users set options with plot controls.
295
                    tickOptions: {},
296
                    tickInterval: 5,
297
                    showMinorTicks: true,
298
                    ticks: ticks,
299
                    rendererOptions: {
300
                        category: false,
301
                        baselineWidth: 2
302
                    }
303
                }
304
            }
305
        };
306
 
307
        // initialize form elements
308
        // set these before attaching event handlers.
309
 
310
        $('input[type=checkbox][name=gridsVertical]').attr('checked', true);
311
        $('input[type=checkbox][name=gridsHorizontal]').attr('checked', true);
312
        $('input[type=checkbox][name=showMinorTicks]').attr('checked', false);
313
        $('input[type=checkbox][name=plotBands]').attr('checked', false);
314
        $('input[type=checkbox][name=showContour]').attr('checked', true);
315
        $('input[type=checkbox][name=barPadding]').attr('checked', true);
316
        $('select[name=axisPosition]').val('both');
317
        $('input[type=radio][name=backgroundColor]').attr('checked', false);
318
        $('input[type=radio][name=backgroundColor][value=white]').attr('checked', true);
319
        $('input[type=radio][name=backgroundColor]').attr('checked', false);
320
        $('input[type=radio][name=backgroundColor][value=white]').attr('checked', true);
321
        $('input[type=radio][name=seriesColor]').attr('checked', false);
322
        $('input[type=radio][name=seriesColor][value=green]').attr('checked', true);
323
 
324
        plot1 = $.jqplot('chart1', [male, female, male2, female2], plotOptions);
325
 
326
 
327
        // After plot creation, check to see if contours should be displayed
328
        checkContour();
329
 
330
        //////
331
        // The followng functions use verbose css selectors to make
332
        // it clear exactly which elements they are binging to/operating on
333
        //////
334
 
335
        //////
336
        // Function which checkes if the countour lines checkbox is checked.
337
        // If not, hide the contour lines by hiding the canvases they are
338
        // drawn on.
339
        //////
340
        function checkContour() {
341
            if (!$('input[type=checkbox][name=showContour]').get(0).checked) {
342
                plot1.series[2].canvas._elem.addClass('jqplot-series-hidden');
343
                plot1.series[2].canvas._elem.hide();
344
                plot1.series[3].canvas._elem.addClass('jqplot-series-hidden');
345
                plot1.series[3].canvas._elem.hide();
346
            }
347
        }
348
 
349
        $('select[name=axisPosition]').change(function(){
350
            // this refers to the html element we are binding to.
351
            // $(this) is jQuery object on that element.
352
 
353
            switch ($(this).val()) {
354
                case 'both':
355
                    plotOptions.series[0].yaxis = 'yaxis';
356
                    plotOptions.series[1].yaxis = 'y2axis';
357
                    plotOptions.series[2].yaxis = 'yaxis';
358
                    plotOptions.series[3].yaxis = 'y2axis';
359
                    break;
360
                case 'left':
361
                    plotOptions.series[0].yaxis = 'yaxis';
362
                    plotOptions.series[1].yaxis = 'yaxis';
363
                    plotOptions.series[2].yaxis = 'yaxis';
364
                    plotOptions.series[3].yaxis = 'yaxis';
365
                    break;
366
                case 'right':
367
                    plotOptions.series[0].yaxis = 'y2axis';
368
                    plotOptions.series[1].yaxis = 'y2axis';
369
                    plotOptions.series[2].yaxis = 'y2axis';
370
                    plotOptions.series[3].yaxis = 'y2axis';
371
                    break;
372
                case 'mid':
373
                    plotOptions.series[0].yaxis = 'yMidAxis';
374
                    plotOptions.series[1].yaxis = 'yMidAxis';
375
                    plotOptions.series[2].yaxis = 'yMidAxis';
376
                    plotOptions.series[3].yaxis = 'yMidAxis';
377
                    break;
378
                default:
379
                    break;
380
 
381
            }
382
 
383
            plot1.destroy();
384
            plot1 = $.jqplot('chart1', [male, female, male2, female2], plotOptions);
385
            // Finally, check to see if we need to hide contour lines.
386
            checkContour();
387
        });
388
 
389
        $('input[type=radio][name=backgroundColor]').change(function(){
390
            // this refers to the html element we are binding to.
391
            // $(this) is jQuery object on that element.
392
            plot1.grid.background = $(this).val();
393
            plotOptions.grid.background = $(this).val();
394
            plot1.replot();
395
            // Finally, check to see if we need to hide contour lines.
396
            checkContour();
397
        });
398
 
399
        $('input[type=radio][name=seriesColor]').change(function(){
400
            // this refers to the html element we are binding to.
401
            // $(this) is jQuery object on that element.
402
            if ($(this).val() === 'blue') {
403
                // reset highlight colors so they will be recalculated.
404
                plot1.series[0].highlightColors = [];
405
                plot1.series[1].highlightColors = [];
406
                // reset series color to properly calculate highlight color.
407
                plot1.series[0].color = blueColors[0];
408
                plot1.series[1].color = blueColors[1];
409
                // to actually draw a new color, have to set the color on the shaperenderer.
410
                plot1.series[0].renderer.shapeRenderer.fillStyle = blueColors[0];
411
                plot1.series[1].renderer.shapeRenderer.fillStyle = blueColors[1];
412
                // update plot options state.
413
                plotOptions.seriesColors = blueColors;
414
            }
415
            else if ($(this).val() === 'green') {
416
                // reset highlight colors so they will be recalculated.
417
                plot1.series[0].highlightColors = [];
418
                plot1.series[1].highlightColors = [];
419
                // reset series color to properly calculate highlight color.
420
                plot1.series[0].color = greenColors[0];
421
                plot1.series[1].color = greenColors[1];
422
                // to actually draw a new color, have to set the color on the shaperenderer.
423
                plot1.series[0].renderer.shapeRenderer.fillStyle = greenColors[0];
424
                plot1.series[1].renderer.shapeRenderer.fillStyle = greenColors[1];
425
                // update plot options state.
426
                plotOptions.seriesColors = blueColors;
427
            }
428
            plot1.replot();
429
            // Finally, check to see if we need to hide contour lines.
430
            checkContour();
431
        });
432
 
433
        $('input[type=checkbox][name=gridsVertical]').change(function(){
434
            // this refers to the html element we are binding to.
435
            // $(this) is jQuery object on that element.
436
            plot1.axes.xaxis.tickOptions.showGridline = this.checked;
437
            plotOptions.axes.xaxis.tickOptions.showGridline = this.checked;
438
            plot1.replot();
439
            // Finally, check to see if we need to hide contour lines.
440
            checkContour();
441
        });
442
 
443
        $('input[type=checkbox][name=gridsHorizontal]').change(function(){
444
            // this refers to the html element we are binding to.
445
            // $(this) is jQuery object on that element.
446
            plot1.axes.yaxis.tickOptions.showGridline = this.checked;
447
            plot1.axes.y2axis.tickOptions.showGridline = this.checked;
448
            plot1.axes.yMidAxis.tickOptions.showGridline = this.checked;
449
            plotOptions.axes.yaxis.tickOptions.showGridline = this.checked;
450
            plotOptions.axes.y2axis.tickOptions.showGridline = this.checked;
451
            plotOptions.axes.yMidAxis.tickOptions.showGridline = this.checked;
452
            plot1.replot();
453
            // Finally, check to see if we need to hide contour lines.
454
            checkContour();
455
        });
456
 
457
        $('input[type=checkbox][name=showMinorTicks]').change(function(){
458
            // this refers to the html element we are binding to.
459
            // $(this) is jQuery object on that element.
460
            plot1.axes.yaxis.showMinorTicks = !this.checked;
461
            plot1.axes.y2axis.showMinorTicks = !this.checked;
462
            plot1.axes.yMidAxis.showMinorTicks = !this.checked;
463
            plotOptions.axes.yaxis.showMinorTicks = !this.checked;
464
            plotOptions.axes.y2axis.showMinorTicks = !this.checked;
465
            plotOptions.axes.yMidAxis.showMinorTicks = !this.checked;
466
            plot1.replot();
467
            // Finally, check to see if we need to hide contour lines.
468
            checkContour();
469
        });
470
 
471
        $('input[type=checkbox][name=plotBands]').change(function(){
472
            // this refers to the html element we are binding to.
473
            // $(this) is jQuery object on that element.
474
            plot1.grid.plotBands.show = this.checked;
475
            plotOptions.grid.rendererOptions.plotBands.show = this.checked;
476
            plot1.replot();
477
            // Finally, check to see if we need to hide contour lines.
478
            checkContour();
479
        });
480
 
481
        $('input[type=checkbox][name=showContour]').change(function(){
482
            // this refers to the html element we are binding to.
483
            // $(this) is jQuery object on that element.
484
            var speed = $(this).val();
485
            if (this.checked) {
486
                plot1.series[2].canvas._elem.removeClass('jqplot-series-hidden');
487
                plot1.series[2].canvas._elem.fadeIn(speed);
488
                plot1.series[3].canvas._elem.removeClass('jqplot-series-hidden');
489
                plot1.series[3].canvas._elem.fadeIn(speed);
490
            }
491
            else {
492
                plot1.series[2].canvas._elem.addClass('jqplot-series-hidden');
493
                plot1.series[2].canvas._elem.fadeOut(speed);
494
                plot1.series[3].canvas._elem.addClass('jqplot-series-hidden');
495
                plot1.series[3].canvas._elem.fadeOut(speed);
496
            }
497
        });
498
 
499
        $('input[type=checkbox][name=barPadding]').change(function(){
500
            // this refers to the html element we are binding to.
501
            // $(this) is jQuery object on that element.
502
            if (this.checked) {
503
                var val = parseFloat($(this).val());
504
                plot1.series[0].barPadding = val;
505
                plot1.series[1].barPadding = val;
506
                plotOptions.seriesDefaults.rendererOptions.barPadding = val;
507
            }
508
            else {
509
                plot1.series[0].barPadding = 0;
510
                plot1.series[1].barPadding = 0;
511
                plotOptions.seriesDefaults.rendererOptions.barPadding = 0;
512
            }
513
            plot1.replot();
514
            // Finally, check to see if we need to hide contour lines.
515
            checkContour();
516
        });
517
 
518
        // bind to the data highlighting event to make custom tooltip:
519
        $('.jqplot-target').bind('jqplotDataHighlight', function(evt, seriesIndex, pointIndex, data) {
520
            // Here, assume first series is male poulation and second series is female population.
521
            // Adjust series indices as appropriate.
522
            var malePopulation = Math.abs(plot1.series[0].data[pointIndex][1]);
523
            var femalePopulation = Math.abs(plot1.series[1].data[pointIndex][1]);
524
            var ratio = femalePopulation / malePopulation * 100;
525
 
526
            $('#tooltipMale').stop(true, true).fadeIn(250).html(malePopulation.toPrecision(4));
527
            $('#tooltipFemale').stop(true, true).fadeIn(250).html(femalePopulation.toPrecision(4));
528
            $('#tooltipRatio').stop(true, true).fadeIn(250).html(ratio.toPrecision(4));
529
 
530
            // Since we don't know which axis is rendererd and acive with out a little extra work,
531
            // just use the supplied ticks array to get the age label.
532
            $('#tooltipAge').stop(true, true).fadeIn(250).html(ticks[pointIndex]);
533
        });
534
 
535
        // bind to the data highlighting event to make custom tooltip:
536
        $('.jqplot-target').bind('jqplotDataUnhighlight', function(evt, seriesIndex, pointIndex, data) {
537
            // clear out all the tooltips.
538
            $('.tooltip-item').stop(true, true).fadeOut(200).html('');
539
        });
540
 
541
        // add a date at the bottom.
542
 
543
        var d = new $.jsDate();
544
        $('div.jqplot-datestamp').html('Generated on '+d.strftime('%v'));
545
 
546
        $("div.chart-container").resizable({delay:20});
547
 
548
        $("div.chart-container").bind("resize", function(event, ui) {
549
            plot1.replot();
550
        });
551
 
552
    });
553
    </script>
554
 
555
 
556
<!-- End example scripts -->
557
 
558
<!-- Don't touch this! -->
559
 
560
 
561
    <script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
562
    <script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
563
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
564
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
565
<!-- End Don't touch this! -->
566
 
567
<!-- Additional plugins go here -->
568
 
569
    <script class="include" type="text/javascript" src="../plugins/jqplot.categoryAxisRenderer.min.js"></script>
570
 
571
    <!-- load the pyramidAxis and Grid renderers in production.  pyramidRenderer will try to load via ajax if not present, but that is not optimal and depends on paths being set. -->
572
    <script class="include" type="text/javascript" src="../plugins/jqplot.pyramidAxisRenderer.min.js"></script>
573
    <script class="include" type="text/javascript" src="../plugins/jqplot.pyramidGridRenderer.min.js"></script>
574
 
575
    <script class="include" type="text/javascript" src="../plugins/jqplot.pyramidRenderer.min.js"></script>
576
    <script class="include" type="text/javascript" src="../plugins/jqplot.canvasTextRenderer.min.js"></script>
577
    <script class="include" type="text/javascript" src="../plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
578
    <script class="include" type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
579
 
580
<!-- End additional plugins -->
581
 
582
        </div>
583
         <div class="col2">
584
 
585
           <div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
586
           <div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
587
           <div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
588
           <div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
589
           <div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
590
           <div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
591
           <div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
592
           <div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
593
           <div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
594
           <div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
595
           <div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
596
           <div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
597
           <div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
598
           <div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
599
           <div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
600
           <div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
601
           <div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
602
           <div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
603
           <div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
604
           <div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
605
           <div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
606
           <div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
607
           <div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
608
           <div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
609
           <div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
610
           <div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
611
           <div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
612
           <div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
613
           <div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
614
           <div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
615
           <div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
616
           <div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
617
           <div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
618
           <div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
619
           <div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
620
           <div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
621
           <div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
622
           <div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
623
           <div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
624
           <div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
625
           <div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
626
           <div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
627
           <div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
628
           <div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
629
           <div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
630
           <div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
631
           <div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
632
           <div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
633
           <div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
634
           <div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
635
           <div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
636
           <div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
637
           <div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
638
           <div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
639
           <div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
640
           <div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
641
 
642
         </div>
643
               </div>
644
    </div>
645
    <script type="text/javascript" src="example.min.js"></script>
646
 
647
</body>
648
 
649
 
650
</html>