import { registerFigure, registerOverlay } from "klinecharts";registerFigure({name: "custom_graphics",checkEventOn: (coordinate, attrs) => {// 当前鼠标坐标,判断事件是否可用const { x: px, y: py } = coordinate;const { x, y, r } = attrs;if (px <= x + r && px >= x - r && py <= y + r && py >= y - r) {return true;}return false;},draw: (ctx, attrs) => {const { x, y, r, text } = attrs;// 画圆形&文字drawCircleAndText(ctx, x, y, r, text);// 画箭头drawArrow(ctx, x, y, r, text, 3);drawArrow(ctx, x, y, r, text, 6);drawArrow(ctx, x, y, r, text, 9);// 画矩形&文字drawRectAndText(ctx, x, y, r, text, 12);},
});
registerOverlay({name: "custom_overlay