Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Bug] Tooltip formatting (#1129)

Valentine Panchinbff6a3b6ed54
diff --git a/src/constants/tooltip.js b/src/constants/tooltip.js
index a08867bf0..ed0ada7e9 100644
--- a/src/constants/tooltip.js
+++ b/src/constants/tooltip.js
@@ -59,7 +59,7 @@ export const TOOLTIP_FORMATS = {
DECIMAL_PRECENT_REGULAR: {
id: 'DECIMAL_PRECENT_REGULAR',
label: '12.345 → 12.35%',
- format: '.2f',
+ format: '%',
type: TOOLTIP_FORMAT_TYPES.PERCENTAGE
},
DECIMAL_DECIMAL_FIXED_2: {
@@ -89,7 +89,7 @@ export const TOOLTIP_FORMATS = {
DECIMAL_DELTA: {
id: 'DECIMAL_DELTA',
label: '+12,345.432',
- format: '+,',
+ format: '+,.3f',
type: TOOLTIP_FORMAT_TYPES.DECIMAL
},
DECIMAL_CURRENCY: {
diff --git a/src/utils/data-utils.js b/src/utils/data-utils.js
index 38eebb16c..2db1231f6 100644
--- a/src/utils/data-utils.js
+++ b/src/utils/data-utils.js
@@ -320,7 +320,7 @@ export function applyDefaultFormat(tooltipFormat) {
case TOOLTIP_FORMAT_TYPES.DATE_TIME:
return v => moment.utc(v).format(tooltipFormat.format);
case TOOLTIP_FORMAT_TYPES.PERCENTAGE:
- return v => `${d3Format(tooltipFormat.format)(v)}%`;
+ return v => `${d3Format(TOOLTIP_FORMATS.DECIMAL_DECIMAL_FIXED_2.format)(v)}%`;
default:
return v => v;
}