更改 rCharts Sankey 图上的字体大小

Change Font Size on rCharts Sankey Diagram

我正在使用以下代码使用 rCharts 创建桑基图。我希望增加 Sankey 图上打印的文本的字体大小。我找不到手册来告诉我如何做到这一点。想法?

rm(list = ls())
require(reshape)
require(rCharts)
require(rjson)
target <- c('TMF', 'TMF', 'TMF','Evaporation','Mill Reclaim','Void Losses','Seepage')
source <- c('Precipitation & Run Off','Slurry','Other','TMF','TMF','TMF','TMF')
value <- c(638,1610,755,118,1430,466,2)
x <- data.frame(target,source,value)
sankeyPlot <- rCharts$new()
sankeyPlot$set(
data = x,
nodeWidth = 10,
nodePadding = 10,
layout = 32,
width = 1100,
height = 675,
units = "cubic metres",
title = "Sankey Diagram"
)
sankeyPlot$setLib('http://timelyportfolio.github.io/rCharts_d3_sankey')
sankeyPlot

基于this answer,您可以添加脚本来自定义您的情节。要更改文本大小,您可以添加:

sankeyPlot$setTemplate(
        afterScript = "
<script>
d3.selectAll('#{{ chartId }} svg text')
  .style('font-size', '55')
</script>
")