From f66f17373141ffaa8571cf65c3f404cd1988210d Mon Sep 17 00:00:00 2001 From: Brandon Hilkert Date: Wed, 21 May 2014 19:52:41 -0400 Subject: [PATCH] Fix labels to not move on mouseover --- web/assets/javascripts/dashboard.js | 16 ++++++++++++++-- web/assets/stylesheets/application.css | 6 ++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/web/assets/javascripts/dashboard.js b/web/assets/javascripts/dashboard.js index 75c0b01b..65f9ffd6 100644 --- a/web/assets/javascripts/dashboard.js +++ b/web/assets/javascripts/dashboard.js @@ -48,7 +48,13 @@ var realtimeGraph = function(updatePath) { var legend = document.querySelector('#realtime-legend'); var Hover = Rickshaw.Class.create(Rickshaw.Graph.HoverDetail, { render: function(args) { - legend.innerHTML = args.formattedXValue; + + legend.innerHTML = ""; + + var timestamp = document.createElement('div'); + timestamp.className = 'timestamp'; + timestamp.innerHTML = args.formattedXValue; + legend.appendChild(timestamp); args.detail.sort(function(a, b) { return a.order - b.order }).forEach( function(d) { var line = document.createElement('div'); @@ -149,7 +155,13 @@ var historyGraph = function() { var legend = document.querySelector('#history-legend'); var Hover = Rickshaw.Class.create(Rickshaw.Graph.HoverDetail, { render: function(args) { - legend.innerHTML = args.formattedXValue; + + legend.innerHTML = ""; + + var timestamp = document.createElement('div'); + timestamp.className = 'timestamp'; + timestamp.innerHTML = args.formattedXValue; + legend.appendChild(timestamp); args.detail.sort(function(a, b) { return a.order - b.order }).forEach( function(d) { var line = document.createElement('div'); diff --git a/web/assets/stylesheets/application.css b/web/assets/stylesheets/application.css index 50e68f54..6bf3fe40 100755 --- a/web/assets/stylesheets/application.css +++ b/web/assets/stylesheets/application.css @@ -401,6 +401,12 @@ div.interval-slider input { margin-top: 5px; float: right; } +#realtime-legend .timestamp, +#history-legend .timestamp { + display: inline-block; + width: 250px; + text-align: right; +} #realtime-legend .line, #history-legend .line { display: inline-block;