32 lines
977 B
Clojure
32 lines
977 B
Clojure
(ns mailhead.visualize
|
|
(:use [tangle.core])
|
|
(:require [mailhead.parser :as parser]))
|
|
|
|
(defn nodes [receive-path] ["home" "servera" "target"])
|
|
|
|
(defn edges [receive-path] [["home" "servera" {:label "200ms" :fillcolor "gray" :color "gray"}]
|
|
["servera" "target" {:label "50min" :fillcolor "gray" :color "gray"}]])
|
|
|
|
(defn draw-path [receive-path]
|
|
(-> (graph->dot
|
|
(nodes receive-path)
|
|
(edges receive-path)
|
|
{:node {:shape :box
|
|
:fontname "Arial"
|
|
:fontsize 12
|
|
:style "filled"
|
|
:fillcolor "darkgoldenrod1"
|
|
:color "darkgoldenrod3"}
|
|
:edge {:fontname "Arial"
|
|
:fontsize 10}
|
|
:directed? true
|
|
:graph {:rankdir :LR
|
|
:color "transparent"}})
|
|
(dot->image "png")))
|
|
|
|
(defn draw [filename]
|
|
(draw-path (parser/parse-from-file filename)))
|
|
|
|
(draw "/home/aaron/workbench/clojurecup2015/sample-data/header1.eml")
|
|
|