Skip to content

Commit

Permalink
fix(plugin-chart-pivot-table): dont display nulls as 0 (#1265)
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje authored and zhaoyongjie committed Nov 26, 2021
1 parent 094f35f commit 635c182
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ const iconStyle = { stroke: 'black', strokeWidth: '16px' };
const aggregatorsFactory = (formatter: NumberFormatter) => ({
Count: aggregatorTemplates.count(formatter),
'Count Unique Values': aggregatorTemplates.countUnique(formatter),
'List Unique Values': aggregatorTemplates.listUnique(', '),
'List Unique Values': aggregatorTemplates.listUnique(', ', formatter),
Sum: aggregatorTemplates.sum(formatter),
Average: aggregatorTemplates.average(formatter),
Median: aggregatorTemplates.median(formatter),
'Sample Variance': aggregatorTemplates.var(1, formatter),
'Sample Standard Deviation': aggregatorTemplates.stdev(1, formatter),
Minimum: aggregatorTemplates.min(formatter),
Maximum: aggregatorTemplates.max(formatter),
First: aggregatorTemplates.first(),
First: aggregatorTemplates.first(formatter),
Last: aggregatorTemplates.last(formatter),
'Sum as Fraction of Total': aggregatorTemplates.fractionOf(
aggregatorTemplates.sum(),
Expand Down Expand Up @@ -147,11 +147,13 @@ export default function PivotTableChart(props: PivotTableProps) {
data.reduce(
(acc: Record<string, any>[], record: Record<string, any>) => [
...acc,
...metricNames.map((name: string) => ({
...record,
[METRIC_KEY]: name,
value: record[name],
})),
...metricNames
.map((name: string) => ({
...record,
[METRIC_KEY]: name,
value: record[name],
}))
.filter(record => record.value !== null),
],
[],
),
Expand Down

0 comments on commit 635c182

Please sign in to comment.