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>Quintile 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
  <link class="include" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/smoothness/jquery-ui.css" rel="Stylesheet" />
36
 
37
    <style type="text/css">
38
 
39
        .quintile-outer-container {
40
            width: 900px;
41
            margin-bottom: 25px;
42
        }
43
 
44
        .jqplot-chart {
45
            width: 500px;
46
            height: 400px;
47
        }
48
 
49
        pre.code {
50
            margin-top: 45px;
51
            clear: both;
52
        }
53
 
54
        .quintile-toolbar .ui-icon {
55
            float: right;
56
            margin: 3px 5px;
57
        }
58
 
59
        table.stats-table td, table.highlighted-stats-table td {
60
            background-color: rgb(230, 230, 230);
61
            padding: 0.5em;
62
        }
63
 
64
        col.label {
65
            width: 14em;
66
        }
67
 
68
        col.value {
69
            width: 7em;
70
        }
71
 
72
        td.quintile-value {
73
            width: 7em;
74
            text-align: right;
75
        }
76
 
77
        table.stats-table td.tooltip-header, table.highlighted-stats-table td.tooltip-header {
78
            background-color: rgb(200, 200, 200);
79
        }
80
 
81
        table.stats-table, table.highlighted-stats-table, td.contour-cell {
82
            font-size: 0.7em;
83
        }
84
 
85
        td.contour-cell {
86
            height: 1.5em;
87
            padding-left: 20px;
88
            padding-bottom: 1.5em;
89
        }
90
 
91
        table.highlighted-stats-table {
92
            margin-top: 15px;
93
        }
94
 
95
        td.stats-cell {
96
            padding-left: 20px;
97
            padding-top: 20px;
98
            vertical-align: top;
99
 
100
        }
101
 
102
        td.stats-cell div.input {
103
            font-size: 0.7em;
104
            margin-top: 1.5em;
105
        }
106
 
107
        div.overlay-chart-container {
108
            display: none;
109
            z-index: 11;
110
            position: fixed;
111
            width: 588px;
112
            left: 50%;
113
            margin-left: -294px;
114
            background-color: white;
115
        }
116
 
117
        div.overlay-chart-container .ui-icon {
118
            float: right;
119
            margin: 3px 5px;
120
        }
121
 
122
        div.overlay-shadow {
123
            display: none;
124
            z-index: 10;
125
            background-color: rgba(0, 0, 0, 0.8);
126
            position: fixed;
127
            top: 0px;
128
            left: 0px;
129
            width: 100%;
130
            height: 100%;
131
        }
132
 
133
        @media print {
134
            td.stats-cell {
135
                vertical-align: top;
136
                padding-top: 35px;
137
            }
138
 
139
            table.stats-table, table.stats-table td {
140
                 color: #aaaaaa;
141
                 border: 1px solid #bbbbbb;
142
                 border-collapse: collapse;
143
            }
144
 
145
            table.stats-table tr {
146
                font-family: Verdana,Arial,sans-serif;
147
                /*font-size: 0.7em;*/
148
            }
149
        }
150
 
151
    </style>
152
 
153
    <div class="overlay-shadow"></div>
154
 
155
    <div class="overlay-chart-container ui-corner-all">
156
        <div class="overlay-chart-container-header ui-widget-header ui-corner-top">Right click the image to Copy or Save As...<div class="ui-icon ui-icon-closethick"></div></div>
157
        <div class="overlay-chart-container-content ui-corner-bottom"></div>
158
    </div>
159
 
160
    <div class="quintile-outer-container ui-widget ui-corner-all">
161
        <div class="quintile-toolbar ui-widget-header  ui-corner-top">
162
            <span class="quintile-title">Income Level:  First Quintile</span>
163
            <div class="quintile-toggle ui-icon ui-icon-arrowthickstop-1-n"></div>
164
            <div class="ui-icon ui-icon-newwin"></div>
165
        </div>
166
        <div class="quintile-content ui-widget-content ui-corner-bottom">
167
            <table class="quintile-display">
168
                <tr>
169
                    <td class="chart-cell" rowspan="2">
170
                        <div class="jqplot-chart"></div>
171
                    </td>
172
                    <td class="stats-cell">
173
                        <table class="stats-table">
174
                        <colgroup>
175
                            <col class="label">
176
                            <col class="value">
177
                        </colgroup>
178
                        <tbody>
179
                            <tr>
180
                                <td class="ui-corner-tl">Mean Age:</td>
181
                                <td class="quintile-value summary-meanAge ui-corner-tr"></td>
182
                            </tr>
183
                            <tr>
184
                                <td>Sex Ratio:</td>
185
                                <td class="quintile-value summary-sexRatio"></td>
186
                            </tr>
187
                            <tr>
188
                                <td>Age Dependency Ratio:</td>
189
                                <td class="quintile-value summary-ageDependencyRatio"></td>
190
                            </tr>
191
                            <tr>
192
                                <td>Population, Total:</td>
193
                                <td class="quintile-value summary-populationTotal"></td>
194
                            </tr>
195
                            <tr>
196
                                <td>Population, Male:</td>
197
                                <td class="quintile-value summary-populationMale"></td>
198
                            </tr>
199
                            <tr>
200
                                <td class="ui-corner-bl">Population, Female:</td>
201
                                <td class="quintile-value summary-populationFemale ui-corner-br"></td>
202
                            </tr>
203
                        </tbody>
204
                        </table>
205
                        <table class="highlighted-stats-table">
206
                        <colgroup>
207
                            <col class="label">
208
                            <col class="value">
209
                        </colgroup>
210
                        <tbody>
211
                            <tr class="tooltip-header">
212
                                <td class="tooltip-header ui-corner-top" colspan="2">Highlighted Range: <span class="tooltip-item tooltipAge">&nbsp;</span></td>
213
                            </tr>
214
                            <tr>
215
                                <td>Population, Male: </td>
216
                                <td class="quintile-value"><span class="tooltip-item tooltipMale">&nbsp;</span></td>
217
                            </tr>
218
                            <tr>
219
                                <td>Population, Female: </td>
220
                                <td class="quintile-value"><span class="tooltip-item tooltipFemale">&nbsp;</span></td>
221
                            </tr>
222
                            <tr>
223
                                <td class="ui-corner-bl">Sex Ratio: </td>
224
                                <td class="quintile-value ui-corner-br"><span class="tooltip-item tooltipRatio">&nbsp;</span></td>
225
                            </tr>
226
                        <tbody>
227
                        </table>
228
                    </td>
229
                </tr>
230
                <tr>
231
                    <td class="contour-cell">
232
                        <input name="showContour" type="checkbox" /> Use as overlay on other charts?
233
                    </td>
234
                </tr>
235
            </table>
236
        </div>
237
    </div>
238
 
239
    <script class="code" type="text/javascript" language="javascript">
240
    $(document).ready(function(){
241
 
242
        // if browser supports canvas, show additional toolbar icons
243
        if (!$.jqplot.use_excanvas) {
244
            $('div.quintile-toolbar').append('<div class="ui-icon ui-icon-image"></div><div class="ui-icon ui-icon-print"></div>');
245
        }
246
 
247
        var quintHash = {0: 'First Quintile', 1: 'Second Quintile', 2: 'Third Quintile', 3: 'Fourth Quintile', 4: 'Fifth Quintile'}
248
 
249
        // Add the needed containers:
250
        for (var i=1; i<5; i++) {
251
            var el = $('div.quintile-outer-container:last')
252
            var clone = el.clone();
253
            clone.find('span.quintile-title').html('Income Level:  ' + quintHash[i]);
254
            clone.insertAfter(el);
255
        }
256
 
257
        var male;
258
        var female;
259
        var summaryTable;
260
        var sexRatios;
261
        var quintiles = [ [ [27777522, 13657657, 14119865, 22.96185242727780, 22.92340104876670, 22.99840039165770, 95.15435452471940],
262
            [0.16814981778556500, 0.16938884829023600, 0.13029899959403300, 0.08445061806046640, 0.05811840452702920, 0.05631028061504850, 0.06512242137179920, 0.06861163659177230, 0.06020567860988050, 0.04355880225459750, 0.02803499342457000, 0.01912758869230340, 0.01515038483762410, 0.01223701332240520, 0.00869244058559189, 0.00529469386492945, 0.00328609724536106, 0.00194751964322071, 0.00114713861262733, 0.00086662207093871],
263
            [0.15777933298339800, 0.15671077815250300, 0.12447815070139100, 0.08939377850853680, 0.07830223837100820, 0.08053563812713150, 0.07682071635522590, 0.06269916689630620, 0.04365876627610810, 0.03084162032257200, 0.02432244409407740, 0.02120157090634930, 0.01791380814933710, 0.01326354596024400, 0.00968643784396050, 0.00633359323592785, 0.00349435421488265, 0.00158514030722019, 0.00062587894057936, 0.00035303965324001],
264
            [0.96726540940724300, 1.03084161446685000, 1.04551821911720000, 1.01249668698901000, 0.91377904610163700, 0.71793506186340200, 0.67630912102504800, 0.81996977584158100, 1.05847758500203000, 1.33386431492214000, 1.36610600401065000, 1.11490766666616000, 0.87264547467534200, 0.81805292713174800, 0.89240386671080400, 0.86800712885521700, 0.80860485322858600, 0.90961820179781800, 1.18839220506104000, 1.77284683642290000, 2.37438923518884000] ],
265
          [ [27749565, 13838477, 13911088, 24.59760821726010, 24.93140692365050, 24.25806641635340, 77.89121151531350],
266
            [0.13460476947529500, 0.14372006850062500, 0.12847108657610600, 0.09875785820893480, 0.07155805029015120, 0.06299959058572970, 0.06669930695548060, 0.06620210601954020, 0.05883374707069510, 0.04833706700819440, 0.03521801565126300, 0.02559536412958920, 0.02062306586521670, 0.01576211515574400, 0.01023801649094930, 0.00572503164287636, 0.00307516687772024, 0.00165330051290922, 0.00104697926747485, 0.00087929371550523],
267
            [0.13970508453303800, 0.13975442365362800, 0.11681679473806300, 0.09435373241811580, 0.08802952295423720, 0.08580953135424240, 0.07740975573970180, 0.06538018068005290, 0.04960049471620990, 0.03735678030431880, 0.02976493031984740, 0.02384624281925690, 0.01786909883056510, 0.01280223896627530, 0.00854305561048803, 0.00534781144388522, 0.00336845668342047, 0.00201559921183726, 0.00124722944598909, 0.00097903557682698],
268
            [0.99478035075329800, 0.95846318148882600, 1.02300804808641000, 1.09402516010135000, 1.04121346671673000, 0.80864396372867400, 0.73034724501018900, 0.85714209189972800, 1.00728620755889000, 1.17996112502462000, 1.28717635944761000, 1.17702912743046000, 1.06774746443199000, 1.14809486978252000, 1.22477345443636000, 1.19214694369792000, 1.06494947429125000, 0.90816533289574900, 0.81597117843348200, 0.83506239070880300, 0.89343444858290900] ],
269
          [ [27773083, 14068521, 13704562, 26.03124974398200, 26.46223974345070, 25.59233340000260, 66.99286359589060],
270
            [0.11075465721807600, 0.12531352270434800, 0.12461977157255700, 0.11125959454297800, 0.08638877858554280, 0.06731675090789110, 0.06187750302195390, 0.06283663484842800, 0.05868334457568110, 0.05026814063111530, 0.04079416969542070, 0.03139012243581270, 0.02388339994025160, 0.01756428234835730, 0.01203845901370310, 0.00701750790134651, 0.00386618590184589, 0.00206610447696370, 0.00117506121489637, 0.00088600846283140],
271
            [0.11432537302481000, 0.12667609073231400, 0.11974891524623500, 0.10506132545858400, 0.09301444384053810, 0.08267846594852100, 0.07221670745205490, 0.06493541188927070, 0.05720135869997910, 0.04682451198762990, 0.03485427327295350, 0.02629070404866000, 0.01998999845792230, 0.01428519039077750, 0.00980039073555805, 0.00599266397652053, 0.00331791767499821, 0.00156650907345305, 0.00072094415435746, 0.00049880393486330],
272
            [1.02655750690901000, 0.99449511323857500, 1.01551553024478000, 1.06831332671397000, 1.08712098857701000, 0.95343309606544400, 0.83582242597784900, 0.87958614394243600, 0.99337814815975000, 1.05315379343805000, 1.10205392288684000, 1.20150435531963000, 1.22567146812179000, 1.22649751828565000, 1.26219850103057000, 1.26098752647638000, 1.20211569414631000, 1.19619066818704000, 1.35395006440030000, 1.67317801793479000, 1.82343918147671000] ],
273
          [ [27763227, 14197178, 13566049, 27.18018253648030, 27.20726467467510, 27.15223055717600, 58.62068064918010],
274
            [0.09684619409307840, 0.11118728522535100, 0.12478646127724500, 0.11986149426641600, 0.09520840637648180, 0.07266436962641580, 0.06157942773922730, 0.05776990145557140, 0.05595079146694350, 0.05422906155293650, 0.04606394160905190, 0.03460401579477880, 0.02431694855838520, 0.01695117276859440, 0.01211661291564830, 0.00784551008485565, 0.00430794264393258, 0.00206401896375649, 0.00099084255721430, 0.00065560102411584],
275
            [0.09693358901304290, 0.10652960384957600, 0.11580433409088400, 0.11321777793810400, 0.09912292067710200, 0.08131783917502760, 0.07048109387720830, 0.06833459006738460, 0.06313644652192900, 0.05255568033191890, 0.03903863379099840, 0.02910689297792140, 0.02269025908501970, 0.01651322011205660, 0.01126491285383100, 0.00657328507941835, 0.00372023325715849, 0.00195236631466226, 0.00099341991698984, 0.00071290106976617],
276
            [1.04652268320717000, 1.04557914271650000, 1.09227868937597000, 1.12769408251422000, 1.10793353197135000, 1.00519391705143000, 0.93515656400210500, 0.91434829403035100, 0.88472781091218400, 0.92741634411137500, 1.07984413189527000, 1.23485263418514000, 1.24416877771066000, 1.12154903817441000, 1.07427786276195000, 1.12564654732811000, 1.24907168423899000, 1.21184866195041000, 1.10637161065473000, 1.04380755195023000, 0.96240750921599800] ],
277
          [ [27754352, 14075999, 13678353, 29.11682279982730, 29.25251358929000, 28.97478042663600, 50.90167162031000],
278
            [0.07773301902264660, 0.09756477612918870, 0.11769211568808000, 0.11953094319783700, 0.10070874902748300, 0.07710380627667010, 0.06107481209270700, 0.05557245339785060, 0.05625960991605260, 0.05655944052572760, 0.05050018273054490, 0.03998167380585820, 0.03018284824156070, 0.02178128532719260, 0.01546004923447120, 0.01053184010191340, 0.00618324070639374, 0.00309253762350306, 0.00148564380196157, 0.00100097315235749],
279
            [0.07414870947175290, 0.08945795766137910, 0.11321883781048900, 0.11651658562245200, 0.09931926283967810, 0.08029240511352740, 0.07198971835798040, 0.07305219001114050, 0.06968907391161920, 0.06031073521142600, 0.04701710534217110, 0.03436632086919040, 0.02578058253156860, 0.01918327371957260, 0.01236986721101920, 0.00632468067099160, 0.00324813634215291, 0.00173308253350124, 0.00107597562154257, 0.00090549914684498],
280
            [1.02907119007676000, 1.07881594924275000, 1.12232721275485000, 1.06972980730035000, 1.05569391096106000, 1.04346799653703000, 0.98820437091643300, 0.87304591541007500, 0.78283773210481600, 0.83076356851850300, 0.96506352588551000, 1.10530588311237000, 1.19721831153422000, 1.20479432618776000, 1.16843941971104000, 1.28614891275391000, 1.71360639234849000, 1.95896791328722000, 1.83628956559048000, 1.42088092397757000, 1.13757438283678000] ] ]
281
 
282
        $('td.summary-meanAge').each(function(index) {
283
            $(this).html($.jqplot.sprintf('%5.2f', quintiles[index][0][3]));
284
        });
285
 
286
        $('td.summary-sexRatio').each(function(index) {
287
            $(this).html($.jqplot.sprintf('%5.2f', quintiles[index][3][0]));
288
        });
289
 
290
        $('td.summary-ageDependencyRatio').each(function(index) {
291
            $(this).html($.jqplot.sprintf('%5.2f', quintiles[index][0][6]));
292
        });
293
 
294
        $('td.summary-populationTotal').each(function(index) {
295
            $(this).html($.jqplot.sprintf("%'d", quintiles[index][0][0]));
296
        });
297
 
298
        $('td.summary-populationMale').each(function(index) {
299
            $(this).html($.jqplot.sprintf("%'d", quintiles[index][0][1]));
300
        });
301
 
302
        $('td.summary-populationFemale').each(function(index) {
303
            $(this).html($.jqplot.sprintf("%'d", quintiles[index][0][2]));
304
        });
305
 
306
        // These two variables should be removed outside of the jqplot.com example environment.
307
        $.jqplot._noToImageButton = true;
308
        $.jqplot._noCodeBlock = true;
309
 
310
        // the "x" values from the data will go into the ticks array.
311
        // ticks should be strings for this case where we have values like "75+"
312
        var ticks = ["0-4", "5-9", "10-14", "15-19", "20-24", "25-29", "30-34", "35-39", "40-44", "45-49", "50-54", "55-59", "60-64", "65-69", "70-74", "75-79", "80-84", "85-90", "90-94", "95+"];
313
 
314
        // Custom color arrays are set up for each series to get the look that is desired.
315
        // Two color arrays are created for the default and optional color which the user can pick.
316
        var greenColors = ["#526D2C", "#77933C"];
317
 
318
        // These options are common to all plots.
319
        var plotOptions = {
320
            // We set up a customized title which acts as labels for the left and right sides of the pyramid.
321
            title: {
322
                text: '<span style="position:relative;left:25%;">Male</span><span style="position:relative;left:50%;">Female</span>',
323
                textAlign: 'left'
324
            },
325
            // by default, the series will use the green color scheme.
326
            seriesColors: greenColors,
327
 
328
            grid: {
329
                drawBorder: false,
330
                shadow: false,
331
                background: "white",
332
                rendererOptions: {
333
                    // plotBands is an option of the pyramidGridRenderer.
334
                    // it will put banding at starting at a specified value
335
                    // along the y axis with an adjustable interval.
336
                    plotBands: {
337
                        show: true,
338
                        interval: 2,
339
                        color: 'rgb(250, 240, 225)'
340
                    }
341
                }
342
            },
343
 
344
            // This makes the effective starting value of the axes 0 instead of 1.
345
            // For display, the y axis will use the ticks we supplied.
346
            defaultAxisStart: 0,
347
            seriesDefaults: {
348
                renderer: $.jqplot.PyramidRenderer,
349
                rendererOptions: {
350
                    barPadding: 4,
351
                    fill: false
352
                },
353
                yaxis: "yaxis",
354
                shadow: false,
355
                show: false
356
            },
357
 
358
            // We have 10 series, but only 2 will be shown at a time unless an overlay is turned on.
359
            // Set up options for all series now, so when turned on they will look right.
360
            series: [
361
                // For pyramid plots, the default side is right.
362
                // We want to override here to put first set of bars
363
                // on left.
364
                {
365
                    rendererOptions:{
366
                        side: "left"
367
                    }
368
                },
369
                {
370
                    yaxis: "y2axis"
371
                },
372
                {
373
                    rendererOptions: {
374
                        side: 'left'
375
                    }
376
                },
377
                {
378
                    yaxis: 'y2axis'
379
                },
380
                {
381
                    rendererOptions: {
382
                        side: 'left'
383
                    }
384
                },
385
                {
386
                    yaxis: 'y2axis'
387
                },
388
                {
389
                    rendererOptions: {
390
                        side: 'left'
391
                    }
392
                },
393
                {
394
                    yaxis: 'y2axis'
395
                },
396
                {
397
                    rendererOptions: {
398
                        side: 'left'
399
                    }
400
                },
401
                {
402
                    yaxis: 'y2axis'
403
                }
404
            ],
405
            axesDefaults: {
406
                tickOptions: {
407
                    showGridline: false
408
                },
409
                pad: 0,
410
                rendererOptions: {
411
                    baselineWidth: 2
412
                },
413
                scaleToHiddenSeries: true
414
            },
415
 
416
            // Set up all the y axes, since users are allowed to switch between them.
417
            // The only axis that will show is the one that the series are "attached" to.
418
            // We need the appropriate options for the others for when the user switches.
419
            axes: {
420
                xaxis: {
421
                    tickOptions: {
422
                        formatter: $.jqplot.PercentTickFormatter,
423
                        formatString: '%d%%'
424
                    }
425
                },
426
                yaxis: {
427
                    label: "Age",
428
                    // Use canvas label renderer to get rotated labels.
429
                    labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
430
                    // include empty tick options, they will be used
431
                    // as users set options with plot controls.
432
                    tickOptions: {},
433
                    showMinorTicks: true,
434
                    ticks: ticks,
435
                    rendererOptions: {
436
                        category: true
437
                    }
438
                },
439
                y2axis: {
440
                    label: "Age",
441
                    // Use canvas label renderer to get rotated labels.
442
                    labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
443
                    // include empty tick options, they will be used
444
                    // as users set options with plot controls.
445
                    tickOptions: {},
446
                    showMinorTicks: true,
447
                    ticks: ticks,
448
                    rendererOptions: {
449
                        category: true
450
                    }
451
                }
452
            }
453
        };
454
 
455
        // These options are different for each series.
456
        // sopts are common options for the overlay series in each plot.
457
        var sopts = {color: '#C57225'};
458
 
459
        // An array of 5 elements, one for each plot.
460
        var plotOptsArr = [];
461
 
462
        // Options for each individual plot
463
        plotOptsArr[0] = $.extend(true, {}, plotOptions, {series:[{show: true, rendererOptions:{synchronizeHighlight: 1, fill: true}}, {show: true, rendererOptions: {synchronizeHighlight: 0, fill: true}}, sopts, sopts, sopts, sopts, sopts, sopts, sopts, sopts]});
464
 
465
        plotOptsArr[1] = $.extend(true, {}, plotOptions, {series:[sopts, sopts, {show: true, rendererOptions:{synchronizeHighlight: 3, fill: true}}, {show: true, rendererOptions: {synchronizeHighlight: 2, fill: true}}, sopts, sopts, sopts, sopts, sopts, sopts]});
466
 
467
        plotOptsArr[2] = $.extend(true, {}, plotOptions, {series:[sopts, sopts, sopts, sopts, {show: true, rendererOptions:{synchronizeHighlight: 5, fill: true}}, {show: true, rendererOptions: {synchronizeHighlight: 4, fill: true}}, sopts, sopts, sopts, sopts]});
468
 
469
        plotOptsArr[3] = $.extend(true, {}, plotOptions, {series:[sopts, sopts, sopts, sopts, sopts, sopts, {show: true, rendererOptions:{synchronizeHighlight: 7, fill: true}}, {show: true, rendererOptions: {synchronizeHighlight: 6, fill: true}}, sopts, sopts]});
470
 
471
        plotOptsArr[4] = $.extend(true, {}, plotOptions, {series:[sopts, sopts, sopts, sopts, sopts, sopts, sopts, sopts, {show: true, rendererOptions:{synchronizeHighlight: 9, fill: true}}, {show: true, rendererOptions: {synchronizeHighlight: 8, fill: true}}]});
472
 
473
 
474
        // Create all the plots at one time.
475
        // Use jQuery selecctor syntax to select all the plot targets.  Here, no id's were specified on the targets, so they are auto generated.
476
        // You can get a reference to the individual plot object by:
477
        //     var plot = $('div.jqplot-chart').eq(0).data('jqplot');
478
        //
479
        $('div.jqplot-chart').jqplot([quintiles[0][1], quintiles[0][2], quintiles[1][1], quintiles[1][2], quintiles[2][1], quintiles[2][2], quintiles[3][1], quintiles[3][2], quintiles[4][1], quintiles[4][2]], plotOptsArr[0], plotOptsArr[1], plotOptsArr[2], plotOptsArr[3], plotOptsArr[4]);
480
 
481
        //////
482
        // The followng functions use verbose css selectors to make
483
        // it clear exactly which elements they are binging to/operating on
484
        //////
485
 
486
        // bind to the data highlighting event to make custom tooltip:
487
        $(".jqplot-target").each(function(index){
488
            $(this).bind("jqplotDataHighlight", function(evt, seriesIndex, pointIndex, data) {
489
                // Here, assume first series is male poulation and second series is female population.
490
                // Adjust series indices as appropriate.
491
                var plot = $(this).data('jqplot');
492
                var malePopulation = Math.abs(plot.series[0].data[pointIndex][1]) * quintiles[index][0][1];
493
                var femalePopulation = Math.abs(plot.series[1].data[pointIndex][1]) * quintiles[index][0][2];
494
                var malePopulation = quintiles[index][1][pointIndex] * quintiles[index][0][1];
495
                var femalePopulation = quintiles[index][2][pointIndex] * quintiles[index][0][2];
496
                // var ratio = femalePopulation / malePopulation * 100;
497
                var ratio = quintiles[index][3][pointIndex+1];
498
 
499
                $(this).closest('table').find('.tooltipMale').stop(true, true).fadeIn(350).html($.jqplot.sprintf("%'d", malePopulation));
500
                $(this).closest('table').find('.tooltipFemale').stop(true, true).fadeIn(350).html($.jqplot.sprintf("%'d", femalePopulation));
501
                $(this).closest('table').find('.tooltipRatio').stop(true, true).fadeIn(350).html($.jqplot.sprintf('%5.2f', ratio));
502
 
503
                // Since we don't know which axis is rendererd and acive with out a little extra work,
504
                // just use the supplied ticks array to get the age label.
505
                $(this).closest('table').find('.tooltipAge').stop(true, true).fadeIn(350).html(ticks[pointIndex]);
506
            });
507
        });
508
 
509
        // bind to the data highlighting event to make custom tooltip:
510
        $(".jqplot-target").each(function() {
511
            $(this).bind("jqplotDataUnhighlight", function(evt, seriesIndex, pointIndex, data) {
512
                // clear out all the tooltips.
513
                $(this).closest('table').find(".tooltip-item").fadeOut(250);
514
            });
515
        });
516
 
517
        // Open and close the plot container.
518
        $('.quintile-toggle').each(function() {
519
            $(this).click(function(e) {
520
                if ($(this).hasClass('ui-icon-arrowthickstop-1-n')) {
521
                    $(this).parent().next('.quintile-content').effect('blind', {mode:'hide'}, 600);
522
                    // $('.quintile-content').jqplotEffect('blind', {mode: 'hide'}, 600);
523
                    $(this).removeClass('ui-icon-arrowthickstop-1-n');
524
                    $(this).addClass('ui-icon-arrowthickstop-1-s');
525
                }
526
                else if ($(this).hasClass('ui-icon-arrowthickstop-1-s')) {
527
                    $(this).parent().next('.quintile-content').effect('blind', {mode:'show'}, 600, function() {
528
                        $(this).find('div.jqplot-chart').data('jqplot').replot();
529
                    });
530
                    // $('.quintile-content').jqplotEffect('blind', {mode: 'show'}, 150);
531
                    $(this).removeClass('ui-icon-arrowthickstop-1-s');
532
                    $(this).addClass('ui-icon-arrowthickstop-1-n');
533
                }
534
            });
535
        });
536
 
537
        // Handle each of the checkboxes to display overlays.
538
        $('input[type=checkbox][name=showContour]').each(function(index) {
539
            // on load/reload, clear all the check boxes.
540
            $(this).get(0).checked = false;
541
 
542
            // bind to change event event on the checkbox.
543
            $(this).change(function(evt){
544
 
545
                // if check box is checked.
546
                if (this.checked) {
547
                    // uncheck all other check boxes.
548
                    $('input[type=checkbox][name=showContour]').each(function(cidx) {
549
                        if (cidx !== index) {
550
                            this.checked = false;
551
                        }
552
                    });
553
 
554
                    // On each chart, show the checked plot's overlay and
555
                    // show the original plot.
556
                    $('div.jqplot-chart').each(function(pidx) {
557
                        var plot = $(this).data('jqplot');
558
 
559
                        // Set up options to hide all series.
560
                        var seriesOpts = [{show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}];
561
 
562
                        // Show series for this particular plot (pidx) and for the checked plot (index).
563
                        seriesOpts[2 * pidx].show = true;
564
                        seriesOpts[2 * pidx + 1].show = true;
565
                        seriesOpts[2 * index].show = true;
566
                        seriesOpts[2 * index + 1].show = true;
567
 
568
                        // replot with the new options.
569
                        plot.replot({series: seriesOpts});
570
 
571
                    });
572
                }
573
 
574
                // if check box is not checked.
575
                else {
576
                    $('div.jqplot-chart').each(function(pidx) {
577
                        // Set up options to hide all series.
578
                        var seriesOpts = [{show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}, {show: false}];
579
                        var plot = $(this).data('jqplot');
580
 
581
                        // Here showing only the series for this particular plot (pidx).
582
                        seriesOpts[2 * pidx].show = true;
583
                        seriesOpts[2 * pidx + 1].show = true;
584
 
585
                        // replot with the new options.
586
                        plot.replot({series: seriesOpts});
587
                    });
588
                }
589
            })
590
        });
591
 
592
        $('.ui-icon-print').click(function(){
593
            $(this).parent().next().print();
594
        });
595
 
596
 
597
        $('.ui-icon-image').each(function() {
598
            $(this).bind('click', function(evt) {
599
                var chart = $(this).closest('div.quintile-outer-container').find('div.jqplot-target');
600
                var imgelem = chart.jqplotToImageElem();
601
                var div = $('div.overlay-chart-container-content');
602
                div.empty();
603
                div.append(imgelem);
604
                $('div.overlay-shadow').fadeIn(600);
605
                div.parent().fadeIn(1000);
606
                div = null;
607
            });
608
        });
609
 
610
 
611
        $('.ui-icon-newwin').each(function(index) {
612
            $(this).bind('click', function(evt) {
613
                var url = 'kcp_pyramid_by_age.html?qidx='+index;
614
                window.open(url);
615
            });
616
        });
617
 
618
        $('div.overlay-chart-container-header div.ui-icon-closethick').click(function(){
619
            var div = $('div.overlay-chart-container-content');
620
            div.parent().fadeOut(600);
621
            $('div.overlay-shadow').fadeOut(1000);
622
        });
623
 
624
    });
625
    </script>
626
 
627
<!-- End example scripts -->
628
 
629
<!-- Don't touch this! -->
630
 
631
 
632
    <script class="include" type="text/javascript" src="../jquery.jqplot.min.js"></script>
633
    <script type="text/javascript" src="syntaxhighlighter/scripts/shCore.min.js"></script>
634
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.min.js"></script>
635
    <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.min.js"></script>
636
<!-- End Don't touch this! -->
637
 
638
<!-- Additional plugins go here -->
639
 
640
    <script class="include" type="text/javascript" src="../plugins/jqplot.categoryAxisRenderer.min.js"></script>
641
 
642
    <!-- 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. -->
643
    <script class="include" type="text/javascript" src="../plugins/jqplot.pyramidAxisRenderer.min.js"></script>
644
    <script class="include" type="text/javascript" src="../plugins/jqplot.pyramidGridRenderer.min.js"></script>
645
 
646
    <script class="include" type="text/javascript" src="../plugins/jqplot.pyramidRenderer.min.js"></script>
647
    <script class="include" type="text/javascript" src="../plugins/jqplot.canvasTextRenderer.min.js"></script>
648
    <script class="include" type="text/javascript" src="../plugins/jqplot.canvasAxisLabelRenderer.min.js"></script>
649
    <script class="include" type="text/javascript" src="http:/ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
650
    <script class="include" type="text/javascript" src="kcp.print.js"></script>
651
 
652
<!-- End additional plugins -->
653
 
654
        </div>
655
         <div class="col2">
656
 
657
           <div class="example-link"><a class="example-link" href="data-renderers.html">AJAX and JSON Data Loading via Data Renderers</a></div>
658
           <div class="example-link"><a class="example-link" href="barLineAnimated.html">Animated Charts</a></div>
659
           <div class="example-link"><a class="example-link" href="dashboardWidget.html">Animated Dashboard Sample - Filled Line with Log Axis</a></div>
660
           <div class="example-link"><a class="example-link" href="kcp_area.html">Area Chart</a></div>
661
           <div class="example-link"><a class="example-link" href="kcp_area2.html">Area Chart 2</a></div>
662
           <div class="example-link"><a class="example-link" href="axisLabelTests.html">Axis Labels</a></div>
663
           <div class="example-link"><a class="example-link" href="axisLabelsRotatedText.html">Axis Labels and Rotated Text</a></div>
664
           <div class="example-link"><a class="example-link" href="barTest.html">Bar Charts</a></div>
665
           <div class="example-link"><a class="example-link" href="multipleBarColors.html">Bar Colors Example</a></div>
666
           <div class="example-link"><a class="example-link" href="bezierCurve.html">Bezier Curve Plots</a></div>
667
           <div class="example-link"><a class="example-link" href="blockPlot.html">Block Plots</a></div>
668
           <div class="example-link"><a class="example-link" href="bubbleChart.html">Bubble Charts</a></div>
669
           <div class="example-link"><a class="example-link" href="bubble-plots.html">Bubble Plots</a></div>
670
           <div class="example-link"><a class="example-link" href="candlestick.html">Candlestick and Open Hi Low Close Charts</a></div>
671
           <div class="example-link"><a class="example-link" href="theming.html">Chart Theming</a></div>
672
           <div class="example-link"><a class="example-link" href="fillBetweenLines.html">Charts with Fill Between Lines</a></div>
673
           <div class="example-link"><a class="example-link" href="kcp_cdf.html">Cumulative Density Function Chart</a></div>
674
           <div class="example-link"><a class="example-link" href="dashedLines.html">Dashed Lines with Smoothing</a></div>
675
           <div class="example-link"><a class="example-link" href="cursor-highlighter.html">Data Point Highlighting, Tooltips and Cursor Tracking</a></div>
676
           <div class="example-link"><a class="example-link" href="point-labels.html">Data Point labels</a></div>
677
           <div class="example-link"><a class="example-link" href="date-axes.html">Date Axes</a></div>
678
           <div class="example-link"><a class="example-link" href="dateAxisRenderer.html">Date Axes 2</a></div>
