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.
I'm trying to develop a custom R powered visual. I'm using the few examples on githib from the Microsoft team as a template.
(I'm using this repo a lot: https://github.com/Microsoft/PowerBI-visuals-clustering-kmeans)
The problem I am running into is the lack of simplicity making the visuals. The examples on Microsoft's github are very complex. I would like to see a custom R visual with a simple line chart, similar to the bar chart walkthrough on Microsoft's github--but for custom R visuals.
I understand the three key files are visual.ts, capabilities.json, and the r script
Is there a simple custom R visual such as a line chart where I can see the visual.ts, capabilities.json, and r script? This would be tremendously helpful. The K means and other examples on Microsoft's github are not helpful because there is a lot of detail in the visual tied to the clustering algorithm, not so much associated with making the visual.
I am native R programmer, I am running into problems at the visual.ts file. Namely finding the interaction bewteen powerbi.extensibility.visual, enumerateObjectInstances, and the R script.
If it is not possible, can Microsoft consider de-encrypting the current R visuals, so we can open up the zip file to see more examples of a working custom R visual?
Any direction would be appreciated.
Thank you!
Hello @jpf5046
You might use these templates as an example to develop a custom R-powered visual:
These templates don't contain a lot of code line. They represent the basic structure of the R-powered visual.
Please let us know if you have any questions.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
@v-viig thank you for the help.
I'm still having trouble finding the interaction between Power BI fields added and the Rscript.
I was wondering if you could point me in the right direction.
Here is the plot I was to make with my custom visual:
p = plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec, color = ~am, colors = c('#BF382A', '#0C4B8E')) %>% add_markers() %>% layout(scene = list(xaxis = list(title = 'wt'), yaxis = list(title = 'hp'), zaxis = list(title = 'qsec')));
So to do this I did the following:
In capabilities.json I changed to this:
{ "dataRoles": [ { "displayName": "CAR TYPE", "kind": "GroupingOrMeasure", "name": "Values" }, { "displayName": "wt", "kind": "GroupingOrMeasure", "name": "Values" }, { "displayName": "hp", "kind": "GroupingOrMeasure", "name": "Values" }, { "displayName": "qsec", "kind": "GroupingOrMeasure", "name": "Values" } ], "dataViewMappings": [ { "scriptResult": { "dataInput": { "table": { "rows": { "select": [ { "for": { "in": "Values" } } ], "dataReductionAlgorithm": { "top": {} } } } }, "script": { "scriptProviderDefault": "R", "scriptOutputType": "html", "source": { "objectName": "rcv_script", "propertyName": "source" }, "provider": { "objectName": "rcv_script", "propertyName": "provider" } } } } ], "objects": { "rcv_script": { "properties": { "provider": { "type": { "text": true } }, "source": { "type": { "scripting": { "source": true } } } } } }, "suppressDefaultTitle": true }
And then I'm pretty sure I have to change visual.ts but I am unsure of what to change.
Just making the changes above creates a bunch of errors in cmd line as you could guess.
What step did I skip?
Thank you
Since I'm facing the same problem (binding input data to R script) I'd like to know if you found any solution to this?
My first attemts look somehow similar to what you did but without success on my side as well.
Any answer will be helpful.
Thank you!
Hello @Kangaroo,
Could you please send an email to pbicvsupport@microsoft.com with issue's details?
We'll include our R developer to resolve this issue.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Could you please collect all data and issues that you have and send it to Power BI Custom Visuals Support <pbicvsupport@microsoft.com>?
We'll contact our R-developer in order to assist you.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
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.