mirror of
https://github.com/apache/superset.git
synced 2026-04-22 09:35:23 +00:00
feat: Implement currencies formatter for saved metrics (#24517)
This commit is contained in:
committed by
GitHub
parent
e402c94a9f
commit
83ff4cd86a
@@ -21,7 +21,6 @@ import {
|
||||
CategoricalColorNamespace,
|
||||
CategoricalColorScale,
|
||||
DataRecord,
|
||||
getNumberFormatter,
|
||||
getMetricLabel,
|
||||
getColumnLabel,
|
||||
} from '@superset-ui/core';
|
||||
@@ -47,6 +46,7 @@ import { OpacityEnum } from '../constants';
|
||||
import { getDefaultTooltip } from '../utils/tooltip';
|
||||
import { Refs } from '../types';
|
||||
import { getColtypesMapping } from '../utils/series';
|
||||
import { getValueFormatter } from '../utils/valueFormatter';
|
||||
|
||||
const setIntervalBoundsAndColors = (
|
||||
intervals: string,
|
||||
@@ -105,7 +105,11 @@ export default function transformProps(
|
||||
} = chartProps;
|
||||
|
||||
const gaugeSeriesOptions = defaultGaugeSeriesOption(theme);
|
||||
const { verboseMap = {} } = datasource;
|
||||
const {
|
||||
verboseMap = {},
|
||||
currencyFormats = {},
|
||||
columnFormats = {},
|
||||
} = datasource;
|
||||
const {
|
||||
groupby,
|
||||
metric,
|
||||
@@ -132,7 +136,12 @@ export default function transformProps(
|
||||
const refs: Refs = {};
|
||||
const data = (queriesData[0]?.data || []) as DataRecord[];
|
||||
const coltypeMapping = getColtypesMapping(queriesData[0]);
|
||||
const numberFormatter = getNumberFormatter(numberFormat);
|
||||
const numberFormatter = getValueFormatter(
|
||||
metric,
|
||||
currencyFormats,
|
||||
columnFormats,
|
||||
numberFormat,
|
||||
);
|
||||
const colorFn = CategoricalColorNamespace.getScale(colorScheme as string);
|
||||
const axisLineWidth = calculateAxisLineWidth(data, fontSize, overlap);
|
||||
const groupbyLabels = groupby.map(getColumnLabel);
|
||||
|
||||
Reference in New Issue
Block a user