diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2023-08-03 17:51:48 -0400 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2023-08-03 17:51:48 -0400 |
commit | acbfb6e690b98388d1f7d9a8544c89b2740adea4 (patch) | |
tree | bba72eb17f0054e9a058f9dcd9bcee9af4445660 /src/client/views/nodes/DataVizBox/DataVizBox.tsx | |
parent | 8bdae208c4ae44766241c285f2f7234027b9b80f (diff) |
ability to revert histogram bar colors
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DataVizBox.tsx')
-rw-r--r-- | src/client/views/nodes/DataVizBox/DataVizBox.tsx | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx index 80586d7c7..e08c55197 100644 --- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx +++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx @@ -71,12 +71,14 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { restoreView = (data: Doc) => { const changedView = this.dataVizView !== data.presDataVizView && (this.layoutDoc._dataVizView = data.presDataVizView); const changedAxes = this.axes.join('') !== StrListCast(data.presDataVizAxes).join('') && (this.layoutDoc._data_vizAxes = new List<string>(StrListCast(data.presDataVizAxes))); + // this.layoutDoc.selected = data.selected; + // this.layoutDoc.histogramBarColors = data.histogramBarColors; + this.layoutDoc.defaultHistogramColor = data.defaultHistogramColor; + this.layoutDoc.pieSliceColors = data.pieSliceColors; Object.keys(this.layoutDoc).map(key => { - if (key.startsWith('histogram-title') || key.startsWith('histogramBarColors') || key.startsWith('defaultHistogramColor') - || key.startsWith('lineChart-title') || key.startsWith('pieChart-title') || key.startsWith('pieSliceColors')){ - this.layoutDoc['_'+key] = data[key]; - } + if (key.startsWith('histogram-title') || key.startsWith('lineChart-title') || key.startsWith('pieChart-title')){ this.layoutDoc['_'+key] = data[key]; } }) + const func = () => this._chartRenderer?.restoreView(data); if (changedView || changedAxes) { setTimeout(func, 100); @@ -97,11 +99,12 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { anchor.presDataVizView = this.dataVizView; anchor.presDataVizAxes = this.axes.length ? new List<string>(this.axes) : undefined; + // anchor.selected = this.layoutDoc.selected; + // anchor.histogramBarColors = this.layoutDoc.histogramBarColors; + anchor.defaultHistogramColor = this.layoutDoc.defaultHistogramColor; + anchor.pieSliceColors = this.layoutDoc.pieSliceColors; Object.keys(this.layoutDoc).map(key => { - if (key.startsWith('histogram-title') || key.startsWith('histogramBarColors') || key.startsWith('defaultHistogramColor') - || key.startsWith('lineChart-title') || key.startsWith('pieChart-title') || key.startsWith('pieSliceColors')){ - anchor[key] = this.layoutDoc[key]; - } + if (key.startsWith('histogram-title') || key.startsWith('lineChart-title') || key.startsWith('pieChart-title')){ anchor[key] = this.layoutDoc[key]; } }) this.addDocument(anchor); |