-> We have to develop a flex application where we call web service and use the data to update xml file and render the angle gauge widget.
-> Firstly we call web service and get all the data.
-> next Load xml file from the folder and update the dial value and upperlimit value in the xml file using the data got from web service.
-> then use that xml file to render the chart.
Here is the code-->
<?xml version="1.0" encoding="utf-8"?>
<s:BorderContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:mgemws="services.mgemws.*"
xmlns:components="com.fusionwidgets.components.*"
initialize="bordercontainer1_creationCompleteHandler(event)" >
<fx:Script>
<![CDATA[
[Bindable]
public var LatestkW:String;
[Bindable]
public var PeakkW:String;
[Bindable]
public var SumkWh:String;
protected var xmlLoader:URLLoader;
[Bindable]
public var loadSupplyXml:XML = new XML;
protected function bordercontainer1_creationCompleteHandler(event:FlexEvent):void
{
getLoadSupplyResult.token = mGEMWS.getLoadSupply("4", "715"); //sending id to getLoadSupply method to get data from Web Service
}
public function init():void
{
xmlLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE,setData);
xmlLoader.load(new URLRequest("data/loadSupply.xml")); //loading xml file
}
protected function setData(event:Event):void
{
loadSupplyXml = XML(event.target.data);
loadSupplyXml.@upperLimit = PeakkW;
loadSupplyXml.dials[0].dial.@value = LatestkW;
Alert.show(loadSupplyXml); //shows updated Xml file(it works)
fw.FCDataXML = loadSupplyXml;
fw.FCRender(); //{doesnt work. shows "No data to display"}
}
protected function getLoadSupplyResult_resultHandler(event:ResultEvent):void
{
LatestkW = getLoadSupplyResult.lastResult[0]; //returns the data from web service
PeakkW = getLoadSupplyResult.lastResult[1];
SumkWh = getLoadSupplyResult.lastResult[2];
//once values are got load xml file, update values and apply to chart
init();
}
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getLoadSupplyResult" result="getLoadSupplyResult_resultHandler(event)"/>
<mgemws:MGEMWS id="mGEMWS" showBusyCursor="true" />
</fx:Declarations>
<components:FusionWidgets id="fw" FCChartType="AngularGauge" FCDataXML="{loadSupplyXml}"/>
</s:BorderContainer>
and the loadSupply.xml is-->
<?xml version="1.0" encoding="UTF-8"?>
<chart decimals="2" palette="2" autoScale="1" showBorder="0" basefontColor="ffffff" gaugeFillRatio="3" bgAlpha='0,0' pivotRadius="6" gaugeInnerRadius="60%"
showTickValues="1" tickValueStep="2" placeTicksInside="0" placeValuesInside="0" showToolTip="1" baseFontSize="9" adjustTM="0" numberSuffix="kW"
pivotFillColor="000000" dataStreamURL="" gaugeStartAngle="225" gaugeEndAngle="-45" gaugeOuterRadius="75" upperLimit="150" lowerLimit="0">
<colorRange>
<color minValue="0" maxValue="1" code="bbbaba"/>
</colorRange>
<dials>
<dial value="29.11" rearExtension="10" baseWidth="10" bgColor="000000"/>
</dials>
</chart>
when i run the application it calls the webservice, get the data, loads the xml file and update the xml file. but when fw.FCDataXML = loadSupplyXml; fw.FCRender(); are used it doesnt renders the gauge.
it shows "No data to display".
Can anyone please help me out in solving the issue..?
Regards,
Sushma
This post has been edited by Sushma N: 13 April 2011 - 08:51 AM

Back to top
MultiQuote