Forum Discussion
Custom Object Drowdown
I'm creating a custom visual. I want to include a dropdown object on the format pane that I can fill with options. I know it's possible because it's in the standard KPI visual, but I can't find any documentation besides primitive types and fills. Any help on how to construct the capabilities.json and enumeration?
Thanks!
Anonymous,
You may refer to capabilities.json of Dual KPI and view its source code at https://github.com/Microsoft/powerbi-visuals-dualkpi. As for the spec, see https://github.com/Microsoft/PowerBI-visuals-tools/blob/164f80e7e269f56dbbfd8009e4d860c7c03b4f07/templates/visuals/.api/v1.6.0/schema.capabilities.json.
16 Replies
- v-chuncz-msftCommunity Support
Anonymous,
You may refer to capabilities.json of Dual KPI and view its source code at https://github.com/Microsoft/powerbi-visuals-dualkpi. As for the spec, see https://github.com/Microsoft/PowerBI-visuals-tools/blob/164f80e7e269f56dbbfd8009e4d860c7c03b4f07/templates/visuals/.api/v1.6.0/schema.capabilities.json.
- AnonymousNot applicable
Awesome thanks! That's a great resource.
I'll put the code here for others to see an example.
Capabilities.json:
"displayUnits": { "displayName": "Display Units", "type": { "enumeration": [{ "value": "none", "displayName": "None" }, { "value": "thousands", "displayName": "Thousands" }, { "value": "millions", "displayName": "Millions" }, { "value": "billions", "displayName": "Billions" }] } }And the enumeration is the same as you would get a string.
- AnonymousNot applicable
Can you put up enumeration code as well, I tried and it is not working properly
- satishrHelper III
I want to show the list of fonts available. Is there an easy way to do it instead of typing all the fonts available for the dropdown.
- v-viigCommunity Champion
PBIcustomizer There's no way to use dynamic drop-downs.
satishr No, there isn't. You should specify all of font for the dropdown.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
- satishrHelper III
Thanks for the reply v-viig. Can you let me know how the default Font family dropdown for Title works? It lists few fonts in its drop-down and each font value is displayed in its own font.