Comments (3)
@RackweLLizm you can refer to this source code
https://github.com/antvis/Graphin/blob/master/packages/graphin/src/shape/graphin-circle.ts#L339
from g6vp.
@pomelo-nwu
I have examined the part you mentioned, but it did not solve my problem. The part that I think will solve my main problem will be the place where the graph.updateItem(item,{}) method is triggered. Because G6VP loads nodes with photos at the time of initiliazed. But later when a photo is loaded with UpdateItem, G6VP does not render this photo on the node.
When I look at the MiniMap, I see the photo there. But I cannot see it on Node.
I think the problem is related to the UpdateItem method. I would be very grateful if you can point to the area where this part is triggered and the image operation is performed.
from g6vp.
I solved the problem, although not with a satisfactory method.
The problem is related to the update method in the circle of the graph.
If I update a node's icon as a photo with the graph.updateItem method and add the following code, the problem is solved, g6vp can render the photo.
path: graphin-circle.js
update: function update(cfg, item) {
if (!cfg.style) return;
try {
// var style = deepMix({}, cfg._initialStyle, cfg.style); // getStyles(cfg._initialStyle, cfg.style) as NodeStyle;
var style = merge({}, cfg._initialStyle, cfg.style); // getStyles(cfg._initialStyle, cfg.style) as NodeStyle;
cfg._initialStyle = Object.assign({}, style);
var badges = cfg.style.badges,
keyshape = style.keyshape;
var r = getRadiusBySize(keyshape.size);
var group = item.getContainer();
if (style.icon.type === "image") {
//customize
var imageAttrs = parseIcon(style);
var imageShape = group.addShape('image', imageAttrs);
var clip = style.icon.clip;
if (clip) {
var _r = clip.r,
clipStyle = __rest(clip, ["r"]);
imageShape.setClip({
type: 'circle',
attrs: Object.assign({
x: 0,
y: 0,
r: _r
}, clipStyle)
});
}
//customize
}
var shapes = group.get('children');
setStatusStyle(shapes, style, parseAttr);
var copyShapes = _toConsumableArray(shapes);
if (badges) {
var index = 0;
copyShapes.forEach(function (shape) {
if (shape.cfg.name.startsWith('badges')) {
shapes.splice(index, 1);
} else {
index = index + 1;
}
});
badges.forEach(function (badge) {
drawBadge(badge, group, r);
});
}
} catch (error) {
console.error('error');
}
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
added code:
if (style.icon.type === "image") {
//customize
var imageAttrs = parseIcon(style);
var imageShape = group.addShape('image', imageAttrs);
var clip = style.icon.clip;
if (clip) {
var _r = clip.r,
clipStyle = __rest(clip, ["r"]);
imageShape.setClip({
type: 'circle',
attrs: Object.assign({
x: 0,
y: 0,
r: _r
}, clipStyle)
});
}
//customize
}
i also think there is a problem with badges remove here. sometimes i see that even if i set the badges array to empty value in Graphin, the badges are not removed. still there.
I made the following change in this. solved the problem;
var badges = style.badges
(changes) => var badges = cfg.style.badges,
from g6vp.
Related Issues (20)
- 获取到的schema信息有误
- Using with G6VP "Vite" HOT 3
- 布局方案bug HOT 1
- 水印bug HOT 2
- “大图展览” 无法设置大图展示节点数限制 HOT 1
- pnpx @antv/gi-cli 报错,从 @antv/gi-cli 1.2.2 开始有这问题 HOT 3
- G6VP这个项目怎么进行私有化部署 HOT 6
- 请问G6VP项目能否离线部署 HOT 9
- Tugraph-DB 对于 G6VP 的需求清单
- html无法导出问题
- BUG: 前一布局动画未完成时,布局切换错误
- BUG: Cypher 语句查询的初始设置无效
- BUG:使用neo4j作为数据源时,样式定义文本字段未正确列举
- Is there any progress on G6VP V2 release date?
- pnpm install报错 HOT 1
- 图交互的一些需求(也可能是我没找到怎么配,求助) HOT 1
- 是否考虑增加Nebula数据源 HOT 1
- updateData and Layout not refresh HOT 1
- Do not call Hooks inside useEffect(...), useMemo(...) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from g6vp.