Changeset View
Changeset View
Standalone View
Standalone View
swh/web/assets/src/bundles/webapp/history-counters.js
Show All 32 Lines | const tooltip = d3.select('body') | ||||
.attr('class', 'd3-tooltip') | .attr('class', 'd3-tooltip') | ||||
.attr('id', `${container}-tooltip`) | .attr('id', `${container}-tooltip`) | ||||
.style('opacity', 0); | .style('opacity', 0); | ||||
// update width and height without margins | // update width and height without margins | ||||
width = width - margin.left - margin.right; | width = width - margin.left - margin.right; | ||||
height = height - margin.top - margin.bottom; | height = height - margin.top - margin.bottom; | ||||
// Make sure data points are sorted, by x coordinate then y coordinate. | |||||
historyData.sort(function(a, b) { | |||||
return a[0] - b[0] !== 0 ? a[0] - b[0] : a[1] - b[1]; | |||||
}); | |||||
const firstPoint = historyData[0]; | const firstPoint = historyData[0]; | ||||
const lastPoint = historyData[historyData.length - 1]; | const lastPoint = historyData[historyData.length - 1]; | ||||
// create main svg group element | // create main svg group element | ||||
const g = svg.append('g') | const g = svg.append('g') | ||||
.attr('transform', `translate(${margin.left}, ${margin.top})`); | .attr('transform', `translate(${margin.left}, ${margin.top})`); | ||||
// create x scale | // create x scale | ||||
▲ Show 20 Lines • Show All 95 Lines • Show Last 20 Lines |