Shuffle around, remove zoom rect temporarily

This commit is contained in:
Jan Philipp Timme 2017-12-31 00:19:51 +01:00
parent 7d10181f77
commit b299ab7eeb
1 changed files with 21 additions and 16 deletions

View File

@ -80,7 +80,15 @@ function createLineGraph(containerId, raceData){
var svg = d3.select(containerId).append("svg")
.attr("width", svgWidth)
.attr("height", svgHeight);
//----------------------------------------------------------------------
/*svg.append("rect")
.attr("class", "zoom")
.attr("width", graphPosWidth.width)
.attr("height", graphPosWidth.height)
.attr("transform", "translate(" + graphPosWidth.posX + "," + graphPosWidth.posY + ")")
.call(zoom);*/
svg.append("defs").append("clipPath")
.attr("id", "clip")
.append("rect")
@ -98,6 +106,18 @@ function createLineGraph(containerId, raceData){
// -----------------------------------------------------------------------
context.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + smallGraphPosWidth.height + ")")
.call(d3.axisBottom(x2));
context.append("g")
.attr("class", "brush")
.call(brush)
.call(brush.move, x.range());
// -----------------------------------------------------------------------
// Scale the range of the data
x.domain([0, raceData.lapTimes.size]);
y.domain([raceData.drivers.length, 1]);
@ -304,22 +324,7 @@ function createLineGraph(containerId, raceData){
//----------------------------
context.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + smallGraphPosWidth.height + ")")
.call(d3.axisBottom(x2));
context.append("g")
.attr("class", "brush")
.call(brush)
.call(brush.move, x.range());
svg.append("rect")
.attr("class", "zoom")
.attr("width", graphPosWidth.width)
.attr("height", graphPosWidth.height)
.attr("transform", "translate(" + graphPosWidth.posX + "," + graphPosWidth.posY + ")")
.call(zoom);
//---------------------------------------------------------------------------