2010-08-20 65 views
0

我正在使用webcharts3d爲我的網頁創建一個測量圖。我想添加一個onclick事件到圖表 - 任何想法如何做到這一點?添加onclick活動到webcharts3d圖表嗎?

這裏是我的代碼:

<cfsavecontent variable="chartStyle"> 
<!--- xml chart style ---> 
</cfsavecontent> 
<cfsavecontent variable="chartModel"><?xml version="1.0" encoding="UTF-8"?> 
<XML type="default"> 
<COL>2000</COL> 
<cfoutput><ROW col0="#url.rating#">Sample 0:</ROW></cfoutput> 
</XML></cfsavecontent> 

<cfscript> 
    oMyWebChart = createObject("Java","com.gp.api.jsp.MxServerComponent"); 
    oMyApp = getPageContext().getServletContext(); 
    oSvr = oMyWebChart.getDefaultInstance(oMyApp); 
    oMyChart2 = oSvr.newImageSpec(); 
    oMyChart2.width = 120; 
    oMyChart2.height= 120; 
    oMyChart2.type = "swf"; 
    oMyChart2.style = "#chartStyle#"; 
    oMyChart2.model = "#chartModel#"; 
</cfscript> 

<cfsavecontent variable="chartImgTag"> 
    <cfoutput>#oSvr.getImageTag(oMyChart2,"http://myWebsite.com/CFIDE/GraphData.cfm?graphCache=wc50&graphID=")#</cfoutput> 
</cfsavecontent> 

    <cfoutput> 
    #chartimgtag# 
</cfoutput> 
+0

喜歡超鏈接?有些圖表模型具有「動作」屬性,但我沒有看到一個用於量表圖表。如果沒有,那麼將圖表包裹在錨定標記中怎麼樣? – Leigh 2010-08-20 19:05:02

回答

0

我最終做的是將圖表類型設置爲png而不是swf。然後我可以用錨標記包圍它。

oMyChart2.type = "png"; 

,而不是

oMyChart2.type = "swf"; 
+0

很高興我的想法工作;) – Leigh 2010-08-23 21:47:34

0

URL事件cfchart。你可以檢查出來。

+0

是的,但cfchart不直接支持量表圖表afaik。這就是他們使用上面的代碼而不是cfchart標籤的原因。 – Leigh 2010-08-22 17:43:56

0

這是爲我工作,保持oMyChart2.type = 「SWF」;

<!--- Extract the style from the WCP file ---> 
<cfset wcp = XMLParse(ExpandPath("reports/pie.wcp"))> 
<cfset wcp.project.style.pieChart.elements.XmlAttributes.action = "javascript:alert('$(colLabel)')"> 
<cfset chartStyle = ToString(wcp.project.style.pieChart)> 
+1

對不起,我忽略了OP是使用量表不餡餅。 – Metcalf 2012-02-28 20:53:57