Rename VisGraph component to Graph

This commit is contained in:
Maciej Pędzich 2024-04-28 22:36:57 +02:00
parent 02908f7021
commit bbce0af92a
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D

View File

@ -1,7 +1,7 @@
--- ---
import type { Node, Edge, Options } from 'vis-network/esnext'; import type { Node, Edge, Options } from 'vis-network/esnext';
export interface Props { interface Props {
nodes: Node[]; nodes: Node[];
edges: Edge[]; edges: Edge[];
options?: Options; options?: Options;
@ -40,6 +40,26 @@ const { nodes, edges, options = {} } = Astro.props;
edges edges
}; };
const options: Options = { const options: Options = {
nodes: {
shape: 'box',
color: '#2060df',
font: {
color: '#fff'
}
},
edges: {
arrows: 'to',
color: '#4178e7'
},
layout: {
hierarchical: {
direction: 'UD',
sortMethod: 'directed',
nodeSpacing: 175,
levelSeparation: 80
}
},
physics: false,
...(JSON.parse(this.dataset.options as string) as Options) ...(JSON.parse(this.dataset.options as string) as Options)
}; };
@ -52,7 +72,7 @@ const { nodes, edges, options = {} } = Astro.props;
<style> <style>
div { div {
width: 100vw; width: 100%;
height: 100vh; height: 100%;
} }
</style> </style>