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,
I need to create a visual that knows when the same category has been selected in another visual. But I am lost : (
I have tried to follow this tutorial.
But I don't know if the information is updated and completed.
1. First problem
According to the tutorial:
private host: IVisualHost;
private selectionManager: ISelectionManager;
constructor(options: VisualConstructorOptions) {
this.host = options.host;
// ...
this.selectionManager = this.host.createSelectionManager();
}
I try:
...
import IVisualHost = powerbi.extensibility.IVisualHost;
import ISelectionManager = powerbi.extensibility.ISelectionManager;
...
constructor(options: VisualConstructorOptions) {
this.host = options.host;
this.selectionManager = this.host.createSelectionManager();
But, tslinter:
Property 'createSelectionManager' does not exist on type 'IVisualHost'
Then, in the update
const selection: ISelectionId = this.host.createSelectionIdBuilder()
.withTable(options.dataViews[0].table, 1)
.createSelectionId();
But
Property 'createSelectionIdBuilder' does not exist on type 'IVisualHost'
Please, does anyone know any updated reference where it is explained how to interrelate visuals (table mode)
Ty in advance
Solved! Go to Solution.
Hi @Anonymous,
Sorry to hear you're having trouble. However, please try to post more complete code, as it is difficult to reproduce your issue if we don't have the complete picture and can only guess at how we can help.
It is difficult to be 100% certain this is the correct solution, but I'll go with my gut. I'm pretty sure that you might not have added the class properties from the tutorial you have quoted.
From your code snippet, it looks like you've imported the references for IVisualHost and ISelectionManager, but you need to make class properties for host and selectionManager, otherwise you cannot use them in either the constructor or update methods, and this is likely why the TS compiler is getting upset.
Please ensure that you add the following between the class declaration and the constructor method:
private host: IVisualHost;
private selectionManager: ISelectionManager;
This way, your properties should be visible to the class's internal methods and you can assign/utilise them as needed. [Further reading]
Again, it's hard to confirm completely without further context, but your approach to selection ID generation after this looks like it might be okay.
If you do have all this set up correctly, please post your full code somewhere - ideally as a repo or Gist on GitHub or somewhere similar - and we can take a more detailed look. Please include any other relevant details such as your capabilities and settings files. If you can't share your whole project, please create a minimal visual that reproduces the issue and we can focus on those areas and get you up and running.
Good luck!
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 friend, ty for response!
I finally found that:
https://jorgecandeias.github.io/2017/09/11/adding-interactions-to-your-power-bi-custom-visual/
+
https://github.com/microsoft/PowerBI-visuals-sampleBarChart/blob/master/src/barChart.ts
And, more or less, begin to understand how work the selection : )
Hi @Anonymous,
Sorry to hear you're having trouble. However, please try to post more complete code, as it is difficult to reproduce your issue if we don't have the complete picture and can only guess at how we can help.
It is difficult to be 100% certain this is the correct solution, but I'll go with my gut. I'm pretty sure that you might not have added the class properties from the tutorial you have quoted.
From your code snippet, it looks like you've imported the references for IVisualHost and ISelectionManager, but you need to make class properties for host and selectionManager, otherwise you cannot use them in either the constructor or update methods, and this is likely why the TS compiler is getting upset.
Please ensure that you add the following between the class declaration and the constructor method:
private host: IVisualHost;
private selectionManager: ISelectionManager;
This way, your properties should be visible to the class's internal methods and you can assign/utilise them as needed. [Further reading]
Again, it's hard to confirm completely without further context, but your approach to selection ID generation after this looks like it might be okay.
If you do have all this set up correctly, please post your full code somewhere - ideally as a repo or Gist on GitHub or somewhere similar - and we can take a more detailed look. Please include any other relevant details such as your capabilities and settings files. If you can't share your whole project, please create a minimal visual that reproduces the issue and we can focus on those areas and get you up and running.
Good luck!
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 all I'm trying to add interactions for my custom visual , But I'm facing some issues in my visual.ts
I've used R script to create my custom visual table,To add interactions in visual.ts i'm facing issues with these statements
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 |
---|---|
14 | |
2 | |
2 | |
1 | |
1 |