Pimp the graph

This commit is contained in:
Aaron Fischer 2015-12-05 23:41:04 +01:00
parent bacd2a2f5f
commit 77da1bf687

View file

@ -2,18 +2,26 @@
(:use [tangle.core]) (:use [tangle.core])
(:require [mailhead.parser :as parser])) (:require [mailhead.parser :as parser]))
(defn nodes [receive-path] [:a :b :c]) (defn nodes [receive-path] ["home" "servera" "target"])
(defn edges [receive-path] [[:a :b {:label "200ms"}] (defn edges [receive-path] [["home" "servera" {:label "200ms" :fillcolor "gray" :color "gray"}]
[:b :c {:label "50min"}]]) ["servera" "target" {:label "50min" :fillcolor "gray" :color "gray"}]])
(defn draw-path [receive-path] (defn draw-path [receive-path]
(-> (graph->dot (-> (graph->dot
(nodes receive-path) (nodes receive-path)
(edges receive-path) (edges receive-path)
{:node {:shape :box} {:node {:shape :box
:fontname "Arial"
:fontsize 12
:style "filled"
:fillcolor "darkgoldenrod1"
:color "darkgoldenrod3"}
:edge {:fontname "Arial"
:fontsize 10}
:directed? true :directed? true
:graph {:rankdir :LR}}) :graph {:rankdir :LR
:color "transparent"}})
(dot->image "png"))) (dot->image "png")))
(defn draw [filename] (defn draw [filename]