Temp working point

This commit is contained in:
Daniel Compton 2016-11-09 14:39:39 +13:00
parent b3d64dd7a8
commit c6384dcd74
No known key found for this signature in database
GPG Key ID: A6E4DC5283B5DCEC
1 changed files with 170 additions and 165 deletions

View File

@ -228,7 +228,8 @@
[force-outer traces-ratom]
[:hr]
[:h2 {:on-click #(swap! desc inc)} "Click"]
[(d3t/create-d3 {:render-component (fn [ratom]
[(d3t/create-d3
{:render-component (fn [ratom]
[:div
[:h1 (str "SVG")]
[:svg#d3cmp {:width width :height height}]])
@ -277,8 +278,6 @@
(attr "stroke-width" (fn [d] (Math/sqrt (.-value d))))
)
link-sel (.. svg
(selectAll ".links > line"))
node (.. (. svg append "g")
(attr "class" "nodes")
@ -297,18 +296,22 @@
(on "drag" dragged)
(on "end" dragended))))
circle-sel (.. svg
(selectAll ".node > circle"))
label (.. node
(append "text")
(attr "dy" ".35em")
(text #(gob/get % "title" "")))
label-sel (.. svg
(selectAll ".node > text"))
ticked (fn []
(let [link-sel (.. svg
(selectAll ".links > line"))
circle-sel (.. svg
(selectAll ".node > circle"))
label-sel (.. svg
(selectAll ".node > text"))]
(.. link-sel
(attr "x1" (fn [d] (.. d -source -x)))
(attr "y1" (fn [d] (.. d -source -y)))
@ -319,18 +322,19 @@
(attr "cy" (fn [d] (min-max (.. d -r) (.. d -y) (- height (.. d -r))))))
(.. label-sel
(attr "x" #(+ (.-x %) 2 (.-r %)))
(attr "y" #(+ (.-y %))))
(attr "y" #(+ (.-y %)))))
nil)
]
(.. simulation
(nodes nodes)
(on "tick" ticked))
(.. simulation
(force "link")
(links links))))
(links links))
))
:d3-enter (fn [ratom]
(let [graph (trace->sub-graph @ratom)
nodes (clj->js (:nodes graph))
links (clj->js (:links graph))
@ -338,6 +342,9 @@
svg @svg-a
color @color-a
simulation @simulation-a
_ (js/console.log "d3ent" (.. svg
(selectAll ".links > line")
size))
dragstarted (fn [d]
(when (zero? (.. js/d3 -event -active))
@ -395,12 +402,10 @@
(.. simulation
(force "link")
(links links))
)
(println "D3 did enter"))}
(println "D3 did enter")
(js/console.log "d3 ent done" (.. svg
(selectAll ".links > line")
size))))}
traces-ratom)]
[:hr]])))