-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [TSVB] Metric count is depicted as - instead of 0 * Rename extractData to mapEmptyToZero and remove unnecessary intervalString undefined assignment in get_bucket_size.js Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Diana Derevyankina <54894989+DziyanaDzeraviankina@users.noreply.github.com>
- Loading branch information
1 parent
149deab
commit e467354
Showing
8 changed files
with
62 additions
and
52 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
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
25 changes: 25 additions & 0 deletions
25
src/plugins/vis_type_timeseries/server/lib/vis_data/helpers/map_empty_to_zero.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 mapEmptyToZero = (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
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