Forum Discussion
Are there more examples for visual.ts, capabilities.json and R script for custom R 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
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