hqchart 1.1.13350 → 1.1.13358

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.
@@ -2811,7 +2811,7 @@ if(x>=left&&x<=right&&y>bottom&&y<chartHeight)return-3;return-1;};this.PtInChart
2811
2811
  }}return-1;};this.PtInButtons=function(x,y){for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];if(item.Height<=0)continue;var button=item.Frame.PtInButtons(x,y);if(button){button.Frame=item.Frame;button.FrameID=i;return button;}for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];var overlayFrame=overlayItem.Frame;if(!overlayFrame||!overlayFrame.PtInButtons)continue;var button=overlayFrame.PtInButtons(x,y);if(button){button.IndexID=overlayItem.Identify;button.FrameID=i;button.OverlayFrame=overlayFrame;button.Frame=item.Frame;return button;}}}return null;};//是否在X轴坐标上
2812
2812
  this.PtInFrameBottom=function(x,y){var left=this.ChartBorder.GetLeft();var top=this.ChartBorder.GetBottom();var width=this.ChartBorder.GetWidth();var height=this.ChartBorder.Bottom;this.Canvas.beginPath();this.Canvas.rect(left,top,width,height);if(this.Canvas.isPointInPath(x,y))return true;return false;};this.PtInFrameVertical=function(x,y){for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];if(item.Height<=0)continue;if(!item.Frame.PtInVertical)continue;if(item.Frame.PtInVertical(x,y)){return{Frame:item.Frame};}}return null;};this.GetXFromIndex=function(index){return this.SubFrame[0].Frame.GetXFromIndex(index);};this.GetYFromData=function(value){return this.SubFrame[0].Frame.GetYFromData(value);};this.ZoomUp=function(cursorIndex){var result=this.SubFrame[0].Frame.ZoomUp(cursorIndex);this.UpdateAllFrame();return result;};this.ZoomDown=function(cursorIndex,option){var result=this.SubFrame[0].Frame.ZoomDown(cursorIndex,option);this.UpdateAllFrame();return result;};this.SetXShowCount=function(showCount){var result=this.SubFrame[0].Frame.SetXShowCount(showCount);this.UpdateAllFrame();return result;};this.GetXShowCount=function(){var xPointcount=-1;if(!IFrameSplitOperator.IsNonEmptyArray(this.SubFrame))return xPointcount;var subFrame=this.SubFrame[0];if(!subFrame.Frame)return xPointcount;xPointcount=subFrame.Frame.XPointCount;return xPointcount;};this.XCoordinateZoom=function(step,isMoveLeft){var result=this.SubFrame[0].Frame.XCoordinateZoom(step,isMoveLeft);this.UpdateAllFrame();return result;};//设置重新计算刻度坐标
2813
2813
  this.ResetXYSplit=function(){for(var _i in this.SubFrame){this.SubFrame[_i].Frame.XYSplit=true;}};this.ResetXSplit=function(){for(var _i2 in this.SubFrame){this.SubFrame[_i2].Frame.XSplit=true;}};//清空Y轴坐标的最大最小值
2814
- this.ClearYCoordinateMaxMin=function(windowIndex){if(IFrameSplitOperator.IsNumber(windowIndex)){var subItem=this.SubFrame[windowIndex];if(!subItem||!subItem.Frame)return;if(frame.YMaxMin){frame.YMaxMin.Max=null;frame.YMaxMin.Min=null;}}else{for(var i=0;i<this.SubFrame.length;++i){var subItem=this.SubFrame[i];var frame=subItem.Frame;if(frame.YMaxMin){frame.YMaxMin.Max=null;frame.YMaxMin.Min=null;}}}};this.SetLanguage=function(languageID){for(var _i3 in this.SubFrame){var item=this.SubFrame[_i3];if(item&&item.Frame){if(item.Frame.YSplitOperator)item.Frame.YSplitOperator.LanguageID=languageID;if(item.Frame.XSplitOperator)item.Frame.XSplitOperator.LanguageID=languageID;}}};this.GetCurrentPageSize=function()//获取当前页显示的数据个数
2814
+ this.ClearYCoordinateMaxMin=function(windowIndex){if(IFrameSplitOperator.IsNumber(windowIndex)){var subItem=this.SubFrame[windowIndex];if(!subItem||!subItem.Frame)return;var frame=subItem.Frame;if(frame.YMaxMin){frame.YMaxMin.Max=null;frame.YMaxMin.Min=null;}}else{for(var i=0;i<this.SubFrame.length;++i){var subItem=this.SubFrame[i];var frame=subItem.Frame;if(frame.YMaxMin){frame.YMaxMin.Max=null;frame.YMaxMin.Min=null;}}}};this.SetLanguage=function(languageID){for(var _i3 in this.SubFrame){var item=this.SubFrame[_i3];if(item&&item.Frame){if(item.Frame.YSplitOperator)item.Frame.YSplitOperator.LanguageID=languageID;if(item.Frame.XSplitOperator)item.Frame.XSplitOperator.LanguageID=languageID;}}};this.GetCurrentPageSize=function()//获取当前页显示的数据个数
2815
2815
  {if(this.SubFrame.length<=0)return null;var item=this.SubFrame[0];if(!item||!item.Frame)return null;return item.Frame.XPointCount;};this.OnSize=function(){var obj={};this.SubFrame[0].Frame.OnSize(obj);this.UpdateAllFrame();return obj;};this.SetDataWidth=function(dataWidth){var obj=this.SubFrame[0].Frame.SetDataWidth(dataWidth);this.UpdateAllFrame();return obj;};this.UpdateAllFrame=function(){var mainFrame=this.SubFrame[0].Frame;for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];if(i>0)//第1个窗口主坐标已经算好了
2816
2816
  {item.Frame.XPointCount=mainFrame.XPointCount;item.Frame.ZoomIndex=mainFrame.ZoomIndex;item.Frame.DataWidth=mainFrame.DataWidth;item.Frame.DistanceWidth=mainFrame.DistanceWidth;item.Frame.LastCalculateStatus.Width=mainFrame.LastCalculateStatus.Width;item.Frame.LastCalculateStatus.XPointCount=mainFrame.LastCalculateStatus.XPointCount;}for(var j in item.OverlayIndex){var overlayItem=this.SubFrame[i].OverlayIndex[j];overlayItem.Frame.XPointCount=mainFrame.XPointCount;overlayItem.Frame.ZoomIndex=mainFrame.ZoomIndex;overlayItem.Frame.DataWidth=mainFrame.DataWidth;overlayItem.Frame.DistanceWidth=mainFrame.DistanceWidth;overlayItem.Frame.LastCalculateStatus.Width=mainFrame.LastCalculateStatus.Width;overlayItem.Frame.LastCalculateStatus.XPointCount=mainFrame.LastCalculateStatus.XPointCount;}}};//鼠标是否在边框上
2817
2817
  this.PtInFrameBorder=function(x,y){var height=this.DragBorderHeight;for(var i=0;i<this.SubFrame.length-1;++i){var item=this.SubFrame[i];if(item.Frame.Heigh<=0)continue;var bottom=item.Frame.ChartBorder.GetBottom();var left=item.Frame.ChartBorder.GetLeft();var right=item.Frame.ChartBorder.GetRight();item.Frame.Canvas.beginPath();item.Frame.Canvas.rect(left,bottom-height/2,right-left,height);if(item.Frame.Canvas.isPointInPath(x,y)){return{Index:i,Bottom:true};}}return null;};this.IsEnableDragY=function(index){if(!this.SubFrame)return false;var item=this.SubFrame[index];if(!item||!item.Frame||!item.Frame.YSplitOperator)return false;var split=item.Frame.YSplitOperator;if(typeof split.IsEnableDragY!='function')return false;return split.IsEnableDragY();};this.IsEnableOverlayDragY=function(index,overlayIndex){if(!this.SubFrame)return false;var item=this.SubFrame[index];var overlayItem=item.OverlayIndex[overlayIndex];if(!overlayItem||!overlayItem.Frame)return false;var split=overlayItem.Frame.YSplitOperator;if(overlayItem.Frame.IsShareY)split=overlayItem.Frame.MainFrame.YSplitOperator;if(!split||typeof split.IsEnableDragY!='function')return false;return split.IsEnableDragY();};this.PtInFrameY=function(x,y){var rightExtendWith=0;if(this.GetExtendChartByClassName){var finder=this.GetExtendChartByClassName("StockChip");if(finder&&finder.Chart)rightExtendWith=finder.Chart.Width;}for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];if(item.Frame.Heigh<=0)continue;var rightWidth=item.Frame.ChartBorder.Right;rightWidth-=rightExtendWith;var border=item.Frame.ChartBorder.GetBorder();var bottom=border.Bottom;var top=border.TopTitle;var left=border.Left;var right=border.Right;var maxTopHegith=30;var barHegith=bottom-top;if(barHegith/3>maxTopHegith){var barTop=top+maxTopHegith;var barBottom=bottom-maxTopHegith;}else{var internal=barHegith/3;var barTop=top+internal;var barBottom=bottom-internal;}var position=0;if(y<barTop)position=1;else if(y>barBottom)position=2;if(rightWidth>=10){if(IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex)){var overlayItem=item.OverlayIndex[0];var rightOffset=overlayItem.Frame.RightOffset;item.Frame.Canvas.beginPath();item.Frame.Canvas.rect(right,top,rightOffset,bottom-top);if(item.Frame.Canvas.isPointInPath(x,y)){return{Index:i,Right:true,Left:false,Position:position,IsOverlay:false};//Position 1=上面 2 下面 0=中间(TODO)
@@ -5002,7 +5002,10 @@ if(!pageInfo)return;if(!this.OverlayIndex)return;if(!IFrameSplitOperator.IsNonEm
5002
5002
  info.IsLast=pageInfo.IsLast;//是否是最后一个数据
5003
5003
  if(IFrameSplitOperator.IsNumber(option.LineType))info.LineType=option.LineType;info.Value=item.Value;var text=IFrameSplitOperator.FormatValueString(item.Value,floatPrecision,this.LanguageID);if(option.Position=='left')info.Message[0]=text;else info.Message[1]=text;if(!pageInfo.IsLast){var config={};if(!pageInfo.IsLast)config.EmptyBGColor=g_JSChartResource.FrameLatestPrice.EmptyBGColor;info.ExtendData={Custom:config};}if(event){var sendData={PreventDefault:false,Label:info,Data:item,IndexName:chart.IndexName,OverlayIdentify:this.OverlayIndex.Identify};event.Callback(event,sendData,this);if(sendData.PreventDefault)continue;}this.Frame.CustomHorizontalInfo.push(info);}}},//回调外部处理自定义Y轴刻度
5004
5004
  this.InvokeCustomYCoordinateCallback=function(){if(!this.GetEventCallback)return null;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_CUSTOM_Y_COORDINATE);if(!event||!event.Callback)return null;var data={ID:this.Frame.Identify,Frame:this.Frame,PreventDefault:false,Custom:this.Custom};if(this.OverlayIdentify)data.OverlayIdentify=this.OverlayIdentify;event.Callback(event,data,this);return data;};this.Reset=function()//重置
5005
- {};this.SetOption=function(option){};}//字符串格式化 千分位分割
5005
+ {};this.SetOption=function(option){};//计算上下预留
5006
+ this.ReservedHeight=function(splitData){if(!this.Frame)return;if(this.Frame.IsHScreen)return;//横屏以后再搞
5007
+ var yReserved=this.Frame.HorizontalReserved;if(!yReserved)return;var reservedHeight=0;if(IFrameSplitOperator.IsPlusNumber(yReserved.Top))reservedHeight+=yReserved.Top;if(IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))reservedHeight+=yReserved.Bottom;if(reservedHeight<=0)return;var border=this.Frame.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var srcHeight=bottom-top;if(srcHeight<reservedHeight)return;var max=splitData.Max;var min=splitData.Min;if(IFrameSplitOperator.IsPlusNumber(yReserved.Top))top-=yReserved.Top;if(IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))bottom+=yReserved.Bottom;var value=(max-min)/(bottom-top);//1个像素点对应的数值
5008
+ if(IFrameSplitOperator.IsPlusNumber(yReserved.Top)){var topValue=value*yReserved.Top;max+=topValue;}if(IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)){var bottomValue=value*yReserved.Bottom;min-=bottomValue;}splitData.Max=max;splitData.Min=min;this.Frame.HorizontalMax=splitData.Max;this.Frame.HorizontalMin=splitData.Min;};}//字符串格式化 千分位分割
5006
5009
  IFrameSplitOperator.FormatValueThousandsString=function(value,floatPrecision){if(value==null||isNaN(value)){if(floatPrecision>0){var nullText='-.';for(var i=0;i<floatPrecision;++i){nullText+='-';}return nullText;}return'--';}var result='';var num=value.toFixed(floatPrecision);if(floatPrecision>0){var numFloat=num.split('.')[1];var numM=num.split('.')[0];while(numM.length>3){result=','+numM.slice(-3)+result;numM=numM.slice(0,numM.length-3);}if(numM){result=numM+result+'.'+numFloat;}}else{while(num.length>3){result=','+num.slice(-3)+result;num=num.slice(0,num.length-3);}if(num){result=num+result;}}return result;};//数据输出格式化 floatPrecision=小数位数
5007
5010
  IFrameSplitOperator.FormatValueString=function(value,floatPrecision,languageID){/*
5008
5011
  if (value==null || isNaN(value))
@@ -5110,7 +5113,8 @@ if(this.SplitLogarithmic(splitData,defaultfloatPrecision)){bFilter=false;}else{t
5110
5113
  {
5111
5114
  JSConsole.Chart.Log(`[FrameSplitKLinePriceY::Operator] ${i}=${this.Frame.HorizontalInfo[i].Message[0]}`);
5112
5115
  }
5113
- */JSConsole.Chart.Log('[FrameSplitKLinePriceY::Operator] fixed . Max='+splitData.Max+' Min='+splitData.Min+' Count='+splitData.Count);if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);if(event&&event.Callback){var data={ID:this.Frame.Identify,Frame:this.Frame};event.Callback(event,data,this);}}};this.SplitTickData=function(splitData,floatPrecision){switch(this.CoordinateType){case 1://百分比
5116
+ */this.ReservedHeight(splitData);//预留高度
5117
+ JSConsole.Chart.Log('[FrameSplitKLinePriceY::Operator] fixed . Max='+splitData.Max+' Min='+splitData.Min+' Count='+splitData.Count);if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);if(event&&event.Callback){var data={ID:this.Frame.Identify,Frame:this.Frame};event.Callback(event,data,this);}}};this.SplitTickData=function(splitData,floatPrecision){switch(this.CoordinateType){case 1://百分比
5114
5118
  if(!this.SplitPercentage(splitData,floatPrecision,splitData.IsFixedMaxMin)){this.SplitDefault(splitData,floatPrecision,splitData.IsFixedMaxMin);}else{this.Frame.MultiTextFormat=this.PercentageTextFormat;splitData.IsFilter=false;}break;default:if(this.SplitType==3){this.SplitTickPrice(splitData,floatPrecision);}else{this.SplitDefault(splitData,floatPrecision,splitData.IsFixedMaxMin);}}};this.SplitTickPrice=function(splitData,floatPrecision){var aryPrice=this.KLineChart.GetAllPrice();this.Frame.HorizontalInfo=[];for(var i in aryPrice){var value=aryPrice[i];this.Frame.HorizontalInfo[i]=new CoordinateInfo();this.Frame.HorizontalInfo[i].Value=value;if(this.IsShowLeftText)this.Frame.HorizontalInfo[i].Message[0]=value.toFixed(floatPrecision);if(this.IsShowRightText)this.Frame.HorizontalInfo[i].Message[1]=value.toFixed(floatPrecision);}};this.SplitPercentage=function(splitData,floatPrecision,isFixedMaxMin)//百分比坐标
5115
5119
  {var firstOpenPrice=this.GetFirstOpenPrice();if(!IFrameSplitOperator.IsNumber(firstOpenPrice))return false;splitData.Max=(splitData.Max-firstOpenPrice)/firstOpenPrice;splitData.Min=(splitData.Min-firstOpenPrice)/firstOpenPrice;splitData.Interval=(splitData.Max-splitData.Min)/(splitData.Count-1);if(!isFixedMaxMin)this.IntegerCoordinateSplit2(splitData);var minValue=(1+splitData.Min)*firstOpenPrice;var maxValue=(1+splitData.Max)*firstOpenPrice;var textColor;if(g_JSChartResource.Frame&&g_JSChartResource.Frame.PercentageText){var item=g_JSChartResource.Frame.PercentageText;textColor={PriceColor:item.PriceColor,PercentageColor:item.PercentageColor,SplitColor:item.SplitColor,Font:item.Font};}var aryHorizontal=[];for(var value=0;value<=splitData.Max;value+=splitData.Interval){var price=(value+1)*firstOpenPrice;var item=new CoordinateInfo();item.Value=price;if(this.IsShowLeftText)item.Message[0]=price.toFixed(floatPrecision);//左边价格坐标
5116
5120
  if(this.IsShowRightText){var strPrice=price.toFixed(floatPrecision);var text=(value*100).toFixed(2);//右边百分比
@@ -5181,9 +5185,7 @@ coordinate.Message[1]=IFrameSplitOperator.FormatValueString(value,floatPrecision
5181
5185
  //this.Frame.HorizontalInfo[i].LineColor="rgb(220,220,220)";
5182
5186
  }}this.FilterIgnoreYValue();this.CustomCoordinate();if(this.SplitType!=1)this.Frame.HorizontalInfo=this.Filter(this.Frame.HorizontalInfo,splitData.Max>0&&splitData.Min<0);this.RightFrameSplitY();this.MainOverlayFrameSplitY();//主图Y轴绑定叠加Y轴坐标
5183
5187
  this.CallAcutionSplitY(this.SplitCount,splitData);if(this.EnableRemoveZero)this.RemoveZero(this.Frame.HorizontalInfo);this.DynamicMessageText();this.Frame.HorizontalMax=splitData.Max;this.Frame.HorizontalMin=splitData.Min;if(this.EnableZoomUpDown==true&&!this.FixedYMaxMin)this.FixedYMaxMin={Max:splitData.Max,Min:splitData.Min};this.ReservedHeight(splitData);//预留高度
5184
- if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);if(event&&event.Callback){var data={ID:this.Frame.Identify,Frame:this.Frame};if(this.OverlayIdentify)data.OverlayIdentify=this.OverlayIdentify;event.Callback(event,data,this);}}};this.ReservedHeight=function(splitData){if(this.Frame.IsHScreen)return;//横屏以后再搞
5185
- var yReserved=this.Frame.HorizontalReserved;if(!yReserved)return;var reservedHeight=0;if(IFrameSplitOperator.IsPlusNumber(yReserved.Top))reservedHeight+=yReserved.Top;if(IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))reservedHeight+=yReserved.Bottom;if(reservedHeight<=0)return;var border=this.Frame.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var srcHeight=bottom-top;if(srcHeight<reservedHeight)return;var max=splitData.Max;var min=splitData.Min;if(IFrameSplitOperator.IsPlusNumber(yReserved.Top))top-=yReserved.Top;if(IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))bottom+=yReserved.Bottom;var value=(max-min)/(bottom-top);//1个像素点对应的数值
5186
- if(IFrameSplitOperator.IsPlusNumber(yReserved.Top)){var topValue=value*yReserved.Top;max+=topValue;}if(IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)){var bottomValue=value*yReserved.Bottom;min-=bottomValue;}splitData.Max=max;splitData.Min=min;this.Frame.HorizontalMax=splitData.Max;this.Frame.HorizontalMin=splitData.Min;};this.FormatValueString=function(value){var text;if(this.StringFormat==1)//手机端格式 如果有万,亿单位了 去掉小数
5188
+ if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);if(event&&event.Callback){var data={ID:this.Frame.Identify,Frame:this.Frame};if(this.OverlayIdentify)data.OverlayIdentify=this.OverlayIdentify;event.Callback(event,data,this);}}};this.FormatValueString=function(value){var text;if(this.StringFormat==1)//手机端格式 如果有万,亿单位了 去掉小数
5187
5189
  {var floatPrecision=this.FloatPrecision;if(IFrameSplitOperator.IsNumber(value)&&Math.abs(value)>1000)floatPrecision=0;text=IFrameSplitOperator.FormatValueString(value,floatPrecision,this.LanguageID);}else if(this.StringFormat==2)//原始数据输出
5188
5190
  {text=''+value.toFixed(this.FloatPrecision);}else{var absValue=Math.abs(value);if(absValue<0.0000000001){text=0;}else if(absValue<this.FLOATPRECISION_RANGE[this.FLOATPRECISION_RANGE.length-1]){text=value.toExponential(2).toString();}else{var floatPrecision=this.GetFloatPrecision(absValue,this.FloatPrecision);//数据比小数位数还小, 调整小数位数
5189
5191
  text=IFrameSplitOperator.FormatValueString(value,floatPrecision,this.LanguageID);}}return text;};this.FilterIgnoreYValue=function(){if(!this.IgnoreYValue||this.IgnoreYValue.length<=0)return;var setValue=new _set2.default(this.IgnoreYValue);this.Frame.HorizontalInfo=this.Frame.HorizontalInfo.filter(function(item){return!setValue.has(item.Value);});};this.DynamicMessageText=function(){if(this.SplitType==2){for(var i=0;i<this.Frame.HorizontalInfo.length;++i){var item=this.Frame.HorizontalInfo[i];if(item.Message[0])item.Message[0]+='%';if(item.Message[1])item.Message[1]+='%';}}};this.CallAcutionSplitY=function(count,splitData){if(this.Frame.Identify!=1)return null;var aryCallAcution=this.GetCallAcutionSplitY(count,splitData);if(!aryCallAcution)return;for(var i=0;i<this.Frame.HorizontalInfo.length;++i)//把显示的数据迁移到 Message[2] Message[3]
@@ -7376,16 +7378,20 @@ var title=this.TitlePaint[1];if(title){title.TradeIndex=null;title.ColorIndex=nu
7376
7378
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
7377
7379
  this.Draw();};this.SetFrameToolbar=function(windowIndex,window){if(!window||!this.Frame.SubFrame[windowIndex]||!this.Frame.SubFrame[windowIndex].Frame)return;var frame=this.Frame.SubFrame[windowIndex].Frame;var bChanged=false;if(IFrameSplitOperator.IsBool(window.Modify)){frame.ModifyIndex=window.Modify;bChanged=true;}if(IFrameSplitOperator.IsBool(window.Change)){frame.ChangeIndex=window.Change;bChanged=true;}if(IFrameSplitOperator.IsBool(window.Close)){frame.CloseIndex=window.Close;bChanged=true;}if(IFrameSplitOperator.IsBool(window.Overlay)){frame.OverlayIndex=window.Overlay;bChanged=true;}//工具栏变 先刷新工具栏
7378
7380
  if(bChanged){frame.SizeChange=true;frame.ToolbarRect=null;//清空工具栏缓存
7379
- frame.DrawToolbar();}};//切换成 脚本指标
7381
+ frame.DrawToolbar();}};this.SetFrameAttribute=function(windowIndex,attr){if(!window||!this.Frame.SubFrame[windowIndex]||!this.Frame.SubFrame[windowIndex].Frame)return;if(!attr)return;var frame=this.Frame.SubFrame[windowIndex].Frame;if(!IFrameSplitOperator.IsUndefined(attr.HorizontalReserved))frame.HorizontalReserved=attr.HorizontalReserved;//Y轴上下预留
7382
+ if(IFrameSplitOperator.IsNumber(attr.TitleHeight))frame.ChartBorder.TitleHeight=attr.TitleHeight;//指标标题高度
7383
+ };this.ResetFrameAttribute=function(windowIndex){if(!window||!this.Frame.SubFrame[windowIndex]||!this.Frame.SubFrame[windowIndex].Frame)return;var frame=this.Frame.SubFrame[windowIndex].Frame;frame.HorizontalReserved=null;};//切换成 脚本指标
7380
7384
  this.ChangeScriptIndex=function(windowIndex,indexData,option){this.DeleteIndexPaint(windowIndex,true);this.WindowIndex[windowIndex]=new ScriptIndex(indexData.Name,indexData.Script,indexData.Args,indexData);//脚本执行
7381
- if(option){if(option.Window)this.SetFrameToolbar(windowIndex,option.Window);}this.OnChangeIndexEvent(windowIndex,{ID:indexData.ID,Name:indexData.Name,FunctionName:"ChangeScriptIndex"});this.Frame.ClearUpDonwFrameYData({Index:windowIndex});var bindData=this.ChartPaint[0].Data;this.BindIndexData(windowIndex,bindData);//执行脚本
7385
+ this.ResetFrameAttribute(windowIndex);this.Frame.ClearYCoordinateMaxMin(windowIndex);if(option){if(option.Window){this.SetFrameToolbar(windowIndex,option.Window);this.SetFrameAttribute(windowIndex,option.Window);//窗口属性
7386
+ }}this.OnChangeIndexEvent(windowIndex,{ID:indexData.ID,Name:indexData.Name,FunctionName:"ChangeScriptIndex"});this.Frame.ClearUpDonwFrameYData({Index:windowIndex});var bindData=this.ChartPaint[0].Data;this.BindIndexData(windowIndex,bindData);//执行脚本
7382
7387
  this.UpdataDataoffset();//更新数据偏移
7383
7388
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
7384
7389
  this.Draw();};this.OnKLinePageChange=function(eventid){if(!this.ChartPaint[0])return;var bindData=this.ChartPaint[0].Data;for(var i=0;i<this.WindowIndex.length;++i){var item=this.WindowIndex[i];if(!item)continue;if(item.IsUsePageData===true)this.BindIndexData(i,bindData,{Type:1});//执行脚本
7385
7390
  }//叠加指标
7386
7391
  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&&overlayItem.Script&&overlayItem.Script.IsUsePageData==true)this.BindOverlayIndexData(overlayItem,i,bindData);}}};//切换api指标