679
           <div class="example-link"><a class="example-link" href="rotatedTickLabelsZoom.html">Date Axes, Rotated Labels and Zooming</a></div>
680
           <div class="example-link"><a class="example-link" href="canvas-overlay.html">Draw Lines on Plots - Canvas Overlay</a></div>
681
           <div class="example-link"><a class="example-link" href="draw-rectangles.html">Draw Rectangles on Plots</a></div>
682
           <div class="example-link"><a class="example-link" href="kcp_engel.html">Engel Curves</a></div>
683
           <div class="example-link"><a class="example-link" href="bandedLine.html">Error Bands and Confidence Intervals</a></div>
684
           <div class="example-link"><a class="example-link" href="area.html">Filled (Area) Charts</a></div>
685
           <div class="example-link"><a class="example-link" href="axisScalingForceTickAt.html">Force Plot to Have Tick at 0 or 100</a></div>
686
           <div class="example-link"><a class="example-link" href="hiddenPlotsInTabs.html">Hidden Plots</a></div>
687
           <div class="example-link"><a class="example-link" href="customHighlighterCursorTrendline.html">Highlighting, Dragging Points, Cursor and Trend Lines</a></div>
688
           <div class="example-link"><a class="example-link" href="line-charts.html">Line Charts and Options</a></div>
