cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KristianA Regular Visitor
Regular Visitor

Converting power bi R script visual to custom R visual

Hi,

I'm trying to add plotly to my R-script visualization, and have tried the RADACAD guide at http://radacad.com/interactive-map-using-r-and-power-bi-create-custom-visual-part-1

I got the visualization working in PBI although the code probably looks awful. Now I'm trying to add the functionality from plotly, so I can see the values of the datapoints on my scatterplot.

I got some sample data where the table has the amazing name "Sheet1" and the columns I add to "values" are "Price", "Production", and "Date".


here is the code that I got working in PBI, and I'm trying to package into a custom R visual

library(ggplot2)
p = qplot(1:10, (1:10)^3)
g = ggplot(dataset, aes(x=Price, y=Production, color = Date))+
geom_point() +
theme(axis.text.x = element_text(size=14),
axis.text.y = element_text(size=14),
axis.title.x = element_text(size=16),
axis.title.y = element_text(size=16),
panel.background = element_rect(fill = "white",
colour = "777777",
size = 0.4, linetype = "solid"),
panel.grid.major = element_line(size = 0.08, linetype = 'dashed',
colour = "777777"),
panel.grid.minor = element_line(size = 0.08, linetype = 'dashed',
colour = "777777")) +
theme(legend.position="bottom") +
ylab("Production") +
xlab("Price") +
stat_smooth(method = "lm", formula = y ~ poly(x,2), size = 1, se = FALSE)
g$respect = TRUE
library(grid)
grid.draw(g)

Any input on how to convert the above into what needs to go in the example below is appreciated!


############### Library Declarations ###############
libraryRequireInstall("ggplot2");
libraryRequireInstall("plotly")
####################################################

################### Actual code ####################
g = qplot(Values$Data, data = Values, fill = Values$Type, main = Sys.time());
####################################################

############# Create and save widget ###############
p = ggplotly(g);
internalSaveWidget(p, 'out.html');

1 REPLY 1
Moderator v-viig
Moderator

Re: Converting power bi R script visual to custom R visual

Please send this issue to Power BI R Custom Visuals Support <pbircvsupport@microsoft.com>.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Helpful resources

Announcements
Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 156 members 1,845 guests
Please welcome our newest community members: