aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/components/PieChart.tsx
diff options
context:
space:
mode:
authorgeireann <geireann.lindfield@gmail.com>2023-08-24 15:48:26 -0400
committergeireann <geireann.lindfield@gmail.com>2023-08-24 15:48:26 -0400
commiteeb7d43e9eca66c8e3418e89492848589ee20aa3 (patch)
tree74df54f967be1b2551b1675b50d294306a1596f6 /src/client/views/nodes/DataVizBox/components/PieChart.tsx
parent20e3d33d864f9ee9db2ca65848b0f42a087b699e (diff)
speedups for dataviz
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/PieChart.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/components/PieChart.tsx9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
index 213baa8a4..e730d54f0 100644
--- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
@@ -13,6 +13,7 @@ import { ColorPicker, EditableText, Size, Type } from 'browndash-components';
import { FaFillDrip } from 'react-icons/fa';
import { listSpec } from '../../../../../fields/Schema';
import { undoable } from '../../../../util/UndoManager';
+import { Utils } from '../../../../../Utils';
export interface PieChartProps {
rootDoc: Doc;
@@ -42,9 +43,11 @@ export class PieChart extends React.Component<PieChartProps> {
private selectedData: any = undefined; // Selection of selected slice
private hoverOverData: any = undefined; // Selection of slice being hovered over
+ @computed get rowGuids() {
+ return StrListCast(this.props.layoutDoc.dataViz_rowGuids)
+ }
// filters all data to just display selected data if brushed (created from an incoming link)
@computed get _piechartData() {
- var guids = StrListCast(this.props.layoutDoc.dataViz_rowGuids);
if (this.props.axes.length < 1) return [];
if (this.props.axes.length < 2) {
var ax0 = this.props.axes[0];
@@ -52,7 +55,7 @@ export class PieChart extends React.Component<PieChartProps> {
this.byCategory = false;
}
return this.props.pairs
- ?.filter(pair => (!this.incomingLinks.length ? true : this.incomingLinks[0]!.dataViz_selectedRows && StrListCast(this.incomingLinks[0].dataViz_selectedRows).includes(guids[this.props.pairs.indexOf(pair)])))
+ ?.filter(pair => (!this.incomingLinks.length ? true : this.incomingLinks[0]!.dataViz_selectedRows && StrListCast(this.incomingLinks[0].dataViz_selectedRows).includes(this.rowGuids[this.props.pairs.indexOf(pair)])))
.map(pair => ({ [ax0]: pair[this.props.axes[0]] }));
}
var ax0 = this.props.axes[0];
@@ -61,7 +64,7 @@ export class PieChart extends React.Component<PieChartProps> {
this.byCategory = false;
}
return this.props.pairs
- ?.filter(pair => (!this.incomingLinks.length ? true : this.incomingLinks[0]!.dataViz_selectedRows && StrListCast(this.incomingLinks[0].dataViz_selectedRows).includes(guids[this.props.pairs.indexOf(pair)])))
+ ?.filter(pair => (!this.incomingLinks.length ? true : this.incomingLinks[0]!.dataViz_selectedRows && StrListCast(this.incomingLinks[0].dataViz_selectedRows).includes(this.rowGuids[this.props.pairs.indexOf(pair)])))
.map(pair => ({ [ax0]: pair[this.props.axes[0]], [ax1]: pair[this.props.axes[1]] }));
}