aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/DataVizBox.tsx
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2024-01-23 13:22:13 -0500
committersrichman333 <sarah_n_richman@brown.edu>2024-01-23 13:22:13 -0500
commitaa3c70399ac2b6a337a9c85fb30f57f82ee44063 (patch)
treec876ccc11c55004b4dd16d926e5c4ddea2c970f0 /src/client/views/nodes/DataVizBox/DataVizBox.tsx
parent3a235c77d942507838b63372cfa3dc38972bd0a2 (diff)
data has a title column
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DataVizBox.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/DataVizBox.tsx8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
index 981ec0aa1..ea053b09d 100644
--- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx
+++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
@@ -104,8 +104,11 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
@computed.struct get axes() {
return StrListCast(this.layoutDoc._dataViz_axes);
}
-
selectAxes = (axes: string[]) => (this.layoutDoc._dataViz_axes = new List<string>(axes));
+ @computed.struct get titleCol() {
+ return StrCast(this.layoutDoc._dataViz_titleCol);
+ }
+ selectTitleCol = (titleCol: string) => (this.layoutDoc._dataViz_titleCol = titleCol);
@action // pinned / linked anchor doc includes selected rows, graph titles, and graph colors
restoreView = (data: Doc) => {
@@ -271,6 +274,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
layoutDoc: this.layoutDoc,
records: this.records,
axes: this.axes,
+ titleCol: this.titleCol,
//width: this.SidebarShown? this._props.PanelWidth()*.9/1.2: this._props.PanelWidth() * 0.9,
height: (this._props.PanelHeight() / scale - 32) /* height of 'change view' button */ * 0.9,
width: (this._props.PanelWidth() / scale) * 0.9,
@@ -278,7 +282,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
};
if (!this.records.length) return 'no data/visualization';
switch (this.dataVizView) {
- case DataVizView.TABLE: return <TableBox {...sharedProps} docView={this._props.DocumentView} selectAxes={this.selectAxes} />;
+ case DataVizView.TABLE: return <TableBox {...sharedProps} docView={this._props.DocumentView} selectAxes={this.selectAxes} selectTitleCol={this.selectTitleCol}/>;
case DataVizView.LINECHART: return <LineChart {...sharedProps} dataDoc={this.dataDoc} fieldKey={this.fieldKey} ref={r => (this._vizRenderer = r ?? undefined)} vizBox={this} />;
case DataVizView.HISTOGRAM: return <Histogram {...sharedProps} dataDoc={this.dataDoc} fieldKey={this.fieldKey} ref={r => (this._vizRenderer = r ?? undefined)} />;
case DataVizView.PIECHART: return <PieChart {...sharedProps} dataDoc={this.dataDoc} fieldKey={this.fieldKey} ref={r => (this._vizRenderer = r ?? undefined)}