From 49fa6721e2a7af21db5da339cd3c7d90d3e8bf8b Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Wed, 2 Aug 2023 12:37:52 -0400
Subject: linking title bug fix

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

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

diff --git a/src/client/views/nodes/DataVizBox/components/LineChart.tsx b/src/client/views/nodes/DataVizBox/components/LineChart.tsx
index 0142e96ad..0e699bb99 100644
--- a/src/client/views/nodes/DataVizBox/components/LineChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/LineChart.tsx
@@ -350,19 +350,19 @@ export class LineChart extends React.Component<LineChartProps> {
     }
 
     render() {
+        this.componentDidMount();
         var titleAccessor:any = '';
-        if (this.props.axes.length==2) titleAccessor = StrCast(this.props.layoutDoc['lineChart-title-'+this.props.axes[0]+'-'+this.props.axes[1]]);
-        else if (this.props.axes.length>0) titleAccessor = StrCast(this.props.layoutDoc['lineChart-title-'+this.props.axes[0]]);
-        const title = titleAccessor? titleAccessor : this.defaultGraphTitle;
+        if (this.props.axes.length==2) titleAccessor = 'lineChart-title-'+this.props.axes[0]+'-'+this.props.axes[1];
+        else if (this.props.axes.length>0) titleAccessor = 'lineChart-title-'+this.props.axes[0];
+        if (!this.props.layoutDoc[titleAccessor]) this.props.layoutDoc[titleAccessor] = this.defaultGraphTitle;
         const selectedPt = this._currSelected ? `x: ${this._currSelected.x} y: ${this._currSelected.y}` : 'none';
         return (
             this.props.axes.length >= 2 ? (
             <div className="chart-container" >
                 <div className="graph-title"> 
                     <EditableText
-                        val={title}
-                        setVal={action(val => {this.props.axes.length>1? this.props.layoutDoc['lineChart-title-'+this.props.axes[0]+"-"+this.props.axes[1]] = val as string
-                            : this.props.layoutDoc['lineChart-title-'+this.props.axes[0]] = val as string})}
+                        val={StrCast(this.props.layoutDoc[titleAccessor])}
+                        setVal={action(val => this.props.layoutDoc[titleAccessor] = val as string)}
                         color={"black"}
                         size={Size.LARGE}
                         fillWidth
-- 
cgit v1.2.3-70-g09d2

