hqchart 1.1.14372 → 1.1.14375
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.
- package/lib/umychart.vue.js +211 -211
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +8 -0
- package/src/jscommon/umychart.DialogSearchIndex.js +12 -1
- package/src/jscommon/umychart.DialogSelectRect.js +6 -0
- package/src/jscommon/umychart.DialogTooltip.js +4 -0
- package/src/jscommon/umychart.js +24 -1
- package/src/jscommon/umychart.popMenu.js +14 -1
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +25 -2
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +69 -4
package/lib/umychart.vue.js
CHANGED
|
@@ -1603,7 +1603,7 @@ CMD_REPORT_COLUMN_FILTER_ID:104,//报价列表 筛选
|
|
|
1603
1603
|
CMD_REPORT_CHANGE_COLUMN_ID:105//报价列表 切换列 Arg[Column, ]
|
|
1604
1604
|
};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=[];}};}/*
|
|
1605
1605
|
图形控件
|
|
1606
|
-
*/function JSChartContainer(uielement,OffscreenElement,cacheElement){var
|
|
1606
|
+
*/function JSChartContainer(uielement,OffscreenElement,cacheElement){var _this6=this;this.ClassName='JSChartContainer';var _self=this;this.Frame;//框架画法
|
|
1607
1607
|
this.ChartPaint=new Array();//图形画法
|
|
1608
1608
|
this.ChartPaintEx=[];//图形扩展画法
|
|
1609
1609
|
this.ChartInfo=new Array();//K线|走势图上信息地雷
|
|
@@ -1691,12 +1691,13 @@ this.DialogSelectRect;//区间统计
|
|
|
1691
1691
|
this.FloatTooltip;//浮动tooltip信息
|
|
1692
1692
|
this.DialogSearchIndex;//指标搜索
|
|
1693
1693
|
this.DialogModifyIndexParam;//指标参数修改
|
|
1694
|
-
this.
|
|
1694
|
+
this.RestoreFocusTimer=null;//恢复焦点定时器
|
|
1695
|
+
this.RestoreFocus=function(delay){var _this4=this;var value=1000;if(IFrameSplitOperator.IsNumber(delay))value=delay;this.ClearRestoreFocusTimer();this.RestoreFocusTimer=setTimeout(function(){_this4.SetFocus();},value);};this.ClearRestoreFocusTimer=function(){if(this.RestoreFocusTimer){clearTimeout(this.RestoreFocusTimer);this.RestoreFocusTimer=null;}};this.GetVolUnit=function()//成交量单位
|
|
1695
1696
|
{var upperSymbol=this.Symbol?this.Symbol.toUpperCase():null;var unit=MARKET_SUFFIX_NAME.GetVolUnit(upperSymbol);return unit;};this.ClearStockCache=function(){this.StockCache.Data=null;};this.InitalPopMenu=function()//初始化弹出窗口
|
|
1696
1697
|
{if(this.JSPopMenu)return;this.JSPopMenu=new JSPopMenu();//内置菜单
|
|
1697
|
-
this.JSPopMenu.Inital();};this.InitalDrawToolDialog=function(){if(this.DialogDrawTool)return;this.DialogDrawTool=new JSDialogDrawTool();this.DialogDrawTool.Inital(this);this.DialogDrawTool.Create();};this.InitalTooltipDialog=function(option){if(this.DialogTooltip)return;this.DialogTooltip=new JSDialogTooltip();this.DialogTooltip.Inital(this,option);this.DialogTooltip.Create();};this.InitalFloatTooltip=function(option){if(this.FloatTooltip)return;this.FloatTooltip=new JSFloatTooltip();this.FloatTooltip.Inital(this,option);this.FloatTooltip.Create();};this.InitalModifyDrawDialog=function(){if(this.DialogModifyDraw)return;this.DialogModifyDraw=new JSDialogModifyDraw();this.DialogModifyDraw.Inital(this);this.DialogModifyDraw.Create();};this.InitalSelectRectDialog=function(option){if(this.DialogSelectRect)return;this.DialogSelectRect=new JSDialogSelectRect();this.DialogSelectRect.Inital(this,option);this.DialogSelectRect.Create();};this.InitalSearchIndexDialog=function(option){if(this.DialogSearchIndex)return;this.DialogSearchIndex=new JSDialogSearchIndex();this.DialogSearchIndex.Inital(this,option);this.DialogSearchIndex.Create();};this.InitalModifyIndexParamDialog=function(option){if(this.DialogModifyIndexParam)return;this.DialogModifyIndexParam=new JSDialogModifyIndexParam();this.DialogModifyIndexParam.Inital(this,option);this.DialogModifyIndexParam.Create();};this.ShowChangeIndexDialog=function(data){if(!data)return;if(!this.DialogSearchIndex)return;data.Title='\u5207\u6362\u6307\u6807 [\u7A97\u53E3'+(data.WindowIndex+1)+']';this.DialogSearchIndex.SetOpData(data);this.DialogSearchIndex.Show();};this.ShowAddOverlayIndexDialog=function(data){if(!data)return;if(!this.DialogSearchIndex)return;data.Title='\u6DFB\u52A0\u53E0\u52A0\u6307\u6807 [\u7A97\u53E3'+(data.WindowIndex+1)+']';this.DialogSearchIndex.SetOpData(data);this.DialogSearchIndex.Show();};//添加指标窗口
|
|
1698
|
+
this.JSPopMenu.Inital(this);};this.InitalDrawToolDialog=function(){if(this.DialogDrawTool)return;this.DialogDrawTool=new JSDialogDrawTool();this.DialogDrawTool.Inital(this);this.DialogDrawTool.Create();};this.InitalTooltipDialog=function(option){if(this.DialogTooltip)return;this.DialogTooltip=new JSDialogTooltip();this.DialogTooltip.Inital(this,option);this.DialogTooltip.Create();};this.InitalFloatTooltip=function(option){if(this.FloatTooltip)return;this.FloatTooltip=new JSFloatTooltip();this.FloatTooltip.Inital(this,option);this.FloatTooltip.Create();};this.InitalModifyDrawDialog=function(){if(this.DialogModifyDraw)return;this.DialogModifyDraw=new JSDialogModifyDraw();this.DialogModifyDraw.Inital(this);this.DialogModifyDraw.Create();};this.InitalSelectRectDialog=function(option){if(this.DialogSelectRect)return;this.DialogSelectRect=new JSDialogSelectRect();this.DialogSelectRect.Inital(this,option);this.DialogSelectRect.Create();};this.InitalSearchIndexDialog=function(option){if(this.DialogSearchIndex)return;this.DialogSearchIndex=new JSDialogSearchIndex();this.DialogSearchIndex.Inital(this,option);this.DialogSearchIndex.Create();};this.InitalModifyIndexParamDialog=function(option){if(this.DialogModifyIndexParam)return;this.DialogModifyIndexParam=new JSDialogModifyIndexParam();this.DialogModifyIndexParam.Inital(this,option);this.DialogModifyIndexParam.Create();};this.ShowChangeIndexDialog=function(data){if(!data)return;if(!this.DialogSearchIndex)return;data.Title='\u5207\u6362\u6307\u6807 [\u7A97\u53E3'+(data.WindowIndex+1)+']';this.DialogSearchIndex.SetOpData(data);this.DialogSearchIndex.Show();};this.ShowAddOverlayIndexDialog=function(data){if(!data)return;if(!this.DialogSearchIndex)return;data.Title='\u6DFB\u52A0\u53E0\u52A0\u6307\u6807 [\u7A97\u53E3'+(data.WindowIndex+1)+']';this.DialogSearchIndex.SetOpData(data);this.DialogSearchIndex.Show();};//添加指标窗口
|
|
1698
1699
|
this.ShowAddIndexWindowDialog=function(option){if(!this.DialogSearchIndex)return;var data=option;if(!data)data={};data.OpType=3;data.Title='\u589E\u52A0\u6307\u6807\u7A97\u53E3';this.DialogSearchIndex.SetOpData(data);this.DialogSearchIndex.Show();};this.ShowModifyIndexParamDialog=function(data){if(!this.DialogModifyIndexParam)return;if(data.Type==1){var indexScript=this.WindowIndex[data.WindowIndex];if(!indexScript)return;data.IndexScript=indexScript;data.Title='['+indexScript.Name+']\u53C2\u6570\u4FEE\u6539 \u7A97\u53E3['+(data.WindowIndex+1)+']';}else if(data.Type==2){var overlayIndex=this.GetOverlayIndexByIdentify(data.Identify);if(!overlayIndex||!overlayIndex.OverlayItem.Script)return;var indexScript=overlayIndex.OverlayItem.Script;data.IndexScript=indexScript;data.Title='['+indexScript.Name+']\u53C2\u6570\u4FEE\u6539 \u53E0\u52A0\u7A97\u53E3['+(data.WindowIndex+1)+']';}this.DialogModifyIndexParam.SetIndexData(data);this.DialogModifyIndexParam.Show();};this.DrawSelectRectDialog=function(){};this.IsShowSelectRectDialog=function(){if(!this.DialogSelectRect)return false;return this.DialogSelectRect.IsShow();};this.ShowDrawToolDialog=function(x,y){if(!this.DialogDrawTool)return;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();var top=this.UIElement.offsetTop+15;var left=this.UIElement.offsetWidth-this.DialogDrawTool.DivDialog.offsetWidth-15;left+=rtClient.left+rtScroll.Left;top+=rtClient.top+rtScroll.Top;this.DialogDrawTool.Show(left,top);};this.IsShowDrawToolDialog=function(){if(!this.DialogDrawTool)return false;return this.DialogDrawTool.IsShow();};this.ShowModifyDrawDialog=function(chart,x,y){if(!this.DialogModifyDraw)return;this.DialogModifyDraw.SetChartPicture(chart);if(this.DialogModifyDraw.IsShow())return;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();var top=this.UIElement.offsetTop+15;var left=(this.UIElement.offsetWidth-this.DialogModifyDraw.DivDialog.offsetWidth)/2;left+=rtClient.left+rtScroll.Left;top+=rtClient.top+rtScroll.Top;this.DialogModifyDraw.Show(left,top);};this.CloseModifyDrawDialog=function(){if(!this.DialogModifyDraw)return;this.DialogModifyDraw.Close();};this.IsShowTooltipDialog=function(){if(!this.DialogTooltip)return false;return this.DialogTooltip.IsShow();};this.CloseTooltipDialog=function(){if(!this.DialogTooltip)return;this.DialogTooltip.Close();};this.HideFloatTooltip=function(){if(!this.FloatTooltip)return;this.FloatTooltip.Hide();};this.DestroyTooltipDialog=function(){if(!this.DialogTooltip)return;this.DialogTooltip.Destroy();this.DialogTooltip=null;};this.DestroyFloatTooltip=function(){if(!this.FloatTooltip)return;this.FloatTooltip.Destroy();this.FloatTooltip=null;};this.DestroySearchIndexDialog=function(){if(!this.DialogSearchIndex)return;this.DialogSearchIndex.Destroy();this.DialogSearchIndex=null;};//obj={ Element:, Canvas: }
|
|
1699
|
-
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
|
|
1700
|
+
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 _this5=this;this.StopDisplayLatest();if(!this.DisplayLatestOption.Enable)return;this.DisplayLatestOption.Timer=setTimeout(function(){if(_this5.DisplayLatest){JSConsole.Chart.Log('[JSChartContainer:StartStopDisplayLatest] call this.DisplayLatest()');_this5.DisplayLatest();}},this.DisplayLatestOption.DelayTime);};this.StopDrawDynamicInfo=function(){if(this.DrawDynamicInfoOption.Timer){clearTimeout(this.DrawDynamicInfoOption.Timer);this.DrawDynamicInfoOption.Timer=null;}};this.ChartDestroy=function()//销毁
|
|
1700
1701
|
{this.IsDestroy=true;this.StopAutoUpdate();this.DestroyTooltipDialog();this.DestroyFloatTooltip();this.DestroySearchIndexDialog();};this.ChartDestory=this.ChartDestroy;//老版本写错了,需要兼容下
|
|
1701
1702
|
//设置焦点
|
|
1702
1703
|
this.SetFocus=function(){if(this.UIElement)this.UIElement.focus();};//设置事件回调
|
|
@@ -1704,7 +1705,7 @@ this.SetFocus=function(){if(this.UIElement)this.UIElement.focus();};//设置事
|
|
|
1704
1705
|
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)//获取事件回调
|
|
1705
1706
|
{if(!this.mapEvent.has(id))return null;var item=this.mapEvent.get(id);return item;};//接收指标数据
|
|
1706
1707
|
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);};//鼠标事件绑定
|
|
1707
|
-
uielement.onmousemove=function(e){
|
|
1708
|
+
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);
|
|
1708
1709
|
var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
|
|
1709
1710
|
var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;this.StopDisplayLatest();//加载数据中,禁用鼠标事件
|
|
1710
1711
|
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;
|
|
@@ -1722,7 +1723,7 @@ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MOUSE_MOVE);var titleChart=t
|
|
|
1722
1723
|
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;if(!this.IsShowRightMenu)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);//右键菜单事件
|
|
1723
1724
|
return false;};this.UIOnDblClick=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash)return;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轴上
|
|
1724
1725
|
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)return null;if(dragY.IsOverlay===true){if(!dragY.Right||!this.EnableYDrag.Right)return null;if(this.Frame.IsEnableOverlayDragY(dragY.Index,dragY.OverlayIndex))return dragY;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;};//是否可以上下拖拽
|
|
1725
|
-
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;}var label=this.Frame.PtInHorizontalLabel(x,y);if(label&&this.ClickHorizontalLabel){this.ClickHorizontalLabel(label,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;this.SetCursor(sendData);};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
|
|
1726
|
+
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;}var label=this.Frame.PtInHorizontalLabel(x,y);if(label&&this.ClickHorizontalLabel){this.ClickHorizontalLabel(label,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;this.SetCursor(sendData);};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)){this.IsOnTouch=false;return;}var bDrawDynamicInfo=false;if(this.GlobalOption.SelectedBorder&&this.GlobalOption.SelectedBorder.Mode>=1){var item=this.GlobalOption.SelectedBorder;var frameId=this.Frame.PtInFrame(x,y);if(frameId>=0&&frameId!=item.SelFrame){item.SelFrame=frameId;bDrawDynamicInfo=true;}}var bRedraw=false;if(this.GlobalOption.SelectedXBorder&&this.GlobalOption.SelectedXBorder.Mode>=1){if(this.PtInMulitDayMinute){var item=this.GlobalOption.SelectedXBorder;var selectedDate=this.PtInMulitDayMinute(x,y);if(item.Date!=selectedDate){item.Date=selectedDate;bRedraw=true;}}}if(this.TryClickCrossCursor(x,y,e)){this.IsOnTouch=false;return;}if(this.TryClickChartTooltipData&&this.TryClickChartTooltipData(x,y,e))//预留给外部点击图标什么用的
|
|
1726
1727
|
{this.IsOnTouch=false;return;}if(this.TryClickLock){//JSConsole.Chart.Log('[uielement.onmousedown] left, top ',e.clientX, e.clientY, this.getBoundingClientRect().left,this.getBoundingClientRect().top);
|
|
1727
1728
|
if(this.TryClickLock(x,y))return;}this.HideSelectRect();this.ClearDragSelectRect();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";
|
|
1728
1729
|
this.SetCursor({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";
|
|
@@ -1748,7 +1749,7 @@ var bDraw=false;if(drawPictureActive.Select.Guid&&drawPictureActive.Select.Chart
|
|
|
1748
1749
|
this.SelectChartDrawPicture.DragInfo={Click:{X:e.clientX,Y:e.clientY}};}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_DRAWPICTURE);//选中画图工具事件
|
|
1749
1750
|
if(event&&event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};event.Callback(event,sendData,this);}else{this.OnSelectChartPicture(drawPictrueData.ChartDrawPicture);//选中画图工具事件
|
|
1750
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();}else if(bRedraw){this.Draw();}else if(bDrawDynamicInfo){this.DrawDynamicInfo();}}}if(!this.SelectChartDrawPicture)this.CloseModifyDrawDialog();//当前没有选中画图 隐藏画图修改框
|
|
1751
|
-
document.onmousemove=function(e){
|
|
1752
|
+
document.onmousemove=function(e){_this7.DocOnMouseMove(e);};document.onmouseup=function(e){_this7.DocOnMouseUp(e);};};this.DocOnMouseMove=function(e){//加载数据中,禁用鼠标事件
|
|
1752
1753
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash)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)//边框拖动
|
|
1753
1754
|
{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)//Y轴缩放
|
|
1754
1755
|
{if(moveSetpY<5)return;var yMove=e.clientY-drag.LastMove.Y;//this.UIElement.style.cursor="n-resize";
|
|
@@ -1794,7 +1795,7 @@ this.IsPhonePinching=function(e){var changed=e.changedTouches.length;var touchin
|
|
|
1794
1795
|
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)//是否是单点触屏
|
|
1795
1796
|
{var touchCount=e.touches.length;return touchCount==1;};this.StopDragTimer=function(){if(IFrameSplitOperator.IsNumber(this.DragTimer)){clearTimeout(this.DragTimer);this.DragTimer=null;this.IsPress=false;}};this.GetMoveAngle=function(pt,pt2)//计算角度
|
|
1796
1797
|
{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;};//手机拖拽
|
|
1797
|
-
uielement.ontouchstart=function(e){
|
|
1798
|
+
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.TryPhoneClickButton=function(x,y,e){if(this.TryClickLock||this.TryClickIndexTitle)//指标枷锁区域 , 指标标题点击
|
|
1798
1799
|
{if(this.TryClickLock&&this.TryClickLock(x,y))return true;if(this.TryClickIndexTitle&&this.TryClickIndexTitle(x,y))return true;}if(this.ClickFrameButton){var button=this.Frame.PtInButtons(x,y);if(button){this.ClickFrameButton(button,e);return true;}}button=this.PtInExtendChartButtons(x,y);if(button&&this.ClickExtendChartButton){this.ClickExtendChartButton(button,e);return true;}return false;};this.OnTouchStart=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsPress=false;this.IsOnTouch=true;this.TouchDrawCount=0;this.PhonePinch=null;this.StopDragTimer();var isSingleTouch=this.IsSingleTouch(e);if(this.EnableScrollUpDown==false||!isSingleTouch||//多点触屏
|
|
1799
1800
|
this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID&&this.TouchStatus.CorssCursorShow==true)//十字光标显示,不能滚动页面
|
|
1800
1801
|
{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.TryPhoneClickButton(pt.X,pt.Y,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":{}//最后移动的位置
|
|
@@ -1835,10 +1836,10 @@ for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];item.Canva
|
|
|
1835
1836
|
for(var i=0;i<this.ChartPaintEx.length;++i){var item=this.ChartPaintEx[i];item.Canvas=canvas;}//叠加股票
|
|
1836
1837
|
for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];item.Canvas=canvas;}//扩展画法
|
|
1837
1838
|
for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];item.Canvas=canvas;}};//清空画布
|
|
1838
|
-
this.ClearCanvas=function(canvas){if(!canvas)return;if(!this.UIElement)return;canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);};this.Draw=function(){var
|
|
1839
|
+
this.ClearCanvas=function(canvas){if(!canvas)return;if(!this.UIElement)return;canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);};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();//获取设备的分辨率
|
|
1839
1840
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
1840
1841
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){var data=this.InvokeBeforeDrawSplashScreenCallback();if(data&&data.PreventDefault===true)return;this.Frame.ClearCoordinateText();this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}if(this.CacheCanvas)this.SetCanvas(this.CacheCanvas);//框架
|
|
1841
|
-
if(this.Frame.SetBeforeDrawXYCallback){this.Frame.SetBeforeDrawXYCallback(function(frame){
|
|
1842
|
+
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();}//框架内图形
|
|
1842
1843
|
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);//画叠加指标
|
|
1843
1844
|
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();}//叠加股票
|
|
1844
1845
|
for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];item.Draw();}if(this.Frame.DrawOveraly)this.Frame.DrawOveraly(false);//画叠加指标
|
|
@@ -1888,7 +1889,7 @@ item.Draw(moveonPoint,this.LastMouseStatus);}if(this.SelectChartDrawPicture){thi
|
|
|
1888
1889
|
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;if(this.PtInExtendChartPaintTooltip(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 是否阻止内置的点击处理
|
|
1889
1890
|
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 是否阻止内置的点击处理
|
|
1890
1891
|
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);//删除画图工具
|
|
1891
|
-
}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
|
|
1892
|
+
}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;//鼠标状态
|
|
1892
1893
|
var button=null;//当前鼠标所在按钮
|
|
1893
1894
|
var frameID=this.Frame.PtInFrame(x,y);if(IFrameSplitOperator.IsNumber(frameID)&&frameID>=0)//在K线内部移动,调整K线索引
|
|
1894
1895
|
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.Frame.PtInHorizontalLabel&&this.Frame.PtInHorizontalLabel(x,y)){mouseStatus={Cursor:"pointer",Name:"HorizontalLabel"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame Horizontal Label ");}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;}//区间选择
|
|
@@ -1901,8 +1902,8 @@ else this.SetCursor({Cursor:"move"});//this.UIElement.style.cursor="move";
|
|
|
1901
1902
|
else this.SetCursor({Cursor:"pointer"});//this.UIElement.style.cursor="pointer";
|
|
1902
1903
|
}bDrawPicture=true;}}this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.SetCursor({Cursor:"default"});//this.UIElement.style.cursor="default";
|
|
1903
1904
|
}}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;//鼠标移开,在按钮上,不显示十字光标
|
|
1904
|
-
if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);if(this.DrawDynamicInfoOption.Enable){this.DrawDynamicInfoOption.Timer=setTimeout(function(){
|
|
1905
|
-
this.SetCursor=function(obj){if(!obj||!obj.Cursor)return;if(obj.Cursor=="default")this.UIElement.style.cursor=this.DefaultCursor;else this.UIElement.style.cursor=obj.Cursor;};this.OnKeyDown=function(e){var
|
|
1905
|
+
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);}this.SetCursor(mouseStatus);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();}}};//设置鼠标形状 {Cursor:鼠标形状 }
|
|
1906
|
+
this.SetCursor=function(obj){if(!obj||!obj.Cursor)return;if(obj.Cursor=="default")this.UIElement.style.cursor=this.DefaultCursor;else this.UIElement.style.cursor=obj.Cursor;};this.OnKeyDown=function(e){var _this10=this;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;//回调事件
|
|
1906
1907
|
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);if(event&&event.Callback){var sendData={e:e,PreventDefault:false};event.Callback(event,sendData,this);if(sendData.PreventDefault)return;}var keyID=e.keyCode?e.keyCode:e.which;var draw=false;if(this.ChartCorssCursor&&this.ChartCorssCursor.OnKeyDown)//十字光标 隐藏显示
|
|
1907
1908
|
{var sendData={e:e,KeyID:keyID,Draw:false,PreventDefault:false};this.ChartCorssCursor.OnKeyDown(sendData);draw=sendData.Draw;}switch(keyID){case 37://left
|
|
1908
1909
|
if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}if(this.CursorIndex<=0.99999){if(!this.DataMoveLeft()){//左移数据到头了 触发下载新数据
|
|
@@ -1910,7 +1911,7 @@ if(this.DragDownloadData)this.DragDownloadData();break;}this.UpdataDataoffset();
|
|
|
1910
1911
|
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.ResetFrameXSplit();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");}else{//判断是否在最后一个数据上
|
|
1911
1912
|
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
|
|
1912
1913
|
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.ResetFrameXSplit();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");break;case 40://down
|
|
1913
|
-
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){
|
|
1914
|
+
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.ResetFrameXSplit();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true){}else{this.Draw();}this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");break;case 46://del
|
|
1914
1915
|
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);//删除选中的画图工具
|
|
1915
1916
|
this.CloseModifyDrawDialog();}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
|
|
1916
1917
|
this.OnMarkRectSelect(e);break;case 27://ESCAPE 取消画布工具
|
|
@@ -1934,10 +1935,10 @@ this.Frame.SetFrameBorderSizeChange();this.Frame.ReDrawToolbar();this.Draw();};t
|
|
|
1934
1935
|
{}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)//取消鼠标位置,十字光标就不显示了
|
|
1935
1936
|
{this.LastPoint.Y=null;this.LastPoint.X=null;}else{this.LastPoint.X=pt.X;this.LastPoint.Y=pt.Y;}};this.ShowTooltipByKeyDown=function(){if(!this.KLineTooltipConfig.Enable||!this.KLineTooltipConfig.EnableKeyDown){this.HideFloatTooltip();return;}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 缩放还是使用原始坐标
|
|
1936
1937
|
this.ShowTooltip(this.LastPoint.X/pixelTatio,this.LastPoint.Y/pixelTatio,toolTip);};this.DrawTooltipDialog=function(){};this.DrawFloatTooltip=function(point,toolTip){if(!this.FloatTooltip)return;this.UpdateFloatTooltip(point,toolTip);};this.UpdateFloatTooltip=function(point,toolTip){if(!this.FloatTooltip)return;var sendData={Tooltip:toolTip,Point:point,Symbol:this.Symbol,Name:this.Name,DataType:1};this.FloatTooltip.Update(sendData);};//更新实时行情到浮动tooltip
|
|
1937
|
-
this.UpdateHQFloatTooltip=function(item){};this.ShowTooltip=function(x,y,toolTip){var
|
|
1938
|
+
this.UpdateHQFloatTooltip=function(item){};this.ShowTooltip=function(x,y,toolTip){var _this11=this;if(!this.IsShowTooltip)return;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
1938
1939
|
var xMove=15/pixelTatio;//顶部坐标偏移位置
|
|
1939
1940
|
this.TooltipCache.Type=toolTip.Type;this.TooltipCache.Data=null;this.TooltipCache.X=x;this.TooltipCache.Y=y;var bHideFloatToolip=true;if(toolTip.Type===0)//K线信息
|
|
1940
|
-
{if(!this.KLineTooltipConfig.Enable)return;if(this.FloatTooltip){this.DrawFloatTooltip({X:x,Y:y,YMove:20/pixelTatio},toolTip);bHideFloatToolip=false;return;}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
|
|
1941
|
+
{if(!this.KLineTooltipConfig.Enable)return;if(this.FloatTooltip){this.DrawFloatTooltip({X:x,Y:y,YMove:20/pixelTatio},toolTip);bHideFloatToolip=false;return;}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
|
|
1941
1942
|
if(format.Height>0)textHeight=format.Height;//新版本高度有格式化类计算完成
|
|
1942
1943
|
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}` );
|
|
1943
1944
|
//if (toolTip.ChartPaint.Name=="Overlay-KLine") this.Tooltip.style.height =220+"px";
|
|
@@ -1954,7 +1955,7 @@ this.Tooltip.style.position="absolute";this.Tooltip.style.left=left+"px";this.To
|
|
|
1954
1955
|
this.Tooltip.style.position="absolute";this.Tooltip.style.left=left+"px";this.Tooltip.style.top=top+xMove+"px";this.Tooltip.style.width=width+"px";this.Tooltip.style.height=null;this.Tooltip.innerHTML=format.Text;;this.Tooltip.style.display="block";}else if(toolTip.Type==7)//ChartDrawSVG
|
|
1955
1956
|
{if(this.FloatTooltip){this.DrawFloatTooltip({X:x,Y:y,YMove:20/pixelTatio},toolTip);bHideFloatToolip=false;return;}var left=x;var top=y;var format=g_DivTooltipDataForamt.Create('ChartDrawSVGDataStringFormat');format.Value=toolTip;format.Symbol=this.Symbol;format.Period=this.Period;format.LanguageID=this.LanguageID;if(!format.Operator())return;var width=format.Width;this.Tooltip.className='jchart-chartdrawsvg-tooltip';//ChartDrawSVG指标数据
|
|
1956
1957
|
this.Tooltip.style.position="absolute";this.Tooltip.style.left=left+"px";this.Tooltip.style.top=top+xMove+"px";this.Tooltip.style.width=width+"px";this.Tooltip.style.height=null;this.Tooltip.innerHTML=format.Text;this.Tooltip.style.display="block";}else if(toolTip.Type==8)//ChartDrawSVG 新版本
|
|
1957
|
-
{if(this.FloatTooltip){this.DrawFloatTooltip({X:x,Y:y,YMove:20/pixelTatio},toolTip);bHideFloatToolip=false;return;}}if(bHideFloatToolip)this.HideFloatTooltip();};this.UpdateDOMTooltip=function(toolTipType,data){var
|
|
1958
|
+
{if(this.FloatTooltip){this.DrawFloatTooltip({X:x,Y:y,YMove:20/pixelTatio},toolTip);bHideFloatToolip=false;return;}}if(bHideFloatToolip)this.HideFloatTooltip();};this.UpdateDOMTooltip=function(toolTipType,data){var _this12=this;if(!this.TooltipCache.IsShow)return;if(this.TooltipCache.Type!=toolTipType)return;if(!this.TooltipCache.Data)return;if(this.TooltipCache.Type===0){if(!data||!IFrameSplitOperator.IsNonEmptyArray(data.Data))return;var lastItem=data.Data[data.Data.length-1];if(lastItem.Date!=this.TooltipCache.Data.Date)return;if(IFrameSplitOperator.IsNumber(lastItem.Time)&&lastItem.Time!=this.TooltipCache.Data.Time)return;var klinePaint=this.ChartPaint[0];var format=g_DivTooltipDataForamt.Create('HistoryDataStringFormat');format.Value={Data:lastItem,ChartPaint:klinePaint,Type:this.TooltipCache.Type};format.Symbol=this.Symbol;format.LanguageID=this.LanguageID;format.GetEventCallback=function(id){return _this12.GetEventCallback(id);};if(!format.Operator())return;if(format.Text==this.TooltipCache.InnerHTML)return;this.Tooltip.innerHTML=format.Text;this.TooltipCache.InnerHTML=format.Text;}};this.HideTooltip=function(){this.TooltipCache.IsShow=false;this.TooltipCache.Type=null;this.TooltipCache.InnerHTML=null;this.TooltipCache.Data=null;if(this.Tooltip.style.display!="none")this.Tooltip.style.display="none";this.HideFloatTooltip();};this.UpdateSelectRect=function(start,end){if(!this.ChartPaint[0].Data)return;var paint=this.GetRectSelectPaint();if(!paint)return;var data=this.ChartPaint[0].Data;var count=data.Data.length;if(end>=count)end=count-1;var startItem=data.Data[start];var endItem=data.Data[end];JSConsole.Chart.Log('[JSChartContainer::UpdateSelectRect]',startItem,endItem);paint.SetPoint(startItem,{Index:0,DataIndex:start});paint.SetPoint(endItem,{Index:1,DataIndex:end});this.Draw();};this.HideSelectRect=function(){this.ClearDragSelectRect();};this.ResetFrameXYSplit=function(){if(typeof this.Frame.ResetXYSplit=='function')this.Frame.ResetXYSplit();};this.ResetFrameXSplit=function(){if(typeof this.Frame.ResetXSplit=='function')this.Frame.ResetXSplit();};this.ResetFrameYCustomSplit=function(windowIndex){if(typeof this.Frame.ResetYCustomSplit=='function')this.Frame.ResetYCustomSplit(windowIndex);};this.UpdateFrameMaxMinV2=function(){var mapFrame=new _map2.default();//key=frameid, value:{ ChartPaint:[] }
|
|
1958
1959
|
for(var i=0;i<this.Frame.SubFrame.length;++i){var subItem=this.Frame.SubFrame[i];if(!subItem||!subItem.Frame)continue;var frame=subItem.Frame;//自定义刻度每次都调用
|
|
1959
1960
|
frame.YCustomSplit=true;var key=frame.Identify;var item={ID:key,Frame:frame,ChartPaint:[],Max:null,Min:null,OverlayFrame:[],//共享坐标
|
|
1960
1961
|
SingleOverlay:[],//独立坐标
|
|
@@ -2056,7 +2057,7 @@ if(IFrameSplitOperator.IsBool(windowItem.IsShowNameArrow))frame.IsShowNameArrow=
|
|
|
2056
2057
|
{frame.CustomToolbar=item.CustomToolbar.slice();}}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.IsShowTitleArrow))subFrame.Frame.IsShowTitleArrow=option.IsShowTitleArrow;if(IFrameSplitOperator.IsNumber(option.TitleArrowType))subFrame.Frame.TitleArrowType=option.TitleArrowType;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.IsNumber(option.Height))subFrame.Height=option.Height;//高度
|
|
2057
2058
|
if(IFrameSplitOperator.IsBool(option.IsShowLeftText)){subFrame.Frame.IsShowYText[0]=option.IsShowLeftText;subFrame.Frame.YSplitOperator.IsShowLeftText=option.IsShowLeftText;//显示左边刻度
|
|
2058
2059
|
}if(IFrameSplitOperator.IsBool(option.IsShowRightText)){subFrame.Frame.IsShowYText[1]=option.IsShowRightText;subFrame.Frame.YSplitOperator.IsShowRightText=option.IsShowRightText;//显示右边刻度
|
|
2059
|
-
}};this.AddNewSubFrame=function(option){var
|
|
2060
|
+
}};this.AddNewSubFrame=function(option){var _this13=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 _this13.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
|
|
2060
2061
|
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();//更新数据偏移
|
|
2061
2062
|
this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
2062
2063
|
this.Draw();return index;};//增加一个指标窗口
|
|
@@ -2085,7 +2086,7 @@ this.DeleteWindowsOverlayIndex=function(windowIndex){if(!IFrameSplitOperator.IsN
|
|
|
2085
2086
|
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)//图形销毁事件
|
|
2086
2087
|
{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)//图形销毁事件
|
|
2087
2088
|
{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=复制 }
|
|
2088
|
-
this.MoveIndex=function(src,dest,option){var
|
|
2089
|
+
this.MoveIndex=function(src,dest,option){var _this14=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;//固定窗口
|
|
2089
2090
|
var fixedWindowCount=0;var isMinuteChart=this.ClassName=="MinuteChartContainer"||this.ClassName=="MinuteChartHScreenContainer"?true:false;if(isMinuteChart)fixedWindowCount=2;//走势图固定2个窗口
|
|
2090
2091
|
if(dest.WindowIndex>=fixedWindowCount&&this.WindowIndex[dest.WindowIndex]==null)//主指标是空的,移动到主指标上
|
|
2091
2092
|
{if(findItem)this.WindowIndex[dest.WindowIndex]=this.CreateMainScript(findItem);else if(findOverlayItem)this.WindowIndex[dest.WindowIndex]=this.CreateMainScript(findOverlayItem.Script);if(option.Operator==0)//移动模式, 删除原来的
|
|
@@ -2093,15 +2094,15 @@ if(dest.WindowIndex>=fixedWindowCount&&this.WindowIndex[dest.WindowIndex]==null)
|
|
|
2093
2094
|
this.UpdataDataoffset();//更新数据偏移
|
|
2094
2095
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
2095
2096
|
this.Draw();}else{var subFrame=this.Frame.SubFrame[dest.WindowIndex];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;
|
|
2096
|
-
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
|
|
2097
|
+
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 _this14.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};//叠加指标信息
|
|
2097
2098
|
}else if(findOverlayItem){scriptIndex=this.CreateOverlayScript(findOverlayItem.Script);scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:dest.WindowIndex,Frame:overlayFrame};//叠加指标信息
|
|
2098
2099
|
}overlayFrame.Script=scriptIndex;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_OVERLAY_FRAME);if(event&&event.Callback){var sendData={OverlayFrame:overlayFrame,WindowIndex:dest.WindowIndex,SubFrame:subFrame};event.Callback(event,sendData,this);}subFrame.OverlayIndex.push(overlayFrame);var updateWindowIndex=dest.WindowIndex;if(option.Operator==0)//移动模式, 删除原来的
|
|
2099
2100
|
{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();//更新数据偏移
|
|
2100
2101
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
2101
2102
|
this.Draw();}};//移动指标到新的指标窗口 src={ WindowIndex:指标窗口索引,IndexID:指标ID } , option={ Operator: 0=移动, 1=复制 }
|
|
2102
|
-
this.MoveIndexToNewWindow=function(src,option){var
|
|
2103
|
+
this.MoveIndexToNewWindow=function(src,option){var _this15=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;//指标在最后一个窗口不需要移动
|
|
2103
2104
|
this.RemoveMinSizeWindows();//清空隐藏的指标
|
|
2104
|
-
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
|
|
2105
|
+
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 _this15.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
|
|
2105
2106
|
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)//移动模式, 删除原来的
|
|
2106
2107
|
{if(findOverlayItem)this.DeleteOverlayIndex(findOverlayItem.Identify,src.WindowIndex);else if(findItem)this.DeleteMainIndex(findItem.Guid,src.WindowIndex);}this.UpdataDataoffset();//更新数据偏移
|
|
2107
2108
|
this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
@@ -2147,7 +2148,7 @@ if(IFrameSplitOperator.IsBool(srcParam)){if(srcParam){this.DestroyPopMinuteChart
|
|
|
2147
2148
|
this.OnClickRightMenu=function(data){JSConsole.Chart.Log('[JSChartContainer::OnClickRightMenu] ',data);if(!data||!data.Data)return;var cmdID=data.Data.ID;//命令ID
|
|
2148
2149
|
var aryArgs=data.Data.Args;//参数
|
|
2149
2150
|
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MENU_COMMAND);//回调通知外部
|
|
2150
|
-
if(event&&event.Callback){var data={PreventDefault:false,CommandID:cmdID,Args:aryArgs,SrcData:data};event.Callback(event,data,this);if(data.PreventDefault)return;}this.ExecuteMenuCommand(cmdID,aryArgs);};this.PopupRightMenuV2=function(data,e){var
|
|
2151
|
+
if(event&&event.Callback){var data={PreventDefault:false,CommandID:cmdID,Args:aryArgs,SrcData:data};event.Callback(event,data,this);if(data.PreventDefault)return;}this.ExecuteMenuCommand(cmdID,aryArgs);};this.PopupRightMenuV2=function(data,e){var _this16=this;if(!this.JSPopMenu)return;var x=data.X,y=data.Y;var frameID=data.FrameID;var menuData={Menu:this.GetRightMenuData(frameID,data),Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID};menuData.ClickCallback=function(data){_this16.OnClickRightMenu(data);};var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_RIGHT_MENU);if(event&&event.Callback){var sendData={MenuData:menuData,FrameID:frameID,Data:data};event.Callback(event,sendData,this);}this.PopupMenuByRClick(menuData,x,y);};this.OnCMDSelectedSummary=function(e,selectData){if(selectData)this.UpdateSelectRect(selectData.Start,selectData.End);this.HideSelectRect();if(this.DialogSelectRect&&e)this.DrawSelectRectDialog(e);};//指标窗口扩展图形
|
|
2151
2152
|
this.CreateChartPaintExtend=function(chart,windowIndex){if(windowIndex<0)return false;var subFrame=this.Frame.SubFrame[windowIndex];if(!subFrame||!subFrame.Frame)return false;var frame=subFrame.Frame;chart.Canvas=this.Canvas;chart.ChartBorder=frame.ChartBorder;chart.ChartFrame=frame;this.ChartPaintEx.push(chart);return true;};//删除指标窗口扩展图形 option={ ChartID:图形ID, WindowIndex:窗口 }
|
|
2152
2153
|
this.DeleteChartPaintExtend=function(option,bCallDestroy){if(!option)return;if(!IFrameSplitOperator.IsNonEmptyArray(this.ChartPaintEx))return;if(IFrameSplitOperator.IsNumber(option.WindowIndex)){var windowIndex=option.WindowIndex;if(!this.Frame.SubFrame[windowIndex])return;var subFrame=this.Frame.SubFrame[windowIndex].Frame;if(!subFrame)return;var paint=[];//踢出当前窗口的指标画法
|
|
2153
2154
|
var deleteCount=0;for(var i=0;i<this.ChartPaintEx.length;++i){var item=this.ChartPaintEx[i];var bFind=item.ChartFrame.Guid==subFrame.Guid||item.ChartFrame==subFrame;if(!bFind){paint.push(item);}else{++deleteCount;if(bCallDestroy===true){if(item&&item.OnDestroy)item.OnDestroy();//图形销毁
|
|
@@ -7266,24 +7267,24 @@ this.ResetFrameXSplit();this.Frame.SetSizeChage(true);this.Draw();this.UpdatePoi
|
|
|
7266
7267
|
this.ChartOperator_GetIndex_ByDateTime=function(hisData,dateTime,period,searchType){if(!hisData)return null;//数据还没有到达
|
|
7267
7268
|
if(!IFrameSplitOperator.IsNonEmptyArray(hisData.Data))return null;if(!IFrameSplitOperator.IsPlusNumber(dateTime.Date)||dateTime.Date<19810101)return null;if(ChartData.IsDayPeriod(period,true)){for(var i=0;i<hisData.Data.length;++i){var item=hisData.Data[i];if(searchType==1){if(item.Date==dateTime.Date)return i;}else{if(item.Date>=dateTime.Date)return i;}}return null;}if(ChartData.IsMinutePeriod(period,true)||ChartData.IsMilliSecondPeriod(period)){var findTime=null;if(IFrameSplitOperator.IsNumber(dateTime.Time))findTime=dateTime.Time;for(var i=0;i<hisData.Data.length;++i){var item=hisData.Data[i];if(searchType==1)//精确匹配
|
|
7268
7269
|
{if(findTime==null)return null;if(item.Date==dateTime.Date&&item.Time==findTime)return i;}else{if(findTime==null)//只有日期
|
|
7269
|
-
{if(item.Date>=dateTime.Date)return i;}else{if(item.Date>dateTime.Date||item.Date==dateTime.Date&&item.Time>=findTime)return i;}}}return null;}return null;};this.OnWheel=function(e){var
|
|
7270
|
+
{if(item.Date>=dateTime.Date)return i;}else{if(item.Date>dateTime.Date||item.Date==dateTime.Date&&item.Time>=findTime)return i;}}}return null;}return null;};this.OnWheel=function(e){var _this17=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);//PC触摸板双指缩放时deltaY数值在[-20,20]之间
|
|
7270
7271
|
if(IFrameSplitOperator.IsNumber(e.deltaY)){var value=e.deltaY*pixelTatio;if(Math.abs(value)<90)return;}var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var enableZoomUpDown=true;//是否允许缩放
|
|
7271
7272
|
if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Wheel===false)enableZoomUpDown=false;if(this.SourceData&&this.SourceData.Data){if(isInClient&&wheelValue<0&&enableZoomUpDown)//缩小
|
|
7272
7273
|
{var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(e.ctrlKey)cursorIndex.ZoomType=1;//ctrl+滚轴 十字中心缩放
|
|
7273
|
-
if(this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){
|
|
7274
|
+
if(this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){_this17.ZoomDownloadData(requestData);}})){this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.ResetFrameXSplit();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true){}else{this.Draw();}this.OnKLinePageChange("wheel");}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
|
|
7274
7275
|
{var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(e.ctrlKey)cursorIndex.ZoomType=1;//ctrl+滚轴 十字中心缩放
|
|
7275
7276
|
if(this.Frame.ZoomUp(cursorIndex)){JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex);this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.ResetFrameXSplit();this.Draw();this.OnKLinePageChange("wheel");}}}if(!isInClient){if(!this.OnWheel_ZoomUpDownFrameY(e,x,y))return;}if(e.preventDefault)e.preventDefault();else e.returnValue=false;};//通过滚轴缩放Y轴
|
|
7276
7277
|
this.OnWheel_ZoomUpDownFrameY=function(e,x,y){if(!this.EnableYDrag.Wheel)return false;var dragY=this.TryYDrag(x,y);if(!dragY)return false;if(dragY.Left&&!dragY.IsOverlay||dragY.Right){}else{return false;}var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var yMove=this.EnableYDrag.WheelYMove;if(wheelValue>0)yMove*=-1;dragY.Position=0;//只能两边缩放
|
|
7277
7278
|
if(!this.Frame.OnZoomUpDownFrameY(dragY,yMove))return false;this.Frame.SetSizeChage(true);this.Draw();return true;};//创建
|
|
7278
7279
|
//windowCount 窗口个数
|
|
7279
|
-
this.Create=function(windowCount,option){var
|
|
7280
|
-
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return
|
|
7280
|
+
this.Create=function(windowCount,option){var _this18=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
7281
|
+
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this18.GetEventCallback(id);};this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this18.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ExtendChartPaint=this.ExtendChartPaint;this.ChartCorssCursor.GetEventCallback=function(id){return _this18.GetEventCallback(id);};this.ChartCorssCursor.OnChangeStatusCallback=function(data,obj){_this18.OnChangeCorssCursorStatus(data,obj);};//创建等待提示
|
|
7281
7282
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
7282
|
-
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
|
|
7283
|
+
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 _this18.GetExtendChartRightWidth();};this.Frame.GetExtendChartByClassName=function(name){return _this18.GetExtendChartByClassName(name);};this.Frame.GetEventCallback=function(id){return _this18.GetEventCallback(id);};this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
|
|
7283
7284
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();this.CreateExtendChart("RectSelectPaint",option?option.SelectRect:null);//区间统计
|
|
7284
7285
|
if(this.EnableIndexChartDrag)this.CreateExtendChart("DragMovePaint");this.CreateDragSelectRect(option?option.DragSelectRect:null);//子窗口动态标题
|
|
7285
|
-
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
|
|
7286
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
7286
|
+
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 _this18.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){_this18.OnKeyDown(e);},true);//键盘消息
|
|
7287
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this18.OnWheel(e);},true);//上下滚动消息
|
|
7287
7288
|
this.InitalPopMinuteChart(option);};this.InitalPopMinuteChart=function(option){if(!option)return false;if(option.PopMinuteChart&&option.PopMinuteChart.Enable)//新的配置格式
|
|
7288
7289
|
{var item=option.PopMinuteChart;this.PopMinuteChart=new JSPopMinuteChart();this.PopMinuteChart.Inital(this,item);return true;}else if(option.KLine&&option.KLine.KLineDoubleClick===true)//旧的格式 不要使用了
|
|
7289
7290
|
{this.PopMinuteChart=new JSPopMinuteChart();this.PopMinuteChart.Inital(this);return true;}return false;};this.DestroyPopMinuteChart=function(){if(!this.PopMinuteChart)return;this.PopMinuteChart.Destroy();this.PopMinuteChart=null;};this.ShowMinuteChartDialog=function(data,x,y){if(!this.PopMinuteChart)return;if(!data.Tooltip||!data.Chart)return;var pixelRatio=GetDevicePixelRatio();var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();x+=rtClient.left+rtScroll.Left;y+=rtClient.top+rtScroll.Top;var date=data.Tooltip.Data.Date;var symbol=data.Chart.Symbol;this.PopMinuteChart.Show({Date:date,Symbol:symbol,Data:data.Tooltip.Data},x/pixelRatio,y/pixelRatio);};this.OnCustomKeyDown=function(keyID,e)//自定义键盘事件
|
|
@@ -7298,16 +7299,16 @@ if(this.CursorIndex+step+data.DataOffset+1>data.Data.length)//数据不够步长
|
|
|
7298
7299
|
{step=data.Data.length-1-data.DataOffset-this.CursorIndex;bMoveEnd=true;}if(this.CursorIndex+step>=xPointcount)//当前屏最右边了
|
|
7299
7300
|
{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线图实例
|
|
7300
7301
|
this.GetKLineChart=function(){if(!this.ChartPaint[0])return null;return this.ChartPaint[0];};//创建子窗口
|
|
7301
|
-
this.CreateChildWindow=function(windowCount){var
|
|
7302
|
+
this.CreateChildWindow=function(windowCount){var _this19=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.GetExtraCanvas=function(name){return _this19.GetExtraCanvas(name);};frame.ChartBorder=border;frame.Identify=i;//窗口序号
|
|
7302
7303
|
frame.RightSpaceCount=this.RightSpaceCount;//右边
|
|
7303
|
-
frame.GetEventCallback=function(id){return
|
|
7304
|
+
frame.GetEventCallback=function(id){return _this19.GetEventCallback(id);};frame.GlobalOption=this.GlobalOption;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 _this19.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this19.GetKLineChart();};frame.YSplitOperator.HQChart=this;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
7304
7305
|
border.BottomSpace=15*pixelTatio;//主图上下留空间
|
|
7305
|
-
border.TopSpace=15*pixelTatio;frame.GetEventCallback=function(id){return
|
|
7306
|
-
}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
|
|
7307
|
-
frame.GetEventCallback=function(id){return
|
|
7306
|
+
border.TopSpace=15*pixelTatio;frame.GetEventCallback=function(id){return _this19.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 _this19.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this19.GetKLineChart();};frame.YSplitOperator.HQChart=this;//frame.IsLocked = true;
|
|
7307
|
+
}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 _this19.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();frame.FrameData.SubFrameItem=subFrame;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 _this20=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.GetExtraCanvas=function(name){return _this20.GetExtraCanvas(name);};frame.ChartBorder=border;frame.Identify=id;//窗口序号
|
|
7308
|
+
frame.GetEventCallback=function(id){return _this20.GetEventCallback(id);};frame.GlobalOption=this.GlobalOption;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.XSplitOperator.GetEventCallback=function(id){return _this20.GetEventCallback(id);};frame.YSplitOperator.GetEventCallback=function(id){return _this20.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this20.GetKLineChart();};frame.YSplitOperator.HQChart=this;frame.XSplitOperator.Symbol=this.Symbol;frame.XSplitOperator.Period=this.Period;//K线数据绑定
|
|
7308
7309
|
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();frame.FrameData.SubFrameItem=subFrame;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线画法
|
|
7309
|
-
this.CreateMainKLine=function(){var
|
|
7310
|
-
this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].HQChart=this;this.TitlePaint[0].GetEventCallback=function(id){return
|
|
7310
|
+
this.CreateMainKLine=function(){var _this21=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 _this21.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;//绑定叠加
|
|
7311
|
+
this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].HQChart=this;this.TitlePaint[0].GetEventCallback=function(id){return _this21.GetEventCallback(id);};};//绑定主图K线数据
|
|
7311
7312
|
this.BindMainData=function(hisData,showCount,chartOperator){var isShowAll=false;//全部显示
|
|
7312
7313
|
if(chartOperator&&chartOperator.IsShowAll===true)isShowAll=true;this.ChartPaint[0].Data=hisData;this.ChartPaint[0].Symbol=this.Symbol;if(this.KLineSize){if(!IFrameSplitOperator.IsNumber(this.KLineSize.DataWidth)){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=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i].Frame;if(isShowAll)item.XPointCount=hisData.Data.length+this.RightSpaceCount;else 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;//动态标题
|
|
7313
7314
|
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;//十字光标
|
|
@@ -7683,15 +7684,15 @@ this.Draw();};this.AddOverlayIndex=function(obj){var overlay=this.CreateOverlayW
|
|
|
7683
7684
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7684
7685
|
this.Draw();};//创建一个叠加指标
|
|
7685
7686
|
this.CreateOverlayWindowsIndex=function(obj)// {WindowIndex:, IndexName:, Identify:, ShowRightText:, API:}
|
|
7686
|
-
{var
|
|
7687
|
+
{var _this22=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)//动态执行脚本
|
|
7687
7688
|
{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);//系统指标
|
|
7688
7689
|
if(!indexInfo){indexCustom=JSIndexMap.Get(indexName);//定制指标
|
|
7689
7690
|
if(!indexCustom){console.warn('[KLineChartContainer::CreateOverlayIndex] can not find index['+indexName+']');return null;}}}var subFrame=this.Frame.SubFrame[windowIndex];var overlayFrame=new OverlayIndexItem();if(obj.Identify)overlayFrame.Identify=obj.Identify;//由外部指定id
|
|
7690
7691
|
//var frame= this.ClassName==='KLineChartHScreenContainer' ? new OverlayKLineHScreenFrame() : new OverlayKLineFrame();
|
|
7691
|
-
var frame=this.CreateOverlayFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GetEventCallback=function(id){return
|
|
7692
|
+
var frame=this.CreateOverlayFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GetEventCallback=function(id){return _this22.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;//废弃
|
|
7692
7693
|
if(IFrameSplitOperator.IsBool(obj.IsShareY))frame.IsShareY=obj.IsShareY;if(IFrameSplitOperator.IsNumber(obj.IsShowMainFrame))frame.IsShowMainFrame=obj.IsShowMainFrame;//if (IFrameSplitOperator.IsBool(obj.IsShowIndexTitle)) frame.IsShowIndexTitle=obj.IsShowIndexTitle;
|
|
7693
7694
|
if(IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin))frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin;//是否计算Y最大最小值
|
|
7694
|
-
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
|
|
7695
|
+
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 _this22.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this22.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;//自定义刻度绘制在主图上
|
|
7695
7696
|
if(IFrameSplitOperator.IsBool(item.IsShowToolbar))frame.IsShowToolbar=item.IsShowToolbar;//是否显示工具栏
|
|
7696
7697
|
}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};//叠加指标信息
|
|
7697
7698
|
overlayFrame.Script=apiIndex;}else if(indexInfo){JSIndexScript.ModifyAttribute(indexInfo,obj);var scriptIndex=new OverlayScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
|
|
@@ -7712,10 +7713,10 @@ this.ChangeCoordinateType=function(obj){if(!this.Frame)return;if(!IFrameSplitOpe
|
|
|
7712
7713
|
{frame.Frame.YSplitOperator.CoordinateType=2;}else{return;}}else{if(obj.Type>=0&&obj.Type<=5)frame.YSplitOperator.CoordinateType=obj.Type;if(obj.IsReverse===true)frame.CoordinateType=1;else if(obj.IsReverse==false)frame.CoordinateType=0;}//请求缓存的最大最小值
|
|
7713
7714
|
frame.YMaxMin.Max=null;frame.YMaxMin.Min=null;this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7714
7715
|
this.Frame.SetSizeChage(true);this.Draw();};//设置指标窗口个数
|
|
7715
|
-
this.ChangeIndexWindowCount=function(count,option){var
|
|
7716
|
+
this.ChangeIndexWindowCount=function(count,option){var _this23=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.DeleteChartPaintExtend({WindowIndex: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);this.TitlePaint.splice(count+1,currentLength-count);//最后一个显示X轴坐标
|
|
7716
7717
|
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();//调整坐标最大 最小值
|
|
7717
7718
|
this.Draw();}else{//创建新的指标窗口
|
|
7718
|
-
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
|
|
7719
|
+
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 _this23.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}//最后一个显示X轴坐标
|
|
7719
7720
|
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();//调整坐标最大 最小值
|
|
7720
7721
|
this.Draw();//创建指标
|
|
7721
7722
|
var indexName=[{Index:"RSI"},{Index:"MACD"},{Index:"VOL"},{Index:"UOS"},{Index:"CHO"},{Index:"BRAR"}];//增加的指标名字
|
|
@@ -7727,11 +7728,11 @@ var subFrame=this.Frame.SubFrame[i];if(item.Modify!=null)this.Frame.SubFrame[i].
|
|
|
7727
7728
|
}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);//执行脚本
|
|
7728
7729
|
}//this.UpdataDataoffset(); //更新数据偏移
|
|
7729
7730
|
}};this.ChangeIndexTemplate=function(option)//切换指标模板 可以设置指标窗口个数 每个窗口的指标
|
|
7730
|
-
{var
|
|
7731
|
+
{var _this24=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,symbol=null;if(option.Symbol)symbol=option.Symbol;if(option.KLine){if(IFrameSplitOperator.IsNumber(option.KLine.Period)&&option.KLine.Period!=this.Period)period=option.KLine.Period;//周期
|
|
7731
7732
|
if(IFrameSplitOperator.IsNumber(option.KLine.Right)&&option.KLine.Right!=this.Right)right=option.KLine.Right;//复权
|
|
7732
7733
|
}var bRefreshData=period!=null||right!=null||symbol!=null;//清空所有的指标图型
|
|
7733
7734
|
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);this.TitlePaint.splice(count+1,currentLength-count);}else{for(var i=currentLength;i<count;++i)//创建新的指标窗口
|
|
7734
|
-
{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
|
|
7735
|
+
{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 _this24.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}}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;var frame=this.Frame.SubFrame[i];this.DeleteWindowsOverlayIndex(i);//清空叠加指标
|
|
7735
7736
|
if(item.Script)//自定义指标脚本
|
|
7736
7737
|
{this.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
|
|
7737
7738
|
}else if(item.API)//后台指标
|
|
@@ -7864,7 +7865,7 @@ var stockChipConfig={Name:'StockChip',ShowType:1,Width:230};//var stockChipConfi
|
|
|
7864
7865
|
var bShowCorss=false;//十字光标十字线
|
|
7865
7866
|
if(this.ChartCorssCursor)bShowCorss=this.ChartCorssCursor.IsShowCorss;var bPopMinuteChart=false;if(this.PopMinuteChart)bPopMinuteChart=true;var kItem=null;if(frameID>=0&&option&&IFrameSplitOperator.IsNumber(option.CursorIndex)){var kData=this.GetKData();if(kData&&IFrameSplitOperator.IsNonEmptyArray(kData.Data)){var dataIndex=kData.DataOffset+option.CursorIndex;if(dataIndex>=0&&dataIndex<kData.Data.length)kItem=kData.Data[dataIndex];}}var aryMenu=[{Name:"分析周期",SubMenu:[{Name:"日线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[0]},Checked:this.Period==0},{Name:"周线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[1]},Checked:this.Period==1},{Name:"双周线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[21]},Checked:this.Period==21},{Name:"月线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[2]},Checked:this.Period==2},{Name:"季线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[9]},Checked:this.Period==9},{Name:"半年",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[22]},Checked:this.Period==22},{Name:"年线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[3]},Checked:this.Period==3},{Name:"1分",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[4]},Checked:this.Period==4},{Name:"5分",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[5]},Checked:this.Period==5},{Name:"15分",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[6]},Checked:this.Period==6},{Name:"30分",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[7]},Checked:this.Period==7},{Name:"60分",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[8]},Checked:this.Period==8},{Name:"2小时",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[11]},Checked:this.Period==11},{Name:"4小时",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[12]},Checked:this.Period==12},{Name:"分笔",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[10]},Checked:this.Period==10},{Name:"自定义周期:3分钟",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[20003]},Checked:this.Period==20003},{Name:"自定义周期:35分钟",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[20035]},Checked:this.Period==20035},{Name:"自定义周期:8日",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID,Args:[40008]},Checked:this.Period==40008}]},{Name:"指标切换",SubMenu:[{Name:"均线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"均线"]}},{Name:"BOLL",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"BOLL"]}},{Name:"MACD",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"MACD"]}},{Name:"MACD(粗)",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"MACD2"]}},{Name:"KDJ",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"KDJ"]}},{Name:"VOL",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"VOL"]}},{Name:"RSI",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"RSI"]}},{Name:"BRAR",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"BRAR"]}},{Name:"WR",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"WR"]}}]},{Name:"五彩K线",SubMenu:[{Name:"十字星",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COLOR_INDEX_ID,Args:["五彩K线-十字星"]}},{Name:"早晨之星",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COLOR_INDEX_ID,Args:["五彩K线-早晨之星"]}},{Name:"垂死十字",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COLOR_INDEX_ID,Args:["五彩K线-垂死十字"]}},{Name:"三只乌鸦",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COLOR_INDEX_ID,Args:["五彩K线-三只乌鸦"]}},{Name:"光脚阴线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COLOR_INDEX_ID,Args:["五彩K线-光脚阴线"]}},{Name:"黄昏之星",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COLOR_INDEX_ID,Args:["五彩K线-黄昏之星"]}}]},{Name:"专家系统",SubMenu:[{Name:"BIAS",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_TRADE_INDEX_ID,Args:["交易系统-BIAS"]}},{Name:"CCI",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_TRADE_INDEX_ID,Args:["交易系统-CCI"]}},{Name:"DMI",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_TRADE_INDEX_ID,Args:["交易系统-DMI"]}},{Name:"KD",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_TRADE_INDEX_ID,Args:["交易系统-KD"]}},{Name:"BOLL",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_TRADE_INDEX_ID,Args:["交易系统-BOLL"]}},{Name:"KDJ",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_TRADE_INDEX_ID,Args:["交易系统-KDJ"]}}]},{Name:"信息地雷",SubMenu:[{Name:"公告",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_INFO_ID,Args:["公告",!aryKLineInfo.includes("AnnouncementInfo")]},Checked:aryKLineInfo.includes("AnnouncementInfo")},{Name:"业绩预告",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_INFO_ID,Args:["业绩预告",!aryKLineInfo.includes("PforecastInfo")]},Checked:aryKLineInfo.includes("PforecastInfo")},{Name:"调研",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_INFO_ID,Args:["调研",!aryKLineInfo.includes("ResearchInfo")]},Checked:aryKLineInfo.includes("ResearchInfo")},{Name:"大宗交易",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_INFO_ID,Args:["大宗交易",!aryKLineInfo.includes("BlockTrading")]},Checked:aryKLineInfo.includes("BlockTrading")},{Name:"龙虎榜",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_INFO_ID,Args:["龙虎榜",!aryKLineInfo.includes("TradeDetail")]},Checked:aryKLineInfo.includes("TradeDetail")},{Name:"互动易",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_INFO_ID,Args:["互动易",!aryKLineInfo.includes("InvestorInfo")]},Checked:aryKLineInfo.includes("InvestorInfo")},{Name:JSPopMenu.SEPARATOR_LINE_NAME},{Name:"显示位置",SubMenu:[{Name:"底部",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INFO_POSITION_ID,Args:[1]},Checked:infoPosition===1},{Name:"K线上",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INFO_POSITION_ID,Args:[0]},Checked:infoPosition===0}]}]},{Name:"缺口提示",SubMenu:[{Name:"显示1个缺口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PRICE_GAP_ID,Args:[true,1]},Checked:priceGap.Enable==true&&priceGap.Count==1},{Name:"显示2个缺口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PRICE_GAP_ID,Args:[true,2]},Checked:priceGap.Enable==true&&priceGap.Count==2},{Name:"显示3个缺口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PRICE_GAP_ID,Args:[true,3]},Checked:priceGap.Enable==true&&priceGap.Count==3},{Name:"隐藏缺口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_PRICE_GAP_ID,Args:[false]},Checked:priceGap.Enable==false}]},{Name:"叠加品种",SubMenu:[{Name:"上证指数",Data:{ID:JSCHART_MENU_ID.CMD_OVERLAY_SYMBOL_ID,Args:["000001.sh",!aryOverlaySymbol.includes("000001.sh")]},Checked:aryOverlaySymbol.includes("000001.sh")},{Name:"深证成指",Data:{ID:JSCHART_MENU_ID.CMD_OVERLAY_SYMBOL_ID,Args:["399001.sz",!aryOverlaySymbol.includes("399001.sz")]},Checked:aryOverlaySymbol.includes("399001.sz")},{Name:"中小板指",Data:{ID:JSCHART_MENU_ID.CMD_OVERLAY_SYMBOL_ID,Args:["399005.sz",!aryOverlaySymbol.includes("399005.sz")]},Checked:aryOverlaySymbol.includes("399005.sz")},{Name:"创业板指",Data:{ID:JSCHART_MENU_ID.CMD_OVERLAY_SYMBOL_ID,Args:["399006.sz",!aryOverlaySymbol.includes("399006.sz")]},Checked:aryOverlaySymbol.includes("399006.sz")},{Name:"沪深300",Data:{ID:JSCHART_MENU_ID.CMD_OVERLAY_SYMBOL_ID,Args:["000300.sh",!aryOverlaySymbol.includes("000300.sh")]},Checked:aryOverlaySymbol.includes("000300.sh")}]},{Name:"主图线型",SubMenu:[{Name:"K线(空心阳线)",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[3]},Checked:klineType==3},{Name:"K线(实心阳线)",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[0]},Checked:klineType==0},{Name:"美国线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[2,true,{IsThinAKBar:false}]},Checked:klineType==2&&!bThinAKBar},{Name:"美国线(细)",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[2,true,{IsThinAKBar:true}]},Checked:klineType==2&&bThinAKBar},{Name:"收盘线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[1]},Checked:klineType==1},{Name:"收盘面积",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[4]},Checked:klineType==4},{Name:"K线(空心阳线阴线)",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[6]},Checked:klineType==6},{Name:"Heikin Ashi",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[11]},Checked:klineType==11},{Name:"Line Break",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[12]},Checked:klineType==12},{Name:"High-low",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[13]},Checked:klineType==13},{Name:"HLC Area",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[15]},Checked:klineType==15}]},{Name:"坐标类型",SubMenu:[{Name:"反转坐标",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COORDINATETYPE_ID,Args:[{IsReverse:coordinateType==0}]},Checked:coordinateType==1},{Name:JSPopMenu.SEPARATOR_LINE_NAME},{Name:"普通坐标",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COORDINATETYPE_ID,Args:[{Type:0}]},Checked:yCoordinateType==0},{Name:"百分比坐标",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COORDINATETYPE_ID,Args:[{Type:1}]},Checked:yCoordinateType==1},{Name:"对数坐标",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COORDINATETYPE_ID,Args:[{Type:2}]},Checked:yCoordinateType==2},{Name:"等比坐标",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COORDINATETYPE_ID,Args:[{Type:3}]},Checked:yCoordinateType==3},{Name:"等分坐标",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COORDINATETYPE_ID,Args:[{Type:4}]},Checked:yCoordinateType==4},{Name:"黄金分割",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_COORDINATETYPE_ID,Args:[{Type:5}]},Checked:yCoordinateType==5}]},{Name:"指标窗口个数",SubMenu:[{Name:"1个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[2]},Checked:2==windowCount},{Name:"2个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[3]},Checked:3==windowCount},{Name:"3个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[4]},Checked:4==windowCount},{Name:"4个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[5]},Checked:5==windowCount},{Name:"5个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[6]},Checked:6==windowCount}]},{Name:"其他设置",SubMenu:[{Name:"禁止拖拽",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID,Args:[0]},Checked:0==this.DragMode},{Name:"启动拖拽",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID,Args:[1]},Checked:1==this.DragMode},{Name:"左键区间选择",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID,Args:[2]},Checked:2==this.DragMode},{Name:JSPopMenu.SEPARATOR_LINE_NAME},{Name:"背景分割",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_BG_SPLIT_ID,Args:[!bBGSpit]},Checked:bBGSpit},{Name:"画图工具",Data:{ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID,Args:[]},Checked:this.IsShowDrawToolDialog()},{Name:"移动筹码图",Data:{ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID,Args:[stockChipConfig.Name,stockChipConfig]},Checked:bShowStockChip},{Name:"十字光标线",Data:{ID:JSCHART_MENU_ID.CMD_SHOW_CORSS_LINE_ID,Args:[!bShowCorss]},Checked:bShowCorss},{Name:"双击弹分时图",Data:{ID:JSCHART_MENU_ID.CMD_ENABLE_POP_MINUTE_CHART_ID,Args:[!bPopMinuteChart]},Checked:bPopMinuteChart},{Name:JSPopMenu.SEPARATOR_LINE_NAME},{Name:"鼠标形状",SubMenu:[{Name:"默认",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DEFAULTCURSOR_ID,Args:["default"]},Checked:this.DefaultCursor=="default"},{Name:"十字线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DEFAULTCURSOR_ID,Args:["crosshair"]},Checked:this.DefaultCursor=="crosshair"}]},{Name:"语言设置",SubMenu:[{Name:"中文",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_LANGUAGE_ID,Args:["CN"]},Checked:this.LanguageID==JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID},{Name:"英语",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_LANGUAGE_ID,Args:["EN"]},Checked:this.LanguageID==JSCHART_LANGUAGE_ID.LANGUAGE_ENGLISH_ID},{Name:"繁体",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_LANGUAGE_ID,Args:["TC"]},Checked:this.LanguageID==JSCHART_LANGUAGE_ID.LANGUAGE_TRADITIONAL_CHINESE_ID}]},{Name:"区间选择样式",SubMenu:[{Name:"样式1(默认)",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID,Args:[0]},Checked:0==this.ChartDragSelectRect.ShowMode},{Name:"样式2",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID,Args:[1]},Checked:1==this.ChartDragSelectRect.ShowMode},{Name:"样式3",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DRAG_RECT_SHOW_MODE_ID,Args:[2]},Checked:2==this.ChartDragSelectRect.ShowMode}]},{Name:"K线浮动框",SubMenu:[{Name:"禁用",Data:{ID:JSCHART_MENU_ID.CMD_DIALOG_TOOLTIP_ATTRIBUTE,Args:[{Enable:false}]},Checked:!this.DialogTooltip},{Name:"样式1",Data:{ID:JSCHART_MENU_ID.CMD_DIALOG_TOOLTIP_ATTRIBUTE,Args:[{Enable:true,Style:0}]},Checked:this.DialogTooltip&&this.DialogTooltip.Style===0},{Name:"样式2",Data:{ID:JSCHART_MENU_ID.CMD_DIALOG_TOOLTIP_ATTRIBUTE,Args:[{Enable:true,Style:1}]},Checked:this.DialogTooltip&&this.DialogTooltip.Style===1}]},{Name:"K线提示框",SubMenu:[{Name:"启用",Data:{ID:JSCHART_MENU_ID.CMD_KLINE_TOOLTIP_ATTRIBUTE,Args:[{Enable:!this.KLineTooltipConfig.Enable}]},Checked:this.KLineTooltipConfig.Enable},{Name:"键盘左右显示",Data:{ID:JSCHART_MENU_ID.CMD_KLINE_TOOLTIP_ATTRIBUTE,Args:[{EnableKeyDown:!this.KLineTooltipConfig.EnableKeyDown}]},Checked:this.KLineTooltipConfig.EnableKeyDown}]}]}];//复权
|
|
7866
7867
|
if(!MARKET_SUFFIX_NAME.IsSHSZIndex(this.Symbol)&&!MARKET_SUFFIX_NAME.IsBIT(this.Symbol)){var rightMenu={Name:"复权处理",SubMenu:[{Name:"不复权",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_RIGHT_ID,Args:[0]},Checked:0==this.Right},{Name:"前复权",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_RIGHT_ID,Args:[1]},Checked:1==this.Right},{Name:"后复权",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_RIGHT_ID,Args:[2]},Checked:2==this.Right}]};aryMenu.splice(1,0,rightMenu);}//删除菜单
|
|
7867
|
-
for(var i=0;i<aryMenu.length;++i){var item=aryMenu[i];if(item.Name=="五彩K线"){if(this.ColorIndex){item.SubMenu.push({Name:JSPopMenu.SEPARATOR_LINE_NAME});item.SubMenu.push({Name:"删除五彩K线",Data:{ID:JSCHART_MENU_ID.CMD_DELETE_COLOR_INDEX_ID}});}}else if(item.Name=="专家系统"){if(this.TradeIndex){item.SubMenu.push({Name:JSPopMenu.SEPARATOR_LINE_NAME});item.SubMenu.push({Name:"删除专家系统",Data:{ID:JSCHART_MENU_ID.CMD_DELETE_TRADE_INDEX_ID}});}}else if(item.Name=="叠加品种"){for(var j=0;j<item.SubMenu.length;++j){if(item.SubMenu[j].Checked){item.SubMenu.push({Name:JSPopMenu.SEPARATOR_LINE_NAME});item.SubMenu.push({Name:"取消叠加",Data:{ID:JSCHART_MENU_ID.CMD_DELETE_ALL_OVERLAY_SYMBOL_ID}});break;}}}else if(item.Name=="信息地雷"){for(var j=0;j<item.SubMenu.length;++j){if(item.SubMenu[j].Checked){item.SubMenu.push({Name:JSPopMenu.SEPARATOR_LINE_NAME});item.SubMenu.push({Name:"删除所有",Data:{ID:JSCHART_MENU_ID.CMD_DELETE_ALL_KLINE_INFO_ID}});break;}}}else if(item.Name=="其他设置"){if(kItem){var bLocked=this.IsLockCorssCursor();if(bLocked)item.SubMenu.push({Name:"锁十字光标",Data:{ID:JSCHART_MENU_ID.CMD_UNLOCK_CROSSCURSOR},Checked:bLocked});else item.SubMenu.push({Name:"锁十字光标",Data:{ID:JSCHART_MENU_ID.CMD_LOCK_CROSSCURSOR,Args:[{KItem:{Date:kItem.Date,Time:kItem.Time},Draw:true}]},Checked:bLocked});}}}return aryMenu;};this.PopupSelectRectMenuV2=function(data,e){var
|
|
7868
|
+
for(var i=0;i<aryMenu.length;++i){var item=aryMenu[i];if(item.Name=="五彩K线"){if(this.ColorIndex){item.SubMenu.push({Name:JSPopMenu.SEPARATOR_LINE_NAME});item.SubMenu.push({Name:"删除五彩K线",Data:{ID:JSCHART_MENU_ID.CMD_DELETE_COLOR_INDEX_ID}});}}else if(item.Name=="专家系统"){if(this.TradeIndex){item.SubMenu.push({Name:JSPopMenu.SEPARATOR_LINE_NAME});item.SubMenu.push({Name:"删除专家系统",Data:{ID:JSCHART_MENU_ID.CMD_DELETE_TRADE_INDEX_ID}});}}else if(item.Name=="叠加品种"){for(var j=0;j<item.SubMenu.length;++j){if(item.SubMenu[j].Checked){item.SubMenu.push({Name:JSPopMenu.SEPARATOR_LINE_NAME});item.SubMenu.push({Name:"取消叠加",Data:{ID:JSCHART_MENU_ID.CMD_DELETE_ALL_OVERLAY_SYMBOL_ID}});break;}}}else if(item.Name=="信息地雷"){for(var j=0;j<item.SubMenu.length;++j){if(item.SubMenu[j].Checked){item.SubMenu.push({Name:JSPopMenu.SEPARATOR_LINE_NAME});item.SubMenu.push({Name:"删除所有",Data:{ID:JSCHART_MENU_ID.CMD_DELETE_ALL_KLINE_INFO_ID}});break;}}}else if(item.Name=="其他设置"){if(kItem){var bLocked=this.IsLockCorssCursor();if(bLocked)item.SubMenu.push({Name:"锁十字光标",Data:{ID:JSCHART_MENU_ID.CMD_UNLOCK_CROSSCURSOR},Checked:bLocked});else item.SubMenu.push({Name:"锁十字光标",Data:{ID:JSCHART_MENU_ID.CMD_LOCK_CROSSCURSOR,Args:[{KItem:{Date:kItem.Date,Time:kItem.Time},Draw:true}]},Checked:bLocked});}}}return aryMenu;};this.PopupSelectRectMenuV2=function(data,e){var _this25=this;var aryMenu=[{Name:"区间统计",Data:{ID:JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID,Args:[e,data.SelectData]}},{Name:"区间放大",Data:{ID:JSCHART_MENU_ID.CMD_SELECTED_ZOOM_ID,Args:[data.SelectData]}}];var menuData={Menu:aryMenu,Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID};menuData.ClickCallback=function(data){_this25.OnClickRightMenu(data);};var x=data.X,y=data.Y;this.PopupMenuByRClick(menuData,x,y);};//重新加载画图工具(切换股票|周期)
|
|
7868
7869
|
this.ReloadChartDrawPicture=function(){this.ChartDrawPicture=[];if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.IsSelected=false;this.SelectChartDrawPicture=null;this.CurrentChartDrawPicture=null;if(this.ChartDrawStorage){this.ChartDrawStorageCache=this.ChartDrawStorage.GetDrawData({Symbol:this.Symbol,Period:this.Period});var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_LOAD_DRAWPICTURE);if(event&&event.Callback){var sendData={Symbol:this.Symbol,Period:this.Period,DrawStorage:this.ChartDrawStorage,ChartDrawStorageCache:this.ChartDrawStorageCache};event.Callback(event,sendData,this);}}};this.CreateChartDrawPictureByStorage=function()//把缓存(this.ChartDrawStorageCache) 画图工具创建出来
|
|
7869
7870
|
{if(!IFrameSplitOperator.IsNonEmptyArray(this.ChartDrawStorageCache))return;for(var i=0;i<this.ChartDrawStorageCache.length;++i){var item=this.ChartDrawStorageCache[i];if(item.FrameID<0||!this.Frame.SubFrame||this.Frame.SubFrame.length<item.FrameID)continue;var drawPicture=IChartDrawPicture.CreateChartDrawPicture(item);if(!drawPicture)continue;drawPicture.Canvas=this.Canvas;drawPicture.Status=10;drawPicture.Frame=this.Frame.SubFrame[item.FrameID].Frame;//绑定框架坐标
|
|
7870
7871
|
drawPicture.Option=this.ChartDrawOption;if(drawPicture.ImportStorageData)drawPicture.ImportStorageData(item);drawPicture.UpdateXValue();drawPicture.ValueToPoint();var self=this;drawPicture.GetActiveDrawPicture=function(){return self.GetActiveDrawPicture();};if(drawPicture.ClassName==='ChartDrawPictureText')drawPicture.IsInitialized=true;this.ChartDrawPicture.push(drawPicture);}this.ChartDrawStorageCache=null;//清空缓存
|
|
@@ -8203,7 +8204,7 @@ this.PtInClient_V2=function(x,y){this.Canvas.beginPath();if(this.Frame.IsHScreen
|
|
|
8203
8204
|
{for(var i=0;i<border.DayBorder.length;++i){var client=border.DayBorder[i];this.Canvas.beginPath();this.Canvas.rect(client.LeftEx,border.TopEx,client.RightEx-client.LeftEx,border.BottomEx-border.TopEx);if(this.Canvas.isPointInPath(x,y))return 100+i;//盘前
|
|
8204
8205
|
this.Canvas.beginPath();this.Canvas.rect(client.Left,border.TopEx,client.LeftEx-client.Left,border.BottomEx-border.TopEx);if(this.Canvas.isPointInPath(x,y))return 200+i;//盘后
|
|
8205
8206
|
this.Canvas.beginPath();this.Canvas.rect(client.RightEx,border.TopEx,client.Right-client.RightEx,border.BottomEx-border.TopEx);if(this.Canvas.isPointInPath(x,y))return 300+i;}return-2;}this.Canvas.rect(border.LeftEx,border.Top,border.RightEx-border.LeftEx,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 1;if(this.Frame.ChartBorder.LeftExtendWidth>10){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){this.Canvas.rect(border.Left,border.Top,border.Right-border.Left,border.TopEx-border.Top);}else{this.Canvas.rect(border.Left,border.Top,border.LeftEx-border.Left,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 2;}if(this.Frame.ChartBorder.RightExtendWidth>10){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){this.Canvas.rect(border.Left,border.BottomEx,border.Right-border.Left,border.Bottom-border.BottomEx);}else{this.Canvas.rect(border.RightEx,border.Top,border.Right-border.RightEx,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 3;}return-1;};//手势
|
|
8206
|
-
this.OnTouchStart=function(e){var
|
|
8207
|
+
this.OnTouchStart=function(e){var _this26=this;if(this.DragMode==0)return;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsPress=false;this.IsOnTouch=true;this.TouchDrawCount=0;this.PhonePinch=null;this.StopDragTimer();if(this.EnableScrollUpDown==false)e.preventDefault();//上下拖动图形不能阻止事件
|
|
8207
8208
|
if(this.IsPhoneDragging(e)){var drag={Click:{},LastMove:{}};//LastMove=最后移动的位置
|
|
8208
8209
|
var touches=this.GetToucheData(e,this.IsForceLandscape);var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);if(this.TryClickLock||this.TryClickIndexTitle)//指标枷锁区域 , 指标标题点击
|
|
8209
8210
|
{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;}}drag.Click.X=touches[0].clientX;drag.Click.Y=touches[0].clientY;drag.LastMove.X=touches[0].clientX;drag.LastMove.Y=touches[0].clientY;var self=this;var T_ShowCorssCursor=function T_ShowCorssCursor()//临时函数(Temp_) T_开头
|
|
@@ -8213,9 +8214,9 @@ var touches=this.GetToucheData(e,this.IsForceLandscape);var pt=this.PointAbsolut
|
|
|
8213
8214
|
if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo({Corss:false,Tooltip:false});}if(e.cancelable)e.preventDefault();return;}else{var drawPictrueData={};var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
|
|
8214
8215
|
drawPictrueData.X=touches[0].clientX-uielement.getBoundingClientRect().left;drawPictrueData.Y=touches[0].clientY-uielement.getBoundingClientRect().top;if(this.GetChartDrawPictureByPoint(drawPictrueData)){if(drawPictrueData.ChartDrawPicture.EnableMove==true)drawPictrueData.ChartDrawPicture.Status=20;drawPictrueData.ChartDrawPicture.ValueToPoint();drawPictrueData.ChartDrawPicture.MovePointIndex=drawPictrueData.PointIndex;drawPictrueData.ChartDrawPicture.IsSelected=true;this.CurrentChartDrawPicture=drawPictrueData.ChartDrawPicture;this.SelectChartDrawPicture=drawPictrueData.ChartDrawPicture;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_DRAWPICTURE);//选中画图工具事件
|
|
8215
8216
|
if(event&&event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};event.Callback(event,sendData,this);}if(e.cancelable)e.preventDefault();return;}}}else{if(this.EnableScrollUpDown==true){this.DragTimer=setTimeout(function(){self.IsPress=true;if(drag.Click.X==drag.LastMove.X&&drag.Click.Y==drag.LastMove.Y){var mouseDrag=self.MouseDrag;self.MouseDrag=null;T_ShowCorssCursor();self.PreventTouchEvent(e);}},800);}this.MouseDrag=drag;this.PhoneTouchInfo={Start:{X:touches[0].clientX,Y:touches[0].clientY},End:{X:touches[0].clientX,Y:touches[0].clientY}};this.SelectChartDrawPicture=null;var bStartTimer=true;//长按计时开始
|
|
8216
|
-
if(this.EnableClickModel){if(this.ClickModel.IsShowCorssCursor==true)bStartTimer=false;else bStartTimer=true;}if(bStartTimer){this.StopDragTimer();this.DragTimer=setTimeout(function(){
|
|
8217
|
-
{
|
|
8218
|
-
var x=drag.Click.X;var y=drag.Click.Y;if(
|
|
8217
|
+
if(this.EnableClickModel){if(this.ClickModel.IsShowCorssCursor==true)bStartTimer=false;else bStartTimer=true;}if(bStartTimer){this.StopDragTimer();this.DragTimer=setTimeout(function(){_this26.IsPress=true;if(drag.Click.X==drag.LastMove.X&&drag.Click.Y==drag.LastMove.Y)//手指没有移动,出现十字光标
|
|
8218
|
+
{_this26.MouseDrag=null;//移动十字光标
|
|
8219
|
+
var x=drag.Click.X;var y=drag.Click.Y;if(_this26.EnableClickModel===true)_this26.ClickModel.IsShowCorssCursor=true;self.MoveCorssCursor(drag.Click,e);//移动十字光标
|
|
8219
8220
|
}},this.PressTime);}else if(!this.EnableClickModel){if(this.EnableScrollUpDown==false)T_ShowCorssCursor();//移动十字光标
|
|
8220
8221
|
else if(this.IsClickShowCorssCursor)T_ShowCorssCursor();}}if(this.EnableZoomIndexWindow){this.PhoneDBClick.AddTouchStart(touches[0].clientX,touches[0].clientY,Date.now());JSConsole.Chart.Log("[MinuteChartContainer::OnTouchStart] PhoneDBClick ",this.PhoneDBClick);}this.TouchEvent({EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH,FunctionName:"OnTouchStart"},e);}else if(this.IsPhonePinching(e)){var phonePinch={"Start":{},"Last":{}};var touches=this.GetToucheData(e,this.IsForceLandscape);phonePinch.Start={"X":touches[0].pageX,"Y":touches[0].pageY,"X2":touches[1].pageX,"Y2":touches[1].pageY};phonePinch.Last={"X":touches[0].pageX,"Y":touches[0].pageY,"X2":touches[1].pageX,"Y2":touches[1].pageY};this.PhonePinch=phonePinch;this.SelectChartDrawPicture=null;}};this.OnTouchMove=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var touches=this.GetToucheData(e,this.IsForceLandscape);if(this.IsPhoneDragging(e)){var drag=this.MouseDrag;if(drag==null){var pixelTatio=GetDevicePixelRatio();var x=touches[0].clientX-uielement.getBoundingClientRect().left*pixelTatio;var y=touches[0].clientY-uielement.getBoundingClientRect().top*pixelTatio;this.OnMouseMove(x,y,e);}else{var moveAngle=this.GetMoveAngle(drag.LastMove,{X:touches[0].clientX,Y:touches[0].clientY});var moveSetp=Math.abs(drag.LastMove.X-touches[0].clientX);var moveUpDown=Math.abs(drag.LastMove.Y-touches[0].clientY);moveSetp=parseInt(moveSetp);if(this.CurrentChartDrawPicture&&this.CurrentChartDrawPicture.EnableMove===true){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==1||drawPicture.Status==2){if(moveSetp<5&&moveUpDown<5)return;if(this.SetChartDrawPictureSecondPoint(touches[0].clientX,touches[0].clientY,true)){this.DrawDynamicInfo();}}else if(drawPicture.Status==3){if(this.SetChartDrawPictureThirdPoint(touches[0].clientX,touches[0].clientY,true)){this.DrawDynamicInfo();}}else if(drawPicture.Status==20)//画图工具移动
|
|
8221
8222
|
{if(moveSetp<5&&moveUpDown<5)return;if(this.MoveChartDrawPicture(touches[0].clientX-drag.LastMove.X,touches[0].clientY-drag.LastMove.Y,true)){this.DrawDynamicInfo();}}drag.LastMove.X=touches[0].clientX;drag.LastMove.Y=touches[0].clientY;}else if(this.EnableClickModel&&this.ClickModel.IsShowCorssCursor===false){//点击模式 十字光标隐藏 不做任何操作
|
|
@@ -8254,18 +8255,18 @@ if(this.ChartCorssCursor)bShowCorss=this.ChartCorssCursor.IsShowCorss;var aryMen
|
|
|
8254
8255
|
if(this.SelectedChart.EnableSelected){selectedChart=this.PtInChart(x,y);}var dbClickInfo={SelectedChart:selectedChart};this.DBClickEvent(dbClickInfo,e);//没有图形选中,双击缩放窗口
|
|
8255
8256
|
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);};//创建
|
|
8256
8257
|
//windowCount 窗口个数
|
|
8257
|
-
this.Create=function(windowCount,option){var
|
|
8258
|
-
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return
|
|
8258
|
+
this.Create=function(windowCount,option){var _this27=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8259
|
+
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return _this27.PtInClient(x,y);};this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_Minute_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this27.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this27.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ShareAfterVol=this.ShareAfterVol;this.ChartCorssCursor.CallAcutionXOperator=new CallAcutionXOperator();this.ChartCorssCursor.GetEventCallback=function(id){return _this27.GetEventCallback(id);};//创建等待提示
|
|
8259
8260
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
8260
|
-
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
|
|
8261
|
+
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 _this27.GetExtendChartRightWidth();};this.Frame.GetEventCallback=function(id){return _this27.GetEventCallback(id);};this.Frame.ZoomStartWindowIndex=2;this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
|
|
8261
8262
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();this.CreateExtendChart("RectSelectPaint",option?option.SelectRect:null);//区间统计
|
|
8262
8263
|
if(this.EnableIndexChartDrag)this.CreateExtendChart("DragMovePaint");this.CreateDragSelectRect(option?option.DragSelectRect:null);//子窗口动态标题
|
|
8263
|
-
for(var i=0;i<this.Frame.SubFrame.length;++i){var titlePaint=new DynamicChartTitlePainting();if(i==0||i==1)titlePaint.IsShowMainIndexTitle=false;titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return
|
|
8264
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
8264
|
+
for(var i=0;i<this.Frame.SubFrame.length;++i){var titlePaint=new DynamicChartTitlePainting();if(i==0||i==1)titlePaint.IsShowMainIndexTitle=false;titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this27.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;titlePaint.MainTitlePaint=this.TitlePaint[0];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){_this27.OnKeyDown(e);},true);//键盘消息
|
|
8265
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this27.OnWheel(e);},true);//上下滚动消息
|
|
8265
8266
|
};//创建子窗口
|
|
8266
|
-
this.CreateChildWindow=function(windowCount){var
|
|
8267
|
-
frame.XPointCount=243;frame.GlobalOption=this.GlobalOption;frame.HQChart=this;frame.GetEventCallback=function(id){return
|
|
8268
|
-
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();frame.FrameData.SubFrameItem=subFrame;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
|
|
8267
|
+
this.CreateChildWindow=function(windowCount){var _this28=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;frame.HQChart=this;frame.GetEventCallback=function(id){return _this28.GetEventCallback(id);};if(i>=2){}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 _this28.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 _this28.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 _this28.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();frame.FrameData.SubFrameItem=subFrame;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 _this29=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;//窗口序号
|
|
8268
|
+
frame.XPointCount=243;frame.GlobalOption=this.GlobalOption;frame.HQChart=this;frame.GetEventCallback=function(id){return _this29.GetEventCallback(id);};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 _this29.GetEventCallback(id);};frame.YSplitOperator.GetEventCallback=function(id){return _this29.GetEventCallback(id);};frame.XSplitOperator.Symbol=this.Symbol;if(this.DayCount>1){var dayCount=this.DayCount;if(IFrameSplitOperator.IsNonEmptyArray(this.DayData))dayCount=this.DayData.length;frame.XSplitOperator.DayCount=dayCount;frame.XSplitOperator.DayData=this.DayData;frame.DayCount=dayCount;}//K线数据绑定
|
|
8269
|
+
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();frame.FrameData.SubFrameItem=subFrame;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 _this30=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 _this30.GetEventCallback(id);};titlePaint.MainTitlePaint=this.TitlePaint[0];this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
|
|
8269
8270
|
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();//更新数据偏移
|
|
8270
8271
|
this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
8271
8272
|
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;}}};//删除某一个窗口的指标
|
|
@@ -8276,8 +8277,8 @@ subFrame.YSpecificMaxMin=null;subFrame.IsLocked=false;//解除上锁
|
|
|
8276
8277
|
subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType;//还原Y坐标分割模式
|
|
8277
8278
|
this.ChartPaint=paint;//清空东条标题
|
|
8278
8279
|
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线画法
|
|
8279
|
-
this.CreateMainKLine=function(){var
|
|
8280
|
-
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
|
|
8280
|
+
this.CreateMainKLine=function(){var _this31=this;//分钟线
|
|
8281
|
+
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 _this31.GetEventCallback(id);};this.ChartPaint[0]=minuteLine;//分钟线均线
|
|
8281
8282
|
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;//成交量
|
|
8282
8283
|
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;//绑定叠加
|
|
8283
8284
|
this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].CallAcutionXOperator=new CallAcutionXOperator();this.TitlePaint[0].CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;this.TitlePaint[0].HQChart=this;};//切换成 脚本指标
|
|
@@ -8292,19 +8293,19 @@ this.UpdataDataoffset();//更新数据偏移
|
|
|
8292
8293
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
8293
8294
|
this.Draw();};this.ChangeIndex=function(windowIndex,indexName,option){if(this.Frame.SubFrame.length<3)return;if(option&&option.API)return this.ChangeAPIIndex(windowIndex,option);//查找系统指标
|
|
8294
8295
|
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;JSIndexScript.ModifyAttribute(indexInfo,option);return this.ChangeScriptIndex(windowIndex,indexInfo,option);};//设置指标窗口个数
|
|
8295
|
-
this.ChangeIndexWindowCount=function(count){var
|
|
8296
|
+
this.ChangeIndexWindowCount=function(count){var _this32=this;if(count<2)return;//1,2个窗口固定的不能动
|
|
8296
8297
|
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);this.DeleteChartPaintExtend({WindowIndex: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);this.TitlePaint.splice(count+1,currentLength-count);}else{//创建新的指标窗口
|
|
8297
|
-
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
|
|
8298
|
+
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 _this32.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;titlePaint.MainTitlePaint=this.TitlePaint[0];this.TitlePaint[i+1]=titlePaint;}//创建指标
|
|
8298
8299
|
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);//脚本执行
|
|
8299
8300
|
var bindData=this.SourceData;this.BindIndexData(i,bindData);//执行脚本
|
|
8300
8301
|
}//最后一个显示X轴坐标
|
|
8301
8302
|
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();//更新数据偏移
|
|
8302
8303
|
}this.UpdateXShowText();this.Frame.SetSizeChage(true);this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
8303
8304
|
this.Draw();};this.ChangeIndexTemplate=function(option)//切换指标模板 可以设置指标窗口个数 每个窗口的指标, 只能从第3个指标窗口开始设置,前面2个指标窗口固定无法设置
|
|
8304
|
-
{var
|
|
8305
|
+
{var _this33=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,symbol=null;if(IFrameSplitOperator.IsNumber(option.DayCount)&&option.DayCount!=this.DayCount)dayCount=option.DayCount;//天数
|
|
8305
8306
|
if(option.Symbol)symbol=option.Symbol;var bRefreshData=dayCount!=null||symbol!=null;//清空所有的指标图型
|
|
8306
8307
|
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);this.TitlePaint.splice(count+1,currentLength-count);}else{for(var i=currentLength;i<count;++i)//创建新的指标窗口
|
|
8307
|
-
{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
|
|
8308
|
+
{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 _this33.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;titlePaint.MainTitlePaint=this.TitlePaint[0];this.TitlePaint[i+1]=titlePaint;}}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)//自定义指标脚本
|
|
8308
8309
|
{this.WindowIndex[windowIndex]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
|
|
8309
8310
|
}else if(item.API)//后台指标
|
|
8310
8311
|
{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 systemScript=new JSIndexScript();var indexInfo=systemScript.Get(indexID);if(indexInfo){JSIndexScript.ModifyAttribute(indexInfo,item);this.WindowIndex[windowIndex]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
|
|
@@ -8544,8 +8545,8 @@ else this.ClearBindOverlayPositionData();this.TitlePaint[0].Data=this.SourceData
|
|
|
8544
8545
|
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;//十字光标
|
|
8545
8546
|
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=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];item.MainData=minuteData;//绑定主图数据
|
|
8546
8547
|
}};//绑定分钟叠加指标数据(持仓量)
|
|
8547
|
-
this.BindOverlayPositionData=function(minuteData,yClose){var
|
|
8548
|
-
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
|
|
8548
|
+
this.BindOverlayPositionData=function(minuteData,yClose){var _this34=this;if(this.Frame.SubFrame.length<2)return;var chart=null;var frame=null;var subFrame=this.Frame.SubFrame[1];//第2个窗口
|
|
8549
|
+
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 _this34.GetEventCallback(id);};frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;frame.YSplitOperator.FloatPrecision=0;//持仓量 整数
|
|
8549
8550
|
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;//右边坐标绑定到主坐标上
|
|
8550
8551
|
}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)//图形不存在就创建一个
|
|
8551
8552
|
{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个窗口
|
|
@@ -8555,12 +8556,12 @@ this.AddOverlayIndex=function(obj){var overlay=this.CreateOverlayWindowsIndex(ob
|
|
|
8555
8556
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
8556
8557
|
this.Draw();};//创建一个叠加指标
|
|
8557
8558
|
this.CreateOverlayWindowsIndex=function(obj)//{WindowIndex:, IndexName:, Identify:, ShowRightText:, API:}
|
|
8558
|
-
{var
|
|
8559
|
+
{var _this35=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)//动态执行脚本
|
|
8559
8560
|
{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);//系统指标
|
|
8560
8561
|
if(!indexInfo){indexCustom=JSIndexMap.Get(indexName);//定制指标
|
|
8561
8562
|
if(!indexCustom){console.warn('[MinuteChartContainer::CreateOverlayIndex] can not find index['+indexName+']');return null;}}}var subFrame=this.Frame.SubFrame[windowIndex];var overlayFrame=new OverlayIndexItem();if(obj.Identify)overlayFrame.Identify=obj.Identify;//由外部指定id
|
|
8562
8563
|
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(IFrameSplitOperator.IsBool(obj.ShowRightText))frame.IsShow=obj.ShowRightText;if(IFrameSplitOperator.IsBool(obj.IsShareY))frame.IsShareY=obj.IsShareY;if(IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin))frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin;//是否计算Y最大最小值
|
|
8563
|
-
if(IFrameSplitOperator.IsNumber(obj.IsShowMainFrame))frame.IsShowMainFrame=obj.IsShowMainFrame;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
|
|
8564
|
+
if(IFrameSplitOperator.IsNumber(obj.IsShowMainFrame))frame.IsShowMainFrame=obj.IsShowMainFrame;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.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};//叠加指标信息
|
|
8564
8565
|
overlayFrame.Script=apiIndex;}else if(indexInfo){JSIndexScript.ModifyAttribute(indexInfo,obj);var scriptIndex=new OverlayScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
|
|
8565
8566
|
scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
|
|
8566
8567
|
overlayFrame.Script=scriptIndex;}else{var scriptIndex=indexCustom.Create();scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
|
|
@@ -8597,8 +8598,8 @@ if(option)drawPicture.SetOption(option);var self=this;drawPicture.Update=functio
|
|
|
8597
8598
|
{self.DrawDynamicInfo();};drawPicture.GetActiveDrawPicture=function(){return self.GetActiveDrawPicture();};this.CurrentChartDrawPicture=drawPicture;JSConsole.Chart.Log("[MinuteChartContainer::CreateChartDrawPicture] ",name,this.CurrentChartDrawPicture);return true;};//手动添加画线
|
|
8598
8599
|
this.AddChartDrawPicture=function(obj){if(!obj)return null;if(obj.FrameID<0||obj.FrameID>=this.Frame.SubFrame.length)return null;var self=this;var item=IChartDrawPicture.GetDrawPictureByClassName(obj.ClassName);if(!item)return null;var drawPicture=item.Create();drawPicture.Canvas=this.Canvas;drawPicture.Status=10;drawPicture.Frame=this.Frame.SubFrame[obj.FrameID].Frame;//绑定框架坐标
|
|
8599
8600
|
drawPicture.Symbol=this.Symbol;drawPicture.Period=888888888;if(obj.Value)drawPicture.Value=obj.Value;if(obj.Guid)drawPicture.Guid=obj.Guid;if(drawPicture.ImportStorageData)drawPicture.ImportStorageData(obj);drawPicture.SetOption(obj);if(obj.EnableUpdateXValue)drawPicture.UpdateXValue();drawPicture.ValueToPoint();drawPicture.GetActiveDrawPicture=function(){return self.GetActiveDrawPicture();};if(drawPicture.ClassName==='ChartDrawPictureText')drawPicture.IsInitialized=true;this.ChartDrawPicture.push(drawPicture);if(obj.Draw==true)this.DrawDynamicInfo();return drawPicture;};this.ReloadChartDrawPicture=function(){this.ChartDrawPicture=[];if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.IsSelected=false;this.SelectChartDrawPicture=null;this.CurrentChartDrawPicture=null;this.MoveOnChartDrawPicture=null;if(this.ChartDrawStorage){this.ChartDrawStorageCache=this.ChartDrawStorage.GetDrawData({Symbol:this.Symbol,Period:888888888});}};this.CreateChartDrawPictureByStorage=function()//把缓存(this.ChartDrawStorageCache) 画图工具创建出来
|
|
8600
|
-
{var
|
|
8601
|
-
if(drawPicture.ImportStorageData)drawPicture.ImportStorageData(item);drawPicture.ResetXValue();drawPicture.UpdateXValue();drawPicture.ValueToPoint();drawPicture.GetActiveDrawPicture=function(){return
|
|
8601
|
+
{var _this36=this;if(!this.ChartDrawStorageCache||this.ChartDrawStorageCache.length<=0)return;var self=this;for(var i=0;i<this.ChartDrawStorageCache.length;++i){var item=this.ChartDrawStorageCache[i];if(item.FrameID<0||!this.Frame.SubFrame||this.Frame.SubFrame.length<item.FrameID)continue;var drawPicture=IChartDrawPicture.CreateChartDrawPicture(item);if(!drawPicture)continue;drawPicture.Canvas=this.Canvas;drawPicture.Status=10;drawPicture.Frame=this.Frame.SubFrame[item.FrameID].Frame;//绑定框架坐标
|
|
8602
|
+
if(drawPicture.ImportStorageData)drawPicture.ImportStorageData(item);drawPicture.ResetXValue();drawPicture.UpdateXValue();drawPicture.ValueToPoint();drawPicture.GetActiveDrawPicture=function(){return _this36.GetActiveDrawPicture();};if(drawPicture.ClassName==='ChartDrawPictureText')drawPicture.IsInitialized=true;this.ChartDrawPicture.push(drawPicture);}this.ChartDrawStorageCache=null;//清空缓存
|
|
8602
8603
|
};this.SetSizeChange=function(bChanged){this.Frame.SetSizeChage(bChanged);for(var i in this.ExtendChartPaint){var item=this.ExtendChartPaint[i];item.SizeChange=bChanged;}};this.SetSizeChage=this.SetSizeChange;//根据X坐标获取数据索引
|
|
8603
8604
|
this.GetDataIndexByPoint=function(x){var frame=this.Frame;if(this.Frame.SubFrame&&this.Frame.SubFrame.length>0)frame=this.Frame.SubFrame[0].Frame;if(!frame)return;var value=frame.GetXData(x);var index=parseInt(value.toFixed(0));return index;};//不支持未来时间 目前只支持主图
|
|
8604
8605
|
this.GetDateTimeByPoint=function(x,y){var clientPos=this.PtInClient_V2(x,y);// 100-199=多日分时主图 200-299=盘前 300-399=盘后 1=主图 2=盘前 3=盘后
|
|
@@ -8800,19 +8801,19 @@ if(this.DataMove(moveSetp,isLeft)){this.UpdataDataoffset();this.UpdatePointByCur
|
|
|
8800
8801
|
{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//缩小
|
|
8801
8802
|
{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;};//创建
|
|
8802
8803
|
//windowCount 窗口个数
|
|
8803
|
-
this.Create=function(windowCount){var
|
|
8804
|
-
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;this.ChartCorssCursor.GetEventCallback=function(id){return
|
|
8804
|
+
this.Create=function(windowCount){var _this37=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8805
|
+
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;this.ChartCorssCursor.GetEventCallback=function(id){return _this37.GetEventCallback(id);};//创建等待提示
|
|
8805
8806
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
8806
8807
|
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;//十字光标绑定框架
|
|
8807
8808
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();//子窗口动态标题
|
|
8808
|
-
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
|
|
8809
|
+
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);//键盘消息
|
|
8809
8810
|
};//创建子窗口
|
|
8810
|
-
this.CreateChildWindow=function(windowCount){var
|
|
8811
|
+
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.GetExtraCanvas=function(name){return _this38.GetExtraCanvas(name);};frame.ChartBorder=border;frame.Identify=i;//窗口序号
|
|
8811
8812
|
frame.RightSpaceCount=this.RightSpaceCount;//右边
|
|
8812
|
-
frame.GetEventCallback=function(id){return
|
|
8813
|
+
frame.GetEventCallback=function(id){return _this38.GetEventCallback(id);};frame.GlobalOption=this.GlobalOption;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);};frame.YSplitOperator.HQChart=this;//主图上下间距
|
|
8813
8814
|
var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
8814
|
-
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.YSplitOperator.GetEventCallback=function(id){return
|
|
8815
|
-
}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
|
|
8815
|
+
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.YSplitOperator.GetEventCallback=function(id){return _this38.GetEventCallback(id);};frame.YSplitOperator.HQChart=this;//frame.IsLocked = true;
|
|
8816
|
+
}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();frame.FrameData.SubFrameItem=subFrame;subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;}};this.CreateStockChipPhone=function(option){var chart=new StockChipPhone();chart.Canvas=this.Canvas;chart.ChartBorder=this.Frame.ChartBorder;chart.ChartFrame=this.Frame;chart.HQChart=this;chart.Left=this.Frame.ChartBorder.Bottom;//左边间距使用当前框架间距
|
|
8816
8817
|
chart.SetOption(option);this.ExtendChartPaint.push(chart);this.Frame.ChartBorder.Bottom+=chart.Width;//创建筹码需要增加右边的间距
|
|
8817
8818
|
this.GlobalOption.RightHorizontal.Show=false;return chart;};this.DeleteStockChipChart=function(){var stockChip=this.GetStockChipChart();if(!stockChip)return;var chipWidth=stockChip.Chart.Width;this.DeleteExtendChart(stockChip);this.Frame.ChartBorder.Bottom-=chipWidth;if(stockChip.Chart.ClassName=="StockChipPhone"){this.GlobalOption.RightHorizontal.Show=true;this.Frame.ResetXYSplit();}this.SetSizeChange(true);this.Draw();};}////////////////////////////////////////////////////////////////////////////////
|
|
8818
8819
|
// 走势图横屏显示
|
|
@@ -8820,14 +8821,14 @@ this.GlobalOption.RightHorizontal.Show=false;return chart;};this.DeleteStockChip
|
|
|
8820
8821
|
function MinuteChartHScreenContainer(uielement){this.newMethod=MinuteChartContainer;//派生
|
|
8821
8822
|
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);};//创建
|
|
8822
8823
|
//windowCount 窗口个数
|
|
8823
|
-
this.Create=function(windowCount){var
|
|
8824
|
-
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return
|
|
8824
|
+
this.Create=function(windowCount){var _this39=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8825
|
+
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();this.ChartCorssCursor.GetEventCallback=function(id){return _this39.GetEventCallback(id);};//创建等待提示
|
|
8825
8826
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
8826
8827
|
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;//十字光标绑定框架
|
|
8827
8828
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();//子窗口动态标题
|
|
8828
|
-
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
|
|
8829
|
+
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);//键盘消息
|
|
8829
8830
|
};//创建子窗口
|
|
8830
|
-
this.CreateChildWindow=function(windowCount){var
|
|
8831
|
+
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;frame.HQChart=this;frame.GetEventCallback=function(id){return _this40.GetEventCallback(id);};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();frame.FrameData.SubFrameItem=subFrame;subFrame.Frame=frame;if(i==0)subFrame.Height=20;else subFrame.Height=10;this.Frame.SubFrame[i]=subFrame;}};}/////////////////////////////////////////////////////////////////////////////////
|
|
8831
8832
|
// 深度图
|
|
8832
8833
|
//
|
|
8833
8834
|
function DepthChartContainer(uielement){this.newMethod=JSChartContainer;//派生
|
|
@@ -8835,7 +8836,7 @@ this.newMethod(uielement);delete this.newMethod;this.ClassName="DepthChartContai
|
|
|
8835
8836
|
this.MapAsk=new _map2.default();this.MapBid=new _map2.default();this.IsAutoUpdate=false;//是否自动更新行情数据
|
|
8836
8837
|
this.AutoUpdateFrequency=30000;//30秒更新一次数据
|
|
8837
8838
|
this.AutoUpdateTimer;this.DefaultZoom=0.8;//默认显示80%的盘口 (0 - 1)
|
|
8838
|
-
this.MaxVolRate=1.1;this.Create=function(option){var
|
|
8839
|
+
this.MaxVolRate=1.1;this.Create=function(option){var _this41=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8839
8840
|
this.ChartCorssCursor=new DepthChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.HQChart=this;//this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");
|
|
8840
8841
|
//this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;
|
|
8841
8842
|
//this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");
|
|
@@ -8843,9 +8844,9 @@ this.ChartCorssCursor=new DepthChartCorssCursor();this.ChartCorssCursor.Canvas=t
|
|
|
8843
8844
|
//创建等待提示
|
|
8844
8845
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);//创建框架
|
|
8845
8846
|
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;
|
|
8846
|
-
ySplitOper.ChartBorder=this.Frame.ChartBorder;ySplitOper.GetEventCallback=function(id){return
|
|
8847
|
-
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){
|
|
8848
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
8847
|
+
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;//十字光标绑定框架
|
|
8848
|
+
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);//键盘消息
|
|
8849
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this41.OnWheel(e);},true);//上下滚动消息
|
|
8849
8850
|
};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;//是否允许缩放
|
|
8850
8851
|
if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Wheel===false)enableZoomUpDown=false;if(isInClient&&wheelValue<0&&enableZoomUpDown)//缩小
|
|
8851
8852
|
{if(this.Frame.ZoomDown()){this.UpdateFrameMaxMin();this.Draw();}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
|
|
@@ -8917,11 +8918,11 @@ this.BarPosition=1;//柱子方向 0=左边 1=右边
|
|
|
8917
8918
|
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=[];//清空
|
|
8918
8919
|
}else{frame=hqChart.Frame.SubFrame[windowIndex].Frame;hqChart.DeleteIndexPaint(windowIndex);//清空
|
|
8919
8920
|
}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;}};//请求数据
|
|
8920
|
-
this.RequestData=function(hqChart,windowIndex,hisData,option){var
|
|
8921
|
+
this.RequestData=function(hqChart,windowIndex,hisData,option){var _this42=this;this.CancelRequestTimer();var T_RequestData=function T_RequestData(){//请求数据
|
|
8921
8922
|
var klineChart=hqChart.ChartPaint[0];//获取当前K线图实例
|
|
8922
8923
|
var kData=klineChart.Data;//K线数据
|
|
8923
8924
|
if(!kData||IFrameSplitOperator.IsNonEmptyArray(!kData.Data))return;var pageKRange=klineChart.DrawKRange;//当前显示的K线索引
|
|
8924
|
-
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:
|
|
8925
|
+
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)//页面缩放或移动延迟更新
|
|
8925
8926
|
{this.RequestTimer=setTimeout(function(){T_RequestData();},this.DelayRequestFrequency);}else{T_RequestData();}return true;};this.OnRecvVolumeProfileData=function(data){this.BindData(data);this.HQChart.UpdataDataoffset();//更新数据偏移
|
|
8926
8927
|
this.HQChart.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
8927
8928
|
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
|
|
@@ -11203,21 +11204,21 @@ var symbol=readArgument.Value;//支持 SH60000, SZ000001
|
|
|
11203
11204
|
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)//复制参数
|
|
11204
11205
|
{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= (代码,周期),指标(参数) => 输出
|
|
11205
11206
|
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;
|
|
11206
|
-
this.CallMemberScriptIndex=function(job){var
|
|
11207
|
+
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))//读取指标
|
|
11207
11208
|
{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)//复制参数
|
|
11208
11209
|
{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,//复权
|
|
11209
11210
|
Period:indexInfo.PeriodID,//周期
|
|
11210
|
-
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){
|
|
11211
|
+
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,
|
|
11211
11212
|
IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:dateTimeRange//K线数据范围
|
|
11212
11213
|
};//执行脚本
|
|
11213
|
-
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){
|
|
11214
|
+
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_this43.ExecuteScriptIndexError(error,indexInfo);});};this.CallDynamicScriptIndex=function(job,varTable){var _this44=this;var callInfo=job.DynamicName;var indexInfo={Job:job,PeriodID:this.Period,Symbol:this.Symbol};if(!this.ReadIndexFunctionValue(callInfo,indexInfo))//读取指标
|
|
11214
11215
|
{var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallDynamicScriptIndex() Error: \''+callInfo+'\' '+indexInfo.Error);}var systemIndex=new JSIndexScript();//系统指标
|
|
11215
11216
|
var systemItem=systemIndex.Get(indexInfo.Name);if(!systemItem){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallDynamicScriptIndex() Error: \''+callInfo+'\' '+indexInfo.Name+' \u6307\u6807\u4E0D\u5B58\u5728');}indexInfo.SytemIndex=systemItem;if(!this.ReadDynamicIndexArgumentValue(job.Args,indexInfo,varTable)){var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallDynamicScriptIndex() '+indexInfo.Name+' \u6307\u6807\u53C2\u6570\u9519\u8BEF : '+indexInfo.Error+' ');}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,//复权
|
|
11216
11217
|
Period:indexInfo.PeriodID,//周期
|
|
11217
|
-
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){
|
|
11218
|
+
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this44.RecvDynamicScriptIndexData(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,
|
|
11218
11219
|
IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:dateTimeRange//K线数据范围
|
|
11219
11220
|
};//执行脚本
|
|
11220
|
-
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){
|
|
11221
|
+
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_this44.ExecuteScriptIndexError(error,indexInfo);});};this.ReadDynamicIndexArgumentValue=function(args,result,varTable){result.Args=[];for(var i=0;i<result.SytemIndex.Args.length;++i)//复制参数
|
|
11221
11222
|
{var item=result.SytemIndex.Args[i];result.Args.push({Value:item.Value,Name:item.Name,IsDefault:true});}if(!IFrameSplitOperator.IsNonEmptyArray(args))return true;for(var i=0;i<args.length;++i){var item=args[i];var argItem=result.Args[i];if(!argItem)continue;if(item.Type==Syntax.Literal){argItem.Value=item.Value;argItem.IsDefault=false;}else if(item.Type==Syntax.Identifier)//支持传参
|
|
11222
11223
|
{if(varTable.has(item.Name)){argItem.Value=varTable.get(item.Name);argItem.IsDefault=false;}}}return true;};/*****************************************************************************************************************************
|
|
11223
11224
|
脚本调用
|
|
@@ -11234,16 +11235,16 @@ var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_t
|
|
|
11234
11235
|
|
|
11235
11236
|
"MA.MA1"(6,12,18)
|
|
11236
11237
|
|
|
11237
|
-
*******************************************************************************************************************************/this.CallScriptIndex=function(job,varTable){var
|
|
11238
|
+
*******************************************************************************************************************************/this.CallScriptIndex=function(job,varTable){var _this45=this;if(job.Member)return this.CallMemberScriptIndex(job);if(job.DynamicName)return this.CallDynamicScriptIndex(job,varTable);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))//读取代码
|
|
11238
11239
|
{var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() Error: '+indexInfo.Error);}if(!this.ReadIndexFunctionValue(job.Args[1],indexInfo))//读取指标
|
|
11239
11240
|
{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))//读取返回值索引
|
|
11240
11241
|
{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;//系统指标
|
|
11241
11242
|
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,//复权
|
|
11242
11243
|
Period:indexInfo.PeriodID,//周期
|
|
11243
|
-
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){
|
|
11244
|
+
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this45.RecvScriptIndexData(outVar,job,symbolData);_this45.Execute.RunNextJob();},CallbackParam:indexInfo,Async:true,MaxRequestDataCount:this.MaxRequestDataCount+30*2,MaxRequestMinuteDayCount:this.MaxRequestMinuteDayCount+2,Arguments:indexInfo.Args,//Condition:this.Condition,
|
|
11244
11245
|
IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:DateTimeRange//K线数据范围
|
|
11245
11246
|
};//执行脚本
|
|
11246
|
-
var run=JSComplier.Execute(indexInfo.SytemIndex.Script,option,function(error,indexInfo){
|
|
11247
|
+
var run=JSComplier.Execute(indexInfo.SytemIndex.Script,option,function(error,indexInfo){_this45.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);//保存所有的指标数据, 下面用到了就可以不用算了
|
|
11247
11248
|
for(var i in data){var key=outVar[i].Name;if(indexInfo.Period)key+='#'+indexInfo.Period;//带周期的变量
|
|
11248
11249
|
memberValue[key]=data[i].Data;}};this.RecvDynamicScriptIndexData=function(outVar,indexInfo,symbolData){JSConsole.Complier.Log('[JSSymbolData::RecvDynamicScriptIndexData] ',outVar,indexInfo,symbolData);var kLine=symbolData.Data.Data;var aryOutVar=outVar;var data=this.Data.FitKLineIndex(kLine,aryOutVar,this.Period,indexInfo.PeriodID);var objName=indexInfo.Name;var memberValue={};if(this.Execute.VarTable.has(objName))memberValue=this.Execute.VarTable.get(objName);else this.Execute.VarTable.set(objName,memberValue);var strValue="";for(var i=0;i<indexInfo.Args.length;++i){var item=indexInfo.Args[i];if(item.IsDefault===false){if(strValue.length>0)strValue+=",";strValue+=''+item.Value;}}var strArgs='('+strValue+')';//保存所有的指标数据, 下面用到了就可以不用算了
|
|
11249
11250
|
for(var i=0;i<data.length;++i){var key=outVar[i].Name+'#'+strArgs;if(indexInfo.Period)key+='#'+indexInfo.Period;//带周期的变量
|
|
@@ -11417,7 +11418,7 @@ GetMarginJobID:function GetMarginJobID(value){var dataMap=new _map2.default([[1,
|
|
|
11417
11418
|
[10,JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_NEWS_ANALYSIS_PLEDGE]]);if(dataMap.has(value))return dataMap.get(value);return null;},//财务截面数据 分报告期
|
|
11418
11419
|
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
|
|
11419
11420
|
GetSectionReportPeriod:function GetSectionReportPeriod(year,quarter){if(year>=2000&&quarter>=1&&quarter<=4)return{Year:year,Quarter:quarter};return null;}};//专业财务数据
|
|
11420
|
-
var JS_ARRAY_PROFESSIONAL_FINANCE=[{Name:"GPJYVALUE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_GPJYVALUE,Explain:"股票交易类数据GPJYVALUE(ID,N,TYPE)",FuncName:"JSSymbolData::GetGPJYValue",ArgCount:3},{Name:"GPJYONE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_GPJYONE,Explain:"股票交易类数据GPJYONE(ID,N,Y,MMDD)",FuncName:"JSSymbolData::GetGPJYOne",ArgCount:4},{Name:"SCJYVALUE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SCJYVALUE,Explain:"市场交易类数据SCJYVALUE(ID,N,TYPE)",FuncName:"JSSymbolData::GetSCJYValue",ArgCount:3},{Name:"SCJYONE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SCJYONE,Explain:"市场交易类数据SCJYONE(ID,N,Y,MMDD)",FuncName:"JSSymbolData::GetSCJYOne",ArgCount:4},{Name:"BKJYVALUE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_BKJYVALUE,Explain:"板块交易类数据BKJYVALUE(ID,N,TYPE)",FuncName:"JSSymbolData::GetBKJYValue",ArgCount:3},{Name:"BKJYONE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_BKJYONE,Explain:"板块交易类数据BKJYONE(ID,N,Y,MMDD)",FuncName:"JSSymbolData::GetBKJYOne",ArgCount:4},{Name:"FINVALUE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_FINVALUE,Explain:"财务数据FINVALUE(ID)",FuncName:"JSSymbolData::GetFinValue",ArgCount:1},{Name:"FINONE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_FINONE,Explain:"财务数据FINONE(ID,Y,MMDD)",FuncName:"JSSymbolData::GetFinOne",ArgCount:3}];function JSExecute(ast,option){var
|
|
11421
|
+
var JS_ARRAY_PROFESSIONAL_FINANCE=[{Name:"GPJYVALUE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_GPJYVALUE,Explain:"股票交易类数据GPJYVALUE(ID,N,TYPE)",FuncName:"JSSymbolData::GetGPJYValue",ArgCount:3},{Name:"GPJYONE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_GPJYONE,Explain:"股票交易类数据GPJYONE(ID,N,Y,MMDD)",FuncName:"JSSymbolData::GetGPJYOne",ArgCount:4},{Name:"SCJYVALUE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SCJYVALUE,Explain:"市场交易类数据SCJYVALUE(ID,N,TYPE)",FuncName:"JSSymbolData::GetSCJYValue",ArgCount:3},{Name:"SCJYONE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_SCJYONE,Explain:"市场交易类数据SCJYONE(ID,N,Y,MMDD)",FuncName:"JSSymbolData::GetSCJYOne",ArgCount:4},{Name:"BKJYVALUE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_BKJYVALUE,Explain:"板块交易类数据BKJYVALUE(ID,N,TYPE)",FuncName:"JSSymbolData::GetBKJYValue",ArgCount:3},{Name:"BKJYONE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_BKJYONE,Explain:"板块交易类数据BKJYONE(ID,N,Y,MMDD)",FuncName:"JSSymbolData::GetBKJYOne",ArgCount:4},{Name:"FINVALUE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_FINVALUE,Explain:"财务数据FINVALUE(ID)",FuncName:"JSSymbolData::GetFinValue",ArgCount:1},{Name:"FINONE",JobID:JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_FINONE,Explain:"财务数据FINONE(ID,Y,MMDD)",FuncName:"JSSymbolData::GetFinOne",ArgCount:3}];function JSExecute(ast,option){var _this46=this;this.AST=ast;//语法树
|
|
11421
11422
|
this.ErrorHandler=new ErrorHandler();this.VarTable=new _map2.default();//变量表
|
|
11422
11423
|
this.VarDrawTable=new _map2.default();//绘图变量表
|
|
11423
11424
|
this.OutVarTable=[];//输出变量
|
|
@@ -11479,7 +11480,7 @@ this.ConstVarTable=new _map2.default([//个股数据
|
|
|
11479
11480
|
["OFFERCANCELVOL",null],//累计总有效撤卖量,专业版等(资金流向功能)沪深京品种行情专用 累计总有效委卖量-累计总有效撤卖量=总卖+总成交量
|
|
11480
11481
|
["AVGOFFERPX",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=[];//执行的任务队列
|
|
11481
11482
|
this.UpdateUICallback=null;//回调
|
|
11482
|
-
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
|
|
11483
|
+
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 _this46.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;//调试模式信息
|
|
11483
11484
|
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();//绘图变量表
|
|
11484
11485
|
JSConsole.Complier.Log('[JSExecute::Execute] Load Arguments',this.Arguments);for(var _i122 in this.Arguments)//预定义的变量
|
|
11485
11486
|
{var _item18=this.Arguments[_i122];this.VarTable.set(_item18.Name,_item18.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://量比
|
|
@@ -11547,8 +11548,8 @@ else if(_value4.indexOf("FONTSIZE")==0){var strFontSize=_value4.replace("FONTSIZ
|
|
|
11547
11548
|
{var _outVar13=this.VarTable.get(_varName3);var _value11={Name:_varName3,Data:_outVar13,Type:9};if(color)_value11.Color=color;if(upColor)_value11.UpColor=upColor;if(downColor)_value11.DownColor=downColor;if(lineWidth)_value11.LineWidth=lineWidth;this.OutVarTable.push(_value11);}else if(colorStick&&_varName3)//CYW: SUM(VAR4,10)/10000, COLORSTICK; 画上下柱子
|
|
11548
11549
|
{var _outVar14=this.VarTable.get(_varName3);var _value12={Name:_varName3,Data:_outVar14,Color:color,Type:2};if(lineWidth)_value12.LineWidth=lineWidth;if(color)_value12.Color=color;if(upColor)_value12.UpColor=upColor;if(downColor)_value12.DownColor=downColor;this.OutVarTable.push(_value12);}else if(_varName3&&color&&!_draw3){var _outVar15=this.VarTable.get(_varName3);if(!Array.isArray(_outVar15))_outVar15=this.SingleDataToArrayData(_outVar15);var _value13={Name:_varName3,Data:_outVar15,Color:color,Type:0};if(lineWidth)_value13.LineWidth=lineWidth;if(isShow==false)_value13.IsShow=false;if(isExData==true)_value13.IsExData=true;if(isDotLine==true)_value13.IsDotLine=true;if(IFrameSplitOperator.IsNonEmptyArray(lineDash))_value13.LineDash=lineDash;if(isOverlayLine==true)_value13.IsOverlayLine=true;if(isSingleLine==true)_value13.IsSingleLine=true;if(isNoneName==true)_value13.NoneName=true;if(isShowTitle==false)_value13.IsShowTitle=false;if(stepLine==true)_value13.Type=7;this.OutVarTable.push(_value13);}else if(_draw3)//画图函数
|
|
11549
11550
|
{var outVar={Name:_draw3.Name,Draw:_draw3,Type:1};if(color)outVar.Color=color;if(isDotLine==true)outVar.IsDotLine=true;if(IFrameSplitOperator.IsNonEmptyArray(lineDash))outVar.LineDash=lineDash;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;if(IFrameSplitOperator.IsBool(isFirstDraw))outVar.IsFirstDraw=isFirstDraw;if(IFrameSplitOperator.IsNumber(klineType))outVar.KLineType=klineType;this.OutVarTable.push(outVar);}else if(_varName3){var _outVar16=this.VarTable.get(_varName3);var _value14={Name:_varName3,Data:_outVar16,Type:0};if(color)_value14.Color=color;if(lineWidth)_value14.LineWidth=lineWidth;if(isShow==false)_value14.IsShow=false;if(isExData==true)_value14.IsExData=true;if(isDotLine==true)_value14.IsDotLine=true;if(IFrameSplitOperator.IsNonEmptyArray(lineDash))_value14.LineDash=lineDash;if(isOverlayLine==true)_value14.IsOverlayLine=true;if(isSingleLine==true)_value14.IsSingleLine=true;if(isShowTitle==false)_value14.IsShowTitle=false;if(stepLine==true)_value14.Type=7;this.OutVarTable.push(_value14);}}}};this.ReadUnaryExpression=function(item,varInfo){var argument=item.Argument;var outVar=null;if(argument.Type==Syntax.Literal){outVar=argument.Value;if(!Array.isArray(outVar))outVar=this.SingleDataToArrayData(outVar);}else if(argument.Type==Syntax.Identifier){var varName=argument.Name;outVar=this.ReadVariable(varName,item.Expression);if(!Array.isArray(outVar))outVar=this.SingleDataToArrayData(outVar);}else if(argument.Type==Syntax.BinaryExpression){outVar=argument.Out;if(!Array.isArray(outVar))outVar=this.SingleDataToArrayData(outVar);}else if(argument.Type==Syntax.CallExpression){var callItem=argument;if(this.Draw.IsDrawFunction(callItem.Callee.Name)){return false;}else if(callItem.Callee.Name==="IFC"&&callItem.Draw){return false;}else{outVar=callItem.Out;if(!Array.isArray(outVar))outVar=this.SingleDataToArrayData(outVar);}}else{return false;}if(item.Operator=='-'){if(outVar)outVar=this.Algorithm.Subtract(0,outVar);}varInfo.OutVar=outVar;return true;};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();//执行脚本
|
|
11550
|
-
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
|
|
11551
|
-
this.DebugRun=function(){var
|
|
11551
|
+
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 _this47=this;if(debugCtrl.ExeLine<debugCtrl.LineCount){var item=this.AST.Body[debugCtrl.ExeLine];this.RunASTNode(item);++debugCtrl.ExeLine;this.DebugFilter(debugCtrl,function(){_this47.DebugRun_Next(debugCtrl);});}else{this.DebugRun_End();debugCtrl.Status=2;this.DebugFilter(debugCtrl,null);}};//debug模式
|
|
11552
|
+
this.DebugRun=function(){var _this48=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(){_this48.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;case Syntax.UnaryExpression:this.VisitUnaryExpression(node);break;}};this.VisitUnaryExpression=function(node){if(node.Operator=='-'){var tempValue=this.GetNodeValueEx(node.Argument);var value=this.Algorithm.Subtract(0,tempValue);}else{var value=node.Argument.Value;}return value;};this.VisitSequenceExpression=function(node){for(var _i125 in node.Expression){var _item20=node.Expression[_i125];this.VisitNode(_item20);}};this.GetDynamicScriptIndex=function(node,args){var dynamicName=node.Callee.Value;var aryValue=dynamicName.split(".");if(aryValue.length!=2){this.ThrowUnexpectedNode(node,'\u8C03\u7528\u6307\u6807\u683C\u5F0F\''+dynamicName+'\'\u9519\u8BEF');}var name=aryValue[0];var outName=aryValue[1];var period=null;var pos=outName.indexOf('#');if(pos!=-1){period=outName.slice(pos+1);//周期
|
|
11552
11553
|
outName=outName.slice(0,pos);}var strValue="";for(var i=0;i<args.length;++i){var value=args[i];if(strValue.length>0)strValue+=",";strValue+=''+value;}var strArgs='('+strValue+')';var key=outName+'#'+strArgs;if(period)key+='#'+period;if(!this.VarTable.has(name))return null;var indexData=this.VarTable.get(name);var value=indexData[key];return value;};//函数调用
|
|
11553
11554
|
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个条件参数
|
|
11554
11555
|
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(node.Callee.Type==Syntax.Literal){node.Out=[];node.Draw=null;var data=this.GetDynamicScriptIndex(node,args);if(data)node.Out=data;return node.Out;}if(funcName==="IFC"){//IFC(X,A,B)若X不为0则执行A,否则执行B.IFC与IF函数的区别:根据X的值来选择性执行A、B表达式.
|
|
@@ -12354,15 +12355,15 @@ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FILTER_DEAL_DATA);if(!event|
|
|
|
12354
12355
|
event.Callback(event,sendData,this);return sendData.Result;};this.EnableFilter=function(bEnable,option)//启动|关闭筛选
|
|
12355
12356
|
{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;};//创建
|
|
12356
12357
|
//windowCount 窗口个数
|
|
12357
|
-
this.Create=function(option){var
|
|
12358
|
+
this.Create=function(option){var _this49=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
12358
12359
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);//创建框架
|
|
12359
12360
|
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;//创建表格
|
|
12360
|
-
var chart=new ChartDealList();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return
|
|
12361
|
+
var chart=new ChartDealList();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this49.GetEventCallback(id);};this.ChartPaint[0]=chart;if(option){if(IFrameSplitOperator.IsBool(option.IsSingleTable))chart.IsSingleTable=option.IsSingleTable;//单表模式
|
|
12361
12362
|
if(IFrameSplitOperator.IsBool(option.IsShowHeader))chart.IsShowHeader=option.IsShowHeader;//是否显示表头
|
|
12362
12363
|
if(IFrameSplitOperator.IsBool(option.IsShowLastPage))this.IsShowLastPage=option.IsShowLastPage;//是否显示最后一页
|
|
12363
12364
|
if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
|
|
12364
|
-
}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){
|
|
12365
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
12365
|
+
}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){_this49.OnKeyDown(e);},true);//键盘消息
|
|
12366
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this49.OnWheel(e);},true);//上下滚动消息
|
|
12366
12367
|
};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();//获取设备的分辨率
|
|
12367
12368
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12368
12369
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
@@ -12467,10 +12468,10 @@ var _iteratorNormalCompletion25=true;var _didIteratorError25=false;var _iterator
|
|
|
12467
12468
|
//注册事件
|
|
12468
12469
|
if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}if(option.EnableResize==true)this.CreateResizeListener();if(option.EnablePopMenuV2===true)chart.InitalPopMenu();if(option.FloatTooltip&&option.FloatTooltip.Enable)chart.InitalFloatTooltip(option.FloatTooltip);//提示信息
|
|
12469
12470
|
if(option.MinuteChartTooltip&&option.MinuteChartTooltip.Enable)chart.InitalMinuteChartTooltip(option.MinuteChartTooltip);if(option.Symbol)chart.Symbol=option.Symbol;if(option.Name)chart.Name=option.Name;var requestOption={Callback:null};if(chart.Symbol)requestOption.Callback=function(){chart.RequestMemberListData();};if(option.LoadStockList===false){chart.ChartSplashPaint.IsEnableSplash=false;chart.Draw();}else{chart.RequestStockListData(requestOption);//下载码表
|
|
12470
|
-
}};this.CreateJSReportChartContainer=function(option){var
|
|
12471
|
+
}};this.CreateJSReportChartContainer=function(option){var _this50=this;var chart=new JSReportChartContainer(this.CanvasElement);chart.GetExtraCanvas=function(name){return _this50.GetExtraCanvas(name);};chart.Create(option);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;if(IFrameSplitOperator.IsNonEmptyArray(option.Column))chart.SetColumn(option.Column);if(IFrameSplitOperator.IsNonEmptyArray(option.Tab))chart.SetTab(option.Tab);if(IFrameSplitOperator.IsNumber(option.TabSelected))chart.SetSelectedTab(option.TabSelected);if(IFrameSplitOperator.IsBool(option.EnableDragRow))chart.EnableDragRow=option.EnableDragRow;if(IFrameSplitOperator.IsNumber(option.DragRowType))chart.DragRowType=option.DragRowType;if(IFrameSplitOperator.IsBool(option.EnableDragHeader))chart.EnableDragHeader=option.EnableDragHeader;if(IFrameSplitOperator.IsNumber(option.WheelPageType))chart.WheelPageType=option.WheelPageType;if(IFrameSplitOperator.IsBool(option.PageUpDownCycle))chart.PageUpDownCycle=option.PageUpDownCycle;if(option.VScrollbar)chart.SetVScrollbar(option.VScrollbar);if(option.SortInfo){var item=option.SortInfo;if(IFrameSplitOperator.IsNumber(item.Field))chart.SortInfo.Field=item.Field;if(IFrameSplitOperator.IsNumber(item.Sort))chart.SortInfo.Sort=item.Sort;}if(option.VirtualTable){var item=option.VirtualTable;if(IFrameSplitOperator.IsBool(item.Enable))chart.Data.Virtual.Enable=item.Enable;}var reportChart=chart.GetReportChart();if(reportChart){if(IFrameSplitOperator.IsNumber(option.TextOverflowStyle))reportChart.TextOverflowStyle=option.TextOverflowStyle;if(IFrameSplitOperator.IsNumber(option.MultiSelectModel))reportChart.MultiSelectModel=option.MultiSelectModel;}this.SetChartBorder(chart,option);//是否自动更新
|
|
12471
12472
|
if(option.IsAutoUpdate!=null)chart.IsAutoUpdate=option.IsAutoUpdate;if(option.AutoUpdateFrequency>0)chart.AutoUpdateFrequency=option.AutoUpdateFrequency;if(IFrameSplitOperator.IsBool(option.EnableFilter))chart.EnableFilter=option.EnableFilter;//注册事件
|
|
12472
12473
|
if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}return chart;};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;if(IFrameSplitOperator.IsNumber(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;if(IFrameSplitOperator.IsNumber(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;if(IFrameSplitOperator.IsNumber(option.Border.Bottom))chart.Frame.ChartBorder.Bottom=option.Border.Bottom;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
12473
|
-
chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;};this.CreateResizeListener=function(){var
|
|
12474
|
+
chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;};this.CreateResizeListener=function(){var _this51=this;this.ResizeListener=new ResizeObserver(function(entries){_this51.OnDivResize(entries);});this.ResizeListener.observe(this.DivElement);};this.OnDivResize=function(entries){JSConsole.Chart.Log("[JSReportChart::OnDivResize] entries=",entries);this.OnSize();};/////////////////////////////////////////////////////////////////////////////
|
|
12474
12475
|
//对外接口
|
|
12475
12476
|
//切换股票代码接口
|
|
12476
12477
|
this.ChangeSymbol=function(symbol,option){if(this.JSChartContainer)this.JSChartContainer.ChangeSymbol(symbol,option);};this.SetColumn=function(aryColumn,option){if(this.JSChartContainer)this.JSChartContainer.SetColumn(aryColumn,option);};this.SetSelectedRow=function(option){if(this.JSChartContainer)this.JSChartContainer.SetSelectedRow(option);};this.EnableFilter=function(bEnable,option)//启动|关闭筛选
|
|
@@ -12539,27 +12540,27 @@ this.LastMouseStatus={MoveStatus:null,TooltipStatus:null,MouseOnStatus:null};thi
|
|
|
12539
12540
|
{this.IsDestroy=true;this.StopAutoUpdate();this.DestroyMinuteChartTooltip();this.DestroyFloatTooltip();};this.StopAutoDragScrollTimer=function(){JSConsole.Chart.Log("[JSReportChartContainer::StopAutoDragScrollTimer] stop ");this.EnablePageScroll=false;if(this.AutoDragScrollTimer!=null){clearTimeout(this.AutoDragScrollTimer);this.AutoDragScrollTimer=null;}};this.InitalPopMenu=function()//初始化弹出窗口
|
|
12540
12541
|
{if(this.JSPopMenu)return;this.JSPopMenu=new JSPopMenu();//内置菜单
|
|
12541
12542
|
this.JSPopMenu.Inital();};this.InitalMinuteChartTooltip=function(option){if(this.TooltipMinuteChart)return;this.TooltipMinuteChart=new JSTooltipMinuteChart();this.TooltipMinuteChart.Inital(this,option);this.TooltipMinuteChart.Create();};this.DestroyMinuteChartTooltip=function(){if(!this.TooltipMinuteChart)return;this.TooltipMinuteChart.Destroy();this.TooltipMinuteChart=null;};this.InitalFloatTooltip=function(option){if(this.FloatTooltip)return;this.FloatTooltip=new JSFloatTooltip();this.FloatTooltip.Inital(this,option);this.FloatTooltip.Create();};this.HideFloatTooltip=function(){if(!this.FloatTooltip)return;this.FloatTooltip.Hide();};this.DestroyFloatTooltip=function(){if(!this.FloatTooltip)return;this.FloatTooltip.Destroy();this.FloatTooltip=null;};this.DrawFloatTooltip=function(point,toolTip){if(!this.FloatTooltip)return;this.UpdateFloatTooltip(point,toolTip);};this.UpdateFloatTooltip=function(point,toolTip){if(!this.FloatTooltip)return;var sendData={Tooltip:toolTip,Point:point,DataType:3};this.FloatTooltip.Update(sendData);};//data={ Symbol }
|
|
12542
|
-
this.ShowMinuteChartTooltip=function(x,y,data){if(!this.TooltipMinuteChart)return;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();var offsetLeft=rtClient.left+rtScroll.Left;var offsetTop=rtClient.top+rtScroll.Top;data.Offset={Left:offsetLeft,Top:offsetTop};this.TooltipMinuteChart.Show(data,x,y);};this.HideMinuteChartTooltip=function(){if(!this.TooltipMinuteChart)return;this.TooltipMinuteChart.Hide();};this.AutoScrollPage=function(step){var
|
|
12543
|
+
this.ShowMinuteChartTooltip=function(x,y,data){if(!this.TooltipMinuteChart)return;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();var offsetLeft=rtClient.left+rtScroll.Left;var offsetTop=rtClient.top+rtScroll.Top;data.Offset={Left:offsetLeft,Top:offsetTop};this.TooltipMinuteChart.Show(data,x,y);};this.HideMinuteChartTooltip=function(){if(!this.TooltipMinuteChart)return;this.TooltipMinuteChart.Hide();};this.AutoScrollPage=function(step){var _this52=this;this.AutoDragScrollTimer=setTimeout(function(){_this52.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;};//清空画布
|
|
12543
12544
|
this.ClearCanvas=function(canvas){if(!canvas)return;if(!this.UIElement)return;canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);};//清空固定行数据
|
|
12544
12545
|
this.ClearFixedRowData=function(){this.FixedRowData.Data=[];this.FixedRowData.Symbol=[];};//设置固定行
|
|
12545
12546
|
this.SetFixedRowCount=function(value){var chart=this.GetReportChart();if(!chart)return;chart.FixedRowCount=value;};//创建
|
|
12546
|
-
this.Create=function(option){var
|
|
12547
|
+
this.Create=function(option){var _this53=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
12547
12548
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
|
|
12548
12549
|
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;//创建表格
|
|
12549
|
-
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
|
|
12550
|
+
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 _this53.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this53.GetStockData(symbol);};chart.GetBlockDataCallback=function(symbol){return _this53.GetBlockData(symbol);};chart.GetFlashBGDataCallback=function(symbol,time){return _this53.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;chart.VScrollbar=new ChartVScrollbar();chart.VScrollbar.Frame=this.Frame;chart.VScrollbar.Canvas=this.Canvas;chart.VScrollbar.ChartBorder=this.Frame.ChartBorder;chart.VScrollbar.Report=chart;chart.VScrollbar.IsShowCallback=function(){if(_this53.DragYScroll)return true;return _this53.IsShowVScrollbar;};this.ChartPaint[0]=chart;//页脚
|
|
12550
12551
|
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;//是否显示表头
|
|
12551
12552
|
if(IFrameSplitOperator.IsNumber(option.FixedColumn))chart.FixedColumn=option.FixedColumn;//固定列
|
|
12552
12553
|
if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
|
|
12553
12554
|
if(IFrameSplitOperator.IsBool(option.TabShow))chart.Tab.IsShow=option.TabShow;if(IFrameSplitOperator.IsNumber(option.FixedRowCount))chart.FixedRowCount=option.FixedRowCount;//固定行
|
|
12554
12555
|
if(IFrameSplitOperator.IsBool(option.ItemBorder))chart.IsDrawBorder=option.ItemBorder;//单元格边框
|
|
12555
|
-
if(IFrameSplitOperator.IsNumber(option.SelectedModel))chart.SelectedModel=option.SelectedModel;if(IFrameSplitOperator.IsNumber(option.HeaderRowCount))chart.HeaderRowCount=option.HeaderRowCount;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){
|
|
12556
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
12557
|
-
this.UIElement.ondblclick=function(e){
|
|
12558
|
-
this.UIElement.ontouchstart=function(e){
|
|
12556
|
+
if(IFrameSplitOperator.IsNumber(option.SelectedModel))chart.SelectedModel=option.SelectedModel;if(IFrameSplitOperator.IsNumber(option.HeaderRowCount))chart.HeaderRowCount=option.HeaderRowCount;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){_this53.OnKeyDown(e);},true);//键盘消息
|
|
12557
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this53.OnWheel(e);},true);//上下滚动消息
|
|
12558
|
+
this.UIElement.ondblclick=function(e){_this53.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this53.UIOnMouseDown(e);};this.UIElement.onmouseup=function(e){_this53.UIOnMounseUp(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);};//手机拖拽
|
|
12559
|
+
this.UIElement.ontouchstart=function(e){_this53.OnTouchStart(e);};this.UIElement.ontouchmove=function(e){_this53.OnTouchMove(e);};this.UIElement.ontouchend=function(e){_this53.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();//获取设备的分辨率
|
|
12559
12560
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12560
12561
|
this.LastMouseStatus.MouseOnStatus=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
12561
|
-
for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.IsDrawFirst)item.Draw(this.LastMouseStatus);}for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.IsDrawFirst)item.Draw(this.LastMouseStatus);}if(this.GlobalOption.FlashBGCount>0){this.DelayDraw(500);}};this.DelayDraw=function(frequency){var
|
|
12562
|
-
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){var
|
|
12562
|
+
for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.IsDrawFirst)item.Draw(this.LastMouseStatus);}for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.IsDrawFirst)item.Draw(this.LastMouseStatus);}if(this.GlobalOption.FlashBGCount>0){this.DelayDraw(500);}};this.DelayDraw=function(frequency){var _this54=this;if(typeof this.FlashBGTimer=='number'){clearTimeout(this.FlashBGTimer);this.FlashBGTimer=null;}this.FlashBGTimer=setTimeout(function(){_this54.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;chart.MultiSelectedRow=[];}};this.ClearData=function(){this.SourceData.Data=[];this.Data.Data=[];this.Data.Virtual.Count=0;this.BlockData=new _map2.default();};this.ClearMapStockData=function(){this.MapStockData=new _map2.default();};this.ResetSortStatus=function(){this.SortInfo.Field=-1;this.SortInfo.Sort=0;};this.SetSelectedRow=function(option){var reportChart=this.GetReportChart();if(!reportChart)return false;if(!reportChart.SetSelectedRow(option))return false;this.Draw();};//设置股票列表
|
|
12563
|
+
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){var _this55=this;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;}if(IFrameSplitOperator.IsBool(option.IsReloadStockList)){var requestOption={Callback:null};if(this.Symbol)requestOption.Callback=function(){_this55.RequestMemberListData();};this.MapStockData=new _map2.default();this.RequestStockListData(requestOption);return;}}this.RequestMemberListData();};//更新数据
|
|
12563
12564
|
this.UpdateFullData=function(data){var arySymbol=[];if(IFrameSplitOperator.IsNonEmptyArray(data.data)){//0=证券代码 1=股票名称
|
|
12564
12565
|
for(var i=0;i<data.data.length;++i){var item=data.data[i];var symbol=item[0];var stock=null;if(this.MapStockData.has(symbol)){stock=this.MapStockData.get(symbol);}else{stock=new HQReportItem();stock.OriginalSymbol=symbol;this.MapStockData.set(symbol,stock);}stock.Symbol=this.GetSymbolNoSuffix(symbol);stock.Name=item[1];this.ReadStockJsonData(stock,item);arySymbol.push(symbol);}}//设置显示数据
|
|
12565
12566
|
this.Data.Data=[];this.SourceData.Data=[];if(IFrameSplitOperator.IsNonEmptyArray(arySymbol)){for(var i=0;i<arySymbol.length;++i){this.Data.Data.push(arySymbol[i]);this.SourceData.Data.push(arySymbol[i]);}}this.Draw();};//设置全部的数据
|
|
@@ -12625,15 +12626,15 @@ this.GetStockData=function(symbol){if(!this.MapStockData)return null;if(!this.Ma
|
|
|
12625
12626
|
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)//超时的删除
|
|
12626
12627
|
{this.FlashBG.delete(symbol);return null;}if(!stockItem.Data||stockItem.Data.size<=0){this.FlashBG.delete(symbol);return null;}var aryDelID=[];//超时需要参数的
|
|
12627
12628
|
var _iteratorNormalCompletion26=true;var _didIteratorError26=false;var _iteratorError26=undefined;try{for(var _iterator26=(0,_getIterator3.default)(stockItem.Data),_step26;!(_iteratorNormalCompletion26=(_step26=_iterator26.next()).done);_iteratorNormalCompletion26=true){var mapItem=_step26.value;var item=mapItem[1];if(time-item.Time>=timeDiff||item.Count<=0)aryDelID.push(item.ID);}}catch(err){_didIteratorError26=true;_iteratorError26=err;}finally{try{if(!_iteratorNormalCompletion26&&_iterator26.return){_iterator26.return();}}finally{if(_didIteratorError26){throw _iteratorError26;}}}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=是否延迟
|
|
12628
|
-
this.DelayUpdateStockData=function(){var
|
|
12629
|
+
this.DelayUpdateStockData=function(){var _this56=this;if(this.DelayUpdateTimer!=null){clearTimeout(this.DelayUpdateTimer);this.DelayUpdateTimer=null;}var frequency=this.DelayUpdateFrequency;this.DelayUpdateTimer=setTimeout(function(){_this56.UpdateStockData();},frequency);};this.UpdateStockData=function(){if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;var chart=this.ChartPaint[0];if(!chart)return;if(this.Data.Virtual&&this.Data.Virtual.Enable){this.RequestVirtualStockData();//虚拟表格 全部取后台
|
|
12629
12630
|
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);//远程排序
|
|
12630
12631
|
return;}}var arySymbol=chart.ShowSymbol;if(!IFrameSplitOperator.IsNonEmptyArray(arySymbol))return;this.RequestStockData(arySymbol);};//下载股票数据
|
|
12631
12632
|
this.RequestStockData=function(arySymbol){var self=this;if(this.NetworkFilter){var obj={Name:'JSDealChartContainer::RequestStockData',//类名::函数名
|
|
12632
12633
|
Explain:'报价列表股票数据',Request:{Data:{stocks:arySymbol},symbol:this.Symbol,name:this.Name},Self:this,PreventDefault:false};this.NetworkFilter(obj,function(data){self.RecvStockData(data);self.AutoUpdate();});if(obj.PreventDefault==true)return;}//throw { Name:'JSReportChartContainer::RequestStockData', Error:'(报价列表股票数据)不提供内置测试数据' };
|
|
12633
|
-
};this.RecvStockData=function(data){var
|
|
12634
|
+
};this.RecvStockData=function(data){var _this57=this;var setUpdateSymbol=new _set2.default();//更新的股票列表
|
|
12634
12635
|
if(IFrameSplitOperator.IsNonEmptyArray(data.data)){//0=证券代码 1=股票名称 2=昨收 3=开 4=高 5=低 6=收 7=成交量 8=成交金额, 9=买价 10=买量 11=卖价 12=卖量 13=均价 14=流通股 15=总股本
|
|
12635
12636
|
for(var i=0;i<data.data.length;++i){var item=data.data[i];var symbol=item[0];if(!symbol)continue;var stock=null;if(this.MapStockData.has(symbol)){stock=this.MapStockData.get(symbol);}else{stock=new HQReportItem();stock.OriginalSymbol=symbol;stock.Symbol=this.GetSymbolNoSuffix(symbol);this.MapStockData.set(symbol,stock);}this.ReadStockJsonData(stock,item);if(!setUpdateSymbol.has(symbol))setUpdateSymbol.add(symbol);}}var chart=this.ChartPaint[0];if(!chart)return;var bUpdate=false;//实时本地数据排序
|
|
12636
|
-
var chart=this.ChartPaint[0];if(chart&&this.SortInfo.Sort==1&&IFrameSplitOperator.IsNumber(this.SortInfo.Field)&&this.SortInfo.Field>=0){var column=chart.Column[this.SortInfo.Field];var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column:column,SortInfo:this.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
|
|
12637
|
+
var chart=this.ChartPaint[0];if(chart&&this.SortInfo.Sort==1&&IFrameSplitOperator.IsNumber(this.SortInfo.Field)&&this.SortInfo.Field>=0){var column=chart.Column[this.SortInfo.Field];var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column:column,SortInfo:this.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 _this57.LocalSort(left,right,column,_this57.SortInfo.Sort);});}bUpdate=true;//排序暂时每次都刷新
|
|
12637
12638
|
}else{//更新的股票在当前页面,需要重绘
|
|
12638
12639
|
var aryStock=chart.ShowSymbol;for(var i=0;i<aryStock.length;++i){if(setUpdateSymbol.has(aryStock[i].Symbol)){bUpdate=true;break;}}}if(bUpdate)this.Draw();};//读取单条股票json数据
|
|
12639
12640
|
this.ReadStockJsonData=function(stock,item){//0=证券代码 1=股票名称 2=昨收 3=开 4=高 5=低 6=收 7=成交量 8=成交金额, 9=买价 10=买量 11=卖价 12=卖量 13=均价 14=流通股 15=总股本 16=涨停价 17=跌停价
|
|
@@ -12699,7 +12700,7 @@ var result=this.MoveSelectedRow(-1);if(result){if(result.Redraw)this.Draw();if(r
|
|
|
12699
12700
|
var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}break;case 37://left
|
|
12700
12701
|
if(this.MoveXOffset(-1))this.Draw();break;case 39://right
|
|
12701
12702
|
if(this.MoveXOffset(1))this.Draw();break;}//不让滚动条滚动
|
|
12702
|
-
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
|
|
12703
|
+
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 _this58=this;this.DragXScroll=null;this.DragYScroll=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 },
|
|
12703
12704
|
//LastMove:{ X:e.clientX, Y:e.clientY},
|
|
12704
12705
|
ClickData:dragColumnWidth,ColumnWidth:dragColumnWidth.Column.Width};}else{var clickData=chart.OnMouseDown(x,y,e);if(!clickData)return;//if (e.button!=0) return;
|
|
12705
12706
|
if((clickData.Type==2||clickData.Type==4)&&(e.button==0||e.button==2))//点击行|固定行
|
|
@@ -12715,11 +12716,11 @@ if((clickData.Type==2||clickData.Type==4)&&(e.button==0||e.button==2))//点击
|
|
|
12715
12716
|
{if(this.MoveYOffset(-1)){this.Draw();this.DelayUpdateStockData();}}else if(scroll.Type==2)//底部按钮
|
|
12716
12717
|
{if(this.MoveYOffset(1)){this.Draw();this.DelayUpdateStockData();}}else if(scroll.Type==3)//滚动条
|
|
12717
12718
|
{this.DragYScroll={Click:{X:x,Y:y},LastMove:{X:x,Y:y}};}else if(scroll.Type==4)//滚动条内部
|
|
12718
|
-
{if(this.SetYOffset(scroll.Pos)){this.Draw();this.DelayUpdateStockData();}}}}}document.onmousemove=function(e){
|
|
12719
|
+
{if(this.SetYOffset(scroll.Pos)){this.Draw();this.DelayUpdateStockData();}}}}}document.onmousemove=function(e){_this58.DocOnMouseMove(e);};document.onmouseup=function(e){_this58.DocOnMouseUp(e);};};this.UIOnMounseUp=function(e){console.log('"UIOnMounseUp');};//去掉右键菜单
|
|
12719
12720
|
this.UIOnContextMenu=function(e){e.preventDefault();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;if(!this.IsShowRightMenu)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);//右键菜单事件
|
|
12720
12721
|
};this.OnRightMenu=function(x,y,e){this.PopupRightMenu(x,y,e);};this.PtInReportChart=function(x,y)//Type: 2=行 3=表头 4=固定行
|
|
12721
|
-
{var chart=this.GetReportChart();if(!chart)return null;var row=chart.PtInHeader(x,y);if(row)return{Type:3,Row:row,X:x,Y:y};row=chart.PtInFixedBody(x,y);if(row)return{Type:4,Row:row,X:x,Y:y};row=chart.PtInBody(x,y);if(row)return{Type:2,Row:row,X:x,Y:y};return{Type:-1,Row:null,X:x,Y:y};};this.PopupRightMenu=function(x,y,e){var
|
|
12722
|
-
if(!data)return;if(!this.JSPopMenu)return;data.e=e;var menuData={Menu:null,Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID};menuData.ClickCallback=function(data){
|
|
12722
|
+
{var chart=this.GetReportChart();if(!chart)return null;var row=chart.PtInHeader(x,y);if(row)return{Type:3,Row:row,X:x,Y:y};row=chart.PtInFixedBody(x,y);if(row)return{Type:4,Row:row,X:x,Y:y};row=chart.PtInBody(x,y);if(row)return{Type:2,Row:row,X:x,Y:y};return{Type:-1,Row:null,X:x,Y:y};};this.PopupRightMenu=function(x,y,e){var _this59=this;var pixelTatio=GetDevicePixelRatio();var data=this.PtInReportChart(x*pixelTatio,y*pixelTatio);//x,y 需要乘以放大倍速
|
|
12723
|
+
if(!data)return;if(!this.JSPopMenu)return;data.e=e;var menuData={Menu:null,Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID};menuData.ClickCallback=function(data){_this59.OnClickRightMenu(data);};var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_RIGHT_MENU);if(event&&event.Callback){var sendData={MenuData:menuData,Data:data};event.Callback(event,sendData,this);}if(menuData.Menu)this.PopupMenuByRClick(menuData,x,y);};//右键菜单
|
|
12723
12724
|
this.PopupMenuByRClick=function(menuData,x,y){if(!this.JSPopMenu)return;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();x+=rtClient.left+rtScroll.Left;y+=rtClient.top+rtScroll.Top;this.JSPopMenu.CreatePopMenu(menuData);this.JSPopMenu.PopupMenuByRight(x,y);};//点击右键菜单
|
|
12724
12725
|
this.OnClickRightMenu=function(data){JSConsole.Chart.Log('[JSReportChartContainer::OnClickRightMenu] ',data);if(!data||!data.Data)return;var cmdID=data.Data.ID;//命令ID
|
|
12725
12726
|
var aryArgs=data.Data.Args;//参数
|
|
@@ -12770,18 +12771,18 @@ if(chart.MultiSelectModel==1){var pageStatus=chart.GetCurrentPageStatus();if(IFr
|
|
|
12770
12771
|
{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;};//左右移动
|
|
12771
12772
|
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.SetYOffset=function(pos){if(!IFrameSplitOperator.IsNumber(pos))return false;var chart=this.ChartPaint[0];if(!chart)return false;var maxOffset=chart.GetYScrollRange();if(pos<0)pos=0;if(pos>maxOffset)pos=maxOffset;this.Data.YOffset=pos;return true;};this.GotoLastPage=function(){var chart=this.ChartPaint[0];if(!chart)return;//显示最后一屏
|
|
12772
12773
|
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.SetVScrollbar=function(option){var chart=this.GetReportChart();if(!chart)return;var scrollbar=chart.VScrollbar;if(!scrollbar)return;scrollbar.SetOption(option);};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();}if(this.MinuteChartTooltip)this.MinuteChartTooltip.ReloadResource(option);};//列排序
|
|
12773
|
-
this.SortColumn=function(index,sortType){var
|
|
12774
|
+
this.SortColumn=function(index,sortType){var _this60=this;if(index<0)return false;var reportChart=this.GetReportChart();if(!reportChart)return false;var column=reportChart.Column[index];if(!column)return false;if(column.Sort!=1&&column.Sort!=2)return false;var sortInfo={Field:index,Sort:sortType};if(this.Data.Virtual&&this.Data.Virtual.Enable){this.SortInfo.Field=sortInfo.Field;this.SortInfo.Sort=sortInfo.Sort;this.Data.YOffset=0;this.ResetReportSelectStatus();this.RequestVirtualStockData();//虚拟表格
|
|
12774
12775
|
return true;}else if(sortInfo.Sort==0)//不排序还原
|
|
12775
12776
|
{this.Data.Data=[];if(IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data))this.Data.Data=this.SourceData.Data.slice();}else if(sortInfo.Sort==1||sortInfo.Sort==2){if(column.Sort==1)//本地排序
|
|
12776
|
-
{var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column: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
|
|
12777
|
+
{var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column: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 _this60.LocalSort(left,right,column,sortInfo.Sort);});}}else if(column.Sort==2)//远程排序
|
|
12777
12778
|
{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(column,sortInfo.Field,sortInfo.Sort);//远程排序
|
|
12778
12779
|
return true;}}this.Data.YOffset=0;this.ResetReportSelectStatus();this.SortInfo.Field=sortInfo.Field;this.SortInfo.Sort=sortInfo.Sort;this.Draw();this.DelayUpdateStockData();return true;};//点表头
|
|
12779
|
-
this.OnClickHeader=function(clickData,e){var
|
|
12780
|
-
{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
|
|
12780
|
+
this.OnClickHeader=function(clickData,e){var _this61=this;var header=clickData.Header;if(header.Column&&header.Column.EnablePopupHeaderMenu){this.PopupHeaderMenu(clickData,e);return;}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)//本地排序
|
|
12781
|
+
{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 _this61.LocalSort(left,right,header.Column,sortInfo.Sort);});}}else if(header.Column.Sort==2)//远程排序
|
|
12781
12782
|
{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);//远程排序
|
|
12782
|
-
return;}}this.Data.YOffset=0;this.ResetReportSelectStatus();this.SortInfo.Field=sortInfo.Field;this.SortInfo.Sort=sortInfo.Sort;this.Draw();this.DelayUpdateStockData();}}};this.PopupHeaderMenu=function(clickData,e){var
|
|
12783
|
+
return;}}this.Data.YOffset=0;this.ResetReportSelectStatus();this.SortInfo.Field=sortInfo.Field;this.SortInfo.Sort=sortInfo.Sort;this.Draw();this.DelayUpdateStockData();}}};this.PopupHeaderMenu=function(clickData,e){var _this62=this;if(!this.JSPopMenu)return;if(!this.GetEventCallback)return;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_REPORT_HEADER_MENU);if(!event||!event.Callback)return;var header=clickData.Header;var column=header.Column;var menuData={Menu:null,Position:JSPopMenu.POSITION_ID.DROPDOWN_MENU_ID};menuData.ClickCallback=function(data){_this62.OnClickHeaderMenu(column,data);};var sendData={MenuData:menuData,Column:column,Index:header.Index,PreventDefault:false,e:e};event.Callback(event,sendData,this);if(sendData.PreventDefault==true)return;if(!menuData.Menu)return;this.PopupMenuByDrapdown(menuData,header.Rect);};//下拉菜单
|
|
12783
12784
|
this.PopupMenuByDrapdown=function(menuData,rtButton){if(!this.JSPopMenu)return;var pixelRatio=GetDevicePixelRatio();var rtCell={Left:rtButton.Left/pixelRatio,Right:rtButton.Right/pixelRatio,Bottom:rtButton.Bottom/pixelRatio,Top:rtButton.Top/pixelRatio};rtCell.Width=rtCell.Right-rtCell.Left;rtCell.Height=rtCell.Bottom-rtCell.Top;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();var offsetLeft=rtClient.left+rtScroll.Left;var offsetTop=rtClient.top+rtScroll.Top;rtCell.Left+=offsetLeft;rtCell.Right+=offsetLeft;rtCell.Top+=offsetTop;rtCell.Bottom+=offsetTop;this.JSPopMenu.CreatePopMenu(menuData);this.JSPopMenu.PopupMenuByDrapdown(rtCell);};this.GetTabPopMenu=function(tabItem){var aryMenu=[];if(IFrameSplitOperator.IsNonEmptyArray(tabItem.ArySubMenu)){for(var i=0;i<tabItem.ArySubMenu.length;++i){var item=tabItem.ArySubMenu[i];var menuItem={Name:item.Title,Data:{ID:item.CommandID,Args:[item.ID]}};if(item.Text)menuItem.Text=item.Text;aryMenu.push(menuItem);}}return aryMenu;};this.PopupTabMenu=function(menuData,tab,e){if(!this.JSPopMenu)return;var rtTab=tab.Rect;var pixelRatio=GetDevicePixelRatio();var rtCell={Left:rtTab.Left/pixelRatio,Right:rtTab.Right/pixelRatio,Bottom:rtTab.Bottom/pixelRatio,Top:rtTab.Top/pixelRatio};rtCell.Width=rtCell.Right-rtCell.Left;rtCell.Height=rtCell.Bottom-rtCell.Top;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();var offsetLeft=rtClient.left+rtScroll.Left;var offsetTop=rtClient.top+rtScroll.Top;rtCell.Left+=offsetLeft;rtCell.Right+=offsetLeft;rtCell.Top+=offsetTop;rtCell.Bottom+=offsetTop;this.JSPopMenu.CreatePopMenu(menuData);this.JSPopMenu.PopupMenuByTab(rtCell);if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation();};//点击标签
|
|
12784
|
-
this.OnClickTab=function(tabData,e){var
|
|
12785
|
+
this.OnClickTab=function(tabData,e){var _this63=this;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 menuData={Menu:this.GetTabPopMenu(tabData.Tab),Position:JSPopMenu.POSITION_ID.TAB_MENU_ID};menuData.ClickCallback=function(data){_this63.OnClickTabPopMenu(tabData,data);};var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_REPORT_TABMENU);if(event&&event.Callback){var sendData={MenuData:menuData,Tab:tabData,PreventDefault:false,e:e};event.Callback(event,sendData,this);if(sendData.PreventDefault==true)return;}this.PopupTabMenu(menuData,tabData.Tab,e);}else{var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_REPORT_TAB);if(event&&event.Callback){var sendData={Data:tabData,IsSide:{X:x,Y:x},UIElement:uiElement,e:e,Redraw:redraw,PreventDefault:false};event.Callback(event,sendData,this);if(IFrameSplitOperator.IsBool(sendData.Redraw))redraw=sendData.Redraw;if(sendData.PreventDefault==true)return;}if(tabData.Tab.CommandID==JSCHART_MENU_ID.CMD_REPORT_CHANGE_BLOCK_ID){this.ExecuteMenuCommand(tabData.Tab.CommandID,[tabData.Tab.ID]);this.SetSelectedTab(tabData.Index);redraw=true;}}if(redraw)this.Draw();};this.OnClickTabPopMenu=function(tabData,data){JSConsole.Chart.Log('[JSReportChartContainer::OnClickTabPopMenu] ',tabData,data);var cmdID=data.Data.ID;//命令ID
|
|
12785
12786
|
var aryArgs=data.Data.Args;//参数
|
|
12786
12787
|
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MENU_COMMAND);//回调通知外部
|
|
12787
12788
|
if(event&&event.Callback){var data={PreventDefault:false,CommandID:cmdID,Args:aryArgs,SrcData:data,TabData:tabData};event.Callback(event,data,this);if(data.PreventDefault)return;}this.ExecuteMenuCommand(cmdID,aryArgs);this.SetSelectedTab(tabData.Index);this.Draw();};this.OnClickHeaderMenu=function(menuData,data){JSConsole.Chart.Log('[JSReportChartContainer::OnClickHeaderMenu] ',menuData,data);var cmdID=data.Data.ID;var aryArgs=data.Data.Args;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MENU_COMMAND);//回调通知外部
|
|
@@ -13298,7 +13299,7 @@ if(option.Symbol){chart.Draw();var name=option.Symbol;if(option.Name)name=option
|
|
|
13298
13299
|
if(option.SortInfo){var item=option.SortInfo;if(IFrameSplitOperator.IsNumber(item.Field))chart.SortInfo.Field=item.Field;if(IFrameSplitOperator.IsNumber(item.Sort))chart.SortInfo.Sort=item.Sort;}this.SetChartBorder(chart,option);//是否自动更新
|
|
13299
13300
|
if(option.IsAutoUpdate!=null)chart.IsAutoUpdate=option.IsAutoUpdate;if(option.AutoUpdateFrequency>0)chart.AutoUpdateFrequency=option.AutoUpdateFrequency;if(IFrameSplitOperator.IsBool(option.EnableFilter))chart.EnableFilter=option.EnableFilter;//注册事件
|
|
13300
13301
|
if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}return chart;};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;if(IFrameSplitOperator.IsNumber(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;if(IFrameSplitOperator.IsNumber(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;if(IFrameSplitOperator.IsNumber(option.Border.Bottom))chart.Frame.ChartBorder.Bottom=option.Border.Bottom;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
13301
|
-
chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;};this.CreateResizeListener=function(){var
|
|
13302
|
+
chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;};this.CreateResizeListener=function(){var _this64=this;this.ResizeListener=new ResizeObserver(function(entries){_this64.OnDivResize(entries);});this.ResizeListener.observe(this.DivElement);};this.OnDivResize=function(entries){JSConsole.Chart.Log("[JSTReportChart::OnDivResize] entries=",entries);this.OnSize();};/////////////////////////////////////////////////////////////////////////////
|
|
13302
13303
|
//对外接口
|
|
13303
13304
|
//切换股票代码接口
|
|
13304
13305
|
this.ChangeSymbol=function(symbol,option){if(this.JSChartContainer)this.JSChartContainer.ChangeSymbol(symbol,option);};this.SetColumn=function(aryColumn,option){if(this.JSChartContainer)this.JSChartContainer.SetColumn(aryColumn,option);};//事件回调
|
|
@@ -13349,16 +13350,16 @@ this.ChartDestory=function()//销毁
|
|
|
13349
13350
|
this.ShowMinuteChartTooltip=function(x,y,data){if(!this.TooltipMinuteChart)return;var rtClient=this.UIElement.getBoundingClientRect();var rtScroll=GetScrollPosition();var offsetLeft=rtClient.left+rtScroll.Left;var offsetTop=rtClient.top+rtScroll.Top;data.Offset={Left:offsetLeft,Top:offsetTop};this.TooltipMinuteChart.Show(data,x,y);};this.HideMinuteChartTooltip=function(){if(!this.TooltipMinuteChart)return;this.TooltipMinuteChart.Hide();};this.InitalFloatTooltip=function(option){if(this.FloatTooltip)return;this.FloatTooltip=new JSFloatTooltip();this.FloatTooltip.Inital(this,option);this.FloatTooltip.Create();};this.HideFloatTooltip=function(){if(!this.FloatTooltip)return;this.FloatTooltip.Hide();};this.DestroyFloatTooltip=function(){if(!this.FloatTooltip)return;this.FloatTooltip.Destroy();this.FloatTooltip=null;};this.DrawFloatTooltip=function(point,toolTip){if(!this.FloatTooltip)return;this.UpdateFloatTooltip(point,toolTip);};this.UpdateFloatTooltip=function(point,toolTip){if(!this.FloatTooltip)return;var sendData={Tooltip:toolTip,Point:point,DataType:4};this.FloatTooltip.Update(sendData);};//清空固定行数据
|
|
13350
13351
|
this.ClearFixedRowData=function(){this.FixedRowData.Data=[];};//设置固定行
|
|
13351
13352
|
this.SetFixedRowCount=function(value){var chart=this.ChartPaint[0];if(!chart)return;chart.FixedRowCount=value;};//创建
|
|
13352
|
-
this.Create=function(option){var
|
|
13353
|
+
this.Create=function(option){var _this65=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
13353
13354
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
|
|
13354
13355
|
this.Frame=new JSTReportFrame();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;//创建表格
|
|
13355
|
-
var chart=new ChartTReport();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.UIElement=this.UIElement;chart.GetEventCallback=function(id){return
|
|
13356
|
+
var chart=new ChartTReport();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.UIElement=this.UIElement;chart.GetEventCallback=function(id){return _this65.GetEventCallback(id);};chart.GetExePriceDataCallback=function(exePrice){return _this65.GetExePriceData(exePrice);};chart.GetFlashBGDataCallback=function(symbol,time){return _this65.GetFlashBGData(symbol,time);};chart.Data=this.Data;chart.BorderData=this.BorderData;chart.GlobalOption=this.GlobalOption;chart.FixedRowData=this.FixedRowData;chart.SortInfo=this.SortInfo;this.ChartPaint[0]=chart;if(option){if(IFrameSplitOperator.IsBool(option.IsShowHeader))chart.IsShowHeader=option.IsShowHeader;//是否显示表头
|
|
13356
13357
|
if(IFrameSplitOperator.IsNumber(option.FixedColumn))chart.FixedColumn=option.FixedColumn;//固定列
|
|
13357
13358
|
if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
|
|
13358
13359
|
if(IFrameSplitOperator.IsBool(option.ItemBorder))chart.IsDrawBorder=option.ItemBorder;//单元格边框
|
|
13359
|
-
if(IFrameSplitOperator.IsNumber(option.SelectedModel))chart.SelectedModel=option.SelectedModel;}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSTReportChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSTReportChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){
|
|
13360
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
13361
|
-
this.UIElement.ondblclick=function(e){
|
|
13360
|
+
if(IFrameSplitOperator.IsNumber(option.SelectedModel))chart.SelectedModel=option.SelectedModel;}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSTReportChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSTReportChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this65.OnKeyDown(e);},true);//键盘消息
|
|
13361
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this65.OnWheel(e);},true);//上下滚动消息
|
|
13362
|
+
this.UIElement.ondblclick=function(e){_this65.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this65.UIOnMouseDown(e);};this.UIElement.onmousemove=function(e){_this65.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this65.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this65.UIOnMouseleave(e);};this.UIElement.oncontextmenu=function(e){_this65.UIOnContextMenu(e);};/*
|
|
13362
13363
|
this.UIElement.onmouseup=(e)=>{ this.UIOnMounseUp(e); }
|
|
13363
13364
|
|
|
13364
13365
|
|
|
@@ -13370,7 +13371,7 @@ this.UIElement.ondblclick=function(e){_this64.UIOnDblClick(e);};this.UIElement.o
|
|
|
13370
13371
|
*/};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();//获取设备的分辨率
|
|
13371
13372
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
13372
13373
|
this.LastMouseStatus.MouseOnStatus=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
13373
|
-
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
|
|
13374
|
+
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 _this66=this;if(typeof this.FlashBGTimer=='number'){clearTimeout(this.FlashBGTimer);this.FlashBGTimer=null;}this.FlashBGTimer=setTimeout(function(){_this66.Draw();},frequency);};this.ClearData=function(){this.SourceData.Data=[];this.Data.Data=[];this.Data.Price=null;this.Data.XOffset=0;//清空偏移
|
|
13374
13375
|
this.Data.YOffset=0;this.MapStockData=new _map2.default();this.MapExePriceData=null;this.BorderData.MapData=null;};this.StopAutoUpdate=function(){this.CancelAutoUpdate();this.AutoUpdateEvent(false,'JSTReportChartContainer::StopAutoUpdate');if(!this.IsAutoUpdate)return;this.IsAutoUpdate=false;};//设置事件回调
|
|
13375
13376
|
//{event:事件id, callback:回调函数}
|
|
13376
13377
|
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)//获取事件回调
|
|
@@ -13381,10 +13382,10 @@ Explain:'T型报价列表数据',Self:this,PreventDefault:false};this.NetworkFil
|
|
|
13381
13382
|
}throw{Name:'JSTReportChartContainer::RequestStockListData',Error:'(T型报价列表数据)不提供内置测试数据'};};this.RecvStockListData=function(data){this.MapExePriceData=new _map2.default();this.MapStockData=new _map2.default();if(IFrameSplitOperator.IsNonEmptyArray(data.data)){//0=行权价格 1=左边期权代码 2=右侧期权代码 3=左侧期权名称 4=右侧期权名称
|
|
13382
13383
|
for(var i=0;i<data.data.length;++i){var item=data.data[i];var exePrice=item[0];var leftData=new HQTReportItem();leftData.Symbol=leftData.Name=item[1];if(item[3])leftData.Name=item[3];var rightData=new HQTReportItem();rightData.Symbol=rightData.Name=item[2];if(item[4])rightData.Name=item[4];this.MapStockData.set(leftData.Symbol,leftData);this.MapStockData.set(rightData.Symbol,rightData);var dataItem={ExePrice:exePrice,LeftData:leftData,RightData:rightData};this.MapExePriceData.set(dataItem.ExePrice,dataItem);this.SourceData.Data.push(exePrice);this.Data.Data.push(exePrice);}}if(IFrameSplitOperator.IsNumber(data.price)){this.Data.Price=data.price;}if(IFrameSplitOperator.IsNumber(data.Decimal)){var chart=this.ChartPaint[0];if(chart)chart.DefaultDecimal=data.Decimal;}this.Draw();this.UpdateStockData();};this.GetExePriceData=function(exePrice){if(!this.MapExePriceData)return null;if(!this.MapExePriceData.has(exePrice))return null;return this.MapExePriceData.get(exePrice);};this.UpdateStockData=function(){if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;if(this.MapStockData.size<=0)return;var arySymbol=[];var _iteratorNormalCompletion27=true;var _didIteratorError27=false;var _iteratorError27=undefined;try{for(var _iterator27=(0,_getIterator3.default)(this.MapStockData),_step27;!(_iteratorNormalCompletion27=(_step27=_iterator27.next()).done);_iteratorNormalCompletion27=true){var mapItem=_step27.value;arySymbol.push(mapItem[0]);}}catch(err){_didIteratorError27=true;_iteratorError27=err;}finally{try{if(!_iteratorNormalCompletion27&&_iterator27.return){_iterator27.return();}}finally{if(_didIteratorError27){throw _iteratorError27;}}}if(!IFrameSplitOperator.IsNonEmptyArray(arySymbol))return;this.RequestStockData(arySymbol);};//下载期权数据
|
|
13383
13384
|
this.RequestStockData=function(arySymbol){var self=this;if(this.NetworkFilter){var chart=this.ChartPaint[0];var obj={Name:'JSTReportChartContainer::RequestStockData',//类名::函数名
|
|
13384
|
-
Explain:'T型报价列表期权数据',Request:{Data:{stocks:arySymbol,symbol:this.Symbol,fixedRowCount:chart.FixedRowCount}},Self:this,PreventDefault:false};this.NetworkFilter(obj,function(data){self.RecvStockData(data);self.AutoUpdate();});if(obj.PreventDefault==true)return;}throw{Name:'JSTReportChartContainer::RequestStockData',Error:'(T型报价列表期权数据)不提供内置测试数据'};};this.RecvStockData=function(data){var
|
|
13385
|
+
Explain:'T型报价列表期权数据',Request:{Data:{stocks:arySymbol,symbol:this.Symbol,fixedRowCount:chart.FixedRowCount}},Self:this,PreventDefault:false};this.NetworkFilter(obj,function(data){self.RecvStockData(data);self.AutoUpdate();});if(obj.PreventDefault==true)return;}throw{Name:'JSTReportChartContainer::RequestStockData',Error:'(T型报价列表期权数据)不提供内置测试数据'};};this.RecvStockData=function(data){var _this67=this;var setUpdateSymbol=new _set2.default();//更新的股票列表
|
|
13385
13386
|
if(IFrameSplitOperator.IsNonEmptyArray(data.data)){for(var i=0;i<data.data.length;++i){var item=data.data[i];var symbol=item[0];//0=证券代码;
|
|
13386
13387
|
if(!symbol)continue;var stock=null;if(this.MapStockData.has(symbol)){stock=this.MapStockData.get(symbol);}else{stock=new HQTReportItem();stock.Symbol=symbol;this.MapStockData.set(symbol,stock);}this.ReadStockJsonData(stock,item);if(!setUpdateSymbol.has(symbol))setUpdateSymbol.add(symbol);}}if(IFrameSplitOperator.IsNumber(data.price))this.Data.Price=data.price;if(IFrameSplitOperator.IsNonEmptyArray(data.fixedRowData)){for(var i=0;i<data.fixedRowData.length;++i){var item=data.fixedRowData[i];if(!item||!item.TData)continue;this.FixedRowData.Data[i]=item;}}var chart=this.ChartPaint[0];//实时数据排序
|
|
13387
|
-
if(chart&&(this.SortInfo.Sort==1||this.SortInfo.Sort==2)&&IFrameSplitOperator.IsNumber(this.SortInfo.Field)&&this.SortInfo.Field>=0){var column=chart.Column[this.SortInfo.Field];var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_TREPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column:column,SortInfo:this.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
|
|
13388
|
+
if(chart&&(this.SortInfo.Sort==1||this.SortInfo.Sort==2)&&IFrameSplitOperator.IsNumber(this.SortInfo.Field)&&this.SortInfo.Field>=0){var column=chart.Column[this.SortInfo.Field];var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_TREPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column:column,SortInfo:this.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 _this67.LocalSort(left,right,column,_this67.SortInfo.Sort,_this67.SortInfo.CellType);});}}this.CalculateData();this.Draw();};//计算统计数据
|
|
13388
13389
|
this.CalculateData=function(){if(!this.MapExePriceData||this.MapExePriceData.size<=0)return;var leftMaxPosition={Max:null,ExePrice:null,CellType:1};var rightMaxPosition={Max:null,ExePrice:null,CellType:2};this.BorderData.MapData=new _map2.default();var _iteratorNormalCompletion28=true;var _didIteratorError28=false;var _iteratorError28=undefined;try{for(var _iterator28=(0,_getIterator3.default)(this.MapExePriceData),_step28;!(_iteratorNormalCompletion28=(_step28=_iterator28.next()).done);_iteratorNormalCompletion28=true){var mapItem=_step28.value;var item=mapItem[1];var leftData=item.LeftData;var rightData=item.RightData;if(leftData&&IFrameSplitOperator.IsNumber(leftData.Position)){if(leftMaxPosition.Max==null||leftMaxPosition.Max<leftData.Position){leftMaxPosition.Max=leftData.Position;leftMaxPosition.ExePrice=mapItem[0];}}if(rightData&&IFrameSplitOperator.IsNumber(rightData.Position)){if(rightMaxPosition.Max==null||rightMaxPosition.Max<rightData.Position){rightMaxPosition.Max=rightData.Position;rightMaxPosition.ExePrice=mapItem[0];}}}}catch(err){_didIteratorError28=true;_iteratorError28=err;}finally{try{if(!_iteratorNormalCompletion28&&_iterator28.return){_iterator28.return();}}finally{if(_didIteratorError28){throw _iteratorError28;}}}var aryData=[null,null,null];if(leftMaxPosition.ExePrice)aryData[1]=leftMaxPosition;if(rightMaxPosition.ExePrice)aryData[2]=rightMaxPosition;this.BorderData.MapData.set(TREPORT_COLUMN_ID.POSITION_ID,{Data:aryData});};//读取单条股票json数据
|
|
13389
13390
|
this.ReadStockJsonData=function(stock,item){//0=证券代码 1=股票名称 2=昨收 3=开 4=高 5=低 6=收 7=成交量 8=成交金额, 9=买价 10=买量 11=卖价 12=卖量 13=均价 14=持仓 16=涨停价 17=跌停价
|
|
13390
13391
|
//21=涨幅% 22=涨跌 24=振幅%
|
|
@@ -13413,7 +13414,7 @@ if(IFrameSplitOperator.IsString(item[201])||IFrameSplitOperator.IsObject(item[20
|
|
|
13413
13414
|
var frequency=this.AutoUpdateFrequency;if(marketStatus==1)//盘前
|
|
13414
13415
|
{this.AutoUpdateTimer=setTimeout(function(){self.AutoUpdate();},frequency);}else if(marketStatus==2)//盘中
|
|
13415
13416
|
{this.AutoUpdateTimer=setTimeout(function(){self.UpdateStockData();},frequency);}};//delay=是否延迟
|
|
13416
|
-
this.DelayUpdateStockData=function(){var
|
|
13417
|
+
this.DelayUpdateStockData=function(){var _this68=this;if(this.DelayUpdateTimer!=null){clearTimeout(this.DelayUpdateTimer);this.DelayUpdateTimer=null;}var frequency=this.DelayUpdateFrequency;this.DelayUpdateTimer=setTimeout(function(){_this68.UpdateStockData();},frequency);};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.GetTReportChart();if(chart)chart.OnDblClick(x,y,e);};this.UIOnMouseDown=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)return;var clickData=chart.OnMouseDown(x,y,e);if(!clickData)return;if(clickData.Type==2&&(e.button==0||e.button==2))//点击行
|
|
13417
13418
|
{if(clickData.Redraw==true)this.Draw();}else if(clickData.Type==3&&e.button==0)//表头
|
|
13418
13419
|
{this.OnClickHeader(clickData,e);}//document.onmousemove=(e)=>{ this.DocOnMouseMove(e); }
|
|
13419
13420
|
//document.onmouseup=(e)=> { this.DocOnMouseUp(e); }
|
|
@@ -13429,8 +13430,8 @@ if(tooltipData){if(tooltipData.Type==20){if(tooltipData.Data&&tooltipData.Data.S
|
|
|
13429
13430
|
*/if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;if(bShowChartTooltip){this.ShowMinuteChartTooltip(null,null,chartTooltipData);}else{this.HideMinuteChartTooltip();}if(bShowTooltip){var xTooltip=e.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=e.clientY-this.UIElement.getBoundingClientRect().top;this.DrawFloatTooltip({X:xTooltip,Y:yTooltip,YMove:20/pixelTatio},this.LastMouseStatus.TooltipStatus.Data);}else{this.HideFloatTooltip();}};this.UIOnMounseOut=function(e){this.HideMinuteChartTooltip();};this.UIOnMouseleave=function(e){this.HideMinuteChartTooltip();};this.UIOnContextMenu=function(e){e.preventDefault();var x=e.clientX-this.UIElement.getBoundingClientRect().left;var y=e.clientY-this.UIElement.getBoundingClientRect().top;this.OnRightMenu(x,y,e);//右键菜单事件
|
|
13430
13431
|
};this.OnRightMenu=function(x,y,e){};//点表头
|
|
13431
13432
|
this.OnClickHeader=function(clickData,e){var header=clickData.Header;if(header.Column&&header.Column.Sort==1){var data={CellType:header.CellType,ColumnIndex:header.ColumnIndex};this.SortHeader(header.Column,data);}};//排序
|
|
13432
|
-
this.SortHeader=function(column,sortData){var
|
|
13433
|
-
{this.Data.Data=[];for(var i=0;i<this.SourceData.Data.length;++i){this.Data.Data.push(this.SourceData.Data[i]);}}else{var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_TREPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column: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
|
|
13433
|
+
this.SortHeader=function(column,sortData){var _this69=this;var sortInfo={Field:this.SortInfo.Field,Sort:this.SortInfo.Sort,CellType:this.SortInfo.CellType};var arySortType=column.SortType;if(sortInfo.Field!=sortData.ColumnIndex||sortInfo.CellType!=sortData.CellType){sortInfo.Field=sortData.ColumnIndex;sortInfo.CellType=sortData.CellType;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(sortInfo.Sort==0)//还原
|
|
13434
|
+
{this.Data.Data=[];for(var i=0;i<this.SourceData.Data.length;++i){this.Data.Data.push(this.SourceData.Data[i]);}}else{var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_TREPORT_LOCAL_SORT);if(event&&event.Callback){var sendData={Column: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 _this69.LocalSort(left,right,column,sortInfo.Sort,sortInfo.CellType);});}}this.Data.YOffset=0;this.SortInfo.Field=sortInfo.Field;this.SortInfo.Sort=sortInfo.Sort;this.SortInfo.CellType=sortInfo.CellType;this.Draw();this.DelayUpdateStockData();};//本地排序
|
|
13434
13435
|
this.LocalSort=function(left,right,column,sortType,cellType){switch(column.Type){case TREPORT_COLUMN_ID.SYMBOL_ID:case TREPORT_COLUMN_ID.NAME_ID:return this.LocalStringSort(left,right,column,sortType,cellType);case TREPORT_COLUMN_ID.PRICE_ID:case TREPORT_COLUMN_ID.VOL_ID:case TREPORT_COLUMN_ID.UPDOWN_ID:case TREPORT_COLUMN_ID.BUY_PRICE_ID:case TREPORT_COLUMN_ID.SELL_PRICE_ID:case TREPORT_COLUMN_ID.AMOUNT_ID:case TREPORT_COLUMN_ID.BUY_VOL_ID:case TREPORT_COLUMN_ID.SELL_VOL_ID:case TREPORT_COLUMN_ID.YCLOSE_ID:case TREPORT_COLUMN_ID.OPEN_ID:case TREPORT_COLUMN_ID.HIGH_ID:case TREPORT_COLUMN_ID.LOW_ID:case TREPORT_COLUMN_ID.AVERAGE_PRICE_ID:case TREPORT_COLUMN_ID.EXE_PRICE_ID://行权价格
|
|
13435
13436
|
case TREPORT_COLUMN_ID.POSITION_ID://持仓量
|
|
13436
13437
|
case TREPORT_COLUMN_ID.AMPLITUDE_ID:case TREPORT_COLUMN_ID.INCREASE_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER1_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER2_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER3_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER4_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER5_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER6_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER7_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER8_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER9_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER10_ID:return this.LocalNumberSort(left,right,column,sortType,cellType);default:return 0;}};this.LocalNumberSort=function(left,right,column,sortType,cellType){var leftStock=this.GetExePriceData(left);var rightStock=this.GetExePriceData(right);var leftValue=-99999999999999,rightValue=-99999999999999;if(sortType==2)leftValue=rightValue=99999999999999;var filedName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);if(cellType==0)//行权价格
|
|
@@ -13606,7 +13607,7 @@ this.CanvasElement.height*=pixelTatio;this.CanvasElement.width*=pixelTatio;JSCon
|
|
|
13606
13607
|
//注册事件
|
|
13607
13608
|
if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}if(option.EnableResize==true)this.CreateResizeListener();chart.Draw();};this.CreateJSKeyboardChartContainer=function(option){var chart=new JSKeyboardChartContainer(this.CanvasElement);chart.Create(option);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;if(IFrameSplitOperator.IsNonEmptyArray(option.Column))chart.SetColumn(option.Column);if(IFrameSplitOperator.IsNumber(option.BorderLine))chart.Frame.BorderLine=option.BorderLine;this.SetChartBorder(chart,option);//注册事件
|
|
13608
13609
|
if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}return chart;};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;if(IFrameSplitOperator.IsNumber(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;if(IFrameSplitOperator.IsNumber(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;if(IFrameSplitOperator.IsNumber(option.Border.Bottom))chart.Frame.ChartBorder.Bottom=option.Border.Bottom;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
13609
|
-
chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;};this.CreateResizeListener=function(){var
|
|
13610
|
+
chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;};this.CreateResizeListener=function(){var _this70=this;this.ResizeListener=new ResizeObserver(function(entries){_this70.OnDivResize(entries);});this.ResizeListener.observe(this.DivElement);};this.OnDivResize=function(entries){JSConsole.Chart.Log("[JSKeyboardChart::OnDivResize] entries=",entries);this.OnSize();};/////////////////////////////////////////////////////////////////////////////
|
|
13610
13611
|
//对外接口
|
|
13611
13612
|
this.SetColumn=function(aryColumn,option){if(this.JSChartContainer)this.JSChartContainer.SetColumn(aryColumn,option);};//事件回调
|
|
13612
13613
|
this.AddEventCallback=function(obj){if(this.JSChartContainer&&typeof this.JSChartContainer.AddEventCallback=='function'){JSConsole.Chart.Log('[JSKeyboardChart:AddEventCallback] obj=',obj);this.JSChartContainer.AddEventCallback(obj);}};//重新加载配置
|
|
@@ -13642,11 +13643,11 @@ var aryFuncKeyQuery=null;this.MapSymbol.clear();this.Data.Data=[];this.Data.XOff
|
|
|
13642
13643
|
}
|
|
13643
13644
|
this.ChartPaint[0].SelectedRow=0;
|
|
13644
13645
|
*/};//创建
|
|
13645
|
-
this.Create=function(option){var
|
|
13646
|
+
this.Create=function(option){var _this71=this;this.UIElement.JSChartContainer=this;//创建框架
|
|
13646
13647
|
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;//创建表格
|
|
13647
|
-
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
|
|
13648
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
13649
|
-
this.UIElement.ondblclick=function(e){
|
|
13648
|
+
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 _this71.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this71.GetStockData(symbol);};chart.Data=this.Data;this.ChartPaint[0]=chart;chart.VScrollbar=new ChartKeyboardVScrollbar();chart.VScrollbar.Frame=this.Frame;chart.VScrollbar.Canvas=this.Canvas;chart.VScrollbar.ChartBorder=this.Frame.ChartBorder;chart.VScrollbar.Report=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){_this71.OnKeyDown(e);},true);//键盘消息
|
|
13649
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this71.OnWheel(e);},true);//上下滚动消息
|
|
13650
|
+
this.UIElement.ondblclick=function(e){_this71.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this71.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this71.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this71.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this71.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this71.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();//获取设备的分辨率
|
|
13650
13651
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
13651
13652
|
this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
13652
13653
|
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;}};//设置事件回调
|
|
@@ -13663,14 +13664,14 @@ var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();}brea
|
|
|
13663
13664
|
if(this.MoveXOffset(-1))this.Draw();break;case 39://right
|
|
13664
13665
|
if(this.MoveXOffset(1))this.Draw();break;case 13://Enter
|
|
13665
13666
|
this.OnSelectedSymbol();break;}//不让滚动条滚动
|
|
13666
|
-
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 selItem=this.MapSymbol.get(data.Symbol);if(!selItem)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SELECTED);if(event&&event.Callback){event.Callback(event,{Data:data,RowData:selItem},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
|
|
13667
|
+
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 selItem=this.MapSymbol.get(data.Symbol);if(!selItem)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SELECTED);if(event&&event.Callback){event.Callback(event,{Data:data,RowData:selItem},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 _this72=this;this.DragYScroll=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;
|
|
13667
13668
|
if(clickData.Type==2&&(e.button==0||e.button==2))//点击行
|
|
13668
13669
|
{if(clickData.Redraw==true)this.Draw();}else if(clickData.Type==5&&e.button==0)//右侧滚动条
|
|
13669
13670
|
{var scroll=clickData.VScrollbar;if(scroll.Type==1)//顶部按钮
|
|
13670
13671
|
{if(this.MoveYOffset(-1))this.Draw();}else if(scroll.Type==2)//底部按钮
|
|
13671
13672
|
{if(this.MoveYOffset(1))this.Draw();}else if(scroll.Type==3)//滚动条
|
|
13672
13673
|
{this.DragYScroll={Click:{X:x,Y:y},LastMove:{X:x,Y:y}};}else if(scroll.Type==4)//滚动条内部
|
|
13673
|
-
{if(this.SetYOffset(scroll.Pos))this.Draw();}}}document.onmousemove=function(e){
|
|
13674
|
+
{if(this.SetYOffset(scroll.Pos))this.Draw();}}}document.onmousemove=function(e){_this72.DocOnMouseMove(e);};document.onmouseup=function(e){_this72.DocOnMouseUp(e);};};//去掉右键菜单
|
|
13674
13675
|
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)
|
|
13675
13676
|
// this.StopAutoDragScrollTimer();
|
|
13676
13677
|
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;if(this.DragYScroll){var chart=this.ChartPaint[0];if(!chart||!chart.VScrollbar)return;this.DragYScroll.LastMove.X=x;this.DragYScroll.LastMove.Y=y;var pos=chart.VScrollbar.GetScrollPostionByPoint(x,y);if(this.SetYOffset(pos))this.Draw();}};this.DocOnMouseUp=function(e){//清空事件
|
|
@@ -13759,7 +13760,7 @@ var height=this.DivElement.offsetHeight;var width=this.DivElement.offsetWidth;if
|
|
|
13759
13760
|
this.CanvasElement.height*=pixelTatio;this.CanvasElement.width*=pixelTatio;JSConsole.Chart.Log('[JSScrollBarChart::OnSize] devicePixelRatio='+window.devicePixelRatio+', height='+this.CanvasElement.height+', width='+this.CanvasElement.width);if(this.JSChartContainer&&this.JSChartContainer.OnSize){this.JSChartContainer.OnSize();}};this.SetOption=function(option){var chart=this.CreateJSScrollBarChartContainer(option);if(!chart)return false;this.JSChartContainer=chart;this.DivElement.JSChart=this;//div中保存一份
|
|
13760
13761
|
if(option.EnableResize==true)this.CreateResizeListener();if(option.OnCreatedCallback)option.OnCreatedCallback(chart);chart.Draw();};this.CreateJSScrollBarChartContainer=function(option){var chart=new JSScrollBarChartContainer(this.CanvasElement);chart.Create(option);if(IFrameSplitOperator.IsNumber(option.DelayDragFrequency))chart.DelayDragFrequency=option.DelayDragFrequency;this.SetChartBorder(chart,option);//注册事件
|
|
13761
13762
|
if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}return chart;};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;if(IFrameSplitOperator.IsNumber(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;if(IFrameSplitOperator.IsNumber(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;if(IFrameSplitOperator.IsNumber(option.Border.Bottom))chart.Frame.ChartBorder.Bottom=option.Border.Bottom;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
13762
|
-
chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;if(IFrameSplitOperator.IsBool(item.AutoLeft))chart.AutoMargin.Left=item.AutoLeft;if(IFrameSplitOperator.IsBool(item.AutoRight))chart.AutoMargin.Right=item.AutoRight;};this.CreateResizeListener=function(){var
|
|
13763
|
+
chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;if(IFrameSplitOperator.IsBool(item.AutoLeft))chart.AutoMargin.Left=item.AutoLeft;if(IFrameSplitOperator.IsBool(item.AutoRight))chart.AutoMargin.Right=item.AutoRight;};this.CreateResizeListener=function(){var _this73=this;this.ResizeListener=new ResizeObserver(function(entries){_this73.OnDivResize(entries);});this.ResizeListener.observe(this.DivElement);};this.OnDivResize=function(entries){JSConsole.Chart.Log("[JSScrollBarChart::OnDivResize] entries=",entries);this.OnSize();};/////////////////////////////////////////////////////////////////////////////
|
|
13763
13764
|
//对外接口
|
|
13764
13765
|
//事件回调
|
|
13765
13766
|
this.AddEventCallback=function(obj){if(this.JSChartContainer&&typeof this.JSChartContainer.AddEventCallback=='function'){JSConsole.Chart.Log('[JSScrollBarChart:AddEventCallback] obj=',obj);this.JSChartContainer.AddEventCallback(obj);}};//重新加载配置
|
|
@@ -13792,28 +13793,28 @@ this.HQChart=null;this.ChartDestory=function()//销毁
|
|
|
13792
13793
|
//{event:事件id, callback:回调函数}
|
|
13793
13794
|
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)//获取事件回调
|
|
13794
13795
|
{if(!this.mapEvent.has(id))return null;var item=this.mapEvent.get(id);return item;};//创建
|
|
13795
|
-
this.Create=function(option){var
|
|
13796
|
+
this.Create=function(option){var _this74=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
13796
13797
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
|
|
13797
13798
|
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;//背景
|
|
13798
|
-
var chart=new ScrollBarBGChart();chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return
|
|
13799
|
-
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
|
|
13800
|
-
this.UIElement.onmousedown=function(e){
|
|
13799
|
+
var chart=new ScrollBarBGChart();chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this74.GetEventCallback(id);};this.ChartPaint.push(chart);//创建滑块
|
|
13800
|
+
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 _this74.GetEventCallback(id);};this.SliderChart=chart;this.ChartPaint.push(chart);//this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
|
|
13801
|
+
this.UIElement.onmousedown=function(e){_this74.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this74.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this74.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this74.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this74.UIOnMouseleave(e);};//手机拖拽
|
|
13801
13802
|
//this.UIElement.ontouchstart=(e)=> { this.OnTouchStart(e); }
|
|
13802
13803
|
//this.UIElement.ontouchmove=(e)=> {this.OnTouchMove(e); }
|
|
13803
13804
|
//this.UIElement.ontouchend=(e)=> {this.OnTouchEnd(e); }
|
|
13804
13805
|
};//创建一个图形
|
|
13805
|
-
this.CreateChartPaint=function(name){var
|
|
13806
|
+
this.CreateChartPaint=function(name){var _this75=this;var chart=g_ChartPaintFactory.Create(name);if(!chart)return null;chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.Data=this.Frame.Data;chart.GetEventCallback=function(id){return _this75.GetEventCallback(id);};chart.GetHQChartCallback=function(){return _this75.GetHQChart();};return chart;};this.GetChartPaintByClassName=function(name){for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.ClassName==name){return{Chart:item,Index:i};}}return null;};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();//获取设备的分辨率
|
|
13806
13807
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
13807
13808
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
13808
13809
|
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;}};//未启动
|
|
13809
|
-
this.UIOnDblClick=function(e){};this.CancelDragTimer=function(){if(this.DragTimer){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.UIOnMouseDown=function(e){var
|
|
13810
|
+
this.UIOnDblClick=function(e){};this.CancelDragTimer=function(){if(this.DragTimer){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.UIOnMouseDown=function(e){var _this76=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){if(!this.Frame.PtInClient(x,y))return;//滚动块直接移动到鼠标点击的位置
|
|
13810
13811
|
var index=this.Frame.GetXData(x);index=Math.round(index);var pageRange=this.GetPageRange();var showCount=pageRange.ShowCount;var start=index-parseInt(showCount/2);if(start<0)start=0;var end=start+showCount;if(end>=this.Frame.XPointCount){end=this.Frame.XPointCount-1;start=end-showCount;}var drag={UpdateData:{StartIndex:start,EndIndex:end,Type:3}};this.DragUpdate(drag);return;}this.DragSlider={Click:{X:e.clientX,Y:e.clientY},LastMove:{X:e.clientX,Y:e.clientY},Data:clickData};this.DragSlider.DrawCount=0;//重绘次数
|
|
13811
|
-
}document.onmousemove=function(e){
|
|
13812
|
+
}document.onmousemove=function(e){_this76.DocOnMouseMove(e);};document.onmouseup=function(e){_this76.DocOnMouseUp(e);};};//去掉右键菜单
|
|
13812
13813
|
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"};;//鼠标状态
|
|
13813
|
-
var item=this.SliderChart.PtInChart(x,y);if(item){switch(item.Data.Type){case 0:mouseStatus={Cursor:"grab",Name:"SliderChart"};break;case 1:case 2:mouseStatus={Cursor:"col-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
|
|
13814
|
+
var item=this.SliderChart.PtInChart(x,y);if(item){switch(item.Data.Type){case 0:mouseStatus={Cursor:"grab",Name:"SliderChart"};break;case 1:case 2:mouseStatus={Cursor:"col-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 _this77=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)//整体移动
|
|
13814
13815
|
{if(xStart<left)//第1页
|
|
13815
13816
|
{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)//左移动
|
|
13816
|
-
{if(xStart<=left){xStart=pageRange.First.XStart;}else if(xStart>=right){xStart=pageRange.Last.XEnd;}this.SliderChart.XStart=xStart;}else if(type==2){if(xEnd>=right){xEnd=pageRange.Last.XEnd;}else if(xEnd<=left){xEnd=pageRange.First.XStart;}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(){
|
|
13817
|
+
{if(xStart<=left){xStart=pageRange.First.XStart;}else if(xStart>=right){xStart=pageRange.Last.XEnd;}this.SliderChart.XStart=xStart;}else if(type==2){if(xEnd>=right){xEnd=pageRange.Last.XEnd;}else if(xEnd<=left){xEnd=pageRange.First.XStart;}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(){_this77.DragUpdate(_this77.DragSlider);},this.DelayDragFrequency);}}};this.DocOnMouseUp=function(e){//清空事件
|
|
13817
13818
|
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: }
|
|
13818
13819
|
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();};//移动滑块
|
|
13819
13820
|
this.UpdateXDataOffset=function(obj){if(!obj)return;var type=obj.Type;if(obj.Type==0){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start+0.5);//四舍五入
|
|
@@ -13879,25 +13880,25 @@ this.AreaColor=g_JSChartResource.ScrollBar.BGChart.AreaColor;//面积图颜色
|
|
|
13879
13880
|
内置菜单 使用table模式
|
|
13880
13881
|
*/function JSPopMenu(){this.Data={Menu:[],Position:0};//{ Name:, SVG, ID, bChecked:, SubMenu:[] } Position 0=右键菜单 1=Tab弹菜单 2=下拉菜单
|
|
13881
13882
|
this.RootDOM=null;this.TBodyDOM=null;this.ArySubRootDOM=[];this.ClickCallback=null;//点击回调
|
|
13882
|
-
this.CheckedClassName="UMyChart_MenuItem_Span_Checked iconfont icon-checked";//选中图标
|
|
13883
|
+
this.RestoreFocusCallback=null;this.CheckedClassName="UMyChart_MenuItem_Span_Checked iconfont icon-checked";//选中图标
|
|
13883
13884
|
this.RightArrowClassName="UMyChart_MenuItem_Span_Arrow iconfont icon-menu_arraw_right";//右侧箭头
|
|
13884
|
-
this.SelectedClassName="UMyChart_MenuItem_Tr_Selected";this.AryTDClassName=["UMyChart_MenuItem_Td_Status",//图标
|
|
13885
|
+
this.SelectedClassName="UMyChart_MenuItem_Tr_Selected";this.RestoreFocusDelay=1000;this.AryTDClassName=["UMyChart_MenuItem_Td_Status",//图标
|
|
13885
13886
|
"UMyChart_MenuItem_Td_Content",//文字
|
|
13886
13887
|
"UMyChart_MenuItem_Td_Shortcut",//快捷方式
|
|
13887
13888
|
"UMyChart_MenuItem_Td_Arrow"//箭头
|
|
13888
|
-
];this.Inital=function(){var
|
|
13889
|
-
this.CreatePopMenu=function(data){this.Clear();if(!IFrameSplitOperator.IsNonEmptyArray(data.Menu))return;var root=document.createElement("div");root.className="UMyChart_PopMenu";var table=document.createElement("table");table.className="UMyChart_PopMenu_Table";root.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_PopMenu_Tbody";table.appendChild(tbody);var rootData={Root:root,TBody:tbody,Table:table};root.JSMenuData=rootData;for(var i=0;i<data.Menu.length;++i){var item=data.Menu[i];if(item.Name==JSPopMenu.SEPARATOR_LINE_NAME){var trSeparator=this.CreateSeparatorTr();if(trSeparator)tbody.appendChild(trSeparator);continue;}var trDom=this.CreateMenu(rootData,item);tbody.appendChild(trDom);}document.body.appendChild(root);this.RootDOM=root;this.TBodyDOM=tbody;if(IFrameSplitOperator.IsNumber(data.Position))this.Data.Position=data.Position;if(data.ClickCallback)this.ClickCallback=data.ClickCallback;};//清除菜单
|
|
13890
|
-
this.Clear=function(){this.Data.Menu=[];this.Data.Position=JSPopMenu.POSITION_ID.RIGHT_MENU_ID;this.ClickCallback=null;if(!this.RootDOM)return;document.body.removeChild(this.RootDOM);this.RootDOM=null;this.TBodyDOM=null;for(var i=0;i<this.ArySubRootDOM.length;++i){document.body.removeChild(this.ArySubRootDOM[i]);}this.ArySubRootDOM=[];};this.CreateMenu=function(parentItem,item){var
|
|
13889
|
+
];this.Inital=function(hqchart,option){var _this78=this;this.HQChart=hqchart;window.addEventListener('mousedown',function(e){_this78.OnWindowMouseDown(e);});};//创建菜单
|
|
13890
|
+
this.CreatePopMenu=function(data){this.Clear();if(!IFrameSplitOperator.IsNonEmptyArray(data.Menu))return;var root=document.createElement("div");root.className="UMyChart_PopMenu";var table=document.createElement("table");table.className="UMyChart_PopMenu_Table";root.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_PopMenu_Tbody";table.appendChild(tbody);var rootData={Root:root,TBody:tbody,Table:table};root.JSMenuData=rootData;for(var i=0;i<data.Menu.length;++i){var item=data.Menu[i];if(item.Name==JSPopMenu.SEPARATOR_LINE_NAME){var trSeparator=this.CreateSeparatorTr();if(trSeparator)tbody.appendChild(trSeparator);continue;}var trDom=this.CreateMenu(rootData,item);tbody.appendChild(trDom);}document.body.appendChild(root);this.RootDOM=root;this.TBodyDOM=tbody;if(IFrameSplitOperator.IsNumber(data.Position))this.Data.Position=data.Position;if(data.ClickCallback)this.ClickCallback=data.ClickCallback;if(data.RestoreFocusCallback)this.RestoreFocusCallback=data.RestoreFocusCallback;};//清除菜单
|
|
13891
|
+
this.Clear=function(){this.Data.Menu=[];this.Data.Position=JSPopMenu.POSITION_ID.RIGHT_MENU_ID;this.ClickCallback=null;if(!this.RootDOM)return;document.body.removeChild(this.RootDOM);this.RootDOM=null;this.TBodyDOM=null;for(var i=0;i<this.ArySubRootDOM.length;++i){document.body.removeChild(this.ArySubRootDOM[i]);}this.ArySubRootDOM=[];};this.CreateMenu=function(parentItem,item){var _this79=this;var trDom=document.createElement("tr");trDom.className='UMyChart_MenuItem_Tr';if(item.Disable===true)trDom.classList.add('UMyChart_DrawTool_Disable_Tr');var prtTdDom=null;for(var i=0;i<this.AryTDClassName.length;++i){var tdDom=document.createElement("td");tdDom.className=this.AryTDClassName[i];if(i==0)//图标
|
|
13891
13892
|
{if(item.Checked){var spanDom=document.createElement("span");spanDom.className=this.CheckedClassName;spanDom.style["font-size"]="10px";tdDom.appendChild(spanDom);}}else if(i==1)//内容
|
|
13892
13893
|
{tdDom.innerText=item.Name;}else if(i==2)//快捷方式
|
|
13893
13894
|
{if(item.Text)tdDom.innerText=item.Text;}else if(i==3)//箭头
|
|
13894
13895
|
{if(IFrameSplitOperator.IsNonEmptyArray(item.SubMenu)){var spanDom=document.createElement("span");spanDom.className=this.RightArrowClassName;spanDom.style["font-size"]="10px";tdDom.appendChild(spanDom);}}trDom.appendChild(tdDom);}if(IFrameSplitOperator.IsNonEmptyArray(item.SubMenu))//子菜单
|
|
13895
|
-
{var subRoot=document.createElement("div");subRoot.className="UMyChart_PopSubMenu";var subTable=document.createElement("table");subTable.className="UMyChart_PopMenu_Table";subRoot.appendChild(subTable);var subTbody=document.createElement("tbody");subTbody.className="UMyChart_PopMenu_TBody";subTable.appendChild(subTbody);var subRootData={Root:subRoot,TBody:subTbody,Table:subTable};subRoot.JSMenuData=subRootData;var preTrDom=null;for(var i=0;i<item.SubMenu.length;++i){var subItem=item.SubMenu[i];if(subItem.Name==JSPopMenu.SEPARATOR_LINE_NAME){var trSeparator=this.CreateSeparatorTr();if(trSeparator)subTbody.appendChild(trSeparator);continue;}var subTrDom=this.CreateMenu(subRootData,subItem);preTrDom=subTrDom;subTbody.appendChild(subTrDom);}trDom.onmouseover=function(e){
|
|
13896
|
-
trDom.onmouseover=function(e){
|
|
13897
|
-
this.PopupMenuByTab=function(rtTab){if(!this.RootDOM)return;if(!rtTab)return;var xLeft=rtTab.Left;var yTop=rtTab.Top-this.RootDOM.offsetHeight;this.RootDOM.style.visibility='visible';this.RootDOM.style.top=yTop+"px";this.RootDOM.style.left=xLeft+"px";};//弹右键菜单
|
|
13898
|
-
this.PopupMenuByRight=function(x,y){if(!this.RootDOM)return;if(!IFrameSplitOperator.IsNumber(x)||!IFrameSplitOperator.IsNumber(y))return;//菜单在当前屏幕无法显示需要调整
|
|
13896
|
+
{var subRoot=document.createElement("div");subRoot.className="UMyChart_PopSubMenu";var subTable=document.createElement("table");subTable.className="UMyChart_PopMenu_Table";subRoot.appendChild(subTable);var subTbody=document.createElement("tbody");subTbody.className="UMyChart_PopMenu_TBody";subTable.appendChild(subTbody);var subRootData={Root:subRoot,TBody:subTbody,Table:subTable};subRoot.JSMenuData=subRootData;var preTrDom=null;for(var i=0;i<item.SubMenu.length;++i){var subItem=item.SubMenu[i];if(subItem.Name==JSPopMenu.SEPARATOR_LINE_NAME){var trSeparator=this.CreateSeparatorTr();if(trSeparator)subTbody.appendChild(trSeparator);continue;}var subTrDom=this.CreateMenu(subRootData,subItem);preTrDom=subTrDom;subTbody.appendChild(subTrDom);}trDom.onmouseover=function(e){_this79.OnMouseOver(e,parentItem,trDom,subRoot);};document.body.appendChild(subRoot);this.ArySubRootDOM.push(subRoot);}else{if(item.Disable===true){}else{trDom.onmousedown=function(e){_this79.OnClickMenu(e,item,false);};//菜单点击
|
|
13897
|
+
trDom.onmouseover=function(e){_this79.OnMouseOver(e,parentItem);};}}return trDom;};this.CreateSeparatorTr=function(){var trSeparator=document.createElement("tr");trSeparator.className='UMyChart_MenuItem_Tr_Separator';var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Status_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);return trSeparator;};//弹tab菜单
|
|
13898
|
+
this.PopupMenuByTab=function(rtTab){if(!this.RootDOM)return;if(!rtTab)return;if(this.HQChart)this.HQChart.ClearRestoreFocusTimer();var xLeft=rtTab.Left;var yTop=rtTab.Top-this.RootDOM.offsetHeight;this.RootDOM.style.visibility='visible';this.RootDOM.style.top=yTop+"px";this.RootDOM.style.left=xLeft+"px";};//弹右键菜单
|
|
13899
|
+
this.PopupMenuByRight=function(x,y){if(!this.RootDOM)return;if(!IFrameSplitOperator.IsNumber(x)||!IFrameSplitOperator.IsNumber(y))return;if(this.HQChart)this.HQChart.ClearRestoreFocusTimer();//菜单在当前屏幕无法显示需要调整
|
|
13899
13900
|
var menuHeight=this.RootDOM.offsetHeight;var yMenuBottom=y+menuHeight;var yBottom=window.innerHeight-15;if(yMenuBottom>yBottom)y=yBottom-menuHeight;var menuWidth=this.RootDOM.offsetWidth;var yMenuRight=x+menuWidth;var yRight=window.innerWidth-15;if(yMenuRight>yRight)x=yRight-menuWidth;this.RootDOM.style.visibility='visible';this.RootDOM.style.top=y+"px";this.RootDOM.style.left=x+"px";};//下拉菜单
|
|
13900
|
-
this.PopupMenuByDrapdown=function(rtButton){if(!this.RootDOM)return;if(!rtButton)return;var xLeft=rtButton.Left;var yTop=rtButton.Bottom;var menuHeight=this.RootDOM.offsetHeight;var yMenuBottom=yTop+menuHeight;var yBottom=window.innerHeight-15;if(yMenuBottom>yBottom)yTop=rtButton.Top-menuHeight;if(this.Data.Position==JSPopMenu.POSITION_ID.DROPDOWN_RIGHT_MENU_ID){var menuWidth=this.RootDOM.offsetWidth;xLeft=rtButton.Right-menuWidth;}this.RootDOM.style.visibility='visible';this.RootDOM.style.top=yTop+"px";this.RootDOM.style.left=xLeft+"px";};this.OnClickMenu=function(e,item,bSubMenu){console.log("[JSPopMenu::OnClickMenu] e=, item=, bSubMenu",e,item,bSubMenu);if(!this.ClickCallback)return;this.ClickCallback(item);};this.OnMouseOver=function(e,parentItem,trDom,subMenu){if(parentItem&&parentItem.PopMenu&&parentItem.PopMenu!=subMenu){parentItem.PopMenu.style.visibility="hidden";if(parentItem.PopRow)parentItem.PopRow.classList.remove(this.SelectedClassName);var popMenuData=parentItem.PopMenu.JSMenuData;for(var i=0;i<50;++i)//隐藏子菜单 最多50层
|
|
13901
|
+
this.PopupMenuByDrapdown=function(rtButton){if(!this.RootDOM)return;if(!rtButton)return;if(this.HQChart)this.HQChart.ClearRestoreFocusTimer();var xLeft=rtButton.Left;var yTop=rtButton.Bottom;var menuHeight=this.RootDOM.offsetHeight;var yMenuBottom=yTop+menuHeight;var yBottom=window.innerHeight-15;if(yMenuBottom>yBottom)yTop=rtButton.Top-menuHeight;if(this.Data.Position==JSPopMenu.POSITION_ID.DROPDOWN_RIGHT_MENU_ID){var menuWidth=this.RootDOM.offsetWidth;xLeft=rtButton.Right-menuWidth;}this.RootDOM.style.visibility='visible';this.RootDOM.style.top=yTop+"px";this.RootDOM.style.left=xLeft+"px";};this.OnClickMenu=function(e,item,bSubMenu){console.log("[JSPopMenu::OnClickMenu] e=, item=, bSubMenu",e,item,bSubMenu);if(!this.ClickCallback)return;this.ClickCallback(item);};this.OnMouseOver=function(e,parentItem,trDom,subMenu){if(parentItem&&parentItem.PopMenu&&parentItem.PopMenu!=subMenu){parentItem.PopMenu.style.visibility="hidden";if(parentItem.PopRow)parentItem.PopRow.classList.remove(this.SelectedClassName);var popMenuData=parentItem.PopMenu.JSMenuData;for(var i=0;i<50;++i)//隐藏子菜单 最多50层
|
|
13901
13902
|
{if(!popMenuData)break;if(!popMenuData.PopMenu)break;popMenuData.PopMenu.style.visibility="hidden";popMenuData=popMenuData.PopMenu;}parentItem.PopMenu=null;parentItem.PopRow=null;}if(subMenu){if(subMenu.style.visibility=="visible"){}else{var rtParent=trDom.getBoundingClientRect();var x=rtParent.right,y=rtParent.top;//菜单在当前屏幕无法显示需要调整
|
|
13902
13903
|
var yBottom=window.innerHeight-15;var yRight=window.innerWidth-15;var menuHeight=subMenu.offsetHeight;var menuWidth=subMenu.offsetWidth;var yMenuBottom=y+menuHeight;var yMenuRight=x+menuWidth;if(yMenuBottom>yBottom)y=yBottom-menuHeight;if(yMenuRight>yRight)x=rtParent.left-menuWidth;subMenu.style.left=x+'px';subMenu.style.top=y+'px';trDom.classList.add(this.SelectedClassName);/*
|
|
13903
13904
|
if (this.Data.Position==JSPopMenu.POSITION_ID.TAB_MENU_ID)
|
|
@@ -13910,7 +13911,7 @@ var yBottom=window.innerHeight-15;var yRight=window.innerWidth-15;var menuHeight
|
|
|
13910
13911
|
subMenu.style.top=`${yOffset}px`;
|
|
13911
13912
|
}
|
|
13912
13913
|
}
|
|
13913
|
-
*/subMenu.style.visibility="visible";}parentItem.PopMenu=subMenu;parentItem.PopRow=trDom;}};this.OnWindowMouseDown=function(e){if(!this.RootDOM)return;console.log("[JSPopMenu::OnWindowMouseDown] e=",e);this.Clear();};}JSPopMenu.POSITION_ID={};JSPopMenu.POSITION_ID.RIGHT_MENU_ID=0;JSPopMenu.POSITION_ID.TAB_MENU_ID=1;JSPopMenu.POSITION_ID.DROPDOWN_MENU_ID=2;//左对齐下拉
|
|
13914
|
+
*/subMenu.style.visibility="visible";}parentItem.PopMenu=subMenu;parentItem.PopRow=trDom;}};this.OnWindowMouseDown=function(e){if(!this.RootDOM)return;console.log("[JSPopMenu::OnWindowMouseDown] e=",e);this.Clear();if(this.HQChart)this.HQChart.RestoreFocus(this.RestoreFocusDelay);};}JSPopMenu.POSITION_ID={};JSPopMenu.POSITION_ID.RIGHT_MENU_ID=0;JSPopMenu.POSITION_ID.TAB_MENU_ID=1;JSPopMenu.POSITION_ID.DROPDOWN_MENU_ID=2;//左对齐下拉
|
|
13914
13915
|
JSPopMenu.POSITION_ID.DROPDOWN_RIGHT_MENU_ID=3;//右对齐下拉
|
|
13915
13916
|
JSPopMenu.SEPARATOR_LINE_NAME="MENU_SEPARATOR";//分割线
|
|
13916
13917
|
/*
|
|
@@ -13928,17 +13929,17 @@ CMD_DELETE_DRAW_CHART_ID:6,CMD_CHANGE_FONT_COLOR_ID:7,//切换字体颜色
|
|
|
13928
13929
|
CMD_CHANGE_BG_COLOR_ID:8,//切换背景色
|
|
13929
13930
|
CMD_CHANGE_BORDER_COLOR_ID:9,//边框颜色
|
|
13930
13931
|
CMD_LOCK_DRAW_CHART_ID:10//上锁
|
|
13931
|
-
};function JSDialogDrawTool(){this.AryChartGroup=[{Title:"线段",AryChart:[{Title:'线段',ClassName:'hqchart_drawtool icon-draw_line',Type:0,Data:{ID:"线段"}},{Title:'线段信息',ClassName:'hqchart_drawtool icon-infoline',Type:0,Data:{ID:"InfoLine"}},{Title:'射线',ClassName:'hqchart_drawtool icon-draw_rays',Type:0,Data:{ID:"射线"}},{Title:"趋势线角度",ClassName:"hqchart_drawtool icon-qushixianjiaodu",Type:0,Data:{ID:"TrendAngle"}},{Title:'标价线',ClassName:'hqchart_drawtool icon-price_line',Type:0,Data:{ID:"标价线"}},{Title:'垂直线',ClassName:'hqchart_drawtool icon-vertical_line',Type:0,Data:{ID:"垂直线"}},{Title:'十字线',ClassName:'hqchart_drawtool icon-tubiao_shizixian',Type:0,Data:{ID:"十字线"}},{Title:'箭头',ClassName:'hqchart_drawtool icon-bottom-arrow-solid',Type:0,Data:{ID:"箭头"}},{Title:'大箭头',ClassName:'hqchart_drawtool icon-big_arrow',Type:0,Data:{ID:"ArrowMarker"}},{Title:'趋势线',ClassName:'hqchart_drawtool icon-draw_trendline',Type:0,Data:{ID:"趋势线"}},{Title:'水平线',ClassName:'hqchart_drawtool icon-draw_hline',Type:0,Data:{ID:"水平线"}},{Title:'水平射线',ClassName:'hqchart_drawtool icon-tubiao_shuipingshexian',Type:0,Data:{ID:"水平射线"}},{Title:'涂鸦线段',ClassName:'hqchart_drawtool icon-draw_line',Type:0,Data:{ID:"涂鸦线段"}},{Title:'阻速线',ClassName:'hqchart_drawtool icon-draw_resline',Type:0,Data:{ID:"阻速线"}},{Title:'通达信阻速线',ClassName:'hqchart_drawtool icon-draw_resline',Type:0,Data:{ID:"阻速线2"}},{Title:'江恩角度线',ClassName:'hqchart_drawtool icon-jiangenjiaoduxian',Type:0,Data:{ID:"江恩角度线"}},{Title:'通达信江恩角度线',ClassName:'hqchart_drawtool icon-jiangenjiaoduxian',Type:0,Data:{ID:"江恩角度线2"}}]},{Title:"通道",AryChart:[{Title:'平行线',ClassName:'hqchart_drawtool icon-draw_parallel_lines',Type:0,Data:{ID:"平行线"}},{Title:'水平线段',ClassName:'hqchart_drawtool icon-draw_hlinesegment',Type:0,Data:{ID:"水平线段"}},{Title:'平行射线',ClassName:'hqchart_drawtool icon-draw_p_rays_lines',Type:0,Data:{ID:"平行射线"}},{Title:'平行通道',ClassName:'hqchart_drawtool icon-draw_parallelchannel',Type:0,Data:{ID:"平行通道"}},{Title:'价格通道线',ClassName:'hqchart_drawtool icon-draw_pricechannel',Type:0,Data:{ID:"价格通道线"}},{Title:'箱型线',ClassName:'hqchart_drawtool icon-draw_box',Type:0,Data:{ID:"箱型线"}},{Title:"不相交通道",ClassName:"hqchart_drawtool icon-buxiangjiaojiao",Type:0,Data:{ID:"DisjointChannel"}},{Title:"平滑顶/底",ClassName:"hqchart_drawtool icon-tubiao_buxiangjiaotongdao",Type:0,Data:{ID:"FlatTop"}},{Title:"波段线",ClassName:'hqchart_drawtool icon-draw_waveband',Type:0,Data:{ID:"波段线"}},{Title:"百分比线",ClassName:'hqchart_drawtool icon-PercentageLine',Type:0,Data:{ID:"百分比线"}},{Title:"黄金分割",ClassName:'hqchart_drawtool icon-GoldenSection',Type:0,Data:{ID:"黄金分割"}},{Title:"线形回归线",ClassName:'hqchart_drawtool icon-linear_3',Type:0,Data:{ID:"线形回归线"}},{Title:"线形回归带",ClassName:'hqchart_drawtool icon-linear_1',Type:0,Data:{ID:"线形回归带"}},{Title:"延长线形回归带",ClassName:'hqchart_drawtool icon-linear_2',Type:0,Data:{ID:"延长线形回归带"}}]},{Title:"形状",AryChart:[{Title:'圆弧线',ClassName:'hqchart_drawtool icon-draw_arc',Type:0,Data:{ID:"圆弧线"}},{Title:'矩形',ClassName:'hqchart_drawtool icon-rectangle',Type:0,Data:{ID:"矩形"}},{Title:'平行四边形',ClassName:'hqchart_drawtool icon-draw_quadrangle',Type:0,Data:{ID:"平行四边形"}},{Title:'三角形',ClassName:'hqchart_drawtool icon-draw_triangle',Type:0,Data:{ID:"三角形"}},{Title:'圆',ClassName:'hqchart_drawtool icon-draw_circle',Type:0,Data:{ID:"圆"}},{Title:'对称角度',ClassName:'hqchart_drawtool icon-draw_symangle',Type:0,Data:{ID:"对称角度"}}]},{Title:"波浪线",AryChart:[{Title:'M头W底',ClassName:'hqchart_drawtool icon-draw_wavemw',Type:0,Data:{ID:"M头W底"}},{Title:'头肩型',ClassName:'hqchart_drawtool icon-draw_head_shoulders_bt',Type:0,Data:{ID:"头肩型"}},{Title:'波浪尺',ClassName:'hqchart_drawtool icon-waveruler',Type:0,Data:{ID:"波浪尺"}},{Title:'AB波浪尺',ClassName:'hqchart_drawtool icon-waveruler',Type:0,Data:{ID:"AB波浪尺"}}]},{Title:"斐波那契",AryChart:[{Title:'斐波那契周期线',ClassName:'hqchart_drawtool icon-feibonaqizhouqixian',Type:0,Data:{ID:"斐波那契周期线"}},{Title:'斐波那契楔形',ClassName:'hqchart_drawtool icon-feibonaqiqixing',Type:0,Data:{ID:"FibWedge"}},{Title:'斐波那契回撤',ClassName:'hqchart_drawtool icon-feibonaqihuiche',Type:0,Data:{ID:"FibRetracement"}},{Title:'斐波那契速度阻力扇',ClassName:'hqchart_drawtool icon-feibonaqisuduzulishan',Type:0,Data:{ID:"FibSpeedResistanceFan"}}]},{Title:"测量工具",AryChart:[{Title:'价格范围',ClassName:'hqchart_drawtool icon-shijianfanwei',Type:0,Data:{ID:"PriceRange"}},{Title:'时间范围',ClassName:'hqchart_drawtool icon-jiagefanwei',Type:0,Data:{ID:"DateRange"}},{Title:"价格和时间范围",ClassName:"hqchart_drawtool icon-jiagefanwei",Type:0,Data:{ID:"DatePriceRange"}},{Title:"监测线",ClassName:"hqchart_drawtool icon-jiance",Type:0,Data:{ID:"MonitorLine"}}]},{Title:"文字",AryChart:[{Title:"文字",ClassName:'hqchart_drawtool icon-draw_text',Type:0,Data:{ID:"文本"}},{Title:"锚点文字",ClassName:'hqchart_drawtool icon-maodianwenzi',Type:0,Data:{ID:"AnchoredText"}},{Title:"注释",ClassName:'hqchart_drawtool icon-maodian ',Type:0,Data:{ID:"Note"}},{Title:'价格标签',ClassName:'hqchart_drawtool icon-Tooltip',Type:0,Data:{ID:"PriceLabel"}},{Title:'价格注释',ClassName:'hqchart_drawtool icon-tooltiptext',Type:0,Data:{ID:"PriceNote"}},{Title:'向上箭头',ClassName:'iconfont icon-arrow_up',Type:0,Data:{ID:"icon-arrow_up"}},{Title:'向下箭头',ClassName:'iconfont icon-arrow_down',Type:0,Data:{ID:"icon-arrow_down"}},{Title:'向左箭头',ClassName:'iconfont icon-arrow_left',Type:0,Data:{ID:"icon-arrow_left"}},{Title:'向右箭头',ClassName:'iconfont icon-arrow_right',Type:0,Data:{ID:"icon-arrow_right"}}]}];this.ToolConfig={Title:"工具",AryTool:[{Title:"选中",ClassName:'hqchart_drawtool icon-arrow',Type:1,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_SELECTED_ID}},{Title:'尺子',ClassName:'hqchart_drawtool icon-ruler',Type:0,Data:{ID:"尺子"}},{Title:"磁铁",ClassName:'hqchart_drawtool icon-xifu',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_ENABLE_MAGNET_ID}},{Title:"点击切换颜色",ClassName:'hqchart_drawtool icon-fangkuai',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID}},{Title:"擦除画线",ClassName:'hqchart_drawtool icon-a-xiangpicachuxiangpica',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_ERASE_DRAW_CHART_ID}},{Title:"删除所有画线",ClassName:'hqchart_drawtool icon-recycle_bin',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_ALL_DRAW_CHART_ID}}]};this.DivDialog=null;this.AryDivChart=[];this.HQChart=null;this.LineColor='rgb(255,140,0)';this.LineColorIndex=0;this.RandomLineColor=["rgb(255,69,0)","rgb(0,191,255)","rgb(255,0,255)","rgb(255,105,180)"];this.LineWidth=1*GetDevicePixelRatio();this.ColumnCount=5;this.DragTitle=null;this.Inital=function(hqchart){this.LineColor=g_JSChartResource.DrawPicture.LineColor[0];this.RandomLineColor.splice(0,0,this.LineColor);this.HQChart=hqchart;};this.Create=function(){var
|
|
13932
|
-
this.CreateToolGroup(tbody);this.DivDialog=divDom;document.body.appendChild(divDom);};this.Destroy=function(){this.AryDivChart=[];if(this.DivDialog)document.body.removeChild(this.DivDialog);this.DivDialog=null;};this.CreateChartGroupItem=function(groupItem,tbody){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Group_Tr';tbody.appendChild(trDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Group_Td";tdDom.innerText=groupItem.Title;tdDom.colSpan=this.ColumnCount;trDom.appendChild(tdDom);var chartCount=groupItem.AryChart.length;for(var i=0,j=0;i<chartCount;){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Tr';for(j=0;j<this.ColumnCount&&i<chartCount;++j,++i){var item=groupItem.AryChart[i];this.CreateChartItem(item,trDom);}tbody.appendChild(trDom);}};this.CreateChartItem=function(item,trDom){var
|
|
13932
|
+
};function JSDialogDrawTool(){this.AryChartGroup=[{Title:"线段",AryChart:[{Title:'线段',ClassName:'hqchart_drawtool icon-draw_line',Type:0,Data:{ID:"线段"}},{Title:'线段信息',ClassName:'hqchart_drawtool icon-infoline',Type:0,Data:{ID:"InfoLine"}},{Title:'射线',ClassName:'hqchart_drawtool icon-draw_rays',Type:0,Data:{ID:"射线"}},{Title:"趋势线角度",ClassName:"hqchart_drawtool icon-qushixianjiaodu",Type:0,Data:{ID:"TrendAngle"}},{Title:'标价线',ClassName:'hqchart_drawtool icon-price_line',Type:0,Data:{ID:"标价线"}},{Title:'垂直线',ClassName:'hqchart_drawtool icon-vertical_line',Type:0,Data:{ID:"垂直线"}},{Title:'十字线',ClassName:'hqchart_drawtool icon-tubiao_shizixian',Type:0,Data:{ID:"十字线"}},{Title:'箭头',ClassName:'hqchart_drawtool icon-bottom-arrow-solid',Type:0,Data:{ID:"箭头"}},{Title:'大箭头',ClassName:'hqchart_drawtool icon-big_arrow',Type:0,Data:{ID:"ArrowMarker"}},{Title:'趋势线',ClassName:'hqchart_drawtool icon-draw_trendline',Type:0,Data:{ID:"趋势线"}},{Title:'水平线',ClassName:'hqchart_drawtool icon-draw_hline',Type:0,Data:{ID:"水平线"}},{Title:'水平射线',ClassName:'hqchart_drawtool icon-tubiao_shuipingshexian',Type:0,Data:{ID:"水平射线"}},{Title:'涂鸦线段',ClassName:'hqchart_drawtool icon-draw_line',Type:0,Data:{ID:"涂鸦线段"}},{Title:'阻速线',ClassName:'hqchart_drawtool icon-draw_resline',Type:0,Data:{ID:"阻速线"}},{Title:'通达信阻速线',ClassName:'hqchart_drawtool icon-draw_resline',Type:0,Data:{ID:"阻速线2"}},{Title:'江恩角度线',ClassName:'hqchart_drawtool icon-jiangenjiaoduxian',Type:0,Data:{ID:"江恩角度线"}},{Title:'通达信江恩角度线',ClassName:'hqchart_drawtool icon-jiangenjiaoduxian',Type:0,Data:{ID:"江恩角度线2"}}]},{Title:"通道",AryChart:[{Title:'平行线',ClassName:'hqchart_drawtool icon-draw_parallel_lines',Type:0,Data:{ID:"平行线"}},{Title:'水平线段',ClassName:'hqchart_drawtool icon-draw_hlinesegment',Type:0,Data:{ID:"水平线段"}},{Title:'平行射线',ClassName:'hqchart_drawtool icon-draw_p_rays_lines',Type:0,Data:{ID:"平行射线"}},{Title:'平行通道',ClassName:'hqchart_drawtool icon-draw_parallelchannel',Type:0,Data:{ID:"平行通道"}},{Title:'价格通道线',ClassName:'hqchart_drawtool icon-draw_pricechannel',Type:0,Data:{ID:"价格通道线"}},{Title:'箱型线',ClassName:'hqchart_drawtool icon-draw_box',Type:0,Data:{ID:"箱型线"}},{Title:"不相交通道",ClassName:"hqchart_drawtool icon-buxiangjiaojiao",Type:0,Data:{ID:"DisjointChannel"}},{Title:"平滑顶/底",ClassName:"hqchart_drawtool icon-tubiao_buxiangjiaotongdao",Type:0,Data:{ID:"FlatTop"}},{Title:"波段线",ClassName:'hqchart_drawtool icon-draw_waveband',Type:0,Data:{ID:"波段线"}},{Title:"百分比线",ClassName:'hqchart_drawtool icon-PercentageLine',Type:0,Data:{ID:"百分比线"}},{Title:"黄金分割",ClassName:'hqchart_drawtool icon-GoldenSection',Type:0,Data:{ID:"黄金分割"}},{Title:"线形回归线",ClassName:'hqchart_drawtool icon-linear_3',Type:0,Data:{ID:"线形回归线"}},{Title:"线形回归带",ClassName:'hqchart_drawtool icon-linear_1',Type:0,Data:{ID:"线形回归带"}},{Title:"延长线形回归带",ClassName:'hqchart_drawtool icon-linear_2',Type:0,Data:{ID:"延长线形回归带"}}]},{Title:"形状",AryChart:[{Title:'圆弧线',ClassName:'hqchart_drawtool icon-draw_arc',Type:0,Data:{ID:"圆弧线"}},{Title:'矩形',ClassName:'hqchart_drawtool icon-rectangle',Type:0,Data:{ID:"矩形"}},{Title:'平行四边形',ClassName:'hqchart_drawtool icon-draw_quadrangle',Type:0,Data:{ID:"平行四边形"}},{Title:'三角形',ClassName:'hqchart_drawtool icon-draw_triangle',Type:0,Data:{ID:"三角形"}},{Title:'圆',ClassName:'hqchart_drawtool icon-draw_circle',Type:0,Data:{ID:"圆"}},{Title:'对称角度',ClassName:'hqchart_drawtool icon-draw_symangle',Type:0,Data:{ID:"对称角度"}}]},{Title:"波浪线",AryChart:[{Title:'M头W底',ClassName:'hqchart_drawtool icon-draw_wavemw',Type:0,Data:{ID:"M头W底"}},{Title:'头肩型',ClassName:'hqchart_drawtool icon-draw_head_shoulders_bt',Type:0,Data:{ID:"头肩型"}},{Title:'波浪尺',ClassName:'hqchart_drawtool icon-waveruler',Type:0,Data:{ID:"波浪尺"}},{Title:'AB波浪尺',ClassName:'hqchart_drawtool icon-waveruler',Type:0,Data:{ID:"AB波浪尺"}}]},{Title:"斐波那契",AryChart:[{Title:'斐波那契周期线',ClassName:'hqchart_drawtool icon-feibonaqizhouqixian',Type:0,Data:{ID:"斐波那契周期线"}},{Title:'斐波那契楔形',ClassName:'hqchart_drawtool icon-feibonaqiqixing',Type:0,Data:{ID:"FibWedge"}},{Title:'斐波那契回撤',ClassName:'hqchart_drawtool icon-feibonaqihuiche',Type:0,Data:{ID:"FibRetracement"}},{Title:'斐波那契速度阻力扇',ClassName:'hqchart_drawtool icon-feibonaqisuduzulishan',Type:0,Data:{ID:"FibSpeedResistanceFan"}}]},{Title:"测量工具",AryChart:[{Title:'价格范围',ClassName:'hqchart_drawtool icon-shijianfanwei',Type:0,Data:{ID:"PriceRange"}},{Title:'时间范围',ClassName:'hqchart_drawtool icon-jiagefanwei',Type:0,Data:{ID:"DateRange"}},{Title:"价格和时间范围",ClassName:"hqchart_drawtool icon-jiagefanwei",Type:0,Data:{ID:"DatePriceRange"}},{Title:"监测线",ClassName:"hqchart_drawtool icon-jiance",Type:0,Data:{ID:"MonitorLine"}}]},{Title:"文字",AryChart:[{Title:"文字",ClassName:'hqchart_drawtool icon-draw_text',Type:0,Data:{ID:"文本"}},{Title:"锚点文字",ClassName:'hqchart_drawtool icon-maodianwenzi',Type:0,Data:{ID:"AnchoredText"}},{Title:"注释",ClassName:'hqchart_drawtool icon-maodian ',Type:0,Data:{ID:"Note"}},{Title:'价格标签',ClassName:'hqchart_drawtool icon-Tooltip',Type:0,Data:{ID:"PriceLabel"}},{Title:'价格注释',ClassName:'hqchart_drawtool icon-tooltiptext',Type:0,Data:{ID:"PriceNote"}},{Title:'向上箭头',ClassName:'iconfont icon-arrow_up',Type:0,Data:{ID:"icon-arrow_up"}},{Title:'向下箭头',ClassName:'iconfont icon-arrow_down',Type:0,Data:{ID:"icon-arrow_down"}},{Title:'向左箭头',ClassName:'iconfont icon-arrow_left',Type:0,Data:{ID:"icon-arrow_left"}},{Title:'向右箭头',ClassName:'iconfont icon-arrow_right',Type:0,Data:{ID:"icon-arrow_right"}}]}];this.ToolConfig={Title:"工具",AryTool:[{Title:"选中",ClassName:'hqchart_drawtool icon-arrow',Type:1,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_SELECTED_ID}},{Title:'尺子',ClassName:'hqchart_drawtool icon-ruler',Type:0,Data:{ID:"尺子"}},{Title:"磁铁",ClassName:'hqchart_drawtool icon-xifu',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_ENABLE_MAGNET_ID}},{Title:"点击切换颜色",ClassName:'hqchart_drawtool icon-fangkuai',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID}},{Title:"擦除画线",ClassName:'hqchart_drawtool icon-a-xiangpicachuxiangpica',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_ERASE_DRAW_CHART_ID}},{Title:"删除所有画线",ClassName:'hqchart_drawtool icon-recycle_bin',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_ALL_DRAW_CHART_ID}}]};this.DivDialog=null;this.AryDivChart=[];this.HQChart=null;this.LineColor='rgb(255,140,0)';this.LineColorIndex=0;this.RandomLineColor=["rgb(255,69,0)","rgb(0,191,255)","rgb(255,0,255)","rgb(255,105,180)"];this.LineWidth=1*GetDevicePixelRatio();this.ColumnCount=5;this.DragTitle=null;this.RestoreFocusDelay=800;this.Inital=function(hqchart){this.LineColor=g_JSChartResource.DrawPicture.LineColor[0];this.RandomLineColor.splice(0,0,this.LineColor);this.HQChart=hqchart;};this.Create=function(){var _this80=this;var divDom=document.createElement("div");divDom.className='UMyChart_DrawTool_Dialog_Div';var divTitle=document.createElement("div");divTitle.className='UMyChart_DrawTool_Title_Div';divTitle.innerText="画图工具";divTitle.onmousedown=function(e){_this80.OnMouseDownTitle(e);};var divClose=document.createElement("div");divClose.className='UMyChart_DrawTool_Close_Div';divClose.innerText="x";divClose.onmousedown=function(e){_this80.Close(e);};divTitle.appendChild(divClose);divDom.appendChild(divTitle);var table=document.createElement("table");table.className="UMyChart_DrawTool_Table";divDom.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_DrawTool_Tbody";table.appendChild(tbody);for(var i=0;i<this.AryChartGroup.length;++i){var item=this.AryChartGroup[i];if(!IFrameSplitOperator.IsNonEmptyArray(item.AryChart))continue;this.CreateChartGroupItem(item,tbody);var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Group_End_Tr';tbody.appendChild(trDom);}//工具栏
|
|
13933
|
+
this.CreateToolGroup(tbody);this.DivDialog=divDom;document.body.appendChild(divDom);};this.Destroy=function(){this.AryDivChart=[];if(this.DivDialog)document.body.removeChild(this.DivDialog);this.DivDialog=null;};this.CreateChartGroupItem=function(groupItem,tbody){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Group_Tr';tbody.appendChild(trDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Group_Td";tdDom.innerText=groupItem.Title;tdDom.colSpan=this.ColumnCount;trDom.appendChild(tdDom);var chartCount=groupItem.AryChart.length;for(var i=0,j=0;i<chartCount;){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Tr';for(j=0;j<this.ColumnCount&&i<chartCount;++j,++i){var item=groupItem.AryChart[i];this.CreateChartItem(item,trDom);}tbody.appendChild(trDom);}};this.CreateChartItem=function(item,trDom){var _this81=this;var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Td";tdDom.title=item.Title;trDom.appendChild(tdDom);var spanDom=document.createElement("span");spanDom.className=item.ClassName;spanDom.classList.add("UMyChart_DrawTool_Span");tdDom.appendChild(spanDom);var data={Item:item,TD:tdDom,Span:spanDom};tdDom.onmousedown=function(e){_this81.OnClickItem(e,data);};//点击
|
|
13933
13934
|
this.AryDivChart.push(data);};this.OnClickItem=function(e,data){console.log('[JSDialogDrawTool::OnClickChartItem] ',data);if(!data.Item||!data.Item.Data)return;var type=data.Item.Type;var id=data.Item.Data.ID;if(type==2&&id==JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID){this.OnChangeLineColor(data);}else if(type==2&&id==JS_DRAWTOOL_MENU_ID.CMD_DELETE_ALL_DRAW_CHART_ID){this.DeleteAllChart();}else if(type==2&&id==JS_DRAWTOOL_MENU_ID.CMD_ERASE_DRAW_CHART_ID){this.ClearAllSelectedChart();this.ClearCurrnetDrawPicture();this.EnableEraseChart(true);}else if(type==1&&id==JS_DRAWTOOL_MENU_ID.CMD_SELECTED_ID){this.ClearAllSelectedChart();this.ClearCurrnetDrawPicture();this.EnableEraseChart(false);}else if(type==2&&id==JS_DRAWTOOL_MENU_ID.CMD_ENABLE_MAGNET_ID){this.ChangeMagnet(data);}else if(type==0){this.ClearAllSelectedChart();this.EnableEraseChart(false);data.Span.classList.remove("UMyChart_DrawTool_Span");data.Span.classList.add("UMyChart_DrawTool_Span_Selected");this.CreateDrawPicture(data);}};//清空选中状态
|
|
13934
|
-
this.ClearAllSelectedChart=function(){for(var i=0;i<this.AryDivChart.length;++i){var item=this.AryDivChart[i];if(item.Item.Type==2)continue;item.Span.classList.remove("UMyChart_DrawTool_Span_Selected");item.Span.classList.add("UMyChart_DrawTool_Span");}};this.CreateToolGroup=function(tbody){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Group_Tr';tbody.appendChild(trDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Group_Td";tdDom.innerText=this.ToolConfig.Title;tdDom.colSpan=this.ColumnCount;trDom.appendChild(tdDom);var chartCount=this.ToolConfig.AryTool.length;for(var i=0,j=0;i<chartCount;){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Tr';for(j=0;j<this.ColumnCount&&i<chartCount;++j,++i){var item=this.ToolConfig.AryTool[i];this.CreateToolItem(item,trDom);}tbody.appendChild(trDom);}};this.CreateToolItem=function(item,trDom){var
|
|
13935
|
-
{spanDom.style['color']=this.LineColor;}tdDom.onmousedown=function(e){
|
|
13935
|
+
this.ClearAllSelectedChart=function(){for(var i=0;i<this.AryDivChart.length;++i){var item=this.AryDivChart[i];if(item.Item.Type==2)continue;item.Span.classList.remove("UMyChart_DrawTool_Span_Selected");item.Span.classList.add("UMyChart_DrawTool_Span");}};this.CreateToolGroup=function(tbody){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Group_Tr';tbody.appendChild(trDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Group_Td";tdDom.innerText=this.ToolConfig.Title;tdDom.colSpan=this.ColumnCount;trDom.appendChild(tdDom);var chartCount=this.ToolConfig.AryTool.length;for(var i=0,j=0;i<chartCount;){var trDom=document.createElement("tr");trDom.className='UMyChart_DrawTool_Tr';for(j=0;j<this.ColumnCount&&i<chartCount;++j,++i){var item=this.ToolConfig.AryTool[i];this.CreateToolItem(item,trDom);}tbody.appendChild(trDom);}};this.CreateToolItem=function(item,trDom){var _this82=this;var tdDom=document.createElement("td");tdDom.className="UMyChart_DrawTool_Td";tdDom.title=item.Title;trDom.appendChild(tdDom);var spanDom=document.createElement("span");spanDom.className=item.ClassName;spanDom.classList.add("UMyChart_DrawTool_Span");tdDom.appendChild(spanDom);var data={Item:item,TD:tdDom,Span:spanDom};if(item.Type==2&&item.Data.ID==JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID)//颜色
|
|
13936
|
+
{spanDom.style['color']=this.LineColor;}tdDom.onmousedown=function(e){_this82.OnClickItem(e,data);};//点击
|
|
13936
13937
|
this.AryDivChart.push(data);};this.OnChangeLineColor=function(data){++this.LineColorIndex;var index=this.LineColorIndex%this.RandomLineColor.length;this.LineColor=this.RandomLineColor[index];data.Span.style['color']=this.LineColor;};//清空所有画图工具
|
|
13937
|
-
this.DeleteAllChart=function(){if(!this.HQChart)return;this.HQChart.ClearChartDrawPicture();};this.SetEraseChartButtonStatus=function(enable){for(var i=0;i<this.AryDivChart.length;++i){var item=this.AryDivChart[i];if(item.Item.Type==2&&item.Item.Data&&item.Item.Data.ID==JS_DRAWTOOL_MENU_ID.CMD_ERASE_DRAW_CHART_ID){if(enable){if(item.Span.classList.contains("UMyChart_DrawTool_Span")){item.Span.classList.replace("UMyChart_DrawTool_Span","UMyChart_DrawTool_Span_Selected");}}else{if(item.Span.classList.contains("UMyChart_DrawTool_Span_Selected")){item.Span.classList.replace("UMyChart_DrawTool_Span_Selected","UMyChart_DrawTool_Span");}}break;}}};this.EnableEraseChart=function(enable){if(!this.HQChart)return;if(this.HQChart.EnableEraseChartDrawPicture==enable)return;this.HQChart.EnableEraseChartDrawPicture=enable;this.SetEraseChartButtonStatus(enable);};this.ChangeMagnet=function(data){if(!this.HQChart)return;var enable=true;if(this.HQChart.ChartDrawOption.Magnet){var item=this.HQChart.ChartDrawOption.Magnet;var enable=!item.Enable;}if(enable){this.HQChart.SetChartDrawOption({Magnet:{Enable:enable,Type:0}});data.Span.classList.remove("UMyChart_DrawTool_Span");data.Span.classList.add("UMyChart_DrawTool_Span_Selected");}else{this.HQChart.SetChartDrawOption({Magnet:{Enable:false}});data.Span.classList.remove("UMyChart_DrawTool_Span_Selected");data.Span.classList.add("UMyChart_DrawTool_Span");}};this.CreateDrawPicture=function(data){var
|
|
13938
|
+
this.DeleteAllChart=function(){if(!this.HQChart)return;this.HQChart.ClearChartDrawPicture();};this.SetEraseChartButtonStatus=function(enable){for(var i=0;i<this.AryDivChart.length;++i){var item=this.AryDivChart[i];if(item.Item.Type==2&&item.Item.Data&&item.Item.Data.ID==JS_DRAWTOOL_MENU_ID.CMD_ERASE_DRAW_CHART_ID){if(enable){if(item.Span.classList.contains("UMyChart_DrawTool_Span")){item.Span.classList.replace("UMyChart_DrawTool_Span","UMyChart_DrawTool_Span_Selected");}}else{if(item.Span.classList.contains("UMyChart_DrawTool_Span_Selected")){item.Span.classList.replace("UMyChart_DrawTool_Span_Selected","UMyChart_DrawTool_Span");}}break;}}};this.EnableEraseChart=function(enable){if(!this.HQChart)return;if(this.HQChart.EnableEraseChartDrawPicture==enable)return;this.HQChart.EnableEraseChartDrawPicture=enable;this.SetEraseChartButtonStatus(enable);};this.ChangeMagnet=function(data){if(!this.HQChart)return;var enable=true;if(this.HQChart.ChartDrawOption.Magnet){var item=this.HQChart.ChartDrawOption.Magnet;var enable=!item.Enable;}if(enable){this.HQChart.SetChartDrawOption({Magnet:{Enable:enable,Type:0}});data.Span.classList.remove("UMyChart_DrawTool_Span");data.Span.classList.add("UMyChart_DrawTool_Span_Selected");}else{this.HQChart.SetChartDrawOption({Magnet:{Enable:false}});data.Span.classList.remove("UMyChart_DrawTool_Span_Selected");data.Span.classList.add("UMyChart_DrawTool_Span");}};this.CreateDrawPicture=function(data){var _this83=this;if(!this.HQChart)return null;var option={LineColor:this.LineColor,//线段颜色
|
|
13938
13939
|
LineWidth:this.LineWidth,//线段宽度
|
|
13939
13940
|
PointColor:this.LineColor//点颜色
|
|
13940
|
-
};var name=data.Item.Data.ID;if(["icon-arrow_up","icon-arrow_down","icon-arrow_left","icon-arrow_right"].includes(name))option=null;else if(name=="InfoLine")option.FormatLabelTextCallback=function(lableInfo){
|
|
13941
|
-
this.OnFinishDrawPicture=function(chart,data){data.Span.classList.remove("UMyChart_DrawTool_Span_Selected");data.Span.classList.add("UMyChart_DrawTool_Span");};this.Show=function(x,y){if(!this.DivDialog)return;this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.Close=function(e){if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.OnMouseDownTitle=function(e){var
|
|
13941
|
+
};var name=data.Item.Data.ID;if(["icon-arrow_up","icon-arrow_down","icon-arrow_left","icon-arrow_right"].includes(name))option=null;else if(name=="InfoLine")option.FormatLabelTextCallback=function(lableInfo){_this83.ChartInfoLine_FormatLabelText(lableInfo);};else if(name=="MonitorLine")option.FormatLabelTextCallback=function(lableInfo){_this83.ChartDrawMonitorLine_FormatLabelText(lableInfo);};this.HQChart.CreateChartDrawPicture(name,option,function(chart){_this83.OnFinishDrawPicture(chart,data);});};this.ClearCurrnetDrawPicture=function(){if(this.HQChart)this.HQChart.ClearCurrnetDrawPicture();};//画图工具绘制完成
|
|
13942
|
+
this.OnFinishDrawPicture=function(chart,data){data.Span.classList.remove("UMyChart_DrawTool_Span_Selected");data.Span.classList.add("UMyChart_DrawTool_Span");};this.Show=function(x,y){if(!this.DivDialog)return;this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.Close=function(e){if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';if(this.HQChart)this.HQChart.RestoreFocus(this.RestoreFocusDelay);};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.OnMouseDownTitle=function(e){var _this84=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this84.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this84.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};this.ChartInfoLine_FormatLabelText=function(labelInfo){if(!IFrameSplitOperator.IsNonEmptyArray(labelInfo.AryValue))return;if(!labelInfo.Data||!IFrameSplitOperator.IsNonEmptyArray(labelInfo.Data.Data))return;for(var i=0;i<labelInfo.AryValue.length;++i){var item=labelInfo.AryValue[i];if(!IFrameSplitOperator.IsNumber(item.XValue)||item.XValue<0)return;}var startIndex=labelInfo.AryValue[0].XValue;var endIndex=labelInfo.AryValue[1].XValue;var startItem=labelInfo.Data.Data[startIndex];var endItem=labelInfo.Data.Data[endIndex];if(!startItem||!endItem)return;var isMinutePeriod=ChartData.IsMinutePeriod(labelInfo.Data.Period,true);labelInfo.AryText=[];labelInfo.AryText.push({Name:"起始日期: ",Text:IFrameSplitOperator.FormatDateString(startItem.Date),NameColor:"rgb(0,0,0)",TextColor:"rgb(30,10,30)"});if(isMinutePeriod)labelInfo.AryText.push({Name:"起始时间: ",Text:IFrameSplitOperator.FormatTimeString(startItem.Time,"HH:MM"),NameColor:"rgb(0,0,0)",TextColor:"rgb(30,10,30)"});labelInfo.AryText.push({Name:"结束日期: ",Text:IFrameSplitOperator.FormatDateString(endItem.Date),NameColor:"rgb(0,0,0)",TextColor:"rgb(30,10,30)"});if(isMinutePeriod)labelInfo.AryText.push({Name:"结束时间: ",Text:IFrameSplitOperator.FormatTimeString(endItem.Time,"HH:MM"),NameColor:"rgb(0,0,0)",TextColor:"rgb(30,10,30)"});//示例:计算一个斜率数据
|
|
13942
13943
|
var x=labelInfo.AryPoint[1].X-labelInfo.AryPoint[0].X;var y=labelInfo.AryPoint[1].Y-labelInfo.AryPoint[0].Y;var text="--";if(x!=0)text=''+(y/x).toFixed(4);labelInfo.AryText.push({Name:"斜率: ",Text:text,NameColor:"rgb(0,0,0)",TextColor:"rgb(238, 0, 238)"});labelInfo.AryText.push({Name:"其他: ",Text:'......',NameColor:"rgb(0,0,0)",TextColor:"rgb(156, 156, 156)"});};this.ChartDrawMonitorLine_FormatLabelText=function(labelInfo){if(!labelInfo.Data||!IFrameSplitOperator.IsNonEmptyArray(labelInfo.Data.Data))return;if(!IFrameSplitOperator.IsNumber(labelInfo.StartIndex)||labelInfo.StartIndex<0)return;var startItem=labelInfo.Data.Data[labelInfo.StartIndex];var endItem=labelInfo.Data.Data[labelInfo.Data.Data.length-1];labelInfo.YValue=endItem.Close;var isMinutePeriod=ChartData.IsMinutePeriod(labelInfo.Data.Period,true);labelInfo.AryText=[];labelInfo.AryText.push({Name:"起始: ",Text:IFrameSplitOperator.FormatDateString(startItem.Date,"MM-DD"),NameColor:"rgb(0,0,0)",TextColor:"rgb(30,10,30)"});if(isMinutePeriod)labelInfo.AryText.push({Name:"起始: ",Text:IFrameSplitOperator.FormatTimeString(startItem.Time,"HH:MM"),NameColor:"rgb(0,0,0)",TextColor:"rgb(30,10,30)"});labelInfo.AryText.push({Name:"最新: ",Text:IFrameSplitOperator.FormatDateString(endItem.Date,"MM-DD"),NameColor:"rgb(0,0,0)",TextColor:"rgb(30,10,30)"});if(isMinutePeriod)labelInfo.AryText.push({Name:"最新: ",Text:IFrameSplitOperator.FormatTimeString(endItem.Time,"HH:MM"),NameColor:"rgb(0,0,0)",TextColor:"rgb(30,10,30)"});labelInfo.AryText.push({Name:"ɑ: ",Text:"--.--",NameColor:"rgb(0, 0 ,255)",TextColor:"rgb(255, 165, 0)"});labelInfo.AryText.push({Name:"β: ",Text:"--.--",NameColor:"rgb(0 ,0 ,255)",TextColor:"rgb(238 ,121, 66)"});};}/////////////////////////////////////////////////////////////////////////////////////
|
|
13943
13944
|
// 修改画图工具
|
|
13944
13945
|
//
|
|
@@ -13949,14 +13950,14 @@ this.ColorButton=null;this.BGColorButton=null;this.FontColorButton=null;this.Bor
|
|
|
13949
13950
|
this.RandomBGColor=["rgba(210,251,209,0.8)","rgb(217,217,253)","rgb(255,208,204)","rgb(252,249,206)"];//背景颜色
|
|
13950
13951
|
this.RandomFontColor=["rgb(0,0,0)","rgb(255, 0, 0)","rgb(20, 255, 0)","rgb(255, 0, 255)"];//文字颜色
|
|
13951
13952
|
this.RandomBorderColor=["rgb(0,0,0)","rgb(5, 246, 143)","rgb(139, 137, 137)","rgb(255, 20, 147)"];//边框颜色
|
|
13952
|
-
this.AryButton=[{Title:"修改线段颜色",ClassName:'hqchart_drawtool icon-huabi',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID}},{Title:"修改字体颜色",ClassName:'hqchart_drawtool icon-zitiyanse',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID}},{Title:"修改背景颜色",ClassName:'hqchart_drawtool icon-zitibeijingse',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID}},{Title:"修改边框颜色",ClassName:'hqchart_drawtool icon-biankuang',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BORDER_COLOR_ID}},{Title:"上锁",ClassName:'hqchart_drawtool icon-lock',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_LOCK_DRAW_CHART_ID}},{Title:"删除图形",ClassName:'hqchart_drawtool icon-recycle_bin',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID}}];this.Inital=function(hqchart){this.HQChart=hqchart;};this.Destroy=function(){this.ChartPicture=null;this.ColorButton=null;if(this.DivDialog){document.body.remove(this.DivDialog);this.DivDialog=null;}};this.Create=function(){var
|
|
13953
|
-
divItem.onmouseover=function(e){
|
|
13953
|
+
this.AryButton=[{Title:"修改线段颜色",ClassName:'hqchart_drawtool icon-huabi',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID}},{Title:"修改字体颜色",ClassName:'hqchart_drawtool icon-zitiyanse',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID}},{Title:"修改背景颜色",ClassName:'hqchart_drawtool icon-zitibeijingse',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID}},{Title:"修改边框颜色",ClassName:'hqchart_drawtool icon-biankuang',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BORDER_COLOR_ID}},{Title:"上锁",ClassName:'hqchart_drawtool icon-lock',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_LOCK_DRAW_CHART_ID}},{Title:"删除图形",ClassName:'hqchart_drawtool icon-recycle_bin',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID}}];this.RestoreFocusDelay=800;this.Inital=function(hqchart){this.HQChart=hqchart;};this.Destroy=function(){this.ChartPicture=null;this.ColorButton=null;if(this.DivDialog){document.body.remove(this.DivDialog);this.DivDialog=null;}};this.Create=function(){var _this85=this;var divDom=document.createElement("div");divDom.className='UMyChart_Draw_Modify_Dialog_Div';var drgDiv=document.createElement("div");drgDiv.className="UMyChart_Draw_Modify_Dialog_Drag_Div";drgDiv.onmousedown=function(e){_this85.OnMouseDownTitle(e);};divDom.appendChild(drgDiv);var spanDom=document.createElement("span");spanDom.className="hqchart_drawtool icon-tuodong";spanDom.classList.add("UMyChart_DrawTool_Span");drgDiv.appendChild(spanDom);for(var i=0;i<this.AryButton.length;++i){var item=this.AryButton[i];this.CreateButtonItem(item,divDom);}this.DivDialog=divDom;document.body.appendChild(divDom);};this.CreateButtonItem=function(item,parentDivDom){var _this86=this;var divItem=document.createElement("div");divItem.className="UMyChart_Draw_Modify_Dialog_Button_Div";var spanTooltip=document.createElement("span");spanTooltip.className="UMyChart_Draw_Modify_Tooltip";spanTooltip.innerText=item.Title;divItem.appendChild(spanTooltip);var spanDom=document.createElement("span");spanDom.className=item.ClassName;spanDom.classList.add("UMyChart_DrawTool_Span");divItem.appendChild(spanDom);var data={Div:divItem,Span:spanDom,Parent:parentDivDom,Item:item,Tooltip:spanTooltip};divItem.onmousedown=function(e){_this86.OnClickButton(e,data);};//点击
|
|
13954
|
+
divItem.onmouseover=function(e){_this86.OnHoverButton(e,data);};divItem.onmouseout=function(e){_this86.OnLeaveButton(e,data);};switch(item.Data.ID){case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID:this.ColorButton=data;break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID:this.BGColorButton=data;divItem.style.display="none";break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID:this.FontColorButton=data;divItem.style.display="none";break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BORDER_COLOR_ID:this.BorderColorButton=data;divItem.style.display="none";break;case JS_DRAWTOOL_MENU_ID.CMD_LOCK_DRAW_CHART_ID:this.LockButton=data;this.LockButton.Span.style['color']="rgb(220,220,220)";break;}parentDivDom.appendChild(divItem);};this.OnClickButton=function(e,data){console.log('[JSDialogModifyDraw::OnClickButton] ',data);if(!data.Item||!data.Item.Data)return;var id=data.Item.Data.ID;switch(id){case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID:this.ModifyLineColor();break;case JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID:this.DeleteDrawPicture();break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID:this.ModifyBGColor();break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID:this.ModifyFontColor();break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BORDER_COLOR_ID:this.ModifyBorderColor();break;case JS_DRAWTOOL_MENU_ID.CMD_LOCK_DRAW_CHART_ID:this.ModifyLockChart();break;}};this.OnHoverButton=function(e,data){//var x=e.clientX;
|
|
13954
13955
|
//data.Tooltip.style.left=x+"px";
|
|
13955
|
-
data.Tooltip.style.display="inline";};this.OnLeaveButton=function(e,data){data.Tooltip.style.display="none";};this.Close=function(e){if(!this.DivDialog)return;this.ChartPicture=null;this.DivDialog.style.visibility='hidden';};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.DeleteDrawPicture=function(){if(this.ChartPicture&&this.HQChart){this.HQChart.ClearChartDrawPicture(this.ChartPicture);}this.Close();};this.ShowButton=function(dom,diaplay){if(dom.style.display==diaplay)return;dom.style.display=diaplay;};this.GetRandomColor=function(currentColor,randomLineColor){var colorIndex=0;for(var i=0;i<randomLineColor.length;++i){if(currentColor==randomLineColor[i]){colorIndex=i+1;break;}}colorIndex=colorIndex%randomLineColor.length;var color=randomLineColor[colorIndex];return color;};this.ModifyLineColor=function(){if(!this.ChartPicture||!this.HQChart)return;var color=this.GetRandomColor(this.ChartPicture.LineColor,this.RandomLineColor);this.ChartPicture.LineColor=color;this.ChartPicture.PointColor=color;if(this.ColorButton)this.ColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13956
|
+
data.Tooltip.style.display="inline";};this.OnLeaveButton=function(e,data){data.Tooltip.style.display="none";};this.Close=function(e){if(!this.DivDialog)return;this.ChartPicture=null;this.DivDialog.style.visibility='hidden';if(this.HQChart)this.HQChart.RestoreFocus(this.RestoreFocusDelay);};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.DeleteDrawPicture=function(){if(this.ChartPicture&&this.HQChart){this.HQChart.ClearChartDrawPicture(this.ChartPicture);}this.Close();};this.ShowButton=function(dom,diaplay){if(dom.style.display==diaplay)return;dom.style.display=diaplay;};this.GetRandomColor=function(currentColor,randomLineColor){var colorIndex=0;for(var i=0;i<randomLineColor.length;++i){if(currentColor==randomLineColor[i]){colorIndex=i+1;break;}}colorIndex=colorIndex%randomLineColor.length;var color=randomLineColor[colorIndex];return color;};this.ModifyLineColor=function(){if(!this.ChartPicture||!this.HQChart)return;var color=this.GetRandomColor(this.ChartPicture.LineColor,this.RandomLineColor);this.ChartPicture.LineColor=color;this.ChartPicture.PointColor=color;if(this.ColorButton)this.ColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13956
13957
|
this.HQChart.Draw();};this.ModifyFontColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteTextColor,this.RandomFontColor);this.ChartPicture.NoteTextColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.TextColor,this.RandomFontColor);this.ChartPicture.TextColor=color;}if(this.FontColorButton)this.FontColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13957
13958
|
this.HQChart.Draw();};this.ModifyBGColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteBGColor,this.RandomBGColor);this.ChartPicture.NoteBGColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.BGColor,this.RandomBGColor);this.ChartPicture.BGColor=color;}if(this.BGColorButton)this.BGColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13958
13959
|
this.HQChart.Draw();};this.ModifyLockChart=function(){if(!this.ChartPicture||!this.HQChart)return;this.ChartPicture.EnableMove=!this.ChartPicture.EnableMove;if(this.LockButton)this.LockButton.Span.style['color']=this.ChartPicture.EnableMove?"rgb(220,220,220)":"rgb(0,0,0)";};this.ModifyBorderColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteBorderColor,this.RandomBorderColor);this.ChartPicture.NoteBorderColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.BorderColor,this.RandomBorderColor);this.ChartPicture.BorderColor=color;}if(this.BorderColorButton)this.BorderColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13959
|
-
this.HQChart.Draw();};this.Show=function(x,y){if(!this.DivDialog)this.Create();this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.SetChartPicture=function(chart){this.ChartPicture=chart;var bShowLineColor=true,bShowBGColor=false,bShowFontColor=false,bShowBorderColor=false;var bgColor=null,fontColor=null,borderColor=null;var ARRAY_TEXT_CHART=['ChartDrawPriceLabel',"ChartDrawAnchoredText","ChartDrawPriceNote"];if(ARRAY_TEXT_CHART.includes(chart.ClassName)){bShowBGColor=true;bShowFontColor=true;bShowBorderColor=true;bgColor=chart.BGColor;fontColor=chart.TextColor;borderColor=chart.BorderColor;}else if(chart.ClassName=="ChartDrawNote"){bShowBGColor=true;bShowFontColor=true;bShowBorderColor=true;bgColor=chart.NoteBGColor;fontColor=chart.NoteTextColor;borderColor=chart.NoteBorderColor;}if(this.ColorButton){var item=this.ColorButton;this.ShowButton(item.Div,bShowLineColor?"inline":"none");if(bShowLineColor){item.Span.style['color']=chart.LineColor;}}if(this.BGColorButton){var item=this.BGColorButton;this.ShowButton(item.Div,bShowBGColor?"inline":"none");if(bShowBGColor){item.Span.style['color']=bgColor;}}if(this.FontColorButton){var item=this.FontColorButton;this.ShowButton(item.Div,bShowFontColor?"inline":"none");if(bShowFontColor){item.Span.style['color']=fontColor;}}if(this.BorderColorButton){var item=this.BorderColorButton;this.ShowButton(item.Div,bShowBorderColor?"inline":"none");if(bShowBorderColor){item.Span.style['color']=borderColor;}}if(this.LockButton){var item=this.LockButton;item.Span.style['color']=this.ChartPicture.EnableMove?"rgb(220,220,220)":"rgb(0,0,0)";}};this.OnMouseDownTitle=function(e){var
|
|
13960
|
+
this.HQChart.Draw();};this.Show=function(x,y){if(!this.DivDialog)this.Create();this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.SetChartPicture=function(chart){this.ChartPicture=chart;var bShowLineColor=true,bShowBGColor=false,bShowFontColor=false,bShowBorderColor=false;var bgColor=null,fontColor=null,borderColor=null;var ARRAY_TEXT_CHART=['ChartDrawPriceLabel',"ChartDrawAnchoredText","ChartDrawPriceNote"];if(ARRAY_TEXT_CHART.includes(chart.ClassName)){bShowBGColor=true;bShowFontColor=true;bShowBorderColor=true;bgColor=chart.BGColor;fontColor=chart.TextColor;borderColor=chart.BorderColor;}else if(chart.ClassName=="ChartDrawNote"){bShowBGColor=true;bShowFontColor=true;bShowBorderColor=true;bgColor=chart.NoteBGColor;fontColor=chart.NoteTextColor;borderColor=chart.NoteBorderColor;}if(this.ColorButton){var item=this.ColorButton;this.ShowButton(item.Div,bShowLineColor?"inline":"none");if(bShowLineColor){item.Span.style['color']=chart.LineColor;}}if(this.BGColorButton){var item=this.BGColorButton;this.ShowButton(item.Div,bShowBGColor?"inline":"none");if(bShowBGColor){item.Span.style['color']=bgColor;}}if(this.FontColorButton){var item=this.FontColorButton;this.ShowButton(item.Div,bShowFontColor?"inline":"none");if(bShowFontColor){item.Span.style['color']=fontColor;}}if(this.BorderColorButton){var item=this.BorderColorButton;this.ShowButton(item.Div,bShowBorderColor?"inline":"none");if(bShowBorderColor){item.Span.style['color']=borderColor;}}if(this.LockButton){var item=this.LockButton;item.Span.style['color']=this.ChartPicture.EnableMove?"rgb(220,220,220)":"rgb(0,0,0)";}};this.OnMouseDownTitle=function(e){var _this87=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this87.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this87.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};}/*
|
|
13960
13961
|
Copyright (c) 2018 jones
|
|
13961
13962
|
|
|
13962
13963
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -13968,12 +13969,12 @@ this.HQChart.Draw();};this.Show=function(x,y){if(!this.DivDialog)this.Create();t
|
|
|
13968
13969
|
K线点击弹出指定日期分时图
|
|
13969
13970
|
*/function JSPopMinuteChart(){this.DivDialog=null;this.TitleBox=null;//{ DivTitle, DivName, DivName }
|
|
13970
13971
|
this.HQChart=null;this.DragTitle=null;this.Date=null;this.ID=Guid();this.TitleColor=g_JSChartResource.PopMinuteChart.TitleColor;this.TitleBGColor=g_JSChartResource.PopMinuteChart.TitleBGColor;this.BGColor=g_JSChartResource.PopMinuteChart.BGColor;this.BorderColor=g_JSChartResource.PopMinuteChart.BorderColor;this.Minute={Option:JSPopMinuteChart.GetMinuteOption(),JSChart:null,Date:null};this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){if(IFrameSplitOperator.IsObject(option.Option)){var item=CloneData(option.Option);//复制一份出来
|
|
13971
|
-
this.Minute.Option=(0,_assign2.default)(this.Minute.Option,item);}}};this.Create=function(){var
|
|
13972
|
-
if(this.HQChart)this.Minute.Option.Language=g_JSChartLocalization.GetLanguageName(this.HQChart.LanguageID);this.Minute.Option.OnCreatedCallback=function(chart){
|
|
13972
|
+
this.Minute.Option=(0,_assign2.default)(this.Minute.Option,item);}}};this.Create=function(){var _this88=this;var divDom=document.createElement('div');divDom.className='jchart_pop_minute_dailog';divDom.id=this.ID;var divTitle=document.createElement("div");divTitle.className='jschart_pop_minute_chart_Title_Div';divTitle.onmousedown=function(e){_this88.OnMouseDownTitle(e);};divDom.appendChild(divTitle);var divInfoText=document.createElement("div");divInfoText.className="jschart_pop_minute_chart_Title";divInfoText.innerText="分时图";this.DivInfoText=divInfoText;divTitle.appendChild(divInfoText);var divClose=document.createElement("div");divClose.className='jschart_pop_minute_chart_Close_Div';divClose.innerText="x";divClose.onmousedown=function(e){_this88.Close(e);};divTitle.appendChild(divClose);var divChart=document.createElement('div');divChart.className='jschart_pop_minute_chart';divDom.appendChild(divChart);this.TitleBox={DivTitle:divTitle,DivName:divInfoText,DivColor:divClose};this.DivDialog=divDom;var chart=JSChart.Init(divChart);this.Minute.JSChart=chart;//语言跟主图保持一致
|
|
13973
|
+
if(this.HQChart)this.Minute.Option.Language=g_JSChartLocalization.GetLanguageName(this.HQChart.LanguageID);this.Minute.Option.OnCreatedCallback=function(chart){_this88.OnCreateHQChart(chart);};this.Minute.Option.NetworkFilter=function(data,callback){_this88.NetworkFilter(data,callback);};chart.SetOption(this.Minute.Option);//设置K线配置
|
|
13973
13974
|
document.body.appendChild(divDom);this.UpdateStyle();};this.UpdateStyle=function(){if(!this.DivDialog)return;if(this.BGColor)this.DivDialog.style['background-color']=this.BGColor;if(this.BorderColor)this.DivDialog.style['border-color']=this.BorderColor;if(this.TitleBGColor)this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;if(this.TitleColor)this.TitleBox.DivName.style['color']=this.TitleColor;};this.NetworkFilter=function(data,callback){if(!this.HQChart||!this.HQChart.NetworkFilter)return;if(data)data.PopMinuteData={Date:this.Date};//弹出分时图额外数据
|
|
13974
13975
|
if(data.Name=='MinuteChartContainer::RequestMinuteData')//分时图数据对接
|
|
13975
13976
|
{data.Request.Data.date=this.Date;data.Name="MinuteChartContainer::RequestPopMinuteData";data.Explain="指定日期分时数据";};this.HQChart.NetworkFilter(data,callback);};this.OnCreateHQChart=function(chart){};this.Destroy=function(){if(this.DivDialog)document.body.removeChild(this.DivDialog);this.DivDialog=null;this.TitleBox=null;this.Minute.JSChart=null;};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.Show=function(data,x,y){if(!this.DivDialog)this.Create();if(!data.Symbol||!IFrameSplitOperator.IsPlusNumber(data.Date))return;this.Date=data.Date;var name=data.Symbol;if(data.Name)name=data.Name;var title=name+' '+IFrameSplitOperator.FormatDateString(data.Date)+' \u5206\u65F6\u56FE';this.TitleBox.DivName.innerText=title;if(this.Minute.JSChart){this.Minute.JSChart.ChangeSymbol(data.Symbol);}//超出窗口调整位置
|
|
13976
|
-
var height=this.DivDialog.offsetHeight;var width=this.DivDialog.offsetWidth;var xRight=window.innerWidth-5;var ybottom=window.innerHeight-5;if(x+width>xRight)x=xRight-width;if(y+height>ybottom)y=ybottom-height;this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.Close=function(e){if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';};this.OnMouseDownTitle=function(e){var
|
|
13977
|
+
var height=this.DivDialog.offsetHeight;var width=this.DivDialog.offsetWidth;var xRight=window.innerWidth-5;var ybottom=window.innerHeight-5;if(x+width>xRight)x=xRight-width;if(y+height>ybottom)y=ybottom-height;this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.Close=function(e){if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';};this.OnMouseDownTitle=function(e){var _this89=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this89.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this89.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};this.ReloadResource=function(option){this.TitleColor=g_JSChartResource.PopMinuteChart.TitleColor;this.TitleBGColor=g_JSChartResource.PopMinuteChart.TitleBGColor;this.BGColor=g_JSChartResource.PopMinuteChart.BGColor;this.BorderColor=g_JSChartResource.PopMinuteChart.BorderColor;if(!this.DivDialog)return;this.UpdateStyle();if(this.Minute.JSChart)this.Minute.JSChart.ReloadResource(option);};this.SetLanguage=function(language){if(!this.DivDialog)return;if(this.Minute.JSChart)this.Minute.JSChart.SetLanguage(language);};}JSPopMinuteChart.GetMinuteOption=function(){var option={Type:'分钟走势图',//创建图形类型
|
|
13977
13978
|
Windows://窗口指标
|
|
13978
13979
|
[//{ Index:"VOL" },
|
|
13979
13980
|
//{ Index:"RSI" }
|
|
@@ -13995,8 +13996,8 @@ Top:25,Bottom:25,AutoLeft:{Blank:10,MinWidth:60},AutoRight:{Blank:10,MinWidth:60
|
|
|
13995
13996
|
//
|
|
13996
13997
|
//////////////////////////////////////////////////////
|
|
13997
13998
|
function JSTooltipMinuteChart(){this.DivDialog=null;this.HQChart=null;this.ID=Guid();this.BGColor=g_JSChartResource.PopMinuteChart.BGColor;this.BorderColor=g_JSChartResource.PopMinuteChart.BorderColor;this.OnCreateCallback;this.Minute={Option:JSTooltipMinuteChart.GetMinuteOption(),JSChart:null,Symbol:null,Date:null};this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){if(IFrameSplitOperator.IsObject(option.Option)){var item=CloneData(option.Option);//复制一份出来
|
|
13998
|
-
this.Minute.Option=(0,_assign2.default)(this.Minute.Option,item);}if(option.OnCreateCallback)this.OnCreateCallback=option.OnCreateCallback;}};this.Create=function(){var
|
|
13999
|
-
if(this.HQChart)this.Minute.Option.Language=g_JSChartLocalization.GetLanguageName(this.HQChart.LanguageID);this.Minute.Option.OnCreatedCallback=function(chart){
|
|
13999
|
+
this.Minute.Option=(0,_assign2.default)(this.Minute.Option,item);}if(option.OnCreateCallback)this.OnCreateCallback=option.OnCreateCallback;}};this.Create=function(){var _this90=this;var divDom=document.createElement('div');divDom.className='UMyChart_Tooltip_Minute_Div';divDom.id=this.ID;var divChart=document.createElement('div');divChart.className='UMyChart_Tooltip_Minute_Chart_Div';divDom.appendChild(divChart);this.DivDialog=divDom;var chart=JSChart.Init(divChart);this.Minute.JSChart=chart;//语言跟主图保持一致
|
|
14000
|
+
if(this.HQChart)this.Minute.Option.Language=g_JSChartLocalization.GetLanguageName(this.HQChart.LanguageID);this.Minute.Option.OnCreatedCallback=function(chart){_this90.OnCreateHQChart(chart);};this.Minute.Option.NetworkFilter=function(data,callback){_this90.NetworkFilter(data,callback);};chart.SetOption(this.Minute.Option);//设置K线配置
|
|
14000
14001
|
document.body.appendChild(divDom);this.UpdateStyle();};this.UpdateStyle=function(){if(!this.DivDialog)return;if(this.BGColor)this.DivDialog.style['background-color']=this.BGColor;if(this.BorderColor)this.DivDialog.style['border-color']=this.BorderColor;};this.NetworkFilter=function(data,callback){if(!this.HQChart||!this.HQChart.NetworkFilter)return;/*
|
|
14001
14002
|
if (data) data.PopMinuteData={ Date:this.Date }; //弹出分时图额外数据
|
|
14002
14003
|
|
|
@@ -14037,10 +14038,10 @@ Top:25,Bottom:25,AutoLeft:{Blank:10,MinWidth:40},AutoRight:{Blank:10,MinWidth:40
|
|
|
14037
14038
|
*/function JSPopKeyboard(){this.DivDialog=null;this.DragTitle=null;this.TitleBox=null;//{ DivTitle, DivName, }
|
|
14038
14039
|
this.InputDOM=null;this.Title="HQChart 键盘精灵";this.ID=Guid();this.ActiveDOM=null;//启动键盘精灵是的控件
|
|
14039
14040
|
this.InputStatus=0;//0=空闲 1=输入中
|
|
14040
|
-
this.BGColor=g_JSChartResource.DialogPopKeyboard.BGColor;this.TitleColor=g_JSChartResource.DialogPopKeyboard.TitleColor;this.TitleBGColor=g_JSChartResource.DialogPopKeyboard.TitleBGColor;this.BorderColor=g_JSChartResource.DialogPopKeyboard.BorderColor;this.InputBGColor=g_JSChartResource.DialogPopKeyboard.Input.BGColor;this.InputTextColor=g_JSChartResource.DialogPopKeyboard.Input.TextColor;this.Keyboard={Option:JSPopKeyboard.GetOption(),JSChart:null};this.Inital=function(){var
|
|
14041
|
-
chart.AddEventCallback({event:JSCHART_EVENT_ID.ON_KEYBOARD_MOUSEUP,callback:function callback(event,data,chart){
|
|
14041
|
+
this.BGColor=g_JSChartResource.DialogPopKeyboard.BGColor;this.TitleColor=g_JSChartResource.DialogPopKeyboard.TitleColor;this.TitleBGColor=g_JSChartResource.DialogPopKeyboard.TitleBGColor;this.BorderColor=g_JSChartResource.DialogPopKeyboard.BorderColor;this.InputBGColor=g_JSChartResource.DialogPopKeyboard.Input.BGColor;this.InputTextColor=g_JSChartResource.DialogPopKeyboard.Input.TextColor;this.Keyboard={Option:JSPopKeyboard.GetOption(),JSChart:null};this.Inital=function(){var _this91=this;window.addEventListener('mousedown',function(e){_this91.OnWindowMouseDown(e);});};this.OnWindowMouseDown=function(e){if(!this.DivDialog)return;console.log("[JSPopKeyboard::OnWindowMouseDown] e=",e);if(!this.DivDialog.contains(e.target)){this.Hide();}};this.Create=function(){var _this92=this;var divDom=document.createElement('div');divDom.className='jchart_pop_keyboard_dailog';divDom.id=this.ID;var divTitle=document.createElement("div");divTitle.className='jschart_keyboard_Title_Div';divTitle.onmousedown=function(e){_this92.OnMouseDownTitle(e);};divDom.appendChild(divTitle);var divInfoText=document.createElement("div");divInfoText.className="jschart_keyboard_Title";divInfoText.innerText=this.Title;this.DivInfoText=divInfoText;divTitle.appendChild(divInfoText);var divClose=document.createElement("div");divClose.className='jschart_keyboard_Close_Div';divClose.innerText="x";divClose.onmousedown=function(e){_this92.Hide();};divTitle.appendChild(divClose);this.TitleBox={DivTitle:divTitle,DivName:divInfoText,DivClose:divClose};var divInput=document.createElement("div");divInput.className='jschart_keyboard_Input_Div';divDom.appendChild(divInput);var input=document.createElement("input");input.className="jschart_keyboard_input";input.addEventListener("keydown",function(event){_this92.OnKeydown(event);});input.addEventListener("keyup",function(event){_this92.OnKeyup(event);});input.addEventListener("compositionstart",function(event){_this92.OnCompositionStart(event);});input.addEventListener("compositionupdate",function(event){_this92.OnCompositionUpdate(event);});input.addEventListener("compositionend",function(event){_this92.OnCompositionEnd(event);});divInput.appendChild(input);var divChart=document.createElement("div");divChart.className="jschart_keyboard_Chart_Div";divDom.appendChild(divChart);this.DivDialog=divDom;this.InputDOM=input;var chart=JSKeyboardChart.Init(divChart);this.Keyboard.JSChart=chart;this.Keyboard.Option.OnCreatedCallback=function(chart){_this92.OnCreateHQChart(chart);};chart.SetOption(this.Keyboard.Option);//设置K线配置
|
|
14042
|
+
chart.AddEventCallback({event:JSCHART_EVENT_ID.ON_KEYBOARD_MOUSEUP,callback:function callback(event,data,chart){_this92.OnChartMouseUp(event,data,chart);}});this.UpdateStyle();document.body.appendChild(divDom);};this.OnCreateHQChart=function(chart){};this.OnCompositionStart=function(event){this.InputStatus=1;};this.OnCompositionUpdate=function(event){};this.OnCompositionEnd=function(event){this.InputStatus=0;};this.OnKeydown=function(event){if(this.InputStatus!=0)return;var aryKey=new _set2.default([40,38,13,33,34]);if(aryKey.has(event.keyCode)){this.Keyboard.JSChart.OnKeyDown(event);}if(event.keyCode==27){this.Hide();}};this.OnKeyup=function(event){if(this.InputStatus!=0)return;var code=event.keyCode;if(code==8)//删除
|
|
14042
14043
|
{var strText=this.InputDOM.value;if(strText.length==0){this.Hide();//只有按了删除 才能隐藏
|
|
14043
|
-
return;}}if(code>=48&&code<=57||code>=65&&code<=90||code>=96&&code<=122||code==8){var strText=this.InputDOM.value;strText=strText.toUpperCase();this.Keyboard.JSChart.Search(strText);}};this.OnMouseDownTitle=function(e){var
|
|
14044
|
+
return;}}if(code>=48&&code<=57||code>=65&&code<=90||code>=96&&code<=122||code==8){var strText=this.InputDOM.value;strText=strText.toUpperCase();this.Keyboard.JSChart.Search(strText);}};this.OnMouseDownTitle=function(e){var _this93=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this93.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this93.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};this.SetSymbolData=function(data){if(!this.Keyboard.JSChart)return false;this.Keyboard.JSChart.SetSymbolData(data);};this.Show=function(){if(!this.DivDialog)return;//显示在右下方
|
|
14044
14045
|
var height=this.DivDialog.offsetHeight;var width=this.DivDialog.offsetWidth;var xRight=window.innerWidth-5;var ybottom=window.innerHeight-5;var x=xRight-width;var y=ybottom-height;this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.Hide=function(){if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';this.InputDOM.value="";this.Keyboard.JSChart.ClearSearch();if(this.ActiveDOM){if(this.ActiveDOM.focus)this.ActiveDOM.focus();//把焦点换回去
|
|
14045
14046
|
this.ActiveDOM=null;}};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.OnGlobalKeydown=function(event){if(!this.DivDialog)return;var code=event.keyCode;if(code==116)return;//F5不处理
|
|
14046
14047
|
if(!this.IsShow()&&code>=48&&code<=57||code>=65&&code<=90||code>=96&&code<=122){this.Show();this.InputDOM.focus();if(this.InputDOM.value==""){this.InputDOM.value=event.key;event.preventDefault();}if(event.target)this.ActiveDOM=event.target;}else if(code==27&&this.IsShow()){this.Hide();}};this.OnGlobalMouseDown=function(event){if(!this.DivDialog)return;if(this.DivDialog.style.display=='none')return;if(!this.DivDialog.contains(event.target)){this.Hide();}};this.OnChartMouseUp=function(event,data,chart){this.InputDOM.focus();};this.UpdateStyle=function(){if(!this.DivDialog)return;if(this.BGColor)this.DivDialog.style['background-color']=this.BGColor;if(this.BorderColor)this.DivDialog.style['border-color']=this.BorderColor;if(this.InputBGColor)this.InputDOM.style['background-color']=this.InputBGColor;if(this.InputTextColor)this.InputDOM.style['color']=this.InputTextColor;if(this.TitleBGColor)this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;if(this.TitleColor){this.TitleBox.DivName.style['color']=this.TitleColor;this.TitleBox.DivClose.style['color']=this.TitleColor;}};this.ReloadResource=function(option){this.BGColor=g_JSChartResource.DialogPopKeyboard.BGColor;this.TitleColor=g_JSChartResource.DialogPopKeyboard.TitleColor;this.TitleBGColor=g_JSChartResource.DialogPopKeyboard.TitleBGColor;this.BorderColor=g_JSChartResource.DialogPopKeyboard.BorderColor;this.InputBGColor=g_JSChartResource.DialogPopKeyboard.Input.BGColor;this.InputTextColor=g_JSChartResource.DialogPopKeyboard.Input.TextColor;if(this.Keyboard.JSChart){this.Keyboard.JSChart.ReloadResource();this.Keyboard.JSChart.Draw();}if(!this.DivDialog)return;this.UpdateStyle();};}JSPopKeyboard.GetOption=function(){var option={Type:'键盘精灵',//创建图形类型
|
|
@@ -14065,8 +14066,8 @@ this.Style=0;//0=一行一个, 1=2行一个
|
|
|
14065
14066
|
this.HQChart=null;this.UpColor=g_JSChartResource.UpTextColor;this.DownColor=g_JSChartResource.DownTextColor;this.UnchangeColor=g_JSChartResource.UnchagneTextColor;this.TitleColor=g_JSChartResource.DialogTooltip.TitleColor;this.TitleBGColor=g_JSChartResource.DialogTooltip.TitleBGColor;this.BGColor=g_JSChartResource.DialogTooltip.BGColor;this.BorderColor=g_JSChartResource.DialogTooltip.BorderColor;this.TextColor=g_JSChartResource.DialogTooltip.TextColor;this.ValueColor=g_JSChartResource.DialogTooltip.ValueColor;this.VolColor=g_JSChartResource.DialogTooltip.VolColor;this.AmountColor=g_JSChartResource.DialogTooltip.AmountColor;this.TurnoverRateColor=g_JSChartResource.DialogTooltip.TurnoverRateColor;this.PositionColor=g_JSChartResource.DialogTooltip.PositionColor;this.DateTimeColor=g_JSChartResource.DialogTooltip.DateTimeColor;this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;this.MaxRowCount=25;this.AryData=[];this.AryText=[];this.KItemCache=null;this.KItemCacheID=null;this.LastValueCache=null;//最后的鼠标位置对应的数值
|
|
14066
14067
|
this.LastValueCacheID=null;//鼠标信息
|
|
14067
14068
|
this.DataID=null;//当前显示的数据时间{ Symbol:, Date:, Time: }
|
|
14068
|
-
this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){if(IFrameSplitOperator.IsNumber(option.Style))this.Style=option.Style;}};this.Destroy=function(){this.AryData=[];this.AryText=[];this.KItemCache=null;this.KItemCacheID=null;if(this.DivDialog){document.body.removeChild(this.DivDialog);this.DivDialog=null;}};this.OnClickColseButton=function(e){this.Close(e);if(this.HQChart&&this.HQChart.ChartCorssCursor){var chart=this.HQChart.ChartCorssCursor;if(!chart.IsShowCorss)return;chart.IsShowCorss=false;this.HQChart.Draw();this.HQChart.SetFocus();}};//data={ Symbol, Date, Time}
|
|
14069
|
-
this.IsEqualDataID=function(data){if(!this.DataID)return false;if(!data)return false;if(this.DataID.Symbol!=data.Symbol)return false;if(this.DataID.Date!=data.Date)return false;if(IFrameSplitOperator.IsNumber(this.DataID.Time)){if(this.DataID.Time!=data.Time)return false;}return true;};this.Create=function(){var
|
|
14069
|
+
this.RestoreFocusDelay=800;this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){if(IFrameSplitOperator.IsNumber(option.Style))this.Style=option.Style;}};this.Destroy=function(){this.AryData=[];this.AryText=[];this.KItemCache=null;this.KItemCacheID=null;if(this.DivDialog){document.body.removeChild(this.DivDialog);this.DivDialog=null;}};this.OnClickColseButton=function(e){this.Close(e);if(this.HQChart&&this.HQChart.ChartCorssCursor){var chart=this.HQChart.ChartCorssCursor;if(!chart.IsShowCorss)return;chart.IsShowCorss=false;this.HQChart.Draw();this.HQChart.SetFocus();}};//data={ Symbol, Date, Time}
|
|
14070
|
+
this.IsEqualDataID=function(data){if(!this.DataID)return false;if(!data)return false;if(this.DataID.Symbol!=data.Symbol)return false;if(this.DataID.Date!=data.Date)return false;if(IFrameSplitOperator.IsNumber(this.DataID.Time)){if(this.DataID.Time!=data.Time)return false;}return true;};this.Create=function(){var _this94=this;var divDom=document.createElement("div");divDom.className='UMyChart_Tooltip_Dialog_Div';var divTitle=document.createElement("div");divTitle.className='UMyChart_Tooltip_Title_Div';divTitle.onmousedown=function(e){_this94.OnMouseDownTitle(e);};var divName=document.createElement("div");divName.className='UMyChart_Tooltip_Name_Div';divName.innerText="----";divTitle.appendChild(divName);var divClose=document.createElement("div");divClose.className='UMyChart_Tooltip_Close_Div';divClose.innerText="x";divClose.onmousedown=function(e){_this94.OnClickColseButton(e);};divTitle.appendChild(divClose);divDom.appendChild(divTitle);var table=document.createElement("table");table.className="UMyChart_Tooltip_Table";divDom.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_Tooltip_Tbody";table.appendChild(tbody);this.AryData=[];if(this.Style==1){for(var i=0;i<this.MaxRowCount;++i){var rowItem={Tr:null,TitleSpan:null,TextSpan:null,Tr2:null};var trDom=document.createElement("tr");trDom.className='UMyChart_Tooltip_Group_Tr';tbody.appendChild(trDom);rowItem.Tr=trDom;var tdDom=document.createElement("td");tdDom.className="UMyChart_Tooltip_Text_Sinlge_Td";//标题
|
|
14070
14071
|
trDom.appendChild(tdDom);var spanDom=document.createElement("span");spanDom.className='UMyChart_Tooltip_Title_Left_Span';spanDom.innerText='标题';tdDom.appendChild(spanDom);rowItem.TitleSpan=spanDom;var trDom=document.createElement("tr");trDom.className='UMyChart_Tooltip_Group_Tr';tbody.appendChild(trDom);rowItem.Tr2=trDom;var tdDom=document.createElement("td");tdDom.className="UMyChart_Tooltip_Text_Sinlge_Td";//数值
|
|
14071
14072
|
trDom.appendChild(tdDom);var spanDom=document.createElement("span");spanDom.className='UMyChart_Tooltip_Text_Span';spanDom.innerText='数值';tdDom.appendChild(spanDom);rowItem.TextSpan=spanDom;this.AryData.push(rowItem);}}else{for(var i=0;i<this.MaxRowCount;++i){var rowItem={Tr:null,TitleSpan:null,TextSpan:null};var trDom=document.createElement("tr");trDom.className='UMyChart_Tooltip_Group_Tr';tbody.appendChild(trDom);rowItem.Tr=trDom;var tdDom=document.createElement("td");tdDom.className="UMyChart_Tooltip_Title_Td";//标题
|
|
14072
14073
|
trDom.appendChild(tdDom);var spanDom=document.createElement("span");spanDom.className='UMyChart_Tooltip_Title_Span';spanDom.innerText='标题';tdDom.appendChild(spanDom);rowItem.TitleSpan=spanDom;var tdDom=document.createElement("td");tdDom.className="UMyChart_Tooltip_Text_Td";//数值
|
|
@@ -14081,7 +14082,7 @@ if(data.DataType==1){this.UpdateKLineData(data);return;}else if(data.DataType==2
|
|
|
14081
14082
|
}}else if(this.HQChart.ClassName=='MinuteChartContainer'){var strKItem=(0,_stringify2.default)(data.MinItem);var strLastValue=(0,_stringify2.default)(data.LastValue);var bUpdata=false;if(this.KItemCacheID!=strKItem)//数据变动的才更新
|
|
14082
14083
|
{this.KItemCache=JSON.parse(strKItem);this.KItemCacheID=strKItem;bUpdata=true;}if(data.LastValue&&data.LastValue.Y&&IFrameSplitOperator.IsNumber(data.LastValue.Y.Value)&&this.LastValueCacheID!=strLastValue){this.LastValueCache=JSON.parse(strLastValue);this.LastValueCacheID=strLastValue;bUpdata=true;}if(bUpdata){this.UpdateDataID(data);this.UpdateTableDOM();}}else{return;}this.TitleBox.DivName.innerText=data.Name;if(!this.IsShow())this.Show();};this.UpdateTableDOM=function(){if(!this.KItemCache)return;if(this.HQChart.ClassName=='KLineChartContainer')this.AryText=this.GetFormatKLineTooltipText(this.KItemCache);else if(this.HQChart.ClassName=='MinuteChartContainer')this.AryText=this.GetFormatMinuteTooltipText(this.KItemCache);else return;var index=0;for(index=0;index<this.AryText.length&&index<this.MaxRowCount;++index){var outItem=this.AryText[index];var item=this.AryData[index];item.TitleSpan.innerText=outItem.Title;item.TitleSpan.style.color=this.TextColor;item.TextSpan.innerText=outItem.Text;item.TextSpan.style.color=outItem.Color;item.Tr.style.display="";if(item.Tr2)item.Tr2.style.display="";}for(;index<this.MaxRowCount;++index){var item=this.AryData[index];item.Tr.style.display="none";if(item.Tr2)item.Tr2.style.display="none";}};this.UpdateDataID=function(data){if(this.HQChart.ClassName=='KLineChartContainer'){var kItem=data.KItem;this.DataID={Symbol:data.Symbol,Date:kItem.Date,Time:null};if(IFrameSplitOperator.IsNumber(kItem.Time))this.DataID.Time=kItem.Time;}else if(this.HQChart.ClassName=='MinuteChartContainer'){var minItem=data.MinItem;if(minItem.Type==0)//连续交易
|
|
14083
14084
|
{var item=minItem.Data;if(item)this.DataID={Symbol:data.Symbol,Date:item.Date,Time:item.Time};}else if(minItem.Type==1)//集合竞价
|
|
14084
|
-
{var item=minItem.Data.Data;if(item)this.DataID={Symbol:data.Symbol,Date:item.Date,Time:item.Time};}}};this.Close=function(e){if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';};this.OnMouseDownTitle=function(e){var
|
|
14085
|
+
{var item=minItem.Data.Data;if(item)this.DataID={Symbol:data.Symbol,Date:item.Date,Time:item.Time};}}};this.Close=function(e){if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';if(this.HQChart)this.HQChart.RestoreFocus(this.RestoreFocusDelay);};this.OnMouseDownTitle=function(e){var _this95=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this95.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this95.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};this.Show=function(x,y){if(this.IsShow())return;if(!this.DivDialog)return;if(!this.HQChart)return;var top=this.HQChart.Frame.ChartBorder.GetTop();var left=this.HQChart.Frame.ChartBorder.GetLeft();var rtClient=this.HQChart.UIElement.getBoundingClientRect();var x=left+rtClient.left+5;var y=top+rtClient.top+10;this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";this.DivDialog.style.visibility='visible';};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.GetFormatKLineTooltipText=function(data){var defaultfloatPrecision=GetfloatPrecision(this.HQChart.Symbol);//价格小数位数
|
|
14085
14086
|
var upperSymbol=this.HQChart.Symbol.toUpperCase();var unit=MARKET_SUFFIX_NAME.GetVolUnit(upperSymbol);var priceFormat=0;if(this.Style==1)priceFormat=1;//日期
|
|
14086
14087
|
var dateItem=this.ForamtDate(data.Date,"YYYY/MM/DD/W",'DialogTooltip-Date');//时间
|
|
14087
14088
|
var timeItem=null;if(IFrameSplitOperator.IsNumber(data.Time))timeItem=this.FormatTime(data.Time,this.HQChart.Period,null,'DialogTooltip-Time');var yClose=data.YClose;//昨收价|昨结算价
|
|
@@ -14186,10 +14187,10 @@ this.ReloadResource=function(option){this.UpColor=g_JSChartResource.UpTextColor;
|
|
|
14186
14187
|
jones_2000@163.com
|
|
14187
14188
|
|
|
14188
14189
|
内置区间统计框 设置框
|
|
14189
|
-
*/function JSDialogSelectRect(){this.DivDialog=null;this.DragTitle=null;this.HQChart=null;this.UpColor=g_JSChartResource.UpTextColor;this.DownColor=g_JSChartResource.DownTextColor;this.UnchangeColor=g_JSChartResource.UnchagneTextColor;this.TitleColor=g_JSChartResource.DialogSelectRect.TitleColor;this.TitleBGColor=g_JSChartResource.DialogSelectRect.TitleBGColor;this.BGColor=g_JSChartResource.DialogSelectRect.BGColor;this.BorderColor=g_JSChartResource.DialogSelectRect.BorderColor;this.TextColor=g_JSChartResource.DialogSelectRect.TextColor;this.ValueColor=g_JSChartResource.DialogSelectRect.ValueColor;this.VolColor=g_JSChartResource.DialogSelectRect.VolColor;this.AmountColor=g_JSChartResource.DialogSelectRect.AmountColor;this.TurnoverRateColor=g_JSChartResource.DialogSelectRect.TurnoverRateColor;this.PositionColor=g_JSChartResource.DialogSelectRect.PositionColor;this.MaxRowCount=10;this.AryData=[];this.DateTimeBox={Start:{SpanText:null,SpanValue:null},End:{SpanText:null,SpanValue:null}};this.ShowData;this.SelectData;this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){}};this.Destroy=function(){this.AryData=[];this.ShowData=null;this.DateTimeBox={Start:{SpanText:null,SpanValue:null},End:{SpanText:null,SpanValue:null}};if(this.DivDialog){document.body.removeChild(this.DivDialog);this.DivDialog=null;}};this.Create=function(){var
|
|
14190
|
-
var divStartDate=document.createElement("div");divDateTime.append(divStartDate);var spanText=document.createElement("span");spanText.className="UMyChart_SelectRect_DateTitle_Span";spanText.innerText="开始:";divStartDate.appendChild(spanText);this.DateTimeBox.Start.SpanText=spanText;var spanDate=document.createElement("span");spanDate.className="UMyChart_SelectRect_DateValue_Span";spanDate.innerText="--/--";divStartDate.appendChild(spanDate);this.DateTimeBox.Start.SpanValue=spanDate;var spanArrow=document.createElement("span");spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";spanArrow.innerText="<";spanArrow.onmousedown=function(e){
|
|
14191
|
-
var divEndDate=document.createElement("div");divDateTime.append(divEndDate);var spanText=document.createElement("span");spanText.className="UMyChart_SelectRect_DateTitle_Span";spanText.innerText="结束:";divEndDate.appendChild(spanText);this.DateTimeBox.End.SpanText=spanText;var spanDate=document.createElement("span");spanDate.className="UMyChart_SelectRect_DateValue_Span";spanDate.innerText="--/--";divEndDate.appendChild(spanDate);this.DateTimeBox.SpanEnd=spanDate;this.DateTimeBox.End.SpanValue=spanDate;var spanArrow=document.createElement("span");spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";spanArrow.innerText="<";spanArrow.onmousedown=function(e){
|
|
14192
|
-
item.Td=tdDom;trDom.appendChild(tdDom);var spanDom=document.createElement("span");spanDom.className='UMyChart_SelectRect_Item_Left_Span';spanDom.innerText='数值';item.LeftSpan=spanDom;tdDom.appendChild(spanDom);var spanDom=document.createElement("span");spanDom.className='UMyChart_SelectRect_Item_Right_Span';spanDom.innerText='--';item.RightSpan=spanDom;tdDom.appendChild(spanDom);rowItem.AryItem.push(item);}this.AryData.push(rowItem);}document.body.appendChild(divDom);this.DivDialog=divDom;this.UpdateStyle();};this.Close=function(e){if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';this.ShowData=null;this.SelectData=null;};this.MoveStartDate=function(step){if(!this.DivDialog||!this.HQChart)return;if(step==0)return;if(!this.SelectData)return;var selectData=this.SelectData;var bUpdate=false;if(step>0){var index=selectData.Start;var endIndex=selectData.End;for(i=0;i<step&&index<endIndex;++i){++index;}if(selectData.Start!=index){selectData.Start=index;bUpdate=true;}}else{step=Math.abs(step);var index=selectData.Start;var endIndex=selectData.End;for(var i=0;i<step&&index>0;++i){--index;}if(selectData.Start!=index){selectData.Start=index;bUpdate=true;}}if(bUpdate)this.UpdateSelectRect(selectData);};this.MoveEndDate=function(step){if(!this.DivDialog)return;if(step==0)return;if(!this.SelectData)return;var selectData=this.SelectData;var bUpdate=false;if(step>0){var index=selectData.End;var startIndex=selectData.Start;for(i=0;i<step&&index<this.ShowData.DataCount;++i){++index;}if(selectData.End!=index){selectData.End=index;bUpdate=true;}}else{step=Math.abs(step);var index=selectData.End;var startIndex=selectData.Start;for(var i=0;i<step&&index>startIndex;++i){--index;}if(selectData.End!=index){selectData.End=index;bUpdate=true;}}if(bUpdate)this.UpdateSelectRect(selectData);};this.Show=function(x,y){if(!this.DivDialog)return;if(!this.HQChart)return;/*
|
|
14190
|
+
*/function JSDialogSelectRect(){this.DivDialog=null;this.DragTitle=null;this.HQChart=null;this.UpColor=g_JSChartResource.UpTextColor;this.DownColor=g_JSChartResource.DownTextColor;this.UnchangeColor=g_JSChartResource.UnchagneTextColor;this.TitleColor=g_JSChartResource.DialogSelectRect.TitleColor;this.TitleBGColor=g_JSChartResource.DialogSelectRect.TitleBGColor;this.BGColor=g_JSChartResource.DialogSelectRect.BGColor;this.BorderColor=g_JSChartResource.DialogSelectRect.BorderColor;this.TextColor=g_JSChartResource.DialogSelectRect.TextColor;this.ValueColor=g_JSChartResource.DialogSelectRect.ValueColor;this.VolColor=g_JSChartResource.DialogSelectRect.VolColor;this.AmountColor=g_JSChartResource.DialogSelectRect.AmountColor;this.TurnoverRateColor=g_JSChartResource.DialogSelectRect.TurnoverRateColor;this.PositionColor=g_JSChartResource.DialogSelectRect.PositionColor;this.MaxRowCount=10;this.AryData=[];this.DateTimeBox={Start:{SpanText:null,SpanValue:null},End:{SpanText:null,SpanValue:null}};this.ShowData;this.SelectData;this.RestoreFocusDelay=800;this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){}};this.Destroy=function(){this.AryData=[];this.ShowData=null;this.DateTimeBox={Start:{SpanText:null,SpanValue:null},End:{SpanText:null,SpanValue:null}};if(this.DivDialog){document.body.removeChild(this.DivDialog);this.DivDialog=null;}};this.Create=function(){var _this96=this;var divDom=document.createElement("div");divDom.className='UMyChart_SelectRect_Dialog_Div';var divTitle=document.createElement("div");divTitle.className='UMyChart_SelectRect_Title_Div';divTitle.onmousedown=function(e){_this96.OnMouseDownTitle(e);};var divName=document.createElement("div");divName.className='UMyChart_SelectRect_Name_Div';divName.innerText="区间统计";divTitle.appendChild(divName);var divClose=document.createElement("div");divClose.className='UMyChart_SelectRect_Close_Div';divClose.innerText="x";divClose.onmousedown=function(e){_this96.Close(e);};divTitle.appendChild(divClose);divDom.appendChild(divTitle);var divDateTime=document.createElement("div");divDateTime.className='UMyChart_SelectRect_DateTime_Div';//起始日期
|
|
14191
|
+
var divStartDate=document.createElement("div");divDateTime.append(divStartDate);var spanText=document.createElement("span");spanText.className="UMyChart_SelectRect_DateTitle_Span";spanText.innerText="开始:";divStartDate.appendChild(spanText);this.DateTimeBox.Start.SpanText=spanText;var spanDate=document.createElement("span");spanDate.className="UMyChart_SelectRect_DateValue_Span";spanDate.innerText="--/--";divStartDate.appendChild(spanDate);this.DateTimeBox.Start.SpanValue=spanDate;var spanArrow=document.createElement("span");spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";spanArrow.innerText="<";spanArrow.onmousedown=function(e){_this96.MoveStartDate(-1);};divStartDate.appendChild(spanArrow);var spanArrow=document.createElement("span");spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";spanArrow.innerText=">";spanArrow.onmousedown=function(e){_this96.MoveStartDate(1);};divStartDate.appendChild(spanArrow);//结束日期
|
|
14192
|
+
var divEndDate=document.createElement("div");divDateTime.append(divEndDate);var spanText=document.createElement("span");spanText.className="UMyChart_SelectRect_DateTitle_Span";spanText.innerText="结束:";divEndDate.appendChild(spanText);this.DateTimeBox.End.SpanText=spanText;var spanDate=document.createElement("span");spanDate.className="UMyChart_SelectRect_DateValue_Span";spanDate.innerText="--/--";divEndDate.appendChild(spanDate);this.DateTimeBox.SpanEnd=spanDate;this.DateTimeBox.End.SpanValue=spanDate;var spanArrow=document.createElement("span");spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";spanArrow.innerText="<";spanArrow.onmousedown=function(e){_this96.MoveEndDate(-1);};divEndDate.appendChild(spanArrow);var spanArrow=document.createElement("span");spanArrow.className="UMyChart_SelectRect_ArrowButton_Span";spanArrow.innerText=">";spanArrow.onmousedown=function(e){_this96.MoveEndDate(1);};divEndDate.appendChild(spanArrow);divDom.appendChild(divDateTime);var table=document.createElement("table");table.className="UMyChart_SelectRect_Table";divDom.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_SelectRect_Tbody";table.appendChild(tbody);for(var i=0;i<this.MaxRowCount;++i){var rowItem={Tr:null,AryItem:[]};var trDom=document.createElement("tr");trDom.className='UMyChart_SelectRect_Tr';tbody.appendChild(trDom);rowItem.Tr=trDom;for(var j=0;j<3;++j){var item={Td:null,LeftSpan:null,RightSpan:null};var tdDom=document.createElement("td");tdDom.className="UMyChart_SelectRect_Td";//标题+数值
|
|
14193
|
+
item.Td=tdDom;trDom.appendChild(tdDom);var spanDom=document.createElement("span");spanDom.className='UMyChart_SelectRect_Item_Left_Span';spanDom.innerText='数值';item.LeftSpan=spanDom;tdDom.appendChild(spanDom);var spanDom=document.createElement("span");spanDom.className='UMyChart_SelectRect_Item_Right_Span';spanDom.innerText='--';item.RightSpan=spanDom;tdDom.appendChild(spanDom);rowItem.AryItem.push(item);}this.AryData.push(rowItem);}document.body.appendChild(divDom);this.DivDialog=divDom;this.UpdateStyle();};this.Close=function(e){if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';this.ShowData=null;this.SelectData=null;if(this.HQChart)this.HQChart.RestoreFocus(this.RestoreFocusDelay);};this.MoveStartDate=function(step){if(!this.DivDialog||!this.HQChart)return;if(step==0)return;if(!this.SelectData)return;var selectData=this.SelectData;var bUpdate=false;if(step>0){var index=selectData.Start;var endIndex=selectData.End;for(i=0;i<step&&index<endIndex;++i){++index;}if(selectData.Start!=index){selectData.Start=index;bUpdate=true;}}else{step=Math.abs(step);var index=selectData.Start;var endIndex=selectData.End;for(var i=0;i<step&&index>0;++i){--index;}if(selectData.Start!=index){selectData.Start=index;bUpdate=true;}}if(bUpdate)this.UpdateSelectRect(selectData);};this.MoveEndDate=function(step){if(!this.DivDialog)return;if(step==0)return;if(!this.SelectData)return;var selectData=this.SelectData;var bUpdate=false;if(step>0){var index=selectData.End;var startIndex=selectData.Start;for(i=0;i<step&&index<this.ShowData.DataCount;++i){++index;}if(selectData.End!=index){selectData.End=index;bUpdate=true;}}else{step=Math.abs(step);var index=selectData.End;var startIndex=selectData.Start;for(var i=0;i<step&&index>startIndex;++i){--index;}if(selectData.End!=index){selectData.End=index;bUpdate=true;}}if(bUpdate)this.UpdateSelectRect(selectData);};this.Show=function(x,y){if(!this.DivDialog)return;if(!this.HQChart)return;/*
|
|
14193
14194
|
if (!this.DivDialog.style.top || !this.DivDialog.style.left) //上一次显示的位置
|
|
14194
14195
|
{
|
|
14195
14196
|
var top=this.HQChart.Frame.ChartBorder.GetTop();
|
|
@@ -14201,7 +14202,7 @@ item.Td=tdDom;trDom.appendChild(tdDom);var spanDom=document.createElement("span"
|
|
|
14201
14202
|
this.DivDialog.style.top = y + "px";
|
|
14202
14203
|
this.DivDialog.style.left = x + "px";
|
|
14203
14204
|
}
|
|
14204
|
-
*/var top=this.HQChart.Frame.ChartBorder.GetTop();var left=this.HQChart.Frame.ChartBorder.GetLeft();var rtClient=this.HQChart.UIElement.getBoundingClientRect();left=left+rtClient.left+5;top=top+rtClient.top+10;if(IFrameSplitOperator.IsNumber(x)&&IFrameSplitOperator.IsNumber(y)){left=x;top=y;}var right=x+this.DivDialog.offsetWidth;var bottom=y+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.top=top+"px";this.DivDialog.style.left=left+"px";this.DivDialog.style.visibility='visible';};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.OnMouseDownTitle=function(e){var
|
|
14205
|
+
*/if(this.HQChart)this.HQChart.ClearRestoreFocusTimer();var top=this.HQChart.Frame.ChartBorder.GetTop();var left=this.HQChart.Frame.ChartBorder.GetLeft();var rtClient=this.HQChart.UIElement.getBoundingClientRect();left=left+rtClient.left+5;top=top+rtClient.top+10;if(IFrameSplitOperator.IsNumber(x)&&IFrameSplitOperator.IsNumber(y)){left=x;top=y;}var right=x+this.DivDialog.offsetWidth;var bottom=y+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.top=top+"px";this.DivDialog.style.left=left+"px";this.DivDialog.style.visibility='visible';};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.OnMouseDownTitle=function(e){var _this97=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this97.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this97.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};//配色修改
|
|
14205
14206
|
this.ReloadResource=function(option){this.UpColor=g_JSChartResource.UpTextColor;this.DownColor=g_JSChartResource.DownTextColor;this.UnchangeColor=g_JSChartResource.UnchagneTextColor;this.TitleColor=g_JSChartResource.DialogSelectRect.TitleColor;this.TitleBGColor=g_JSChartResource.DialogSelectRect.TitleBGColor;this.BGColor=g_JSChartResource.DialogSelectRect.BGColor;this.BorderColor=g_JSChartResource.DialogSelectRect.BorderColor;this.TextColor=g_JSChartResource.DialogSelectRect.TextColor;this.ValueColor=g_JSChartResource.DialogSelectRect.ValueColor;this.VolColor=g_JSChartResource.DialogSelectRect.VolColor;this.AmountColor=g_JSChartResource.DialogSelectRect.AmountColor;this.TurnoverRateColor=g_JSChartResource.DialogSelectRect.TurnoverRateColor;this.PositionColor=g_JSChartResource.DialogSelectRect.PositionColor;if(!this.DivDialog)return;this.UpdateStyle();if(this.SelectData){var selectData=this.SelectData;this.HQChart.UpdateSelectRect(selectData.Start,selectData.End);var showData=this.CalculateKLineData({SelectData:selectData});this.FormatKLineText(showData);this.ShowData=showData;this.UpdateTableDOM(showData);}};this.UpdateStyle=function(){if(!this.DivDialog)return;if(this.BGColor)this.DivDialog.style['background-color']=this.BGColor;if(this.BorderColor)this.DivDialog.style['border-color']=this.BorderColor;if(this.DateTimeBox.Start){var item=this.DateTimeBox.Start;item.SpanText.style["color"]=this.TextColor;item.SpanValue.style["color"]=this.ValueColor;}if(this.DateTimeBox.End){var item=this.DateTimeBox.End;item.SpanText.style["color"]=this.TextColor;item.SpanValue.style["color"]=this.ValueColor;}//if (this.TitleBGColor) this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;
|
|
14206
14207
|
};this.UpdateTableDOM=function(showData){var index=0;for(var index=0,j=0,dataIndex=0;index<this.AryData.length&&dataIndex<showData.AryText.length;++index){var rowItem=this.AryData[index];for(j=0;j<rowItem.AryItem.length;++j,++dataIndex){if(dataIndex>=showData.AryText.length)break;var item=rowItem.AryItem[j];var outItem=showData.AryText[dataIndex];item.LeftSpan.innerText=outItem.Title;item.LeftSpan.style.color=this.TextColor;item.RightSpan.innerText=outItem.Text;item.RightSpan.style.color=outItem.Color;}rowItem.Tr.style.display="";}for(;index<this.AryData.length;++index){var rowItem=this.AryData[index];rowItem.Tr.style.display="none";}if(this.DateTimeBox.Start.SpanValue)this.DateTimeBox.Start.SpanValue.innerText=showData.Date.Start.Text;if(this.DateTimeBox.End.SpanValue)this.DateTimeBox.End.SpanValue.innerText=showData.Date.End.Text;};this.UpdateSelectRect=function(selectData){this.HQChart.UpdateSelectRect(selectData.Start,selectData.End);var showData=null;if(this.HQChart.ClassName=='KLineChartContainer'){showData=this.CalculateKLineData({SelectData:selectData});this.FormatKLineText(showData);}else if(this.HQChart.ClassName=='MinuteChartContainer'){showData=this.CalculateMinuteData({SelectData:selectData});this.FormatMinuteText(showData);}if(showData){this.ShowData=showData;this.UpdateTableDOM(showData);}};this.Update=function(data){if(!this.DivDialog)return;var showData;if(this.HQChart.ClassName=='KLineChartContainer'){showData=this.CalculateKLineData(data);this.FormatKLineText(showData);}else if(this.HQChart.ClassName=='MinuteChartContainer'){showData=this.CalculateMinuteData(data);this.FormatMinuteText(showData);}if(!showData)return;this.ShowData=showData;this.SelectData=data.SelectData;this.UpdateTableDOM(showData);if(!this.IsShow())this.Show(data.X,data.Y);};this.CreateEmptyShowData=function(){var showData={Open:null,Close:null,High:null,Low:null,YClose:null,Vol:0,Amount:0,Date:{Start:{Time:null,Date:null,Text:""},End:{Time:null,Date:null,Text:""}},Count:0,KLine:{Up:0,Down:0,Unchanged:0},//阳线|阴线|平线
|
|
14207
14208
|
AryText:[],DataCount:0};return showData;};this.CalculateKLineData=function(data){var selectData=data.SelectData;var hisData=selectData.Data;var start=selectData.Start;var end=selectData.End;var showData=this.CreateEmptyShowData();showData.DataCount=hisData.Data.length;for(var i=start;i<hisData.Data.length&&i<=end;++i){var item=hisData.Data[i];++showData.Count;if(!IFrameSplitOperator.IsNumber(showData.Open)&&IFrameSplitOperator.IsNumber(item.Open))showData.Open=item.Open;if(IFrameSplitOperator.IsNumber(item.Close))showData.Close=item.Close;if(IFrameSplitOperator.IsNumber(item.Vol))showData.Vol+=item.Vol;if(IFrameSplitOperator.IsNumber(item.Amount))showData.Amount+=item.Amount;if(IFrameSplitOperator.IsNumber(item.High)){if(!IFrameSplitOperator.IsNumber(showData.High)||showData.High<item.High)showData.High=item.High;}if(IFrameSplitOperator.IsNumber(item.Low)){if(!IFrameSplitOperator.IsNumber(showData.Low)||showData.Low>item.Low)showData.Low=item.Low;}if(IFrameSplitOperator.IsNumber(item.Open)&&IFrameSplitOperator.IsNumber(item.Close)){if(item.Close>item.Open)++showData.KLine.Up;else if(item.Close<item.Open)++showData.KLine.Down;else++showData.KLine.Unchanged;}if(IFrameSplitOperator.IsNumber(item.Date)){showData.Date.End.Date=item.Date;if(!IFrameSplitOperator.IsNumber(showData.Date.Start.Date))showData.Date.Start.Date=item.Date;}if(IFrameSplitOperator.IsNumber(item.Time)){showData.Date.End.Time=item.Time;if(!IFrameSplitOperator.IsNumber(showData.Date.Start.Time))showData.Date.Start.Time=item.Time;}}return showData;};//格式化K线数据
|
|
@@ -14224,16 +14225,16 @@ this.OpData=null;this.TitleColor=g_JSChartResource.DialogSearchIndex.TitleColor;
|
|
|
14224
14225
|
this.ColCount=3;//列
|
|
14225
14226
|
this.MaxGroupCount=10;//分类最多个数
|
|
14226
14227
|
this.AryData=[];this.AryGroup=[];//分类
|
|
14227
|
-
this.IndexData=JSDialogSearchIndex.GetDefaultIndexData();this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){if(IFrameSplitOperator.IsNumber(option.Style))this.Style=option.Style;if(option.IndexData)this.IndexData=option.IndexData;if(IFrameSplitOperator.IsNumber(option.MaxRowCount))this.MaxRowCount=option.MaxRowCount;}};this.Destroy=function(){this.AryData=[];this.AryGroup=[];this.IndexData=null;this.InputDom=null;this.HQChart=null;if(this.DivDialog){document.body.removeChild(this.DivDialog);this.DivDialog=null;}};this.OnClickColseButton=function(e){this.Close(e);};//设置当前窗口数据
|
|
14228
|
-
this.SetOpData=function(data){this.OpData=data;};this.Close=function(e){this.OpData=null;if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';};this.OnMouseDownTitle=function(e){var
|
|
14229
|
-
{var rtClient=this.HQChart.UIElement.getBoundingClientRect();x=rtClient.left+(rtClient.right-rtClient.left-this.DivDialog.offsetWidth)/2;y=rtClient.top+(rtClient.bottom-rtClient.top-this.DivDialog.offsetHeight)/2;}this.InputDom.value="";this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.Create=function(){var
|
|
14230
|
-
var divTitle=document.createElement("div");divTitle.className='UMyChart_SearchIndex_Title_Div';divTitle.onmousedown=function(e){
|
|
14228
|
+
this.IndexData=JSDialogSearchIndex.GetDefaultIndexData();this.RestoreFocusDelay=800;this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){if(IFrameSplitOperator.IsNumber(option.Style))this.Style=option.Style;if(option.IndexData)this.IndexData=option.IndexData;if(IFrameSplitOperator.IsNumber(option.MaxRowCount))this.MaxRowCount=option.MaxRowCount;}};this.Destroy=function(){this.AryData=[];this.AryGroup=[];this.IndexData=null;this.InputDom=null;this.HQChart=null;if(this.DivDialog){document.body.removeChild(this.DivDialog);this.DivDialog=null;}};this.OnClickColseButton=function(e){this.Close(e);};//设置当前窗口数据
|
|
14229
|
+
this.SetOpData=function(data){this.OpData=data;};this.Close=function(e){this.OpData=null;if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';if(this.HQChart)this.HQChart.RestoreFocus(this.RestoreFocusDelay);};this.OnMouseDownTitle=function(e){var _this98=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this98.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this98.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};this.Show=function(x,y,groupID){if(!this.DivDialog)return;if(this.HQChart)this.HQChart.ClearRestoreFocusTimer();if(!groupID)groupID=this.IndexData.Data[0].Group.ID;this.UpdateGroupData();this.ChangeGroup(groupID);if(this.OpData&&this.OpData.Title)this.TitleBox.DivName.innerText=this.OpData.Title;if(!IFrameSplitOperator.IsNumber(x)||!IFrameSplitOperator.IsNumber(y))//默认居中显示
|
|
14230
|
+
{var rtClient=this.HQChart.UIElement.getBoundingClientRect();x=rtClient.left+(rtClient.right-rtClient.left-this.DivDialog.offsetWidth)/2;y=rtClient.top+(rtClient.bottom-rtClient.top-this.DivDialog.offsetHeight)/2;}this.InputDom.value="";this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.Create=function(){var _this99=this;var divDom=document.createElement("div");divDom.className='UMyChart_SearchIndex_Dialog_Div';//对话框标题栏
|
|
14231
|
+
var divTitle=document.createElement("div");divTitle.className='UMyChart_SearchIndex_Title_Div';divTitle.onmousedown=function(e){_this99.OnMouseDownTitle(e);};divDom.appendChild(divTitle);var divName=document.createElement("div");divName.className='UMyChart_SearchIndex_Name_Div';divName.innerText="指标搜索";divTitle.appendChild(divName);var divClose=document.createElement("div");divClose.className='UMyChart_SearchIndex_Close_Div';divClose.innerText="x";divClose.onmousedown=function(e){_this99.OnClickColseButton(e);};divTitle.appendChild(divClose);//整个框子
|
|
14231
14232
|
var divFrame=document.createElement("div");divFrame.className="UMyChart_SearchIndex_Frome_Div";divDom.appendChild(divFrame);//搜索框
|
|
14232
|
-
var divInput=document.createElement("div");divInput.className="UMyChart_SearchIndex_Input_Div";divFrame.appendChild(divInput);var input=document.createElement("input");input.className='UMyChart_SearchIndex_Input';input.type="text";input.placeholder="输入指标名称";input.addEventListener("input",function(e){
|
|
14233
|
+
var divInput=document.createElement("div");divInput.className="UMyChart_SearchIndex_Input_Div";divFrame.appendChild(divInput);var input=document.createElement("input");input.className='UMyChart_SearchIndex_Input';input.type="text";input.placeholder="输入指标名称";input.addEventListener("input",function(e){_this99.OnInputSearch(e);});divInput.appendChild(input);this.InputDom=input;//分类+指标内容
|
|
14233
14234
|
var divContainer=document.createElement("div");divContainer.className="UMyChart_SearchIndex_Container_Div";divDom.appendChild(divContainer);//分类
|
|
14234
|
-
var divGroup=document.createElement("div");divGroup.className="UMyChart_SearchIndex_GroupList_Div";divContainer.appendChild(divGroup);for(var i=0,j=0;i<this.MaxGroupCount;++i){var groupItem={Div:null,Span:null};var divItem=document.createElement("div");divItem.className="UMyChart_SearchIndex_Group_Div";divGroup.appendChild(divItem);groupItem.Div=divItem;var spanDom=document.createElement("span");spanDom.className='UMyChart_SearchIndex_Group_Span';spanDom.innerText='分类名称';divItem.appendChild(spanDom);groupItem.Span=spanDom;spanDom.onmousedown=function(e){
|
|
14235
|
-
var divTable=document.createElement("div");divTable.className='UMyChart_SearchIndex_Table_Div';divContainer.appendChild(divTable);var table=document.createElement("table");table.className="UMyChart_SearchIndex_Table";divTable.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_SearchIndex_Tbody";table.appendChild(tbody);this.AryData=[];for(var i=0,j=0;i<this.MaxRowCount;++i){var rowItem={Tr:null,AryCell:[]};var trDom=document.createElement("tr");trDom.className='UMyChart_SearchIndex_Group_Tr';tbody.appendChild(trDom);rowItem.Tr=trDom;for(j=0;j<this.ColCount;++j){var cellItem=this.CreateCellDOM(i,j,trDom);rowItem.AryCell.push(cellItem);}this.AryData.push(rowItem);}document.body.appendChild(divDom);this.DivName=divName;this.DivDialog=divDom;this.TitleBox={DivTitle:divTitle,DivName:divName,DivColor:divClose};this.UpdateStyle();};this.CreateCellDOM=function(rowID,colID,trDom){var
|
|
14236
|
-
trDom.appendChild(tdDom);cellItem.Td=tdDom;var spanDom=document.createElement("span");spanDom.className='UMyChart_SearchIndex_Text_Span';spanDom.innerText='指标名称';spanDom.onmousedown=function(e){
|
|
14235
|
+
var divGroup=document.createElement("div");divGroup.className="UMyChart_SearchIndex_GroupList_Div";divContainer.appendChild(divGroup);for(var i=0,j=0;i<this.MaxGroupCount;++i){var groupItem={Div:null,Span:null};var divItem=document.createElement("div");divItem.className="UMyChart_SearchIndex_Group_Div";divGroup.appendChild(divItem);groupItem.Div=divItem;var spanDom=document.createElement("span");spanDom.className='UMyChart_SearchIndex_Group_Span';spanDom.innerText='分类名称';divItem.appendChild(spanDom);groupItem.Span=spanDom;spanDom.onmousedown=function(e){_this99.OnClickGroup(e);};this.AryGroup.push(groupItem);}//表格
|
|
14236
|
+
var divTable=document.createElement("div");divTable.className='UMyChart_SearchIndex_Table_Div';divContainer.appendChild(divTable);var table=document.createElement("table");table.className="UMyChart_SearchIndex_Table";divTable.appendChild(table);var tbody=document.createElement("tbody");tbody.className="UMyChart_SearchIndex_Tbody";table.appendChild(tbody);this.AryData=[];for(var i=0,j=0;i<this.MaxRowCount;++i){var rowItem={Tr:null,AryCell:[]};var trDom=document.createElement("tr");trDom.className='UMyChart_SearchIndex_Group_Tr';tbody.appendChild(trDom);rowItem.Tr=trDom;for(j=0;j<this.ColCount;++j){var cellItem=this.CreateCellDOM(i,j,trDom);rowItem.AryCell.push(cellItem);}this.AryData.push(rowItem);}document.body.appendChild(divDom);this.DivName=divName;this.DivDialog=divDom;this.TitleBox={DivTitle:divTitle,DivName:divName,DivColor:divClose};this.UpdateStyle();};this.CreateCellDOM=function(rowID,colID,trDom){var _this100=this;var cellItem={Td:null,Span:null,RowID:rowID,ColID:colID,IndexItem:null};var tdDom=document.createElement("td");tdDom.className="UMyChart_SearchIndex_Text_Td";//指标名称
|
|
14237
|
+
trDom.appendChild(tdDom);cellItem.Td=tdDom;var spanDom=document.createElement("span");spanDom.className='UMyChart_SearchIndex_Text_Span';spanDom.innerText='指标名称';spanDom.onmousedown=function(e){_this100.OnClickIndex(e,cellItem);};tdDom.appendChild(spanDom);cellItem.Span=spanDom;return cellItem;};this.OnClickIndex=function(e,cellItem){if(!this.OpData)return;if(!cellItem||!cellItem.IndexItem)return;var event=this.HQChart.GetEventCallback(JSCHART_EVENT_ID.SEARCH_DIALOG_ON_CLICK_INDEX);if(event&&event.Callback){var sendData={OpData:this.OpData,IndexData:cellItem.IndexItem,HQChart:this.HQChart,PreventDefault:false};event.Callback(event,sendData,this);if(sendData.PreventDefault==true)return;//已被上层处理了
|
|
14237
14238
|
}if(this.OpData.OpType==1){if(!IFrameSplitOperator.IsNumber(this.OpData.WindowIndex))return;var indexItem=cellItem.IndexItem;if(indexItem.Type==0)//系统指标
|
|
14238
14239
|
{this.HQChart.ChangeIndex(this.OpData.WindowIndex,indexItem.ID);}else if(indexItem.Type==1)//自定义脚本指标
|
|
14239
14240
|
{var indexData={ID:indexItem.ID,Name:indexItem.Name,Script:indexItem.Script,Args:indexItem.Args};this.HQChart.ChangeScriptIndex(this.OpData.WindowIndex,indexData);}else if(indexItem.Type==2)//api指标
|
|
@@ -14262,11 +14263,10 @@ this.Style=0;//样式 预留
|
|
|
14262
14263
|
this.TitleColor=g_JSChartResource.DialogModifyIndexParam.TitleColor;this.TitleBGColor=g_JSChartResource.DialogModifyIndexParam.TitleBGColor;this.BGColor=g_JSChartResource.DialogModifyIndexParam.BGColor;this.BorderColor=g_JSChartResource.DialogModifyIndexParam.BorderColor;this.ParamNameColor=g_JSChartResource.DialogModifyIndexParam.ParamNameColor;this.InputTextColor=g_JSChartResource.DialogModifyIndexParam.InputTextColor;this.MaxRowCount=30;//行
|
|
14263
14264
|
this.HQChart=null;this.AryData=[];this.IndexData=null;//指标数据 { WindowsIndex:, Type:1=主图 2=叠加, Identify, IndexScript: }
|
|
14264
14265
|
this.Arguments=[];//参数备份
|
|
14265
|
-
this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){if(IFrameSplitOperator.IsNumber(option.Style))this.Style=option.Style;if(IFrameSplitOperator.IsNumber(option.MaxRowCount))this.MaxRowCount=option.MaxRowCount;}};this.Destroy=function(){this.AryData=[];this.HQChart=null;if(this.DivDialog){document.body.removeChild(this.DivDialog);this.DivDialog=null;}};this.Show=function(x,y){if(!this.DivDialog)return
|
|
14266
|
-
this.UpdateParam();if(this.IndexData&&this.IndexData.Title)this.TitleBox.DivName.innerText=this.IndexData.Title;if(!IFrameSplitOperator.IsNumber(x)||!IFrameSplitOperator.IsNumber(y))//默认居中显示
|
|
14266
|
+
this.RestoreFocusDelay=800;this.Inital=function(hqchart,option){this.HQChart=hqchart;if(option){if(IFrameSplitOperator.IsNumber(option.Style))this.Style=option.Style;if(IFrameSplitOperator.IsNumber(option.MaxRowCount))this.MaxRowCount=option.MaxRowCount;}};this.Destroy=function(){this.AryData=[];this.HQChart=null;if(this.DivDialog){document.body.removeChild(this.DivDialog);this.DivDialog=null;}};this.Show=function(x,y){if(!this.DivDialog)return;if(this.HQChart)this.HQChart.ClearRestoreFocusTimer();this.UpdateParam();if(this.IndexData&&this.IndexData.Title)this.TitleBox.DivName.innerText=this.IndexData.Title;if(!IFrameSplitOperator.IsNumber(x)||!IFrameSplitOperator.IsNumber(y))//默认居中显示
|
|
14267
14267
|
{var rtClient=this.HQChart.UIElement.getBoundingClientRect();x=rtClient.left+(rtClient.right-rtClient.left-this.DivDialog.offsetWidth)/2;y=rtClient.top+(rtClient.bottom-rtClient.top-this.DivDialog.offsetHeight)/2;}this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.OnClickColseButton=function(e){this.RestoreParam();//还原参数
|
|
14268
|
-
this.Close(e);};this.OnClickRestoreButton=function(e){var aryText=this.Arguments;if(!aryText)aryText=[];this.UpdateParamTable(aryText);this.RestoreParam();};this.OnClickOkButton=function(e){this.Close(e);};this.Close=function(e){this.IndexData=null;this.Arguments=[];if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';};this.SetIndexData=function(data){this.IndexData=data;this.BackupParam();};this.OnMouseDownTitle=function(e){var
|
|
14269
|
-
var divTitle=document.createElement("div");divTitle.className='UMyChart_ModifyIndexParam_Title_Div';divTitle.onmousedown=function(e){
|
|
14268
|
+
this.Close(e);};this.OnClickRestoreButton=function(e){var aryText=this.Arguments;if(!aryText)aryText=[];this.UpdateParamTable(aryText);this.RestoreParam();};this.OnClickOkButton=function(e){this.Close(e);};this.Close=function(e){this.IndexData=null;this.Arguments=[];if(!this.DivDialog)return;this.DivDialog.style.visibility='hidden';if(this.HQChart)this.HQChart.RestoreFocus(this.RestoreFocusDelay);};this.SetIndexData=function(data){this.IndexData=data;this.BackupParam();};this.OnMouseDownTitle=function(e){var _this101=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this101.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this101.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};this.Create=function(){var _this102=this;var divDom=document.createElement("div");divDom.className='UMyChart_ModifyIndexParam_Dialog_Div';//对话框标题栏
|
|
14269
|
+
var divTitle=document.createElement("div");divTitle.className='UMyChart_ModifyIndexParam_Title_Div';divTitle.onmousedown=function(e){_this102.OnMouseDownTitle(e);};divDom.appendChild(divTitle);var divName=document.createElement("div");divName.className='UMyChart_ModifyIndexParam_Name_Div';divName.innerText="指标参数修改";divTitle.appendChild(divName);var divClose=document.createElement("div");divClose.className='UMyChart_ModifyIndexParam_Close_Div';divClose.innerText="x";divClose.onmousedown=function(e){_this102.OnClickColseButton(e);};divTitle.appendChild(divClose);//整个框子
|
|
14270
14270
|
var divFrame=document.createElement("div");divFrame.className="UMyChart_ModifyIndexParam_Frome_Div";divDom.appendChild(divFrame);//表格
|
|
14271
14271
|
var divTable=document.createElement("div");divTable.className='UMyChart_ModifyIndexParam_Table_Div';divFrame.appendChild(divTable);var table=document.createElement("table");table.className="UMyChart_ModifyIndexParam_Table";divTable.appendChild(table);/*
|
|
14272
14272
|
var thead=document.createElement("thead");
|
|
@@ -14291,22 +14291,22 @@ var divTable=document.createElement("div");divTable.className='UMyChart_ModifyIn
|
|
|
14291
14291
|
thDom.innerText="说明";
|
|
14292
14292
|
trDom.appendChild(thDom);
|
|
14293
14293
|
*/var tbody=document.createElement("tbody");tbody.className="UMyChart_ModifyIndexParam_Tbody";table.appendChild(tbody);this.AryData=[];for(var i=0;i<this.MaxRowCount;++i){var rowItem=this.CreateRowDOM(i,tbody);this.AryData.push(rowItem);}var divButton=document.createElement("div");divButton.className='UMyChart_ModifyIndexParam_Button_Div';divFrame.appendChild(divButton);var btnRestore=document.createElement("button");//btnRestore.className="UMyChart_ModifyIndexParam_button";
|
|
14294
|
-
btnRestore.innerText="恢复默认";btnRestore.addEventListener("mousedown",function(e){
|
|
14295
|
-
btnOk.innerText="确认";btnOk.addEventListener("mousedown",function(e){
|
|
14294
|
+
btnRestore.innerText="恢复默认";btnRestore.addEventListener("mousedown",function(e){_this102.OnClickRestoreButton(e);});divButton.appendChild(btnRestore);var btnOk=document.createElement("button");//btnOk.className="UMyChart_ModifyIndexParam_button";
|
|
14295
|
+
btnOk.innerText="确认";btnOk.addEventListener("mousedown",function(e){_this102.OnClickOkButton(e);});divButton.appendChild(btnOk);document.body.appendChild(divDom);this.DivName=divName;this.DivDialog=divDom;this.TitleBox={DivTitle:divTitle,DivName:divName,DivColor:divClose};this.UpdateStyle();};this.CreateRowDOM=function(index,tbody){var _this103=this;var rowItem={Tr:null,TdName:null,SpanName:null,TdValue:null,Input:null,ParamItem:null};var trDom=document.createElement("tr");trDom.className='UMyChart_ModifyIndexParam_Tr';tbody.appendChild(trDom);rowItem.Tr=trDom;var tdDom=document.createElement("td");tdDom.className="UMyChart_ModifyIndexParam_Name_Td";//指标名称
|
|
14296
14296
|
trDom.appendChild(tdDom);rowItem.TdName=tdDom;var spanDom=document.createElement("span");spanDom.className='UMyChart_ModifyIndexParam_Name_Span';spanDom.innerText='参数';tdDom.appendChild(spanDom);rowItem.SpanName=spanDom;var tdDom=document.createElement("td");tdDom.className="UMyChart_ModifyIndexParam_Value_Td";//指标名称
|
|
14297
|
-
trDom.appendChild(tdDom);rowItem.TdValue=tdDom;var input=document.createElement("input");input.className='UMyChart_ModifyIndexParam_Input';input.type="number";input.step=1;input.addEventListener("mouseup",function(e){
|
|
14297
|
+
trDom.appendChild(tdDom);rowItem.TdValue=tdDom;var input=document.createElement("input");input.className='UMyChart_ModifyIndexParam_Input';input.type="number";input.step=1;input.addEventListener("mouseup",function(e){_this103.OnParamMouseUp(e);});input.addEventListener("keyup",function(e){_this103.OnParamKeyUp(e);});tdDom.appendChild(input);rowItem.Input=input;return rowItem;};this.UpdateStyle=function(){if(!this.DivDialog)return;if(this.BGColor)this.DivDialog.style['background-color']=this.BGColor;if(this.BorderColor)this.DivDialog.style['border-color']=this.BorderColor;if(this.TitleBGColor)this.TitleBox.DivTitle.style['background-color']=this.TitleBGColor;if(this.TitleColor)this.TitleBox.DivName.style['color']=this.TitleColor;};this.UpdateParamTable=function(aryText){var index=0;for(index=0;index<aryText.length&&index<this.AryData.length;++index){var item=aryText[index];var row=this.AryData[index];row.SpanName.innerText=item.Name+': ';row.SpanName.style.color=this.ParamNameColor;row.Input.value=item.Value;row.Input.style.color=this.InputTextColor;row.Input.dataset.paramid=item.Index;if(row.Tr.style.display=="none")row.Tr.style.display="";}for(;index<this.AryData.length;++index){var row=this.AryData[index];row.Tr.style.display="none";row.Input.dataset.paramid=-1;}};this.UpdateParam=function(){var aryText=[];var indexScript=this.IndexData.IndexScript;if(indexScript&&IFrameSplitOperator.IsNonEmptyArray(indexScript.Arguments)){for(var i=0;i<indexScript.Arguments.length;++i){var item=indexScript.Arguments[i];aryText.push({Name:item.Name,Value:item.Value,Index:i});}}this.UpdateParamTable(aryText);};this.RestoreParam=function(){if(!this.IndexData||!this.IndexData.IndexScript)return;var indexScript=this.IndexData.IndexScript;if(!IFrameSplitOperator.IsNonEmptyArray(indexScript.Arguments))return;if(!IFrameSplitOperator.IsNonEmptyArray(this.Arguments))return;var bUpdate=false;for(var i=0;i<this.Arguments.length;++i){var oldItem=this.Arguments[i];var item=indexScript.Arguments[i];if(oldItem.Value!=item.Value){item.Value=oldItem.Value;bUpdate=true;}}if(!bUpdate)return;if(this.IndexData.Type==1)this.HQChart.UpdateWindowIndex(this.IndexData.WindowIndex);else if(this.IndexData.Type==2)this.HQChart.UpdateOverlayIndex(this.IndexData.Identify);};this.BackupParam=function(){this.Arguments=[];if(!this.IndexData||!this.IndexData.IndexScript)return;var indexScript=this.IndexData.IndexScript;if(IFrameSplitOperator.IsNonEmptyArray(indexScript.Arguments)){for(var i=0;i<indexScript.Arguments.length;++i){var item=indexScript.Arguments[i];this.Arguments.push({Name:item.Name,Value:item.Value,Index:i});}}};this.OnParamMouseUp=function(e){var input=e.target;var value=input.value;var id=input.dataset.paramid;this.ModifyParam(id,parseInt(value));};this.OnParamKeyUp=function(e){var input=e.target;var value=input.value;var id=input.dataset.paramid;this.ModifyParam(id,parseInt(value));};this.ModifyParam=function(id,value){if(!this.IndexData||!this.IndexData.IndexScript)return;var indexScript=this.IndexData.IndexScript;var item=indexScript.Arguments[id];if(!item)return;if(item.Value==value)return;item.Value=value;if(this.IndexData.Type==1)this.HQChart.UpdateWindowIndex(this.IndexData.WindowIndex);else if(this.IndexData.Type==2)this.HQChart.UpdateOverlayIndex(this.IndexData.Identify);};}///////////////////////////////////////////////////////////////////////////////////
|
|
14298
14298
|
// 工作线程计算指标示例
|
|
14299
14299
|
//
|
|
14300
14300
|
//
|
|
14301
14301
|
//////////////////////////////////////////////////////////////////////////////////
|
|
14302
14302
|
function HQChartScriptWorker(){this.Status=0;//0=空闲 1=运行
|
|
14303
|
-
this.Create=function(){var
|
|
14304
|
-
};this.ExecuteScript=function(indexData,message){var
|
|
14303
|
+
this.Create=function(){var _this104=this;addEventListener('message',function(obj){_this104.OnRecvMessage(obj);});};this.NetworkFilter=function(data,callback,indexInfo){JSConsole.Complier.Log('[HQChartScriptWorker::NetworkFilter] ['+data.Name+']['+data.Explain+'] data=',data);//数据下载
|
|
14304
|
+
};this.ExecuteScript=function(indexData,message){var _this105=this;var scriptObj={};if(indexData.Script){scriptObj.Name=indexData.Name;scriptObj.ID=indexData.Index;scriptObj.Script=indexData.Script;}else{if(!indexData.Index)return false;var scriptData=new JSIndexScript();var finder=scriptData.Get(indexData.Index);if(!finder)return false;scriptObj.ID=indexData.Index;scriptObj.Name=finder.Name;scriptObj.Script=finder.Script;scriptObj.Args=finder.Args;}if(indexData.Args)scriptObj.Args=indexData.Args;if(IFrameSplitOperator.IsBool(message.IsApiPeriod))scriptObj.IsApiPeriod=message.IsApiPeriod;var indexInfo={Name:scriptObj.Name,ID:scriptObj.ID,Script:scriptObj.Script,Args:scriptObj.Args,Guid:message.Guid};scriptObj.ErrorCallback=function(error){_this105.OnExecuteError(error,indexInfo,message);};scriptObj.FinishCallback=function(data,jsExectute){_this105.OnExecuteFinish(data,indexInfo,jsExectute,message);};scriptObj.NetworkFilter=function(data,callback){_this105.NetworkFilter(data,callback,indexInfo,message);};JSConsole.Complier.Log('[HQChartScriptWorker::ExecuteScript] scriptObj=',scriptObj);var indexConsole=new ScriptIndexConsole(scriptObj);var hisData=null;if(message&&message.Data){hisData=new ChartData();hisData.Data=message.Data;hisData.Right=message.Right;hisData.Period=message.Period;hisData.DataType=message.DataType;//0=日线 1=分钟
|
|
14305
14305
|
hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,Stock:{Symbol:message.Symbol},Request:{MaxDataCount:500,MaxMinuteDayCount:5},Period:message.Period,Right:message.Right,Data:hisData};if(IFrameSplitOperator.IsNumber(message.HQDataType))stockObj.HQDataType=message.HQDataType;indexConsole.ExecuteScript(stockObj);};this.OnRecvMessage=function(message){var data=message.data;if(!data)return;if(data.ID==JSCHART_WORKER_MESSAGE_ID.EXECUTE_SCRIPT){if(!IFrameSplitOperator.IsNonEmptyArray(data.AryIndex))return;for(var i=0;i<data.AryIndex.length;++i){var item=data.AryIndex[i];this.Status=1;//执行状态
|
|
14306
14306
|
this.ExecuteScript(item,data);}this.Status=0;}};this.OnExecuteFinish=function(data,indexInfo,jsExectute,jobInfo){var message={Data:data,IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.FINISH_EXECUTE_SCRIPT,JobInfo:jobInfo};postMessage(message);};this.OnExecuteError=function(error,indexInfo,jobData){var message={IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.ERROR_EXECUTE_SCRIPT,Error:error};postMessage(message);};}/********************************************************************************
|
|
14307
14307
|
* 版本信息输出
|
|
14308
14308
|
*
|
|
14309
|
-
*/var HQCHART_VERSION="1.1.
|
|
14309
|
+
*/var HQCHART_VERSION="1.1.14374";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
|
|
14310
14310
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
14311
14311
|
// BaseIndex:BaseIndex,
|
|
14312
14312
|
// ChartLine:ChartLine,
|