想要使用自定义颜色为每个系列提供不同的条形颜色

时间:2020-07-31 17:13:58

标签: angular angular8 angular9 ngx-charts

是否可以为每个系列添加不同的颜色。使用customColors?为

customColors() {
result = JSON.parse('[{"name":"Used","value":"#e8c728"},{"name":"Used","value":"#FF0000"}]');
return result;
}

样本图: https://stackblitz.com/edit/swimlane-grouped-vertical-bar-chart?embed=1&file=app/app.component.ts https://stackblitz.com/edit/swimlane-grouped-vertical-bar-chart-cn1o4k

enter image description here

data: [
{
"name": "Lineage Transformations",
"series": [
{
"name": "Limit",
"value": 0
},
{
"name": "Used",
"value": 0
}
]
},
{
"name": "Data sources",
"series": [
{
"name": "Limit",
"value": 10
},
{
"name": "Used",
"value": 0
}
]
}
]

0 个答案:

没有答案