Forum Discussion
Need help with creating a Power BI Custom Visual HTML with Plotly
- Anonymous6 years ago
Have solved it
Hi and thanks for fast response. Perhaps I was not clear enough. Below you see what I am looking for
Here you see a hardcoded version that works. I need to replace this code so it works with fields from Power BI when it uses the custom visual. It may be a challenge when I am using fields from two different tables, but perhaps not. I am sure there are solution for that. Hope you understand it better now
source('./r_files/flatten_HTML.r')
############### Library Declarations ###############
libraryRequireInstall("ggplot2");
libraryRequireInstall("plotly")
####################################################
################### Actual code ####################
# y <- c(Values$Value)
# x <- c(Values$AvgWeight)
trace_0 <- rnorm(100, mean = 5)
x <- c(1:100)
x2 <- c(1, 10, 20, 40, 60)
y2 <- c(4, 2, 3, 5, 7)
data <- data.frame(x, x2, trace_0, y2)
g <- plot_ly(data, x = ~x) %>%
add_trace(y = ~trace_0, name = 'trace 0',mode = 'lines', type = "scatter") %>%
#add_trace(y = ~trace_1, name = 'trace 1', mode = 'lines+markers') %>%
add_trace(x= ~x2, y = ~y2, name = 'trace 2', mode = 'markers', type = "scatter")
####################################################
############# Create and save widget ###############
p = ggplotly(g);
internalSaveWidget(p, 'out.html');
####################################################
Have solved it
- Anonymous6 years agoNot applicable
Anonymous
This is not possible given the current functionality of the visual. It must be hardcoded.
- Anonymous6 years agoNot applicable
I should add that there is a custom visual for the javascript library d3. It might allow you to do this but it only supports 20,000 data points.
- Marco575 years ago
Helper III
Hello Anonymous,
Any chances you would share how you did?
Thanks in advance.