Get the data from selected row and show it in the graphics

i am trying to show a graph when the user selects a row in the data grid but the chart is not showing up.  i am able to pull the data from the backend using php/mysql and populating the data grid successfully but i would like to show a chart based on what the user selects in the data grid.  pls. help.
Note, i am using flash builder 4
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="" 
			   xmlns:mx="library://" minWidth="955" minHeight="600" xmlns:summarybyallservice="services.summarybyallservice.*"
			import mx.controls.Alert;
			import mx.collections.ArrayCollection;
			import mx.utils.ArrayUtil;
			private var mydata:ArrayCollection = new ArrayCollection();
			private var ac:ArrayCollection;
			/* Array for moving up and down */
			private var pos:Array = [1,2,3];
			/* Radius for the pie chart */       
			private var explRadius:Array = new Array();
			private function initApp():void
			protected function summarybyallService_resultHandler(event:ResultEvent):void
				mydata = event.result as ArrayCollection;
			private function selectRow(e:ListEvent):void
				var j:int;
					for(j;j< explRadius.length; j++)
					explRadius[e.columnIndex -1]=.2;
					ac = new ArrayCollection([
						{Years:"Act FY10",, /2 },
						{Years:"Act FY11", , /2},
						{Years:"Ann FY11",, /2 }
					theColumnChart.dataProvider =ac;
					/*thePieSeries.perWedgeExplodeRadius = explRadius; */

		<s:CallResponder id="getAllSummary_by_allResult"/>
		<summarybyallservice:SummarybyallService id="summarybyallService" 
												 fault=" + '\n' + event.fault.faultDetail)" 
		<!-- Place non-visual elements (e.g., services, value objects) here -->
		<!-- Define chart effects -->
		<!--Column chart effect-->
		<mx:SeriesSlide id="slideIn" duration="1000" direction="up"/>
		<mx:SeriesSlide id="slideOut" duration="1000" direction="down" />
		<mx:SolidColor id="sc0" color="red" alpha=".3"/>
		<mx:Stroke id="stroke0" color="red" weight="1" alpha=".8"/>
	<mx:DataGrid x="76" y="68" id="dGrid" dataProvider="{mydata}" width="427"
			<mx:DataGridColumn headerText="Category" dataField="category"/>
			<mx:DataGridColumn headerText="Actual FY10" dataField="Actual_FY10"/>
			<mx:DataGridColumn headerText="Actual FY11" dataField="Actual_FY11"/>
			<mx:DataGridColumn headerText="Annualized FY11" dataField="Anualized_FY11"/>
	<mx:ColumnChart id="theColumnChart" 
					height="121" width="411"
					type="clustered" y="238" x="76">
			<mx:LinearAxis minimum="0" maximum="1500"/>


Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

It seems to work for me. You do have to CLICK a datagrid column to populate the graph. Maybe you want to change
change="selectRow(event)" ?

Because I don't have the summarybyallService code, to test this, I replaced the summarybyall service invocation with an assignment of a hard coded array collection to the one bound to the datagrid dataprovider:

mydata =new ArrayCollection([
karinos57Author Commented:
thanks for your quick response.  i have tried your suggestion but still not working.  i can see the graph but without the bars or the spend; see attached.  thanks
The problem is that your data is larger than the limit for the graph.

You have
                        <mx:LinearAxis minimum="0" maximum="1500"/>
The smallest value in the screenshot you attached is like 200 million, so it is just to big to register on an axis whose maximum is 1500. Try changing the maximum to 1000000000.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

karinos57Author Commented:
it is working like a charm, thank you very much.  one last question:
how can i format the numbers with dolar signs and with no decimial.  I would like to see currency with no decimal.  thanks again for your time
Put this in your script area:

protected function myLabelFunction(item:Object, dgc:DataGridColumn):String{
     var str:String = item[dgc.dataField];
     return "$" + (str.indexOf(".") > -1) ? str.substring(0,str.indexOf(".")) : str;

Then, for each datagridcolumn that you want to format like that, add:
Oops! Left out a crucial set of parentheses:

protected function myLabelFunction(item:Object, dgc:DataGridColumn):String{
     var str:String = item[dgc.dataField];
     return "$" + ((str.indexOf(".") > -1) ? str.substring(0,str.indexOf(".")) : str);

Open in new window

karinos57Author Commented:
it is working fine but the numbers are not rounded up.  is there a way to round up the numbers - i don't know if i have to use currency formatter class.  thanks again for your help.
protected function myLabelFunction(item:Object, dgc:DataGridColumn):String {
       var str:int = Math.round(item[dgc.dataField]);
       return "$" + str;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
karinos57Author Commented:
thank you very much.  it is working like a charm.  the only thing i would like to ask is to put comma in the proper place within the numbers but i already asked too much.  thanks again.
No, I think I can spare a numberformatter example:
        . . .
  private var nf:NumberFormatter;

  private function initApp():void {
            nf = new NumberFormatter();
            nf.useThousandsSeparator = true;
            nf.precision = 0;
  protected function myLabelFunction(item:Object, dgc:DataGridColumn):String {
            return "$" + nf.format(Math.round(item[dgc.dataField]));

Open in new window

karinos57Author Commented:
i am getting 2 errors:
the first one at this line: private var nf:NumberFormatter;
and the error is
1046: Type was not found or was not a compile-time constant: NumberFormatter.      

2nd at this line:nf = new NumberFormatter();
and the error is :
"Call to a possibly undefined method NumberFormatter."
import mx.formatters.NumberFormatter;
up there with the other import statements.
karinos57Author Commented:
you are the man.  thnx again.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Flex

From novice to tech pro — start learning today.