0

私は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

4

1 に答える 1

0

問題を理解しました。cartesianCanvas から派生した新しいクラスを作成し、その「updateDisplayList」関数をオーバーライドして行を再描画する必要がありました

override protected function updateDisplayList( unscaledWidth:Number, unscaledHeight:Number ):void
{
    super.updateDisplayList( unscaledWidth, unscaledHeight );       
    drawLine();
}
于 2012-03-10T15:42:29.503 に答える