var graph = {
nodes:[
{x:100 , y:300, color:'black', size:10, id:0},
{x:600 , y:300, color:'black', size:10, id:1}
],
links:[
{
id:0,
source:0,
target:1,
interpolation:'cardinal',
colorLink:'lightGrey',
sizeLink:12,
colorParticule:'black',
widthParticule:20,
heightParticule:3,
patternParticule:[10,2,10],
patternType:'absolute',
frequencyParticule:1,
speedParticule:150
}
]
}
var flownetGraph = flownet.graph('#view')
.nodes(graph.nodes)
.links(graph.links)
// Mapping viusal variable on nodes
.node_properties('x', function(d, i){ return d.x})
.node_properties('y', function(d, i){ return d.y})
.node_properties('color', function(d, i){ return d.color})
.node_properties('size', function(d, i){ return d.size})
.node_properties('label_text', function(d, i){return 'id:'+d.id})
.node_properties('label_x', function(d){ return d.x+12})
.node_properties('label_y', function(d){ return d.y-12})
.node_properties('label_size', 16)
.node_properties('label_font', 'arial')
.node_properties('label_color', 'black')
// Mapping viusal variable on links
.link_properties('points', function(d,i){ return [{x:250,y:400},{x:450,y:200}]})
.link_properties('interpolation', function(d,i){ return d.interpolation})
.link_properties('color', function(d,i){ return d.colorLink})
.link_properties('size', function(d,i){ return d.sizeLink})
// Mapping viusal variable on particles
.particles('color', function(d,i){ return "black"})
.particles('size', function(d,i){ return 10})
.particles('height', function(d,i){ return 2})
//.particles("computationalMethod", "Speed-Frequency-RelativePattern")
.particles('speed', function(d,i){ return 40})
.particles("frequency", 1)
.particles('pattern', function(d,i){ return [0.0,0.3]})
/*
.particles("computationalMethod", "Speed-Frequency-AbsolutePattern")
.particles('speed', function(d,i){ return 40})
.particles("frequency", 1)
.particles('visual_pattern', function(d,i){ return [10,2,10]})
*/
/*
.particles("computationalMethod", "Speed-Spacing-RelativePattern")
.particles('speed', function(d,i){ return 40})
.particles("spacing", 60)
.particles('pattern', function(d,i){ return [0.0,0.3]})
*/
/*
.particles("computationalMethod", "Speed-Spacing-AbsolutePattern")
.particles('speed', function(d,i){ return 40})
.particles("spacing", 60)
.particles('visual_pattern', function(d,i){ return [10,2,10]})
*/
.start()