From 7d10181f770104bce8cc216a647098085e0d6b40 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Sat, 30 Dec 2017 23:58:33 +0100 Subject: [PATCH] Make gridlines scale as well --- js/diagrams.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/diagrams.js b/js/diagrams.js index 5392298..7da2a9d 100644 --- a/js/diagrams.js +++ b/js/diagrams.js @@ -279,7 +279,7 @@ function createLineGraph(containerId, raceData){ // Add gridlines on x axis to better figure out laps focus.append("g") - .attr("class", "grid axis axis--x") + .attr("class", "xAxisGridlines") .attr("transform", "translate(0," + graphPosWidth.height + ")") .style("opacity", 0.06) .call(xAxisGridlines); @@ -514,12 +514,14 @@ function createLineGraph(containerId, raceData){ } function updateElements(){ - //update the data!! + // Update the data! focus.selectAll(".pathLines").attr("d", lineDataDefinition); focus.selectAll(".pitstopdot").attr("cx", function(d, i) {return x(d.lap) }); focus.selectAll(".endpointdot").attr("x", function(d, i) { return x(d.lap) - rectSize * 1/2; }); - //Update xAxis + // Update xAxis focus.select(".axis--x").call(xAxis); + // Update gridlines + focus.select(".xAxisGridlines").call(xAxisGridlines); } }