From 4aeffc02334fb873341d93f300f3e153499854fd Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Thu, 17 Aug 2023 14:12:22 -0400
Subject: layout doc fields organized

---
 src/client/views/nodes/DataVizBox/components/PieChart.tsx | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'src/client/views/nodes/DataVizBox/components/PieChart.tsx')

diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
index 213baa8a4..6d8302b6a 100644
--- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
@@ -92,6 +92,7 @@ export class PieChart extends React.Component<PieChartProps> {
             },
             { fireImmediately: true }
         );
+        if (!this.props.layoutDoc.dataViz_pie) this.props.layoutDoc.dataViz_pie = '';
     };
 
     @action
@@ -270,7 +271,7 @@ export class PieChart extends React.Component<PieChartProps> {
                 var sliceColor;
                 if (dataPoint) {
                     var accessByName = dataPoint[this.props.axes[0]].replace(/\$/g, '').replace(/\%/g, '').replace(/\</g, '');
-                    var sliceColors = StrListCast(this.props.layoutDoc.pieSliceColors).map(each => each.split('::'));
+                    var sliceColors = StrListCast(this.props.layoutDoc.dataViz_pie_sliceColors).map(each => each.split('::'));
                     sliceColors.map(each => {
                         if (each[0] == StrCast(accessByName)) sliceColor = each[1];
                     });
@@ -324,7 +325,7 @@ export class PieChart extends React.Component<PieChartProps> {
         this.curSliceSelected.attr('fill', color);
         var sliceName = this._currSelected[this.props.axes[0]].replace(/\$/g, '').replace(/\%/g, '').replace(/\</g, '');
 
-        const sliceColors = Cast(this.props.layoutDoc.pieSliceColors, listSpec('string'), null);
+        const sliceColors = Cast(this.props.layoutDoc.dataViz_pie_sliceColors, listSpec('string'), null);
         sliceColors.map(each => {
             if (each.split('::')[0] == sliceName) sliceColors.splice(sliceColors.indexOf(each), 1);
         });
@@ -334,10 +335,10 @@ export class PieChart extends React.Component<PieChartProps> {
     render() {
         this.componentDidMount();
         var titleAccessor: any = '';
-        if (this.props.axes.length == 2) titleAccessor = 'dataViz_title_pieChart_' + this.props.axes[0] + '-' + this.props.axes[1];
-        else if (this.props.axes.length > 0) titleAccessor = 'dataViz_title_pieChart_' + this.props.axes[0];
+        if (this.props.axes.length == 2) titleAccessor = 'dataViz_pie_title' + this.props.axes[0] + '-' + this.props.axes[1];
+        else if (this.props.axes.length > 0) titleAccessor = 'dataViz_pie_title' + this.props.axes[0];
         if (!this.props.layoutDoc[titleAccessor]) this.props.layoutDoc[titleAccessor] = this.defaultGraphTitle;
-        if (!this.props.layoutDoc.pieSliceColors) this.props.layoutDoc.pieSliceColors = new List<string>();
+        if (!this.props.layoutDoc.dataViz_pie_sliceColors) this.props.layoutDoc.dataViz_pie_sliceColors = new List<string>();
         var selected: string;
         var curSelectedSliceName = '';
         if (this._currSelected) {
@@ -350,7 +351,7 @@ export class PieChart extends React.Component<PieChartProps> {
             selected += ' }';
         } else selected = 'none';
         var selectedSliceColor;
-        var sliceColors = StrListCast(this.props.layoutDoc.pieSliceColors).map(each => each.split('::'));
+        var sliceColors = StrListCast(this.props.layoutDoc.dataViz_pie_sliceColors).map(each => each.split('::'));
         sliceColors.map(each => {
             if (each[0] == curSelectedSliceName!) selectedSliceColor = each[1];
         });
-- 
cgit v1.2.3-70-g09d2

