From df979d5c6654abe12fc965d536e53bc39db9161f Mon Sep 17 00:00:00 2001 From: SatyamKumar620-lit Date: Sat, 14 Sep 2024 18:22:40 +0530 Subject: [PATCH] Update Graph.tsx --- src/Graph.tsx | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Graph.tsx b/src/Graph.tsx index 277797d933..4e6a7dc766 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', - timestamp: 'date', + price_abc: 'float', + price_def: 'float', + ratio: 'float', + timestamp:'data', + 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('columns', '["top_ask_price"]'); + elem.setAttribute('columns', '["ratio","lower_bound","upper_bound","trigger_alert]');"]'); 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() { + componentDidUpdate() { if (this.table) { - this.table.update( + this.table.update([ DataManipulator.generateRow(this.props.data), - ); + ]as unknow as TableData); } } }