如何修改树图中节点的属性?
How to modify the attributes of nodes in a treemap?
我构建了一个树状图并想改变图形的一些属性,即节点描述中使用的字体大小并指定各种节点的颜色
当右键单击图表并选择 "View Source" -> "Parsed JSON" 时,我看到设置已放在 labels
的每个元素中。我如何在渲染之前访问这些以强制我的选择(全局(字体)或每个节点(背景颜色))?
由于解析的 JSON 视图显示,作为示例,对于 label
的给定元素,"background-color":"#1f1f1f"
设置为与 text
相同的级别,我试着把这个放在我的 series
:
{
"text": "Candidates",
"children": [
{
"text": "Can not scan: 13 %",
"value": 13
},
{
"text": "Scanned: 87 %",
"children": [
{
"text": "Not authenticated: 61 %",
"children": [
{
"text": "Confirmed vulnerable: 38 %",
"value": 38,
"font-color": "yellow"
},
{
"text": "Unknown: 23 %",
"value": 23
}
]
},
(...)
但未应用 "font-color": "yellow"
(或任何其他属性)。
在我们的树状图文档页面 first example 上,我们有一个调色板示例来说明如何更改颜色。该代码如下所示:
var myConfig = {
"type":"treemap",
"options":{
"split-type":"balanced",
"color-type":"palette",
"palette":["#f44336","#29b6f6","#ab47bc","#ffc107","#5c6bc0","#009688"]
},
"plotarea":{
"margin": "0 0 35 0"
},
"series":[
{
"text":"North America",
"children":[
...
如果要更改 options.box 内完成的字体大小:
var myConfig = {
"type":"treemap",
"options":{
"split-type":"balanced",
"color-type":"palette",
"palette":["#f44336","#29b6f6","#ab47bc","#ffc107","#5c6bc0","#009688"],
box: {
fontSize:15
}
},
"plotarea":{
"margin": "0 0 35 0"
},
"series":[
{
"text":"North America",
...
相关文献:
https://www.zingchart.com/docs/chart-types/treemap/#treemap__box
我构建了一个树状图并想改变图形的一些属性,即节点描述中使用的字体大小并指定各种节点的颜色
当右键单击图表并选择 "View Source" -> "Parsed JSON" 时,我看到设置已放在 labels
的每个元素中。我如何在渲染之前访问这些以强制我的选择(全局(字体)或每个节点(背景颜色))?
由于解析的 JSON 视图显示,作为示例,对于 label
的给定元素,"background-color":"#1f1f1f"
设置为与 text
相同的级别,我试着把这个放在我的 series
:
{
"text": "Candidates",
"children": [
{
"text": "Can not scan: 13 %",
"value": 13
},
{
"text": "Scanned: 87 %",
"children": [
{
"text": "Not authenticated: 61 %",
"children": [
{
"text": "Confirmed vulnerable: 38 %",
"value": 38,
"font-color": "yellow"
},
{
"text": "Unknown: 23 %",
"value": 23
}
]
},
(...)
但未应用 "font-color": "yellow"
(或任何其他属性)。
在我们的树状图文档页面 first example 上,我们有一个调色板示例来说明如何更改颜色。该代码如下所示:
var myConfig = {
"type":"treemap",
"options":{
"split-type":"balanced",
"color-type":"palette",
"palette":["#f44336","#29b6f6","#ab47bc","#ffc107","#5c6bc0","#009688"]
},
"plotarea":{
"margin": "0 0 35 0"
},
"series":[
{
"text":"North America",
"children":[
...
如果要更改 options.box 内完成的字体大小:
var myConfig = {
"type":"treemap",
"options":{
"split-type":"balanced",
"color-type":"palette",
"palette":["#f44336","#29b6f6","#ab47bc","#ffc107","#5c6bc0","#009688"],
box: {
fontSize:15
}
},
"plotarea":{
"margin": "0 0 35 0"
},
"series":[
{
"text":"North America",
...
相关文献: https://www.zingchart.com/docs/chart-types/treemap/#treemap__box