summaryrefslogtreecommitdiff
path: root/datastore-leveldb/wwwroot/lib/flot-0.7/examples/tracking.html
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2013-04-18 17:34:27 +0200
committerYves Fischer <yvesf-git@xapek.org>2013-04-18 17:34:27 +0200
commit87f4134201f0a0840415aab531e32ca714bc7a36 (patch)
treecf148ecc810f92ca2e4c177498a56130806ed4e4 /datastore-leveldb/wwwroot/lib/flot-0.7/examples/tracking.html
parent7c8e064216cc672557cbf3892ff090490505e408 (diff)
downloadebus-alt-87f4134201f0a0840415aab531e32ca714bc7a36.tar.gz
ebus-alt-87f4134201f0a0840415aab531e32ca714bc7a36.zip
leveldb geht so
Diffstat (limited to 'datastore-leveldb/wwwroot/lib/flot-0.7/examples/tracking.html')
-rw-r--r--datastore-leveldb/wwwroot/lib/flot-0.7/examples/tracking.html95
1 files changed, 95 insertions, 0 deletions
diff --git a/datastore-leveldb/wwwroot/lib/flot-0.7/examples/tracking.html b/datastore-leveldb/wwwroot/lib/flot-0.7/examples/tracking.html
new file mode 100644
index 0000000..c116159
--- /dev/null
+++ b/datastore-leveldb/wwwroot/lib/flot-0.7/examples/tracking.html
@@ -0,0 +1,95 @@
+<!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">
+ <!--[if lte IE 8]><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>
+ <script language="javascript" type="text/javascript" src="../jquery.flot.crosshair.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 (look at the legend).</p>
+
+ <p id="hoverdata"></p>
+
+<script type="text/javascript">
+var plot;
+$(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)]);
+ }
+
+ plot = $.plot($("#placeholder"),
+ [ { data: sin, label: "sin(x) = -0.00"},
+ { data: cos, label: "cos(x) = -0.00" } ], {
+ series: {
+ 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>