From 3b9df1622c2fd7df3d46d89920b7f8022fe2f5f1 Mon Sep 17 00:00:00 2001 From: Milan Mehta <110523894+Milan1609@users.noreply.github.com> Date: Sat, 24 Aug 2024 15:56:31 +0530 Subject: [PATCH] Update Graph.tsx --- src/Graph.tsx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Graph.tsx b/src/Graph.tsx index 277797d933..fa6b71faed 100644 --- a/src/Graph.tsx +++ b/src/Graph.tsx @@ -23,10 +23,13 @@ class Graph extends Component { const elem = document.getElementsByTagName('perspective-viewer')[0] as unknown as PerspectiveViewerElement; const schema = { - stock: 'string', - top_ask_price: 'float', - top_bid_price: 'float', + price_abc: 'float', + price_def: 'float', + ratio: 'float', timestamp: 'date', + upper_bound: 'float', + lower_bound: 'float', + trigger_alert: 'float', }; if (window.perspective && window.perspective.worker()) { @@ -36,23 +39,25 @@ class Graph extends Component { // Load the `table` in the `` DOM reference. elem.load(this.table); elem.setAttribute('view', 'y_line'); - elem.setAttribute('column-pivots', '["stock"]'); - elem.setAttribute('row-pivots', '["timestamp"]'); + elem.setAttribute('row-pivots', '["ratio" , "lower_bound", "upper_bound", "trigger_alert"]'); elem.setAttribute('columns', '["top_ask_price"]'); elem.setAttribute('aggregates', JSON.stringify({ - stock: 'distinctcount', - top_ask_price: 'avg', - top_bid_price: 'avg', + price_abc: 'avg', + price_def: 'avg', + ratio: 'avg', timestamp: 'distinct count', + upper_bound: 'avg', + lower_bound: 'avg', + trigger_alert: 'avg', })); } } componentDidUpdate() { if (this.table) { - this.table.update( + this.table.update([ DataManipulator.generateRow(this.props.data), - ); + ] as unknown as TableDate); } } }