Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const cy = 0.5;
let sumX = 0;
let minX = Infinity;
_.each(cfg.points, (p: any) => {
if (p.x < minX) {
minX = p.x;
}
sumX += p.x;
});
const cx = sumX / cfg.points.length;
const cp = this.parsePoint({ x: cx, y: cy });
const minP = this.parsePoint({ x: minX, y: 0.5 });
const xWidth = cp.x - minP.x;
const radius = Math.min(xWidth, minP.y);
const attrs = getFillAttrs(cfg);
const clipCircle = new Circle({
attrs: {
x: cp.x,
y: cp.y,
r: radius,
},
});
addWaterWave(
cp.x,
cp.y,
1 - cfg.points[1].y, // cfg.y / (2 * cp.y),
1,
[attrs.fill],
container,
clipCircle,
radius * 4
);
drawClip(cfg, shape) {
const clip = Util.mix({}, this.options.clipCfg, cfg.clipCfg);
if (!clip.show) {
return;
}
// 支持circle、rect、ellipse、Polygon及自定义path clip
const { type, x, y } = clip;
let clipShape = null;
if (type === 'circle') {
const { r } = clip;
clipShape = new G.Circle({
attrs: {
r,
x,
y
}
});
} else if (type === 'rect') {
const { width, height } = clip;
clipShape = new G.Rect({
attrs: {
x,
y,
width,
height
}
});