aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DataVizBox/DataVizBox.tsx9
-rw-r--r--src/client/views/nodes/DataVizBox/components/PieChart.tsx2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
index b98f65054..b14525993 100644
--- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx
+++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
@@ -33,9 +33,14 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
static dataset = new ObservableMap<string, { [key: string]: string }[]>();
private _vizRenderer: LineChart | Histogram | PieChart | undefined;
- // all CSV records in the dataset
+ // all CSV records in the dataset (that aren't an empty row)
@computed.struct get records() {
- return DataVizBox.dataset.get(CsvCast(this.rootDoc[this.fieldKey]).url.href);
+ var records = DataVizBox.dataset.get(CsvCast(this.rootDoc[this.fieldKey]).url.href)
+ var nonEmptyRecords = records?.filter(record => {
+ var notEmpty = false;
+ Object.keys(record).forEach(key => { if (record[key]!=undefined && record[key]!="") notEmpty = true});
+ return notEmpty})
+ return nonEmptyRecords;
}
// currently chosen visualization type: line, pie, histogram, table
diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
index de6263198..200e51240 100644
--- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
@@ -52,7 +52,7 @@ export class PieChart extends React.Component<PieChartProps> {
// organized by specified number percentages/ratios if one column is selected and it contains numbers
// otherwise, assume data is organized by categories
@computed get byCategory() {
- return this.props.axes.length === 1 || !/\d/.test(this.props.records[0][this.props.axes[0]]);
+ return !/\d/.test(this.props.records[0][this.props.axes[0]]);
}
// filters all data to just display selected data if brushed (created from an incoming link)
@computed get _pieChartData() {