new G6.Layout.comboCombined giving different coordinate results than normal comboCombined initialization #4797
bsansone posted onGitHub
Describe the bug
I am using the comboCombined
layout type to render my graph in the browser which works fine, but for some graphs that are large we want to calculate the layout (get the x, y coordinates) on the server. I assumed this can be done by doing:
const comboCombinedLayout = new G6.Layout.comboCombined();
comboCombinedLayout.init({
nodes,
edges,
combos,
});
comboCombinedLayout.execute();
const results = {
nodes: comboCombinedLayout.nodes,
edges: comboCombinedLayout.edges,
combos: comboCombinedLayout.combos,
};
// these x, y coordinates are not the same
console.log(results);
The results however are different than what I would normally get with:
new G6.Graph({
...options,
layout: {
type: "comboCombined",
},
});
Your Example Website or App
https://codesandbox.io/s/infallible-ptolemy-hz8jq6?file=/src/index.js
Steps to Reproduce the Bug or Issue
Go to https://codesandbox.io/s/infallible-ptolemy-hz8jq6?file=/src/index.js
Notice the
layoutCfg
is set to use the defaultcomboCombined
layout type and the graph renders correctly.const layoutCfg = { // For @antv/g6 type: "comboCombined" // For @antv/layout // we already have the x, y gathered from the layout method // type: null };
Comment out
type: "comboCombined"
and uncomment// type: null
This will cause the layout to be computed via
const comboCombinedLayout = new G6.Layout.comboCombined({
, leaving the layout type =null
will tell the graph we have predefined x, y coordinates to use.Notice after saving that the graph does not look the same as the original and the x, y coordinates are different
Expected behavior
I expected using the built-in new G6.Layout.comboCombined
method to act the same as the layout: { type: "comboCombined" }
config so that the coordinates can be computed on the server.
Screenshots or Videos
Expected Results:
Actual Results:
Platform
- OS: Ubuntu Linux
- Browser: Chrome
- Version: 115.0.5790.170 (Official Build) (64-bit)
- G6 Version: 4.8.8
Additional context
No response