689
           <div class="example-link"><a class="example-link" href="kcp_lorenz.html">Lorenz Curves</a></div>
690
           <div class="example-link"><a class="example-link" href="mekkoCharts.html">Mekko Charts</a></div>
691
           <div class="example-link"><a class="example-link" href="meterGauge.html">Meter Gauge</a></div>
692
           <div class="example-link"><a class="example-link" href="candlestick-charts.html">Open Hi Low Close and Candlestick Charts</a></div>
693
           <div class="example-link"><a class="example-link" href="pieTest.html">Pie Charts and Options</a></div>
694
           <div class="example-link"><a class="example-link" href="pieTest4.html">Pie Charts and Options 2</a></div>
695
           <div class="example-link"><a class="example-link" href="pie-donut-charts.html">Pie and Donut Charts</a></div>
696
           <div class="example-link"><a class="example-link" href="selectorSyntax.html">Plot Creation with jQuery Selectors</a></div>
697
           <div class="example-link"><a class="example-link" href="zooming.html">Plot Zooming and Cursor Control</a></div>
698
           <div class="example-link"><a class="example-link" href="kcp_pdf.html">Probability Density Function Chart</a></div>
699
           <div class="example-link"><a class="example-link" href="kcp_pyramid_by_age.html">Pyramid Chart By Age</a></div>
700
           <div class="example-link"><a class="example-link" href="kcp_pyramid.html">Pyramid Charts</a></div>
701
           <div class="example-link"><a class="example-link" href="kcp_pyramid2.html">Pyramid Charts 2</a></div>
702
           <div class="example-link"><a class="example-link" href="kcp_quintiles.html">Quintile Pyramid Charts</a></div>
703
           <div class="example-link"><a class="example-link" href="resizablePlot.html">Resizable Plots</a></div>
704
           <div class="example-link"><a class="example-link" href="rotated-tick-labels.html">Rotated Labels and Font Styling</a></div>
705
           <div class="example-link"><a class="example-link" href="smoothedLine.html">Smoothed Lines</a></div>
706
           <div class="example-link"><a class="example-link" href="bar-charts.html">Vertical and Horizontal Bar Charts</a></div>
707
           <div class="example-link"><a class="example-link" href="waterfall.html">Waterfall Charts</a></div>
708
           <div class="example-link"><a class="example-link" href="waterfall2.html">Waterfall Charts 2</a></div>
709
           <div class="example-link"><a class="example-link" href="zoomOptions.html">Zoom Options</a></div>
710
           <div class="example-link"><a class="example-link" href="zoomProxy.html">Zoom Proxy - Control one plot from another</a></div>
711
           <div class="example-link"><a class="example-link" href="zoom1.html">Zooming</a></div>
712
           <div class="example-link"><a class="example-link" href="dateAxisLogAxisZooming.html">Zooming with Date and Log Axes</a></div>
713
 
714
         </div>
715
               </div>
716
    </div>
717
    <script type="text/javascript" src="example.min.js"></script>
718
 
719
</body>
720
 
721
 
722
</html>