Get position, width and height of the actual chart
I want to place a container (transparent red) on top of my chart.
How do I get the origin (point A), width and height of开发者_如何转开发 this area?
http://img88.imageshack.us/img88/4558/flexchart01.png http://img88.imageshack.us/img88/4558/flexchart01.png
So if you wanted to place this container as a background image (I realize this isn't quite what you want to do) you could place a 100% width and height canvas in the tag of the canvas. I believe there is a similar property that goes on top of the chart, maybe you can do something with this?
Edit: It is annotationElements that you want:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
<mx:Script><![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var expenses:ArrayCollection = new ArrayCollection([
{Month:"Jan", Profit:2000, Expenses:1500, Amount:450},
{Month:"Feb", Profit:1000, Expenses:200, Amount:600},
{Month:"Mar", Profit:1500, Expenses:500, Amount:300}
]);
]]></mx:Script>
<mx:Panel title="Line Chart">
<mx:LineChart id="myChart"
dataProvider="{expenses}"
showDataTips="true"
>
<mx:horizontalAxis>
<mx:CategoryAxis
dataProvider="{expenses}"
categoryField="Month"
/>
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries
yField="Profit"
displayName="Profit"
/>
<mx:LineSeries
yField="Expenses"
displayName="Expenses"
/>
</mx:series>
<mx:annotationElements>
<mx:Canvas backgroundAlpha=".5" backgroundColor="0xff0000" />
</mx:annotationElements>
</mx:LineChart>
<mx:Legend dataProvider="{myChart}"/>
</mx:Panel>
</mx:Application>
精彩评论