Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
In this article, I will explain the steps required to make this happen.
The result looks like this.
When you view the code in the above Sandbox you will probably recognize a regular Custom Power BI Visual project. We do need to make a few changes though to make this work.
Personally, I like to create a Github repository from Visual Studio (where I edit my Custom Visual).
Within Codesandbox.io, you can import a Github repository. So here we import our custom Visual project.
In our codesandbox solution we will need to add some sample data from our Power BI dashboard. In order to do so we will copy the options object and add it as a json file in codesandbox.
First we start the debugger;
On our dashboard page we press F12 (with the visual selected) and re-run the visual. This will open up DevTools (in Chrome). In the section Sources -> Scope, we can copy the ‘options’ object.
In codesanbox we add a data.json file and paste the contents.
We also add an index.ts file where we instantiate the Visual class.
From here we need to make a few more (small) changes to the code. The primary changes made are;
The syntax to load modules has changed,
A few changes in the Visual.ts file:
- The settings are not imported,
- The visual is attached to the SVG element ‘app’,
- References to Visual settings have been hard-coded, as we can’t access these settings.
Please follow the links for the details.
After following the above steps we are able to demonstrate a running version of the visual on the web without the need to access the Power BI service. This allows us to share (code for) visuals on platforms like Medium ealisy.
Hope it works for you!
p.s. this is a repost from Medium. I am the original author.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.