Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@

private readonly locale = inject(LOCALE_ID).toString();
private readonly actualMinNumberOfDecimals = computed(
() => this.numberOfDecimals() ?? this.minNumberOfDecimals()

Check warning on line 92 in projects/charts-ng/src/components/si-chart-gauge/si-chart-gauge.component.ts

View workflow job for this annotation

GitHub Actions / test

`numberOfDecimals` is deprecated. Use `minNumberOfDecimals` and `maxNumberOfDecimals` instead
);
private readonly actualMaxNumberOfDecimals = computed(
() => this.numberOfDecimals() ?? this.maxNumberOfDecimals()

Check warning on line 95 in projects/charts-ng/src/components/si-chart-gauge/si-chart-gauge.component.ts

View workflow job for this annotation

GitHub Actions / test

`numberOfDecimals` is deprecated. Use `minNumberOfDecimals` and `maxNumberOfDecimals` instead
);
private readonly numberFormat = computed(() => {
const minDecimals = this.actualMinNumberOfDecimals();
Expand Down Expand Up @@ -366,19 +366,13 @@
private valueFormatterInternal(): (val: number) => string {
const unit = this.unit();
const valueFormatter = this.valueFormatter();
const labelFormatter = this.labelFormatter();

const formattedUnit = unit ? (unit.length > 5 ? `\n{unit|${unit}}` : ` {unit|${unit}}`) : '';

return (value: number): string => {
if (valueFormatter) {
return `{value|${valueFormatter(value)}}${formattedUnit}`;
}
// DEPRECATED: Use the new input `valueFormatter` to format the value.
// labelFormatter should be removed from here in future versions.
if (labelFormatter) {
return labelFormatter(value);
}
return `{value|${this.numberFormat().format(value)}}${formattedUnit}`;
};
}
Expand Down
Loading