ColdFusion 9.0 Resources |
Using the Chart classThe Chart class is the proxy for the ColdFusion Chart service, which provides the functionality of the cfchart tag and its child chartdata and chartseries tags.
The following example shows how you can use the chart service: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:cf="coldfusion.service.mxml.*" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; [Bindable] public var chaSer:Array; public var chaDat:Array; function init():void { chaDat = [{item:"Facilities",value:"35000"}, {item:"Facilities1",value:"32000"}]; chaSer = [{type:"bar",chartdata:chaDat}, {type:"line",chartdata:chaDat}];chartest.execute(); } function handleResult(event:ResultEvent):void { Alert.show("success" + event.result.toString()); } function handleFault(event:FaultEvent):void { Alert.show("failure" + event.toString()); } ]]> </mx:Script> <cf:Config id="configid" cfServer="localhost" cfPort="80" servicePassword="service" serviceUserName="service" > </cf:Config> <cf:Chart id="chartest" action="generate" format="jpg" xAxisTitle="Department" yAxisTitle="Salary Average" chartSeries="{chaSer}" result="handleResult(event)" fault="handleFault(event)" backgroundColor = "Black" chartHeight = "500" chartWidth = "600" dataBackgroundColor = "yellow" font = "ariel" fontBold = "yes" fontItalic = "yes" fontSize = "12" foregroundColor = "red" gridLines = "2" labelFormat = "number" markerSize = "10" showBorder = "yes" showLegend = "yes" showMarkers = "yes" showxGridLines="yes" showyGridLines="yes" tipBgColor="blue" tipStyle = "MouseOver" title = "AIR Integration testing"/> </mx:Application> |