summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/basic.html2
-rw-r--r--examples/dual-axis.html2
-rw-r--r--examples/graph-types.html12
-rw-r--r--examples/index.html6
-rw-r--r--examples/interacting.html2
-rw-r--r--examples/selection.html6
-rw-r--r--examples/setting-options.html4
-rw-r--r--examples/thresholding.html52
-rw-r--r--examples/time.html2
-rw-r--r--examples/tracking.html90
-rw-r--r--examples/turning-series.html2
-rw-r--r--examples/visitors.html4
-rw-r--r--examples/zooming.html8
13 files changed, 174 insertions, 18 deletions
diff --git a/examples/basic.html b/examples/basic.html
index afd7ac1..fde8def 100644
--- a/examples/basic.html
+++ b/examples/basic.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
diff --git a/examples/dual-axis.html b/examples/dual-axis.html
index d97fa8a..03a94e6 100644
--- a/examples/dual-axis.html
+++ b/examples/dual-axis.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
diff --git a/examples/graph-types.html b/examples/graph-types.html
index 64aa0e9..b3c3818 100644
--- a/examples/graph-types.html
+++ b/examples/graph-types.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
@@ -36,7 +36,11 @@ $(function () {
var d5 = [];
for (var i = 0; i < 14; i += 0.5)
d5.push([i, Math.sqrt(i)]);
-
+
+ var d6 = [];
+ for (var i = 0; i < 14; i += 0.5 + Math.random())
+ d6.push([i, Math.sqrt(2*i + Math.sin(i) + 5)]);
+
$.plot($("#placeholder"), [
{
data: d1,
@@ -58,6 +62,10 @@ $(function () {
data: d5,
lines: { show: true },
points: { show: true }
+ },
+ {
+ data: d6,
+ lines: { show: true, steps: true }
}
]);
});
diff --git a/examples/index.html b/examples/index.html
index 36ae0a1..3f116ed 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
@@ -16,11 +16,11 @@
<ul>
<li><a href="basic.html">Basic example</a></li>
<li><a href="graph-types.html">Different graph types</a> and <a href="setting-options.html">setting various options</a></li>
- <li><a href="turning-series.html">Turning series on/off</a></li>
+ <li><a href="turning-series.html">Turning series on/off</a> and <a href="thresholding.html">thresholding the data</a></li>
<li><a href="selection.html">Selection support and zooming</a> and <a href="zooming.html">zooming with overview</a></li>
<li><a href="time.html">Plotting time series</a> and <a href="visitors.html">visitors per day with zooming and weekends</a></li>
<li><a href="dual-axis.html">Dual axis support</a></li>
- <li><a href="interacting.html">Interacting with the data</a></li>
+ <li><a href="interacting.html">Interacting with the data</a> and <a href="tracking.html">tracking curves with crosshair</a></li>
</ul>
</body>
</html>
diff --git a/examples/interacting.html b/examples/interacting.html
index b5c8003..5cb59d0 100644
--- a/examples/interacting.html
+++ b/examples/interacting.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
diff --git a/examples/selection.html b/examples/selection.html
index 4a745d7..56cb3db 100644
--- a/examples/selection.html
+++ b/examples/selection.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
@@ -90,6 +90,10 @@ $(function () {
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }
}));
});
+
+ placeholder.bind("plotunselected", function (event) {
+ $("#selection").text("");
+ });
var plot = $.plot(placeholder, data, options);
diff --git a/examples/setting-options.html b/examples/setting-options.html
index 31dd798..b0570b2 100644
--- a/examples/setting-options.html
+++ b/examples/setting-options.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
@@ -53,7 +53,7 @@ $(function () {
max: 2
},
grid: {
- backgroundColor: "#fffaff"
+ backgroundColor: { colors: ["#fff", "#eee"] }
}
});
});
diff --git a/examples/thresholding.html b/examples/thresholding.html
new file mode 100644
index 0000000..7d29294
--- /dev/null
+++ b/examples/thresholding.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Flot Examples</title>
+ <link href="layout.css" rel="stylesheet" type="text/css"></link>
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
+ <script language="javascript" type="text/javascript" src="../jquery.js"></script>
+ <script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
+ </head>
+ <body>
+ <h1>Flot Examples</h1>
+
+ <div id="placeholder" style="width:600px;height:300px;"></div>
+
+ <p>You can apply a specific color to the part of a data series
+ below a threshold. This is can be useful for highlighting negative
+ values, e.g. when displaying net results or what's in stock.</p>
+
+ <p class="controls">
+ <input type="button" value="Threshold at 5">
+ <input type="button" value="Threshold at 0">
+ <input type="button" value="Threshold at -2.5">
+ </p>
+
+<script id="source" language="javascript" type="text/javascript">
+$(function () {
+ var d1 = [];
+ for (var i = 0; i <= 60; i += 1)
+ d1.push([i, parseInt(Math.random() * 30 - 10)]);
+
+ function doPlot(t) {
+ $.plot($("#placeholder"), [ {
+ data: d1,
+ color: "rgb(30, 180, 20)",
+ threshold: { below: t, color: "rgb(200, 20, 30)" },
+ lines: { steps: true }
+ } ]);
+ }
+
+ doPlot(0);
+
+ $(".controls input").click(function (e) {
+ e.preventDefault();
+ var t = parseFloat($(this).val().replace('Threshold at ', ''));
+ doPlot(t);
+ });
+});
+</script>
+
+ </body>
+</html>
diff --git a/examples/time.html b/examples/time.html
index f810a28..d1dd4e3 100644
--- a/examples/time.html
+++ b/examples/time.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
diff --git a/examples/tracking.html b/examples/tracking.html
new file mode 100644
index 0000000..722f960
--- /dev/null
+++ b/examples/tracking.html
@@ -0,0 +1,90 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <title>Flot Examples</title>
+ <link href="layout.css" rel="stylesheet" type="text/css"></link>
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
+ <script language="javascript" type="text/javascript" src="../jquery.js"></script>
+ <script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
+ </head>
+ <body>
+ <h1>Flot Examples</h1>
+
+ <div id="placeholder" style="width:600px;height:300px"></div>
+
+ <p>You can add crosshairs that'll track the mouse position, either
+ on both axes or as here on only one.</p>
+
+ <p>If you combine it with listening on hover events, you can use
+ it to track the intersection on the curves by interpolating
+ the data points.</p>
+
+ <p id="hoverdata"></p>
+
+<script id="source" language="javascript" type="text/javascript">
+$(function () {
+ var sin = [], cos = [];
+ for (var i = 0; i < 14; i += 0.1) {
+ sin.push([i, Math.sin(i)]);
+ cos.push([i, Math.cos(i)]);
+ }
+
+ var plot = $.plot($("#placeholder"),
+ [ { data: sin, label: "sin(x) = -0.00"}, { data: cos, label: "cos(x) = -0.00" } ],
+ { lines: { show: true },
+ crosshair: { mode: "x" },
+ grid: { hoverable: true, autoHighlight: false },
+ yaxis: { min: -1.2, max: 1.2 }
+ });
+ var legends = $("#placeholder .legendLabel");
+ legends.each(function () {
+ // fix the widths so they don't jump around
+ $(this).css('width', $(this).width());
+ });
+
+ var updateLegendTimeout = null;
+ var latestPosition = null;
+
+ function updateLegend() {
+ updateLegendTimeout = null;
+
+ var pos = latestPosition;
+
+ var axes = plot.getAxes();
+ if (pos.x < axes.xaxis.min || pos.x > axes.xaxis.max ||
+ pos.y < axes.yaxis.min || pos.y > axes.yaxis.max)
+ return;
+
+ var i, j, dataset = plot.getData();
+ for (i = 0; i < dataset.length; ++i) {
+ var series = dataset[i];
+
+ // find the nearest points, x-wise
+ for (j = 0; j < series.data.length; ++j)
+ if (series.data[j][0] > pos.x)
+ break;
+
+ // now interpolate
+ var y, p1 = series.data[j - 1], p2 = series.data[j];
+ if (p1 == null)
+ y = p2[1];
+ else if (p2 == null)
+ y = p1[1];
+ else
+ y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);
+
+ legends.eq(i).text(series.label.replace(/=.*/, "= " + y.toFixed(2)));
+ }
+ }
+
+ $("#placeholder").bind("plothover", function (event, pos, item) {
+ latestPosition = pos;
+ if (!updateLegendTimeout)
+ updateLegendTimeout = setTimeout(updateLegend, 50);
+ });
+});
+</script>
+
+ </body>
+</html>
diff --git a/examples/turning-series.html b/examples/turning-series.html
index 83fb134..7b25479 100644
--- a/examples/turning-series.html
+++ b/examples/turning-series.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
diff --git a/examples/visitors.html b/examples/visitors.html
index 919f903..13440fa 100644
--- a/examples/visitors.html
+++ b/examples/visitors.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
@@ -60,7 +60,7 @@ $(function () {
lines: { show: true, lineWidth: 1 },
shadowSize: 0,
xaxis: { ticks: [], mode: "time" },
- yaxis: { ticks: [], min: 0, max: 4000 },
+ yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 },
selection: { mode: "x" }
});
diff --git a/examples/zooming.html b/examples/zooming.html
index 0f3284b..d74f065 100644
--- a/examples/zooming.html
+++ b/examples/zooming.html
@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Flot Examples</title>
<link href="layout.css" rel="stylesheet" type="text/css"></link>
- <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.pack.js"></script><![endif]-->
+ <!--[if IE]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="../jquery.js"></script>
<script language="javascript" type="text/javascript" src="../jquery.flot.js"></script>
</head>
@@ -31,8 +31,10 @@ $(function () {
// setup plot
function getData(x1, x2) {
var d = [];
- for (var i = x1; i < x2; i += (x2 - x1) / 100)
- d.push([i, Math.sin(i * Math.sin(i))]);
+ for (var i = 0; i <= 100; ++i) {
+ var x = x1 + i * (x2 - x1) / 100;
+ d.push([x, Math.sin(x * Math.sin(x))]);
+ }
return [
{ label: "sin(x sin(x))", data: d }