diff --git a/.vs/AAWeb/v15/.suo b/.vs/AAWeb/v15/.suo index cf5017af6..16b544c1b 100644 Binary files a/.vs/AAWeb/v15/.suo and b/.vs/AAWeb/v15/.suo differ diff --git a/ProductCard.js b/ProductCard.js index 3dceb314b..757e2d466 100644 --- a/ProductCard.js +++ b/ProductCard.js @@ -78,6 +78,7 @@ let plotterModule = ecosystem.getPlotterModule(plotter, thisObject.product.plotter.moduleName); thisObject.product.plotter.profilePicture = plotterModule.profilePicture; + thisObject.product.plotter.module = plotterModule; /* Lets set the basic dimensions of this thisObject. */ diff --git a/TimeMachine.js b/TimeMachine.js index 5baaa4cb1..df903ffb3 100644 --- a/TimeMachine.js +++ b/TimeMachine.js @@ -117,113 +117,6 @@ function newTimeMachine() { } - function otherCharts() { - /* Chart 1 */ - /* - var orderBookChart = newOrderBookChart(); - - orderBookChart.container.displacement.parentDisplacement = timeMachine.container.displacement; - orderBookChart.container.zoom.parentZoom = timeMachine.container.zoom; - orderBookChart.container.frame.parentFrame = timeMachine.container.frame; - - orderBookChart.container.parentContainer = timeMachine.container; - - orderBookChart.container.frame.width = timeMachine.container.frame.width * 0.50; - orderBookChart.container.frame.height = timeMachine.container.frame.height * 0.50; - - orderBookChart.container.frame.position.x = timeMachine.container.frame.width * 0; - orderBookChart.container.frame.position.y = timeMachine.container.frame.height * 0.50; - - orderBookChart.initialize(1); - - - orderBookChart.setDatetime(controlPanel.datetimeDisplay.currentDatetime); - - timeMachine.charts.push(orderBookChart); - - - - controlPanel.container.eventHandler.listenToEvent('Datetime Changed', orderBookChart.setDatetime, undefined); - */ - /* Chart 2 */ - /* - var orderBookChart = newOrderBookChart(); - - orderBookChart.container.displacement.parentDisplacement = timeMachine.container.displacement; - orderBookChart.container.zoom.parentZoom = timeMachine.container.zoom; - orderBookChart.container.frame.parentFrame = timeMachine.container.frame; - - orderBookChart.container.parentContainer = timeMachine.container; - - orderBookChart.container.frame.width = timeMachine.container.frame.width * 0.50; - orderBookChart.container.frame.height = timeMachine.container.frame.height * 0.50; - - orderBookChart.container.frame.position.x = timeMachine.container.frame.width * 0.50; - orderBookChart.container.frame.position.y = timeMachine.container.frame.height * 0.50; - - orderBookChart.initialize(2); - - - orderBookChart.setDatetime(controlPanel.datetimeDisplay.currentDatetime); - - timeMachine.charts.push(orderBookChart); - - controlPanel.container.eventHandler.listenToEvent('Datetime Changed', orderBookChart.setDatetime, undefined); - */ - /* Chart 3 */ - /* - var priceChart = newPriceChart(); - - priceChart.container.displacement.parentDisplacement = timeMachine.container.displacement; - priceChart.container.zoom.parentZoom = timeMachine.container.zoom; - priceChart.container.frame.parentFrame = timeMachine.container.frame; - - priceChart.container.parentContainer = timeMachine.container; - - priceChart.container.frame.width = timeMachine.container.frame.width * 1; - priceChart.container.frame.height = timeMachine.container.frame.height * 1 / 3; - - priceChart.container.frame.position.x = timeMachine.container.frame.width * 0; - priceChart.container.frame.position.y = timeMachine.container.frame.height * 0; - - priceChart.initialize(1, 2, marketTrades); - - - priceChart.setDatetime(controlPanel.datetimeDisplay.currentDatetime); - - timeMachine.charts.push(priceChart); - - controlPanel.container.eventHandler.listenToEvent('Datetime Changed', priceChart.setDatetime, undefined); - */ - - /* Chart 5 */ - /* - var spreadChart = newSpreadChart(); - - spreadChart.container.displacement.parentDisplacement = timeMachine.container.displacement; - spreadChart.container.zoom.parentZoom = timeMachine.container.zoom; - spreadChart.container.frame.parentFrame = timeMachine.container.frame; - - spreadChart.container.parentContainer = timeMachine.container; - - spreadChart.container.frame.width = timeMachine.container.frame.width * 1; - spreadChart.container.frame.height = timeMachine.container.frame.height * 1 / 3; - - spreadChart.container.frame.position.x = timeMachine.container.frame.width * 0; - spreadChart.container.frame.position.y = timeMachine.container.frame.height * 1 / 3; - - spreadChart.initialize(1, 2, marketTrades); - - - spreadChart.setDatetime(controlPanel.datetimeDisplay.currentDatetime); - - timeMachine.charts.push(spreadChart); - - controlPanel.container.eventHandler.listenToEvent('Datetime Changed', spreadChart.setDatetime, undefined); - */ - - - } function draw() { @@ -272,19 +165,17 @@ function newTimeMachine() { return container; } - - - //for (var i = 0; i < this.charts.length; i++) { + for (var i = 0; i < this.charts.length; i++) { - // container = this.charts[i].getContainer(point); + container = this.charts[i].getContainer(point); - // if (container !== undefined) { + if (container !== undefined) { /* We found an inner container which has the point. We return it. */ - // return container; - // } - //} + return container; + } + } /* The point does not belong to any inner container, so we return the current container. */ diff --git a/TimelineChart.js b/TimelineChart.js index 5fe9a46ff..53e2d0fb6 100644 --- a/TimelineChart.js +++ b/TimelineChart.js @@ -166,23 +166,17 @@ function newTimelineChart() { switch (thisSet.type) { case 'Market Files': { - storage.eventHandler.listenToEvent('Market File Loaded', pProductCard.onMarketFileLoaded); - } break; case 'Daily Files': { - storage.eventHandler.listenToEvent('Daily File Loaded', pProductCard.onDailyFileLoaded); - } break; case 'Single File': { - storage.eventHandler.listenToEvent('Single File Loaded', pProductCard.onSingleFileLoaded);; - } break; } @@ -234,6 +228,29 @@ function newTimelineChart() { storage.eventHandler.listenToEvent('Daily File Loaded', plotter.onDailyFileLoaded); + /* Lets load now this plotter panels. */ + + productPlotter.panels = []; + + for (let i = 0; i < pProductCard.product.plotter.module.panels.length; i++) { + + let panel = pProductCard.product.plotter.module.panels[i]; + + let plotterPanel = getNewPlotterPanel(pProductCard.product.plotter.devTeam, pProductCard.product.plotter.codeName, pProductCard.product.plotter.moduleName, panel.codeName); + + plotterPanel.initialize(); + + /* Connect Panel to the Plotter via an Event. */ + + if (panel.event !== undefined) { + + productPlotter.plotter.container.eventHandler.listenToEvent(panel.event, plotterPanel.onEventRaised); + + } + + productPlotter.panels.push(plotterPanel); + } + /* Add the new Active Protter to the Array */ productPlotters.push(productPlotter); @@ -398,7 +415,26 @@ function newTimelineChart() { if (this.container.frame.isThisPointHere(point) === true) { - return this.container; + for (let i = 0; i < productPlotters.length; i++) { + + let productPlotter = productPlotters[i]; + + for (let j = 0; j < productPlotter.panels.length; j++) { + + let panel = productPlotter.panels[j]; + + let panelContainer = panel.getContainer(point); + + if (panelContainer !== undefined) { + + /* We found an inner container which has the point. We return it. */ + + return panelContainer; + } + } + } + + // return this.container; Currently there is a BUG in which if this is enabled the datetime of the control panel is not recalculated. } else { @@ -454,20 +490,36 @@ function newTimelineChart() { chartGrid.draw(thisObject.container, timeLineCoordinateSystem); - for (var i = 0; i < productPlotters.length; i++) { + /* First the Product Plotters. */ + + for (let i = 0; i < productPlotters.length; i++) { let productPlotter = productPlotters[i]; productPlotter.plotter.draw(); } + /* Then the competition plotters. */ + for (let i = 0; i < competitionPlotters.length; i++) { let competitionPlotter = competitionPlotters[i]; - competitionPlotter.plotter.draw(); - } + + /* Finally the panels. */ + + for (let i = 0; i < productPlotters.length; i++) { + + let productPlotter = productPlotters[i]; + + for (let j = 0; j < productPlotter.panels.length; j++) { + + let panel = productPlotter.panels[j]; + panel.draw(); + } + } + } }