You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
现在设置完渐变色,它的渐变样式不是按照圆环的形状渐变的
`import { Pie, G2 } from '@antv/g2plot';
const { registerTheme } = G2;
registerTheme('custom-theme', {
colors10: ['l(0) 0:#000000 0.5:#177BEE 1:#177BEE', 'l(0) 0:#000000 0.5:#EAB966 1:#EAB966', 'l(0) 0:#000000 0.5:#05CFF7 1:#05CFF7'],
/** 20色板 */
colors20: ['#FACDAA', '#F4A49E', '#EE7B91', '#E85285', '#BE408C', '#BE408C', '#942D93'],
});
const data = [
{ type: '分类一', value: 27 },
{ type: '分类二', value: 25 },
{ type: '分类三', value: 18 },
{ type: '分类四', value: 15 },
{ type: '分类五', value: 10 },
{ type: '其他', value: 5 },
];
const piePlot = new Pie('container', {
theme: 'custom-theme',
appendPadding: 10,
data,
angleField: 'value',
colorField: 'type',
radius: 1,
innerRadius: 0.64,
meta: {
value: {
formatter: (v) =>
¥ ${v}
,},
},
label: {
type: 'inner',
offset: '-50%',
autoRotate: false,
style: { textAlign: 'center' },
formatter: ({ percent }) =>
${(percent * 100).toFixed(0)}%
,},
statistic: {
title: {
offsetY: -8,
},
content: {
offsetY: -4,
},
},
// 添加 中心统计文本 交互
interactions: [
{ type: 'element-selected' },
{ type: 'element-active' },
{
type: 'pie-statistic-active',
cfg: {
start: [
{ trigger: 'element:mouseenter', action: 'pie-statistic:change' },
{ trigger: 'legend-item:mouseenter', action: 'pie-statistic:change' },
],
end: [
{ trigger: 'element:mouseleave', action: 'pie-statistic:reset' },
{ trigger: 'legend-item:mouseleave', action: 'pie-statistic:reset' },
],
},
},
],
});
piePlot.render();
`
Beta Was this translation helpful? Give feedback.
All reactions