- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xowiki::includelet::graph
::xowiki::includelet::graph create ... \
[ -__decoration (default "plain") ]
Class Relations
- class: ::xowiki::IncludeletClass
- superclass: ::xowiki::Includelet
- subclass: ::xowiki::includelet::activity-graph, ::xowiki::includelet::collab-graph
::xowiki::IncludeletClass create ::xowiki::includelet::graph \ -superclass ::xowiki::IncludeletMethods (to be applied on instances)
__decoration (setter)
graphHTML (scripted)
::xo::Page requireJS "/resources/ajaxhelper/prototype/prototype.js" set user_agent [string tolower [ns_set iget [ns_conn headers] User-Agent]] if {[string match "*msie *" $user_agent]} { # canvas support for MSIE ::xo::Page requireJS "/resources/xowiki/excanvas.js" } ::xo::Page requireJS "/resources/xowiki/collab-graph.js" ::xo::Page requireJS "/resources/ajaxhelper/yui/yahoo/yahoo.js" ::xo::Page requireJS "/resources/ajaxhelper/yui/event/event.js" set nodesHTML "" array set n $nodes foreach {node label} $nodes { set link "<a href='[ns_quotehtml $base?$attrib=$node]'>[ns_quotehtml $label]</a>" append nodesHTML "<div id='[ns_quotehtml $node]' style='position:relative;'> $link</div>\n" } set edgesHTML ""; set c 0 foreach p [lsort -index 1 -decreasing -integer $edges] { lassign $p edge weight width lassign [split $edge ,] a b #:log "--G $a -> $b check $c > $max_edges, $weight < $cutoff" if {[incr c] > $max_edges} break if {$weight < $cutoff} continue append edgesHTML "g.addEdge(\$('$a'), \$('$b'), $weight, 0, $width);\n" } # [lsort -index 1 -decreasing -integer $edges]<br>[set cutoff] - [set c]<br> return [subst -novariables { <div> <canvas id="collab" width="500" height="500" style="border: 0px solid black"> </canvas> [set nodesHTML] <script type="text/javascript" nonce='[security::csp::nonce]'> function draw() { if (typeof(G_vmlCanvasManager) == "object") { G_vmlCanvasManager.init_(window.document); } var g = new Graph(); [set edgesHTML] var layouter = new Graph.Layout.Spring(g); layouter.layout(); // IE does not pick up the canvas width or height $('collab').width=500; $('collab').height=500; var renderer = new Graph.Renderer.Basic($('collab'), g); renderer.radius = 5; renderer.draw(); } YAHOO.util.Event.addListener(window, 'load', draw); // YAHOO.util.Event.onContentReady('collab', draw); </script> </div> }]
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables