Merge branch 'master' of https://github.com/F1Vis/f1vis
# Conflicts: # js/diagrams.js
This commit is contained in:
commit
3487c02bf6
@ -45,11 +45,15 @@ function createLineGraph(containerId, raceData){
|
|||||||
y = d3.scaleLinear().range([graphPosWidth.height, 0]),
|
y = d3.scaleLinear().range([graphPosWidth.height, 0]),
|
||||||
y2 = d3.scaleLinear().range([smallGraphPosWidth.height, 0]);
|
y2 = d3.scaleLinear().range([smallGraphPosWidth.height, 0]);
|
||||||
|
|
||||||
var xAxis = d3.axisBottom(x),
|
// Gather lapNumbers for xAxis tickvalues
|
||||||
|
var lapNumbers = [];
|
||||||
|
for(var i=0; i<raceData.lapTimes.size; i++) lapNumbers.push(i);
|
||||||
|
|
||||||
|
var xAxis = d3.axisBottom(x).tickValues(lapNumbers),
|
||||||
yAxis = d3.axisLeft(y);
|
yAxis = d3.axisLeft(y);
|
||||||
|
|
||||||
var xAxisGridlines = d3.axisBottom(x)
|
var xAxisGridlines = d3.axisBottom(x)
|
||||||
.ticks(raceData.lapTimes.size) // One gridline for each lap
|
.tickValues(lapNumbers) // One gridline for each lap
|
||||||
.tickSize(-graphPosWidth.height)
|
.tickSize(-graphPosWidth.height)
|
||||||
.tickFormat("");
|
.tickFormat("");
|
||||||
|
|
||||||
@ -82,14 +86,13 @@ function createLineGraph(containerId, raceData){
|
|||||||
.attr("height", svgHeight);
|
.attr("height", svgHeight);
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
// make sure we have no overlapping
|
||||||
svg.append("defs").append("clipPath")
|
svg.append("defs").append("clipPath")
|
||||||
.attr("id", "clip")
|
.attr("id", "clip")
|
||||||
.append("rect")
|
.append("rect")
|
||||||
.attr("width", graphPosWidth.width)
|
.attr("width", graphPosWidth.width)
|
||||||
.attr("height", graphPosWidth.height);
|
.attr("height", graphPosWidth.height);
|
||||||
|
|
||||||
|
|
||||||
var focus = svg.append("g")
|
var focus = svg.append("g")
|
||||||
.attr("class", "focus")
|
.attr("class", "focus")
|
||||||
.attr("transform", "translate(" + graphPosWidth.posX + "," + graphPosWidth.posY + ")");
|
.attr("transform", "translate(" + graphPosWidth.posX + "," + graphPosWidth.posY + ")");
|
||||||
|
Loading…
Reference in New Issue
Block a user