41722bb9ef37f7742c9e493b748f59920c0d90df hiram Fri Nov 6 22:39:39 2020 -0800 now showing mean of values when not at base display refs #21980 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 5530108..2f7ec64 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -4591,32 +4591,36 @@ var clientX = Math.floor(evt.clientX); // the graphOffset is the index (x coordinate) into the 'spans' definitions // of the data value boxes for the graph. The magic number three // is used elsewhere in this code, note the comment on the constant // LEFTADD. var graphOffset = Math.max(0, clientX - tdLeft - 3); var windowUp = false; // see if window is supposed to become visible var foundIdx = -1; if (mouseOver.spans[trackName]) { foundIdx = mouseOver.findRange(graphOffset, mouseOver.spans[trackName]); } // can show 'no data' when not found var mouseOverValue = "no data"; if (foundIdx > -1) { // value to display + if (mouseOver.spans[trackName][foundIdx].m) { + mouseOverValue = " mean: " + mouseOver.spans[trackName][foundIdx].v + " "; + } else { mouseOverValue = " " + mouseOver.spans[trackName][foundIdx].v + " "; } + } $('#mouseOverText').html(mouseOverValue); var msgWidth = Math.ceil($('#mouseOverText').width()); var msgHeight = Math.ceil($('#mouseOverText').height()); var lineHeight = Math.max(0, tdHeight - msgHeight); var lineTop = Math.max(0, tdTop + msgHeight); var msgLeft = Math.max(0, clientX - (msgWidth/2) - 3); // with magic 3 var lineLeft = Math.max(0, clientX - 3); // with magic 3 $('#mouseOverText').css('left',msgLeft + "px"); $('#mouseOverText').css('top',tdTop + "px"); $('#mouseOverVerticalLine').css('left',lineLeft + "px"); $('#mouseOverVerticalLine').css('top',lineTop + "px"); $('#mouseOverVerticalLine').css('height',lineHeight + "px"); windowUp = true; // yes, window is to become visible if (windowUp) { // the window should become visible