Listing 1

<cfcomponent>
<cffunction name="GenerateChart"
access="public" output="yes"
returntype="string">
<!--- BEGIN ARG DECLARATION -
-->
<cfargument
name="CARG_LABELS" type="string"
required="true">
<cfargument name="CARG_VALUES"
type="string" required="true">
<cfargument name="CARG_VALUES2"
type="string"
required="true">
<cfargument
name="CARG_SERIES1CAPTION"
type="string" required="true">
<cfargument
name="CARG_SERIES2CAPTION"
type="string" required="true">
<cfargument name="CARG_WIDTH"
type="numeric" required="true">
<cfargument
name="CARG_HEIGHT" type="numeric"
required="true">
<cfargument name="CARG_ANIMATE"
type="boolean"
required="true">
<cfargument name="CARG_CHARTNAME"
type="string"
required="true">
<cfargument name="CARG_CHARTSUBTITLE"
type="string"
required="true">
<cfargument name="CARG_CHARTSTYLE" type="string"
required="true">
<!--- LOCAL VARIABLES --->
<cfscript>
var seperator = "|";
var ignoremultseperators = true;
var chartoutput = "";
</cfscript>
<!--- INSTANTIATE CHART OBJECT --->
<cfobject type="com" name="chart"
class="SwiffChartObject.ChartObj.1" action="create">
<cfscript>
ignoremultseparators= true;
chart.SetSeparators(seperator, ignoremultseparators);
// SET THE CHART LABELS
chart.SetCategoriesFromString(arguments.CARG_LABELS);
// ADD ONE SERIES AND SET THE CHART VALUES
chart.AddSeries();
chart.SetSeriesValuesFromString(0,
arguments.CARG_VALUES);
chart.SetSeriesCaption(0,
arguments.CARG_SERIES1CAPTION);
// IF ANOTHER SERIES IS PASSED ADD IT TO THE CHART
if(Len(arguments.CARG_VALUES2) gt 0){
chart.AddSeries();
chart.SetSeriesValuesFromString(1,
arguments.CARG_VALUES2);
chart.SetSeriesCaption(1,
arguments.CARG_SERIES2CAPTION);
}
// SET THE CHART TITLE
chart.SetTitle( arguments.CARG_CHARTNAME );
// IF A SUBTITLE IS PASSED
if(Len(arguments.CARG_CHARTSUBTITLE)){
chart.SetSubtitle(arguments.CARG_CHARTSUBTITLE);
}
// APPLY THE CHART STYLE
chart.LoadStyle( arguments.CARG_CHARTSTYLE );
// VARIOUS PARAMETERS
chart.SetWidth( arguments.CARG_WIDTH );
chart.SetHeight( arguments.CARG_HEIGHT );
chart.SetLooping( false );
chart.CompressSWF( true);
chart.AnimateChart( arguments.CARG_ANIMATE );
// GET THE HTML FOR THE CHART AND OUTPUT IT
chartoutput = chart.GetHTMLTag();
writeoutput(chartoutput);
</cfscript>
</cffunction>
</cfcomponent>