0

Hi I am trying to Create a Custom Visual using NodeJS and PBIVIZ I have done installation etc. But I when I am adding values and trying to view the final plot I am getting the below error. Following is the code used

library(ggplot2)
dataset = values
g = ggplot(data=dataset, aes(x=dataset$Buying,     
           fill=dataset$Car_Acceptibility)) + 
           geom_bar(stat="count") + 
           scale_x_discrete(name ="Buying Price") +
           scale_fill_discrete(name="Acceptability")

####################################################

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

Custom Visual Error

  • Please do not post (only) an image of code/data/errors: it breaks screen-readers and it cannot be copied or searched (ref: https://meta.stackoverflow.com/a/285557 and https://xkcd.com/2116/). Please include the code, console output, or data (e.g., `data.frame(...)` or the output from `dput(head(x))`) directly. – r2evans Sep 30 '22 at 14:48
  • Welcome to SO, BinitDubey! This could be for several reasons with a lot of speculation, I don't think anybody is going to be able to help much without more context at a minimum, more preferably a reproducible question. Please make this question *reproducible*. This includes sample code you've attempted (including listing non-base R packages, and any errors/warnings received), sample *unambiguous* data (e.g., `data.frame(x=...,y=...)` or the output from `dput(head(x))`), and intended output given that input. See: https://stackoverflow.com/q/5963269. – r2evans Sep 30 '22 at 14:50
  • I read a blog on Custom Visuals in R and following is the Code that I am using in My script.r file in my --Rhtml folder dataset = values g = ggplot(data=dataset, aes(x=dataset$Buying, fill=dataset$Car_Acceptibility)) + geom_bar(stat="count") + scale_x_discrete(name ="Buying Price") + scale_fill_discrete(name="Acceptability") #################################################### ############# Create and save widget ############### p = ggplotly(g); internalSaveWidget(p, 'out.html'); – Binit Dubey Sep 30 '22 at 15:01
  • Comments are not well-suited for large amounts of code/data, please [edit] your question and put it there. (Also, comments are often skipped by readers and/or hidden by the Stack interface, so it's best to keep the question complete.) Thanks! – r2evans Sep 30 '22 at 15:06
  • But that code is about plotting it, nothing to do with reading in the data. Where in your script are you using `read.*`? How is your BI app setup for retrieving/accessing data? This is the context I was referring to earlier. – r2evans Sep 30 '22 at 15:12
  • Doesn't Values that are used in Power Bi visual, flow into the R script. I am referring to (dataset = Values) – Binit Dubey Sep 30 '22 at 15:33
  • From the error, there's no indication it even gets to `dataset = values`. I have no idea how `values` is created, and your code makes no reference to `read.csv` or `file`, so it's difficult to know where to go with this. – r2evans Sep 30 '22 at 15:39
  • @r2evans Power BI automatically runs `read.csv` and store in `values`. – Stéphane Laurent Oct 01 '22 at 06:56

0 Answers0