mirror of
https://github.com/apache/superset.git
synced 2026-04-23 01:55:09 +00:00
fix: Timeseries Y-axis format with contribution mode (#27106)
This commit is contained in:
committed by
GitHub
parent
13f1642c73
commit
af577d64b1
@@ -23,6 +23,7 @@ import {
|
||||
getNumberFormatter,
|
||||
getTimeFormatter,
|
||||
isSavedMetric,
|
||||
NumberFormats,
|
||||
QueryFormMetric,
|
||||
smartDateDetailedFormatter,
|
||||
smartDateFormatter,
|
||||
@@ -30,14 +31,22 @@ import {
|
||||
ValueFormatter,
|
||||
} from '@superset-ui/core';
|
||||
|
||||
export const getPercentFormatter = (format?: string) =>
|
||||
getNumberFormatter(
|
||||
!format || format === NumberFormats.SMART_NUMBER
|
||||
? NumberFormats.PERCENT
|
||||
: format,
|
||||
);
|
||||
|
||||
export const getYAxisFormatter = (
|
||||
metrics: QueryFormMetric[],
|
||||
forcePercentFormatter: boolean,
|
||||
customFormatters: Record<string, ValueFormatter>,
|
||||
defaultFormatter: ValueFormatter,
|
||||
format?: string,
|
||||
) => {
|
||||
if (forcePercentFormatter) {
|
||||
return getNumberFormatter(',.0%');
|
||||
return getPercentFormatter(format);
|
||||
}
|
||||
const metricsArray = ensureIsArray(metrics);
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user