antvis/G2
The issue has been closed
饼图模式下 color 配置成值对应的字段,生成的图例是连续性图例,这个时候如果配置了label,只显示最后一个 #3160
jefferyssy posted onGitHub
- I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
const data = [
{ item: "事例一", count: 40, percent: 0.4 },
{ item: "事例二", count: 21, percent: 0.21 },
{ item: "事例三", count: 17, percent: 0.17 },
{ item: "事例四", count: 13, percent: 0.13 },
{ item: "事例五", count: 9, percent: 0.09 }
];
chart
.interval()
.adjust("stack")
.position("percent")
.color("count")
.label("percent", (percent) => {
return {
content: (data) => {
return `${data.item}: ${percent * 100}%`;
}
};
})
将 color从item 改成 item 这个时候是连续性图例,展示也正常,当时 label 配置不正确了
Environment | Info |
---|---|
g2 | 4.1.4 |
System | - |
Browser | - |
<!-- generated by antv-issue-helper. DO NOT REMOVE -->