ColdFusion Tip: Using the included webcharts3d engine in CFMX 7
If you're not aware of it, Macromedia licensed the WebCharts 3D engine with CFMX 7 and if you dig around you can find the WebCharts Designer 5.0 as part of the distribution. In the multi-server installation, the default path is C:\\JRun4\\servers\\cfusion\\cfusion-ear\\cfusion-war\\WEB-INF\\cfusion\\charting.
This means that if you want to go beyond the standard charts available using the cfchart tag, you can access the WebCharts engine using Java or even design your your own charts with the designer. This gives you access to the entire gallery that is provided by the WebCharts 3D engine. (I'm assuming this as I haven't tested the other charts).
The only setup necessary is that you have to add an "Images" folder to the charting cache directory in the ColdFusion administrator since the webcharts getImageTag function prepends that to the file name.
Below is an example based on the WebCharts example code.
<cfsaveContent variable="chartStyle">
<frameChart is3D="false">
<frame xDepth="12" yDepth="11" isHStripVisible="true" stripColor="#40CCAAEE"/>
<xAxis isAntialiased="true">
<labelFormat pattern="#,##0.###"/>
<parseFormat pattern="#,##0.###"/>
<titleStyle font="Arial-12-bold">Year </titleStyle>
</xAxis>
<yAxis scaleMin="0" isAntialiased="true">
<labelFormat pattern="#,##0.###"/>
<parseFormat pattern="#,##0.###"/>
<titleStyle font="Arial-12-bold">
<![CDATA[ Sales ('000) ]]>
</titleStyle>
</yAxis>
<legend spacing="0" halign="Right" isAntialiased="true">
<decoration style="None"/>
</legend>
<elements drawShadow="true">
<morph morph="Grow"/>
</elements>
<title halign="Left" isAntialiased="true" font="Arial-12-bold"
foreground="blue" isMultiline="false">
<decoration style="None"/>Computer Sales by Year
</title>
<popup background="#CCFFFF" isAntialiased="true" foreground="black"/>
<paint isVertical="true" min="47" max="83"/>
</frameChart>
</cfsaveContent>
<cfsavecontent variable="chartModel">
<?xml version="1.0" encoding="UTF-8"?>
<XML type="default">
<COL>2000</COL>
<COL>2001</COL>
<COL>2002</COL>
<COL>2003</COL>
<COL>2004</COL>
<ROW col0="100.0" col1="200.0" col2="100.0" col3="180.0" col4="200.0">Laptops</ROW>
<ROW col0="150.0" col1="300.0" col2="250.0" col3="230.0" col4="250.0">Desktops</ROW>
</XML>
</cfsavecontent>
<cfobject action="create" type="java"
class="com.gp.api.jsp.MxServerComponent" name="myWebChart">
<cfscript>
myApp = getPageContext().getServletContext();
svr = myWebChart.getDefaultInstance(myApp);
myChart = svr.newImageSpec();
myChart.width = 320 ;
myChart.height= 300 ;
myChart.type = "PNG" ;
myChart.style = "#chartStyle#";
myChart.model = "#chartModel#";
</cfscript>
<cfoutput>#svr.getImageTag(myChart,"getWebChart.cfm?chartName=")#</cfoutput>



There are no comments for this entry.
[Add Comment]