Forum Discussion
Are there more examples for visual.ts, capabilities.json and R script for custom R Visuals?
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!
5 Replies
- v-viigCommunity Champion
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
- jpf5046Helper I
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
- v-viigCommunity Champion
Could you please collect all data and issues that you have and send it to Power BI Custom Visuals Support <[email protected]>?
We'll contact our R-developer in order to assist you.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals