var bgCanvas = { 'styles': { 'strokeStyle': '#555' }, 'impl': { 'init': function(){}, 'plot': function(canvas, ctx){ var times = 6, d = 100; var pi2 = Math.PI * 2; for (var i = 1; i <= times; i++) { ctx.beginPath(); ctx.arc(0, 0, i * d, 0, pi2, true); ctx.stroke(); ctx.closePath(); } } } } //Take off previous width and height styles and //add half of the *actual* label width to the left position. //That will center your label (do the math man). function fOnPlaceLabel(domElement, node) { domElement.innerHTML = node.name; var left = parseInt(domElement.style.left); domElement.style.width = ''; domElement.style.height = ''; var w = domElement.offsetWidth; domElement.style.left = (left - w /2) + 'px'; } //Add a controller to make the tree move on click. function fOnCreateLabel(domElement, node) { domElement.innerHTML = node.name; domElement.onclick = function() { rgraph.onClick(node.id); }; }

menu | centrer