Skip to content

Commit aca36ac

Browse files
committed
fix graph tooltip bug
1 parent b9923c2 commit aca36ac

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

www/index.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,8 @@ <h3>Select date range for the CSV export</h3>
10061006
var editDataEnd=0;
10071007

10081008
function renderGraphTooltip(event, pos, item) {
1009-
if (item && graphOptions.yaxes[item.seriesIndex]) {
1009+
if(!item) return;
1010+
if (graphOptions.yaxes[item.seriesIndex]) {
10101011
var date = new Date(item.datapoint[0]);
10111012

10121013
for (var mkey in metricsDef)
@@ -1035,7 +1036,7 @@ <h3>Select date range for the CSV export</h3>
10351036
var val = date.format("mmm-d, ") + '<b>' + date.format('h:MM')+'</b>'+date.format('tt')+'<br/><b>' + (item.graphValPrefix||'') + (item.valOverride || item.datapoint[1]/*.toFixed(2)*/) + '</b>' + (item.unit || '') + (item.graphValSuffix||'');
10361037
$("#tooltip").html(val)
10371038
.css({top: item.pageY-40, left: item.pageX+7})
1038-
.fadeIn(100);
1039+
.show();
10391040
}
10401041
else if (toolTipOnItem) { hideTooltip(); toolTipOnItem=false; }
10411042
}
@@ -1427,7 +1428,7 @@ <h3>Select date range for the CSV export</h3>
14271428
//$('#graphReset').click(function () {graphView.resetDomain(); refreshGraph();});
14281429
$('#graphExport').click(function (e) { e.preventDefault(); exportGraph(); });
14291430
$('.graphControl').click(function () {graphView.setDomain($(this).attr("hours")); refreshGraph();});
1430-
1431+
14311432
metricGraph.on("plothover", renderGraphTooltip); //graph value tooltips
14321433
metricGraph.on("plotclick", plotClick);
14331434
metricGraph.on("plotselected", plotSelect);
@@ -1578,10 +1579,12 @@ <h2>' + (nodeResolveString(node.label||'', node.metrics) || node._id) + ' ' + re
15781579
existingNode.replaceWith(newLI);
15791580
else $('#nodeList').append(newLI);
15801581

1581-
if (selectedNodeId == node._id && (['nodedetails','metricdetails','requestdetails'].indexOf($.mobile.activePage.attr('id')) > -1))
1582-
refreshNodeDetails(node);
1583-
1584-
if ($.mobile.activePage.attr('id')=='metricdetails') refreshGraph(true, false);
1582+
if (selectedNodeId == node._id) {
1583+
if (['nodedetails','metricdetails','requestdetails'].indexOf($.mobile.activePage.attr('id')) > -1)
1584+
refreshNodeDetails(node);
1585+
if ($.mobile.activePage.attr('id')=='metricdetails')
1586+
refreshGraph(true, false);
1587+
}
15851588

15861589
//update this node's events on the events page
15871590
for(var key in node.events)
@@ -1734,7 +1737,7 @@ <h2>' + (nodeResolveString(node.label||'', node.metrics) || node._id) + ' ' + re
17341737
var timeoutID=false;
17351738
function hideTooltip() {
17361739
if ($("#tooltip").is(':visible'))
1737-
$("#tooltip").fadeOut(100);
1740+
$("#tooltip").hide();
17381741
}
17391742

17401743
$("#graphDeleteDataToggle").click("tap", function(event) {

0 commit comments

Comments
 (0)