root / hci / trunk / eneraptor-web-app / web-app / js / flot / examples / thresholding.html @ 69
History | View | Annotate | Download (1.87 KB)
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"></link> |
7 |
<!--[if IE]><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 id="source" language="javascript" 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>
|