From 3bc49b458c6f7275b5444553ce7e22306fec3ab7 Mon Sep 17 00:00:00 2001 From: Naafiyan Ahmed Date: Mon, 25 Jul 2022 15:11:29 -0400 Subject: fixed graph cut off bug - i hate javascript types --- src/client/views/nodes/DataVizBox/utils/D3Utils.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/client/views/nodes/DataVizBox/utils') diff --git a/src/client/views/nodes/DataVizBox/utils/D3Utils.ts b/src/client/views/nodes/DataVizBox/utils/D3Utils.ts index 90ec35f5c..5c7f9bce1 100644 --- a/src/client/views/nodes/DataVizBox/utils/D3Utils.ts +++ b/src/client/views/nodes/DataVizBox/utils/D3Utils.ts @@ -4,11 +4,12 @@ import { DataPoint } from '../ChartBox'; // TODO: nda - implement function that can handle range for strings export const minMaxRange = (dataPts: DataPoint[]) => { - const yMin = d3.min(dataPts, d => d.y); - const yMax = d3.max(dataPts, d => d.y); + console.log(Number(dataPts[4].y)); + const yMin = d3.min(dataPts, d => Number(d.y)); + const yMax = d3.max(dataPts, d => Number(d.y)); - const xMin = d3.min(dataPts, d => d.x); - const xMax = d3.max(dataPts, d => d.x); + const xMin = d3.min(dataPts, d => Number(d.x)); + const xMax = d3.max(dataPts, d => Number(d.x)); return { xMin, xMax, yMin, yMax }; }; @@ -37,12 +38,12 @@ export const xAxisCreator = (g: d3.Selection, width: number, yScale: d3.ScaleLinear) => { +export const yAxisCreator = (g: d3.Selection, marginLeft: number, yScale: d3.ScaleLinear) => { g.attr('class', 'y-axis').call(d3.axisLeft(yScale)); }; export const xGrid = (g: d3.Selection, height: number, scale: d3.ScaleLinear) => { - g.attr('class', 'grid') + g.attr('class', 'xGrid') .attr('transform', `translate(0,${height})`) .call( d3 @@ -53,7 +54,7 @@ export const xGrid = (g: d3.Selection, he }; export const yGrid = (g: d3.Selection, width: number, scale: d3.ScaleLinear) => { - g.attr('class', 'grid').call( + g.attr('class', 'yGrid').call( d3 .axisLeft(scale) .tickSize(-width) -- cgit v1.2.3-70-g09d2