hqchart 1.1.13171 → 1.1.13182
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 +276 -183
- package/package.json +1 -1
- package/src/jscommon/umychart.js +787 -109
- package/src/jscommon/umychart.popMenu.js +266 -0
- package/src/jscommon/umychart.resource/css/umychart.popmenu.css +92 -0
- package/src/jscommon/umychart.resource/font/iconfont.css +7 -3
- package/src/jscommon/umychart.resource/font/iconfont.ttf +0 -0
- package/src/jscommon/umychart.resource/font/iconfont.woff +0 -0
- package/src/jscommon/umychart.resource/font/iconfont.woff2 +0 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +788 -110
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +1056 -110
package/lib/umychart.vue.js
CHANGED
|
@@ -1146,7 +1146,7 @@ chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTat
|
|
|
1146
1146
|
for(var i=0;i<chart.Frame.SubFrame.length;++i){chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight*=pixelTatio;}chart.ChartCorssCursor.TextHeight*=pixelTatio;//十字光标文本信息高度
|
|
1147
1147
|
};this.SetChartBorder=function(chart,option){if(!option.Border)return;var item=option.Border;if(IFrameSplitOperator.IsNumber(option.Border.Left))chart.Frame.ChartBorder.Left=option.Border.Left;else option.Border.Left=chart.Frame.ChartBorder.Left;if(IFrameSplitOperator.IsNumber(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;else option.Border.Right=chart.Frame.ChartBorder.Right;if(IFrameSplitOperator.IsNumber(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;else option.Border.Top=chart.Frame.ChartBorder.Top;if(IFrameSplitOperator.IsNumber(option.Border.Bottom))chart.Frame.ChartBorder.Bottom=option.Border.Bottom;else option.Border.Bottom=chart.Frame.ChartBorder.Bottom;if(item.AutoLeft){chart.Frame.AutoLeftBorder={};if(IFrameSplitOperator.IsNumber(item.AutoLeft.Blank))chart.Frame.AutoLeftBorder.Blank=item.AutoLeft.Blank;if(IFrameSplitOperator.IsNumber(item.AutoLeft.MinWidth))chart.Frame.AutoLeftBorder.MinWidth=item.AutoLeft.MinWidth;}if(item.AutoRight){chart.Frame.AutoRightBorder={};if(IFrameSplitOperator.IsNumber(item.AutoRight.Blank))chart.Frame.AutoRightBorder.Blank=item.AutoRight.Blank;if(IFrameSplitOperator.IsNumber(item.AutoRight.MinWidth))chart.Frame.AutoRightBorder.MinWidth=item.AutoRight.MinWidth;}};this.SetEventCallback=function(chart,aryCallback){if(!chart)return;if(!IFrameSplitOperator.IsNonEmptyArray(aryCallback))return;for(var i=0;i<aryCallback.length;++i){var item=aryCallback[i];chart.AddEventCallback(item);}};//历史K线图
|
|
1148
1148
|
this.CreateKLineChartContainer=function(option){var _this2=this;var chart=null;if(option.Type==="历史K线图横屏")chart=new KLineChartHScreenContainer(this.CanvasElement);else chart=new KLineChartContainer(this.CanvasElement,this.OffscreenCanvasElement,this.CacheCanvasElement);chart.GetExtraCanvas=function(name){return _this2.GetExtraCanvas(name);};var extraElement=this.GetExtraCanvas(JSChart.CorssCursorCanvasKey);if(extraElement)chart.SetCorssCursorElement(extraElement);if(option.EventCallback)this.SetEventCallback(chart,option.EventCallback);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;//创建改参数div
|
|
1149
|
-
chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;chart.MinuteDialog=this.MinuteDialog;//右键菜单
|
|
1149
|
+
chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;chart.MinuteDialog=this.MinuteDialog;var pixelRatio=GetDevicePixelRatio();//右键菜单
|
|
1150
1150
|
if(option.IsShowRightMenu==true)chart.RightMenu=new KLineRightMenu(this.DivElement);if(option.ScriptError)chart.ScriptErrorCallback=option.ScriptError;chart.SelectRectRightMenu=new KLineSelectRightMenu(this.DivElement);if(option.EnableScrollUpDown==true)chart.EnableScrollUpDown=option.EnableScrollUpDown;if(option.DisableMouse==true)chart.DisableMouse=option.DisableMouse;if(option.TouchMoveMinAngle)chart.TouchMoveMinAngle=option.TouchMoveMinAngle;if(option.EnableZoomUpDown)chart.EnableZoomUpDown=option.EnableZoomUpDown;if(IFrameSplitOperator.IsString(option.SplashTitle))chart.LoadDataSplashTitle=option.SplashTitle;if(IFrameSplitOperator.IsBool(option.EnableZoomIndexWindow))chart.EnableZoomIndexWindow=option.EnableZoomIndexWindow;if(IFrameSplitOperator.IsBool(option.IsDrawPictureXY))chart.IsDrawPictureXY=option.IsDrawPictureXY;if(IFrameSplitOperator.IsNumber(option.CtrlMoveStep))chart.CtrlMoveStep=option.CtrlMoveStep;if(IFrameSplitOperator.IsBool(option.EnableIndexChartDrag))chart.EnableIndexChartDrag=option.EnableIndexChartDrag;if(IFrameSplitOperator.IsBool(option.EnableVerifyRecvData))chart.EnableVerifyRecvData=option.EnableVerifyRecvData;if(option.GlobalOption){var item=option.GlobalOption;if(IFrameSplitOperator.IsBool(item.IsValueFullRange))chart.GlobalOption.IsValueFullRange=item.IsValueFullRange;if(item.SelectedBorder){var subItem=item.SelectedBorder;if(IFrameSplitOperator.IsNumber(subItem.Mode))chart.GlobalOption.SelectedBorder.Mode=subItem.Mode;}}if(option.EnableYDrag){var item=option.EnableYDrag;if(IFrameSplitOperator.IsBool(item.Left))chart.EnableYDrag.Left=item.Left;if(IFrameSplitOperator.IsBool(item.Right))chart.EnableYDrag.Right=item.Right;if(IFrameSplitOperator.IsBool(item.Wheel))chart.EnableYDrag.Wheel=item.Wheel;if(IFrameSplitOperator.IsNumber(item.WheelYMove))chart.EnableYDrag.WheelYMove=item.WheelYMove;}if(option.KLine)//k线图的属性设置
|
|
1151
1151
|
{var item=option.KLine;if(option.KLine.DragMode>=0)chart.DragMode=option.KLine.DragMode;if(option.KLine.Right>=0)chart.Right=option.KLine.Right;if(option.KLine.Period>=0)chart.Period=option.KLine.Period;if(option.KLine.MaxReqeustDataCount>0)chart.MaxRequestDataCount=option.KLine.MaxReqeustDataCount;//兼容老版本
|
|
1152
1152
|
if(option.KLine.MaxRequestDataCount>0)chart.MaxRequestDataCount=option.KLine.MaxRequestDataCount;if(option.KLine.Info&&option.KLine.Info.length>0)chart.SetKLineInfo(option.KLine.Info,false);if(option.KLine.KLineDoubleClick==false)chart.MinuteDialog=this.MinuteDialog=null;if(IFrameSplitOperator.IsBool(item.IsShowTooltip))chart.IsShowTooltip=item.IsShowTooltip;if(IFrameSplitOperator.IsBool(item.IsShowKLineDivTooltip))chart.IsShowKLineDivTooltip=item.IsShowKLineDivTooltip;if(option.KLine.MaxRequestMinuteDayCount>0)chart.MaxRequestMinuteDayCount=option.KLine.MaxRequestMinuteDayCount;if(option.KLine.DrawType)chart.KLineDrawType=option.KLine.DrawType;if(option.KLine.FirstShowDate>19910101)chart.CustomShow={Date:option.KLine.FirstShowDate,PageSize:option.KLine.PageSize};if(option.KLine.RightSpaceCount>0)chart.RightSpaceCount=option.KLine.RightSpaceCount;if(option.KLine.ZoomType>0)chart.ZoomType=option.KLine.ZoomType;if(option.KLine.DataWidth>=1)chart.KLineSize={DataWidth:option.KLine.DataWidth};if(IFrameSplitOperator.IsNumber(option.KLine.RightFormula))chart.RightFormula=option.KLine.RightFormula;}if(option.EnableFlowCapital){var item=option.EnableFlowCapital;if(item.BIT==true)chart.EnableFlowCapital.BIT=item.BIT;}if(IFrameSplitOperator.IsBool(option.EnableBorderDrag)){chart.EnableBorderDrag=option.EnableBorderDrag;}if(option.Page){if(option.Page.Day&&option.Page.Day.Enable==true)chart.Page.Day.Enable=true;if(option.Page.Minute&&option.Page.Minute.Enable==true)chart.Page.Minute.Enable=true;}if(option.DragDownload){if(option.DragDownload.Day&&option.DragDownload.Day.Enable==true)chart.DragDownload.Day.Enable=true;if(option.DragDownload.Minute&&option.DragDownload.Minute.Enable==true)chart.DragDownload.Minute.Enable=true;}if(option.ZoomDownload){if(option.ZoomDownload.Day&&IFrameSplitOperator.IsBool(option.ZoomDownload.Day.Enable))chart.ZoomDownload.Day.Enable=option.ZoomDownload.Day.Enable;if(option.ZoomDownload.Minute&&IFrameSplitOperator.IsBool(option.ZoomDownload.Minute.Enable))chart.ZoomDownload.Minute.Enable=option.ZoomDownload.Minute.Enable;}if(option.Language){var value=g_JSChartLocalization.GetLanguageID(option.Language);if(IFrameSplitOperator.IsNumber(value))chart.LanguageID=value;}if(option.SourceDatatLimit)chart.SetSourceDatatLimit(option.SourceDatatLimit);if(option.DrawPicture)//画图工具
|
|
@@ -1162,7 +1162,7 @@ if(option.CorssCursorInfo.PressTime)chart.PressTime=option.CorssCursorInfo.Press
|
|
|
1162
1162
|
if(IFrameSplitOperator.IsNumber(option.CorssCursorInfo.HPenType))chart.ChartCorssCursor.HPenType=option.CorssCursorInfo.HPenType;if(option.CorssCursorInfo.VPenType>0)chart.ChartCorssCursor.VPenType=option.CorssCursorInfo.VPenType;if(IFrameSplitOperator.IsNumber(item.VLineType))chart.ChartCorssCursor.VLineType=item.VLineType;if(option.CorssCursorInfo.DateFormatType>0)chart.ChartCorssCursor.StringFormatX.DateFormatType=option.CorssCursorInfo.DateFormatType;if(IFrameSplitOperator.IsBool(item.IsDrawXRangeBG))chart.ChartCorssCursor.IsDrawXRangeBG=item.IsDrawXRangeBG;if(IFrameSplitOperator.IsBool(option.CorssCursorInfo.IsFixXLastTime))chart.ChartCorssCursor.IsFixXLastTime=option.CorssCursorInfo.IsFixXLastTime;if(IFrameSplitOperator.IsNumber(item.TextHeight))chart.ChartCorssCursor.TextHeight=item.TextHeight;if(item.RightButton){if(IFrameSplitOperator.IsBool(item.RightButton.Enable))chart.ChartCorssCursor.RightButton.Enable=item.RightButton.Enable;}if(IFrameSplitOperator.IsNumber(item.PriceFormatType))chart.ChartCorssCursor.StringFormatY.PriceFormatType=item.PriceFormatType;if(IFrameSplitOperator.IsNumber(item.DataFormatType))chart.ChartCorssCursor.StringFormatY.DataFormatType=item.DataFormatType;}//保存十字光标文字高度
|
|
1163
1163
|
option.CorssCursor={};option.CorssCursor.TitleHeight=chart.ChartCorssCursor.TextHeight;if(IFrameSplitOperator.IsNumber(option.SplashTitlePosition)){if(chart.ChartSplashPaint)chart.ChartSplashPaint.Position=option.SplashTitlePosition;}if(option.Frame){for(var i=0;i<option.Frame.length;++i){var item=option.Frame[i];if(!chart.Frame.SubFrame[i])continue;var subFrame=chart.Frame.SubFrame[i].Frame;if(IFrameSplitOperator.IsNumber(item.SplitCount))chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;if(item.StringFormat)chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;if(IFrameSplitOperator.IsNumber(item.FloatPrecision))chart.Frame.SubFrame[i].Frame.YSplitOperator.FloatPrecision=item.FloatPrecision;if(item.Custom)chart.Frame.SubFrame[i].Frame.YSplitOperator.Custom=item.Custom;if(IFrameSplitOperator.IsNumber(item.SplitType)){chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitType=item.SplitType;chart.Frame.SubFrame[i].Frame.YSplitOperator.DefaultSplitType=item.SplitType;}if(!isNaN(item.Height))chart.Frame.SubFrame[i].Height=item.Height;if(item.IsShowLeftText===false||item.IsShowLeftText===true){chart.Frame.SubFrame[i].Frame.IsShowYText[0]=item.IsShowLeftText;chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowLeftText=item.IsShowLeftText;//显示左边刻度
|
|
1164
1164
|
}if(item.IsShowRightText===false||item.IsShowRightText===true){chart.Frame.SubFrame[i].Frame.IsShowYText[1]=item.IsShowRightText;chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowRightText=item.IsShowRightText;//显示右边刻度
|
|
1165
|
-
}if(item.TopSpace>=0)chart.Frame.SubFrame[i].Frame.ChartBorder.TopSpace=item.TopSpace;if(item.BottomSpace>=0)chart.Frame.SubFrame[i].Frame.ChartBorder.BottomSpace=item.BottomSpace;if(item.RightTextPosition>0)chart.Frame.SubFrame[i].Frame.YTextPosition[1]=item.RightTextPosition;if(item.LeftTextPosition>0)chart.Frame.SubFrame[i].Frame.YTextPosition[0]=item.LeftTextPosition;if(item.IsShowXLine==false)chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;if(item.IsShowYLine==false)chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;if(IFrameSplitOperator.IsNumber(item.YTextBaseline))chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;if(item.YCoordinateType>0)chart.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType=item.YCoordinateType;if(item.IsYReverse==true)chart.Frame.SubFrame[0].Frame.CoordinateType=1;//反转坐标
|
|
1165
|
+
}if(item.TopSpace>=0)chart.Frame.SubFrame[i].Frame.ChartBorder.TopSpace=item.TopSpace*pixelRatio;if(item.BottomSpace>=0)chart.Frame.SubFrame[i].Frame.ChartBorder.BottomSpace=item.BottomSpace*pixelRatio;if(item.RightTextPosition>0)chart.Frame.SubFrame[i].Frame.YTextPosition[1]=item.RightTextPosition;if(item.LeftTextPosition>0)chart.Frame.SubFrame[i].Frame.YTextPosition[0]=item.LeftTextPosition;if(item.IsShowXLine==false)chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;if(item.IsShowYLine==false)chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;if(IFrameSplitOperator.IsNumber(item.YTextBaseline))chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;if(item.YCoordinateType>0)chart.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType=item.YCoordinateType;if(item.IsYReverse==true)chart.Frame.SubFrame[0].Frame.CoordinateType=1;//反转坐标
|
|
1166
1166
|
if(IFrameSplitOperator.IsNumber(item.PercentageTextFormat))subFrame.YSplitOperator.PercentageTextFormat=item.PercentageTextFormat;//百分比坐标格式
|
|
1167
1167
|
if(item.DefaultYMaxMin)chart.Frame.SubFrame[i].Frame.YSplitOperator.DefaultYMaxMin=item.DefaultYMaxMin;if(IFrameSplitOperator.IsBool(item.EnableRemoveZero))chart.Frame.SubFrame[i].Frame.YSplitOperator.EnableRemoveZero=item.EnableRemoveZero;if(IFrameSplitOperator.IsPlusNumber(item.MinYDistance))chart.Frame.SubFrame[i].Frame.MinYDistance=item.MinYDistance;if(IFrameSplitOperator.IsNumber(item.BorderLine))chart.Frame.SubFrame[i].Frame.BorderLine=item.BorderLine;if(IFrameSplitOperator.IsBool(item.IsShowIndexTitle))chart.Frame.SubFrame[i].Frame.IsShowIndexTitle=item.IsShowIndexTitle;if(IFrameSplitOperator.IsBool(item.IsDrawTitleBottomLine))subFrame.IsDrawTitleBottomLine=item.IsDrawTitleBottomLine;if(IFrameSplitOperator.IsBool(item.IsShowNameArrow))chart.Frame.SubFrame[i].Frame.IsShowNameArrow=item.IsShowNameArrow;if(item.ClientBGColor)subFrame.ClientBGColor=item.ClientBGColor;}}if(option.KLine){var item=option.KLine;var klineChart=chart.ChartPaint[0];if(option.KLine.ShowKLine==false)klineChart.IsShow=false;if(option.KLine.InfoPosition>0)klineChart.InfoPosition=option.KLine.InfoPosition;if(IFrameSplitOperator.IsBool(item.IsShowMaxMinPrice))klineChart.IsShowMaxMinPrice=item.IsShowMaxMinPrice;if(item.PriceGap){if(IFrameSplitOperator.IsBool(item.PriceGap.Enable))klineChart.PriceGap.Enable=item.PriceGap.Enable;if(IFrameSplitOperator.IsNumber(item.PriceGap.Count))klineChart.PriceGap.Count=item.PriceGap.Count;}}if(option.KLineTitle){var item=option.KLineTitle;if(option.KLineTitle.IsShowName==false)chart.TitlePaint[0].IsShowName=false;if(option.KLineTitle.IsShowSettingInfo==false)chart.TitlePaint[0].IsShowSettingInfo=false;if(option.KLineTitle.IsShow==false)chart.TitlePaint[0].IsShow=false;if(IFrameSplitOperator.IsBool(item.IsTitleShowLatestData))chart.IsTitleShowLatestData=item.IsTitleShowLatestData;}//叠加股票
|
|
1168
1168
|
if(option.Overlay){for(var i=0;i<option.Overlay.length;++i){var item=option.Overlay[i];chart.OverlaySymbol(item.Symbol,item);}}if(option.ExtendChart){for(var i=0;i<option.ExtendChart.length;++i){var item=option.ExtendChart[i];chart.CreateExtendChart(item.Name,item);}}//创建子窗口的指标
|
|
@@ -1186,7 +1186,7 @@ chart.Create(option.Windows.length);if(option.Border){if(!isNaN(option.Border.Le
|
|
|
1186
1186
|
var scriptData=new JSIndexScript();for(var i=0;i<option.Windows.length;++i){var item=option.Windows[i];if(item.Script){chart.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
|
|
1187
1187
|
}else{var indexItem=JSIndexMap.Get(item.Index);if(indexItem){chart.WindowIndex[i]=indexItem.Create();chart.CreateWindowIndex(i);}else{var indexInfo=scriptData.Get(item.Index);if(!indexInfo)continue;if(item.Lock)indexInfo.Lock=item.Lock;chart.WindowIndex[i]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
|
|
1188
1188
|
}}if(item.Modify!=null)chart.Frame.SubFrame[i].Frame.ModifyIndex=item.Modify;if(item.Change!=null)chart.Frame.SubFrame[i].Frame.ChangeIndex=item.Change;if(!isNaN(item.TitleHeight))chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;}return chart;};//分钟走势图
|
|
1189
|
-
this.CreateMinuteChartContainer=function(option){var _this3=this;var chart=null;if(option.Type==="分钟走势图横屏")chart=new MinuteChartHScreenContainer(this.CanvasElement);else chart=new MinuteChartContainer(this.CanvasElement,this.OffscreenCanvasElement,this.CacheCanvasElement);chart.GetExtraCanvas=function(name){return _this3.GetExtraCanvas(name);};if(option.EventCallback)this.SetEventCallback(chart,option.EventCallback);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;var windowsCount=2;if(option.Windows&&option.Windows.length>0)windowsCount+=option.Windows.length;//指标窗口从第3个窗口开始
|
|
1189
|
+
this.CreateMinuteChartContainer=function(option){var _this3=this;var chart=null;if(option.Type==="分钟走势图横屏")chart=new MinuteChartHScreenContainer(this.CanvasElement);else chart=new MinuteChartContainer(this.CanvasElement,this.OffscreenCanvasElement,this.CacheCanvasElement);chart.GetExtraCanvas=function(name){return _this3.GetExtraCanvas(name);};if(option.EventCallback)this.SetEventCallback(chart,option.EventCallback);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;var pixelRatio=GetDevicePixelRatio();var windowsCount=2;if(option.Windows&&option.Windows.length>0)windowsCount+=option.Windows.length;//指标窗口从第3个窗口开始
|
|
1190
1190
|
if(option.EnableScrollUpDown==true)chart.EnableScrollUpDown=option.EnableScrollUpDown;if(option.DisableMouse==true)chart.DisableMouse=option.DisableMouse;if(option.ScriptError)chart.ScriptErrorCallback=option.ScriptError;//指标执行错误回调
|
|
1191
1191
|
if(IFrameSplitOperator.IsString(option.SplashTitle))chart.LoadDataSplashTitle=option.SplashTitle;if(IFrameSplitOperator.IsBool(option.EnableSelectRect))chart.EnableSelectRect=option.EnableSelectRect;//是否启用区间选择
|
|
1192
1192
|
if(IFrameSplitOperator.IsBool(option.EnableZoomIndexWindow))chart.EnableZoomIndexWindow=option.EnableZoomIndexWindow;if(IFrameSplitOperator.IsBool(option.IsDrawPictureXY))chart.IsDrawPictureXY=option.IsDrawPictureXY;if(IFrameSplitOperator.IsBool(option.EnableNewIndex))chart.EnableNewIndex=option.EnableNewIndex;if(IFrameSplitOperator.IsBool(option.EnableIndexChartDrag))chart.EnableIndexChartDrag=option.EnableIndexChartDrag;if(IFrameSplitOperator.IsBool(option.EnableVerifyRecvData))chart.EnableVerifyRecvData=option.EnableVerifyRecvData;if(option.GlobalOption){var item=option.GlobalOption;if(IFrameSplitOperator.IsBool(item.IsValueFullRange))chart.GlobalOption.IsValueFullRange=item.IsValueFullRange;if(IFrameSplitOperator.IsNumber(item.XDateFormat))chart.GlobalOption.XDateFormat=item.XDateFormat;}if(option.DisplayLatest){var item=option.DisplayLatest;if(IFrameSplitOperator.IsBool(item.Enable))chart.DisplayLatestOption.Enable=item.Enable;if(IFrameSplitOperator.IsNumber(item.DelayTime))chart.DisplayLatestOption.DelayTime=item.DelayTime;}if(option.DrawDynamicInfo){var item=option.DrawDynamicInfo;if(IFrameSplitOperator.IsBool(item.Enable))chart.DrawDynamicInfoOption.Enable=item.Enable;if(IFrameSplitOperator.IsNumber(item.DelayTime))chart.DrawDynamicInfoOption.DelayTime=item.DelayTime;}chart.SelectRectDialog=new MinuteSelectRectDialog(this.DivElement);if(option.Minute)//分钟走势图属性设置
|
|
@@ -1199,7 +1199,7 @@ if(option.PageInfo)chart.SetPageInfo(option.PageInfo);chart.Create(windowsCount,
|
|
|
1199
1199
|
if(option.CorssCursorInfo){var item=option.CorssCursorInfo;if(!isNaN(option.CorssCursorInfo.Left))chart.ChartCorssCursor.ShowTextMode.Left=option.CorssCursorInfo.Left;if(!isNaN(option.CorssCursorInfo.Right))chart.ChartCorssCursor.ShowTextMode.Right=option.CorssCursorInfo.Right;if(!isNaN(option.CorssCursorInfo.Bottom))chart.ChartCorssCursor.ShowTextMode.Bottom=option.CorssCursorInfo.Bottom;if(option.CorssCursorInfo.IsShowCorss===false)chart.ChartCorssCursor.IsShowCorss=option.CorssCursorInfo.IsShowCorss;if(option.CorssCursorInfo.RightTextFormat>0)chart.ChartCorssCursor.TextFormat.Right=option.CorssCursorInfo.RightTextFormat;if(option.CorssCursorInfo.IsOnlyDrawMinute==true)chart.ChartCorssCursor.IsOnlyDrawMinute=option.CorssCursorInfo.IsOnlyDrawMinute;//Y轴显示收盘价
|
|
1200
1200
|
if(IFrameSplitOperator.IsBool(option.CorssCursorInfo.IsFixXLastTime))chart.ChartCorssCursor.IsFixXLastTime=option.CorssCursorInfo.IsFixXLastTime;if(item.RightButton){if(IFrameSplitOperator.IsBool(item.RightButton.Enable))chart.ChartCorssCursor.RightButton.Enable=item.RightButton.Enable;}if(IFrameSplitOperator.IsNumber(item.PriceFormatType))chart.ChartCorssCursor.StringFormatY.PriceFormatType=item.PriceFormatType;if(IFrameSplitOperator.IsNumber(item.DataFormatType))chart.ChartCorssCursor.StringFormatY.DataFormatType=item.DataFormatType;if(IFrameSplitOperator.IsNumber(item.HPenType))chart.ChartCorssCursor.HPenType=item.HPenType;if(IFrameSplitOperator.IsNumber(item.VPenType))chart.ChartCorssCursor.VPenType=item.VPenType;}if(option.MinuteInfo)chart.CreateMinuteInfo(option.MinuteInfo);if(option.IsShowRightMenu==true)chart.RightMenu=new MinuteRightMenu(this.DivElement);if(IFrameSplitOperator.IsNumber(option.DayCount))chart.DayCount=option.DayCount;this.SetChartBorder(chart,option);if(option.SplashTitle)chart.ChartSplashPaint.SplashTitle=option.SplashTitle;if(IFrameSplitOperator.IsBool(option.EnableBorderDrag)){chart.EnableBorderDrag=option.EnableBorderDrag;}this.AdjustChartBorder(chart);if(option.Frame){for(var i=0;i<option.Frame.length;++i){var item=option.Frame[i];if(!chart.Frame.SubFrame[i])continue;var subFrame=chart.Frame.SubFrame[i].Frame;if(IFrameSplitOperator.IsNumber(item.SplitCount))chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;if(item.StringFormat)chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;if(IFrameSplitOperator.IsNumber(item.SplitType)){chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitType=item.SplitType;chart.Frame.SubFrame[i].Frame.YSplitOperator.DefaultSplitType=item.SplitType;}if(item.IsShowLeftText==false){chart.Frame.SubFrame[i].Frame.IsShowYText[0]=item.IsShowLeftText;chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowLeftText=item.IsShowLeftText;//显示左边刻度
|
|
1201
1201
|
}if(item.IsShowRightText==false){chart.Frame.SubFrame[i].Frame.IsShowYText[1]=item.IsShowRightText;chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowRightText=item.IsShowRightText;//显示右边刻度
|
|
1202
|
-
}if(item.Height>=0)chart.Frame.SubFrame[i].Height=item.Height;if(item.Custom)chart.Frame.SubFrame[i].Frame.YSplitOperator.Custom=item.Custom;if(item.RightTextFormat>0)chart.Frame.SubFrame[i].Frame.YSplitOperator.RightTextFormat=item.RightTextFormat;if(IFrameSplitOperator.IsNumber(item.TitleHeight))chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;if(IFrameSplitOperator.IsNumber(item.BorderLine))chart.Frame.SubFrame[i].Frame.BorderLine=item.BorderLine;if(IFrameSplitOperator.IsBool(item.EnableRemoveZero))chart.Frame.SubFrame[i].Frame.YSplitOperator.EnableRemoveZero=item.EnableRemoveZero;if(IFrameSplitOperator.IsNumber(item.FloatPrecision))chart.Frame.SubFrame[i].Frame.YSplitOperator.FloatPrecision=item.FloatPrecision;if(IFrameSplitOperator.IsBool(item.IsShowXLine))chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;if(IFrameSplitOperator.IsBool(item.IsShowYLine))chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;if(IFrameSplitOperator.IsNumber(item.YTextBaseline))chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;if(IFrameSplitOperator.IsBool(item.IsShowIndexTitle))chart.Frame.SubFrame[i].Frame.IsShowIndexTitle=item.IsShowIndexTitle;if(item.TopSpace>=0)chart.Frame.SubFrame[i].Frame.ChartBorder.TopSpace=item.TopSpace;if(item.BottomSpace>=0)chart.Frame.SubFrame[i].Frame.ChartBorder.BottomSpace=item.BottomSpace;//是否显示关闭集合竞价按钮
|
|
1202
|
+
}if(item.Height>=0)chart.Frame.SubFrame[i].Height=item.Height;if(item.Custom)chart.Frame.SubFrame[i].Frame.YSplitOperator.Custom=item.Custom;if(item.RightTextFormat>0)chart.Frame.SubFrame[i].Frame.YSplitOperator.RightTextFormat=item.RightTextFormat;if(IFrameSplitOperator.IsNumber(item.TitleHeight))chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;if(IFrameSplitOperator.IsNumber(item.BorderLine))chart.Frame.SubFrame[i].Frame.BorderLine=item.BorderLine;if(IFrameSplitOperator.IsBool(item.EnableRemoveZero))chart.Frame.SubFrame[i].Frame.YSplitOperator.EnableRemoveZero=item.EnableRemoveZero;if(IFrameSplitOperator.IsNumber(item.FloatPrecision))chart.Frame.SubFrame[i].Frame.YSplitOperator.FloatPrecision=item.FloatPrecision;if(IFrameSplitOperator.IsBool(item.IsShowXLine))chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;if(IFrameSplitOperator.IsBool(item.IsShowYLine))chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;if(IFrameSplitOperator.IsNumber(item.YTextBaseline))chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;if(IFrameSplitOperator.IsBool(item.IsShowIndexTitle))chart.Frame.SubFrame[i].Frame.IsShowIndexTitle=item.IsShowIndexTitle;if(item.TopSpace>=0)chart.Frame.SubFrame[i].Frame.ChartBorder.TopSpace=item.TopSpace*pixelRatio;if(item.BottomSpace>=0)chart.Frame.SubFrame[i].Frame.ChartBorder.BottomSpace=item.BottomSpace*pixelRatio;//是否显示关闭集合竞价按钮
|
|
1203
1203
|
if(IFrameSplitOperator.IsNumber(item.CloseBeforeButton))chart.Frame.SubFrame[i].Frame.IsShowCloseButton=item.CloseBeforeButton;if(item.ClientBGColor)subFrame.ClientBGColor=item.ClientBGColor;}chart.UpdateXShowText();}if(option.ExtendChart){for(var i=0;i<option.ExtendChart.length;++i){var item=option.ExtendChart[i];chart.CreateExtendChart(item.Name,item);}}//叠加股票
|
|
1204
1204
|
if(option.Overlay){for(var i=0;i<option.Overlay.length;++i){var item=option.Overlay[i];chart.OverlaySymbol(item.Symbol,item);}}if(option.MinuteLine){if(option.MinuteLine.IsDrawAreaPrice==false)chart.ChartPaint[0].IsDrawArea=false;if(option.MinuteLine.IsShowLead==false)chart.IsShowLead=false;if(option.MinuteLine.IsShowAveragePrice==false){chart.ChartPaint[1].IsShow=false;chart.TitlePaint[0].IsShowAveragePrice=false;//标题栏均线也不显示
|
|
1205
1205
|
for(var i=0;i<chart.ExtendChartPaint.length;++i){var item=chart.ExtendChartPaint[i];if(item.ClassName=="MinuteTooltipPaint")item.IsShowAveragePrice=false;}}if(option.MinuteLine.SplitType>0)chart.Frame.SubFrame[0].Frame.YSplitOperator.SplitType=option.MinuteLine.SplitType;}if(option.MinuteVol){var item=option.MinuteVol;if(IFrameSplitOperator.IsNumber(item.BarColorType))chart.ChartPaint[2].BarColorType=item.BarColorType;}if(option.MinuteTitle){var item=option.MinuteTitle;if(IFrameSplitOperator.IsBool(item.IsShowName))chart.TitlePaint[0].IsShowName=item.IsShowName;if(IFrameSplitOperator.IsBool(item.IsShowDate))chart.TitlePaint[0].IsShowDate=item.IsShowDate;if(IFrameSplitOperator.IsBool(item.IsShowTime))chart.TitlePaint[0].IsShowTime=item.IsShowTime;if(IFrameSplitOperator.IsBool(item.IsTitleShowLatestData))chart.IsTitleShowLatestData=item.IsTitleShowLatestData;if(IFrameSplitOperator.IsBool(item.IsAlwaysShowLastData))chart.TitlePaint[0].IsAlwaysShowLastData=item.IsAlwaysShowLastData;if(IFrameSplitOperator.IsNumber(item.ShowLastDataFormat))chart.TitlePaint[0].ShowLastDataFormat=item.ShowLastDataFormat;if(IFrameSplitOperator.IsNumber(item.TitleBaseLine))chart.TitlePaint[0].TitleBaseLine=item.TitleBaseLine;if(item.TimeFormat)chart.TitlePaint[0].TimeFormat=item.TimeFormat;}if(IFrameSplitOperator.IsBool(option.CorssCursorTouchEnd))chart.CorssCursorTouchEnd=option.CorssCursorTouchEnd;if(IFrameSplitOperator.IsBool(option.IsClickShowCorssCursor))chart.IsClickShowCorssCursor=option.IsClickShowCorssCursor;if(option.IsShowBeforeData===true)chart.IsShowBeforeData=option.IsShowBeforeData;//分钟数据指标从第3个指标窗口设置
|
|
@@ -1248,13 +1248,12 @@ this.CreateDepthChartContainer=function(option){var chart=null;chart=new DepthCh
|
|
|
1248
1248
|
}return chart;};//根据option内容绘制图形
|
|
1249
1249
|
this.SetOption=function(option){//toolbar按钮风格
|
|
1250
1250
|
if(IFrameSplitOperator.IsNumber(option.ToolbarButtonStyle))g_JSChartResource.ToolbarButtonStyle=option.ToolbarButtonStyle;var chart=null;switch(option.Type){case"历史K线图":case'历史K线图横屏':chart=this.CreateKLineChartContainer(option);break;case"自定义指数历史K线图":chart=this.CreateCustomKLineChartContainer(option);break;case"分钟走势图":case"分钟走势图横屏":chart=this.CreateMinuteChartContainer(option);break;case"迷你分钟走势图":chart=this.CreateMinMinuteChartContainer(option);break;case"历史分钟走势图":chart=this.CreateHistoryMinuteChartContainer(option);break;case'K线训练':case'K线训练横屏':case"简单K线训练":case"简单K线训练横屏":chart=this.CreateKLineTrainChartContainer(option);break;case"深度图":chart=this.CreateDepthChartContainer(option);break;default:return false;}if(!chart)return false;this.JSChartContainer=chart;if(option.DefaultCursor)chart.DefaultCursor=option.DefaultCursor;if(option.OnCreatedCallback)option.OnCreatedCallback(chart);//是否自动更新
|
|
1251
|
-
if(option.IsAutoUpdate!=null)chart.IsAutoUpdate=option.IsAutoUpdate;if(option.AutoUpdateFrequency>0)chart.AutoUpdateFrequency=option.AutoUpdateFrequency
|
|
1251
|
+
if(option.IsAutoUpdate!=null)chart.IsAutoUpdate=option.IsAutoUpdate;if(option.AutoUpdateFrequency>0)chart.AutoUpdateFrequency=option.AutoUpdateFrequency;//内置菜单
|
|
1252
|
+
if(option.EnablePopMenuV2===true){chart.JSPopMenu=new JSPopMenu();chart.JSPopMenu.Inital();chart.EnablePopMenuV2=true;}//注册事件
|
|
1252
1253
|
if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}//设置股票代码
|
|
1253
1254
|
if(!option.Symbol){chart.DrawEmpty();this.JSChartContainer=chart;this.DivElement.JSChart=this;//div中保存一份
|
|
1254
1255
|
}else{chart.Draw();chart.ChangeSymbol(option.Symbol);this.JSChartContainer=chart;this.DivElement.JSChart=this;//div中保存一份
|
|
1255
|
-
this.JSChartContainer.Draw();}
|
|
1256
|
-
//chart.GetLatestVersion();
|
|
1257
|
-
}}};//创建工具条
|
|
1256
|
+
this.JSChartContainer.Draw();}};//创建工具条
|
|
1258
1257
|
this.CreateToolbar=function(option){};//创建设置div窗口
|
|
1259
1258
|
this.CreateSettingDiv=function(option){};this.Focus=function(){if(this.CanvasElement)this.CanvasElement.focus();};//切换股票代码接口
|
|
1260
1259
|
this.ChangeSymbol=function(symbol,option){if(this.JSChartContainer)this.JSChartContainer.ChangeSymbol(symbol,option);};//K线切换指标
|
|
@@ -1286,7 +1285,7 @@ this.ClearChartDrawPicture=function(drawPicture,option){if(this.JSChartContainer
|
|
|
1286
1285
|
this.JSChartContainer.ClearChartDrawPicture(drawPicture,option);}};//复制一个画图
|
|
1287
1286
|
this.PasteChartDrawPicture=function(data,frameID,option){if(this.JSChartContainer&&typeof this.JSChartContainer.PasteChartDrawPicture=='function'){JSConsole.Chart.Log('[JSChart:PasteChartDrawPicture] ',data,frameID,option);return this.JSChartContainer.PasteChartDrawPicture(data,frameID,option);}};//重新加载配置
|
|
1288
1287
|
this.ReloadResource=function(option){if(this.JSChartContainer&&typeof this.JSChartContainer.ReloadResource=='function'){JSConsole.Chart.Log('[JSChart:ReloadResource] ');this.JSChartContainer.ReloadResource(option);}};this.EnableSplashScreen=function(enable,option){if(this.JSChartContainer&&typeof this.JSChartContainer.EnableSplashScreen=='function'){JSConsole.Chart.Log('[JSChart:EnableSplashScreen] ');this.JSChartContainer.EnableSplashScreen(enable,option);}};this.Draw=function(){if(this.JSChartContainer&&typeof this.JSChartContainer.Draw=='function'){JSConsole.Chart.Log('[JSChart:Draw] ');this.JSChartContainer.Draw();}};this.SetFocus=function(){if(this.JSChartContainer&&typeof this.JSChartContainer.SetFocus=='function'){JSConsole.Chart.Log('[JSChart:SetFocus] ');this.JSChartContainer.SetFocus();}};//数据导出, option={ Start:{ Date, Time:可选}, End:{Date: Time:可选} }
|
|
1289
|
-
this.ExportData=function(option){if(this.JSChartContainer&&typeof this.JSChartContainer.ExportData=='function'){JSConsole.Chart.Log('[JSChart:ExportData] ');return this.JSChartContainer.ExportData(option);}};this.ChangePriceGap=function(option){if(this.JSChartContainer&&typeof this.JSChartContainer.ChangePriceGap=='function'){JSConsole.Chart.Log('[JSChart:ChangePriceGap] ');return this.JSChartContainer.ChangePriceGap(option);}};}JSChart.LastVersion=null;//最新的版本号
|
|
1288
|
+
this.ExportData=function(option){if(this.JSChartContainer&&typeof this.JSChartContainer.ExportData=='function'){JSConsole.Chart.Log('[JSChart:ExportData] ');return this.JSChartContainer.ExportData(option);}};this.ChangePriceGap=function(option){if(this.JSChartContainer&&typeof this.JSChartContainer.ChangePriceGap=='function'){JSConsole.Chart.Log('[JSChart:ChangePriceGap] ');return this.JSChartContainer.ChangePriceGap(option);}};this.PopupMenuByTab=function(menuData,rtTab){if(this.JSChartContainer&&typeof this.JSChartContainer.PopupMenuByTab=='function'){JSConsole.Chart.Log('[JSChart:ChangePriceGap] ');return this.JSChartContainer.PopupMenuByTab(menuData,rtTab);}};}JSChart.LastVersion=null;//最新的版本号
|
|
1290
1289
|
JSChart.EnableCanvasWillReadFrequently=false;//https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently
|
|
1291
1290
|
JSChart.CorssCursorCanvasKey="hqchart_corsscursor";//初始化
|
|
1292
1291
|
JSChart.Init=function(divElement,bScreen,bCacheCanvas){var jsChartControl=new JSChart(divElement,bScreen,bCacheCanvas);jsChartControl.OnSize();return jsChartControl;};JSChart.SetDomain=function(domain,cacheDomain){if(domain)g_JSChartResource.Domain=domain;if(cacheDomain)g_JSChartResource.CacheDomain=cacheDomain;};JSChart.SetPyIndexDomain=function(domain)//设置py指标计算api域名
|
|
@@ -1317,7 +1316,7 @@ JSChart.RegisterScriptIndexChart=function(name,option){return g_ScriptIndexChart
|
|
|
1317
1316
|
//option:{ Create:创建类方法 }
|
|
1318
1317
|
JSChart.RegisterDialogClass=function(name,option){return g_DialogFactory.Add(name,option);};//注册框架类
|
|
1319
1318
|
JSChart.RegisterChartFrameClass=function(name,option){return g_ChartFrameFactory.Add(name,option);};//一些公共函数
|
|
1320
|
-
JSChart.ToFixedPoint=function(value){return ToFixedPoint(value);};JSChart.ToFixedPoint2=function(width,value){return ToFixedPoint2(width,value);};JSChart.ToFixedRect=function(value){return ToFixedRect(value);};var JSCHART_EVENT_ID={RECV_KLINE_MATCH:1,//接收到形态匹配
|
|
1319
|
+
JSChart.ToFixedPoint=function(value){return ToFixedPoint(value);};JSChart.ToFixedPoint2=function(width,value){return ToFixedPoint2(width,value);};JSChart.ToFixedRect=function(value){return ToFixedRect(value);};JSChart.GetScrollPosition=function(){return GetScrollPosition();};var JSCHART_EVENT_ID={RECV_KLINE_MATCH:1,//接收到形态匹配
|
|
1321
1320
|
RECV_INDEX_DATA:2,//接收指标数据
|
|
1322
1321
|
RECV_HISTROY_DATA:3,//接收到历史数据
|
|
1323
1322
|
RECV_TRAIN_MOVE_STEP:4,//接收K线训练,移动一次K线
|
|
@@ -1458,9 +1457,30 @@ MINUTE_DAY_EXTENDDATA:21,MINUTE_BEFOREOPEN_EXTENDDATA:21,MINUTE_AFTERCLOSE_EXTEN
|
|
|
1458
1457
|
KLINE_DAY_EXTENDDATA:25,KLINE_MINUTE_EXTENDDATA:25,//OrderBook Heatmap
|
|
1459
1458
|
KLINE_HEATMAP:67};var JSCHART_WORKER_MESSAGE_ID={EXECUTE_SCRIPT:1,//工作线程执行脚本
|
|
1460
1459
|
FINISH_EXECUTE_SCRIPT:2,//脚本执行完成
|
|
1461
|
-
ERROR_EXECUTE_SCRIPT:3};
|
|
1460
|
+
ERROR_EXECUTE_SCRIPT:3};var JSCHART_MENU_ID={CMD_CHANGE_PERIOD_ID:1,//切换周期
|
|
1461
|
+
CMD_CHANGE_WINDOW_COUNT_ID:2,//窗口个数
|
|
1462
|
+
CMD_CHANGE_RIGHT_ID:3,//复权
|
|
1463
|
+
CMD_CHANGE_INDEX_ID:4,//切换指标
|
|
1464
|
+
CMD_CHANGE_COLOR_INDEX_ID:5,//五彩K线指标
|
|
1465
|
+
CMD_CHANGE_TRADE_INDEX_ID:6,//专家系统(交易指标)
|
|
1466
|
+
CMD_DELETE_COLOR_INDEX_ID:7,//删除五彩K线指标
|
|
1467
|
+
CMD_DELETE_TRADE_INDEX_ID:8,//删除专家系统(交易指标)
|
|
1468
|
+
CMD_CHANGE_KLINE_TYPE_ID:9,//切换K线类型
|
|
1469
|
+
CMD_CHANGE_PRICE_GAP_ID:10,//缺口提示
|
|
1470
|
+
CMD_OVERLAY_SYMBOL_ID:11,//叠加品种
|
|
1471
|
+
CMD_DELETE_ALL_OVERLAY_SYMBOL_ID:12,//删除所有叠加品种
|
|
1472
|
+
CMD_CHANGE_COORDINATETYPE_ID:13,//切换坐标类型
|
|
1473
|
+
CMD_CHANGE_KLINE_INFO_ID:14,//切换信息地雷
|
|
1474
|
+
CMD_DELETE_ALL_KLINE_INFO_ID:15,//清空信息地雷
|
|
1475
|
+
CMD_CHANGE_DRAG_MODE_ID:16,//切换拖动模式
|
|
1476
|
+
CMD_CHANGE_BG_SPLIT_ID:17,//背景分割
|
|
1477
|
+
CMD_SHOW_DRAWTOOL_ID:18,//画图工具
|
|
1478
|
+
CMD_HIDE_DRAWTOOL_ID:19,CMD_SHOW_STOCKCHIP_ID:20,//筹码分布
|
|
1479
|
+
CMD_HIDE_STOCKCHIP_ID:21,CMD_ENABLE_SELECT_RECT_ID:22,//启动区间选择
|
|
1480
|
+
CMD_CHANGE_DAY_COUNT_ID:23//切换天数
|
|
1481
|
+
};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=[];}};}/*
|
|
1462
1482
|
图形控件
|
|
1463
|
-
*/function JSChartContainer(uielement,OffscreenElement,cacheElement){var
|
|
1483
|
+
*/function JSChartContainer(uielement,OffscreenElement,cacheElement){var _this5=this;this.ClassName='JSChartContainer';var _self=this;this.Frame;//框架画法
|
|
1464
1484
|
this.ChartPaint=new Array();//图形画法
|
|
1465
1485
|
this.ChartPaintEx=[];//图形扩展画法
|
|
1466
1486
|
this.ChartInfo=new Array();//K线|走势图上信息地雷
|
|
@@ -1482,6 +1502,9 @@ this.IsClickShowCorssCursor=false;//手势点击显示十字光标
|
|
|
1482
1502
|
this.ChartSplashPaint=null;//等待提示
|
|
1483
1503
|
this.LoadDataSplashTitle="数据加载中";//下载数据提示信息
|
|
1484
1504
|
this.DefaultCursor="default";//crosshair , default 默认手型
|
|
1505
|
+
this.EnablePopMenuV2=false;this.JSPopMenu;//内置菜单
|
|
1506
|
+
//this.JSPopMenu=new JSPopMenu(); //内置菜单
|
|
1507
|
+
//this.JSPopMenu.Inital();
|
|
1485
1508
|
//绘图缓存
|
|
1486
1509
|
this.CacheCanvas=null;this.CacheElement=null;if(cacheElement){this.CacheElement=cacheElement;this.CacheCanvas=cacheElement.getContext("2d");}if(OffscreenElement){this.Canvas=OffscreenElement.getContext("2d");this.OffscreenCanvasElement=OffscreenElement;this.ShowCanvas=uielement.getContext("2d");}else{if(JSChart.EnableCanvasWillReadFrequently===true){var contextAttr={willReadFrequently:true};this.Canvas=uielement.getContext("2d",contextAttr);//画布
|
|
1487
1510
|
}else{this.Canvas=uielement.getContext("2d");//画布
|
|
@@ -1537,16 +1560,14 @@ this.DisplayLatestOption={Timer:null,Enable:false,DelayTime:60*1000*3,LastPoint:
|
|
|
1537
1560
|
this.StockCache={Data:null};//扩展数据缓存数据
|
|
1538
1561
|
this.ClearStockCache=function(){this.StockCache.Data=null;};//obj={ Element:, Canvas: }
|
|
1539
1562
|
this.SetCorssCursorElement=function(obj){if(!obj||!obj.Element||!obj.Canvas)return;this.CorssCursorElement=obj.Element;this.CorssCursorCanvas=obj.Canvas;};this.StopDisplayLatest=function(){this.GlobalOption.IsDisplayLatest=false;if(this.DisplayLatestOption.Timer){clearTimeout(this.DisplayLatestOption.Timer);this.DisplayLatestOption.Timer=null;}};this.StartStopDisplayLatest=function(){var _this4=this;this.StopDisplayLatest();if(!this.DisplayLatestOption.Enable)return;this.DisplayLatestOption.Timer=setTimeout(function(){if(_this4.DisplayLatest){JSConsole.Chart.Log('[JSChartContainer:StartStopDisplayLatest] call this.DisplayLatest()');_this4.DisplayLatest();}},this.DisplayLatestOption.DelayTime);};this.StopDrawDynamicInfo=function(){if(this.DrawDynamicInfoOption.Timer){clearTimeout(this.DrawDynamicInfoOption.Timer);this.DrawDynamicInfoOption.Timer=null;}};this.ChartDestroy=function()//销毁
|
|
1540
|
-
{this.IsDestroy=true;this.StopAutoUpdate();
|
|
1541
|
-
|
|
1542
|
-
this.GetLatestVersion=function(){var _this5=this;if(this.GetLatestVersionTimer!=null){clearTimeout(this.GetLatestVersionTimer);this.GetLatestVersionTimer=null;}var roundeTime=Math.floor(Math.random()*50);var waittimer=1000*60*3+roundeTime*1000;var value="aHR0cHM6Ly9ocWNoYXJ0LnplYWxpbmsuY29tL2FwaS9HZXRWZXJzaW9u";JSConsole.Chart.Log("[JSChartContainer::GetLatestVersion] wait for get hqchart latest version. ",waittimer);this.GetLatestVersionTimer=setTimeout(function(){var width=0,height=0;if(_this5.Frame&&_this5.Frame.ChartBorder){width=_this5.Frame.ChartBorder.GetChartWidth();height=_this5.Frame.ChartBorder.GetChartHeight();}var url=atob(value)+'?width='+width+'&height='+height+'&type=h5';if(JSChart.LastVersion!=null)return;//只请求一次
|
|
1543
|
-
JSNetwork.HttpRequest({url:url,type:"get",dataType:"json",async:true,success:function success(data){JSConsole.Chart.Log("[JSChartContainer::GetLatestVersion] hqchart latest version. ",data);JSChart.LastVersion=data;},error:function error(request,textStatus,errorThrown){JSConsole.Chart.Log("[JSChartContainer::GetLatestVersion] Get HQChart latest version failed.",request);}});},waittimer);};//设置焦点
|
|
1563
|
+
{this.IsDestroy=true;this.StopAutoUpdate();};this.ChartDestory=this.ChartDestroy;//老版本写错了,需要兼容下
|
|
1564
|
+
//设置焦点
|
|
1544
1565
|
this.SetFocus=function(){if(this.UIElement)this.UIElement.focus();};//设置事件回调
|
|
1545
1566
|
//{event:事件id, callback:回调函数}
|
|
1546
1567
|
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)//获取事件回调
|
|
1547
1568
|
{if(!this.mapEvent.has(id))return null;var item=this.mapEvent.get(id);return item;};//接收指标数据
|
|
1548
1569
|
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);};//鼠标事件绑定
|
|
1549
|
-
uielement.onmousemove=function(e){
|
|
1570
|
+
uielement.onmousemove=function(e){_this5.UIOnMouseMove(e);};uielement.oncontextmenu=function(e){return _this5.UIOnContextMenu(e);};uielement.ondblclick=function(e){_this5.UIOnDblClick(e);};uielement.onmousedown=function(e){_this5.UIOnMouseDown(e);};uielement.onmouseout=function(e){_this5.UIOnMounseOut(e);};uielement.onmouseleave=function(e){_this5.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);
|
|
1550
1571
|
var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
|
|
1551
1572
|
var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;this.StopDisplayLatest();//加载数据中,禁用鼠标事件
|
|
1552
1573
|
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;
|
|
@@ -1564,7 +1585,7 @@ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MOUSE_MOVE);var titleChart=t
|
|
|
1564
1585
|
if(titleChart)titleChart.OnMouseMoveEvent=null;this.StartStopDisplayLatest();};this.IsMouseOnClient=function(x,y){var rect={Left:this.Frame.ChartBorder.GetLeft(),Top:this.Frame.ChartBorder.GetTop(),Width:this.Frame.ChartBorder.GetWidth(),Height:this.Frame.ChartBorder.GetHeight()};rect.Right=rect.Left+rect.Width;rect.Bottom=rect.Top+rect.Height;if(x>=rect.Left&&x<=rect.Right&&y>=rect.Top&&y<=rect.Bottom)return true;return false;};this.UIOnContextMenu=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var x=e.clientX-this.UIElement.getBoundingClientRect().left;var y=e.clientY-this.UIElement.getBoundingClientRect().top;if(typeof this.OnRightMenu=='function')this.OnRightMenu(x,y,e);//右键菜单事件
|
|
1565
1586
|
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轴上
|
|
1566
1587
|
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;};//是否可以上下拖拽
|
|
1567
|
-
this.TryUpDownDrag=function(x,y){var windowIndex=this.Frame.PtInFrame(x,y);if(windowIndex<0)return null;var item=this.Frame.SubFrame[windowIndex];if(!item||!item.Frame)return null;var frame=item.Frame;if(!frame.YSplitOperator||!frame.YSplitOperator.FixedYMaxMin)return null;return{Index:windowIndex,X:x,Y:y};};this.TryRectSelectDrag=function(x,y){var paint=this.GetRectSelectPaint();if(!paint)return null;if(paint.GetPointCount()<=0)return null;var item=paint.PtInPaint(x,y);return{Item:item,X:x,Y:y};};this.TryClickCrossCursor=function(x,y,e){if(!this.ChartCorssCursor)return;var button=this.ChartCorssCursor.PtInButton(x,y);if(!button)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_CROSSCURSOR_RIGHT);if(event&&event.Callback){var sendData={Button:button,e:e};event.Callback(event,sendData,this);}return true;};this.TryClickButton=function(x,y,e){var button=this.Frame.PtInButtons(x,y);if(button&&this.ClickFrameButton){this.ClickFrameButton(button,e);return true;}button=this.PtInExtendChartButtons(x,y);if(button&&this.ClickExtendChartButton){this.ClickExtendChartButton(button,e);return true;}button=this.PtInDrawPictureButtons(x,y);if(button&&this.ClickDrawPictureButton){this.ClickDrawPictureButton(button,e);return true;}button=this.PtInTitleButtons(x,y);if(button&&this.ClickTitleButton){this.ClickTitleButton(button,e);return true;}return false;};this.TryMouseMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);if(!event||!event.Callback)return false;return event.Callback(event,sendData,this);};this.TryClick_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_DOWN);if(!event||!event.Callback)return false;sendData.ChartDrag=null;sendData.Cusrsor=null;event.Callback(event,sendData,this);this.CustomChartDrag=sendData.ChartDrag;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
|
|
1588
|
+
this.TryUpDownDrag=function(x,y){var windowIndex=this.Frame.PtInFrame(x,y);if(windowIndex<0)return null;var item=this.Frame.SubFrame[windowIndex];if(!item||!item.Frame)return null;var frame=item.Frame;if(!frame.YSplitOperator||!frame.YSplitOperator.FixedYMaxMin)return null;return{Index:windowIndex,X:x,Y:y};};this.TryRectSelectDrag=function(x,y){var paint=this.GetRectSelectPaint();if(!paint)return null;if(paint.GetPointCount()<=0)return null;var item=paint.PtInPaint(x,y);return{Item:item,X:x,Y:y};};this.TryClickCrossCursor=function(x,y,e){if(!this.ChartCorssCursor)return;var button=this.ChartCorssCursor.PtInButton(x,y);if(!button)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_CROSSCURSOR_RIGHT);if(event&&event.Callback){var sendData={Button:button,e:e};event.Callback(event,sendData,this);}return true;};this.TryClickButton=function(x,y,e){var button=this.Frame.PtInButtons(x,y);if(button&&this.ClickFrameButton){this.ClickFrameButton(button,e);return true;}button=this.PtInExtendChartButtons(x,y);if(button&&this.ClickExtendChartButton){this.ClickExtendChartButton(button,e);return true;}button=this.PtInDrawPictureButtons(x,y);if(button&&this.ClickDrawPictureButton){this.ClickDrawPictureButton(button,e);return true;}button=this.PtInTitleButtons(x,y);if(button&&this.ClickTitleButton){this.ClickTitleButton(button,e);return true;}return false;};this.TryMouseMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);if(!event||!event.Callback)return false;return event.Callback(event,sendData,this);};this.TryClick_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_DOWN);if(!event||!event.Callback)return false;sendData.ChartDrag=null;sendData.Cusrsor=null;event.Callback(event,sendData,this);this.CustomChartDrag=sendData.ChartDrag;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 _this6=this;this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.ClickDownPoint={X:e.clientX,Y:e.clientY};this.IsOnTouch=true;this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.TryClickButton(x,y,e)){return;}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)){return;}if(this.TryClickChartTooltipData&&this.TryClickChartTooltipData(x,y,e))//预留给外部点击图标什么用的
|
|
1568
1589
|
{return;}if(this.TryClickLock){//JSConsole.Chart.Log('[uielement.onmousedown] left, top ',e.clientX, e.clientY, this.getBoundingClientRect().left,this.getBoundingClientRect().top);
|
|
1569
1590
|
if(this.TryClickLock(x,y))return;}this.HideSelectRect();if(this.SelectRectRightMenu)this.SelectRectRightMenu.Hide();if(this.ChartPictureMenu)this.ChartPictureMenu.Hide();var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){if(item.Type==4){//this.UIElement.style.cursor="pointer";
|
|
1570
1591
|
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";
|
|
@@ -1587,7 +1608,7 @@ var bDraw=false;if(drawPictureActive.Select.Guid&&drawPictureActive.Select.Chart
|
|
|
1587
1608
|
//this.SelectChartDrawPicture=drawPictrueData.ChartDrawPicture;
|
|
1588
1609
|
this.SelectChartDrawPicture.DragInfo={Click:{X:e.clientX,Y:e.clientY}};}else{this.CurrentChartDrawPicture=null;this.SelectChartDrawPicture=null;}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_DRAWPICTURE);//选中画图工具事件
|
|
1589
1610
|
if(event&&event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};event.Callback(event,sendData,this);}else{this.OnSelectChartPicture(drawPictrueData.ChartDrawPicture);//选中画图工具事件
|
|
1590
|
-
}}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();}}}document.onmousemove=function(e){
|
|
1611
|
+
}}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();}}}document.onmousemove=function(e){_this6.DocOnMouseMove(e);};document.onmouseup=function(e){_this6.DocOnMouseUp(e);};};this.DocOnMouseMove=function(e){//加载数据中,禁用鼠标事件
|
|
1591
1612
|
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)//边框拖动
|
|
1592
1613
|
{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轴缩放
|
|
1593
1614
|
{if(moveSetpY<5)return;var yMove=e.clientY-drag.LastMove.Y;//this.UIElement.style.cursor="n-resize";
|
|
@@ -1631,7 +1652,7 @@ this.IsPhonePinching=function(e){var changed=e.changedTouches.length;var touchin
|
|
|
1631
1652
|
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)//是否是单点触屏
|
|
1632
1653
|
{var touchCount=e.touches.length;return touchCount==1;};this.StopDragTimer=function(){if(IFrameSplitOperator.IsNumber(this.DragTimer)){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.GetMoveAngle=function(pt,pt2)//计算角度
|
|
1633
1654
|
{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;};//手机拖拽
|
|
1634
|
-
uielement.ontouchstart=function(e){
|
|
1655
|
+
uielement.ontouchstart=function(e){_this5.OnTouchStart(e);};uielement.ontouchmove=function(e){_this5.OnTouchMove(e);};uielement.ontouchend=function(e){_this5.OnTouchEnd(e);};this.AddPhoneDBClickInfo=function(x,y,time){var item={X:x,Y:y,Time:time};this.PhoneDBClickInfo.Start.push(item);};this.ClearPhoneDBClickInfo=function(){this.PhoneDBClickInfo.Start=[];};this.IsShortPhoneClick=function(x,y,time){};this.OnTouchStart=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsOnTouch=true;this.TouchDrawCount=0;this.PhonePinch=null;this.StopDragTimer();var isSingleTouch=this.IsSingleTouch(e);if(this.EnableScrollUpDown==false||!isSingleTouch||//多点触屏
|
|
1635
1656
|
this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID&&this.TouchStatus.CorssCursorShow==true)//十字光标显示,不能滚动页面
|
|
1636
1657
|
{if(e.cancelable)e.preventDefault();}if(this.IsPhoneDragging(e)){var touches=this.GetToucheData(e,this.IsForceLandscape);var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);if(this.TryClickLock||this.TryClickIndexTitle)//指标枷锁区域 , 指标标题点击
|
|
1637
1658
|
{var x=pt.X;var y=pt.Y;if(this.TryClickLock&&this.TryClickLock(x,y))return;if(this.TryClickIndexTitle&&this.TryClickIndexTitle(x,y))return;}if(this.ClickFrameButton){var button=this.Frame.PtInButtons(pt.X,pt.Y);if(button){this.ClickFrameButton(button,e);return;}}if(this.EnableVerticalDrag){this.VerticalDrag={IsDrag:false};if(this.Frame.PtInFrameVertical(pt.X,pt.Y))this.VerticalDrag.IsDrag=true;}var bStartTimer=true;if(this.ChartDrawOption.IsLockScreen){bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID){if(this.TouchStatus.CorssCursorShow==true)bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.DISABLE_DRAG_ID){bStartTimer=false;}else{if(!isSingleTouch)bStartTimer=false;}if(this.VerticalDrag)bStartTimer=false;if(this.EnableClickModel&&this.ClickModel.IsShowCorssCursor==true)bStartTimer=false;var drag={"Click":{},"LastMove":{}//最后移动的位置
|
|
@@ -1671,10 +1692,10 @@ for(var i=0;i<this.ChartDrawPicture.length;++i){var item=this.ChartDrawPicture[i
|
|
|
1671
1692
|
for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];item.Canvas=canvas;}//扩展图形
|
|
1672
1693
|
for(var i=0;i<this.ChartPaintEx.length;++i){var item=this.ChartPaintEx[i];item.Canvas=canvas;}//叠加股票
|
|
1673
1694
|
for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];item.Canvas=canvas;}//扩展画法
|
|
1674
|
-
for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];item.Canvas=canvas;}};this.Draw=function(){var
|
|
1695
|
+
for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];item.Canvas=canvas;}};this.Draw=function(){var _this7=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();//获取设备的分辨率
|
|
1675
1696
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
1676
1697
|
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);//框架
|
|
1677
|
-
if(this.Frame.SetBeforeDrawXYCallback){this.Frame.SetBeforeDrawXYCallback(function(frame){
|
|
1698
|
+
if(this.Frame.SetBeforeDrawXYCallback){this.Frame.SetBeforeDrawXYCallback(function(frame){_this7.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();}//框架内图形
|
|
1678
1699
|
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);//画叠加指标
|
|
1679
1700
|
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();}//叠加股票
|
|
1680
1701
|
for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];item.Draw();}if(this.Frame.DrawOveraly)this.Frame.DrawOveraly(false);//画叠加指标
|
|
@@ -1719,7 +1740,7 @@ item.Draw(moveonPoint,this.LastMouseStatus);}if(this.SelectChartDrawPicture){thi
|
|
|
1719
1740
|
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 是否阻止内置的点击处理
|
|
1720
1741
|
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 是否阻止内置的点击处理
|
|
1721
1742
|
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);//删除画图工具
|
|
1722
|
-
}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
|
|
1743
|
+
}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 _this8=this;this.StopDrawDynamicInfo();this.LastPoint.X=x;this.LastPoint.Y=y;var mouseStatus=null;//鼠标状态
|
|
1723
1744
|
var button=null;//当前鼠标所在按钮
|
|
1724
1745
|
var frameID=this.Frame.PtInFrame(x,y);if(IFrameSplitOperator.IsNumber(frameID)&&frameID>=0)//在K线内部移动,调整K线索引
|
|
1725
1746
|
this.CursorIndex=this.Frame.GetXData(x);if(this.EnableBorderDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){mouseStatus={Cursor:"n-resize",Name:"DragBorder"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag border ",dragBorder);}}if(this.EnableYDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragY=this.TryYDrag(x,y);if(dragY){mouseStatus={Cursor:dragY.Position==0?"n-resize":"row-resize",Name:"DragY"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag y ",dragY);}}if(!this.CurrentChartDrawPicture){button=this.PtInButton(x,y);if(button){mouseStatus={Cursor:"pointer",Name:button.Name};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ",button);}}if(this.ChartCorssCursor){var crossButton=this.ChartCorssCursor.PtInButton(x,y);if(crossButton){mouseStatus={Cursor:"pointer",Name:"CorssCursorButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] cross cursor button ",crossButton);}}if(this.ClassName=="KLineChartContainer"&&this.Frame.PtInFrameBottom(x,y)){mouseStatus={Cursor:"ew-resize",Name:"FrameButtom"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");}if(this.SelectedChart.EnableMoveOn&&this.PtInChart&&!this.CurrentChartDrawPicture){var chartInfo=this.PtInChart(x,y);if(chartInfo&&chartInfo.Identify){mouseStatus={Cursor:"pointer",Name:"PtInChart"};this.SelectedChart.MoveOn.Identify=chartInfo.Identify;this.SelectedChart.MoveOn.Identify=null;JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] Point in chart ",chartInfo);}else{this.SelectedChart.MoveOn.Identify=null;}}else{this.SelectedChart.MoveOn.Identify=null;}//区间选择
|
|
@@ -1732,15 +1753,15 @@ else this.SetCursor({Cursor:"move"});//this.UIElement.style.cursor="move";
|
|
|
1732
1753
|
else this.SetCursor({Cursor:"pointer"});//this.UIElement.style.cursor="pointer";
|
|
1733
1754
|
}bDrawPicture=true;this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.SetCursor({Cursor:"default"});//this.UIElement.style.cursor="default";
|
|
1734
1755
|
}}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;//鼠标移开,在按钮上,不显示十字光标
|
|
1735
|
-
if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);if(this.DrawDynamicInfoOption.Enable){this.DrawDynamicInfoOption.Timer=setTimeout(function(){
|
|
1736
|
-
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
|
|
1756
|
+
if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);if(this.DrawDynamicInfoOption.Enable){this.DrawDynamicInfoOption.Timer=setTimeout(function(){_this8.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:鼠标形状 }
|
|
1757
|
+
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 _this9=this;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;//回调事件
|
|
1737
1758
|
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;switch(keyID){case 37://left
|
|
1738
1759
|
if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}if(this.CursorIndex<=0.99999){if(!this.DataMoveLeft()){//左移数据到头了 触发下载新数据
|
|
1739
1760
|
if(this.DragDownloadData)this.DragDownloadData();break;}this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.ResetFrameXSplit();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");}else{--this.CursorIndex;this.UpdatePointByCursorIndex();this.DrawDynamicInfo();this.ShowTooltipByKeyDown();}break;case 39://right
|
|
1740
1761
|
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{//判断是否在最后一个数据上
|
|
1741
1762
|
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
|
|
1742
1763
|
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
|
|
1743
|
-
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){
|
|
1764
|
+
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){_this9.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
|
|
1744
1765
|
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);//删除选中的画图工具
|
|
1745
1766
|
}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
|
|
1746
1767
|
this.OnMarkRectSelect(e);break;case 27://ESCAPE 取消画布工具
|
|
@@ -1762,10 +1783,10 @@ this.Frame.SetFrameBorderSizeChange();this.Frame.ReDrawToolbar();this.Draw();};t
|
|
|
1762
1783
|
{var pt={X:null,Y:null};pt.X=this.Frame.GetXFromIndex(this.CursorIndex);var index=Math.abs(this.CursorIndex-0.5);if(this.IsKLineContainer())index=this.CursorIndex;var data=this.Frame.Data;if(data.DataOffset+index<data.Data.length){var close=data.Data[data.DataOffset+index].Close;pt.Y=this.Frame.GetYFromData(close);}if(type==1&&this.ChartCorssCursor){if(this.ChartCorssCursor.Status==1)//十字光标显示中, 不调整位置
|
|
1763
1784
|
{}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)//取消鼠标位置,十字光标就不显示了
|
|
1764
1785
|
{this.LastPoint.Y=null;this.LastPoint.X=null;}else{this.LastPoint.X=pt.X;this.LastPoint.Y=pt.Y;}};this.ShowTooltipByKeyDown=function(){var index=Math.abs(this.CursorIndex-0.5);index=parseInt(index.toFixed(0));if(this.ClassName=='KLineChartContainer'||this.ClassName=='KLineTrainChartContainer')index=this.CursorIndex;var data=this.Frame.Data;var toolTip=new TooltipData();toolTip.Data=data.Data[data.DataOffset+index];toolTip.ChartPaint=this.ChartPaint[0];var pixelTatio=GetDevicePixelRatio();if(pixelTatio===0)pixelTatio=1;//div 缩放还是使用原始坐标
|
|
1765
|
-
this.ShowTooltip(this.LastPoint.X/pixelTatio,this.LastPoint.Y/pixelTatio,toolTip);};this.ShowTooltip=function(x,y,toolTip){var
|
|
1786
|
+
this.ShowTooltip(this.LastPoint.X/pixelTatio,this.LastPoint.Y/pixelTatio,toolTip);};this.ShowTooltip=function(x,y,toolTip){var _this10=this;if(!this.IsShowTooltip)return;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
1766
1787
|
var xMove=15/pixelTatio;//顶部坐标偏移位置
|
|
1767
1788
|
this.TooltipCache.Type=toolTip.Type;this.TooltipCache.Data=null;this.TooltipCache.X=x;this.TooltipCache.Y=y;if(toolTip.Type===0)//K线信息
|
|
1768
|
-
{if(!this.IsShowKLineDivTooltip)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
|
|
1789
|
+
{if(!this.IsShowKLineDivTooltip)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 _this10.GetEventCallback(id);};if(!format.Operator())return;var textHeight=format.LineCount*25;//每行的行高25
|
|
1769
1790
|
if(format.Height>0)textHeight=format.Height;//新版本高度有格式化类计算完成
|
|
1770
1791
|
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}` );
|
|
1771
1792
|
//if (toolTip.ChartPaint.Name=="Overlay-KLine") this.Tooltip.style.height =220+"px";
|
|
@@ -1781,7 +1802,7 @@ this.Tooltip.style.position="absolute";this.Tooltip.style.left=left+"px";this.To
|
|
|
1781
1802
|
{var left=x;var top=y;var format=g_DivTooltipDataForamt.Create('ScatterPlotDataStringFormat');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-charscatterplot-tooltip';//OX指标数据
|
|
1782
1803
|
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
|
|
1783
1804
|
{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指标数据
|
|
1784
|
-
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";}};this.UpdateDOMTooltip=function(toolTipType,data){var
|
|
1805
|
+
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";}};this.UpdateDOMTooltip=function(toolTipType,data){var _this11=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 _this11.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.ShowSelectRect=function(x,y,x2,y2){var left=x;var top=y;var border=this.Frame.ChartBorder.GetBorder();var borderRight=border.Right;var borderLeft=border.Left;if(x>borderRight)x=borderRight;if(x2>borderRight)x2=borderRight;if(x<borderLeft)x=borderLeft;if(x2<borderLeft)x2=borderLeft;if(x>x2)left=x2;if(y>y2)top=y2;var width=Math.abs(x-x2);var height=Math.abs(y-y2);this.SelectRect.style.width=width+"px";this.SelectRect.style.height=height+"px";this.SelectRect.style.position="absolute";this.SelectRect.style.left=left+"px";this.SelectRect.style.top=top+"px";this.SelectRect.style.display="block";};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 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.SelectRect.style.display="none";};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.UpdateFrameMaxMinV2=function(){var mapFrame=new _map2.default();//key=frameid, value:{ ChartPaint:[] }
|
|
1785
1806
|
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;var key=frame.Identify;var item={ID:key,Frame:frame,ChartPaint:[],Max:null,Min:null,OverlayFrame:[],//共享坐标
|
|
1786
1807
|
SingleOverlay:[],//独立坐标
|
|
1787
1808
|
MainOverlayFrame:[null,null]//叠加坐标在主坐标显示[0]=left [1]=right
|
|
@@ -1876,7 +1897,7 @@ this.SetSubFrameAttribute=function(subFrame,windowItem,frameItem){if(!subFrame||
|
|
|
1876
1897
|
}if(IFrameSplitOperator.IsBool(frameItem.IsShowRightText)){frame.IsShowYText[1]=frameItem.IsShowRightText;frame.YSplitOperator.IsShowRightText=frameItem.IsShowRightText;//显示右边刻度
|
|
1877
1898
|
}if(IFrameSplitOperator.IsNumber(frameItem.Height)&&frameItem.Height>=0)subFrame.Height=frameItem.Height;}};this.SetSubFrameOption=function(subFrame,option){if(!option)return;var frame=subFrame.Frame;if(option.Window){var item=option.Window;if(IFrameSplitOperator.IsBool(item.Modify))frame.ModifyIndex=item.Modify;if(IFrameSplitOperator.IsBool(item.Change))frame.ChangeIndex=item.Change;if(IFrameSplitOperator.IsBool(item.Close))frame.CloseIndex=item.Close;if(IFrameSplitOperator.IsBool(item.Overlay))frame.OverlayIndex=item.Overlay;if(IFrameSplitOperator.IsBool(item.Export))frame.ExportData=item.Export;if(IFrameSplitOperator.IsBool(item.MaxMin))frame.MaxMinWindow=item.MaxMin;if(IFrameSplitOperator.IsBool(item.TitleWindow))frame.TitleWindow=item.TitleWindow;if(IFrameSplitOperator.IsBool(item.IsDrawTitleBG))frame.IsDrawTitleBG=item.IsDrawTitleBG;if(IFrameSplitOperator.IsBool(item.IsShowNameArrow))frame.IsShowNameArrow=item.IsShowNameArrow;if(item.OverlayIndexType){if(IFrameSplitOperator.IsNumber(item.OverlayIndexType.Position))frame.OverlayIndexType.Position=item.OverlayIndexType.Position;if(IFrameSplitOperator.IsNumber(item.OverlayIndexType.LineSpace))frame.OverlayIndexType.LineSpace=item.OverlayIndexType.LineSpace;}}if(IFrameSplitOperator.IsNumber(option.SplitCount))subFrame.Frame.YSplitOperator.SplitCount=option.SplitCount;if(IFrameSplitOperator.IsNumber(option.TitleHeight))subFrame.Frame.ChartBorder.TitleHeight=option.TitleHeight;if(IFrameSplitOperator.IsBool(option.IsShowTitleArrow))subFrame.Frame.IsShowTitleArrow=option.IsShowTitleArrow;if(IFrameSplitOperator.IsBool(option.IsShowIndexName))subFrame.Frame.IsShowIndexName=option.IsShowIndexName;if(IFrameSplitOperator.IsBool(option.IsShowOverlayIndexName))subFrame.Frame.IsShowOverlayIndexName=option.IsShowOverlayIndexName;if(IFrameSplitOperator.IsNumber(option.IndexParamSpace))subFrame.Frame.IndexParamSpace=option.IndexParamSpace;if(IFrameSplitOperator.IsBool(option.IsShowXLine))subFrame.Frame.IsShowXLine=option.IsShowXLine;if(IFrameSplitOperator.IsBool(option.IsShowYLine))subFrame.Frame.IsShowYLine=option.IsShowYLine;if(IFrameSplitOperator.IsBool(option.IsShowIndexTitle))subFrame.Frame.IsShowIndexTitle=option.IsShowIndexTitle;if(IFrameSplitOperator.IsBool(option.IsShowLeftText)){subFrame.Frame.IsShowYText[0]=option.IsShowLeftText;subFrame.Frame.YSplitOperator.IsShowLeftText=option.IsShowLeftText;//显示左边刻度
|
|
1878
1899
|
}if(IFrameSplitOperator.IsBool(option.IsShowRightText)){subFrame.Frame.IsShowYText[1]=option.IsShowRightText;subFrame.Frame.YSplitOperator.IsShowRightText=option.IsShowRightText;//显示右边刻度
|
|
1879
|
-
}};this.AddNewSubFrame=function(option){var
|
|
1900
|
+
}};this.AddNewSubFrame=function(option){var _this12=this;var index=this.Frame.SubFrame.length;var subFrame=this.CreateSubFrameItem(index);var pixelRatio=GetDevicePixelRatio();subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[index]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[index].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this12.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
|
|
1880
1901
|
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();//更新数据偏移
|
|
1881
1902
|
this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
1882
1903
|
this.Draw();return index;};//增加一个指标窗口
|
|
@@ -1901,7 +1922,7 @@ this.DeleteWindowsOverlayIndex=function(windowIndex){if(!IFrameSplitOperator.IsN
|
|
|
1901
1922
|
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)//图形销毁事件
|
|
1902
1923
|
{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)//图形销毁事件
|
|
1903
1924
|
{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=复制 }
|
|
1904
|
-
this.MoveIndex=function(src,dest,option){var
|
|
1925
|
+
this.MoveIndex=function(src,dest,option){var _this13=this;if(!src||!dest||!option)return false;if(!IFrameSplitOperator.IsNumber(src.WindowIndex)||src.WindowIndex<0||src.WindowIndex>=this.Frame.SubFrame.length)return false;if(!IFrameSplitOperator.IsNumber(dest.WindowIndex)||dest.WindowIndex<0||dest.WindowIndex>=this.Frame.SubFrame.length)return false;var find=this.FindScriptIndex(src.IndexID,src.WindowIndex);if(!find)return false;var findItem=null,findOverlayItem=null;if(find.Type==0)findItem=find.Data;else if(find.Type==1)findOverlayItem=find.Data;if(!findOverlayItem&&!findItem)return false;//固定窗口
|
|
1905
1926
|
var fixedWindowCount=0;var isMinuteChart=this.ClassName=="MinuteChartContainer"||this.ClassName=="MinuteChartHScreenContainer"?true:false;if(isMinuteChart)fixedWindowCount=2;//走势图固定2个窗口
|
|
1906
1927
|
if(dest.WindowIndex>=fixedWindowCount&&this.WindowIndex[dest.WindowIndex]==null)//主指标是空的,移动到主指标上
|
|
1907
1928
|
{if(findItem)this.WindowIndex[dest.WindowIndex]=this.CreateMainScript(findItem);else if(findOverlayItem)this.WindowIndex[dest.WindowIndex]=this.CreateMainScript(findOverlayItem.Script);if(option.Operator==0)//移动模式, 删除原来的
|
|
@@ -1909,15 +1930,15 @@ if(dest.WindowIndex>=fixedWindowCount&&this.WindowIndex[dest.WindowIndex]==null)
|
|
|
1909
1930
|
this.UpdataDataoffset();//更新数据偏移
|
|
1910
1931
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
1911
1932
|
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;
|
|
1912
|
-
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
|
|
1933
|
+
frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this13.GetEventCallback(id);};overlayFrame.Frame=frame;var scriptIndex;if(findItem){scriptIndex=this.CreateOverlayScript(findItem);scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:dest.WindowIndex,Frame:overlayFrame};//叠加指标信息
|
|
1913
1934
|
}else if(findOverlayItem){scriptIndex=this.CreateOverlayScript(findOverlayItem.Script);scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:dest.WindowIndex,Frame:overlayFrame};//叠加指标信息
|
|
1914
1935
|
}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)//移动模式, 删除原来的
|
|
1915
1936
|
{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();//更新数据偏移
|
|
1916
1937
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
1917
1938
|
this.Draw();}};//移动指标到新的指标窗口 src={ WindowIndex:指标窗口索引,IndexID:指标ID } , option={ Operator: 0=移动, 1=复制 }
|
|
1918
|
-
this.MoveIndexToNewWindow=function(src,option){var
|
|
1939
|
+
this.MoveIndexToNewWindow=function(src,option){var _this14=this;if(!src||!option)return false;if(!IFrameSplitOperator.IsNumber(src.WindowIndex)||src.WindowIndex<0||src.WindowIndex>=this.Frame.SubFrame.length)return false;var find=this.FindScriptIndex(src.IndexID,src.WindowIndex);if(!find)return false;var findItem=null,findOverlayItem=null;if(find.Type==0)findItem=find.Data;else if(find.Type==1)findOverlayItem=find.Data;if(!findOverlayItem&&!findItem)return false;if(src.WindowIndex==this.Frame.SubFrame.length-1&&this.Frame.SubFrame[src.WindowIndex].OverlayIndex<=0)return false;//指标在最后一个窗口不需要移动
|
|
1919
1940
|
this.RemoveMinSizeWindows();//清空隐藏的指标
|
|
1920
|
-
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
|
|
1941
|
+
var index=this.Frame.SubFrame.length;var subFrame=this.CreateSubFrameItem(index);var pixelRatio=GetDevicePixelRatio();subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[index]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[index].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.SelectedChart=this.SelectedChart;titlePaint.GetEventCallback=function(id){return _this14.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
|
|
1921
1942
|
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)//移动模式, 删除原来的
|
|
1922
1943
|
{if(findOverlayItem)this.DeleteOverlayIndex(findOverlayItem.Identify,src.WindowIndex);else if(findItem)this.DeleteMainIndex(findItem.Guid,src.WindowIndex);}this.UpdataDataoffset();//更新数据偏移
|
|
1923
1944
|
this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
@@ -1940,10 +1961,22 @@ this.GetIndexInfo=function(){var aryIndex=[];for(var i=0,j=0;i<this.WindowIndex.
|
|
|
1940
1961
|
{info.Args=[];for(j=0;j<item.Arguments.length;++j){var argItem=item.Arguments[j];info.Args.push({Name:argItem.Name,Value:argItem.Value});}}aryIndex.push(info);}this.GetOverlayIndexInfo(aryIndex);//叠加指标
|
|
1941
1962
|
return aryIndex;};//叠加指标
|
|
1942
1963
|
this.GetOverlayIndexInfo=function(aryIndex){for(var i=0,j=0,k=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i];if(!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex))continue;for(j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];if(!overlayItem.Script)continue;var indexData=overlayItem.Script;var info={Name:indexData.Name,ID:indexData.ID,WindowIndex:i,IsOverlay:true,Identify:overlayItem.Identify};if(IFrameSplitOperator.IsNonEmptyArray(indexData.Arguments))//参数
|
|
1943
|
-
{info.Args=[];for(k=0;k<indexData.Arguments.length;++k){var argItem=indexData.Arguments[k];info.Args.push({Name:argItem.Name,Value:argItem.Value});}}aryIndex.push(info);}}};
|
|
1964
|
+
{info.Args=[];for(k=0;k<indexData.Arguments.length;++k){var argItem=indexData.Arguments[k];info.Args.push({Name:argItem.Name,Value:argItem.Value});}}aryIndex.push(info);}}};this.PopupMenuByTab=function(menuData,rtTab){if(!this.JSPopMenu)return;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);};this.PopuMenuByRClick=function(menuData,x,y){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);};//点击右键菜单
|
|
1965
|
+
this.OnClickRightMenu=function(data){JSConsole.Chart.Log('[JSChartContainer::OnClickRightMenu] ',data);if(!data||!data.Data)return;var cmdID=data.Data.ID;//命令ID
|
|
1966
|
+
var aryArgs=data.Data.Args;//参数
|
|
1967
|
+
var param=null,srcParam=null;//原始值
|
|
1968
|
+
if(IFrameSplitOperator.IsNonEmptyArray(aryArgs)){srcParam=aryArgs[0];if(IFrameSplitOperator.IsNumber(aryArgs[0]))param=aryArgs[0];}switch(cmdID){case JSCHART_MENU_ID.CMD_CHANGE_PERIOD_ID:if(this.ChangePeriod&¶m!=null)this.ChangePeriod(param);break;case JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID:if(this.ChangeIndexWindowCount&¶m!=null)this.ChangeIndexWindowCount(param);break;case JSCHART_MENU_ID.CMD_CHANGE_RIGHT_ID:if(this.ChangeRight&¶m!=null)this.ChangeRight(param);break;case JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID:if(this.ChangeIndex&¶m!=null&&aryArgs[1])this.ChangeIndex(param,aryArgs[1]);break;case JSCHART_MENU_ID.CMD_CHANGE_COLOR_INDEX_ID:case JSCHART_MENU_ID.CMD_CHANGE_TRADE_INDEX_ID:if(this.ChangeInstructionIndex&&aryArgs[0])this.ChangeInstructionIndex(aryArgs[0]);break;case JSCHART_MENU_ID.CMD_DELETE_COLOR_INDEX_ID://删除五彩K线指标
|
|
1969
|
+
case JSCHART_MENU_ID.CMD_DELETE_TRADE_INDEX_ID://删除专家系统(交易指标)
|
|
1970
|
+
if(this.CancelInstructionIndex)this.CancelInstructionIndex();break;case JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID://切换K线类型
|
|
1971
|
+
if(this.ChangeKLineDrawType&¶m!=null)this.ChangeKLineDrawType(param,aryArgs[1],aryArgs[2]);break;case JSCHART_MENU_ID.CMD_CHANGE_PRICE_GAP_ID://缺口提示
|
|
1972
|
+
if(this.ChangePriceGap&&IFrameSplitOperator.IsBool(aryArgs[0])){if(aryArgs[0]==false){this.ChangePriceGap({Enable:aryArgs[0]});}else{if(IFrameSplitOperator.IsNumber(aryArgs[1]))this.ChangePriceGap({Enable:aryArgs[0],Count:aryArgs[1]});}}break;case JSCHART_MENU_ID.CMD_OVERLAY_SYMBOL_ID:if(aryArgs[1]===true){if(this.OverlaySymbol&&aryArgs[0])this.OverlaySymbol(aryArgs[0]);}else if(aryArgs[1]===false){if(this.DeleteOverlaySymbol&&aryArgs[0])this.DeleteOverlaySymbol(aryArgs[0]);}break;case JSCHART_MENU_ID.CMD_DELETE_ALL_OVERLAY_SYMBOL_ID:if(this.ClearOverlaySymbol)this.ClearOverlaySymbol();break;case JSCHART_MENU_ID.CMD_CHANGE_COORDINATETYPE_ID:if(this.ChangeCoordinateType&&aryArgs[0])this.ChangeCoordinateType(aryArgs[0]);break;case JSCHART_MENU_ID.CMD_CHANGE_KLINE_INFO_ID:if(aryArgs[0]&&IFrameSplitOperator.IsBool(aryArgs[1])){if(aryArgs[1]==true&&this.AddKLineInfo)this.AddKLineInfo(aryArgs[0],true);else if(aryArgs[1]==false&&this.DeleteKLineInfo)this.DeleteKLineInfo(aryArgs[0]);}break;case JSCHART_MENU_ID.CMD_DELETE_ALL_KLINE_INFO_ID:if(this.ClearKLineInfo)this.ClearKLineInfo();break;case JSCHART_MENU_ID.CMD_CHANGE_DRAG_MODE_ID:if(param!=null)this.DragMode=param;break;case JSCHART_MENU_ID.CMD_CHANGE_BG_SPLIT_ID:if(IFrameSplitOperator.IsBool(srcParam)){if(srcParam){this.CreateExtendChart("SessionBreaksPaint",{});this.Draw();}else{var finder=this.GetExtendChartByClassName("SessionBreaksPaint");if(finder){this.DeleteExtendChartByID(finder.Chart.ID);this.Draw();}}}break;case JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID:var option={Name:'画图工具',Top:this.Frame.ChartBorder.Top};var extendChart=this.CreateExtendChart(option.Name,option);//创建扩展图形
|
|
1973
|
+
this.SetSizeChange(true);this.Draw();break;case JSCHART_MENU_ID.CMD_HIDE_DRAWTOOL_ID:var drawTools=this.GetExtendChartByClassName('DrawToolsButton');if(drawTools){var toolsWidth=drawTools.Chart.Width;var toolsIndex=parseInt(drawTools.Index);for(var i=toolsIndex+1;i<this.ExtendChartPaint.length;++i)//在画图工具后面创建的需要减去工具的宽度
|
|
1974
|
+
{var item=this.ExtendChartPaint[i];if(item.ClassName=='StockChip'){item.Left-=toolsWidth;}}this.DeleteExtendChart(drawTools);this.Frame.ChartBorder.Right-=toolsWidth;this.SetSizeChange(true);this.Draw();}break;case JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID:var option={Name:'筹码分布',ShowType:1,Width:230};var extendChart=this.CreateExtendChart(option.Name,option);//创建扩展图形
|
|
1975
|
+
this.SetSizeChange(true);this.Draw();break;case JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:var StockChip=chart.GetExtendChartByClassName('StockChip');if(StockChip){var chipWidth=StockChip.Chart.Width;var chipIndex=parseInt(StockChip.Index);for(var i=chipIndex+1;i<this.ExtendChartPaint.length;++i)//在筹码后面创建的需要筹码的宽度
|
|
1976
|
+
{var item=this.ExtendChartPaint[i];if(item.ClassName=='DrawToolsButton'){item.Left-=chipWidth;}}this.DeleteExtendChart(StockChip);this.Frame.ChartBorder.Right-=chipWidth;this.SetSizeChange(true);this.Draw();}break;case JSCHART_MENU_ID.CMD_ENABLE_SELECT_RECT_ID:if(IFrameSplitOperator.IsBool(srcParam))this.EnableSelectRect=srcParam;break;case JSCHART_MENU_ID.CMD_CHANGE_DAY_COUNT_ID:if(this.ChangeDayCount&¶m!=null)this.ChangeDayCount(param);break;}};}function GetDevicePixelRatio(){if(typeof window=='undefined')return 1;return window.devicePixelRatio||1;}function GetFontHeight(context,font,word){if(!context)return null;if(font)context.font=font;var text='擎';if(IFrameSplitOperator.IsString(word))text=word;var fontInfo=context.measureText(text);var textHeight=fontInfo.fontBoundingBoxAscent+fontInfo.fontBoundingBoxDescent;if(!IFrameSplitOperator.IsNumber(textHeight))textHeight=fontInfo.width+2*GetDevicePixelRatio();return textHeight;}function IsPhoneWeb(){var userAgentInfo=navigator.userAgent;var Agents=new Array("Android","iPhone","SymbianOS","Windows Phone","iPad","iPod");for(var v=0;v<Agents.length;v++){if(userAgentInfo.indexOf(Agents[v])>0)return true;}return false;}function OnKeyDown(e)//键盘事件
|
|
1944
1977
|
{if(this.JSChartContainer&&this.JSChartContainer.OnKeyDown)this.JSChartContainer.OnKeyDown(e);}function OnWheel(e)//上下滚动事件
|
|
1945
1978
|
{if(this.JSChartContainer&&this.JSChartContainer.OnWheel)this.JSChartContainer.OnWheel(e);}function ToFixed(number,precision){var b=1;if(isNaN(number))return number;if(number<0)b=-1;var multiplier=Math.pow(10,precision);var value=Math.round(Math.abs(number)*multiplier)/multiplier*b;if(/^(\d+(?:\.\d+)?)(e)([\-]?\d+)$/.test(value))var s=value.toFixed2(precision);else var s=value.toString();var rs=s.indexOf('.');if(rs<0&&precision>0){rs=s.length;s+='.';}while(s.length<=rs+precision){s+='0';}return s;}Number.prototype.toFixed2=Number.prototype.toFixed;//备份下老的
|
|
1946
|
-
Number.prototype.toFixed=function(precision){return ToFixed(this,precision);};function Guid(){function S4(){return((1+Math.random())*0x10000|0).toString(16).substring(1);}return"guid"+(S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());}function GetScrollPosition(){var scrollPos={};var scrollTop=0;var scrollLeft=0;if(document.documentElement&&document.documentElement.scrollTop){scrollTop=document.documentElement.scrollTop;scrollLeft=document.documentElement.scrollLeft;}else if(document.body){scrollTop=document.body.scrollTop;scrollLeft=document.body.scrollLeft;}scrollPos.Top=scrollTop;scrollPos.Left=scrollLeft;return scrollPos;}//修正线段有毛刺
|
|
1979
|
+
Number.prototype.toFixed=function(precision){return ToFixed(this,precision);};function Guid(){function S4(){return((1+Math.random())*0x10000|0).toString(16).substring(1);}return"guid"+(S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());}function GetScrollPosition(){var scrollPos={};var scrollTop=0;var scrollLeft=0;if(document.documentElement&&(document.documentElement.scrollTop||document.documentElement.scrollLeft)){scrollTop=document.documentElement.scrollTop;scrollLeft=document.documentElement.scrollLeft;}else if(document.body){scrollTop=document.body.scrollTop;scrollLeft=document.body.scrollLeft;}scrollPos.Top=scrollTop;scrollPos.Left=scrollLeft;return scrollPos;}//修正线段有毛刺
|
|
1947
1980
|
function ToFixedPoint(value){return parseInt(value)+0.5;}//修正粗线段毛刺
|
|
1948
1981
|
function ToFixedPoint2(width,value){var fixValue=width%2===0?Math.floor(value):Math.floor(value)+0.5;//毛边修正
|
|
1949
1982
|
return fixValue;}function ToFixedRect(value){// With a bitwise or.
|
|
@@ -4668,7 +4701,7 @@ this.newMethod();delete this.newMethod;this.ClassName='DrawToolsButton';this.HQC
|
|
|
4668
4701
|
this.Color="#696969";//input type="color"不支持rgb的颜色格式
|
|
4669
4702
|
//this.Left=5;
|
|
4670
4703
|
this.Top=5*GetDevicePixelRatio();this.Width=45*GetDevicePixelRatio();//宽度
|
|
4671
|
-
this.SetOption=function(option){var pixelRatio=GetDevicePixelRatio();if(!option)return;if(option.Width>10)this.Width=option.Width*pixelRatio;};this.Clear=function(){if(this.ToolsDiv)this.ChartBorder.UIElement.parentNode.removeChild(this.ToolsDiv);};this.Draw=function(){var
|
|
4704
|
+
this.SetOption=function(option){var pixelRatio=GetDevicePixelRatio();if(!option)return;if(option.Width>10)this.Width=option.Width*pixelRatio;};this.Clear=function(){if(this.ToolsDiv)this.ChartBorder.UIElement.parentNode.removeChild(this.ToolsDiv);};this.Draw=function(){var _this15=this;if(this.SizeChange==false)return;//工具列表
|
|
4672
4705
|
var TOOL_LIST=[[{HTML:{Title:'线段',IClass:'iconfont icon-draw_line',ID:'icon-segment'},Name:'线段'},{HTML:{Title:'尺子',IClass:'iconfont icon-ruler',ID:'icon_ruler'},Name:'尺子'},{HTML:{Title:'射线',IClass:'iconfont icon-draw_rays',ID:'icon-beam'},Name:'射线'},{HTML:{Title:'标价线',IClass:'iconfont icon-price_line',ID:'icon-price-line'},Name:'标价线'},{HTML:{Title:'垂直线',IClass:'iconfont icon-vertical_line',ID:'icon-vertical-line'},Name:'垂直线'},{HTML:{Title:'箭头',IClass:'iconfont icon-draw_rays',ID:'icon-beam2'},Name:'箭头'},{HTML:{Title:'趋势线',IClass:'iconfont icon-draw_trendline',ID:'icon-trendline'},Name:'趋势线'},{HTML:{Title:'水平线',IClass:'iconfont icon-draw_hline',ID:'icon-hline'},Name:'水平线'},{HTML:{Title:'水平线段',IClass:'iconfont icon-draw_hlinesegment',ID:'icon-hlineseg'},Name:'水平线段'},{HTML:{Title:'平行射线',IClass:'iconfont icon-draw_p_rays_lines',ID:'icon-rayslineseg'},Name:'平行射线'},{HTML:{Title:'平行线',IClass:'iconfont icon-draw_parallel_lines',ID:'icon-parallellines'},Name:'平行线'},{HTML:{Title:'平行通道',IClass:'iconfont icon-draw_parallelchannel',ID:'icon-parallelchannel'},Name:'平行通道'},{HTML:{Title:'价格通道线',IClass:'iconfont icon-draw_pricechannel',ID:'icon-pricechannel'},Name:'价格通道线'},{HTML:{Title:'M头W底',IClass:'iconfont icon-draw_wavemw',ID:'icon-wavemw'},Name:'M头W底'},{HTML:{Title:'头肩型',IClass:'iconfont icon-draw_head_shoulders_bt',ID:'icon-Head-Shoulders'},Name:'头肩型'},{HTML:{Title:'波浪尺',IClass:'iconfont icon-waveruler',ID:'icon-wave-ruler'},Name:'波浪尺'},{HTML:{Title:'AB波浪尺',IClass:'iconfont icon-waveruler',ID:'icon-wave-ruler2'},Name:'AB波浪尺'},{HTML:{Title:'箱型线',IClass:'iconfont icon-draw_box',ID:'icon-drawbox'},Name:'箱型线'},{HTML:{Title:'涂鸦线段',IClass:'iconfont icon-draw_line',ID:'icon-segment2'},Name:'涂鸦线段'}],[{HTML:{Title:'圆弧',IClass:'iconfont icon-draw_arc',ID:'icon-arc'},Name:'圆弧线'},{HTML:{Title:'矩形',IClass:'iconfont icon-rectangle',ID:'icon-rect'},Name:'矩形'},{HTML:{Title:'平行四边形',IClass:'iconfont icon-draw_quadrangle',ID:'icon-quad'},Name:'平行四边形'},{HTML:{Title:'三角形',IClass:'iconfont icon-draw_triangle',ID:'icon-triangle'},Name:'三角形'},{HTML:{Title:'圆',IClass:'iconfont icon-draw_circle',ID:'icon-circle'},Name:'圆'},{HTML:{Title:'对称角度',IClass:'iconfont icon-draw_symangle',ID:'icon-symangle'},Name:'对称角度'}],[{HTML:{Title:'文本',IClass:'iconfont icon-draw_text',ID:'icon-text'},Name:'文本'},{HTML:{Title:'向上箭头',IClass:'iconfont icon-arrow_up',ID:'icon-arrowup'},Name:'icon-arrow_up'},{HTML:{Title:'向下箭头',IClass:'iconfont icon-arrow_down',ID:'icon-arrowdown'},Name:'icon-arrow_down'},{HTML:{Title:'向左箭头',IClass:'iconfont icon-arrow_left',ID:'icon-arrowleft'},Name:'icon-arrow_left'},{HTML:{Title:'向右箭头',IClass:'iconfont icon-arrow_right',ID:'icon-arrowright'},Name:'icon-arrow_right'}],[{HTML:{Title:'江恩角度线',IClass:'iconfont icon-draw_gannfan',ID:'icon-gannfan'},Name:'江恩角度线'},{HTML:{Title:'斐波那契周期线',IClass:'iconfont icon-draw_fibonacci',ID:'icon-fibonacci'},Name:'斐波那契周期线'},{HTML:{Title:'阻速线',IClass:'iconfont icon-draw_resline',ID:'icon-resline'},Name:'阻速线'},{HTML:{Title:'黄金分割',IClass:'iconfont icon-draw_goldensection',ID:'icon-goldensection'},Name:'黄金分割'},{HTML:{Title:'百分比线',IClass:'iconfont icon-draw_percentage',ID:'icon-percentage'},Name:'百分比线'},{HTML:{Title:'波段线',IClass:'iconfont icon-draw_waveband',ID:'icon-waveband'},Name:'波段线'},{HTML:{Title:'线形回归线',IClass:'iconfont icon-linear_3',ID:'icon-waveband2'},Name:'线形回归线'},{HTML:{Title:'线形回归带',IClass:'iconfont icon-linear_1',ID:'icon-waveband3'},Name:'线形回归带'},{HTML:{Title:'延长线形回归带',IClass:'iconfont icon-linear_2',ID:'icon-waveband5'},Name:'延长线形回归带'}],[{HTML:{Title:'全部删除',IClass:'iconfont icon-recycle_bin',ID:'icon-delete'},Name:'全部删除'}]];var hqChart=this.HQChart;if(!this.ToolsDiv){var div=document.createElement("div");div.className='drawtools';div.id=this.ID;var spanList="";//一层菜单
|
|
4673
4706
|
var menuTwoList="";//二层菜单
|
|
4674
4707
|
var menuOne=new Array();TOOL_LIST.forEach(function(item,index){menuOne.push(item[0]);});for(var i=0;i<TOOL_LIST.length;i++){var itemOut=menuOne[i];var itemIn=TOOL_LIST[i];var menuTwoStr="";var contentArrow="";for(var j=0;j<itemIn.length;j++){var currentItem=itemIn[j];var menuTwoName=currentItem.Name;if(menuTwoName.indexOf('up')>-1){menuTwoName="向上箭头";}else if(menuTwoName.indexOf('down')>-1){menuTwoName="向下箭头";}else if(menuTwoName.indexOf('left')>-1){menuTwoName="向左箭头";}else if(menuTwoName.indexOf('right')>-1){menuTwoName="向右箭头";}menuTwoStr+='<p class="menuTwoItem '+currentItem.HTML.ID+'">'+menuTwoName+'<i class="'+currentItem.HTML.IClass+'" title="'+currentItem.HTML.Title+'"></i></p>';}if(i!==TOOL_LIST.length-1){//不是“全部删除”项
|
|
@@ -4678,7 +4711,7 @@ event.stopPropagation();(0,_jquery2.default)(".drawtools").find(".menuTwo").hide
|
|
|
4678
4711
|
event.stopPropagation();(0,_jquery2.default)(this).siblings('.menuTwo').hide();});if(item.Name=='全部删除'){(0,_jquery2.default)('#'+this.ID+" .first-icon-delete").click(function(){(0,_jquery2.default)(".drawtools").find(".menuTwo").hide();(0,_jquery2.default)(this).siblings().removeClass('active');(0,_jquery2.default)(this).addClass('active');hqChart.ClearChartDrawPicture();(0,_jquery2.default)(".subTolls").css("display","none");});}else{(0,_jquery2.default)('#'+this.ID+" .first-"+menuOne[i].HTML.ID).click(//一层菜单类名是:“first-”+item.HTML.ID
|
|
4679
4712
|
{// DrawName: menuOne[i].Name, //把画法名字传进去
|
|
4680
4713
|
CurrentIndex:i},function(event){(0,_jquery2.default)(".drawtools").find(".menuTwo").hide();(0,_jquery2.default)(this).siblings().removeClass('active');(0,_jquery2.default)(this).addClass('active');hqChart.CreateChartDrawPicture(menuOne[event.data.CurrentIndex].Name);});var _loop=function _loop(){itemTwo=TOOL_LIST[i][j];var classname=itemTwo.HTML.IClass;//闭包问题
|
|
4681
|
-
(0,_jquery2.default)('#'+
|
|
4714
|
+
(0,_jquery2.default)('#'+_this15.ID+' .'+itemTwo.HTML.ID).hover(function(event){event.stopPropagation();(0,_jquery2.default)(this).closest('.icon-image').find(".contentArrow").addClass("trans");});(0,_jquery2.default)('#'+_this15.ID+' .'+itemTwo.HTML.ID).click(//二层菜单
|
|
4682
4715
|
{DrawName:itemTwo.Name,//把画法名字传进去
|
|
4683
4716
|
CurrentIndex:i,CurrentData:itemTwo},function(event){event.stopPropagation();(0,_jquery2.default)(this).closest('.icon-image').find(".contentArrow").hide();(0,_jquery2.default)(this).siblings().removeClass("current");(0,_jquery2.default)(this).addClass("current");(0,_jquery2.default)(this).closest('.icon-image').children('i').eq(0).removeClass().addClass(classname,"active").attr('title',event.data.CurrentData.HTML.Title);menuOne.splice(event.data.CurrentIndex,1,event.data.CurrentData);(0,_jquery2.default)(this).parent().hide();hqChart.CreateChartDrawPicture(event.data.DrawName);});};for(var j in TOOL_LIST[i]){var itemTwo;_loop();}}}}var curID=this.ID;(0,_jquery2.default)(document).click(function(event){if(!(0,_jquery2.default)("#"+curID).is(event.target)&&(0,_jquery2.default)("#"+curID).has(event.target).length===0){(0,_jquery2.default)("#"+curID+" .menuTwo").hide();(0,_jquery2.default)("#"+curID+" .contentArrow").hide();}});var scrollPos=GetScrollPosition();var pixelRatio=GetDevicePixelRatio();// var left=this.ChartBorder.GetChartWidth()-this.Right-this.ToolsWidth;
|
|
4684
4717
|
var left=ToFixedPoint(this.ChartBorder.GetRight()+this.Left);// var top = this.Top+this.ChartBorder.UIElement.getBoundingClientRect().top+scrollPos.Top;
|
|
@@ -4866,9 +4899,11 @@ this.AryRectButton=[];this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
|
|
|
4866
4899
|
this.SelectedID="A1"
|
|
4867
4900
|
*/this.ReloadResource=function(resource){this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;this.BorderColor=g_JSChartResource.FrameButtomToolbar.BorderColor;this.ButtonConfig=CloneData(g_JSChartResource.FrameButtomToolbar.Button);};this.SetOption=function(option){if(option){if(IFrameSplitOperator.IsNumber(option.FrameID))this.FrameID=option.FrameID;if(option.FrameGuid)this.FrameGuid=option.FrameGuid;if(IFrameSplitOperator.IsNonEmptyArray(option.AryButton))this.AryButton=option.AryButton.slice();if(option.SelectedID)this.SelectedID=option.SelectedID;}};//设置当前选中的菜单ID
|
|
4868
4901
|
this.SetSelectedID=function(id){this.SelectedID=id;};this.Draw=function(moveonPoint,mouseStatus){this.AryRectButton=[];var frame=this.GetFrame();if(!frame)return;if(frame.IsHScreen)return;//不支持横屏
|
|
4869
|
-
if(frame.IsMinSize)return;if(frame.ChartBorder.IsShowTitleOnly)return;var border=frame.ChartBorder.GetBorder();var rtBG={Left:border.Left+1,Right:border.Right-1,Top:border.BottomEx+1,Bottom:border.Bottom-1};rtBG.Width=rtBG.Right-rtBG.Left;rtBG.Height=rtBG.Bottom-rtBG.Top;if(rtBG.Height<10)return;if(this.BGColor){this.Canvas.fillStyle=this.BGColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);}var font=this.
|
|
4870
|
-
var bgColor=this.ButtonConfig.BGColor.Default;var titleColor=this.ButtonConfig.TitleColor.Default;if(moveonPoint&&moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom){bgColor=this.ButtonConfig.BGColor.MoveOn;titleColor=this.ButtonConfig.TitleColor.MoveOn;if(mouseStatus)mouseStatus.MouseOnToolbar={Rect:rtButton,Item:item,Frame:frame,Point:{X:moveonPoint.X,Y:moveonPoint.Y},ID:"TitleButton"};}if(this.SelectedID&&this.SelectedID==item.ID){bgColor=this.ButtonConfig.BGColor.Selected;titleColor=this.ButtonConfig.TitleColor.Selected;}if(bgColor){this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(rtButton.Left,rtButton.Top,rtButton.Width,rtButton.Height);}if(this.ButtonConfig.BorderColor){this.Canvas.strokeStyle=this.ButtonConfig.BorderColor;this.Canvas.beginPath();this.Canvas.moveTo(ToFixedPoint(rtButton.Right),rtButton.Top);this.Canvas.lineTo(ToFixedPoint(rtButton.Right),rtButton.Bottom);this.Canvas.stroke();}this.Canvas.fillStyle=titleColor;var xText=rtButton.Left+rtButton.Width/2;//居中
|
|
4871
|
-
var yText=rtButton.Top+this.ButtonConfig.Mergin.Top+(rtButton.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom)/2;this.Canvas.fillText(item.Title,xText,yText);
|
|
4902
|
+
if(frame.IsMinSize)return;if(frame.ChartBorder.IsShowTitleOnly)return;var border=frame.ChartBorder.GetBorder();var rtBG={Left:border.Left+1,Right:border.Right-1,Top:border.BottomEx+1,Bottom:border.Bottom-1};rtBG.Width=rtBG.Right-rtBG.Left;rtBG.Height=rtBG.Bottom-rtBG.Top;if(rtBG.Height<10)return;if(this.BGColor){this.Canvas.fillStyle=this.BGColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);}var font=this.GetTitleFont(rtBG.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom);var svgFont=this.GetSVGFont(rtBG.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom);this.Canvas.textBaseline='middle';this.Canvas.textAlign='center';this.Canvas.font=font;var xBotton=rtBG.Left;for(var i=0;i<this.AryButton.length;++i){var item=this.AryButton[i];if(!item.Title&&!(item.SVGButton&&item.SVGButton.Symbol))return;var textWidth=0;if(item.Title){textWidth=this.Canvas.measureText(item.Title).width+2;}var svgButtonWidth=0;if(item.SVGButton&&item.SVGButton.Symbol){svgButtonWidth=this.ButtonConfig.SVG.Size;if(textWidth>0)svgButtonWidth+=this.ButtonConfig.SVG.MerginLeft;}var buttonWidth=textWidth+svgButtonWidth+this.ButtonConfig.Mergin.Left+this.ButtonConfig.Mergin.Right;var rtButton={Left:xBotton,Top:rtBG.Top,Bottom:rtBG.Bottom,Height:rtBG.Height,Width:buttonWidth};rtButton.Right=rtButton.Left+rtButton.Width;//鼠标是否在按钮上
|
|
4903
|
+
var bgColor=this.ButtonConfig.BGColor.Default;var titleColor=this.ButtonConfig.TitleColor.Default;if(moveonPoint&&moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom){bgColor=this.ButtonConfig.BGColor.MoveOn;titleColor=this.ButtonConfig.TitleColor.MoveOn;if(mouseStatus)mouseStatus.MouseOnToolbar={Rect:rtButton,Item:item,Frame:frame,Point:{X:moveonPoint.X,Y:moveonPoint.Y},ID:"TitleButton"};}if(this.SelectedID&&this.SelectedID==item.ID){bgColor=this.ButtonConfig.BGColor.Selected;titleColor=this.ButtonConfig.TitleColor.Selected;}if(bgColor){this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(rtButton.Left,rtButton.Top,rtButton.Width,rtButton.Height);}if(this.ButtonConfig.BorderColor){this.Canvas.strokeStyle=this.ButtonConfig.BorderColor;this.Canvas.beginPath();this.Canvas.moveTo(ToFixedPoint(rtButton.Right),rtButton.Top);this.Canvas.lineTo(ToFixedPoint(rtButton.Right),rtButton.Bottom);this.Canvas.stroke();}if(item.Title){this.Canvas.fillStyle=titleColor;var xText=rtButton.Left+(rtButton.Width-svgButtonWidth)/2;//居中
|
|
4904
|
+
var yText=rtButton.Top+this.ButtonConfig.Mergin.Top+(rtButton.Height-this.ButtonConfig.Mergin.Top-this.ButtonConfig.Mergin.Bottom)/2;this.Canvas.fillText(item.Title,xText,yText);}var rtSVG=null;if(item.SVGButton&&item.SVGButton.Symbol){this.Canvas.font=svgFont;this.Canvas.fillStyle=titleColor;var xText=rtButton.Right-this.ButtonConfig.SVG.Size/2-this.ButtonConfig.Mergin.Right;this.Canvas.fillText(item.SVGButton.Symbol,xText,yText);this.Canvas.font=font;rtSVG={Left:rtButton.Right-this.ButtonConfig.Mergin.Right-this.ButtonConfig.SVG.Size,Top:rtButton.Top,Width:this.ButtonConfig.SVG.Size,Height:this.ButtonConfig.SVG.Size};rtSVG.Right=rtSVG.Left+rtSVG.Width;rtSVG.Bottom=rtSVG.Top+rtSVG.Height;}//{ Rect:rtButton, ID:item.ID, Data:item, RectSVG:rtSVG }
|
|
4905
|
+
if(textWidth>0&&svgButtonWidth>0){var rtText={Left:rtButton.Left,Top:rtButton.Top,Bottom:rtButton.Bottom};rtText.Right=rtText.Left+textWidth+this.ButtonConfig.Mergin.Left+this.ButtonConfig.SVG.MerginLeft/2;var cacheItem={Rect:rtText,ID:item.ID,Data:item,RectCell:rtButton,ButtonType:0};this.AryRectButton.push(cacheItem);var rtSVG={Left:rtText.Right,Right:rtButton.Right,Top:rtButton.Top,Bottom:rtButton.Bottom};var cacheItem={Rect:rtSVG,ID:item.ID,Data:item,RectCell:rtButton,ButtonType:1};this.AryRectButton.push(cacheItem);}else{var cacheItem={Rect:rtButton,ID:item.ID,Data:item,RectCell:rtButton};//RectCell 全部的大小
|
|
4906
|
+
if(textWidth>0)cacheItem.ButtonType=0;else if(svgButtonWidth>0)cacheItem.ButtonType=1;this.AryRectButton.push(cacheItem);}xBotton+=buttonWidth+1;}if(this.BorderColor){this.Canvas.strokeStyle=this.BorderColor;this.Canvas.beginPath();this.Canvas.moveTo(border.Left,ToFixedPoint(border.BottomEx));this.Canvas.lineTo(border.Right,ToFixedPoint(border.BottomEx));this.Canvas.stroke();}};this.GetFrame=function(){if(!this.ChartFrame)return null;if(this.FrameID>=0){var subFrame=this.ChartFrame.SubFrame[this.FrameID];if(!subFrame||!subFrame.Frame)return null;return subFrame.Frame;}return null;};this.GetTitleFont=function(height){var config=this.ButtonConfig.Font;var fontSize=height*GetDevicePixelRatio();if(IFrameSplitOperator.IsPlusNumber(config.Size))fontSize=config.Size;var font=fontSize+'px '+config.Family;return font;};this.GetSVGFont=function(height){var config=this.ButtonConfig.SVG;var fontSize=height*GetDevicePixelRatio();if(IFrameSplitOperator.IsPlusNumber(config.Size))fontSize=config.Size;var font=fontSize+'px '+config.Family;return font;};this.PtInButtons=function(x,y){for(var i=0;i<this.AryRectButton.length;++i){var item=this.AryRectButton[i];var rect=item.Rect;if(x>rect.Left&&x<rect.Right&&y>rect.Top&&y<rect.Bottom){var frame=this.GetFrame();var result={ID:item.Data.ID,Rect:rect,FrameID:this.FrameID,Frame:frame,Data:item.Data,ButtonType:item.ButtonType,RectCell:item.RectCell};return result;}}return null;};}//弹幕数据 { X:X偏移, Y:Y偏移, Text:内容, Color:颜色 }
|
|
4872
4907
|
function BarrageList(){this.PlayList=[];//正在播放队列
|
|
4873
4908
|
this.Cache=[];//没有播放的弹幕数据
|
|
4874
4909
|
this.MinLineHeight=40*GetDevicePixelRatio();this.Height;//高度
|
|
@@ -5794,19 +5829,21 @@ this.LimitFrameID;//限制在指定窗口绘图
|
|
|
5794
5829
|
//接口函数
|
|
5795
5830
|
this.SetLastPoint=null;//this.SetLastPoint=function(obj) obj={X:,Y:}
|
|
5796
5831
|
this.Update=null;//更新数据回调
|
|
5797
|
-
this.GetActiveDrawPicture=null;this.GetYCoordinatePoint=null;this.Draw=function(){};this.SetOption=function(option){if(!option)return;if(option.LineColor)this.LineColor=option.LineColor;if(option.LineWidth>0)this.LineWidth=option.LineWidth;if(option.AreaColor)this.AreaColor=option.AreaColor;if(option.PointColor)this.PointColor=option.PointColor;if(option.MoveOnPointColor)this.
|
|
5832
|
+
this.GetActiveDrawPicture=null;this.GetYCoordinatePoint=null;this.Draw=function(){};this.SetOption=function(option){if(!option)return;if(option.LineColor)this.LineColor=option.LineColor;if(option.LineWidth>0)this.LineWidth=option.LineWidth;if(option.AreaColor)this.AreaColor=option.AreaColor;if(option.PointColor)this.PointColor=option.PointColor;if(option.MoveOnPointColor)this.MoveOnPointColor=option.MoveOnPointColor;if(option.PointRadius)this.PointRadius=option.PointRadius;if(IFrameSplitOperator.IsNumber(option.SquareSize))this.SquareSize=option.SquareSize;if(IFrameSplitOperator.IsBool(option.IsShowPoint))this.IsShowPoint=option.IsShowPoint;if(IFrameSplitOperator.IsNumber(option.LimitFrameID))this.LimitFrameID=option.LimitFrameID;if(IFrameSplitOperator.IsBool(option.EnableCtrlMove))this.EnableCtrlMove=option.EnableCtrlMove;if(IFrameSplitOperator.IsBool(option.IsShowYCoordinate))this.IsShowYCoordinate=option.IsShowYCoordinate;};this.ReloadResource=function(resource){if(!resource){this.PointColor=g_JSChartResource.DrawPicture.PointColor[0];this.MoveOnPointColor=g_JSChartResource.DrawPicture.PointColor[1];this.PointBGColor=g_JSChartResource.DrawPicture.PointColor[2];}};this.SetLineWidth=function(){this.BackupLineWidth=null;if(this.LineWidth>0){this.BackupLineWidth=this.Canvas.lineWidth;this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();}};this.GetFontHeight=function(font){return GetFontHeight(this.Canvas,font,"擎");};this.RestoreLineWidth=function(){if(this.BackupLineWidth!=null){this.Canvas.lineWidth=this.BackupLineWidth;}};//磁吸K线
|
|
5798
5833
|
this.PointMagnetKLine=function(){if(!this.IsSupportMagnet)return false;if(!this.Frame)return false;if(this.Frame.ClassName=="MinuteFrame"||this.Frame.Class=="MinuteHScreenFrame")return false;if(this.Frame.Identify!=0)return false;var pointIndex=-1;if(this.Status==2)pointIndex=1;else if(this.Status==1)pointIndex=0;else if(IFrameSplitOperator.IsNumber(this.MovePointIndex))pointIndex=this.MovePointIndex;if(pointIndex<0)return false;if(this.Option&&this.Option.Magnet&&this.Option.Magnet.Enable){var option={IsFixedX:false,Magnet:{Enable:true,PointIndex:pointIndex,Distance:this.Option.Magnet.Distance,Type:this.Option.Magnet.Type}};return this.AdjustPoint(this.Point,option);}return false;};//Point => Value
|
|
5799
|
-
this.PointToValue=function(){if(!this.Frame)return false;if(this.Frame.ClassName=="MinuteFrame"||this.Frame.Class=="MinuteHScreenFrame"){return this.PointToValue_Minute();}else{return this.PointToValue_KLine();}};this.PointToKLine=function(aryPoint){if(!this.Frame)return null;var data=this.Frame.Data;if(!data)return null;var kLine=[];var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i in aryPoint){var item=aryPoint[i];var xValue=parseInt(this.Frame.GetXData(item.Y))+data.DataOffset;var yValue=this.Frame.GetYData(item.X);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;kLine[i]=valueItem;}}else{for(var i in aryPoint){var item=aryPoint[i];var index=parseInt(this.Frame.GetXData(item.X,false));var xValue=index+data.DataOffset;if(xValue<0)xValue=0;else if(xValue>=data.Data.length){xValue=data.Data.length-1;index=xValue-data.DataOffset;}var yValue=this.Frame.GetYData(item.Y,false);var valueItem={XValue:xValue,YValue:yValue,XIndex:index};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;kLine[i]=valueItem;}}return kLine;};this.PointToValue_KLine=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i in this.Point){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.Y,false))+data.DataOffset;var yValue=this.Frame.GetYData(item.X,false);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;this.Value[i]=valueItem;}}else{for(var i in this.Point){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.X,false))+data.DataOffset;if(xValue<0)xValue=0;else if(xValue>=data.Data.length)xValue=data.Data.length-1;var yValue=this.Frame.GetYData(item.Y,false);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;this.Value[i]=valueItem;}}return true;};this.PointToValue_Minute=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i=0;i<this.Point.length;++i){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.Y));var yValue=this.Frame.GetYData(item.X);var valueItem={XValue:xValue,YValue:yValue};var minuteItem=data.Data[xValue];valueItem.DateTime={Date:minuteItem.Date,Time:minuteItem.Time};this.Value[i]=valueItem;}}else{var xDatetime=g_MinuteTimeStringData.GetTimeData(this.Symbol);for(var i=0;i<this.Point.length;++i){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.X));var yValue=this.Frame.GetYData(item.Y);if(xValue>=data.Data.length)//超过当前数据,直接读固定时间
|
|
5834
|
+
this.PointToValue=function(){if(!this.Frame)return false;if(this.Frame.ClassName=="MinuteFrame"||this.Frame.Class=="MinuteHScreenFrame"){return this.PointToValue_Minute();}else{return this.PointToValue_KLine();}};this.PointToKLine=function(aryPoint){if(!this.Frame)return null;var data=this.Frame.Data;if(!data)return null;var kLine=[];var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i in aryPoint){var item=aryPoint[i];var xValue=parseInt(this.Frame.GetXData(item.Y))+data.DataOffset;var yValue=this.Frame.GetYData(item.X);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;kLine[i]=valueItem;}}else{for(var i in aryPoint){var item=aryPoint[i];var index=parseInt(this.Frame.GetXData(item.X,false));var xValue=index+data.DataOffset;if(xValue<0)xValue=0;else if(xValue>=data.Data.length){xValue=data.Data.length-1;index=xValue-data.DataOffset;}var yValue=this.Frame.GetYData(item.Y,false);var valueItem={XValue:xValue,YValue:yValue,XIndex:index};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;kLine[i]=valueItem;}}return kLine;};this.PointToValue_KLine=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i in this.Point){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.Y,false))+data.DataOffset;var yValue=this.Frame.GetYData(item.X,false);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;this.Value[i]=valueItem;}}else{for(var i in this.Point){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.X,false))+data.DataOffset;if(xValue<0)xValue=0;else if(xValue>=data.Data.length)xValue=data.Data.length-1;var yValue=this.Frame.GetYData(item.Y,false);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;this.Value[i]=valueItem;}}return true;};this.PointToValue_Minute=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i=0;i<this.Point.length;++i){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.Y,false));var yValue=this.Frame.GetYData(item.X,false);var valueItem={XValue:xValue,YValue:yValue};var minuteItem=data.Data[xValue];valueItem.DateTime={Date:minuteItem.Date,Time:minuteItem.Time};this.Value[i]=valueItem;}}else{var xDatetime=g_MinuteTimeStringData.GetTimeData(this.Symbol);for(var i=0;i<this.Point.length;++i){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.X,false));var yValue=this.Frame.GetYData(item.Y,false);if(xValue>=data.Data.length)//超过当前数据,直接读固定时间
|
|
5800
5835
|
{var index=xValue%xDatetime.length;var dataIndex=data.Data.length-1;var valueItem={XValue:xValue,YValue:yValue};var minuteItem=data.Data[dataIndex];var timeItem=xDatetime[index];valueItem.DateTime={Date:minuteItem.Date,Time:timeItem};this.Value[i]=valueItem;}else{var valueItem={XValue:xValue,YValue:yValue};var minuteItem=data.Data[xValue];valueItem.DateTime={Date:minuteItem.Date,Time:minuteItem.Time};this.Value[i]=valueItem;}}}return true;};this.IsPointIn=function(x,y,option){return false;};//Value => Point
|
|
5801
5836
|
this.ValueToPoint=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;//this.UpdateXValue();
|
|
5802
5837
|
var isHScreen=this.Frame.IsHScreen;this.Point=[];for(var i=0;i<this.Value.length;++i){var item=this.Value[i];var pt=new Point();if(isHScreen){pt.Y=this.Frame.GetXFromIndex(item.XValue-data.DataOffset,false);pt.X=this.Frame.GetYFromData(item.YValue,false);}else{pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset,false);pt.Y=this.Frame.GetYFromData(item.YValue,false);}this.Point[i]=pt;}};this.UpdateXValue=function()//通过datetime更新x的索引
|
|
5803
|
-
{if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;var aryDateTime=[];for(var i=0;i<this.Value.length;++i){var item=this.Value[i];if(!item.DateTime)break;var dateTime={Date:item.DateTime.Date};if(IFrameSplitOperator.IsNumber(item.DateTime.Time))dateTime.Time=item.DateTime.Time;aryDateTime[i]=dateTime;}data.FindDataIndexByDateTime(aryDateTime);for(var i
|
|
5838
|
+
{if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;var aryDateTime=[];for(var i=0;i<this.Value.length;++i){var item=this.Value[i];if(!item.DateTime)break;var dateTime={Date:item.DateTime.Date};if(IFrameSplitOperator.IsNumber(item.DateTime.Time))dateTime.Time=item.DateTime.Time;aryDateTime[i]=dateTime;}data.FindDataIndexByDateTime(aryDateTime);for(var i=0;i<aryDateTime.length;++i){var findItem=aryDateTime[i];var valueItem=this.Value[i];if(findItem.Index>=0)valueItem.XValue=findItem.Index;}};//重置X索引数据
|
|
5839
|
+
this.ResetXValue=function(){for(var i=0;i<this.Value.length;++i){var item=this.Value[i];item.XValue=null;}return true;};//xStep,yStep 移动的偏移量
|
|
5804
5840
|
this.Move=function(xStep,yStep){if(this.Status!=20)return false;if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;if(this.MovePointIndex==null)return false;var index=parseInt(this.MovePointIndex);if(index===100)//整体移动
|
|
5805
5841
|
{if(this.IsMoveOutOfBounds(this.Point,xStep,yStep))return false;for(var i in this.Point){this.Point[i].X+=xStep;this.Point[i].Y+=yStep;}}else if(index===0||index===1||index===2||index===3||index===4||index===5){if(index<this.Point.length){this.Point[index].X+=xStep;this.Point[index].Y+=yStep;}}else{return false;}};//是否超出边界了
|
|
5806
5842
|
this.IsMoveOutOfBounds=function(aryPoint,xStep,yStep){if(!this.EnableMoveCheck)return false;if(!this.Frame)return false;if(this.Frame.ClassName=="MinuteFrame"||this.Frame.Class=="MinuteHScreenFrame")return false;var data=this.Frame.Data;if(!data)return false;if(!IFrameSplitOperator.IsNonEmptyArray(data.Data))return false;if(!IFrameSplitOperator.IsNonEmptyArray(aryPoint))return false;var isHScreen=this.Frame.IsHScreen;if(isHScreen){//TODO:横屏以后再做
|
|
5807
5843
|
return false;}else{var offset=data.DataOffset;var startIndex=0-offset;var endIndex=data.Data.length-offset;if(xStep>0){var xEnd=this.Frame.GetXFromIndex(endIndex-1,false);for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];if(item.X+xStep>xEnd)return true;}}else if(xStep<0){var xStart=this.Frame.GetXFromIndex(startIndex,false);for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];if(item.X+xStep<xStart)return true;}}return false;}};this.ClipFrame=function(){if(this.Frame.IsHScreen){var left=this.Frame.ChartBorder.GetLeftEx();var top=this.Frame.ChartBorder.GetTop();var width=this.Frame.ChartBorder.GetWidthEx();var height=this.Frame.ChartBorder.GetHeight();}else{var left=this.Frame.ChartBorder.GetLeft();var top=this.Frame.ChartBorder.GetTopEx();var width=this.Frame.ChartBorder.GetWidth();var height=this.Frame.ChartBorder.GetHeightEx();}this.Canvas.save();this.Canvas.beginPath();this.Canvas.rect(left,top,width,height);this.Canvas.clip();};//计算需要画的点的坐标option:{IsCheckX:是否检测X值, IsCheckY:是否检测Y值}
|
|
5808
5844
|
this.CalculateDrawPoint=function(option){if(this.Status<2)return null;if(!this.Point.length||!this.Frame)return null;var drawPoint=[];if(this.Status==10){var data=this.Frame.Data;if(!data)return null;var showCount=this.Frame.XPointCount;var invaildX=0;//超出范围的x点个数
|
|
5809
|
-
var isHScreen=this.Frame.IsHScreen;for(var i=0;i<this.Value.length;++i){var item=this.Value[i];
|
|
5845
|
+
var isHScreen=this.Frame.IsHScreen;for(var i=0;i<this.Value.length;++i){var item=this.Value[i];if(!IFrameSplitOperator.IsNumber(item.XValue))return null;//无效索引 不显示
|
|
5846
|
+
var dataIndex=item.XValue-data.DataOffset;if(dataIndex<0||dataIndex>=showCount)++invaildX;var pt=new Point();if(isHScreen)//横屏X,Y对调
|
|
5810
5847
|
{pt.Y=this.Frame.GetXFromIndex(item.XValue-data.DataOffset,false);pt.X=this.Frame.GetYFromData(item.YValue,false);}else{pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset,false);pt.Y=this.Frame.GetYFromData(item.YValue,false);}drawPoint.push(pt);}if(option&&option.IsCheckX===true){if(invaildX==this.Value.length)return null;}}else//移动中
|
|
5811
5848
|
{for(var i=0;i<this.Point.length;++i){var item=this.Point[i];drawPoint.push({X:item.X,Y:item.Y});}if(this.OnlyMoveXIndex){var option={IsFixedX:this.OnlyMoveXIndex};JSConsole.Chart.Log('[IChartDrawPicture::CalculateDrawPoint] Status='+this.Status+' MovePointIndex='+this.MovePointIndex+' Identify='+this.Frame.Identify);//磁吸功能
|
|
5812
5849
|
if(this.Option&&this.Option.Magnet&&this.Option.Magnet.Enable&&this.IsSupportMagnet&&this.Frame.Identify==0){var pointIndex=-1;if(this.Status==2)pointIndex=1;//创建第2个点
|
|
@@ -5869,7 +5906,7 @@ IChartDrawPicture.RegisterIonFont=function(obj){if(!obj.Name||!obj.Text||!obj.Fa
|
|
|
5869
5906
|
{var item=IChartDrawPicture.GetDrawPictureByClassName(obj.ClassName);if(!item)return null;var chartDraw=item.Create();//TODO:后面都放到每一个SetOptin里面
|
|
5870
5907
|
if(obj.Period>=0)chartDraw.Period=obj.Period;if(obj.Right>=0)chartDraw.Right=obj.Right;if(obj.Guid)chartDraw.Guid=obj.Guid;if(obj.Symbol)chartDraw.Symbol=obj.Symbol;if(obj.Value)chartDraw.Value=obj.Value;if(obj.Text)chartDraw.Text=obj.Text;if(obj.LineColor)chartDraw.LineColor=obj.LineColor;if(obj.AreaColor)chartDraw.AreaColor=obj.AreaColor;if(obj.FontOption)chartDraw.FontOption=obj.FontOption;if(obj.Label)chartDraw.Label=obj.Label;if(obj.LineWidth>0)chartDraw.LineWidth=obj.LineWidth;if(obj.EnableMove===false)chartDraw.EnableMove=obj.EnableMove;if(IFrameSplitOperator.IsBool(obj.EnableSave))chartDraw.EnableSave=obj.EnableSave;if(IFrameSplitOperator.IsNumber(obj.ChannelWidth))chartDraw.ChannelWidth=obj.ChannelWidth;if(IFrameSplitOperator.IsBool(obj.IsShowYCoordinate))chartDraw.IsShowYCoordinate=obj.IsShowYCoordinate;if(chartDraw.SetOption)chartDraw.SetOption(obj);return chartDraw;};//画图工具-线段
|
|
5871
5908
|
function ChartDrawPictureLine(){this.newMethod=IChartDrawPicture;//派生
|
|
5872
|
-
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawPictureLine';this.IsPointIn=this.IsPointIn_XYValue_Line;this.GetXYCoordinate=this.GetXYCoordinate_default;this.IsShowYCoordinate=false;this.CopyData=this.CopyData_default;this.OnlyMoveXIndex=true;this.IsSupportMagnet=true;this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint({IsCheckX:true,IsCheckY:
|
|
5909
|
+
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawPictureLine';this.IsPointIn=this.IsPointIn_XYValue_Line;this.GetXYCoordinate=this.GetXYCoordinate_default;this.IsShowYCoordinate=false;this.CopyData=this.CopyData_default;this.OnlyMoveXIndex=true;this.IsSupportMagnet=true;this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint({IsCheckX:true,IsCheckY:false});if(!drawPoint)return;if(drawPoint.length!=2)return;this.ClipFrame();var ptStart=drawPoint[0];var ptEnd=drawPoint[1];this.SetLineWidth();this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(ptStart.X,ptStart.Y);this.Canvas.lineTo(ptEnd.X,ptEnd.Y);this.Canvas.stroke();this.RestoreLineWidth();/*
|
|
5873
5910
|
if (this.IsSelected)
|
|
5874
5911
|
{
|
|
5875
5912
|
this.Canvas.strokeStyle='rgba(255,0,0,0.5)';
|
|
@@ -6682,8 +6719,8 @@ TextColor:"rgb(0,0,0)",Item:{Mergin:{Top:2,Bottom:0,Left:1,Right:1},//单元格
|
|
|
6682
6719
|
Font:{Size:15,Name:"微软雅黑"},BarMergin:{Top:2,Left:0,Right:0,Bottom:2},//单元格字体
|
|
6683
6720
|
NameFont:{Size:14,Name:"微软雅黑"},SymbolFont:{Size:12,Name:"微软雅黑"}}},//滚动条
|
|
6684
6721
|
this.ScrollBar={BorderColor:'rgb(192,192,192)',XSplitTextFont:12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1',XSplitTextColor:"rgb(0,0,0)",XSplitLineColor:"rgba(0,0,0,0.8)",BGChart:{Color:"rgb(135,206,250)",LineWidth:1,AreaColor:"rgba(135,206,250,0.5)"},Slider:{DateFont:14*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1',DateColor:'rgb(0,0,0)',BarColor:"rgb(207,207,207)",BarAreaColor:"rgba(232,232,232,0.65)",BarWidth:10,BarPadding:15,//上下留白
|
|
6685
|
-
MinCenterWidth:15}},this.FrameButtomToolbar={BGColor:"rgb(235,235,235)",BorderColor:"rgb(204,204,204)",Button:{Font:{Family:"微软雅黑"},TitleColor:{Selected:"rgb(255,255,255)",Default:"rgb(125,125,125)",MoveOn:"rgb(234,85,4)"},BGColor:{Selected:"rgb(234,85,4)",Default:"rgb(235,235,235)",MoveOn:"rgb(242,242,242)"},BorderColor:"rgb(204,204,204)",Mergin:{Left:5*GetDevicePixelRatio(),Right:5*GetDevicePixelRatio(),Top:4*GetDevicePixelRatio(),Bottom:2*GetDevicePixelRatio()}}//自定义风格
|
|
6686
|
-
};this.SetStyle=function(style){var T_SetButtonStyle=function T_SetButtonStyle(item,dest){if(!item)return;if(item.Color)dest.Color=item.Color;if(item.MoveOnColor)dest.MoveOnColor=item.MoveOnColor;if(item.SelectedColor)dest.SelectedColor=item.SelectedColor;if(item.Family)dest.Family=item.Family;if(item.Text)dest.Text=item.Text;if(IFrameSplitOperator.IsNumber(item.Size))dest.Size=item.Size;if(IFrameSplitOperator.IsNumber(item.MerginLeft))dest.MerginLeft=item.MerginLeft;};if(style.TooltipBGColor)this.TooltipBGColor=style.TooltipBGColor;if(style.TooltipAlpha)this.TooltipAlpha=style.TooltipAlpha;if(style.SelectRectBGColor)this.SelectRectBGColor=style.SelectRectBGColor;if(style.UpBarColor)this.UpBarColor=style.UpBarColor;if(style.DownBarColor)this.DownBarColor=style.DownBarColor;if(style.UnchagneBarColor)this.UnchagneBarColor=style.UnchagneBarColor;if(style.EmptyBarBGColor)this.EmptyBarBGColor=style.EmptyBarBGColor;if(style.HighLowBarColor)this.HighLowBarColor=style.HighLowBarColor;if(style.HighLowText){var dest=this.HighLowText;var item=style.HighLowText;if(item.FontName)dest.FontName=item.FontName;if(item.Color)dest.Color=item.Color;if(item.MaxText)dest.MaxText=item.MaxText;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))dest.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))dest.MinSize=item.MinSize;}if(style.SplashScreen){var item=style.SplashScreen;if(item.BGColor)this.SplashScreen.BGColor=item.BGColor;if(item.Title)this.SplashScreen.Title=item.Title;if(item.TextColor)this.SplashScreen.TextColor=item.TextColor;if(item.Font)this.SplashScreen.Font=item.Font;}if(style.HLCArea){var item=style.HLCArea;if(item.HighLineColor)this.HLCArea.HighLineColor=item.HighLineColor;if(item.LowLineColor)this.HLCArea.LowLineColor=item.LowLineColor;if(item.CloseLineColor)this.HLCArea.CloseLineColor=item.CloseLineColor;if(item.UpAreaColor)this.HLCArea.UpAreaColor=item.UpAreaColor;if(item.DownAreaColor)this.HLCArea.DownAreaColor=item.DownAreaColor;if(IFrameSplitOperator.IsNumber(item.LineWidth))this.HLCArea.LineWidth=item.LineWidth;}if(style.Minute){if(style.Minute.VolBarColor)this.Minute.VolBarColor=style.Minute.VolBarColor;if(style.Minute.VolTitleColor)this.Minute.VolTitleColor=style.Minute.VolTitleColor;if(style.Minute.PriceColor)this.Minute.PriceColor=style.Minute.PriceColor;if(IFrameSplitOperator.IsNumber(style.Minute.PriceLineWidth))this.Minute.PriceLineWidth=style.Minute.PriceLineWidth;if(style.Minute.AvPriceColor)this.Minute.AvPriceColor=style.Minute.AvPriceColor;if(style.Minute.AreaPriceColor)this.Minute.AreaPriceColor=style.Minute.AreaPriceColor;if(style.Minute.PositionColor)this.Minute.PositionColor=style.Minute.PositionColor;if(style.Minute.FrameSplitTextColor)this.Minute.FrameSplitTextColor=style.Minute.FrameSplitTextColor;if(style.Minute.Before){var item=style.Minute.Before;if(item.BGColor)this.Minute.Before.BGColor=item.BGColor;if(item.LineColor)this.Minute.Before.LineColor=item.LineColor;if(item.VolColor)this.Minute.Before.VolColor=item.VolColor;if(item.AvPriceColor)this.Minute.Before.AvPriceColor=item.AvPriceColor;if(item.CloseIcon)T_SetButtonStyle(item.CloseIcon,this.Minute.Before.CloseIcon);if(item.Point){if(item.Point.Color)this.Minute.Before.Point.Color=item.Point.Color;if(item.Point.Radius)this.Minute.Before.Point.Radius=item.Point.Radius;}}if(style.Minute.After){var item=style.Minute.After;if(item.BGColor)this.Minute.After.BGColor=item.BGColor;if(item.LineColor)this.Minute.After.LineColor=item.LineColor;if(item.VolColor)this.Minute.After.VolColor=item.VolColor;if(item.AvPriceColor)this.Minute.After.AvPriceColor=item.AvPriceColor;if(item.Point){if(item.Point.Color)this.Minute.After.Point.Color=item.Point.Color;if(item.Point.Radius)this.Minute.After.Point.Radius=item.Point.Radius;}}}if(style.DefaultTextColor)this.DefaultTextColor=style.DefaultTextColor;if(style.DefaultTextFont)this.DefaultTextFont=style.DefaultTextFont;if(style.TitleFont)this.TitleFont=style.TitleFont;if(style.IndexTitleBGColor)this.IndexTitleBGColor=style.IndexTitleBGColor;if(style.IndexTitleBorderColor)this.IndexTitleBorderColor=style.IndexTitleBorderColor;if(style.IndexTitleBorderMoveOnColor)this.IndexTitleBorderMoveOnColor=style.IndexTitleBorderMoveOnColor;if(IFrameSplitOperator.IsNumber(style.IndexTitleBorderStyle))this.IndexTitleBorderStyle=style.IndexTitleBorderStyle;if(style.IndexTitleColor)this.IndexTitleColor=style.IndexTitleColor;if(style.IndexTitleSelectedColor)this.IndexTitleSelectedColor=style.IndexTitleSelectedColor;if(style.OverlayIndexTitleBGColor)this.OverlayIndexTitleBGColor=style.OverlayIndexTitleBGColor;if(style.UpTextColor)this.UpTextColor=style.UpTextColor;if(style.DownTextColor)this.DownTextColor=style.DownTextColor;if(style.UnchagneTextColor)this.UnchagneTextColor=style.UnchagneTextColor;if(style.CloseLineColor)this.CloseLineColor=style.CloseLineColor;if(style.CloseLineAreaColor)this.CloseLineAreaColor=style.CloseLineAreaColor;if(style.CloseLineWidth)this.CloseLineWidth=style.CloseLineWidth;if(style.FrameBorderPen)this.FrameBorderPen=style.FrameBorderPen;if(style.MultiDayBorderPen)this.MultiDayBorderPen=style.MultiDayBorderPen;if(style.FrameSplitPen)this.FrameSplitPen=style.FrameSplitPen;if(style.FrameDotSplitPen)this.FrameDotSplitPen=style.FrameDotSplitPen;if(style.FrameSplitTextColor)this.FrameSplitTextColor=style.FrameSplitTextColor;if(style.FrameSplitTextFont)this.FrameSplitTextFont=style.FrameSplitTextFont;if(style.FrameTitleBGColor)this.FrameTitleBGColor=style.FrameTitleBGColor;if(style.SelFrameBorderColor)this.SelFrameBorderColor=style.SelFrameBorderColor;if(IFrameSplitOperator.IsNumber(style.IndexTitleMerginLeft))this.IndexTitleMerginLeft=style.IndexTitleMerginLeft;if(style.IndexTitle){var item=style.IndexTitle;if(item.UpDownArrow){var subItem=item.UpDownArrow;if(subItem.UpColor)this.IndexTitle.UpDownArrow.UpColor=subItem.UpColor;if(subItem.DownColor)this.IndexTitle.UpDownArrow.DownColor=subItem.DownColor;if(subItem.UnchangeColor)this.IndexTitle.UpDownArrow.UnchangeColor=subItem.UnchangeColor;}}if(style.Frame){if(style.Frame.XBottomOffset)this.Frame.XBottomOffset=style.Frame.XBottomOffset;if(style.Frame.YTopOffset)this.Frame.YTopOffset=style.Frame.YTopOffset;if(style.Frame.PercentageText){var item=style.Frame.PercentageText;if(item.PriceColor)this.Frame.PercentageText.PriceColor=item.PriceColor;if(item.PercentageColor)this.Frame.PercentageText.PercentageColor=item.PercentageColor;if(item.SplitColor)this.Frame.PercentageText.SplitColor=item.SplitColor;if(item.Font)this.Frame.PercentageText.Font=item.Font;}}if(IFrameSplitOperator.IsNumber(style.ToolbarButtonStyle))this.ToolbarButtonStyle=style.ToolbarButtonStyle;if(IFrameSplitOperator.IsBool(style.IsDOMFrameTitle))this.IsDOMFrameTitle=style.IsDOMFrameTitle;if(style.FrameLatestPrice){var item=style.FrameLatestPrice;if(style.FrameLatestPrice.TextColor)this.FrameLatestPrice.TextColor=style.FrameLatestPrice.TextColor;if(style.FrameLatestPrice.UpBarColor)this.FrameLatestPrice.UpBarColor=style.FrameLatestPrice.UpBarColor;if(style.FrameLatestPrice.DownBarColor)this.FrameLatestPrice.DownBarColor=style.FrameLatestPrice.DownBarColor;if(style.FrameLatestPrice.UnchagneBarColor)this.FrameLatestPrice.UnchagneBarColor=style.FrameLatestPrice.UnchagneBarColor;if(style.FrameLatestPrice.BGAlpha)this.FrameLatestPrice.BGAlpha=style.FrameLatestPrice.BGAlpha;if(style.FrameLatestPrice.OverlayTextColor)this.FrameLatestPrice.OverlayTextColor=style.FrameLatestPrice.OverlayTextColor;if(item.EmptyBGColor)this.FrameLatestPrice.EmptyBGColor=item.EmptyBGColor;}if(style.OverlayFrame){var item=style.OverlayFrame;if(style.OverlayFrame.BolderPen)this.OverlayFrame.BolderPen=style.OverlayFrame.BolderPen;if(style.OverlayFrame.TitleColor)this.OverlayFrame.TitleColor=style.OverlayFrame.TitleColor;if(style.OverlayFrame.TitleFont)this.OverlayFrame.TitleFont=style.OverlayFrame.TitleFont;}if(style.CorssCursorBGColor)this.CorssCursorBGColor=style.CorssCursorBGColor;if(style.CorssCursorTextColor)this.CorssCursorTextColor=style.CorssCursorTextColor;if(style.CorssCursorTextFont)this.CorssCursorTextFont=style.CorssCursorTextFont;if(style.CorssCursorVPenColor)this.CorssCursorVPenColor=style.CorssCursorVPenColor;if(style.CorssCursorHPenColor)this.CorssCursorHPenColor=style.CorssCursorHPenColor;if(style.CorssCursorBorderColor)this.CorssCursorBorderColor=style.CorssCursorBorderColor;if(style.CorssCursorXRangeBGColor)this.CorssCursorXRangeBGColor=style.CorssCursorXRangeBGColor;if(style.CorssCursor&&style.CorssCursor.RightButton){var item=style.CorssCursor.RightButton;if(item.BGColor)this.CorssCursor.RightButton.BGColor=item.BGColor;if(item.PenColor)this.CorssCursor.RightButton.PenColor=item.PenColor;if(item.Icon)this.CorssCursor.RightButton.Icon=item.Icon;}if(style.KLine)this.KLine=style.KLine;if(style.VirtualKLine){var item=style.VirtualKLine;if(item.Color)this.VirtualKLine.Color=item.Color;if(item.LineDash)this.VirtualKLine.LineDash=item.LineDash;}if(style.PriceGapStyple){var item=style.PriceGapStyple;if(item.Line&&item.Line.Color)this.PriceGapStyple.Line.Color=item.Line.Color;if(item.Text){if(item.Text.Color)this.PriceGapStyple.Text.Color=item.Text.Color;if(item.Text.Font)this.PriceGapStyple.Text.Font=item.Text.Font;}}if(style.Index){if(style.Index.LineColor)this.Index.LineColor=style.Index.LineColor;if(style.Index.NotSupport)this.Index.NotSupport=style.Index.NotSupport;}if(style.ColorArray)this.ColorArray=style.ColorArray;if(style.DrawPicture){var item=style.DrawPicture;if(item.LineColor)this.DrawPicture.LineColor=item.LineColor;if(item.PointColor)this.DrawPicture.PointColor=item.PointColor;if(item.XYCoordinate)this.DrawPicture.XYCoordinate=item.XYCoordinate;if(IFrameSplitOperator.IsNumber(item.PointType))this.DrawPicture.PointType=item.PointType;if(IFrameSplitOperator.IsBool(item.IsShowPoint))this.DrawPicture.IsShowPoint=item.IsShowPoint;}if(style.TooltipPaint){if(style.TooltipPaint.BGColor)this.TooltipPaint.BGColor=style.TooltipPaint.BGColor;if(style.TooltipPaint.BorderColor)this.TooltipPaint.BorderColor=style.TooltipPaint.BorderColor;if(style.TooltipPaint.TitleColor)this.TooltipPaint.TitleColor=style.TooltipPaint.TitleColor;if(style.TooltipPaint.TitleFont)this.TooltipPaint.TitleFont=style.TooltipPaint.TitleFont;if(style.TooltipPaint.DateTimeColor)this.TooltipPaint.DateTimeColor=style.TooltipPaint.DateTimeColor;if(style.TooltipPaint.VolColor)this.TooltipPaint.VolColor=style.TooltipPaint.VolColor;if(style.TooltipPaint.AmountColor)this.TooltipPaint.AmountColor=style.TooltipPaint.AmountColor;}if(style.PCTooltipPaint){var item=style.PCTooltipPaint;if(item.BGColor)this.PCTooltipPaint.BGColor=item.BGColor;if(item.BorderColor)this.PCTooltipPaint.BorderColor=item.BorderColor;if(item.TitleColor)this.PCTooltipPaint.TitleColor=item.TitleColor;if(item.TitleFont)this.PCTooltipPaint.TitleFont=item.TitleFont;if(item.DateTimeColor)this.PCTooltipPaint.DateTimeColor=item.DateTimeColor;if(item.VolColor)this.PCTooltipPaint.VolColor=item.VolColor;if(item.AmountColor)this.PCTooltipPaint.AmountColor=item.AmountColor;}if(style.MinuteInfo){var item=style.MinuteInfo;if(style.MinuteInfo.TextColor)this.MinuteInfo.TextColor=style.MinuteInfo.TextColor;if(style.MinuteInfo.Font)this.MinuteInfo.Font=style.MinuteInfo.Font;if(style.MinuteInfo.PointColor)this.MinuteInfo.PointColor=style.MinuteInfo.PointColor;if(style.MinuteInfo.LineColor)this.MinuteInfo.LineColor=style.MinuteInfo.LineColor;if(style.MinuteInfo.TextBGColor)this.MinuteInfo.TextBGColor=style.MinuteInfo.TextBGColor;if(IFrameSplitOperator.IsNumber(item.PointRadius))this.MinuteInfo.PointRadius=item.PointRadius;}if(style.Title){if(style.Title.TradeIndexColor)this.Title.TradeIndexColor=style.Title.TradeIndexColor;if(style.Title.ColorIndexColor)this.Title.ColorIndexColor=style.Title.ColorIndexColor;if(style.Title.VolColor)this.Title.VolColor=style.Title.VolColor;if(style.Title.AmountColor)this.Title.AmountColor=style.Title.AmountColor;if(style.Title.DateTimeColor)this.Title.DateTimeColor=style.Title.DateTimeColor;if(style.Title.NameColor)this.Title.NameColor=style.Title.NameColor;if(style.Title.SettingColor)this.Title.SettingColor=style.Title.SettingColor;if(style.Title.TurnoverRateColor)this.Title.TurnoverRateColor=style.Title.TurnoverRateColor;if(style.Title.PositionColor)this.Title.PositionColor=style.Title.PositionColor;}if(style.DRAWICON){if(style.DRAWICON.Icon){var item=style.DRAWICON.Icon;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))this.DRAWICON.Icon.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))this.DRAWICON.Icon.MinSize=item.MinSize;if(item.Zoom)this.DRAWICON.Icon.Zoom=item.Zoom;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWICON.Icon.YOffset=item.YOffset;}if(style.DRAWICON.Text){var item=style.DRAWICON.Text;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))this.DRAWICON.Text.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))this.DRAWICON.Text.MinSize=item.MinSize;if(item.Zoom)this.DRAWICON.Text.Zoom=item.Zoom;if(item.FontName)this.DRAWICON.Text.FontName=item.FontName;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWICON.Text.YOffset=item.YOffset;}}if(style.DRAWTEXT){var item=style.DRAWTEXT;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))this.DRAWICON.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))this.DRAWICON.MinSize=item.MinSize;if(item.Zoom)this.DRAWTEXT.Zoom=item.Zoom;if(item.FontName)this.DRAWTEXT.FontName=item.FontName;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWTEXT.YOffset=item.YOffset;}if(style.DRAWTEXT_FIX){var item=style.DRAWTEXT_FIX;if(item.Font)this.DRAWTEXT_FIX.Font=item.Font;}if(style.DRAWNUMBER_FIX){var item=style.DRAWNUMBER_FIX;if(item.Font)this.DRAWNUMBER_FIX.Font=item.Font;}if(style.DRAWNUMBER){var item=style.DRAWNUMBER;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))this.DRAWNUMBER.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))this.DRAWNUMBER.MinSize=item.MinSize;if(item.Zoom)this.DRAWNUMBER.Zoom=item.Zoom;if(item.FontName)this.DRAWNUMBER.FontName=item.FontName;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWNUMBER.YOffset=item.YOffset;}if(style.DRAWABOVE){var item=style.DRAWABOVE;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWABOVE.YOffset=item.YOffset;}if(style.DOTLINE)this.DOTLINE=style.DOTLINE;if(style.DRAWSL)this.DOTLINE=style.DRAWSL;if(style.DragSubFrameBorder)this.DragSubFrameBorder=style.DragSubFrameBorder;if(style.DepthMapPaint){var item=style.DepthMapPaint;if(item.LineColor)this.DepthMapPaint.LineColor=item.LineColor;if(item.AreaColor)this.DepthMapPaint.AreaColor=item.AreaColor;if(item.TextColor)this.DepthMapPaint.TextColor=item.TextColor;if(item.TextBGColor)this.DepthMapPaint.TextBGColor=item.TextBGColor;}if(style.KLineYAxisBGPaint){var item=style.KLineYAxisBGPaint;if(item.Font)this.KLineYAxisBGPaint.Font=item.Font;if(item.LineColor)this.KLineYAxisBGPaint.LineColor=item.LineColor;if(item.DiffValutTextColor)this.KLineYAxisBGPaint.DiffValutTextColor=item.DiffValutTextColor;if(item.DiffValueBGColor)this.KLineYAxisBGPaint.DiffValueBGColor=item.DiffValueBGColor;}if(style.StockChip){var item=style.StockChip;if(item.InfoColor)this.StockChip.InfoColor=item.InfoColor;if(item.DayInfoColor)this.StockChip.DayInfoColor=item.DayInfoColor;if(item.DefaultButton)T_SetButtonStyle(item.DefaultButton,this.StockChip.DefaultButton);if(item.LongButton)T_SetButtonStyle(item.LongButton,this.StockChip.LongButton);if(item.RecentButton)T_SetButtonStyle(item.RecentButton,this.StockChip.RecentButton);}if(style.DepthChart){var item=style.DepthChart;if(item.BidColor){if(item.BidColor.Line)this.DepthChart.BidColor.Line=item.BidColor.Line;if(item.BidColor.Area)this.DepthChart.BidColor.Area=item.BidColor.Area;}if(item.AskColor){if(item.AskColor.Line)this.DepthChart.AskColor.Line=item.AskColor.Line;if(item.AskColor.Area)this.DepthChart.AskColor.Area=item.AskColor.Area;}if(item.LineWidth)this.DepthChart.LineWidth=item.LineWidth;}if(style.DepthCorss){var item=style.DepthCorss;if(item.BidColor){if(item.BidColor.Line)this.DepthCorss.BidColor.Line=item.BidColor.Line;}if(item.AskColor){if(item.AskColor.Line)this.DepthCorss.AskColor.Line=item.AskColor.Line;}if(item.LineWidth)this.DepthCorss.LineWidth=item.LineWidth;if(item.LineDash)this.DepthCorss.LineDash=item.LineDash;if(item.Tooltip){var tooltip=item.Tooltip;if(tooltip.BGColor)this.DepthCorss.Tooltip.BGColor=tooltip.BGColor;if(tooltip.TextColor)this.DepthCorss.Tooltip.TextColor=tooltip.TextColor;if(tooltip.Font)this.DepthCorss.Tooltip.Font=tooltip.Font;if(tooltip.LineHeight)this.DepthCorss.Tooltip.LineHeight=tooltip.LineHeight;var border=tooltip.Border;if(IFrameSplitOperator.IsNumber(border.Top))this.DepthCorss.Tooltip.Border.Top=border.Top;if(IFrameSplitOperator.IsNumber(border.Bottom))this.DepthCorss.Tooltip.Border.Bottom=border.Bottom;if(IFrameSplitOperator.IsNumber(border.Left))this.DepthCorss.Tooltip.Border.Left=border.Left;if(IFrameSplitOperator.IsNumber(border.Right))this.DepthCorss.Tooltip.Border.Right=border.Right;if(IFrameSplitOperator.IsNumber(border.ItemSpace))this.DepthCorss.Tooltip.Border.ItemSpace=border.ItemSpace;}}if(style.CIRCLEDOT){var item=style.CIRCLEDOT;if(IFrameSplitOperator.IsNumber(item.Radius))this.CIRCLEDOT.Radius=item.Radius;}if(style.POINTDOT){var item=style.POINTDOT;if(IFrameSplitOperator.IsNumber(item.Radius))this.POINTDOT.Radius=item.Radius;}if(style.RectSelect){var item=style.RectSelect;if(item.LineColor)this.RectSelect.LineColor=item.LineColor;if(item.LineWidth>0)this.RectSelect.LineWidth=item.LineWidth;if(item.LineDotted)this.RectSelect.LineDotted=item.LineDotted;if(item.AreaColor)this.RectSelect.AreaColor=item.AreaColor;if(item.SubAreaColor)this.RectSelect.SubAreaColor=item.SubAreaColor;if(item.RangeTextColor)this.RectSelect.RangeTextColor=item.RangeTextColor;if(item.RangeTextFont)this.RectSelect.RangeTextFont=item.RangeTextFont;if(item.RangeTextBGColor)this.RectSelect.RangeTextBGColor=item.RangeTextBGColor;if(item.RangeTextSubColor)this.RectSelect.RangeTextSubColor=item.RangeTextSubColor;if(item.RangeTextSubFont)this.RectSelect.RangeTextSubFont=item.RangeTextSubFont;if(item.RangeTextSubBGColor)this.RectSelect.RangeTextSubBGColor=item.RangeTextSubBGColor;}if(style.OrderFlow){item=style.OrderFlow;if(item.UpColor)this.OrderFlow.UpColor=item.UpColor;if(item.DownColor)this.OrderFlow.DownColor=item.DownColor;if(item.UnchagneColor)this.OrderFlow.UnchagneColor=item.UnchagneColor;if(item.Text)this.OrderFlow.Text=item.Text;if(item.Line)this.OrderFlow.Line=item.Line;}if(style.OrderFlow_Style2){item=style.OrderFlow_Style2;if(item.UpColor)this.OrderFlow_Style2.UpColor=item.UpColor;if(item.DownColor)this.OrderFlow_Style2.DownColor=item.DownColor;if(item.UnchagneColor)this.OrderFlow_Style2.UnchagneColor=item.UnchagneColor;if(IFrameSplitOperator.IsNumber(item.BarWidth))this.OrderFlow_Style2.BarWidth=item.BarWidth;}if(style.ChartOX){var item=style.ChartOX;if(item.Family)this.ChartOX.Family=item.Family;if(item.Up)this.ChartOX.Up=item.Up;if(item.Down)this.ChartOX.Down=item.Down;if(item.SquareLineColor)this.ChartOX.SquareLineColor=item.SquareLineColor;}if(style.DealList){var item=style.DealList;if(item.BorderColor)this.DealList.BorderColor=item.BorderColor;if(item.UpTextColor)this.DealList.UpTextColor=item.UpTextColor;if(item.DownTextColor)this.DealList.DownTextColor=item.DownTextColor;if(item.UnchagneTextColor)this.DealList.UnchagneTextColor=item.UnchagneTextColor;if(item.CloseLineColor)this.DealList.CloseLineColor=item.CloseLineColor;if(item.Header){var header=item.Header;if(header.Color)this.DealList.Header.Color=header.Color;if(header.Mergin){var mergin=header.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.DealList.Header.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))this.DealList.Header.Mergin.Left=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))this.DealList.Header.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.DealList.Header.Mergin.Bottom=mergin.Bottom;}if(header.Font){var font=header.Font;if(font.Name)this.DealList.Header.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.DealList.Header.Font.Size=font.Size;}}if(item.Row){var row=item.Row;if(row.Mergin){var mergin=row.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Top))this.DealList.Row.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.DealList.Row.Mergin.Bottom=mergin.Bottom;}if(row.Font){var font=row.Font;if(font.Name)this.DealList.Row.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.DealList.Row.Font.Size=font.Size;}if(row.BarMergin){var mergin=row.BarMergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.DealList.Row.BarMergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Top))this.DealList.Row.BarMergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Right))this.DealList.Row.BarMergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.DealList.Row.BarMergin.Bottom=mergin.Bottom;}}if(item.FieldColor){var filed=item.FieldColor;if(filed.Vol)this.DealList.FieldColor.Vol=filed.Vol;if(filed.Time)this.DealList.FieldColor.Time=filed.Time;if(filed.Deal)this.DealList.FieldColor.Deal=filed.Deal;if(filed.Index)this.DealList.FieldColor.Index=filed.Index;if(filed.BarTitle)this.DealList.FieldColor.BarTitle=filed.BarTitle;if(filed.Text)this.DealList.FieldColor.Text=filed.Text;if(IFrameSplitOperator.IsNonEmptyArray(filed.Bar)){for(var i=0;i<filed.Bar.length;++i){this.DealList.FieldColor.Bar[i]=filed.Bar[i];}}}}if(style.Report)this.SetReportStyle(style.Report);if(style.TReport)this.SetTReportStyle(style.TReport);if(style.SelectedChart){var item=style.SelectedChart;if(IFrameSplitOperator.IsNumber(item.LineWidth))this.SelectedChart.LineWidth=item.LineWidth;if(IFrameSplitOperator.IsNumber(item.Radius))this.SelectedChart.Radius=item.Radius;if(IFrameSplitOperator.IsNumber(item.MinSpace))this.SelectedChart.MinSpace=item.MinSpace;if(item.LineColor)this.SelectedChart.LineColor=item.LineColor;if(item.LineColor)this.SelectedChart.BGColor=item.BGColor;}if(style.DragMovePaint){var item=style.DragMovePaint;if(item.TextColor)this.DragMovePaint.TextColor=item.TextColor;if(item.Font)this.DragMovePaint.Font=item.Font;}if(style.SessionBreaksPaint){var item=style.SessionBreaksPaint;if(IFrameSplitOperator.IsNonEmptyArray(item.BGColor))this.SessionBreaksPaint.BGColor=item.BGColor.slice();if(item.SplitLine){var subItem=item.SplitLine;if(subItem.Color)this.SessionBreaksPaint.SplitLine.Color=subItem.Color;if(IFrameSplitOperator.IsNumber(subItem.Width))this.SessionBreaksPaint.SplitLine.Width=subItem.Width;this.SessionBreaksPaint.SplitLine.Dash=subItem.Dash;}}if(IFrameSplitOperator.IsNumber(style.ToolbarButtonStyle))this.ToolbarButtonStyle=style.ToolbarButtonStyle;if(style.Buttons){var buttons=style.Buttons;T_SetButtonStyle(buttons.CloseOverlayIndex,this.Buttons.CloseOverlayIndex);T_SetButtonStyle(buttons.CloseWindow,this.Buttons.CloseWindow);T_SetButtonStyle(buttons.ChangeIndex,this.Buttons.ChangeIndex);T_SetButtonStyle(buttons.OverlayIndex,this.Buttons.OverlayIndex);T_SetButtonStyle(buttons.ModifyIndexParam,this.Buttons.ModifyIndexParam);T_SetButtonStyle(buttons.MaxMinWindow,this.Buttons.MaxMinWindow);T_SetButtonStyle(buttons.TitleWindow,this.Buttons.TitleWindow);T_SetButtonStyle(buttons.ExportData,this.Buttons.ExportData);}if(style.ChartDrawVolProfile){var item=style.ChartDrawVolProfile;if(item.UpVolColor)this.ChartDrawVolProfile.UpVolColor=item.UpVolColor;if(item.DownVolColor)this.ChartDrawVolProfile.DownVolColor=item.DownVolColor;if(item.AreaUpColor)this.ChartDrawVolProfile.AreaUpColor=item.AreaUpColor;if(item.AreaDonwColor)this.ChartDrawVolProfile.AreaDonwColor=item.AreaDonwColor;if(item.BGColor)this.ChartDrawVolProfile.BGColor=item.BGColor;if(item.BorderColor)this.ChartDrawVolProfile.BorderColor=item.BorderColor;if(item.VolLineColor)this.ChartDrawVolProfile.VolLineColor=item.VolLineColor;if(item.Text){if(item.Text.Color)this.ChartDrawVolProfile.Text.Color=item.Text.Color;if(item.Text.Family)this.ChartDrawVolProfile.Text.Family=item.Text.Family;if(IFrameSplitOperator.IsNumber(item.Text.FontMaxSize))this.ChartDrawVolProfile.Text.FontMaxSize=item.Text.FontMaxSize;if(IFrameSplitOperator.IsNumber(item.Text.FontMinSize))this.ChartDrawVolProfile.Text.FontMinSize=item.Text.FontMinSize;}}if(style.DisableLogo===true){if(this.FrameLogo)this.FrameLogo.Text=null;}if(style.ScrollBar){var item=style.ScrollBar;if(item.BorderColor)this.ScrollBar.BorderColor=item.BorderColor;if(item.XSplitTextFont)this.ScrollBar.XSplitTextFont=item.XSplitTextFont;if(item.XSplitTextColor)this.ScrollBar.XSplitTextColor=item.XSplitTextColor;if(item.XSplitLineColor)this.ScrollBar.XSplitLineColor=item.XSplitLineColor;if(item.Slider){var subItem=item.Slider;if(subItem.DateFont)this.ScrollBar.Slider.DateFont=subItem.DateFont;if(subItem.DateColor)this.ScrollBar.Slider.DateColor=subItem.DateColor;if(subItem.BarColor)this.ScrollBar.Slider.BarColor=subItem.BarColor;if(subItem.BarAreaColor)this.ScrollBar.Slider.BarAreaColor=subItem.BarAreaColor;if(IFrameSplitOperator.IsNumber(subItem.BarWidth))this.ScrollBar.Slider.BarWidth=subItem.BarWidth;if(IFrameSplitOperator.IsNumber(subItem.BarPadding))this.ScrollBar.Slider.BarPadding=subItem.BarPadding;if(IFrameSplitOperator.IsNumber(subItem.MinCenterWidth))this.ScrollBar.Slider.MinCenterWidth=subItem.MinCenterWidth;}if(item.BGChart){var subItem=item.BGChart;if(subItem.Color)this.ScrollBar.BGChart.Color=subItem.Color;if(subItem.AreaColor)this.ScrollBar.BGChart.AreaColor=subItem.AreaColor;if(IFrameSplitOperator.IsPlusNumber(subItem.LineWidth))this.ScrollBar.BGChart.LineWidth=subItem.LineWidth;}}if(style.FrameButtomToolbar)this.SetFrameButtomToolbar(style.FrameButtomToolbar);};this.SetReportStyle=function(style){var item=style;var dest=this.Report;if(item.BorderColor)this.Report.BorderColor=item.BorderColor;if(item.UpTextColor)this.Report.UpTextColor=item.UpTextColor;if(item.DownTextColor)this.Report.DownTextColor=item.DownTextColor;if(item.UnchagneTextColor)this.Report.UnchagneTextColor=item.UnchagneTextColor;if(item.BorderColor)this.Report.SelectedColor=item.SelectedColor;if(item.CloseLine){var closeLine=item.CloseLine;if(closeLine.CloseColor)this.Report.CloseLine.CloseColor=closeLine.CloseColor;if(closeLine.YCloseColor)this.Report.CloseLine.YCloseColor=closeLine.YCloseColor;if(closeLine.AreaColor)this.Report.CloseLine.AreaColor=closeLine.AreaColor;}if(item.KLine){var kline=item.KLine;if(kline.UpColor)this.Report.KLine.UpColor=kline.UpColor;if(kline.DownColor)this.Report.KLine.DownColor=kline.DownColor;if(kline.UnchagneColor)this.Report.KLine.UnchagneColor=kline.UnchagneColor;if(IFrameSplitOperator.IsNumber(kline.DataWidth))this.Report.KLine.DataWidth=kline.DataWidth;if(IFrameSplitOperator.IsNumber(kline.DistanceWidth))this.Report.KLine.DistanceWidth=kline.DistanceWidth;}if(item.Header){var header=item.Header;if(header.Color)this.Report.Header.Color=header.Color;if(header.SortColor)this.Report.Header.SortColor=header.SortColor;if(header.Mergin){var mergin=header.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.Header.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.Header.Mergin.Left=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.Header.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.Header.Mergin.Bottom=mergin.Bottom;}if(header.Font){var font=header.Font;if(font.Name)this.Report.Header.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Header.Font.Size=font.Size;}}if(item.Item){var row=item.Item;if(row.Mergin){var mergin=row.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.Item.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.Item.Mergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.Item.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.Item.Mergin.Bottom=mergin.Bottom;}if(row.Font){var font=row.Font;if(font.Name)this.Report.Item.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Item.Font.Size=font.Size;}if(row.BarMergin){var mergin=row.BarMergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.Item.BarMergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.Item.BarMergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.Item.BarMergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.Item.BarMergin.Bottom=mergin.Bottom;}if(row.NameFont){var font=row.NameFont;if(font.Name)this.Report.Item.NameFont.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Item.NameFont.Size=font.Size;}if(row.SymbolFont){var font=row.SymbolFont;if(font.Name)this.Report.Item.SymbolFont.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Item.SymbolFont.Size=font.Size;}}if(item.FixedItem){var row=item.FixedItem;if(row.Font){var font=row.Font;if(font.Name)this.Report.FixedItem.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.FixedItem.Font.Size=font.Size;}}if(item.LimitBorder){var limit=item.LimitBorder;if(limit.Color)this.Report.LimitBorder.Color=limit.Color;if(limit.Mergin){var mergin=limit.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.LimitBorder.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.LimitBorder.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.LimitBorder.Mergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.LimitBorder.Mergin.Bottom=mergin.Bottom;}}if(item.LimitColor){var limit=item.LimitColor;if(limit.UpColor)this.Report.LimitColor.UpColor=limit.UpColor;if(limit.DownColor)this.Report.LimitColor.DownColor=limit.DownColor;if(limit.TextColor)this.Report.LimitColor.UpColor=limit.TextColor;}if(item.FieldColor){var filed=item.FieldColor;if(filed.Name)this.Report.FieldColor.Name=filed.Name;if(filed.Symbol)this.Report.FieldColor.Symbol=filed.Symbol;if(filed.Vol)this.Report.FieldColor.Vol=filed.Vol;if(filed.Amount)this.Report.FieldColor.Amount=filed.Amount;if(filed.Index)this.Report.FieldColor.Index=filed.Index;if(filed.BarTitle)this.Report.FieldColor.BarTitle=filed.BarTitle;if(filed.Text)this.Report.FieldColor.Text=filed.Text;if(IFrameSplitOperator.IsNonEmptyArray(filed.Bar)){for(var i=0;i<filed.Bar.length;++i){this.Report.FieldColor.Bar[i]=filed.Bar[i];}}}if(item.Tab){var tab=item.Tab;if(tab.Font){var font=tab.Font;if(font.Name)this.Report.Tab.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Tab.Font.Size=font.Size;}if(IFrameSplitOperator.IsNumber(tab.ScrollBarWidth))this.Report.Tab.ScrollBarWidth=tab.ScrollBarWidth;if(tab.ButtonColor)this.Report.Tab.ButtonColor=tab.ButtonColor;if(tab.BarColor)this.Report.Tab.BarColor=tab.BarColor;if(tab.BorderColor)this.Report.Tab.BorderColor=tab.BorderColor;if(tab.TabTitleColor)this.Report.Tab.TabTitleColor=tab.TabTitleColor;if(tab.TabSelectedTitleColor)this.Report.Tab.TabSelectedTitleColor=tab.TabSelectedTitleColor;if(tab.TabSelectedBGColor)this.Report.Tab.TabSelectedBGColor=tab.TabSelectedBGColor;if(tab.TabMoveOnTitleColor)this.Report.Tab.TabMoveOnTitleColor=tab.TabMoveOnTitleColor;if(tab.TabBGColor)this.Report.Tab.TabBGColor=tab.TabBGColor;}if(item.PageInfo){var pageinfo=item.PageInfo;if(pageinfo.Font){var font=pageinfo.Font;if(font.Name)this.Report.PageInfo.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.PageInfo.Font.Size=font.Size;}if(pageinfo.TextColor)this.Report.PageInfo.TextColor=pageinfo.TextColor;if(pageinfo.BGColor)this.Report.PageInfo.BGColor=pageinfo.BGColor;if(pageinfo.Mergin){var mergin=pageinfo.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.PageInfo.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.PageInfo.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.PageInfo.Mergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.PageInfo.Mergin.Bottom=mergin.Bottom;}}if(item.DragRow){var dragRow=item.DragRow;if(dragRow.Color)this.Report.DragRow.Color=dragRow.Color;if(dragRow.TextColor)this.Report.DragRow.TextColor=dragRow.TextColor;if(dragRow.MoveRowColor)this.Report.DragRow.MoveRowColor=dragRow.MoveRowColor;if(dragRow.SrcRowColor)this.Report.DragRow.SrcRowColor=dragRow.SrcRowColor;}if(item.VScrollbar){var subItem=item.VScrollbar;if(IFrameSplitOperator.IsNumber(subItem.ScrollBarHeight))dest.VScrollbar.ScrollBarHeight=subItem.ScrollBarHeight;if(subItem.ButtonColor)dest.VScrollbar.ButtonColor=subItem.ButtonColor;if(subItem.BarColor)dest.VScrollbar.BarColor=subItem.BarColor;if(subItem.BorderColor)dest.VScrollbar.BorderColor=subItem.BorderColor;if(subItem.BGColor)dest.VScrollbar.BGColor=subItem.BGColor;}};this.SetTReportStyle=function(style){var item=style;var dest=this.TReport;if(item.BorderColor)dest.BorderColor=item.BorderColor;if(item.UpTextColor)dest.UpTextColor=item.UpTextColor;if(item.DownTextColor)dest.DownTextColor=item.DownTextColor;if(item.UnchangeTextColor)dest.UnchangeTextColor=item.UnchangeTextColor;if(item.BorderColor)dest.SelectedColor=item.SelectedColor;if(item.UpBGColor)dest.UpBGColor=item.UpBGColor;if(item.DownBGColor)dest.DownBGColor=item.DownBGColor;if(item.Header){var header=item.Header;if(header.Color)dest.Header.Color=header.Color;if(header.SortColor)dest.Header.SortColor=header.SortColor;if(header.Mergin){var mergin=header.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))dest.Header.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))dest.Header.Mergin.Left=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))dest.Header.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))dest.Header.Mergin.Bottom=mergin.Bottom;}if(header.Font){var font=header.Font;if(font.Name)dest.Header.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))dest.Header.Font.Size=font.Size;}}if(item.CenterItem){var cell=item.CenterItem;if(cell.TextColor)dest.CenterItem.TextColor=cell.TextColor;if(cell.BaseTextColor)dest.CenterItem.BaseTextColor=cell.BaseTextColor;if(cell.BGColor)dest.CenterItem.BGColor=cell.BGColor;}if(item.Item){var row=item.Item;if(row.Mergin){var mergin=row.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))dest.Item.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))dest.Item.Mergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))dest.Item.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))dest.Item.Mergin.Bottom=mergin.Bottom;}if(row.Font){var font=row.Font;if(font.Name)dest.Item.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))dest.Item.Font.Size=font.Size;}if(row.NameFont){var font=row.NameFont;if(font.Name)dest.Item.NameFont.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))dest.Item.NameFont.Size=font.Size;}if(row.SymbolFont){var font=row.SymbolFont;if(font.Name)dest.Item.SymbolFont.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))dest.Item.SymbolFont.Size=font.Size;}}if(item.FieldColor){var filed=item.FieldColor;if(filed.Name)dest.FieldColor.Name=filed.Name;if(filed.Symbol)dest.FieldColor.Symbol=filed.Symbol;if(filed.Vol)dest.FieldColor.Vol=filed.Vol;if(filed.Amount)dest.FieldColor.Amount=filed.Amount;if(filed.Index)dest.FieldColor.Index=filed.Index;if(filed.Text)dest.FieldColor.Text=filed.Text;if(filed.Position)dest.FieldColor.Position=filed.Position;}if(item.MarkBorder){var subIem=item.MarkBorder;if(subIem.MaxPositionColor)dest.MarkBorder.MaxPositionColor=subIem.MaxPositionColor;}};this.SetFrameButtomToolbar=function(style){var dest=this.FrameButtomToolbar;if(style.BGColor)dest.BGColor=style.BGColor;if(style.BorderColor)dest.BorderColor=style.BorderColor;if(style.Button){var button=style.Button;if(button.BorderColor)dest.Button.BorderColor=button.BorderColor;if(button.Font){var item=button.Font;var destItem=this.FrameButtomToolbar.Button.Font;if(item.Family)destItem.Family=item.Family;if(IFrameSplitOperator.IsNumber(item.Size))destItem.Size=item.Size;}if(button.TitleColor){var item=button.TitleColor;var destItem=this.FrameButtomToolbar.Button.TitleColor;if(item.Selected)destItem.Selected=item.Selected;if(item.Default)destItem.Default=item.Default;if(item.MoveOn)destItem.MoveOn=item.MoveOn;}if(button.BGColor){var item=button.BGColor;var destItem=this.FrameButtomToolbar.Button.BGColor;if(item.Selected)destItem.Selected=item.Selected;if(item.Default)destItem.Default=item.Default;if(item.MoveOn)destItem.MoveOn=item.MoveOn;}if(button.Mergin){var item=button.Mergin;var destItem=this.FrameButtomToolbar.Button.Mergin;if(IFrameSplitOperator.IsNumber(item.Left))destItem.Left=item.Left;if(IFrameSplitOperator.IsNumber(item.Right))destItem.Left=item.Right;if(IFrameSplitOperator.IsNumber(item.Top))destItem.Top=item.Top;if(IFrameSplitOperator.IsNumber(item.Bottom))destItem.Bottom=item.Bottom;}}};}var g_JSChartResource=new JSChartResource();/////////////////////////////////////////////////////////////////////////////////
|
|
6722
|
+
MinCenterWidth:15}},this.FrameButtomToolbar={BGColor:"rgb(235,235,235)",BorderColor:"rgb(204,204,204)",Button:{Font:{Family:"微软雅黑",Size:12*GetDevicePixelRatio()},TitleColor:{Selected:"rgb(255,255,255)",Default:"rgb(125,125,125)",MoveOn:"rgb(234,85,4)"},BGColor:{Selected:"rgb(234,85,4)",Default:"rgb(235,235,235)",MoveOn:"rgb(242,242,242)"},BorderColor:"rgb(204,204,204)",Mergin:{Left:5*GetDevicePixelRatio(),Right:5*GetDevicePixelRatio(),Top:4*GetDevicePixelRatio(),Bottom:2*GetDevicePixelRatio()},SVG:{Family:"iconfont",Size:12*GetDevicePixelRatio(),MerginLeft:4*GetDevicePixelRatio()}}//自定义风格
|
|
6723
|
+
};this.SetStyle=function(style){var T_SetButtonStyle=function T_SetButtonStyle(item,dest){if(!item)return;if(item.Color)dest.Color=item.Color;if(item.MoveOnColor)dest.MoveOnColor=item.MoveOnColor;if(item.SelectedColor)dest.SelectedColor=item.SelectedColor;if(item.Family)dest.Family=item.Family;if(item.Text)dest.Text=item.Text;if(IFrameSplitOperator.IsNumber(item.Size))dest.Size=item.Size;if(IFrameSplitOperator.IsNumber(item.MerginLeft))dest.MerginLeft=item.MerginLeft;};if(style.TooltipBGColor)this.TooltipBGColor=style.TooltipBGColor;if(style.TooltipAlpha)this.TooltipAlpha=style.TooltipAlpha;if(style.SelectRectBGColor)this.SelectRectBGColor=style.SelectRectBGColor;if(style.UpBarColor)this.UpBarColor=style.UpBarColor;if(style.DownBarColor)this.DownBarColor=style.DownBarColor;if(style.UnchagneBarColor)this.UnchagneBarColor=style.UnchagneBarColor;if(style.EmptyBarBGColor)this.EmptyBarBGColor=style.EmptyBarBGColor;if(style.HighLowBarColor)this.HighLowBarColor=style.HighLowBarColor;if(style.HighLowText){var dest=this.HighLowText;var item=style.HighLowText;if(item.FontName)dest.FontName=item.FontName;if(item.Color)dest.Color=item.Color;if(item.MaxText)dest.MaxText=item.MaxText;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))dest.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))dest.MinSize=item.MinSize;}if(style.SplashScreen){var item=style.SplashScreen;if(item.BGColor)this.SplashScreen.BGColor=item.BGColor;if(item.Title)this.SplashScreen.Title=item.Title;if(item.TextColor)this.SplashScreen.TextColor=item.TextColor;if(item.Font)this.SplashScreen.Font=item.Font;}if(style.HLCArea){var item=style.HLCArea;if(item.HighLineColor)this.HLCArea.HighLineColor=item.HighLineColor;if(item.LowLineColor)this.HLCArea.LowLineColor=item.LowLineColor;if(item.CloseLineColor)this.HLCArea.CloseLineColor=item.CloseLineColor;if(item.UpAreaColor)this.HLCArea.UpAreaColor=item.UpAreaColor;if(item.DownAreaColor)this.HLCArea.DownAreaColor=item.DownAreaColor;if(IFrameSplitOperator.IsNumber(item.LineWidth))this.HLCArea.LineWidth=item.LineWidth;}if(style.Minute){if(style.Minute.VolBarColor)this.Minute.VolBarColor=style.Minute.VolBarColor;if(style.Minute.VolTitleColor)this.Minute.VolTitleColor=style.Minute.VolTitleColor;if(style.Minute.PriceColor)this.Minute.PriceColor=style.Minute.PriceColor;if(IFrameSplitOperator.IsNumber(style.Minute.PriceLineWidth))this.Minute.PriceLineWidth=style.Minute.PriceLineWidth;if(style.Minute.AvPriceColor)this.Minute.AvPriceColor=style.Minute.AvPriceColor;if(style.Minute.AreaPriceColor)this.Minute.AreaPriceColor=style.Minute.AreaPriceColor;if(style.Minute.PositionColor)this.Minute.PositionColor=style.Minute.PositionColor;if(style.Minute.FrameSplitTextColor)this.Minute.FrameSplitTextColor=style.Minute.FrameSplitTextColor;if(style.Minute.Before){var item=style.Minute.Before;if(item.BGColor)this.Minute.Before.BGColor=item.BGColor;if(item.LineColor)this.Minute.Before.LineColor=item.LineColor;if(item.VolColor)this.Minute.Before.VolColor=item.VolColor;if(item.AvPriceColor)this.Minute.Before.AvPriceColor=item.AvPriceColor;if(item.CloseIcon)T_SetButtonStyle(item.CloseIcon,this.Minute.Before.CloseIcon);if(item.Point){if(item.Point.Color)this.Minute.Before.Point.Color=item.Point.Color;if(item.Point.Radius)this.Minute.Before.Point.Radius=item.Point.Radius;}}if(style.Minute.After){var item=style.Minute.After;if(item.BGColor)this.Minute.After.BGColor=item.BGColor;if(item.LineColor)this.Minute.After.LineColor=item.LineColor;if(item.VolColor)this.Minute.After.VolColor=item.VolColor;if(item.AvPriceColor)this.Minute.After.AvPriceColor=item.AvPriceColor;if(item.Point){if(item.Point.Color)this.Minute.After.Point.Color=item.Point.Color;if(item.Point.Radius)this.Minute.After.Point.Radius=item.Point.Radius;}}}if(style.DefaultTextColor)this.DefaultTextColor=style.DefaultTextColor;if(style.DefaultTextFont)this.DefaultTextFont=style.DefaultTextFont;if(style.TitleFont)this.TitleFont=style.TitleFont;if(style.IndexTitleBGColor)this.IndexTitleBGColor=style.IndexTitleBGColor;if(style.IndexTitleBorderColor)this.IndexTitleBorderColor=style.IndexTitleBorderColor;if(style.IndexTitleBorderMoveOnColor)this.IndexTitleBorderMoveOnColor=style.IndexTitleBorderMoveOnColor;if(IFrameSplitOperator.IsNumber(style.IndexTitleBorderStyle))this.IndexTitleBorderStyle=style.IndexTitleBorderStyle;if(style.IndexTitleColor)this.IndexTitleColor=style.IndexTitleColor;if(style.IndexTitleSelectedColor)this.IndexTitleSelectedColor=style.IndexTitleSelectedColor;if(style.OverlayIndexTitleBGColor)this.OverlayIndexTitleBGColor=style.OverlayIndexTitleBGColor;if(style.UpTextColor)this.UpTextColor=style.UpTextColor;if(style.DownTextColor)this.DownTextColor=style.DownTextColor;if(style.UnchagneTextColor)this.UnchagneTextColor=style.UnchagneTextColor;if(style.CloseLineColor)this.CloseLineColor=style.CloseLineColor;if(style.CloseLineAreaColor)this.CloseLineAreaColor=style.CloseLineAreaColor;if(style.CloseLineWidth)this.CloseLineWidth=style.CloseLineWidth;if(style.FrameBorderPen)this.FrameBorderPen=style.FrameBorderPen;if(style.MultiDayBorderPen)this.MultiDayBorderPen=style.MultiDayBorderPen;if(style.FrameSplitPen)this.FrameSplitPen=style.FrameSplitPen;if(style.FrameDotSplitPen)this.FrameDotSplitPen=style.FrameDotSplitPen;if(style.FrameSplitTextColor)this.FrameSplitTextColor=style.FrameSplitTextColor;if(style.FrameSplitTextFont)this.FrameSplitTextFont=style.FrameSplitTextFont;if(style.FrameTitleBGColor)this.FrameTitleBGColor=style.FrameTitleBGColor;if(style.SelFrameBorderColor)this.SelFrameBorderColor=style.SelFrameBorderColor;if(IFrameSplitOperator.IsNumber(style.IndexTitleMerginLeft))this.IndexTitleMerginLeft=style.IndexTitleMerginLeft;if(style.IndexTitle){var item=style.IndexTitle;if(item.UpDownArrow){var subItem=item.UpDownArrow;if(subItem.UpColor)this.IndexTitle.UpDownArrow.UpColor=subItem.UpColor;if(subItem.DownColor)this.IndexTitle.UpDownArrow.DownColor=subItem.DownColor;if(subItem.UnchangeColor)this.IndexTitle.UpDownArrow.UnchangeColor=subItem.UnchangeColor;}}if(style.Frame){if(style.Frame.XBottomOffset)this.Frame.XBottomOffset=style.Frame.XBottomOffset;if(style.Frame.YTopOffset)this.Frame.YTopOffset=style.Frame.YTopOffset;if(style.Frame.PercentageText){var item=style.Frame.PercentageText;if(item.PriceColor)this.Frame.PercentageText.PriceColor=item.PriceColor;if(item.PercentageColor)this.Frame.PercentageText.PercentageColor=item.PercentageColor;if(item.SplitColor)this.Frame.PercentageText.SplitColor=item.SplitColor;if(item.Font)this.Frame.PercentageText.Font=item.Font;}}if(IFrameSplitOperator.IsNumber(style.ToolbarButtonStyle))this.ToolbarButtonStyle=style.ToolbarButtonStyle;if(IFrameSplitOperator.IsBool(style.IsDOMFrameTitle))this.IsDOMFrameTitle=style.IsDOMFrameTitle;if(style.FrameLatestPrice){var item=style.FrameLatestPrice;if(style.FrameLatestPrice.TextColor)this.FrameLatestPrice.TextColor=style.FrameLatestPrice.TextColor;if(style.FrameLatestPrice.UpBarColor)this.FrameLatestPrice.UpBarColor=style.FrameLatestPrice.UpBarColor;if(style.FrameLatestPrice.DownBarColor)this.FrameLatestPrice.DownBarColor=style.FrameLatestPrice.DownBarColor;if(style.FrameLatestPrice.UnchagneBarColor)this.FrameLatestPrice.UnchagneBarColor=style.FrameLatestPrice.UnchagneBarColor;if(style.FrameLatestPrice.BGAlpha)this.FrameLatestPrice.BGAlpha=style.FrameLatestPrice.BGAlpha;if(style.FrameLatestPrice.OverlayTextColor)this.FrameLatestPrice.OverlayTextColor=style.FrameLatestPrice.OverlayTextColor;if(item.EmptyBGColor)this.FrameLatestPrice.EmptyBGColor=item.EmptyBGColor;}if(style.OverlayFrame){var item=style.OverlayFrame;if(style.OverlayFrame.BolderPen)this.OverlayFrame.BolderPen=style.OverlayFrame.BolderPen;if(style.OverlayFrame.TitleColor)this.OverlayFrame.TitleColor=style.OverlayFrame.TitleColor;if(style.OverlayFrame.TitleFont)this.OverlayFrame.TitleFont=style.OverlayFrame.TitleFont;}if(style.CorssCursorBGColor)this.CorssCursorBGColor=style.CorssCursorBGColor;if(style.CorssCursorTextColor)this.CorssCursorTextColor=style.CorssCursorTextColor;if(style.CorssCursorTextFont)this.CorssCursorTextFont=style.CorssCursorTextFont;if(style.CorssCursorVPenColor)this.CorssCursorVPenColor=style.CorssCursorVPenColor;if(style.CorssCursorHPenColor)this.CorssCursorHPenColor=style.CorssCursorHPenColor;if(style.CorssCursorBorderColor)this.CorssCursorBorderColor=style.CorssCursorBorderColor;if(style.CorssCursorXRangeBGColor)this.CorssCursorXRangeBGColor=style.CorssCursorXRangeBGColor;if(style.CorssCursor&&style.CorssCursor.RightButton){var item=style.CorssCursor.RightButton;if(item.BGColor)this.CorssCursor.RightButton.BGColor=item.BGColor;if(item.PenColor)this.CorssCursor.RightButton.PenColor=item.PenColor;if(item.Icon)this.CorssCursor.RightButton.Icon=item.Icon;}if(style.KLine)this.KLine=style.KLine;if(style.VirtualKLine){var item=style.VirtualKLine;if(item.Color)this.VirtualKLine.Color=item.Color;if(item.LineDash)this.VirtualKLine.LineDash=item.LineDash;}if(style.PriceGapStyple){var item=style.PriceGapStyple;if(item.Line&&item.Line.Color)this.PriceGapStyple.Line.Color=item.Line.Color;if(item.Text){if(item.Text.Color)this.PriceGapStyple.Text.Color=item.Text.Color;if(item.Text.Font)this.PriceGapStyple.Text.Font=item.Text.Font;}}if(style.Index){if(style.Index.LineColor)this.Index.LineColor=style.Index.LineColor;if(style.Index.NotSupport)this.Index.NotSupport=style.Index.NotSupport;}if(style.ColorArray)this.ColorArray=style.ColorArray;if(style.DrawPicture){var item=style.DrawPicture;if(item.LineColor)this.DrawPicture.LineColor=item.LineColor;if(item.PointColor)this.DrawPicture.PointColor=item.PointColor;if(item.XYCoordinate)this.DrawPicture.XYCoordinate=item.XYCoordinate;if(IFrameSplitOperator.IsNumber(item.PointType))this.DrawPicture.PointType=item.PointType;if(IFrameSplitOperator.IsBool(item.IsShowPoint))this.DrawPicture.IsShowPoint=item.IsShowPoint;}if(style.TooltipPaint){if(style.TooltipPaint.BGColor)this.TooltipPaint.BGColor=style.TooltipPaint.BGColor;if(style.TooltipPaint.BorderColor)this.TooltipPaint.BorderColor=style.TooltipPaint.BorderColor;if(style.TooltipPaint.TitleColor)this.TooltipPaint.TitleColor=style.TooltipPaint.TitleColor;if(style.TooltipPaint.TitleFont)this.TooltipPaint.TitleFont=style.TooltipPaint.TitleFont;if(style.TooltipPaint.DateTimeColor)this.TooltipPaint.DateTimeColor=style.TooltipPaint.DateTimeColor;if(style.TooltipPaint.VolColor)this.TooltipPaint.VolColor=style.TooltipPaint.VolColor;if(style.TooltipPaint.AmountColor)this.TooltipPaint.AmountColor=style.TooltipPaint.AmountColor;}if(style.PCTooltipPaint){var item=style.PCTooltipPaint;if(item.BGColor)this.PCTooltipPaint.BGColor=item.BGColor;if(item.BorderColor)this.PCTooltipPaint.BorderColor=item.BorderColor;if(item.TitleColor)this.PCTooltipPaint.TitleColor=item.TitleColor;if(item.TitleFont)this.PCTooltipPaint.TitleFont=item.TitleFont;if(item.DateTimeColor)this.PCTooltipPaint.DateTimeColor=item.DateTimeColor;if(item.VolColor)this.PCTooltipPaint.VolColor=item.VolColor;if(item.AmountColor)this.PCTooltipPaint.AmountColor=item.AmountColor;}if(style.MinuteInfo){var item=style.MinuteInfo;if(style.MinuteInfo.TextColor)this.MinuteInfo.TextColor=style.MinuteInfo.TextColor;if(style.MinuteInfo.Font)this.MinuteInfo.Font=style.MinuteInfo.Font;if(style.MinuteInfo.PointColor)this.MinuteInfo.PointColor=style.MinuteInfo.PointColor;if(style.MinuteInfo.LineColor)this.MinuteInfo.LineColor=style.MinuteInfo.LineColor;if(style.MinuteInfo.TextBGColor)this.MinuteInfo.TextBGColor=style.MinuteInfo.TextBGColor;if(IFrameSplitOperator.IsNumber(item.PointRadius))this.MinuteInfo.PointRadius=item.PointRadius;}if(style.Title){if(style.Title.TradeIndexColor)this.Title.TradeIndexColor=style.Title.TradeIndexColor;if(style.Title.ColorIndexColor)this.Title.ColorIndexColor=style.Title.ColorIndexColor;if(style.Title.VolColor)this.Title.VolColor=style.Title.VolColor;if(style.Title.AmountColor)this.Title.AmountColor=style.Title.AmountColor;if(style.Title.DateTimeColor)this.Title.DateTimeColor=style.Title.DateTimeColor;if(style.Title.NameColor)this.Title.NameColor=style.Title.NameColor;if(style.Title.SettingColor)this.Title.SettingColor=style.Title.SettingColor;if(style.Title.TurnoverRateColor)this.Title.TurnoverRateColor=style.Title.TurnoverRateColor;if(style.Title.PositionColor)this.Title.PositionColor=style.Title.PositionColor;}if(style.DRAWICON){if(style.DRAWICON.Icon){var item=style.DRAWICON.Icon;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))this.DRAWICON.Icon.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))this.DRAWICON.Icon.MinSize=item.MinSize;if(item.Zoom)this.DRAWICON.Icon.Zoom=item.Zoom;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWICON.Icon.YOffset=item.YOffset;}if(style.DRAWICON.Text){var item=style.DRAWICON.Text;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))this.DRAWICON.Text.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))this.DRAWICON.Text.MinSize=item.MinSize;if(item.Zoom)this.DRAWICON.Text.Zoom=item.Zoom;if(item.FontName)this.DRAWICON.Text.FontName=item.FontName;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWICON.Text.YOffset=item.YOffset;}}if(style.DRAWTEXT){var item=style.DRAWTEXT;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))this.DRAWICON.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))this.DRAWICON.MinSize=item.MinSize;if(item.Zoom)this.DRAWTEXT.Zoom=item.Zoom;if(item.FontName)this.DRAWTEXT.FontName=item.FontName;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWTEXT.YOffset=item.YOffset;}if(style.DRAWTEXT_FIX){var item=style.DRAWTEXT_FIX;if(item.Font)this.DRAWTEXT_FIX.Font=item.Font;}if(style.DRAWNUMBER_FIX){var item=style.DRAWNUMBER_FIX;if(item.Font)this.DRAWNUMBER_FIX.Font=item.Font;}if(style.DRAWNUMBER){var item=style.DRAWNUMBER;if(IFrameSplitOperator.IsPlusNumber(item.MaxSize))this.DRAWNUMBER.MaxSize=item.MaxSize;if(IFrameSplitOperator.IsPlusNumber(item.MinSize))this.DRAWNUMBER.MinSize=item.MinSize;if(item.Zoom)this.DRAWNUMBER.Zoom=item.Zoom;if(item.FontName)this.DRAWNUMBER.FontName=item.FontName;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWNUMBER.YOffset=item.YOffset;}if(style.DRAWABOVE){var item=style.DRAWABOVE;if(IFrameSplitOperator.IsNumber(item.YOffset))this.DRAWABOVE.YOffset=item.YOffset;}if(style.DOTLINE)this.DOTLINE=style.DOTLINE;if(style.DRAWSL)this.DOTLINE=style.DRAWSL;if(style.DragSubFrameBorder)this.DragSubFrameBorder=style.DragSubFrameBorder;if(style.DepthMapPaint){var item=style.DepthMapPaint;if(item.LineColor)this.DepthMapPaint.LineColor=item.LineColor;if(item.AreaColor)this.DepthMapPaint.AreaColor=item.AreaColor;if(item.TextColor)this.DepthMapPaint.TextColor=item.TextColor;if(item.TextBGColor)this.DepthMapPaint.TextBGColor=item.TextBGColor;}if(style.KLineYAxisBGPaint){var item=style.KLineYAxisBGPaint;if(item.Font)this.KLineYAxisBGPaint.Font=item.Font;if(item.LineColor)this.KLineYAxisBGPaint.LineColor=item.LineColor;if(item.DiffValutTextColor)this.KLineYAxisBGPaint.DiffValutTextColor=item.DiffValutTextColor;if(item.DiffValueBGColor)this.KLineYAxisBGPaint.DiffValueBGColor=item.DiffValueBGColor;}if(style.StockChip){var item=style.StockChip;if(item.InfoColor)this.StockChip.InfoColor=item.InfoColor;if(item.DayInfoColor)this.StockChip.DayInfoColor=item.DayInfoColor;if(item.DefaultButton)T_SetButtonStyle(item.DefaultButton,this.StockChip.DefaultButton);if(item.LongButton)T_SetButtonStyle(item.LongButton,this.StockChip.LongButton);if(item.RecentButton)T_SetButtonStyle(item.RecentButton,this.StockChip.RecentButton);}if(style.DepthChart){var item=style.DepthChart;if(item.BidColor){if(item.BidColor.Line)this.DepthChart.BidColor.Line=item.BidColor.Line;if(item.BidColor.Area)this.DepthChart.BidColor.Area=item.BidColor.Area;}if(item.AskColor){if(item.AskColor.Line)this.DepthChart.AskColor.Line=item.AskColor.Line;if(item.AskColor.Area)this.DepthChart.AskColor.Area=item.AskColor.Area;}if(item.LineWidth)this.DepthChart.LineWidth=item.LineWidth;}if(style.DepthCorss){var item=style.DepthCorss;if(item.BidColor){if(item.BidColor.Line)this.DepthCorss.BidColor.Line=item.BidColor.Line;}if(item.AskColor){if(item.AskColor.Line)this.DepthCorss.AskColor.Line=item.AskColor.Line;}if(item.LineWidth)this.DepthCorss.LineWidth=item.LineWidth;if(item.LineDash)this.DepthCorss.LineDash=item.LineDash;if(item.Tooltip){var tooltip=item.Tooltip;if(tooltip.BGColor)this.DepthCorss.Tooltip.BGColor=tooltip.BGColor;if(tooltip.TextColor)this.DepthCorss.Tooltip.TextColor=tooltip.TextColor;if(tooltip.Font)this.DepthCorss.Tooltip.Font=tooltip.Font;if(tooltip.LineHeight)this.DepthCorss.Tooltip.LineHeight=tooltip.LineHeight;var border=tooltip.Border;if(IFrameSplitOperator.IsNumber(border.Top))this.DepthCorss.Tooltip.Border.Top=border.Top;if(IFrameSplitOperator.IsNumber(border.Bottom))this.DepthCorss.Tooltip.Border.Bottom=border.Bottom;if(IFrameSplitOperator.IsNumber(border.Left))this.DepthCorss.Tooltip.Border.Left=border.Left;if(IFrameSplitOperator.IsNumber(border.Right))this.DepthCorss.Tooltip.Border.Right=border.Right;if(IFrameSplitOperator.IsNumber(border.ItemSpace))this.DepthCorss.Tooltip.Border.ItemSpace=border.ItemSpace;}}if(style.CIRCLEDOT){var item=style.CIRCLEDOT;if(IFrameSplitOperator.IsNumber(item.Radius))this.CIRCLEDOT.Radius=item.Radius;}if(style.POINTDOT){var item=style.POINTDOT;if(IFrameSplitOperator.IsNumber(item.Radius))this.POINTDOT.Radius=item.Radius;}if(style.RectSelect){var item=style.RectSelect;if(item.LineColor)this.RectSelect.LineColor=item.LineColor;if(item.LineWidth>0)this.RectSelect.LineWidth=item.LineWidth;if(item.LineDotted)this.RectSelect.LineDotted=item.LineDotted;if(item.AreaColor)this.RectSelect.AreaColor=item.AreaColor;if(item.SubAreaColor)this.RectSelect.SubAreaColor=item.SubAreaColor;if(item.RangeTextColor)this.RectSelect.RangeTextColor=item.RangeTextColor;if(item.RangeTextFont)this.RectSelect.RangeTextFont=item.RangeTextFont;if(item.RangeTextBGColor)this.RectSelect.RangeTextBGColor=item.RangeTextBGColor;if(item.RangeTextSubColor)this.RectSelect.RangeTextSubColor=item.RangeTextSubColor;if(item.RangeTextSubFont)this.RectSelect.RangeTextSubFont=item.RangeTextSubFont;if(item.RangeTextSubBGColor)this.RectSelect.RangeTextSubBGColor=item.RangeTextSubBGColor;}if(style.OrderFlow){item=style.OrderFlow;if(item.UpColor)this.OrderFlow.UpColor=item.UpColor;if(item.DownColor)this.OrderFlow.DownColor=item.DownColor;if(item.UnchagneColor)this.OrderFlow.UnchagneColor=item.UnchagneColor;if(item.Text)this.OrderFlow.Text=item.Text;if(item.Line)this.OrderFlow.Line=item.Line;}if(style.OrderFlow_Style2){item=style.OrderFlow_Style2;if(item.UpColor)this.OrderFlow_Style2.UpColor=item.UpColor;if(item.DownColor)this.OrderFlow_Style2.DownColor=item.DownColor;if(item.UnchagneColor)this.OrderFlow_Style2.UnchagneColor=item.UnchagneColor;if(IFrameSplitOperator.IsNumber(item.BarWidth))this.OrderFlow_Style2.BarWidth=item.BarWidth;}if(style.ChartOX){var item=style.ChartOX;if(item.Family)this.ChartOX.Family=item.Family;if(item.Up)this.ChartOX.Up=item.Up;if(item.Down)this.ChartOX.Down=item.Down;if(item.SquareLineColor)this.ChartOX.SquareLineColor=item.SquareLineColor;}if(style.DealList){var item=style.DealList;if(item.BorderColor)this.DealList.BorderColor=item.BorderColor;if(item.UpTextColor)this.DealList.UpTextColor=item.UpTextColor;if(item.DownTextColor)this.DealList.DownTextColor=item.DownTextColor;if(item.UnchagneTextColor)this.DealList.UnchagneTextColor=item.UnchagneTextColor;if(item.CloseLineColor)this.DealList.CloseLineColor=item.CloseLineColor;if(item.Header){var header=item.Header;if(header.Color)this.DealList.Header.Color=header.Color;if(header.Mergin){var mergin=header.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.DealList.Header.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))this.DealList.Header.Mergin.Left=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))this.DealList.Header.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.DealList.Header.Mergin.Bottom=mergin.Bottom;}if(header.Font){var font=header.Font;if(font.Name)this.DealList.Header.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.DealList.Header.Font.Size=font.Size;}}if(item.Row){var row=item.Row;if(row.Mergin){var mergin=row.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Top))this.DealList.Row.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.DealList.Row.Mergin.Bottom=mergin.Bottom;}if(row.Font){var font=row.Font;if(font.Name)this.DealList.Row.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.DealList.Row.Font.Size=font.Size;}if(row.BarMergin){var mergin=row.BarMergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.DealList.Row.BarMergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Top))this.DealList.Row.BarMergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Right))this.DealList.Row.BarMergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.DealList.Row.BarMergin.Bottom=mergin.Bottom;}}if(item.FieldColor){var filed=item.FieldColor;if(filed.Vol)this.DealList.FieldColor.Vol=filed.Vol;if(filed.Time)this.DealList.FieldColor.Time=filed.Time;if(filed.Deal)this.DealList.FieldColor.Deal=filed.Deal;if(filed.Index)this.DealList.FieldColor.Index=filed.Index;if(filed.BarTitle)this.DealList.FieldColor.BarTitle=filed.BarTitle;if(filed.Text)this.DealList.FieldColor.Text=filed.Text;if(IFrameSplitOperator.IsNonEmptyArray(filed.Bar)){for(var i=0;i<filed.Bar.length;++i){this.DealList.FieldColor.Bar[i]=filed.Bar[i];}}}}if(style.Report)this.SetReportStyle(style.Report);if(style.TReport)this.SetTReportStyle(style.TReport);if(style.SelectedChart){var item=style.SelectedChart;if(IFrameSplitOperator.IsNumber(item.LineWidth))this.SelectedChart.LineWidth=item.LineWidth;if(IFrameSplitOperator.IsNumber(item.Radius))this.SelectedChart.Radius=item.Radius;if(IFrameSplitOperator.IsNumber(item.MinSpace))this.SelectedChart.MinSpace=item.MinSpace;if(item.LineColor)this.SelectedChart.LineColor=item.LineColor;if(item.LineColor)this.SelectedChart.BGColor=item.BGColor;}if(style.DragMovePaint){var item=style.DragMovePaint;if(item.TextColor)this.DragMovePaint.TextColor=item.TextColor;if(item.Font)this.DragMovePaint.Font=item.Font;}if(style.SessionBreaksPaint){var item=style.SessionBreaksPaint;if(IFrameSplitOperator.IsNonEmptyArray(item.BGColor))this.SessionBreaksPaint.BGColor=item.BGColor.slice();if(item.SplitLine){var subItem=item.SplitLine;if(subItem.Color)this.SessionBreaksPaint.SplitLine.Color=subItem.Color;if(IFrameSplitOperator.IsNumber(subItem.Width))this.SessionBreaksPaint.SplitLine.Width=subItem.Width;this.SessionBreaksPaint.SplitLine.Dash=subItem.Dash;}}if(IFrameSplitOperator.IsNumber(style.ToolbarButtonStyle))this.ToolbarButtonStyle=style.ToolbarButtonStyle;if(style.Buttons){var buttons=style.Buttons;T_SetButtonStyle(buttons.CloseOverlayIndex,this.Buttons.CloseOverlayIndex);T_SetButtonStyle(buttons.CloseWindow,this.Buttons.CloseWindow);T_SetButtonStyle(buttons.ChangeIndex,this.Buttons.ChangeIndex);T_SetButtonStyle(buttons.OverlayIndex,this.Buttons.OverlayIndex);T_SetButtonStyle(buttons.ModifyIndexParam,this.Buttons.ModifyIndexParam);T_SetButtonStyle(buttons.MaxMinWindow,this.Buttons.MaxMinWindow);T_SetButtonStyle(buttons.TitleWindow,this.Buttons.TitleWindow);T_SetButtonStyle(buttons.ExportData,this.Buttons.ExportData);}if(style.ChartDrawVolProfile){var item=style.ChartDrawVolProfile;if(item.UpVolColor)this.ChartDrawVolProfile.UpVolColor=item.UpVolColor;if(item.DownVolColor)this.ChartDrawVolProfile.DownVolColor=item.DownVolColor;if(item.AreaUpColor)this.ChartDrawVolProfile.AreaUpColor=item.AreaUpColor;if(item.AreaDonwColor)this.ChartDrawVolProfile.AreaDonwColor=item.AreaDonwColor;if(item.BGColor)this.ChartDrawVolProfile.BGColor=item.BGColor;if(item.BorderColor)this.ChartDrawVolProfile.BorderColor=item.BorderColor;if(item.VolLineColor)this.ChartDrawVolProfile.VolLineColor=item.VolLineColor;if(item.Text){if(item.Text.Color)this.ChartDrawVolProfile.Text.Color=item.Text.Color;if(item.Text.Family)this.ChartDrawVolProfile.Text.Family=item.Text.Family;if(IFrameSplitOperator.IsNumber(item.Text.FontMaxSize))this.ChartDrawVolProfile.Text.FontMaxSize=item.Text.FontMaxSize;if(IFrameSplitOperator.IsNumber(item.Text.FontMinSize))this.ChartDrawVolProfile.Text.FontMinSize=item.Text.FontMinSize;}}if(style.DisableLogo===true){if(this.FrameLogo)this.FrameLogo.Text=null;}if(style.ScrollBar){var item=style.ScrollBar;if(item.BorderColor)this.ScrollBar.BorderColor=item.BorderColor;if(item.XSplitTextFont)this.ScrollBar.XSplitTextFont=item.XSplitTextFont;if(item.XSplitTextColor)this.ScrollBar.XSplitTextColor=item.XSplitTextColor;if(item.XSplitLineColor)this.ScrollBar.XSplitLineColor=item.XSplitLineColor;if(item.Slider){var subItem=item.Slider;if(subItem.DateFont)this.ScrollBar.Slider.DateFont=subItem.DateFont;if(subItem.DateColor)this.ScrollBar.Slider.DateColor=subItem.DateColor;if(subItem.BarColor)this.ScrollBar.Slider.BarColor=subItem.BarColor;if(subItem.BarAreaColor)this.ScrollBar.Slider.BarAreaColor=subItem.BarAreaColor;if(IFrameSplitOperator.IsNumber(subItem.BarWidth))this.ScrollBar.Slider.BarWidth=subItem.BarWidth;if(IFrameSplitOperator.IsNumber(subItem.BarPadding))this.ScrollBar.Slider.BarPadding=subItem.BarPadding;if(IFrameSplitOperator.IsNumber(subItem.MinCenterWidth))this.ScrollBar.Slider.MinCenterWidth=subItem.MinCenterWidth;}if(item.BGChart){var subItem=item.BGChart;if(subItem.Color)this.ScrollBar.BGChart.Color=subItem.Color;if(subItem.AreaColor)this.ScrollBar.BGChart.AreaColor=subItem.AreaColor;if(IFrameSplitOperator.IsPlusNumber(subItem.LineWidth))this.ScrollBar.BGChart.LineWidth=subItem.LineWidth;}}if(style.FrameButtomToolbar)this.SetFrameButtomToolbar(style.FrameButtomToolbar);};this.SetReportStyle=function(style){var item=style;var dest=this.Report;if(item.BorderColor)this.Report.BorderColor=item.BorderColor;if(item.UpTextColor)this.Report.UpTextColor=item.UpTextColor;if(item.DownTextColor)this.Report.DownTextColor=item.DownTextColor;if(item.UnchagneTextColor)this.Report.UnchagneTextColor=item.UnchagneTextColor;if(item.BorderColor)this.Report.SelectedColor=item.SelectedColor;if(item.CloseLine){var closeLine=item.CloseLine;if(closeLine.CloseColor)this.Report.CloseLine.CloseColor=closeLine.CloseColor;if(closeLine.YCloseColor)this.Report.CloseLine.YCloseColor=closeLine.YCloseColor;if(closeLine.AreaColor)this.Report.CloseLine.AreaColor=closeLine.AreaColor;}if(item.KLine){var kline=item.KLine;if(kline.UpColor)this.Report.KLine.UpColor=kline.UpColor;if(kline.DownColor)this.Report.KLine.DownColor=kline.DownColor;if(kline.UnchagneColor)this.Report.KLine.UnchagneColor=kline.UnchagneColor;if(IFrameSplitOperator.IsNumber(kline.DataWidth))this.Report.KLine.DataWidth=kline.DataWidth;if(IFrameSplitOperator.IsNumber(kline.DistanceWidth))this.Report.KLine.DistanceWidth=kline.DistanceWidth;}if(item.Header){var header=item.Header;if(header.Color)this.Report.Header.Color=header.Color;if(header.SortColor)this.Report.Header.SortColor=header.SortColor;if(header.Mergin){var mergin=header.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.Header.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.Header.Mergin.Left=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.Header.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.Header.Mergin.Bottom=mergin.Bottom;}if(header.Font){var font=header.Font;if(font.Name)this.Report.Header.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Header.Font.Size=font.Size;}}if(item.Item){var row=item.Item;if(row.Mergin){var mergin=row.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.Item.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.Item.Mergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.Item.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.Item.Mergin.Bottom=mergin.Bottom;}if(row.Font){var font=row.Font;if(font.Name)this.Report.Item.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Item.Font.Size=font.Size;}if(row.BarMergin){var mergin=row.BarMergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.Item.BarMergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.Item.BarMergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.Item.BarMergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.Item.BarMergin.Bottom=mergin.Bottom;}if(row.NameFont){var font=row.NameFont;if(font.Name)this.Report.Item.NameFont.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Item.NameFont.Size=font.Size;}if(row.SymbolFont){var font=row.SymbolFont;if(font.Name)this.Report.Item.SymbolFont.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Item.SymbolFont.Size=font.Size;}}if(item.FixedItem){var row=item.FixedItem;if(row.Font){var font=row.Font;if(font.Name)this.Report.FixedItem.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.FixedItem.Font.Size=font.Size;}}if(item.LimitBorder){var limit=item.LimitBorder;if(limit.Color)this.Report.LimitBorder.Color=limit.Color;if(limit.Mergin){var mergin=limit.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.LimitBorder.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.LimitBorder.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.LimitBorder.Mergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.LimitBorder.Mergin.Bottom=mergin.Bottom;}}if(item.LimitColor){var limit=item.LimitColor;if(limit.UpColor)this.Report.LimitColor.UpColor=limit.UpColor;if(limit.DownColor)this.Report.LimitColor.DownColor=limit.DownColor;if(limit.TextColor)this.Report.LimitColor.UpColor=limit.TextColor;}if(item.FieldColor){var filed=item.FieldColor;if(filed.Name)this.Report.FieldColor.Name=filed.Name;if(filed.Symbol)this.Report.FieldColor.Symbol=filed.Symbol;if(filed.Vol)this.Report.FieldColor.Vol=filed.Vol;if(filed.Amount)this.Report.FieldColor.Amount=filed.Amount;if(filed.Index)this.Report.FieldColor.Index=filed.Index;if(filed.BarTitle)this.Report.FieldColor.BarTitle=filed.BarTitle;if(filed.Text)this.Report.FieldColor.Text=filed.Text;if(IFrameSplitOperator.IsNonEmptyArray(filed.Bar)){for(var i=0;i<filed.Bar.length;++i){this.Report.FieldColor.Bar[i]=filed.Bar[i];}}}if(item.Tab){var tab=item.Tab;if(tab.Font){var font=tab.Font;if(font.Name)this.Report.Tab.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.Tab.Font.Size=font.Size;}if(IFrameSplitOperator.IsNumber(tab.ScrollBarWidth))this.Report.Tab.ScrollBarWidth=tab.ScrollBarWidth;if(tab.ButtonColor)this.Report.Tab.ButtonColor=tab.ButtonColor;if(tab.BarColor)this.Report.Tab.BarColor=tab.BarColor;if(tab.BorderColor)this.Report.Tab.BorderColor=tab.BorderColor;if(tab.TabTitleColor)this.Report.Tab.TabTitleColor=tab.TabTitleColor;if(tab.TabSelectedTitleColor)this.Report.Tab.TabSelectedTitleColor=tab.TabSelectedTitleColor;if(tab.TabSelectedBGColor)this.Report.Tab.TabSelectedBGColor=tab.TabSelectedBGColor;if(tab.TabMoveOnTitleColor)this.Report.Tab.TabMoveOnTitleColor=tab.TabMoveOnTitleColor;if(tab.TabBGColor)this.Report.Tab.TabBGColor=tab.TabBGColor;}if(item.PageInfo){var pageinfo=item.PageInfo;if(pageinfo.Font){var font=pageinfo.Font;if(font.Name)this.Report.PageInfo.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))this.Report.PageInfo.Font.Size=font.Size;}if(pageinfo.TextColor)this.Report.PageInfo.TextColor=pageinfo.TextColor;if(pageinfo.BGColor)this.Report.PageInfo.BGColor=pageinfo.BGColor;if(pageinfo.Mergin){var mergin=pageinfo.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))this.Report.PageInfo.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Top))this.Report.PageInfo.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Right))this.Report.PageInfo.Mergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Bottom))this.Report.PageInfo.Mergin.Bottom=mergin.Bottom;}}if(item.DragRow){var dragRow=item.DragRow;if(dragRow.Color)this.Report.DragRow.Color=dragRow.Color;if(dragRow.TextColor)this.Report.DragRow.TextColor=dragRow.TextColor;if(dragRow.MoveRowColor)this.Report.DragRow.MoveRowColor=dragRow.MoveRowColor;if(dragRow.SrcRowColor)this.Report.DragRow.SrcRowColor=dragRow.SrcRowColor;}if(item.VScrollbar){var subItem=item.VScrollbar;if(IFrameSplitOperator.IsNumber(subItem.ScrollBarHeight))dest.VScrollbar.ScrollBarHeight=subItem.ScrollBarHeight;if(subItem.ButtonColor)dest.VScrollbar.ButtonColor=subItem.ButtonColor;if(subItem.BarColor)dest.VScrollbar.BarColor=subItem.BarColor;if(subItem.BorderColor)dest.VScrollbar.BorderColor=subItem.BorderColor;if(subItem.BGColor)dest.VScrollbar.BGColor=subItem.BGColor;}};this.SetTReportStyle=function(style){var item=style;var dest=this.TReport;if(item.BorderColor)dest.BorderColor=item.BorderColor;if(item.UpTextColor)dest.UpTextColor=item.UpTextColor;if(item.DownTextColor)dest.DownTextColor=item.DownTextColor;if(item.UnchangeTextColor)dest.UnchangeTextColor=item.UnchangeTextColor;if(item.BorderColor)dest.SelectedColor=item.SelectedColor;if(item.UpBGColor)dest.UpBGColor=item.UpBGColor;if(item.DownBGColor)dest.DownBGColor=item.DownBGColor;if(item.Header){var header=item.Header;if(header.Color)dest.Header.Color=header.Color;if(header.SortColor)dest.Header.SortColor=header.SortColor;if(header.Mergin){var mergin=header.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))dest.Header.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))dest.Header.Mergin.Left=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))dest.Header.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))dest.Header.Mergin.Bottom=mergin.Bottom;}if(header.Font){var font=header.Font;if(font.Name)dest.Header.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))dest.Header.Font.Size=font.Size;}}if(item.CenterItem){var cell=item.CenterItem;if(cell.TextColor)dest.CenterItem.TextColor=cell.TextColor;if(cell.BaseTextColor)dest.CenterItem.BaseTextColor=cell.BaseTextColor;if(cell.BGColor)dest.CenterItem.BGColor=cell.BGColor;}if(item.Item){var row=item.Item;if(row.Mergin){var mergin=row.Mergin;if(IFrameSplitOperator.IsNumber(mergin.Left))dest.Item.Mergin.Left=mergin.Left;if(IFrameSplitOperator.IsNumber(mergin.Right))dest.Item.Mergin.Right=mergin.Right;if(IFrameSplitOperator.IsNumber(mergin.Top))dest.Item.Mergin.Top=mergin.Top;if(IFrameSplitOperator.IsNumber(mergin.Bottom))dest.Item.Mergin.Bottom=mergin.Bottom;}if(row.Font){var font=row.Font;if(font.Name)dest.Item.Font.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))dest.Item.Font.Size=font.Size;}if(row.NameFont){var font=row.NameFont;if(font.Name)dest.Item.NameFont.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))dest.Item.NameFont.Size=font.Size;}if(row.SymbolFont){var font=row.SymbolFont;if(font.Name)dest.Item.SymbolFont.Name=font.Name;if(IFrameSplitOperator.IsNumber(font.Size))dest.Item.SymbolFont.Size=font.Size;}}if(item.FieldColor){var filed=item.FieldColor;if(filed.Name)dest.FieldColor.Name=filed.Name;if(filed.Symbol)dest.FieldColor.Symbol=filed.Symbol;if(filed.Vol)dest.FieldColor.Vol=filed.Vol;if(filed.Amount)dest.FieldColor.Amount=filed.Amount;if(filed.Index)dest.FieldColor.Index=filed.Index;if(filed.Text)dest.FieldColor.Text=filed.Text;if(filed.Position)dest.FieldColor.Position=filed.Position;}if(item.MarkBorder){var subIem=item.MarkBorder;if(subIem.MaxPositionColor)dest.MarkBorder.MaxPositionColor=subIem.MaxPositionColor;}};this.SetFrameButtomToolbar=function(style){var dest=this.FrameButtomToolbar;if(style.BGColor)dest.BGColor=style.BGColor;if(style.BorderColor)dest.BorderColor=style.BorderColor;if(style.Button){var button=style.Button;if(button.BorderColor)dest.Button.BorderColor=button.BorderColor;if(button.Font){var item=button.Font;var destItem=this.FrameButtomToolbar.Button.Font;if(item.Family)destItem.Family=item.Family;if(IFrameSplitOperator.IsNumber(item.Size))destItem.Size=item.Size;}if(button.TitleColor){var item=button.TitleColor;var destItem=this.FrameButtomToolbar.Button.TitleColor;if(item.Selected)destItem.Selected=item.Selected;if(item.Default)destItem.Default=item.Default;if(item.MoveOn)destItem.MoveOn=item.MoveOn;}if(button.BGColor){var item=button.BGColor;var destItem=this.FrameButtomToolbar.Button.BGColor;if(item.Selected)destItem.Selected=item.Selected;if(item.Default)destItem.Default=item.Default;if(item.MoveOn)destItem.MoveOn=item.MoveOn;}if(button.Mergin){var item=button.Mergin;var destItem=this.FrameButtomToolbar.Button.Mergin;if(IFrameSplitOperator.IsNumber(item.Left))destItem.Left=item.Left;if(IFrameSplitOperator.IsNumber(item.Right))destItem.Left=item.Right;if(IFrameSplitOperator.IsNumber(item.Top))destItem.Top=item.Top;if(IFrameSplitOperator.IsNumber(item.Bottom))destItem.Bottom=item.Bottom;}if(button.SVG){var item=button.SVG;var destItem=this.FrameButtomToolbar.Button.SVG;if(IFrameSplitOperator.IsNumber(item.Size))destItem.Size=item.Size;if(IFrameSplitOperator.IsNumber(item.MerginLeft))destItem.MerginLeft=item.MerginLeft;if(item.Family)destItem.Family=item.Family;}}};}var g_JSChartResource=new JSChartResource();/////////////////////////////////////////////////////////////////////////////////
|
|
6687
6724
|
//
|
|
6688
6725
|
//
|
|
6689
6726
|
//
|
|
@@ -6878,21 +6915,21 @@ this.ChartOperator_Temp_GetHistroyData=function(){var hisData=null;if(!this.Fram
|
|
|
6878
6915
|
return hisData;};this.ChartOperator_Temp_Update=function(){this.UpdataDataoffset();//更新数据偏移
|
|
6879
6916
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
6880
6917
|
this.ResetFrameXSplit();this.Frame.SetSizeChage(true);this.Draw();this.UpdatePointByCursorIndex();//更新十字光标位子
|
|
6881
|
-
};this.OnWheel=function(e){var
|
|
6918
|
+
};this.OnWheel=function(e){var _this16=this;JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var isInClient=false;this.Canvas.beginPath();this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());isInClient=this.Canvas.isPointInPath(x,y);var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var enableZoomUpDown=true;//是否允许缩放
|
|
6882
6919
|
if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Wheel===false)enableZoomUpDown=false;if(this.SourceData&&this.SourceData.Data){if(isInClient&&wheelValue<0&&enableZoomUpDown)//缩小
|
|
6883
|
-
{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){
|
|
6920
|
+
{var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){_this16.ZoomDownloadData(requestData);}})){this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.ResetFrameXSplit();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true){}else{this.Draw();}this.OnKLinePageChange("wheel");}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
|
|
6884
6921
|
{var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomUp(cursorIndex)){JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex);this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.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轴
|
|
6885
6922
|
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;//只能两边缩放
|
|
6886
6923
|
if(!this.Frame.OnZoomUpDownFrameY(dragY,yMove))return false;this.Frame.SetSizeChage(true);this.Draw();return true;};//创建
|
|
6887
6924
|
//windowCount 窗口个数
|
|
6888
|
-
this.Create=function(windowCount,option){var
|
|
6889
|
-
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return
|
|
6925
|
+
this.Create=function(windowCount,option){var _this17=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
6926
|
+
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this17.GetEventCallback(id);};this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this17.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ExtendChartPaint=this.ExtendChartPaint;//创建等待提示
|
|
6890
6927
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
6891
|
-
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
|
|
6928
|
+
this.Frame=new HQTradeFrame();this.Frame.ChartBorder=new ChartBorder();this.Frame.ChartBorder.UIElement=this.UIElement;this.Frame.ChartBorder.Top=30;this.Frame.ChartBorder.Left=5;this.Frame.ChartBorder.Bottom=20;this.Frame.Canvas=this.Canvas;this.Frame.GetExtendChartRightWidth=function(){return _this17.GetExtendChartRightWidth();};this.Frame.GetExtendChartByClassName=function(name){return _this17.GetExtendChartByClassName(name);};this.Frame.GetEventCallback=function(id){return _this17.GetEventCallback(id);};this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
|
|
6892
6929
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();this.CreateExtendChart("RectSelectPaint",option?option.SelectRect:null);//区间统计
|
|
6893
6930
|
if(this.EnableIndexChartDrag)this.CreateExtendChart("DragMovePaint");//子窗口动态标题
|
|
6894
|
-
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
|
|
6895
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
6931
|
+
for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this17.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;var bRegisterKeydown=true;var bRegisterWheel=true;if(option&&option.Listener){var item=option.Listener;if(item.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[KLineChartContainer::Create] not register keydown event.');}if(item.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[KLineChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this17.OnKeyDown(e);},true);//键盘消息
|
|
6932
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this17.OnWheel(e);},true);//上下滚动消息
|
|
6896
6933
|
};this.OnCustomKeyDown=function(keyID,e)//自定义键盘事件
|
|
6897
6934
|
{if(keyID==37&&e.ctrlKey)//Ctrl+Left
|
|
6898
6935
|
{this.MoveCorssCursorLeft(this.CtrlMoveStep);return true;}else if(keyID==39&&e.ctrlKey)//Ctrl+Right
|
|
@@ -6905,18 +6942,18 @@ if(this.CursorIndex+step+data.DataOffset+1>data.Data.length)//数据不够步长
|
|
|
6905
6942
|
{step=data.Data.length-1-data.DataOffset-this.CursorIndex;bMoveEnd=true;}if(this.CursorIndex+step>=xPointcount)//当前屏最右边了
|
|
6906
6943
|
{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线图实例
|
|
6907
6944
|
this.GetKLineChart=function(){if(!this.ChartPaint[0])return null;return this.ChartPaint[0];};//创建子窗口
|
|
6908
|
-
this.CreateChildWindow=function(windowCount){var
|
|
6945
|
+
this.CreateChildWindow=function(windowCount){var _this18=this;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=g_ChartFrameFactory.Create("KLineFrame",{ID:i});frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;//窗口序号
|
|
6909
6946
|
frame.RightSpaceCount=this.RightSpaceCount;//右边
|
|
6910
|
-
frame.GetEventCallback=function(id){return
|
|
6911
|
-
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;if(i==0){frame.YSplitOperator=new FrameSplitKLinePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return
|
|
6947
|
+
frame.GetEventCallback=function(id){return _this18.GetEventCallback(id);};frame.GlobalOption=this.GlobalOption;if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
|
|
6948
|
+
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;if(i==0){frame.YSplitOperator=new FrameSplitKLinePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this18.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this18.GetKLineChart();};frame.YSplitOperator.HQChart=this;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
6912
6949
|
border.BottomSpace=15*pixelTatio;//主图上下留空间
|
|
6913
|
-
border.TopSpace=15*pixelTatio;frame.GetEventCallback=function(id){return
|
|
6914
|
-
}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
|
|
6915
|
-
frame.GetEventCallback=function(id){return
|
|
6916
|
-
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitKLineX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.ShowText=false;frame.XSplitOperator.GetEventCallback=function(id){return
|
|
6950
|
+
border.TopSpace=15*pixelTatio;frame.GetEventCallback=function(id){return _this18.GetEventCallback(id);};}else{frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.GetEventCallback=function(id){return _this18.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this18.GetKLineChart();};frame.YSplitOperator.HQChart=this;//frame.IsLocked = true;
|
|
6951
|
+
}frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitKLineX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.LanguageID=this.LanguageID;frame.XSplitOperator.GetEventCallback=function(id){return _this18.GetEventCallback(id);};if(i!=windowCount-1)frame.XSplitOperator.ShowText=false;for(var j=frame.HorizontalMin;j<=frame.HorizontalMax;j+=1){frame.HorizontalInfo[j]=new CoordinateInfo();frame.HorizontalInfo[j].Value=j;if(i==0&&j==frame.HorizontalMin)continue;frame.HorizontalInfo[j].Message[1]=j.toString();frame.HorizontalInfo[j].Font="14px 微软雅黑";}var subFrame=new SubFrameItem();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 _this19=this;var border=new ChartBorder();border.UIElement=this.UIElement;var frameClassName="KLineFrame";if(this.ClassName=="KLineChartHScreenContainer")frameClassName="KLineHScreenFrame";var frame=g_ChartFrameFactory.Create(frameClassName,{ID:id});frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=id;//窗口序号
|
|
6952
|
+
frame.GetEventCallback=function(id){return _this19.GetEventCallback(id);};frame.GlobalOption=this.GlobalOption;if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
|
|
6953
|
+
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitKLineX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.ShowText=false;frame.XSplitOperator.GetEventCallback=function(id){return _this19.GetEventCallback(id);};frame.YSplitOperator.GetEventCallback=function(id){return _this19.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this19.GetKLineChart();};frame.YSplitOperator.HQChart=this;frame.XSplitOperator.Symbol=this.Symbol;frame.XSplitOperator.Period=this.Period;//K线数据绑定
|
|
6917
6954
|
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线画法
|
|
6918
|
-
this.CreateMainKLine=function(){var
|
|
6919
|
-
this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].HQChart=this;this.TitlePaint[0].GetEventCallback=function(id){return
|
|
6955
|
+
this.CreateMainKLine=function(){var _this20=this;var kline=g_ChartPaintFactory.Create("ChartKLine");kline.Canvas=this.Canvas;kline.ChartBorder=this.Frame.SubFrame[0].Frame.ChartBorder;kline.ChartFrame=this.Frame.SubFrame[0].Frame;kline.Name="Main-KLine";kline.DrawType=this.KLineDrawType;kline.Identify="Main-KLine";kline.GetEventCallback=function(id){return _this20.GetEventCallback(id);};this.ChartPaint[0]=kline;this.TitlePaint[0]=new DynamicKLineTitlePainting();this.TitlePaint[0].Frame=this.Frame.SubFrame[0].Frame;this.TitlePaint[0].Canvas=this.Canvas;this.TitlePaint[0].OverlayChartPaint=this.OverlayChartPaint;//绑定叠加
|
|
6956
|
+
this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].HQChart=this;this.TitlePaint[0].GetEventCallback=function(id){return _this20.GetEventCallback(id);};};//绑定主图K线数据
|
|
6920
6957
|
this.BindMainData=function(hisData,showCount){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;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;//动态标题
|
|
6921
6958
|
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;//十字光标
|
|
6922
6959
|
this.Frame.Data=this.ChartPaint[0].Data;for(var i=0;i<this.OverlayChartPaint.length;++i)//K线叠加 主图股票数据绑定到叠加上
|
|
@@ -7276,15 +7313,15 @@ this.Draw();};this.AddOverlayIndex=function(obj){var overlay=this.CreateOverlayW
|
|
|
7276
7313
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7277
7314
|
this.Draw();};//创建一个叠加指标
|
|
7278
7315
|
this.CreateOverlayWindowsIndex=function(obj)// {WindowIndex:, IndexName:, Identify:, ShowRightText:, API:}
|
|
7279
|
-
{var
|
|
7316
|
+
{var _this21=this;var indexName=obj.IndexName;var windowIndex=obj.WindowIndex;var apiItem=null,indexInfo=null,indexCustom=null;if(obj.API){apiItem=obj.API;}else if(obj.Script)//动态执行脚本
|
|
7280
7317
|
{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);//系统指标
|
|
7281
7318
|
if(!indexInfo){indexCustom=JSIndexMap.Get(indexName);//定制指标
|
|
7282
7319
|
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
|
|
7283
7320
|
//var frame= this.ClassName==='KLineChartHScreenContainer' ? new OverlayKLineHScreenFrame() : new OverlayKLineFrame();
|
|
7284
|
-
var frame=this.CreateOverlayFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GetEventCallback=function(id){return
|
|
7321
|
+
var frame=this.CreateOverlayFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GetEventCallback=function(id){return _this21.GetEventCallback(id);};if(obj.ShowRightText===true)frame.IsShow=true;else if(obj.ShowRightText===false)frame.IsShow=false;if(IFrameSplitOperator.IsBool(obj.ShowToolbar))frame.IsShowToolbar=obj.ShowToolbar;//废弃
|
|
7285
7322
|
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;
|
|
7286
7323
|
if(IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin))frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin;//是否计算Y最大最小值
|
|
7287
|
-
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
|
|
7324
|
+
frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this21.GetEventCallback(id);};frame.YSplitOperator.GetKLineChartCallback=function(){return _this21.GetKLineChart();};frame.YSplitOperator.OverlayIndex=overlayFrame;frame.YSplitOperator.HQChart=this;frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;if(obj.Frame){var item=obj.Frame;if(item.Custom)frame.YSplitOperator.Custom=item.Custom;if(IFrameSplitOperator.IsBool(item.IsYDrawMainFrame))frame.IsYDrawMainFrame=item.IsYDrawMainFrame;//自定义刻度绘制在主图上
|
|
7288
7325
|
if(IFrameSplitOperator.IsBool(item.IsShowToolbar))frame.IsShowToolbar=item.IsShowToolbar;//是否显示工具栏
|
|
7289
7326
|
}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};//叠加指标信息
|
|
7290
7327
|
overlayFrame.Script=apiIndex;}else if(indexInfo){JSIndexScript.ModifyAttribute(indexInfo,obj);var scriptIndex=new OverlayScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
|
|
@@ -7305,10 +7342,10 @@ this.ChangeCoordinateType=function(obj){if(!this.Frame)return;if(!IFrameSplitOpe
|
|
|
7305
7342
|
{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;}//请求缓存的最大最小值
|
|
7306
7343
|
frame.YMaxMin.Max=null;frame.YMaxMin.Min=null;this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7307
7344
|
this.Frame.SetSizeChage(true);this.Draw();};//设置指标窗口个数
|
|
7308
|
-
this.ChangeIndexWindowCount=function(count,option){var
|
|
7345
|
+
this.ChangeIndexWindowCount=function(count,option){var _this22=this;if(count<=0)return;if(this.Frame.SubFrame.length==count)return;this.Frame.RestoreIndexWindows();var currentLength=this.Frame.SubFrame.length;if(currentLength>count){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);for(var i=currentLength-1;i>=count;--i){this.DeleteIndexPaint(i);this.Frame.SubFrame[i].Frame.ClearToolbar();if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}this.Frame.SubFrame.splice(count,currentLength-count);this.WindowIndex.splice(count,currentLength-count);this.TitlePaint.splice(count+1,currentLength-count);//最后一个显示X轴坐标
|
|
7309
7346
|
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();//调整坐标最大 最小值
|
|
7310
7347
|
this.Draw();}else{//创建新的指标窗口
|
|
7311
|
-
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
|
|
7348
|
+
var pixelRatio=GetDevicePixelRatio();for(var i=currentLength;i<count;++i){var subFrame=this.CreateSubFrameItem(i);subFrame.Frame.ChartBorder.TitleHeight*=pixelRatio;this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this22.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}//最后一个显示X轴坐标
|
|
7312
7349
|
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();//调整坐标最大 最小值
|
|
7313
7350
|
this.Draw();//创建指标
|
|
7314
7351
|
var indexName=[{Index:"RSI"},{Index:"MACD"},{Index:"VOL"},{Index:"UOS"},{Index:"CHO"},{Index:"BRAR"}];//增加的指标名字
|
|
@@ -7320,11 +7357,11 @@ var subFrame=this.Frame.SubFrame[i];if(item.Modify!=null)this.Frame.SubFrame[i].
|
|
|
7320
7357
|
}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);//执行脚本
|
|
7321
7358
|
}//this.UpdataDataoffset(); //更新数据偏移
|
|
7322
7359
|
}};this.ChangeIndexTemplate=function(option)//切换指标模板 可以设置指标窗口个数 每个窗口的指标
|
|
7323
|
-
{var
|
|
7360
|
+
{var _this23=this;if(!option.Windows)return;var count=option.Windows.length;if(count<=0)return;var currentLength=this.Frame.SubFrame.length;var period=null,right=null,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;//周期
|
|
7324
7361
|
if(IFrameSplitOperator.IsNumber(option.KLine.Right)&&option.KLine.Right!=this.Right)right=option.KLine.Right;//复权
|
|
7325
7362
|
}var bRefreshData=period!=null||right!=null||symbol!=null;//清空所有的指标图型
|
|
7326
7363
|
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)//创建新的指标窗口
|
|
7327
|
-
{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
|
|
7364
|
+
{var subFrame=this.CreateSubFrameItem(i);this.Frame.SubFrame[i]=subFrame;var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this23.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}}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);//清空叠加指标
|
|
7328
7365
|
if(item.Script)//自定义指标脚本
|
|
7329
7366
|
{this.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
|
|
7330
7367
|
}else if(item.API)//后台指标
|
|
@@ -7389,24 +7426,24 @@ this.ClearKLineInfo=function(){if(!this.ChartInfo||this.ChartInfo.length<=0)retu
|
|
|
7389
7426
|
this.OverlaySymbol=function(symbol,option){for(var i in this.OverlayChartPaint){var item=this.OverlayChartPaint[i];if(item.Symbol===symbol){console.warn('[KLineChartContainer::OverlaySymbol] overlay symbol='+symbol+' exist.');return false;}}var paint=new ChartOverlayKLine();paint.Canvas=this.Canvas;paint.ChartBorder=this.Frame.SubFrame[0].Frame.ChartBorder;paint.ChartFrame=this.Frame.SubFrame[0].Frame;paint.Name="Overlay-KLine";paint.DrawType=this.KLineDrawType;paint.Symbol=symbol;paint.Identify='Overlay-KLine-'+symbol;if(option&&option.Color)paint.Color=option.Color;else paint.Color=g_JSChartResource.OverlaySymbol.Color[g_JSChartResource.OverlaySymbol.Random%g_JSChartResource.OverlaySymbol.Color.length];paint.SetOption(option);++g_JSChartResource.OverlaySymbol.Random;if(this.ChartPaint[0]&&this.ChartPaint[0].Data&&this.SourceData)paint.MainData=this.ChartPaint[0].Data;//绑定主图数据
|
|
7390
7427
|
this.OverlayChartPaint.push(paint);if(ChartData.IsDayPeriod(this.Period,true))this.RequestOverlayHistoryData();//请求日线数据
|
|
7391
7428
|
else if(ChartData.IsMinutePeriod(this.Period,true))this.RequestOverlayHistoryMinuteData();//请求分钟历史数据
|
|
7392
|
-
return true;};this.RequestOverlayHistoryData=function(){var
|
|
7393
|
-
var self=this;var dataCount=this.GetRequestDataCount();var firstDate=this.SourceData.Data[0].Date;var _loop2=function _loop2(){var item=
|
|
7394
|
-
if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';var symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(
|
|
7395
|
-
Explain:'叠加股票日K线数据',Request:{Url:self.KLineApiUrl,Data:{symbol:symbol,count:dataCount.MaxRequestDataCount,"first":{date:firstDate},field:["name","symbol","yclose","open","price","high",'vol','amount']},Type:'POST'},Self:
|
|
7429
|
+
return true;};this.RequestOverlayHistoryData=function(){var _this24=this;if(!this.OverlayChartPaint.length)return;if(!this.SourceData||!this.SourceData.Data)return;//主图数据还没有到完
|
|
7430
|
+
var self=this;var dataCount=this.GetRequestDataCount();var firstDate=this.SourceData.Data[0].Date;var _loop2=function _loop2(){var item=_this24.OverlayChartPaint[i];if(!item.MainData)return'continue';//等待主图股票数据未下载完
|
|
7431
|
+
if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';var symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this24.NetworkFilter){obj={Name:'KLineChartContainer::RequestOverlayHistoryData',//类名::
|
|
7432
|
+
Explain:'叠加股票日K线数据',Request:{Url:self.KLineApiUrl,Data:{symbol:symbol,count:dataCount.MaxRequestDataCount,"first":{date:firstDate},field:["name","symbol","yclose","open","price","high",'vol','amount']},Type:'POST'},Self:_this24,PreventDefault:false};_this24.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayHistoryData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
|
|
7396
7433
|
}//请求数据
|
|
7397
|
-
JSNetwork.HttpRequest({url:
|
|
7434
|
+
JSNetwork.HttpRequest({url:_this24.KLineApiUrl,data:{"field":["name","symbol","yclose","open","price","high"],"symbol":symbol,"start":-1,"count":dataCount.MaxRequestDataCount},type:"post",dataType:"json",async:true,success:function success(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOverlayHistoryData(data,item);}});};for(var i=0;i<this.OverlayChartPaint.length;++i){var obj;var _ret2=_loop2();if(_ret2==='continue')continue;}};this.RecvOverlayHistoryData=function(data,paint){if(paint.IsDelete)return;var aryDayData=KLineChartContainer.JsonDataToHistoryData(data);//原始叠加数据
|
|
7398
7435
|
var sourceData=new ChartData();sourceData.Data=aryDayData;sourceData.DataType=0;var bindData=new ChartData();bindData.Data=aryDayData;bindData.Period=this.Period;bindData.Right=this.Right;bindData.DataType=0;if(bindData.Right>0&&MARKET_SUFFIX_NAME.IsSHSZStockA(data.symbol)&&!this.IsApiPeriod)//复权数据 ,A股才有有复权
|
|
7399
7436
|
{var rightData=bindData.GetRightData(bindData.Right,{AlgorithmType:this.RightFormula});bindData.Data=rightData;}var aryOverlayData=this.SourceData.GetOverlayData(bindData.Data,this.IsApiPeriod);//和主图数据拟合以后的数据
|
|
7400
7437
|
bindData.Data=aryOverlayData;if(ChartData.IsDayPeriod(bindData.Period,false)&&!this.IsApiPeriod)//周期数据
|
|
7401
7438
|
{var periodData=bindData.GetPeriodData(bindData.Period);bindData.Data=periodData;}paint.Data=bindData;paint.SourceData=sourceData;paint.Title=data.name;paint.Symbol=data.symbol;paint.Status=OVERLAY_STATUS_ID.STATUS_FINISHED_ID;this.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType=1;//调整为百份比坐标
|
|
7402
7439
|
this.UpdataDataoffset();//更新数据偏移
|
|
7403
7440
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7404
|
-
this.Frame.SetSizeChage(true);this.Draw();};this.RequestOverlayHistoryMinuteData=function(){var
|
|
7405
|
-
var self=this;var dataCount=this.GetRequestDataCount();var firstDate=this.SourceData.Data[0].Date;var firstTime=this.SourceData.Data[0].Time;var _loop3=function _loop3(){var item=
|
|
7406
|
-
if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';var symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(
|
|
7407
|
-
Explain:'叠加股票分钟K线数据',Request:{Url:self.MinuteKLineApiUrl,Data:{symbol:symbol,count:dataCount.MaxRequestMinuteDayCount,"first":{date:firstDate,time:firstTime},field:["name","symbol","yclose","open","price","high",'vol','amount']},Type:'POST'},Self:
|
|
7441
|
+
this.Frame.SetSizeChage(true);this.Draw();};this.RequestOverlayHistoryMinuteData=function(){var _this25=this;if(!this.OverlayChartPaint.length)return;if(!this.SourceData||!this.SourceData.Data)return;//主图数据还没有到完
|
|
7442
|
+
var self=this;var dataCount=this.GetRequestDataCount();var firstDate=this.SourceData.Data[0].Date;var firstTime=this.SourceData.Data[0].Time;var _loop3=function _loop3(){var item=_this25.OverlayChartPaint[i];if(!item.MainData)return'continue';//等待主图股票数据未下载完
|
|
7443
|
+
if(item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID)return'continue';var symbol=item.Symbol;if(!symbol)return'continue';item.Status=OVERLAY_STATUS_ID.STATUS_REQUESTDATA_ID;if(_this25.NetworkFilter){obj={Name:'KLineChartContainer::RequestOverlayHistoryMinuteData',//类名::
|
|
7444
|
+
Explain:'叠加股票分钟K线数据',Request:{Url:self.MinuteKLineApiUrl,Data:{symbol:symbol,count:dataCount.MaxRequestMinuteDayCount,"first":{date:firstDate,time:firstTime},field:["name","symbol","yclose","open","price","high",'vol','amount']},Type:'POST'},Self:_this25,PreventDefault:false};_this25.NetworkFilter(obj,function(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOveralyHistoryMinuteData(data,item);});if(obj.PreventDefault==true)return'continue';//已被上层替换,不调用默认的网络请求
|
|
7408
7445
|
}//请求数据
|
|
7409
|
-
JSNetwork.HttpRequest({url:
|
|
7446
|
+
JSNetwork.HttpRequest({url:_this25.MinuteKLineApiUrl,data:{"field":["name","symbol","yclose","open","price","high",'vol','amount'],"symbol":symbol,"start":-1,"count":dataCount.MaxRequestMinuteDayCount},type:"post",dataType:"json",async:true,success:function success(data){item.Status=OVERLAY_STATUS_ID.STATUS_RECVDATA_ID;self.RecvOveralyHistoryMinuteData(data,item);}});};for(var i=0;i<this.OverlayChartPaint.length;++i){var obj;var _ret3=_loop3();if(_ret3==='continue')continue;}};this.RecvOveralyHistoryMinuteData=function(data,paint){if(this.EnableVerifyRecvData&&data.symbol!=paint.Symbol){JSConsole.Chart.Warn('[MinuteChartContainer::RecvOveralyHistoryMinuteData] recv data symbol not match. paint['+paint.Symbol+'] , Recv['+data.symbol+']');return;}var aryDayData=KLineChartContainer.JsonDataToMinuteHistoryData(data);if(!aryDayData)return;//原始叠加数据
|
|
7410
7447
|
var sourceData=new ChartData();sourceData.Data=aryDayData;sourceData.DataType=1;//0=日线数据 1=分钟数据
|
|
7411
7448
|
var bindData=new ChartData();bindData.Data=aryDayData;bindData.Period=this.Period;bindData.Right=this.Right;bindData.DataType=1;var aryOverlayData=this.SourceData.GetOverlayMinuteData(bindData.Data,this.IsApiPeriod);//和主图数据拟合以后的数据
|
|
7412
7449
|
bindData.Data=aryOverlayData;if(ChartData.IsMinutePeriod(bindData.Period,false)&&!this.IsApiPeriod)//周期数据, API周期数据不用计算
|
|
@@ -7447,8 +7484,18 @@ if(isPhone)pixelTatio=1;var xStep=x*pixelTatio;var yStep=y*pixelTatio;//JSConsol
|
|
|
7447
7484
|
drawPicture.Move(xStep,yStep,drag);return true;};//数据长度变化 需要更新画图工具X轴索引
|
|
7448
7485
|
this.UpdateChartDrawXValue=function(){for(var i in this.ChartDrawPicture){var item=this.ChartDrawPicture[i];item.UpdateXValue();}};//注册鼠标右键事件
|
|
7449
7486
|
this.OnRightMenu=function(x,y,e){var pixelTatio=GetDevicePixelRatio();//x,y 需要乘以放大倍速
|
|
7450
|
-
if(this.RightMenu){var frameId=this.Frame.PtInFrame(x*pixelTatio,y*pixelTatio);e.data={Chart:this,FrameID:frameId};this.RightMenu.DoModal(e);}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CONTEXT_MENU);if(event){var frameId=this.Frame.PtInFrame(x*pixelTatio,y*pixelTatio);var data={X:x,Y:y,Event:e,FrameID:frameId};event.Callback(event,data,this);}}
|
|
7451
|
-
this.
|
|
7487
|
+
if(this.EnablePopMenuV2){var frameId=this.Frame.PtInFrame(x*pixelTatio,y*pixelTatio);this.PopuRightMenuV2({X:e.offsetX,Y:e.offsetY,FrameID:frameId},e);}else if(this.RightMenu){var frameId=this.Frame.PtInFrame(x*pixelTatio,y*pixelTatio);e.data={Chart:this,FrameID:frameId};this.RightMenu.DoModal(e);}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CONTEXT_MENU);if(event){var frameId=this.Frame.PtInFrame(x*pixelTatio,y*pixelTatio);var data={X:x,Y:y,Event:e,FrameID:frameId};event.Callback(event,data,this);}};//右键菜单数据
|
|
7488
|
+
this.GetRightMenuData=function(frameID){var windowCount=this.Frame.SubFrame.length;//窗口个数
|
|
7489
|
+
var klineChart=this.ChartPaint[0];var priceGap=klineChart.PriceGap;//缺口配置信息
|
|
7490
|
+
var coordinateType=null,yCoordinateType=null;//坐标类型
|
|
7491
|
+
var mainFrame=null;if(this.Frame.SubFrame[0]&&this.Frame.SubFrame[0].Frame)mainFrame=this.Frame.SubFrame[0].Frame;if(mainFrame){coordinateType=mainFrame.CoordinateType;if(mainFrame.YSplitOperator)yCoordinateType=mainFrame.YSplitOperator.CoordinateType;}var aryKLineInfo=[];//信息地雷
|
|
7492
|
+
for(var i=0;i<this.ChartInfo.length;++i){var item=this.ChartInfo[i];if(item&&item.ClassName)aryKLineInfo.push(item.ClassName);}var aryOverlaySymbol=[];//叠加的股票列表
|
|
7493
|
+
for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];if(item&&item.Symbol)aryOverlaySymbol.push(item.Symbol);}var bBGSpit=false,bShowDrawTool=false,bShowStockChip=false;if(this.GetExtendChartByClassName("SessionBreaksPaint"))bBGSpit=true;if(this.GetExtendChartByClassName('DrawToolsButton'))bShowDrawTool=true;//画图工具
|
|
7494
|
+
if(this.GetExtendChartByClassName('StockChip'))bShowStockChip=true;//筹码
|
|
7495
|
+
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:"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:"缺口提示",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]}},{Name:"K线(实心阳线)",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[0]}},{Name:"美国线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[2,true,{IsThinAKBar:false}]}},{Name:"美国线(细)",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[2,true,{IsThinAKBar:true}]}},{Name:"收盘线",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[1]}},{Name:"收盘面积",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[4]}},{Name:"K线(空心阳线阴线)",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[6]}},{Name:"Heikin Ashi",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[11]}},{Name:"Line Break",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[12]}},{Name:"High-low",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[13]}},{Name:"HLC Area",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID,Args:[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:bShowDrawTool?JSCHART_MENU_ID.CMD_HIDE_DRAWTOOL_ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID,Args:[]},Checked:bShowDrawTool},{Name:"移动筹码图",Data:{ID:bShowStockChip?JSCHART_MENU_ID.CMD_HIDE_STOCKCHIP_ID:JSCHART_MENU_ID.CMD_SHOW_STOCKCHIP_ID,Args:[]},Checked:bShowStockChip}]}];//复权
|
|
7496
|
+
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);}//删除菜单
|
|
7497
|
+
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;}}}}return aryMenu;};this.PopuRightMenuV2=function(data,e){var _this26=this;if(!this.JSPopMenu)return;var x=data.X,y=data.Y;var frameID=data.FrameID;var menuData={Menu:this.GetRightMenuData(frameID),Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID};menuData.ClickCallback=function(data){_this26.OnClickRightMenu(data);};this.PopuMenuByRClick(menuData,x,y);};//重新加载画图工具(切换股票|周期)
|
|
7498
|
+
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) 画图工具创建出来
|
|
7452
7499
|
{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;//绑定框架坐标
|
|
7453
7500
|
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;//清空缓存
|
|
7454
7501
|
};//形态匹配
|
|
@@ -7579,7 +7626,7 @@ var obj=this.Frame.OnSize();this.Frame.SetSizeChage(true);if(obj.Changed){this.U
|
|
|
7579
7626
|
event.Callback(event,data,this);if(data.PreventDefault)return;}if(button.ID==JSCHART_BUTTON_ID.CLOSE_OVERLAY_INDEX){var id=button.IndexID;if(id)this.DeleteOverlayWindowsIndex(id);}else if(button.ID==JSCHART_BUTTON_ID.MODIFY_OVERLAY_INDEX_PARAM){var id=button.IndexID;var frame=button.Frame;e.data={Chart:this,Identify:id,IsOverlay:true};if(frame.ModifyIndexEvent)frame.ModifyIndexEvent(e);}else if(button.ID==JSCHART_BUTTON_ID.CLOSE_INDEX_WINDOW){var frame=button.Frame;this.RemoveIndexWindow(frame.Identify);}else if(button.ID==JSCHART_BUTTON_ID.CHANGE_INDEX){var frame=button.Frame;e.data={Chart:this,Identify:frame.Identify,IsOverlay:false};if(frame.ChangeIndexEvent)frame.ChangeIndexEvent(e);}else if(button.ID==JSCHART_BUTTON_ID.MODIFY_INDEX_PARAM){var frame=button.Frame;e.data={Chart:this,Identify:frame.Identify,IsOverlay:false};if(frame.ModifyIndexEvent)frame.ModifyIndexEvent(e);}else if(button.ID==JSCHART_BUTTON_ID.OVERLAY_INDEX){var frame=button.Frame;e.data={Chart:this,Identify:frame.Identify,IsOverlay:true};if(frame.ChangeIndexEvent)frame.ChangeIndexEvent(e);}else if(button.ID==JSCHART_BUTTON_ID.MAX_MIN_WINDOW){var id=button.IndexID;var frame=button.Frame;var frameId=button.FrameID;if(frameId>=this.Frame.ZoomStartWindowIndex){if(this.ZoomIndexWindow(frameId,null)){this.Frame.SetSizeChage(true);this.Draw();}}}else if(button.ID==JSCHART_BUTTON_ID.TITLE_WINDOW)//标题模式
|
|
7580
7627
|
{var id=button.IndexID;var frame=button.Frame;var frameId=button.FrameID;if(this.ShowIndexTitleOnly(frameId)){this.Frame.SetSizeChage(true);this.Draw();}}else if(button.ID==JSCHART_BUTTON_ID.EXPORT_DATA)//数据导出
|
|
7581
7628
|
{var data=this.ExportData({Type:"CSV"});if(!data)return;var date=Date.now();var fileName='hqchart_'+this.Symbol+'_'+date+'.csv';var alink=document.createElement("a");var csvDataBlob=new Blob([data],{type:"text/csv"});alink.href=URL.createObjectURL(csvDataBlob);document.body.appendChild(alink);alink.setAttribute("download",fileName);alink.click();document.body.removeChild(alink);}};this.ClickTitleButton=function(button,e){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_TITLE_BUTTON);if(event&&event.Callback){var data={Info:button,PreventDefault:false};//PreventDefault 是否阻止内置的点击处理
|
|
7582
|
-
event.Callback(event,data,this);if(data.PreventDefault)return;}};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 是否阻止内置的点击处理
|
|
7629
|
+
event.Callback(event,data,this);if(data.PreventDefault)return;}};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,e:e};//PreventDefault 是否阻止内置的点击处理
|
|
7583
7630
|
event.Callback(event,data,this);if(data.PreventDefault)return;}//筹码按钮
|
|
7584
7631
|
if(button.ID==JSCHART_BUTTON_ID.CHIP_DEFULT){button.Chart.ShowType=0;this.Draw();}else if(button.ID==JSCHART_BUTTON_ID.CHIP_LONG){button.Chart.ShowType=1;this.Draw();}else if(button.ID==JSCHART_BUTTON_ID.CHIP_RECENT){button.Chart.ShowType=2;this.Draw();}};//成交量分布图数据请求
|
|
7585
7632
|
this.RequestVolumeProfileData=function(option){var self=this;var chart=option.Chart;if(this.NetworkFilter){var obj={Name:'KLineChartContainer::RequestVolumeProfileData',//类名::函数
|
|
@@ -7788,24 +7835,29 @@ RectSelectPaint:paint,//区间选择背景
|
|
|
7788
7835
|
e:e};event.Callback(event,data,this);}if(this.SelectRectDialog){e.data={Chart:this,X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,SelectData:selectData,//区间选择的数据
|
|
7789
7836
|
RectSelectPaint:paint//区间选择背景
|
|
7790
7837
|
};this.SelectRectDialog.DoModal(e);}}this.Draw();};//注册鼠标右键事件
|
|
7791
|
-
this.OnRightMenu=function(x,y,e){
|
|
7838
|
+
this.OnRightMenu=function(x,y,e){var pixelTatio=GetDevicePixelRatio();//x,y 需要乘以放大倍速
|
|
7839
|
+
if(this.EnablePopMenuV2){var frameId=this.Frame.PtInFrame(x*pixelTatio,y*pixelTatio);this.PopuRightMenuV2({X:e.offsetX,Y:e.offsetY,FrameID:frameId},e);}else if(this.RightMenu){var frameId=this.Frame.PtInFrame(x,y);e.data={Chart:this,FrameID:frameId};this.RightMenu.DoModal(e);}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CONTEXT_MENU);if(event){var frameId=this.Frame.PtInFrame(x,y);var data={X:x,Y:y,Event:e,FrameID:frameId};event.Callback(event,data,this);}};//右键菜单数据
|
|
7840
|
+
this.GetRightMenuData=function(frameID){var windowCount=this.Frame.SubFrame.length;//窗口个数
|
|
7841
|
+
var aryOverlaySymbol=[];//叠加的股票列表
|
|
7842
|
+
for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];if(item&&item.Symbol)aryOverlaySymbol.push(item.Symbol);}var aryMenu=[{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:"当日分时图",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DAY_COUNT_ID,Args:[1]},Checked:this.DayCount==1},{Name:"最近2日",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DAY_COUNT_ID,Args:[2]},Checked:this.DayCount==2},{Name:"最近3日",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DAY_COUNT_ID,Args:[3]},Checked:this.DayCount==3},{Name:"最近4日",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DAY_COUNT_ID,Args:[4]},Checked:this.DayCount==4},{Name:"最近5日",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_DAY_COUNT_ID,Args:[5]},Checked:this.DayCount==5}]},{Name:"指标窗口个数",SubMenu:[{Name:"1个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[2]},Checked:3==windowCount},{Name:"2个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[3]},Checked:4==windowCount},{Name:"3个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[4]},Checked:5==windowCount},{Name:"4个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[5]},Checked:6==windowCount},{Name:"5个窗口",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_WINDOW_COUNT_ID,Args:[6]},Checked:7==windowCount}]},{Name:"指标切换",SubMenu:[{Name:"MACD",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"MACD"]}},{Name:"DMI",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"DMI"]}},{Name:"DMA",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"DMA"]}},{Name:"BRAR",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"BRAR"]}},{Name:"KDJ",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"KDJ"]}},{Name:"RSI",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"RSI"]}},{Name:"WR",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"WR"]}},{Name:"CCI",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"CCI"]}},{Name:"TRIX",Data:{ID:JSCHART_MENU_ID.CMD_CHANGE_INDEX_ID,Args:[frameID,"TRIX"]}}]},{Name:"区间选择",Data:{ID:JSCHART_MENU_ID.CMD_ENABLE_SELECT_RECT_ID,Args:[!this.EnableSelectRect]},Checked:this.EnableSelectRect}];//删除菜单
|
|
7843
|
+
for(var i=0;i<aryMenu.length;++i){var item=aryMenu[i];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;}}}}return aryMenu;};this.PopuRightMenuV2=function(data,e){var _this27=this;if(!this.JSPopMenu)return;var x=data.X,y=data.Y;var frameID=data.FrameID;var menuData={Menu:this.GetRightMenuData(frameID),Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID};menuData.ClickCallback=function(data){_this27.OnClickRightMenu(data);};this.PopuMenuByRClick(menuData,x,y);};this.OnWheel=function(e){JSConsole.Chart.Log('[MinuteChartContainer::OnWheel]',e);};this.OnDoubleClick=function(x,y,e){JSConsole.Chart.Log("[MinuteChartContainer::OnDoubleClick]",e);if(this.ClickChartTimer!=null){clearTimeout(this.ClickChartTimer);this.ClickChartTimer=null;}var selectedChart;//图形选中
|
|
7792
7844
|
if(this.SelectedChart.EnableSelected){selectedChart=this.PtInChart(x,y);}var dbClickInfo={SelectedChart:selectedChart};this.DBClickEvent(dbClickInfo,e);//没有图形选中,双击缩放窗口
|
|
7793
7845
|
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);};//创建
|
|
7794
7846
|
//windowCount 窗口个数
|
|
7795
|
-
this.Create=function(windowCount,option){var
|
|
7796
|
-
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return
|
|
7847
|
+
this.Create=function(windowCount,option){var _this28=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
7848
|
+
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return _this28.PtInClient(x,y);};this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_Minute_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this28.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this28.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ShareAfterVol=this.ShareAfterVol;this.ChartCorssCursor.CallAcutionXOperator=new CallAcutionXOperator();//创建等待提示
|
|
7797
7849
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
7798
|
-
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
|
|
7850
|
+
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 _this28.GetExtendChartRightWidth();};this.Frame.GetEventCallback=function(id){return _this28.GetEventCallback(id);};this.Frame.ZoomStartWindowIndex=2;this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
|
|
7799
7851
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();this.CreateExtendChart("RectSelectPaint",option?option.SelectRect:null);//区间统计
|
|
7800
7852
|
if(this.EnableIndexChartDrag)this.CreateExtendChart("DragMovePaint");//子窗口动态标题
|
|
7801
|
-
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
|
|
7802
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
7853
|
+
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 _this28.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.ChartCorssCursor.StringFormatX.Frame=this.Frame.SubFrame[0].Frame;this.ChartCorssCursor.StringFormatY.Frame=this.Frame;if(this.ChartCorssCursor.CallAcutionXOperator)this.ChartCorssCursor.CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;var bRegisterKeydown=true;var bRegisterWheel=true;if(option&&option.Listener){var item=option.Listener;if(item.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register keydown event.');}if(item.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[MinuteChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this28.OnKeyDown(e);},true);//键盘消息
|
|
7854
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this28.OnWheel(e);},true);//上下滚动消息
|
|
7803
7855
|
};//创建子窗口
|
|
7804
|
-
this.CreateChildWindow=function(windowCount){var
|
|
7805
|
-
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;}var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];if(i==0){frame.YSplitOperator=new FrameSplitMinutePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.GetEventCallback=function(id){return
|
|
7856
|
+
this.CreateChildWindow=function(windowCount){var _this29=this;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_FRAME);for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=new MinuteFrame();frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;frame.GlobalOption=this.GlobalOption;if(i<2)frame.ChartBorder.TitleHeight=0;frame.XPointCount=243;if(i>=2){if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
|
|
7857
|
+
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;}var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];if(i==0){frame.YSplitOperator=new FrameSplitMinutePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.GetEventCallback=function(id){return _this29.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 _this29.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 _this29.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 _this30=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;//窗口序号
|
|
7806
7858
|
frame.XPointCount=243;frame.GlobalOption=this.GlobalOption;if(id>=2){if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
|
|
7807
|
-
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;}var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitMinuteX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.ShowText=false;frame.XSplitOperator.DayOffset=this.DayOffset;frame.XSplitOperator.GetEventCallback=function(id){return
|
|
7808
|
-
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
|
|
7859
|
+
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;}var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=border;frame.XSplitOperator=new FrameSplitMinuteX();frame.XSplitOperator.Frame=frame;frame.XSplitOperator.ChartBorder=border;frame.XSplitOperator.ShowText=false;frame.XSplitOperator.DayOffset=this.DayOffset;frame.XSplitOperator.GetEventCallback=function(id){return _this30.GetEventCallback(id);};frame.YSplitOperator.GetEventCallback=function(id){return _this30.GetEventCallback(id);};frame.XSplitOperator.Symbol=this.Symbol;if(this.DayCount>1){frame.XSplitOperator.DayCount=this.DayData.length;frame.XSplitOperator.DayData=this.DayData;frame.DayCount=this.DayData.length;}//K线数据绑定
|
|
7860
|
+
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 _this31=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 _this31.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
|
|
7809
7861
|
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();//更新数据偏移
|
|
7810
7862
|
this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7811
7863
|
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;}}};//删除某一个窗口的指标
|
|
@@ -7816,8 +7868,8 @@ subFrame.YSpecificMaxMin=null;subFrame.IsLocked=false;//解除上锁
|
|
|
7816
7868
|
subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType;//还原Y坐标分割模式
|
|
7817
7869
|
this.ChartPaint=paint;//清空东条标题
|
|
7818
7870
|
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线画法
|
|
7819
|
-
this.CreateMainKLine=function(){var
|
|
7820
|
-
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
|
|
7871
|
+
this.CreateMainKLine=function(){var _this32=this;//分钟线
|
|
7872
|
+
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 _this32.GetEventCallback(id);};this.ChartPaint[0]=minuteLine;//分钟线均线
|
|
7821
7873
|
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;//成交量
|
|
7822
7874
|
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;//绑定叠加
|
|
7823
7875
|
this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].CallAcutionXOperator=new CallAcutionXOperator();this.TitlePaint[0].CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;};//切换成 脚本指标
|
|
@@ -7832,19 +7884,19 @@ this.UpdataDataoffset();//更新数据偏移
|
|
|
7832
7884
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7833
7885
|
this.Draw();};this.ChangeIndex=function(windowIndex,indexName,option){if(this.Frame.SubFrame.length<3)return;if(option&&option.API)return this.ChangeAPIIndex(windowIndex,option);//查找系统指标
|
|
7834
7886
|
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);};//设置指标窗口个数
|
|
7835
|
-
this.ChangeIndexWindowCount=function(count){var
|
|
7887
|
+
this.ChangeIndexWindowCount=function(count){var _this33=this;if(count<2)return;//1,2个窗口固定的不能动
|
|
7836
7888
|
if(this.Frame.SubFrame.length==count)return;var currentLength=this.Frame.SubFrame.length;if(currentLength>count){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DELETE_FRAME);for(var i=currentLength-1;i>=count;--i){this.DeleteIndexPaint(i);var item=this.Frame.SubFrame[i].Frame;if(item.ClearToolbar)item.ClearToolbar();if(event&&event.Callback){var sendData={SubFrame:this.Frame.SubFrame[i],WindowIndex:i};event.Callback(event,sendData,this);}}this.Frame.SubFrame.splice(count,currentLength-count);this.WindowIndex.splice(count,currentLength-count);this.TitlePaint.splice(count+1,currentLength-count);}else{//创建新的指标窗口
|
|
7837
|
-
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
|
|
7889
|
+
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 _this33.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}//创建指标
|
|
7838
7890
|
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);//脚本执行
|
|
7839
7891
|
var bindData=this.SourceData;this.BindIndexData(i,bindData);//执行脚本
|
|
7840
7892
|
}//最后一个显示X轴坐标
|
|
7841
7893
|
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();//更新数据偏移
|
|
7842
7894
|
}this.UpdateXShowText();this.Frame.SetSizeChage(true);this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7843
7895
|
this.Draw();};this.ChangeIndexTemplate=function(option)//切换指标模板 可以设置指标窗口个数 每个窗口的指标, 只能从第3个指标窗口开始设置,前面2个指标窗口固定无法设置
|
|
7844
|
-
{var
|
|
7896
|
+
{var _this34=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;//天数
|
|
7845
7897
|
if(option.Symbol)symbol=option.Symbol;var bRefreshData=dayCount!=null||symbol!=null;//清空所有的指标图型
|
|
7846
7898
|
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)//创建新的指标窗口
|
|
7847
|
-
{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
|
|
7899
|
+
{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 _this34.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;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)//自定义指标脚本
|
|
7848
7900
|
{this.WindowIndex[windowIndex]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
|
|
7849
7901
|
}else if(item.API)//后台指标
|
|
7850
7902
|
{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);//脚本执行
|
|
@@ -7888,7 +7940,7 @@ if(option.Overlay&&IFrameSplitOperator.IsNonEmptyArray(option.Overlay)){var setS
|
|
|
7888
7940
|
{var item=this.OverlayChartPaint[i];setSymbol.add(item.Symbol);}for(var i=0;i<option.Overlay.length;++i){var item=option.Overlay[i];if(setSymbol.has(item.Symbol))continue;var paint=new ChartOverlayMinutePriceLine();paint.Canvas=this.Canvas;paint.ChartBorder=this.Frame.SubFrame[0].Frame.ChartBorder;paint.ChartFrame=this.Frame.SubFrame[0].Frame;paint.Name="Overlay-Minute";paint.Symbol=item.Symbol;paint.Identify='Overlay-Minute-'+item.Symbol;if(item.Color)paint.Color=item.Color;//外部设置颜色
|
|
7889
7941
|
else paint.Color=g_JSChartResource.OverlaySymbol.Color[g_JSChartResource.OverlaySymbol.Random%g_JSChartResource.OverlaySymbol.Color.length];++g_JSChartResource.OverlaySymbol.Random;paint.MainData=this.SourceData;//绑定主图数据
|
|
7890
7942
|
if(paint.SetOption)paint.SetOption(item);this.OverlayChartPaint.push(paint);}}}if(!symbol||this.DayCount<=0){this.DrawEmpty();}else{this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.EnableSplash(true);//增加下载动画
|
|
7891
|
-
this.Draw();this.RequestData();}};this.SetPageInfo=function(pageInfo){if(!pageInfo)return;if(IFrameSplitOperator.IsBool(pageInfo.Enable))this.PageInfo.Enable=pageInfo.Enable;if(IFrameSplitOperator.IsNumber(pageInfo.Offset))this.PageInfo.Offset=pageInfo.Offset;if(IFrameSplitOperator.IsNumber(pageInfo.ShowDayCount))this.PageInfo.ShowDayCount=pageInfo.ShowDayCount;};this.ClearMinuteData=function(){this.SourceData=null;this.DayData=null;this.BeforeOpenData=null;this.AfterCloseData=null;this.MultiDayBeforeOpenData=null;this.MultiDayAfterCloseData=null;};this.ChangeDayCount=function(count,option){if(count<0)return;this.StopDisplayLatest();this.CancelAutoUpdate();this.AutoUpdateEvent(false,"MinuteChartContainer::ChangeDayCount");this.DayCount=count;this.ClearMinuteData();if(option&&option.PageInfo){this.SetPageInfo(option.PageInfo);this.ResetDayOffset();}
|
|
7943
|
+
this.Draw();this.RequestData();}};this.SetPageInfo=function(pageInfo){if(!pageInfo)return;if(IFrameSplitOperator.IsBool(pageInfo.Enable))this.PageInfo.Enable=pageInfo.Enable;if(IFrameSplitOperator.IsNumber(pageInfo.Offset))this.PageInfo.Offset=pageInfo.Offset;if(IFrameSplitOperator.IsNumber(pageInfo.ShowDayCount))this.PageInfo.ShowDayCount=pageInfo.ShowDayCount;};this.ClearMinuteData=function(){this.SourceData=null;this.DayData=null;this.BeforeOpenData=null;this.AfterCloseData=null;this.MultiDayBeforeOpenData=null;this.MultiDayAfterCloseData=null;};this.ChangeDayCount=function(count,option){if(count<0)return;this.StopDisplayLatest();this.CancelAutoUpdate();this.AutoUpdateEvent(false,"MinuteChartContainer::ChangeDayCount");this.DayCount=count;this.ClearMinuteData();if(option&&option.PageInfo){this.SetPageInfo(option.PageInfo);this.ResetDayOffset();}this.ReloadChartDrawPicture();this.ResetDataStatus();this.ClearIndexPaint();//清空指标
|
|
7892
7944
|
this.Frame.ClearYCoordinateMaxMin();this.ResetOverlaySymbolStatus();this.RequestData();};//[{ Symbol: , Color, Option: }]
|
|
7893
7945
|
this.OverlaySymbols=function(aryData,option){if(option&&option.ClearAll===true)//全部清空
|
|
7894
7946
|
{for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];item.IsDelete=true;}this.OverlayChartPaint=[];}var aryNewOverlay=[];for(var i=0,j=0;i<aryData.length;++i)//去重,已经叠加过的不用在叠加
|
|
@@ -7920,6 +7972,7 @@ this.BindMainData(sourceData,yClose);//外汇 均线暂时不用
|
|
|
7920
7972
|
if(MARKET_SUFFIX_NAME.IsForeignExchange(upperSymbol))this.ChartPaint[1].Data=null;for(var _i15=0;_i15<this.Frame.SubFrame.length;++_i15){var item=this.Frame.SubFrame[_i15];item.Frame.XSplitOperator.Symbol=this.Symbol;item.Frame.XSplitOperator.DayCount=showDayCount;item.Frame.XSplitOperator.DayData=this.DayData;item.Frame.XSplitOperator.Operator();//调整X轴个数
|
|
7921
7973
|
item.Frame.XSplitOperator.IsBeforeData=this.IsBeforeData;item.Frame.XSplitOperator.IsAfterData=this.IsAfterData;item.Frame.YSplitOperator.Symbol=this.Symbol;item.Frame.YSplitOperator.IsBeforeData=this.IsBeforeData;item.Frame.YSplitOperator.IsAfterData=this.IsAfterData;for(var j in item.OverlayIndex)//子坐标X轴个数同步
|
|
7922
7974
|
{var overlayItem=item.OverlayIndex[j];overlayItem.Frame.XPointCount=item.Frame.XPointCount;overlayItem.Frame.MinuteCount=item.Frame.MinuteCount;}}this.ChartCorssCursor.StringFormatY.Symbol=this.Symbol;this.ChartCorssCursor.StringFormatX.Symbol=this.Symbol;this.ChartCorssCursor.StringFormatX.IsBeforeData=this.IsBeforeData;this.ChartCorssCursor.StringFormatX.IsAfterData=this.IsAfterData;this.TitlePaint[0].IsShowDate=true;this.UpdateDataOffset();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7975
|
+
this.CreateChartDrawPictureByStorage();//创建画图工具
|
|
7923
7976
|
//执行脚本
|
|
7924
7977
|
if(this.Frame.SubFrame.length>2){var bindData=new ChartData();bindData.Data=allMinuteData;for(var i=2;i<this.Frame.SubFrame.length;++i){this.BindIndexData(i,bindData);}}this.Frame.SetSizeChage(true);this.Draw();};this.HistoryMinuteDataToArray=function(data){var result=[];for(var i=data.length-1;i>=0;--i){var item=data[i];for(var j=0;j<item.Data.length;++j){result.push(item.Data[j]);}}return result;};//更新一天的数据
|
|
7925
7978
|
this.UpdateLatestMinuteData=function(data,date,stock){if(!this.DayData)return;for(var i=0;i<this.DayData.length;++i){var item=this.DayData[i];if(item.Date===date){item.Data=data;//整一天的数据都替换掉
|
|
@@ -8082,8 +8135,8 @@ else this.ClearBindOverlayPositionData();this.TitlePaint[0].Data=this.SourceData
|
|
|
8082
8135
|
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;//十字光标
|
|
8083
8136
|
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;//绑定主图数据
|
|
8084
8137
|
}};//绑定分钟叠加指标数据(持仓量)
|
|
8085
|
-
this.BindOverlayPositionData=function(minuteData,yClose){var
|
|
8086
|
-
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
|
|
8138
|
+
this.BindOverlayPositionData=function(minuteData,yClose){var _this35=this;if(this.Frame.SubFrame.length<2)return;var chart=null;var frame=null;var subFrame=this.Frame.SubFrame[1];//第2个窗口
|
|
8139
|
+
var overlayFrame=null;for(var i=0;i<subFrame.OverlayIndex.length;++i){var item=subFrame.OverlayIndex[i];if(item.Identify=='Position_Line_Frame'){overlayFrame=item;break;}}if(!overlayFrame){overlayFrame=new OverlayIndexItem();overlayFrame.Identify='Position_Line_Frame';if(this.ClassName=="MinuteChartContainer")frame=new OverlayMinuteFrame();else frame=new OverlayMinuteHScreenFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GlobalOption=this.GlobalOption;overlayFrame.Frame=frame;frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this35.GetEventCallback(id);};frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;var chart=new ChartMinutePositionLine();chart.Canvas=this.Canvas;chart.Name='Position-Line';chart.ChartBorder=frame.ChartBorder;chart.ChartFrame=frame;chart.Identify=overlayFrame.Identify;chart.Color=g_JSChartResource.Minute.PositionColor;overlayFrame.ChartPaint.push(chart);subFrame.OverlayIndex.push(overlayFrame);subFrame.Frame.RightFrame=frame;//右边坐标绑定到主坐标上
|
|
8087
8140
|
}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)//图形不存在就创建一个
|
|
8088
8141
|
{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个窗口
|
|
8089
8142
|
subFrame.Frame.RightFrame=null;subFrame.Frame.IsShowPositionTitle=false;for(var i in subFrame.OverlayIndex){var item=subFrame.OverlayIndex[i];if(item.Identify=='Position_Line_Frame'){subFrame.OverlayIndex.splice(i,1);break;}}};this.GetOverlayIndexByIdentify=function(identify){for(var i=0;i<this.Frame.SubFrame.length;++i){var item=this.Frame.SubFrame[i];if(!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex))continue;for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];if(overlayItem.Identify===identify)return{OverlayItem:overlayItem,WindowIndex:i};}}return null;};this.RecvOverlayIndex=function(identify,data){var overlayIndex=this.GetOverlayIndexByIdentify(identify);if(overlayIndex==null){console.warn('[MinuteChartContainer::RecvOverlayIndex] can\'t find overlay index. [identify='+identify+']');return;}if(!overlayIndex.Script)return;if(typeof overlayIndex.RecvSubscribeData!="function")return;var bindData=this.SourceData;if(!bindData)return;overlayIndex.Script.RecvSubscribeData(data,this,overlayIndex.WindowIndex,bindData);};//更新叠加指标
|
|
@@ -8092,12 +8145,12 @@ this.AddOverlayIndex=function(obj){var overlay=this.CreateOverlayWindowsIndex(ob
|
|
|
8092
8145
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
8093
8146
|
this.Draw();};//创建一个叠加指标
|
|
8094
8147
|
this.CreateOverlayWindowsIndex=function(obj)//{WindowIndex:, IndexName:, Identify:, ShowRightText:, API:}
|
|
8095
|
-
{var
|
|
8148
|
+
{var _this36=this;var indexName=obj.IndexName;var windowIndex=obj.WindowIndex;var apiItem=null,indexInfo=null,indexCustom=null;if(obj.API){apiItem=obj.API;}else if(obj.Script)//动态执行脚本
|
|
8096
8149
|
{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);//系统指标
|
|
8097
8150
|
if(!indexInfo){indexCustom=JSIndexMap.Get(indexName);//定制指标
|
|
8098
8151
|
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
|
|
8099
8152
|
var frame=null;if(this.ClassName=="MinuteChartContainer")frame=new OverlayMinuteFrame();else frame=new OverlayMinuteHScreenFrame();frame.Canvas=this.Canvas;frame.MainFrame=subFrame.Frame;frame.ChartBorder=subFrame.Frame.ChartBorder;frame.GlobalOption=this.GlobalOption;if(obj.ShowRightText===true)frame.IsShow=true;else if(obj.ShowRightText===false)frame.IsShow=false;if(obj.IsShareY===true)frame.IsShareY=true;if(IFrameSplitOperator.IsBool(obj.IsCalculateYMaxMin))frame.IsCalculateYMaxMin=obj.IsCalculateYMaxMin;//是否计算Y最大最小值
|
|
8100
|
-
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
|
|
8153
|
+
frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');frame.YSplitOperator.Frame=frame;frame.YSplitOperator.ChartBorder=frame.ChartBorder;frame.YSplitOperator.SplitCount=subFrame.Frame.YSplitOperator.SplitCount;frame.YSplitOperator.GetEventCallback=function(id){return _this36.GetEventCallback(id);};frame.YSplitOperator.HQChart=this;frame.YSplitOperator.OverlayIdentify=overlayFrame.Identify;if(obj.Frame){var item=obj.Frame;if(item.Custom)frame.YSplitOperator.Custom=item.Custom;}overlayFrame.Frame=frame;if(apiItem){var apiIndex=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,obj,true);apiIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
|
|
8101
8154
|
overlayFrame.Script=apiIndex;}else if(indexInfo){JSIndexScript.ModifyAttribute(indexInfo,obj);var scriptIndex=new OverlayScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
|
|
8102
8155
|
scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
|
|
8103
8156
|
overlayFrame.Script=scriptIndex;}else{var scriptIndex=indexCustom.Create();scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
|
|
@@ -8135,9 +8188,9 @@ this.Draw();};this.CreateChartDrawPicture=function(name,option,callback){var dra
|
|
|
8135
8188
|
if(option)drawPicture.SetOption(option);var self=this;drawPicture.Update=function()//更新回调函数
|
|
8136
8189
|
{self.DrawDynamicInfo();};drawPicture.GetActiveDrawPicture=function(){return self.GetActiveDrawPicture();};this.CurrentChartDrawPicture=drawPicture;JSConsole.Chart.Log("[MinuteChartContainer::CreateChartDrawPicture] ",name,this.CurrentChartDrawPicture);return true;};//手动添加画线
|
|
8137
8190
|
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;//绑定框架坐标
|
|
8138
|
-
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=[];this.
|
|
8139
|
-
{if(!this.ChartDrawStorageCache||this.ChartDrawStorageCache.length<=0)return;for(var i
|
|
8140
|
-
drawPicture.UpdateXValue();drawPicture.ValueToPoint();if(drawPicture.ClassName==='ChartDrawPictureText')drawPicture.IsInitialized=true;this.ChartDrawPicture.push(drawPicture);}this.ChartDrawStorageCache=null;//清空缓存
|
|
8191
|
+
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) 画图工具创建出来
|
|
8192
|
+
{var _this37=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;//绑定框架坐标
|
|
8193
|
+
if(drawPicture.ImportStorageData)drawPicture.ImportStorageData(item);drawPicture.ResetXValue();drawPicture.UpdateXValue();drawPicture.ValueToPoint();drawPicture.GetActiveDrawPicture=function(){return _this37.GetActiveDrawPicture();};if(drawPicture.ClassName==='ChartDrawPictureText')drawPicture.IsInitialized=true;this.ChartDrawPicture.push(drawPicture);}this.ChartDrawStorageCache=null;//清空缓存
|
|
8141
8194
|
};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坐标获取数据索引
|
|
8142
8195
|
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;};//不支持未来时间 目前只支持主图
|
|
8143
8196
|
this.GetDateTimeByPoint=function(x,y){var clientPos=this.PtInClient_V2(x,y);// 100-199=多日分时主图 200-299=盘前 300-399=盘后 1=主图 2=盘前 3=盘后
|
|
@@ -8349,33 +8402,33 @@ if(this.DataMove(moveSetp,isLeft)){this.UpdataDataoffset();this.UpdatePointByCur
|
|
|
8349
8402
|
{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//缩小
|
|
8350
8403
|
{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;};//创建
|
|
8351
8404
|
//windowCount 窗口个数
|
|
8352
|
-
this.Create=function(windowCount){var
|
|
8405
|
+
this.Create=function(windowCount){var _this38=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8353
8406
|
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;//创建等待提示
|
|
8354
8407
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
8355
8408
|
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;//十字光标绑定框架
|
|
8356
8409
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();//子窗口动态标题
|
|
8357
|
-
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
|
|
8410
|
+
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 _this38.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.UIElement.addEventListener("keydown",OnKeyDown,true);//键盘消息
|
|
8358
8411
|
};//创建子窗口
|
|
8359
|
-
this.CreateChildWindow=function(windowCount){var
|
|
8412
|
+
this.CreateChildWindow=function(windowCount){var _this39=this;for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=g_ChartFrameFactory.Create("KLineHScreenFrame",{ID:i});frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;//窗口序号
|
|
8360
8413
|
frame.RightSpaceCount=this.RightSpaceCount;//右边
|
|
8361
8414
|
if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
|
|
8362
|
-
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;if(i==0){frame.YSplitOperator=new FrameSplitKLinePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return
|
|
8415
|
+
if(this.ChangeIndexDialog)frame.ChangeIndexEvent=this.ChangeIndexDialog.DoModal;frame.HorizontalMax=20;frame.HorizontalMin=10;if(i==0){frame.YSplitOperator=new FrameSplitKLinePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.FrameSplitData2=this.FrameSplitData.get('double');frame.YSplitOperator.GetEventCallback=function(id){return _this39.GetEventCallback(id);};//主图上下间距
|
|
8363
8416
|
var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
8364
8417
|
border.TopSpace=12*pixelTatio;border.BottomSpace=12*pixelTatio;}else{frame.YSplitOperator=new FrameSplitY();frame.YSplitOperator.LanguageID=this.LanguageID;frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('double');//frame.IsLocked = true;
|
|
8365
|
-
}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
|
|
8418
|
+
}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 _this39.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;}};}////////////////////////////////////////////////////////////////////////////////
|
|
8366
8419
|
// 走势图横屏显示
|
|
8367
8420
|
//
|
|
8368
8421
|
function MinuteChartHScreenContainer(uielement){this.newMethod=MinuteChartContainer;//派生
|
|
8369
8422
|
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);};//创建
|
|
8370
8423
|
//windowCount 窗口个数
|
|
8371
|
-
this.Create=function(windowCount){var
|
|
8372
|
-
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return
|
|
8424
|
+
this.Create=function(windowCount){var _this40=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8425
|
+
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return _this40.PtInClient(x,y);};this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_Minute_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this40.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this40.GetEventCallback(id);};this.ChartCorssCursor.CallAcutionXOperator=new CallAcutionXOperator();//创建等待提示
|
|
8373
8426
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
8374
8427
|
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;//十字光标绑定框架
|
|
8375
8428
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();//子窗口动态标题
|
|
8376
|
-
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
|
|
8429
|
+
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 _this40.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);//键盘消息
|
|
8377
8430
|
};//创建子窗口
|
|
8378
|
-
this.CreateChildWindow=function(windowCount){var
|
|
8431
|
+
this.CreateChildWindow=function(windowCount){var _this41=this;for(var i=0;i<windowCount;++i){var border=new ChartBorder();border.UIElement=this.UIElement;var frame=new MinuteHScreenFrame();frame.Canvas=this.Canvas;frame.ChartBorder=border;frame.Identify=i;if(i<2)frame.ChartBorder.TitleHeight=0;frame.XPointCount=243;var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];frame.HorizontalMax=DEFAULT_HORIZONTAL[0];frame.HorizontalMin=DEFAULT_HORIZONTAL[DEFAULT_HORIZONTAL.length-1];if(i==0){frame.YSplitOperator=new FrameSplitMinutePriceY();frame.YSplitOperator.FrameSplitData=this.FrameSplitData.get('price');frame.YSplitOperator.GetEventCallback=function(id){return _this41.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 _this41.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 _this41.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;}};}/////////////////////////////////////////////////////////////////////////////////
|
|
8379
8432
|
// 深度图
|
|
8380
8433
|
//
|
|
8381
8434
|
function DepthChartContainer(uielement){this.newMethod=JSChartContainer;//派生
|
|
@@ -8383,7 +8436,7 @@ this.newMethod(uielement);delete this.newMethod;this.ClassName="DepthChartContai
|
|
|
8383
8436
|
this.MapAsk=new _map2.default();this.MapBid=new _map2.default();this.IsAutoUpdate=false;//是否自动更新行情数据
|
|
8384
8437
|
this.AutoUpdateFrequency=30000;//30秒更新一次数据
|
|
8385
8438
|
this.AutoUpdateTimer;this.DefaultZoom=0.8;//默认显示80%的盘口 (0 - 1)
|
|
8386
|
-
this.MaxVolRate=1.1;this.Create=function(option){var
|
|
8439
|
+
this.MaxVolRate=1.1;this.Create=function(option){var _this42=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8387
8440
|
this.ChartCorssCursor=new DepthChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.HQChart=this;//this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");
|
|
8388
8441
|
//this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;
|
|
8389
8442
|
//this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");
|
|
@@ -8391,9 +8444,9 @@ this.ChartCorssCursor=new DepthChartCorssCursor();this.ChartCorssCursor.Canvas=t
|
|
|
8391
8444
|
//创建等待提示
|
|
8392
8445
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);//创建框架
|
|
8393
8446
|
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;
|
|
8394
|
-
ySplitOper.ChartBorder=this.Frame.ChartBorder;ySplitOper.GetEventCallback=function(id){return
|
|
8395
|
-
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){
|
|
8396
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
8447
|
+
ySplitOper.ChartBorder=this.Frame.ChartBorder;ySplitOper.GetEventCallback=function(id){return _this42.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 _this42.GetEventCallback(id);};this.Frame.XSplitOperator=xSplitOper;if(this.ChartCorssCursor)this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
|
|
8448
|
+
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){_this42.OnKeyDown(e);},true);//键盘消息
|
|
8449
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this42.OnWheel(e);},true);//上下滚动消息
|
|
8397
8450
|
};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;//是否允许缩放
|
|
8398
8451
|
if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Wheel===false)enableZoomUpDown=false;if(isInClient&&wheelValue<0&&enableZoomUpDown)//缩小
|
|
8399
8452
|
{if(this.Frame.ZoomDown()){this.UpdateFrameMaxMin();this.Draw();}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
|
|
@@ -8465,11 +8518,11 @@ this.BarPosition=1;//柱子方向 0=左边 1=右边
|
|
|
8465
8518
|
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=[];//清空
|
|
8466
8519
|
}else{frame=hqChart.Frame.SubFrame[windowIndex].Frame;hqChart.DeleteIndexPaint(windowIndex);//清空
|
|
8467
8520
|
}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;}};//请求数据
|
|
8468
|
-
this.RequestData=function(hqChart,windowIndex,hisData,option){var
|
|
8521
|
+
this.RequestData=function(hqChart,windowIndex,hisData,option){var _this43=this;this.CancelRequestTimer();var T_RequestData=function T_RequestData(){//请求数据
|
|
8469
8522
|
var klineChart=hqChart.ChartPaint[0];//获取当前K线图实例
|
|
8470
8523
|
var kData=klineChart.Data;//K线数据
|
|
8471
8524
|
if(!kData||IFrameSplitOperator.IsNonEmptyArray(!kData.Data))return;var pageKRange=klineChart.DrawKRange;//当前显示的K线索引
|
|
8472
|
-
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:
|
|
8525
|
+
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:_this43};if(IFrameSplitOperator.IsNumber(startKItem.Time))option.Start.Time=startKItem.Time;if(IFrameSplitOperator.IsNumber(endKItem.Time))option.End.Time=endKItem.Time;option.ValueAreaVol=_this43.Arguments[0].Value;if(_this43.Arguments[1].Value>0)_this43.BarPosition=1;else _this43.BarPosition=0;if(_this43.ChartVolProfile){_this43.ChartVolProfile.SetOption({BarPosition:_this43.BarPosition});}_this43.DataStatus=0;if(hqChart&&hqChart.RequestVolumeProfileData){hqChart.RequestVolumeProfileData(option);}};if(option&&option.Type==1)//页面缩放或移动延迟更新
|
|
8473
8526
|
{this.RequestTimer=setTimeout(function(){T_RequestData();},this.DelayRequestFrequency);}else{T_RequestData();}return true;};this.OnRecvVolumeProfileData=function(data){this.BindData(data);this.HQChart.UpdataDataoffset();//更新数据偏移
|
|
8474
8527
|
this.HQChart.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
8475
8528
|
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
|
|
@@ -10946,21 +10999,21 @@ var symbol=readArgument.Value;//支持 SH60000, SZ000001
|
|
|
10946
10999
|
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)//复制参数
|
|
10947
11000
|
{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= (代码,周期),指标(参数) => 输出
|
|
10948
11001
|
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;
|
|
10949
|
-
this.CallMemberScriptIndex=function(job){var
|
|
11002
|
+
this.CallMemberScriptIndex=function(job){var _this44=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))//读取指标
|
|
10950
11003
|
{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)//复制参数
|
|
10951
11004
|
{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,//复权
|
|
10952
11005
|
Period:indexInfo.PeriodID,//周期
|
|
10953
|
-
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){
|
|
11006
|
+
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this44.RecvMemberScriptIndexData(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,
|
|
10954
11007
|
IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:dateTimeRange//K线数据范围
|
|
10955
11008
|
};//执行脚本
|
|
10956
|
-
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){
|
|
11009
|
+
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_this44.ExecuteScriptIndexError(error,indexInfo);});};this.CallDynamicScriptIndex=function(job,varTable){var _this45=this;var callInfo=job.DynamicName;var indexInfo={Job:job,PeriodID:this.Period,Symbol:this.Symbol};if(!this.ReadIndexFunctionValue(callInfo,indexInfo))//读取指标
|
|
10957
11010
|
{var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallDynamicScriptIndex() Error: \''+callInfo+'\' '+indexInfo.Error);}var systemIndex=new JSIndexScript();//系统指标
|
|
10958
11011
|
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,//复权
|
|
10959
11012
|
Period:indexInfo.PeriodID,//周期
|
|
10960
|
-
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){
|
|
11013
|
+
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this45.RecvDynamicScriptIndexData(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,
|
|
10961
11014
|
IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:dateTimeRange//K线数据范围
|
|
10962
11015
|
};//执行脚本
|
|
10963
|
-
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){
|
|
11016
|
+
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_this45.ExecuteScriptIndexError(error,indexInfo);});};this.ReadDynamicIndexArgumentValue=function(args,result,varTable){result.Args=[];for(var i=0;i<result.SytemIndex.Args.length;++i)//复制参数
|
|
10964
11017
|
{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)//支持传参
|
|
10965
11018
|
{if(varTable.has(item.Name)){argItem.Value=varTable.get(item.Name);argItem.IsDefault=false;}}}return true;};/*****************************************************************************************************************************
|
|
10966
11019
|
脚本调用
|
|
@@ -10977,16 +11030,16 @@ var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_t
|
|
|
10977
11030
|
|
|
10978
11031
|
"MA.MA1"(6,12,18)
|
|
10979
11032
|
|
|
10980
|
-
*******************************************************************************************************************************/this.CallScriptIndex=function(job,varTable){var
|
|
11033
|
+
*******************************************************************************************************************************/this.CallScriptIndex=function(job,varTable){var _this46=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))//读取代码
|
|
10981
11034
|
{var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallScriptIndex() Error: '+indexInfo.Error);}if(!this.ReadIndexFunctionValue(job.Args[1],indexInfo))//读取指标
|
|
10982
11035
|
{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))//读取返回值索引
|
|
10983
11036
|
{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;//系统指标
|
|
10984
11037
|
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,//复权
|
|
10985
11038
|
Period:indexInfo.PeriodID,//周期
|
|
10986
|
-
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){
|
|
11039
|
+
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this46.RecvScriptIndexData(outVar,job,symbolData);_this46.Execute.RunNextJob();},CallbackParam:indexInfo,Async:true,MaxRequestDataCount:this.MaxRequestDataCount+30*2,MaxRequestMinuteDayCount:this.MaxRequestMinuteDayCount+2,Arguments:indexInfo.Args,//Condition:this.Condition,
|
|
10987
11040
|
IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:DateTimeRange//K线数据范围
|
|
10988
11041
|
};//执行脚本
|
|
10989
|
-
var run=JSComplier.Execute(indexInfo.SytemIndex.Script,option,function(error,indexInfo){
|
|
11042
|
+
var run=JSComplier.Execute(indexInfo.SytemIndex.Script,option,function(error,indexInfo){_this46.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);//保存所有的指标数据, 下面用到了就可以不用算了
|
|
10990
11043
|
for(var i in data){var key=outVar[i].Name;if(indexInfo.Period)key+='#'+indexInfo.Period;//带周期的变量
|
|
10991
11044
|
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+')';//保存所有的指标数据, 下面用到了就可以不用算了
|
|
10992
11045
|
for(var i=0;i<data.length;++i){var key=outVar[i].Name+'#'+strArgs;if(indexInfo.Period)key+='#'+indexInfo.Period;//带周期的变量
|
|
@@ -11154,7 +11207,7 @@ GetMarginJobID:function GetMarginJobID(value){var dataMap=new _map2.default([[1,
|
|
|
11154
11207
|
[9,JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_NEWS_ANALYSIS_TOPMANAGERS],//NEWS(9) 高管要闻
|
|
11155
11208
|
[10,JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_NEWS_ANALYSIS_PLEDGE]]);if(dataMap.has(value))return dataMap.get(value);return null;},//财务截面数据 分报告期
|
|
11156
11209
|
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
|
|
11157
|
-
GetSectionReportPeriod:function GetSectionReportPeriod(year,quarter){if(year>=2000&&quarter>=1&&quarter<=4)return{Year:year,Quarter:quarter};return null;}};function JSExecute(ast,option){var
|
|
11210
|
+
GetSectionReportPeriod:function GetSectionReportPeriod(year,quarter){if(year>=2000&&quarter>=1&&quarter<=4)return{Year:year,Quarter:quarter};return null;}};function JSExecute(ast,option){var _this47=this;this.AST=ast;//语法树
|
|
11158
11211
|
this.ErrorHandler=new ErrorHandler();this.VarTable=new _map2.default();//变量表
|
|
11159
11212
|
this.VarDrawTable=new _map2.default();//绘图变量表
|
|
11160
11213
|
this.OutVarTable=[];//输出变量
|
|
@@ -11200,7 +11253,7 @@ this.ConstVarTable=new _map2.default([//个股数据
|
|
|
11200
11253
|
['DRAWNULL',null],["NULL",null],["MACHINEDATE",null],["MACHINETIME",null],["MACHINEWEEK",null],["TR",null],//真实波幅
|
|
11201
11254
|
["AUTOFILTER",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=[];//执行的任务队列
|
|
11202
11255
|
this.UpdateUICallback=null;//回调
|
|
11203
|
-
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
|
|
11256
|
+
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 _this47.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;//调试模式信息
|
|
11204
11257
|
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();//绘图变量表
|
|
11205
11258
|
JSConsole.Complier.Log('[JSExecute::Execute] Load Arguments',this.Arguments);for(var _i125 in this.Arguments)//预定义的变量
|
|
11206
11259
|
{var _item16=this.Arguments[_i125];this.VarTable.set(_item16.Name,_item16.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://量比
|
|
@@ -11266,8 +11319,8 @@ else if(value.indexOf("FONTSIZE")==0){var strFontSize=value.replace("FONTSIZE","
|
|
|
11266
11319
|
{var _outVar13=this.VarTable.get(_varName3);var _value7={Name:_varName3,Data:_outVar13,Type:9};if(color)_value7.Color=color;if(upColor)_value7.UpColor=upColor;if(downColor)_value7.DownColor=downColor;if(lineWidth)_value7.LineWidth=lineWidth;this.OutVarTable.push(_value7);}else if(colorStick&&_varName3)//CYW: SUM(VAR4,10)/10000, COLORSTICK; 画上下柱子
|
|
11267
11320
|
{var _outVar14=this.VarTable.get(_varName3);var _value8={Name:_varName3,Data:_outVar14,Color:color,Type:2};if(lineWidth)_value8.LineWidth=lineWidth;if(color)_value8.Color=color;if(upColor)_value8.UpColor=upColor;if(downColor)_value8.DownColor=downColor;this.OutVarTable.push(_value8);}else if(_varName3&&color&&!_draw3){var _outVar15=this.VarTable.get(_varName3);if(!Array.isArray(_outVar15))_outVar15=this.SingleDataToArrayData(_outVar15);var _value9={Name:_varName3,Data:_outVar15,Color:color,Type:0};if(lineWidth)_value9.LineWidth=lineWidth;if(isShow==false)_value9.IsShow=false;if(isExData==true)_value9.IsExData=true;if(isDotLine==true)_value9.IsDotLine=true;if(isOverlayLine==true)_value9.IsOverlayLine=true;if(isNoneName==true)_value9.NoneName=true;if(isShowTitle==false)_value9.IsShowTitle=false;if(stepLine==true)_value9.Type=7;this.OutVarTable.push(_value9);}else if(_draw3)//画图函数
|
|
11268
11321
|
{var outVar={Name:_draw3.Name,Draw:_draw3,Type:1};if(color)outVar.Color=color;if(isDotLine==true)outVar.IsDotLine=true;if(lineWidth)outVar.LineWidth=lineWidth;if(isDrawAbove)outVar.IsDrawAbove=true;if(isDrawCenter)outVar.IsDrawCenter=true;if(isDrawBelow)outVar.IsDrawBelow=true;if(drawAlign>=0)outVar.DrawAlign=drawAlign;if(drawVAlign>=0)outVar.DrawVAlign=drawVAlign;if(fontSize>0)outVar.DrawFontSize=fontSize;if(bgConfig)outVar.Background=bgConfig;if(vLineConfig)outVar.VerticalLine=vLineConfig;if(IFrameSplitOperator.IsNumber(xOffset))outVar.XOffset=xOffset;if(IFrameSplitOperator.IsNumber(yOffset))outVar.YOffset=yOffset;if(IFrameSplitOperator.IsBool(isFirstDraw))outVar.IsFirstDraw=isFirstDraw;this.OutVarTable.push(outVar);}else if(_varName3){var _outVar16=this.VarTable.get(_varName3);var _value10={Name:_varName3,Data:_outVar16,Type:0};if(color)_value10.Color=color;if(lineWidth)_value10.LineWidth=lineWidth;if(isShow==false)_value10.IsShow=false;if(isExData==true)_value10.IsExData=true;if(isDotLine==true)_value10.IsDotLine=true;if(isOverlayLine==true)_value10.IsOverlayLine=true;if(isShowTitle==false)_value10.IsShowTitle=false;if(stepLine==true)_value10.Type=7;this.OutVarTable.push(_value10);}}}};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();//执行脚本
|
|
11269
|
-
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
|
|
11270
|
-
this.DebugRun=function(){var
|
|
11322
|
+
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 _this48=this;if(debugCtrl.ExeLine<debugCtrl.LineCount){var item=this.AST.Body[debugCtrl.ExeLine];this.RunASTNode(item);++debugCtrl.ExeLine;this.DebugFilter(debugCtrl,function(){_this48.DebugRun_Next(debugCtrl);});}else{this.DebugRun_End();debugCtrl.Status=2;this.DebugFilter(debugCtrl,null);}};//debug模式
|
|
11323
|
+
this.DebugRun=function(){var _this49=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(){_this49.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 _i128 in node.Expression){var _item18=node.Expression[_i128];this.VisitNode(_item18);}};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);//周期
|
|
11271
11324
|
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;};//函数调用
|
|
11272
11325
|
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个条件参数
|
|
11273
11326
|
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表达式.
|
|
@@ -12066,15 +12119,15 @@ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FILTER_DEAL_DATA);if(!event|
|
|
|
12066
12119
|
event.Callback(event,sendData,this);return sendData.Result;};this.EnableFilter=function(bEnable,option)//启动|关闭筛选
|
|
12067
12120
|
{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;};//创建
|
|
12068
12121
|
//windowCount 窗口个数
|
|
12069
|
-
this.Create=function(option){var
|
|
12122
|
+
this.Create=function(option){var _this50=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
12070
12123
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);//创建框架
|
|
12071
12124
|
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;//创建表格
|
|
12072
|
-
var chart=new ChartDealList();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return
|
|
12125
|
+
var chart=new ChartDealList();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this50.GetEventCallback(id);};this.ChartPaint[0]=chart;if(option){if(IFrameSplitOperator.IsBool(option.IsSingleTable))chart.IsSingleTable=option.IsSingleTable;//单表模式
|
|
12073
12126
|
if(IFrameSplitOperator.IsBool(option.IsShowHeader))chart.IsShowHeader=option.IsShowHeader;//是否显示表头
|
|
12074
12127
|
if(IFrameSplitOperator.IsBool(option.IsShowLastPage))this.IsShowLastPage=option.IsShowLastPage;//是否显示最后一页
|
|
12075
12128
|
if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
|
|
12076
|
-
}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){
|
|
12077
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
12129
|
+
}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this50.OnKeyDown(e);},true);//键盘消息
|
|
12130
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this50.OnWheel(e);},true);//上下滚动消息
|
|
12078
12131
|
};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();//获取设备的分辨率
|
|
12079
12132
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12080
12133
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
@@ -12236,26 +12289,26 @@ this.DragPageCycle=true;//手机翻页循环
|
|
|
12236
12289
|
this.DragXScroll=null;//{Start:{x,y}, End:{x, y}}
|
|
12237
12290
|
this.DragYScroll=null;this.IsShowVScrollbar=false;this.IsDestroy=false;//是否已经销毁了
|
|
12238
12291
|
this.ChartDestory=function()//销毁
|
|
12239
|
-
{this.IsDestroy=true;this.StopAutoUpdate();};this.StopAutoDragScrollTimer=function(){JSConsole.Chart.Log("[JSReportChartContainer::StopAutoDragScrollTimer] stop ");this.EnablePageScroll=false;if(this.AutoDragScrollTimer!=null){clearTimeout(this.AutoDragScrollTimer);this.AutoDragScrollTimer=null;}};this.AutoScrollPage=function(step){var
|
|
12292
|
+
{this.IsDestroy=true;this.StopAutoUpdate();};this.StopAutoDragScrollTimer=function(){JSConsole.Chart.Log("[JSReportChartContainer::StopAutoDragScrollTimer] stop ");this.EnablePageScroll=false;if(this.AutoDragScrollTimer!=null){clearTimeout(this.AutoDragScrollTimer);this.AutoDragScrollTimer=null;}};this.AutoScrollPage=function(step){var _this51=this;this.AutoDragScrollTimer=setTimeout(function(){_this51.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;};//清空固定行数据
|
|
12240
12293
|
this.ClearFixedRowData=function(){this.FixedRowData.Data=[];this.FixedRowData.Symbol=[];};//设置固定行
|
|
12241
12294
|
this.SetFixedRowCount=function(value){var chart=this.GetReportChart();if(!chart)return;chart.FixedRowCount=value;};//创建
|
|
12242
|
-
this.Create=function(option){var
|
|
12295
|
+
this.Create=function(option){var _this52=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
12243
12296
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
|
|
12244
12297
|
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;//创建表格
|
|
12245
|
-
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
|
|
12298
|
+
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 _this52.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this52.GetStockData(symbol);};chart.GetBlockDataCallback=function(symbol){return _this52.GetBlockData(symbol);};chart.GetFlashBGDataCallback=function(symbol,time){return _this52.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(_this52.DragYScroll)return true;return _this52.IsShowVScrollbar;};this.ChartPaint[0]=chart;//页脚
|
|
12246
12299
|
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;//是否显示表头
|
|
12247
12300
|
if(IFrameSplitOperator.IsNumber(option.FixedColumn))chart.FixedColumn=option.FixedColumn;//固定列
|
|
12248
12301
|
if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
|
|
12249
12302
|
if(IFrameSplitOperator.IsBool(option.TabShow))chart.Tab.IsShow=option.TabShow;if(IFrameSplitOperator.IsNumber(option.FixedRowCount))chart.FixedRowCount=option.FixedRowCount;//固定行
|
|
12250
12303
|
if(IFrameSplitOperator.IsBool(option.ItemBorder))chart.IsDrawBorder=option.ItemBorder;//单元格边框
|
|
12251
|
-
if(IFrameSplitOperator.IsNumber(option.SelectedModel))chart.SelectedModel=option.SelectedModel;if(IFrameSplitOperator.IsNonEmptyArray(option.FixedSymbol)){chart.FixedRowCount=0;this.FixedRowData.Type=1;this.FixedRowData.Symbol=[];var aryData=option.FixedSymbol;for(var i=0;i<aryData.length;++i){var item=aryData[i];this.FixedRowData.Symbol.push(item.Symbol);++chart.FixedRowCount;}}}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){
|
|
12252
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
12253
|
-
this.UIElement.ondblclick=function(e){
|
|
12254
|
-
this.UIElement.ontouchstart=function(e){
|
|
12304
|
+
if(IFrameSplitOperator.IsNumber(option.SelectedModel))chart.SelectedModel=option.SelectedModel;if(IFrameSplitOperator.IsNonEmptyArray(option.FixedSymbol)){chart.FixedRowCount=0;this.FixedRowData.Type=1;this.FixedRowData.Symbol=[];var aryData=option.FixedSymbol;for(var i=0;i<aryData.length;++i){var item=aryData[i];this.FixedRowData.Symbol.push(item.Symbol);++chart.FixedRowCount;}}}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSDealChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this52.OnKeyDown(e);},true);//键盘消息
|
|
12305
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this52.OnWheel(e);},true);//上下滚动消息
|
|
12306
|
+
this.UIElement.ondblclick=function(e){_this52.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this52.UIOnMouseDown(e);};this.UIElement.onmouseup=function(e){_this52.UIOnMounseUp(e);};this.UIElement.oncontextmenu=function(e){_this52.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this52.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this52.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this52.UIOnMouseleave(e);};//手机拖拽
|
|
12307
|
+
this.UIElement.ontouchstart=function(e){_this52.OnTouchStart(e);};this.UIElement.ontouchmove=function(e){_this52.OnTouchMove(e);};this.UIElement.ontouchend=function(e){_this52.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();//获取设备的分辨率
|
|
12255
12308
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12256
12309
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
12257
|
-
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
|
|
12258
|
-
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
|
|
12310
|
+
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 _this53=this;if(typeof this.FlashBGTimer=='number'){clearTimeout(this.FlashBGTimer);this.FlashBGTimer=null;}this.FlashBGTimer=setTimeout(function(){_this53.Draw();},frequency);};this.ResetReportStatus=function(){this.Data.XOffset=0;this.Data.YOffset=0;};this.ResetReportSelectStatus=function(){var chart=this.GetReportChart();if(chart){chart.SelectedRow=-1;chart.SelectedFixedRow=-1;}};this.ClearData=function(){this.SourceData.Data=[];this.Data.Data=[];this.BlockData=new _map2.default();};this.ResetSortStatus=function(){this.SortInfo.Field=-1;this.SortInfo.Sort=0;};//设置股票列表
|
|
12311
|
+
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 _this54=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(){_this54.RequestMemberListData();};this.MapStockData=new _map2.default();this.RequestStockListData(requestOption);return;}}this.RequestMemberListData();};this.RequestMemberListData=function(){//this.ChartSplashPaint.SetTitle(this.SplashTitle.MemberList);
|
|
12259
12312
|
//this.ChartSplashPaint.EnableSplash(true);
|
|
12260
12313
|
//this.Draw();
|
|
12261
12314
|
var self=this;if(this.NetworkFilter){var obj={Name:'JSReportChartContainer::RequestMemberListData',//类名::
|
|
@@ -12273,7 +12326,7 @@ this.GetStockData=function(symbol){if(!this.MapStockData)return null;if(!this.Ma
|
|
|
12273
12326
|
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)//超时的删除
|
|
12274
12327
|
{this.FlashBG.delete(symbol);return null;}if(!stockItem.Data||stockItem.Data.size<=0){this.FlashBG.delete(symbol);return null;}var aryDelID=[];//超时需要参数的
|
|
12275
12328
|
var _iteratorNormalCompletion21=true;var _didIteratorError21=false;var _iteratorError21=undefined;try{for(var _iterator21=(0,_getIterator3.default)(stockItem.Data),_step21;!(_iteratorNormalCompletion21=(_step21=_iterator21.next()).done);_iteratorNormalCompletion21=true){var mapItem=_step21.value;var item=mapItem[1];if(time-item.Time>=timeDiff||item.Count<=0)aryDelID.push(item.ID);}}catch(err){_didIteratorError21=true;_iteratorError21=err;}finally{try{if(!_iteratorNormalCompletion21&&_iterator21.return){_iterator21.return();}}finally{if(_didIteratorError21){throw _iteratorError21;}}}if(IFrameSplitOperator.IsNonEmptyArray(aryDelID)){for(var i=0;i<aryDelID.length;++i){stockItem.Data.delete(aryDelID[i]);}if(stockItem.Data.size<=0){this.FlashBG.delete(symbol);return null;}}return stockItem;};//delay=是否延迟
|
|
12276
|
-
this.DelayUpdateStockData=function(){var
|
|
12329
|
+
this.DelayUpdateStockData=function(){var _this55=this;if(this.DelayUpdateTimer!=null){clearTimeout(this.DelayUpdateTimer);this.DelayUpdateTimer=null;}var frequency=this.DelayUpdateFrequency;this.DelayUpdateTimer=setTimeout(function(){_this55.UpdateStockData();},frequency);};this.UpdateStockData=function(){if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;var chart=this.ChartPaint[0];if(!chart)return;if(this.SortInfo&&this.SortInfo.Field>=0&&this.SortInfo.Sort>0){var column=chart.Column[this.SortInfo.Field];if(column.Sort==2){this.RequestStockSortData(column,this.SortInfo.Field,this.SortInfo.Sort);//远程排序
|
|
12277
12330
|
return;}}var arySymbol=chart.ShowSymbol;if(!IFrameSplitOperator.IsNonEmptyArray(arySymbol))return;this.RequestStockData(arySymbol);};//下载股票数据
|
|
12278
12331
|
this.RequestStockData=function(arySymbol){var self=this;if(this.NetworkFilter){var obj={Name:'JSDealChartContainer::RequestStockData',//类名::函数名
|
|
12279
12332
|
Explain:'报价列表股票数据',Request:{Data:{stocks:arySymbol}},Self:this,PreventDefault:false};this.NetworkFilter(obj,function(data){self.RecvStockData(data);self.AutoUpdate();});if(obj.PreventDefault==true)return;}throw{Name:'JSReportChartContainer::RequestStockData',Error:'(报价列表股票数据)不提供内置测试数据'};};this.RecvStockData=function(data){var setUpdateSymbol=new _set2.default();//更新的股票列表
|
|
@@ -12329,7 +12382,7 @@ var result=this.MoveSelectedRow(-1);if(result){if(result.Redraw)this.Draw();if(r
|
|
|
12329
12382
|
var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}break;case 37://left
|
|
12330
12383
|
if(this.MoveXOffset(-1))this.Draw();break;case 39://right
|
|
12331
12384
|
if(this.MoveXOffset(1))this.Draw();break;}//不让滚动条滚动
|
|
12332
|
-
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
|
|
12385
|
+
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 _this56=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 },
|
|
12333
12386
|
//LastMove:{ X:e.clientX, Y:e.clientY},
|
|
12334
12387
|
ClickData:dragColumnWidth,ColumnWidth:dragColumnWidth.Column.Width};}else{var clickData=chart.OnMouseDown(x,y,e);if(!clickData)return;//if (e.button!=0) return;
|
|
12335
12388
|
if((clickData.Type==2||clickData.Type==4)&&(e.button==0||e.button==2))//点击行|固定行
|
|
@@ -12345,7 +12398,7 @@ if((clickData.Type==2||clickData.Type==4)&&(e.button==0||e.button==2))//点击
|
|
|
12345
12398
|
{if(this.MoveYOffset(-1)){this.Draw();this.DelayUpdateStockData();}}else if(scroll.Type==2)//底部按钮
|
|
12346
12399
|
{if(this.MoveYOffset(1)){this.Draw();this.DelayUpdateStockData();}}else if(scroll.Type==3)//滚动条
|
|
12347
12400
|
{this.DragYScroll={Click:{X:x,Y:y},LastMove:{X:x,Y:y}};}else if(scroll.Type==4)//滚动条内部
|
|
12348
|
-
{if(this.SetYOffset(scroll.Pos)){this.Draw();this.DelayUpdateStockData();}}}}}document.onmousemove=function(e){
|
|
12401
|
+
{if(this.SetYOffset(scroll.Pos)){this.Draw();this.DelayUpdateStockData();}}}}}document.onmousemove=function(e){_this56.DocOnMouseMove(e);};document.onmouseup=function(e){_this56.DocOnMouseUp(e);};};this.UIOnMounseUp=function(e){console.log('"UIOnMounseUp');};//去掉右键菜单
|
|
12349
12402
|
this.UIOnContextMenu=function(e){e.preventDefault();};this.UIOnMouseMove=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.DragRow)return;if(this.DrawHeader)return;if(this.DragColumnWidth)return;var tabChart=this.GetTabChart();if(tabChart){var tabData=tabChart.PtInTab(x,y);if(tabData){var index=tabData.Index;if(tabChart.MoveOnTabIndex!=index){tabChart.MoveOnTabIndex=index;this.Draw();}}}var mouseStatus={Cursor:"default",Name:"Default"};;//鼠标状态
|
|
12350
12403
|
var report=this.GetReportChart();var cell=null;var bDraw=false;if(report){var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);if(dragHeaderWidth){mouseStatus={Cursor:"col-resize",Name:"DragHeaderWidth"};JSConsole.Chart.Log("[JSReportChartContainer::UIOnMouseMove] drag column width ",dragHeaderWidth);}else{cell=report.PtInCell(x,y);//是否在单元格(EnableTooltip)
|
|
12351
12404
|
}var scrollbar=report.VScrollbar;if(scrollbar.Enable){var bShowScrollbar=report.PtInClient(x,y);this.IsShowVScrollbar=bShowScrollbar;if(!this.DragYScroll){if(bShowScrollbar&&!scrollbar.LastStatus.Draw)bDraw=true;else if(!bShowScrollbar&&scrollbar.LastStatus.Draw)bDraw=true;}}}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);if(event){var sendData={X:x,Y:y,Cell:cell};event.Callback(event,sendData,this);}if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;if(bDraw)this.Draw();};this.UIOnMounseOut=function(e){var bDraw=false;var tabChart=this.GetTabChart();if(tabChart&&tabChart.MoveOnTabIndex>=0){tabChart.MoveOnTabIndex=-1;bDraw=true;this.Draw();}var scrollbar=this.GetVScrollbarChart();if(scrollbar.Enable){this.IsShowVScrollbar=false;if(!this.DragYScroll){if(scrollbar.LastStatus.Draw)bDraw=true;}}if(bDraw)this.Draw();};this.UIOnMouseleave=function(e){var tabChart=this.GetTabChart();if(tabChart&&tabChart.MoveOnTabIndex>=0){tabChart.MoveOnTabIndex=-1;this.Draw();}};this.DocOnMouseMove=function(e){this.DragMove.PreMove.X=this.DragMove.Move.X;this.DragMove.PreMove.Y=this.DragMove.Move.Y;this.DragMove.Move.X=e.clientX;this.DragMove.Move.Y=e.clientX;if(this.DragMove.Move.X!=this.DragMove.PreMove.X||this.DragMove.Move.Y!=this.DragMove.PreMove.Y)this.StopAutoDragScrollTimer();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;//JSConsole.Chart.Log(`[JSReportChartContainer::DocOnMouseMove] x=${x}, y=${y}`);
|
|
@@ -12384,8 +12437,8 @@ if(chart.SelectedModel==0)//不可翻页模式, 只能在当前页移动
|
|
|
12384
12437
|
{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;};//左右移动
|
|
12385
12438
|
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;//显示最后一屏
|
|
12386
12439
|
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;if(IFrameSplitOperator.IsBool(option.Enable))scrollbar.Enable=option.Enable;};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();}};//点表头
|
|
12387
|
-
this.OnClickHeader=function(clickData,e){var
|
|
12388
|
-
{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
|
|
12440
|
+
this.OnClickHeader=function(clickData,e){var _this57=this;var header=clickData.Header;if(header.Column&&(header.Column.Sort==1||header.Column.Sort==2)){var index=header.Index;var sortInfo={Field:this.SortInfo.Field,Sort:this.SortInfo.Sort};var arySortType=header.Column.SortType;if(sortInfo.Field!=index){sortInfo.Field=index;sortInfo.Sort=arySortType[0];}else{if(arySortType.length==1){sortInfo.Sort=arySortType[0];}else{for(var i=0;i<arySortType.length;++i){if(sortInfo.Sort==arySortType[i]){sortInfo.Sort=arySortType[(i+1)%arySortType.length];break;}}}}if(header.Column.Sort==1||header.Column.Sort==2){if(sortInfo.Sort==0){this.Data.Data=[];for(var i=0;i<this.SourceData.Data.length;++i){this.Data.Data.push(this.SourceData.Data[i]);}}else{if(header.Column.Sort==1)//本地排序
|
|
12441
|
+
{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 _this57.LocalSort(left,right,header.Column,sortInfo.Sort);});}}else if(header.Column.Sort==2)//远程排序
|
|
12389
12442
|
{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);//远程排序
|
|
12390
12443
|
return;}}this.Data.YOffset=0;this.ResetReportSelectStatus();this.SortInfo.Field=sortInfo.Field;this.SortInfo.Sort=sortInfo.Sort;this.Draw();this.DelayUpdateStockData();}}};//点击标签
|
|
12391
12444
|
this.OnClickTab=function(tabData,e){if(!tabData.Tab)return;var redraw=false;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var uiElement={Left:this.UIElement.getBoundingClientRect().left,Top:this.UIElement.getBoundingClientRect().top};if(tabData.Tab.IsMenu){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_REPORT_TABMENU);if(event&&event.Callback){redraw=true;var rtItem=tabData.Rect;var rtDOM={Left:rtItem.Left/pixelTatio,Right:rtItem.Right/pixelTatio,Top:rtItem.Top/pixelTatio,Bottom:rtItem.Bottom/pixelTatio};var sendData={Data:tabData,IsSide:{X:x,Y:x},UIElement:uiElement,Rect:rtDOM,e:e,Redraw:redraw};event.Callback(event,sendData,this);if(IFrameSplitOperator.IsBool(sendData.Redraw))redraw=sendData.Redraw;}this.SetSelectedTab(tabData.Index);//选中tab
|
|
@@ -12667,16 +12720,16 @@ this.DragXScroll=null;//{Start:{x,y}, End:{x, y}}
|
|
|
12667
12720
|
this.IsDestroy=false;//是否已经销毁了
|
|
12668
12721
|
this.ChartDestory=function()//销毁
|
|
12669
12722
|
{this.IsDestroy=true;this.StopAutoUpdate();};//创建
|
|
12670
|
-
this.Create=function(option){var
|
|
12723
|
+
this.Create=function(option){var _this58=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
12671
12724
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
|
|
12672
12725
|
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;//创建表格
|
|
12673
|
-
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
|
|
12726
|
+
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 _this58.GetEventCallback(id);};chart.GetExePriceDataCallback=function(exePrice){return _this58.GetExePriceData(exePrice);};chart.GetFlashBGDataCallback=function(symbol,time){return _this58.GetFlashBGData(symbol,time);};chart.Data=this.Data;chart.BorderData=this.BorderData;chart.GlobalOption=this.GlobalOption;chart.SortInfo=this.SortInfo;this.ChartPaint[0]=chart;if(option){if(IFrameSplitOperator.IsBool(option.IsShowHeader))chart.IsShowHeader=option.IsShowHeader;//是否显示表头
|
|
12674
12727
|
if(IFrameSplitOperator.IsNumber(option.FixedColumn))chart.FixedColumn=option.FixedColumn;//固定列
|
|
12675
12728
|
if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
|
|
12676
12729
|
if(IFrameSplitOperator.IsBool(option.ItemBorder))chart.IsDrawBorder=option.ItemBorder;//单元格边框
|
|
12677
|
-
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){
|
|
12678
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
12679
|
-
this.UIElement.ondblclick=function(e){
|
|
12730
|
+
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){_this58.OnKeyDown(e);},true);//键盘消息
|
|
12731
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this58.OnWheel(e);},true);//上下滚动消息
|
|
12732
|
+
this.UIElement.ondblclick=function(e){_this58.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this58.UIOnMouseDown(e);};/*
|
|
12680
12733
|
this.UIElement.onmouseup=(e)=>{ this.UIOnMounseUp(e); }
|
|
12681
12734
|
this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
|
|
12682
12735
|
this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
|
|
@@ -12691,7 +12744,7 @@ this.UIElement.ondblclick=function(e){_this56.UIOnDblClick(e);};this.UIElement.o
|
|
|
12691
12744
|
*/};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();//获取设备的分辨率
|
|
12692
12745
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12693
12746
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
12694
|
-
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
|
|
12747
|
+
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 _this59=this;if(typeof this.FlashBGTimer=='number'){clearTimeout(this.FlashBGTimer);this.FlashBGTimer=null;}this.FlashBGTimer=setTimeout(function(){_this59.Draw();},frequency);};this.ClearData=function(){this.SourceData.Data=[];this.Data.Data=[];this.Data.Price=null;this.MapStockData=null;this.MapExePriceData=null;this.BorderData.MapData=null;};this.StopAutoUpdate=function(){this.CancelAutoUpdate();this.AutoUpdateEvent(false,'JSTReportChartContainer::StopAutoUpdate');if(!this.IsAutoUpdate)return;this.IsAutoUpdate=false;};//设置事件回调
|
|
12695
12748
|
//{event:事件id, callback:回调函数}
|
|
12696
12749
|
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)//获取事件回调
|
|
12697
12750
|
{if(!this.mapEvent.has(id))return null;var item=this.mapEvent.get(id);return item;};this.OnSize=function(){if(!this.Frame)return;this.SetSizeChange(true);this.Draw();this.DelayUpdateStockData();};this.SetSizeChange=function(bChanged){for(var i=0;i<this.ChartPaint.length;++i){var chart=this.ChartPaint[i];if(chart)chart.SizeChange=bChanged;}};this.ChangeSymbol=function(symbol,option){this.CancelAutoUpdate();this.ClearData();this.Symbol=symbol;this.Name=symbol;if(option){if(option.Name)this.Name=option.Name;}this.RequestStockListData();};this.CancelAutoUpdate=function()//关闭停止更新
|
|
@@ -12701,10 +12754,10 @@ Explain:'T型报价列表数据',Self:this,PreventDefault:false};this.NetworkFil
|
|
|
12701
12754
|
}throw{Name:'JSTReportChartContainer::RequestStockListData',Error:'(T型报价列表数据)不提供内置测试数据'};};this.RecvStockListData=function(data){if(IFrameSplitOperator.IsNonEmptyArray(data.data)){this.MapExePriceData=new _map2.default();this.MapStockData=new _map2.default();//0=行权价格 1=左边期权代码 2=右侧期权代码 3=左侧期权名称 4=右侧期权名称
|
|
12702
12755
|
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;}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 _iteratorNormalCompletion22=true;var _didIteratorError22=false;var _iteratorError22=undefined;try{for(var _iterator22=(0,_getIterator3.default)(this.MapStockData),_step22;!(_iteratorNormalCompletion22=(_step22=_iterator22.next()).done);_iteratorNormalCompletion22=true){var mapItem=_step22.value;arySymbol.push(mapItem[0]);}}catch(err){_didIteratorError22=true;_iteratorError22=err;}finally{try{if(!_iteratorNormalCompletion22&&_iterator22.return){_iterator22.return();}}finally{if(_didIteratorError22){throw _iteratorError22;}}}if(!IFrameSplitOperator.IsNonEmptyArray(arySymbol))return;this.RequestStockData(arySymbol);};//下载期权数据
|
|
12703
12756
|
this.RequestStockData=function(arySymbol){var self=this;if(this.NetworkFilter){var obj={Name:'JSTReportChartContainer::RequestStockData',//类名::函数名
|
|
12704
|
-
Explain:'T型报价列表期权数据',Request:{Data:{stocks:arySymbol,symbol:this.Symbol}},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
|
|
12757
|
+
Explain:'T型报价列表期权数据',Request:{Data:{stocks:arySymbol,symbol:this.Symbol}},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 _this60=this;var setUpdateSymbol=new _set2.default();//更新的股票列表
|
|
12705
12758
|
if(IFrameSplitOperator.IsNonEmptyArray(data.data)){for(var i=0;i<data.data.length;++i){var item=data.data[i];var symbol=item[0];//0=证券代码;
|
|
12706
12759
|
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;//实时数据排序
|
|
12707
|
-
var chart=this.ChartPaint[0];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
|
|
12760
|
+
var chart=this.ChartPaint[0];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 _this60.LocalSort(left,right,column,_this60.SortInfo.Sort,_this60.SortInfo.CellType);});}}this.CalculateData();this.Draw();};//计算统计数据
|
|
12708
12761
|
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 _iteratorNormalCompletion23=true;var _didIteratorError23=false;var _iteratorError23=undefined;try{for(var _iterator23=(0,_getIterator3.default)(this.MapExePriceData),_step23;!(_iteratorNormalCompletion23=(_step23=_iterator23.next()).done);_iteratorNormalCompletion23=true){var mapItem=_step23.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(leftMaxPosition.Max==null||leftMaxPosition.Max<rightData.Position){rightMaxPosition.Max=rightData.Position;rightMaxPosition.ExePrice=mapItem[0];}}}}catch(err){_didIteratorError23=true;_iteratorError23=err;}finally{try{if(!_iteratorNormalCompletion23&&_iterator23.return){_iterator23.return();}}finally{if(_didIteratorError23){throw _iteratorError23;}}}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数据
|
|
12709
12762
|
this.ReadStockJsonData=function(stock,item){//0=证券代码 1=股票名称 2=昨收 3=开 4=高 5=低 6=收 7=成交量 8=成交金额, 9=买价 10=买量 11=卖价 12=卖量 13=均价 14=持仓 16=涨停价 17=跌停价
|
|
12710
12763
|
//21=涨幅% 22=涨跌 24=振幅%
|
|
@@ -12729,14 +12782,14 @@ if(item[33])stock.KLine=item[33];//33=K线
|
|
|
12729
12782
|
var frequency=this.AutoUpdateFrequency;if(marketStatus==1)//盘前
|
|
12730
12783
|
{this.AutoUpdateTimer=setTimeout(function(){self.AutoUpdate();},frequency);}else if(marketStatus==2)//盘中
|
|
12731
12784
|
{this.AutoUpdateTimer=setTimeout(function(){self.UpdateStockData();},frequency);}};//delay=是否延迟
|
|
12732
|
-
this.DelayUpdateStockData=function(){var
|
|
12785
|
+
this.DelayUpdateStockData=function(){var _this61=this;if(this.DelayUpdateTimer!=null){clearTimeout(this.DelayUpdateTimer);this.DelayUpdateTimer=null;}var frequency=this.DelayUpdateFrequency;this.DelayUpdateTimer=setTimeout(function(){_this61.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))//点击行
|
|
12733
12786
|
{if(clickData.Redraw==true)this.Draw();}else if(clickData.Type==3&&e.button==0)//表头
|
|
12734
12787
|
{this.OnClickHeader(clickData,e);}//document.onmousemove=(e)=>{ this.DocOnMouseMove(e); }
|
|
12735
12788
|
//document.onmouseup=(e)=> { this.DocOnMouseUp(e); }
|
|
12736
12789
|
};//点表头
|
|
12737
12790
|
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);}};//排序
|
|
12738
|
-
this.SortHeader=function(column,sortData){var
|
|
12739
|
-
{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
|
|
12791
|
+
this.SortHeader=function(column,sortData){var _this62=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)//还原
|
|
12792
|
+
{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 _this62.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();};//本地排序
|
|
12740
12793
|
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://行权价格
|
|
12741
12794
|
case TREPORT_COLUMN_ID.POSITION_ID://持仓量
|
|
12742
12795
|
case TREPORT_COLUMN_ID.AMPLITUDE_ID:case TREPORT_COLUMN_ID.INCREASE_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)//行权价格
|
|
@@ -12916,11 +12969,11 @@ this.MapSymbol.clear();this.Data.Data=[];this.Data.XOffset=0;this.Data.YOffset=0
|
|
|
12916
12969
|
}
|
|
12917
12970
|
this.ChartPaint[0].SelectedRow=0;
|
|
12918
12971
|
*/};//创建
|
|
12919
|
-
this.Create=function(option){var
|
|
12972
|
+
this.Create=function(option){var _this63=this;this.UIElement.JSChartContainer=this;//创建框架
|
|
12920
12973
|
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;//创建表格
|
|
12921
|
-
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
|
|
12922
|
-
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){
|
|
12923
|
-
this.UIElement.ondblclick=function(e){
|
|
12974
|
+
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 _this63.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this63.GetStockData(symbol);};chart.Data=this.Data;this.ChartPaint[0]=chart;if(option){}var bRegisterKeydown=true;var bRegisterWheel=true;if(option){if(option.KeyDown===false){bRegisterKeydown=false;JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register keydown event.');}if(option.Wheel===false){bRegisterWheel=false;JSConsole.Chart.Log('[JSKeyboardChartContainer::Create] not register wheel event.');}}if(bRegisterKeydown)this.UIElement.addEventListener("keydown",function(e){_this63.OnKeyDown(e);},true);//键盘消息
|
|
12975
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this63.OnWheel(e);},true);//上下滚动消息
|
|
12976
|
+
this.UIElement.ondblclick=function(e){_this63.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this63.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this63.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this63.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this63.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this63.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();//获取设备的分辨率
|
|
12924
12977
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12925
12978
|
this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
12926
12979
|
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;}};//设置事件回调
|
|
@@ -12937,9 +12990,9 @@ var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();}brea
|
|
|
12937
12990
|
if(this.MoveXOffset(-1))this.Draw();break;case 39://right
|
|
12938
12991
|
if(this.MoveXOffset(1))this.Draw();break;case 13://Enter
|
|
12939
12992
|
this.OnSelectedSymbol();break;}//不让滚动条滚动
|
|
12940
|
-
if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.OnSelectedSymbol=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return false;var chart=this.ChartPaint[0];if(!chart)return false;var data=chart.GetSelectedSymbol();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SELECTED);if(event&&event.Callback){event.Callback(event,{Data:data},this);}};this.UIOnDblClick=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart){if(chart.OnDblClick(x,y,e))this.OnSelectedSymbol();}};this.UIOnMouseDown=function(e){var
|
|
12993
|
+
if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.OnSelectedSymbol=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return false;var chart=this.ChartPaint[0];if(!chart)return false;var data=chart.GetSelectedSymbol();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SELECTED);if(event&&event.Callback){event.Callback(event,{Data:data},this);}};this.UIOnDblClick=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart){if(chart.OnDblClick(x,y,e))this.OnSelectedSymbol();}};this.UIOnMouseDown=function(e){var _this64=this;this.DragXScroll=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var chart=this.ChartPaint[0];if(chart){var clickData=chart.OnMouseDown(x,y,e);if(!clickData)return;//if (e.button!=0) return;
|
|
12941
12994
|
if(clickData.Type==2&&(e.button==0||e.button==2))//点击行
|
|
12942
|
-
{if(clickData.Redraw==true)this.Draw();}}document.onmousemove=function(e){
|
|
12995
|
+
{if(clickData.Redraw==true)this.Draw();}}document.onmousemove=function(e){_this64.DocOnMouseMove(e);};document.onmouseup=function(e){_this64.DocOnMouseUp(e);};};//去掉右键菜单
|
|
12943
12996
|
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)
|
|
12944
12997
|
// this.StopAutoDragScrollTimer();
|
|
12945
12998
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;//JSConsole.Chart.Log(`[JSReportChartContainer::DocOnMouseMove] x=${x}, y=${y}`);
|
|
@@ -13052,12 +13105,12 @@ this.HQChart=null;this.ChartDestory=function()//销毁
|
|
|
13052
13105
|
//{event:事件id, callback:回调函数}
|
|
13053
13106
|
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)//获取事件回调
|
|
13054
13107
|
{if(!this.mapEvent.has(id))return null;var item=this.mapEvent.get(id);return item;};//创建
|
|
13055
|
-
this.Create=function(option){var
|
|
13108
|
+
this.Create=function(option){var _this65=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
13056
13109
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
|
|
13057
13110
|
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;//背景
|
|
13058
|
-
var chart=new ScrollBarBGChart();chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return
|
|
13059
|
-
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
|
|
13060
|
-
this.UIElement.onmousedown=function(e){
|
|
13111
|
+
var chart=new ScrollBarBGChart();chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this65.GetEventCallback(id);};this.ChartPaint.push(chart);//创建滑块
|
|
13112
|
+
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 _this65.GetEventCallback(id);};this.SliderChart=chart;this.ChartPaint.push(chart);//this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
|
|
13113
|
+
this.UIElement.onmousedown=function(e){_this65.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this65.UIOnContextMenu(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);};//手机拖拽
|
|
13061
13114
|
//this.UIElement.ontouchstart=(e)=> { this.OnTouchStart(e); }
|
|
13062
13115
|
//this.UIElement.ontouchmove=(e)=> {this.OnTouchMove(e); }
|
|
13063
13116
|
//this.UIElement.ontouchend=(e)=> {this.OnTouchEnd(e); }
|
|
@@ -13065,13 +13118,13 @@ this.UIElement.onmousedown=function(e){_this63.UIOnMouseDown(e);};this.UIElement
|
|
|
13065
13118
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
13066
13119
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
13067
13120
|
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;}};//未启动
|
|
13068
|
-
this.UIOnDblClick=function(e){};this.CancelDragTimer=function(){if(this.DragTimer){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.UIOnMouseDown=function(e){var
|
|
13069
|
-
}document.onmousemove=function(e){
|
|
13121
|
+
this.UIOnDblClick=function(e){};this.CancelDragTimer=function(){if(this.DragTimer){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.UIOnMouseDown=function(e){var _this66=this;this.CancelDragTimer();this.DragSlider=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.SliderChart){var clickData=this.SliderChart.PtInChart(x,y);if(!clickData)return;this.DragSlider={Click:{X:e.clientX,Y:e.clientY},LastMove:{X:e.clientX,Y:e.clientY},Data:clickData};this.DragSlider.DrawCount=0;//重绘次数
|
|
13122
|
+
}document.onmousemove=function(e){_this66.DocOnMouseMove(e);};document.onmouseup=function(e){_this66.DocOnMouseUp(e);};};//去掉右键菜单
|
|
13070
13123
|
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"};;//鼠标状态
|
|
13071
|
-
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
|
|
13124
|
+
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 _this67=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)//整体移动
|
|
13072
13125
|
{if(xStart<left)//第1页
|
|
13073
13126
|
{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)//左移动
|
|
13074
|
-
{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(){
|
|
13127
|
+
{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(){_this67.DragUpdate(_this67.DragSlider);},this.DelayDragFrequency);}}};this.DocOnMouseUp=function(e){//清空事件
|
|
13075
13128
|
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: }
|
|
13076
13129
|
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();};//移动滑块
|
|
13077
13130
|
this.UpdateXDataOffset=function(obj){if(obj.Type==0){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start);var moveSetp=start-this.XOffsetData.Start;this.XOffsetData.Start=start;this.XOffsetData.End+=moveSetp;}else if(obj.Type==1){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start);this.XOffsetData.Start=start;}else if(obj.Type==2){var end=this.Frame.GetXData(obj.XEnd);end=parseInt(end);this.XOffsetData.End=end;}var endItem=this.SourceData.Data[this.XOffsetData.End];var startItem=this.SourceData.Data[this.XOffsetData.Start];var sendData={Type:obj.Type,Count:this.XOffsetData.Count};if(this.XOffsetData.End>this.XOffsetData.Start){sendData.Start={Index:this.XOffsetData.Start,Item:startItem};sendData.End={Index:this.XOffsetData.End,Item:endItem};}else{sendData.Start={Index:this.XOffsetData.End,Item:endItem};sendData.End={Index:this.XOffsetData.Start,Item:startItem};}if(this.HQChart&&this.HQChart.JSChartContainer){var internalChart=this.HQChart.JSChartContainer;if(internalChart.ChartOperator){var obj={ID:JSCHART_OPERATOR_ID.OP_SCROOLBAR_SLIDER_CHANGED,Start:sendData.Start,End:sendData.End,Type:sendData.Type};internalChart.ChartOperator(obj);}}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SCROLLBAR_SLIDER_CHANGED);if(event){event.Callback(event,sendData,this);}};this.ReloadResource=function(option){this.Frame.ReloadResource(option);for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.ReloadResource)item.ReloadResource(option);}if(option&&option.Redraw){this.SetSizeChange(true);this.Draw();}};this.GetPageRange=function(){var result={};var showCount=Math.abs(this.XOffsetData.Start-this.XOffsetData.End);result.ShowCount=showCount;//第1页
|
|
@@ -13124,19 +13177,59 @@ this.AreaColor=g_JSChartResource.ScrollBar.BGChart.AreaColor;//面积图颜色
|
|
|
13124
13177
|
this.ReloadResource=function(resource){this.Color=g_JSChartResource.ScrollBar.BGChart.Color;//线段颜色
|
|
13125
13178
|
this.LineWidth=g_JSChartResource.ScrollBar.BGChart.LineWidth;//线段宽度
|
|
13126
13179
|
this.AreaColor=g_JSChartResource.ScrollBar.BGChart.AreaColor;//面积图颜色
|
|
13127
|
-
};this.Draw=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;this.Canvas.save();if(this.LineWidth>0)this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();var bottom=this.ChartBorder.GetBottom();this.Canvas.strokeStyle=this.Color;var bFirstPoint=true;var drawCount=0,x,y;var firstPoint={};for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var value=item.Close;if(!IFrameSplitOperator.IsNumber(value))continue;x=this.ChartFrame.GetXFromIndex(i);y=this.ChartFrame.GetYFromData(value);if(bFirstPoint){this.Canvas.beginPath();this.Canvas.moveTo(x,y);bFirstPoint=false;firstPoint={X:x,Y:y};}else{this.Canvas.lineTo(x,y);}++drawCount;}if(drawCount>0){this.Canvas.stroke();this.Canvas.lineTo(x,bottom);this.Canvas.lineTo(firstPoint.X,bottom);this.Canvas.closePath();this.Canvas.fillStyle=this.AreaColor;this.Canvas.fill();}this.Canvas.restore();};this.GetMaxMin=function(){var range={Max:null,Min:null};if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return range;for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var value=item.Close;if(!IFrameSplitOperator.IsNumber(value))continue;if(range.Max==null||range.Max<value)range.Max=value;if(range.Min==null||range.Min>value)range.Min=value;}return range;};}
|
|
13180
|
+
};this.Draw=function(){if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;this.Canvas.save();if(this.LineWidth>0)this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();var bottom=this.ChartBorder.GetBottom();this.Canvas.strokeStyle=this.Color;var bFirstPoint=true;var drawCount=0,x,y;var firstPoint={};for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var value=item.Close;if(!IFrameSplitOperator.IsNumber(value))continue;x=this.ChartFrame.GetXFromIndex(i);y=this.ChartFrame.GetYFromData(value);if(bFirstPoint){this.Canvas.beginPath();this.Canvas.moveTo(x,y);bFirstPoint=false;firstPoint={X:x,Y:y};}else{this.Canvas.lineTo(x,y);}++drawCount;}if(drawCount>0){this.Canvas.stroke();this.Canvas.lineTo(x,bottom);this.Canvas.lineTo(firstPoint.X,bottom);this.Canvas.closePath();this.Canvas.fillStyle=this.AreaColor;this.Canvas.fill();}this.Canvas.restore();};this.GetMaxMin=function(){var range={Max:null,Min:null};if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return range;for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var value=item.Close;if(!IFrameSplitOperator.IsNumber(value))continue;if(range.Max==null||range.Max<value)range.Max=value;if(range.Min==null||range.Min>value)range.Min=value;}return range;};}/*
|
|
13181
|
+
Copyright (c) 2018 jones
|
|
13182
|
+
|
|
13183
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
13184
|
+
|
|
13185
|
+
开源项目 https://github.com/jones2000/HQChart
|
|
13186
|
+
|
|
13187
|
+
jones_2000@163.com
|
|
13188
|
+
|
|
13189
|
+
内置菜单 使用table模式
|
|
13190
|
+
*/function JSPopMenu(){this.Data={Menu:[],Position:0};//{ Name:, SVG, ID, bChecked:, SubMenu:[] } Position 0=右键菜单 1=Tab弹菜单 2=下拉菜单
|
|
13191
|
+
this.RootDOM=null;this.TBodyDOM=null;this.ArySubRootDOM=[];this.ClickCallback=null;//点击回调
|
|
13192
|
+
this.CheckedClassName="UMyChart_MenuItem_Span_Checked iconfont icon-checked";//选中图标
|
|
13193
|
+
this.RightArrowClassName="UMyChart_MenuItem_Span_Arrow iconfont icon-menu_arraw_right";//右侧箭头
|
|
13194
|
+
this.AryTDClassName=["UMyChart_MenuItem_Td_Status",//图标
|
|
13195
|
+
"UMyChart_MenuItem_Td_Content",//文字
|
|
13196
|
+
"UMyChart_MenuItem_Td_Shortcut",//快捷方式
|
|
13197
|
+
"UMyChart_MenuItem_Td_Arrow"//箭头
|
|
13198
|
+
];this.Inital=function(){var _this68=this;window.addEventListener('mousedown',function(e){_this68.OnWindowMouseDown(e);});};//创建菜单
|
|
13199
|
+
this.CreatePopMenu=function(data){this.Clear();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};for(var i=0;i<data.Menu.length;++i){var item=data.Menu[i];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;};//清除菜单
|
|
13200
|
+
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 _this69=this;var trDom=document.createElement("tr");trDom.className='UMyChart_MenuItem_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)//图标
|
|
13201
|
+
{if(item.Checked){var spanDom=document.createElement("span");spanDom.className=this.CheckedClassName;tdDom.appendChild(spanDom);}}else if(i==1)//内容
|
|
13202
|
+
{tdDom.innerText=item.Name;}else if(i==2)//快捷方式
|
|
13203
|
+
{}else if(i==3)//箭头
|
|
13204
|
+
{if(IFrameSplitOperator.IsNonEmptyArray(item.SubMenu)){var spanDom=document.createElement("span");spanDom.className=this.RightArrowClassName;tdDom.appendChild(spanDom);}}trDom.appendChild(tdDom);}if(IFrameSplitOperator.IsNonEmptyArray(item.SubMenu))//子菜单
|
|
13205
|
+
{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};var preTrDom=null;for(var i=0;i<item.SubMenu.length;++i){var subItem=item.SubMenu[i];if(subItem.Name==JSPopMenu.SEPARATOR_LINE_NAME){if(preTrDom)preTrDom.classList.add("border");continue;}var subTrDom=this.CreateMenu(subRootData,subItem);preTrDom=subTrDom;subTbody.appendChild(subTrDom);}trDom.onmouseover=function(e){_this69.OnMouseOver(e,parentItem,trDom,subRoot);};document.body.appendChild(subRoot);this.ArySubRootDOM.push(subRoot);}else{trDom.onmousedown=function(e){_this69.OnClickMenu(e,item,false);};//菜单点击
|
|
13206
|
+
trDom.onmouseover=function(e){_this69.OnMouseOver(e,parentItem);};}return trDom;};//弹tab菜单
|
|
13207
|
+
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";};//弹右键菜单
|
|
13208
|
+
this.PopupMenuByRight=function(x,y){if(!this.RootDOM)return;if(!IFrameSplitOperator.IsNumber(x)||!IFrameSplitOperator.IsNumber(y))return;this.RootDOM.style.visibility='visible';this.RootDOM.style.top=y+"px";this.RootDOM.style.left=x+"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";parentItem.PopMenu=null;parentItem.PopRow=null;}if(subMenu){if(subMenu.style.visibility=="visible"){}else{var rtParent=trDom.getBoundingClientRect();subMenu.style.left=rtParent.right+'px';subMenu.style.top=rtParent.top+'px';/*
|
|
13209
|
+
if (this.Data.Position==JSPopMenu.POSITION_ID.TAB_MENU_ID)
|
|
13210
|
+
{
|
|
13211
|
+
var yButton=parentItem.Root.getBoundingClientRect().bottom;
|
|
13212
|
+
var ySubButton=subMenu.getBoundingClientRect().bottom;
|
|
13213
|
+
if (yButton<ySubButton)
|
|
13214
|
+
{
|
|
13215
|
+
var yOffset=yButton-ySubButton;
|
|
13216
|
+
subMenu.style.top=`${yOffset}px`;
|
|
13217
|
+
}
|
|
13218
|
+
}
|
|
13219
|
+
*/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.SEPARATOR_LINE_NAME="MENU_SEPARATOR";//分割线
|
|
13220
|
+
///////////////////////////////////////////////////////////////////////////////////
|
|
13128
13221
|
// 工作线程计算指标示例
|
|
13129
13222
|
//
|
|
13130
13223
|
//
|
|
13131
13224
|
//////////////////////////////////////////////////////////////////////////////////
|
|
13132
13225
|
function HQChartScriptWorker(){this.Status=0;//0=空闲 1=运行
|
|
13133
|
-
this.Create=function(){var
|
|
13134
|
-
};this.ExecuteScript=function(indexData,message){var
|
|
13226
|
+
this.Create=function(){var _this70=this;addEventListener('message',function(obj){_this70.OnRecvMessage(obj);});};this.NetworkFilter=function(data,callback,indexInfo){JSConsole.Complier.Log('[HQChartScriptWorker::NetworkFilter] ['+data.Name+']['+data.Explain+'] data=',data);//数据下载
|
|
13227
|
+
};this.ExecuteScript=function(indexData,message){var _this71=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){_this71.OnExecuteError(error,indexInfo,message);};scriptObj.FinishCallback=function(data,jsExectute){_this71.OnExecuteFinish(data,indexInfo,jsExectute,message);};scriptObj.NetworkFilter=function(data,callback){_this71.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=分钟
|
|
13135
13228
|
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;//执行状态
|
|
13136
13229
|
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);};}/********************************************************************************
|
|
13137
13230
|
* 版本信息输出
|
|
13138
13231
|
*
|
|
13139
|
-
*/var HQCHART_VERSION="1.1.
|
|
13232
|
+
*/var HQCHART_VERSION="1.1.13181";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
|
|
13140
13233
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
13141
13234
|
// BaseIndex:BaseIndex,
|
|
13142
13235
|
// ChartLine:ChartLine,
|
|
@@ -13163,4 +13256,4 @@ GetDevicePixelRatio:GetDevicePixelRatio},(0,_defineProperty3.default)(_jsChartIn
|
|
|
13163
13256
|
HQMinuteTimeStringFormat:HQMinuteTimeStringFormat,//分时图X轴 十字光标输出格式化
|
|
13164
13257
|
HQDateStringFormat:HQDateStringFormat,//K线图X轴 十字光标输出格式化
|
|
13165
13258
|
HQPriceStringFormat:HQPriceStringFormat//分时图,K线图Y轴 十字光标输出格式化
|
|
13166
|
-
}),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'JS_ID',{JSCHART_EVENT_ID:JSCHART_EVENT_ID,JSCHART_OPERATOR_ID:JSCHART_OPERATOR_ID,JSCHART_DRAG_ID:JSCHART_DRAG_ID,JSCHART_BUTTON_ID:JSCHART_BUTTON_ID,JSCHART_DATA_FIELD_ID:JSCHART_DATA_FIELD_ID,JSCHART_WORKER_MESSAGE_ID:JSCHART_WORKER_MESSAGE_ID}),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'HQChartScriptWorker',HQChartScriptWorker),_jsChartInit$jsChartS);
|
|
13259
|
+
}),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'JS_ID',{JSCHART_EVENT_ID:JSCHART_EVENT_ID,JSCHART_OPERATOR_ID:JSCHART_OPERATOR_ID,JSCHART_DRAG_ID:JSCHART_DRAG_ID,JSCHART_BUTTON_ID:JSCHART_BUTTON_ID,JSCHART_DATA_FIELD_ID:JSCHART_DATA_FIELD_ID,JSCHART_WORKER_MESSAGE_ID:JSCHART_WORKER_MESSAGE_ID}),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'HQChartScriptWorker',HQChartScriptWorker),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'JSPopMenu',JSPopMenu),_jsChartInit$jsChartS);
|