From 5912044b65df270421694f0d609fb08191498e18 Mon Sep 17 00:00:00 2001 From: cgtboy1988 Date: Fri, 22 Dec 2017 14:25:51 -0500 Subject: [PATCH 1/3] Updating colors and vertical scaling Should now scale without em, which is more accurate across resolutions and browsers. --- www/scoreboard-llnl-timeline.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/www/scoreboard-llnl-timeline.html b/www/scoreboard-llnl-timeline.html index 1abfaaa..72bbb00 100644 --- a/www/scoreboard-llnl-timeline.html +++ b/www/scoreboard-llnl-timeline.html @@ -63,8 +63,7 @@ window.addEventListener("load", init); -

Scoreboard

+

Scoreboard

- From c4f7d72b1bb4fb5ba925284ae267b7a67343252b Mon Sep 17 00:00:00 2001 From: cgtboy1988 Date: Fri, 22 Dec 2017 14:26:24 -0500 Subject: [PATCH 2/3] Updating colors and vertical scaling --- www/scoreboard-llnl.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/www/scoreboard-llnl.js b/www/scoreboard-llnl.js index ffebd16..bc3c336 100644 --- a/www/scoreboard-llnl.js +++ b/www/scoreboard-llnl.js @@ -148,12 +148,17 @@ function scoreboard(element, continuous, mode, interval) { var graph = document.createElement("svg"); graph.id = "graph"; graph.style.width="100%"; - graph.style.height="40em"; + graph.style.height = "100vh"; + var titleHeight = document.getElementById("title").clientHeight; + titleHeight += document.getElementById("title").offsetTop * 2; + console.log(titleHeight); graph.style.backgroundColor = "white"; graph.style.display = "table"; var holdingDiv = document.createElement("div"); holdingDiv.align="center"; holdingDiv.id="holding"; + holdingDiv.style.height = "100%"; + element.style.height = "100%"; element.appendChild(holdingDiv); holdingDiv.appendChild(graph); @@ -162,6 +167,7 @@ function scoreboard(element, continuous, mode, interval) { var width = graph.offsetWidth; var height = graph.offsetHeight; + height = height - titleHeight - margins; //var xScale = d3.scaleLinear().range([minTime, maxTime]); //var yScale = d3.scaleLinear().range([0, topActualScore]); @@ -283,13 +289,13 @@ function scoreboard(element, continuous, mode, interval) { .text("Time (minutes)"); var legend = graph.append("g"); - var legendRowHeight = (height) / 10; + var legendRowHeight = (height - margins) / 10; legend.selectAll("rect") .data(winningTeams) .enter() .append("rect") .attr("class", function(d){ return "team_" + d; }) - .attr("fill", function(d, i){ return colorScale[i * 2 + 1]; }) + .attr("fill", function(d, i){ return colorScale[i * 2]; }) .style("z-index", function(d, i){ return i; }) .attr("x", 0) .attr("y", function(d, i){ return legendRowHeight * i; }) @@ -343,8 +349,8 @@ function scoreboard(element, continuous, mode, interval) { .style("stroke", colorScale[(maxNumEntry - zIndex) * 2]) .style("fill", colorScale[(maxNumEntry - zIndex) * 2]); legend.selectAll("." + curClass) - .style("stroke", colorScale[(maxNumEntry - zIndex) * 2 + 1]) - .style("fill", colorScale[(maxNumEntry - zIndex) * 2 + 1]); + .style("stroke", colorScale[(maxNumEntry - zIndex) * 2]) + .style("fill", colorScale[(maxNumEntry - zIndex) * 2]); d3.select("body").selectAll("text") .style("stroke-width", 0); } @@ -388,8 +394,8 @@ function scoreboard(element, continuous, mode, interval) { .style("stroke", colorScale[(maxNumEntry - zIndex) * 2]) .style("fill", colorScale[(maxNumEntry - zIndex) * 2]); legend.selectAll("." + curClass) - .style("stroke", colorScale[(maxNumEntry - zIndex) * 2 + 1]) - .style("fill", colorScale[(maxNumEntry - zIndex) * 2 + 1]); + .style("stroke", colorScale[(maxNumEntry - zIndex) * 2]) + .style("fill", colorScale[(maxNumEntry - zIndex) * 2]); d3.select("body").selectAll("text") .style("stroke-width", 0); } @@ -412,8 +418,8 @@ function scoreboard(element, continuous, mode, interval) { .style("stroke", colorScale[zIndex * 2]) .style("fill", colorScale[zIndex * 2]); legend.selectAll("." + curClass) - .style("stroke", colorScale[(zIndex) * 2 + 1]) - .style("fill", colorScale[(zIndex) * 2 + 1]); + .style("stroke", colorScale[(zIndex) * 2]) + .style("fill", colorScale[(zIndex) * 2]); d3.select("body").selectAll("text") .style("stroke-width", 0); } @@ -521,4 +527,3 @@ function scoreboard(element, continuous, mode, interval) { } once(); } - From 66c94db0fc7af2b099c621b6b124eff23c8f7f3a Mon Sep 17 00:00:00 2001 From: cgtboy1988 Date: Fri, 22 Dec 2017 14:28:12 -0500 Subject: [PATCH 3/3] Removed debug logging --- www/scoreboard-llnl.js | 1 - 1 file changed, 1 deletion(-) diff --git a/www/scoreboard-llnl.js b/www/scoreboard-llnl.js index bc3c336..7546522 100644 --- a/www/scoreboard-llnl.js +++ b/www/scoreboard-llnl.js @@ -151,7 +151,6 @@ function scoreboard(element, continuous, mode, interval) { graph.style.height = "100vh"; var titleHeight = document.getElementById("title").clientHeight; titleHeight += document.getElementById("title").offsetTop * 2; - console.log(titleHeight); graph.style.backgroundColor = "white"; graph.style.display = "table"; var holdingDiv = document.createElement("div");