hqchart 1.1.12420 → 1.1.12429

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1325,7 +1325,7 @@ this.AdjustChartBorder=function(chart){var pixelTatio=GetDevicePixelRatio();//
1325
1325
  chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;if(chart.Frame.AutoLeftBorder){var item=chart.Frame.AutoLeftBorder;if(IFrameSplitOperator.IsNumber(item.MinWidth))item.MinWidth*=pixelTatio;if(IFrameSplitOperator.IsNumber(item.Blank))item.Blank*=pixelTatio;}if(chart.Frame.AutoRightBorder){var item=chart.Frame.AutoRightBorder;if(IFrameSplitOperator.IsNumber(item.MinWidth))item.MinWidth*=pixelTatio;if(IFrameSplitOperator.IsNumber(item.Blank))item.Blank*=pixelTatio;}};this.AdjustTitleHeight=function(chart){var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
1326
1326
  for(var i=0;i<chart.Frame.SubFrame.length;++i){chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight*=pixelTatio;}chart.ChartCorssCursor.TextHeight*=pixelTatio;//十字光标文本信息高度
1327
1327
  };this.SetChartBorder=function(chart,option){if(!option.Border)return;var item=option.Border;if(IFrameSplitOperator.IsNumber(option.Border.Left))chart.Frame.ChartBorder.Left=option.Border.Left;else option.Border.Left=chart.Frame.ChartBorder.Left;if(IFrameSplitOperator.IsNumber(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;else option.Border.Right=chart.Frame.ChartBorder.Right;if(IFrameSplitOperator.IsNumber(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;else option.Border.Top=chart.Frame.ChartBorder.Top;if(IFrameSplitOperator.IsNumber(option.Border.Bottom))chart.Frame.ChartBorder.Bottom=option.Border.Bottom;else option.Border.Bottom=chart.Frame.ChartBorder.Bottom;if(item.AutoLeft){chart.Frame.AutoLeftBorder={};if(IFrameSplitOperator.IsNumber(item.AutoLeft.Blank))chart.Frame.AutoLeftBorder.Blank=item.AutoLeft.Blank;if(IFrameSplitOperator.IsNumber(item.AutoLeft.MinWidth))chart.Frame.AutoLeftBorder.MinWidth=item.AutoLeft.MinWidth;}if(item.AutoRight){chart.Frame.AutoRightBorder={};if(IFrameSplitOperator.IsNumber(item.AutoRight.Blank))chart.Frame.AutoRightBorder.Blank=item.AutoRight.Blank;if(IFrameSplitOperator.IsNumber(item.AutoRight.MinWidth))chart.Frame.AutoRightBorder.MinWidth=item.AutoRight.MinWidth;}};this.SetEventCallback=function(chart,aryCallback){if(!chart)return;if(!IFrameSplitOperator.IsNonEmptyArray(aryCallback))return;for(var i=0;i<aryCallback.length;++i){var item=aryCallback[i];chart.AddEventCallback(item);}};//历史K线图
1328
- this.CreateKLineChartContainer=function(option){var chart=null;if(option.Type==="历史K线图横屏")chart=new KLineChartHScreenContainer(this.CanvasElement);else chart=new KLineChartContainer(this.CanvasElement,this.OffscreenCanvasElement,this.CacheCanvasElement);var extraElement=this.GetExtraCanvas(JSChart.CorssCursorCanvasKey);if(extraElement)chart.SetCorssCursorElement(extraElement);if(option.EventCallback)this.SetEventCallback(chart,option.EventCallback);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;//创建改参数div
1328
+ this.CreateKLineChartContainer=function(option){var _this2=this;var chart=null;if(option.Type==="历史K线图横屏")chart=new KLineChartHScreenContainer(this.CanvasElement);else chart=new KLineChartContainer(this.CanvasElement,this.OffscreenCanvasElement,this.CacheCanvasElement);chart.GetExtraCanvas=function(name){return _this2.GetExtraCanvas(name);};var extraElement=this.GetExtraCanvas(JSChart.CorssCursorCanvasKey);if(extraElement)chart.SetCorssCursorElement(extraElement);if(option.EventCallback)this.SetEventCallback(chart,option.EventCallback);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;//创建改参数div
1329
1329
  chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;chart.MinuteDialog=this.MinuteDialog;//右键菜单
1330
1330
  if(option.IsShowRightMenu==true)chart.RightMenu=new KLineRightMenu(this.DivElement);if(option.ScriptError)chart.ScriptErrorCallback=option.ScriptError;chart.SelectRectRightMenu=new KLineSelectRightMenu(this.DivElement);if(option.EnableScrollUpDown==true)chart.EnableScrollUpDown=option.EnableScrollUpDown;if(option.DisableMouse==true)chart.DisableMouse=option.DisableMouse;if(option.TouchMoveMinAngle)chart.TouchMoveMinAngle=option.TouchMoveMinAngle;if(option.EnableZoomUpDown)chart.EnableZoomUpDown=option.EnableZoomUpDown;if(IFrameSplitOperator.IsString(option.SplashTitle))chart.LoadDataSplashTitle=option.SplashTitle;if(IFrameSplitOperator.IsBool(option.EnableZoomIndexWindow))chart.EnableZoomIndexWindow=option.EnableZoomIndexWindow;if(IFrameSplitOperator.IsBool(option.IsDrawPictureXY))chart.IsDrawPictureXY=option.IsDrawPictureXY;if(IFrameSplitOperator.IsNumber(option.CtrlMoveStep))chart.CtrlMoveStep=option.CtrlMoveStep;if(IFrameSplitOperator.IsBool(option.EnableIndexChartDrag))chart.EnableIndexChartDrag=option.EnableIndexChartDrag;if(IFrameSplitOperator.IsBool(option.EnableVerifyRecvData))chart.EnableVerifyRecvData=option.EnableVerifyRecvData;if(option.EnableYDrag){var item=option.EnableYDrag;if(IFrameSplitOperator.IsBool(item.Left))chart.EnableYDrag.Left=item.Left;if(IFrameSplitOperator.IsBool(item.Right))chart.EnableYDrag.Right=item.Right;}if(option.KLine)//k线图的属性设置
1331
1331
  {if(option.KLine.DragMode>=0)chart.DragMode=option.KLine.DragMode;if(option.KLine.Right>=0)chart.Right=option.KLine.Right;if(option.KLine.Period>=0)chart.Period=option.KLine.Period;if(option.KLine.MaxReqeustDataCount>0)chart.MaxRequestDataCount=option.KLine.MaxReqeustDataCount;//兼容老版本
@@ -1365,7 +1365,7 @@ chart.Create(option.Windows.length);if(option.Border){if(!isNaN(option.Border.Le
1365
1365
  var scriptData=new JSIndexScript();for(var i=0;i<option.Windows.length;++i){var item=option.Windows[i];if(item.Script){chart.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
1366
1366
  }else{var indexItem=JSIndexMap.Get(item.Index);if(indexItem){chart.WindowIndex[i]=indexItem.Create();chart.CreateWindowIndex(i);}else{var indexInfo=scriptData.Get(item.Index);if(!indexInfo)continue;if(item.Lock)indexInfo.Lock=item.Lock;chart.WindowIndex[i]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
1367
1367
  }}if(item.Modify!=null)chart.Frame.SubFrame[i].Frame.ModifyIndex=item.Modify;if(item.Change!=null)chart.Frame.SubFrame[i].Frame.ChangeIndex=item.Change;if(!isNaN(item.TitleHeight))chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;}return chart;};//分钟走势图
1368
- this.CreateMinuteChartContainer=function(option){var chart=null;if(option.Type==="分钟走势图横屏")chart=new MinuteChartHScreenContainer(this.CanvasElement);else chart=new MinuteChartContainer(this.CanvasElement,this.OffscreenCanvasElement,this.CacheCanvasElement);if(option.EventCallback)this.SetEventCallback(chart,option.EventCallback);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;var windowsCount=2;if(option.Windows&&option.Windows.length>0)windowsCount+=option.Windows.length;//指标窗口从第3个窗口开始
1368
+ this.CreateMinuteChartContainer=function(option){var _this3=this;var chart=null;if(option.Type==="分钟走势图横屏")chart=new MinuteChartHScreenContainer(this.CanvasElement);else chart=new MinuteChartContainer(this.CanvasElement,this.OffscreenCanvasElement,this.CacheCanvasElement);chart.GetExtraCanvas=function(name){return _this3.GetExtraCanvas(name);};if(option.EventCallback)this.SetEventCallback(chart,option.EventCallback);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;var windowsCount=2;if(option.Windows&&option.Windows.length>0)windowsCount+=option.Windows.length;//指标窗口从第3个窗口开始
1369
1369
  if(option.EnableScrollUpDown==true)chart.EnableScrollUpDown=option.EnableScrollUpDown;if(option.DisableMouse==true)chart.DisableMouse=option.DisableMouse;if(option.ScriptError)chart.ScriptErrorCallback=option.ScriptError;//指标执行错误回调
1370
1370
  if(IFrameSplitOperator.IsString(option.SplashTitle))chart.LoadDataSplashTitle=option.SplashTitle;if(IFrameSplitOperator.IsBool(option.EnableSelectRect))chart.EnableSelectRect=option.EnableSelectRect;//是否启用区间选择
1371
1371
  if(IFrameSplitOperator.IsBool(option.EnableZoomIndexWindow))chart.EnableZoomIndexWindow=option.EnableZoomIndexWindow;if(IFrameSplitOperator.IsBool(option.IsDrawPictureXY))chart.IsDrawPictureXY=option.IsDrawPictureXY;if(IFrameSplitOperator.IsBool(option.EnableNewIndex))chart.EnableNewIndex=option.EnableNewIndex;if(IFrameSplitOperator.IsBool(option.EnableIndexChartDrag))chart.EnableIndexChartDrag=option.EnableIndexChartDrag;if(IFrameSplitOperator.IsBool(option.EnableVerifyRecvData))chart.EnableVerifyRecvData=option.EnableVerifyRecvData;if(option.GlobalOption){var item=option.GlobalOption;if(IFrameSplitOperator.IsBool(item.IsValueFullRange))chart.GlobalOption.IsValueFullRange=item.IsValueFullRange;if(IFrameSplitOperator.IsNumber(item.XDateFormat))chart.GlobalOption.XDateFormat=item.XDateFormat;}if(option.DisplayLatest){var item=option.DisplayLatest;if(IFrameSplitOperator.IsBool(item.Enable))chart.DisplayLatestOption.Enable=item.Enable;if(IFrameSplitOperator.IsNumber(item.DelayTime))chart.DisplayLatestOption.DelayTime=item.DelayTime;}if(option.DrawDynamicInfo){var item=option.DrawDynamicInfo;if(IFrameSplitOperator.IsBool(item.Enable))chart.DrawDynamicInfoOption.Enable=item.Enable;if(IFrameSplitOperator.IsNumber(item.DelayTime))chart.DrawDynamicInfoOption.DelayTime=item.DelayTime;}chart.SelectRectDialog=new MinuteSelectRectDialog(this.DivElement);if(option.Minute)//分钟走势图属性设置
@@ -1596,7 +1596,7 @@ ON_RECV_REALTIME_DATA:109,//实时数据
1596
1596
  ON_CUSTOM_OVERLAY_TOOLBAR:110,//自定义叠加指标按钮
1597
1597
  //绘图之前的事件
1598
1598
  ON_BEFORE_DRAW:111,ON_BEFORE_DRAW_DYNAMIC_INFO:112,//自定义图形拖拽
1599
- ON_CUSTOM_DRAG_MOUSE_DOWN:113,ON_CUSTOM_DRAG_DOC_MOUSE_MOVE:114,ON_CUSTOM_DRAG_DOC_MOUSE_UP:115};var JSCHART_OPERATOR_ID={OP_SCROLL_LEFT:1,//往左移动
1599
+ ON_CUSTOM_DRAG_MOUSE_DOWN:113,ON_CUSTOM_DRAG_DOC_MOUSE_MOVE:114,ON_CUSTOM_DRAG_DOC_MOUSE_UP:115,ON_CUSTOM_DRAG_MOUSE_MOVE:116};var JSCHART_OPERATOR_ID={OP_SCROLL_LEFT:1,//往左移动
1600
1600
  OP_SCROLL_RIGHT:2,//往右移动
1601
1601
  OP_ZOOM_OUT:3,//缩小
1602
1602
  OP_ZOOM_IN:4,//放大
@@ -1633,7 +1633,7 @@ KLINE_HEATMAP:67};var JSCHART_WORKER_MESSAGE_ID={EXECUTE_SCRIPT:1,//工作线程
1633
1633
  FINISH_EXECUTE_SCRIPT:2,//脚本执行完成
1634
1634
  ERROR_EXECUTE_SCRIPT:3};function PhoneDBClick(){this.Start=[];this.Clear=function(){this.Start=[];};this.AddTouchStart=function(x,y,time){if(this.Start.length>0){var item=this.Start[this.Start.length-1];var spanTime=time-item.Time;if(spanTime>0&&spanTime<300){this.Start.push({X:x,Y:y,Time:time});}else{this.Start=[];}}else{this.Start.push({X:x,Y:y,Time:time});}};this.IsVaildDBClick=function(){if(this.Start.length==2)return true;return false;};this.AddTouchEnd=function(time){if(this.Start.length<=0)return;var item=this.Start[this.Start.length-1];var spanTime=time-item.Time;if(spanTime>=0&&spanTime<150){}else{this.Start=[];}};}/*
1635
1635
  图形控件
1636
- */function JSChartContainer(uielement,OffscreenElement,cacheElement){var _this4=this;this.ClassName='JSChartContainer';var _self=this;this.Frame;//框架画法
1636
+ */function JSChartContainer(uielement,OffscreenElement,cacheElement){var _this6=this;this.ClassName='JSChartContainer';var _self=this;this.Frame;//框架画法
1637
1637
  this.ChartPaint=new Array();//图形画法
1638
1638
  this.ChartPaintEx=[];//图形扩展画法
1639
1639
  this.ChartInfo=new Array();//K线|走势图上信息地雷
@@ -1702,20 +1702,20 @@ this.EnableVerticalDrag=false;//十字光标长留(手势才有)
1702
1702
  this.ClickModel={IsShowCorssCursor:false};this.EnableClickModel=false;//标题栏显示最新数据
1703
1703
  this.DisplayLatestOption={Timer:null,Enable:false,DelayTime:60*1000*3,LastPoint:null};this.DrawDynamicInfoOption={Timer:null,Enable:false,DelayTime:10};this.CustomChartDrag;//自定义图形的拖拽操作 { Type:, Data: }
1704
1704
  //obj={ Element:, Canvas: }
1705
- this.SetCorssCursorElement=function(obj){if(!obj||!obj.Element||!obj.Canvas)return;this.CorssCursorElement=obj.Element;this.CorssCursorCanvas=obj.Canvas;};this.StopDisplayLatest=function(){this.GlobalOption.IsDisplayLatest=false;if(this.DisplayLatestOption.Timer){clearTimeout(this.DisplayLatestOption.Timer);this.DisplayLatestOption.Timer=null;}};this.StartStopDisplayLatest=function(){var _this2=this;this.StopDisplayLatest();if(!this.DisplayLatestOption.Enable)return;this.DisplayLatestOption.Timer=setTimeout(function(){if(_this2.DisplayLatest){JSConsole.Chart.Log('[JSChartContainer:StartStopDisplayLatest] call this.DisplayLatest()');_this2.DisplayLatest();}},this.DisplayLatestOption.DelayTime);};this.StopDrawDynamicInfo=function(){if(this.DrawDynamicInfoOption.Timer){clearTimeout(this.DrawDynamicInfoOption.Timer);this.DrawDynamicInfoOption.Timer=null;}};this.ChartDestroy=function()//销毁
1705
+ this.SetCorssCursorElement=function(obj){if(!obj||!obj.Element||!obj.Canvas)return;this.CorssCursorElement=obj.Element;this.CorssCursorCanvas=obj.Canvas;};this.StopDisplayLatest=function(){this.GlobalOption.IsDisplayLatest=false;if(this.DisplayLatestOption.Timer){clearTimeout(this.DisplayLatestOption.Timer);this.DisplayLatestOption.Timer=null;}};this.StartStopDisplayLatest=function(){var _this4=this;this.StopDisplayLatest();if(!this.DisplayLatestOption.Enable)return;this.DisplayLatestOption.Timer=setTimeout(function(){if(_this4.DisplayLatest){JSConsole.Chart.Log('[JSChartContainer:StartStopDisplayLatest] call this.DisplayLatest()');_this4.DisplayLatest();}},this.DisplayLatestOption.DelayTime);};this.StopDrawDynamicInfo=function(){if(this.DrawDynamicInfoOption.Timer){clearTimeout(this.DrawDynamicInfoOption.Timer);this.DrawDynamicInfoOption.Timer=null;}};this.ChartDestroy=function()//销毁
1706
1706
  {this.IsDestroy=true;this.StopAutoUpdate();if(this.GetLatestVersionTimer!=null){clearTimeout(this.GetLatestVersionTimer);this.GetLatestVersionTimer=null;}};this.ChartDestory=this.ChartDestroy;//老版本写错了,需要兼容下
1707
1707
  this.GetLatestVersionTimer=null;//获取最新版本
1708
- this.GetLatestVersion=function(){var _this3=this;if(this.GetLatestVersionTimer!=null){clearTimeout(this.GetLatestVersionTimer);this.GetLatestVersionTimer=null;}var roundeTime=Math.floor(Math.random()*50);var waittimer=1000*60*3+roundeTime*1000;var value="aHR0cHM6Ly9ocWNoYXJ0LnplYWxpbmsuY29tL2FwaS9HZXRWZXJzaW9u";JSConsole.Chart.Log("[JSChartContainer::GetLatestVersion] wait for get hqchart latest version. ",waittimer);this.GetLatestVersionTimer=setTimeout(function(){var width=0,height=0;if(_this3.Frame&&_this3.Frame.ChartBorder){width=_this3.Frame.ChartBorder.GetChartWidth();height=_this3.Frame.ChartBorder.GetChartHeight();}var url=atob(value)+'?width='+width+'&height='+height+'&type=h5';if(JSChart.LastVersion!=null)return;//只请求一次
1708
+ this.GetLatestVersion=function(){var _this5=this;if(this.GetLatestVersionTimer!=null){clearTimeout(this.GetLatestVersionTimer);this.GetLatestVersionTimer=null;}var roundeTime=Math.floor(Math.random()*50);var waittimer=1000*60*3+roundeTime*1000;var value="aHR0cHM6Ly9ocWNoYXJ0LnplYWxpbmsuY29tL2FwaS9HZXRWZXJzaW9u";JSConsole.Chart.Log("[JSChartContainer::GetLatestVersion] wait for get hqchart latest version. ",waittimer);this.GetLatestVersionTimer=setTimeout(function(){var width=0,height=0;if(_this5.Frame&&_this5.Frame.ChartBorder){width=_this5.Frame.ChartBorder.GetChartWidth();height=_this5.Frame.ChartBorder.GetChartHeight();}var url=atob(value)+'?width='+width+'&height='+height+'&type=h5';if(JSChart.LastVersion!=null)return;//只请求一次
1709
1709
  JSNetwork.HttpRequest({url:url,type:"get",dataType:"json",async:true,success:function success(data){JSConsole.Chart.Log("[JSChartContainer::GetLatestVersion] hqchart latest version. ",data);JSChart.LastVersion=data;},error:function error(request,textStatus,errorThrown){JSConsole.Chart.Log("[JSChartContainer::GetLatestVersion] Get HQChart latest version failed.",request);}});},waittimer);};//设置焦点
1710
1710
  this.SetFocus=function(){if(this.UIElement)this.UIElement.focus();};//设置事件回调
1711
1711
  //{event:事件id, callback:回调函数}
1712
1712
  this.AddEventCallback=function(object){if(!object||!object.event||!object.callback)return;var data={Callback:object.callback,Source:object};this.mapEvent.set(object.event,data);};this.RemoveEventCallback=function(eventid){if(!this.mapEvent.has(eventid))return;this.mapEvent.delete(eventid);};this.GetEventCallback=function(id)//获取事件回调
1713
1713
  {if(!this.mapEvent.has(id))return null;var item=this.mapEvent.get(id);return item;};//接收指标数据
1714
1714
  this.GetIndexEvent=function(){return this.GetEventCallback(JSCHART_EVENT_ID.RECV_INDEX_DATA);};this.GetOverlayIndexEvent=function(){return this.GetEventCallback(JSCHART_EVENT_ID.RECV_OVERLAY_INDEX_DATA);};//鼠标事件绑定
1715
- uielement.onmousemove=function(e){_this4.UIOnMouseMove(e);};uielement.oncontextmenu=function(e){return _this4.UIOnContextMenu(e);};uielement.ondblclick=function(e){_this4.UIOnDblClick(e);};uielement.onmousedown=function(e){_this4.UIOnMouseDown(e);};uielement.onmouseout=function(e){_this4.UIOnMounseOut(e);};uielement.onmouseleave=function(e){_this4.UIOnMouseleave(e);};this.UIOnMouseMove=function(e){//JSConsole.Chart.Log('[JSChartContainer.UIOnMouseMove] e.clientX, e.clientY, left, top ',e.clientX, e.clientY, this.getBoundingClientRect().left,this.getBoundingClientRect().top);
1715
+ uielement.onmousemove=function(e){_this6.UIOnMouseMove(e);};uielement.oncontextmenu=function(e){return _this6.UIOnContextMenu(e);};uielement.ondblclick=function(e){_this6.UIOnDblClick(e);};uielement.onmousedown=function(e){_this6.UIOnMouseDown(e);};uielement.onmouseout=function(e){_this6.UIOnMounseOut(e);};uielement.onmouseleave=function(e){_this6.UIOnMouseleave(e);};this.UIOnMouseMove=function(e){//JSConsole.Chart.Log('[JSChartContainer.UIOnMouseMove] e.clientX, e.clientY, left, top ',e.clientX, e.clientY, this.getBoundingClientRect().left,this.getBoundingClientRect().top);
1716
1716
  var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
1717
1717
  var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;this.StopDisplayLatest();//加载数据中,禁用鼠标事件
1718
- this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;if(this.DisableMouse==true)return;if(this.BorderDrag)return;if(this.YDrag)return;if(this.IndexChartDrag)return;//if (this.RectSelectDrag) return;
1718
+ this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;if(this.DisableMouse==true)return;if(this.BorderDrag)return;if(this.YDrag)return;if(this.IndexChartDrag)return;if(this.CustomChartDrag)return;//if (this.RectSelectDrag) return;
1719
1719
  /*
1720
1720
  if (this.CurrentChartDrawPicture)
1721
1721
  {
@@ -1730,10 +1730,10 @@ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MOUSE_MOVE);var titleChart=t
1730
1730
  if(titleChart)titleChart.OnMouseMoveEvent=null;this.StartStopDisplayLatest();};this.IsMouseOnClient=function(x,y){var rect={Left:this.Frame.ChartBorder.GetLeft(),Top:this.Frame.ChartBorder.GetTop(),Width:this.Frame.ChartBorder.GetWidth(),Height:this.Frame.ChartBorder.GetHeight()};rect.Right=rect.Left+rect.Width;rect.Bottom=rect.Top+rect.Height;if(x>=rect.Left&&x<=rect.Right&&y>=rect.Top&&y<=rect.Bottom)return true;return false;};this.UIOnContextMenu=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var x=e.clientX-this.UIElement.getBoundingClientRect().left;var y=e.clientY-this.UIElement.getBoundingClientRect().top;if(typeof this.OnRightMenu=='function')this.OnRightMenu(x,y,e);//右键菜单事件
1731
1731
  return false;};this.UIOnDblClick=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;this.OnDoubleClick(x,y,e);};//是否在拖拽Y轴上
1732
1732
  this.TryYDrag=function(x,y){if(!this.EnableYDrag)return null;if(!this.EnableYDrag.Left&&!this.EnableYDrag.Right)return null;if(!this.Frame||!this.Frame.PtInFrameY)return null;var dragY=this.Frame.PtInFrameY(x,y);if(!dragY||dragY.Index<0||dragY.IsOverlay==true)return null;if(dragY.Left&&this.EnableYDrag.Left&&this.Frame.IsEnableDragY(dragY.Index)){return dragY;}if(dragY.Right&&this.EnableYDrag.Right&&this.Frame.IsEnableDragY(dragY.Index)){return dragY;}return null;};//是否可以上下拖拽
1733
- this.TryUpDownDrag=function(x,y){var windowIndex=this.Frame.PtInFrame(x,y);if(windowIndex<0)return null;var item=this.Frame.SubFrame[windowIndex];if(!item||!item.Frame)return null;var frame=item.Frame;if(!frame.YSplitOperator||!frame.YSplitOperator.FixedYMaxMin)return null;return{Index:windowIndex,X:x,Y:y};};this.TryRectSelectDrag=function(x,y){var paint=this.GetRectSelectPaint();if(!paint)return null;if(paint.GetPointCount()<=0)return null;var item=paint.PtInPaint(x,y);return{Item:item,X:x,Y:y};};this.TryClickCrossCursor=function(x,y,e){if(!this.ChartCorssCursor)return;var button=this.ChartCorssCursor.PtInButton(x,y);if(!button)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_CROSSCURSOR_RIGHT);if(event&&event.Callback){var sendData={Button:button,e:e};event.Callback(event,sendData,this);}return true;};this.TryClickButton=function(x,y,e){var button=this.Frame.PtInButtons(x,y);if(button&&this.ClickFrameButton){this.ClickFrameButton(button,e);return true;}button=this.PtInExtendChartButtons(x,y);if(button&&this.ClickExtendChartButton){this.ClickExtendChartButton(button,e);return true;}button=this.PtInDrawPictureButtons(x,y);if(button&&this.ClickDrawPictureButton){this.ClickDrawPictureButton(button,e);return true;}button=this.PtInTitleButtons(x,y);if(button&&this.ClickTitleButton){this.ClickTitleButton(button,e);return true;}return false;};this.UIOnMouseDown=function(e){var _this5=this;this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.ClickDownPoint={X:e.clientX,Y:e.clientY};this.IsOnTouch=true;this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.TryClickButton(x,y,e)){return;}if(this.TryClickCrossCursor(x,y,e)){return;}if(this.TryClickChartTooltipData&&this.TryClickChartTooltipData(x,y,e))//预留给外部点击图标什么用的
1733
+ this.TryUpDownDrag=function(x,y){var windowIndex=this.Frame.PtInFrame(x,y);if(windowIndex<0)return null;var item=this.Frame.SubFrame[windowIndex];if(!item||!item.Frame)return null;var frame=item.Frame;if(!frame.YSplitOperator||!frame.YSplitOperator.FixedYMaxMin)return null;return{Index:windowIndex,X:x,Y:y};};this.TryRectSelectDrag=function(x,y){var paint=this.GetRectSelectPaint();if(!paint)return null;if(paint.GetPointCount()<=0)return null;var item=paint.PtInPaint(x,y);return{Item:item,X:x,Y:y};};this.TryClickCrossCursor=function(x,y,e){if(!this.ChartCorssCursor)return;var button=this.ChartCorssCursor.PtInButton(x,y);if(!button)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_CROSSCURSOR_RIGHT);if(event&&event.Callback){var sendData={Button:button,e:e};event.Callback(event,sendData,this);}return true;};this.TryClickButton=function(x,y,e){var button=this.Frame.PtInButtons(x,y);if(button&&this.ClickFrameButton){this.ClickFrameButton(button,e);return true;}button=this.PtInExtendChartButtons(x,y);if(button&&this.ClickExtendChartButton){this.ClickExtendChartButton(button,e);return true;}button=this.PtInDrawPictureButtons(x,y);if(button&&this.ClickDrawPictureButton){this.ClickDrawPictureButton(button,e);return true;}button=this.PtInTitleButtons(x,y);if(button&&this.ClickTitleButton){this.ClickTitleButton(button,e);return true;}return false;};this.TryMouseMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);if(!event||!event.Callback)return false;return event.Callback(event,sendData,this);};this.TryClick_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_DOWN);if(!event||!event.Callback)return false;sendData.ChartDrag=null;sendData.Cusrsor=null;event.Callback(event,sendData,this);this.CustomChartDrag=sendData.ChartDrag;if(sendData.Cusrsor)this.UIElement.style.cursor=sendData.Cusrsor;};this.TryDragMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_MOVE);if(!event||!event.Callback)return;var e=sendData.e;var drag=sendData.Drag;if(Math.abs(drag.LastMove.Y-e.clientY)<2&&Math.abs(drag.LastMove.X-e.clientX)<2)return;if(event.Callback(event,sendData,this)){drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.TryMouseUp_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_UP);if(!event||!event.Callback)return;event.Callback(event,sendData,this);};this.UIOnMouseDown=function(e){var _this7=this;this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.ClickDownPoint={X:e.clientX,Y:e.clientY};this.IsOnTouch=true;this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.TryClickButton(x,y,e)){return;}if(this.TryClickCrossCursor(x,y,e)){return;}if(this.TryClickChartTooltipData&&this.TryClickChartTooltipData(x,y,e))//预留给外部点击图标什么用的
1734
1734
  {return;}if(this.TryClickLock){//JSConsole.Chart.Log('[uielement.onmousedown] left, top ',e.clientX, e.clientY, this.getBoundingClientRect().left,this.getBoundingClientRect().top);
1735
1735
  if(this.TryClickLock(x,y))return;}this.HideSelectRect();if(this.SelectRectRightMenu)this.SelectRectRightMenu.Hide();if(this.ChartPictureMenu)this.ChartPictureMenu.Hide();var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){if(item.Type==4){this.UIElement.style.cursor="pointer";var obj={X:e.clientX};if(this.GetXDataIndex(obj)){this.RectSelectDrag={DataIndex:obj.DataIndex,Type:item.Type,X:e.clientX};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag sub rect select ",obj);}}else{this.UIElement.style.cursor="ew-resize";this.RectSelectDrag={Index:item.PointIndex,Type:item.Type};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag rect select ",item);}}}if(!this.RectSelectDrag&&this.ClearRectSelect(false))this.Draw();if(this.EnableBorderDrag&&this.Frame){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){this.UIElement.style.cursor="n-resize";this.BorderDrag={Index:dragBorder.Index};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] DragBorder ",dragBorder);}}//拖拽Y轴缩放
1736
- if(!this.BorderDrag){var dragY=this.TryYDrag(x,y);if(dragY){this.UIElement.style.cursor=dragY.Position==0?"n-resize":"row-resize";this.YDrag=dragY;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragY ",dragY);}else{var dragUpDown=this.TryUpDownDrag(x,y);if(dragUpDown){this.UIElement.style.cursor="pointer";this.UpDownDrag=dragUpDown;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragUpDown ",dragUpDown);}}}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_DOWN);if(event&&event.Callback){var sendData={ChartDrag:null,X:x,Y:y,Cusrsor:null};event.Callback(event,sendData,this);this.CustomChartDrag=sendData.ChartDrag;if(sendData.Cusrsor)this.UIElement.style.cursor=sendData.Cusrsor;}if(this.DragMode==0)return;var drag={"Click":{},"LastMove":{},//最后移动的位置
1736
+ if(!this.BorderDrag){var dragY=this.TryYDrag(x,y);if(dragY){this.UIElement.style.cursor=dragY.Position==0?"n-resize":"row-resize";this.YDrag=dragY;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragY ",dragY);}else{var dragUpDown=this.TryUpDownDrag(x,y);if(dragUpDown){this.UIElement.style.cursor="pointer";this.UpDownDrag=dragUpDown;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragUpDown ",dragUpDown);}}}var sendData={X:x,Y:y,e:e};if(this.TryClick_CustomChartDrag(sendData)){}if(this.DragMode==0)return;var drag={"Click":{},"LastMove":{},//最后移动的位置
1737
1737
  CurrentMove:{}//当前的移动
1738
1738
  };drag.Click.X=e.clientX;drag.Click.Y=e.clientY;drag.Click.IsInFrameBottom=this.Frame.PtInFrameBottom(x,y);//是否点击在X轴上
1739
1739
  drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;this.MouseDrag=drag;var drawPictureActive=this.GetActiveDrawPicture();//上一次选中的
@@ -1748,16 +1748,16 @@ var bDraw=false;if(drawPictureActive.Select.Guid&&drawPictureActive.Select.Chart
1748
1748
  //this.SelectChartDrawPicture=drawPictrueData.ChartDrawPicture;
1749
1749
  this.SelectChartDrawPicture.DragInfo={Click:{X:e.clientX,Y:e.clientY}};}else{this.CurrentChartDrawPicture=null;this.SelectChartDrawPicture=null;}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_DRAWPICTURE);//选中画图工具事件
1750
1750
  if(event&&event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};event.Callback(event,sendData,this);}else{this.OnSelectChartPicture(drawPictrueData.ChartDrawPicture);//选中画图工具事件
1751
- }}else{if(this.ClickChartTimer!=null){clearTimeout(this.ClickChartTimer);this.ClickChartTimer=null;}var self=this;var ptClick={X:this.ClickDownPoint.X,Y:this.ClickDownPoint.Y};this.ClickChartTimer=setTimeout(function(){self.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_CHART_PAINT,ptClick,e);},250);var bSelectedChartChanged=false;if(this.SelectedChart.EnableSelected){var selectChart=this.PtInChart(x,y);if(selectChart){if(this.SelectedChart.Selected.Identify!=selectChart.Identify){this.SelectedChart.Selected.Identify=selectChart.Identify;this.SelectedChart.Selected.Chart=selectChart.Chart;bSelectedChartChanged=true;}if(this.EnableIndexChartDrag){this.IndexChartDrag={SelectedChart:selectChart,LastMove:{X:x,Y:y},Click:{X:x,Y:y}};this.IndexChartDrag.Info=this.GetSelectedChartInfo(selectChart);if(this.IndexChartDrag.Info)this.IndexChartDrag.Info.FrameID=this.Frame.PtInFrame(x,y);}}else{if(this.SelectedChart.Selected.Identify){this.SelectedChart.Selected.Identify=null;this.SelectedChart.Selected.Chart=null;bSelectedChartChanged=true;}}}else{if(this.SelectedChart.Selected.Identify){this.SelectedChart.Selected.Identify=null;bSelectedChartChanged=true;}}if(drawPictureActive.Select.Guid!=null&&this.SelectChartDrawPicture==null||bSelectedChartChanged){var drawType=0;if(drawPictureActive.Select.Guid&&drawPictureActive.Select.Chart&&drawPictureActive.Select.Chart.IsDrawMain)drawType=1;if(bSelectedChartChanged){var chart=selectedChart.Chart;if(chart&&chart.SetSelectedStatus){chart.SetSelectedStatus(0);drawType=1;}chart=this.SelectedChart.Selected.Chart;if(chart&&chart.SetSelectedStatus){chart.SetSelectedStatus(1);drawType=1;}}if(drawType==1)this.Draw();else this.DrawDynamicInfo();}}}document.onmousemove=function(e){_this5.DocOnMouseMove(e);};document.onmouseup=function(e){_this5.DocOnMouseUp(e);};};this.DocOnMouseMove=function(e){//加载数据中,禁用鼠标事件
1751
+ }}else{if(this.ClickChartTimer!=null){clearTimeout(this.ClickChartTimer);this.ClickChartTimer=null;}var self=this;var ptClick={X:this.ClickDownPoint.X,Y:this.ClickDownPoint.Y};this.ClickChartTimer=setTimeout(function(){self.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_CHART_PAINT,ptClick,e);},250);var bSelectedChartChanged=false;if(this.SelectedChart.EnableSelected){var selectChart=this.PtInChart(x,y);if(selectChart){if(this.SelectedChart.Selected.Identify!=selectChart.Identify){this.SelectedChart.Selected.Identify=selectChart.Identify;this.SelectedChart.Selected.Chart=selectChart.Chart;bSelectedChartChanged=true;}if(this.EnableIndexChartDrag){this.IndexChartDrag={SelectedChart:selectChart,LastMove:{X:x,Y:y},Click:{X:x,Y:y}};this.IndexChartDrag.Info=this.GetSelectedChartInfo(selectChart);if(this.IndexChartDrag.Info)this.IndexChartDrag.Info.FrameID=this.Frame.PtInFrame(x,y);}}else{if(this.SelectedChart.Selected.Identify){this.SelectedChart.Selected.Identify=null;this.SelectedChart.Selected.Chart=null;bSelectedChartChanged=true;}}}else{if(this.SelectedChart.Selected.Identify){this.SelectedChart.Selected.Identify=null;bSelectedChartChanged=true;}}if(drawPictureActive.Select.Guid!=null&&this.SelectChartDrawPicture==null||bSelectedChartChanged){var drawType=0;if(drawPictureActive.Select.Guid&&drawPictureActive.Select.Chart&&drawPictureActive.Select.Chart.IsDrawMain)drawType=1;if(bSelectedChartChanged){var chart=selectedChart.Chart;if(chart&&chart.SetSelectedStatus){chart.SetSelectedStatus(0);drawType=1;}chart=this.SelectedChart.Selected.Chart;if(chart&&chart.SetSelectedStatus){chart.SetSelectedStatus(1);drawType=1;}}if(drawType==1)this.Draw();else this.DrawDynamicInfo();}}}document.onmousemove=function(e){_this7.DocOnMouseMove(e);};document.onmouseup=function(e){_this7.DocOnMouseUp(e);};};this.DocOnMouseMove=function(e){//加载数据中,禁用鼠标事件
1752
1752
  if(this.ChartSplashPaint&&this.IsEnableSplash==true)return;var drag=this.MouseDrag;if(!drag)return;var moveSetp=Math.abs(drag.LastMove.X-e.clientX);var moveSetpY=Math.abs(drag.LastMove.Y-e.clientY);var isDragSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Index>=0;var isDragSubSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Type==4;if(drag.CurrentMove){drag.CurrentMove.X=e.clientX;drag.CurrentMove.Y=e.clientY;}if(this.BorderDrag&&this.BorderDrag.Index>=0){if(Math.abs(drag.LastMove.Y-e.clientY)<5)return;var yMove=e.clientY-drag.LastMove.Y;this.OnMoveFromeBorder(this.BorderDrag.Index,yMove);drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}else if(this.YDrag&&this.YDrag.Index>=0){if(moveSetpY<5)return;var yMove=e.clientY-drag.LastMove.Y;//this.UIElement.style.cursor="n-resize";
1753
- JSConsole.Chart.Log("[JSChartContainer::DocOnMouseMove] YDrag ",this.YDrag,yMove);this.OnZoomUpDownFrameY(this.YDrag,yMove);drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}else if(this.IndexChartDrag&&this.IndexChartDrag.SelectedChart){if(Math.abs(drag.LastMove.Y-e.clientY)<2&&Math.abs(drag.LastMove.X-e.clientX)<2)return;var chartMove=this.GetExtendChartByClassName("DragMovePaint");if(chartMove&&chartMove.Chart){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;chartMove.Chart.Point={X:x,Y:y};chartMove.Chart.IsShow=true;chartMove.Chart.Info=this.IndexChartDrag.Info;this.DrawDynamicInfo();}this.IndexChartDrag.LastMove.X=x;this.IndexChartDrag.LastMove.Y=y;drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}else if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==1||drawPicture.Status==2){if(Math.abs(drag.LastMove.X-e.clientX)<5&&Math.abs(drag.LastMove.Y-e.clientY)<5)return;if(this.SetChartDrawPictureSecondPoint(e.clientX,e.clientY)){this.DrawDynamicInfo();}}else if(drawPicture.Status==3){if(this.SetChartDrawPictureThirdPoint(e.clientX,e.clientY)){this.DrawDynamicInfo();}}else if(drawPicture.Status==20)//画图工具移动
1753
+ JSConsole.Chart.Log("[JSChartContainer::DocOnMouseMove] YDrag ",this.YDrag,yMove);this.OnZoomUpDownFrameY(this.YDrag,yMove);drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}else if(this.IndexChartDrag&&this.IndexChartDrag.SelectedChart){if(Math.abs(drag.LastMove.Y-e.clientY)<2&&Math.abs(drag.LastMove.X-e.clientX)<2)return;var chartMove=this.GetExtendChartByClassName("DragMovePaint");if(chartMove&&chartMove.Chart){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;chartMove.Chart.Point={X:x,Y:y};chartMove.Chart.IsShow=true;chartMove.Chart.Info=this.IndexChartDrag.Info;this.DrawDynamicInfo();}this.IndexChartDrag.LastMove.X=x;this.IndexChartDrag.LastMove.Y=y;drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}else if(this.CustomChartDrag){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var sendData={X:x,Y:y,e:e,ChartDrag:this.CustomChartDrag,Drag:drag};this.TryDragMove_CustomChartDrag(sendData);}else if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==1||drawPicture.Status==2){if(Math.abs(drag.LastMove.X-e.clientX)<5&&Math.abs(drag.LastMove.Y-e.clientY)<5)return;if(this.SetChartDrawPictureSecondPoint(e.clientX,e.clientY)){this.DrawDynamicInfo();}}else if(drawPicture.Status==3){if(this.SetChartDrawPictureThirdPoint(e.clientX,e.clientY)){this.DrawDynamicInfo();}}else if(drawPicture.Status==20)//画图工具移动
1754
1754
  {if(Math.abs(drag.LastMove.X-e.clientX)<5&&Math.abs(drag.LastMove.Y-e.clientY)<1)return;if(this.SelectChartDrawPicture){if(this.SelectChartDrawPicture.EnableCtrlMove){if(!e.ctrlKey)return;}}if(this.SelectChartDrawPicture&&this.SelectChartDrawPicture.DragInfo)this.SelectChartDrawPicture.DragInfo.Move={X:e.clientX,Y:e.client};if(this.MoveChartDrawPicture(e.clientX-drag.LastMove.X,e.clientY-drag.LastMove.Y,false,drag)){this.DrawDynamicInfo();}}drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}else if(this.DragMode==1||isDragSelectRect||isDragSubSelectRect)//数据上下左右拖拽
1755
1755
  {this.OnDragMode_One({X:moveSetp,Y:moveSetpY},e);}else if(this.DragMode==2)//区间选择
1756
1756
  {var yMoveSetp=Math.abs(drag.LastMove.Y-e.clientY);if(moveSetp<5&&yMoveSetp<5)return;this.UIElement.style.cursor="default";var x=drag.Click.X-uielement.getBoundingClientRect().left;var y=drag.Click.Y-uielement.getBoundingClientRect().top;var x2=e.clientX-uielement.getBoundingClientRect().left;var y2=e.clientY-uielement.getBoundingClientRect().top;this.ShowSelectRect(x,y,x2,y2);drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.OnDragMode_One=function(moveData,e){var moveSetp=moveData.X;var moveSetpY=moveData.Y;var drag=this.MouseDrag;if(moveSetp<5&&moveSetpY<5)return;var bNeedDraw=false;var bUpDownY=false;if(moveSetpY>=5){if(this.UpDownDrag&&this.UpDownDrag.Index>=0){var yMove=e.clientY-drag.LastMove.Y;JSConsole.Chart.Log("[JSChartContainer::OnDragMode_One] UpDownDrag ",this.UpDownDrag,yMove);this.UIElement.style.cursor="pointer";if(this.OnUpDonwFrameY(this.UpDownDrag,yMove)){bNeedDraw=true;bUpDownY=true;}drag.LastMove.Y=e.clientY;}}if(moveSetp>=5){if(this.RectSelectDrag){if(this.RectSelectDrag.Index>=0){var obj={X:e.clientX,Y:e.clientY,PointIndex:this.RectSelectDrag.Index,Name:"MoveRectSelectLine"};if(this.MoveRectSelectPoint(obj))bNeedDraw=true;}else if(this.RectSelectDrag.Type===4){var obj={X:e.clientX};if(!this.GetXDataIndex(obj))return;if(obj.DataIndex==this.RectSelectDrag.DataIndex)return;var step=obj.DataIndex-this.RectSelectDrag.DataIndex;var isLeft=true;if(step>0)isLeft=false;if(!this.MoveSubRectSelect({Step:Math.abs(step),IsLeft:isLeft,X:e.clientX,Y:e.clientY}))return;this.RectSelectDrag.DataIndex=obj.DataIndex;this.RectSelectDrag.X=e.clientX;bNeedDraw=true;}}else{var isLeft=true;if(drag.LastMove.X<e.clientX)isLeft=false;//右移数据
1757
1757
  var cursorStatus="pointer";if(drag.Click.IsInFrameBottom)cursorStatus="ew-resize";var oneStepWidth=this.GetMoveOneStepWidth();if(moveSetp<oneStepWidth){this.UIElement.style.cursor=cursorStatus;if(bNeedDraw)this.Draw();return;}else{if(drag.Click&&drag.Click.IsInFrameBottom){if(this.XCoordinateZoom(moveSetp,isLeft)){this.UpdataDataoffset();this.UpdateFrameMaxMin();this.ResetFrameXYSplit();bNeedDraw=true;}}else if(this.DataMove(moveSetp,isLeft)){this.UpdataDataoffset();//this.UpdatePointByCursorIndex(); //推拽数据的时候不需要把鼠标位置更新到K线上
1758
1758
  this.UpdateFrameMaxMin();this.ResetFrameXYSplit();bNeedDraw=true;}else if(!bUpDownY){if(this.DragDownloadData)this.DragDownloadData();}}this.UIElement.style.cursor=cursorStatus;}drag.LastMove.X=e.clientX;}if(bNeedDraw){this.Draw();this.OnKLinePageChange("datamove");}};this.GetXDataIndex=function(obj){if(!this.ChartPaint[0]||!this.ChartPaint[0].Data)return false;var kData=this.ChartPaint[0].Data;if(!this.Frame.SubFrame[0])return false;var subFrame=this.Frame.SubFrame[0].Frame;if(!subFrame)false;var pixelTatio=GetDevicePixelRatio();var x=(obj.X-uielement.getBoundingClientRect().left)*pixelTatio;var index=subFrame.GetXData(x);index=parseInt(index.toFixed(0));var dataIndex=index+kData.DataOffset;if(dataIndex>=kData.Data.length)dataIndex=kData.Data.length-1;var item=kData.Data[dataIndex];obj.DataIndex=dataIndex;obj.Item=item;//JSConsole.Chart.Log("[JSChartContainer::GetXDataIndex] point, item", obj.PointIndex, item);
1759
1759
  return true;};this.DocOnMouseUp=function(e){//清空事件
1760
- document.onmousemove=null;document.onmouseup=null;var IsMinuteChart=this.ClassName=="MinuteChartContainer"||this.ClassName=="MinuteChartHScreenContainer"?true:false;var isDragSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Index>=0;var isDragSubSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Type==4;var bClearDrawPicture=true;if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==2||drawPicture.Status==1||drawPicture.Status==3){drawPicture.PointStatus=drawPicture.Status;if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo();else bClearDrawPicture=false;}else if(drawPicture.Status==20){if(this.FinishMoveChartDrawPicture())this.DrawDynamicInfo();}}else if(this.IndexChartDrag&&this.IndexChartDrag.SelectedChart){var chartMove=this.GetExtendChartByClassName("DragMovePaint");if(chartMove&&chartMove.Chart)chartMove.Chart.Clear();if(!this.OnDragChart(this.IndexChartDrag))this.DrawDynamicInfo();this.UIElement.style.cursor="default";}else if(isDragSelectRect)//区间选择拖动范围
1760
+ document.onmousemove=null;document.onmouseup=null;var IsMinuteChart=this.ClassName=="MinuteChartContainer"||this.ClassName=="MinuteChartHScreenContainer"?true:false;var isDragSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Index>=0;var isDragSubSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Type==4;var bClearDrawPicture=true;if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==2||drawPicture.Status==1||drawPicture.Status==3){drawPicture.PointStatus=drawPicture.Status;if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo();else bClearDrawPicture=false;}else if(drawPicture.Status==20){if(this.FinishMoveChartDrawPicture())this.DrawDynamicInfo();}}else if(this.IndexChartDrag&&this.IndexChartDrag.SelectedChart){var chartMove=this.GetExtendChartByClassName("DragMovePaint");if(chartMove&&chartMove.Chart)chartMove.Chart.Clear();if(!this.OnDragChart(this.IndexChartDrag))this.DrawDynamicInfo();this.UIElement.style.cursor="default";}else if(this.CustomChartDrag){var sendData={e:e,ChartDrag:this.CustomChartDrag,Drag:this.MouseDrag};this.TryMouseUp_CustomChartDrag(sendData);}else if(isDragSelectRect)//区间选择拖动范围
1761
1761
  {if(this.OnDragSelectRectMouseUp)this.OnDragSelectRectMouseUp(e);}else if(isDragSubSelectRect){if(this.OnDragSubSelectRectMouseUp)this.OnDragSubSelectRectMouseUp(e);}else if(IsMinuteChart){if(this.OnMinuteSelectRectMouseUp)this.OnMinuteSelectRectMouseUp(e);}else if(this.DragMode==2)//区间选择
1762
1762
  {var drag=this.MouseDrag;drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;var selectData=new SelectRectData();var pixelTatio=GetDevicePixelRatio();//区间起始位置 结束位子
1763
1763
  selectData.XStart=(drag.Click.X-uielement.getBoundingClientRect().left)*pixelTatio;selectData.YStart=(drag.Click.Y-uielement.getBoundingClientRect().top)*pixelTatio;selectData.XEnd=(drag.LastMove.X-uielement.getBoundingClientRect().left)*pixelTatio;selectData.YEnd=(drag.LastMove.Y-uielement.getBoundingClientRect().top)*pixelTatio;selectData.JSChartContainer=this;selectData.Stock={Symbol:this.Symbol,Name:this.Name};if(!this.BorderDrag&&this.GetSelectRectData(selectData)){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);var paint=this.GetRectSelectPaint();var isShowMenu=true;if(event&&event.Callback){var data={X:drag.LastMove.X-uielement.getBoundingClientRect().left,Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,SelectData:selectData,//区间选择的数据
@@ -1767,7 +1767,7 @@ IsShowMenu:true};event.Callback(event,data,this);isShowMenu=data.IsShowMenu;}if(
1767
1767
  RectSelectPaint:paint//区间选择背景
1768
1768
  };this.SelectRectRightMenu.DoModal(e);}}}else{this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICKUP_CHART_PAINT,this.ClickDownPoint,e);}}else{this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICKUP_CHART_PAINT,this.ClickDownPoint,e);this.ClickEvent(e);}//清空数据
1769
1769
  JSConsole.Chart.Log('[KLineChartContainer::document.onmouseup]',e);if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.DragInfo=null;this.UIElement.style.cursor="default";this.MouseDrag=null;this.ClickDownPoint=null;this.IsOnTouch=false;if(this.BorderDrag&&this.BorderDrag.Index>=0)this.Frame.SaveSubFrameHeightRate();//拖拽指标窗口高度以后保存
1770
- this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;if(bClearDrawPicture===true)this.CurrentChartDrawPicture=null;};this.UIOnMounseOut=function(e){JSConsole.Chart.Log('[KLineChartContainer::UIOnMounseOut]',e);this.UIOnMouseMove(e);};this.UIOnMouseleave=function(e){JSConsole.Chart.Log('[KLineChartContainer::UIOnMouseleave]',e);//this.UIOnMouseMove(e);
1770
+ this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;if(bClearDrawPicture===true)this.CurrentChartDrawPicture=null;};this.UIOnMounseOut=function(e){JSConsole.Chart.Log('[KLineChartContainer::UIOnMounseOut]',e);this.UIOnMouseMove(e);};this.UIOnMouseleave=function(e){JSConsole.Chart.Log('[KLineChartContainer::UIOnMouseleave]',e);//this.UIOnMouseMove(e);
1771
1771
  };this.OnDragChart=function(drag){if(!drag)return false;var info=drag.Info;var lastMove=drag.LastMove;var startFrameID=info.FrameID;var endFrameID=this.Frame.PtInFrame(lastMove.X,lastMove.Y);if(endFrameID<0){if(endFrameID==-3)//底部 移动到新的窗口
1772
1772
  return this.MoveIndexToNewWindow({WindowIndex:startFrameID,IndexID:info.IndexID},{Operator:0});return false;}if(startFrameID==endFrameID)return false;//移动指标
1773
1773
  return this.MoveIndex({WindowIndex:startFrameID,IndexID:info.IndexID},{WindowIndex:endFrameID},{Operator:0});};//获取选中图形信息
@@ -1783,7 +1783,7 @@ this.IsPhonePinching=function(e){var changed=e.changedTouches.length;var touchin
1783
1783
  for(var i=0;i<e.touches.length;++i){var item=e.touches[i];if(isForceLandscape){touches.push({clientX:item.clientY*pixelTatio,clientY:item.clientX*pixelTatio,pageX:item.pageY*pixelTatio,pageY:item.pageX*pixelTatio});}else{touches.push({clientX:item.clientX*pixelTatio,clientY:item.clientY*pixelTatio,pageX:item.pageX*pixelTatio,pageY:item.pageY*pixelTatio});}}return touches;};this.IsSingleTouch=function(e)//是否是单点触屏
1784
1784
  {var touchCount=e.touches.length;return touchCount==1;};this.StopDragTimer=function(){if(IFrameSplitOperator.IsNumber(this.DragTimer)){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.GetMoveAngle=function(pt,pt2)//计算角度
1785
1785
  {var xMove=Math.abs(pt.X-pt2.X);var yMove=Math.abs(pt.Y-pt2.Y);var angle=Math.atan(xMove/yMove)*180/Math.PI;return angle;};//手机拖拽
1786
- uielement.ontouchstart=function(e){_this4.OnTouchStart(e);};uielement.ontouchmove=function(e){_this4.OnTouchMove(e);};uielement.ontouchend=function(e){_this4.OnTouchEnd(e);};this.AddPhoneDBClickInfo=function(x,y,time){var item={X:x,Y:y,Time:time};this.PhoneDBClickInfo.Start.push(item);};this.ClearPhoneDBClickInfo=function(){this.PhoneDBClickInfo.Start=[];};this.IsShortPhoneClick=function(x,y,time){};this.OnTouchStart=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsOnTouch=true;this.TouchDrawCount=0;this.PhonePinch=null;this.StopDragTimer();var isSingleTouch=this.IsSingleTouch(e);if(this.EnableScrollUpDown==false||!isSingleTouch||//多点触屏
1786
+ uielement.ontouchstart=function(e){_this6.OnTouchStart(e);};uielement.ontouchmove=function(e){_this6.OnTouchMove(e);};uielement.ontouchend=function(e){_this6.OnTouchEnd(e);};this.AddPhoneDBClickInfo=function(x,y,time){var item={X:x,Y:y,Time:time};this.PhoneDBClickInfo.Start.push(item);};this.ClearPhoneDBClickInfo=function(){this.PhoneDBClickInfo.Start=[];};this.IsShortPhoneClick=function(x,y,time){};this.OnTouchStart=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsOnTouch=true;this.TouchDrawCount=0;this.PhonePinch=null;this.StopDragTimer();var isSingleTouch=this.IsSingleTouch(e);if(this.EnableScrollUpDown==false||!isSingleTouch||//多点触屏
1787
1787
  this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID&&this.TouchStatus.CorssCursorShow==true)//十字光标显示,不能滚动页面
1788
1788
  {if(e.cancelable)e.preventDefault();}if(this.IsPhoneDragging(e)){var touches=this.GetToucheData(e,this.IsForceLandscape);var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);if(this.TryClickLock||this.TryClickIndexTitle)//指标枷锁区域 , 指标标题点击
1789
1789
  {var x=pt.X;var y=pt.Y;if(this.TryClickLock&&this.TryClickLock(x,y))return;if(this.TryClickIndexTitle&&this.TryClickIndexTitle(x,y))return;}if(this.ClickFrameButton){var button=this.Frame.PtInButtons(pt.X,pt.Y);if(button){this.ClickFrameButton(button,e);return;}}if(this.EnableVerticalDrag){this.VerticalDrag={IsDrag:false};if(this.Frame.PtInFrameVertical(pt.X,pt.Y))this.VerticalDrag.IsDrag=true;}var bStartTimer=true;if(this.ChartDrawOption.IsLockScreen){bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID){if(this.TouchStatus.CorssCursorShow==true)bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.DISABLE_DRAG_ID){bStartTimer=false;}else{if(!isSingleTouch)bStartTimer=false;}if(this.VerticalDrag)bStartTimer=false;if(this.EnableClickModel&&this.ClickModel.IsShowCorssCursor==true)bStartTimer=false;var drag={"Click":{},"LastMove":{}//最后移动的位置
@@ -1819,10 +1819,10 @@ for(var i=0;i<this.ChartDrawPicture.length;++i){var item=this.ChartDrawPicture[i
1819
1819
  for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];item.Canvas=canvas;}//扩展图形
1820
1820
  for(var i=0;i<this.ChartPaintEx.length;++i){var item=this.ChartPaintEx[i];item.Canvas=canvas;}//叠加股票
1821
1821
  for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];item.Canvas=canvas;}//扩展画法
1822
- for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];item.Canvas=canvas;}};this.Draw=function(){var _this6=this;if(this.ChartCorssCursor)this.ChartCorssCursor.Status=0;if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.StopDrawDynamicInfo();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_BEFORE_DRAW);if(event&&event.Callback){var sendData={};event.Callback(event,sendData,this);}this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);if(this.CacheCanvas)this.CacheCanvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
1822
+ for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];item.Canvas=canvas;}};this.Draw=function(){var _this8=this;if(this.ChartCorssCursor)this.ChartCorssCursor.Status=0;if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.StopDrawDynamicInfo();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_BEFORE_DRAW);if(event&&event.Callback){var sendData={};event.Callback(event,sendData,this);}this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);if(this.CacheCanvas)this.CacheCanvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
1823
1823
  this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
1824
1824
  if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.ClearCoordinateText();this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}if(this.CacheCanvas)this.SetCanvas(this.CacheCanvas);//框架
1825
- if(this.Frame.SetBeforeDrawXYCallback){this.Frame.SetBeforeDrawXYCallback(function(frame){_this6.BeforeDrawXYCoordinate(frame);});}this.Frame.Draw();if(this.Frame.DrawCustomVertical){var eventCVericalDraw=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_VERTICAL_DRAW);this.Frame.DrawCustomVertical(eventCVericalDraw);}this.Frame.CalculateLock();for(var i=0;i<this.ChartDrawPicture.length;++i){var item=this.ChartDrawPicture[i];if(!item.IsDrawMain)continue;if(item.IsDrawMain())item.MainDraw();}//框架内图形
1825
+ if(this.Frame.SetBeforeDrawXYCallback){this.Frame.SetBeforeDrawXYCallback(function(frame){_this8.BeforeDrawXYCoordinate(frame);});}this.Frame.Draw();if(this.Frame.DrawCustomVertical){var eventCVericalDraw=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_VERTICAL_DRAW);this.Frame.DrawCustomVertical(eventCVericalDraw);}this.Frame.CalculateLock();for(var i=0;i<this.ChartDrawPicture.length;++i){var item=this.ChartDrawPicture[i];if(!item.IsDrawMain)continue;if(item.IsDrawMain())item.MainDraw();}//框架内图形
1826
1826
  for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.IsDrawFirst)item.Draw();}if(this.Frame.DrawOveraly)this.Frame.DrawOveraly(true);//画叠加指标
1827
1827
  for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.IsDrawFirst)item.Draw();}for(var i=0;i<this.ChartPaintEx.length;++i){var item=this.ChartPaintEx[i];item.Draw();}//叠加股票
1828
1828
  for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];item.Draw();}if(this.Frame.DrawOveraly)this.Frame.DrawOveraly(false);//画叠加指标
@@ -1865,21 +1865,21 @@ if(option&&option.Point&&(option.ParentFunction=='OnMouseMove'||option.ParentFun
1865
1865
  var barrageData=null;for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.ClassName==='BarragePaint'){bCreated=true;barrageData=item.BarrageList;break;}}if(!bCreated){var chart=new BarragePaint();chart.Canvas=this.Canvas;chart.ChartBorder=this.Frame.ChartBorder;chart.ChartFrame=this.Frame;chart.HQChart=this;chart.SetOption(option);this.ExtendChartPaint.push(chart);barrageData=chart.BarrageList;}this.EnableAnimation=true;var self=this;window.requestAnimationFrame(function(){self.DrawAnimation();});return barrageData;};this.StopAnimation=function(){this.EnableAnimation=false;this.DrawDynamicInfo();};this.GetChartTooltipData=function(x,y,option){var toolTip=new TooltipData();if(this.ChartInfoPaint){if(this.ChartInfoPaint.GetTooltipData(x,y,toolTip))return toolTip;}if(this.PtInChartPaintTooltip(x,y,toolTip))return toolTip;if(IFrameSplitOperator.IsNonEmptyArray(this.Frame.SubFrame)){for(var i=0;i<this.Frame.SubFrame.length;++i){var subFrame=this.Frame.SubFrame[i];for(var j=0;j<subFrame.OverlayIndex.length;++j){var overlayItem=subFrame.OverlayIndex[j];for(var k=0;k<overlayItem.ChartPaint.length;++k){var item=overlayItem.ChartPaint[k];if(item.GetTooltipData(x,y,toolTip))return toolTip;}}}}if(this.PtInOverlayChartPaintTooltip(x,y,toolTip))return toolTip;return null;};this.PtInExtendChartButtons=function(x,y){for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.PtInButtons){var button=item.PtInButtons(x,y);if(button){button.Chart=item;return button;}}}return null;};this.ClickExtendChartButton=function(button,e){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_EXTENDCHART_BUTTON);if(event&&event.Callback){var data={Info:button,PreventDefault:false};//PreventDefault 是否阻止内置的点击处理
1866
1866
  event.Callback(event,data,this);if(data.PreventDefault)return;}};this.PtInDrawPictureButtons=function(x,y){for(var i=0;i<this.ChartDrawPicture.length;++i){var item=this.ChartDrawPicture[i];if(!item.PtInButtons)continue;var button=item.PtInButtons(x,y);if(button){button.Chart=item;return button;}}return null;};this.ClickDrawPictureButton=function(button,e){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_DRAWPICTURE_BUTTON);if(event&&event.Callback){var data={Info:button,PreventDefault:false};//PreventDefault 是否阻止内置的点击处理
1867
1867
  event.Callback(event,data,this);if(data.PreventDefault)return;}if(button.ID==JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE){JSConsole.Chart.Log(button,"ClickDrawPictureButton");this.ClearChartDrawPicture(button.Chart);//删除画图工具
1868
- }else if(button.ID==JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING){}};this.PtInTitleButtons=function(x,y){for(var i=0;i<this.TitlePaint.length;++i){var item=this.TitlePaint[i];if(!item.PtInButtons)continue;var button=item.PtInButtons(x,y);if(button){button.Chart=item;return button;}}return null;};this.OnMouseMove=function(x,y,e,isPhone){var _this7=this;this.StopDrawDynamicInfo();this.LastPoint.X=x;this.LastPoint.Y=y;var mouseStatus=null;//鼠标状态
1868
+ }else if(button.ID==JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING){}};this.PtInTitleButtons=function(x,y){for(var i=0;i<this.TitlePaint.length;++i){var item=this.TitlePaint[i];if(!item.PtInButtons)continue;var button=item.PtInButtons(x,y);if(button){button.Chart=item;return button;}}return null;};this.OnMouseMove=function(x,y,e,isPhone){var _this9=this;this.StopDrawDynamicInfo();this.LastPoint.X=x;this.LastPoint.Y=y;var mouseStatus=null;//鼠标状态
1869
1869
  var button=null;//当前鼠标所在按钮
1870
1870
  var frameID=this.Frame.PtInFrame(x,y);if(IFrameSplitOperator.IsNumber(frameID)&&frameID>=0)//在K线内部移动,调整K线索引
1871
1871
  this.CursorIndex=this.Frame.GetXData(x);if(this.EnableBorderDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){mouseStatus={Cursor:"n-resize",Name:"DragBorder"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag border ",dragBorder);}}if(this.EnableYDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragY=this.TryYDrag(x,y);if(dragY){mouseStatus={Cursor:dragY.Position==0?"n-resize":"row-resize",Name:"DragY"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag y ",dragY);}}if(!this.CurrentChartDrawPicture){button=this.PtInButton(x,y);if(button){mouseStatus={Cursor:"pointer",Name:button.Name};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ",button);}}if(this.ChartCorssCursor){var crossButton=this.ChartCorssCursor.PtInButton(x,y);if(crossButton){mouseStatus={Cursor:"pointer",Name:"CorssCursorButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] cross cursor button ",crossButton);}}if(this.ClassName=="KLineChartContainer"&&this.Frame.PtInFrameBottom(x,y)){mouseStatus={Cursor:"ew-resize",Name:"FrameButtom"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");}if(this.SelectedChart.EnableMoveOn&&this.PtInChart&&!this.CurrentChartDrawPicture){var chartInfo=this.PtInChart(x,y);if(chartInfo&&chartInfo.Identify){mouseStatus={Cursor:"pointer",Name:"PtInChart"};this.SelectedChart.MoveOn.Identify=chartInfo.Identify;this.SelectedChart.MoveOn.Identify=null;JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] Point in chart ",chartInfo);}else{this.SelectedChart.MoveOn.Identify=null;}}else{this.SelectedChart.MoveOn.Identify=null;}//区间选择
1872
1872
  var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){if(item.Type==4)mouseStatus={Cursor:"pointer",Name:"DragRectSelect"};//子区域选中
1873
- else mouseStatus={Cursor:"ew-resize",Name:"DragRectSelect"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag rect select ",item);}}var bDrawPicture=false;//是否正在画图
1873
+ else mouseStatus={Cursor:"ew-resize",Name:"DragRectSelect"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag rect select ",item);}}var sendData={MouseStatus:null,X:x,Y:y,FrameID:frameID,e:e};if(this.TryMouseMove_CustomChartDrag(sendData)){if(sendData.MouseStatus)mouseStatus=sendData.MouseStatus;}var bDrawPicture=false;//是否正在画图
1874
1874
  if(this.CurrentChartDrawPicture){var index=this.Frame.PtInChartFrame(x,y);if(this.CurrentChartDrawPicture.Status!=20){var bDrawValid=false;//是否在有效绘图区域里面
1875
1875
  if(IFrameSplitOperator.IsNumber(this.CurrentChartDrawPicture.LimitFrameID)){if(index>=0&&index==this.CurrentChartDrawPicture.LimitFrameID)bDrawValid=true;}else{if(index>=0)bDrawValid=true;}mouseStatus={Cursor:bDrawValid?"crosshair":"not-allowed",Name:"CurrentChartDrawPicture"};}if(this.CurrentChartDrawPicture.SetLastPoint)this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});bDrawPicture=true;}else{var drawPictrueData={};drawPictrueData.X=x;drawPictrueData.Y=y;if(this.GetChartDrawPictureByPoint(drawPictrueData)&&drawPictrueData.ChartDrawPicture&&drawPictrueData.ChartDrawPicture.EnableMove==true){if(drawPictrueData.PointIndex===100){if(drawPictrueData.Cursor)this.UIElement.style.cursor=drawPictrueData.Cursor;else this.UIElement.style.cursor="move";}else{if(drawPictrueData.Cursor)this.UIElement.style.cursor=drawPictrueData.Cursor;else this.UIElement.style.cursor="pointer";}bDrawPicture=true;this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.UIElement.style.cursor="default";}}var clientPos=this.PtInClient(x,y);var option={ParentFunction:'OnMouseMove',Point:{X:x,Y:y},IsPhone:isPhone===true,ClientPos:clientPos};if(e&&(e.type=="mouseout"||e.type=="mouseleave")||button)option.Corss=false;//鼠标移开,在按钮上,不显示十字光标
1876
- if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);if(this.DrawDynamicInfoOption.Enable){this.DrawDynamicInfoOption.Timer=setTimeout(function(){_this7.DrawDynamicInfo(option);},this.DrawDynamicInfoOption.DelayTime);}else{this.DrawDynamicInfo(option);}if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;if(this.IsShowTooltip&&bDrawPicture==false){var toolTip=this.GetChartTooltipData(x,y);if(toolTip&&toolTip.Data){if(isPhone===true){var touche=e.touches[0];var xTooltip=touche.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=touche.clientY-this.UIElement.getBoundingClientRect().top;}else{var xTooltip=e.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=e.clientY-this.UIElement.getBoundingClientRect().top;}this.ShowTooltip(xTooltip,yTooltip,toolTip);}else{this.HideTooltip();}}};this.OnKeyDown=function(e){var _this8=this;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){case 37://left
1876
+ if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);if(this.DrawDynamicInfoOption.Enable){this.DrawDynamicInfoOption.Timer=setTimeout(function(){_this9.DrawDynamicInfo(option);},this.DrawDynamicInfoOption.DelayTime);}else{this.DrawDynamicInfo(option);}if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;if(this.IsShowTooltip&&bDrawPicture==false){var toolTip=this.GetChartTooltipData(x,y);if(toolTip&&toolTip.Data){if(isPhone===true){var touche=e.touches[0];var xTooltip=touche.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=touche.clientY-this.UIElement.getBoundingClientRect().top;}else{var xTooltip=e.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=e.clientY-this.UIElement.getBoundingClientRect().top;}this.ShowTooltip(xTooltip,yTooltip,toolTip);}else{this.HideTooltip();}}};this.OnKeyDown=function(e){var _this10=this;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){case 37://left
1877
1877
  if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}if(this.CursorIndex<=0.99999){if(!this.DataMoveLeft()){//左移数据到头了 触发下载新数据
1878
1878
  if(this.DragDownloadData)this.DragDownloadData();break;}this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");}else{--this.CursorIndex;this.UpdatePointByCursorIndex();this.DrawDynamicInfo();this.ShowTooltipByKeyDown();}break;case 39://right
1879
1879
  if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}var xPointcount=0;if(this.Frame.XPointCount)xPointcount=this.Frame.XPointCount;else xPointcount=this.Frame.SubFrame[0].Frame.XPointCount;if(this.CursorIndex+1>=xPointcount){if(!this.DataMoveRight())break;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");}else{//判断是否在最后一个数据上
1880
1880
  var data=null;if(this.Frame.Data)data=this.Frame.Data;else data=this.Frame.SubFrame[0].Frame.Data;if(!data)break;if(this.CursorIndex+data.DataOffset+1>=data.Data.length)break;++this.CursorIndex;this.UpdatePointByCursorIndex();this.DrawDynamicInfo();this.ShowTooltipByKeyDown();}break;case 38://up
1881
1881
  if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Keyboard===false)break;var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(!this.Frame.ZoomUp(cursorIndex))break;this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");break;case 40://down
1882
- if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Keyboard===false)break;var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(!this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){_this8.ZoomDownloadData(requestData);}}))break;this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");break;case 46://del
1882
+ if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Keyboard===false)break;var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(!this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){_this10.ZoomDownloadData(requestData);}}))break;this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");break;case 46://del
1883
1883
  if(this.SelectChartDrawPicture){var drawPicture=this.SelectChartDrawPicture;JSConsole.Chart.Log("[JSChartContainer::OnKeyDown] delete draw picture.");this.SelectChartDrawPicture=null;if(this.ChartPictureMenu)this.ChartPictureMenu.Hide();this.ClearChartDrawPicture(drawPicture);//删除选中的画图工具
1884
1884
  }else if(this.SelectedChart&&this.SelectedChart.Selected.Identify){var selectedInfo=this.GetSelectedChartInfo(this.SelectedChart.Selected);if(selectedInfo){if(selectedInfo.Type==JSCHART_DRAGCHART_TYPE_ID.OVERLAY_INDEX)this.DeleteOverlayWindowsIndex(selectedInfo.IndexID);else if(selectedInfo.Type==JSCHART_DRAGCHART_TYPE_ID.OVERLAY_KLINE)this.DeleteOverlaySymbol(selectedInfo.Symbol);}}break;case 32://space
1885
1885
  this.OnMarkRectSelect(e);break;case 27://ESCAPE 取消画布工具
@@ -1901,10 +1901,10 @@ this.Frame.SetFrameBorderSizeChange();this.Frame.ReDrawToolbar();this.Draw();};t
1901
1901
  {var pt={X:null,Y:null};pt.X=this.Frame.GetXFromIndex(this.CursorIndex);var index=Math.abs(this.CursorIndex-0.5);if(this.IsKLineContainer())index=this.CursorIndex;var data=this.Frame.Data;if(data.DataOffset+index<data.Data.length){var close=data.Data[data.DataOffset+index].Close;pt.Y=this.Frame.GetYFromData(close);}if(type==1&&this.ChartCorssCursor){if(this.ChartCorssCursor.Status==1)//十字光标显示中, 不调整位置
1902
1902
  {}else{this.LastPoint.X=this.Frame.GetXFromIndex(this.CursorIndex);var index=Math.abs(this.CursorIndex-0.5);index=parseInt(index.toFixed(0));if(this.IsKLineContainer())index=this.CursorIndex;this.LastPoint.Y=null;}}else if(type==2&&this.ChartCorssCursor)//取消鼠标位置,十字光标就不显示了
1903
1903
  {this.LastPoint.Y=null;this.LastPoint.X=null;}else{this.LastPoint.X=pt.X;this.LastPoint.Y=pt.Y;}};this.ShowTooltipByKeyDown=function(){var index=Math.abs(this.CursorIndex-0.5);index=parseInt(index.toFixed(0));if(this.ClassName=='KLineChartContainer'||this.ClassName=='KLineTrainChartContainer')index=this.CursorIndex;var data=this.Frame.Data;var toolTip=new TooltipData();toolTip.Data=data.Data[data.DataOffset+index];toolTip.ChartPaint=this.ChartPaint[0];var pixelTatio=GetDevicePixelRatio();if(pixelTatio===0)pixelTatio=1;//div 缩放还是使用原始坐标
1904
- this.ShowTooltip(this.LastPoint.X/pixelTatio,this.LastPoint.Y/pixelTatio,toolTip);};this.ShowTooltip=function(x,y,toolTip){var _this9=this;if(!this.IsShowTooltip)return;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
1904
+ this.ShowTooltip(this.LastPoint.X/pixelTatio,this.LastPoint.Y/pixelTatio,toolTip);};this.ShowTooltip=function(x,y,toolTip){var _this11=this;if(!this.IsShowTooltip)return;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
1905
1905
  var xMove=15/pixelTatio;//顶部坐标偏移位置
1906
1906
  if(toolTip.Type===0)//K线信息
1907
- {var scrollPos=GetScrollPosition();var left=x;var top=y;var format=g_DivTooltipDataForamt.Create('HistoryDataStringFormat');format.Value=toolTip;format.Symbol=this.Symbol;format.LanguageID=this.LanguageID;format.GetEventCallback=function(id){return _this9.GetEventCallback(id);};if(!format.Operator())return;var textHeight=format.LineCount*25;//每行的行高25
1907
+ {var scrollPos=GetScrollPosition();var left=x;var top=y;var format=g_DivTooltipDataForamt.Create('HistoryDataStringFormat');format.Value=toolTip;format.Symbol=this.Symbol;format.LanguageID=this.LanguageID;format.GetEventCallback=function(id){return _this11.GetEventCallback(id);};if(!format.Operator())return;var textHeight=format.LineCount*25;//每行的行高25
1908
1908
  if(format.Height>0)textHeight=format.Height;//新版本高度有格式化类计算完成
1909
1909
  var width=format.Width;this.Tooltip.style.width=width+"px";this.Tooltip.style.height=textHeight+"px";//JSConsole.Chart.Log(`[JSChartContainer::ShowTooltip] left=${left} top=${top} xMove=${xMove}` );
1910
1910
  //if (toolTip.ChartPaint.Name=="Overlay-KLine") this.Tooltip.style.height =220+"px";
@@ -2002,7 +2002,7 @@ this.SetSubFrameAttribute=function(subFrame,windowItem,frameItem){if(!subFrame||
2002
2002
  }if(IFrameSplitOperator.IsBool(frameItem.IsShowRightText)){frame.IsShowYText[1]=frameItem.IsShowRightText;frame.YSplitOperator.IsShowRightText=frameItem.IsShowRightText;//显示右边刻度
2003
2003
  }if(IFrameSplitOperator.IsNumber(frameItem.Height)&&frameItem.Height>=0)subFrame.Height=frameItem.Height;}};this.SetSubFrameOption=function(subFrame,option){if(!option)return;if(option.Window){var item=option.Window;if(item.Modify!=null)subFrame.Frame.ModifyIndex=item.Modify;if(item.Change!=null)subFrame.Frame.ChangeIndex=item.Change;if(item.Close!=null)subFrame.Frame.CloseIndex=item.Close;if(item.Overlay!=null)subFrame.Frame.OverlayIndex=item.Overlay;if(item.IsDrawTitleBG==true)subFrame.Frame.IsDrawTitleBG=item.IsDrawTitleBG;if(IFrameSplitOperator.IsBool(item.IsShowNameArrow))subFrame.Frame.IsShowNameArrow=item.IsShowNameArrow;if(item.OverlayIndexType){if(IFrameSplitOperator.IsNumber(item.OverlayIndexType.Position))subFrame.Frame.OverlayIndexType.Position=item.OverlayIndexType.Position;if(IFrameSplitOperator.IsNumber(item.OverlayIndexType.LineSpace))subFrame.Frame.OverlayIndexType.LineSpace=item.OverlayIndexType.LineSpace;}}if(IFrameSplitOperator.IsNumber(option.SplitCount))subFrame.Frame.YSplitOperator.SplitCount=option.SplitCount;if(IFrameSplitOperator.IsNumber(option.TitleHeight))subFrame.Frame.ChartBorder.TitleHeight=option.TitleHeight;if(IFrameSplitOperator.IsBool(option.IsShowTitleArraw))subFrame.Frame.IsShowTitleArraw=option.IsShowTitleArraw;if(IFrameSplitOperator.IsBool(option.IsShowIndexName))subFrame.Frame.IsShowIndexName=option.IsShowIndexName;if(IFrameSplitOperator.IsBool(option.IsShowOverlayIndexName))subFrame.Frame.IsShowOverlayIndexName=option.IsShowOverlayIndexName;if(IFrameSplitOperator.IsNumber(option.IndexParamSpace))subFrame.Frame.IndexParamSpace=option.IndexParamSpace;if(IFrameSplitOperator.IsBool(option.IsShowXLine))subFrame.Frame.IsShowXLine=option.IsShowXLine;if(IFrameSplitOperator.IsBool(option.IsShowYLine))subFrame.Frame.IsShowYLine=option.IsShowYLine;if(IFrameSplitOperator.IsBool(option.IsShowIndexTitle))subFrame.Frame.IsShowIndexTitle=option.IsShowIndexTitle;if(IFrameSplitOperator.IsBool(option.IsShowLeftText)){subFrame.Frame.IsShowYText[0]=option.IsShowLeftText;subFrame.Frame.YSplitOperator.IsShowLeftText=option.IsShowLeftText;//显示左边刻度
2004
2004
  }if(IFrameSplitOperator.IsBool(option.IsShowRightText)){subFrame.Frame.IsShowYText[1]=option.IsShowRightText;subFrame.Frame.YSplitOperator.IsShowRightText=option.IsShowRightText;//显示右边刻度
2005
- }};this.AddNewSubFrame=function(option){var _this10=this;var index=this.Frame.SubFrame.length;var subFrame=this.CreateSubFrameItem(index);var pixelRatio=GetDevicePixelRatio();subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[index]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[index].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this10.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
2005
+ }};this.AddNewSubFrame=function(option){var _this12=this;var index=this.Frame.SubFrame.length;var subFrame=this.CreateSubFrameItem(index);var pixelRatio=GetDevicePixelRatio();subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[index]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[index].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this12.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
2006
2006
  for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;}this.UpdataDataoffset();//更新数据偏移
2007
2007
  this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
2008
2008
  this.Draw();return index;};//增加一个指标窗口
@@ -2026,7 +2026,7 @@ paint.PreventClose=false;paint.ClearPoint();paint.PreventClose=oldPreventClose;/
2026
2026
  this.DeleteOverlayIndex=function(identify,windowIndex){var findIndex=null;if(IFrameSplitOperator.IsNumber(windowIndex)){if(windowIndex>=0&&windowIndex<this.Frame.SubFrame.length){var item=this.Frame.SubFrame[windowIndex];for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];if(overlayItem.Identify===identify){for(var k=0;k<overlayItem.ChartPaint.length;++k)//图形销毁事件
2027
2027
  {var overlayChart=overlayItem.ChartPaint[k];if(overlayChart&&overlayChart.OnDestroy)overlayChart.OnDestroy();}item.OverlayIndex.splice(j,1);findIndex=windowIndex;break;}}}}else{for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i];for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];if(overlayItem.Identify===identify){for(var k=0;k<overlayItem.ChartPaint.length;++k)//图形销毁事件
2028
2028
  {var overlayChart=overlayItem.ChartPaint[k];if(overlayChart&&overlayChart.OnDestroy)overlayChart.OnDestroy();}item.OverlayIndex.splice(j,1);findIndex=i;break;}}}}if(findIndex==null){console.warn('[JSChartContainer::DeleteOverlayIndex] can\'t find overlay index. [identify='+identify+']');return false;}var windowsIndex=findIndex+1;var titlePaint=this.TitlePaint[windowsIndex];if(titlePaint.OverlayIndex.has(identify))titlePaint.OverlayIndex.delete(identify);if(titlePaint.OverlayDynamicTitle.has(identify))titlePaint.OverlayDynamicTitle.delete(identify);return true;};this.FindScriptIndex=function(guid,windowsIndex){if(IFrameSplitOperator.IsNumber(windowsIndex)&&windowsIndex>=0){if(windowsIndex>=this.Frame.SubFrame.length)return null;var item=this.WindowIndex[windowsIndex];if(item&&item.Guid==guid)return{Type:0,Data:item,WindowIndex:windowsIndex};var item=this.Frame.SubFrame[windowsIndex];for(var i=0;i<item.OverlayIndex.length;++i){var overlayItem=item.OverlayIndex[i];if(overlayItem.Identify===guid)return{Type:1,Data:overlayItem,WindowIndex:windowsIndex,OverlayIndex:i};}}else{for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.WindowIndex[i];if(item&&item.Guid==guid)return{Type:0,Data:item,WindowIndex:i};var item=this.Frame.SubFrame[i];for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];if(overlayItem.Identify===guid)return{Type:1,Data:overlayItem,WindowIndex:i,OverlayIndex:j};}}}return null;};//移动指标 src={ WindowIndex:指标窗口索引,IndexID:指标ID } dest={ WindowIndex:指标窗口索引 } , option={ Operator: 0=移动, 1=复制 }
2029
- this.MoveIndex=function(src,dest,option){var _this11=this;if(!src||!dest||!option)return false;if(!IFrameSplitOperator.IsNumber(src.WindowIndex)||src.WindowIndex<0||src.WindowIndex>=this.Frame.SubFrame.length)return false;if(!IFrameSplitOperator.IsNumber(dest.WindowIndex)||dest.WindowIndex<0||dest.WindowIndex>=this.Frame.SubFrame.length)return false;var find=this.FindScriptIndex(src.IndexID,src.WindowIndex);if(!find)return false;var findItem=null,findOverlayItem=null;if(find.Type==0)findItem=find.Data;else if(find.Type==1)findOverlayItem=find.Data;if(!findOverlayItem&&!findItem)return false;//固定窗口
2029
+ this.MoveIndex=function(src,dest,option){var _this13=this;if(!src||!dest||!option)return false;if(!IFrameSplitOperator.IsNumber(src.WindowIndex)||src.WindowIndex<0||src.WindowIndex>=this.Frame.SubFrame.length)return false;if(!IFrameSplitOperator.IsNumber(dest.WindowIndex)||dest.WindowIndex<0||dest.WindowIndex>=this.Frame.SubFrame.length)return false;var find=this.FindScriptIndex(src.IndexID,src.WindowIndex);if(!find)return false;var findItem=null,findOverlayItem=null;if(find.Type==0)findItem=find.Data;else if(find.Type==1)findOverlayItem=find.Data;if(!findOverlayItem&&!findItem)return false;//固定窗口
2030
2030
  var fixedWindowCount=0;var isMinuteChart=this.ClassName=="MinuteChartContainer"||this.ClassName=="MinuteChartHScreenContainer"?true:false;if(isMinuteChart)fixedWindowCount=2;//走势图固定2个窗口
2031
2031
  if(dest.WindowIndex>=fixedWindowCount&&this.WindowIndex[dest.WindowIndex]==null)//主指标是空的,移动到主指标上
2032
2032
  {if(findItem)this.WindowIndex[dest.WindowIndex]=this.CreateMainScript(findItem);else if(findOverlayItem)this.WindowIndex[dest.WindowIndex]=this.CreateMainScript(findOverlayItem.Script);if(option.Operator==0)//移动模式, 删除原来的
@@ -2034,15 +2034,15 @@ if(dest.WindowIndex>=fixedWindowCount&&this.WindowIndex[dest.WindowIndex]==null)
2034
2034
  this.UpdataDataoffset();//更新数据偏移
2035
2035
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
2036
2036
  this.Draw();}else{var subFrame=this.Frame.SubFrame[dest.WindowIndex];subFrame.Interval=this.OverlayIndexFrameWidth;var overlayFrame=new OverlayIndexItem();var frame=this.CreateOverlayFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;if(findOverlayItem)frame.IsShow=findOverlayItem.Frame.IsShow;//if (obj.IsShareY===true) frame.IsShareY=true;
2037
- frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this11.GetEventCallback(id);};overlayFrame.Frame=frame;var scriptIndex;if(findItem){scriptIndex=this.CreateOverlayScript(findItem);scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:dest.WindowIndex,Frame:overlayFrame};//叠加指标信息
2037
+ frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this13.GetEventCallback(id);};overlayFrame.Frame=frame;var scriptIndex;if(findItem){scriptIndex=this.CreateOverlayScript(findItem);scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:dest.WindowIndex,Frame:overlayFrame};//叠加指标信息
2038
2038
  }else if(findOverlayItem){scriptIndex=this.CreateOverlayScript(findOverlayItem.Script);scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:dest.WindowIndex,Frame:overlayFrame};//叠加指标信息
2039
2039
  }overlayFrame.Script=scriptIndex;subFrame.OverlayIndex.push(overlayFrame);var updateWindowIndex=dest.WindowIndex;if(option.Operator==0)//移动模式, 删除原来的
2040
2040
  {if(findOverlayItem)this.DeleteOverlayIndex(findOverlayItem.Identify,src.WindowIndex);else if(findItem){this.DeleteMainIndex(findItem.Guid,src.WindowIndex);var find=this.FindScriptIndex(overlayFrame.Identify);if(find)updateWindowIndex=find.WindowIndex;}}var bindData=this.GetMainData();this.BindOverlayIndexData(overlayFrame,updateWindowIndex,bindData);this.UpdataDataoffset();//更新数据偏移
2041
2041
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
2042
2042
  this.Draw();}};//移动指标到新的指标窗口 src={ WindowIndex:指标窗口索引,IndexID:指标ID } , option={ Operator: 0=移动, 1=复制 }
2043
- this.MoveIndexToNewWindow=function(src,option){var _this12=this;if(!src||!option)return false;if(!IFrameSplitOperator.IsNumber(src.WindowIndex)||src.WindowIndex<0||src.WindowIndex>=this.Frame.SubFrame.length)return false;var find=this.FindScriptIndex(src.IndexID,src.WindowIndex);if(!find)return false;var findItem=null,findOverlayItem=null;if(find.Type==0)findItem=find.Data;else if(find.Type==1)findOverlayItem=find.Data;if(!findOverlayItem&&!findItem)return false;if(src.WindowIndex==this.Frame.SubFrame.length-1&&this.Frame.SubFrame[src.WindowIndex].OverlayIndex<=0)return false;//指标在最后一个窗口不需要移动
2043
+ this.MoveIndexToNewWindow=function(src,option){var _this14=this;if(!src||!option)return false;if(!IFrameSplitOperator.IsNumber(src.WindowIndex)||src.WindowIndex<0||src.WindowIndex>=this.Frame.SubFrame.length)return false;var find=this.FindScriptIndex(src.IndexID,src.WindowIndex);if(!find)return false;var findItem=null,findOverlayItem=null;if(find.Type==0)findItem=find.Data;else if(find.Type==1)findOverlayItem=find.Data;if(!findOverlayItem&&!findItem)return false;if(src.WindowIndex==this.Frame.SubFrame.length-1&&this.Frame.SubFrame[src.WindowIndex].OverlayIndex<=0)return false;//指标在最后一个窗口不需要移动
2044
2044
  this.RemoveMinSizeWindows();//清空隐藏的指标
2045
- var index=this.Frame.SubFrame.length;var subFrame=this.CreateSubFrameItem(index);var pixelRatio=GetDevicePixelRatio();subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[index]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[index].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.SelectedChart=this.SelectedChart;titlePaint.GetEventCallback=function(id){return _this12.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
2045
+ var index=this.Frame.SubFrame.length;var subFrame=this.CreateSubFrameItem(index);var pixelRatio=GetDevicePixelRatio();subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[index]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[index].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.SelectedChart=this.SelectedChart;titlePaint.GetEventCallback=function(id){return _this14.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
2046
2046
  for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;}if(option.Operator==0)//移动模式, 删除原来的
2047
2047
  {if(findOverlayItem)this.DeleteOverlayIndex(findOverlayItem.Identify,src.WindowIndex);else if(findItem)this.DeleteMainIndex(findItem.Guid,src.WindowIndex);}this.UpdataDataoffset();//更新数据偏移
2048
2048
  this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
@@ -4672,7 +4672,7 @@ this.newMethod();delete this.newMethod;this.ClassName='DrawToolsButton';this.HQC
4672
4672
  this.Color="#696969";//input type="color"不支持rgb的颜色格式
4673
4673
  //this.Left=5;
4674
4674
  this.Top=5*GetDevicePixelRatio();this.Width=45*GetDevicePixelRatio();//宽度
4675
- this.SetOption=function(option){var pixelRatio=GetDevicePixelRatio();if(!option)return;if(option.Width>10)this.Width=option.Width*pixelRatio;};this.Clear=function(){if(this.ToolsDiv)this.ChartBorder.UIElement.parentNode.removeChild(this.ToolsDiv);};this.Draw=function(){var _this13=this;if(this.SizeChange==false)return;//工具列表
4675
+ this.SetOption=function(option){var pixelRatio=GetDevicePixelRatio();if(!option)return;if(option.Width>10)this.Width=option.Width*pixelRatio;};this.Clear=function(){if(this.ToolsDiv)this.ChartBorder.UIElement.parentNode.removeChild(this.ToolsDiv);};this.Draw=function(){var _this15=this;if(this.SizeChange==false)return;//工具列表
4676
4676
  var TOOL_LIST=[[{HTML:{Title:'线段',IClass:'iconfont icon-draw_line',ID:'icon-segment'},Name:'线段'},{HTML:{Title:'尺子',IClass:'iconfont icon-ruler',ID:'icon_ruler'},Name:'尺子'},{HTML:{Title:'射线',IClass:'iconfont icon-draw_rays',ID:'icon-beam'},Name:'射线'},{HTML:{Title:'标价线',IClass:'iconfont icon-price_line',ID:'icon-price-line'},Name:'标价线'},{HTML:{Title:'垂直线',IClass:'iconfont icon-vertical_line',ID:'icon-vertical-line'},Name:'垂直线'},{HTML:{Title:'箭头',IClass:'iconfont icon-draw_rays',ID:'icon-beam2'},Name:'箭头'},{HTML:{Title:'趋势线',IClass:'iconfont icon-draw_trendline',ID:'icon-trendline'},Name:'趋势线'},{HTML:{Title:'水平线',IClass:'iconfont icon-draw_hline',ID:'icon-hline'},Name:'水平线'},{HTML:{Title:'水平线段',IClass:'iconfont icon-draw_hlinesegment',ID:'icon-hlineseg'},Name:'水平线段'},{HTML:{Title:'平行射线',IClass:'iconfont icon-draw_p_rays_lines',ID:'icon-rayslineseg'},Name:'平行射线'},{HTML:{Title:'平行线',IClass:'iconfont icon-draw_parallel_lines',ID:'icon-parallellines'},Name:'平行线'},{HTML:{Title:'平行通道',IClass:'iconfont icon-draw_parallelchannel',ID:'icon-parallelchannel'},Name:'平行通道'},{HTML:{Title:'价格通道线',IClass:'iconfont icon-draw_pricechannel',ID:'icon-pricechannel'},Name:'价格通道线'},{HTML:{Title:'M头W底',IClass:'iconfont icon-draw_wavemw',ID:'icon-wavemw'},Name:'M头W底'},{HTML:{Title:'头肩型',IClass:'iconfont icon-draw_head_shoulders_bt',ID:'icon-Head-Shoulders'},Name:'头肩型'},{HTML:{Title:'波浪尺',IClass:'iconfont icon-waveruler',ID:'icon-wave-ruler'},Name:'波浪尺'},{HTML:{Title:'AB波浪尺',IClass:'iconfont icon-waveruler',ID:'icon-wave-ruler'},Name:'AB波浪尺'},{HTML:{Title:'箱型线',IClass:'iconfont icon-draw_box',ID:'icon-drawbox'},Name:'箱型线'},{HTML:{Title:'涂鸦线段',IClass:'iconfont icon-draw_line',ID:'icon-segment2'},Name:'涂鸦线段'}],[{HTML:{Title:'圆弧',IClass:'iconfont icon-draw_arc',ID:'icon-arc'},Name:'圆弧线'},{HTML:{Title:'矩形',IClass:'iconfont icon-rectangle',ID:'icon-rect'},Name:'矩形'},{HTML:{Title:'平行四边形',IClass:'iconfont icon-draw_quadrangle',ID:'icon-quad'},Name:'平行四边形'},{HTML:{Title:'三角形',IClass:'iconfont icon-draw_triangle',ID:'icon-triangle'},Name:'三角形'},{HTML:{Title:'圆',IClass:'iconfont icon-draw_circle',ID:'icon-circle'},Name:'圆'},{HTML:{Title:'对称角度',IClass:'iconfont icon-draw_symangle',ID:'icon-symangle'},Name:'对称角度'}],[{HTML:{Title:'文本',IClass:'iconfont icon-draw_text',ID:'icon-text'},Name:'文本'},{HTML:{Title:'向上箭头',IClass:'iconfont icon-arrow_up',ID:'icon-arrowup'},Name:'icon-arrow_up'},{HTML:{Title:'向下箭头',IClass:'iconfont icon-arrow_down',ID:'icon-arrowdown'},Name:'icon-arrow_down'},{HTML:{Title:'向左箭头',IClass:'iconfont icon-arrow_left',ID:'icon-arrowleft'},Name:'icon-arrow_left'},{HTML:{Title:'向右箭头',IClass:'iconfont icon-arrow_right',ID:'icon-arrowright'},Name:'icon-arrow_right'}],[{HTML:{Title:'江恩角度线',IClass:'iconfont icon-draw_gannfan',ID:'icon-gannfan'},Name:'江恩角度线'},{HTML:{Title:'斐波那契周期线',IClass:'iconfont icon-draw_fibonacci',ID:'icon-fibonacci'},Name:'斐波那契周期线'},{HTML:{Title:'阻速线',IClass:'iconfont icon-draw_resline',ID:'icon-resline'},Name:'阻速线'},{HTML:{Title:'黄金分割',IClass:'iconfont icon-draw_goldensection',ID:'icon-goldensection'},Name:'黄金分割'},{HTML:{Title:'百分比线',IClass:'iconfont icon-draw_percentage',ID:'icon-percentage'},Name:'百分比线'},{HTML:{Title:'波段线',IClass:'iconfont icon-draw_waveband',ID:'icon-waveband'},Name:'波段线'},{HTML:{Title:'线形回归线',IClass:'iconfont icon-linear_3',ID:'icon-waveband2'},Name:'线形回归线'},{HTML:{Title:'线形回归带',IClass:'iconfont icon-linear_1',ID:'icon-waveband3'},Name:'线形回归带'},{HTML:{Title:'延长线形回归带',IClass:'iconfont icon-linear_2',ID:'icon-waveband5'},Name:'延长线形回归带'}],[{HTML:{Title:'全部删除',IClass:'iconfont icon-recycle_bin',ID:'icon-delete'},Name:'全部删除'}]];var hqChart=this.HQChart;if(!this.ToolsDiv){var div=document.createElement("div");div.className='drawtools';div.id=this.ID;var spanList="";//一层菜单
4677
4677
  var menuTwoList="";//二层菜单
4678
4678
  var menuOne=new Array();TOOL_LIST.forEach(function(item,index){menuOne.push(item[0]);});for(var i=0;i<TOOL_LIST.length;i++){var itemOut=menuOne[i];var itemIn=TOOL_LIST[i];var menuTwoStr="";var contentArrow="";for(var j=0;j<itemIn.length;j++){var currentItem=itemIn[j];var menuTwoName=currentItem.Name;if(menuTwoName.indexOf('up')>-1){menuTwoName="向上箭头";}else if(menuTwoName.indexOf('down')>-1){menuTwoName="向下箭头";}else if(menuTwoName.indexOf('left')>-1){menuTwoName="向左箭头";}else if(menuTwoName.indexOf('right')>-1){menuTwoName="向右箭头";}menuTwoStr+='<p class="menuTwoItem '+currentItem.HTML.ID+'">'+menuTwoName+'<i class="'+currentItem.HTML.IClass+'" title="'+currentItem.HTML.Title+'"></i></p>';}if(i!==TOOL_LIST.length-1){//不是“全部删除”项
@@ -4682,7 +4682,7 @@ event.stopPropagation();(0,_jquery2.default)(".drawtools").find(".menuTwo").hide
4682
4682
  event.stopPropagation();(0,_jquery2.default)(this).siblings('.menuTwo').hide();});if(item.Name=='全部删除'){(0,_jquery2.default)('#'+this.ID+" .first-icon-delete").click(function(){(0,_jquery2.default)(".drawtools").find(".menuTwo").hide();(0,_jquery2.default)(this).siblings().removeClass('active');(0,_jquery2.default)(this).addClass('active');hqChart.ClearChartDrawPicture();(0,_jquery2.default)(".subTolls").css("display","none");});}else{(0,_jquery2.default)('#'+this.ID+" .first-"+menuOne[i].HTML.ID).click(//一层菜单类名是:“first-”+item.HTML.ID
4683
4683
  {// DrawName: menuOne[i].Name, //把画法名字传进去
4684
4684
  CurrentIndex:i},function(event){(0,_jquery2.default)(".drawtools").find(".menuTwo").hide();(0,_jquery2.default)(this).siblings().removeClass('active');(0,_jquery2.default)(this).addClass('active');hqChart.CreateChartDrawPicture(menuOne[event.data.CurrentIndex].Name);});var _loop=function _loop(){itemTwo=TOOL_LIST[i][j];var classname=itemTwo.HTML.IClass;//闭包问题
4685
- (0,_jquery2.default)('#'+_this13.ID+' .'+itemTwo.HTML.ID).hover(function(event){event.stopPropagation();(0,_jquery2.default)(this).closest('.icon-image').find(".contentArrow").addClass("trans");});(0,_jquery2.default)('#'+_this13.ID+' .'+itemTwo.HTML.ID).click(//二层菜单
4685
+ (0,_jquery2.default)('#'+_this15.ID+' .'+itemTwo.HTML.ID).hover(function(event){event.stopPropagation();(0,_jquery2.default)(this).closest('.icon-image').find(".contentArrow").addClass("trans");});(0,_jquery2.default)('#'+_this15.ID+' .'+itemTwo.HTML.ID).click(//二层菜单
4686
4686
  {DrawName:itemTwo.Name,//把画法名字传进去
4687
4687
  CurrentIndex:i,CurrentData:itemTwo},function(event){event.stopPropagation();(0,_jquery2.default)(this).closest('.icon-image').find(".contentArrow").hide();(0,_jquery2.default)(this).siblings().removeClass("current");(0,_jquery2.default)(this).addClass("current");(0,_jquery2.default)(this).closest('.icon-image').children('i').eq(0).removeClass().addClass(classname,"active").attr('title',event.data.CurrentData.HTML.Title);menuOne.splice(event.data.CurrentIndex,1,event.data.CurrentData);(0,_jquery2.default)(this).parent().hide();hqChart.CreateChartDrawPicture(event.data.DrawName);});};for(var j in TOOL_LIST[i]){var itemTwo;_loop();}}}}var curID=this.ID;(0,_jquery2.default)(document).click(function(event){if(!(0,_jquery2.default)("#"+curID).is(event.target)&&(0,_jquery2.default)("#"+curID).has(event.target).length===0){(0,_jquery2.default)("#"+curID+" .menuTwo").hide();(0,_jquery2.default)("#"+curID+" .contentArrow").hide();}});var scrollPos=GetScrollPosition();var pixelRatio=GetDevicePixelRatio();// var left=this.ChartBorder.GetChartWidth()-this.Right-this.ToolsWidth;
4688
4688
  var left=ToFixedPoint(this.ChartBorder.GetRight()+this.Left);// var top = this.Top+this.ChartBorder.UIElement.getBoundingClientRect().top+scrollPos.Top;
@@ -6565,19 +6565,19 @@ this.ChartOperator_Temp_GetHistroyData=function(){var hisData=null;if(!this.Fram
6565
6565
  return hisData;};this.ChartOperator_Temp_Update=function(){this.UpdataDataoffset();//更新数据偏移
6566
6566
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
6567
6567
  this.Frame.SetSizeChage(true);this.Draw();this.UpdatePointByCursorIndex();//更新十字光标位子
6568
- };this.OnWheel=function(e){var _this14=this;JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var isInClient=false;this.Canvas.beginPath();this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());isInClient=this.Canvas.isPointInPath(x,y);var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var enableZoomUpDown=true;//是否允许缩放
6568
+ };this.OnWheel=function(e){var _this16=this;JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var isInClient=false;this.Canvas.beginPath();this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());isInClient=this.Canvas.isPointInPath(x,y);var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var enableZoomUpDown=true;//是否允许缩放
6569
6569
  if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Wheel===false)enableZoomUpDown=false;if(this.SourceData&&this.SourceData.Data){if(isInClient&&wheelValue<0&&enableZoomUpDown)//缩小
6570
- {var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){_this14.ZoomDownloadData(requestData);}})){this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.OnKLinePageChange("wheel");}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
6570
+ {var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){_this16.ZoomDownloadData(requestData);}})){this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.OnKLinePageChange("wheel");}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
6571
6571
  {var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomUp(cursorIndex)){JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex);this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.Draw();this.OnKLinePageChange("wheel");}}}if(!isInClient)return;if(e.preventDefault)e.preventDefault();else e.returnValue=false;};//创建
6572
6572
  //windowCount 窗口个数
6573
- this.Create=function(windowCount,option){var _this15=this;this.UIElement.JSChartContainer=this;//创建十字光标
6574
- this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this15.GetEventCallback(id);};this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this15.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ExtendChartPaint=this.ExtendChartPaint;//创建等待提示
6573
+ this.Create=function(windowCount,option){var _this17=this;this.UIElement.JSChartContainer=this;//创建十字光标
6574
+ this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this17.GetEventCallback(id);};this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this17.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ExtendChartPaint=this.ExtendChartPaint;//创建等待提示
6575
6575
  this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
6576
- this.Frame=new HQTradeFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=30;this.Frame.ChartBorder.Left=5;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.Frame.GetExtendChartRightWidth=function(){return _this15.GetExtendChartRightWidth();};this.Frame.GetExtendChartByClassName=function(name){return _this15.GetExtendChartByClassName(name);};this.Frame.GetEventCallback=function(id){return _this15.GetEventCallback(id);};this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
6576
+ this.Frame=new HQTradeFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=30;this.Frame.ChartBorder.Left=5;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.Frame.GetExtendChartRightWidth=function(){return _this17.GetExtendChartRightWidth();};this.Frame.GetExtendChartByClassName=function(name){return _this17.GetExtendChartByClassName(name);};this.Frame.GetEventCallback=function(id){return _this17.GetEventCallback(id);};this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
6577
6577
  this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();this.CreateExtendChart("RectSelectPaint",option?option.SelectRect:null);//区间统计
6578
6578
  if(this.EnableIndexChartDrag)this.CreateExtendChart("DragMovePaint");//子窗口动态标题
6579
- for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this15.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;var bRegisterKeydown=true;var bRegisterWheel=true;if(option&&option.Listener){var item=option.Listener;if(item.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[KLineChartContainer::Create] not register keydown event.');}if(item.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[KLineChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this15.OnKeyDown(e);},true);//键盘消息
6580
- if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this15.OnWheel(e);},true);//上下滚动消息
6579
+ for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this17.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;var bRegisterKeydown=true;var bRegisterWheel=true;if(option&&option.Listener){var item=option.Listener;if(item.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[KLineChartContainer::Create] not register keydown event.');}if(item.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[KLineChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this17.OnKeyDown(e);},true);//键盘消息
6580
+ if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this17.OnWheel(e);},true);//上下滚动消息
6581
6581
  };this.OnCustomKeyDown=function(keyID,e)//自定义键盘事件
6582
6582
  {if(keyID==37&&e.ctrlKey)//Ctrl+Left
6583
6583
  {this.MoveCorssCursorLeft(this.CtrlMoveStep);return true;}else if(keyID==39&&e.ctrlKey)//Ctrl+Right
@@ -6590,18 +6590,18 @@ if(this.CursorIndex+step+data.DataOffset+1>data.Data.length)//数据不够步长
6590
6590
  {step=data.Data.length-1-data.DataOffset-this.CursorIndex;bMoveEnd=true;}if(this.CursorIndex+step>=xPointcount)//当前屏最右边了
6591
6591
  {var lMoveStep=this.CursorIndex+step-(xPointcount-1);data.DataOffset+=lMoveStep;if(bMoveEnd)this.CursorIndex=xPointcount-1;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");return;}this.CursorIndex+=step;this.UpdatePointByCursorIndex();this.DrawDynamicInfo();this.ShowTooltipByKeyDown();};//获取K线图实例
6592
6592
  this.GetKLineChart=function(){if(!this.ChartPaint[0])return null;return this.ChartPaint[0];};//创建子窗口
6593
- this.CreateChildWindow=function(windowCount){var _this16=this;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=g_ChartFrameFactory.Create("KLineFrame",{ID:i});frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;//窗口序号
6593
+ this.CreateChildWindow=function(windowCount){var _this18=this;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=g_ChartFrameFactory.Create("KLineFrame",{ID:i});frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;//窗口序号
6594
6594
  frame.RightSpaceCount=this.RightSpaceCount;//右边
6595
- frame.GetEventCallback=function(id){return _this16.GetEventCallback(id);};if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
6596
- if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;if(i==0){frame.YSplitOperator=new FrameSplitKLinePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this16.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this16.GetKLineChart();};frame.YSplitOperator.HQChart=this;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
6595
+ frame.GetEventCallback=function(id){return _this18.GetEventCallback(id);};if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
6596
+ if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;if(i==0){frame.YSplitOperator=new FrameSplitKLinePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this18.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this18.GetKLineChart();};frame.YSplitOperator.HQChart=this;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
6597
6597
  border.BottomSpace=15*pixelTatio;//主图上下留空间
6598
- border.TopSpace=15*pixelTatio;frame.GetEventCallback=function(id){return _this16.GetEventCallback(id);};}else{frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.GetEventCallback=function(id){return _this16.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this16.GetKLineChart();};frame.YSplitOperator.HQChart=this;//frame.IsLocked = true;
6599
- }frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitKLineX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.LanguageID=this.LanguageID;frame.XSplitOperator.GetEventCallback=function(id){return _this16.GetEventCallback(id);};if(i!=windowCount-1)frame.XSplitOperator.ShowText=false;for(var j=frame.HorizontalMin;j<=frame.HorizontalMax;j+=1){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=j;if(i==0&&j==frame.HorizontalMin)continue;frame.HorizontalInfo[j].Message[1]=j.toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}};this.CreateSubFrameItem=function(id){var _this17=this;var border=new ChartBorder();border.UIElement=this.UIElement;var frameClassName="KLineFrame";if(this.ClassName=="KLineChartHScreenContainer")frameClassName="KLineHScreenFrame";var frame=g_ChartFrameFactory.Create(frameClassName,{ID:id});frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=id;//窗口序号
6600
- frame.GetEventCallback=function(id){return _this17.GetEventCallback(id);};if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
6601
- if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitKLineX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.ShowText=false;frame.YSplitOperator.GetEventCallback=function(id){return _this17.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this17.GetKLineChart();};frame.YSplitOperator.HQChart=this;frame.XSplitOperator.Symbol=this.Symbol;frame.XSplitOperator.Period=this.Period;//K线数据绑定
6598
+ border.TopSpace=15*pixelTatio;frame.GetEventCallback=function(id){return _this18.GetEventCallback(id);};}else{frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.GetEventCallback=function(id){return _this18.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this18.GetKLineChart();};frame.YSplitOperator.HQChart=this;//frame.IsLocked = true;
6599
+ }frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitKLineX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.LanguageID=this.LanguageID;frame.XSplitOperator.GetEventCallback=function(id){return _this18.GetEventCallback(id);};if(i!=windowCount-1)frame.XSplitOperator.ShowText=false;for(var j=frame.HorizontalMin;j<=frame.HorizontalMax;j+=1){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=j;if(i==0&&j==frame.HorizontalMin)continue;frame.HorizontalInfo[j].Message[1]=j.toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}};this.CreateSubFrameItem=function(id){var _this19=this;var border=new ChartBorder();border.UIElement=this.UIElement;var frameClassName="KLineFrame";if(this.ClassName=="KLineChartHScreenContainer")frameClassName="KLineHScreenFrame";var frame=g_ChartFrameFactory.Create(frameClassName,{ID:id});frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=id;//窗口序号
6600
+ frame.GetEventCallback=function(id){return _this19.GetEventCallback(id);};if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
6601
+ if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitKLineX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.ShowText=false;frame.YSplitOperator.GetEventCallback=function(id){return _this19.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this19.GetKLineChart();};frame.YSplitOperator.HQChart=this;frame.XSplitOperator.Symbol=this.Symbol;frame.XSplitOperator.Period=this.Period;//K线数据绑定
6602
6602
  var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;frame.XPointCount=xPointCouont;frame.Data=this.ChartPaint[0].Data;for(var j=frame.HorizontalMin;j<=frame.HorizontalMax;j+=1){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=j;frame.HorizontalInfo[j].Message[1]=j.toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;subFrame.Height=10;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);if(event&&event.Callback){var sendData={SubFrame:subFrame,WindowIndex:id};event.Callback(event,sendData,this);}return subFrame;};//创建主图K线画法
6603
- this.CreateMainKLine=function(){var _this18=this;var kline=g_ChartPaintFactory.Create("ChartKLine");kline.Canvas=this.Canvas;kline.ChartBorder=this.Frame.SubFrame[0].Frame.ChartBorder;kline.ChartFrame=this.Frame.SubFrame[0].Frame;kline.Name="Main-KLine";kline.DrawType=this.KLineDrawType;kline.Identify="Main-KLine";kline.GetEventCallback=function(id){return _this18.GetEventCallback(id);};this.ChartPaint[0]=kline;this.TitlePaint[0]=new DynamicKLineTitlePainting();this.TitlePaint[0].Frame=this.Frame.SubFrame[0].Frame;this.TitlePaint[0].Canvas=this.Canvas;this.TitlePaint[0].OverlayChartPaint=this.OverlayChartPaint;//绑定叠加
6604
- this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].HQChart=this;this.TitlePaint[0].GetEventCallback=function(id){return _this18.GetEventCallback(id);};};//绑定主图K线数据
6603
+ this.CreateMainKLine=function(){var _this20=this;var kline=g_ChartPaintFactory.Create("ChartKLine");kline.Canvas=this.Canvas;kline.ChartBorder=this.Frame.SubFrame[0].Frame.ChartBorder;kline.ChartFrame=this.Frame.SubFrame[0].Frame;kline.Name="Main-KLine";kline.DrawType=this.KLineDrawType;kline.Identify="Main-KLine";kline.GetEventCallback=function(id){return _this20.GetEventCallback(id);};this.ChartPaint[0]=kline;this.TitlePaint[0]=new DynamicKLineTitlePainting();this.TitlePaint[0].Frame=this.Frame.SubFrame[0].Frame;this.TitlePaint[0].Canvas=this.Canvas;this.TitlePaint[0].OverlayChartPaint=this.OverlayChartPaint;//绑定叠加
6604
+ this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].HQChart=this;this.TitlePaint[0].GetEventCallback=function(id){return _this20.GetEventCallback(id);};};//绑定主图K线数据
6605
6605
  this.BindMainData=function(hisData,showCount){this.ChartPaint[0].Data=hisData;this.ChartPaint[0].Symbol=this.Symbol;if(this.KLineSize){if(this.KLineSize.DataWidth==null){showCount=this.Frame.SubFrame[0].Frame.XPointCount-this.RightSpaceCount;}else{var obj=this.Frame.SetDataWidth(this.KLineSize.DataWidth);showCount=obj.XPointCount-this.RightSpaceCount;this.KLineSize.DataWidth=null;}}for(var i in this.Frame.SubFrame){var item=this.Frame.SubFrame[i].Frame;item.XPointCount=showCount+this.RightSpaceCount;item.Data=this.ChartPaint[0].Data;item.XSplitOperator.Symbol=this.Symbol;item.XSplitOperator.Period=this.Period;}this.TitlePaint[0].Data=this.ChartPaint[0].Data;//动态标题
6606
6606
  this.TitlePaint[0].Symbol=this.Symbol;this.TitlePaint[0].Name=this.Name;this.TitlePaint[0].Period=this.Period;this.ChartCorssCursor.StringFormatX.Data=this.ChartPaint[0].Data;//十字光标
6607
6607
  this.Frame.Data=this.ChartPaint[0].Data;for(var i in this.OverlayChartPaint)//K线叠加 主图股票数据绑定到叠加上
@@ -6630,10 +6630,10 @@ this.UpdateFrameMaxMin();//调整坐标最大 最小值
6630
6630
  this.Frame.SetSizeChage(true);this.Draw();this.UpdatePointByCursorIndex();//更新十字光标位子
6631
6631
  };this.OnMarkRectSelect=function(e){var corssCursor=this.ChartCorssCursor;//十字光标
6632
6632
  if(!corssCursor||corssCursor.Status==0)return;if(!IFrameSplitOperator.IsNumber(corssCursor.CursorIndex))return;if(!this.ChartPaint[0]||!this.ChartPaint[0].Data)return;var paint=this.GetRectSelectPaint();if(!paint)return;var cursorIndex=corssCursor.CursorIndex;JSConsole.Chart.Log("[KLineChartContainer::OnMarkRectSelect] dataIndex",cursorIndex);var kData=this.ChartPaint[0].Data;cursorIndex=parseInt(cursorIndex.toFixed(0));var index=cursorIndex+kData.DataOffset;if(index>=kData.Data.length)index=kData.Data.length-1;var item=kData.Data[index];JSConsole.Chart.Log("[KLineChartContainer::OnMarkRectSelect] item",item);if(!this.SetRectSelectData(item,index))return;var pointCount=paint.GetPointCount();var pixelTatio=GetDevicePixelRatio();if(pointCount==1)//第1个位置
6633
- {var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN_SELECT_RECT_FIRST);if(event&&event.Callback){var data={X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,Item:item,Index:index,RectSelectPaint:paint//区间选择背景
6634
- };event.Callback(event,data,this);}}else if(pointCount==2){var selectData=paint.GetSelectRectData();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN_SELECT_RECT);var isShowMenu=true;if(event&&event.Callback){var data={X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,SelectData:selectData,//区间选择的数据
6633
+ {var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN_SELECT_RECT_FIRST);if(event&&event.Callback){var data={X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,Item:item,Index:index,RectSelectPaint:paint,//区间选择背景
6634
+ e:e};event.Callback(event,data,this);}}else if(pointCount==2){var selectData=paint.GetSelectRectData();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN_SELECT_RECT);var isShowMenu=true;if(event&&event.Callback){var data={X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,SelectData:selectData,//区间选择的数据
6635
6635
  RectSelectPaint:paint,//区间选择背景
6636
- IsShowMenu:true};event.Callback(event,data,this);isShowMenu=data.IsShowMenu;}if(isShowMenu&&this.SelectRectRightMenu){e.data={Chart:this,X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,SelectData:selectData,//区间选择的数据
6636
+ IsShowMenu:true,e:e};event.Callback(event,data,this);isShowMenu=data.IsShowMenu;}if(isShowMenu&&this.SelectRectRightMenu){e.data={Chart:this,X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,SelectData:selectData,//区间选择的数据
6637
6637
  RectSelectPaint:paint//区间选择背景
6638
6638
  };this.SelectRectRightMenu.DoModal(e);}}this.Draw();};//创建指定窗口指标
6639
6639
  this.CreateWindowIndex=function(windowIndex){this.WindowIndex[windowIndex].Create(this,windowIndex);};this.BindIndexData=function(windowIndex,hisData,option){if(!this.WindowIndex[windowIndex])return;if(typeof this.WindowIndex[windowIndex].RequestData=="function")//数据需要另外下载的.
@@ -6948,13 +6948,13 @@ this.Draw();};this.AddOverlayIndex=function(obj){var overlay=this.CreateOverlayW
6948
6948
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
6949
6949
  this.Draw();};//创建一个叠加指标
6950
6950
  this.CreateOverlayWindowsIndex=function(obj)// {WindowIndex:, IndexName:, Identify:, ShowRightText:, API:}
6951
- {var _this19=this;var indexName=obj.IndexName;var windowIndex=obj.WindowIndex;var apiItem=null,indexInfo=null,indexCustom=null;if(obj.API){apiItem=obj.API;}else if(obj.Script)//动态执行脚本
6951
+ {var _this21=this;var indexName=obj.IndexName;var windowIndex=obj.WindowIndex;var apiItem=null,indexInfo=null,indexCustom=null;if(obj.API){apiItem=obj.API;}else if(obj.Script)//动态执行脚本
6952
6952
  {indexInfo={Script:obj.Script,ID:obj.indexName,Name:obj.indexName};if(obj.Name)indexInfo.Name=obj.Name;}else{var scriptData=new JSIndexScript();indexInfo=scriptData.Get(indexName);//系统指标
6953
6953
  if(!indexInfo){indexCustom=JSIndexMap.Get(indexName);//定制指标
6954
6954
  if(!indexCustom){console.warn('[KLineChartContainer::CreateOverlayIndex] can not find index['+indexName+']');return null;}}}var subFrame=this.Frame.SubFrame[windowIndex];subFrame.Interval=this.OverlayIndexFrameWidth;var overlayFrame=new OverlayIndexItem();if(obj.Identify)overlayFrame.Identify=obj.Identify;//由外部指定id
6955
- var frame=this.ClassName==='KLineChartHScreenContainer'?new OverlayKLineHScreenFrame():new OverlayKLineFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GetEventCallback=function(id){return _this19.GetEventCallback(id);};if(obj.ShowRightText===true)frame.IsShow=true;else if(obj.ShowRightText===false)frame.IsShow=false;if(IFrameSplitOperator.IsBool(obj.ShowToolbar))frame.IsShowToolbar=obj.ShowToolbar;//废弃
6955
+ var frame=this.ClassName==='KLineChartHScreenContainer'?new OverlayKLineHScreenFrame():new OverlayKLineFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GetEventCallback=function(id){return _this21.GetEventCallback(id);};if(obj.ShowRightText===true)frame.IsShow=true;else if(obj.ShowRightText===false)frame.IsShow=false;if(IFrameSplitOperator.IsBool(obj.ShowToolbar))frame.IsShowToolbar=obj.ShowToolbar;//废弃
6956
6956
  if(IFrameSplitOperator.IsBool(obj.IsShareY))frame.IsShareY=obj.IsShareY;if(IFrameSplitOperator.IsBool(obj.IsShowIndexTitle))frame.IsShowIndexTitle=obj.IsShowIndexTitle;if(IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin))frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin;//是否计算Y最大最小值
6957
- frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this19.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this19.GetKLineChart();};frame.YSplitOperator.OverlayIndex=overlayFrame;frame.YSplitOperator.HQChart=this;frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;if(obj.Frame){var item=obj.Frame;if(item.Custom)frame.YSplitOperator.Custom=item.Custom;if(IFrameSplitOperator.IsBool(item.IsYDrawMainFrame))frame.IsYDrawMainFrame=item.IsYDrawMainFrame;//自定义刻度绘制在主图上
6957
+ frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this21.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this21.GetKLineChart();};frame.YSplitOperator.OverlayIndex=overlayFrame;frame.YSplitOperator.HQChart=this;frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;if(obj.Frame){var item=obj.Frame;if(item.Custom)frame.YSplitOperator.Custom=item.Custom;if(IFrameSplitOperator.IsBool(item.IsYDrawMainFrame))frame.IsYDrawMainFrame=item.IsYDrawMainFrame;//自定义刻度绘制在主图上
6958
6958
  if(IFrameSplitOperator.IsBool(item.IsShowToolbar))frame.IsShowToolbar=item.IsShowToolbar;//自定义刻度绘制在主图上
6959
6959
  }overlayFrame.Frame=frame;if(apiItem){var apiIndex=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,obj,true);apiIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
6960
6960
  overlayFrame.Script=apiIndex;}else if(indexInfo){var args=indexInfo.Args;if(obj.Args)args=obj.Args;//外部可以设置参数
@@ -6975,10 +6975,10 @@ this.ChangeCoordinateType=function(obj){if(!this.Frame&&!this.Frame.SubFrame)ret
6975
6975
  {this.Frame.SubFrame[0].Frame.CoordinateType=1;}else if(type==1){this.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType=type;}else if(type==0){this.Frame.SubFrame[0].Frame.CoordinateType=0;this.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType=0;}else if(type==3)//对数坐标
6976
6976
  {this.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType=2;}else{return;}}else{if(obj.Type>=0&&obj.Type<=5)this.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType=obj.Type;if(obj.IsReverse===true)this.Frame.SubFrame[0].Frame.CoordinateType=1;else if(obj.IsReverse==false)this.Frame.SubFrame[0].Frame.CoordinateType=0;}this.UpdateFrameMaxMin();//调整坐标最大 最小值
6977
6977
  this.Frame.SetSizeChage(true);this.Draw();};//设置指标窗口个数
6978
- this.ChangeIndexWindowCount=function(count,option){var _this20=this;if(count<=0)return;if(this.Frame.SubFrame.length==count)return;this.Frame.RestoreIndexWindows();var currentLength=this.Frame.SubFrame.length;if(currentLength>count){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);for(var i=currentLength-1;i>=count;--i){this.DeleteIndexPaint(i);this.Frame.SubFrame[i].Frame.ClearToolbar();if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}this.Frame.SubFrame.splice(count,currentLength-count);this.WindowIndex.splice(count,currentLength-count);//最后一个显示X轴坐标
6978
+ this.ChangeIndexWindowCount=function(count,option){var _this22=this;if(count<=0)return;if(this.Frame.SubFrame.length==count)return;this.Frame.RestoreIndexWindows();var currentLength=this.Frame.SubFrame.length;if(currentLength>count){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);for(var i=currentLength-1;i>=count;--i){this.DeleteIndexPaint(i);this.Frame.SubFrame[i].Frame.ClearToolbar();if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}this.Frame.SubFrame.splice(count,currentLength-count);this.WindowIndex.splice(count,currentLength-count);//最后一个显示X轴坐标
6979
6979
  for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;}this.Frame.SetSizeChage(true);this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
6980
6980
  this.Draw();}else{//创建新的指标窗口
6981
- var pixelRatio=GetDevicePixelRatio();for(var i=currentLength;i<count;++i){var subFrame=this.CreateSubFrameItem(i);subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this20.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}//最后一个显示X轴坐标
6981
+ var pixelRatio=GetDevicePixelRatio();for(var i=currentLength;i<count;++i){var subFrame=this.CreateSubFrameItem(i);subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this22.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}//最后一个显示X轴坐标
6982
6982
  for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;}this.Frame.SetSizeChage(true);this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
6983
6983
  this.Draw();//创建指标
6984
6984
  var indexName=[{Index:"RSI"},{Index:"MACD"},{Index:"VOL"},{Index:"UOS"},{Index:"CHO"},{Index:"BRAR"}];//增加的指标名字
@@ -6990,11 +6990,11 @@ var subFrame=this.Frame.SubFrame[i];if(item.Modify!=null)this.Frame.SubFrame[i].
6990
6990
  }if(item.OverlayIndexType){if(IFrameSplitOperator.IsNumber(item.OverlayIndexType.Position))subFrame.Frame.OverlayIndexType.Position=item.OverlayIndexType.Position;if(IFrameSplitOperator.IsNumber(item.OverlayIndexType.LineSpace))subFrame.Frame.OverlayIndexType.LineSpace=item.OverlayIndexType.LineSpace;}var bindData=this.ChartPaint[0].Data;this.BindIndexData(i,bindData);//执行脚本
6991
6991
  }//this.UpdataDataoffset(); //更新数据偏移
6992
6992
  }};this.ChangeIndexTemplate=function(option)//切换指标模板 可以设置指标窗口个数 每个窗口的指标
6993
- {var _this21=this;if(!option.Windows)return;var count=option.Windows.length;if(count<=0)return;var currentLength=this.Frame.SubFrame.length;var period=null,right=null;if(option.KLine){if(IFrameSplitOperator.IsNumber(option.KLine.Period)&&option.KLine.Period!=this.Period)period=option.KLine.Period;//周期
6993
+ {var _this23=this;if(!option.Windows)return;var count=option.Windows.length;if(count<=0)return;var currentLength=this.Frame.SubFrame.length;var period=null,right=null;if(option.KLine){if(IFrameSplitOperator.IsNumber(option.KLine.Period)&&option.KLine.Period!=this.Period)period=option.KLine.Period;//周期
6994
6994
  if(IFrameSplitOperator.IsNumber(option.KLine.Right)&&option.KLine.Right!=this.Right)right=option.KLine.Right;//复权
6995
6995
  }var bRefreshData=period!=null||right!=null;//清空所有的指标图型
6996
6996
  for(var i=0;i<currentLength;++i){this.DeleteIndexPaint(i);var frame=this.Frame.SubFrame[i];frame.YSpecificMaxMin=null;frame.IsLocked=false;frame.YSplitScale=null;}if(currentLength>count){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);for(var i=currentLength-1;i>=count;--i){this.Frame.SubFrame[i].Frame.ClearToolbar();if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}this.Frame.SubFrame.splice(count,currentLength-count);this.WindowIndex.splice(count,currentLength-count);}else{for(var i=currentLength;i<count;++i)//创建新的指标窗口
6997
- {var subFrame=this.CreateSubFrameItem(i);this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this21.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}}var systemScript=new JSIndexScript();for(var i=0;i<count;++i){var windowIndex=i;var item=option.Windows[i];var frameItem=null;if(option.Frame&&option.Frame.length>i)frameItem=option.Frame[i];var titleIndex=windowIndex+1;this.TitlePaint[titleIndex].Data=[];this.TitlePaint[titleIndex].Title=null;if(item.Script)//自定义指标脚本
6997
+ {var subFrame=this.CreateSubFrameItem(i);this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this23.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}}var systemScript=new JSIndexScript();for(var i=0;i<count;++i){var windowIndex=i;var item=option.Windows[i];var frameItem=null;if(option.Frame&&option.Frame.length>i)frameItem=option.Frame[i];var titleIndex=windowIndex+1;this.TitlePaint[titleIndex].Data=[];this.TitlePaint[titleIndex].Title=null;if(item.Script)//自定义指标脚本
6998
6998
  {this.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
6999
6999
  }else if(item.API)//后台指标
7000
7000
  {var apiItem=item.API;this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,item);}else{var indexID=item.Index;var indexItem=JSIndexMap.Get(indexID);if(indexItem){this.WindowIndex[i]=indexItem.Create();this.CreateWindowIndex(windowIndex);}else{var indexInfo=systemScript.Get(indexID);if(indexInfo){var args=indexInfo.Args;if(option.Windows[i].Args)args=option.Windows[i].Args;var indexData={Name:indexInfo.Name,Script:indexInfo.Script,Args:args,ID:indexID,//扩展属性 可以是空
@@ -7060,24 +7060,24 @@ this.ClearKLineInfo=function(){if(!this.ChartInfo||this.ChartInfo.length<=0)retu
7060
7060
  this.OverlaySymbol=function(symbol,option){for(var i in this.OverlayChartPaint){var item=this.OverlayChartPaint[i];if(item.Symbol===symbol){console.warn('[KLineChartContainer::OverlaySymbol] overlay symbol='+symbol+' exist.');return false;}}var paint=new ChartOverlayKLine();paint.Canvas=this.Canvas;paint.ChartBorder=this.Frame.SubFrame[0].Frame.ChartBorder;paint.ChartFrame=this.Frame.SubFrame[0].Frame;paint.Name="Overlay-KLine";paint.DrawType=this.KLineDrawType;paint.Symbol=symbol;paint.Identify='Overlay-KLine-'+symbol;if(option&&option.Color)paint.Color=option.Color;else paint.Color=g_JSChartResource.OverlaySymbol.Color[g_JSChartResource.OverlaySymbol.Random%g_JSChartResource.OverlaySymbol.Color.length];paint.SetOption(option);++g_JSChartResource.OverlaySymbol.Random;if(this.ChartPaint[0]&&this.ChartPaint[0].Data&&this.SourceData)paint.MainData=this.ChartPaint[0].Data;//绑定主图数据
7061
7061
  this.OverlayChartPaint.push(paint);if(ChartData.IsDayPeriod(this.Period,true))this.RequestOverlayHistoryData();//请求日线数据
7062
7062
  else if(ChartData.IsMinutePeriod(this.Period,true))this.RequestOverlayHistoryMinuteData();//请求分钟历史数据
7063
- return true;};this.RequestOverlayHistoryData=function(){var _this22=this;if(!this.OverlayChartPaint.length)return;if(!this.SourceData||!this.SourceData.Data)return;//主图数据还没有到完
7064
- var self=this;var dataCount=this.GetRequestDataCount();var firstDate=this.SourceData.Data[0].Date;var _loop2=function _loop2(){var item=_this22.OverlayChartPaint[i];if(!item.MainData)return'continue';//等待主图股票数据未下载完
7065
- if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';var symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this22.NetworkFilter){obj={Name:'KLineChartContainer::RequestOverlayHistoryData',//类名::
7066
- Explain:'叠加股票日K线数据',Request:{Url:self.KLineApiUrl,Data:{symbol:symbol,count:dataCount.MaxRequestDataCount,"first":{date:firstDate},field:["name","symbol","yclose","open","price","high",'vol','amount']},Type:'POST'},Self:_this22,PreventDefault:false};_this22.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayHistoryData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
7063
+ return true;};this.RequestOverlayHistoryData=function(){var _this24=this;if(!this.OverlayChartPaint.length)return;if(!this.SourceData||!this.SourceData.Data)return;//主图数据还没有到完
7064
+ var self=this;var dataCount=this.GetRequestDataCount();var firstDate=this.SourceData.Data[0].Date;var _loop2=function _loop2(){var item=_this24.OverlayChartPaint[i];if(!item.MainData)return'continue';//等待主图股票数据未下载完
7065
+ if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';var symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this24.NetworkFilter){obj={Name:'KLineChartContainer::RequestOverlayHistoryData',//类名::
7066
+ Explain:'叠加股票日K线数据',Request:{Url:self.KLineApiUrl,Data:{symbol:symbol,count:dataCount.MaxRequestDataCount,"first":{date:firstDate},field:["name","symbol","yclose","open","price","high",'vol','amount']},Type:'POST'},Self:_this24,PreventDefault:false};_this24.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayHistoryData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
7067
7067
  }//请求数据
7068
- JSNetwork.HttpRequest({url:_this22.KLineApiUrl,data:{"field":["name","symbol","yclose","open","price","high"],"symbol":symbol,"start":-1,"count":dataCount.MaxRequestDataCount},type:"post",dataType:"json",async:true,success:function success(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayHistoryData(data,item);}});};for(var i=0;i<this.OverlayChartPaint.length;++i){var obj;var _ret2=_loop2();if(_ret2==='continue')continue;}};this.RecvOverlayHistoryData=function(data,paint){if(paint.IsDelete)return;var aryDayData=KLineChartContainer.JsonDataToHistoryData(data);//原始叠加数据
7068
+ JSNetwork.HttpRequest({url:_this24.KLineApiUrl,data:{"field":["name","symbol","yclose","open","price","high"],"symbol":symbol,"start":-1,"count":dataCount.MaxRequestDataCount},type:"post",dataType:"json",async:true,success:function success(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayHistoryData(data,item);}});};for(var i=0;i<this.OverlayChartPaint.length;++i){var obj;var _ret2=_loop2();if(_ret2==='continue')continue;}};this.RecvOverlayHistoryData=function(data,paint){if(paint.IsDelete)return;var aryDayData=KLineChartContainer.JsonDataToHistoryData(data);//原始叠加数据
7069
7069
  var sourceData=new ChartData();sourceData.Data=aryDayData;sourceData.DataType=0;var bindData=new ChartData();bindData.Data=aryDayData;bindData.Period=this.Period;bindData.Right=this.Right;bindData.DataType=0;if(bindData.Right>0&&MARKET_SUFFIX_NAME.IsSHSZStockA(data.symbol)&&!this.IsApiPeriod)//复权数据 ,A股才有有复权
7070
7070
  {var rightData=bindData.GetRightData(bindData.Right,{AlgorithmType:this.RightFormula});bindData.Data=rightData;}var aryOverlayData=this.SourceData.GetOverlayData(bindData.Data,this.IsApiPeriod);//和主图数据拟合以后的数据
7071
7071
  bindData.Data=aryOverlayData;if(ChartData.IsDayPeriod(bindData.Period,false)&&!this.IsApiPeriod)//周期数据
7072
7072
  {var periodData=bindData.GetPeriodData(bindData.Period);bindData.Data=periodData;}paint.Data=bindData;paint.SourceData=sourceData;paint.Title=data.name;paint.Symbol=data.symbol;paint.Status=OVERLAY_STATUS_ID.STATUS_FINISHED_ID;this.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType=1;//调整为百份比坐标
7073
7073
  this.UpdataDataoffset();//更新数据偏移
7074
7074
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
7075
- this.Frame.SetSizeChage(true);this.Draw();};this.RequestOverlayHistoryMinuteData=function(){var _this23=this;if(!this.OverlayChartPaint.length)return;if(!this.SourceData||!this.SourceData.Data)return;//主图数据还没有到完
7076
- var self=this;var dataCount=this.GetRequestDataCount();var firstDate=this.SourceData.Data[0].Date;var firstTime=this.SourceData.Data[0].Time;var _loop3=function _loop3(){var item=_this23.OverlayChartPaint[i];if(!item.MainData)return'continue';//等待主图股票数据未下载完
7077
- if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';var symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this23.NetworkFilter){obj={Name:'KLineChartContainer::RequestOverlayHistoryMinuteData',//类名::
7078
- Explain:'叠加股票分钟K线数据',Request:{Url:self.MinuteKLineApiUrl,Data:{symbol:symbol,count:dataCount.MaxRequestMinuteDayCount,"first":{date:firstDate,time:firstTime},field:["name","symbol","yclose","open","price","high",'vol','amount']},Type:'POST'},Self:_this23,PreventDefault:false};_this23.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOveralyHistoryMinuteData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
7075
+ this.Frame.SetSizeChage(true);this.Draw();};this.RequestOverlayHistoryMinuteData=function(){var _this25=this;if(!this.OverlayChartPaint.length)return;if(!this.SourceData||!this.SourceData.Data)return;//主图数据还没有到完
7076
+ var self=this;var dataCount=this.GetRequestDataCount();var firstDate=this.SourceData.Data[0].Date;var firstTime=this.SourceData.Data[0].Time;var _loop3=function _loop3(){var item=_this25.OverlayChartPaint[i];if(!item.MainData)return'continue';//等待主图股票数据未下载完
7077
+ if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';var symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this25.NetworkFilter){obj={Name:'KLineChartContainer::RequestOverlayHistoryMinuteData',//类名::
7078
+ Explain:'叠加股票分钟K线数据',Request:{Url:self.MinuteKLineApiUrl,Data:{symbol:symbol,count:dataCount.MaxRequestMinuteDayCount,"first":{date:firstDate,time:firstTime},field:["name","symbol","yclose","open","price","high",'vol','amount']},Type:'POST'},Self:_this25,PreventDefault:false};_this25.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOveralyHistoryMinuteData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
7079
7079
  }//请求数据
7080
- JSNetwork.HttpRequest({url:_this23.MinuteKLineApiUrl,data:{"field":["name","symbol","yclose","open","price","high",'vol','amount'],"symbol":symbol,"start":-1,"count":dataCount.MaxRequestMinuteDayCount},type:"post",dataType:"json",async:true,success:function success(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOveralyHistoryMinuteData(data,item);}});};for(var i=0;i<this.OverlayChartPaint.length;++i){var obj;var _ret3=_loop3();if(_ret3==='continue')continue;}};this.RecvOveralyHistoryMinuteData=function(data,paint){if(this.EnableVerifyRecvData&&data.symbol!=paint.Symbol){JSConsole.Chart.Warn('[MinuteChartContainer::RecvOveralyHistoryMinuteData] recv data symbol not match. paint['+paint.Symbol+'] , Recv['+data.symbol+']');return;}var aryDayData=KLineChartContainer.JsonDataToMinuteHistoryData(data);if(!aryDayData)return;//原始叠加数据
7080
+ JSNetwork.HttpRequest({url:_this25.MinuteKLineApiUrl,data:{"field":["name","symbol","yclose","open","price","high",'vol','amount'],"symbol":symbol,"start":-1,"count":dataCount.MaxRequestMinuteDayCount},type:"post",dataType:"json",async:true,success:function success(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOveralyHistoryMinuteData(data,item);}});};for(var i=0;i<this.OverlayChartPaint.length;++i){var obj;var _ret3=_loop3();if(_ret3==='continue')continue;}};this.RecvOveralyHistoryMinuteData=function(data,paint){if(this.EnableVerifyRecvData&&data.symbol!=paint.Symbol){JSConsole.Chart.Warn('[MinuteChartContainer::RecvOveralyHistoryMinuteData] recv data symbol not match. paint['+paint.Symbol+'] , Recv['+data.symbol+']');return;}var aryDayData=KLineChartContainer.JsonDataToMinuteHistoryData(data);if(!aryDayData)return;//原始叠加数据
7081
7081
  var sourceData=new ChartData();sourceData.Data=aryDayData;sourceData.DataType=1;//0=日线数据 1=分钟数据
7082
7082
  var bindData=new ChartData();bindData.Data=aryDayData;bindData.Period=this.Period;bindData.Right=this.Right;bindData.DataType=1;var aryOverlayData=this.SourceData.GetOverlayMinuteData(bindData.Data,this.IsApiPeriod);//和主图数据拟合以后的数据
7083
7083
  bindData.Data=aryOverlayData;if(ChartData.IsMinutePeriod(bindData.Period,false)&&!this.IsApiPeriod)//周期数据, API周期数据不用计算
@@ -7453,20 +7453,20 @@ this.OnRightMenu=function(x,y,e){if(this.RightMenu){var frameId=this.Frame.PtInF
7453
7453
  if(this.SelectedChart.EnableSelected){selectedChart=this.PtInChart(x,y);}var dbClickInfo={SelectedChart:selectedChart};this.DBClickEvent(dbClickInfo,e);//没有图形选中,双击缩放窗口
7454
7454
  if(!selectedChart&&this.EnableZoomIndexWindow){var frameId=this.Frame.PtInFrame(x,y);JSConsole.Chart.Log("[MinuteChartContainer::OnDoubleClick] frameId",frameId);if(frameId>=this.Frame.ZoomStartWindowIndex){if(this.ZoomIndexWindow(frameId,{X:x,Y:y})){this.Frame.SetSizeChage(true);this.Draw();}}}};this.GetDataItem=function(pointInfo){if(!pointInfo)return null;if(!IFrameSplitOperator.IsNumber(pointInfo.Index))return null;if(!this.SourceData||!this.SourceData.Data)return null;var data=this.SourceData;var clientPos=pointInfo.ClientPos;if(clientPos==2||clientPos==3||clientPos>=200&&clientPos<=299||clientPos>=300&&clientPos<=399){if(!this.ChartCorssCursor||!this.ChartCorssCursor.CallAcutionXOperator)return null;var isHScreen=this.Frame.IsHScreen===true;var callAcutionXOper=this.ChartCorssCursor.CallAcutionXOperator;callAcutionXOper.Value=isHScreen?pointInfo.Point.Y:pointInfo.Point.X;callAcutionXOper.Point={X:pointInfo.Point.X,Y:pointInfo.Point.Y};callAcutionXOper.ClientPos=clientPos;if(clientPos==2){if(!this.BeforeOpenData)return null;}else if(clientPos==3){if(!this.AfterCloseData)return null;}else if(clientPos>=200&&clientPos<=299){if(!this.MultiDayBeforeOpenData||!IFrameSplitOperator.IsNonEmptyArray(this.MultiDayBeforeOpenData))return;}else if(clientPos>=300&&tclientPos<=399){if(!this.MultiDayAfterCloseData||!IFrameSplitOperator.IsNonEmptyArray(this.MultiDayAfterCloseData))return;}if(callAcutionXOper.Operator()){var item=callAcutionXOper.Item;return{Type:clientPos,Item:item,Index:callAcutionXOper.DataIndex};}return null;}var index=parseInt(pointInfo.Index.toFixed(0));var dataIndex=index+data.DataOffset;if(dataIndex>=data.Data.length)return null;var item=data.Data[dataIndex];return{Type:clientPos,Item:item,Index:dataIndex};};this.UpdatePointByCursorIndex=function(){this.LastPoint.X=this.Frame.GetXFromIndex(this.CursorIndex);var index=this.CursorIndex;index=parseInt(index.toFixed(0));var data=this.Frame.SourceData;if(data.DataOffset+index>=data.Data.length){return;}var item=data.Data[data.DataOffset+index];var close=null;if(item.Before)close=item.Before.Close;else close=item.Close;this.LastPoint.Y=this.Frame.GetYFromData(close);};//创建
7455
7455
  //windowCount 窗口个数
7456
- this.Create=function(windowCount,option){var _this24=this;this.UIElement.JSChartContainer=this;//创建十字光标
7457
- this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return _this24.PtInClient(x,y);};this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_Minute_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this24.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this24.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ShareAfterVol=this.ShareAfterVol;this.ChartCorssCursor.CallAcutionXOperator=new CallAcutionXOperator();//创建等待提示
7456
+ this.Create=function(windowCount,option){var _this26=this;this.UIElement.JSChartContainer=this;//创建十字光标
7457
+ this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return _this26.PtInClient(x,y);};this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_Minute_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this26.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this26.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ShareAfterVol=this.ShareAfterVol;this.ChartCorssCursor.CallAcutionXOperator=new CallAcutionXOperator();//创建等待提示
7458
7458
  this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
7459
- this.Frame=new HQTradeFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=25;this.Frame.ChartBorder.TitleHeight=0;this.Frame.ChartBorder.Left=50;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.Frame.GetExtendChartRightWidth=function(){return _this24.GetExtendChartRightWidth();};this.Frame.GetEventCallback=function(id){return _this24.GetEventCallback(id);};this.Frame.ZoomStartWindowIndex=2;this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
7459
+ this.Frame=new HQTradeFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=25;this.Frame.ChartBorder.TitleHeight=0;this.Frame.ChartBorder.Left=50;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.Frame.GetExtendChartRightWidth=function(){return _this26.GetExtendChartRightWidth();};this.Frame.GetEventCallback=function(id){return _this26.GetEventCallback(id);};this.Frame.ZoomStartWindowIndex=2;this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
7460
7460
  this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();this.CreateExtendChart("RectSelectPaint",option?option.SelectRect:null);//区间统计
7461
7461
  if(this.EnableIndexChartDrag)this.CreateExtendChart("DragMovePaint");//子窗口动态标题
7462
- for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this24.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;if(this.ChartCorssCursor.CallAcutionXOperator)this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;var bRegisterKeydown=true;var bRegisterWheel=true;if(option&&option.Listener){var item=option.Listener;if(item.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');}if(item.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this24.OnKeyDown(e);},true);//键盘消息
7463
- if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this24.OnWheel(e);},true);//上下滚动消息
7462
+ for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this26.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;if(this.ChartCorssCursor.CallAcutionXOperator)this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;var bRegisterKeydown=true;var bRegisterWheel=true;if(option&&option.Listener){var item=option.Listener;if(item.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');}if(item.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this26.OnKeyDown(e);},true);//键盘消息
7463
+ if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this26.OnWheel(e);},true);//上下滚动消息
7464
7464
  };//创建子窗口
7465
- this.CreateChildWindow=function(windowCount){var _this25=this;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=new MinuteFrame();frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;frame.GlobalOption=this.GlobalOption;if(i<2)frame.ChartBorder.TitleHeight=0;frame.XPointCount=243;if(i>=2){if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
7466
- if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;}var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];if(i==0){frame.YSplitOperator=new FrameSplitMinutePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.GetEventCallback=function(id){return _this25.GetEventCallback(id);};frame.YSplitOperator.DayOffset=this.DayOffset;frame.YSplitOperator.GlobalOption=this.GlobalOption;frame.YSplitOperator.HQChart=this;}else{frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this25.GetEventCallback(id);};if(i==1)frame.YSplitOperator.ShareAfterVol=this.ShareAfterVol;}frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitMinuteX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.DayOffset=this.DayOffset;frame.XSplitOperator.GetEventCallback=function(id){return _this25.GetEventCallback(id);};if(i!=windowCount-1)frame.XSplitOperator.ShowText=false;frame.XSplitOperator.Operator();for(var j in DEFAULT_HORIZONTAL){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=DEFAULT_HORIZONTAL[j];if(i==0&&j==frame.HorizontalMin)continue;frame.HorizontalInfo[j].Message[1]=DEFAULT_HORIZONTAL[j].toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}};this.CreateSubFrameItem=function(id,mainFrame){var _this26=this;var border=new ChartBorder();border.UIElement=this.UIElement;if(mainFrame&&mainFrame.ChartBorder&&mainFrame.ChartBorder.MultiDayMinute){var item=mainFrame.ChartBorder.MultiDayMinute;border.MultiDayMinute.Count=item.Count;border.MultiDayMinute.Left=item.Left;border.MultiDayMinute.Right=item.Right;}var frame=null;if(this.ClassName=="MinuteChartHScreenContainer")frame=new MinuteHScreenFrame();else frame=new MinuteFrame();frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=id;//窗口序号
7465
+ this.CreateChildWindow=function(windowCount){var _this27=this;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=new MinuteFrame();frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;frame.GlobalOption=this.GlobalOption;if(i<2)frame.ChartBorder.TitleHeight=0;frame.XPointCount=243;if(i>=2){if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
7466
+ if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;}var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];if(i==0){frame.YSplitOperator=new FrameSplitMinutePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.GetEventCallback=function(id){return _this27.GetEventCallback(id);};frame.YSplitOperator.DayOffset=this.DayOffset;frame.YSplitOperator.GlobalOption=this.GlobalOption;frame.YSplitOperator.HQChart=this;}else{frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this27.GetEventCallback(id);};if(i==1)frame.YSplitOperator.ShareAfterVol=this.ShareAfterVol;}frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitMinuteX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.DayOffset=this.DayOffset;frame.XSplitOperator.GetEventCallback=function(id){return _this27.GetEventCallback(id);};if(i!=windowCount-1)frame.XSplitOperator.ShowText=false;frame.XSplitOperator.Operator();for(var j in DEFAULT_HORIZONTAL){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=DEFAULT_HORIZONTAL[j];if(i==0&&j==frame.HorizontalMin)continue;frame.HorizontalInfo[j].Message[1]=DEFAULT_HORIZONTAL[j].toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}};this.CreateSubFrameItem=function(id,mainFrame){var _this28=this;var border=new ChartBorder();border.UIElement=this.UIElement;if(mainFrame&&mainFrame.ChartBorder&&mainFrame.ChartBorder.MultiDayMinute){var item=mainFrame.ChartBorder.MultiDayMinute;border.MultiDayMinute.Count=item.Count;border.MultiDayMinute.Left=item.Left;border.MultiDayMinute.Right=item.Right;}var frame=null;if(this.ClassName=="MinuteChartHScreenContainer")frame=new MinuteHScreenFrame();else frame=new MinuteFrame();frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=id;//窗口序号
7467
7467
  frame.XPointCount=243;frame.GlobalOption=this.GlobalOption;if(id>=2){if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
7468
- if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;}var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitMinuteX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.ShowText=false;frame.XSplitOperator.DayOffset=this.DayOffset;frame.XSplitOperator.GetEventCallback=function(id){return _this26.GetEventCallback(id);};frame.YSplitOperator.GetEventCallback=function(id){return _this26.GetEventCallback(id);};frame.XSplitOperator.Symbol=this.Symbol;if(this.DayCount>1){frame.XSplitOperator.DayCount=this.DayData.length;frame.XSplitOperator.DayData=this.DayData;frame.DayCount=this.DayData.length;}//K线数据绑定
7469
- var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;frame.XPointCount=xPointCouont;frame.Data=this.ChartPaint[0].Data;for(var j in DEFAULT_HORIZONTAL){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=DEFAULT_HORIZONTAL[j];frame.HorizontalInfo[j].Message[1]=DEFAULT_HORIZONTAL[j].toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;subFrame.Height=10;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);if(event&&event.Callback){var sendData={SubFrame:subFrame,WindowIndex:id};event.Callback(event,sendData,this);}return subFrame;};this.AddNewSubFrame=function(option){var _this27=this;var mainFrame=this.Frame.SubFrame[0].Frame;var index=this.Frame.SubFrame.length;var subFrame=this.CreateSubFrameItem(index,mainFrame);var pixelRatio=GetDevicePixelRatio();subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[index]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[index].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this27.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
7468
+ if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;}var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitMinuteX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.ShowText=false;frame.XSplitOperator.DayOffset=this.DayOffset;frame.XSplitOperator.GetEventCallback=function(id){return _this28.GetEventCallback(id);};frame.YSplitOperator.GetEventCallback=function(id){return _this28.GetEventCallback(id);};frame.XSplitOperator.Symbol=this.Symbol;if(this.DayCount>1){frame.XSplitOperator.DayCount=this.DayData.length;frame.XSplitOperator.DayData=this.DayData;frame.DayCount=this.DayData.length;}//K线数据绑定
7469
+ var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;frame.XPointCount=xPointCouont;frame.Data=this.ChartPaint[0].Data;for(var j in DEFAULT_HORIZONTAL){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=DEFAULT_HORIZONTAL[j];frame.HorizontalInfo[j].Message[1]=DEFAULT_HORIZONTAL[j].toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;subFrame.Height=10;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);if(event&&event.Callback){var sendData={SubFrame:subFrame,WindowIndex:id};event.Callback(event,sendData,this);}return subFrame;};this.AddNewSubFrame=function(option){var _this29=this;var mainFrame=this.Frame.SubFrame[0].Frame;var index=this.Frame.SubFrame.length;var subFrame=this.CreateSubFrameItem(index,mainFrame);var pixelRatio=GetDevicePixelRatio();subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[index]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[index].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this29.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
7470
7470
  for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;}this.UpdataDataoffset();//更新数据偏移
7471
7471
  this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
7472
7472
  this.Draw();return index;};this.UpdateXShowText=function(){var bLastFrame=true;for(var i=this.Frame.SubFrame.length-1;i>=0;--i){var item=this.Frame.SubFrame[i].Frame;var subFrame=this.Frame.SubFrame[i];if(bLastFrame){item.XSplitOperator.ShowText=true;if(subFrame.Height>0)bLastFrame=false;}else{item.XSplitOperator.ShowText=false;}}};//删除某一个窗口的指标
@@ -7477,8 +7477,8 @@ var subFrame=this.Frame.SubFrame[windowIndex].Frame;subFrame.YSpecificMaxMin=nul
7477
7477
  subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType;//还原Y坐标分割模式
7478
7478
  this.ChartPaint=paint;//清空东条标题
7479
7479
  var titleIndex=windowIndex+1;this.TitlePaint[titleIndex].Data=[];this.TitlePaint[titleIndex].Title=null;};this.CreateStockInfo=function(){this.ExtendChartPaint[0]=new StockInfoExtendChartPaint();this.ExtendChartPaint[0].Canvas=this.Canvas;this.ExtendChartPaint[0].ChartBorder=this.Frame.ChartBorder;this.ExtendChartPaint[0].ChartFrame=this.Frame;this.Frame.ChartBorder.Right=300;};//创建主图K线画法
7480
- this.CreateMainKLine=function(){var _this28=this;//分钟线
7481
- var minuteLine=g_ChartPaintFactory.Create("ChartMinutePriceLine");minuteLine.Canvas=this.Canvas;minuteLine.ChartBorder=this.Frame.SubFrame[0].Frame.ChartBorder;minuteLine.ChartFrame=this.Frame.SubFrame[0].Frame;minuteLine.Name="Minute-Line";minuteLine.Identify="Minute-Line";minuteLine.Color=g_JSChartResource.Minute.PriceColor;minuteLine.LineWidth=g_JSChartResource.Minute.PriceLineWidth;minuteLine.AreaColor=g_JSChartResource.Minute.AreaPriceColor;minuteLine.GetEventCallback=function(id){return _this28.GetEventCallback(id);};this.ChartPaint[0]=minuteLine;//分钟线均线
7480
+ this.CreateMainKLine=function(){var _this30=this;//分钟线
7481
+ var minuteLine=g_ChartPaintFactory.Create("ChartMinutePriceLine");minuteLine.Canvas=this.Canvas;minuteLine.ChartBorder=this.Frame.SubFrame[0].Frame.ChartBorder;minuteLine.ChartFrame=this.Frame.SubFrame[0].Frame;minuteLine.Name="Minute-Line";minuteLine.Identify="Minute-Line";minuteLine.Color=g_JSChartResource.Minute.PriceColor;minuteLine.LineWidth=g_JSChartResource.Minute.PriceLineWidth;minuteLine.AreaColor=g_JSChartResource.Minute.AreaPriceColor;minuteLine.GetEventCallback=function(id){return _this30.GetEventCallback(id);};this.ChartPaint[0]=minuteLine;//分钟线均线
7482
7482
  var averageLine=new ChartMinutePriceLine();averageLine.Canvas=this.Canvas;averageLine.ChartBorder=this.Frame.SubFrame[0].Frame.ChartBorder;averageLine.ChartFrame=this.Frame.SubFrame[0].Frame;averageLine.Name="Minute-Average-Line";averageLine.Identify="Minute-Average-Line";averageLine.Color=g_JSChartResource.Minute.AvPriceColor;averageLine.IsDrawArea=false;this.ChartPaint[1]=averageLine;//成交量
7483
7483
  var volLine=g_ChartPaintFactory.Create("ChartMinuteVolumBar");volLine.Color=g_JSChartResource.Minute.VolBarColor;volLine.Canvas=this.Canvas;volLine.ChartBorder=this.Frame.SubFrame[1].Frame.ChartBorder;volLine.ChartFrame=this.Frame.SubFrame[1].Frame;volLine.Name="Minute-Vol-Bar";volLine.Identify="Minute-Vol-Bar";volLine.ShareAfterVol=this.ShareAfterVol;this.ChartPaint[2]=volLine;this.TitlePaint[0]=new DynamicMinuteTitlePainting();this.TitlePaint[0].Frame=this.Frame.SubFrame[0].Frame;this.TitlePaint[0].Canvas=this.Canvas;this.TitlePaint[0].OverlayChartPaint=this.OverlayChartPaint;//绑定叠加
7484
7484
  this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].CallAcutionXOperator=new CallAcutionXOperator();this.TitlePaint[0].CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;};//切换成 脚本指标
@@ -7494,19 +7494,19 @@ this.UpdateFrameMaxMin();//调整坐标最大 最小值
7494
7494
  this.Draw();};this.ChangeIndex=function(windowIndex,indexName,option){if(this.Frame.SubFrame.length<3)return;if(option&&option.API)return this.ChangeAPIIndex(windowIndex,option);//查找系统指标
7495
7495
  var scriptData=new JSIndexScript();var indexInfo=scriptData.Get(indexName);if(!indexInfo)return;if(windowIndex<2)windowIndex=2;if(windowIndex>=this.Frame.SubFrame.length)windowIndex=2;var indexData={Name:indexInfo.Name,Script:indexInfo.Script,Args:indexInfo.Args,ID:indexName,//扩展属性 可以是空
7496
7496
  KLineType:indexInfo.KLineType,YSpecificMaxMin:indexInfo.YSpecificMaxMin,YSplitScale:indexInfo.YSplitScale,FloatPrecision:indexInfo.FloatPrecision,Condition:indexInfo.Condition,StringFormat:indexInfo.StringFormat,OutName:indexInfo.OutName};if(option){if(option.FloatPrecision>=0)indexData.FloatPrecision=option.FloatPrecision;if(option.StringFormat>0)indexData.StringFormat=option.StringFormat;if(option.Args)indexData.Args=option.Args;if(IFrameSplitOperator.IsNumber(option.YSplitType))indexData.YSplitType=option.YSplitType;if(option.Lock)indexData.Lock=option.Lock;}return this.ChangeScriptIndex(windowIndex,indexData,option);};//设置指标窗口个数
7497
- this.ChangeIndexWindowCount=function(count){var _this29=this;if(count<2)return;//1,2个窗口固定的不能动
7497
+ this.ChangeIndexWindowCount=function(count){var _this31=this;if(count<2)return;//1,2个窗口固定的不能动
7498
7498
  if(this.Frame.SubFrame.length==count)return;var currentLength=this.Frame.SubFrame.length;if(currentLength>count){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);for(var i=currentLength-1;i>=count;--i){this.DeleteIndexPaint(i);var item=this.Frame.SubFrame[i].Frame;if(item.ClearToolbar)item.ClearToolbar();if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}this.Frame.SubFrame.splice(count,currentLength-count);this.WindowIndex.splice(count,currentLength-count);}else{//创建新的指标窗口
7499
- var mainFrame=this.Frame.SubFrame[0].Frame;for(var i=currentLength;i<count;++i){var subFrame=this.CreateSubFrameItem(i,mainFrame);this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this29.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}//创建指标
7499
+ var mainFrame=this.Frame.SubFrame[0].Frame;for(var i=currentLength;i<count;++i){var subFrame=this.CreateSubFrameItem(i,mainFrame);this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this31.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}//创建指标
7500
7500
  var indexName=["RSI","MACD","DMA","DMI","KDJ","WR"];var scriptData=new JSIndexScript();for(var i=currentLength;i<count;++i){var name=indexName[i%indexName.length];var indexInfo=scriptData.Get(name);this.WindowIndex[i]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
7501
7501
  var bindData=this.SourceData;this.BindIndexData(i,bindData);//执行脚本
7502
7502
  }//最后一个显示X轴坐标
7503
7503
  for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(i==this.Frame.SubFrame.length-1)item.XSplitOperator.ShowText=true;else item.XSplitOperator.ShowText=false;}this.UpdataDataoffset();//更新数据偏移
7504
7504
  }this.UpdateXShowText();this.Frame.SetSizeChage(true);this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
7505
7505
  this.Draw();};this.ChangeIndexTemplate=function(option)//切换指标模板 可以设置指标窗口个数 每个窗口的指标, 只能从第3个指标窗口开始设置,前面2个指标窗口固定无法设置
7506
- {var _this30=this;if(!Array.isArray(option.Windows))return;var count=option.Windows.length;var currentLength=this.Frame.SubFrame.length;var startWindowIndex=2;count+=startWindowIndex;var dayCount=null;if(IFrameSplitOperator.IsNumber(option.DayCount)&&option.DayCount!=this.DayCount)dayCount=option.DayCount;//天数
7506
+ {var _this32=this;if(!Array.isArray(option.Windows))return;var count=option.Windows.length;var currentLength=this.Frame.SubFrame.length;var startWindowIndex=2;count+=startWindowIndex;var dayCount=null;if(IFrameSplitOperator.IsNumber(option.DayCount)&&option.DayCount!=this.DayCount)dayCount=option.DayCount;//天数
7507
7507
  var bRefreshData=dayCount!=null;//清空所有的指标图型
7508
7508
  for(var i=startWindowIndex;i<currentLength;++i){this.DeleteIndexPaint(i);var frame=this.Frame.SubFrame[i];frame.YSpecificMaxMin=null;frame.IsLocked=false;frame.YSplitScale=null;}if(currentLength>count){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);for(var i=currentLength-1;i>=count;--i){this.Frame.SubFrame[i].Frame.ClearToolbar();if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}this.Frame.SubFrame.splice(count,currentLength-count);this.WindowIndex.splice(count,currentLength-count);}else{for(var i=currentLength;i<count;++i)//创建新的指标窗口
7509
- {var subFrame=this.CreateSubFrameItem(i);this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this30.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}}var systemScript=new JSIndexScript();for(var i=0;i<count;++i){var windowIndex=i;var item=null,frameItem=null;if(option.Frame&&option.Frame.length>i)frameItem=option.Frame[windowIndex];if(windowIndex>=startWindowIndex)item=option.Windows[windowIndex-startWindowIndex];var titleIndex=windowIndex+1;this.TitlePaint[titleIndex].Data=[];this.TitlePaint[titleIndex].Title=null;if(item){if(item.Script)//自定义指标脚本
7509
+ {var subFrame=this.CreateSubFrameItem(i);this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this32.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}}var systemScript=new JSIndexScript();for(var i=0;i<count;++i){var windowIndex=i;var item=null,frameItem=null;if(option.Frame&&option.Frame.length>i)frameItem=option.Frame[windowIndex];if(windowIndex>=startWindowIndex)item=option.Windows[windowIndex-startWindowIndex];var titleIndex=windowIndex+1;this.TitlePaint[titleIndex].Data=[];this.TitlePaint[titleIndex].Title=null;if(item){if(item.Script)//自定义指标脚本
7510
7510
  {this.WindowIndex[windowIndex]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
7511
7511
  }else if(item.API)//后台指标
7512
7512
  {var apiItem=item.API;this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,item);}else{var indexID=item.Index;var indexItem=JSIndexMap.Get(indexID);if(indexItem){this.WindowIndex[windowIndex]=indexItem.Create();this.CreateWindowIndex(windowIndex);}else{var indexInfo=systemScript.Get(indexID);if(indexInfo){var args=indexInfo.Args;if(item.Args)args=item.Args;var indexData={Name:indexInfo.Name,Script:indexInfo.Script,Args:args,ID:indexID,//扩展属性 可以是空
@@ -7616,17 +7616,17 @@ if(limitData&&limitData.max>0&&limitData.min>0)//API里带涨停价格 直接使
7616
7616
  {this.LimitPrice={Max:limitData.max,Min:limitData.min};return;}var range=MARKET_SUFFIX_NAME.GetLimitPriceRange(this.Symbol,this.Name);//通过规则获取涨停价格
7617
7617
  if(!range){JSConsole.Chart.Log('[MinuteChartContainer::CaclutateLimitPrice] '+this.Symbol+' no limit price.');return;}//var yClose=data.stock[0].yclose;
7618
7618
  if(yClose<=0)return;this.LimitPrice={Max:yClose*(1+range.Max),Min:yClose*(1+range.Min)};JSConsole.Chart.Log('[MinuteChartContainer::CaclutateLimitPrice] '+this.Symbol+' yClose:'+yClose+' max:'+this.LimitPrice.Max+' min:'+this.LimitPrice.Min);this.LimitPrice.Max=parseFloat(this.LimitPrice.Max.toFixed(2));this.LimitPrice.Min=parseFloat(this.LimitPrice.Min.toFixed(2));JSConsole.Chart.Log('[MinuteChartContainer::CaclutateLimitPrice] '+this.Symbol+' tofixed(2) max:'+this.LimitPrice.Max+' min:'+this.LimitPrice.Min);};//请求叠加数据 (主数据下载完再下载))
7619
- this.RequestOverlayMinuteData=function(){var _this31=this;var self=this;var date=this.TradeDate;//最后一个交易日期
7620
- var _loop4=function _loop4(){var item=_this31.OverlayChartPaint[i];if(!item.MainData||!(item.MainYClose>0))return'continue';if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this31.NetworkFilter){obj={Name:'MinuteChartContainer::RequestOverlayMinuteData',//类名::函数名
7621
- Explain:'叠加股票最新分时数据',Request:{Url:self.HistoryMinuteApiUrl,Data:{days:[date],symbol:symbol},Type:'POST'},Self:_this31,PreventDefault:false};_this31.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayMinuteData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
7619
+ this.RequestOverlayMinuteData=function(){var _this33=this;var self=this;var date=this.TradeDate;//最后一个交易日期
7620
+ var _loop4=function _loop4(){var item=_this33.OverlayChartPaint[i];if(!item.MainData||!(item.MainYClose>0))return'continue';if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this33.NetworkFilter){obj={Name:'MinuteChartContainer::RequestOverlayMinuteData',//类名::函数名
7621
+ Explain:'叠加股票最新分时数据',Request:{Url:self.HistoryMinuteApiUrl,Data:{days:[date],symbol:symbol},Type:'POST'},Self:_this33,PreventDefault:false};_this33.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayMinuteData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
7622
7622
  }//请求数据
7623
7623
  JSNetwork.HttpRequest({url:self.HistoryMinuteApiUrl,data:{"symbol":symbol,"days":[date]},type:"post",dataType:"json",async:true,success:function success(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;//self.RecvMultiOverlayMinuteData([data]);
7624
7624
  self.RecvOverlayMinuteData(data,item);}});};for(var i=0;i<this.OverlayChartPaint.length;++i){var symbol;var obj;var _ret4=_loop4();if(_ret4==='continue')continue;}};//一次接收多个叠加品种
7625
7625
  this.RecvMultiOverlayMinuteData=function(aryData){if(!IFrameSplitOperator.IsNonEmptyArray(aryData))return;var bUpdate=false;for(var i=0;i<aryData.length;++i){var overlayData=aryData[i];if(!overlayData.symbol)continue;for(var j=0;j<this.OverlayChartPaint.length;++j){var item=this.OverlayChartPaint[j];if(!item.MainData||!(item.MainYClose>0))continue;if(overlayData.symbol==item.Symbol){this.RecvOverlayMinuteData(overlayData,item,{Redraw:false});bUpdate=true;break;}}}if(bUpdate){this.UpdateFrameMaxMin();//调整坐标最大 最小值
7626
7626
  this.Frame.SetSizeChage(true);this.Draw();}};this.RecvOverlayMinuteData=function(data,paint,option){if(paint.IsDelete)return;if(this.EnableVerifyRecvData&&data.symbol!=paint.Symbol){JSConsole.Chart.Warn('[MinuteChartContainer::RecvOverlayMinuteData] recv data symbol not match. paint['+paint.Symbol+'] , Recv['+data.symbol+']');return;}var aryMinuteData=MinuteChartContainer.JsonDataToMinuteDataArray(data);var sourceData=null;var yClose;if(this.DayCount>1)//多日数据
7627
7627
  {if(aryMinuteData.length<=0)return;var minuteData=aryMinuteData[0];for(var i in paint.SourceData){var item=paint.SourceData[i];if(item.Date==minuteData.Date){paint.SourceData[i]=minuteData;var allMinuteData=this.HistoryMinuteDataToArray(paint.SourceData);var sourceData=new ChartData();sourceData.Data=allMinuteData;yClose=minuteData.YClose;break;}}if(sourceData==null)return;}else{if(aryMinuteData.length>0)sourceData=aryMinuteData[0];else sourceData=new ChartData();yClose=sourceData.YClose;}paint.Data=sourceData;paint.Title=data.name;paint.Symbol=data.symbol;paint.YClose=yClose;paint.Status=OVERLAY_STATUS_ID.STATUS_FINISHED_ID;var bRedraw=true;if(option&&option.Redraw==false)bRedraw=false;if(bRedraw){this.UpdateFrameMaxMin();//调整坐标最大 最小值
7628
- this.Frame.SetSizeChage(true);this.Draw();}};this.RequestOverlayHistoryMinuteData=function(){var _this32=this;if(!IFrameSplitOperator.IsNonEmptyArray(this.DayData))return;var self=this;var days=[];for(var i=0;i<this.DayData.length;++i){var item=this.DayData[i];days.push(item.Date);}if(days.length<=0)return;var _loop5=function _loop5(){var item=_this32.OverlayChartPaint[i];symbol=item.Symbol;if(!symbol)return'continue';if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this32.NetworkFilter){obj={Name:'MinuteChartContainer::RequestOverlayHistoryMinuteData',//类名::函数名
7629
- Explain:'叠加股票多日分时数据',Request:{Url:self.HistoryMinuteApiUrl,Data:{days:days,symbol:symbol},Type:'POST'},Self:_this32,PreventDefault:false};_this32.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayHistoryMinuteData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
7628
+ this.Frame.SetSizeChage(true);this.Draw();}};this.RequestOverlayHistoryMinuteData=function(){var _this34=this;if(!IFrameSplitOperator.IsNonEmptyArray(this.DayData))return;var self=this;var days=[];for(var i=0;i<this.DayData.length;++i){var item=this.DayData[i];days.push(item.Date);}if(days.length<=0)return;var _loop5=function _loop5(){var item=_this34.OverlayChartPaint[i];symbol=item.Symbol;if(!symbol)return'continue';if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this34.NetworkFilter){obj={Name:'MinuteChartContainer::RequestOverlayHistoryMinuteData',//类名::函数名
7629
+ Explain:'叠加股票多日分时数据',Request:{Url:self.HistoryMinuteApiUrl,Data:{days:days,symbol:symbol},Type:'POST'},Self:_this34,PreventDefault:false};_this34.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayHistoryMinuteData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
7630
7630
  }JSNetwork.HttpRequest({url:self.HistoryMinuteApiUrl,data:{"symbol":symbol,"days":days},type:"post",dataType:"json",async:true,success:function success(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayHistoryMinuteData(data,item);}});};for(var i=0;i<this.OverlayChartPaint.length;++i){var symbol;var obj;var _ret5=_loop5();if(_ret5==='continue')continue;}};this.RecvOverlayHistoryMinuteData=function(data,paint)//叠加历史的分钟数据
7631
7631
  {if(this.EnableVerifyRecvData&&data.symbol!=paint.Symbol){JSConsole.Chart.Warn('[MinuteChartContainer::RecvOverlayHistoryMinuteData] recv data symbol not match. paint['+paint.Symbol+'] , Recv['+data.symbol+']');return;}if(!IFrameSplitOperator.IsNonEmptyArray(this.DayData))return;var dayData=MinuteChartContainer.JsonDataToMinuteDataArray(data);if(!IFrameSplitOperator.IsNonEmptyArray(dayData))return;var overlayDayData=[];for(var i=0;i<this.DayData.length;++i){var item=this.DayData[i];var bFind=false;for(var j=0;j<dayData.length;++j){if(item.Date==dayData[j].Date){overlayDayData.push(dayData[j]);bFind=true;break;}}if(!bFind)//当天不存在叠加数据, 存空
7632
7632
  {var empytData=new ChartData();empytData.Date=item.Date;overlayDayData.push(empytData);}}paint.SourceData=overlayDayData;var allMinuteData=this.HistoryMinuteDataToArray(overlayDayData);var yClose=overlayDayData[0].YClose;//取最近一个交易日前收盘最为中轴线
@@ -7654,8 +7654,8 @@ else this.ClearBindOverlayPositionData();this.TitlePaint[0].Data=this.SourceData
7654
7654
  this.TitlePaint[0].Symbol=this.Symbol;this.TitlePaint[0].Name=this.Name;this.TitlePaint[0].YClose=yClose;this.TitlePaint[0].BeforeOpenData=this.BeforeOpenData;this.TitlePaint[0].AfterCloseData=this.AfterCloseData;this.TitlePaint[0].MultiDayBeforeOpenData=this.IsShowMultiDayBeforeData?this.MultiDayBeforeOpenData:null;this.TitlePaint[0].MultiDayAfterCloseData=this.IsShowMultiDayAfterData?this.MultiDayAfterCloseData:null;if(this.TitlePaint[0].CallAcutionXOperator){this.TitlePaint[0].CallAcutionXOperator.BeforeOpenData=this.BeforeOpenData;this.TitlePaint[0].CallAcutionXOperator.AfterCloseData=this.AfterCloseData;this.TitlePaint[0].CallAcutionXOperator.MultiDayBeforeOpenData=multiBeforeOpenData;this.TitlePaint[0].CallAcutionXOperator.MultiDayAfterCloseData=multiAfterCloseData;this.TitlePaint[0].CallAcutionXOperator.DayOffset=this.DayOffset;}if(this.ChartCorssCursor&&this.ChartCorssCursor.StringFormatY){this.ChartCorssCursor.StringFormatY.YClose=yClose;this.ChartCorssCursor.StringFormatY.BeforeOpenData=this.BeforeOpenData;this.ChartCorssCursor.StringFormatY.AfterCloseData=this.AfterCloseData;this.ChartCorssCursor.StringFormatY.MultiDayBeforeOpenData=multiBeforeOpenData;this.ChartCorssCursor.StringFormatY.MultiDayAfterCloseData=multiAfterCloseData;this.ChartCorssCursor.StringFormatY.DayOffset=this.DayOffset;this.ChartCorssCursor.StringFormatX.Data=this.ChartPaint[0].Data;//十字光标
7655
7655
  this.ChartCorssCursor.StringFormatX.BeforeOpenData=this.BeforeOpenData;this.ChartCorssCursor.StringFormatX.AfterCloseData=this.AfterCloseData;this.ChartCorssCursor.StringFormatX.MultiDayBeforeOpenData=multiBeforeOpenData;this.ChartCorssCursor.StringFormatX.MultiDayAfterCloseData=multiAfterCloseData;this.ChartCorssCursor.StringFormatX.DayOffset=this.DayOffset;;if(this.ChartCorssCursor.CallAcutionXOperator){this.ChartCorssCursor.CallAcutionXOperator.BeforeOpenData=this.BeforeOpenData;this.ChartCorssCursor.CallAcutionXOperator.AfterCloseData=this.AfterCloseData;this.ChartCorssCursor.CallAcutionXOperator.MultiDayBeforeOpenData=multiBeforeOpenData;this.ChartCorssCursor.CallAcutionXOperator.MultiDayAfterCloseData=multiAfterCloseData;this.ChartCorssCursor.CallAcutionXOperator.DayOffset=this.DayOffset;}}if(this.ExtendChartPaint[0]){this.ExtendChartPaint[0].Symbol=this.Symbol;this.ExtendChartPaint[0].Name=this.Name;}for(var i in this.OverlayChartPaint){var item=this.OverlayChartPaint[i];item.MainData=this.ChartPaint[0].Data;//叠加股票
7656
7656
  item.MainYClose=yClose;}};//绑定分钟叠加指标数据(持仓量)
7657
- this.BindOverlayPositionData=function(minuteData,yClose){var _this33=this;if(this.Frame.SubFrame.length<2)return;var chart=null;var frame=null;var subFrame=this.Frame.SubFrame[1];//第2个窗口
7658
- var overlayFrame=null;for(var i=0;i<subFrame.OverlayIndex.length;++i){var item=subFrame.OverlayIndex[i];if(item.Identify=='Position_Line_Frame'){overlayFrame=item;break;}}if(!overlayFrame){overlayFrame=new OverlayIndexItem();overlayFrame.Identify='Position_Line_Frame';if(this.ClassName=="MinuteChartContainer")frame=new OverlayMinuteFrame();else frame=new OverlayMinuteHScreenFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GlobalOption=this.GlobalOption;overlayFrame.Frame=frame;frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this33.GetEventCallback(id);};frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;var chart=new ChartMinutePositionLine();chart.Canvas=this.Canvas;chart.Name='Position-Line';chart.ChartBorder=frame.ChartBorder;chart.ChartFrame=frame;chart.Identify=overlayFrame.Identify;chart.Color=g_JSChartResource.Minute.PositionColor;overlayFrame.ChartPaint.push(chart);subFrame.OverlayIndex.push(overlayFrame);subFrame.Frame.RightFrame=frame;//右边坐标绑定到主坐标上
7657
+ this.BindOverlayPositionData=function(minuteData,yClose){var _this35=this;if(this.Frame.SubFrame.length<2)return;var chart=null;var frame=null;var subFrame=this.Frame.SubFrame[1];//第2个窗口
7658
+ var overlayFrame=null;for(var i=0;i<subFrame.OverlayIndex.length;++i){var item=subFrame.OverlayIndex[i];if(item.Identify=='Position_Line_Frame'){overlayFrame=item;break;}}if(!overlayFrame){overlayFrame=new OverlayIndexItem();overlayFrame.Identify='Position_Line_Frame';if(this.ClassName=="MinuteChartContainer")frame=new OverlayMinuteFrame();else frame=new OverlayMinuteHScreenFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GlobalOption=this.GlobalOption;overlayFrame.Frame=frame;frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this35.GetEventCallback(id);};frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;var chart=new ChartMinutePositionLine();chart.Canvas=this.Canvas;chart.Name='Position-Line';chart.ChartBorder=frame.ChartBorder;chart.ChartFrame=frame;chart.Identify=overlayFrame.Identify;chart.Color=g_JSChartResource.Minute.PositionColor;overlayFrame.ChartPaint.push(chart);subFrame.OverlayIndex.push(overlayFrame);subFrame.Frame.RightFrame=frame;//右边坐标绑定到主坐标上
7659
7659
  }else{frame=overlayFrame.Frame;for(var i=0;i<overlayFrame.ChartPaint.length;++i){var item=overlayFrame.ChartPaint[i];if(item.Name=='Position-Line'){chart=item;break;}}if(!chart)//图形不存在就创建一个
7660
7660
  {chart=new ChartMinutePositionLine();chart.Canvas=this.Canvas;chart.Name='Position-Line';chart.ChartBorder=frame.ChartBorder;chart.ChartFrame=frame;chart.Identify=overlayFrame.Identify;chart.Color=g_JSChartResource.Minute.PositionColor;overlayFrame.ChartPaint.push(chart);}}var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;frame.XPointCount=xPointCouont;subFrame.Frame.IsShowPositionTitle=true;var bindData=new ChartData();bindData.Data=minuteData.GetPosition();chart.Data=bindData;};this.ClearBindOverlayPositionData=function(){if(this.Frame.SubFrame.length<2)return;var subFrame=this.Frame.SubFrame[1];//第2个窗口
7661
7661
  subFrame.Frame.RightFrame=null;subFrame.Frame.IsShowPositionTitle=false;for(var i in subFrame.OverlayIndex){var item=subFrame.OverlayIndex[i];if(item.Identify=='Position_Line_Frame'){subFrame.OverlayIndex.splice(i,1);break;}}};this.GetOverlayIndexByIdentify=function(identify){for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i];if(!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex))continue;for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];if(overlayItem.Identify===identify)return{OverlayItem:overlayItem,WindowIndex:i};}}return null;};this.RecvOverlayIndex=function(identify,data){var overlayIndex=this.GetOverlayIndexByIdentify(identify);if(overlayIndex==null){console.warn('[MinuteChartContainer::RecvOverlayIndex] can\'t find overlay index. [identify='+identify+']');return;}if(!overlayIndex.Script)return;if(typeof overlayIndex.RecvSubscribeData!="function")return;var bindData=this.SourceData;if(!bindData)return;overlayIndex.Script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,bindData);};//更新叠加指标
@@ -7664,12 +7664,12 @@ this.AddOverlayIndex=function(obj){var overlay=this.CreateOverlayWindowsIndex(ob
7664
7664
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
7665
7665
  this.Draw();};//创建一个叠加指标
7666
7666
  this.CreateOverlayWindowsIndex=function(obj)//{WindowIndex:, IndexName:, Identify:, ShowRightText:, API:}
7667
- {var _this34=this;var indexName=obj.IndexName;var windowIndex=obj.WindowIndex;var apiItem=null,indexInfo=null,indexCustom=null;if(obj.API){apiItem=obj.API;}else if(obj.Script)//动态执行脚本
7667
+ {var _this36=this;var indexName=obj.IndexName;var windowIndex=obj.WindowIndex;var apiItem=null,indexInfo=null,indexCustom=null;if(obj.API){apiItem=obj.API;}else if(obj.Script)//动态执行脚本
7668
7668
  {indexInfo={Script:obj.Script,ID:obj.indexName,Name:obj.indexName};if(obj.Name)indexInfo.Name=obj.Name;}else{var scriptData=new JSIndexScript();indexInfo=scriptData.Get(indexName);//系统指标
7669
7669
  if(!indexInfo){indexCustom=JSIndexMap.Get(indexName);//定制指标
7670
7670
  if(!indexCustom){console.warn('[MinuteChartContainer::CreateOverlayIndex] can not find index['+indexName+']');return null;}}}var subFrame=this.Frame.SubFrame[windowIndex];subFrame.Interval=this.OverlayIndexFrameWidth;var overlayFrame=new OverlayIndexItem();if(obj.Identify)overlayFrame.Identify=obj.Identify;//由外部指定id
7671
7671
  var frame=null;if(this.ClassName=="MinuteChartContainer")frame=new OverlayMinuteFrame();else frame=new OverlayMinuteHScreenFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GlobalOption=this.GlobalOption;if(obj.ShowRightText===true)frame.IsShow=true;else if(obj.ShowRightText===false)frame.IsShow=false;if(obj.IsShareY===true)frame.IsShareY=true;if(IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin))frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin;//是否计算Y最大最小值
7672
- frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this34.GetEventCallback(id);};frame.YSplitOperator.HQChart=this;frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;if(obj.Frame){var item=obj.Frame;if(item.Custom)frame.YSplitOperator.Custom=item.Custom;}overlayFrame.Frame=frame;if(apiItem){var apiIndex=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,obj,true);apiIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
7672
+ frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this36.GetEventCallback(id);};frame.YSplitOperator.HQChart=this;frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;if(obj.Frame){var item=obj.Frame;if(item.Custom)frame.YSplitOperator.Custom=item.Custom;}overlayFrame.Frame=frame;if(apiItem){var apiIndex=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,obj,true);apiIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
7673
7673
  overlayFrame.Script=apiIndex;}else if(indexInfo){var indexData=indexInfo;if(obj.Args)indexData.Args=obj.Args;//外部可以设置参数
7674
7674
  var scriptIndex=new OverlayScriptIndex(indexData.Name,indexData.Script,indexData.Args,indexData);//脚本执行
7675
7675
  scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
@@ -7932,33 +7932,33 @@ if(this.DataMove(moveSetp,isLeft)){this.UpdataDataoffset();this.UpdatePointByCur
7932
7932
  {var cursorIndex={};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(!this.Frame.ZoomUp(cursorIndex))return;this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("OnTouchMove");}else//缩小
7933
7933
  {var cursorIndex={};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(!this.Frame.ZoomDown(cursorIndex))return;this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("OnTouchMove");}phonePinch.Last={"X":touches[0].pageX,"Y":touches[0].pageY,"X2":touches[1].pageX,"Y2":touches[1].pageY};}};this.OnTouchEnd=function(e){JSConsole.Chart.Log('[KLineChartHScreenContainer:OnTouchEnd]',e);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var bClearDrawPicture=true;if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==2||drawPicture.Status==1||drawPicture.Status==3){drawPicture.PointStatus=drawPicture.Status;if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo();else bClearDrawPicture=false;}else if(drawPicture.Status==20){if(this.FinishMoveChartDrawPicture())this.DrawDynamicInfo();}}this.IsOnTouch=false;this.VerticalDrag=null;this.StopDragTimer();this.TouchEvent({EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH,FunctionName:"OnTouchEnd"},e);this.OnTouchFinished();this.TouchDrawCount=0;};//创建
7934
7934
  //windowCount 窗口个数
7935
- this.Create=function(windowCount){var _this35=this;this.UIElement.JSChartContainer=this;//创建十字光标
7935
+ this.Create=function(windowCount){var _this37=this;this.UIElement.JSChartContainer=this;//创建十字光标
7936
7936
  this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ExtendChartPaint=this.ExtendChartPaint;//创建等待提示
7937
7937
  this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
7938
7938
  this.Frame=new HQTradeHScreenFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=30;this.Frame.ChartBorder.Left=5;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
7939
7939
  this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();//子窗口动态标题
7940
- for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this35.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.UIElement.addEventListener("keydown",OnKeyDown,true);//键盘消息
7940
+ for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this37.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.UIElement.addEventListener("keydown",OnKeyDown,true);//键盘消息
7941
7941
  };//创建子窗口
7942
- this.CreateChildWindow=function(windowCount){var _this36=this;for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=g_ChartFrameFactory.Create("KLineHScreenFrame",{ID:i});frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;//窗口序号
7942
+ this.CreateChildWindow=function(windowCount){var _this38=this;for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=g_ChartFrameFactory.Create("KLineHScreenFrame",{ID:i});frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;//窗口序号
7943
7943
  frame.RightSpaceCount=this.RightSpaceCount;//右边
7944
7944
  if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
7945
- if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;if(i==0){frame.YSplitOperator=new FrameSplitKLinePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this36.GetEventCallback(id);};//主图上下间距
7945
+ if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;if(i==0){frame.YSplitOperator=new FrameSplitKLinePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this38.GetEventCallback(id);};//主图上下间距
7946
7946
  var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
7947
7947
  border.TopSpace=12*pixelTatio;border.BottomSpace=12*pixelTatio;}else{frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');//frame.IsLocked = true;
7948
- }frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitKLineX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.GetEventCallback=function(id){return _this36.GetEventCallback(id);};if(i!=windowCount-1)frame.XSplitOperator.ShowText=false;for(var j=frame.HorizontalMin;j<=frame.HorizontalMax;j+=1){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=j;if(i==0&&j==frame.HorizontalMin)continue;frame.HorizontalInfo[j].Message[1]=j.toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;}};}////////////////////////////////////////////////////////////////////////////////
7948
+ }frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitKLineX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.GetEventCallback=function(id){return _this38.GetEventCallback(id);};if(i!=windowCount-1)frame.XSplitOperator.ShowText=false;for(var j=frame.HorizontalMin;j<=frame.HorizontalMax;j+=1){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=j;if(i==0&&j==frame.HorizontalMin)continue;frame.HorizontalInfo[j].Message[1]=j.toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;}};}////////////////////////////////////////////////////////////////////////////////
7949
7949
  // 走势图横屏显示
7950
7950
  //
7951
7951
  function MinuteChartHScreenContainer(uielement){this.newMethod=MinuteChartContainer;//派生
7952
7952
  this.newMethod(uielement);delete this.newMethod;this.ClassName='MinuteChartHScreenContainer';this.OnMouseMove=function(x,y,e,isPhone){this.LastPoint.X=x;this.LastPoint.Y=y;this.CursorIndex=this.Frame.GetXData(y);var clientPos=this.PtInClient(x,y);var option={ParentFunction:'OnMouseMove',Point:{X:x,Y:y},IsPhone:isPhone===true,ClientPos:clientPos};this.DrawDynamicInfo(option);};//创建
7953
7953
  //windowCount 窗口个数
7954
- this.Create=function(windowCount){var _this37=this;this.UIElement.JSChartContainer=this;//创建十字光标
7955
- this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return _this37.PtInClient(x,y);};this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_Minute_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this37.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this37.GetEventCallback(id);};this.ChartCorssCursor.CallAcutionXOperator=new CallAcutionXOperator();//创建等待提示
7954
+ this.Create=function(windowCount){var _this39=this;this.UIElement.JSChartContainer=this;//创建十字光标
7955
+ this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return _this39.PtInClient(x,y);};this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_Minute_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this39.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this39.GetEventCallback(id);};this.ChartCorssCursor.CallAcutionXOperator=new CallAcutionXOperator();//创建等待提示
7956
7956
  this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
7957
7957
  this.Frame=new HQTradeHScreenFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=25;this.Frame.ChartBorder.Left=50;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
7958
7958
  this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();//子窗口动态标题
7959
- for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this37.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;this.UIElement.addEventListener("keydown",OnKeyDown,true);//键盘消息
7959
+ for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this39.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;this.UIElement.addEventListener("keydown",OnKeyDown,true);//键盘消息
7960
7960
  };//创建子窗口
7961
- this.CreateChildWindow=function(windowCount){var _this38=this;for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=new MinuteHScreenFrame();frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;if(i<2)frame.ChartBorder.TitleHeight=0;frame.XPointCount=243;var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];if(i==0){frame.YSplitOperator=new FrameSplitMinutePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.GetEventCallback=function(id){return _this38.GetEventCallback(id);};frame.YSplitOperator.DayOffset=this.DayOffset;frame.YSplitOperator.HQChart=this;}else{frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this38.GetEventCallback(id);};}frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitMinuteX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.DayOffset=this.DayOffset;frame.XSplitOperator.GetEventCallback=function(id){return _this38.GetEventCallback(id);};if(i!=windowCount-1)frame.XSplitOperator.ShowText=false;frame.XSplitOperator.Operator();for(var j in DEFAULT_HORIZONTAL){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=DEFAULT_HORIZONTAL[j];if(i==0&&j==frame.HorizontalMin)continue;frame.HorizontalInfo[j].Message[1]=DEFAULT_HORIZONTAL[j].toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;}};}/////////////////////////////////////////////////////////////////////////////////
7961
+ this.CreateChildWindow=function(windowCount){var _this40=this;for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=new MinuteHScreenFrame();frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;if(i<2)frame.ChartBorder.TitleHeight=0;frame.XPointCount=243;var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];if(i==0){frame.YSplitOperator=new FrameSplitMinutePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.GetEventCallback=function(id){return _this40.GetEventCallback(id);};frame.YSplitOperator.DayOffset=this.DayOffset;frame.YSplitOperator.HQChart=this;}else{frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this40.GetEventCallback(id);};}frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitMinuteX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.DayOffset=this.DayOffset;frame.XSplitOperator.GetEventCallback=function(id){return _this40.GetEventCallback(id);};if(i!=windowCount-1)frame.XSplitOperator.ShowText=false;frame.XSplitOperator.Operator();for(var j in DEFAULT_HORIZONTAL){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=DEFAULT_HORIZONTAL[j];if(i==0&&j==frame.HorizontalMin)continue;frame.HorizontalInfo[j].Message[1]=DEFAULT_HORIZONTAL[j].toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;}};}/////////////////////////////////////////////////////////////////////////////////
7962
7962
  // 深度图
7963
7963
  //
7964
7964
  function DepthChartContainer(uielement){this.newMethod=JSChartContainer;//派生
@@ -7966,7 +7966,7 @@ this.newMethod(uielement);delete this.newMethod;this.ClassName="DepthChartContai
7966
7966
  this.MapAsk=new _map2.default();this.MapBid=new _map2.default();this.IsAutoUpdate=false;//是否自动更新行情数据
7967
7967
  this.AutoUpdateFrequency=30000;//30秒更新一次数据
7968
7968
  this.AutoUpdateTimer;this.DefaultZoom=0.8;//默认显示80%的盘口 (0 - 1)
7969
- this.MaxVolRate=1.1;this.Create=function(option){var _this39=this;this.UIElement.JSChartContainer=this;//创建十字光标
7969
+ this.MaxVolRate=1.1;this.Create=function(option){var _this41=this;this.UIElement.JSChartContainer=this;//创建十字光标
7970
7970
  this.ChartCorssCursor=new DepthChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.HQChart=this;//this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");
7971
7971
  //this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;
7972
7972
  //this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");
@@ -7974,9 +7974,9 @@ this.ChartCorssCursor=new DepthChartCorssCursor();this.ChartCorssCursor.Canvas=t
7974
7974
  //创建等待提示
7975
7975
  this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);//创建框架
7976
7976
  this.Frame=new DepthChartFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=30;this.Frame.ChartBorder.Left=5;this.Frame.ChartBorder.Bottom=20;this.Frame.ChartBorder.TitleHeight=0;this.Frame.Canvas=this.Canvas;this.Frame.Identify=0;var ySplitOper=new FrameSplitY();ySplitOper.FrameSplitData=this.FrameSplitData.get('double');ySplitOper.LanguageID=this.LanguageID;ySplitOper.Frame=this.Frame;ySplitOper.SplitCount=5;ySplitOper.LineType=3;ySplitOper.IgnoreYValue=[0];//ySplitOper.SplitType=2;
7977
- ySplitOper.ChartBorder=this.Frame.ChartBorder;ySplitOper.GetEventCallback=function(id){return _this39.GetEventCallback(id);};this.Frame.YSplitOperator=ySplitOper;var xSplitOper=new FrameSplitXDepth();xSplitOper.Frame=this.Frame;;xSplitOper.ChartBorder=this.Frame.ChartBorder;;xSplitOper.LanguageID=this.LanguageID;xSplitOper.LineType=3;xSplitOper.GetEventCallback=function(id){return _this39.GetEventCallback(id);};this.Frame.XSplitOperator=xSplitOper;if(this.ChartCorssCursor)this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
7978
- this.ChartSplashPaint.Frame=this.Frame;var chartItem=new ChartOrderbookDepth();chartItem.Canvas=this.Canvas;chartItem.ChartBorder=this.Frame.ChartBorder;chartItem.ChartFrame=this.Frame;chartItem.Name="深度图";this.ChartPaint.push(chartItem);var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[DepthChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this39.OnKeyDown(e);},true);//键盘消息
7979
- if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this39.OnWheel(e);},true);//上下滚动消息
7977
+ ySplitOper.ChartBorder=this.Frame.ChartBorder;ySplitOper.GetEventCallback=function(id){return _this41.GetEventCallback(id);};this.Frame.YSplitOperator=ySplitOper;var xSplitOper=new FrameSplitXDepth();xSplitOper.Frame=this.Frame;;xSplitOper.ChartBorder=this.Frame.ChartBorder;;xSplitOper.LanguageID=this.LanguageID;xSplitOper.LineType=3;xSplitOper.GetEventCallback=function(id){return _this41.GetEventCallback(id);};this.Frame.XSplitOperator=xSplitOper;if(this.ChartCorssCursor)this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
7978
+ this.ChartSplashPaint.Frame=this.Frame;var chartItem=new ChartOrderbookDepth();chartItem.Canvas=this.Canvas;chartItem.ChartBorder=this.Frame.ChartBorder;chartItem.ChartFrame=this.Frame;chartItem.Name="深度图";this.ChartPaint.push(chartItem);var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[DepthChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this41.OnKeyDown(e);},true);//键盘消息
7979
+ if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this41.OnWheel(e);},true);//上下滚动消息
7980
7980
  };this.OnWheel=function(e){JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);var x=e.clientX-this.UIElement.getBoundingClientRect().left;var y=e.clientY-this.UIElement.getBoundingClientRect().top;var isInClient=false;this.Canvas.beginPath();this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());isInClient=this.Canvas.isPointInPath(x,y);var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var enableZoomUpDown=true;//是否允许缩放
7981
7981
  if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Wheel===false)enableZoomUpDown=false;if(isInClient&&wheelValue<0&&enableZoomUpDown)//缩小
7982
7982
  {if(this.Frame.ZoomDown()){this.UpdateFrameMaxMin();this.Draw();}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
@@ -8099,11 +8099,11 @@ this.BarPosition=1;//柱子方向 0=左边 1=右边
8099
8099
  this.BarWidthRate=0.3;this.Arguments=[{Name:"VAVol",Value:70},{Name:"BarPosition",Value:0}];this.SetArgs=function(args){if(!args||!IFrameSplitOperator.IsNonEmptyArray(args))return;for(var i=0;i<args.length;++i){var item=args[i];if(item.Name=="VAVol")this.SetParamValue(item.Name,item.Value);else if(item.Name=="BarPosition")this.SetParamValue(item.Name,item.Value);}};this.SetParamValue=function(name,value){for(var i=0;i<this.Arguments.length;++i){var item=this.Arguments[i];if(item.Name==name)item.Value=value;}};if(option){if(IFrameSplitOperator.IsNumber(option.VolType))this.VolType=option.VolType;if(IFrameSplitOperator.IsNumber(option.BarWidthRate))this.BarWidthRate=option.BarWidthRate;if(IFrameSplitOperator.IsNumber(option.DelayRequestFrequency))this.DelayRequestFrequency=option.DelayRequestFrequency;if(option.Args)this.SetArgs(option.Args);if(IFrameSplitOperator.IsNumber(option.BarPosition)){this.BarPosition=option.BarPosition;this.SetParamValue("BarPosition",this.BarPosition);}}this.GetParamValue=function(name){for(var i=0;i<this.Arguments.length;++i){var item=this.Arguments[i];if(item.Name==name)return item.Value;}};this.Create=function(hqChart,windowIndex){this.HQChart=hqChart;this.WindowIndex=windowIndex;};this.CreateChart=function(hqChart,windowIndex){var frame=null;var isOverlay=this.IsOverlay();if(isOverlay){frame=this.OverlayIndex.Frame.Frame;this.OverlayIndex.Frame.ChartPaint=[];//清空
8100
8100
  }else{frame=hqChart.Frame.SubFrame[windowIndex].Frame;hqChart.DeleteIndexPaint(windowIndex);//清空
8101
8101
  }var aryPaint=[];var paint=new ChartVolProfileVisibleRange();paint.Canvas=hqChart.Canvas;paint.Name=this.Name+"-0";paint.ChartBorder=frame.ChartBorder;paint.ChartFrame=frame;paint.HQChart=this.HQChart;paint.Identify=this.Guid;paint.SetOption(this);if(isOverlay)this.OverlayIndex.Frame.ChartPaint.push(paint);else hqChart.ChartPaint.push(paint);aryPaint.push(paint);this.ChartVolProfile=paint;return aryPaint;};this.CancelRequestTimer=function(){if(this.RequestTimer){clearTimeout(this.RequestTimer);this.RequestTimer=null;}};//请求数据
8102
- this.RequestData=function(hqChart,windowIndex,hisData,option){var _this40=this;this.CancelRequestTimer();var T_RequestData=function T_RequestData(){//请求数据
8102
+ this.RequestData=function(hqChart,windowIndex,hisData,option){var _this42=this;this.CancelRequestTimer();var T_RequestData=function T_RequestData(){//请求数据
8103
8103
  var klineChart=hqChart.ChartPaint[0];//获取当前K线图实例
8104
8104
  var kData=klineChart.Data;//K线数据
8105
8105
  if(!kData||IFrameSplitOperator.IsNonEmptyArray(!kData.Data))return;var pageKRange=klineChart.DrawKRange;//当前显示的K线索引
8106
- if(!pageKRange||!IFrameSplitOperator.IsNumber(pageKRange.Start)||!IFrameSplitOperator.IsNumber(pageKRange.End))return;var startKItem=kData.Data[pageKRange.Start];var endKItem=kData.Data[pageKRange.End];var option={Start:{Date:startKItem.Date,DataIndex:pageKRange.Start},End:{Date:endKItem.Date,DataIndex:pageKRange.End},Chart:_this40};if(IFrameSplitOperator.IsNumber(startKItem.Time))option.Start.Time=startKItem.Time;if(IFrameSplitOperator.IsNumber(endKItem.Time))option.End.Time=endKItem.Time;option.ValueAreaVol=_this40.Arguments[0].Value;if(_this40.Arguments[1].Value>0)_this40.BarPosition=1;else _this40.BarPosition=0;if(_this40.ChartVolProfile){_this40.ChartVolProfile.SetOption({BarPosition:_this40.BarPosition});}_this40.DataStatus=0;if(hqChart&&hqChart.RequestVolumeProfileData){hqChart.RequestVolumeProfileData(option);}};if(option&&option.Type==1)//页面缩放或移动延迟更新
8106
+ if(!pageKRange||!IFrameSplitOperator.IsNumber(pageKRange.Start)||!IFrameSplitOperator.IsNumber(pageKRange.End))return;var startKItem=kData.Data[pageKRange.Start];var endKItem=kData.Data[pageKRange.End];var option={Start:{Date:startKItem.Date,DataIndex:pageKRange.Start},End:{Date:endKItem.Date,DataIndex:pageKRange.End},Chart:_this42};if(IFrameSplitOperator.IsNumber(startKItem.Time))option.Start.Time=startKItem.Time;if(IFrameSplitOperator.IsNumber(endKItem.Time))option.End.Time=endKItem.Time;option.ValueAreaVol=_this42.Arguments[0].Value;if(_this42.Arguments[1].Value>0)_this42.BarPosition=1;else _this42.BarPosition=0;if(_this42.ChartVolProfile){_this42.ChartVolProfile.SetOption({BarPosition:_this42.BarPosition});}_this42.DataStatus=0;if(hqChart&&hqChart.RequestVolumeProfileData){hqChart.RequestVolumeProfileData(option);}};if(option&&option.Type==1)//页面缩放或移动延迟更新
8107
8107
  {this.RequestTimer=setTimeout(function(){T_RequestData();},this.DelayRequestFrequency);}else{T_RequestData();}return true;};this.OnRecvVolumeProfileData=function(data){this.BindData(data);this.HQChart.UpdataDataoffset();//更新数据偏移
8108
8108
  this.HQChart.UpdateFrameMaxMin();//调整坐标最大 最小值
8109
8109
  this.HQChart.Draw();return true;};this.BindData=function(data){if(!this.ChartVolProfile||this.ChartVolProfile.IsDestroy==true)this.CreateChart(this.HQChart,this.WindowIndex);var chart=this.ChartVolProfile;chart.Data=null;if(!data||!IFrameSplitOperator.IsNonEmptyArray(data.Data))return;if(!IFrameSplitOperator.IsNumber(data.MaxPrice)||!IFrameSplitOperator.IsNumber(data.MinPrice))return;var maxVol=0,vol=0;var maxVolPrice=null;for(var i=0,j=0;i<data.Data.length;++i){var item=data.Data[i];vol=0;for(j=0;j<item.Vol.length;++j){var volItem=item.Vol[j];if(IFrameSplitOperator.IsNumber(volItem.Value))vol+=volItem.Value;}if(maxVol<vol){maxVol=vol;maxVolPrice=item.Price;}}if(this.maxVolPrice<=0||this.maxVol<=0)return;chart.MaxVolPrice=maxVolPrice;chart.MaxVol=maxVol;chart.MaxPrice=data.MaxPrice;chart.MinPrice=data.MinPrice;chart.Data=data;var titleIndex=this.WindowIndex+1;this.HQChart.TitlePaint[titleIndex].Title="VPVR";this.HQChart.TitlePaint[titleIndex].Identify=this.Guid;//指标ID
@@ -10649,14 +10649,14 @@ var symbol=readArgument.Value;//支持 SH60000, SZ000001
10649
10649
  if(symbol.indexOf('.SH')>0)result.Symbol=symbol.replace('.SH',".sh");else if(symbol.indexOf('.SZ')>0)result.Symbol=symbol.replace('.SZ',".sz");else if(symbol.indexOf("SH")==0)result.Symbol=symbol.slice(2)+".sh";else if(symbol.indexOf("SZ")==0)result.Symbol=symbol.slice(2)+".sz";else result.Symbol=symbol;return true;};this.ReadIndexArgumentValue=function(args,result){result.Args=[];for(var i in result.SytemIndex.Args)//复制参数
10650
10650
  {var item=result.SytemIndex.Args[i];result.Args.push({Value:item.Value,Name:item.Name});}if(args.length>2&&result.SytemIndex.Args&&result.SytemIndex.Args.length>0){for(var i=2,j=0;i<args.length&&j<result.SytemIndex.Args.length;++i,++j){var readArgument={};var item=args[i];if((typeof item==='undefined'?'undefined':(0,_typeof3.default)(item))==='object'){if(!this.ReadArgumentValue(item,readArgument)){result.Error=readArgument.Error;return false;}}else{readArgument.Value=item;}result.Args[j].Value=readArgument.Value;}}return true;};//key= (代码,周期),指标(参数) => 输出
10651
10651
  this.GenerateScriptIndexKey=function(indexInfo){var indexParam='';var args=indexInfo.Args;for(var i in args){if(indexParam.length>0)indexParam+=',';var item=args[i];indexParam+=item.Value.toString();}var out="ALL";if(indexInfo.Out)out=indexInfo.Out;else if(IFrameSplitOperator.IsPlusNumber(indexInfo.OutIndex))out='Out['+(indexInfo.OutIndex-1)+']';var key='('+indexInfo.Symbol+','+indexInfo.PeriodID+'), '+indexInfo.Name+'('+indexParam+')=>'+out;return key;};//TMP2:=KDJ.K#WEEK;
10652
- this.CallMemberScriptIndex=function(job){var _this41=this;if(job.Member.Object.Type!=Syntax.Identifier||job.Member.Property.Type!=Syntax.Identifier){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallMemberScriptIndex() Error: \u53C2\u6570\u9519\u8BEF');}var objName=job.Member.Object.Name;var PropertyName=job.Member.Property.Name;if(PropertyName==""||PropertyName==null){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallMemberScriptIndex() Error: '+objName+'.'+PropertyName+' \u6307\u6807\u8F93\u51FA\u53D8\u91CF\u9519\u8BEF');}if(this.Execute.VarTable.has(objName)){var memberValue=this.Execute.VarTable.get(objName);if(memberValue.hasOwnProperty(PropertyName)){JSConsole.Complier.Log('[JSSymbolData::CallMemberScriptIndex] index data '+objName+'.'+PropertyName+' in cache.');return this.Execute.RunNextJob();}}var callInfo=objName+"."+PropertyName;var indexInfo={Job:job,PeriodID:this.Period,Symbol:this.Symbol};if(!this.ReadIndexFunctionValue(callInfo,indexInfo))//读取指标
10652
+ this.CallMemberScriptIndex=function(job){var _this43=this;if(job.Member.Object.Type!=Syntax.Identifier||job.Member.Property.Type!=Syntax.Identifier){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallMemberScriptIndex() Error: \u53C2\u6570\u9519\u8BEF');}var objName=job.Member.Object.Name;var PropertyName=job.Member.Property.Name;if(PropertyName==""||PropertyName==null){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallMemberScriptIndex() Error: '+objName+'.'+PropertyName+' \u6307\u6807\u8F93\u51FA\u53D8\u91CF\u9519\u8BEF');}if(this.Execute.VarTable.has(objName)){var memberValue=this.Execute.VarTable.get(objName);if(memberValue.hasOwnProperty(PropertyName)){JSConsole.Complier.Log('[JSSymbolData::CallMemberScriptIndex] index data '+objName+'.'+PropertyName+' in cache.');return this.Execute.RunNextJob();}}var callInfo=objName+"."+PropertyName;var indexInfo={Job:job,PeriodID:this.Period,Symbol:this.Symbol};if(!this.ReadIndexFunctionValue(callInfo,indexInfo))//读取指标
10653
10653
  {var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallMemberScriptIndex() Error: \''+callInfo+'\' '+indexInfo.Error);}var systemIndex=new JSIndexScript();var systemItem=systemIndex.Get(indexInfo.Name);if(!systemItem){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallMemberScriptIndex() Error: \''+callInfo+'\' '+indexInfo.Name+' \u6307\u6807\u4E0D\u5B58\u5728');}if(Array.isArray(systemItem.Args)&&systemItem.Args.length>0){indexInfo.Args=[];for(var i in systemItem.Args)//复制参数
10654
10654
  {var item=systemItem.Args[i];indexInfo.Args.push({Value:item.Value,Name:item.Name});}}JSConsole.Complier.Log('[JSSymbolData::CallMemberScriptIndex] call script index',indexInfo);var dateTimeRange=this.Data.GetDateRange();var option={HQDataType:this.DataType,Symbol:indexInfo.Symbol,Name:'',Right:this.Right,//复权
10655
10655
  Period:indexInfo.PeriodID,//周期
10656
- Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this41.RecvMemberScriptIndexData(outVar,job,symbolData);_this41.Execute.RunNextJob();},CallbackParam:indexInfo,Async:true,MaxRequestDataCount:this.MaxRequestDataCount+30*2,MaxRequestMinuteDayCount:this.MaxRequestMinuteDayCount+2,Arguments:indexInfo.Args,//Condition:this.Condition,
10656
+ Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this43.RecvMemberScriptIndexData(outVar,job,symbolData);_this43.Execute.RunNextJob();},CallbackParam:indexInfo,Async:true,MaxRequestDataCount:this.MaxRequestDataCount+30*2,MaxRequestMinuteDayCount:this.MaxRequestMinuteDayCount+2,Arguments:indexInfo.Args,//Condition:this.Condition,
10657
10657
  IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:dateTimeRange//K线数据范围
10658
10658
  };//执行脚本
10659
- var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_this41.ExecuteScriptIndexError(error,indexInfo);});};/*****************************************************************************************************************************
10659
+ var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_this43.ExecuteScriptIndexError(error,indexInfo);});};/*****************************************************************************************************************************
10660
10660
  脚本调用
10661
10661
 
10662
10662
  STKINDI
@@ -10669,16 +10669,16 @@ var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_t
10669
10669
  CALCSTOCKINDEX('SH600000','KDJ',3)表示上证600000的KDJ指标第3个输出即J之值,第一个参数可在前面加SZ(深市),SH(沪市),BJ(京市),或市场_,,
10670
10670
  CALCSTOCKINDEX('47_IFL0','MACD',2)表示IFL0品种的MACD指标第2个输出值.
10671
10671
 
10672
- *******************************************************************************************************************************/this.CallScriptIndex=function(job){var _this42=this;if(job.Member)return this.CallMemberScriptIndex(job);if(!job.Args||!(job.Args.length>=2)){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() Error: '+job.FunctionName+' \u53C2\u6570\u9519\u8BEF');}var indexInfo={Job:job,PeriodID:this.Period};if(!this.ReadSymbolArgumentValue(job.Args[0],indexInfo))//读取代码
10672
+ *******************************************************************************************************************************/this.CallScriptIndex=function(job){var _this44=this;if(job.Member)return this.CallMemberScriptIndex(job);if(!job.Args||!(job.Args.length>=2)){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() Error: '+job.FunctionName+' \u53C2\u6570\u9519\u8BEF');}var indexInfo={Job:job,PeriodID:this.Period};if(!this.ReadSymbolArgumentValue(job.Args[0],indexInfo))//读取代码
10673
10673
  {var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() Error: '+indexInfo.Error);}if(!this.ReadIndexFunctionValue(job.Args[1],indexInfo))//读取指标
10674
10674
  {var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() Error: '+indexInfo.Error);}if(job.FunctionName=="CALCSTOCKINDEX"){if(!this.ReadIndexFunctionOut(job.Args[2],indexInfo))//读取返回值索引
10675
10675
  {var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() Error: '+indexInfo.Error);}}var systemIndex=new JSIndexScript();var systemItem=systemIndex.Get(indexInfo.Name);if(!systemItem){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() '+indexInfo.Name+' \u6307\u6807\u4E0D\u5B58\u5728');}indexInfo.SytemIndex=systemItem;//系统指标
10676
10676
  if(!this.ReadIndexArgumentValue(job.Args,indexInfo)){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() '+indexInfo.Name+' \u6307\u6807\u53C2\u6570\u9519\u8BEF : '+indexInfo.Error+' ');}JSConsole.Complier.Log('[JSSymbolData::CallScriptIndex] call script index',indexInfo);var DateTimeRange=null;if(this.Data&&this.Data.Data.length>0){var start=this.Data.Data[0];var end=this.Data.Data[this.Data.Data.length-1];DateTimeRange={Start:{Date:start.Date,Time:start.Time},End:{Date:end.Date,Time:end.Time}};}var option={HQDataType:this.DataType,Symbol:indexInfo.Symbol,Name:'',Right:this.Right,//复权
10677
10677
  Period:indexInfo.PeriodID,//周期
10678
- Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this42.RecvScriptIndexData(outVar,job,symbolData);_this42.Execute.RunNextJob();},CallbackParam:indexInfo,Async:true,MaxRequestDataCount:this.MaxRequestDataCount+30*2,MaxRequestMinuteDayCount:this.MaxRequestMinuteDayCount+2,Arguments:indexInfo.Args,//Condition:this.Condition,
10678
+ Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this44.RecvScriptIndexData(outVar,job,symbolData);_this44.Execute.RunNextJob();},CallbackParam:indexInfo,Async:true,MaxRequestDataCount:this.MaxRequestDataCount+30*2,MaxRequestMinuteDayCount:this.MaxRequestMinuteDayCount+2,Arguments:indexInfo.Args,//Condition:this.Condition,
10679
10679
  IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:DateTimeRange//K线数据范围
10680
10680
  };//执行脚本
10681
- var run=JSComplier.Execute(indexInfo.SytemIndex.Script,option,function(error,indexInfo){_this42.ExecuteScriptIndexError(error,indexInfo);});};this.RecvMemberScriptIndexData=function(outVar,indexInfo,symbolData){JSConsole.Complier.Log('[JSSymbolData::RecvMemberScriptIndexData] ',outVar,indexInfo,symbolData);var kLine=symbolData.Data.Data;var aryOutVar=outVar;var data=this.Data.FitKLineIndex(kLine,aryOutVar,this.Period,indexInfo.PeriodID);var member=indexInfo.Job.Member;var objName=member.Object.Name;var propertyName=member.Property.Name;var memberValue={};if(this.Execute.VarTable.has(objName))memberValue=this.Execute.VarTable.get(objName);else this.Execute.VarTable.set(objName,memberValue);//保存所有的指标数据, 下面用到了就可以不用算了
10681
+ var run=JSComplier.Execute(indexInfo.SytemIndex.Script,option,function(error,indexInfo){_this44.ExecuteScriptIndexError(error,indexInfo);});};this.RecvMemberScriptIndexData=function(outVar,indexInfo,symbolData){JSConsole.Complier.Log('[JSSymbolData::RecvMemberScriptIndexData] ',outVar,indexInfo,symbolData);var kLine=symbolData.Data.Data;var aryOutVar=outVar;var data=this.Data.FitKLineIndex(kLine,aryOutVar,this.Period,indexInfo.PeriodID);var member=indexInfo.Job.Member;var objName=member.Object.Name;var propertyName=member.Property.Name;var memberValue={};if(this.Execute.VarTable.has(objName))memberValue=this.Execute.VarTable.get(objName);else this.Execute.VarTable.set(objName,memberValue);//保存所有的指标数据, 下面用到了就可以不用算了
10682
10682
  for(var i in data){var key=outVar[i].Name;if(indexInfo.Period)key+='#'+indexInfo.Period;//带周期的变量
10683
10683
  memberValue[key]=data[i].Data;}};this.RecvScriptIndexData=function(outVar,indexInfo,symbolData){var key=this.GenerateScriptIndexKey(indexInfo);JSConsole.Complier.Log('[JSSymbolData::RecvScriptIndexData] ',outVar,indexInfo,symbolData,key);var kLine=symbolData.Data.Data;var aryOutVar=outVar;if(indexInfo.Out){for(var i=0;i<outVar.length;++i){var item=outVar[i];if(item.Name==indexInfo.Out){aryOutVar=[item];break;}}var data=this.Data.FitKLineIndex(kLine,aryOutVar,this.Period,indexInfo.PeriodID);this.ScriptIndexOutData.set(key,data[0].Data);}else if(IFrameSplitOperator.IsPlusNumber(indexInfo.OutIndex)){var index=indexInfo.OutIndex-1;aryOutVar=[outVar[index]];var data=this.Data.FitKLineIndex(kLine,aryOutVar,this.Period,indexInfo.PeriodID);this.ScriptIndexOutData.set(key,data[0].Data);}else{var data=this.Data.FitKLineIndex(kLine,aryOutVar,this.Period,indexInfo.PeriodID);var result={__Type__:"Object"};for(var i in data){var item=data[i];result[item.Name]=item.Data;}this.ScriptIndexOutData.set(key,result);}};this.ExecuteScriptIndexError=function(error,indexInfo){var token=indexInfo.Job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() '+indexInfo.Name+' \u6307\u6807\u6267\u884C\u9519\u8BEF : '+error+' ');};this.GetScriptIndexOutData=function(args,node,funcName){var indexInfo={PeriodID:this.Period};if(!this.ReadSymbolArgumentValue(args[0],indexInfo))//读取代码
10684
10684
  this.Execute.ThrowUnexpectedNode(node,funcName+'() \u80A1\u7968\u4EE3\u7801\u9519\u8BEF: '+indexInfo.Error);if(!this.ReadIndexFunctionValue(args[1],indexInfo))//读取指标
@@ -10843,7 +10843,7 @@ GetMarginJobID:function GetMarginJobID(value){var dataMap=new _map2.default([[1,
10843
10843
  [9,JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_NEWS_ANALYSIS_TOPMANAGERS],//NEWS(9) 高管要闻
10844
10844
  [10,JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_NEWS_ANALYSIS_PLEDGE]]);if(dataMap.has(value))return dataMap.get(value);return null;},//财务截面数据 分报告期
10845
10845
  GetSectionFinanceID:function GetSectionFinanceID(value){var dataMap=new _map2.default([['流动资产',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_01],['货币资金',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_02],['存货',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_03],['流动负债',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_04],['非流动负债',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_05],['三项费用',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_06],['投资收益',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_07],['归母净利润',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_08],['扣非净利润',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_09],['扣非每股收益',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_10],['加权平均净资产收益',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_11],['在建工程',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_12],['累计折旧',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_13],['少数股东利润',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_14],['汇兑损益',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_15],['坏账计提',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_16],['固定资产',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_17],['当期折旧',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_18],['营业总收入',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_19],['主营业务利润',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_20],['营业利润',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_21],['净利润',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_22],['应收账款',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_23],['财务费用',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_24],['经营性现金流',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_25],['资产总计',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_26],['负债总计',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_27],['所有者权益总计',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_28],['毛利率',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_29],['每股资本公积金',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_30],['每股未分配利润',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_31],['每股收益',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_32],['每股净资产',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_33],['每股经营性现金流',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_34],['扣非净利润涨幅',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_35],['扣非净利润涨速',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_36],['净利润涨幅',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_37],['资产负债率',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_38],['利润同比',JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SECTION_F_39]]);if(dataMap.has(value))return dataMap.get(value);return null;},//获取报告期 2018, 1
10846
- GetSectionReportPeriod:function GetSectionReportPeriod(year,quarter){if(year>=2000&&quarter>=1&&quarter<=4)return{Year:year,Quarter:quarter};return null;}};function JSExecute(ast,option){var _this43=this;this.AST=ast;//语法树
10846
+ GetSectionReportPeriod:function GetSectionReportPeriod(year,quarter){if(year>=2000&&quarter>=1&&quarter<=4)return{Year:year,Quarter:quarter};return null;}};function JSExecute(ast,option){var _this45=this;this.AST=ast;//语法树
10847
10847
  this.ErrorHandler=new ErrorHandler();this.VarTable=new _map2.default();//变量表
10848
10848
  this.VarDrawTable=new _map2.default();//绘图变量表
10849
10849
  this.OutVarTable=[];//输出变量
@@ -10888,7 +10888,7 @@ this.ConstVarTable=new _map2.default([//个股数据
10888
10888
  ["HYSJL",null],//指数市净率或个股所属行业的市净率
10889
10889
  ['DRAWNULL',null],["NULL",null],["MACHINEDATE",null],["MACHINETIME",null],["MACHINEWEEK",null]]);this.SymbolData=new JSSymbolData(this.AST,option,this);this.Algorithm=new JSAlgorithm(this.ErrorHandler,this.SymbolData);this.Draw=new JSDraw(this.ErrorHandler,this.SymbolData);this.JobList=[];//执行的任务队列
10890
10890
  this.UpdateUICallback=null;//回调
10891
- this.CallbackParam=null;this.IsSectionMode=false;if(option){if(option.Callback)this.UpdateUICallback=option.Callback;if(option.CallbackParam){this.CallbackParam=option.CallbackParam;if(this.CallbackParam.HQChart)this.GetEventCallback=function(id){return _this43.CallbackParam.HQChart.GetEventCallback(id);};}if(option.Arguments)this.Arguments=option.Arguments;if(option.IsSectionMode)this.IsSectionMode=option.IsSectionMode;if(option.Self)this.IndexCtrl=option.Self;//调试模式信息
10891
+ this.CallbackParam=null;this.IsSectionMode=false;if(option){if(option.Callback)this.UpdateUICallback=option.Callback;if(option.CallbackParam){this.CallbackParam=option.CallbackParam;if(this.CallbackParam.HQChart)this.GetEventCallback=function(id){return _this45.CallbackParam.HQChart.GetEventCallback(id);};}if(option.Arguments)this.Arguments=option.Arguments;if(option.IsSectionMode)this.IsSectionMode=option.IsSectionMode;if(option.Self)this.IndexCtrl=option.Self;//调试模式信息
10892
10892
  if(IFrameSplitOperator.IsNumber(option.Debug))this.Debug=option.Debug;if(option.DebugFilter)this.DebugFilter=option.DebugFilter;}this.Execute=function(){this.OutVarTable=[];this.VarTable=new _map2.default();this.VarDrawTable=new _map2.default();//绘图变量表
10893
10893
  JSConsole.Complier.Log('[JSExecute::Execute] Load Arguments',this.Arguments);for(var _i141 in this.Arguments)//预定义的变量
10894
10894
  {var _item22=this.Arguments[_i141];this.VarTable.set(_item22.Name,_item22.Value);}this.RunNextJob();};this.RunNextJob=function(){if(this.JobList.length<=0)return;JSConsole.Complier.Log('[JSExecute::Execute] JobList',this.JobList);var jobItem=this.JobList.shift();switch(jobItem.ID){case JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SYMBOL_DATA:return this.SymbolData.GetSymbolData();case JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SYMBOL_PERIOD_DATA:return this.SymbolData.GetSymbolPeriodData(jobItem);case JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_INDEX_DATA:return this.SymbolData.GetIndexData();case JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_LATEST_INDEX_DATA:return this.SymbolData.GetLatestIndexData();case JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_INDEX_INCREASE_DATA:return this.SymbolData.GetIndexIncreaseData(jobItem);case JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SYMBOL_LATEST_DATA:return this.SymbolData.GetLatestData(jobItem);case JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_VOLR_DATA://量比
@@ -10950,8 +10950,8 @@ else if(value.indexOf("FONTSIZE")==0){var strFontSize=value.replace("FONTSIZE","
10950
10950
  {var _outVar13=this.VarTable.get(_varName3);var _value10={Name:_varName3,Data:_outVar13,Type:9};if(color)_value10.Color=color;if(upColor)_value10.UpColor=upColor;if(downColor)_value10.DownColor=downColor;if(lineWidth)_value10.LineWidth=lineWidth;this.OutVarTable.push(_value10);}else if(colorStick&&_varName3)//CYW: SUM(VAR4,10)/10000, COLORSTICK; 画上下柱子
10951
10951
  {var _outVar14=this.VarTable.get(_varName3);var _value11={Name:_varName3,Data:_outVar14,Color:color,Type:2};if(lineWidth)_value11.LineWidth=lineWidth;if(color)_value11.Color=color;if(upColor)_value11.UpColor=upColor;if(downColor)_value11.DownColor=downColor;this.OutVarTable.push(_value11);}else if(_varName3&&color&&!_draw3){var _outVar15=this.VarTable.get(_varName3);if(!Array.isArray(_outVar15))_outVar15=this.SingleDataToArrayData(_outVar15);var _value12={Name:_varName3,Data:_outVar15,Color:color,Type:0};if(lineWidth)_value12.LineWidth=lineWidth;if(isShow==false)_value12.IsShow=false;if(isExData==true)_value12.IsExData=true;if(isDotLine==true)_value12.IsDotLine=true;if(isOverlayLine==true)_value12.IsOverlayLine=true;if(isNoneName==true)_value12.NoneName=true;if(isShowTitle==false)_value12.IsShowTitle=false;if(stepLine==true)_value12.Type=7;this.OutVarTable.push(_value12);}else if(_draw3)//画图函数
10952
10952
  {var outVar={Name:_draw3.Name,Draw:_draw3,Type:1};if(color)outVar.Color=color;if(isDotLine==true)outVar.IsDotLine=true;if(lineWidth)outVar.LineWidth=lineWidth;if(isDrawAbove)outVar.IsDrawAbove=true;if(isDrawCenter)outVar.IsDrawCenter=true;if(isDrawBelow)outVar.IsDrawBelow=true;if(drawAlign>=0)outVar.DrawAlign=drawAlign;if(drawVAlign>=0)outVar.DrawVAlign=drawVAlign;if(fontSize>0)outVar.DrawFontSize=fontSize;if(bgConfig)outVar.Background=bgConfig;if(vLineConfig)outVar.VerticalLine=vLineConfig;if(IFrameSplitOperator.IsNumber(xOffset))outVar.XOffset=xOffset;if(IFrameSplitOperator.IsNumber(yOffset))outVar.YOffset=yOffset;this.OutVarTable.push(outVar);}else if(_varName3){var _outVar16=this.VarTable.get(_varName3);var _value13={Name:_varName3,Data:_outVar16,Type:0};if(color)_value13.Color=color;if(lineWidth)_value13.LineWidth=lineWidth;if(isShow==false)_value13.IsShow=false;if(isExData==true)_value13.IsExData=true;if(isDotLine==true)_value13.IsDotLine=true;if(isOverlayLine==true)_value13.IsOverlayLine=true;if(isShowTitle==false)_value13.IsShowTitle=false;if(stepLine==true)_value13.Type=7;this.OutVarTable.push(_value13);}}}};this.GetOutIconData=function(cond,iconDraw){if(Array.isArray(cond)){for(var i=0;i<cond.length&&i<iconDraw.DrawData.length;++i){var item=cond[i];if(item<=0)iconDraw.DrawData[i]=null;}return iconDraw;}if(cond)return iconDraw;return null;};this.GetSoundEvent=function(){if(!this.GetEventCallback)return null;return this.GetEventCallback(JSCHART_EVENT_ID.ON_PLAY_SOUND);};this.Run=function(){try{var data=this.RunAST();//执行脚本
10953
- JSConsole.Complier.Log('[JSComplier.Run] execute finish',data);if(this.IndexCtrl)this.IndexCtrl.Status=0;if(this.UpdateUICallback){JSConsole.Complier.Log('[JSComplier.Run] invoke UpdateUICallback.');if(this.CallbackParam&&this.CallbackParam.Job&&this.CallbackParam.Job.ID==JS_EXECUTE_JOB_ID.JOB_EXECUTE_INDEX){this.UpdateUICallback(data,this.CallbackParam,this.SymbolData);}else{if(this.CallbackParam&&this.CallbackParam.Self&&this.CallbackParam.Self.ClassName==='ScriptIndexConsole')this.CallbackParam.JSExecute=this;if(this.IsUsePageData==true)this.CallbackParam.Self.IsUsePageData=true;this.UpdateUICallback(data,this.CallbackParam);}}}catch(error){JSConsole.Complier.Log(error);if(error.Job){JSConsole.Complier.Log('[JSComplier.Run] download job and reexectue',error.Job);this.JobList.push(error.Job);this.JobList.push({ID:JS_EXECUTE_JOB_ID.JOB_RUN_SCRIPT});this.Execute();}else if(this.ErrorCallback){if(this.IndexCtrl)this.IndexCtrl.Status=0;this.ErrorCallback(error,this.CallbackParam);}}};this.DebugRun_End=function(){var data=this.OutVarTable;JSConsole.Complier.Log('[JSComplier.DebugRun_End] execute finish',data);if(this.IndexCtrl)this.IndexCtrl.Status=0;if(this.UpdateUICallback){JSConsole.Complier.Log('[JSComplier.DebugRun_End] invoke UpdateUICallback.');if(this.CallbackParam&&this.CallbackParam.Job&&this.CallbackParam.Job.ID==JS_EXECUTE_JOB_ID.JOB_EXECUTE_INDEX){this.UpdateUICallback(data,this.CallbackParam,this.SymbolData);}else{if(this.CallbackParam&&this.CallbackParam.Self&&this.CallbackParam.Self.ClassName==='ScriptIndexConsole')this.CallbackParam.JSExecute=this;if(this.IsUsePageData==true)this.CallbackParam.Self.IsUsePageData=true;this.UpdateUICallback(data,this.CallbackParam);}}};this.DebugRun_Next=function(debugCtrl){var _this44=this;if(debugCtrl.ExeLine<debugCtrl.LineCount){var item=this.AST.Body[debugCtrl.ExeLine];this.RunASTNode(item);++debugCtrl.ExeLine;this.DebugFilter(debugCtrl,function(){_this44.DebugRun_Next(debugCtrl);});}else{this.DebugRun_End();debugCtrl.Status=2;this.DebugFilter(debugCtrl,null);}};//debug模式
10954
- this.DebugRun=function(){var _this45=this;try{if(!this.AST)this.ThrowError();if(!this.AST.Body)this.ThrowError();var debugCtrl={LineCount:this.AST.Body.length,ExeLine:0,Self:this,Status:1};this.DebugFilter(debugCtrl,function(){_this45.DebugRun_Next(debugCtrl);});}catch(error){if(this.ErrorCallback){if(this.IndexCtrl)this.IndexCtrl.Status=0;this.ErrorCallback(error,this.CallbackParam);}}};this.VisitNode=function(node){switch(node.Type){case Syntax.SequenceExpression:this.VisitSequenceExpression(node);break;case Syntax.ExpressionStatement:this.VisitNode(node.Expression);break;case Syntax.AssignmentExpression:this.VisitAssignmentExpression(node);break;case Syntax.BinaryExpression:case Syntax.LogicalExpression:this.VisitBinaryExpression(node);break;case Syntax.CallExpression:this.VisitCallExpression(node);break;}};this.VisitSequenceExpression=function(node){for(var _i144 in node.Expression){var _item24=node.Expression[_i144];this.VisitNode(_item24);}};//函数调用
10953
+ JSConsole.Complier.Log('[JSComplier.Run] execute finish',data);if(this.IndexCtrl)this.IndexCtrl.Status=0;if(this.UpdateUICallback){JSConsole.Complier.Log('[JSComplier.Run] invoke UpdateUICallback.');if(this.CallbackParam&&this.CallbackParam.Job&&this.CallbackParam.Job.ID==JS_EXECUTE_JOB_ID.JOB_EXECUTE_INDEX){this.UpdateUICallback(data,this.CallbackParam,this.SymbolData);}else{if(this.CallbackParam&&this.CallbackParam.Self&&this.CallbackParam.Self.ClassName==='ScriptIndexConsole')this.CallbackParam.JSExecute=this;if(this.IsUsePageData==true)this.CallbackParam.Self.IsUsePageData=true;this.UpdateUICallback(data,this.CallbackParam);}}}catch(error){JSConsole.Complier.Log(error);if(error.Job){JSConsole.Complier.Log('[JSComplier.Run] download job and reexectue',error.Job);this.JobList.push(error.Job);this.JobList.push({ID:JS_EXECUTE_JOB_ID.JOB_RUN_SCRIPT});this.Execute();}else if(this.ErrorCallback){if(this.IndexCtrl)this.IndexCtrl.Status=0;this.ErrorCallback(error,this.CallbackParam);}}};this.DebugRun_End=function(){var data=this.OutVarTable;JSConsole.Complier.Log('[JSComplier.DebugRun_End] execute finish',data);if(this.IndexCtrl)this.IndexCtrl.Status=0;if(this.UpdateUICallback){JSConsole.Complier.Log('[JSComplier.DebugRun_End] invoke UpdateUICallback.');if(this.CallbackParam&&this.CallbackParam.Job&&this.CallbackParam.Job.ID==JS_EXECUTE_JOB_ID.JOB_EXECUTE_INDEX){this.UpdateUICallback(data,this.CallbackParam,this.SymbolData);}else{if(this.CallbackParam&&this.CallbackParam.Self&&this.CallbackParam.Self.ClassName==='ScriptIndexConsole')this.CallbackParam.JSExecute=this;if(this.IsUsePageData==true)this.CallbackParam.Self.IsUsePageData=true;this.UpdateUICallback(data,this.CallbackParam);}}};this.DebugRun_Next=function(debugCtrl){var _this46=this;if(debugCtrl.ExeLine<debugCtrl.LineCount){var item=this.AST.Body[debugCtrl.ExeLine];this.RunASTNode(item);++debugCtrl.ExeLine;this.DebugFilter(debugCtrl,function(){_this46.DebugRun_Next(debugCtrl);});}else{this.DebugRun_End();debugCtrl.Status=2;this.DebugFilter(debugCtrl,null);}};//debug模式
10954
+ this.DebugRun=function(){var _this47=this;try{if(!this.AST)this.ThrowError();if(!this.AST.Body)this.ThrowError();var debugCtrl={LineCount:this.AST.Body.length,ExeLine:0,Self:this,Status:1};this.DebugFilter(debugCtrl,function(){_this47.DebugRun_Next(debugCtrl);});}catch(error){if(this.ErrorCallback){if(this.IndexCtrl)this.IndexCtrl.Status=0;this.ErrorCallback(error,this.CallbackParam);}}};this.VisitNode=function(node){switch(node.Type){case Syntax.SequenceExpression:this.VisitSequenceExpression(node);break;case Syntax.ExpressionStatement:this.VisitNode(node.Expression);break;case Syntax.AssignmentExpression:this.VisitAssignmentExpression(node);break;case Syntax.BinaryExpression:case Syntax.LogicalExpression:this.VisitBinaryExpression(node);break;case Syntax.CallExpression:this.VisitCallExpression(node);break;}};this.VisitSequenceExpression=function(node){for(var _i144 in node.Expression){var _item24=node.Expression[_i144];this.VisitNode(_item24);}};//函数调用
10955
10955
  this.VisitCallExpression=function(node){var funcName=node.Callee.Name;var args=[];for(var i=0;i<node.Arguments.length;++i){var item=node.Arguments[i];var value;if(funcName==="IFC"&&i>=1)break;//IFC先处理第1个条件参数
10956
10956
  if(item.Type==Syntax.BinaryExpression||item.Type==Syntax.LogicalExpression)value=this.VisitBinaryExpression(item);else if(item.Type==Syntax.CallExpression)value=this.VisitCallExpression(item);else value=this.GetNodeValue(item);args.push(value);}if(funcName==="IFC"){//IFC(X,A,B)若X不为0则执行A,否则执行B.IFC与IF函数的区别:根据X的值来选择性执行A、B表达式.
10957
10957
  var bResult=this.Algorithm.IFC(args[0]);var item=bResult?node.Arguments[1]:node.Arguments[2];var value;if(item.Type==Syntax.BinaryExpression||item.Type==Syntax.LogicalExpression)value=this.VisitBinaryExpression(item);else if(item.Type==Syntax.CallExpression)value=this.VisitCallExpression(item);else value=this.GetNodeValue(item);node.Out=value;if(item.Draw)node.Draw=item.Draw;return node.Out;}//JSConsole.Complier.Log('[JSExecute::VisitCallExpression]' , funcName, '(', args.toString() ,')');
@@ -11698,15 +11698,15 @@ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FILTER_DEAL_DATA);if(!event|
11698
11698
  event.Callback(event,sendData,this);return sendData.Result;};this.EnableFilter=function(bEnable,option)//启动|关闭筛选
11699
11699
  {this.EnableFilterData=bEnable;this.Data.Data=this.FilterData(this.SourceData.Data);this.Data.DataOffset=0;if(option){if(option.GotoLastPage==true)this.GotoLastPage();if(option.Redraw==true)this.Draw();}};this.CloneArray=function(aryData){var data=[];if(!IFrameSplitOperator.IsNonEmptyArray(aryData))return data;for(var i=0;i<aryData.length;++i){data.push(aryData[i]);}return data;};//创建
11700
11700
  //windowCount 窗口个数
11701
- this.Create=function(option){var _this46=this;this.UIElement.JSChartContainer=this;//创建等待提示
11701
+ this.Create=function(option){var _this48=this;this.UIElement.JSChartContainer=this;//创建等待提示
11702
11702
  this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);//创建框架
11703
11703
  this.Frame=new JSDealFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=30;this.Frame.ChartBorder.Left=5;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.ChartSplashPaint.Frame=this.Frame;//创建表格
11704
- var chart=new ChartDealList();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this46.GetEventCallback(id);};this.ChartPaint[0]=chart;if(option){if(IFrameSplitOperator.IsBool(option.IsSingleTable))chart.IsSingleTable=option.IsSingleTable;//单表模式
11704
+ var chart=new ChartDealList();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this48.GetEventCallback(id);};this.ChartPaint[0]=chart;if(option){if(IFrameSplitOperator.IsBool(option.IsSingleTable))chart.IsSingleTable=option.IsSingleTable;//单表模式
11705
11705
  if(IFrameSplitOperator.IsBool(option.IsShowHeader))chart.IsShowHeader=option.IsShowHeader;//是否显示表头
11706
11706
  if(IFrameSplitOperator.IsBool(option.IsShowLastPage))this.IsShowLastPage=option.IsShowLastPage;//是否显示最后一页
11707
11707
  if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
11708
- }var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this46.OnKeyDown(e);},true);//键盘消息
11709
- if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this46.OnWheel(e);},true);//上下滚动消息
11708
+ }var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this48.OnKeyDown(e);},true);//键盘消息
11709
+ if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this48.OnWheel(e);},true);//上下滚动消息
11710
11710
  };this.Draw=function(){if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
11711
11711
  this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
11712
11712
  if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
@@ -11867,25 +11867,25 @@ this.DragPageCycle=true;//手机翻页循环
11867
11867
  this.DragXScroll=null;//{Start:{x,y}, End:{x, y}}
11868
11868
  this.IsDestroy=false;//是否已经销毁了
11869
11869
  this.ChartDestory=function()//销毁
11870
- {this.IsDestroy=true;this.StopAutoUpdate();};this.StopAutoDragScrollTimer=function(){JSConsole.Chart.Log("[JSReportChartContainer::StopAutoDragScrollTimer] stop ");this.EnablePageScroll=false;if(this.AutoDragScrollTimer!=null){clearTimeout(this.AutoDragScrollTimer);this.AutoDragScrollTimer=null;}};this.AutoScrollPage=function(step){var _this47=this;this.AutoDragScrollTimer=setTimeout(function(){_this47.ChartOperator_Temp_ScrollPage(step);},300);};this.ChartOperator_Temp_ScrollPage=function(moveSetp){if(!this.EnablePageScroll)return;var reportChart=this.GetReportChart();if(!reportChart)return;if(moveSetp>0){var pageStatus=reportChart.GetCurrentPageStatus();if(pageStatus.IsEnd)return;this.MoveYOffset(moveSetp,false);++moveSetp;}else if(moveSetp<0){if(this.Data.YOffset<=0)return;this.MoveYOffset(moveSetp,false);--moveSetp;}else{return;}this.Draw();if(!this.EnablePageScroll)return;this.AutoScrollPage(moveSetp);return;};//清空固定行数据
11870
+ {this.IsDestroy=true;this.StopAutoUpdate();};this.StopAutoDragScrollTimer=function(){JSConsole.Chart.Log("[JSReportChartContainer::StopAutoDragScrollTimer] stop ");this.EnablePageScroll=false;if(this.AutoDragScrollTimer!=null){clearTimeout(this.AutoDragScrollTimer);this.AutoDragScrollTimer=null;}};this.AutoScrollPage=function(step){var _this49=this;this.AutoDragScrollTimer=setTimeout(function(){_this49.ChartOperator_Temp_ScrollPage(step);},300);};this.ChartOperator_Temp_ScrollPage=function(moveSetp){if(!this.EnablePageScroll)return;var reportChart=this.GetReportChart();if(!reportChart)return;if(moveSetp>0){var pageStatus=reportChart.GetCurrentPageStatus();if(pageStatus.IsEnd)return;this.MoveYOffset(moveSetp,false);++moveSetp;}else if(moveSetp<0){if(this.Data.YOffset<=0)return;this.MoveYOffset(moveSetp,false);--moveSetp;}else{return;}this.Draw();if(!this.EnablePageScroll)return;this.AutoScrollPage(moveSetp);return;};//清空固定行数据
11871
11871
  this.ClearFixedRowData=function(){this.FixedRowData.Data=[];this.FixedRowData.Symbol=[];};//设置固定行
11872
11872
  this.SetFixedRowCount=function(value){var chart=this.GetReportChart();if(!chart)return;chart.FixedRowCount=value;};//创建
11873
- this.Create=function(option){var _this48=this;this.UIElement.JSChartContainer=this;//创建等待提示
11873
+ this.Create=function(option){var _this50=this;this.UIElement.JSChartContainer=this;//创建等待提示
11874
11874
  this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
11875
11875
  this.Frame=new JSReportFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=30;this.Frame.ChartBorder.Left=5;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.ChartSplashPaint.Frame=this.Frame;//创建表格
11876
- var chart=new ChartReport();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.UIElement=this.UIElement;chart.GetEventCallback=function(id){return _this48.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this48.GetStockData(symbol);};chart.GetBlockDataCallback=function(symbol){return _this48.GetBlockData(symbol);};chart.GetFlashBGDataCallback=function(symbol,time){return _this48.GetFlashBGData(symbol,time);};chart.Data=this.Data;chart.GlobalOption=this.GlobalOption;chart.FixedRowData=this.FixedRowData;chart.SortInfo=this.SortInfo;chart.Tab=new ChartReportTab();chart.Tab.Frame=this.Frame;chart.Tab.Canvas=this.Canvas;chart.Tab.ChartBorder=this.Frame.ChartBorder;chart.Tab.Report=chart;this.ChartPaint[0]=chart;//页脚
11876
+ var chart=new ChartReport();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.UIElement=this.UIElement;chart.GetEventCallback=function(id){return _this50.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this50.GetStockData(symbol);};chart.GetBlockDataCallback=function(symbol){return _this50.GetBlockData(symbol);};chart.GetFlashBGDataCallback=function(symbol,time){return _this50.GetFlashBGData(symbol,time);};chart.Data=this.Data;chart.GlobalOption=this.GlobalOption;chart.FixedRowData=this.FixedRowData;chart.SortInfo=this.SortInfo;chart.Tab=new ChartReportTab();chart.Tab.Frame=this.Frame;chart.Tab.Canvas=this.Canvas;chart.Tab.ChartBorder=this.Frame.ChartBorder;chart.Tab.Report=chart;this.ChartPaint[0]=chart;//页脚
11877
11877
  if(option&&option.PageInfo===true){var pageInfoChart=new ChartReportPageInfo();pageInfoChart.Frame=this.Frame;pageInfoChart.ChartBorder=this.Frame.ChartBorder;pageInfoChart.Canvas=this.Canvas;pageInfoChart.Report=chart;this.ChartPaint[1]=pageInfoChart;}if(option){if(IFrameSplitOperator.IsBool(option.IsShowHeader))chart.IsShowHeader=option.IsShowHeader;//是否显示表头
11878
11878
  if(IFrameSplitOperator.IsNumber(option.FixedColumn))chart.FixedColumn=option.FixedColumn;//固定列
11879
11879
  if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
11880
11880
  if(IFrameSplitOperator.IsBool(option.TabShow))chart.Tab.IsShow=option.TabShow;if(IFrameSplitOperator.IsNumber(option.FixedRowCount))chart.FixedRowCount=option.FixedRowCount;//固定行
11881
11881
  if(IFrameSplitOperator.IsBool(option.ItemBorder))chart.IsDrawBorder=option.ItemBorder;//单元格边框
11882
- if(IFrameSplitOperator.IsNumber(option.SelectedModel))chart.SelectedModel=option.SelectedModel;if(IFrameSplitOperator.IsNonEmptyArray(option.FixedSymbol)){chart.FixedRowCount=0;this.FixedRowData.Type=1;this.FixedRowData.Symbol=[];var aryData=option.FixedSymbol;for(var i=0;i<aryData.length;++i){var item=aryData[i];this.FixedRowData.Symbol.push(item.Symbol);++chart.FixedRowCount;}}}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this48.OnKeyDown(e);},true);//键盘消息
11883
- if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this48.OnWheel(e);},true);//上下滚动消息
11884
- this.UIElement.ondblclick=function(e){_this48.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this48.UIOnMouseDown(e);};this.UIElement.onmouseup=function(e){_this48.UIOnMounseUp(e);};this.UIElement.oncontextmenu=function(e){_this48.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this48.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this48.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this48.UIOnMouseleave(e);};//手机拖拽
11885
- this.UIElement.ontouchstart=function(e){_this48.OnTouchStart(e);};this.UIElement.ontouchmove=function(e){_this48.OnTouchMove(e);};this.UIElement.ontouchend=function(e){_this48.OnTouchEnd(e);};};this.Draw=function(){if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
11882
+ if(IFrameSplitOperator.IsNumber(option.SelectedModel))chart.SelectedModel=option.SelectedModel;if(IFrameSplitOperator.IsNonEmptyArray(option.FixedSymbol)){chart.FixedRowCount=0;this.FixedRowData.Type=1;this.FixedRowData.Symbol=[];var aryData=option.FixedSymbol;for(var i=0;i<aryData.length;++i){var item=aryData[i];this.FixedRowData.Symbol.push(item.Symbol);++chart.FixedRowCount;}}}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this50.OnKeyDown(e);},true);//键盘消息
11883
+ if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this50.OnWheel(e);},true);//上下滚动消息
11884
+ this.UIElement.ondblclick=function(e){_this50.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this50.UIOnMouseDown(e);};this.UIElement.onmouseup=function(e){_this50.UIOnMounseUp(e);};this.UIElement.oncontextmenu=function(e){_this50.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this50.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this50.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this50.UIOnMouseleave(e);};//手机拖拽
11885
+ this.UIElement.ontouchstart=function(e){_this50.OnTouchStart(e);};this.UIElement.ontouchmove=function(e){_this50.OnTouchMove(e);};this.UIElement.ontouchend=function(e){_this50.OnTouchEnd(e);};};this.Draw=function(){if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
11886
11886
  this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
11887
11887
  if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
11888
- for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.IsDrawFirst)item.Draw();}for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.IsDrawFirst)item.Draw();}if(this.GlobalOption.FlashBGCount>0){this.DelayDraw(500);}};this.DelayDraw=function(frequency){var _this49=this;if(typeof this.FlashBGTimer=='number'){clearTimeout(this.FlashBGTimer);this.FlashBGTimer=null;}this.FlashBGTimer=setTimeout(function(){_this49.Draw();},frequency);};this.ResetReportStatus=function(){this.Data.XOffset=0;this.Data.YOffset=0;};this.ResetReportSelectStatus=function(){var chart=this.GetReportChart();if(chart){chart.SelectedRow=-1;chart.SelectedFixedRow=-1;}};this.ClearData=function(){this.SourceData.Data=[];this.Data.Data=[];this.BlockData=new _map2.default();};this.ResetSortStatus=function(){this.SortInfo.Field=-1;this.SortInfo.Sort=0;};//设置股票列表
11888
+ for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.IsDrawFirst)item.Draw();}for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.IsDrawFirst)item.Draw();}if(this.GlobalOption.FlashBGCount>0){this.DelayDraw(500);}};this.DelayDraw=function(frequency){var _this51=this;if(typeof this.FlashBGTimer=='number'){clearTimeout(this.FlashBGTimer);this.FlashBGTimer=null;}this.FlashBGTimer=setTimeout(function(){_this51.Draw();},frequency);};this.ResetReportStatus=function(){this.Data.XOffset=0;this.Data.YOffset=0;};this.ResetReportSelectStatus=function(){var chart=this.GetReportChart();if(chart){chart.SelectedRow=-1;chart.SelectedFixedRow=-1;}};this.ClearData=function(){this.SourceData.Data=[];this.Data.Data=[];this.BlockData=new _map2.default();};this.ResetSortStatus=function(){this.SortInfo.Field=-1;this.SortInfo.Sort=0;};//设置股票列表
11889
11889
  this.SetSymbolList=function(arySymbol,option){this.ClearData();this.ResetReportStatus();this.ResetSortStatus();if(IFrameSplitOperator.IsNonEmptyArray(arySymbol)){for(var i=0;i<arySymbol.length;++i){this.Data.Data.push(arySymbol[i]);}}var chart=this.ChartPaint[0];if(chart)chart.Data=this.Data;this.Draw();};this.ChangeSymbol=function(symbol,option){this.Symbol=symbol;this.ClearData();this.ResetReportStatus();this.ResetSortStatus();this.ResetReportSelectStatus();if(option){if(IFrameSplitOperator.IsNumber(option.TabSelected)){var chartTab=this.GetTabChart();if(chartTab)chartTab.SelectedTabIndex=option.TabSelected;}if(Array.isArray(option.FixedSymbol)){var chart=this.GetReportChart();if(chart){chart.FixedRowCount=0;this.FixedRowData.Type=1;this.FixedRowData.Symbol=[];var aryData=option.FixedSymbol;for(var i=0;i<aryData.length;++i){var item=aryData[i];this.FixedRowData.Symbol.push(item.Symbol);++chart.FixedRowCount;}this.SetSizeChange(true);}}if(option.SortInfo){var item=option.SortInfo;if(IFrameSplitOperator.IsNumber(item.Field))this.SortInfo.Field=item.Field;if(IFrameSplitOperator.IsNumber(item.Sort))this.SortInfo.Sort=item.Sort;}}this.RequestMemberListData();};this.RequestMemberListData=function(){//this.ChartSplashPaint.SetTitle(this.SplashTitle.MemberList);
11890
11890
  //this.ChartSplashPaint.EnableSplash(true);
11891
11891
  //this.Draw();
@@ -11904,7 +11904,7 @@ this.GetStockData=function(symbol){if(!this.MapStockData)return null;if(!this.Ma
11904
11904
  this.SetFlashBGItem=function(symbol,obj){var item={ID:obj.ID,Color:obj.Color,Count:1};if(IFrameSplitOperator.IsNumber(obj.Count))item.Count=obj.Count;if(IFrameSplitOperator.IsNumber(obj.Time))item.Time=obj.Time;else item.Time=Date.now();if(this.FlashBG.has(symbol)){var stockItem=this.FlashBG.get(symbol);stockItem.LastTime=item.Time;stockItem.Data.set(item.ID,item);}else{var stockItem={LastTime:item.Time,Data:new _map2.default([[item.ID,item]])};this.FlashBG.set(symbol,stockItem);}};this.GetFlashBGData=function(symbol,time){if(!this.FlashBG)return null;if(!this.FlashBG.has(symbol))return null;var timeDiff=3*1000;var stockItem=this.FlashBG.get(symbol);if(time-stockItem.LastTime>=timeDiff)//超时的删除
11905
11905
  {this.FlashBG.delete(symbol);return null;}if(!stockItem.Data||stockItem.Data.size<=0){this.FlashBG.delete(symbol);return null;}var aryDelID=[];//超时需要参数的
11906
11906
  var _iteratorNormalCompletion21=true;var _didIteratorError21=false;var _iteratorError21=undefined;try{for(var _iterator21=(0,_getIterator3.default)(stockItem.Data),_step21;!(_iteratorNormalCompletion21=(_step21=_iterator21.next()).done);_iteratorNormalCompletion21=true){var mapItem=_step21.value;var item=mapItem[1];if(time-item.Time>=timeDiff||item.Count<=0)aryDelID.push(item.ID);}}catch(err){_didIteratorError21=true;_iteratorError21=err;}finally{try{if(!_iteratorNormalCompletion21&&_iterator21.return){_iterator21.return();}}finally{if(_didIteratorError21){throw _iteratorError21;}}}if(IFrameSplitOperator.IsNonEmptyArray(aryDelID)){for(var i=0;i<aryDelID.length;++i){stockItem.Data.delete(aryDelID[i]);}if(stockItem.Data.size<=0){this.FlashBG.delete(symbol);return null;}}return stockItem;};//delay=是否延迟
11907
- this.DelayUpdateStockData=function(){var _this50=this;if(this.DelayUpdateTimer!=null){clearTimeout(this.DelayUpdateTimer);this.DelayUpdateTimer=null;}var frequency=this.DelayUpdateFrequency;this.DelayUpdateTimer=setTimeout(function(){_this50.UpdateStockData();},frequency);};this.UpdateStockData=function(){if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;var chart=this.ChartPaint[0];if(!chart)return;if(this.SortInfo&&this.SortInfo.Field>=0&&this.SortInfo.Sort>0){var column=chart.Column[this.SortInfo.Field];if(column.Sort==2){this.RequestStockSortData(column,this.SortInfo.Field,this.SortInfo.Sort);//远程排序
11907
+ this.DelayUpdateStockData=function(){var _this52=this;if(this.DelayUpdateTimer!=null){clearTimeout(this.DelayUpdateTimer);this.DelayUpdateTimer=null;}var frequency=this.DelayUpdateFrequency;this.DelayUpdateTimer=setTimeout(function(){_this52.UpdateStockData();},frequency);};this.UpdateStockData=function(){if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;var chart=this.ChartPaint[0];if(!chart)return;if(this.SortInfo&&this.SortInfo.Field>=0&&this.SortInfo.Sort>0){var column=chart.Column[this.SortInfo.Field];if(column.Sort==2){this.RequestStockSortData(column,this.SortInfo.Field,this.SortInfo.Sort);//远程排序
11908
11908
  return;}}var arySymbol=chart.ShowSymbol;if(!IFrameSplitOperator.IsNonEmptyArray(arySymbol))return;this.RequestStockData(arySymbol);};//下载股票数据
11909
11909
  this.RequestStockData=function(arySymbol){var self=this;if(this.NetworkFilter){var obj={Name:'JSDealChartContainer::RequestStockData',//类名::函数名
11910
11910
  Explain:'报价列表股票数据',Request:{Data:{stocks:arySymbol}},Self:this,PreventDefault:false};this.NetworkFilter(obj,function(data){self.RecvStockData(data);self.AutoUpdate();});if(obj.PreventDefault==true)return;}throw{Name:'JSReportChartContainer::RequestStockData',Error:'(报价列表股票数据)不提供内置测试数据'};};this.RecvStockData=function(data){var setUpdateSymbol=new _set2.default();//更新的股票列表
@@ -11958,7 +11958,7 @@ var result=this.MoveSelectedRow(-1);if(result){if(result.Redraw)this.Draw();if(r
11958
11958
  var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}break;case 37://left
11959
11959
  if(this.MoveXOffset(-1))this.Draw();break;case 39://right
11960
11960
  if(this.MoveXOffset(1))this.Draw();break;}//不让滚动条滚动
11961
- if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.UIOnDblClick=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart)chart.OnDblClick(x,y,e);};this.UIOnMouseDown=function(e){var _this51=this;this.DragXScroll=null;this.DragHeader=null;this.DragColumnWidth=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart){var dragColumnWidth=chart.PtInHeaderDragBorder(x,y);if(dragColumnWidth){this.DragColumnWidth={ClickPoint:{X:x,Y:y},LastPoint:{X:x,Y:y},//Click:{ X:e.clientX, Y:e.clientY },
11961
+ if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.UIOnDblClick=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart)chart.OnDblClick(x,y,e);};this.UIOnMouseDown=function(e){var _this53=this;this.DragXScroll=null;this.DragHeader=null;this.DragColumnWidth=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart){var dragColumnWidth=chart.PtInHeaderDragBorder(x,y);if(dragColumnWidth){this.DragColumnWidth={ClickPoint:{X:x,Y:y},LastPoint:{X:x,Y:y},//Click:{ X:e.clientX, Y:e.clientY },
11962
11962
  //LastMove:{ X:e.clientX, Y:e.clientY},
11963
11963
  ClickData:dragColumnWidth,ColumnWidth:dragColumnWidth.Column.Width};}else{var clickData=chart.OnMouseDown(x,y,e);if(!clickData)return;//if (e.button!=0) return;
11964
11964
  if((clickData.Type==2||clickData.Type==4)&&(e.button==0||e.button==2))//点击行|固定行
@@ -11969,7 +11969,7 @@ if((clickData.Type==2||clickData.Type==4)&&(e.button==0||e.button==2))//点击
11969
11969
  {if(this.MoveXOffset(1))this.Draw();}else if(tabData.Type==3)//滚动条
11970
11970
  {this.DragXScroll={Click:{X:x,Y:y},LastMove:{X:x,Y:y}};}else if(tabData.Type==4)//滚动条内部
11971
11971
  {if(this.SetXOffset(tabData.Pos))this.Draw();}else if(tabData.Type==5)//标签
11972
- {this.OnClickTab(tabData,e);}}}}document.onmousemove=function(e){_this51.DocOnMouseMove(e);};document.onmouseup=function(e){_this51.DocOnMouseUp(e);};};this.UIOnMounseUp=function(e){console.log('"UIOnMounseUp');};//去掉右键菜单
11972
+ {this.OnClickTab(tabData,e);}}}}document.onmousemove=function(e){_this53.DocOnMouseMove(e);};document.onmouseup=function(e){_this53.DocOnMouseUp(e);};};this.UIOnMounseUp=function(e){console.log('"UIOnMounseUp');};//去掉右键菜单
11973
11973
  this.UIOnContextMenu=function(e){e.preventDefault();};this.UIOnMouseMove=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.DragRow)return;if(this.DrawHeader)return;if(this.DragColumnWidth)return;var tabChart=this.GetTabChart();if(tabChart){var tabData=tabChart.PtInTab(x,y);if(tabData){var index=tabData.Index;if(tabChart.MoveOnTabIndex!=index){tabChart.MoveOnTabIndex=index;this.Draw();}}}var mouseStatus={Cursor:"default",Name:"Default"};;//鼠标状态
11974
11974
  var report=this.GetReportChart();var cell=null;if(report){var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);if(dragHeaderWidth){mouseStatus={Cursor:"col-resize",Name:"DragHeaderWidth"};JSConsole.Chart.Log("[JSReportChartContainer::UIOnMouseMove] drag column width ",dragHeaderWidth);}else{cell=report.PtInCell(x,y);//是否在单元格(EnableTooltip)
11975
11975
  }}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);if(event){var sendData={X:x,Y:y,Cell:cell};event.Callback(event,sendData,this);}if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;};this.UIOnMounseOut=function(e){var tabChart=this.GetTabChart();if(tabChart&&tabChart.MoveOnTabIndex>=0){tabChart.MoveOnTabIndex=-1;this.Draw();}};this.UIOnMouseleave=function(e){var tabChart=this.GetTabChart();if(tabChart&&tabChart.MoveOnTabIndex>=0){tabChart.MoveOnTabIndex=-1;this.Draw();}};this.DocOnMouseMove=function(e){this.DragMove.PreMove.X=this.DragMove.Move.X;this.DragMove.PreMove.Y=this.DragMove.Move.Y;this.DragMove.Move.X=e.clientX;this.DragMove.Move.Y=e.clientX;if(this.DragMove.Move.X!=this.DragMove.PreMove.X||this.DragMove.Move.Y!=this.DragMove.PreMove.Y)this.StopAutoDragScrollTimer();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;//JSConsole.Chart.Log(`[JSReportChartContainer::DocOnMouseMove] x=${x}, y=${y}`);
@@ -12008,8 +12008,8 @@ if(chart.SelectedModel==0)//不可翻页模式, 只能在当前页移动
12008
12008
  {var pageStatus=chart.GetCurrentPageStatus();var pageSize=pageStatus.PageSize;var selected=pageStatus.SelectedRow;if(step>0){if(selected<0||selected<pageStatus.Start||selected>pageStatus.End){chart.SelectedRow=pageStatus.Start;result.Redraw=true;return result;}var offset=this.Data.YOffset;for(var i=0;i<step;++i){++selected;if(selected>pageStatus.End)++offset;if(selected>=this.Data.Data.length){selected=0;offset=0;}}result.Redraw=true;result.Update=offset!=this.Data.YOffset;chart.SelectedRow=selected;this.Data.YOffset=offset;return result;}else if(step<0){if(selected<0||selected<pageStatus.Start||selected>pageStatus.End){chart.SelectedRow=pageStatus.End;result.Redraw=true;return result;}step=Math.abs(step);var offset=this.Data.YOffset;for(var i=0;i<step;++i){--selected;if(selected<pageStatus.Start)--offset;if(selected<0){selected=this.Data.Data.length-1;offset=this.Data.Data.length-pageSize;if(offset<0)offset=0;}}result.Redraw=true;result.Update=offset!=this.Data.YOffset;chart.SelectedRow=selected;this.Data.YOffset=offset;return result;}}return null;};//左右移动
12009
12009
  this.MoveXOffset=function(step){var chart=this.ChartPaint[0];if(!chart)return false;var maxOffset=chart.GetXScrollRange();if(maxOffset<=0)return false;if(step>0){if(this.Data.XOffset>=maxOffset)return false;for(var i=0;i<step;++i){if(this.Data.XOffset>=maxOffset)break;++this.Data.XOffset;}return true;}else if(step<0){if(this.Data.XOffset<=0)return false;step=Math.abs(step);for(var i=0;i<step;++i){if(this.Data.XOffset-1<0)break;--this.Data.XOffset;}return true;}return false;};this.SetXOffset=function(pos){if(!IFrameSplitOperator.IsNumber(pos))return false;var chart=this.ChartPaint[0];if(!chart)return false;var maxOffset=chart.GetXScrollRange();if(pos<0)pos=0;if(pos>maxOffset)pos=maxOffset;this.Data.XOffset=pos;return true;};this.GotoLastPage=function(){var chart=this.ChartPaint[0];if(!chart)return;//显示最后一屏
12010
12010
  var pageSize=chart.GetPageSize(true);var offset=this.Data.Data.length-pageSize;if(offset<0)offset=0;this.Data.DataOffset=offset;};this.SetColumn=function(aryColunm,option){var chart=this.ChartPaint[0];if(!chart)return;chart.SetColumn(aryColunm);chart.SizeChange=true;if(option&&option.Redraw)this.Draw();};this.SetTab=function(aryTab,option){var chart=this.ChartPaint[0];;if(!chart)return;var chartTab=chart.Tab;if(!chartTab)return;chartTab.SetTabList(aryTab);if(option&&option.Redraw)this.Draw();};this.SetSelectedTab=function(index,opiton){var chart=this.ChartPaint[0];;if(!chart)return;var chartTab=chart.Tab;if(!chartTab)return;chartTab.SelectedTabIndex=index;};this.ReloadResource=function(option){this.Frame.ReloadResource(option);for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.ReloadResource)item.ReloadResource(option);}if(option&&option.Redraw){this.SetSizeChange(true);this.Draw();}};//点表头
12011
- this.OnClickHeader=function(clickData,e){var _this52=this;var header=clickData.Header;if(header.Column&&(header.Column.Sort==1||header.Column.Sort==2)){var index=header.Index;var sortInfo={Field:this.SortInfo.Field,Sort:this.SortInfo.Sort};var arySortType=header.Column.SortType;if(sortInfo.Field!=index){sortInfo.Field=index;sortInfo.Sort=arySortType[0];}else{if(arySortType.length==1){sortInfo.Sort=arySortType[0];}else{for(var i=0;i<arySortType.length;++i){if(sortInfo.Sort==arySortType[i]){sortInfo.Sort=arySortType[(i+1)%arySortType.length];break;}}}}if(header.Column.Sort==1||header.Column.Sort==2){if(sortInfo.Sort==0){this.Data.Data=[];for(var i=0;i<this.SourceData.Data.length;++i){this.Data.Data.push(this.SourceData.Data[i]);}}else{if(header.Column.Sort==1)//本地排序
12012
- {var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column:header.Column,SortInfo:sortInfo,SymbolList:this.Data.Data,Result:null};event.Callback(event,sendData,this);if(Array.isArray(sendData.Result))this.Data.Data=sendData.Result;}else{this.Data.Data.sort(function(left,right){return _this52.LocalSort(left,right,header.Column,sortInfo.Sort);});}}else if(header.Column.Sort==2)//远程排序
12011
+ this.OnClickHeader=function(clickData,e){var _this54=this;var header=clickData.Header;if(header.Column&&(header.Column.Sort==1||header.Column.Sort==2)){var index=header.Index;var sortInfo={Field:this.SortInfo.Field,Sort:this.SortInfo.Sort};var arySortType=header.Column.SortType;if(sortInfo.Field!=index){sortInfo.Field=index;sortInfo.Sort=arySortType[0];}else{if(arySortType.length==1){sortInfo.Sort=arySortType[0];}else{for(var i=0;i<arySortType.length;++i){if(sortInfo.Sort==arySortType[i]){sortInfo.Sort=arySortType[(i+1)%arySortType.length];break;}}}}if(header.Column.Sort==1||header.Column.Sort==2){if(sortInfo.Sort==0){this.Data.Data=[];for(var i=0;i<this.SourceData.Data.length;++i){this.Data.Data.push(this.SourceData.Data[i]);}}else{if(header.Column.Sort==1)//本地排序
12012
+ {var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column:header.Column,SortInfo:sortInfo,SymbolList:this.Data.Data,Result:null};event.Callback(event,sendData,this);if(Array.isArray(sendData.Result))this.Data.Data=sendData.Result;}else{this.Data.Data.sort(function(left,right){return _this54.LocalSort(left,right,header.Column,sortInfo.Sort);});}}else if(header.Column.Sort==2)//远程排序
12013
12013
  {if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;this.SortInfo.Field=sortInfo.Field;this.SortInfo.Sort=sortInfo.Sort;this.Data.YOffset=0;this.ResetReportSelectStatus();this.RequestStockSortData(header.Column,sortInfo.Field,sortInfo.Sort);//远程排序
12014
12014
  return;}}this.Data.YOffset=0;this.ResetReportSelectStatus();this.SortInfo.Field=sortInfo.Field;this.SortInfo.Sort=sortInfo.Sort;this.Draw();this.DelayUpdateStockData();}}};//点击标签
12015
12015
  this.OnClickTab=function(tabData,e){if(!tabData.Tab)return;var redraw=false;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var uiElement={Left:this.UIElement.getBoundingClientRect().left,Top:this.UIElement.getBoundingClientRect().top};if(tabData.Tab.IsMenu){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_REPORT_TABMENU);if(event&&event.Callback){redraw=true;var rtItem=tabData.Rect;var rtDOM={Left:rtItem.Left/pixelTatio,Right:rtItem.Right/pixelTatio,Top:rtItem.Top/pixelTatio,Bottom:rtItem.Bottom/pixelTatio};var sendData={Data:tabData,IsSide:{X:x,Y:x},UIElement:uiElement,Rect:rtDOM,e:e,Redraw:redraw};event.Callback(event,sendData,this);if(IFrameSplitOperator.IsBool(sendData.Redraw))redraw=sendData.Redraw;}this.SetSelectedTab(tabData.Index);//选中tab
@@ -12256,11 +12256,11 @@ this.MapSymbol.clear();this.Data.Data=[];this.Data.XOffset=0;this.Data.YOffset=0
12256
12256
  }
12257
12257
  this.ChartPaint[0].SelectedRow=0;
12258
12258
  */};//创建
12259
- this.Create=function(option){var _this53=this;this.UIElement.JSChartContainer=this;//创建框架
12259
+ this.Create=function(option){var _this55=this;this.UIElement.JSChartContainer=this;//创建框架
12260
12260
  this.Frame=new JSKeyboardFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=30;this.Frame.ChartBorder.Left=5;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;//创建表格
12261
- var chart=new ChartSymbolList();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.UIElement=this.UIElement;chart.GetEventCallback=function(id){return _this53.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this53.GetStockData(symbol);};chart.Data=this.Data;this.ChartPaint[0]=chart;if(option){}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this53.OnKeyDown(e);},true);//键盘消息
12262
- if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this53.OnWheel(e);},true);//上下滚动消息
12263
- this.UIElement.ondblclick=function(e){_this53.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this53.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this53.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this53.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this53.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this53.UIOnMouseleave(e);};};this.Draw=function(){if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
12261
+ var chart=new ChartSymbolList();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.UIElement=this.UIElement;chart.GetEventCallback=function(id){return _this55.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this55.GetStockData(symbol);};chart.Data=this.Data;this.ChartPaint[0]=chart;if(option){}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this55.OnKeyDown(e);},true);//键盘消息
12262
+ if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this55.OnWheel(e);},true);//上下滚动消息
12263
+ this.UIElement.ondblclick=function(e){_this55.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this55.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this55.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this55.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this55.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this55.UIOnMouseleave(e);};};this.Draw=function(){if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
12264
12264
  this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
12265
12265
  this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
12266
12266
  for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.IsDrawFirst)item.Draw();}for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.IsDrawFirst)item.Draw();}};this.GetStockData=function(symbol){if(!this.MapSymbol.has(symbol))return null;return this.MapSymbol.get(symbol);};this.ResetStatus=function(){this.Data.XOffset=0;this.Data.YOffset=0;};this.ResetSelectStatus=function(){var chart=this.GetReportChart();if(chart){chart.SelectedRow=-1;chart.SelectedFixedRow=-1;}};//设置事件回调
@@ -12277,9 +12277,9 @@ var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();}brea
12277
12277
  if(this.MoveXOffset(-1))this.Draw();break;case 39://right
12278
12278
  if(this.MoveXOffset(1))this.Draw();break;case 13://Enter
12279
12279
  this.OnSelectedSymbol();break;}//不让滚动条滚动
12280
- if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.OnSelectedSymbol=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return false;var chart=this.ChartPaint[0];if(!chart)return false;var data=chart.GetSelectedSymbol();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SELECTED);if(event&&event.Callback){event.Callback(event,{Data:data},this);}};this.UIOnDblClick=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart){if(chart.OnDblClick(x,y,e))this.OnSelectedSymbol();}};this.UIOnMouseDown=function(e){var _this54=this;this.DragXScroll=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart){var clickData=chart.OnMouseDown(x,y,e);if(!clickData)return;//if (e.button!=0) return;
12280
+ if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.OnSelectedSymbol=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return false;var chart=this.ChartPaint[0];if(!chart)return false;var data=chart.GetSelectedSymbol();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SELECTED);if(event&&event.Callback){event.Callback(event,{Data:data},this);}};this.UIOnDblClick=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart){if(chart.OnDblClick(x,y,e))this.OnSelectedSymbol();}};this.UIOnMouseDown=function(e){var _this56=this;this.DragXScroll=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart){var clickData=chart.OnMouseDown(x,y,e);if(!clickData)return;//if (e.button!=0) return;
12281
12281
  if(clickData.Type==2&&(e.button==0||e.button==2))//点击行
12282
- {if(clickData.Redraw==true)this.Draw();}}document.onmousemove=function(e){_this54.DocOnMouseMove(e);};document.onmouseup=function(e){_this54.DocOnMouseUp(e);};};//去掉右键菜单
12282
+ {if(clickData.Redraw==true)this.Draw();}}document.onmousemove=function(e){_this56.DocOnMouseMove(e);};document.onmouseup=function(e){_this56.DocOnMouseUp(e);};};//去掉右键菜单
12283
12283
  this.UIOnContextMenu=function(e){e.preventDefault();};this.UIOnMouseMove=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;};this.UIOnMounseOut=function(e){};this.UIOnMouseleave=function(e){};this.DocOnMouseMove=function(e){this.DragMove.PreMove.X=this.DragMove.Move.X;this.DragMove.PreMove.Y=this.DragMove.Move.Y;this.DragMove.Move.X=e.clientX;this.DragMove.Move.Y=e.clientX;//if (this.DragMove.Move.X!=this.DragMove.PreMove.X || this.DragMove.Move.Y!=this.DragMove.PreMove.Y)
12284
12284
  // this.StopAutoDragScrollTimer();
12285
12285
  if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;//JSConsole.Chart.Log(`[JSReportChartContainer::DocOnMouseMove] x=${x}, y=${y}`);
@@ -12392,12 +12392,12 @@ this.HQChart=null;this.ChartDestory=function()//销毁
12392
12392
  //{event:事件id, callback:回调函数}
12393
12393
  this.AddEventCallback=function(object){if(!object||!object.event||!object.callback)return;var data={Callback:object.callback,Source:object};this.mapEvent.set(object.event,data);};this.RemoveEventCallback=function(eventid){if(!this.mapEvent.has(eventid))return;this.mapEvent.delete(eventid);};this.GetEventCallback=function(id)//获取事件回调
12394
12394
  {if(!this.mapEvent.has(id))return null;var item=this.mapEvent.get(id);return item;};//创建
12395
- this.Create=function(option){var _this55=this;this.UIElement.JSChartContainer=this;//创建等待提示
12395
+ this.Create=function(option){var _this57=this;this.UIElement.JSChartContainer=this;//创建等待提示
12396
12396
  this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
12397
12397
  this.Frame=new JSScrollBarFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=30;this.Frame.ChartBorder.Left=5;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.ChartSplashPaint.Frame=this.Frame;//背景
12398
- var chart=new ScrollBarBGChart();chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this55.GetEventCallback(id);};this.ChartPaint.push(chart);//创建滑块
12399
- var chart=new SliderChart();chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.OffsetData=this.XOffsetData;chart.GetEventCallback=function(id){return _this55.GetEventCallback(id);};this.SliderChart=chart;this.ChartPaint.push(chart);//this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
12400
- this.UIElement.onmousedown=function(e){_this55.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this55.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this55.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this55.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this55.UIOnMouseleave(e);};//手机拖拽
12398
+ var chart=new ScrollBarBGChart();chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this57.GetEventCallback(id);};this.ChartPaint.push(chart);//创建滑块
12399
+ var chart=new SliderChart();chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.OffsetData=this.XOffsetData;chart.GetEventCallback=function(id){return _this57.GetEventCallback(id);};this.SliderChart=chart;this.ChartPaint.push(chart);//this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
12400
+ this.UIElement.onmousedown=function(e){_this57.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this57.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this57.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this57.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this57.UIOnMouseleave(e);};//手机拖拽
12401
12401
  //this.UIElement.ontouchstart=(e)=> { this.OnTouchStart(e); }
12402
12402
  //this.UIElement.ontouchmove=(e)=> {this.OnTouchMove(e); }
12403
12403
  //this.UIElement.ontouchend=(e)=> {this.OnTouchEnd(e); }
@@ -12405,13 +12405,13 @@ this.UIElement.onmousedown=function(e){_this55.UIOnMouseDown(e);};this.UIElement
12405
12405
  this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
12406
12406
  if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
12407
12407
  for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.IsDrawFirst)item.Draw();}for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.IsDrawFirst)item.Draw();}};this.OnSize=function(){if(!this.Frame)return;this.SetSizeChange(true);this.Draw();};this.SetSizeChange=function(bChanged){for(var i=0;i<this.ChartPaint.length;++i){var chart=this.ChartPaint[i];if(chart)chart.SizeChange=bChanged;}};this.UpdateFrameMaxMin=function(){var max=null,min=null;for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.GetMaxMin)continue;var range=item.GetMaxMin();if(range==null||range.Max==null||range.Min==null)continue;if(max==null||max<range.Max)max=range.Max;if(min==null||min>range.Min)min=range.Min;}if(IFrameSplitOperator.IsNumber(max)&&IFrameSplitOperator.IsNumber(min)){this.Frame.HorizontalMax=max;this.Frame.HorizontalMin=min;}};//未启动
12408
- this.UIOnDblClick=function(e){};this.CancelDragTimer=function(){if(this.DragTimer){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.UIOnMouseDown=function(e){var _this56=this;this.CancelDragTimer();this.DragSlider=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.SliderChart){var clickData=this.SliderChart.PtInChart(x,y);if(!clickData)return;this.DragSlider={Click:{X:e.clientX,Y:e.clientY},LastMove:{X:e.clientX,Y:e.clientY},Data:clickData};this.DragSlider.DrawCount=0;//重绘次数
12409
- }document.onmousemove=function(e){_this56.DocOnMouseMove(e);};document.onmouseup=function(e){_this56.DocOnMouseUp(e);};};//去掉右键菜单
12408
+ this.UIOnDblClick=function(e){};this.CancelDragTimer=function(){if(this.DragTimer){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.UIOnMouseDown=function(e){var _this58=this;this.CancelDragTimer();this.DragSlider=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.SliderChart){var clickData=this.SliderChart.PtInChart(x,y);if(!clickData)return;this.DragSlider={Click:{X:e.clientX,Y:e.clientY},LastMove:{X:e.clientX,Y:e.clientY},Data:clickData};this.DragSlider.DrawCount=0;//重绘次数
12409
+ }document.onmousemove=function(e){_this58.DocOnMouseMove(e);};document.onmouseup=function(e){_this58.DocOnMouseUp(e);};};//去掉右键菜单
12410
12410
  this.UIOnContextMenu=function(e){e.preventDefault();};this.UIOnMouseMove=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.DragSlider)return;var mouseStatus=mouseStatus={Cursor:"default"};;//鼠标状态
12411
- var item=this.SliderChart.PtInChart(x,y);if(item){switch(item.Data.Type){case 0:mouseStatus={Cursor:"move",Name:"SliderChart"};break;case 1:case 2:mouseStatus={Cursor:"ew-resize",Name:"SliderChart"};break;}}if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;};this.UIOnMounseOut=function(e){};this.UIOnMouseleave=function(e){};this.DocOnMouseMove=function(e){var _this57=this;this.DragMove.PreMove.X=this.DragMove.Move.X;this.DragMove.PreMove.Y=this.DragMove.Move.Y;this.DragMove.Move.X=e.clientX;this.DragMove.Move.Y=e.clientX;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;JSConsole.Chart.Log('[JSScrollBarChartContainer::DocOnMouseMove] x='+x+', y='+y);if(this.DragSlider){var drag=this.DragSlider;var moveSetp=(e.clientX-drag.LastMove.X)*pixelTatio;if(Math.abs(moveSetp)<1)return;var pageRange=this.GetPageRange();var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();this.SliderChart.DragMode=true;var type=drag.Data.Data.Type;var xStart=this.SliderChart.XStart+moveSetp;var xEnd=this.SliderChart.XEnd+moveSetp;if(type==0)//整体移动
12411
+ var item=this.SliderChart.PtInChart(x,y);if(item){switch(item.Data.Type){case 0:mouseStatus={Cursor:"move",Name:"SliderChart"};break;case 1:case 2:mouseStatus={Cursor:"ew-resize",Name:"SliderChart"};break;}}if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;};this.UIOnMounseOut=function(e){};this.UIOnMouseleave=function(e){};this.DocOnMouseMove=function(e){var _this59=this;this.DragMove.PreMove.X=this.DragMove.Move.X;this.DragMove.PreMove.Y=this.DragMove.Move.Y;this.DragMove.Move.X=e.clientX;this.DragMove.Move.Y=e.clientX;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;JSConsole.Chart.Log('[JSScrollBarChartContainer::DocOnMouseMove] x='+x+', y='+y);if(this.DragSlider){var drag=this.DragSlider;var moveSetp=(e.clientX-drag.LastMove.X)*pixelTatio;if(Math.abs(moveSetp)<1)return;var pageRange=this.GetPageRange();var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();this.SliderChart.DragMode=true;var type=drag.Data.Data.Type;var xStart=this.SliderChart.XStart+moveSetp;var xEnd=this.SliderChart.XEnd+moveSetp;if(type==0)//整体移动
12412
12412
  {if(xStart<left)//第1页
12413
12413
  {xStart=pageRange.First.XStart;xEnd=pageRange.First.XEnd;}else if(xEnd>=right){xStart=pageRange.Last.XStart;xEnd=pageRange.Last.XEnd;}this.SliderChart.XStart=xStart;this.SliderChart.XEnd=xEnd;}else if(type==1)//左移动
12414
- {if(xStart<=left){xStart=pageRange.First.XStart;}this.SliderChart.XStart=xStart;}else if(type==2){if(xEnd>=right){xEnd=pageRange.Last.XEnd;}this.SliderChart.XEnd=xEnd;}drag.UpdateData={XStart:xStart,XEnd:xEnd,Type:type};drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;if(drag.DrawCount==0){this.DragUpdate(drag);}else{this.DragTimer=setTimeout(function(){_this57.DragUpdate(_this57.DragSlider);},this.DelayDragFrequency);}}};this.DocOnMouseUp=function(e){//清空事件
12414
+ {if(xStart<=left){xStart=pageRange.First.XStart;}this.SliderChart.XStart=xStart;}else if(type==2){if(xEnd>=right){xEnd=pageRange.Last.XEnd;}this.SliderChart.XEnd=xEnd;}drag.UpdateData={XStart:xStart,XEnd:xEnd,Type:type};drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;if(drag.DrawCount==0){this.DragUpdate(drag);}else{this.DragTimer=setTimeout(function(){_this59.DragUpdate(_this59.DragSlider);},this.DelayDragFrequency);}}};this.DocOnMouseUp=function(e){//清空事件
12415
12415
  document.onmousemove=null;document.onmouseup=null;this.CancelDragTimer();var dragSlider=this.DragSlider;this.DragMove=null;this.DragSlider=null;this.SliderChart.DragMode=false;this.DragUpdate(dragSlider);};this.DragUpdate=function(dragData){if(!dragData||!dragData.UpdateData)return;this.UpdateXDataOffset(dragData.UpdateData);this.Draw();++dragData.DrawCount;};this.Reset=function(option){this.SourceData=null;this.XOffsetData.Start=-1;this.XOffsetData.End=-1;this.XOffsetData.Count=0;this.Frame.Data=null;for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];item.Data=null;}if(this.ChartSplashPaint)this.ChartSplashPaint.IsEnableSplash=true;if(option.Draw)this.Draw();};//外部更新滑块 obj={ Start: , End: }
12416
12416
  this.UpdateSlider=function(obj){if(this.SliderChart.DragMode)return;var bSizeChange=false;if((this.AutoMargin.Left||this.AutoMargin.Right)&&obj.Border){if(this.AutoMargin.Left){if(this.Frame.ChartBorder.Left!=obj.Border.Left)bSizeChange=true;}if(this.AutoMargin.Right){if(this.Frame.ChartBorder.Right!=obj.Border.Right)bSizeChange=true;}}var data=obj.Data;if(this.XOffsetData.Start==obj.Start&&this.XOffsetData.End==obj.End&&this.SourceData==data&&!bSizeChange)return;this.SourceData=data;var count=data.Data.length;if(IFrameSplitOperator.IsNumber(obj.RightSpaceCount))count+=obj.RightSpaceCount;this.Frame.XPointCount=count;this.Frame.Data=data;this.XOffsetData.Count=count;this.XOffsetData.Start=obj.Start;this.XOffsetData.End=obj.End;for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];item.Data=data;}if(this.AutoMargin.Left&&obj.Border){if(IFrameSplitOperator.IsNumber(obj.Border.Left))this.Frame.ChartBorder.Left=obj.Border.Left;}if(this.AutoMargin.Right&&obj.Border){if(IFrameSplitOperator.IsNumber(obj.Border.Right))this.Frame.ChartBorder.Right=obj.Border.Right;}this.UpdateFrameMaxMin();if(this.ChartSplashPaint)this.ChartSplashPaint.IsEnableSplash=false;if(obj.Draw)this.Draw();};//移动滑块
12417
12417
  this.UpdateXDataOffset=function(obj){if(obj.Type==0){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start);var moveSetp=start-this.XOffsetData.Start;this.XOffsetData.Start=start;this.XOffsetData.End+=moveSetp;}else if(obj.Type==1){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start);this.XOffsetData.Start=start;}else if(obj.Type==2){var end=this.Frame.GetXData(obj.XEnd);end=parseInt(end);this.XOffsetData.End=end;}var endItem=this.SourceData.Data[this.XOffsetData.End];var startItem=this.SourceData.Data[this.XOffsetData.Start];var sendData={Type:obj.Type,Count:this.XOffsetData.Count};if(this.XOffsetData.End>this.XOffsetData.Start){sendData.Start={Index:this.XOffsetData.Start,Item:startItem};sendData.End={Index:this.XOffsetData.End,Item:endItem};}else{sendData.Start={Index:this.XOffsetData.End,Item:endItem};sendData.End={Index:this.XOffsetData.Start,Item:startItem};}if(this.HQChart&&this.HQChart.JSChartContainer){var internalChart=this.HQChart.JSChartContainer;if(internalChart.ChartOperator){var obj={ID:JSCHART_OPERATOR_ID.OP_SCROOLBAR_SLIDER_CHANGED,Start:sendData.Start,End:sendData.End,Type:sendData.Type};internalChart.ChartOperator(obj);}}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SCROLLBAR_SLIDER_CHANGED);if(event){event.Callback(event,sendData,this);}};this.ReloadResource=function(option){this.Frame.ReloadResource(option);for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.ReloadResource)item.ReloadResource(option);}if(option&&option.Redraw){this.SetSizeChange(true);this.Draw();}};this.GetPageRange=function(){var result={};var showCount=Math.abs(this.XOffsetData.Start-this.XOffsetData.End);result.ShowCount=showCount;//第1页
@@ -12466,7 +12466,7 @@ this.AreaColor=g_JSChartResource.ScrollBar.BGChart.AreaColor;//面积图颜色
12466
12466
  };this.Draw=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;this.Canvas.save();if(this.LineWidth>0)this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();var bottom=this.ChartBorder.GetBottom();this.Canvas.strokeStyle=this.Color;var bFirstPoint=true;var drawCount=0,x,y;var firstPoint={};for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var value=item.Close;if(!IFrameSplitOperator.IsNumber(value))continue;x=this.ChartFrame.GetXFromIndex(i);y=this.ChartFrame.GetYFromData(value);if(bFirstPoint){this.Canvas.beginPath();this.Canvas.moveTo(x,y);bFirstPoint=false;firstPoint={X:x,Y:y};}else{this.Canvas.lineTo(x,y);}++drawCount;}if(drawCount>0){this.Canvas.stroke();this.Canvas.lineTo(x,bottom);this.Canvas.lineTo(firstPoint.X,bottom);this.Canvas.closePath();this.Canvas.fillStyle=this.AreaColor;this.Canvas.fill();}this.Canvas.restore();};this.GetMaxMin=function(){var range={Max:null,Min:null};if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return range;for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var value=item.Close;if(!IFrameSplitOperator.IsNumber(value))continue;if(range.Max==null||range.Max<value)range.Max=value;if(range.Min==null||range.Min>value)range.Min=value;}return range;};}/********************************************************************************
12467
12467
  * 版本信息输出
12468
12468
  *
12469
- */var HQCHART_VERSION="1.1.12419";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
12469
+ */var HQCHART_VERSION="1.1.12428";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
12470
12470
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
12471
12471
  // BaseIndex:BaseIndex,
12472
12472
  // ChartLine:ChartLine,