diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2024-04-24 00:10:58 -0400 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2024-04-24 00:10:58 -0400 |
commit | 7d9ced74c93c7282a2125dca0ed4b2bc70df4955 (patch) | |
tree | e4bc8b2f71ca5b4970ea989da7e98c5e9428269d | |
parent | 81325ec64a24a98e3677b208a56dd048669fae72 (diff) |
filtering from histogram bars works from all histogram types
-rw-r--r-- | src/client/views/nodes/DataVizBox/DataVizBox.scss | 1 | ||||
-rw-r--r-- | src/client/views/nodes/DataVizBox/components/Histogram.tsx | 19 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.scss b/src/client/views/nodes/DataVizBox/DataVizBox.scss index a4f9dba73..9825d926f 100644 --- a/src/client/views/nodes/DataVizBox/DataVizBox.scss +++ b/src/client/views/nodes/DataVizBox/DataVizBox.scss @@ -30,6 +30,7 @@ } .liveSchema-checkBox { + margin-left: 10px; margin-bottom: -35px; } .filterData-checkBox { diff --git a/src/client/views/nodes/DataVizBox/components/Histogram.tsx b/src/client/views/nodes/DataVizBox/components/Histogram.tsx index ff0262c15..aef2d64f3 100644 --- a/src/client/views/nodes/DataVizBox/components/Histogram.tsx +++ b/src/client/views/nodes/DataVizBox/components/Histogram.tsx @@ -43,7 +43,7 @@ export class Histogram extends ObservableReactComponent<HistogramProps> { private numericalYData: boolean = false; // whether the y axis is controlled by provided data rather than frequency private maxBins = 15; // maximum number of bins that is readable on a normal sized doc @observable _currSelected: any | undefined = undefined; // Object of selected bar - private curBarSelected: any = undefined; // histogram bin of selected bar + private curBarSelected: any = undefined; // histogram bin of selected bar for when just one bar is selected private selectedData: any = undefined; // Selection of selected bar private hoverOverData: any = undefined; // Selection of bar being hovered over @@ -166,16 +166,17 @@ export class Histogram extends ObservableReactComponent<HistogramProps> { this.selectedData = sameAsCurrent ? undefined : d; // for filtering child dataviz docs - const selectedRows = Cast(this._props.layoutDoc.dataViz_selectedRows, listSpec('number'), null); - this._tableDataIds.forEach(rowID => { - let match = true; - Object.keys(showSelected).map(key => { - if(key!='frequency' && this._props.records[rowID][key]!=showSelected[key]){ - match = false; + if (this._props.layoutDoc.dataViz_filterSelection){ + console.log("d", d); + const selectedRows = Cast(this._props.layoutDoc.dataViz_selectedRows, listSpec('number'), null); + this._tableDataIds.forEach(rowID => { + let match = false; + for (let i=0; i<d.length; i++){ + if (this._props.records[rowID][xAxisTitle] == d[i]) match = true; } + if (match && !selectedRows?.includes(rowID)) selectedRows?.push(rowID); }) - if (match && !selectedRows?.includes(rowID)) selectedRows?.push(rowID); - }) + } } else this.hoverOverData = d; return true; } |