mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 19:49:02 +08:00
### What problem does this PR solve? feat: Increase the distance between nodes #162 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
parent
ad2e116367
commit
955619c8ac
@ -19,12 +19,22 @@ const finalData = { ...graphData, ...nextData };
|
||||
const ForceGraph = () => {
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
const size = useSize(containerRef);
|
||||
let graph: Graph;
|
||||
|
||||
const render = () => {
|
||||
const graph = new Graph({
|
||||
graph = new Graph({
|
||||
container: containerRef.current!,
|
||||
autoFit: 'view',
|
||||
behaviors: ['drag-element', 'drag-canvas', 'zoom-canvas'],
|
||||
behaviors: [
|
||||
'drag-element',
|
||||
'drag-canvas',
|
||||
'zoom-canvas',
|
||||
'collapse-expand',
|
||||
{
|
||||
type: 'hover-activate',
|
||||
degree: 1, // 👈🏻 Activate relations.
|
||||
},
|
||||
],
|
||||
plugins: [
|
||||
{
|
||||
type: 'tooltip',
|
||||
@ -44,20 +54,34 @@ const ForceGraph = () => {
|
||||
],
|
||||
layout: {
|
||||
type: 'combo-combined',
|
||||
comboPadding: 2,
|
||||
preventOverlap: true,
|
||||
comboPadding: 1,
|
||||
spacing: 20,
|
||||
},
|
||||
node: {
|
||||
style: {
|
||||
size: 20,
|
||||
labelText: (d) => d.id,
|
||||
labelPadding: 20,
|
||||
labelPadding: 30,
|
||||
// labelOffsetX: 20,
|
||||
labelOffsetY: 5,
|
||||
// labelOffsetY: 5,
|
||||
labelPlacement: 'center',
|
||||
labelWordWrap: true,
|
||||
},
|
||||
palette: {
|
||||
type: 'group',
|
||||
field: (d) => d.combo,
|
||||
},
|
||||
// state: {
|
||||
// highlight: {
|
||||
// fill: '#D580FF',
|
||||
// halo: true,
|
||||
// lineWidth: 0,
|
||||
// },
|
||||
// dim: {
|
||||
// fill: '#99ADD1',
|
||||
// },
|
||||
// },
|
||||
},
|
||||
edge: {
|
||||
style: (model) => {
|
||||
@ -77,6 +101,7 @@ const ForceGraph = () => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.info('rendered');
|
||||
render();
|
||||
}, []);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user