diff --git a/AppSchema.json b/AppSchema.json index 8247ba5f8..e973cf5f1 100644 --- a/AppSchema.json +++ b/AppSchema.json @@ -432,6 +432,12 @@ "compatibleTypes": "->Shapes->" }, "properties": [ + { + "name": "polygonCondition", + "type": "node", + "childType": "Polygon Condition", + "autoAdd": true + }, { "name": "polygonBody", "type": "node", @@ -452,6 +458,14 @@ } ], "menuItems": [ + { + "action": "Add UI Object", + "disableIfPropertyIsDefined": true, + "propertyToCheckFor": "polygonCondition", + "actionFunction": "payload.onMenuItemClick", + "label": "Add Polygon Condition", + "relatedUiObject": "Polygon Condition" + }, { "action": "Add UI Object", "disableIfPropertyIsDefined": true, @@ -486,6 +500,41 @@ ], "addLeftIcons": true }, + { + "type": "Polygon Condition", + "icon": "style-condition", + "level": 4, + "propertyNameAtParent": "polygonCondition", + "chainAttachesTo": { + "compatibleTypes": "->Polygon->" + }, + "editors": { + "code": true + }, + "initialValues": { + "code": "" + }, + "properties": [], + "menuItems": [ + { + "action": "Edit Condition", + "actionFunction": "uiObject.codeEditor.activate", + "label": "Edit Condition", + "iconPathOn": "html", + "iconPathOff": "html" + }, + { + "action": "Delete UI Object", + "askConfirmation": true, + "confirmationLabel": "Confirm to Delete", + "actionFunction": "payload.onMenuItemClick", + "label": "Delete Style Condition", + "iconPathOn": "delete", + "iconPathOff": "delete" + } + ], + "addLeftIcons": true + }, { "type": "Polygon Body", "docURL": "https://docs.superalgos.org/suite-hierarchy-data-mine.html#polygon-body", @@ -1763,7 +1812,7 @@ }, { "type": "Parameters", - "docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#parameters", + "docURL": "https://docs.superalgos.org/suite-hierarchy-network.html#parameters", "menuItems": [ { "action": "Add Missing Children", @@ -1829,7 +1878,7 @@ }, { "type": "Base Asset", - "docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#base-asset", + "docURL": "https://docs.superalgos.org/suite-hierarchy-network.html#base-asset", "menuItems": [ { "action": "Configure Base Asset", @@ -2019,7 +2068,7 @@ }, { "type": "Time Range", - "docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#time-range", + "docURL": "https://docs.superalgos.org/suite-hierarchy-network.html#time-range", "menuItems": [ { "action": "Configure Time Range", @@ -2054,7 +2103,7 @@ }, { "type": "Time Frame", - "docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#time-frame", + "docURL": "https://docs.superalgos.org/suite-hierarchy-network.html#time-frame", "menuItems": [ { "action": "Configure Time Frame", @@ -2089,7 +2138,7 @@ }, { "type": "Slippage", - "docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#slippage", + "docURL": "https://docs.superalgos.org/suite-hierarchy-network.html#slippage", "menuItems": [ { "action": "Configure Slippage", @@ -2124,7 +2173,7 @@ }, { "type": "Fee Structure", - "docURL": "https://docs.superalgos.org/suite-hierarchy-trading-system.html#fee-structure", + "docURL": "https://docs.superalgos.org/suite-hierarchy-network.html#fee-structure", "menuItems": [ { "action": "Configure Fee Structure", diff --git a/CanvasApp/Panels/Layer.js b/CanvasApp/Panels/Layer.js index 44e067063..1877a5ecc 100644 --- a/CanvasApp/Panels/Layer.js +++ b/CanvasApp/Panels/Layer.js @@ -170,7 +170,7 @@ function newLayer () { 'Plotter Module->Plotter->' + 'Shapes->' + 'Chart Points->Point->Point Formula->' + - 'Polygon->Polygon Body->Style->Style Condition->Style->' + + 'Polygon->Polygon Condition->Polygon Body->Style->Style Condition->Style->' + 'Polygon Border->Style->Style Condition->Style->' + 'Polygon Vertex->Point->' + 'Plotter Panel->Javascript Code->Panel Data->Data Formula->' diff --git a/CanvasApp/Plotter.js b/CanvasApp/Plotter.js index bba22925f..ff1bf1368 100644 --- a/CanvasApp/Plotter.js +++ b/CanvasApp/Plotter.js @@ -570,23 +570,23 @@ function newPlotter () { let x = 0 let y = 0 eval(point.pointFormula.code) - let dataPoint = { + let rawPoint = { x: x, y: y } - /* Contributing to Auto-Scale */ - coordinateSystem.reportYValue(dataPoint.y) /* The information we store in files is independent from the charing system and its coordinate systems. That means that the first thing we allways need to do is to trasform these points to the coordinate system of the timeline. */ - dataPoint = coordinateSystem.transformThisPoint(dataPoint) + let dataPoint + dataPoint = coordinateSystem.transformThisPoint(rawPoint) dataPoint = transformThisPoint(dataPoint, thisObject.container) dataPoint = canvas.chartingSpace.viewport.fitIntoVisibleArea(dataPoint) dataPoint = thisObject.fitFunction(dataPoint) /* Store the data point at the local map */ + dataPoint.rawPoint = rawPoint dataPoints.set(point.id, dataPoint) } } @@ -598,6 +598,12 @@ function newPlotter () { for (let j = 0; j < productDefinition.referenceParent.shapes.polygons.length; j++) { let polygon = productDefinition.referenceParent.shapes.polygons[j] + /* We will check if we need to plot this Polygon or not. */ + if (polygon.polygonCondition !== undefined) { + let mustPlot = eval(polygon.polygonCondition.code) + if (mustPlot !== true) { continue } + } + let calculatedStyle /* Finding out the fill style */ @@ -724,6 +730,12 @@ function newPlotter () { console.log('[WARN] You have a Polygon Vertex not referencing any Point.') continue } + + /* Contributing to Auto-Scale */ + if (dataPointObject.rawPoint.y > 1 && dataPointObject.rawPoint.y !== undefined && isNaN(dataPointObject.rawPoint.y) === false) { + coordinateSystem.reportYValue(dataPointObject.rawPoint.y) + } + let dataPoint = { x: dataPointObject.x, y: dataPointObject.y