7387
7392
  this.ChangeAPIIndex=function(windowIndex,indexData){this.DeleteIndexPaint(windowIndex,true);//使用API挂接指标数据 API:{ Name:指标名字, Script:指标脚本可以为空, Args:参数可以为空, Url:指标执行地址 }
7388
- var apiItem=indexData.API;this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,indexData);this.OnChangeIndexEvent(windowIndex,{ID:indexData.ID,Name:indexData.Name,FunctionName:"ChangeAPIIndex"});if(indexData){if(indexData.Window)this.SetFrameToolbar(windowIndex,indexData.Window);}this.Frame.ClearUpDonwFrameYData({Index:windowIndex});var bindData=this.ChartPaint[0].Data;this.BindIndexData(windowIndex,bindData);//执行脚本
7393
+ var apiItem=indexData.API;this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,indexData);this.ResetFrameAttribute(windowIndex);this.Frame.ClearYCoordinateMaxMin(windowIndex);this.OnChangeIndexEvent(windowIndex,{ID:indexData.ID,Name:indexData.Name,FunctionName:"ChangeAPIIndex"});if(indexData){if(indexData.Window){this.SetFrameToolbar(windowIndex,indexData.Window);this.SetFrameAttribute(windowIndex,indexData.Window);//窗口属性
7394
+ }}this.Frame.ClearUpDonwFrameYData({Index:windowIndex});var bindData=this.ChartPaint[0].Data;this.BindIndexData(windowIndex,bindData);//执行脚本
7389
7395
  this.UpdataDataoffset();//更新数据偏移
7390
7396
  this.UpdateFrameMaxMin();//调整坐标最大 最小值
7391
7397
  this.Draw();};this.OnChangeIndexEvent=function(windowIndex,indexInfo){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CHANGE_INDEX);if(event&&event.Callback){var data={IndexInfo:indexInfo,WindowIndex:windowIndex};event.Callback(event,data,this);}};//切换指标 指定切换窗口指标
@@ -13310,7 +13316,7 @@ this.AryButton=[{Title:"点击线段颜色",ClassName:'hqchart_drawtool icon-hua
13310
13316
  switch(item.Data.ID){case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID:this.ColorButton=data;break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID:this.BGColorButton=data;divItem.style.display="none";break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID:this.FontColorButton=data;divItem.style.display="none";break;}parentDivDom.appendChild(divItem);};this.OnClickButton=function(e,data){console.log('[JSDialogModifyDraw::OnClickButton] ',data);if(!data.Item||!data.Item.Data)return;var id=data.Item.Data.ID;switch(id){case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID:this.ModifyLineColor();break;case JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID:this.DeleteDrawPicture();break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID:this.ModifyBGColor();break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID:this.ModifyFontColor();break;}};this.Close=function(e){if(!this.DivDialog)return;this.ChartPicture=null;this.DivDialog.style.visibility='hidden';};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.DeleteDrawPicture=function(){if(this.ChartPicture&&this.HQChart){this.HQChart.ClearChartDrawPicture(this.ChartPicture);}this.Close();};this.ShowButton=function(dom,diaplay){if(dom.style.display==diaplay)return;dom.style.display=diaplay;};this.GetRandomColor=function(currentColor,randomLineColor){var colorIndex=0;for(var i=0;i<randomLineColor.length;++i){if(currentColor==randomLineColor[i]){colorIndex=i+1;break;}}colorIndex=colorIndex%randomLineColor.length;var color=randomLineColor[colorIndex];return color;};this.ModifyLineColor=function(){if(!this.ChartPicture||!this.HQChart)return;var color=this.GetRandomColor(this.ChartPicture.LineColor,this.RandomLineColor);this.ChartPicture.LineColor=color;this.ChartPicture.PointColor=color;if(this.ColorButton)this.ColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
13311
13317
  this.HQChart.Draw();};this.ModifyFontColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteTextColor,this.RandomFontColor);this.ChartPicture.NoteTextColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.TextColor,this.RandomFontColor);this.ChartPicture.TextColor=color;}if(this.FontColorButton)this.FontColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
