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
g6 4.8.21 官方示例中,决策树图的示例代码内在modes 增加了'click-select'属性,在defaultConfig中增加了nodeStateStyle(selected)选中节点的样式,并且在node:click事件中,进行了graph.setItemState(item, 'selected', true)操作,但是依然无法实现选中节点的效果。
https://g6.antv.antgroup.com/zh/examples/case/treeDemos/#decisionTree
// 组件props const props = { data: mockData, config: { padding: [20, 50], defaultLevel: 3, defaultZoom: 0.8, modes: { default: ['zoom-canvas', 'drag-canvas', 'click-select'] }, }, }; // 默认配置 const defaultConfig = { width, height, modes: { default: ['zoom-canvas', 'drag-canvas', 'click-select'], }, fitView: true, animate: true, defaultNode: { type: 'flow-rect', }, defaultEdge: { type: 'cubic-horizontal', style: { stroke: '#CED4D9', }, }, layout: { type: 'indented', direction: 'LR', dropCap: false, indent: 300, getHeight: () => { return 60; }, }, nodeStateStyles: { // 节点在 selected 状态下的样式,对应内置的 click-select 行为 selected: { // stroke: '#666', stroke: 'blue', lineWidth: 2, fill: 'blue', shadowColor: 'blue' } } }; graph.on('node:click', (e) => { const { item } = e; const node = item?.get('model'); graph.setItemState(item, 'selected', true) })
4.x
Windows
Chrome
G6 4.8.21,win10 22H2,chrome 126.0.6478.115
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug / 问题描述
g6 4.8.21 官方示例中,决策树图的示例代码内在modes 增加了'click-select'属性,在defaultConfig中增加了nodeStateStyle(selected)选中节点的样式,并且在node:click事件中,进行了graph.setItemState(item, 'selected', true)操作,但是依然无法实现选中节点的效果。
Reproduction link / 重现链接
https://g6.antv.antgroup.com/zh/examples/case/treeDemos/#decisionTree
Steps to Reproduce the Bug or Issue / 重现步骤
// 组件props
const props = {
data: mockData,
config: {
padding: [20, 50],
defaultLevel: 3,
defaultZoom: 0.8,
modes: { default: ['zoom-canvas', 'drag-canvas', 'click-select'] },
},
};
// 默认配置
const defaultConfig = {
width,
height,
modes: {
default: ['zoom-canvas', 'drag-canvas', 'click-select'],
},
fitView: true,
animate: true,
defaultNode: {
type: 'flow-rect',
},
defaultEdge: {
type: 'cubic-horizontal',
style: {
stroke: '#CED4D9',
},
},
layout: {
type: 'indented',
direction: 'LR',
dropCap: false,
indent: 300,
getHeight: () => {
return 60;
},
},
nodeStateStyles: {
// 节点在 selected 状态下的样式,对应内置的 click-select 行为
selected: {
// stroke: '#666',
stroke: 'blue',
lineWidth: 2,
fill: 'blue',
shadowColor: 'blue'
}
}
};
graph.on('node:click', (e) => {
const { item } = e;
const node = item?.get('model');
graph.setItemState(item, 'selected', true)
})
G6 Version / G6 版本
4.x
Operating System / 操作系统
Windows
Browser / 浏览器
Chrome
Additional context / 补充说明
G6 4.8.21,win10 22H2,chrome 126.0.6478.115
The text was updated successfully, but these errors were encountered: