Class ::xowiki::includelet::graph
::xowiki::includelet::graph
create ... \
[ -__decoration (default "plain") ]
Class Relations
- class: ::xowiki::IncludeletClass
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- superclass: ::xowiki::Includelet
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- subclass: ::xowiki::includelet::activity-graph
, ::xowiki::includelet::collab-graph![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xowiki::IncludeletClass create ::xowiki::includelet::graph \
-superclass ::xowiki::Includelet
Methods (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]} {
::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
if {[incr c] > $max_edges} break
if {$weight < $cutoff} continue
append edgesHTML "g.addEdge(\$('$a'), \$('$b'), $weight, 0, $width);\n"
}
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>
}]