diff --git a/src/components/Dashboard.jsx b/src/components/Dashboard.jsx index 5a38e57..2a66343 100644 --- a/src/components/Dashboard.jsx +++ b/src/components/Dashboard.jsx @@ -44,6 +44,7 @@ class Dashboard extends React.Component { } handleSelect(selected) { + console.log(selected) if (selected) { let eventsToSelect = selected.map(event => this.getEventById(event.id)); const parser = this.props.ui.tools.parser; diff --git a/src/components/Timeline.jsx b/src/components/Timeline.jsx index 613b2b6..eaf6548 100644 --- a/src/components/Timeline.jsx +++ b/src/components/Timeline.jsx @@ -22,15 +22,18 @@ class Timeline extends React.Component { selected: this.props.selected, language: this.props.language, select: this.props.select, - filter: this.props.filter, - getCategoryColor: this.props.getCategoryColor } const ui = { tools: this.props.tools, dom: this.props.dom } - this.timeline = new TimelineLogic(app, ui); + const methods = { + filter: this.props.filter, + getCategoryColor: this.props.getCategoryColor + } + + this.timeline = new TimelineLogic(app, ui, methods); this.timeline.update(domain, app); this.timeline.render(domain); } diff --git a/src/js/timeline/timeline.js b/src/js/timeline/timeline.js index 09bfe74..ba1d7df 100644 --- a/src/js/timeline/timeline.js +++ b/src/js/timeline/timeline.js @@ -10,7 +10,7 @@ import { import esLocale from '../data/es-MX.json'; import copy from '../data/copy.json'; -export default function(app, ui) { +export default function(app, ui, methods) { d3.timeFormatDefaultLocale(esLocale); const formatterWithYear = ui.tools.formatterWithYear; const parser = ui.tools.parser; @@ -55,10 +55,6 @@ export default function(app, ui) { let selected = []; let timerange = app.timerange; - const timeFilter = app.filter; - const getCategoryLabel = app.getCategoryLabel; - const getCategoryColor = app.getCategoryColor; - // Drag behavior let dragPos0; let transitionDuration = 500; @@ -223,7 +219,7 @@ export default function(app, ui) { }) .on('end', () => { toggleTransition(true); - timeFilter(scale.x.domain()); + methods.filter(scale.x.domain()); }); /* @@ -285,7 +281,7 @@ export default function(app, ui) { * @param {object} eventPoint data object */ function getEventPointFillColor(eventPoint) { - return getCategoryColor(eventPoint.category); + return methods.getCategoryColor(eventPoint.category); } /** @@ -357,7 +353,7 @@ export default function(app, ui) { const domainF = d3.timeMinute.offset(newCentralTime, zoom.duration / 2); scale.x.domain([domain0, domainF]); - timeFilter(scale.x.domain()); + methods.filter(scale.x.domain()); } /** @@ -380,7 +376,7 @@ export default function(app, ui) { } scale.x.domain([domain0, domainF]); - timeFilter(scale.x.domain()); + methods.filter(scale.x.domain()); } function toggleTransition(isTransition) {