-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TSVB] Metric count is depicted as - instead of 0
- Loading branch information
1 parent
16ae487
commit 28be614
Showing
7 changed files
with
61 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/extract_data.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
// @ts-expect-error not typed yet | ||
import { getAggValue } from './get_agg_value'; | ||
import { METRIC_TYPES } from '../../../../../data/common'; | ||
import type { Metric } from '../../../../common/types'; | ||
|
||
export const extractData = (metric: Metric, buckets: any[]) => { | ||
// Metric types where an empty set equals `zero` | ||
const isSettableToZero = [ | ||
METRIC_TYPES.COUNT, | ||
METRIC_TYPES.CARDINALITY, | ||
METRIC_TYPES.SUM, | ||
].includes(metric.type as METRIC_TYPES); | ||
|
||
return isSettableToZero && !buckets.length | ||
? [[undefined, 0]] | ||
: buckets.map((bucket) => [bucket.key, getAggValue(bucket, metric)]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_bucket.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters