Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi!
Is it possible to add new fonts to the fontFamily type settings? If so, how can I do that?
Solved! Go to Solution.
Hi @Balogh1Bence,
The linked Gist is the workaround - here's the original official suggestion from the custom visuals team. You replace your property in the capabilities.json with this enumeration, rather than the fontFamily type, and then add/modify the list as you need for the font families you want. Note that the fontFamily type contains the standard list of fonts for Power BI and is intended to be this way for consistency with the core visuals, so if you're adding your own, your results might vary for users on other browsers and operating systems.
You can indeed save a property value into the visual's dataView with persistProperties and this might work in your visual code, but this does not expose the value as a usable selection to the properties pane - for lists, you will need corresponding property metadata declared in your capabilities.json for it to show as an entry.
Because the properties pane is managed by the main Power BI window and not the visual (which is sandboxed from the main UI), the JSON in your capabilities tells Power BI how to render the properties in the pane for your visual.
Perhaps you could provide some further detail on what you are trying to achieve, along with the font you're trying to see in the list and I can provide a revised enumeration for you.
Regards,
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @Balogh1Bence,
The fontFamily type is a preset list and cannot be modified. If you want to customise, you'll need to manually recreate the list with an enumeration array. I've recently answered a similar question and already have a Gist you can use for this so you don't have to do it all from scratch - hopefully this can save you some time.
Regards,
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Thanks, but I could modify the kist using persisproperties, problem is that its for saving new settings and not for adding new options, isn't there a workaround?
Hi @Balogh1Bence,
The linked Gist is the workaround - here's the original official suggestion from the custom visuals team. You replace your property in the capabilities.json with this enumeration, rather than the fontFamily type, and then add/modify the list as you need for the font families you want. Note that the fontFamily type contains the standard list of fonts for Power BI and is intended to be this way for consistency with the core visuals, so if you're adding your own, your results might vary for users on other browsers and operating systems.
You can indeed save a property value into the visual's dataView with persistProperties and this might work in your visual code, but this does not expose the value as a usable selection to the properties pane - for lists, you will need corresponding property metadata declared in your capabilities.json for it to show as an entry.
Because the properties pane is managed by the main Power BI window and not the visual (which is sandboxed from the main UI), the JSON in your capabilities tells Power BI how to render the properties in the pane for your visual.
Perhaps you could provide some further detail on what you are trying to achieve, along with the font you're trying to see in the list and I can provide a revised enumeration for you.
Regards,
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
2 | |
2 | |
1 | |
1 |