mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 17:24:26 +08:00
fix the non-amount numbers in charts are not formatted using localized number formatting
This commit is contained in:
@@ -39,7 +39,11 @@ export interface CommonPieChartProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function usePieChartBase(props: CommonPieChartProps) {
|
export function usePieChartBase(props: CommonPieChartProps) {
|
||||||
const { formatAmountToLocalizedNumeralsWithCurrency, formatPercentToLocalizedNumerals } = useI18n();
|
const {
|
||||||
|
formatAmountToLocalizedNumeralsWithCurrency,
|
||||||
|
formatNumberToLocalizedNumerals,
|
||||||
|
formatPercentToLocalizedNumerals
|
||||||
|
} = useI18n();
|
||||||
|
|
||||||
const selectedIndex = ref<number>(0);
|
const selectedIndex = ref<number>(0);
|
||||||
|
|
||||||
@@ -77,7 +81,7 @@ export function usePieChartBase(props: CommonPieChartProps) {
|
|||||||
|
|
||||||
accumulatedPaintPercent += finalItem.paintPercent;
|
accumulatedPaintPercent += finalItem.paintPercent;
|
||||||
finalItem.displayPercent = formatPercentToLocalizedNumerals(finalItem.percent, 2, '<0.01');
|
finalItem.displayPercent = formatPercentToLocalizedNumerals(finalItem.percent, 2, '<0.01');
|
||||||
finalItem.displayValue = props.amountValue ? formatAmountToLocalizedNumeralsWithCurrency(value, props.defaultCurrency) : value.toString();
|
finalItem.displayValue = props.amountValue ? formatAmountToLocalizedNumeralsWithCurrency(value, props.defaultCurrency) : formatNumberToLocalizedNumerals(value);
|
||||||
|
|
||||||
validItems.push(finalItem);
|
validItems.push(finalItem);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ const {
|
|||||||
getCurrentLanguageTextDirection,
|
getCurrentLanguageTextDirection,
|
||||||
formatAmountToWesternArabicNumeralsWithoutDigitGrouping,
|
formatAmountToWesternArabicNumeralsWithoutDigitGrouping,
|
||||||
formatAmountToLocalizedNumeralsWithCurrency,
|
formatAmountToLocalizedNumeralsWithCurrency,
|
||||||
|
formatNumberToLocalizedNumerals,
|
||||||
formatPercentToLocalizedNumerals
|
formatPercentToLocalizedNumerals
|
||||||
} = useI18n();
|
} = useI18n();
|
||||||
|
|
||||||
@@ -403,7 +404,7 @@ function getDisplayValue(value: number): string {
|
|||||||
return formatAmountToLocalizedNumeralsWithCurrency(value, props.defaultCurrency);
|
return formatAmountToLocalizedNumeralsWithCurrency(value, props.defaultCurrency);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value.toString();
|
return formatNumberToLocalizedNumerals(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickItem(e: ECElementEvent): void {
|
function clickItem(e: ECElementEvent): void {
|
||||||
|
|||||||
@@ -45,7 +45,11 @@ const props = defineProps<{
|
|||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const { formatAmountToLocalizedNumeralsWithCurrency, formatPercentToLocalizedNumerals } = useI18n();
|
const {
|
||||||
|
formatAmountToLocalizedNumeralsWithCurrency,
|
||||||
|
formatNumberToLocalizedNumerals,
|
||||||
|
formatPercentToLocalizedNumerals
|
||||||
|
} = useI18n();
|
||||||
|
|
||||||
const isDarkMode = computed<boolean>(() => theme.global.name.value === ThemeType.Dark);
|
const isDarkMode = computed<boolean>(() => theme.global.name.value === ThemeType.Dark);
|
||||||
|
|
||||||
@@ -80,7 +84,7 @@ const radarData = computed<RadarChartData>(() => {
|
|||||||
|
|
||||||
const finalPercent = (isNumber(percent) && percent >= 0) ? percent : (value > 0 ? value / totalValidValue * 100 : 0);
|
const finalPercent = (isNumber(percent) && percent >= 0) ? percent : (value > 0 ? value / totalValidValue * 100 : 0);
|
||||||
const displayPercent = formatPercentToLocalizedNumerals(finalPercent, 2, '<0.01');
|
const displayPercent = formatPercentToLocalizedNumerals(finalPercent, 2, '<0.01');
|
||||||
const displayValue = props.amountValue ? formatAmountToLocalizedNumeralsWithCurrency(value, props.defaultCurrency) : value.toString();
|
const displayValue = props.amountValue ? formatAmountToLocalizedNumeralsWithCurrency(value, props.defaultCurrency) : formatNumberToLocalizedNumerals(value);
|
||||||
|
|
||||||
indicators.push({
|
indicators.push({
|
||||||
name: name,
|
name: name,
|
||||||
|
|||||||
Reference in New Issue
Block a user