如何更改 voronoiTreemap 图例中的文本颜色

发布于 2025-01-19 00:58:55 字数 180 浏览 0 评论 0原文

这是一个例子。文本颜色默认为黑色。

library(voronoiTreemap)

data(ExampleGDP)
gdp_json <- vt_export_json(vt_input_from_df(ExampleGDP))
vt_d3(gdp_json, legend=TRUE)

Here is an example. Text color is black by default.

library(voronoiTreemap)

data(ExampleGDP)
gdp_json <- vt_export_json(vt_input_from_df(ExampleGDP))
vt_d3(gdp_json, legend=TRUE)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仙女山的月亮 2025-01-26 00:58:55

哇!我对此非常满意。我离题。

设置传奇文本颜色更改此 - &gt; 代码中的'#b21e29'

library(voronoiTreemap)
library(htmlwidgets)
library(dplyr)

data(ExampleGDP)
gdp_json <- vt_export_json(vt_input_from_df(ExampleGDP))

# try number 70032536587832
(plt = vt_d3(gdp_json, legend=TRUE) %>% 
    onRender("function(el){
                legends = el.lastChild.lastChild;
                legends.lastChild.setAttribute('style', 'fill: #b21e29;');
             }"))

以下 isbs8.png“ alt =”在此处输入图像描述>

WOO HOO! I'm pretty happy with myself on this one. I digress.

To set the legend text color change this -> '#b21e29' in the following code:

library(voronoiTreemap)
library(htmlwidgets)
library(dplyr)

data(ExampleGDP)
gdp_json <- vt_export_json(vt_input_from_df(ExampleGDP))

# try number 70032536587832
(plt = vt_d3(gdp_json, legend=TRUE) %>% 
    onRender("function(el){
                legends = el.lastChild.lastChild;
                legends.lastChild.setAttribute('style', 'fill: #b21e29;');
             }"))

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文