我正在使用rCharts创建Highcharts气泡图,但无法更改气泡标签 . 在此示例中,我希望分支名称显示在气泡中而不是默认y . 示例数据和我正在使用的代码:
branch <- c('A', 'B', 'C', 'D', 'E', 'F')
cases <- c('100', '200', '300', '400', '500', '600')
prop <- c('600', '500', '400', '300', '200', '100')
units <- c('6', '5', '4', '3', '2', '1')
size <- c('large', 'large', 'large', 'medium', 'small', 'small')
df <- data.frame(branch, cases, prop, units, size)
library(rCharts)
h1 <- hPlot(x = "prop", y = "units", data = df, type = "bubble", group = "size", size = "cases", name = "branch")
h1$plotOptions(bubble =list(dataLabels = list(enabled = TRUE, x = 0,
formatter = "#! function() {
return this.point.name;} !#"
)))
所有帮助表示赞赏!谢谢!
1 回答
在hPlot中,您无法在toolTip或plotOptions中使用未使用的colomn .
尝试使用以下代码,而不是使用名称Y:
如您所见,这将显示气泡中的y值 . 您也可以显示x值 . 但就是这样 . 这是由于气泡图的结构 . 但是有一个解决方法 . 有关详细信息,请参阅https://github.com/ramnathv/rCharts/issues/289 .