views:

44

answers:

2

I am using webcharts3d to create a gauge graph for my webpage. I want to add an onclick event to the chart- any idea how to do that?

Here is my code:

<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&amp;graphID=")#&lt;/cfoutput&gt;
</cfsavecontent>

  <cfoutput>
  #chartimgtag#
 </cfoutput>
A: 

There is URL event in cfchart. You can check it out.

ppshein
Yes, but cfchart does not support gauge charts directly afaik. That is why they are using the code above and not cfchart tags.
Leigh
A: 

What I ended up doing was setting the chart type to png instead of swf. Then I was able to surround it with an anchor tag.

oMyChart2.type = "png"; 

instead of

oMyChart2.type = "swf"; 
dmr
Glad my idea worked ;)
Leigh