私はflex 4.5でdateTimeAxis水平軸を持つcandleStickChartを持っています。
そのチャートの上に線を引くことができるボタンが欲しいです。
ボタンがクリックされるたびに、新しい CartesianDataCanvas が作成されるコードを書きました。MOUSE_DOWN、MOUSE_MOVE、および MOUSE_UP をリッスンして線を描画することで、かなり標準的な線を描画するよりも。
MOUSE_DOWN イベントで、新しい CartesianDataCanvas を作成し、次のコードで説明されているように annotaionArray を更新します (candles は、candleStickChart の ID です)。
public function startDrawing(event:MouseEvent):void
{
canvas = new CartesianDataCanvas;
annotationArray.addItem(canvas);
candles.annotationElements = annotationArray.toArray();
x1 = this.mouseX;
y1 = this.mouseY;
addEventListener(MouseEvent.MOUSE_MOVE, updateLine);
addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
}
Everything is working fine in the first line that i'm drawing.
The problem is that when drawing the second line, the first line is disappeared. When I'm debugging the annotationArray i can see that it is indeed consist of 2 CartesianDataCanvas objects and for somereasoen it shows onlt the last one.
Does someone knows how can I fix this to show all the CartesianDataCanvas in the array at once? I'm fairly new to flex so I defenetly might missed some basic stuff here. feel free to comment on basics too.
Thanks in advance Ravid