diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2023-08-04 11:25:36 -0400 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2023-08-04 11:25:36 -0400 |
commit | f073fd90481d58f2eaccc1d546899dd157aff905 (patch) | |
tree | 4fd83b4159aba9057b3f54a825b72bb3deee7d02 /src/client/views/nodes/DataVizBox/DataVizBox.tsx | |
parent | acbfb6e690b98388d1f7d9a8544c89b2740adea4 (diff) |
selected rows + colored bars + colored slices updating with getAnchor / restoreView
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DataVizBox.tsx')
-rw-r--r-- | src/client/views/nodes/DataVizBox/DataVizBox.tsx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx index e08c55197..a92fc1eb9 100644 --- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx +++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx @@ -1,7 +1,7 @@ import { action, computed, ObservableMap, ObservableSet } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; -import { Doc, StrListCast } from '../../../../fields/Doc'; +import { Doc, Field, StrListCast } from '../../../../fields/Doc'; import { List } from '../../../../fields/List'; import { Cast, CsvCast, StrCast } from '../../../../fields/Types'; import { CsvField } from '../../../../fields/URLField'; @@ -71,10 +71,10 @@ 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.selected = Field.Copy(data.selected); + this.layoutDoc.histogramBarColors = Field.Copy(data.histogramBarColors); this.layoutDoc.defaultHistogramColor = data.defaultHistogramColor; - this.layoutDoc.pieSliceColors = data.pieSliceColors; + this.layoutDoc.pieSliceColors = Field.Copy(data.pieSliceColors); Object.keys(this.layoutDoc).map(key => { if (key.startsWith('histogram-title') || key.startsWith('lineChart-title') || key.startsWith('pieChart-title')){ this.layoutDoc['_'+key] = data[key]; } }) @@ -99,10 +99,10 @@ 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.selected = Field.Copy(this.layoutDoc.selected); + anchor.histogramBarColors = Field.Copy(this.layoutDoc.histogramBarColors); anchor.defaultHistogramColor = this.layoutDoc.defaultHistogramColor; - anchor.pieSliceColors = this.layoutDoc.pieSliceColors; + anchor.pieSliceColors = Field.Copy(this.layoutDoc.pieSliceColors); Object.keys(this.layoutDoc).map(key => { if (key.startsWith('histogram-title') || key.startsWith('lineChart-title') || key.startsWith('pieChart-title')){ anchor[key] = this.layoutDoc[key]; } }) |