From 62a3e83915e4d7763f5e357bc231fd072510b723 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 3 Mar 2018 12:10:14 +0100 Subject: [PATCH] plotArea refactored Part 1 --- .vs/Plotters-Trading/v15/.suo | Bin 14336 -> 22016 bytes Details.js | 36 +++++++++++++++++----------------- History.js | 8 ++++---- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.vs/Plotters-Trading/v15/.suo b/.vs/Plotters-Trading/v15/.suo index 10c5d0f49f2d48a8d4f69d19914587ed7930194d..bd5502151b3d2a5c5bfe41d05ae6723126125842 100644 GIT binary patch delta 625 zcmZ{gy-vbV6vumS`KWkH)u=%raHEXI)JYc?Wzd8eP?uluQ$LEzMv0Ulmtz8SZfLbFj8^l)Lb^KHU$xt z{v@g{8x@YY8T}-slUcJDd>C|sq^fuU-rlwf)`dwf znhY$r1syES4*>=%7_?F|z^S++>FEZw(xbDeVCzII)4KSrqO+q;?NNSMJf6qio*+uB i{hj2L2JC@Lj+ieIQH&a$e=gCc$7T@4G-QcLMnpf+s@bRj delta 474 zcmZ9J&q~8U5XLi`Hd*S%RH13rVj}h=3VnfkiGqTtQSUy1(86B4mBLNA`*j_K zy2ma-SjYnu+EVrDwp3!a*93wkl!L0Ea9%cOS$9e<1Fp81UmiT}9fqoBT|B%paDaLO z)MAj`;x>W})O~c~G%@=qy2#SEd}4B%JNHX56|~g+18Xz&!FHAOuCknXXAZDm$D*}9 z6Lo3w1+fo8$G$?2ocak70ZRy-tm>` viewPort.visibleArea.bottomLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - if (calculateBuys(plotArea, visibleHeight) === false) { continue; } // We snap t to the view port. + if (calculateBuys(timeLineCoordinateSystem, visibleHeight) === false) { continue; } // We snap t to the view port. /* Now we set the real value of y. */ volumePointA1.y = viewPort.visibleArea.bottomRight.y; - volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * plotArea.scale.y; - volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * plotArea.scale.y; + volumePointA2.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; + volumePointA3.y = viewPort.visibleArea.bottomRight.y - volume.amountBuy * timeLineCoordinateSystem.scale.y; volumePointA4.y = viewPort.visibleArea.bottomRight.y; } @@ -553,17 +553,17 @@ } - calculateSells(plotAreaFrame, thisObject.container.frame.height); // We try to see if it fits in the visible area. + calculateSells(timeLineCoordinateSystemFrame, thisObject.container.frame.height); // We try to see if it fits in the visible area. if (volumePointB1.y < viewPort.visibleArea.topLeft.y && frameHeightInViewPort > visibleHeight * 2 / 3) { - calculateSells(plotArea, visibleHeight); // We snap it to the view port. + calculateSells(timeLineCoordinateSystem, visibleHeight); // We snap it to the view port. /* Now we set the real value of y. */ volumePointB1.y = viewPort.visibleArea.topLeft.y; - volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * plotArea.scale.y; - volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * plotArea.scale.y; + volumePointB2.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; + volumePointB3.y = viewPort.visibleArea.topLeft.y + volume.amountSell * timeLineCoordinateSystem.scale.y; volumePointB4.y = viewPort.visibleArea.topLeft.y; } diff --git a/History.js b/History.js index 6e1d047dc..a2a6efe7e 100644 --- a/History.js +++ b/History.js @@ -18,7 +18,7 @@ container.initialize(); thisObject.container = container; - let plotArea = newPlotArea(); // Needed to be able to plot on the timeline, otherwise not. + let timeLineCoordinateSystem = newTimeLineCoordinateSystem(); // Needed to be able to plot on the timeline, otherwise not. let timePeriod; // This will hold the current Time Period the user is at. let datetime; // This will hold the current Datetime the user is at. @@ -119,7 +119,7 @@ if (file === undefined) { return; } // We need the market file to be loaded to make the calculation. - if (plotArea.maxValue > 0) { return; } // Already calculated. + if (timeLineCoordinateSystem.maxValue > 0) { return; } // Already calculated. let minValue = { x: EARLIEST_DATE.valueOf(), @@ -132,7 +132,7 @@ }; - plotArea.initialize( + timeLineCoordinateSystem.initialize( minValue, maxValue, thisObject.container.frame.width, @@ -169,7 +169,7 @@ y: record.rate }; - point = plotArea.inverseTransform(point, thisObject.container.frame.height); + point = timeLineCoordinateSystem.inverseTransform(point, thisObject.container.frame.height); point = transformThisPoint(point, thisObject.container);