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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anthony_W
Helper I
Helper I

Custom R Interactive Visual - How to setup parameters

I am trying to develop several custom power bi visuals using R and Plotly. Previously I have not had any problem in developing ‘basic’ visuals, but would like to extend the visuals to include

  • labelling of the incoming data g. X Values column, Y Values Column, Data Points Colour etc. and
  • the selection of parameters e.g. Colour Gradient, Axis Title font sizes, point size, transparency etc..

1 Basic custom R/Plotly visual

I start a custom visual with the following steps

  1. Type the following command into CMD window: pbiviz new TestVisual -t rhtml
  2. Update blank fields in ‘pbiviz.json’ that must have values
  3. Update ‘script.R’ with the R Script to generate the required visual
  4. Type the following command into CMD window to compile the package: pbiviz package

The visual is then compiled, I can add it to the Power BI report and it works fine.

2 Custom R/Plotly visual with data assignments

I start off with test custom visual as noted above and modify the capabilities.json file. I update the dataRoles and dataviewmappings sections to include 3 parameters: Xvalues, YValues and ColourValues.

The visual is then compiled (using pbiviz package in the command prompt)., I can add it to the Power BI report and it works fine.

3 Custom R/Plotly visual with data assignments and parameters

I am struggling to implement parameters within the customised visual. I have looked at Microsoft’s tutorial located at the following link.

https://microsoft.github.io/PowerBI-visuals/tutorials/funnel-plot-from-r-script-to-r-custom-visual/o...

According to the tutorial, I just have to change the capabilities.json file, the settings.ts file and the R script to identify whether a parameter value exists and assign a default value if required.

I have attempted to do that but can’t get the parameters working probably. Has anyone succeeded in getting the parameters working for a dynamic R custom visual? Or can share a link to a detailed tutorial that works?

 

Thanks.

 

5 REPLIES 5
amitchandak
Super User
Super User

Thanks for the links Amitchandak.

 

Unfortunately the links don't help with my problem.

 

Cheers,

 

 

 

Anonymous
Not applicable

Hi @Anthony_W ,

Please find the following links, hope they can help you.

https://radacad.com/create-custom-visual-with-r-and-json-part3

https://www.youtube.com/watch?v=NMXlWu_oeyA

 

Best Regards

Rena

Thanks for the links yinginr,

 

I am working through the Radacad example. I downloaded the example visual data and managed to compile the custom.

 

I did receive an initial error during compilation stating a 'Globalize' package was not available. The error gave instructions for how to install the package - npm install --save globalize. Once the package is installed, the custom visual compiled OK.

 

I added the visual to a power bi report, but now receive the following R related error:

Error in strsplit(names(values), "\\.") : non-character argument
Calls: %>% -> eval -> eval -> style -> strsplit
Execution halted

 

I tried to find to find the strsplit function in the R code in the custom visual files, but haven't found. I suspect it is in one of the packages. I am still investigating the location of the error...

 

Anonymous
Not applicable

Hi @Anthony_W ,

Which sample you are using? Please try the solution in the following link and check if it works after you find the related "package".

https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/strsplit

 

Best Regards

Rena

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.