radiant-race_results-extension 1.4.3 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/admin/race_instances_controller.rb +1 -1
- data/app/controllers/race_instances_controller.rb +7 -1
- data/app/controllers/race_performances_controller.rb +8 -0
- data/app/models/race.rb +7 -0
- data/app/models/race_checkpoint.rb +27 -1
- data/app/models/race_checkpoint_time.rb +33 -5
- data/app/models/race_instance.rb +38 -9
- data/app/models/race_performance.rb +81 -3
- data/app/views/admin/races/_form.html.haml +1 -2
- data/app/views/race_clubs/show.html.haml +3 -3
- data/app/views/race_instances/_results_header.html.haml +10 -0
- data/app/views/race_instances/_splits_header.html.haml +9 -0
- data/app/views/race_instances/show.html.haml +17 -8
- data/app/views/race_instances/splits.html.haml +19 -14
- data/app/views/race_performances/_performance.html.haml +12 -2
- data/app/views/race_performances/_splits.html.haml +30 -8
- data/app/views/race_performances/show.html.haml +18 -76
- data/app/views/races/show.html.haml +2 -1
- data/config/locales/en.yml +20 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20111103150827_mapping_routes.rb +22 -0
- data/db/migrate/20111115150827_finish_checkpoint.rb +8 -0
- data/lib/race_tags.rb +3 -3
- data/lib/radiant-race_results-extension.rb +1 -1
- data/public/images/race_results/sorts.png +0 -0
- data/public/javascripts/flot/API.txt +1201 -0
- data/public/javascripts/flot/FAQ.txt +76 -0
- data/public/javascripts/flot/LICENSE.txt +22 -0
- data/public/javascripts/flot/Makefile +9 -0
- data/public/javascripts/flot/NEWS.txt +508 -0
- data/public/javascripts/flot/PLUGINS.txt +137 -0
- data/public/javascripts/flot/README.txt +90 -0
- data/public/javascripts/flot/examples/ajax.html +143 -0
- data/public/javascripts/flot/examples/annotating.html +75 -0
- data/public/javascripts/flot/examples/arrow-down.gif +0 -0
- data/public/javascripts/flot/examples/arrow-left.gif +0 -0
- data/public/javascripts/flot/examples/arrow-right.gif +0 -0
- data/public/javascripts/flot/examples/arrow-up.gif +0 -0
- data/public/javascripts/flot/examples/basic.html +38 -0
- data/public/javascripts/flot/examples/data-eu-gdp-growth-1.json +4 -0
- data/public/javascripts/flot/examples/data-eu-gdp-growth-2.json +4 -0
- data/public/javascripts/flot/examples/data-eu-gdp-growth-3.json +4 -0
- data/public/javascripts/flot/examples/data-eu-gdp-growth-4.json +4 -0
- data/public/javascripts/flot/examples/data-eu-gdp-growth-5.json +4 -0
- data/public/javascripts/flot/examples/data-eu-gdp-growth.json +4 -0
- data/public/javascripts/flot/examples/data-japan-gdp-growth.json +4 -0
- data/public/javascripts/flot/examples/data-usa-gdp-growth.json +4 -0
- data/public/javascripts/flot/examples/graph-types.html +75 -0
- data/public/javascripts/flot/examples/hs-2004-27-a-large_web.jpg +0 -0
- data/public/javascripts/flot/examples/image.html +45 -0
- data/public/javascripts/flot/examples/index.html +44 -0
- data/public/javascripts/flot/examples/interacting-axes.html +97 -0
- data/public/javascripts/flot/examples/interacting.html +93 -0
- data/public/javascripts/flot/examples/layout.css +6 -0
- data/public/javascripts/flot/examples/multiple-axes.html +60 -0
- data/public/javascripts/flot/examples/navigate.html +118 -0
- data/public/javascripts/flot/examples/percentiles.html +57 -0
- data/public/javascripts/flot/examples/pie.html +756 -0
- data/public/javascripts/flot/examples/realtime.html +83 -0
- data/public/javascripts/flot/examples/resize.html +61 -0
- data/public/javascripts/flot/examples/selection.html +114 -0
- data/public/javascripts/flot/examples/setting-options.html +61 -0
- data/public/javascripts/flot/examples/stacking.html +77 -0
- data/public/javascripts/flot/examples/symbols.html +49 -0
- data/public/javascripts/flot/examples/thresholding.html +54 -0
- data/public/javascripts/flot/examples/time.html +71 -0
- data/public/javascripts/flot/examples/tracking.html +95 -0
- data/public/javascripts/flot/examples/turning-series.html +98 -0
- data/public/javascripts/flot/examples/visitors.html +90 -0
- data/public/javascripts/flot/examples/zooming.html +98 -0
- data/public/javascripts/flot/excanvas.js +1427 -0
- data/public/javascripts/flot/excanvas.min.js +1 -0
- data/public/javascripts/flot/jquery.colorhelpers.js +179 -0
- data/public/javascripts/flot/jquery.colorhelpers.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.crosshair.js +167 -0
- data/public/javascripts/flot/jquery.flot.crosshair.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.fillbetween.js +183 -0
- data/public/javascripts/flot/jquery.flot.fillbetween.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.image.js +238 -0
- data/public/javascripts/flot/jquery.flot.image.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.js +2599 -0
- data/public/javascripts/flot/jquery.flot.min.js +6 -0
- data/public/javascripts/flot/jquery.flot.navigate.js +336 -0
- data/public/javascripts/flot/jquery.flot.navigate.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.pie.js +750 -0
- data/public/javascripts/flot/jquery.flot.pie.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.resize.js +60 -0
- data/public/javascripts/flot/jquery.flot.resize.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.selection.js +344 -0
- data/public/javascripts/flot/jquery.flot.selection.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.stack.js +184 -0
- data/public/javascripts/flot/jquery.flot.stack.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.symbol.js +70 -0
- data/public/javascripts/flot/jquery.flot.symbol.min.js +1 -0
- data/public/javascripts/flot/jquery.flot.threshold.js +103 -0
- data/public/javascripts/flot/jquery.flot.threshold.min.js +1 -0
- data/public/javascripts/flot/jquery.js +8316 -0
- data/public/javascripts/flot/jquery.min.js +23 -0
- data/public/javascripts/jquery.qtip.js +2675 -0
- data/public/javascripts/jquery.sparkline.js +1271 -0
- data/public/javascripts/races.js +245 -0
- data/public/stylesheets/sass/admin/races.sass +65 -70
- data/public/stylesheets/sass/jquery.flot.sass +416 -0
- data/public/stylesheets/sass/race_results.sass +38 -2
- data/radiant-race_results-extension.gemspec +1 -1
- metadata +95 -11
- data/public/javascripts/tablesorter.js +0 -3
@@ -0,0 +1,54 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Flot Examples</title>
|
6
|
+
<link href="layout.css" rel="stylesheet" type="text/css">
|
7
|
+
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
|
8
|
+
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
|
9
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
|
10
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.threshold.js"></script>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>Flot Examples</h1>
|
14
|
+
|
15
|
+
<div id="placeholder" style="width:600px;height:300px;"></div>
|
16
|
+
|
17
|
+
<p>With the threshold plugin, you can apply a specific color to
|
18
|
+
the part of a data series below a threshold. This is can be useful
|
19
|
+
for highlighting negative values, e.g. when displaying net results
|
20
|
+
or what's in stock.</p>
|
21
|
+
|
22
|
+
<p class="controls">
|
23
|
+
<input type="button" value="Threshold at 5">
|
24
|
+
<input type="button" value="Threshold at 0">
|
25
|
+
<input type="button" value="Threshold at -2.5">
|
26
|
+
</p>
|
27
|
+
|
28
|
+
<script type="text/javascript">
|
29
|
+
$(function () {
|
30
|
+
var d1 = [];
|
31
|
+
for (var i = 0; i <= 60; i += 1)
|
32
|
+
d1.push([i, parseInt(Math.random() * 30 - 10)]);
|
33
|
+
|
34
|
+
function plotWithOptions(t) {
|
35
|
+
$.plot($("#placeholder"), [ {
|
36
|
+
data: d1,
|
37
|
+
color: "rgb(30, 180, 20)",
|
38
|
+
threshold: { below: t, color: "rgb(200, 20, 30)" },
|
39
|
+
lines: { steps: true }
|
40
|
+
} ]);
|
41
|
+
}
|
42
|
+
|
43
|
+
plotWithOptions(0);
|
44
|
+
|
45
|
+
$(".controls input").click(function (e) {
|
46
|
+
e.preventDefault();
|
47
|
+
var t = parseFloat($(this).val().replace('Threshold at ', ''));
|
48
|
+
plotWithOptions(t);
|
49
|
+
});
|
50
|
+
});
|
51
|
+
</script>
|
52
|
+
|
53
|
+
</body>
|
54
|
+
</html>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Flot Examples</title>
|
6
|
+
<link href="layout.css" rel="stylesheet" type="text/css">
|
7
|
+
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
|
8
|
+
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
|
9
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<h1>Flot Examples</h1>
|
13
|
+
|
14
|
+
<div id="placeholder" style="width:600px;height:300px;"></div>
|
15
|
+
|
16
|
+
<p>Monthly mean atmospheric CO<sub>2</sub> in PPM at Mauna Loa, Hawaii (source: <a href="http://www.esrl.noaa.gov/gmd/ccgg/trends/">NOAA/ESRL</a>).</p>
|
17
|
+
|
18
|
+
<p>If you tell Flot that an axis represents time, the data will
|
19
|
+
be interpreted as timestamps and the ticks adjusted and
|
20
|
+
formatted accordingly.</p>
|
21
|
+
|
22
|
+
<p>Zoom to: <button id="whole">Whole period</button>
|
23
|
+
<button id="nineties">1990-2000</button>
|
24
|
+
<button id="ninetynine">1999</button></p>
|
25
|
+
|
26
|
+
<p>The timestamps must be specified as Javascript timestamps, as
|
27
|
+
milliseconds since January 1, 1970 00:00. This is like Unix
|
28
|
+
timestamps, but in milliseconds instead of seconds (remember to
|
29
|
+
multiply with 1000!).</p>
|
30
|
+
|
31
|
+
<p>As an extra caveat, the timestamps are interpreted according to
|
32
|
+
UTC to avoid having the graph shift with each visitor's local
|
33
|
+
time zone. So you might have to add your local time zone offset
|
34
|
+
to the timestamps or simply pretend that the data was produced
|
35
|
+
in UTC instead of your local time zone.</p>
|
36
|
+
|
37
|
+
<script id="source">
|
38
|
+
$(function () {
|
39
|
+
var d = [[-373597200000, 315.71], [-370918800000, 317.45], [-368326800000, 317.50], [-363056400000, 315.86], [-360378000000, 314.93], [-357699600000, 313.19], [-352429200000, 313.34], [-349837200000, 314.67], [-347158800000, 315.58], [-344480400000, 316.47], [-342061200000, 316.65], [-339382800000, 317.71], [-336790800000, 318.29], [-334112400000, 318.16], [-331520400000, 316.55], [-328842000000, 314.80], [-326163600000, 313.84], [-323571600000, 313.34], [-320893200000, 314.81], [-318301200000, 315.59], [-315622800000, 316.43], [-312944400000, 316.97], [-310438800000, 317.58], [-307760400000, 319.03], [-305168400000, 320.03], [-302490000000, 319.59], [-299898000000, 318.18], [-297219600000, 315.91], [-294541200000, 314.16], [-291949200000, 313.83], [-289270800000, 315.00], [-286678800000, 316.19], [-284000400000, 316.89], [-281322000000, 317.70], [-278902800000, 318.54], [-276224400000, 319.48], [-273632400000, 320.58], [-270954000000, 319.78], [-268362000000, 318.58], [-265683600000, 316.79], [-263005200000, 314.99], [-260413200000, 315.31], [-257734800000, 316.10], [-255142800000, 317.01], [-252464400000, 317.94], [-249786000000, 318.56], [-247366800000, 319.69], [-244688400000, 320.58], [-242096400000, 321.01], [-239418000000, 320.61], [-236826000000, 319.61], [-234147600000, 317.40], [-231469200000, 316.26], [-228877200000, 315.42], [-226198800000, 316.69], [-223606800000, 317.69], [-220928400000, 318.74], [-218250000000, 319.08], [-215830800000, 319.86], [-213152400000, 321.39], [-210560400000, 322.24], [-207882000000, 321.47], [-205290000000, 319.74], [-202611600000, 317.77], [-199933200000, 316.21], [-197341200000, 315.99], [-194662800000, 317.07], [-192070800000, 318.36], [-189392400000, 319.57], [-178938000000, 322.23], [-176259600000, 321.89], [-173667600000, 320.44], [-170989200000, 318.70], [-168310800000, 316.70], [-165718800000, 316.87], [-163040400000, 317.68], [-160448400000, 318.71], [-157770000000, 319.44], [-155091600000, 320.44], [-152672400000, 320.89], [-149994000000, 322.13], [-147402000000, 322.16], [-144723600000, 321.87], [-142131600000, 321.21], [-139453200000, 318.87], [-136774800000, 317.81], [-134182800000, 317.30], [-131504400000, 318.87], [-128912400000, 319.42], [-126234000000, 320.62], [-123555600000, 321.59], [-121136400000, 322.39], [-118458000000, 323.70], [-115866000000, 324.07], [-113187600000, 323.75], [-110595600000, 322.40], [-107917200000, 320.37], [-105238800000, 318.64], [-102646800000, 318.10], [-99968400000, 319.79], [-97376400000, 321.03], [-94698000000, 322.33], [-92019600000, 322.50], [-89600400000, 323.04], [-86922000000, 324.42], [-84330000000, 325.00], [-81651600000, 324.09], [-79059600000, 322.55], [-76381200000, 320.92], [-73702800000, 319.26], [-71110800000, 319.39], [-68432400000, 320.72], [-65840400000, 321.96], [-63162000000, 322.57], [-60483600000, 323.15], [-57978000000, 323.89], [-55299600000, 325.02], [-52707600000, 325.57], [-50029200000, 325.36], [-47437200000, 324.14], [-44758800000, 322.11], [-42080400000, 320.33], [-39488400000, 320.25], [-36810000000, 321.32], [-34218000000, 322.90], [-31539600000, 324.00], [-28861200000, 324.42], [-26442000000, 325.64], [-23763600000, 326.66], [-21171600000, 327.38], [-18493200000, 326.70], [-15901200000, 325.89], [-13222800000, 323.67], [-10544400000, 322.38], [-7952400000, 321.78], [-5274000000, 322.85], [-2682000000, 324.12], [-3600000, 325.06], [2674800000, 325.98], [5094000000, 326.93], [7772400000, 328.13], [10364400000, 328.07], [13042800000, 327.66], [15634800000, 326.35], [18313200000, 324.69], [20991600000, 323.10], [23583600000, 323.07], [26262000000, 324.01], [28854000000, 325.13], [31532400000, 326.17], [34210800000, 326.68], [36630000000, 327.18], [39308400000, 327.78], [41900400000, 328.92], [44578800000, 328.57], [47170800000, 327.37], [49849200000, 325.43], [52527600000, 323.36], [55119600000, 323.56], [57798000000, 324.80], [60390000000, 326.01], [63068400000, 326.77], [65746800000, 327.63], [68252400000, 327.75], [70930800000, 329.72], [73522800000, 330.07], [76201200000, 329.09], [78793200000, 328.05], [81471600000, 326.32], [84150000000, 324.84], [86742000000, 325.20], [89420400000, 326.50], [92012400000, 327.55], [94690800000, 328.54], [97369200000, 329.56], [99788400000, 330.30], [102466800000, 331.50], [105058800000, 332.48], [107737200000, 332.07], [110329200000, 330.87], [113007600000, 329.31], [115686000000, 327.51], [118278000000, 327.18], [120956400000, 328.16], [123548400000, 328.64], [126226800000, 329.35], [128905200000, 330.71], [131324400000, 331.48], [134002800000, 332.65], [136594800000, 333.16], [139273200000, 332.06], [141865200000, 330.99], [144543600000, 329.17], [147222000000, 327.41], [149814000000, 327.20], [152492400000, 328.33], [155084400000, 329.50], [157762800000, 330.68], [160441200000, 331.41], [162860400000, 331.85], [165538800000, 333.29], [168130800000, 333.91], [170809200000, 333.40], [173401200000, 331.78], [176079600000, 329.88], [178758000000, 328.57], [181350000000, 328.46], [184028400000, 329.26], [189298800000, 331.71], [191977200000, 332.76], [194482800000, 333.48], [197161200000, 334.78], [199753200000, 334.78], [202431600000, 334.17], [205023600000, 332.78], [207702000000, 330.64], [210380400000, 328.95], [212972400000, 328.77], [215650800000, 330.23], [218242800000, 331.69], [220921200000, 332.70], [223599600000, 333.24], [226018800000, 334.96], [228697200000, 336.04], [231289200000, 336.82], [233967600000, 336.13], [236559600000, 334.73], [239238000000, 332.52], [241916400000, 331.19], [244508400000, 331.19], [247186800000, 332.35], [249778800000, 333.47], [252457200000, 335.11], [255135600000, 335.26], [257554800000, 336.60], [260233200000, 337.77], [262825200000, 338.00], [265503600000, 337.99], [268095600000, 336.48], [270774000000, 334.37], [273452400000, 332.27], [276044400000, 332.41], [278722800000, 333.76], [281314800000, 334.83], [283993200000, 336.21], [286671600000, 336.64], [289090800000, 338.12], [291769200000, 339.02], [294361200000, 339.02], [297039600000, 339.20], [299631600000, 337.58], [302310000000, 335.55], [304988400000, 333.89], [307580400000, 334.14], [310258800000, 335.26], [312850800000, 336.71], [315529200000, 337.81], [318207600000, 338.29], [320713200000, 340.04], [323391600000, 340.86], [325980000000, 341.47], [328658400000, 341.26], [331250400000, 339.29], [333928800000, 337.60], [336607200000, 336.12], [339202800000, 336.08], [341881200000, 337.22], [344473200000, 338.34], [347151600000, 339.36], [349830000000, 340.51], [352249200000, 341.57], [354924000000, 342.56], [357516000000, 343.01], [360194400000, 342.47], [362786400000, 340.71], [365464800000, 338.52], [368143200000, 336.96], [370738800000, 337.13], [373417200000, 338.58], [376009200000, 339.89], [378687600000, 340.93], [381366000000, 341.69], [383785200000, 342.69], [389052000000, 344.30], [391730400000, 343.43], [394322400000, 341.88], [397000800000, 339.89], [399679200000, 337.95], [402274800000, 338.10], [404953200000, 339.27], [407545200000, 340.67], [410223600000, 341.42], [412902000000, 342.68], [415321200000, 343.46], [417996000000, 345.10], [420588000000, 345.76], [423266400000, 345.36], [425858400000, 343.91], [428536800000, 342.05], [431215200000, 340.00], [433810800000, 340.12], [436489200000, 341.33], [439081200000, 342.94], [441759600000, 343.87], [444438000000, 344.60], [446943600000, 345.20], [452210400000, 347.36], [454888800000, 346.74], [457480800000, 345.41], [460159200000, 343.01], [462837600000, 341.23], [465433200000, 341.52], [468111600000, 342.86], [470703600000, 344.41], [473382000000, 345.09], [476060400000, 345.89], [478479600000, 347.49], [481154400000, 348.00], [483746400000, 348.75], [486424800000, 348.19], [489016800000, 346.54], [491695200000, 344.63], [494373600000, 343.03], [496969200000, 342.92], [499647600000, 344.24], [502239600000, 345.62], [504918000000, 346.43], [507596400000, 346.94], [510015600000, 347.88], [512690400000, 349.57], [515282400000, 350.35], [517960800000, 349.72], [520552800000, 347.78], [523231200000, 345.86], [525909600000, 344.84], [528505200000, 344.32], [531183600000, 345.67], [533775600000, 346.88], [536454000000, 348.19], [539132400000, 348.55], [541551600000, 349.52], [544226400000, 351.12], [546818400000, 351.84], [549496800000, 351.49], [552088800000, 349.82], [554767200000, 347.63], [557445600000, 346.38], [560041200000, 346.49], [562719600000, 347.75], [565311600000, 349.03], [567990000000, 350.20], [570668400000, 351.61], [573174000000, 352.22], [575848800000, 353.53], [578440800000, 354.14], [581119200000, 353.62], [583711200000, 352.53], [586389600000, 350.41], [589068000000, 348.84], [591663600000, 348.94], [594342000000, 350.04], [596934000000, 351.29], [599612400000, 352.72], [602290800000, 353.10], [604710000000, 353.65], [607384800000, 355.43], [609976800000, 355.70], [612655200000, 355.11], [615247200000, 353.79], [617925600000, 351.42], [620604000000, 349.81], [623199600000, 350.11], [625878000000, 351.26], [628470000000, 352.63], [631148400000, 353.64], [633826800000, 354.72], [636246000000, 355.49], [638920800000, 356.09], [641512800000, 357.08], [644191200000, 356.11], [646783200000, 354.70], [649461600000, 352.68], [652140000000, 351.05], [654735600000, 351.36], [657414000000, 352.81], [660006000000, 354.22], [662684400000, 354.85], [665362800000, 355.66], [667782000000, 357.04], [670456800000, 358.40], [673048800000, 359.00], [675727200000, 357.99], [678319200000, 356.00], [680997600000, 353.78], [683676000000, 352.20], [686271600000, 352.22], [688950000000, 353.70], [691542000000, 354.98], [694220400000, 356.09], [696898800000, 356.85], [699404400000, 357.73], [702079200000, 358.91], [704671200000, 359.45], [707349600000, 359.19], [709941600000, 356.72], [712620000000, 354.79], [715298400000, 352.79], [717894000000, 353.20], [720572400000, 354.15], [723164400000, 355.39], [725842800000, 356.77], [728521200000, 357.17], [730940400000, 358.26], [733615200000, 359.16], [736207200000, 360.07], [738885600000, 359.41], [741477600000, 357.44], [744156000000, 355.30], [746834400000, 353.87], [749430000000, 354.04], [752108400000, 355.27], [754700400000, 356.70], [757378800000, 358.00], [760057200000, 358.81], [762476400000, 359.68], [765151200000, 361.13], [767743200000, 361.48], [770421600000, 360.60], [773013600000, 359.20], [775692000000, 357.23], [778370400000, 355.42], [780966000000, 355.89], [783644400000, 357.41], [786236400000, 358.74], [788914800000, 359.73], [791593200000, 360.61], [794012400000, 361.58], [796687200000, 363.05], [799279200000, 363.62], [801957600000, 363.03], [804549600000, 361.55], [807228000000, 358.94], [809906400000, 357.93], [812502000000, 357.80], [815180400000, 359.22], [817772400000, 360.44], [820450800000, 361.83], [823129200000, 362.95], [825634800000, 363.91], [828309600000, 364.28], [830901600000, 364.94], [833580000000, 364.70], [836172000000, 363.31], [838850400000, 361.15], [841528800000, 359.40], [844120800000, 359.34], [846802800000, 360.62], [849394800000, 361.96], [852073200000, 362.81], [854751600000, 363.87], [857170800000, 364.25], [859845600000, 366.02], [862437600000, 366.46], [865116000000, 365.32], [867708000000, 364.07], [870386400000, 361.95], [873064800000, 360.06], [875656800000, 360.49], [878338800000, 362.19], [880930800000, 364.12], [883609200000, 364.99], [886287600000, 365.82], [888706800000, 366.95], [891381600000, 368.42], [893973600000, 369.33], [896652000000, 368.78], [899244000000, 367.59], [901922400000, 365.84], [904600800000, 363.83], [907192800000, 364.18], [909874800000, 365.34], [912466800000, 366.93], [915145200000, 367.94], [917823600000, 368.82], [920242800000, 369.46], [922917600000, 370.77], [925509600000, 370.66], [928188000000, 370.10], [930780000000, 369.08], [933458400000, 366.66], [936136800000, 364.60], [938728800000, 365.17], [941410800000, 366.51], [944002800000, 367.89], [946681200000, 369.04], [949359600000, 369.35], [951865200000, 370.38], [954540000000, 371.63], [957132000000, 371.32], [959810400000, 371.53], [962402400000, 369.75], [965080800000, 368.23], [967759200000, 366.87], [970351200000, 366.94], [973033200000, 368.27], [975625200000, 369.64], [978303600000, 370.46], [980982000000, 371.44], [983401200000, 372.37], [986076000000, 373.33], [988668000000, 373.77], [991346400000, 373.09], [993938400000, 371.51], [996616800000, 369.55], [999295200000, 368.12], [1001887200000, 368.38], [1004569200000, 369.66], [1007161200000, 371.11], [1009839600000, 372.36], [1012518000000, 373.09], [1014937200000, 373.81], [1017612000000, 374.93], [1020204000000, 375.58], [1022882400000, 375.44], [1025474400000, 373.86], [1028152800000, 371.77], [1030831200000, 370.73], [1033423200000, 370.50], [1036105200000, 372.18], [1038697200000, 373.70], [1041375600000, 374.92], [1044054000000, 375.62], [1046473200000, 376.51], [1049148000000, 377.75], [1051740000000, 378.54], [1054418400000, 378.20], [1057010400000, 376.68], [1059688800000, 374.43], [1062367200000, 373.11], [1064959200000, 373.10], [1067641200000, 374.77], [1070233200000, 375.97], [1072911600000, 377.03], [1075590000000, 377.87], [1078095600000, 378.88], [1080770400000, 380.42], [1083362400000, 380.62], [1086040800000, 379.70], [1088632800000, 377.43], [1091311200000, 376.32], [1093989600000, 374.19], [1096581600000, 374.47], [1099263600000, 376.15], [1101855600000, 377.51], [1104534000000, 378.43], [1107212400000, 379.70], [1109631600000, 380.92], [1112306400000, 382.18], [1114898400000, 382.45], [1117576800000, 382.14], [1120168800000, 380.60], [1122847200000, 378.64], [1125525600000, 376.73], [1128117600000, 376.84], [1130799600000, 378.29], [1133391600000, 380.06], [1136070000000, 381.40], [1138748400000, 382.20], [1141167600000, 382.66], [1143842400000, 384.69], [1146434400000, 384.94], [1149112800000, 384.01], [1151704800000, 382.14], [1154383200000, 380.31], [1157061600000, 378.81], [1159653600000, 379.03], [1162335600000, 380.17], [1164927600000, 381.85], [1167606000000, 382.94], [1170284400000, 383.86], [1172703600000, 384.49], [1175378400000, 386.37], [1177970400000, 386.54], [1180648800000, 385.98], [1183240800000, 384.36], [1185919200000, 381.85], [1188597600000, 380.74], [1191189600000, 381.15], [1193871600000, 382.38], [1196463600000, 383.94], [1199142000000, 385.44]];
|
40
|
+
|
41
|
+
$.plot($("#placeholder"), [d], { xaxis: { mode: "time" } });
|
42
|
+
|
43
|
+
$("#whole").click(function () {
|
44
|
+
$.plot($("#placeholder"), [d], { xaxis: { mode: "time" } });
|
45
|
+
});
|
46
|
+
|
47
|
+
$("#nineties").click(function () {
|
48
|
+
$.plot($("#placeholder"), [d], {
|
49
|
+
xaxis: {
|
50
|
+
mode: "time",
|
51
|
+
min: (new Date(1990, 1, 1)).getTime(),
|
52
|
+
max: (new Date(2000, 1, 1)).getTime()
|
53
|
+
}
|
54
|
+
});
|
55
|
+
});
|
56
|
+
|
57
|
+
$("#ninetynine").click(function () {
|
58
|
+
$.plot($("#placeholder"), [d], {
|
59
|
+
xaxis: {
|
60
|
+
mode: "time",
|
61
|
+
minTickSize: [1, "month"],
|
62
|
+
min: (new Date(1999, 1, 1)).getTime(),
|
63
|
+
max: (new Date(2000, 1, 1)).getTime()
|
64
|
+
}
|
65
|
+
});
|
66
|
+
});
|
67
|
+
});
|
68
|
+
</script>
|
69
|
+
|
70
|
+
</body>
|
71
|
+
</html>
|
@@ -0,0 +1,95 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Flot Examples</title>
|
6
|
+
<link href="layout.css" rel="stylesheet" type="text/css">
|
7
|
+
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
|
8
|
+
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
|
9
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
|
10
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.crosshair.js"></script>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>Flot Examples</h1>
|
14
|
+
|
15
|
+
<div id="placeholder" style="width:600px;height:300px"></div>
|
16
|
+
|
17
|
+
<p>You can add crosshairs that'll track the mouse position, either
|
18
|
+
on both axes or as here on only one.</p>
|
19
|
+
|
20
|
+
<p>If you combine it with listening on hover events, you can use
|
21
|
+
it to track the intersection on the curves by interpolating
|
22
|
+
the data points (look at the legend).</p>
|
23
|
+
|
24
|
+
<p id="hoverdata"></p>
|
25
|
+
|
26
|
+
<script type="text/javascript">
|
27
|
+
var plot;
|
28
|
+
$(function () {
|
29
|
+
var sin = [], cos = [];
|
30
|
+
for (var i = 0; i < 14; i += 0.1) {
|
31
|
+
sin.push([i, Math.sin(i)]);
|
32
|
+
cos.push([i, Math.cos(i)]);
|
33
|
+
}
|
34
|
+
|
35
|
+
plot = $.plot($("#placeholder"),
|
36
|
+
[ { data: sin, label: "sin(x) = -0.00"},
|
37
|
+
{ data: cos, label: "cos(x) = -0.00" } ], {
|
38
|
+
series: {
|
39
|
+
lines: { show: true }
|
40
|
+
},
|
41
|
+
crosshair: { mode: "x" },
|
42
|
+
grid: { hoverable: true, autoHighlight: false },
|
43
|
+
yaxis: { min: -1.2, max: 1.2 }
|
44
|
+
});
|
45
|
+
var legends = $("#placeholder .legendLabel");
|
46
|
+
legends.each(function () {
|
47
|
+
// fix the widths so they don't jump around
|
48
|
+
$(this).css('width', $(this).width());
|
49
|
+
});
|
50
|
+
|
51
|
+
var updateLegendTimeout = null;
|
52
|
+
var latestPosition = null;
|
53
|
+
|
54
|
+
function updateLegend() {
|
55
|
+
updateLegendTimeout = null;
|
56
|
+
|
57
|
+
var pos = latestPosition;
|
58
|
+
|
59
|
+
var axes = plot.getAxes();
|
60
|
+
if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max ||
|
61
|
+
pos.y < axes.yaxis.min || pos.y > axes.yaxis.max)
|
62
|
+
return;
|
63
|
+
|
64
|
+
var i, j, dataset = plot.getData();
|
65
|
+
for (i = 0; i < dataset.length; ++i) {
|
66
|
+
var series = dataset[i];
|
67
|
+
|
68
|
+
// find the nearest points, x-wise
|
69
|
+
for (j = 0; j < series.data.length; ++j)
|
70
|
+
if (series.data[j][0] > pos.x)
|
71
|
+
break;
|
72
|
+
|
73
|
+
// now interpolate
|
74
|
+
var y, p1 = series.data[j - 1], p2 = series.data[j];
|
75
|
+
if (p1 == null)
|
76
|
+
y = p2[1];
|
77
|
+
else if (p2 == null)
|
78
|
+
y = p1[1];
|
79
|
+
else
|
80
|
+
y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);
|
81
|
+
|
82
|
+
legends.eq(i).text(series.label.replace(/=.*/, "= " + y.toFixed(2)));
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
$("#placeholder").bind("plothover", function (event, pos, item) {
|
87
|
+
latestPosition = pos;
|
88
|
+
if (!updateLegendTimeout)
|
89
|
+
updateLegendTimeout = setTimeout(updateLegend, 50);
|
90
|
+
});
|
91
|
+
});
|
92
|
+
</script>
|
93
|
+
|
94
|
+
</body>
|
95
|
+
</html>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Flot Examples</title>
|
6
|
+
<link href="layout.css" rel="stylesheet" type="text/css">
|
7
|
+
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
|
8
|
+
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
|
9
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<h1>Flot Examples</h1>
|
13
|
+
|
14
|
+
<div id="placeholder" style="width:600px;height:300px;"></div>
|
15
|
+
|
16
|
+
<p>Here is an example with real data: military budgets for
|
17
|
+
various countries in constant (2005) million US dollars (source: <a href="http://www.sipri.org/">SIPRI</a>).</p>
|
18
|
+
|
19
|
+
<p>Since all data is available client-side, it's pretty easy to
|
20
|
+
make the plot interactive. Try turning countries on/off with the
|
21
|
+
checkboxes below.</p>
|
22
|
+
|
23
|
+
<p id="choices">Show:</p>
|
24
|
+
|
25
|
+
<script type="text/javascript">
|
26
|
+
$(function () {
|
27
|
+
var datasets = {
|
28
|
+
"usa": {
|
29
|
+
label: "USA",
|
30
|
+
data: [[1988, 483994], [1989, 479060], [1990, 457648], [1991, 401949], [1992, 424705], [1993, 402375], [1994, 377867], [1995, 357382], [1996, 337946], [1997, 336185], [1998, 328611], [1999, 329421], [2000, 342172], [2001, 344932], [2002, 387303], [2003, 440813], [2004, 480451], [2005, 504638], [2006, 528692]]
|
31
|
+
},
|
32
|
+
"russia": {
|
33
|
+
label: "Russia",
|
34
|
+
data: [[1988, 218000], [1989, 203000], [1990, 171000], [1992, 42500], [1993, 37600], [1994, 36600], [1995, 21700], [1996, 19200], [1997, 21300], [1998, 13600], [1999, 14000], [2000, 19100], [2001, 21300], [2002, 23600], [2003, 25100], [2004, 26100], [2005, 31100], [2006, 34700]]
|
35
|
+
},
|
36
|
+
"uk": {
|
37
|
+
label: "UK",
|
38
|
+
data: [[1988, 62982], [1989, 62027], [1990, 60696], [1991, 62348], [1992, 58560], [1993, 56393], [1994, 54579], [1995, 50818], [1996, 50554], [1997, 48276], [1998, 47691], [1999, 47529], [2000, 47778], [2001, 48760], [2002, 50949], [2003, 57452], [2004, 60234], [2005, 60076], [2006, 59213]]
|
39
|
+
},
|
40
|
+
"germany": {
|
41
|
+
label: "Germany",
|
42
|
+
data: [[1988, 55627], [1989, 55475], [1990, 58464], [1991, 55134], [1992, 52436], [1993, 47139], [1994, 43962], [1995, 43238], [1996, 42395], [1997, 40854], [1998, 40993], [1999, 41822], [2000, 41147], [2001, 40474], [2002, 40604], [2003, 40044], [2004, 38816], [2005, 38060], [2006, 36984]]
|
43
|
+
},
|
44
|
+
"denmark": {
|
45
|
+
label: "Denmark",
|
46
|
+
data: [[1988, 3813], [1989, 3719], [1990, 3722], [1991, 3789], [1992, 3720], [1993, 3730], [1994, 3636], [1995, 3598], [1996, 3610], [1997, 3655], [1998, 3695], [1999, 3673], [2000, 3553], [2001, 3774], [2002, 3728], [2003, 3618], [2004, 3638], [2005, 3467], [2006, 3770]]
|
47
|
+
},
|
48
|
+
"sweden": {
|
49
|
+
label: "Sweden",
|
50
|
+
data: [[1988, 6402], [1989, 6474], [1990, 6605], [1991, 6209], [1992, 6035], [1993, 6020], [1994, 6000], [1995, 6018], [1996, 3958], [1997, 5780], [1998, 5954], [1999, 6178], [2000, 6411], [2001, 5993], [2002, 5833], [2003, 5791], [2004, 5450], [2005, 5521], [2006, 5271]]
|
51
|
+
},
|
52
|
+
"norway": {
|
53
|
+
label: "Norway",
|
54
|
+
data: [[1988, 4382], [1989, 4498], [1990, 4535], [1991, 4398], [1992, 4766], [1993, 4441], [1994, 4670], [1995, 4217], [1996, 4275], [1997, 4203], [1998, 4482], [1999, 4506], [2000, 4358], [2001, 4385], [2002, 5269], [2003, 5066], [2004, 5194], [2005, 4887], [2006, 4891]]
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
58
|
+
// hard-code color indices to prevent them from shifting as
|
59
|
+
// countries are turned on/off
|
60
|
+
var i = 0;
|
61
|
+
$.each(datasets, function(key, val) {
|
62
|
+
val.color = i;
|
63
|
+
++i;
|
64
|
+
});
|
65
|
+
|
66
|
+
// insert checkboxes
|
67
|
+
var choiceContainer = $("#choices");
|
68
|
+
$.each(datasets, function(key, val) {
|
69
|
+
choiceContainer.append('<br/><input type="checkbox" name="' + key +
|
70
|
+
'" checked="checked" id="id' + key + '">' +
|
71
|
+
'<label for="id' + key + '">'
|
72
|
+
+ val.label + '</label>');
|
73
|
+
});
|
74
|
+
choiceContainer.find("input").click(plotAccordingToChoices);
|
75
|
+
|
76
|
+
|
77
|
+
function plotAccordingToChoices() {
|
78
|
+
var data = [];
|
79
|
+
|
80
|
+
choiceContainer.find("input:checked").each(function () {
|
81
|
+
var key = $(this).attr("name");
|
82
|
+
if (key && datasets[key])
|
83
|
+
data.push(datasets[key]);
|
84
|
+
});
|
85
|
+
|
86
|
+
if (data.length > 0)
|
87
|
+
$.plot($("#placeholder"), data, {
|
88
|
+
yaxis: { min: 0 },
|
89
|
+
xaxis: { tickDecimals: 0 }
|
90
|
+
});
|
91
|
+
}
|
92
|
+
|
93
|
+
plotAccordingToChoices();
|
94
|
+
});
|
95
|
+
</script>
|
96
|
+
|
97
|
+
</body>
|
98
|
+
</html>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Flot Examples</title>
|
6
|
+
<link href="layout.css" rel="stylesheet" type="text/css">
|
7
|
+
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
|
8
|
+
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
|
9
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
|
10
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.selection.js"></script>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>Flot Examples</h1>
|
14
|
+
|
15
|
+
<div id="placeholder" style="width:600px;height:300px;"></div>
|
16
|
+
|
17
|
+
<p>Visitors per day to the Flot homepage. Weekends are colored. Try zooming.
|
18
|
+
The plot below shows an overview.</p>
|
19
|
+
|
20
|
+
<div id="overview" style="margin-left:50px;margin-top:20px;width:400px;height:50px"></div>
|
21
|
+
|
22
|
+
<script id="source">
|
23
|
+
$(function () {
|
24
|
+
var d = [[1196463600000, 0], [1196550000000, 0], [1196636400000, 0], [1196722800000, 77], [1196809200000, 3636], [1196895600000, 3575], [1196982000000, 2736], [1197068400000, 1086], [1197154800000, 676], [1197241200000, 1205], [1197327600000, 906], [1197414000000, 710], [1197500400000, 639], [1197586800000, 540], [1197673200000, 435], [1197759600000, 301], [1197846000000, 575], [1197932400000, 481], [1198018800000, 591], [1198105200000, 608], [1198191600000, 459], [1198278000000, 234], [1198364400000, 1352], [1198450800000, 686], [1198537200000, 279], [1198623600000, 449], [1198710000000, 468], [1198796400000, 392], [1198882800000, 282], [1198969200000, 208], [1199055600000, 229], [1199142000000, 177], [1199228400000, 374], [1199314800000, 436], [1199401200000, 404], [1199487600000, 253], [1199574000000, 218], [1199660400000, 476], [1199746800000, 462], [1199833200000, 448], [1199919600000, 442], [1200006000000, 403], [1200092400000, 204], [1200178800000, 194], [1200265200000, 327], [1200351600000, 374], [1200438000000, 507], [1200524400000, 546], [1200610800000, 482], [1200697200000, 283], [1200783600000, 221], [1200870000000, 483], [1200956400000, 523], [1201042800000, 528], [1201129200000, 483], [1201215600000, 452], [1201302000000, 270], [1201388400000, 222], [1201474800000, 439], [1201561200000, 559], [1201647600000, 521], [1201734000000, 477], [1201820400000, 442], [1201906800000, 252], [1201993200000, 236], [1202079600000, 525], [1202166000000, 477], [1202252400000, 386], [1202338800000, 409], [1202425200000, 408], [1202511600000, 237], [1202598000000, 193], [1202684400000, 357], [1202770800000, 414], [1202857200000, 393], [1202943600000, 353], [1203030000000, 364], [1203116400000, 215], [1203202800000, 214], [1203289200000, 356], [1203375600000, 399], [1203462000000, 334], [1203548400000, 348], [1203634800000, 243], [1203721200000, 126], [1203807600000, 157], [1203894000000, 288]];
|
25
|
+
|
26
|
+
// first correct the timestamps - they are recorded as the daily
|
27
|
+
// midnights in UTC+0100, but Flot always displays dates in UTC
|
28
|
+
// so we have to add one hour to hit the midnights in the plot
|
29
|
+
for (var i = 0; i < d.length; ++i)
|
30
|
+
d[i][0] += 60 * 60 * 1000;
|
31
|
+
|
32
|
+
// helper for returning the weekends in a period
|
33
|
+
function weekendAreas(axes) {
|
34
|
+
var markings = [];
|
35
|
+
var d = new Date(axes.xaxis.min);
|
36
|
+
// go to the first Saturday
|
37
|
+
d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7))
|
38
|
+
d.setUTCSeconds(0);
|
39
|
+
d.setUTCMinutes(0);
|
40
|
+
d.setUTCHours(0);
|
41
|
+
var i = d.getTime();
|
42
|
+
do {
|
43
|
+
// when we don't set yaxis, the rectangle automatically
|
44
|
+
// extends to infinity upwards and downwards
|
45
|
+
markings.push({ xaxis: { from: i, to: i + 2 * 24 * 60 * 60 * 1000 } });
|
46
|
+
i += 7 * 24 * 60 * 60 * 1000;
|
47
|
+
} while (i < axes.xaxis.max);
|
48
|
+
|
49
|
+
return markings;
|
50
|
+
}
|
51
|
+
|
52
|
+
var options = {
|
53
|
+
xaxis: { mode: "time", tickLength: 5 },
|
54
|
+
selection: { mode: "x" },
|
55
|
+
grid: { markings: weekendAreas }
|
56
|
+
};
|
57
|
+
|
58
|
+
var plot = $.plot($("#placeholder"), [d], options);
|
59
|
+
|
60
|
+
var overview = $.plot($("#overview"), [d], {
|
61
|
+
series: {
|
62
|
+
lines: { show: true, lineWidth: 1 },
|
63
|
+
shadowSize: 0
|
64
|
+
},
|
65
|
+
xaxis: { ticks: [], mode: "time" },
|
66
|
+
yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 },
|
67
|
+
selection: { mode: "x" }
|
68
|
+
});
|
69
|
+
|
70
|
+
// now connect the two
|
71
|
+
|
72
|
+
$("#placeholder").bind("plotselected", function (event, ranges) {
|
73
|
+
// do the zooming
|
74
|
+
plot = $.plot($("#placeholder"), [d],
|
75
|
+
$.extend(true, {}, options, {
|
76
|
+
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }
|
77
|
+
}));
|
78
|
+
|
79
|
+
// don't fire event on the overview to prevent eternal loop
|
80
|
+
overview.setSelection(ranges, true);
|
81
|
+
});
|
82
|
+
|
83
|
+
$("#overview").bind("plotselected", function (event, ranges) {
|
84
|
+
plot.setSelection(ranges);
|
85
|
+
});
|
86
|
+
});
|
87
|
+
</script>
|
88
|
+
|
89
|
+
</body>
|
90
|
+
</html>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
5
|
+
<title>Flot Examples</title>
|
6
|
+
<link href="layout.css" rel="stylesheet" type="text/css">
|
7
|
+
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
|
8
|
+
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
|
9
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
|
10
|
+
<script language="javascript" type="text/javascript" src="../jquery.flot.selection.js"></script>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<h1>Flot Examples</h1>
|
14
|
+
|
15
|
+
<div style="float:left">
|
16
|
+
<div id="placeholder" style="width:500px;height:300px"></div>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<div id="miniature" style="float:left;margin-left:20px">
|
20
|
+
<div id="overview" style="width:166px;height:100px"></div>
|
21
|
+
|
22
|
+
<p id="overviewLegend" style="margin-left:10px"></p>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<p style="clear:left">The selection support makes it easy to
|
26
|
+
construct flexible zooming schemes. With a few lines of code, the
|
27
|
+
small overview plot to the right has been connected to the large
|
28
|
+
plot. Try selecting a rectangle on either of them.</p>
|
29
|
+
|
30
|
+
<script id="source">
|
31
|
+
$(function () {
|
32
|
+
// setup plot
|
33
|
+
function getData(x1, x2) {
|
34
|
+
var d = [];
|
35
|
+
for (var i = 0; i <= 100; ++i) {
|
36
|
+
var x = x1 + i * (x2 - x1) / 100;
|
37
|
+
d.push([x, Math.sin(x * Math.sin(x))]);
|
38
|
+
}
|
39
|
+
|
40
|
+
return [
|
41
|
+
{ label: "sin(x sin(x))", data: d }
|
42
|
+
];
|
43
|
+
}
|
44
|
+
|
45
|
+
var options = {
|
46
|
+
legend: { show: false },
|
47
|
+
series: {
|
48
|
+
lines: { show: true },
|
49
|
+
points: { show: true }
|
50
|
+
},
|
51
|
+
yaxis: { ticks: 10 },
|
52
|
+
selection: { mode: "xy" }
|
53
|
+
};
|
54
|
+
|
55
|
+
var startData = getData(0, 3 * Math.PI);
|
56
|
+
|
57
|
+
var plot = $.plot($("#placeholder"), startData, options);
|
58
|
+
|
59
|
+
// setup overview
|
60
|
+
var overview = $.plot($("#overview"), startData, {
|
61
|
+
legend: { show: true, container: $("#overviewLegend") },
|
62
|
+
series: {
|
63
|
+
lines: { show: true, lineWidth: 1 },
|
64
|
+
shadowSize: 0
|
65
|
+
},
|
66
|
+
xaxis: { ticks: 4 },
|
67
|
+
yaxis: { ticks: 3, min: -2, max: 2 },
|
68
|
+
grid: { color: "#999" },
|
69
|
+
selection: { mode: "xy" }
|
70
|
+
});
|
71
|
+
|
72
|
+
// now connect the two
|
73
|
+
|
74
|
+
$("#placeholder").bind("plotselected", function (event, ranges) {
|
75
|
+
// clamp the zooming to prevent eternal zoom
|
76
|
+
if (ranges.xaxis.to - ranges.xaxis.from < 0.00001)
|
77
|
+
ranges.xaxis.to = ranges.xaxis.from + 0.00001;
|
78
|
+
if (ranges.yaxis.to - ranges.yaxis.from < 0.00001)
|
79
|
+
ranges.yaxis.to = ranges.yaxis.from + 0.00001;
|
80
|
+
|
81
|
+
// do the zooming
|
82
|
+
plot = $.plot($("#placeholder"), getData(ranges.xaxis.from, ranges.xaxis.to),
|
83
|
+
$.extend(true, {}, options, {
|
84
|
+
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to },
|
85
|
+
yaxis: { min: ranges.yaxis.from, max: ranges.yaxis.to }
|
86
|
+
}));
|
87
|
+
|
88
|
+
// don't fire event on the overview to prevent eternal loop
|
89
|
+
overview.setSelection(ranges, true);
|
90
|
+
});
|
91
|
+
$("#overview").bind("plotselected", function (event, ranges) {
|
92
|
+
plot.setSelection(ranges);
|
93
|
+
});
|
94
|
+
});
|
95
|
+
</script>
|
96
|
+
|
97
|
+
</body>
|
98
|
+
</html>
|