Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const Chart = createG2(chart => {
const Stat = G2.Stat;
chart.coord('theta', {
radius: 0.4, // 设置饼图的大小
});
chart.legend('name', {
position: 'bottom',
itemWrap: true,
word: {
fill: 'rgba(255,255,255,.5)',
},
formatter: name => `${name}: ${desc[name].percent} - ${desc[name].ps}`,
});
chart
.intervalStack()
.position(Stat.summary.percent('data'))
.color('name', color)
.label('name');
if (!margin) {
if (hasLegend) {
m = [24, 240, 24, 0];
} else if (percent) {
m = [0, 0, 0, 0];
} else {
m = [24, 0, 24, 0];
}
}
const h = title ? (height + m[0] + m[2] + (-46)) : (height + m[0] + m[2]);
// clean
this.node.innerHTML = '';
const Stat = G2.Stat;
const chart = new G2.Chart({
container: this.node,
forceFit: fit,
height: h,
plotCfg: {
margin: m,
},
animate,
});
if (!tooltip) {
chart.tooltip(false);
} else {
chart.tooltip({
title: null,