more reactive svgs

integration-tests
Josha von Gizycki 6 years ago
parent fd7fd9fe8b
commit 339016c174

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

Loading…
Cancel
Save