Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
FlagsSelection slice is a simple formatting slice which is used to represent enumeration object type from capabilities.json
file.
There are two FlagSelection slices - ItemFlagsSelection and AutoFlagsSelection.
Their difference is that for AutoFlagsSelection slice you need to declare its enumeration items list under the appropriate object in capabilities.json
file, and for ItemFlagsSelection in the formatting settings class.
In this example, we show how to build a FlagsSelection slices using formatting model utils. The following tabs show examples of the ItemFlagsSelection and AutoFlagsSelection slices.
Insert the following JSON fragment into the capabilities.json
file.
{
// ... same level as dataRoles and dataViewMappings
"objects": {
"labels": {
"properties": {
"itemFlag": {
"type": {
"enumeration": []
}
},
}
}
}
}
Insert the following code fragment into the settings file.
import powerbi from "powerbi-visuals-api";
import { formattingSettings } from "powerbi-visuals-utils-formattingmodel";
const itemFlagOptions : powerbi.IEnumMember[] = [
{value : "1", displayName : "Top"},
{value : "2", displayName : "Bottom"},
{value : "4", displayName : "Left"},
{value : "8", displayName : "Right"}
];
class LabelsCardSetting extends formattingSettings.SimpleCard {
name: string = "labels"; // same as capabilities object name
displayName: string = "Labels";
public itemFlag: formattingSettings.ItemFlagsSelection = new formattingSettings.ItemFlagsSelection({
name: "itemFlag", // same as capabilities property name
displayName: "Item flag",
items: itemFlagOptions,
value: "1"
});
public slices: formattingSettings.Slice[] = [ this.itemFlag ];
}
export class VisualSettings extends formattingSettings.Model {
public labels: LabelsCardSetting = new LabelsCardSetting();
public cards: formattingSettings.SimpleCard[] = [this.labels];
}
Events
Mar 31, 11 PM - Apr 2, 11 PM
The ultimate Microsoft Fabric, Power BI, SQL, and AI community-led event. March 31 to April 2, 2025.
Register todayTraining
Module
Use Dataverse choice columns with formulas - Training
Explore how you can use Power Fx formulas to work with Microsoft Dataverse choice and choices columns. These column data types present the user with a fixed list of values defined by the maker.
Documentation
TextInput formatting slice - Power BI
This article describes how to implement TextInput slice in custom visuals using the formatting model utils
ColorPicker formatting slice - Power BI
This article describes how to implement ColorPicker slice in custom visuals using the formatting model utils
FontControl formatting slice - Power BI
This article describes how to implement FontControl slice in custom visuals using the formatting model utils