Just use the following, p is the panel and h1 is the horizontal Axis,
I'm using the same axis created by your code snippet, also changed the
width, height of the other chart to 50% to make some room for this
chart.
 
private function init():void
{
   var c:ColumnChart = new ColumnChart();
   c.dataProvider = expensesAC;
   c.width = linechart.width;
   c.height = linechart.height;
   c.horizontalAxis = h1;
   c.verticalAxis = v1;
   var s1:ColumnSeries = new ColumnSeries();
   s1.yField = "Profit";
   var s2:ColumnSeries = new ColumnSeries();
   s2.yField = "Expenses";
   s2.verticalAxis = v2;
   c.series = [s1,s2];
   var ar1:AxisRenderer = new AxisRenderer();
   ar1.axis = v1;
   var ar2:AxisRenderer = new AxisRenderer();
   ar2.axis = s2.verticalAxis;
   var ar3:AxisRenderer = new AxisRenderer();
   ar3.axis = h1;
   c.horizontalAxisRenderers = [ar3];
   c.verticalAxisRenderers = [ar1,ar2];
   
   p.addChild(c);
}

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of EddieBerman
Sent: Thursday, February 07, 2008 6:18 AM
To: [email protected]
Subject: [flexcoders] ColumnChart - creating multiple Linear Axis via
ActionScript - Help!



I'm having difficulty understanding how to create, via AS3, a
ColumnChart that contains multiple verticalAxis. I'm familiar with the
sample program "MultipleAxis" provided by Adobe, but can't correctly
translate this to AS3 code. All is good until I need to create and set
the multiple AxisRenderer objects. Can anyone more familiar give me a
suggestion, or point to any reference material for doing this in AS3?
Thanks.

I've pasted the Adobe MXML sample code below that I'd like to replicate:

<mx:ColumnChart id="linechart" height="100%" width="100%"
paddingLeft="5" paddingRight="5" 
showDataTips="true" dataProvider="{expensesAC}">

<mx:horizontalAxis>
<mx:CategoryAxis categoryField="Month"/>
</mx:horizontalAxis>

<mx:verticalAxis>
<mx:LinearAxis id= "v1"/>
</mx:verticalAxis>

<mx:verticalAxisRenderers> 
<mx:AxisRenderer axis = "{v1}"/>
<mx:AxisRenderer axis = "{v2}"/>
</mx:verticalAxisRenderers>

<mx:series>
<mx:ColumnSeries yField="Profit" displayName="Profit"
itemRenderer="mx.charts.renderers.CircleItemRenderer">
</mx:ColumnSeries>

<mx:ColumnSeries yField="Expenses" displayName="Expenses"
itemRenderer="mx.charts.renderers.CircleItemRenderer">
<mx:verticalAxis>
<mx:LinearAxis id = "v2" />
</mx:verticalAxis>
</mx:ColumnSeries>

</mx:series>
</mx:ColumnChart>



 

Reply via email to