Update graph while moving

This commit is contained in:
Maschell 2017-12-30 23:41:37 +01:00
parent 6e1859cd26
commit 222d523323
1 changed files with 9 additions and 5 deletions

View File

@ -509,8 +509,7 @@ function createLineGraph(containerId, raceData){
var s = d3.event.selection || x2.range();
x.domain(s.map(x2.invert, x2));
//Update the x axis data
focus.select(".axis--x").call(xAxis);
updateElements();
//Update the "preview" rectangle
svg.select(".zoom").call(zoom.transform, d3.zoomIdentity
@ -524,6 +523,14 @@ function createLineGraph(containerId, raceData){
x.domain(t.rescaleX(x2).domain());
updateElements();
//call the brush function
context.select(".brush").call(brush.move, x.range().map(t.invertX, t));
}
function updateElements(){
//scale the path axis
focus.selectAll(".pathLines").call(xAxis);
@ -534,9 +541,6 @@ function createLineGraph(containerId, raceData){
//Update x-axis
focus.select(".axis--x").call(xAxis);
//call the brush function
context.select(".brush").call(brush.move, x.range().map(t.invertX, t));
}
}