From a21f4f23e847e09d801c44c16772191a8f1e35b1 Mon Sep 17 00:00:00 2001 From: Ebus-at-dockstar Date: Fri, 19 Sep 2014 22:07:46 +0200 Subject: resize --- datastore-leveldb/wwwroot_ebus/src/ebus.js | 37 +++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'datastore-leveldb') diff --git a/datastore-leveldb/wwwroot_ebus/src/ebus.js b/datastore-leveldb/wwwroot_ebus/src/ebus.js index eb0cb2d..7c59025 100644 --- a/datastore-leveldb/wwwroot_ebus/src/ebus.js +++ b/datastore-leveldb/wwwroot_ebus/src/ebus.js @@ -261,7 +261,8 @@ plotDetail = $.plot($("#ebusgraph"), max:timeToLocal(to), panRange: [timeToLocal(fromOverview), timeToLocal(toOverview)] }, - yaxis: { min: -16, max: 100, panRange: [-16,100] }, + grid: { hoverable: true}, + yaxis: { min: -16, max: 100, panRange: [-50,300] }, pan: { interactive: true, frameRate: 16, @@ -279,6 +280,40 @@ $("#ebusgraph").bind('plotpan', function (event, plot) { update_range(Math.round(axes.xaxis.min), Math.round(axes.xaxis.max)); }); +$(window).resize(function() { + plotDetail.resize(); + plotDetail.setupGrid(); + plotDetail.draw(); + plotOverview.resize(); + plotOverview.setupGrid(); + plotOverview.draw(); +}); + +$("#ebusgraph").bind("plothover", function (event, pos, item) { + function showTooltip(x, y, series, time, value) { + $('
').css( { + position: 'absolute', + display: 'none', + top: y + 5, + left: x + 5, + border: '1px solid #fdd', + padding: '2px', + 'background-color': '#fee', + opacity: 0.80 + }) + .append($('

').text(series)) + .append($('

').text(time.toLocaleDateString() + " " + time.toLocaleTimeString())) + .append($('

').text(value)) + .addClass("tooltip").appendTo("#ebusgraph").fadeIn(100); + } + $("#ebusgraph .tooltip").remove(); + if (item) { + var x = item.datapoint[0].toFixed(2); + var y = item.datapoint[1].toFixed(2); + showTooltip(item.pageX, item.pageY, item.series.label, new Date(Math.ceil(x)), y); + } +}); + plotOverview = $.plot($("#overview"), datasetOverview, { // options -- cgit v1.2.1