diff --git a/BollingerBands.js b/BollingerBands.js index 9f49ced58..28d549aa0 100644 --- a/BollingerBands.js +++ b/BollingerBands.js @@ -51,6 +51,7 @@ let bands = []; // Here we keep the bands to be ploted every time the Draw() function is called by the AAWebPlatform. + let onMouseOverEventSuscriptionId let zoomChangedEventSubscriptionId let offsetChangedEventSubscriptionId let dragFinishedEventSubscriptionId @@ -64,7 +65,7 @@ try { /* Stop listening to the necesary events. */ - + thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId) canvas.chartSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId); canvas.chartSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId); canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId); @@ -122,6 +123,7 @@ dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent("Drag Finished", onDragFinished); marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent("Files Updated", onMarketFilesUpdated); dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent("Files Updated", onDailyFilesUpdated); + onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver) /* Get ready for plotting. */ @@ -139,6 +141,11 @@ } } + function onMouseOver(event) { + let userPosition = getDateFromPoint(event, thisObject.container, coordinateSystem) + userPositionDate = userPosition.valueOf() + } + function getContainer(point) { try { @@ -460,9 +467,6 @@ try { - let userPosition = getUserPosition() - let userPositionDate = userPosition.point.x - let band; let previousBand;