I'm trying to set up a simple line chart that contains both positive and negative values, but I'm having trouble setting the correct properties so that the x-axis renders at the middle of the y-axis; all I'm getting right now is the x-axis being at the bottom of the chart.
<mx:Stroke id="stroke" color="0x000000" weight="1"/>
<mx:horizonalAxisRenderers>
<mx:AxisRenderer axis="{xAxis}" axisStroke="{stroke}"/>
</mx:horizonalAxisRenderers>
<mx:verticalAxisRenderers>
<mx:AxisRenderer axis="{yAxis}" axisStroke="{stroke}"/>
</mx:verticalAxisRenderers>
<mx:horizontalAxis>
<mx:LinearAxis id="xAxis"/>
</mx:horizontalAxis>
<mx:verticalAxis>
<mx:LinearAxis id="yAxis"/>
</mx:verticalAxis>
What property/style should I be adding to the axes so that I get the x-axis displayed at the middle of the y-axis?
I believe you need to use the minimum
and maximum
properties of the LinearAxis
. By giving it those hints, it should render the axis in a reasonable location. I did this a long time ago, so it's a little foggy, but I posted a simple example about rendering negative values on a chart (source included).