13312
13318
  this.HQChart.Draw();};this.ModifyBGColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteBGColor,this.RandomBGColor);this.ChartPicture.NoteBGColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.BGColor,this.RandomBGColor);this.ChartPicture.BGColor=color;}if(this.BGColorButton)this.BGColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
13313
- this.HQChart.Draw();};this.Show=function(x,y){if(!this.DivDialog)this.Create();this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.SetChartPicture=function(chart){this.ChartPicture=chart;var bShowLineColor=true,bShowBGColor=false,bShowFontColor=false;var bgColor=null,fontColor=null;var ARRAY_TEXT_CHART=['ChartDrawPriceLabel',"ChartDrawAnchoredText","ChartDrawPriceNote"];if(ARRAY_TEXT_CHART.includes(chart.ClassName)){bShowBGColor=true;bShowFontColor=true;bgColor=chart.BGColor;fontColor=chart.TextColor;}else if(chart.ClassName=="ChartDrawNote"){bShowBGColor=true;bShowFontColor=true;bgColor=chart.NoteBGColor;fontColor=chart.NoteTextColor;}if(this.ColorButton){var item=this.ColorButton;this.ShowButton(item.Div,bShowLineColor?"block":"none");if(bShowLineColor){item.Span.style['color']=chart.LineColor;}}if(this.BGColorButton){var item=this.BGColorButton;this.ShowButton(item.Div,bShowBGColor?"block":"none");if(bShowBGColor){item.Span.style['color']=bgColor;}}if(this.FontColorButton){var item=this.FontColorButton;this.ShowButton(item.Div,bShowFontColor?"block":"none");if(bShowFontColor){item.Span.style['color']=fontColor;}}};this.OnMouseDownTitle=function(e){var _this76=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this76.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this76.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};}///////////////////////////////////////////////////////////////////////////////////
13319
+ this.HQChart.Draw();};this.Show=function(x,y){if(!this.DivDialog)this.Create();this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.SetChartPicture=function(chart){this.ChartPicture=chart;var bShowLineColor=true,bShowBGColor=false,bShowFontColor=false;var bgColor=null,fontColor=null;var ARRAY_TEXT_CHART=['ChartDrawPriceLabel',"ChartDrawAnchoredText","ChartDrawPriceNote"];if(ARRAY_TEXT_CHART.includes(chart.ClassName)){bShowBGColor=true;bShowFontColor=true;bgColor=chart.BGColor;fontColor=chart.TextColor;}else if(chart.ClassName=="ChartDrawNote"){bShowBGColor=true;bShowFontColor=true;bgColor=chart.NoteBGColor;fontColor=chart.NoteTextColor;}if(this.ColorButton){var item=this.ColorButton;this.ShowButton(item.Div,bShowLineColor?"block":"none");if(bShowLineColor){item.Span.style['color']=chart.LineColor;}}if(this.BGColorButton){var item=this.BGColorButton;this.ShowButton(item.Div,bShowBGColor?"block":"none");if(bShowBGColor){item.Span.style['color']=bgColor;}}if(this.FontColorButton){var item=this.FontColorButton;this.ShowButton(item.Div,bShowFontColor?"block":"none");if(bShowFontColor){item.Span.style['color']=fontColor;}}};this.OnMouseDownTitle=function(e){var _this76=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this76.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this76.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};}///////////////////////////////////////////////////////////////////////////////////
13314
13320
  // 工作线程计算指标示例
13315
13321
  //
13316
13322
  //
@@ -13322,7 +13328,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
13322
13328
  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);};}/********************************************************************************
13323
13329
  * 版本信息输出
13324
13330
  *
13325
- */var HQCHART_VERSION="1.1.13349";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();//把给外界调用的方法暴露出来
13331
+ */var HQCHART_VERSION="1.1.13357";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();//把给外界调用的方法暴露出来
13326
13332
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
13327
13333
  // BaseIndex:BaseIndex,
13328
13334
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13350",
3
+ "version": "1.1.13358",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -919,7 +919,8 @@ function JSDialogModifyDraw()
919
919
  this.DivDialog.style.left = left + 'px'
920
920
  this.DivDialog.style.top = top + 'px'
921
921
 
922
- if(e.preventDefault) e.preventDefault();
922
+ if (e.preventDefault) e.preventDefault();
923
+ if (e.stopPropagation) e.stopPropagation();
923
924
  }
924
925
 
925
926
  this.DocOnMouseUpTitle=function(e)
@@ -19041,6 +19041,8 @@ function HQTradeFrame()
19041
19041
  {
19042
19042
  var subItem=this.SubFrame[windowIndex];
19043
19043
  if (!subItem || !subItem.Frame) return;
19044
+
19045
+ var frame=subItem.Frame;
19044
19046
  if (frame.YMaxMin)
19045
19047
  {
19046
19048
  frame.YMaxMin.Max=null;
@@ -45425,6 +45427,51 @@ function IFrameSplitOperator()
45425
45427
  }
45426
45428
 
45427
45429
  this.SetOption=function(option) { }
45430
+
45431
+ //计算上下预留
45432
+ this.ReservedHeight=function(splitData)
45433
+ {
45434
+ if (!this.Frame) return;
45435
+ if (this.Frame.IsHScreen) return; //横屏以后再搞
45436
+
45437
+ var yReserved=this.Frame.HorizontalReserved;
45438
+ if (!yReserved) return;
45439
+
45440
+ var reservedHeight=0;
45441
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) reservedHeight+=yReserved.Top;
45442
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) reservedHeight+=yReserved.Bottom;
45443
+ if (reservedHeight<=0) return;
45444
+
45445
+ var border=this.Frame.GetBorder();
45446
+ var top=border.TopEx;
45447
+ var bottom=border.BottomEx;
45448
+ var srcHeight=bottom-top;
45449
+ if (srcHeight<reservedHeight) return;
45450
+
45451
+ var max=splitData.Max;
45452
+ var min=splitData.Min;
45453
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) top-=yReserved.Top;
45454
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) bottom+=yReserved.Bottom;
45455
+
45456
+ var value=(max-min)/(bottom-top); //1个像素点对应的数值
45457
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top))
45458
+ {
45459
+ var topValue=value*yReserved.Top;
45460
+ max+=topValue;
45461
+ }
45462
+
45463
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))
45464
+ {
45465
+ var bottomValue=value*yReserved.Bottom;
45466
+ min-=bottomValue;
45467
+ }
45468
+
45469
+ splitData.Max=max;
45470
+ splitData.Min=min;
45471
+
45472
+ this.Frame.HorizontalMax=splitData.Max;
45473
+ this.Frame.HorizontalMin=splitData.Min;
45474
+ }
45428
45475
  }
45429
45476
 
45430
45477
  //字符串格式化 千分位分割
@@ -46077,6 +46124,8 @@ function FrameSplitKLinePriceY()
46077
46124
  }
46078
46125
  */
46079
46126
 
46127
+ this.ReservedHeight(splitData); //预留高度
46128
+
46080
46129
  JSConsole.Chart.Log(`[FrameSplitKLinePriceY::Operator] fixed . Max=${splitData.Max} Min=${splitData.Min} Count=${splitData.Count}`);
46081
46130
 
46082
46131
  if (this.GetEventCallback)
@@ -46915,50 +46964,6 @@ function FrameSplitY()
46915
46964
  }
46916
46965
  }
46917
46966
 
