hqchart 1.1.13171 → 1.1.13191
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 +304 -272
- package/package.json +1 -1
- package/src/jscommon/umychart.js +903 -1620
- package/src/jscommon/umychart.popMenu.js +311 -0
- package/src/jscommon/umychart.resource/css/tools.css +135 -0
- package/src/jscommon/umychart.resource/css/umychart.popmenu.css +129 -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 +904 -1621
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +1219 -1622
package/lib/umychart.vue.js
CHANGED
|
@@ -1146,8 +1146,8 @@ 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;//右键菜单
|
|
1150
|
-
if(option.IsShowRightMenu
|
|
1149
|
+
chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;chart.MinuteDialog=this.MinuteDialog;var pixelRatio=GetDevicePixelRatio();//右键菜单
|
|
1150
|
+
if(IFrameSplitOperator.IsBool(option.IsShowRightMenu))chart.IsShowRightMenu=option.IsShowRightMenu;if(option.ScriptError)chart.ScriptErrorCallback=option.ScriptError;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)//画图工具
|
|
1153
1153
|
{if(option.DrawPicture.StorageKey&&chart.ChartDrawStorage)chart.ChartDrawStorage.Load(option.DrawPicture.StorageKey);}if(option.DrawTool)//画图工具
|
|
@@ -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);}}//创建子窗口的指标
|
|
@@ -1179,14 +1179,14 @@ if(option.OverlayIndexFrameWidth>40)chart.Frame.FixedRightWidth.Overlay=option.O
|
|
|
1179
1179
|
if(IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex)){for(var i=0;i<option.OverlayIndex.length;++i){var item=option.OverlayIndex[i];if(item.Windows>=chart.Frame.SubFrame.length)continue;var itemString=(0,_stringify2.default)(item);var obj=JSON.parse(itemString);if(item.Index)obj.IndexName=item.Index;if(item.Windows>=0)obj.WindowIndex=item.Windows;chart.CreateOverlayWindowsIndex(obj);}}this.AdjustTitleHeight(chart);return chart;};//自定义指数历史K线图
|
|
1180
1180
|
this.CreateCustomKLineChartContainer=function(option){var chart=new CustomKLineChartContainer(this.CanvasElement);//创建改参数div
|
|
1181
1181
|
chart.ModifyIndexDialog=this.ModifyIndexDialog;chart.ChangeIndexDialog=this.ChangeIndexDialog;chart.MinuteDialog=this.MinuteDialog;//右键菜单
|
|
1182
|
-
if(option.IsShowRightMenu
|
|
1182
|
+
if(IFrameSplitOperator.IsBool(option.IsShowRightMenu))chart.IsShowRightMenu=option.IsShowRightMenu;if(option.KLine)//k线图的属性设置
|
|
1183
1183
|
{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.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(option.KLine.PageSize>0)chart.PageSize=option.KLine.PageSize;if(option.KLine.IsShowTooltip==false)chart.IsShowTooltip=false;}if(option.CustomStock)chart.CustomStock=option.CustomStock;if(option.QueryDate)chart.QueryDate=option.QueryDate;if(!option.Windows||option.Windows.length<=0)return null;//创建子窗口
|
|
1184
1184
|
chart.Create(option.Windows.length);if(option.Border){if(!isNaN(option.Border.Left))chart.Frame.ChartBorder.Left=option.Border.Left;if(!isNaN(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;if(!isNaN(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;}if(option.IsShowCorssCursorInfo==false)//取消显示十字光标刻度信息
|
|
1185
1185
|
{chart.ChartCorssCursor.IsShowText=option.IsShowCorssCursorInfo;}if(option.Frame){for(var i=0;i<option.Frame.length;++i){var item=option.Frame[i];if(item.SplitCount)chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;if(item.StringFormat)chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;}}if(option.KLineTitle){if(option.KLineTitle.IsShowName==false)chart.TitlePaint[0].IsShowName=false;if(option.KLineTitle.IsShowSettingInfo==false)chart.TitlePaint[0].IsShowSettingInfo=false;}//创建子窗口的指标
|
|
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)//分钟走势图属性设置
|
|
@@ -1197,9 +1197,9 @@ if(IFrameSplitOperator.IsBool(option.EnableZoomIndexWindow))chart.EnableZoomInde
|
|
|
1197
1197
|
if(option.SelectedChart){var item=option.SelectedChart;if(IFrameSplitOperator.IsBool(item.EnableSelected))chart.SelectedChart.EnableSelected=item.EnableSelected;if(IFrameSplitOperator.IsBool(item.EnableMoveOn))chart.SelectedChart.EnableMoveOn=item.EnableMoveOn;}//分页
|
|
1198
1198
|
if(option.PageInfo)chart.SetPageInfo(option.PageInfo);chart.Create(windowsCount,option);//创建子窗口
|
|
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
|
-
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
|
|
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(IFrameSplitOperator.IsBool(option.IsShowRightMenu))chart.IsShowRightMenu=option.IsShowRightMenu;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个指标窗口设置
|
|
@@ -1247,14 +1247,13 @@ this.CreateDepthChartContainer=function(option){var chart=null;chart=new DepthCh
|
|
|
1247
1247
|
}if(item.IsShowXLine==false)chart.Frame.IsShowXLine=item.IsShowXLine;if(item.IsShowYLine==false)chart.Frame.IsShowYLine=item.IsShowYLine;if(IFrameSplitOperator.IsNumber(item.XSplitCount))chart.Frame.XSplitOperator.SplitCount=item.XSplitCount;//X轴刻度个数 半边的
|
|
1248
1248
|
}return chart;};//根据option内容绘制图形
|
|
1249
1249
|
this.SetOption=function(option){//toolbar按钮风格
|
|
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
|
|
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;chart.DivElement=this.DivElement;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;//内置菜单
|
|
1252
|
+
if(option.EnablePopMenuV2===true)chart.InitalPopMenu();//注册事件
|
|
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,33 @@ 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
|
+
CMD_SHOW_BEFORE_DATA_ID:24,//显示|隐藏集合竞价
|
|
1482
|
+
CMD_SELECTED_ZOOM_ID:25,//选中放大
|
|
1483
|
+
CMD_SELECTED_SUMMARY_ID:26//区间统计
|
|
1484
|
+
};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
1485
|
图形控件
|
|
1463
|
-
*/function JSChartContainer(uielement,OffscreenElement,cacheElement){var
|
|
1486
|
+
*/function JSChartContainer(uielement,OffscreenElement,cacheElement){var _this5=this;this.ClassName='JSChartContainer';var _self=this;this.Frame;//框架画法
|
|
1464
1487
|
this.ChartPaint=new Array();//图形画法
|
|
1465
1488
|
this.ChartPaintEx=[];//图形扩展画法
|
|
1466
1489
|
this.ChartInfo=new Array();//K线|走势图上信息地雷
|
|
@@ -1509,8 +1532,7 @@ this.TooltipCache={Type:null,IsShow:false,X:null,Y:null,Data:null,InnerHTML:null
|
|
|
1509
1532
|
//区间选择
|
|
1510
1533
|
this.SelectRect=document.createElement("div");this.SelectRect.className="jschart-selectrect";this.SelectRect.style.background=g_JSChartResource.SelectRectBGColor;this.SelectRect.style["pointer-events"]="none";//this.SelectRect.style.opacity=g_JSChartResource.SelectRectAlpha;
|
|
1511
1534
|
this.SelectRect.id=Guid();this.SelectRect.oncontextmenu=function(){return false;};//屏蔽选中区域系统右键菜单
|
|
1512
|
-
uielement.parentNode.appendChild(this.SelectRect)
|
|
1513
|
-
this.SelectRectRightMenu;//坐标轴风格方法 double-更加数值型分割 price-更加股票价格分割
|
|
1535
|
+
uielement.parentNode.appendChild(this.SelectRect);//坐标轴风格方法 double-更加数值型分割 price-更加股票价格分割
|
|
1514
1536
|
this.FrameSplitData=new _map2.default();this.FrameSplitData.set("double",new SplitData());this.FrameSplitData.set("price",new PriceSplitData());//事件回调
|
|
1515
1537
|
this.mapEvent=new _map2.default();//通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
|
|
1516
1538
|
this.PhonePinch=null;//手机双指操作信息
|
|
@@ -1535,18 +1557,20 @@ this.EnableVerticalDrag=false;//十字光标长留(手势才有)
|
|
|
1535
1557
|
this.ClickModel={IsShowCorssCursor:false};this.EnableClickModel=false;//标题栏显示最新数据
|
|
1536
1558
|
this.DisplayLatestOption={Timer:null,Enable:false,DelayTime:60*1000*3,LastPoint:null};this.DrawDynamicInfoOption={Timer:null,Enable:false,DelayTime:10};this.CustomChartDrag;//自定义图形的拖拽操作 { Type:, Data: }
|
|
1537
1559
|
this.StockCache={Data:null};//扩展数据缓存数据
|
|
1538
|
-
this.
|
|
1560
|
+
this.JSPopMenu;//内置菜单
|
|
1561
|
+
this.IsShowRightMenu=true;//显示右键菜单
|
|
1562
|
+
this.ClearStockCache=function(){this.StockCache.Data=null;};this.InitalPopMenu=function()//初始化弹出窗口
|
|
1563
|
+
{if(this.JSPopMenu)return;this.JSPopMenu=new JSPopMenu();//内置菜单
|
|
1564
|
+
this.JSPopMenu.Inital();};//obj={ Element:, Canvas: }
|
|
1539
1565
|
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);};//设置焦点
|
|
1566
|
+
{this.IsDestroy=true;this.StopAutoUpdate();};this.ChartDestory=this.ChartDestroy;//老版本写错了,需要兼容下
|
|
1567
|
+
//设置焦点
|
|
1544
1568
|
this.SetFocus=function(){if(this.UIElement)this.UIElement.focus();};//设置事件回调
|
|
1545
1569
|
//{event:事件id, callback:回调函数}
|
|
1546
1570
|
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
1571
|
{if(!this.mapEvent.has(id))return null;var item=this.mapEvent.get(id);return item;};//接收指标数据
|
|
1548
1572
|
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){
|
|
1573
|
+
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
1574
|
var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
|
|
1551
1575
|
var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;this.StopDisplayLatest();//加载数据中,禁用鼠标事件
|
|
1552
1576
|
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;
|
|
@@ -1561,12 +1585,12 @@ this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint
|
|
|
1561
1585
|
if(e&&e.type=="mouseout"&&e.buttons==0){x=y=-1;}//保存最后一次鼠标移动信息
|
|
1562
1586
|
var MoveStatus={X:x,Y:y,IsInClient:this.IsMouseOnClient(x,y)};this.LastMouseStatus.OnMouseMove=MoveStatus;this.LastMouseStatus.MoveOnPoint={X:x,Y:y};//鼠标移动的位置
|
|
1563
1587
|
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MOUSE_MOVE);var titleChart=this.TitlePaint[0];if(event&&titleChart)titleChart.OnMouseMoveEvent=event;this.MoveOnPoint={X:x,Y:y};this.OnMouseMove(x,y,e);//this.LastMouseStatus.MoveOnPoint=null;
|
|
1564
|
-
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);//右键菜单事件
|
|
1588
|
+
if(titleChart)titleChart.OnMouseMoveEvent=null;this.StartStopDisplayLatest();};this.IsMouseOnClient=function(x,y){var rect={Left:this.Frame.ChartBorder.GetLeft(),Top:this.Frame.ChartBorder.GetTop(),Width:this.Frame.ChartBorder.GetWidth(),Height:this.Frame.ChartBorder.GetHeight()};rect.Right=rect.Left+rect.Width;rect.Bottom=rect.Top+rect.Height;if(x>=rect.Left&&x<=rect.Right&&y>=rect.Top&&y<=rect.Bottom)return true;return false;};this.UIOnContextMenu=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;if(!this.IsShowRightMenu)return;var x=e.clientX-this.UIElement.getBoundingClientRect().left;var y=e.clientY-this.UIElement.getBoundingClientRect().top;if(typeof this.OnRightMenu=='function')this.OnRightMenu(x,y,e);//右键菜单事件
|
|
1565
1589
|
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
1590
|
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
|
|
1591
|
+
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
1592
|
{return;}if(this.TryClickLock){//JSConsole.Chart.Log('[uielement.onmousedown] left, top ',e.clientX, e.clientY, this.getBoundingClientRect().left,this.getBoundingClientRect().top);
|
|
1569
|
-
if(this.TryClickLock(x,y))return;}this.HideSelectRect();if(this.
|
|
1593
|
+
if(this.TryClickLock(x,y))return;}this.HideSelectRect();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
1594
|
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";
|
|
1571
1595
|
this.SetCursor({Cursor:"ew-resize"});this.RectSelectDrag={Index:item.PointIndex,Type:item.Type};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag rect select ",item);}}}if(!this.RectSelectDrag&&this.ClearRectSelect(false))this.Draw();if(this.EnableBorderDrag&&this.Frame){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){//this.UIElement.style.cursor="n-resize";
|
|
1572
1596
|
this.SetCursor({Cursor:"n-resize"});this.BorderDrag={Index:dragBorder.Index};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] DragBorder ",dragBorder);}}//拖拽Y轴缩放
|
|
@@ -1587,7 +1611,7 @@ var bDraw=false;if(drawPictureActive.Select.Guid&&drawPictureActive.Select.Chart
|
|
|
1587
1611
|
//this.SelectChartDrawPicture=drawPictrueData.ChartDrawPicture;
|
|
1588
1612
|
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
1613
|
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){
|
|
1614
|
+
}}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
1615
|
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
1616
|
{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
1617
|
{if(moveSetpY<5)return;var yMove=e.clientY-drag.LastMove.Y;//this.UIElement.style.cursor="n-resize";
|
|
@@ -1609,9 +1633,9 @@ this.SetCursor({Cursor:"default"});}else if(this.CustomChartDrag){var sendData={
|
|
|
1609
1633
|
selectData.XStart=(drag.Click.X-uielement.getBoundingClientRect().left)*pixelTatio;selectData.YStart=(drag.Click.Y-uielement.getBoundingClientRect().top)*pixelTatio;selectData.XEnd=(drag.LastMove.X-uielement.getBoundingClientRect().left)*pixelTatio;selectData.YEnd=(drag.LastMove.Y-uielement.getBoundingClientRect().top)*pixelTatio;selectData.JSChartContainer=this;selectData.Stock={Symbol:this.Symbol,Name:this.Name};if(!this.BorderDrag&&this.GetSelectRectData(selectData)){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);var paint=this.GetRectSelectPaint();var isShowMenu=true;if(event&&event.Callback){var data=(0,_defineProperty3.default)({X:drag.LastMove.X-uielement.getBoundingClientRect().left,Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,SelectData:selectData,//区间选择的数据
|
|
1610
1634
|
RectSelectPaint:paint,//区间选择背景
|
|
1611
1635
|
IsShowMenu:true,e:e},'e',e);event.Callback(event,data,this);isShowMenu=data.IsShowMenu;}if(IsMinuteChart)//分时图直接显示显示区间选择
|
|
1612
|
-
{this.HideSelectRect();this.UpdateSelectRect(selectData.Start,selectData.End);}else{if(isShowMenu
|
|
1636
|
+
{this.HideSelectRect();this.UpdateSelectRect(selectData.Start,selectData.End);}else{if(isShowMenu){var data={Chart:this,X:drag.LastMove.X-uielement.getBoundingClientRect().left,Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,SelectData:selectData,//区间选择的数据
|
|
1613
1637
|
RectSelectPaint:paint//区间选择背景
|
|
1614
|
-
};this.
|
|
1638
|
+
};e.data=data;this.PopupSelectRectMenuV2(data,e);}}}else{this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICKUP_CHART_PAINT,this.ClickDownPoint,e);}}else{this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICKUP_CHART_PAINT,this.ClickDownPoint,e);this.ClickEvent(e);}//清空数据
|
|
1615
1639
|
JSConsole.Chart.Log('[KLineChartContainer::document.onmouseup]',e);if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.DragInfo=null;//this.UIElement.style.cursor="default";
|
|
1616
1640
|
this.SetCursor({Cursor:"default"});this.MouseDrag=null;this.ClickDownPoint=null;this.IsOnTouch=false;if(this.BorderDrag&&this.BorderDrag.Index>=0)this.Frame.SaveSubFrameHeightRate();//拖拽指标窗口高度以后保存
|
|
1617
1641
|
this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;if(bClearDrawPicture===true)this.CurrentChartDrawPicture=null;};this.UIOnMounseOut=function(e){JSConsole.Chart.Log('[KLineChartContainer::UIOnMounseOut]',e);this.UIOnMouseMove(e);};this.UIOnMouseleave=function(e){JSConsole.Chart.Log('[KLineChartContainer::UIOnMouseleave]',e);//this.UIOnMouseMove(e);
|
|
@@ -1631,7 +1655,7 @@ this.IsPhonePinching=function(e){var changed=e.changedTouches.length;var touchin
|
|
|
1631
1655
|
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
1656
|
{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
1657
|
{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){
|
|
1658
|
+
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
1659
|
this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID&&this.TouchStatus.CorssCursorShow==true)//十字光标显示,不能滚动页面
|
|
1636
1660
|
{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
1661
|
{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 +1695,10 @@ for(var i=0;i<this.ChartDrawPicture.length;++i){var item=this.ChartDrawPicture[i
|
|
|
1671
1695
|
for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];item.Canvas=canvas;}//扩展图形
|
|
1672
1696
|
for(var i=0;i<this.ChartPaintEx.length;++i){var item=this.ChartPaintEx[i];item.Canvas=canvas;}//叠加股票
|
|
1673
1697
|
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
|
|
1698
|
+
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
1699
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
1676
1700
|
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){
|
|
1701
|
+
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
1702
|
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
1703
|
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
1704
|
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 +1743,7 @@ item.Draw(moveonPoint,this.LastMouseStatus);}if(this.SelectChartDrawPicture){thi
|
|
|
1719
1743
|
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
1744
|
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
1745
|
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
|
|
1746
|
+
}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
1747
|
var button=null;//当前鼠标所在按钮
|
|
1724
1748
|
var frameID=this.Frame.PtInFrame(x,y);if(IFrameSplitOperator.IsNumber(frameID)&&frameID>=0)//在K线内部移动,调整K线索引
|
|
1725
1749
|
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 +1756,15 @@ else this.SetCursor({Cursor:"move"});//this.UIElement.style.cursor="move";
|
|
|
1732
1756
|
else this.SetCursor({Cursor:"pointer"});//this.UIElement.style.cursor="pointer";
|
|
1733
1757
|
}bDrawPicture=true;this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.SetCursor({Cursor:"default"});//this.UIElement.style.cursor="default";
|
|
1734
1758
|
}}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
|
|
1759
|
+
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:鼠标形状 }
|
|
1760
|
+
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
1761
|
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
1762
|
if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}if(this.CursorIndex<=0.99999){if(!this.DataMoveLeft()){//左移数据到头了 触发下载新数据
|
|
1739
1763
|
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
1764
|
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
1765
|
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
1766
|
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){
|
|
1767
|
+
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
1768
|
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
1769
|
}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
1770
|
this.OnMarkRectSelect(e);break;case 27://ESCAPE 取消画布工具
|
|
@@ -1762,10 +1786,10 @@ this.Frame.SetFrameBorderSizeChange();this.Frame.ReDrawToolbar();this.Draw();};t
|
|
|
1762
1786
|
{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
1787
|
{}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
1788
|
{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
|
|
1789
|
+
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
1790
|
var xMove=15/pixelTatio;//顶部坐标偏移位置
|
|
1767
1791
|
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
|
|
1792
|
+
{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
1793
|
if(format.Height>0)textHeight=format.Height;//新版本高度有格式化类计算完成
|
|
1770
1794
|
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
1795
|
//if (toolTip.ChartPaint.Name=="Overlay-KLine") this.Tooltip.style.height =220+"px";
|
|
@@ -1781,7 +1805,7 @@ this.Tooltip.style.position="absolute";this.Tooltip.style.left=left+"px";this.To
|
|
|
1781
1805
|
{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
1806
|
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
1807
|
{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
|
|
1808
|
+
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
1809
|
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
1810
|
SingleOverlay:[],//独立坐标
|
|
1787
1811
|
MainOverlayFrame:[null,null]//叠加坐标在主坐标显示[0]=left [1]=right
|
|
@@ -1876,7 +1900,7 @@ this.SetSubFrameAttribute=function(subFrame,windowItem,frameItem){if(!subFrame||
|
|
|
1876
1900
|
}if(IFrameSplitOperator.IsBool(frameItem.IsShowRightText)){frame.IsShowYText[1]=frameItem.IsShowRightText;frame.YSplitOperator.IsShowRightText=frameItem.IsShowRightText;//显示右边刻度
|
|
1877
1901
|
}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
1902
|
}if(IFrameSplitOperator.IsBool(option.IsShowRightText)){subFrame.Frame.IsShowYText[1]=option.IsShowRightText;subFrame.Frame.YSplitOperator.IsShowRightText=option.IsShowRightText;//显示右边刻度
|
|
1879
|
-
}};this.AddNewSubFrame=function(option){var
|
|
1903
|
+
}};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
1904
|
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
1905
|
this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
1882
1906
|
this.Draw();return index;};//增加一个指标窗口
|
|
@@ -1901,7 +1925,7 @@ this.DeleteWindowsOverlayIndex=function(windowIndex){if(!IFrameSplitOperator.IsN
|
|
|
1901
1925
|
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
1926
|
{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
1927
|
{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
|
|
1928
|
+
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
1929
|
var fixedWindowCount=0;var isMinuteChart=this.ClassName=="MinuteChartContainer"||this.ClassName=="MinuteChartHScreenContainer"?true:false;if(isMinuteChart)fixedWindowCount=2;//走势图固定2个窗口
|
|
1906
1930
|
if(dest.WindowIndex>=fixedWindowCount&&this.WindowIndex[dest.WindowIndex]==null)//主指标是空的,移动到主指标上
|
|
1907
1931
|
{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 +1933,15 @@ if(dest.WindowIndex>=fixedWindowCount&&this.WindowIndex[dest.WindowIndex]==null)
|
|
|
1909
1933
|
this.UpdataDataoffset();//更新数据偏移
|
|
1910
1934
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
1911
1935
|
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
|
|
1936
|
+
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
1937
|
}else if(findOverlayItem){scriptIndex=this.CreateOverlayScript(findOverlayItem.Script);scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:dest.WindowIndex,Frame:overlayFrame};//叠加指标信息
|
|
1914
1938
|
}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
1939
|
{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
1940
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
1917
1941
|
this.Draw();}};//移动指标到新的指标窗口 src={ WindowIndex:指标窗口索引,IndexID:指标ID } , option={ Operator: 0=移动, 1=复制 }
|
|
1918
|
-
this.MoveIndexToNewWindow=function(src,option){var
|
|
1942
|
+
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
1943
|
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
|
|
1944
|
+
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
1945
|
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
1946
|
{if(findOverlayItem)this.DeleteOverlayIndex(findOverlayItem.Identify,src.WindowIndex);else if(findItem)this.DeleteMainIndex(findItem.Guid,src.WindowIndex);}this.UpdataDataoffset();//更新数据偏移
|
|
1923
1947
|
this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
@@ -1940,10 +1964,22 @@ this.GetIndexInfo=function(){var aryIndex=[];for(var i=0,j=0;i<this.WindowIndex.
|
|
|
1940
1964
|
{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
1965
|
return aryIndex;};//叠加指标
|
|
1942
1966
|
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);}}};
|
|
1967
|
+
{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);};//点击右键菜单
|
|
1968
|
+
this.OnClickRightMenu=function(data){JSConsole.Chart.Log('[JSChartContainer::OnClickRightMenu] ',data);if(!data||!data.Data)return;var cmdID=data.Data.ID;//命令ID
|
|
1969
|
+
var aryArgs=data.Data.Args;//参数
|
|
1970
|
+
var param=null,srcParam=null;//原始值
|
|
1971
|
+
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线指标
|
|
1972
|
+
case JSCHART_MENU_ID.CMD_DELETE_TRADE_INDEX_ID://删除专家系统(交易指标)
|
|
1973
|
+
if(this.CancelInstructionIndex)this.CancelInstructionIndex();break;case JSCHART_MENU_ID.CMD_CHANGE_KLINE_TYPE_ID://切换K线类型
|
|
1974
|
+
if(this.ChangeKLineDrawType&¶m!=null)this.ChangeKLineDrawType(param,aryArgs[1],aryArgs[2]);break;case JSCHART_MENU_ID.CMD_CHANGE_PRICE_GAP_ID://缺口提示
|
|
1975
|
+
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);//创建扩展图形
|
|
1976
|
+
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)//在画图工具后面创建的需要减去工具的宽度
|
|
1977
|
+
{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);//创建扩展图形
|
|
1978
|
+
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)//在筹码后面创建的需要筹码的宽度
|
|
1979
|
+
{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;case JSCHART_MENU_ID.CMD_SHOW_BEFORE_DATA_ID:if(this.ShowCallAuctionData&&IFrameSplitOperator.IsBool(srcParam))this.ShowCallAuctionData({Left:srcParam,MultiDay:{Left:srcParam}});break;case JSCHART_MENU_ID.CMD_SELECTED_ZOOM_ID:if(this.ShowSelectData&&srcParam)this.ShowSelectData(srcParam);break;case JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID:var dlg=new KLineSelectRectDialog(this.DivElement);dlg.DoModal(srcParam);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
1980
|
{if(this.JSChartContainer&&this.JSChartContainer.OnKeyDown)this.JSChartContainer.OnKeyDown(e);}function OnWheel(e)//上下滚动事件
|
|
1945
1981
|
{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;}//修正线段有毛刺
|
|
1982
|
+
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
1983
|
function ToFixedPoint(value){return parseInt(value)+0.5;}//修正粗线段毛刺
|
|
1948
1984
|
function ToFixedPoint2(width,value){var fixValue=width%2===0?Math.floor(value):Math.floor(value)+0.5;//毛边修正
|
|
1949
1985
|
return fixValue;}function ToFixedRect(value){// With a bitwise or.
|
|
@@ -4668,7 +4704,7 @@ this.newMethod();delete this.newMethod;this.ClassName='DrawToolsButton';this.HQC
|
|
|
4668
4704
|
this.Color="#696969";//input type="color"不支持rgb的颜色格式
|
|
4669
4705
|
//this.Left=5;
|
|
4670
4706
|
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
|
|
4707
|
+
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
4708
|
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
4709
|
var menuTwoList="";//二层菜单
|
|
4674
4710
|
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 +4714,7 @@ event.stopPropagation();(0,_jquery2.default)(".drawtools").find(".menuTwo").hide
|
|
|
4678
4714
|
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
4715
|
{// DrawName: menuOne[i].Name, //把画法名字传进去
|
|
4680
4716
|
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)('#'+
|
|
4717
|
+
(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
4718
|
{DrawName:itemTwo.Name,//把画法名字传进去
|
|
4683
4719
|
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
4720
|
var left=ToFixedPoint(this.ChartBorder.GetRight()+this.Left);// var top = this.Top+this.ChartBorder.UIElement.getBoundingClientRect().top+scrollPos.Top;
|
|
@@ -4866,9 +4902,11 @@ this.AryRectButton=[];this.BGColor=g_JSChartResource.FrameButtomToolbar.BGColor;
|
|
|
4866
4902
|
this.SelectedID="A1"
|
|
4867
4903
|
*/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
4904
|
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);
|
|
4905
|
+
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;//鼠标是否在按钮上
|
|
4906
|
+
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;//居中
|
|
4907
|
+
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 }
|
|
4908
|
+
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 全部的大小
|
|
4909
|
+
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
4910
|
function BarrageList(){this.PlayList=[];//正在播放队列
|
|
4873
4911
|
this.Cache=[];//没有播放的弹幕数据
|
|
4874
4912
|
this.MinLineHeight=40*GetDevicePixelRatio();this.Height;//高度
|
|
@@ -5794,19 +5832,21 @@ this.LimitFrameID;//限制在指定窗口绘图
|
|
|
5794
5832
|
//接口函数
|
|
5795
5833
|
this.SetLastPoint=null;//this.SetLastPoint=function(obj) obj={X:,Y:}
|
|
5796
5834
|
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.
|
|
5835
|
+
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
5836
|
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)//超过当前数据,直接读固定时间
|
|
5837
|
+
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
5838
|
{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
5839
|
this.ValueToPoint=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;//this.UpdateXValue();
|
|
5802
5840
|
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
|
|
5841
|
+
{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索引数据
|
|
5842
|
+
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
5843
|
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
5844
|
{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
5845
|
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
5846
|
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
5847
|
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];
|
|
5848
|
+
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;//无效索引 不显示
|
|
5849
|
+
var dataIndex=item.XValue-data.DataOffset;if(dataIndex<0||dataIndex>=showCount)++invaildX;var pt=new Point();if(isHScreen)//横屏X,Y对调
|
|
5810
5850
|
{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
5851
|
{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
5852
|
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 +5909,7 @@ IChartDrawPicture.RegisterIonFont=function(obj){if(!obj.Name||!obj.Text||!obj.Fa
|
|
|
5869
5909
|
{var item=IChartDrawPicture.GetDrawPictureByClassName(obj.ClassName);if(!item)return null;var chartDraw=item.Create();//TODO:后面都放到每一个SetOptin里面
|
|
5870
5910
|
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
5911
|
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:
|
|
5912
|
+
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
5913
|
if (this.IsSelected)
|
|
5874
5914
|
{
|
|
5875
5915
|
this.Canvas.strokeStyle='rgba(255,0,0,0.5)';
|
|
@@ -5963,7 +6003,8 @@ this.LineWidth=1;this.Precision=2;//小数位数
|
|
|
5963
6003
|
this.ValueTextColor='rgb(250,250,250)';this.IsShowCorssCursor=true;//画的时候是否显示十字光标
|
|
5964
6004
|
this.GetLabelCallback;//绘制标题回调函数
|
|
5965
6005
|
this.PointCount=1;this.ClassName='ChartDrawHLine';this.Font=14*GetDevicePixelRatio()+"px 微软雅黑";this.TextFont=12*GetDevicePixelRatio()+"px 微软雅黑";this.RightSpaceWidth=50;this.ButtonPosition=0;//按钮位置, 0=价格后面, 1=价格上面
|
|
5966
|
-
this.ButtonBGColor='rgb(190,190,190)';this.ButtonSpace=3;this.Button={CloseIcon:{Text:'\uE62B',Color:'rgb(255,255,255)',Family:"iconfont",Size:16},SettingIcon:{Text:'\uE623',Color:'rgb(255,255,255)',Family:"iconfont",Size:16
|
|
6006
|
+
this.ButtonBGColor='rgb(190,190,190)';this.ButtonSpace=3;this.Button={CloseIcon:{Text:'\uE62B',Color:'rgb(255,255,255)',Family:"iconfont",Size:16,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE,TooltipText:null},SettingIcon:{Text:'\uE623',Color:'rgb(255,255,255)',Family:"iconfont",Size:16,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING,TooltipText:null//修改ID, Text , TooltipText 可以外部定制按钮
|
|
6007
|
+
}};this.AryButton=[];this.ExtendData;//扩展数据
|
|
5967
6008
|
this.ShowPriceTextConfig={IsShow:[false,false,true],//[0]=left内 [1]=right内 [2]=right外
|
|
5968
6009
|
Font:[12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1',12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1']};//内部变量
|
|
5969
6010
|
this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;this.SetOption=function(option){if(this.Super_SetOption)this.Super_SetOption(option);if(option){if(option.GetLabelCallback){this.GetLabelCallback=option.GetLabelCallback;}if(IFrameSplitOperator.IsNumber(option.Precision))this.Precision=option.Precision;if(IFrameSplitOperator.IsNumber(option.Precision))this.Precision=option.Precision;if(option.Font)this.Font=option.Font;if(option.ValueTextColor)this.ValueTextColor=option.ValueTextColor;if(IFrameSplitOperator.IsNumber(option.ButtonPosition))this.ButtonPosition=option.ButtonPosition;if(IFrameSplitOperator.IsNumber(option.RightSpaceWidth))this.RightSpaceWidth=option.RightSpaceWidth;if(option.Button){var item=option.Button;if(item.CloseIcon)this.Button.CloseIcon=CloneData(item.CloseIcon);if(item.SettingIcon)this.Button.SettingIcon=CloneData(item.SettingIcon);}if(option.ExtendData)this.ExtendData=option.ExtendData;if(IFrameSplitOperator.IsNonEmptyArray(option.IsShowPriceText)){for(var i=0;i<option.IsShowPriceText.length&&i<3;++i){var value=option.IsShowPriceText[i];if(IFrameSplitOperator.IsBool(value))this.ShowPriceTextConfig.IsShow[i]=value;}}}};this.ExportStorageData=function(){var storageData;if(this.Super_ExportStorageData){storageData=this.Super_ExportStorageData();if(this.Label)storageData.Label=this.Label;}return storageData;};this.IsPointIn=this.IsPointIn_XYValue_Line;/*
|
|
@@ -5980,10 +6021,10 @@ this.Canvas.strokeStyle=this.LineColor;this.SetLineWidth();this.Canvas.beginPath
|
|
|
5980
6021
|
var line={Start:new Point(),End:new Point()};if(isHScreen){line.Start.X=drawPoint[0].X;line.Start.Y=left;line.End.X=drawPoint[0].X;line.End.Y=right;}else{line.Start.X=left;line.Start.Y=drawPoint[0].Y;line.End.X=right;line.End.Y=drawPoint[0].Y;}this.LinePoint.push(line);var yValue=this.Frame.GetYData(drawPoint[0].Y);var strPrice=yValue.toFixed(this.Precision);if(this.ShowPriceTextConfig.IsShow[0]){this.DrawPriceText(strPrice,line.Start,line.End,0);}if(this.ShowPriceTextConfig.IsShow[1]){this.DrawPriceText(strPrice,line.Start,line.End,1);}var labInfo;if(this.GetLabelCallback)labInfo=this.GetLabelCallback(this);//描述信息
|
|
5981
6022
|
if(labInfo)this.DrawLab(labInfo,drawPoint[0].Y);//画中心点
|
|
5982
6023
|
var xCenter=left+(right-left)/2;var point={X:xCenter,Y:drawPoint[0].Y};this.DrawPoint([point]);this.Canvas.restore();//外部右侧显示价格
|
|
5983
|
-
if(this.ShowPriceTextConfig.IsShow[2]){var rtDraw={};this.CalculateButtonSize();this.DrawValueText(drawPoint[0].Y,rtDraw,labInfo);if(labInfo)this.DrawRightLab(labInfo,rtDraw);}//鼠标是否在按钮上
|
|
6024
|
+
if(this.ShowPriceTextConfig.IsShow[2]){var rtDraw={};this.CalculateButtonSize();this.DrawValueText(drawPoint[0].Y,rtDraw,labInfo);if(labInfo)this.DrawRightLab(labInfo,rtDraw);if(labInfo)this.DrawCustomHLine(labInfo,drawPoint[0].Y);}//鼠标是否在按钮上
|
|
5984
6025
|
if(moveonPoint&&mouseStatus){for(var i=0;i<this.AryButton.length;++i){var item=this.AryButton[i];var rtButton=item.Rect;if(moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom){mouseStatus.MouseOnToolbar={Rect:rtButton,Item:item,Frame:this.Frame,Point:{X:moveonPoint.X,Y:moveonPoint.Y}};break;}}}};this.CalculateLabSize=function(labInfo){this.Canvas.textAlign="left";this.Canvas.textBaseline="top";this.Canvas.font=this.TextFont;var lineHeight=this.Canvas.measureText("擎").width+2;var maxNameWidth=0,maxTextWidth=0;var lineCount=0;var lineSpace=0;if(IFrameSplitOperator.IsNumber(labInfo.LineSpace))lineSpace=labInfo.LineSpace;var maxNameWidth=0,maxTextWidth=0;var lineCount=0;var maxWidth=0;for(var i=0;i<labInfo.AryText.length;++i){var item=labInfo.AryText[i];item.NameWidth=0;item.TextWidth=0;if(item.Name)item.NameWidth=this.Canvas.measureText(item.Name).width+2;if(item.Text)item.TextWidth=this.Canvas.measureText(item.Text).width+2;if(maxNameWidth<item.NameWidth)maxNameWidth=item.NameWidth;if(maxTextWidth<item.TextWidth)maxTextWidth=item.TextWidth;var itemWidth=item.NameWidth+item.TextWidth;if(maxWidth<itemWidth)maxWidth=itemWidth;++lineCount;}var size={Width:maxWidth,Height:lineCount*(lineHeight+lineSpace)+lineSpace,NameWidth:maxNameWidth,TextWidth:maxTextWidth,LineHeight:lineHeight};return size;};this.DrawLab=function(labInfo,y){if(!labInfo)return;if(!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText))return;if(labInfo.Position===2)return;var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();var labSize=this.CalculateLabSize(labInfo);var drawLeft=right-labSize.Width;var drawTop=y-labSize.Height-1;//背景色
|
|
5985
6026
|
if(labInfo.BGColor){this.Canvas.fillStyle=labInfo.BGColor;var rtTop=y-labSize.Height-4;this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(right+drawLeft),ToFixedRect(y-rtTop));}var yText=drawTop;for(var i=0;i<labInfo.AryText.length;++i){var item=labInfo.AryText[i];if(item.Name){this.Canvas.fillStyle=item.NameColor;this.Canvas.fillText(item.Name,drawLeft+1,yText+1);}if(item.Text){this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Text,drawLeft+labSize.NameWidth+1,yText+1);}yText+=labSize.LineHeight;}};this.DrawRightLab=function(labInfo,rtLeftDraw){if(!labInfo)return;if(!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText))return;if(labInfo.Position!=2)return;var labSize=this.CalculateLabSize(labInfo);var drawLeft=rtLeftDraw.Right-labSize.Width;var drawTop=rtLeftDraw.Bottom;var lineSpace=0;if(IFrameSplitOperator.IsNumber(labInfo.LineSpace))lineSpace=labInfo.LineSpace;//背景色
|
|
5986
|
-
if(labInfo.BGColor){this.Canvas.fillStyle=labInfo.BGColor;var rtTop=drawTop;this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(labSize.Width),ToFixedRect(labSize.Height));}var yText=drawTop+1+lineSpace;this.Canvas.textBaseline="top";for(var i=0;i<labInfo.AryText.length;++i){var item=labInfo.AryText[i];if(item.Name){this.Canvas.textAlign="left";this.Canvas.fillStyle=item.NameColor;this.Canvas.fillText(item.Name,drawLeft+1,yText+1);}if(item.Text){this.Canvas.textAlign="right";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Text,rtLeftDraw.Right-1,yText+1);}yText+=labSize.LineHeight+lineSpace;}};this.DrawValueText=function(y,rtDraw,labInfo){var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();if(this.RightSpaceWidth>0){this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(right,ToFixedPoint(y));this.Canvas.lineTo(right+this.RightSpaceWidth,ToFixedPoint(y));this.Canvas.stroke();}var yValue=this.Frame.GetYData(y);var strValue=yValue.toFixed(this.Precision);if(labInfo&&labInfo.PriceSuffixText)strValue+=labInfo.PriceSuffixText;this.Canvas.fillStyle=this.LineColor;this.Canvas.font=this.Font;var textWidth=this.Canvas.measureText(strValue).width;var lineHeight=this.GetFontHeight();var rtBG={Left:right+this.RightSpaceWidth,Top:y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;if(this.ButtonPosition==1)this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));else this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));this.Canvas.fillStyle=this.ValueTextColor;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(strValue,rtBG.Left+2,y);rtDraw.Left=rtBG.Left;rtDraw.Top=rtBG.Top;rtDraw.Bottom=rtBG.Bottom;rtDraw.Right=rtBG.Right;this.DrawButton(rtBG.Top,rtBG.Right,lineHeight,rtDraw);};this.DrawPriceText=function(text,ptStart,ptEnd,position){if(position!=1&&position!=0)return;var font=this.ShowPriceTextConfig.Font[position];this.Canvas.fillStyle=this.LineColor;this.Canvas.font=font;var textWidth=this.Canvas.measureText(text).width;var lineHeight=this.GetFontHeight();var rtBG=null;if(position==1){var rtBG={Left:ptStart.X,Top:ptStart.Y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;}else if(position==0){var rtBG={Right:ptEnd.X,Top:ptEnd.Y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Left=rtBG.Right-rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;}this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));this.Canvas.fillStyle=this.ValueTextColor;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(text,rtBG.Left+2,ptStart.Y);};this.CalculateButtonSize=function(){var pixelRatio=GetDevicePixelRatio();if(this.Button.SettingIcon){var icon=this.Button.SettingIcon;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;var width=this.Canvas.measureText(icon.Text).width;this.SettingButtonSize=width;}if(this.Button.CloseIcon){var icon=this.Button.CloseIcon;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;var width=this.Canvas.measureText(icon.Text).width;this.ColseButtonSize=width;}if(this.ColseButtonSize<=0&&this.SettingButtonSize<=0)return;var buttonWidth=0;if(this.SettingButtonSize>0)buttonWidth+=this.SettingButtonSize;if(this.ColseButtonSize>0){if(buttonWidth>0)buttonWidth+=this.ButtonSpace;buttonWidth+=this.ColseButtonSize;}buttonWidth+=4;this.ButtonBGWidth=buttonWidth;};this.DrawButton=function(drawTop,drawLeft,drawHeight,rtDraw){if(this.ColseButtonSize<=0&&this.SettingButtonSize<=0)return;if(this.ButtonPosition==1)drawTop-=drawHeight;this.Canvas.fillStyle=this.LineColor;var left=drawLeft;var rtBG={Left:drawLeft,Top:drawTop,Width:this.ButtonBGWidth,Height:drawHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;this.Canvas.fillStyle=this.ButtonBGColor;this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));left+=1;var pixelRatio=GetDevicePixelRatio();if(this.Button.SettingIcon&&this.Button.SettingIcon.Text){var rtButton={Left:left,Top:drawTop,Width:this.SettingButtonSize,Height:drawHeight};rtButton.Right=rtButton.Left+rtButton.Width;rtButton.Bottom=rtButton.Top+rtButton.Height;var yCenter=rtButton.Top+rtButton.Height/2;var xCenter=rtButton.Left+rtButton.Width/2;var icon=this.Button.SettingIcon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(this.Button.SettingIcon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:
|
|
6027
|
+
if(labInfo.BGColor){this.Canvas.fillStyle=labInfo.BGColor;var rtTop=drawTop;this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(labSize.Width),ToFixedRect(labSize.Height));}var yText=drawTop+1+lineSpace;this.Canvas.textBaseline="top";for(var i=0;i<labInfo.AryText.length;++i){var item=labInfo.AryText[i];if(item.Name){this.Canvas.textAlign="left";this.Canvas.fillStyle=item.NameColor;this.Canvas.fillText(item.Name,drawLeft+1,yText+1);}if(item.Text){this.Canvas.textAlign="right";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Text,rtLeftDraw.Right-1,yText+1);}yText+=labSize.LineHeight+lineSpace;}};this.DrawCustomHLine=function(labInfo,yLine){if(!labInfo)return;if(!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryLine))return;var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();var pixelRatio=GetDevicePixelRatio();var yMax=yLine,yMin=yLine;for(var i=0;i<labInfo.AryLine.length;++i){var item=labInfo.AryLine[i];if(!IFrameSplitOperator.IsNumber(item.Value))continue;var y=this.Frame.GetYFromData(item.Value);var yFixed=ToFixedPoint(y);var xRight=right;if(IFrameSplitOperator.IsNumber(item.Width))xRight=left+item.Width*pixelRatio;if(item.Color)this.Canvas.strokeStyle=item.Color;else this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(left,yFixed);this.Canvas.lineTo(xRight,yFixed);this.Canvas.stroke();if(yMax<yFixed)yMax=yFixed;if(yMin>yFixed)yMin=yFixed;}if(yMax!=yMin&&labInfo.VLine){var item=labInfo.VLine;var x=left+20*pixelRatio;if(IFrameSplitOperator.IsNumber(item.XOffset))x=left+item.XOffset*pixelRatio;x=ToFixedPoint(x);if(item.Color)this.Canvas.strokeStyle=item.Color;else this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,yMax);this.Canvas.lineTo(x,yMin);this.Canvas.stroke();}};this.DrawValueText=function(y,rtDraw,labInfo){var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();if(this.RightSpaceWidth>0){this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(right,ToFixedPoint(y));this.Canvas.lineTo(right+this.RightSpaceWidth,ToFixedPoint(y));this.Canvas.stroke();}var yValue=this.Frame.GetYData(y);var strValue=yValue.toFixed(this.Precision);if(labInfo&&labInfo.PriceSuffixText)strValue+=labInfo.PriceSuffixText;this.Canvas.fillStyle=this.LineColor;this.Canvas.font=this.Font;var textWidth=this.Canvas.measureText(strValue).width;var lineHeight=this.GetFontHeight();var rtBG={Left:right+this.RightSpaceWidth,Top:y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;if(this.ButtonPosition==1)this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));else this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));this.Canvas.fillStyle=this.ValueTextColor;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(strValue,rtBG.Left+2,y);rtDraw.Left=rtBG.Left;rtDraw.Top=rtBG.Top;rtDraw.Bottom=rtBG.Bottom;rtDraw.Right=rtBG.Right;this.DrawButton(rtBG.Top,rtBG.Right,lineHeight,rtDraw);};this.DrawPriceText=function(text,ptStart,ptEnd,position){if(position!=1&&position!=0)return;var font=this.ShowPriceTextConfig.Font[position];this.Canvas.fillStyle=this.LineColor;this.Canvas.font=font;var textWidth=this.Canvas.measureText(text).width;var lineHeight=this.GetFontHeight();var rtBG=null;if(position==1){var rtBG={Left:ptStart.X,Top:ptStart.Y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;}else if(position==0){var rtBG={Right:ptEnd.X,Top:ptEnd.Y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Left=rtBG.Right-rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;}this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));this.Canvas.fillStyle=this.ValueTextColor;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(text,rtBG.Left+2,ptStart.Y);};this.CalculateButtonSize=function(){var pixelRatio=GetDevicePixelRatio();if(this.Button.SettingIcon){var icon=this.Button.SettingIcon;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;var width=this.Canvas.measureText(icon.Text).width;this.SettingButtonSize=width;}if(this.Button.CloseIcon){var icon=this.Button.CloseIcon;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;var width=this.Canvas.measureText(icon.Text).width;this.ColseButtonSize=width;}if(this.ColseButtonSize<=0&&this.SettingButtonSize<=0)return;var buttonWidth=0;if(this.SettingButtonSize>0)buttonWidth+=this.SettingButtonSize;if(this.ColseButtonSize>0){if(buttonWidth>0)buttonWidth+=this.ButtonSpace;buttonWidth+=this.ColseButtonSize;}buttonWidth+=4;this.ButtonBGWidth=buttonWidth;};this.DrawButton=function(drawTop,drawLeft,drawHeight,rtDraw){if(this.ColseButtonSize<=0&&this.SettingButtonSize<=0)return;if(this.ButtonPosition==1)drawTop-=drawHeight;this.Canvas.fillStyle=this.LineColor;var left=drawLeft;var rtBG={Left:drawLeft,Top:drawTop,Width:this.ButtonBGWidth,Height:drawHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;this.Canvas.fillStyle=this.ButtonBGColor;this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));left+=1;var pixelRatio=GetDevicePixelRatio();if(this.Button.SettingIcon&&this.Button.SettingIcon.Text){var rtButton={Left:left,Top:drawTop,Width:this.SettingButtonSize,Height:drawHeight};rtButton.Right=rtButton.Left+rtButton.Width;rtButton.Bottom=rtButton.Top+rtButton.Height;var yCenter=rtButton.Top+rtButton.Height/2;var xCenter=rtButton.Left+rtButton.Width/2;var icon=this.Button.SettingIcon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(this.Button.SettingIcon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:icon.ID,TooltipText:icon.TooltipText});/*
|
|
5987
6028
|
if (this.ColseButtonSize>0)
|
|
5988
6029
|
{
|
|
5989
6030
|
var xLine=rtButton.Right+this.ButtonSpace/2;
|
|
@@ -5994,7 +6035,7 @@ if(labInfo.BGColor){this.Canvas.fillStyle=labInfo.BGColor;var rtTop=drawTop;this
|
|
|
5994
6035
|
this.Canvas.lineTo(xLine,rtButton.Bottom);
|
|
5995
6036
|
this.Canvas.stroke();
|
|
5996
6037
|
}
|
|
5997
|
-
*/left=rtButton.Right+this.ButtonSpace;}if(this.Button.CloseIcon&&this.Button.CloseIcon.Text){var rtButton={Left:left,Top:drawTop,Width:this.ColseButtonSize,Height:drawHeight};rtButton.Right=rtButton.Left+rtButton.Width;rtButton.Bottom=rtButton.Top+rtButton.Height;var yCenter=rtButton.Top+rtButton.Height/2;var xCenter=rtButton.Left+rtButton.Width/2;var icon=this.Button.CloseIcon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(this.Button.CloseIcon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:
|
|
6038
|
+
*/left=rtButton.Right+this.ButtonSpace;}if(this.Button.CloseIcon&&this.Button.CloseIcon.Text){var rtButton={Left:left,Top:drawTop,Width:this.ColseButtonSize,Height:drawHeight};rtButton.Right=rtButton.Left+rtButton.Width;rtButton.Bottom=rtButton.Top+rtButton.Height;var yCenter=rtButton.Top+rtButton.Height/2;var xCenter=rtButton.Left+rtButton.Width/2;var icon=this.Button.CloseIcon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(this.Button.CloseIcon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:icon.ID,TooltipText:icon.TooltipText});left=rtButton.Right;}rtDraw.Right=rtBG.Right;};this.PtInButtons=function(x,y){for(var i=0;i<this.AryButton.length;++i){var item=this.AryButton[i];if(!item.Rect)continue;var rect=item.Rect;this.Canvas.beginPath();this.Canvas.rect(rect.Left,rect.Top,rect.Width,rect.Height);if(this.Canvas.isPointInPath(x,y)){return{ID:item.ID,Rect:rect};}}return null;};}//趋势线
|
|
5998
6039
|
function ChartDrawPictureTrendLine(){this.newMethod=IChartDrawPicture;//派生
|
|
5999
6040
|
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawPictureTrendLine';this.IsPointIn=this.IsPointIn_XYValue_Line;this.GetXYCoordinate=this.GetXYCoordinate_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:false,IsCheckY:false});if(!drawPoint||drawPoint.length!=2)return;var ptStart=drawPoint[0];var ptEnd=drawPoint[1];var extendLine=this.CalculateExtendLinePoint(ptStart,ptEnd);this.ClipFrame();this.Canvas.strokeStyle=this.LineColor;this.SetLineWidth();this.Canvas.beginPath();this.Canvas.moveTo(extendLine.Start.X,extendLine.Start.Y);this.Canvas.lineTo(extendLine.End.X,extendLine.End.Y);this.Canvas.stroke();this.RestoreLineWidth();var line={Start:ptStart,End:ptEnd};this.LinePoint.push(line);this.DrawPoint(drawPoint);//画点
|
|
6000
6041
|
this.Canvas.restore();};}//画图工具-矩形
|
|
@@ -6682,8 +6723,8 @@ TextColor:"rgb(0,0,0)",Item:{Mergin:{Top:2,Bottom:0,Left:1,Right:1},//单元格
|
|
|
6682
6723
|
Font:{Size:15,Name:"微软雅黑"},BarMergin:{Top:2,Left:0,Right:0,Bottom:2},//单元格字体
|
|
6683
6724
|
NameFont:{Size:14,Name:"微软雅黑"},SymbolFont:{Size:12,Name:"微软雅黑"}}},//滚动条
|
|
6684
6725
|
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();/////////////////////////////////////////////////////////////////////////////////
|
|
6726
|
+
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()}}//自定义风格
|
|
6727
|
+
};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
6728
|
//
|
|
6688
6729
|
//
|
|
6689
6730
|
//
|
|
@@ -6878,21 +6919,21 @@ this.ChartOperator_Temp_GetHistroyData=function(){var hisData=null;if(!this.Fram
|
|
|
6878
6919
|
return hisData;};this.ChartOperator_Temp_Update=function(){this.UpdataDataoffset();//更新数据偏移
|
|
6879
6920
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
6880
6921
|
this.ResetFrameXSplit();this.Frame.SetSizeChage(true);this.Draw();this.UpdatePointByCursorIndex();//更新十字光标位子
|
|
6881
|
-
};this.OnWheel=function(e){var
|
|
6922
|
+
};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
6923
|
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){
|
|
6924
|
+
{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
6925
|
{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
6926
|
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
6927
|
if(!this.Frame.OnZoomUpDownFrameY(dragY,yMove))return false;this.Frame.SetSizeChage(true);this.Draw();return true;};//创建
|
|
6887
6928
|
//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
|
|
6929
|
+
this.Create=function(windowCount,option){var _this17=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
6930
|
+
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
6931
|
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
|
|
6932
|
+
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
6933
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();this.CreateExtendChart("RectSelectPaint",option?option.SelectRect:null);//区间统计
|
|
6893
6934
|
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){
|
|
6935
|
+
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);//键盘消息
|
|
6936
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this17.OnWheel(e);},true);//上下滚动消息
|
|
6896
6937
|
};this.OnCustomKeyDown=function(keyID,e)//自定义键盘事件
|
|
6897
6938
|
{if(keyID==37&&e.ctrlKey)//Ctrl+Left
|
|
6898
6939
|
{this.MoveCorssCursorLeft(this.CtrlMoveStep);return true;}else if(keyID==39&&e.ctrlKey)//Ctrl+Right
|
|
@@ -6905,18 +6946,18 @@ if(this.CursorIndex+step+data.DataOffset+1>data.Data.length)//数据不够步长
|
|
|
6905
6946
|
{step=data.Data.length-1-data.DataOffset-this.CursorIndex;bMoveEnd=true;}if(this.CursorIndex+step>=xPointcount)//当前屏最右边了
|
|
6906
6947
|
{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
6948
|
this.GetKLineChart=function(){if(!this.ChartPaint[0])return null;return this.ChartPaint[0];};//创建子窗口
|
|
6908
|
-
this.CreateChildWindow=function(windowCount){var
|
|
6949
|
+
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
6950
|
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
|
|
6951
|
+
frame.GetEventCallback=function(id){return _this18.GetEventCallback(id);};frame.GlobalOption=this.GlobalOption;if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
|
|
6952
|
+
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
6953
|
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
|
|
6954
|
+
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;
|
|
6955
|
+
}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;//窗口序号
|
|
6956
|
+
frame.GetEventCallback=function(id){return _this19.GetEventCallback(id);};frame.GlobalOption=this.GlobalOption;if(this.ModifyIndexDialog)frame.ModifyIndexEvent=this.ModifyIndexDialog.DoModal;//绑定菜单事件
|
|
6957
|
+
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
6958
|
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
|
|
6959
|
+
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;//绑定叠加
|
|
6960
|
+
this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].HQChart=this;this.TitlePaint[0].GetEventCallback=function(id){return _this20.GetEventCallback(id);};};//绑定主图K线数据
|
|
6920
6961
|
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
6962
|
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
6963
|
this.Frame.Data=this.ChartPaint[0].Data;for(var i=0;i<this.OverlayChartPaint.length;++i)//K线叠加 主图股票数据绑定到叠加上
|
|
@@ -6935,12 +6976,12 @@ this.Frame.Data=this.ChartPaint[0].Data;for(var i in this.OverlayChartPaint)//
|
|
|
6935
6976
|
{var item=this.OverlayChartPaint[i];item.MainData=this.ChartPaint[0].Data;}this.ChartCorssCursor.StringFormatY.Symbol=this.Symbol;};this.SetCustomShow=function(customShow,hisData){if(!customShow||!customShow.Date||customShow.Date<19910101)return;var firstDate=customShow.Date;var index=null;for(var i=0;i<hisData.Data.length;++i){var item=hisData.Data[i];if(item.Date>=firstDate){index=i;break;}}if(index===null){JSConsole.Chart.Log('[KLineChartContainer::SetCustomShow] Can\'t find first date='+firstDate);return;}var count=hisData.Data.length-index;if(customShow.PageSize>0)count=customShow.PageSize;var customShowCount=count;var pageSize=this.GetMaxMinPageSize();if(count>pageSize.Max)customShowCount=pageSize.Max;else if(count<pageSize.Min)customShowCount=pageSize.Min;for(var i in this.Frame.SubFrame){var item=this.Frame.SubFrame[i].Frame;item.XPointCount=customShowCount;}this.ChartPaint[0].Data.DataOffset=index;this.CursorIndex=0;};this.OnDragSelectRectMouseUp=function(e){var paint=this.GetRectSelectPaint();if(!paint)return;var selectData=paint.GetSelectRectData();if(!selectData)return;var pixelTatio=GetDevicePixelRatio();var corssCursor=this.ChartCorssCursor;//十字光标
|
|
6936
6977
|
var x=corssCursor.LastPoint.X/pixelTatio;var y=corssCursor.LastPoint.Y/pixelTatio;var isShowMenu=true;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAG_SELECT_RECT_MOUSEUP);if(event){var data={X:x,Y:y,SelectData:selectData,//区间选择的数据
|
|
6937
6978
|
RectSelectPaint:paint,//区间选择背景
|
|
6938
|
-
IsShowMenu:false};event.Callback(event,data,this);isShowMenu=data.IsShowMenu;}if(isShowMenu
|
|
6979
|
+
IsShowMenu:false};event.Callback(event,data,this);isShowMenu=data.IsShowMenu;}if(isShowMenu){var data={Chart:this,X:x,Y:y,SelectData:selectData,//区间选择的数据
|
|
6939
6980
|
RectSelectPaint:paint//区间选择背景
|
|
6940
|
-
};this.
|
|
6981
|
+
};e.data=data;this.PopupSelectRectMenuV2(data,e);}};this.OnDragSubSelectRectMouseUp=function(e){var paint=this.GetRectSelectPaint();if(!paint)return;var selectData=paint.GetSelectRectData();if(!selectData)return;var pixelTatio=GetDevicePixelRatio();var corssCursor=this.ChartCorssCursor;//十字光标
|
|
6941
6982
|
var x=corssCursor.LastPoint.X/pixelTatio;var y=corssCursor.LastPoint.Y/pixelTatio;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAG_SUB_SELECT_RECT_MOUSEUP);if(event){var subRectData={Start:paint.SubClient.FirstPoint,End:paint.SubClient.SecondPoint};var data={X:x,Y:y,SubSelectData:subRectData,//子区域数据
|
|
6942
6983
|
RectSelectPaint:paint//区间选择背景
|
|
6943
|
-
};event.Callback(event,data,this);}};this.ShowSelectData=function(selectData){this.HideSelectRect();
|
|
6984
|
+
};event.Callback(event,data,this);}};this.ShowSelectData=function(selectData){this.HideSelectRect();JSConsole.Chart.Log('[KLineChartContainer::ShowSelectData] selectData',selectData);var dataOffset=selectData.Start;var showCount=selectData.End-selectData.Start+1;JSConsole.Chart.Log('[KLineChartContainer::ShowSelectData] DataOffset='+dataOffset+', ShowCount='+showCount);for(var i in this.Frame.SubFrame){var item=this.Frame.SubFrame[i].Frame;item.XPointCount=showCount;}this.ChartPaint[0].Data.DataOffset=dataOffset;this.CursorIndex=0;this.UpdataDataoffset();//更新数据偏移
|
|
6944
6985
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
6945
6986
|
this.Frame.SetSizeChage(true);this.Draw();this.UpdatePointByCursorIndex();//更新十字光标位子
|
|
6946
6987
|
};this.OnMarkRectSelect=function(e){var corssCursor=this.ChartCorssCursor;//十字光标
|
|
@@ -6948,9 +6989,9 @@ if(!corssCursor||corssCursor.Status==0)return;if(!IFrameSplitOperator.IsNumber(c
|
|
|
6948
6989
|
{var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN_SELECT_RECT_FIRST);if(event&&event.Callback){var data={X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,Item:item,Index:index,RectSelectPaint:paint,//区间选择背景
|
|
6949
6990
|
e:e};event.Callback(event,data,this);}}else if(pointCount==2){var selectData=paint.GetSelectRectData();var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN_SELECT_RECT);var isShowMenu=true;if(event&&event.Callback){var data={X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,SelectData:selectData,//区间选择的数据
|
|
6950
6991
|
RectSelectPaint:paint,//区间选择背景
|
|
6951
|
-
IsShowMenu:true,e:e};event.Callback(event,data,this);isShowMenu=data.IsShowMenu;}if(isShowMenu
|
|
6992
|
+
IsShowMenu:true,e:e};event.Callback(event,data,this);isShowMenu=data.IsShowMenu;}if(isShowMenu){var data={Chart:this,X:corssCursor.LastPoint.X/pixelTatio,Y:corssCursor.LastPoint.Y/pixelTatio,SelectData:selectData,//区间选择的数据
|
|
6952
6993
|
RectSelectPaint:paint//区间选择背景
|
|
6953
|
-
};this.
|
|
6994
|
+
};e.data=data;this.PopupSelectRectMenuV2(data,e);}}this.Draw();};//创建指定窗口指标
|
|
6954
6995
|
this.CreateWindowIndex=function(windowIndex){this.WindowIndex[windowIndex].Create(this,windowIndex);};this.BindIndexData=function(windowIndex,hisData,option){if(!this.WindowIndex[windowIndex])return;var item=this.WindowIndex[windowIndex];if(typeof item.RequestData=="function")//数据需要另外下载的.
|
|
6955
6996
|
{item.RequestData(this,windowIndex,hisData,option);return;}if(typeof item.ExecuteScript=='function'){if(option&&option.CheckRunCount)if(item.IsExcessRunCount())return;item.ExecuteScript(this,windowIndex,hisData);return;}item.BindData(this,windowIndex,hisData);};//叠加指标 option={ CheckRunCount:执行次数检测 ,SyncExecute:同步|异步检测 }
|
|
6956
6997
|
this.BindOverlayIndexData=function(overlayItem,windowIndex,hisData,option){if(!overlayItem.Script)return;if(typeof overlayItem.Script.RequestData=='function'){overlayItem.Script.RequestData(this,windowIndex,hisData);return;}if(typeof overlayItem.Script.ExecuteScript=='function'){if(option){if(option.CheckRunCount)//检测执行次数
|
|
@@ -7276,15 +7317,15 @@ this.Draw();};this.AddOverlayIndex=function(obj){var overlay=this.CreateOverlayW
|
|
|
7276
7317
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7277
7318
|
this.Draw();};//创建一个叠加指标
|
|
7278
7319
|
this.CreateOverlayWindowsIndex=function(obj)// {WindowIndex:, IndexName:, Identify:, ShowRightText:, API:}
|
|
7279
|
-
{var
|
|
7320
|
+
{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
7321
|
{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
7322
|
if(!indexInfo){indexCustom=JSIndexMap.Get(indexName);//定制指标
|
|
7282
7323
|
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
7324
|
//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
|
|
7325
|
+
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
7326
|
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
7327
|
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
|
|
7328
|
+
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
7329
|
if(IFrameSplitOperator.IsBool(item.IsShowToolbar))frame.IsShowToolbar=item.IsShowToolbar;//是否显示工具栏
|
|
7289
7330
|
}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
7331
|
overlayFrame.Script=apiIndex;}else if(indexInfo){JSIndexScript.ModifyAttribute(indexInfo,obj);var scriptIndex=new OverlayScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
|
|
@@ -7305,10 +7346,10 @@ this.ChangeCoordinateType=function(obj){if(!this.Frame)return;if(!IFrameSplitOpe
|
|
|
7305
7346
|
{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
7347
|
frame.YMaxMin.Max=null;frame.YMaxMin.Min=null;this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7307
7348
|
this.Frame.SetSizeChage(true);this.Draw();};//设置指标窗口个数
|
|
7308
|
-
this.ChangeIndexWindowCount=function(count,option){var
|
|
7349
|
+
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
7350
|
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
7351
|
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
|
|
7352
|
+
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
7353
|
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
7354
|
this.Draw();//创建指标
|
|
7314
7355
|
var indexName=[{Index:"RSI"},{Index:"MACD"},{Index:"VOL"},{Index:"UOS"},{Index:"CHO"},{Index:"BRAR"}];//增加的指标名字
|
|
@@ -7320,11 +7361,11 @@ var subFrame=this.Frame.SubFrame[i];if(item.Modify!=null)this.Frame.SubFrame[i].
|
|
|
7320
7361
|
}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
7362
|
}//this.UpdataDataoffset(); //更新数据偏移
|
|
7322
7363
|
}};this.ChangeIndexTemplate=function(option)//切换指标模板 可以设置指标窗口个数 每个窗口的指标
|
|
7323
|
-
{var
|
|
7364
|
+
{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
7365
|
if(IFrameSplitOperator.IsNumber(option.KLine.Right)&&option.KLine.Right!=this.Right)right=option.KLine.Right;//复权
|
|
7325
7366
|
}var bRefreshData=period!=null||right!=null||symbol!=null;//清空所有的指标图型
|
|
7326
7367
|
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
|
|
7368
|
+
{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
7369
|
if(item.Script)//自定义指标脚本
|
|
7329
7370
|
{this.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
|
|
7330
7371
|
}else if(item.API)//后台指标
|
|
@@ -7389,24 +7430,24 @@ this.ClearKLineInfo=function(){if(!this.ChartInfo||this.ChartInfo.length<=0)retu
|
|
|
7389
7430
|
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
7431
|
this.OverlayChartPaint.push(paint);if(ChartData.IsDayPeriod(this.Period,true))this.RequestOverlayHistoryData();//请求日线数据
|
|
7391
7432
|
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:
|
|
7433
|
+
return true;};this.RequestOverlayHistoryData=function(){var _this24=this;if(!this.OverlayChartPaint.length)return;if(!this.SourceData||!this.SourceData.Data)return;//主图数据还没有到完
|
|
7434
|
+
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';//等待主图股票数据未下载完
|
|
7435
|
+
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',//类名::
|
|
7436
|
+
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
7437
|
}//请求数据
|
|
7397
|
-
JSNetwork.HttpRequest({url:
|
|
7438
|
+
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
7439
|
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
7440
|
{var rightData=bindData.GetRightData(bindData.Right,{AlgorithmType:this.RightFormula});bindData.Data=rightData;}var aryOverlayData=this.SourceData.GetOverlayData(bindData.Data,this.IsApiPeriod);//和主图数据拟合以后的数据
|
|
7400
7441
|
bindData.Data=aryOverlayData;if(ChartData.IsDayPeriod(bindData.Period,false)&&!this.IsApiPeriod)//周期数据
|
|
7401
7442
|
{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
7443
|
this.UpdataDataoffset();//更新数据偏移
|
|
7403
7444
|
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:
|
|
7445
|
+
this.Frame.SetSizeChage(true);this.Draw();};this.RequestOverlayHistoryMinuteData=function(){var _this25=this;if(!this.OverlayChartPaint.length)return;if(!this.SourceData||!this.SourceData.Data)return;//主图数据还没有到完
|
|
7446
|
+
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';//等待主图股票数据未下载完
|
|
7447
|
+
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',//类名::
|
|
7448
|
+
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
7449
|
}//请求数据
|
|
7409
|
-
JSNetwork.HttpRequest({url:
|
|
7450
|
+
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
7451
|
var sourceData=new ChartData();sourceData.Data=aryDayData;sourceData.DataType=1;//0=日线数据 1=分钟数据
|
|
7411
7452
|
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
7453
|
bindData.Data=aryOverlayData;if(ChartData.IsMinutePeriod(bindData.Period,false)&&!this.IsApiPeriod)//周期数据, API周期数据不用计算
|
|
@@ -7447,8 +7488,18 @@ if(isPhone)pixelTatio=1;var xStep=x*pixelTatio;var yStep=y*pixelTatio;//JSConsol
|
|
|
7447
7488
|
drawPicture.Move(xStep,yStep,drag);return true;};//数据长度变化 需要更新画图工具X轴索引
|
|
7448
7489
|
this.UpdateChartDrawXValue=function(){for(var i in this.ChartDrawPicture){var item=this.ChartDrawPicture[i];item.UpdateXValue();}};//注册鼠标右键事件
|
|
7449
7490
|
this.OnRightMenu=function(x,y,e){var pixelTatio=GetDevicePixelRatio();//x,y 需要乘以放大倍速
|
|
7450
|
-
|
|
7451
|
-
this.
|
|
7491
|
+
var frameId=this.Frame.PtInFrame(x*pixelTatio,y*pixelTatio);this.PopupRightMenuV2({X:e.offsetX,Y:e.offsetY,FrameID:frameId},e);var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CONTEXT_MENU);if(event){var data={X:x,Y:y,Event:e,FrameID:frameId};event.Callback(event,data,this);}};//右键菜单数据
|
|
7492
|
+
this.GetRightMenuData=function(frameID){var windowCount=this.Frame.SubFrame.length;//窗口个数
|
|
7493
|
+
var klineChart=this.ChartPaint[0];var priceGap=klineChart.PriceGap;//缺口配置信息
|
|
7494
|
+
var coordinateType=null,yCoordinateType=null;//坐标类型
|
|
7495
|
+
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=[];//信息地雷
|
|
7496
|
+
for(var i=0;i<this.ChartInfo.length;++i){var item=this.ChartInfo[i];if(item&&item.ClassName)aryKLineInfo.push(item.ClassName);}var aryOverlaySymbol=[];//叠加的股票列表
|
|
7497
|
+
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;//画图工具
|
|
7498
|
+
if(this.GetExtendChartByClassName('StockChip'))bShowStockChip=true;//筹码
|
|
7499
|
+
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}]}];//复权
|
|
7500
|
+
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);}//删除菜单
|
|
7501
|
+
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.PopupRightMenuV2=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);};this.PopupSelectRectMenuV2=function(data,e){var _this27=this;var aryMenu=[{Name:"区间统计",Data:{ID:JSCHART_MENU_ID.CMD_SELECTED_SUMMARY_ID,Args:[e]}},{Name:"区间放大",Data:{ID:JSCHART_MENU_ID.CMD_SELECTED_ZOOM_ID,Args:[data.SelectData]}}];var menuData={Menu:aryMenu,Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID};menuData.ClickCallback=function(data){_this27.OnClickRightMenu(data);};var x=data.X,y=data.Y;this.PopuMenuByRClick(menuData,x,y);};//重新加载画图工具(切换股票|周期)
|
|
7502
|
+
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
7503
|
{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
7504
|
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
7505
|
};//形态匹配
|
|
@@ -7579,7 +7630,7 @@ var obj=this.Frame.OnSize();this.Frame.SetSizeChage(true);if(obj.Changed){this.U
|
|
|
7579
7630
|
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
7631
|
{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
7632
|
{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 是否阻止内置的点击处理
|
|
7633
|
+
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
7634
|
event.Callback(event,data,this);if(data.PreventDefault)return;}//筹码按钮
|
|
7584
7635
|
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
7636
|
this.RequestVolumeProfileData=function(option){var self=this;var chart=option.Chart;if(this.NetworkFilter){var obj={Name:'KLineChartContainer::RequestVolumeProfileData',//类名::函数
|
|
@@ -7788,24 +7839,30 @@ RectSelectPaint:paint,//区间选择背景
|
|
|
7788
7839
|
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
7840
|
RectSelectPaint:paint//区间选择背景
|
|
7790
7841
|
};this.SelectRectDialog.DoModal(e);}}this.Draw();};//注册鼠标右键事件
|
|
7791
|
-
this.OnRightMenu=function(x,y,e){
|
|
7842
|
+
this.OnRightMenu=function(x,y,e){var pixelTatio=GetDevicePixelRatio();//x,y 需要乘以放大倍速
|
|
7843
|
+
var frameId=this.Frame.PtInFrame(x*pixelTatio,y*pixelTatio);this.PopupRightMenuV2({X:e.offsetX,Y:e.offsetY,FrameID:frameId},e);var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CONTEXT_MENU);if(event){var data={X:x,Y:y,Event:e,FrameID:frameId};event.Callback(event,data,this);}};//右键菜单数据
|
|
7844
|
+
this.GetRightMenuData=function(frameID){var windowCount=this.Frame.SubFrame.length;//窗口个数
|
|
7845
|
+
var aryOverlaySymbol=[];//叠加的股票列表
|
|
7846
|
+
for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];if(item&&item.Symbol)aryOverlaySymbol.push(item.Symbol);}var bShowDrawTool=false;if(this.GetExtendChartByClassName('DrawToolsButton'))bShowDrawTool=true;//画图工具
|
|
7847
|
+
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},{Name:"其他设置",SubMenu:[{Name:"画图工具",Data:{ID:bShowDrawTool?JSCHART_MENU_ID.CMD_HIDE_DRAWTOOL_ID:JSCHART_MENU_ID.CMD_SHOW_DRAWTOOL_ID,Args:[]},Checked:bShowDrawTool}]}];if(MARKET_SUFFIX_NAME.IsSHSZStockA(this.Symbol)){var item={Name:"集合竞价",Data:{ID:JSCHART_MENU_ID.CMD_SHOW_BEFORE_DATA_ID,Args:[!this.IsShowBeforeData]},Checked:this.IsShowBeforeData};aryMenu.splice(4,0,item);}//删除菜单
|
|
7848
|
+
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.PopupRightMenuV2=function(data,e){var _this28=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){_this28.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
7849
|
if(this.SelectedChart.EnableSelected){selectedChart=this.PtInChart(x,y);}var dbClickInfo={SelectedChart:selectedChart};this.DBClickEvent(dbClickInfo,e);//没有图形选中,双击缩放窗口
|
|
7793
7850
|
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
7851
|
//windowCount 窗口个数
|
|
7795
|
-
this.Create=function(windowCount,option){var
|
|
7796
|
-
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return
|
|
7852
|
+
this.Create=function(windowCount,option){var _this29=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
7853
|
+
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return _this29.PtInClient(x,y);};this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_Minute_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this29.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this29.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY.LanguageID=this.LanguageID;this.ChartCorssCursor.StringFormatY.ShareAfterVol=this.ShareAfterVol;this.ChartCorssCursor.CallAcutionXOperator=new CallAcutionXOperator();//创建等待提示
|
|
7797
7854
|
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
|
|
7855
|
+
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 _this29.GetExtendChartRightWidth();};this.Frame.GetEventCallback=function(id){return _this29.GetEventCallback(id);};this.Frame.ZoomStartWindowIndex=2;this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
|
|
7799
7856
|
this.ChartSplashPaint.Frame=this.Frame;this.CreateChildWindow(windowCount);this.CreateMainKLine();this.CreateExtendChart("RectSelectPaint",option?option.SelectRect:null);//区间统计
|
|
7800
7857
|
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){
|
|
7858
|
+
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 _this29.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){_this29.OnKeyDown(e);},true);//键盘消息
|
|
7859
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this29.OnWheel(e);},true);//上下滚动消息
|
|
7803
7860
|
};//创建子窗口
|
|
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
|
|
7861
|
+
this.CreateChildWindow=function(windowCount){var _this30=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;//绑定菜单事件
|
|
7862
|
+
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 _this30.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 _this30.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 _this30.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 _this31=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
7863
|
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
|
|
7864
|
+
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 _this31.GetEventCallback(id);};frame.YSplitOperator.GetEventCallback=function(id){return _this31.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线数据绑定
|
|
7865
|
+
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 _this32=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 _this32.GetEventCallback(id);};this.TitlePaint[index+1]=titlePaint;this.SetSubFrameOption(subFrame,option);//最后一个显示X轴坐标
|
|
7809
7866
|
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
7867
|
this.Frame.SetSizeChage(true);if(this.UpdateXShowText)this.UpdateXShowText();this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7811
7868
|
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 +7873,8 @@ subFrame.YSpecificMaxMin=null;subFrame.IsLocked=false;//解除上锁
|
|
|
7816
7873
|
subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType;//还原Y坐标分割模式
|
|
7817
7874
|
this.ChartPaint=paint;//清空东条标题
|
|
7818
7875
|
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
|
|
7876
|
+
this.CreateMainKLine=function(){var _this33=this;//分钟线
|
|
7877
|
+
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 _this33.GetEventCallback(id);};this.ChartPaint[0]=minuteLine;//分钟线均线
|
|
7821
7878
|
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
7879
|
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
7880
|
this.TitlePaint[0].LanguageID=this.LanguageID;this.TitlePaint[0].CallAcutionXOperator=new CallAcutionXOperator();this.TitlePaint[0].CallAcutionXOperator.Frame=this.Frame.SubFrame[0].Frame;};//切换成 脚本指标
|
|
@@ -7832,19 +7889,19 @@ this.UpdataDataoffset();//更新数据偏移
|
|
|
7832
7889
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7833
7890
|
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
7891
|
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
|
|
7892
|
+
this.ChangeIndexWindowCount=function(count){var _this34=this;if(count<2)return;//1,2个窗口固定的不能动
|
|
7836
7893
|
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
|
|
7894
|
+
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 _this34.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint[i+1]=titlePaint;}//创建指标
|
|
7838
7895
|
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
7896
|
var bindData=this.SourceData;this.BindIndexData(i,bindData);//执行脚本
|
|
7840
7897
|
}//最后一个显示X轴坐标
|
|
7841
7898
|
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
7899
|
}this.UpdateXShowText();this.Frame.SetSizeChage(true);this.ResetFrameXYSplit();this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
7843
7900
|
this.Draw();};this.ChangeIndexTemplate=function(option)//切换指标模板 可以设置指标窗口个数 每个窗口的指标, 只能从第3个指标窗口开始设置,前面2个指标窗口固定无法设置
|
|
7844
|
-
{var
|
|
7901
|
+
{var _this35=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
7902
|
if(option.Symbol)symbol=option.Symbol;var bRefreshData=dayCount!=null||symbol!=null;//清空所有的指标图型
|
|
7846
7903
|
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
|
|
7904
|
+
{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 _this35.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
7905
|
{this.WindowIndex[windowIndex]=new ScriptIndex(item.Name,item.Script,item.Args,item);//脚本执行
|
|
7849
7906
|
}else if(item.API)//后台指标
|
|
7850
7907
|
{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 +7945,7 @@ if(option.Overlay&&IFrameSplitOperator.IsNonEmptyArray(option.Overlay)){var setS
|
|
|
7888
7945
|
{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
7946
|
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
7947
|
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();}
|
|
7948
|
+
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
7949
|
this.Frame.ClearYCoordinateMaxMin();this.ResetOverlaySymbolStatus();this.RequestData();};//[{ Symbol: , Color, Option: }]
|
|
7893
7950
|
this.OverlaySymbols=function(aryData,option){if(option&&option.ClearAll===true)//全部清空
|
|
7894
7951
|
{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 +7977,7 @@ this.BindMainData(sourceData,yClose);//外汇 均线暂时不用
|
|
|
7920
7977
|
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
7978
|
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
7979
|
{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();//调整坐标最大 最小值
|
|
7980
|
+
this.CreateChartDrawPictureByStorage();//创建画图工具
|
|
7923
7981
|
//执行脚本
|
|
7924
7982
|
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
7983
|
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 +8140,8 @@ else this.ClearBindOverlayPositionData();this.TitlePaint[0].Data=this.SourceData
|
|
|
8082
8140
|
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
8141
|
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
8142
|
}};//绑定分钟叠加指标数据(持仓量)
|
|
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
|
|
8143
|
+
this.BindOverlayPositionData=function(minuteData,yClose){var _this36=this;if(this.Frame.SubFrame.length<2)return;var chart=null;var frame=null;var subFrame=this.Frame.SubFrame[1];//第2个窗口
|
|
8144
|
+
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 _this36.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
8145
|
}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
8146
|
{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
8147
|
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 +8150,12 @@ this.AddOverlayIndex=function(obj){var overlay=this.CreateOverlayWindowsIndex(ob
|
|
|
8092
8150
|
this.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
8093
8151
|
this.Draw();};//创建一个叠加指标
|
|
8094
8152
|
this.CreateOverlayWindowsIndex=function(obj)//{WindowIndex:, IndexName:, Identify:, ShowRightText:, API:}
|
|
8095
|
-
{var
|
|
8153
|
+
{var _this37=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
8154
|
{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
8155
|
if(!indexInfo){indexCustom=JSIndexMap.Get(indexName);//定制指标
|
|
8098
8156
|
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
8157
|
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
|
|
8158
|
+
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 _this37.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
8159
|
overlayFrame.Script=apiIndex;}else if(indexInfo){JSIndexScript.ModifyAttribute(indexInfo,obj);var scriptIndex=new OverlayScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo);//脚本执行
|
|
8102
8160
|
scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
|
|
8103
8161
|
overlayFrame.Script=scriptIndex;}else{var scriptIndex=indexCustom.Create();scriptIndex.OverlayIndex={IsOverlay:true,Identify:overlayFrame.Identify,WindowIndex:windowIndex,Frame:overlayFrame};//叠加指标信息
|
|
@@ -8135,9 +8193,9 @@ this.Draw();};this.CreateChartDrawPicture=function(name,option,callback){var dra
|
|
|
8135
8193
|
if(option)drawPicture.SetOption(option);var self=this;drawPicture.Update=function()//更新回调函数
|
|
8136
8194
|
{self.DrawDynamicInfo();};drawPicture.GetActiveDrawPicture=function(){return self.GetActiveDrawPicture();};this.CurrentChartDrawPicture=drawPicture;JSConsole.Chart.Log("[MinuteChartContainer::CreateChartDrawPicture] ",name,this.CurrentChartDrawPicture);return true;};//手动添加画线
|
|
8137
8195
|
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;//清空缓存
|
|
8196
|
+
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) 画图工具创建出来
|
|
8197
|
+
{var _this38=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;//绑定框架坐标
|
|
8198
|
+
if(drawPicture.ImportStorageData)drawPicture.ImportStorageData(item);drawPicture.ResetXValue();drawPicture.UpdateXValue();drawPicture.ValueToPoint();drawPicture.GetActiveDrawPicture=function(){return _this38.GetActiveDrawPicture();};if(drawPicture.ClassName==='ChartDrawPictureText')drawPicture.IsInitialized=true;this.ChartDrawPicture.push(drawPicture);}this.ChartDrawStorageCache=null;//清空缓存
|
|
8141
8199
|
};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
8200
|
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
8201
|
this.GetDateTimeByPoint=function(x,y){var clientPos=this.PtInClient_V2(x,y);// 100-199=多日分时主图 200-299=盘前 300-399=盘后 1=主图 2=盘前 3=盘后
|
|
@@ -8349,33 +8407,33 @@ if(this.DataMove(moveSetp,isLeft)){this.UpdataDataoffset();this.UpdatePointByCur
|
|
|
8349
8407
|
{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
8408
|
{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
8409
|
//windowCount 窗口个数
|
|
8352
|
-
this.Create=function(windowCount){var
|
|
8410
|
+
this.Create=function(windowCount){var _this39=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8353
8411
|
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
8412
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
8355
8413
|
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
8414
|
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
|
|
8415
|
+
for(var i in this.Frame.SubFrame){var titlePaint=new DynamicChartTitlePainting();titlePaint.Frame=this.Frame.SubFrame[i].Frame;titlePaint.Canvas=this.Canvas;titlePaint.LanguageID=this.LanguageID;titlePaint.GetEventCallback=function(id){return _this39.GetEventCallback(id);};titlePaint.SelectedChart=this.SelectedChart;this.TitlePaint.push(titlePaint);}this.UIElement.addEventListener("keydown",OnKeyDown,true);//键盘消息
|
|
8358
8416
|
};//创建子窗口
|
|
8359
|
-
this.CreateChildWindow=function(windowCount){var
|
|
8417
|
+
this.CreateChildWindow=function(windowCount){var _this40=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
8418
|
frame.RightSpaceCount=this.RightSpaceCount;//右边
|
|
8361
8419
|
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
|
|
8420
|
+
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 _this40.GetEventCallback(id);};//主图上下间距
|
|
8363
8421
|
var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
8364
8422
|
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
|
|
8423
|
+
}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 _this40.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
8424
|
// 走势图横屏显示
|
|
8367
8425
|
//
|
|
8368
8426
|
function MinuteChartHScreenContainer(uielement){this.newMethod=MinuteChartContainer;//派生
|
|
8369
8427
|
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
8428
|
//windowCount 窗口个数
|
|
8371
|
-
this.Create=function(windowCount){var
|
|
8372
|
-
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return
|
|
8429
|
+
this.Create=function(windowCount){var _this41=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8430
|
+
this.ChartCorssCursor=new ChartCorssCursor();this.ChartCorssCursor.PtInClient=function(x,y){return _this41.PtInClient(x,y);};this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_Minute_XStringFormat");this.ChartCorssCursor.StringFormatX.GetEventCallback=function(id){return _this41.GetEventCallback(id);};this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");this.ChartCorssCursor.StringFormatY.GetEventCallback=function(id){return _this41.GetEventCallback(id);};this.ChartCorssCursor.CallAcutionXOperator=new CallAcutionXOperator();//创建等待提示
|
|
8373
8431
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.HQChart=this;//创建框架容器
|
|
8374
8432
|
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
8433
|
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
|
|
8434
|
+
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 _this41.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
8435
|
};//创建子窗口
|
|
8378
|
-
this.CreateChildWindow=function(windowCount){var
|
|
8436
|
+
this.CreateChildWindow=function(windowCount){var _this42=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 _this42.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 _this42.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 _this42.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
8437
|
// 深度图
|
|
8380
8438
|
//
|
|
8381
8439
|
function DepthChartContainer(uielement){this.newMethod=JSChartContainer;//派生
|
|
@@ -8383,7 +8441,7 @@ this.newMethod(uielement);delete this.newMethod;this.ClassName="DepthChartContai
|
|
|
8383
8441
|
this.MapAsk=new _map2.default();this.MapBid=new _map2.default();this.IsAutoUpdate=false;//是否自动更新行情数据
|
|
8384
8442
|
this.AutoUpdateFrequency=30000;//30秒更新一次数据
|
|
8385
8443
|
this.AutoUpdateTimer;this.DefaultZoom=0.8;//默认显示80%的盘口 (0 - 1)
|
|
8386
|
-
this.MaxVolRate=1.1;this.Create=function(option){var
|
|
8444
|
+
this.MaxVolRate=1.1;this.Create=function(option){var _this43=this;this.UIElement.JSChartContainer=this;//创建十字光标
|
|
8387
8445
|
this.ChartCorssCursor=new DepthChartCorssCursor();this.ChartCorssCursor.Canvas=this.Canvas;this.ChartCorssCursor.HQChart=this;//this.ChartCorssCursor.StringFormatX=g_DivTooltipDataForamt.Create("CorssCursor_XStringFormat");
|
|
8388
8446
|
//this.ChartCorssCursor.StringFormatX.LanguageID=this.LanguageID;
|
|
8389
8447
|
//this.ChartCorssCursor.StringFormatY=g_DivTooltipDataForamt.Create("CorssCursor_YStringFormat");
|
|
@@ -8391,9 +8449,9 @@ this.ChartCorssCursor=new DepthChartCorssCursor();this.ChartCorssCursor.Canvas=t
|
|
|
8391
8449
|
//创建等待提示
|
|
8392
8450
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);//创建框架
|
|
8393
8451
|
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){
|
|
8452
|
+
ySplitOper.ChartBorder=this.Frame.ChartBorder;ySplitOper.GetEventCallback=function(id){return _this43.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 _this43.GetEventCallback(id);};this.Frame.XSplitOperator=xSplitOper;if(this.ChartCorssCursor)this.ChartCorssCursor.Frame=this.Frame;//十字光标绑定框架
|
|
8453
|
+
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){_this43.OnKeyDown(e);},true);//键盘消息
|
|
8454
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this43.OnWheel(e);},true);//上下滚动消息
|
|
8397
8455
|
};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
8456
|
if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Wheel===false)enableZoomUpDown=false;if(isInClient&&wheelValue<0&&enableZoomUpDown)//缩小
|
|
8399
8457
|
{if(this.Frame.ZoomDown()){this.UpdateFrameMaxMin();this.Draw();}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
|
|
@@ -8465,11 +8523,11 @@ this.BarPosition=1;//柱子方向 0=左边 1=右边
|
|
|
8465
8523
|
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
8524
|
}else{frame=hqChart.Frame.SubFrame[windowIndex].Frame;hqChart.DeleteIndexPaint(windowIndex);//清空
|
|
8467
8525
|
}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
|
|
8526
|
+
this.RequestData=function(hqChart,windowIndex,hisData,option){var _this44=this;this.CancelRequestTimer();var T_RequestData=function T_RequestData(){//请求数据
|
|
8469
8527
|
var klineChart=hqChart.ChartPaint[0];//获取当前K线图实例
|
|
8470
8528
|
var kData=klineChart.Data;//K线数据
|
|
8471
8529
|
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:
|
|
8530
|
+
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:_this44};if(IFrameSplitOperator.IsNumber(startKItem.Time))option.Start.Time=startKItem.Time;if(IFrameSplitOperator.IsNumber(endKItem.Time))option.End.Time=endKItem.Time;option.ValueAreaVol=_this44.Arguments[0].Value;if(_this44.Arguments[1].Value>0)_this44.BarPosition=1;else _this44.BarPosition=0;if(_this44.ChartVolProfile){_this44.ChartVolProfile.SetOption({BarPosition:_this44.BarPosition});}_this44.DataStatus=0;if(hqChart&&hqChart.RequestVolumeProfileData){hqChart.RequestVolumeProfileData(option);}};if(option&&option.Type==1)//页面缩放或移动延迟更新
|
|
8473
8531
|
{this.RequestTimer=setTimeout(function(){T_RequestData();},this.DelayRequestFrequency);}else{T_RequestData();}return true;};this.OnRecvVolumeProfileData=function(data){this.BindData(data);this.HQChart.UpdataDataoffset();//更新数据偏移
|
|
8474
8532
|
this.HQChart.UpdateFrameMaxMin();//调整坐标最大 最小值
|
|
8475
8533
|
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
|
|
@@ -8782,75 +8840,7 @@ this.Close=function(){if(this.Dialog){this.DivElement.removeChild(this.Dialog);t
|
|
|
8782
8840
|
this.DoModal=function(event){this.Title=event.data.Title;var chart=event.data.Chart;if(this.ID==null)this.Create();//第1次 需要创建div
|
|
8783
8841
|
//居中显示
|
|
8784
8842
|
var border=chart.Frame.ChartBorder;var scrollPos=GetScrollPosition();var left=border.GetWidth()/2;var top=border.GetHeight()/2;this.Show(left,top,200,40);//显示
|
|
8785
|
-
};}
|
|
8786
|
-
//id:"kline"
|
|
8787
|
-
function KLineRightMenu(divElement){this.newMethod=IDivDialog;//派生
|
|
8788
|
-
this.newMethod(divElement);delete this.newMethod;this.option={};this.Create=function(){var _self=this;this.ID=Guid();_self.BindData();_self.BindEvent();};this.BindData=function(){var _self=this;var id=this.DivElement.id;var $body=(0,_jquery2.default)("#"+id);$body.find("div[id^='topMenu_']").remove();$body.find("div[id^='childMenu_']").remove();var $topMenu=(0,_jquery2.default)("<div />");$topMenu.attr("id","topMenu_"+_self.ID).addClass("context-menu-wrapper topmenu").hide();$body.append($topMenu);var $topTable=(0,_jquery2.default)("<table />");$topTable.attr({id:"topTable_"+_self.ID,cellspacing:"0",cellpadding:"0"}).addClass("context-menu");$topMenu.append($topTable);$topTable.append(_self.childrenList(_self.option.data));for(var i=0;i<_self.option.data.length;i++){var isHasChildren=typeof _self.option.data[i].children!="undefined";if(isHasChildren){var $childMenu=(0,_jquery2.default)("<div />");$childMenu.attr({id:"childMenu_"+_self.ID+i,"data-index":i}).addClass("context-menu-wrapper").hide();$body.append($childMenu);var $childTable=(0,_jquery2.default)("<table />");$childTable.attr({id:"childTable_"+_self.ID+i,cellspacing:"0",cellpadding:"0"}).addClass("context-menu");$childMenu.append($childTable);$childTable.append(_self.childrenList(_self.option.data[i].children));}}};this.Update=function(){var _self=this;//var id=this.DivElement.id;
|
|
8789
|
-
//var $body=$("#"+id);
|
|
8790
|
-
//
|
|
8791
|
-
//var $topTable = $("#topTable_" + _self.ID);
|
|
8792
|
-
//$topTable.empty();
|
|
8793
|
-
//$topTable.append(_self.childrenList(_self.option.data));
|
|
8794
|
-
//
|
|
8795
|
-
//for (var i = 0; i < _self.option.data.length; i++) {
|
|
8796
|
-
// var isHasChildren = typeof _self.option.data[i].children != "undefined";
|
|
8797
|
-
//
|
|
8798
|
-
// if (isHasChildren) {
|
|
8799
|
-
// var $childTable = $("#childTable_" + _self.ID + i);
|
|
8800
|
-
// $childTable.empty();
|
|
8801
|
-
// $childTable.append(_self.childrenList(_self.option.data[i].children));
|
|
8802
|
-
// }
|
|
8803
|
-
//}
|
|
8804
|
-
_self.BindData();_self.BindEvent();};this.childrenList=function(list){var result=[];for(var i=0;i<list.length;i++){var isBorder=typeof list[i].isBorder!="undefined"&&list[i].isBorder;var $tr=(0,_jquery2.default)("<tr />");$tr.addClass("font_Arial context-menu");if(isBorder)$tr.addClass("border");var $td1=(0,_jquery2.default)("<td />");if(list[i].selected){$td1.addClass("spacer context-menu").html("√");}else{$td1.addClass("spacer context-menu");}var $td2=(0,_jquery2.default)("<td />");$td2.addClass("text").html(list[i].text);var $td3=(0,_jquery2.default)("<td />");$td3.addClass("right shortcut");var $td4=(0,_jquery2.default)("<td />");$td4.addClass(typeof list[i].children!="undefined"?"submenu-arrow":"context-menu spacer");$tr.append($td1).append($td2).append($td3).append($td4);result.push($tr);}return result;};this.Show=function(obj){var _self=this;_jquery2.default.extend(_self.option,obj);if(!_self.ID)_self.Create();//判断是否重复创建
|
|
8805
|
-
else _self.Update();//更新菜单状态
|
|
8806
|
-
var $topMenu=(0,_jquery2.default)("#topMenu_"+_self.ID),topWidth=$topMenu.outerWidth(),topHeight=$topMenu.outerHeight();var x=_self.option.x,y=_self.option.y;if(topWidth>_self.option.position.X+_self.option.position.W-x)//超过了右边距
|
|
8807
|
-
x=x-topWidth;if(topHeight>_self.option.position.Y+_self.option.position.H-y)//超过了下边距
|
|
8808
|
-
y=y-topHeight;$topMenu.hide();$topMenu.css({position:"absolute",left:x+"px",top:y+"px"}).show();this.isInit=true;};this.Hide=function(){var _self=this;if(typeof _jquery2.default=="undefined")return;(0,_jquery2.default)("#topMenu_"+_self.ID).hide();(0,_jquery2.default)("[id^='childMenu_"+_self.ID+"']").hide();};this.BindEvent=function(){var _self=this;var $childMenu=(0,_jquery2.default)("[id^='childMenu_"+_self.ID+"']");(0,_jquery2.default)("#topTable_"+_self.ID).find("tr").mouseenter(function(){var $this=(0,_jquery2.default)(this),index=$this.index(),$topMenu=(0,_jquery2.default)("#topMenu_"+_self.ID),$child=(0,_jquery2.default)("#childMenu_"+_self.ID+index),trWidth=$this.outerWidth(),trHeight=$this.outerHeight();var left=$topMenu.position().left+trWidth+1;var top=$topMenu.position().top+trHeight*index;if(trWidth>_self.option.position.X+_self.option.position.W-left)//超过了右边距
|
|
8809
|
-
left=left-trWidth-$topMenu.outerWidth()-2;if($child.outerHeight()>_self.option.position.Y+_self.option.position.H-top)//超过了下边距
|
|
8810
|
-
top=$topMenu.position().top+$topMenu.outerHeight()-$child.outerHeight();$childMenu.hide();$child.css({left:left+"px",top:top+"px"}).show();}).mouseleave(function(){var index=(0,_jquery2.default)(this).index();setTimeout(function(){if((0,_jquery2.default)("#childMenu_"+_self.ID+index).attr("data-isShow")!=1){(0,_jquery2.default)("#childMenu_"+_self.ID+index).hide();}},10);}).click(function(){var $this=(0,_jquery2.default)(this);var index=$this.index();if(_jquery2.default.type(_self.option.data[index].click)=="function"){_self.option.data[index].click(_self.option.returnData);$this.hide();}}).contextmenu(function(){return false;//屏蔽系统右键菜单
|
|
8811
|
-
});$childMenu.mouseenter(function(){(0,_jquery2.default)(this).attr("data-isShow","1");}).mouseleave(function(){(0,_jquery2.default)(this).attr("data-isShow","0");}).contextmenu(function(){return false;//屏蔽系统右键菜单
|
|
8812
|
-
});$childMenu.find("tr").click(function(){var $this=(0,_jquery2.default)(this);var divIndex=parseInt($this.closest("div").attr("data-index"));var trIndex=$this.index();if(_jquery2.default.type(_self.option.data[divIndex].children[trIndex].click)=="function"){_self.option.data[divIndex].children[trIndex].click(_self.option.windowIndex||1);$childMenu.hide();}});};this.GetPeriod=function(chart){var data=[{text:"日线",Value:0,click:function click(){chart.ChangePeriod(0);}},{text:"周线",Value:1,click:function click(){chart.ChangePeriod(1);}},{text:"双周线",Value:21,click:function click(){chart.ChangePeriod(21);}},{text:"月线",Value:2,click:function click(){chart.ChangePeriod(2);}},{text:"季线",Value:9,click:function click(){chart.ChangePeriod(9);}},{text:"半年",Value:22,click:function click(){chart.ChangePeriod(22);}},{text:"年线",Value:3,click:function click(){chart.ChangePeriod(3);}},{text:"1分",Value:4,click:function click(){chart.ChangePeriod(4);}},{text:"5分",Value:5,click:function click(){chart.ChangePeriod(5);}},{text:"15分",Value:6,click:function click(){chart.ChangePeriod(6);}},{text:"30分",Value:7,click:function click(){chart.ChangePeriod(7);}},{text:"60分",Value:8,click:function click(){chart.ChangePeriod(8);}},{text:"2小时",Value:11,click:function click(){chart.ChangePeriod(11);}},{text:"4小时",Value:12,click:function click(){chart.ChangePeriod(12);}},{text:"分笔",Value:10,click:function click(){chart.ChangePeriod(10);}},{text:"自定义周期:3分钟",Value:20003,click:function click(){chart.ChangePeriod(20003);}},{text:"自定义周期:35分钟",Value:20035,click:function click(){chart.ChangePeriod(20035);}},{text:"自定义周期:8日",Value:40008,click:function click(){chart.ChangePeriod(40008);}}];for(var i in data){var item=data[i];if(item.Value==chart.Period){item.selected=true;break;}}return data;};this.GetRight=function(chart){var data=[{text:"不复权",click:function click(){chart.ChangeRight(0);}},{text:"前复权",click:function click(){chart.ChangeRight(1);}},{text:"后复权",click:function click(){chart.ChangeRight(2);}}];if(chart.Right>=0&&chart.Right<data.length)data[chart.Right].selected=true;return data;};//指标
|
|
8813
|
-
this.GetIndex=function(chart){return[{text:"均线",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'均线');}},{text:"BOLL",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'BOLL');},isBorder:true},{text:"MACD",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'MACD');}},{text:"KDJ",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'KDJ');}},{text:"VOL",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'VOL');}},{text:"RSI",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'RSI');}},{text:"BRAR",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'BRAR');}},{text:"WR",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'WR');}},{text:"BIAS",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'BIAS');}},{text:"OBV",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'OBV');}},{text:"DMI",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'DMI');}},{text:"CR",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'CR');}},{text:"PSY",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'PSY');}},{text:"CCI",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'CCI');}},{text:"DMA",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'DMA');}},{text:"TRIX",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'TRIX');}},{text:"VR",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'VR');}},{text:"EMV",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'EMV');}},{text:"ROC",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'ROC');}},{text:"MIM",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'MIM');}},{text:"FSL",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'FSL');}}];};//五彩K线
|
|
8814
|
-
this.GetColorIndex=function(chart){var data=[{text:"十字星",click:function click(windowIndex){chart.ChangeInstructionIndex('五彩K线-十字星');}},{text:"早晨之星",click:function click(windowIndex){chart.ChangeInstructionIndex('五彩K线-早晨之星');}},{text:"垂死十字",click:function click(windowIndex){chart.ChangeInstructionIndex('五彩K线-垂死十字');}},{text:"三只乌鸦",click:function click(windowIndex){chart.ChangeInstructionIndex('五彩K线-三只乌鸦');}},{text:"光脚阴线",click:function click(windowIndex){chart.ChangeInstructionIndex('五彩K线-光脚阴线');}},{text:"黄昏之星",click:function click(windowIndex){chart.ChangeInstructionIndex('五彩K线-黄昏之星');}}];if(chart.ColorIndex){data[data.length-1].isBorder=true;data.push({text:"删除五彩K线",click:function click(windowIndex){chart.CancelInstructionIndex();}});}return data;};//专家系统
|
|
8815
|
-
this.GetTradeIndex=function(chart){var data=[{text:"BIAS",click:function click(windowIndex){chart.ChangeInstructionIndex('交易系统-BIAS');}},{text:"CCI",click:function click(windowIndex){chart.ChangeInstructionIndex('交易系统-CCI');}},{text:"DMI",click:function click(windowIndex){chart.ChangeInstructionIndex('交易系统-DMI');}},{text:"KD",click:function click(windowIndex){chart.ChangeInstructionIndex('交易系统-KD');}},{text:"BOLL",click:function click(windowIndex){chart.ChangeInstructionIndex('交易系统-BOLL');}},{text:"KDJ",click:function click(windowIndex){chart.ChangeInstructionIndex('交易系统-KDJ');}}];if(chart.TradeIndex){data[data.length-1].isBorder=true;data.push({text:"删除专家系统",click:function click(windowIndex){chart.CancelInstructionIndex();}});}return data;};//叠加
|
|
8816
|
-
this.GetOverlay=function(chart){var data=[{text:"上证指数",click:function click(){chart.OverlaySymbol('000001.sh');}},{text:"深证成指",click:function click(){chart.OverlaySymbol('399001.sz');}},{text:"中小板指",click:function click(){chart.OverlaySymbol('399005.sz');}},{text:"创业板指",click:function click(){chart.OverlaySymbol('399006.sz');}},{text:"沪深300",click:function click(){chart.OverlaySymbol('000300.sh');}}];for(var i in chart.OverlayChartPaint){var item=chart.OverlayChartPaint[i];var symbol=item.Symbol;var mapSymbol=new _map2.default([['000001.sh',0],['399001.sz',1],['399005.sz',2],['399006.sz',3],['000300.sh',4]]);if(mapSymbol.has(symbol)){var menuItem;(function(){menuItem=data[mapSymbol.get(symbol)];var delSymbol=symbol;menuItem.selected=true;menuItem.click=function(){chart.DeleteOverlaySymbol(delSymbol);};})();}}if(chart.OverlayChartPaint&&chart.OverlayChartPaint.length>0){data[data.length-1].isBorder=true;data.push({text:"取消叠加",click:function click(){chart.ClearOverlaySymbol();}});}return data;};//K线类型设置
|
|
8817
|
-
this.GetKLineType=function(chart){var data=[{text:"K线(空心阳线)",click:function click(){chart.ChangeKLineDrawType(3);}},{text:"K线(实心阳线)",click:function click(){chart.ChangeKLineDrawType(0);}},{text:"美国线",click:function click(){chart.ChangeKLineDrawType(2,true,{IsThinAKBar:false});}},{text:"收盘线",click:function click(){chart.ChangeKLineDrawType(1);}},{text:"收盘面积",click:function click(){chart.ChangeKLineDrawType(4);}},{text:"K线(空心阳线阴线)",click:function click(){chart.ChangeKLineDrawType(6);}},{text:"Heikin Ashi",click:function click(){chart.ChangeKLineDrawType(11);}},{text:"Line Break",click:function click(){chart.ChangeKLineDrawType(12);}},{text:"High-low",click:function click(){chart.ChangeKLineDrawType(13);}},{text:"HLC Area",click:function click(){chart.ChangeKLineDrawType(15);}}];switch(chart.KLineDrawType){case 0:data[1].selected=true;break;case 1:data[3].selected=true;break;case 2:data[2].selected=true;break;case 3:data[0].selected=true;break;case 4:data[4].selected=true;break;case 6:data[5].selected=true;break;case 11:data[6].selected=true;break;case 12:data[7].selected=true;break;case 13:data[8].selected=true;break;case 15:data[9].selected=true;break;}return data;};//指标窗口个数
|
|
8818
|
-
this.GetIndexWindowCount=function(chart){var data=[{text:"1个窗口",click:function click(){chart.ChangeIndexWindowCount(1);}},{text:"2个窗口",click:function click(){chart.ChangeIndexWindowCount(2);}},{text:"3个窗口",click:function click(){chart.ChangeIndexWindowCount(3);}},{text:"4个窗口",click:function click(){chart.ChangeIndexWindowCount(4);}},{text:"5个窗口",click:function click(){chart.ChangeIndexWindowCount(5);}}];var count=chart.Frame.SubFrame.length;if(count-1>=0&&count-1<data.length)data[count-1].selected=true;//选中
|
|
8819
|
-
return data;};//坐标类型
|
|
8820
|
-
this.GetCoordinateType=function(chart){var data=[{text:"普通坐标",click:function click(){chart.ChangeCoordinateType({Type:0});}},{text:"百分比坐标",click:function click(){chart.ChangeCoordinateType({Type:1});}},{text:"反转坐标",click:function click(){chart.ChangeCoordinateType({IsReverse:true});}},{text:"对数坐标",click:function click(){chart.ChangeCoordinateType({Type:2});}},{text:"等比坐标",click:function click(){chart.ChangeCoordinateType({Type:3});}},{text:"等分坐标",click:function click(){chart.ChangeCoordinateType({Type:4});}},{text:"黄金分割",click:function click(){chart.ChangeCoordinateType({Type:5});}}];if(chart.Frame&&chart.Frame.SubFrame&&chart.Frame.SubFrame.length>0){if(chart.Frame.SubFrame[0].Frame.CoordinateType==1){data[2].selected=true;data[2].click=function(){chart.ChangeCoordinateType({IsReverse:false});};//取消反转
|
|
8821
|
-
}if(chart.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType==1)data[1].selected=true;//百分比
|
|
8822
|
-
else if(chart.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType==0)data[0].selected=true;//普通坐标
|
|
8823
|
-
else if(chart.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType==2)data[3].selected=true;//对数
|
|
8824
|
-
else if(chart.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType==3)data[4].selected=true;//等比坐标
|
|
8825
|
-
else if(chart.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType==4)data[5].selected=true;//等分坐标
|
|
8826
|
-
else if(chart.Frame.SubFrame[0].Frame.YSplitOperator.CoordinateType==5)data[6].selected=true;//黄金分割
|
|
8827
|
-
}return data;};//拖拽模式
|
|
8828
|
-
this.GetDragModeType=function(chart){var data=[{text:"禁止拖拽",click:function click(){chart.DragMode=0;}},{text:"启动拖拽",click:function click(){chart.DragMode=1;}},{text:"区间选择",click:function click(){chart.DragMode=2;}}];if(chart.DragMode>=0&&chart.DragMode<data.length)data[chart.DragMode].selected=true;//选中
|
|
8829
|
-
return data;};//工具
|
|
8830
|
-
this.GetTools=function(chart){var data=[];var drawTools=chart.GetExtendChartByClassName('DrawToolsButton');if(drawTools){data.push({text:"关闭画图工具",click:function click(){var toolsWidth=drawTools.Chart.Width;var toolsIndex=parseInt(drawTools.Index);for(var i=toolsIndex+1;i<chart.ExtendChartPaint.length;++i)//在画图工具后面创建的需要减去工具的宽度
|
|
8831
|
-
{var item=chart.ExtendChartPaint[i];if(item.ClassName=='StockChip'){item.Left-=toolsWidth;}}chart.DeleteExtendChart(drawTools);chart.Frame.ChartBorder.Right-=toolsWidth;chart.SetSizeChange(true);chart.Draw();}});}else{data.push({text:"画图工具",click:function click(){var option={Name:'画图工具',Top:chart.Frame.ChartBorder.Top};var extendChart=chart.CreateExtendChart(option.Name,option);//创建扩展图形
|
|
8832
|
-
chart.SetSizeChange(true);chart.Draw();}});}var StockChip=chart.GetExtendChartByClassName('StockChip');if(StockChip){data.push({text:"关闭移动筹码",click:function click(){var chipWidth=StockChip.Chart.Width;var chipIndex=parseInt(StockChip.Index);for(var i=chipIndex+1;i<chart.ExtendChartPaint.length;++i)//在筹码后面创建的需要筹码的宽度
|
|
8833
|
-
{var item=chart.ExtendChartPaint[i];if(item.ClassName=='DrawToolsButton'){item.Left-=chipWidth;}}chart.DeleteExtendChart(StockChip);chart.Frame.ChartBorder.Right-=chipWidth;chart.SetSizeChange(true);chart.Draw();}});}else{data.push({text:"移动筹码",click:function click(){var option={Name:'筹码分布',ShowType:1,Width:230};var extendChart=chart.CreateExtendChart(option.Name,option);//创建扩展图形
|
|
8834
|
-
chart.SetSizeChange(true);chart.Draw();}});}return data;};//缺口提示
|
|
8835
|
-
this.GetPriceGap=function(chart){var klineChart=chart.ChartPaint[0];var priceGap=klineChart.PriceGap;var data=[{text:"显示1个缺口",click:function click(){chart.ChangePriceGap({Enable:true,Count:1});}},{text:"显示2个缺口",click:function click(){chart.ChangePriceGap({Enable:true,Count:2});}},{text:"显示3个缺口",click:function click(){chart.ChangePriceGap({Enable:true,Count:3});}},{text:"隐藏缺口",click:function click(){chart.ChangePriceGap({Enable:false});}}];if(!priceGap.Enable||priceGap.Count<=0){data[data.length-1].selected=true;//选中
|
|
8836
|
-
}else if(priceGap.Enable&&priceGap.Count>0){var index=priceGap.Count-1;if(index>data.length-2)index=data.length-2;data[index].selected=true;//选中
|
|
8837
|
-
}return data;};this.GetBGSplit=function(chart){var data=[{text:"启用",click:function click(){chart.CreateExtendChart("SessionBreaksPaint",{});chart.Draw();}},{text:"关闭",click:function click(){var finder=chart.GetExtendChartByClassName("SessionBreaksPaint");if(finder){chart.DeleteExtendChartByID(finder.Chart.ID);chart.Draw();}}}];var finder=chart.GetExtendChartByClassName("SessionBreaksPaint");if(finder)data[0].selected=true;else data[1].selected=true;return data;};this.GetKLineInfo=function(chart){var setInfo=new _set2.default();for(var i in chart.ChartInfo){var item=chart.ChartInfo[i];setInfo.add(item.ClassName);}var aryKLineInfo=["公告","业绩预告","调研","大宗交易","龙虎榜","互动易"];var data=[];for(var i in aryKLineInfo){var infoName=aryKLineInfo[i];var classInfo=JSKLineInfoMap.GetClassInfo(infoName);if(!classInfo)continue;var item=this.CreateKlineInfoItem(infoName,setInfo.has(classInfo.ClassName),chart);data.push(item);}if(chart.ChartInfo.length>0){data[data.length-1].isBorder=true;var item={text:'删除所有',click:function click(){chart.ClearKLineInfo();}};data.push(item);}return data;};this.CreateKlineInfoItem=function(infoName,bExist,chart){var item={text:infoName,selected:bExist};if(bExist)item.click=function(){chart.DeleteKLineInfo(infoName);};else item.click=function(){chart.AddKLineInfo(infoName,true);};return item;};this.DoModal=function(event){var chart=event.data.Chart;var rightMenu=chart.RightMenu;var x=event.offsetX;var y=event.offsetY;var dataList=[{text:"分析周期",children:this.GetPeriod(chart)},{text:"复权处理",children:this.GetRight(chart)},{text:"指标切换",children:this.GetIndex(chart)},{text:"五彩K线",children:this.GetColorIndex(chart)},{text:'专家系统',children:this.GetTradeIndex(chart)},{text:'信息地雷',children:this.GetKLineInfo(chart)},{text:'缺口提示',children:this.GetPriceGap(chart)},{text:"叠加品种",children:this.GetOverlay(chart)},{text:'主图线型',children:this.GetKLineType(chart)},{text:"坐标类型",children:this.GetCoordinateType(chart)},{text:'指标窗口个数',children:this.GetIndexWindowCount(chart)},{text:'鼠标拖拽',children:this.GetDragModeType(chart)},{text:"工具",children:this.GetTools(chart)},{text:"背景分割",children:this.GetBGSplit(chart)}];var upperSymbol=chart.Symbol.toUpperCase();if(MARKET_SUFFIX_NAME.IsSHSZIndex(chart.Symbol)||MARKET_SUFFIX_NAME.IsBIT(upperSymbol)){dataList.splice(1,1);}var identify=event.data.FrameID;var overlayIndex=this.GetOverlayIndex(chart,identify);if(overlayIndex&&overlayIndex.length>0){var delOverlayIndexMenu={text:'删除叠加指标',children:this.GetDeleteOverlayIndex(chart,overlayIndex)};dataList.splice(3,0,delOverlayIndexMenu);}JSConsole.Chart.Log('[KLineRightMenu::DoModal]',identify);rightMenu.Show({windowIndex:identify,x:x+chart.UIElement.offsetLeft,y:y+chart.UIElement.offsetTop,position:chart.Frame.Position,data:dataList});(0,_jquery2.default)(document).click(function(){rightMenu.Hide();});};this.GetOverlayIndex=function(chart,windowsIndex){if(windowsIndex>=chart.Frame.SubFrame.length||windowsIndex<0)return[];var result=[];var item=chart.Frame.SubFrame[windowsIndex];for(var i in item.OverlayIndex){var overlayItem=item.OverlayIndex[i];result.push({Name:overlayItem.Script.Name,Identify:overlayItem.Identify});}return result;};this.GetDeleteOverlayIndex=function(chart,overlayIndex){var data=[];var _loop4=function _loop4(){var identify=overlayIndex[i].Identify;data.push({text:overlayIndex[i].Name,click:function click(){chart.DeleteOverlayWindowsIndex(identify);}});};for(var i in overlayIndex){_loop4();}return data;};}//K线区间选择右键菜单
|
|
8838
|
-
function KLineSelectRightMenu(divElement){this.newMethod=KLineRightMenu;//派生
|
|
8839
|
-
this.newMethod(divElement);delete this.newMethod;this.DoModal=function(event){var chart=event.data.Chart;var rightMenu=this;var x=event.data.X;var y=event.data.Y;var dataList=[{text:"区间统计",click:function click(){JSConsole.Chart.Log('[KLineSelectRightMenu::click] 区间统计');rightMenu.Hide();var dialog=new KLineSelectRectDialog(divElement);dialog.DoModal(event);}},{text:'区间放大',click:function click(){JSConsole.Chart.Log('[KLineSelectRightMenu::click] 区间放大');var chart=event.data.Chart;chart.ShowSelectData(event.data.SelectData);}}];rightMenu.Show({x:x,y:y,position:chart.Frame.Position,data:dataList});};this.Show=function(obj){var _self=this;_jquery2.default.extend(_self.option,obj);//判断是否重复创建
|
|
8840
|
-
if(!_self.ID)_self.Create();//判断下如果DOM没了需要重新创建
|
|
8841
|
-
var divIdName='topMenu_'+_self.ID;var divDom=document.getElementById(divIdName);if(!divDom)_self.Create();var $topMenu=(0,_jquery2.default)("#topMenu_"+_self.ID),topWidth=$topMenu.outerWidth(),topHeight=$topMenu.outerHeight();$topMenu.contextmenu(function(){return false;//屏蔽系统右键菜单
|
|
8842
|
-
});var x=_self.option.x,y=_self.option.y;if(topWidth>_self.option.position.X+_self.option.position.W-x)//超过了右边距
|
|
8843
|
-
x=x-topWidth;if(topHeight>_self.option.position.Y+_self.option.position.H-y)//超过了下边距
|
|
8844
|
-
y=y-topHeight;$topMenu.hide();$topMenu.css({position:"absolute",left:x+"px",top:y+"px"}).show();(0,_jquery2.default)("#topMenu_"+_self.ID).find("tr").show();//把菜单列表显示
|
|
8845
|
-
this.isInit=true;};}//分钟数据右键菜单
|
|
8846
|
-
function MinuteRightMenu(divElement){this.newMethod=KLineRightMenu;//派生
|
|
8847
|
-
this.newMethod(divElement);delete this.newMethod;this.DoModal=function(event){var chart=event.data.Chart;var rightMenu=chart.RightMenu;var x=event.offsetX;var y=event.offsetY;var dataList=[{text:"叠加品种",children:this.GetOverlay(chart)},{text:"多日分时图",children:this.GetDayCount(chart)},{text:'指标窗口个数',children:this.GetIndexWindowCount(chart)},{text:"副图指标切换",children:this.GetIndex(chart)},{text:"区间选择",children:this.GetSelectRect(chart)}];var symbol=chart.Symbol;if(MARKET_SUFFIX_NAME.IsSHSZStockA(symbol)){dataList.push({text:'集合竞价',children:this.GetShowBeforeData(chart)});}dataList.push({text:"工具",children:this.GetTools(chart)});var identify=event.data.FrameID;var overlayIndex=this.GetOverlayIndex(chart,identify);if(overlayIndex&&overlayIndex.length>0){var delOverlayIndexMenu={text:'删除叠加指标',children:this.GetDeleteOverlayIndex(chart,overlayIndex)};dataList.splice(3,0,delOverlayIndexMenu);}var identify=event.data.FrameID;JSConsole.Chart.Log('[MinuteRightMenu::DoModal]',identify);rightMenu.Show({windowIndex:identify,x:x+chart.UIElement.offsetLeft,y:y+chart.UIElement.offsetTop,position:chart.Frame.Position,data:dataList});(0,_jquery2.default)(document).click(function(){rightMenu.Hide();});};this.GetDayCount=function(chart){var data=[{text:"当日分时图",click:function click(){chart.ChangeDayCount(1);},isBorder:true},{text:"最近2日",click:function click(){chart.ChangeDayCount(2);}},{text:"最近3日",click:function click(){chart.ChangeDayCount(3);}},{text:"最近4日",click:function click(){chart.ChangeDayCount(4);}},{text:"最近5日",click:function click(){chart.ChangeDayCount(5);}},{text:"最近6日",click:function click(){chart.ChangeDayCount(6);}}];if(chart.DayCount-1>=0&&chart.DayCount-1<data.length)data[chart.DayCount-1].selected=true;return data;};this.GetIndex=function(chart){var data=[{text:"MACD",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'MACD');}},{text:"DMI",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'DMI');}},{text:"DMA",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'DMA');}},{text:"BRAR",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'BRAR');}},{text:"KDJ",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'KDJ');}},{text:"RSI",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'RSI');}},{text:"WR",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'WR');}},{text:"CCI",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'CCI');}},{text:"TRIX",click:function click(windowIndex){chart.ChangeIndex(windowIndex,'TRIX');}}];return data;};this.GetShowBeforeData=function(chart)//是否显示集合竞价
|
|
8848
|
-
{if(chart.IsShowBeforeData){var data=[{text:"隐藏",click:function click(){chart.ShowCallAuctionData({Left:false,MultiDay:{Left:false}});}}];return data;}else{var data=[{text:"显示",click:function click(){chart.ShowCallAuctionData({Left:true,MultiDay:{Left:true}});}}];return data;}};this.GetSelectRect=function(chart)//区间选择
|
|
8849
|
-
{if(chart.EnableSelectRect){var data=[{text:"禁用区间选择",click:function click(){chart.EnableSelectRect=false;}}];return data;}else{var data=[{text:"启动区间选择",click:function click(){chart.EnableSelectRect=true;}}];return data;}};//指标窗口个数
|
|
8850
|
-
this.GetIndexWindowCount=function(chart){var data=[{text:"1个窗口",click:function click(){chart.ChangeIndexWindowCount(2);}},{text:"2个窗口",click:function click(){chart.ChangeIndexWindowCount(3);}},{text:"3个窗口",click:function click(){chart.ChangeIndexWindowCount(4);}},{text:"4个窗口",click:function click(){chart.ChangeIndexWindowCount(5);}},{text:"5个窗口",click:function click(){chart.ChangeIndexWindowCount(6);}}];var count=chart.Frame.SubFrame.length-1;if(count-1>=0&&count-1<data.length)data[count-1].selected=true;//选中
|
|
8851
|
-
return data;};//工具
|
|
8852
|
-
this.GetTools=function(chart){var data=[];var drawTools=chart.GetExtendChartByClassName('DrawToolsButton');if(drawTools){data.push({text:"关闭画图工具",click:function click(){var toolsWidth=drawTools.Chart.Width;var toolsIndex=parseInt(drawTools.Index);chart.DeleteExtendChart(drawTools);chart.Frame.ChartBorder.Right-=toolsWidth;chart.SetSizeChange(true);chart.Draw();}});}else{data.push({text:"画图工具",click:function click(){var option={Name:'画图工具',Top:chart.Frame.ChartBorder.Top};var extendChart=chart.CreateExtendChart(option.Name,option);//创建扩展图形
|
|
8853
|
-
chart.SetSizeChange(true);chart.Draw();}});}return data;};}//画图工具 单个图形设置
|
|
8843
|
+
};}//画图工具 单个图形设置
|
|
8854
8844
|
function ChartPictureSettingMenu(divElement){this.newMethod=IDivDialog;//派生
|
|
8855
8845
|
this.newMethod(divElement);delete this.newMethod;this.HQChart;this.ChartPicture;this.SubToolsDiv;this.SettingMenu;this.SettingPV;this.DoModal=function(event){var $body;if(!this.SubToolsDiv){this.ID=Guid();var div=document.createElement("div");div.className='subTolls';div.id=this.ID;this.DivElement.appendChild(div);//$body = $("."+event.data.HQChart.ClassName).context.body;
|
|
8856
8846
|
//$body.append(div);
|
|
@@ -10946,21 +10936,21 @@ var symbol=readArgument.Value;//支持 SH60000, SZ000001
|
|
|
10946
10936
|
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
10937
|
{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
10938
|
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
|
|
10939
|
+
this.CallMemberScriptIndex=function(job){var _this45=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
10940
|
{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
10941
|
{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
10942
|
Period:indexInfo.PeriodID,//周期
|
|
10953
|
-
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){
|
|
10943
|
+
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this45.RecvMemberScriptIndexData(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,
|
|
10954
10944
|
IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:dateTimeRange//K线数据范围
|
|
10955
10945
|
};//执行脚本
|
|
10956
|
-
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){
|
|
10946
|
+
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_this45.ExecuteScriptIndexError(error,indexInfo);});};this.CallDynamicScriptIndex=function(job,varTable){var _this46=this;var callInfo=job.DynamicName;var indexInfo={Job:job,PeriodID:this.Period,Symbol:this.Symbol};if(!this.ReadIndexFunctionValue(callInfo,indexInfo))//读取指标
|
|
10957
10947
|
{var token=job.Token;this.Execute.ErrorHandler.ThrowError(token.Index,token.Line,0,'CallDynamicScriptIndex() Error: \''+callInfo+'\' '+indexInfo.Error);}var systemIndex=new JSIndexScript();//系统指标
|
|
10958
10948
|
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
10949
|
Period:indexInfo.PeriodID,//周期
|
|
10960
|
-
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){
|
|
10950
|
+
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this46.RecvDynamicScriptIndexData(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,
|
|
10961
10951
|
IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:dateTimeRange//K线数据范围
|
|
10962
10952
|
};//执行脚本
|
|
10963
|
-
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){
|
|
10953
|
+
var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_this46.ExecuteScriptIndexError(error,indexInfo);});};this.ReadDynamicIndexArgumentValue=function(args,result,varTable){result.Args=[];for(var i=0;i<result.SytemIndex.Args.length;++i)//复制参数
|
|
10964
10954
|
{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
10955
|
{if(varTable.has(item.Name)){argItem.Value=varTable.get(item.Name);argItem.IsDefault=false;}}}return true;};/*****************************************************************************************************************************
|
|
10966
10956
|
脚本调用
|
|
@@ -10977,16 +10967,16 @@ var run=JSComplier.Execute(systemItem.Script,option,function(error,indexInfo){_t
|
|
|
10977
10967
|
|
|
10978
10968
|
"MA.MA1"(6,12,18)
|
|
10979
10969
|
|
|
10980
|
-
*******************************************************************************************************************************/this.CallScriptIndex=function(job,varTable){var
|
|
10970
|
+
*******************************************************************************************************************************/this.CallScriptIndex=function(job,varTable){var _this47=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
10971
|
{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
10972
|
{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
10973
|
{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
10974
|
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
10975
|
Period:indexInfo.PeriodID,//周期
|
|
10986
|
-
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){
|
|
10976
|
+
Data:null,SourceData:null,Callback:function Callback(outVar,job,symbolData){_this47.RecvScriptIndexData(outVar,job,symbolData);_this47.Execute.RunNextJob();},CallbackParam:indexInfo,Async:true,MaxRequestDataCount:this.MaxRequestDataCount+30*2,MaxRequestMinuteDayCount:this.MaxRequestMinuteDayCount+2,Arguments:indexInfo.Args,//Condition:this.Condition,
|
|
10987
10977
|
IsBeforeData:this.IsBeforeData,NetworkFilter:this.NetworkFilter,IsApiPeriod:this.IsApiPeriod,KLineRange:DateTimeRange//K线数据范围
|
|
10988
10978
|
};//执行脚本
|
|
10989
|
-
var run=JSComplier.Execute(indexInfo.SytemIndex.Script,option,function(error,indexInfo){
|
|
10979
|
+
var run=JSComplier.Execute(indexInfo.SytemIndex.Script,option,function(error,indexInfo){_this47.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
10980
|
for(var i in data){var key=outVar[i].Name;if(indexInfo.Period)key+='#'+indexInfo.Period;//带周期的变量
|
|
10991
10981
|
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
10982
|
for(var i=0;i<data.length;++i){var key=outVar[i].Name+'#'+strArgs;if(indexInfo.Period)key+='#'+indexInfo.Period;//带周期的变量
|
|
@@ -11154,7 +11144,7 @@ GetMarginJobID:function GetMarginJobID(value){var dataMap=new _map2.default([[1,
|
|
|
11154
11144
|
[9,JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_NEWS_ANALYSIS_TOPMANAGERS],//NEWS(9) 高管要闻
|
|
11155
11145
|
[10,JS_EXECUTE_JOB_ID.JOB_DOWNLOAD_NEWS_ANALYSIS_PLEDGE]]);if(dataMap.has(value))return dataMap.get(value);return null;},//财务截面数据 分报告期
|
|
11156
11146
|
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
|
|
11147
|
+
GetSectionReportPeriod:function GetSectionReportPeriod(year,quarter){if(year>=2000&&quarter>=1&&quarter<=4)return{Year:year,Quarter:quarter};return null;}};function JSExecute(ast,option){var _this48=this;this.AST=ast;//语法树
|
|
11158
11148
|
this.ErrorHandler=new ErrorHandler();this.VarTable=new _map2.default();//变量表
|
|
11159
11149
|
this.VarDrawTable=new _map2.default();//绘图变量表
|
|
11160
11150
|
this.OutVarTable=[];//输出变量
|
|
@@ -11200,7 +11190,7 @@ this.ConstVarTable=new _map2.default([//个股数据
|
|
|
11200
11190
|
['DRAWNULL',null],["NULL",null],["MACHINEDATE",null],["MACHINETIME",null],["MACHINEWEEK",null],["TR",null],//真实波幅
|
|
11201
11191
|
["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
11192
|
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
|
|
11193
|
+
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 _this48.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
11194
|
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
11195
|
JSConsole.Complier.Log('[JSExecute::Execute] Load Arguments',this.Arguments);for(var _i125 in this.Arguments)//预定义的变量
|
|
11206
11196
|
{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 +11256,8 @@ else if(value.indexOf("FONTSIZE")==0){var strFontSize=value.replace("FONTSIZE","
|
|
|
11266
11256
|
{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
11257
|
{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
11258
|
{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
|
|
11259
|
+
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 _this49=this;if(debugCtrl.ExeLine<debugCtrl.LineCount){var item=this.AST.Body[debugCtrl.ExeLine];this.RunASTNode(item);++debugCtrl.ExeLine;this.DebugFilter(debugCtrl,function(){_this49.DebugRun_Next(debugCtrl);});}else{this.DebugRun_End();debugCtrl.Status=2;this.DebugFilter(debugCtrl,null);}};//debug模式
|
|
11260
|
+
this.DebugRun=function(){var _this50=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(){_this50.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
11261
|
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
11262
|
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
11263
|
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 +12056,15 @@ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FILTER_DEAL_DATA);if(!event|
|
|
|
12066
12056
|
event.Callback(event,sendData,this);return sendData.Result;};this.EnableFilter=function(bEnable,option)//启动|关闭筛选
|
|
12067
12057
|
{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
12058
|
//windowCount 窗口个数
|
|
12069
|
-
this.Create=function(option){var
|
|
12059
|
+
this.Create=function(option){var _this51=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
12070
12060
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);//创建框架
|
|
12071
12061
|
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
|
|
12062
|
+
var chart=new ChartDealList();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this51.GetEventCallback(id);};this.ChartPaint[0]=chart;if(option){if(IFrameSplitOperator.IsBool(option.IsSingleTable))chart.IsSingleTable=option.IsSingleTable;//单表模式
|
|
12073
12063
|
if(IFrameSplitOperator.IsBool(option.IsShowHeader))chart.IsShowHeader=option.IsShowHeader;//是否显示表头
|
|
12074
12064
|
if(IFrameSplitOperator.IsBool(option.IsShowLastPage))this.IsShowLastPage=option.IsShowLastPage;//是否显示最后一页
|
|
12075
12065
|
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){
|
|
12066
|
+
}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){_this51.OnKeyDown(e);},true);//键盘消息
|
|
12067
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this51.OnWheel(e);},true);//上下滚动消息
|
|
12078
12068
|
};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
12069
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12080
12070
|
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 +12226,26 @@ this.DragPageCycle=true;//手机翻页循环
|
|
|
12236
12226
|
this.DragXScroll=null;//{Start:{x,y}, End:{x, y}}
|
|
12237
12227
|
this.DragYScroll=null;this.IsShowVScrollbar=false;this.IsDestroy=false;//是否已经销毁了
|
|
12238
12228
|
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
|
|
12229
|
+
{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 _this52=this;this.AutoDragScrollTimer=setTimeout(function(){_this52.ChartOperator_Temp_ScrollPage(step);},300);};this.ChartOperator_Temp_ScrollPage=function(moveSetp){if(!this.EnablePageScroll)return;var reportChart=this.GetReportChart();if(!reportChart)return;if(moveSetp>0){var pageStatus=reportChart.GetCurrentPageStatus();if(pageStatus.IsEnd)return;this.MoveYOffset(moveSetp,false);++moveSetp;}else if(moveSetp<0){if(this.Data.YOffset<=0)return;this.MoveYOffset(moveSetp,false);--moveSetp;}else{return;}this.Draw();if(!this.EnablePageScroll)return;this.AutoScrollPage(moveSetp);return;};//清空固定行数据
|
|
12240
12230
|
this.ClearFixedRowData=function(){this.FixedRowData.Data=[];this.FixedRowData.Symbol=[];};//设置固定行
|
|
12241
12231
|
this.SetFixedRowCount=function(value){var chart=this.GetReportChart();if(!chart)return;chart.FixedRowCount=value;};//创建
|
|
12242
|
-
this.Create=function(option){var
|
|
12232
|
+
this.Create=function(option){var _this53=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
12243
12233
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
|
|
12244
12234
|
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
|
|
12235
|
+
var chart=new ChartReport();chart.Frame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.UIElement=this.UIElement;chart.GetEventCallback=function(id){return _this53.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this53.GetStockData(symbol);};chart.GetBlockDataCallback=function(symbol){return _this53.GetBlockData(symbol);};chart.GetFlashBGDataCallback=function(symbol,time){return _this53.GetFlashBGData(symbol,time);};chart.Data=this.Data;chart.GlobalOption=this.GlobalOption;chart.FixedRowData=this.FixedRowData;chart.SortInfo=this.SortInfo;chart.Tab=new ChartReportTab();chart.Tab.Frame=this.Frame;chart.Tab.Canvas=this.Canvas;chart.Tab.ChartBorder=this.Frame.ChartBorder;chart.Tab.Report=chart;chart.VScrollbar=new ChartVScrollbar();chart.VScrollbar.Frame=this.Frame;chart.VScrollbar.Canvas=this.Canvas;chart.VScrollbar.ChartBorder=this.Frame.ChartBorder;chart.VScrollbar.Report=chart;chart.VScrollbar.IsShowCallback=function(){if(_this53.DragYScroll)return true;return _this53.IsShowVScrollbar;};this.ChartPaint[0]=chart;//页脚
|
|
12246
12236
|
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
12237
|
if(IFrameSplitOperator.IsNumber(option.FixedColumn))chart.FixedColumn=option.FixedColumn;//固定列
|
|
12248
12238
|
if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
|
|
12249
12239
|
if(IFrameSplitOperator.IsBool(option.TabShow))chart.Tab.IsShow=option.TabShow;if(IFrameSplitOperator.IsNumber(option.FixedRowCount))chart.FixedRowCount=option.FixedRowCount;//固定行
|
|
12250
12240
|
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){
|
|
12241
|
+
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){_this53.OnKeyDown(e);},true);//键盘消息
|
|
12242
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this53.OnWheel(e);},true);//上下滚动消息
|
|
12243
|
+
this.UIElement.ondblclick=function(e){_this53.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this53.UIOnMouseDown(e);};this.UIElement.onmouseup=function(e){_this53.UIOnMounseUp(e);};this.UIElement.oncontextmenu=function(e){_this53.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this53.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this53.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this53.UIOnMouseleave(e);};//手机拖拽
|
|
12244
|
+
this.UIElement.ontouchstart=function(e){_this53.OnTouchStart(e);};this.UIElement.ontouchmove=function(e){_this53.OnTouchMove(e);};this.UIElement.ontouchend=function(e){_this53.OnTouchEnd(e);};};this.Draw=function(){if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
12255
12245
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12256
12246
|
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
|
|
12247
|
+
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 _this54=this;if(typeof this.FlashBGTimer=='number'){clearTimeout(this.FlashBGTimer);this.FlashBGTimer=null;}this.FlashBGTimer=setTimeout(function(){_this54.Draw();},frequency);};this.ResetReportStatus=function(){this.Data.XOffset=0;this.Data.YOffset=0;};this.ResetReportSelectStatus=function(){var chart=this.GetReportChart();if(chart){chart.SelectedRow=-1;chart.SelectedFixedRow=-1;}};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;};//设置股票列表
|
|
12248
|
+
this.SetSymbolList=function(arySymbol,option){this.ClearData();this.ResetReportStatus();this.ResetSortStatus();if(IFrameSplitOperator.IsNonEmptyArray(arySymbol)){for(var i=0;i<arySymbol.length;++i){this.Data.Data.push(arySymbol[i]);}}var chart=this.ChartPaint[0];if(chart)chart.Data=this.Data;this.Draw();};this.ChangeSymbol=function(symbol,option){var _this55=this;this.Symbol=symbol;this.ClearData();this.ResetReportStatus();this.ResetSortStatus();this.ResetReportSelectStatus();if(option){if(IFrameSplitOperator.IsNumber(option.TabSelected)){var chartTab=this.GetTabChart();if(chartTab)chartTab.SelectedTabIndex=option.TabSelected;}if(Array.isArray(option.FixedSymbol)){var chart=this.GetReportChart();if(chart){chart.FixedRowCount=0;this.FixedRowData.Type=1;this.FixedRowData.Symbol=[];var aryData=option.FixedSymbol;for(var i=0;i<aryData.length;++i){var item=aryData[i];this.FixedRowData.Symbol.push(item.Symbol);++chart.FixedRowCount;}this.SetSizeChange(true);}}if(option.SortInfo){var item=option.SortInfo;if(IFrameSplitOperator.IsNumber(item.Field))this.SortInfo.Field=item.Field;if(IFrameSplitOperator.IsNumber(item.Sort))this.SortInfo.Sort=item.Sort;}if(IFrameSplitOperator.IsBool(option.IsReloadStockList)){var requestOption={Callback:null};if(this.Symbol)requestOption.Callback=function(){_this55.RequestMemberListData();};this.MapStockData=new _map2.default();this.RequestStockListData(requestOption);return;}}this.RequestMemberListData();};this.RequestMemberListData=function(){//this.ChartSplashPaint.SetTitle(this.SplashTitle.MemberList);
|
|
12259
12249
|
//this.ChartSplashPaint.EnableSplash(true);
|
|
12260
12250
|
//this.Draw();
|
|
12261
12251
|
var self=this;if(this.NetworkFilter){var obj={Name:'JSReportChartContainer::RequestMemberListData',//类名::
|
|
@@ -12273,7 +12263,7 @@ this.GetStockData=function(symbol){if(!this.MapStockData)return null;if(!this.Ma
|
|
|
12273
12263
|
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
12264
|
{this.FlashBG.delete(symbol);return null;}if(!stockItem.Data||stockItem.Data.size<=0){this.FlashBG.delete(symbol);return null;}var aryDelID=[];//超时需要参数的
|
|
12275
12265
|
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
|
|
12266
|
+
this.DelayUpdateStockData=function(){var _this56=this;if(this.DelayUpdateTimer!=null){clearTimeout(this.DelayUpdateTimer);this.DelayUpdateTimer=null;}var frequency=this.DelayUpdateFrequency;this.DelayUpdateTimer=setTimeout(function(){_this56.UpdateStockData();},frequency);};this.UpdateStockData=function(){if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;var chart=this.ChartPaint[0];if(!chart)return;if(this.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
12267
|
return;}}var arySymbol=chart.ShowSymbol;if(!IFrameSplitOperator.IsNonEmptyArray(arySymbol))return;this.RequestStockData(arySymbol);};//下载股票数据
|
|
12278
12268
|
this.RequestStockData=function(arySymbol){var self=this;if(this.NetworkFilter){var obj={Name:'JSDealChartContainer::RequestStockData',//类名::函数名
|
|
12279
12269
|
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 +12319,7 @@ var result=this.MoveSelectedRow(-1);if(result){if(result.Redraw)this.Draw();if(r
|
|
|
12329
12319
|
var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}break;case 37://left
|
|
12330
12320
|
if(this.MoveXOffset(-1))this.Draw();break;case 39://right
|
|
12331
12321
|
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
|
|
12322
|
+
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 _this57=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
12323
|
//LastMove:{ X:e.clientX, Y:e.clientY},
|
|
12334
12324
|
ClickData:dragColumnWidth,ColumnWidth:dragColumnWidth.Column.Width};}else{var clickData=chart.OnMouseDown(x,y,e);if(!clickData)return;//if (e.button!=0) return;
|
|
12335
12325
|
if((clickData.Type==2||clickData.Type==4)&&(e.button==0||e.button==2))//点击行|固定行
|
|
@@ -12345,7 +12335,7 @@ if((clickData.Type==2||clickData.Type==4)&&(e.button==0||e.button==2))//点击
|
|
|
12345
12335
|
{if(this.MoveYOffset(-1)){this.Draw();this.DelayUpdateStockData();}}else if(scroll.Type==2)//底部按钮
|
|
12346
12336
|
{if(this.MoveYOffset(1)){this.Draw();this.DelayUpdateStockData();}}else if(scroll.Type==3)//滚动条
|
|
12347
12337
|
{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){
|
|
12338
|
+
{if(this.SetYOffset(scroll.Pos)){this.Draw();this.DelayUpdateStockData();}}}}}document.onmousemove=function(e){_this57.DocOnMouseMove(e);};document.onmouseup=function(e){_this57.DocOnMouseUp(e);};};this.UIOnMounseUp=function(e){console.log('"UIOnMounseUp');};//去掉右键菜单
|
|
12349
12339
|
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
12340
|
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
12341
|
}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 +12374,8 @@ if(chart.SelectedModel==0)//不可翻页模式, 只能在当前页移动
|
|
|
12384
12374
|
{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
12375
|
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
12376
|
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
|
|
12377
|
+
this.OnClickHeader=function(clickData,e){var _this58=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)//本地排序
|
|
12378
|
+
{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 _this58.LocalSort(left,right,header.Column,sortInfo.Sort);});}}else if(header.Column.Sort==2)//远程排序
|
|
12389
12379
|
{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
12380
|
return;}}this.Data.YOffset=0;this.ResetReportSelectStatus();this.SortInfo.Field=sortInfo.Field;this.SortInfo.Sort=sortInfo.Sort;this.Draw();this.DelayUpdateStockData();}}};//点击标签
|
|
12391
12381
|
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 +12657,16 @@ this.DragXScroll=null;//{Start:{x,y}, End:{x, y}}
|
|
|
12667
12657
|
this.IsDestroy=false;//是否已经销毁了
|
|
12668
12658
|
this.ChartDestory=function()//销毁
|
|
12669
12659
|
{this.IsDestroy=true;this.StopAutoUpdate();};//创建
|
|
12670
|
-
this.Create=function(option){var
|
|
12660
|
+
this.Create=function(option){var _this59=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
12671
12661
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
|
|
12672
12662
|
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
|
|
12663
|
+
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 _this59.GetEventCallback(id);};chart.GetExePriceDataCallback=function(exePrice){return _this59.GetExePriceData(exePrice);};chart.GetFlashBGDataCallback=function(symbol,time){return _this59.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
12664
|
if(IFrameSplitOperator.IsNumber(option.FixedColumn))chart.FixedColumn=option.FixedColumn;//固定列
|
|
12675
12665
|
if(IFrameSplitOperator.IsNumber(option.BorderLine))this.Frame.BorderLine=option.BorderLine;//边框
|
|
12676
12666
|
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){
|
|
12667
|
+
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){_this59.OnKeyDown(e);},true);//键盘消息
|
|
12668
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this59.OnWheel(e);},true);//上下滚动消息
|
|
12669
|
+
this.UIElement.ondblclick=function(e){_this59.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this59.UIOnMouseDown(e);};/*
|
|
12680
12670
|
this.UIElement.onmouseup=(e)=>{ this.UIOnMounseUp(e); }
|
|
12681
12671
|
this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
|
|
12682
12672
|
this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
|
|
@@ -12691,7 +12681,7 @@ this.UIElement.ondblclick=function(e){_this56.UIOnDblClick(e);};this.UIElement.o
|
|
|
12691
12681
|
*/};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
12682
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12693
12683
|
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
|
|
12684
|
+
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 _this60=this;if(typeof this.FlashBGTimer=='number'){clearTimeout(this.FlashBGTimer);this.FlashBGTimer=null;}this.FlashBGTimer=setTimeout(function(){_this60.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
12685
|
//{event:事件id, callback:回调函数}
|
|
12696
12686
|
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
12687
|
{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 +12691,10 @@ Explain:'T型报价列表数据',Self:this,PreventDefault:false};this.NetworkFil
|
|
|
12701
12691
|
}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
12692
|
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
12693
|
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
|
|
12694
|
+
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 _this61=this;var setUpdateSymbol=new _set2.default();//更新的股票列表
|
|
12705
12695
|
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
12696
|
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
|
|
12697
|
+
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 _this61.LocalSort(left,right,column,_this61.SortInfo.Sort,_this61.SortInfo.CellType);});}}this.CalculateData();this.Draw();};//计算统计数据
|
|
12708
12698
|
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
12699
|
this.ReadStockJsonData=function(stock,item){//0=证券代码 1=股票名称 2=昨收 3=开 4=高 5=低 6=收 7=成交量 8=成交金额, 9=买价 10=买量 11=卖价 12=卖量 13=均价 14=持仓 16=涨停价 17=跌停价
|
|
12710
12700
|
//21=涨幅% 22=涨跌 24=振幅%
|
|
@@ -12729,14 +12719,14 @@ if(item[33])stock.KLine=item[33];//33=K线
|
|
|
12729
12719
|
var frequency=this.AutoUpdateFrequency;if(marketStatus==1)//盘前
|
|
12730
12720
|
{this.AutoUpdateTimer=setTimeout(function(){self.AutoUpdate();},frequency);}else if(marketStatus==2)//盘中
|
|
12731
12721
|
{this.AutoUpdateTimer=setTimeout(function(){self.UpdateStockData();},frequency);}};//delay=是否延迟
|
|
12732
|
-
this.DelayUpdateStockData=function(){var
|
|
12722
|
+
this.DelayUpdateStockData=function(){var _this62=this;if(this.DelayUpdateTimer!=null){clearTimeout(this.DelayUpdateTimer);this.DelayUpdateTimer=null;}var frequency=this.DelayUpdateFrequency;this.DelayUpdateTimer=setTimeout(function(){_this62.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
12723
|
{if(clickData.Redraw==true)this.Draw();}else if(clickData.Type==3&&e.button==0)//表头
|
|
12734
12724
|
{this.OnClickHeader(clickData,e);}//document.onmousemove=(e)=>{ this.DocOnMouseMove(e); }
|
|
12735
12725
|
//document.onmouseup=(e)=> { this.DocOnMouseUp(e); }
|
|
12736
12726
|
};//点表头
|
|
12737
12727
|
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
|
|
12728
|
+
this.SortHeader=function(column,sortData){var _this63=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)//还原
|
|
12729
|
+
{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 _this63.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
12730
|
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
12731
|
case TREPORT_COLUMN_ID.POSITION_ID://持仓量
|
|
12742
12732
|
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 +12906,11 @@ this.MapSymbol.clear();this.Data.Data=[];this.Data.XOffset=0;this.Data.YOffset=0
|
|
|
12916
12906
|
}
|
|
12917
12907
|
this.ChartPaint[0].SelectedRow=0;
|
|
12918
12908
|
*/};//创建
|
|
12919
|
-
this.Create=function(option){var
|
|
12909
|
+
this.Create=function(option){var _this64=this;this.UIElement.JSChartContainer=this;//创建框架
|
|
12920
12910
|
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){
|
|
12911
|
+
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 _this64.GetEventCallback(id);};chart.GetStockDataCallback=function(symbol){return _this64.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){_this64.OnKeyDown(e);},true);//键盘消息
|
|
12912
|
+
if(bRegisterWheel)this.UIElement.addEventListener("wheel",function(e){_this64.OnWheel(e);},true);//上下滚动消息
|
|
12913
|
+
this.UIElement.ondblclick=function(e){_this64.UIOnDblClick(e);};this.UIElement.onmousedown=function(e){_this64.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this64.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this64.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this64.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this64.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
12914
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
12925
12915
|
this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
12926
12916
|
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 +12927,9 @@ var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();}brea
|
|
|
12937
12927
|
if(this.MoveXOffset(-1))this.Draw();break;case 39://right
|
|
12938
12928
|
if(this.MoveXOffset(1))this.Draw();break;case 13://Enter
|
|
12939
12929
|
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
|
|
12930
|
+
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 _this65=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
12931
|
if(clickData.Type==2&&(e.button==0||e.button==2))//点击行
|
|
12942
|
-
{if(clickData.Redraw==true)this.Draw();}}document.onmousemove=function(e){
|
|
12932
|
+
{if(clickData.Redraw==true)this.Draw();}}document.onmousemove=function(e){_this65.DocOnMouseMove(e);};document.onmouseup=function(e){_this65.DocOnMouseUp(e);};};//去掉右键菜单
|
|
12943
12933
|
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
12934
|
// this.StopAutoDragScrollTimer();
|
|
12945
12935
|
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 +13042,12 @@ this.HQChart=null;this.ChartDestory=function()//销毁
|
|
|
13052
13042
|
//{event:事件id, callback:回调函数}
|
|
13053
13043
|
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
13044
|
{if(!this.mapEvent.has(id))return null;var item=this.mapEvent.get(id);return item;};//创建
|
|
13055
|
-
this.Create=function(option){var
|
|
13045
|
+
this.Create=function(option){var _this66=this;this.UIElement.JSChartContainer=this;//创建等待提示
|
|
13056
13046
|
this.ChartSplashPaint=new ChartSplashPaint();this.ChartSplashPaint.Canvas=this.Canvas;this.ChartSplashPaint.SetTitle(this.LoadDataSplashTitle);this.ChartSplashPaint.IsEnableSplash=true;//创建框架
|
|
13057
13047
|
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){
|
|
13048
|
+
var chart=new ScrollBarBGChart();chart.ChartFrame=this.Frame;chart.ChartBorder=this.Frame.ChartBorder;chart.Canvas=this.Canvas;chart.GetEventCallback=function(id){return _this66.GetEventCallback(id);};this.ChartPaint.push(chart);//创建滑块
|
|
13049
|
+
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 _this66.GetEventCallback(id);};this.SliderChart=chart;this.ChartPaint.push(chart);//this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
|
|
13050
|
+
this.UIElement.onmousedown=function(e){_this66.UIOnMouseDown(e);};this.UIElement.oncontextmenu=function(e){_this66.UIOnContextMenu(e);};this.UIElement.onmousemove=function(e){_this66.UIOnMouseMove(e);};this.UIElement.onmouseout=function(e){_this66.UIOnMounseOut(e);};this.UIElement.onmouseleave=function(e){_this66.UIOnMouseleave(e);};//手机拖拽
|
|
13061
13051
|
//this.UIElement.ontouchstart=(e)=> { this.OnTouchStart(e); }
|
|
13062
13052
|
//this.UIElement.ontouchmove=(e)=> {this.OnTouchMove(e); }
|
|
13063
13053
|
//this.UIElement.ontouchend=(e)=> {this.OnTouchEnd(e); }
|
|
@@ -13065,13 +13055,13 @@ this.UIElement.onmousedown=function(e){_this63.UIOnMouseDown(e);};this.UIElement
|
|
|
13065
13055
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
13066
13056
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
13067
13057
|
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){
|
|
13058
|
+
this.UIOnDblClick=function(e){};this.CancelDragTimer=function(){if(this.DragTimer){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.UIOnMouseDown=function(e){var _this67=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;//重绘次数
|
|
13059
|
+
}document.onmousemove=function(e){_this67.DocOnMouseMove(e);};document.onmouseup=function(e){_this67.DocOnMouseUp(e);};};//去掉右键菜单
|
|
13070
13060
|
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
|
|
13061
|
+
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 _this68=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
13062
|
{if(xStart<left)//第1页
|
|
13073
13063
|
{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(){
|
|
13064
|
+
{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(){_this68.DragUpdate(_this68.DragSlider);},this.DelayDragFrequency);}}};this.DocOnMouseUp=function(e){//清空事件
|
|
13075
13065
|
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
13066
|
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
13067
|
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 +13114,61 @@ this.AreaColor=g_JSChartResource.ScrollBar.BGChart.AreaColor;//面积图颜色
|
|
|
13124
13114
|
this.ReloadResource=function(resource){this.Color=g_JSChartResource.ScrollBar.BGChart.Color;//线段颜色
|
|
13125
13115
|
this.LineWidth=g_JSChartResource.ScrollBar.BGChart.LineWidth;//线段宽度
|
|
13126
13116
|
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;};}
|
|
13117
|
+
};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;};}/*
|
|
13118
|
+
Copyright (c) 2018 jones
|
|
13119
|
+
|
|
13120
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
13121
|
+
|
|
13122
|
+
开源项目 https://github.com/jones2000/HQChart
|
|
13123
|
+
|
|
13124
|
+
jones_2000@163.com
|
|
13125
|
+
|
|
13126
|
+
内置菜单 使用table模式
|
|
13127
|
+
*/function JSPopMenu(){this.Data={Menu:[],Position:0};//{ Name:, SVG, ID, bChecked:, SubMenu:[] } Position 0=右键菜单 1=Tab弹菜单 2=下拉菜单
|
|
13128
|
+
this.RootDOM=null;this.TBodyDOM=null;this.ArySubRootDOM=[];this.ClickCallback=null;//点击回调
|
|
13129
|
+
this.CheckedClassName="UMyChart_MenuItem_Span_Checked iconfont icon-checked";//选中图标
|
|
13130
|
+
this.RightArrowClassName="UMyChart_MenuItem_Span_Arrow iconfont icon-menu_arraw_right";//右侧箭头
|
|
13131
|
+
this.SelectedClassName="UMyChart_MenuItem_Tr_Selected";this.AryTDClassName=["UMyChart_MenuItem_Td_Status",//图标
|
|
13132
|
+
"UMyChart_MenuItem_Td_Content",//文字
|
|
13133
|
+
"UMyChart_MenuItem_Td_Shortcut",//快捷方式
|
|
13134
|
+
"UMyChart_MenuItem_Td_Arrow"//箭头
|
|
13135
|
+
];this.Inital=function(){var _this69=this;window.addEventListener('mousedown',function(e){_this69.OnWindowMouseDown(e);});};//创建菜单
|
|
13136
|
+
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;};//清除菜单
|
|
13137
|
+
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 _this70=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)//图标
|
|
13138
|
+
{if(item.Checked){var spanDom=document.createElement("span");spanDom.className=this.CheckedClassName;spanDom.style["font-size"]="10px";tdDom.appendChild(spanDom);}}else if(i==1)//内容
|
|
13139
|
+
{tdDom.innerText=item.Name;}else if(i==2)//快捷方式
|
|
13140
|
+
{}else if(i==3)//箭头
|
|
13141
|
+
{if(IFrameSplitOperator.IsNonEmptyArray(item.SubMenu)){var spanDom=document.createElement("span");spanDom.className=this.RightArrowClassName;spanDom.style["font-size"]="10px";tdDom.appendChild(spanDom);}}trDom.appendChild(tdDom);}if(IFrameSplitOperator.IsNonEmptyArray(item.SubMenu))//子菜单
|
|
13142
|
+
{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){var trSeparator=document.createElement("tr");trSeparator.className='UMyChart_MenuItem_Tr_Separator';var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Status_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);var tdDom=document.createElement("td");tdDom.className="UMyChart_MenuItem_Td_Separator";trSeparator.appendChild(tdDom);subTbody.appendChild(trSeparator);continue;}var subTrDom=this.CreateMenu(subRootData,subItem);preTrDom=subTrDom;subTbody.appendChild(subTrDom);}trDom.onmouseover=function(e){_this70.OnMouseOver(e,parentItem,trDom,subRoot);};document.body.appendChild(subRoot);this.ArySubRootDOM.push(subRoot);}else{trDom.onmousedown=function(e){_this70.OnClickMenu(e,item,false);};//菜单点击
|
|
13143
|
+
trDom.onmouseover=function(e){_this70.OnMouseOver(e,parentItem);};}return trDom;};//弹tab菜单
|
|
13144
|
+
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";};//弹右键菜单
|
|
13145
|
+
this.PopupMenuByRight=function(x,y){if(!this.RootDOM)return;if(!IFrameSplitOperator.IsNumber(x)||!IFrameSplitOperator.IsNumber(y))return;//菜单在当前屏幕无法显示需要调整
|
|
13146
|
+
var menuHeight=this.RootDOM.offsetHeight;var yMenuBottom=y+menuHeight;var yBottom=window.innerHeight-15;if(yMenuBottom>yBottom)y=yBottom-menuHeight;var menuWidth=this.RootDOM.offsetWidth;var yMenuRight=x+menuWidth;var yRight=window.innerWidth-15;if(yMenuRight>yRight)x=yRight-menuWidth;this.RootDOM.style.visibility='visible';this.RootDOM.style.top=y+"px";this.RootDOM.style.left=x+"px";};this.OnClickMenu=function(e,item,bSubMenu){console.log("[JSPopMenu::OnClickMenu] e=, item=, bSubMenu",e,item,bSubMenu);if(!this.ClickCallback)return;this.ClickCallback(item);};this.OnMouseOver=function(e,parentItem,trDom,subMenu){if(parentItem&&parentItem.PopMenu&&parentItem.PopMenu!=subMenu){parentItem.PopMenu.style.visibility="hidden";if(parentItem.PopRow)parentItem.PopRow.classList.remove(this.SelectedClassName);parentItem.PopMenu=null;parentItem.PopRow=null;}if(subMenu){if(subMenu.style.visibility=="visible"){}else{var rtParent=trDom.getBoundingClientRect();var x=rtParent.right,y=rtParent.top;//菜单在当前屏幕无法显示需要调整
|
|
13147
|
+
var yBottom=window.innerHeight-15;var yRight=window.innerWidth-15;var menuHeight=subMenu.offsetHeight;var menuWidth=subMenu.offsetWidth;var yMenuBottom=y+menuHeight;var yMenuRight=x+menuWidth;if(yMenuBottom>yBottom)y=yBottom-menuHeight;if(yMenuRight>yRight)x=rtParent.left-menuWidth;subMenu.style.left=x+'px';subMenu.style.top=y+'px';trDom.classList.add(this.SelectedClassName);/*
|
|
13148
|
+
if (this.Data.Position==JSPopMenu.POSITION_ID.TAB_MENU_ID)
|
|
13149
|
+
{
|
|
13150
|
+
var yButton=parentItem.Root.getBoundingClientRect().bottom;
|
|
13151
|
+
var ySubButton=subMenu.getBoundingClientRect().bottom;
|
|
13152
|
+
if (yButton<ySubButton)
|
|
13153
|
+
{
|
|
13154
|
+
var yOffset=yButton-ySubButton;
|
|
13155
|
+
subMenu.style.top=`${yOffset}px`;
|
|
13156
|
+
}
|
|
13157
|
+
}
|
|
13158
|
+
*/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";//分割线
|
|
13159
|
+
///////////////////////////////////////////////////////////////////////////////////
|
|
13128
13160
|
// 工作线程计算指标示例
|
|
13129
13161
|
//
|
|
13130
13162
|
//
|
|
13131
13163
|
//////////////////////////////////////////////////////////////////////////////////
|
|
13132
13164
|
function HQChartScriptWorker(){this.Status=0;//0=空闲 1=运行
|
|
13133
|
-
this.Create=function(){var
|
|
13134
|
-
};this.ExecuteScript=function(indexData,message){var
|
|
13165
|
+
this.Create=function(){var _this71=this;addEventListener('message',function(obj){_this71.OnRecvMessage(obj);});};this.NetworkFilter=function(data,callback,indexInfo){JSConsole.Complier.Log('[HQChartScriptWorker::NetworkFilter] ['+data.Name+']['+data.Explain+'] data=',data);//数据下载
|
|
13166
|
+
};this.ExecuteScript=function(indexData,message){var _this72=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){_this72.OnExecuteError(error,indexInfo,message);};scriptObj.FinishCallback=function(data,jsExectute){_this72.OnExecuteFinish(data,indexInfo,jsExectute,message);};scriptObj.NetworkFilter=function(data,callback){_this72.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
13167
|
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
13168
|
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
13169
|
* 版本信息输出
|
|
13138
13170
|
*
|
|
13139
|
-
*/var HQCHART_VERSION="1.1.
|
|
13171
|
+
*/var HQCHART_VERSION="1.1.13190";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
13172
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
13141
13173
|
// BaseIndex:BaseIndex,
|
|
13142
13174
|
// ChartLine:ChartLine,
|
|
@@ -13163,4 +13195,4 @@ GetDevicePixelRatio:GetDevicePixelRatio},(0,_defineProperty3.default)(_jsChartIn
|
|
|
13163
13195
|
HQMinuteTimeStringFormat:HQMinuteTimeStringFormat,//分时图X轴 十字光标输出格式化
|
|
13164
13196
|
HQDateStringFormat:HQDateStringFormat,//K线图X轴 十字光标输出格式化
|
|
13165
13197
|
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);
|
|
13198
|
+
}),(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,JSCHART_MENU_ID:JSCHART_MENU_ID}),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'HQChartScriptWorker',HQChartScriptWorker),(0,_defineProperty3.default)(_jsChartInit$jsChartS,'JSPopMenu',JSPopMenu),_jsChartInit$jsChartS);
|