cancel
Showing results for 
Search instead for 
Did you mean: 

simple Flex Chart question - Plot Chart labels

Former Member
0 Kudos

I'm playing around with displaying data from WDA as charts in Flex 3.

I'm able to bind my internal table, which has 3 fields, to the plot chart.

The table looks like this


ext_id      type string    " bound to prjname in Flex
cost         type string    " bound to prjcost in Flex
benefit     type string    " bound to prjbenefit in Flex

These are all bound to my island's DataSource.

I have bound these in Flex and the Cost and Benefits are showing up as points on my chart. However, I can't seem to get the Project Name to display on the plot points. All I see when I mouse over the point is EXT_ID, and the values for cost and benefits.

The cost/benefit values are coming across correctly, just not the project name (ext_id) value. any ideas?

here's the Flex code for the chart


     [Bindable]
     public var dataSource:ArrayCollection;
     [Bindable]
     public var prjcost:String; 
     [Bindable]
     public var prjbenefit:String;
     [Bindable]
     public var prjname:String;.
.
.
    <mx:PlotChart id="plotchart1" dataProvider="{dataSource}" showDataTips="true">
       <mx:series>
            <mx:PlotSeries displayName="{prjname}" yField="{prjcost}" xField="{prjbenefit}" dataProvider="/>
        </mx:series>
    </mx:PlotChart>

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

This is because your public bindable variables prjcost, prjbenefit, and prjname literally are just holding the attribute name of the context that dataSource is bound to. This works for yField and xField because those properites of the PlotSeries expect an attribute name relative to the parent dataProvider. However the displayName property is different. It doesn't assume the value is relative to the dataProvider.

Former Member
0 Kudos

thanks for the explanation...

so the next logical question is whether it's possible to feed in the project name (ext_id value) and populate the displayName of the plot point with that value?

Could I feed the project name into some sort of array and then assign that value to the displayName?

off topic... several of our team went to Teched and really enjoyed your NW 7.00 -> 7.01 ->7.02 deltas presentation... we just installed 7.01 (7.02 will be at the end of the month when released) on our xRPM system and I have been eager to get my hands on some of the new technical capabilities.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

This is really a Flex question not an Islands specific one. I don't think the displayName properity is what you want to use here. This is the name for the entire series as it will be displayed in the legend. I think what you want is a dataTip. You register a callback for the dataTip rendering and then fill the custom dataTip quick info.

This is an example from a bar chart, but the theory is the same:

<mx:BarChart id="barChart" dataTipFunction="dtFunc" xmlns:mx="http://www.adobe.com/2006/mxml" type="clustered" width="100%" showDataTips="true" height="100%">
	
	<mx:verticalAxis>
		<mx:CategoryAxis categoryField="{SalesOrd}" dataProvider="{dataSource}" />
	</mx:verticalAxis>
	
	<mx:series>
		<mx:BarSeries id="bsGross" xField="{grossAmt}" displayName="Gross Amount" dataProvider="{dataSource}" fill="{otdFill}" showDataEffect="{slideIn}"  />
		<mx:BarSeries id="bsNet" xField="{netAmt}" displayName="Net Amount" dataProvider="{dataSource}" fill="{rtyFill}" showDataEffect="{zoomIn}"  />		
	</mx:series>
</mx:BarChart>

private function dtFunc(hd:HitData):String {
	    	switch(BarSeries(hd.element).id){
	    		case "bsGross":
	    			 return "Sales Order #: " +  hd.item.SO_ID + "\n" + FlashIsland.formatNumber(hd.item.TTL_GROSS_AMOUNT) + " " + hd.item.CURRENCY_CODE;	    			 
	    			 break;
	    		case "bsNet":
	    			 return "Sales Order #: " +  hd.item.SO_ID + "\n " + FlashIsland.formatNumber(hd.item.TTL_NET_AMOUNT) + " " + hd.item.CURRENCY_CODE;
	    			 break;	    		
	    	} 
	    	return "Amount";
	    }

Former Member
0 Kudos

thanks.. i'll take a look at the dataTip property.

Answers (1)

Answers (1)

Former Member
0 Kudos

I should also point out that the value I am seeing as the plot point label is "EXT_ID".

it seems like the WDA fieldname is being used instead of the value.