46918
- this.ReservedHeight=function(splitData)
46919
- {
46920
- if (this.Frame.IsHScreen) return; //横屏以后再搞
46921
-
46922
- var yReserved=this.Frame.HorizontalReserved;
46923
- if (!yReserved) return;
46924
-
46925
- var reservedHeight=0;
46926
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) reservedHeight+=yReserved.Top;
46927
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) reservedHeight+=yReserved.Bottom;
46928
- if (reservedHeight<=0) return;
46929
-
46930
- var border=this.Frame.GetBorder();
46931
- var top=border.TopEx;
46932
- var bottom=border.BottomEx;
46933
- var srcHeight=bottom-top;
46934
- if (srcHeight<reservedHeight) return;
46935
-
46936
- var max=splitData.Max;
46937
- var min=splitData.Min;
46938
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) top-=yReserved.Top;
46939
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) bottom+=yReserved.Bottom;
46940
-
46941
- var value=(max-min)/(bottom-top); //1个像素点对应的数值
46942
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Top))
46943
- {
46944
- var topValue=value*yReserved.Top;
46945
- max+=topValue;
46946
- }
46947
-
46948
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))
46949
- {
46950
- var bottomValue=value*yReserved.Bottom;
46951
- min-=bottomValue;
46952
- }
46953
-
46954
- splitData.Max=max;
46955
- splitData.Min=min;
46956
-
46957
- this.Frame.HorizontalMax=splitData.Max;
46958
- this.Frame.HorizontalMin=splitData.Min;
46959
- }
46960
-
46961
-
46962
46967
  this.FormatValueString=function(value)
46963
46968
  {
46964
46969
  var text;
@@ -71839,15 +71844,41 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
71839
71844
  }
71840
71845
  }
71841
71846
 
71847
+ this.SetFrameAttribute=function(windowIndex, attr)
71848
+ {
71849
+ if (!window || !this.Frame.SubFrame[windowIndex] || !this.Frame.SubFrame[windowIndex].Frame) return;
71850
+ if (!attr) return;
71851
+
71852
+ var frame=this.Frame.SubFrame[windowIndex].Frame;
71853
+
71854
+ if (!IFrameSplitOperator.IsUndefined(attr.HorizontalReserved)) frame.HorizontalReserved=attr.HorizontalReserved; //Y轴上下预留
71855
+ if (IFrameSplitOperator.IsNumber(attr.TitleHeight)) frame.ChartBorder.TitleHeight=attr.TitleHeight; //指标标题高度
71856
+ }
71857
+
71858
+ this.ResetFrameAttribute=function(windowIndex)
71859
+ {
71860
+ if (!window || !this.Frame.SubFrame[windowIndex] || !this.Frame.SubFrame[windowIndex].Frame) return;
71861
+ var frame=this.Frame.SubFrame[windowIndex].Frame;
71862
+
71863
+ frame.HorizontalReserved=null;
71864
+ }
71865
+
71866
+
71842
71867
  //切换成 脚本指标
71843
71868
  this.ChangeScriptIndex=function(windowIndex,indexData,option)
71844
71869
  {
71845
71870
  this.DeleteIndexPaint(windowIndex, true);
71846
71871
  this.WindowIndex[windowIndex]=new ScriptIndex(indexData.Name,indexData.Script,indexData.Args,indexData); //脚本执行
71872
+ this.ResetFrameAttribute(windowIndex);
71873
+ this.Frame.ClearYCoordinateMaxMin(windowIndex);
71847
71874
 
71848
71875
  if (option)
71849
71876
  {
71850
- if (option.Window) this.SetFrameToolbar(windowIndex,option.Window);
71877
+ if (option.Window)
71878
+ {
71879
+ this.SetFrameToolbar(windowIndex,option.Window);
71880
+ this.SetFrameAttribute(windowIndex,option.Window); //窗口属性
71881
+ }
71851
71882
  }
71852
71883
 
71853
71884
  this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeScriptIndex" });
@@ -71894,14 +71925,20 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
71894
71925
  //使用API挂接指标数据 API:{ Name:指标名字, Script:指标脚本可以为空, Args:参数可以为空, Url:指标执行地址 }
71895
71926
  var apiItem=indexData.API;
71896
71927
  this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,indexData);
71928
+ this.ResetFrameAttribute(windowIndex);
71929
+ this.Frame.ClearYCoordinateMaxMin(windowIndex);
71897
71930
 
71898
71931
  this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeAPIIndex" });
71899
71932
 
71900
71933
  if (indexData)
71901
71934
  {
71902
- if (indexData.Window) this.SetFrameToolbar(windowIndex,indexData.Window);
71935
+ if (indexData.Window)
71936
+ {
71937
+ this.SetFrameToolbar(windowIndex,indexData.Window);
71938
+ this.SetFrameAttribute(windowIndex,indexData.Window); //窗口属性
71939
+ }
71903
71940
  }
71904
-
71941
+
71905
71942
  this.Frame.ClearUpDonwFrameYData({ Index:windowIndex });
71906
71943
  var bindData=this.ChartPaint[0].Data;
71907
71944
  this.BindIndexData(windowIndex,bindData); //执行脚本
@@ -1467,6 +1467,7 @@ input[type="color"] {
1467
1467
  .UMyChart_Draw_Modify_Dialog_Drag_Div
1468
1468
  {
1469
1469
  width:24px;
1470
+ user-select: none;
1470
1471
  }
1471
1472
 
1472
1473
  .UMyChart_Draw_Modify_Dialog_Button_Div
@@ -22933,6 +22933,8 @@ function HQTradeFrame()
22933
22933
  {
22934
22934
  var subItem=this.SubFrame[windowIndex];
22935
22935
  if (!subItem || !subItem.Frame) return;
22936
+
22937
+ var frame=subItem.Frame;
22936
22938
  if (frame.YMaxMin)
22937
22939
  {
22938
22940
  frame.YMaxMin.Max=null;
@@ -49317,6 +49319,51 @@ function IFrameSplitOperator()
49317
49319
  }
49318
49320
 
49319
49321
  this.SetOption=function(option) { }
49322
+
49323
+ //计算上下预留
49324
+ this.ReservedHeight=function(splitData)
49325
+ {
49326
+ if (!this.Frame) return;
49327
+ if (this.Frame.IsHScreen) return; //横屏以后再搞
49328
+
49329
+ var yReserved=this.Frame.HorizontalReserved;
49330
+ if (!yReserved) return;
49331
+
49332
+ var reservedHeight=0;
49333
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) reservedHeight+=yReserved.Top;
49334
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) reservedHeight+=yReserved.Bottom;
49335
+ if (reservedHeight<=0) return;
49336
+
49337
+ var border=this.Frame.GetBorder();
49338
+ var top=border.TopEx;
49339
+ var bottom=border.BottomEx;
49340
+ var srcHeight=bottom-top;
49341
+ if (srcHeight<reservedHeight) return;
49342
+
49343
+ var max=splitData.Max;
49344
+ var min=splitData.Min;
49345
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) top-=yReserved.Top;
49346
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) bottom+=yReserved.Bottom;
49347
+
49348
+ var value=(max-min)/(bottom-top); //1个像素点对应的数值
49349
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top))
49350
+ {
49351
+ var topValue=value*yReserved.Top;
49352
+ max+=topValue;
49353
+ }
49354
+
49355
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))
49356
+ {
49357
+ var bottomValue=value*yReserved.Bottom;
49358
+ min-=bottomValue;
49359
+ }
49360
+
49361
+ splitData.Max=max;
49362
+ splitData.Min=min;
49363
+
49364
+ this.Frame.HorizontalMax=splitData.Max;
49365
+ this.Frame.HorizontalMin=splitData.Min;
49366
+ }
49320
49367
  }
49321
49368
 
49322
49369
  //字符串格式化 千分位分割
@@ -49969,6 +50016,8 @@ function FrameSplitKLinePriceY()
49969
50016
  }
49970
50017
  */
49971
50018
 
50019
+ this.ReservedHeight(splitData); //预留高度
50020
+
49972
50021
  JSConsole.Chart.Log(`[FrameSplitKLinePriceY::Operator] fixed . Max=${splitData.Max} Min=${splitData.Min} Count=${splitData.Count}`);
49973
50022
 
49974
50023
  if (this.GetEventCallback)
@@ -50807,50 +50856,6 @@ function FrameSplitY()
50807
50856
  }
50808
50857
  }
50809
50858
 
50810
- this.ReservedHeight=function(splitData)
50811
- {
50812
- if (this.Frame.IsHScreen) return; //横屏以后再搞
50813
-
50814
- var yReserved=this.Frame.HorizontalReserved;
50815
- if (!yReserved) return;
50816
-
50817
- var reservedHeight=0;
50818
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) reservedHeight+=yReserved.Top;
50819
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) reservedHeight+=yReserved.Bottom;
50820
- if (reservedHeight<=0) return;
50821
-
50822
- var border=this.Frame.GetBorder();
50823
- var top=border.TopEx;
50824
- var bottom=border.BottomEx;
50825
- var srcHeight=bottom-top;
50826
- if (srcHeight<reservedHeight) return;
50827
-
50828
- var max=splitData.Max;
50829
- var min=splitData.Min;
50830
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) top-=yReserved.Top;
50831
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) bottom+=yReserved.Bottom;
50832
-
50833
- var value=(max-min)/(bottom-top); //1个像素点对应的数值
50834
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Top))
50835
- {
50836
- var topValue=value*yReserved.Top;
50837
- max+=topValue;
50838
- }
50839
-
50840
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))
50841
- {
50842
- var bottomValue=value*yReserved.Bottom;
50843
- min-=bottomValue;
50844
- }
50845
-
50846
- splitData.Max=max;
50847
- splitData.Min=min;
50848
-
50849
- this.Frame.HorizontalMax=splitData.Max;
50850
- this.Frame.HorizontalMin=splitData.Min;
50851
- }
50852
-
50853
-
50854
50859
  this.FormatValueString=function(value)
50855
50860
  {
50856
50861
  var text;
@@ -75731,15 +75736,41 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
75731
75736
  }
75732
75737
  }
75733
75738
 
75739
+ this.SetFrameAttribute=function(windowIndex, attr)
75740
+ {
75741
+ if (!window || !this.Frame.SubFrame[windowIndex] || !this.Frame.SubFrame[windowIndex].Frame) return;
75742
+ if (!attr) return;
75743
+
75744
+ var frame=this.Frame.SubFrame[windowIndex].Frame;
75745
+
75746
+ if (!IFrameSplitOperator.IsUndefined(attr.HorizontalReserved)) frame.HorizontalReserved=attr.HorizontalReserved; //Y轴上下预留
75747
+ if (IFrameSplitOperator.IsNumber(attr.TitleHeight)) frame.ChartBorder.TitleHeight=attr.TitleHeight; //指标标题高度
75748
+ }
75749
+
75750
+ this.ResetFrameAttribute=function(windowIndex)
75751
+ {
75752
+ if (!window || !this.Frame.SubFrame[windowIndex] || !this.Frame.SubFrame[windowIndex].Frame) return;
75753
+ var frame=this.Frame.SubFrame[windowIndex].Frame;
75754
+
75755
+ frame.HorizontalReserved=null;
75756
+ }
75757
+
75758
+
75734
75759
  //切换成 脚本指标
75735
75760
  this.ChangeScriptIndex=function(windowIndex,indexData,option)
75736
75761
  {
75737
75762
  this.DeleteIndexPaint(windowIndex, true);
75738
75763
  this.WindowIndex[windowIndex]=new ScriptIndex(indexData.Name,indexData.Script,indexData.Args,indexData); //脚本执行
75764
+ this.ResetFrameAttribute(windowIndex);
75765
+ this.Frame.ClearYCoordinateMaxMin(windowIndex);
75739
75766
 
75740
75767
  if (option)
75741
75768
  {
75742
- if (option.Window) this.SetFrameToolbar(windowIndex,option.Window);
75769
+ if (option.Window)
75770
+ {
75771
+ this.SetFrameToolbar(windowIndex,option.Window);
75772
+ this.SetFrameAttribute(windowIndex,option.Window); //窗口属性
75773
+ }
75743
75774
  }
75744
75775
 
75745
75776
  this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeScriptIndex" });
@@ -75786,14 +75817,20 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
75786
75817
  //使用API挂接指标数据 API:{ Name:指标名字, Script:指标脚本可以为空, Args:参数可以为空, Url:指标执行地址 }
75787
75818
  var apiItem=indexData.API;
75788
75819
  this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,indexData);
75820
+ this.ResetFrameAttribute(windowIndex);
75821
+ this.Frame.ClearYCoordinateMaxMin(windowIndex);
75789
75822
 
75790
75823
  this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeAPIIndex" });
75791
75824
 
75792
75825
  if (indexData)
75793
75826
  {
75794
- if (indexData.Window) this.SetFrameToolbar(windowIndex,indexData.Window);
75827
+ if (indexData.Window)
75828
+ {
75829
+ this.SetFrameToolbar(windowIndex,indexData.Window);
75830
+ this.SetFrameAttribute(windowIndex,indexData.Window); //窗口属性
75831
+ }
75795
75832
  }
75796
-
75833
+
75797
75834
  this.Frame.ClearUpDonwFrameYData({ Index:windowIndex });
75798
75835
  var bindData=this.ChartPaint[0].Data;
75799
75836
  this.BindIndexData(windowIndex,bindData); //执行脚本
@@ -133234,7 +133271,7 @@ function ScrollBarBGChart()
133234
133271
 
133235
133272
 
133236
133273
 
133237
- var HQCHART_VERSION="1.1.13349";
133274
+ var HQCHART_VERSION="1.1.13357";
133238
133275
 
133239
133276
  function PrintHQChartVersion()
133240
133277
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13349";
8
+ var HQCHART_VERSION="1.1.13357";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -22977,6 +22977,8 @@ function HQTradeFrame()
22977
22977
  {
22978
22978
  var subItem=this.SubFrame[windowIndex];
22979
22979
  if (!subItem || !subItem.Frame) return;
22980
+
22981
+ var frame=subItem.Frame;
22980
22982
  if (frame.YMaxMin)
22981
22983
  {
22982
22984
  frame.YMaxMin.Max=null;
@@ -49361,6 +49363,51 @@ function IFrameSplitOperator()
49361
49363
  }
49362
49364
 
49363
49365
  this.SetOption=function(option) { }
49366
+
49367
+ //计算上下预留
49368
+ this.ReservedHeight=function(splitData)
49369
+ {
49370
+ if (!this.Frame) return;
49371
+ if (this.Frame.IsHScreen) return; //横屏以后再搞
49372
+
49373
+ var yReserved=this.Frame.HorizontalReserved;
49374
+ if (!yReserved) return;
49375
+
49376
+ var reservedHeight=0;
49377
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) reservedHeight+=yReserved.Top;
49378
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) reservedHeight+=yReserved.Bottom;
49379
+ if (reservedHeight<=0) return;
49380
+
49381
+ var border=this.Frame.GetBorder();
49382
+ var top=border.TopEx;
49383
+ var bottom=border.BottomEx;
49384
+ var srcHeight=bottom-top;
49385
+ if (srcHeight<reservedHeight) return;
49386
+
49387
+ var max=splitData.Max;
49388
+ var min=splitData.Min;
49389
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) top-=yReserved.Top;
49390
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) bottom+=yReserved.Bottom;
49391
+
49392
+ var value=(max-min)/(bottom-top); //1个像素点对应的数值
49393
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top))
49394
+ {
49395
+ var topValue=value*yReserved.Top;
49396
+ max+=topValue;
49397
+ }
49398
+
49399
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))
49400
+ {
49401
+ var bottomValue=value*yReserved.Bottom;
49402
+ min-=bottomValue;
49403
+ }
49404
+
49405
+ splitData.Max=max;
49406
+ splitData.Min=min;
49407
+
49408
+ this.Frame.HorizontalMax=splitData.Max;
49409
+ this.Frame.HorizontalMin=splitData.Min;
49410
+ }
49364
49411
  }
49365
49412
 
49366
49413
  //字符串格式化 千分位分割
@@ -50013,6 +50060,8 @@ function FrameSplitKLinePriceY()
50013
50060
  }
50014
50061
  */
50015
50062
 
50063
+ this.ReservedHeight(splitData); //预留高度
50064
+
50016
50065
  JSConsole.Chart.Log(`[FrameSplitKLinePriceY::Operator] fixed . Max=${splitData.Max} Min=${splitData.Min} Count=${splitData.Count}`);
50017
50066
 
50018
50067
  if (this.GetEventCallback)
@@ -50851,50 +50900,6 @@ function FrameSplitY()
50851
50900
  }
50852
50901
  }
50853
50902
 
50854
- this.ReservedHeight=function(splitData)
50855
- {
50856
- if (this.Frame.IsHScreen) return; //横屏以后再搞
50857
-
50858
- var yReserved=this.Frame.HorizontalReserved;
50859
- if (!yReserved) return;
50860
-
50861
- var reservedHeight=0;
50862
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) reservedHeight+=yReserved.Top;
50863
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) reservedHeight+=yReserved.Bottom;
50864
- if (reservedHeight<=0) return;
50865
-
50866
- var border=this.Frame.GetBorder();
50867
- var top=border.TopEx;
50868
- var bottom=border.BottomEx;
50869
- var srcHeight=bottom-top;
50870
- if (srcHeight<reservedHeight) return;
50871
-
50872
- var max=splitData.Max;
50873
- var min=splitData.Min;
50874
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) top-=yReserved.Top;
50875
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) bottom+=yReserved.Bottom;
50876
-
50877
- var value=(max-min)/(bottom-top); //1个像素点对应的数值
50878
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Top))
50879
- {
50880
- var topValue=value*yReserved.Top;
50881
- max+=topValue;
50882
- }
50883
-
50884
- if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))
50885
- {
50886
- var bottomValue=value*yReserved.Bottom;
50887
- min-=bottomValue;
50888
- }
50889
-
50890
- splitData.Max=max;
50891
- splitData.Min=min;
50892
-
50893
- this.Frame.HorizontalMax=splitData.Max;
50894
- this.Frame.HorizontalMin=splitData.Min;
50895
- }
50896
-
50897
-
50898
50903
  this.FormatValueString=function(value)
50899
50904
  {
50900
50905
  var text;
@@ -75775,15 +75780,41 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
75775
75780
  }
75776
75781
  }
75777
75782
 
75783
+ this.SetFrameAttribute=function(windowIndex, attr)
75784
+ {
75785
+ if (!window || !this.Frame.SubFrame[windowIndex] || !this.Frame.SubFrame[windowIndex].Frame) return;
75786
+ if (!attr) return;
75787
+
75788
+ var frame=this.Frame.SubFrame[windowIndex].Frame;
75789
+
75790
+ if (!IFrameSplitOperator.IsUndefined(attr.HorizontalReserved)) frame.HorizontalReserved=attr.HorizontalReserved; //Y轴上下预留
75791
+ if (IFrameSplitOperator.IsNumber(attr.TitleHeight)) frame.ChartBorder.TitleHeight=attr.TitleHeight; //指标标题高度
75792
+ }
75793
+
75794
+ this.ResetFrameAttribute=function(windowIndex)
75795
+ {
75796
+ if (!window || !this.Frame.SubFrame[windowIndex] || !this.Frame.SubFrame[windowIndex].Frame) return;
75797
+ var frame=this.Frame.SubFrame[windowIndex].Frame;
75798
+
75799
+ frame.HorizontalReserved=null;
75800
+ }
75801
+
75802
+
75778
75803
  //切换成 脚本指标
75779
75804
  this.ChangeScriptIndex=function(windowIndex,indexData,option)
75780
75805
  {
75781
75806
  this.DeleteIndexPaint(windowIndex, true);
75782
75807
  this.WindowIndex[windowIndex]=new ScriptIndex(indexData.Name,indexData.Script,indexData.Args,indexData); //脚本执行
75808
+ this.ResetFrameAttribute(windowIndex);
75809
+ this.Frame.ClearYCoordinateMaxMin(windowIndex);
75783
75810
 
75784
75811
  if (option)
75785
75812
  {
75786
- if (option.Window) this.SetFrameToolbar(windowIndex,option.Window);
75813
+ if (option.Window)
75814
+ {
75815
+ this.SetFrameToolbar(windowIndex,option.Window);
75816
+ this.SetFrameAttribute(windowIndex,option.Window); //窗口属性
75817
+ }
75787
75818
  }
75788
75819
 
75789
75820
  this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeScriptIndex" });
@@ -75830,14 +75861,20 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
75830
75861
  //使用API挂接指标数据 API:{ Name:指标名字, Script:指标脚本可以为空, Args:参数可以为空, Url:指标执行地址 }
75831
75862
  var apiItem=indexData.API;
75832
75863
  this.WindowIndex[windowIndex]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,indexData);
75864
+ this.ResetFrameAttribute(windowIndex);
75865
+ this.Frame.ClearYCoordinateMaxMin(windowIndex);
75833
75866
 
75834
75867
  this.OnChangeIndexEvent(windowIndex, { ID:indexData.ID, Name:indexData.Name, FunctionName:"ChangeAPIIndex" });
75835
75868
 
75836
75869
  if (indexData)
75837
75870
  {
75838
- if (indexData.Window) this.SetFrameToolbar(windowIndex,indexData.Window);
75871
+ if (indexData.Window)
75872
+ {
75873
+ this.SetFrameToolbar(windowIndex,indexData.Window);
75874
+ this.SetFrameAttribute(windowIndex,indexData.Window); //窗口属性
75875
+ }
75839
75876
  }
75840
-
75877
+
75841
75878
  this.Frame.ClearUpDonwFrameYData({ Index:windowIndex });
75842
75879
  var bindData=this.ChartPaint[0].Data;
75843
75880
  this.BindIndexData(windowIndex,bindData); //执行脚本
@@ -136966,7 +137003,8 @@ function JSDialogModifyDraw()
136966
137003
  this.DivDialog.style.left = left + 'px'
136967
137004
  this.DivDialog.style.top = top + 'px'
136968
137005
 
136969
- if(e.preventDefault) e.preventDefault();
137006
+ if (e.preventDefault) e.preventDefault();
137007
+ if (e.stopPropagation) e.stopPropagation();
136970
137008
  }
136971
137009
 
136972
137010
  this.DocOnMouseUpTitle=function(e)
@@ -137102,7 +137140,7 @@ function HQChartScriptWorker()
137102
137140
 
137103
137141
 
137104
137142
 
137105
- var HQCHART_VERSION="1.1.13349";
137143
+ var HQCHART_VERSION="1.1.13357";
137106
137144
 
137107
137145
  function PrintHQChartVersion()
137108
137146
  {