The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now
I am developing a cumstom visual.
So I have a list of dataRoles shown in the Fields
Then I have objects in my Format section:
So my question is, by switch True/false in Show benchmark, is it possible to show/hide the Benchmark measure in my Fields section?
Thanks.
Solved! Go to Solution.
Hi @Anonymous
The configuration around dataRoles is fairly simple, in that you prescribe the fields available, and then you define how these fields map to the dataView (dataViewMappings). There's nothing in the schema for their configuration to suggest you can conditionally show/hide them.
Just my opinion, but I would agree with this, as your user should be able to understand what fields they can supply to the visual without too much further reading, and selectively hiding them may block their ability to utilise any functionality that depends on them later on; they may not remember about it if they toggle a setting they didn't think they needed initially. What if they hand this report on to someone else, who hasn't seen the visual before? They won't know that they can add more fields to the visual to improve its functionality.
If your user opts to not supply these fields then it shouldn't matter; they or other users working with thtem will know they can supply them later if they want to.
A more useful feature would be to toggle availability of the appropriate benchmark settings in the properties pane depending on their selected value. This is a more user-centric design pattern for custom visuals.
Maybe not the answer you're looking for, but will keep your visual in-line with the "Power BI" way of doing things. If it's still a feature you're looking for, then I'd suggest creating an idea for it.
Good luck!
Daniel
P.S. As a small aside, I noticed you were using enums for your true/false values. Similarly, toggles may be more beneficial for the end user and they make your code easier to manage if you do opt to manage show/hide of dependent properties later on. If you set the property as follows for these true/false values, then you will get toggles rather than dropdowns:
"type": { "bool": true }
And then set the corresponding setting.ts property to type boolean.
e.g.:
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 @Anonymous
The configuration around dataRoles is fairly simple, in that you prescribe the fields available, and then you define how these fields map to the dataView (dataViewMappings). There's nothing in the schema for their configuration to suggest you can conditionally show/hide them.
Just my opinion, but I would agree with this, as your user should be able to understand what fields they can supply to the visual without too much further reading, and selectively hiding them may block their ability to utilise any functionality that depends on them later on; they may not remember about it if they toggle a setting they didn't think they needed initially. What if they hand this report on to someone else, who hasn't seen the visual before? They won't know that they can add more fields to the visual to improve its functionality.
If your user opts to not supply these fields then it shouldn't matter; they or other users working with thtem will know they can supply them later if they want to.
A more useful feature would be to toggle availability of the appropriate benchmark settings in the properties pane depending on their selected value. This is a more user-centric design pattern for custom visuals.
Maybe not the answer you're looking for, but will keep your visual in-line with the "Power BI" way of doing things. If it's still a feature you're looking for, then I'd suggest creating an idea for it.
Good luck!
Daniel
P.S. As a small aside, I noticed you were using enums for your true/false values. Similarly, toggles may be more beneficial for the end user and they make your code easier to manage if you do opt to manage show/hide of dependent properties later on. If you set the property as follows for these true/false values, then you will get toggles rather than dropdowns:
"type": { "bool": true }
And then set the corresponding setting.ts property to type boolean.
e.g.:
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)
User | Count |
---|---|
17 | |
2 | |
2 | |
2 | |
1 |
User | Count |
---|---|
20 | |
10 | |
5 | |
4 | |
3 |