# Conflicts:
#	js/diagrams.js
This commit is contained in:
Maschell 2017-12-31 01:36:02 +01:00
commit 3487c02bf6
1 changed files with 7 additions and 4 deletions

View File

@ -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,13 +86,12 @@ 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")