diff options
| author | Naafiyan Ahmed <naafiyan@gmail.com> | 2022-07-25 19:10:55 -0400 |
|---|---|---|
| committer | Naafiyan Ahmed <naafiyan@gmail.com> | 2022-07-25 19:10:55 -0400 |
| commit | ba8cb4194062b0f939afd136a269625f9f26dcaa (patch) | |
| tree | 7fead1b076faa4576eeae0474db365c9c8c2b88e /src/client/views/nodes/DataVizBox/utils/D3Utils.ts | |
| parent | 9730011a61bb3b1522ac59f12a26fbd36f7917a0 (diff) | |
cleaned up code and moved files around
Diffstat (limited to 'src/client/views/nodes/DataVizBox/utils/D3Utils.ts')
| -rw-r--r-- | src/client/views/nodes/DataVizBox/utils/D3Utils.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/nodes/DataVizBox/utils/D3Utils.ts b/src/client/views/nodes/DataVizBox/utils/D3Utils.ts index 5c7f9bce1..2bb091999 100644 --- a/src/client/views/nodes/DataVizBox/utils/D3Utils.ts +++ b/src/client/views/nodes/DataVizBox/utils/D3Utils.ts @@ -3,13 +3,13 @@ import { DataPoint } from '../ChartBox'; // TODO: nda - implement function that can handle range for strings -export const minMaxRange = (dataPts: DataPoint[]) => { - console.log(Number(dataPts[4].y)); - const yMin = d3.min(dataPts, d => Number(d.y)); - const yMax = d3.max(dataPts, d => Number(d.y)); +export const minMaxRange = (dataPts: DataPoint[][]) => { + // find the max and min of all the data points + const yMin = d3.min(dataPts, d => d3.min(d, d => Number(d.y))); + const yMax = d3.max(dataPts, d => d3.max(d, d => Number(d.y))); - const xMin = d3.min(dataPts, d => Number(d.x)); - const xMax = d3.max(dataPts, d => Number(d.x)); + const xMin = d3.min(dataPts, d => d3.min(d, d => Number(d.x))); + const xMax = d3.max(dataPts, d => d3.max(d, d => Number(d.x))); return { xMin, xMax, yMin, yMax }; }; |
