r - 如何在 R 的 Highchart 图例中添加换行符?
问题描述
我制作了一个组织结构图,我需要手动确定文本的换行符。
我正在使用 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
推荐阅读
- spring-boot - 如果在 Spring Webflux 中启用了 CORS,则 Swagger 不起作用
- html - 如何从容器中取出一个块
- c# - 错误 NU1202:包 Microsoft.AspNetCore.Blazor.Cli 0.7.0 与 netcoreapp2.0 (.NETCoreApp,Version=v2.0) 不兼容
- java - 如何将 log4j 转换模式应用于特定包?
- javascript - 在鼠标悬停之前保存原始图像
- vba - 创建过滤循环函数
- ios - 如何将位于 UITableViewCell 中的 UIButton 与位于 View Controller 中的数据模型绑定?
- javascript - 如何根据使用 javascript 的另一个输入字段禁用某些选择按钮的选项?
- python - 如何从python中的数组中找到最小值和最大值?
- flutter - 如何在飞镖逻辑中获取每周日期列表