Skip to content

Commit

Permalink
add graphviz sandbox route
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenClontz committed Nov 4, 2024
1 parent d172e04 commit 9be5ef2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/viewer/src/components/GraphViz/GraphViz.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
import * as d3 from 'd3'
import * as graphviz from 'd3-graphviz'
export let dot = 'digraph {a -> b}'
let graphDiv : HTMLElement
let graphDiv: HTMLElement
onMount(() => {
d3.select(graphDiv).graphviz().renderDot(dot)
})
$: if (graphDiv) { d3.select(graphDiv).graphviz().renderDot(dot) }
</script>

<div bind:this={graphDiv} style="text-align: center;" />
11 changes: 11 additions & 0 deletions packages/viewer/src/routes/(app)/dev/graph/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script lang="ts">
import Title from '@/components/Shared/Title.svelte'
import { GraphViz } from '@/components/GraphViz'
let dot = 'digraph {a -> b}'
</script>

<Title title="GraphViz" />

<input type="text" bind:value={dot} />

<GraphViz {dot} />

0 comments on commit 9be5ef2

Please sign in to comment.