Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
jugurtha
Frequent Visitor

Custom Visual in PowerBi Javascript

Hi all,

 

I'm working on custom visual of PowerBi Javascript and i have a problem in this part of the code below:

Capture4.PNG 

I don't know where i can find the "visualContainer", i try with the title of my visual but it's not working.

Capture5.PNG

 

Than you.

1 ACCEPTED SOLUTION
MattCalderwood
Responsive Resident
Responsive Resident

Hi @jugurtha 

It is a little bit frustrating, but you can get the Visual ID by opening up the pbix file.

Start by making a copy of your PBIX report file

MattCalderwood_0-1596815133872.png

Then rename the pbix file extension to .zip (pbix files are simply zip archives)

MattCalderwood_1-1596815214094.png


You can then browse the contents - open up the 'reports' folder inside - and look for a file called 'Layout'

MattCalderwood_2-1596815297093.png

 

You can then open this file in notepad - or another text editor...

The file contains JSON data defining your report contents and layout.

If we take the contents of the file and view it in a JSON viewer - we can see the structure.

MattCalderwood_3-1596815519403.png

The report is split into the its report pages (Sections) - and each visual is then found under the 'Visiual Containers' array - in my example here, I only have a single visual.

 

The Config property in this first (and only) entry - shows the internal name of your visual.  => 4babf0e10a7c5d8b6819
If you look at the remaining contents you will find the visual title - this will help you identify which visual is which.

 

Note: I think you will also need to supply the internal name for the report sections (ReportSection1) as shown in the JSON you posted.

 

 

An alternative Option for discovering the ID's:

If you are already embedding your report - you can use the GetVisuals function to get all visuals in a page.
https://github.com/Microsoft/PowerBI-JavaScript/wiki/Get-Visuals
The response from this method call will include the internal name/ID of each visual.

Hope this helps.
Cheers, Matt

View solution in original post

1 REPLY 1
MattCalderwood
Responsive Resident
Responsive Resident

Hi @jugurtha 

It is a little bit frustrating, but you can get the Visual ID by opening up the pbix file.

Start by making a copy of your PBIX report file

MattCalderwood_0-1596815133872.png

Then rename the pbix file extension to .zip (pbix files are simply zip archives)

MattCalderwood_1-1596815214094.png


You can then browse the contents - open up the 'reports' folder inside - and look for a file called 'Layout'

MattCalderwood_2-1596815297093.png

 

You can then open this file in notepad - or another text editor...

The file contains JSON data defining your report contents and layout.

If we take the contents of the file and view it in a JSON viewer - we can see the structure.

MattCalderwood_3-1596815519403.png

The report is split into the its report pages (Sections) - and each visual is then found under the 'Visiual Containers' array - in my example here, I only have a single visual.

 

The Config property in this first (and only) entry - shows the internal name of your visual.  => 4babf0e10a7c5d8b6819
If you look at the remaining contents you will find the visual title - this will help you identify which visual is which.

 

Note: I think you will also need to supply the internal name for the report sections (ReportSection1) as shown in the JSON you posted.

 

 

An alternative Option for discovering the ID's:

If you are already embedding your report - you can use the GetVisuals function to get all visuals in a page.
https://github.com/Microsoft/PowerBI-JavaScript/wiki/Get-Visuals
The response from this method call will include the internal name/ID of each visual.

Hope this helps.
Cheers, Matt

Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.