Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How can I resolve garbled characters in Custom Visuals?

I made custom visuals with R script.

But I can not display japanese. japanese language was garbled.

I realize that the characters were convert from Latin-1 to UTF-8.

How can I resolve it?

 

・InputData

 

 capture.PNG

 

 


・Rscript

 

source('./r_files/flatten_HTML.r')

############### Library Declarations ###############
targetPackages <- c('plotly','dplyr') 
newPackages <- targetPackages[!(targetPackages %in% installed.packages()[,"Package"])]
if(length(newPackages)) install.packages(newPackages, repos = "http://cran.us.r-project.org")

libraryRequireInstall("plotly");
libraryRequireInstall("dplyr");
####################################################


############ User Parameters ######### 
# Set of parameters from GUI 
 
MaxAlartLine = 200
if(exists("alartSetting_MaxAlartLine")){ 
  MaxAlartLine = alartSetting_MaxAlartLine
} 

MinAlartLine = 200
if(exists("alartSetting_MinAlartLine")){ 
  MinAlartLine = alartSetting_MinAlartLine
} 

MaxWarningLine = 100
if(exists("alartSetting_MaxWarningLine")){ 
  MaxWarningLine = alartSetting_MaxWarningLine
} 

MinWarningLine = -100
if(exists("alartSetting_MinWarningLine")){ 
  MinWarningLine = alartSetting_MinWarningLine
} 

AlartColor = '#0010c9'
if(exists("alartSetting_AlartColor")){ 
  AlartColor = alartSetting_AlartColor
} 

WarningColor = '#0010c9'
if(exists("alartSetting_WarningColor")){ 
  WarningColor = alartSetting_WarningColor
} 

ColorOn = TRUE
if(exists("alartSetting_ColorOn")){ 
  ColorOn = alartSetting_ColorOn
} 
####################################################


################### Actual code ####################

#HeaderSetting
headerValues <- list();
for (i in (0:ncol(Values))) {
  tmpname <- names(Values)[i] 
  headerValues[i] <- tmpname
}
headerValues <- append(headerValues, "<b>Items</b>", after = 0)

#count
MaxAlartCountdata <- Values %>% dplyr::filter(Values[1] >= MaxAlartLine) %>% dplyr::summarise(cnt=n())
MaxWarningCountdata <- Values %>% dplyr::filter(Values[1] >= MaxWarningLine) %>% dplyr::summarise(cnt=n())
MinWarningCountdata <- Values %>% dplyr::filter(Values[1] <= MinWarningLine) %>% dplyr::summarise(cnt=n())
MinAlartCountdata <- Values %>% dplyr::filter(Values[1] <= MinAlartLine) %>% dplyr::summarise(cnt=n())

#CellSetting
cellValues <- list(
      c('TotalCount','MaxAlartCount','MaxWarningCount','MinWarningCount','MinAlartCount'),
      c(nrow(Values),MaxAlartCountdata[1,1],MaxWarningCountdata[1,1],MinWarningCountdata[1,1],MinAlartCountdata[1,1]))

#CellColorSetting
colorvec <- c('white')
if (ColorOn == TRUE){
  if (MaxAlartCountdata[1,1] == 0) colorvec <- c(colorvec, 'white') else colorvec <- c(colorvec, AlartColor)
  if (MaxWarningCountdata[1,1] == 0) colorvec <- c(colorvec, 'white') else colorvec <- c(colorvec, WarningColor)
  if (MinWarningCountdata[1,1] == 0) colorvec <- c(colorvec, 'white') else colorvec <- c(colorvec, WarningColor)
  if (MinAlartCountdata[1,1] == 0) colorvec <- c(colorvec, 'white') else colorvec <- c(colorvec, AlartColor)
}


#Plot
p <- plot_ly(
  type = 'table',
  header = list(
  values = headerValues,
  align = rep('center', ncol(Values) + 1),
  line = list(width = 1, color = 'black'),
  fill = list(color = 'white'),
  font = list(family = "Arial", size = 14, color = "black")
  ),
  cells = list(
    values = c(cellValues),
    align = rep('center', ncol(Values) + 1),
    line = list(color = "black", width = 1),
    fill = list(color = c('white',list(colorvec))),
    font = list(family = "Arial", size = 12, color = c("black"))
  ));

#output
internalSaveWidget(p, 'out.html');
####################################################


・Result

capture2.PNG

 

4 REPLIES 4
v-viig
Community Champion
Community Champion

We suggest to email pbircvsupport@microsoft.com

 

This email is supported by R expert.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Anonymous
Not applicable

I tried to email.

But No reply.

Please help me.

v-viig
Community Champion
Community Champion

Our R-script developer is on vacation. He will reply soon.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

v-viig
Community Champion
Community Champion

We investigated this issue. It seems you just need to add powerbi_rEnableShowTextForCJKLanguages = 1 at the beginning of your R-script.

 

To find out more please visit documentation: https://docs.microsoft.com/en-us/power-bi/visuals/service-r-visuals#known-limitations

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.