diff --git a/src/wanijo/visualisation/viz.clj b/src/wanijo/visualisation/viz.clj index 3990ad2..83ea800 100644 --- a/src/wanijo/visualisation/viz.clj +++ b/src/wanijo/visualisation/viz.clj @@ -1,5 +1,6 @@ (ns wanijo.visualisation.viz - (:require [dorothy + (:require [clojure.string :refer [replace] :rename {replace sreplace}] + [dorothy [core :as dot] [jvm :as doro-jvm]] [wanijo.framework.routing :refer [path]])) @@ -12,6 +13,13 @@ "\n" (:name node2)))) +(defn render [data] + (-> data + dot/digraph + dot/dot + (doro-jvm/render {:format :svg}) + (sreplace #"width=\"[0-9]+pt\"" ""))) + (defn single-instance [instance] (let [out-nodes (map #(vector (-> % :target :uuid) {:label (node->label (:target %)) @@ -40,9 +48,7 @@ (into in-nodes) (into relationships-out) (into relationships-in) - dot/digraph - dot/dot - (doro-jvm/render {:format :svg})))) + render))) (defn all-instances [instances] (let [sources (map #(vector (-> % :source :uuid) @@ -57,11 +63,7 @@ {:label (-> % :link :name)}) linked)] (-> [{:forcelabels "true" - :rankdir "LR" -;; :splines "ortho" - }] + :rankdir "LR"}] (into sources) (into links) - dot/digraph - dot/dot - (doro-jvm/render {:format :svg})))) + render)))