Skip to content

Instantly share code, notes, and snippets.

@abhijithanilkumar
Created April 8, 2016 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhijithanilkumar/4f8e7a9943c169aca9dca1bba1014240 to your computer and use it in GitHub Desktop.
Save abhijithanilkumar/4f8e7a9943c169aca9dca1bba1014240 to your computer and use it in GitHub Desktop.
#Run this code in Escher
using NetworkViz
using LightGraphs
main(window) = begin
num = Signal(10)
width = Signal(1)
nodesize = Signal(0.2)
edgewidth = Signal(0.5)
toggle = Signal(true)
g = WheelGraph(20)
c = Color[parse(Colorant,"#00004d") for i in 1:nv(g)]
push!(window.assets,("ThreeJS","threejs"))
push!(window.assets,"widgets")
vbox(
h1("Change Properties Example"),
vskip(2em),
vbox(
"Node Size",
slider(0:5) >>> nodesize
),
vskip(2em),
vbox(
"Edge Thickness",
slider(0:10) >>> edgewidth
),
vskip(2em),
vbox(
"Circle/Square Nodes",
hskip(2em),
togglebutton() >>> toggle
),
vskip(2em),
map(toggle,nodesize,edgewidth) do t,nsize,ewidth
n = NodeProperty(c,nsize,t)
e = EdgeProperty("#ff3333",ewidth)
@show nsize,ewidth,t
drawGraph(g,node=n,edge=e,z=1)
end
) |> pad(2em)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment