Make gridlines scale as well
This commit is contained in:
parent
3a851b8fa1
commit
7d10181f77
|
@ -279,7 +279,7 @@ function createLineGraph(containerId, raceData){
|
||||||
|
|
||||||
// Add gridlines on x axis to better figure out laps
|
// Add gridlines on x axis to better figure out laps
|
||||||
focus.append("g")
|
focus.append("g")
|
||||||
.attr("class", "grid axis axis--x")
|
.attr("class", "xAxisGridlines")
|
||||||
.attr("transform", "translate(0," + graphPosWidth.height + ")")
|
.attr("transform", "translate(0," + graphPosWidth.height + ")")
|
||||||
.style("opacity", 0.06)
|
.style("opacity", 0.06)
|
||||||
.call(xAxisGridlines);
|
.call(xAxisGridlines);
|
||||||
|
@ -514,12 +514,14 @@ function createLineGraph(containerId, raceData){
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateElements(){
|
function updateElements(){
|
||||||
//update the data!!
|
// Update the data!
|
||||||
focus.selectAll(".pathLines").attr("d", lineDataDefinition);
|
focus.selectAll(".pathLines").attr("d", lineDataDefinition);
|
||||||
focus.selectAll(".pitstopdot").attr("cx", function(d, i) {return x(d.lap) });
|
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; });
|
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);
|
focus.select(".axis--x").call(xAxis);
|
||||||
|
// Update gridlines
|
||||||
|
focus.select(".xAxisGridlines").call(xAxisGridlines);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue