swf/chart/fx/chart/Chart.as in unageanu-jiji-1.2.1 vs swf/chart/fx/chart/Chart.as in unageanu-jiji-1.2.3
- old
+ new
@@ -29,11 +29,11 @@
private var model:Model;
private var ctrl:Controller;
private var rc:RenderingContext;
private var autoUpdate:AutoUpdate;
private var check:CheckBox;
-
+
public function Chart(canvas:UIComponent){
model = new Model();
ctrl = new Controller(model);
rc = new RenderingContext( canvas );
@@ -92,24 +92,30 @@
ctrl.requestPairs( function(data:Array):void {
scaleSelector = new ScaleSelector( model, ctrl, rc, data );
registExternalInterface();
ExternalInterface.call( "onChartLoaded" );
});
-
+
} catch ( ex:Error ) {
//log(ex.message + ":" + ex.getStackTrace());
}
}
/**
* 外部インターフェイスを登録
*/
private function registExternalInterface():void {
ExternalInterface.addCallback("initializeChart", this.initializeChart );
ExternalInterface.addCallback("setDate", function( date:Number ):void {
- ctrl.changeDate( Util.createDate(date) );
- pointer.setPosition(
- rc.stage.candle.left + (rc.stage.candle.width/2) + 11,
- rc.stage.candle.bottom - (rc.stage.candle.height/4));
+ var d:Date = Util.createDate(date);
+ var f:Function = function():void {
+ pointer.setPosition(
+ model.positionManager.fromDate( Math.floor( date / model.scaleTime) * model.scaleTime ) + rc.stage.candle.left,
+ rc.stage.candle.bottom - (rc.stage.candle.height/4));
+ ctrl.removeEventListener( fx.chart.ctrl.Event.CANDLE_DATA_CHANGED, arguments.callee );
+ }
+ ctrl.addEventListener( fx.chart.ctrl.Event.CANDLE_DATA_CHANGED, f);
+ ctrl.changeDate( d );
+ scroll.update();
} );
ExternalInterface.addCallback("setGraphVisible", this.setGraphVisible );
ExternalInterface.addCallback("setGraphColors", this.setGraphColors );
ExternalInterface.addCallback("removeGraph", this.removeGraph );
}
\ No newline at end of file