fixing missing value display for number fields (#16644)

This commit is contained in:
Peter Pisljar 2018-05-08 06:03:28 -05:00 committed by GitHub
parent 6d52c9d119
commit 3c898a58aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,6 +65,11 @@ export class MetricVisComponent extends Component {
return isColorDark(parseInt(color[1]), parseInt(color[2]), parseInt(color[3]));
}
_getFormattedValue(fieldFormatter, value) {
if (_.isNaN(value)) return '-';
return fieldFormatter(value);
}
_processTableGroups(tableGroups) {
const config = this.props.vis.params.metric;
const isPercentageMode = config.percentageMode;
@ -101,7 +106,7 @@ export class MetricVisComponent extends Component {
}
if (aggConfig) {
if (!isPercentageMode) value = aggConfig.fieldFormatter('html')(value);
if (!isPercentageMode) value = this._getFormattedValue(aggConfig.fieldFormatter('html'), value);
if (bucketAgg) {
const bucketValue = bucketAgg.fieldFormatter('text')(row[0]);
title = `${bucketValue} - ${aggConfig.makeLabel()}`;