Haicharat的产经
Highcharter Sankey
我正在尝试使用以下数据框和代码创建桑基图:
UKvisits <- data.frame(origin=as.character(c(
"France", "Germany", "USA",
"Irish Republic", "Netherlands",
"Spain", "Italy", "Poland",
"Belgium", "Australia",
"Other countries", rep("UK", 5))),
visit=as.character(c(
rep("UK", 11), "Scotland",
"Wales", "Northern Ireland",
"England", "London")),
weights=c(
c(12,10,9,8,6,6,5,4,4,3,33)/100*31.8,
c(2.2,0.9,0.4,12.8,15.5)))
高包线:
hchart(UKvisits, "sankey", hcaes(from = origin, to = visit, weight = weights))
此示例是从此处复制的:https://github.com/jbkunst/highcharter/blob/master/dev/highcharts-v6.R
出于某种原因,每当我 运行 执行此操作时,绘图屏幕都会保持白色并且没有任何内容被绘制。
我正在 R Studio 版本 1.1.423(R 版本:4.3)上尝试此操作
有人知道为什么会这样吗?
我遇到了同样的问题。首先我得到 javascript 控制台错误:
a is undefined
我没有在 ui.R 中使用正确的函数 highchartOutput(),然后我在 javascript 控制台中得到了这个:
Highcharts Error #17 The requested series type does not exist...
我发现 并且一条评论建议通过以下方式安装 highcharter 的开发版本:
devtools::install_github("jbkunst/highcharter")
这解决了我的问题,使用 post:
中的简单代码
highchart() %>%
hc_chart(type = 'sankey') %>%
hc_add_series(
data = list(
list(from = 'AT', to = 'DE', weight = 10),
list(from = 'DE', to = 'CH', weight = 5),
list(from = 'DE', to = 'FI', weight = 5))
)
而且我可以在那里工作。看来要做桑基图就得用dev版了
我正在尝试使用以下数据框和代码创建桑基图:
UKvisits <- data.frame(origin=as.character(c(
"France", "Germany", "USA",
"Irish Republic", "Netherlands",
"Spain", "Italy", "Poland",
"Belgium", "Australia",
"Other countries", rep("UK", 5))),
visit=as.character(c(
rep("UK", 11), "Scotland",
"Wales", "Northern Ireland",
"England", "London")),
weights=c(
c(12,10,9,8,6,6,5,4,4,3,33)/100*31.8,
c(2.2,0.9,0.4,12.8,15.5)))
高包线:
hchart(UKvisits, "sankey", hcaes(from = origin, to = visit, weight = weights))
此示例是从此处复制的:https://github.com/jbkunst/highcharter/blob/master/dev/highcharts-v6.R
出于某种原因,每当我 运行 执行此操作时,绘图屏幕都会保持白色并且没有任何内容被绘制。
我正在 R Studio 版本 1.1.423(R 版本:4.3)上尝试此操作
有人知道为什么会这样吗?
我遇到了同样的问题。首先我得到 javascript 控制台错误:
a is undefined
我没有在 ui.R 中使用正确的函数 highchartOutput(),然后我在 javascript 控制台中得到了这个:
Highcharts Error #17 The requested series type does not exist...
我发现
devtools::install_github("jbkunst/highcharter")
这解决了我的问题,使用 post:
中的简单代码highchart() %>%
hc_chart(type = 'sankey') %>%
hc_add_series(
data = list(
list(from = 'AT', to = 'DE', weight = 10),
list(from = 'DE', to = 'CH', weight = 5),
list(from = 'DE', to = 'FI', weight = 5))
)
而且我可以在那里工作。看来要做桑基图就得用dev版了