Forum Discussion
Are there more examples for visual.ts, capabilities.json and R script for custom R Visuals?
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
- jpf50469 years agoHelper 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-viig9 years agoCommunity 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
- Kangaroo9 years agoRegular Visitor
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!
- v-viig9 years agoCommunity Champion
Hello Kangaroo,
Could you please send an email to [email protected] with issue's details?
We'll include our R developer to resolve this issue.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals