From aa7642006598bd47b415d4d2452dd4d226ab3ac5 Mon Sep 17 00:00:00 2001 From: srichman333 Date: Wed, 12 Jul 2023 22:59:46 -0400 Subject: brushing/linking for histograms + pie charts --- src/client/views/nodes/DataVizBox/DataVizBox.tsx | 1 + src/client/views/nodes/DataVizBox/components/Histogram.tsx | 6 +++--- src/client/views/nodes/DataVizBox/components/PieChart.tsx | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx index e6d08d47f..25098baf1 100644 --- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx +++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx @@ -133,6 +133,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent() { } render() { + if (!this.layoutDoc._dataVizView) this.layoutDoc._dataVizView = this.dataVizView; return !this.pairs?.length ? (
Loading...
) : ( diff --git a/src/client/views/nodes/DataVizBox/components/Histogram.tsx b/src/client/views/nodes/DataVizBox/components/Histogram.tsx index 0ea492ff1..b6ae15709 100644 --- a/src/client/views/nodes/DataVizBox/components/Histogram.tsx +++ b/src/client/views/nodes/DataVizBox/components/Histogram.tsx @@ -305,7 +305,7 @@ export class Histogram extends React.Component { bins.forEach(d => d.x0 = d.x0!) xAxis = d3.axisBottom(x) .ticks(numBins-1) - .tickFormat( i => uniqueArr[i.valueOf]) + .tickFormat( i => uniqueArr[i]) .tickPadding(10) translateXAxis = eachRectWidth / 2; } @@ -355,11 +355,11 @@ export class Histogram extends React.Component { render() { return ( - this.props.axes.length >= 1 ? ( + this.props.axes.length >= 1 && (this.incomingSelected? this.incomingSelected.length>0 : true) ? (
{`Selected: ${Object.keys(this._histogramData[0])[0]}`}
- ) : {'first use table view to select an axis to plot'} + ) : {'first use table view to select a column to graph'} ); } diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx index 121e6db3d..3ca49a46c 100644 --- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx +++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx @@ -14,7 +14,6 @@ import { PinProps, PresBox } from "../../trails"; import { Docs } from "../../../../documents/Documents"; import { List } from "../../../../../fields/List"; import './Chart.scss'; -import { ChatCompletionResponseMessageRoleEnum } from "openai"; export interface PieChartProps { rootDoc: Doc; @@ -281,11 +280,11 @@ export class PieChart extends React.Component { render() { return ( - this.props.axes.length >= 1 ? ( + this.props.axes.length >= 1 && (this.incomingSelected? this.incomingSelected.length>0 : true) ? (
{`Selected: ${Object.keys(this._piechartData[0])[0]}`}
- ) : {'first use table view to select an axis to plot'} + ) : {'first use table view to select a column to graph'} ); } -- cgit v1.2.3-70-g09d2