1
votes

I want to set Maximum and minimum value for X axis in bar chart in flex action script 3 file.

Following line in working in MXML file but I want these code in actionscript 3.

<mx:BarChart x="46" y="115" id="myChart">
    <mx:horizontalAxis>     
        <mx:LinearAxis minimum="-20000" maximum="20000">                
        </mx:LinearAxis>
    </mx:horizontalAxis>
</mx:BarChart>

can anybody change this into Actionscript 3.

thanks..

2
Make sure you indent 5 spaces before you post code - something tells me not all of what you intended is showing up.Jeff Pinkston

2 Answers

1
votes

You can do the following:

var vAxis:LinearAxis = new LinearAxis();
vAxis.maximum = 100;
vAxis.minimum = 0;

This won't guarantee a label but it will keep the axis at a fixed size.

0
votes

In MXML

<mx:ColumnChart ...>
    <mx:verticalAxis>
        <mx:LinearAxis id="vAxis"
                 minimum="0" 
                 maximum="100" />
    </mx:verticalAxis>
</mx:ColumnChart>

For actionscript see slashnick's answer.