mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-12 21:28:59 +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 ForceGraph = () => {
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
const size = useSize(containerRef);
|
const size = useSize(containerRef);
|
||||||
|
let graph: Graph;
|
||||||
|
|
||||||
const render = () => {
|
const render = () => {
|
||||||
const graph = new Graph({
|
graph = new Graph({
|
||||||
container: containerRef.current!,
|
container: containerRef.current!,
|
||||||
autoFit: 'view',
|
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: [
|
plugins: [
|
||||||
{
|
{
|
||||||
type: 'tooltip',
|
type: 'tooltip',
|
||||||
@ -44,20 +54,34 @@ const ForceGraph = () => {
|
|||||||
],
|
],
|
||||||
layout: {
|
layout: {
|
||||||
type: 'combo-combined',
|
type: 'combo-combined',
|
||||||
comboPadding: 2,
|
preventOverlap: true,
|
||||||
|
comboPadding: 1,
|
||||||
|
spacing: 20,
|
||||||
},
|
},
|
||||||
node: {
|
node: {
|
||||||
style: {
|
style: {
|
||||||
size: 20,
|
size: 20,
|
||||||
labelText: (d) => d.id,
|
labelText: (d) => d.id,
|
||||||
labelPadding: 20,
|
labelPadding: 30,
|
||||||
// labelOffsetX: 20,
|
// labelOffsetX: 20,
|
||||||
labelOffsetY: 5,
|
// labelOffsetY: 5,
|
||||||
|
labelPlacement: 'center',
|
||||||
|
labelWordWrap: true,
|
||||||
},
|
},
|
||||||
palette: {
|
palette: {
|
||||||
type: 'group',
|
type: 'group',
|
||||||
field: (d) => d.combo,
|
field: (d) => d.combo,
|
||||||
},
|
},
|
||||||
|
// state: {
|
||||||
|
// highlight: {
|
||||||
|
// fill: '#D580FF',
|
||||||
|
// halo: true,
|
||||||
|
// lineWidth: 0,
|
||||||
|
// },
|
||||||
|
// dim: {
|
||||||
|
// fill: '#99ADD1',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
edge: {
|
edge: {
|
||||||
style: (model) => {
|
style: (model) => {
|
||||||
@ -77,6 +101,7 @@ const ForceGraph = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.info('rendered');
|
||||||
render();
|
render();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user