Skip to content
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
3020def
add rendering events
bobalive Sep 1, 2025
7b65b07
fix namings
bobalive Sep 1, 2025
a81ccf3
add versions
bobalive Sep 1, 2025
36e1fa7
add title formatting
bobalive Sep 1, 2025
130a370
add merge main
bobalive Sep 1, 2025
475bdd0
devided properies setting into groups
bobalive Sep 1, 2025
46c01ae
fixed setting
bobalive Sep 1, 2025
bea916d
added translations
bobalive Sep 1, 2025
8151143
added hover description for settings
bobalive Sep 2, 2025
a940621
fix copilot comment
bobalive Sep 4, 2025
dd8e3c4
fix copilot comments
bobalive Sep 4, 2025
b130068
fix comments
bobalive Sep 5, 2025
4b9b558
renamed description keys
bobalive Sep 9, 2025
3690de0
fix remaining comments
bobalive Sep 9, 2025
d78a86c
returned the default text
bobalive Sep 11, 2025
acc4457
fixed comments
bobalive Sep 11, 2025
ba3025f
fixed resourse string
bobalive Sep 11, 2025
9c0188c
fix comments
bobalive Sep 12, 2025
afc3571
fixed spacing in the settings
bobalive Sep 12, 2025
a8bfccd
add stale data warning description
bobalive Sep 12, 2025
629ec9b
remove s
bobalive Sep 15, 2025
9fdc0d3
updated packages and added focus
bobalive Sep 16, 2025
fbafd32
add test
bobalive Sep 16, 2025
089218c
add readme
bobalive Sep 16, 2025
ef6bc7e
Merge branch 'main' of github.com:bobalive/powerbi-visuals-dualkpi
bobalive Sep 17, 2025
2c91dfa
merge-main
bobalive Sep 17, 2025
a8fab04
fix eslint
bobalive Sep 17, 2025
7b96009
fix commits
bobalive Sep 18, 2025
d9fe9c8
fix high contrastmode for title
bobalive Sep 23, 2025
4d77777
fix text cutting
bobalive Sep 23, 2025
9ccd687
remove console log
bobalive Sep 23, 2025
4015b5d
Merge remote-tracking branch 'upstream/main'
bobalive Sep 24, 2025
8845634
Merge branch 'main' into dualKpiBugs
bobalive Sep 24, 2025
525e18e
fix copilot comments
bobalive Sep 24, 2025
7c9038c
fix percision bug
bobalive Sep 24, 2025
f72f7c1
remove console log
bobalive Sep 24, 2025
7ead0a6
remove console log
bobalive Sep 25, 2025
3041a80
fix comments
bobalive Sep 25, 2025
8036af4
fix comments
bobalive Sep 25, 2025
166fa87
fix comments
bobalive Sep 26, 2025
54c9878
fix copilot comments
bobalive Sep 26, 2025
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
7 changes: 7 additions & 0 deletions src/dualKpiSettingsModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ export class DualKpiSettingsModel extends Model {
public validateValues(): void {
this.colors.opacity.value = this.validateOpacity(this.colors.opacity.value);
this.colorsBottom.opacity.value = this.validateOpacity(this.colorsBottom.opacity.value);

// Disable display units when abbreviate values is on
if (this.properties.generalGroup.abbreviateValues.value) {
this.valueFormatting.displayUnits.disabled = true;

this.valueFormatting.precision.disabled = true;
}
}

public setLocalizedOptions(localizationManager: ILocalizationManager) {
Expand Down
4 changes: 4 additions & 0 deletions src/settings/dualKpiValueFormattingCard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export class DualKpiValueFormattingCard extends Card {
displayName: "Display units",
displayNameKey: "Visual_DisplayUnits",
value: 1,
disabled: false,
disabledReasonKey: "Visual_Description_AbbreviateValues_On"
});

precision = new formattingSettings.NumUpDown({
Expand All @@ -90,6 +92,8 @@ export class DualKpiValueFormattingCard extends Card {
minValue: { value: 0, type: powerbi.visuals.ValidatorType.Min },
maxValue: { value: 17, type: powerbi.visuals.ValidatorType.Max },
},
disabled: false,
disabledReasonKey: "Visual_Description_AbbreviateValues_On"
});

name = "dualKpiValueFormatting";
Expand Down
11 changes: 11 additions & 0 deletions src/visual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export class DualKpi implements IVisual {
};

private static INVISIBLE: string = "invisible";
private static readonly VISUAL_BORDER_AREA_PADDING_RATIO = 0.9;

private static OPACITY_MIN: number = 0;
private static OPACITY_MAX: number = 100;
Expand Down Expand Up @@ -840,6 +841,7 @@ export class DualKpi implements IVisual {
this.formattingSettings.colors.textColor.value.value = colorHelper.getHighContrastColor("foreground", this.formattingSettings.colors.textColor.value.value);
this.formattingSettings.colorsBottom.dataColor.value.value = colorHelper.getHighContrastColor("foreground", this.formattingSettings.colorsBottom.dataColor.value.value);
this.formattingSettings.colorsBottom.textColor.value.value = colorHelper.getHighContrastColor("foreground", this.formattingSettings.colorsBottom.textColor.value.value);
this.formattingSettings.properties.titleGroup.textColor.value.value = colorHelper.getHighContrastColor("foreground", this.formattingSettings.properties.titleGroup.textColor.value.value);
}
}

Expand Down Expand Up @@ -1499,6 +1501,15 @@ export class DualKpi implements IVisual {
element.attr("font-style", isItalic ? "italic" : "normal");
element.attr("text-decoration", isUnderline ? "underline" : "none");
element.attr("font-family", fontFamily);

const tailoredText = textMeasurementService.getTailoredTextOrDefault({
text: element.text(),
fontSize: element.style("font-size"),
fontFamily: element.style("font-family"),
}, options.width * DualKpi.VISUAL_BORDER_AREA_PADDING_RATIO);

element.text(tailoredText);

}

private addOverlayText(options: IDualKpiOptions, latestValue: number, calcHeight: number, calcWidth: number, isTopChart: boolean): void {
Expand Down
3 changes: 2 additions & 1 deletion stringResources/en-US/resources.resjson
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,6 @@
"Visual_Description_TopChartDefaultKpiValue":"Default text when no KPI value is available",
"Visual_Description_MatchTopChartOptions":"Apply top chart's visual settings to the bottom chart for consistent appearance",
"Visual_Description_FontSizeAutoFormatting":"Automatically adjust the text size to fit the visual",
"Visual_Description_StaleDataThreshold":"Defines the time limit to warn if data becomes outdated"
"Visual_Description_StaleDataThreshold":"Defines the time limit to warn if data becomes outdated",
"Visual_Description_AbbreviateValues_On": "Disabled when 'Properties -> Abbreviate values' is turned on"
}
Loading