2011-05-30 39 views

回答

1

解決方案之一可能是這樣的。

//下面是簡單的動畫標記

chart1.connectToPlot("default", function (e){ 
var ele = e.shape ? e.shape.rawNode ? e.shape.rawNode : false : false; 
    if(!ele) return; 
if(e.type == "onmouseover") 
ele.setAttribute("stroke-width", 3) 
else if (e.type == "onmouseout") 
ele.setAttribute("stroke-width", 1.5) 
} 

您可以使用此功能爲原料SVG節點的一些複雜的動畫。不要在上面的代碼中調用setAttrbuite,而是調用下面的函數,將原始svg節點傳遞給它。

function cmplxAnimForRawNode(RawSVGNode){ 
     var svgNS = "http://www.w3.org/2000/svg";  
     var node = document.createElementNS(svgNS, "animateTransform"); 
     var atts = {attributeType:"XML", attributeName:"transform", type:"scale" ,from:"1" ,to:"0" ,dur:"5s", fill:"freeze"} 
     for(name in atts) { 
      node.setAttributeNS(null, name, atts[name]); 
     } 
     RawSVGNode.appendChild(node); 

     }