Forum Discussion
rootchina
9 years agoRegular Visitor
Cannot plot the R viz in PBI Desktop when the column named with Chinese characters (UTF-8)
Hi Power BI guru, Issue Description: I find that there exists a language support issue when I try to plot a R visual in Power BI Desktop. It failes to plot the visual with error throwing out,...
v-sihou-msft
9 years agoMicrosoft Employee
I directly drag 城市 and 纳税 column into R visual. Then your script works and the chinese characters are displayed properly.
library(showtext)
showtext.auto(enable = TRUE)
Sys.setlocale("LC_ALL","CHS")
plot(dataset)
Regards,
rootchina
9 years agoRegular Visitor
Hi Simon,
Thanks for your solution which could avoid calling variables when using plot(dataset) , sometimes we have to use the varibles if we need to plot a accurate shapes with with defined parameters.
Assign the column header with Chinese characters to the variables, like what i describled in the question.
library(showtext)
showtext.auto(enable = TRUE)
font.add('fang', 'simfang.ttf')
Sys.setlocale(,"CHS")
城市 <- dataset$城市
纳税 <- dataset$纳税
plot(城市,纳税,family = 'fang')
Due to the Chinese parse, the scripts fails to executed thought it works in R studio.