[英]How to add a line break in Highchart legend in R?
我制作了一個組織結構圖,我需要手動確定文本的換行符。
我正在使用 paste() 將文本與對象的值連接起來。 但休息不起作用。
根據例子:
library(highcharter)
library(tidyverse)
value <- 1
highchart() %>%
hc_chart(type = 'organization') %>%
hc_add_series(
data = list(
list(from = 'A1', to = 'A2'),
list(from = 'A2', to = 'A3')),
nodes = list(
list(id = 'A1', name = paste("I need to break the text", value, sep="\n"))), #TEXT
nodeWidth = 150) # increasing the width of the box, to illustrate
而不是使用\\n
使用 html 標簽<br>
作為分隔符:
library(highcharter)
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
library(tidyverse)
value <- 1
highchart() %>%
hc_chart(type = 'organization') %>%
hc_add_series(
data = list(
list(from = 'A1', to = 'A2'),
list(from = 'A2', to = 'A3')),
nodes = list(
list(id = 'A1', name = paste("I need to break the text", value, sep="<br>"))), #TEXT
nodeWidth = 150) # increasing the width of the box, to illustrate
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.