aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/components/PieChart.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-08-25 11:58:14 -0400
committerbobzel <zzzman@gmail.com>2023-08-25 11:58:14 -0400
commit6f2fc57f29a90b02dad0bc98c20ec69ef90c39ef (patch)
tree1ee1c33966472443f2d55ea296300335d6e773c7 /src/client/views/nodes/DataVizBox/components/PieChart.tsx
parentfa98e9f411ed19a752a912e42b6ed9607d151159 (diff)
simplification of vizBoxes to use parentViz instead of going through links
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/PieChart.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/components/PieChart.tsx15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
index 79d7b3f23..a8aa51897 100644
--- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
@@ -42,11 +42,11 @@ export class PieChart extends React.Component<PieChartProps> {
@observable _currSelected: any | undefined = undefined; // Object of selected slice
@computed get _tableDataIds() {
- return !this.incomingLinks.length ? this.props.records.map((rec, i) => i) : NumListCast(this.incomingLinks[0].dataViz_selectedRows);
+ return !this.parentViz ? this.props.records.map((rec, i) => i) : NumListCast(this.parentViz.dataViz_selectedRows);
}
// returns all the data records that will be rendered by only returning those records that have been selected by the parent visualization (or all records if there is no parent)
@computed get _tableData() {
- return !this.incomingLinks.length ? this.props.records : this._tableDataIds.map(rowId => this.props.records[rowId]);
+ return !this.parentViz ? this.props.records : this._tableDataIds.map(rowId => this.props.records[rowId]);
}
// organized by specified number percentages/ratios if one column is selected and it contains numbers
@@ -78,10 +78,11 @@ export class PieChart extends React.Component<PieChartProps> {
return ax1 + ' by ' + ax0 + ' Pie Chart';
}
- @computed get incomingLinks() {
- return LinkManager.Instance.getAllRelatedLinks(this.props.rootDoc) // out of all links
- .filter(link => link.link_anchor_1 == this.props.rootDoc.dataViz_parentViz) // get links where this chart doc is the target of the link
- .map(link => DocCast(link.link_anchor_1)); // then return the source of the link
+ @computed get parentViz() {
+ return DocCast(this.props.rootDoc.dataViz_parentViz);
+ // return LinkManager.Instance.getAllRelatedLinks(this.props.rootDoc) // out of all links
+ // .filter(link => link.link_anchor_1 == this.props.rootDoc.dataViz_parentViz) // get links where this chart doc is the target of the link
+ // .map(link => DocCast(link.link_anchor_1)); // then return the source of the link
}
componentWillUnmount() {
@@ -343,7 +344,7 @@ export class PieChart extends React.Component<PieChartProps> {
if (each[0] == curSelectedSliceName!) selectedSliceColor = each[1];
});
- if (this._piechartData.length > 0 || !this.incomingLinks || this.incomingLinks.length == 0) {
+ if (this._piechartData.length > 0 || !this.parentViz) {
return this.props.axes.length >= 1 ? (
<div className="chart-container">
<div className="graph-title">