【发布时间】:2016-02-23 16:17:47
【问题描述】:
我正在尝试在revealjs 演示文稿中的highchart (rcharts) 中添加水平线和垂直线。 我尝试用这种方式修改这个post的代码:
require(xlsx)
library(rCharts)
Perhplot.df <-read.xlsx("C:\\RDirectory\\AREALAVORO\\JOB\\RISULTATI2.xlsx", sheetName="completo2")
lDf <- split(Perhplot.df, Perhplot.df$variable)
h16 <- hPlot(protection ~ days, data = lDf$Exposure,
type = "bubble",
group = "label",
title = "By Days of Exposure",
subtitle = "Move the mouse pointer on the bubbles to view the data",
size = "cluster_size",
group = "label")
h16$set(width = 1000, height = 600)
ord <- c("Less than 1 week"=0,
"1-2 weeks"=1,
"3-4 weeks"=2,
"More than 4 weeks"=3,
"Mean"=4
)
h16$params$series <- lapply(h16$params$series, function(d){
temp = ord[d$name]
names(temp) = NULL
d$legendIndex = temp
return(d)
})
h16$yAxis(min = 35, max = 70, title = list(text = "Level of Protection"))
h16$xAxis(min = 0, max = 45, title = list(text = "Days of Exposure"))
dfy<-data.frame(y=c(35,58,70), x=c(18.8,18.8,18.8))
h16$layer(y~x,data=dfy,type="line",color=list(const = 'darkblue'))
h16$show('inline', include_assets = TRUE)
气泡图没问题,但是我尝试添加垂直线我有这个错误:
Error in envRefInferField(x, what, getClass(class(x)), selfEnv) : ‘layer’ is not a valid field or method name for reference class “Highcharts”
所以该解决方案适用于 Dimple Charts 但不适用于 Highcharts...
【问题讨论】:
标签: r highcharts rcharts