From 613cb7d7f5493ed3ebd77b781bdc08e8dc3f815b Mon Sep 17 00:00:00 2001 From: Tim Date: Mon, 6 May 2024 14:32:02 -0400 Subject: [PATCH] diagonal debug --- src/charts/shape.js | 25 ++- src/components/chart/ChartOrder.vue | 1 - src/components/chart/DiagonalBuilder.vue | 196 +++++++++++++++++++---- src/components/chart/RungBuilder.vue | 15 +- 4 files changed, 184 insertions(+), 53 deletions(-) diff --git a/src/charts/shape.js b/src/charts/shape.js index 161f019..ddc7cd5 100644 --- a/src/charts/shape.js +++ b/src/charts/shape.js @@ -57,7 +57,7 @@ export class Shape { // lineColor, textColor, color, // lineColor and textColor default to color // } - this.debug = false + this.debug = true this.id = null // TradingView shapeId, or null if no TV shape created yet (drawing mode) this.type = type // ShapeType this.model = {} // set to nothing at first @@ -324,30 +324,17 @@ export class Shape { } -let lineChangeInfo = null - function dirtyPoints(pointsA, pointsB) { - const result = dirtyPoints2(pointsA,pointsB) - console.error('dirtyPoints', result, pointsA, pointsB) - return result -} -function dirtyPoints2(pointsA, pointsB) { - console.log('dp2', pointsA, pointsB) if (pointsA === undefined) return true - console.log('dp2b') if (pointsB === undefined) return false - console.log('dp2c') if (pointsB===null) return pointsA !== null - console.log('dp2d') if (pointsA===null) return pointsB.length > 0 - console.log('dp2e') if (pointsA.length!==pointsB.length) return true - console.log('dp2f') for (const i in pointsA) { const a = pointsA[i] const b = pointsB[i] @@ -355,7 +342,6 @@ function dirtyPoints2(pointsA, pointsB) { a.time !== b.time || a.price !== b.price ) return true } - console.log('dp3') return false } @@ -401,7 +387,7 @@ class ShapeTVCallbacks { onProps(shapeId, _tvShape, props) { if (!this.enabled) return // possible when shape is deleted and re-created - if (this.shape.debug) console.log('tvOnProps', props) + if (this.shape.debug) console.error('tvOnProps', props) this.shape.onProps(props) this.shape.tvProps = props } @@ -563,6 +549,13 @@ export class DLine extends Line { } + drawingOverrides() { + const result = super.drawingOverrides(); + result.linetoolextended = {extendLeft: false, extendRight: false} + return result + } + + delete() { this.model.pointA = null this.model.pointB = null diff --git a/src/components/chart/ChartOrder.vue b/src/components/chart/ChartOrder.vue index d4169e4..a20a4ad 100644 --- a/src/components/chart/ChartOrder.vue +++ b/src/components/chart/ChartOrder.vue @@ -29,7 +29,6 @@
- Add condition: DCA Limit Diagonal diff --git a/src/components/chart/DiagonalBuilder.vue b/src/components/chart/DiagonalBuilder.vue index a6e5dfe..3b84c9f 100644 --- a/src/components/chart/DiagonalBuilder.vue +++ b/src/components/chart/DiagonalBuilder.vue @@ -4,53 +4,84 @@ :get-model-value="getModelValue" :set-model-value="setModelValue" :set-values="setLines" :set-weights="setWeights" :std-width="stdWidth" :build-tranches="buildTranches"> - {{ endpoints }} -