We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
registerShape('point', 'maxOrMinPoint', { draw(cfg, group) { const color = 'red'; const showMinPoint = _.get(cfg, 'data.isMin', false); const showMaxPoint = _.get(cfg, 'data.isMax', false); const cfgX = cfg.x as number; const cfgY = cfg.y as number; let resultShape = group.addShape('circle', { attrs: { x: cfg.x as number, y: cfg.y as number, }, }); if (showMaxPoint || showMinPoint) { resultShape = group.addShape('circle', { attrs: { x: cfgX, y: cfgY, r: 3, lineWidth: 2, stroke: color, fill: '#fff', }, name: 'maxCircle', }); resultShape = group.addShape('path', { attrs: { path: `M${cfgX} ${cfgY - 4} L${cfgX + 4} ${cfgY - 8} L${cfgX - 4} ${cfgY - 8} Z`, lineWidth: 2, stroke: color, fill: color, }, name: 'maxPath', }); resultShape = group.addShape('rect', { attrs: { x: cfgX - 20, // 矩形起始点为左上角 y: cfgY - 32, width: 40, height: 24, radius: 4, stroke: color, fill: color, }, name: 'maxPath', }); resultShape = group.addShape('text', { attrs: { x: cfgX, y: cfgY - 14, fontSize: 12, lineWidth: 1, shadowBlur: 0, text: showMaxPoint ? 'Max' : 'Min', fontStyle: 'normal', textAlign: 'center', stroke: '#fff', fill: '#fff', fontWeight: 'lighter', }, name: showMaxPoint ? 'maxCircleText' : 'minCircleText', }); return resultShape; } return resultShape; }, });
The text was updated successfully, but these errors were encountered:
@PiDazhong 解决了吗?我也遇到这个问题了
Sorry, something went wrong.
可以先 const newGroup = group.addGroup(); 然后 newGroup.addShape() 上操作。 最后return newGroup;
const newGroup = group.addGroup();
newGroup.addShape()
return newGroup
其实就是图例只操作你最后的那个resultShape。 但是你实际上是添加了几个resultShape。
No branches or pull requests
The text was updated successfully, but these errors were encountered: