Clean up Timeline component

This commit is contained in:
Franc Camps-Febrer
2018-12-12 12:47:05 +01:00
parent 04cac7ef55
commit ded07321d0
4 changed files with 33 additions and 40 deletions

View File

@@ -129,11 +129,8 @@ Stop and start the development process in terminal after you have added your tok
}
function updateSVG() {
const boundaries = getSVGBoundaries();
const {
topLeft,
bottomRight
} = boundaries;
const { topLeft, bottomRight } = getSVGBoundaries();
svg.attr('width', bottomRight.x - topLeft.x + 200)
.attr('height', bottomRight.y - topLeft.y + 200)
.style('left', `${topLeft.x - 100}px`)
@@ -155,7 +152,7 @@ Stop and start the development process in terminal after you have added your tok
.curve(d3.curveMonotoneX);
}
lMap.on("zoom viewreset move", updateSVG);
lMap.on("zoomend viewreset moveend", updateSVG);
/**
* Returns latitud / longitude
@@ -224,9 +221,7 @@ Stop and start the development process in terminal after you have added your tok
function getLocationEventsDistribution(location) {
const eventCount = {};
const categories = domain.categories;
// categories.sort((a, b) => {
// return (+a.slice(-2) > +b.slice(-2));
// });
categories.forEach(cat => {
eventCount[cat.category] = 0
});

View File

@@ -316,7 +316,7 @@ export default function(newApp, ui, methods) {
const newDomain0 = d3.timeSecond.offset(app.timerange[0], timeShift);
const newDomainF = d3.timeSecond.offset(app.timerange[1], timeShift);
scale.x.domain([newDomain0, newDomainF])
scale.x.domain([newDomain0, newDomainF]);
render();
})
.on('end', () => {
@@ -554,6 +554,7 @@ export default function(newApp, ui, methods) {
app.timerange = newApp.timerange;
app.selected = newApp.selected.slice(0);
updateTimeRange();
renderTimeLabels();
renderEventsAndHighlight();
}
}