hqchart 1.1.13754 → 1.1.13758

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.
@@ -6080,15 +6080,16 @@ this.LineWidth=1;this.Precision=2;//小数位数
6080
6080
  this.ValueTextColor='rgb(250,250,250)';this.IsShowCorssCursor=true;//画的时候是否显示十字光标
6081
6081
  this.GetLabelCallback;//绘制标题回调函数
6082
6082
  this.PointCount=1;this.ClassName='ChartDrawHLine';this.Font=14*GetDevicePixelRatio()+"px 微软雅黑";this.TextFont=12*GetDevicePixelRatio()+"px 微软雅黑";this.RightSpaceWidth=50;this.ButtonPosition=0;//按钮位置, 0=价格后面, 1=价格上面 2=价格上面 左对齐 3=垂直排列
6083
- this.ButtonBGColor='rgb(190,190,190)';this.ButtonSpace=3;this.TextMargin={Left:0,Right:0};this.AlwaysShowLab=false;//总是显示标签
6083
+ this.ButtonBGColor='rgb(190,190,190)';this.ButtonSpace=3;this.TextMargin={Left:0,Right:0,Top:0,Bottom:0,YOffset:4*GetDevicePixelRatio()};this.AlwaysShowLab=false;//总是显示标签
6084
6084
  this.Button={CloseIcon:{Text:'\uE62B',Color:'rgb(255,255,255)',Family:"iconfont",Size:16,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE,TooltipText:null,Margin:{Left:2,Right:2}},SettingIcon:{Text:'\uE623',Color:'rgb(255,255,255)',Family:"iconfont",Size:16,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING,TooltipText:null,Margin:{Left:2,Right:2}//修改ID, Text , TooltipText 可以外部定制按钮
6085
6085
  }};this.CustomButton=[];//自定义的按钮 { Text:'\ue62b', Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_BUTTON_1, TooltipText:null, Data:null }
6086
6086
  this.AryShowButton=[];//需要显示的按钮 { Data:, Width }
6087
6087
  this.AryButton=[];this.ExtendData;//扩展数据
6088
6088
  this.ShowPriceTextConfig={IsShow:[false,false,true],//[0]=left内 [1]=right内 [2]=right外
6089
- Font:[12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1',12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1']};//内部变量
6089
+ Font:[12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1',12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1']};this.LableInfo;//{ Position:2=右侧外部 }
6090
+ //内部变量
6090
6091
  this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;this.VerticalButtonInfo={Width:0,Height:0};//垂直按钮信息
6091
- 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(option.Font)this.Font=option.Font;if(option.ValueTextColor)this.ValueTextColor=option.ValueTextColor;if(option.ButtonBGColor)this.ButtonBGColor=option.ButtonBGColor;if(IFrameSplitOperator.IsNumber(option.ButtonPosition))this.ButtonPosition=option.ButtonPosition;if(IFrameSplitOperator.IsNumber(option.RightSpaceWidth))this.RightSpaceWidth=option.RightSpaceWidth;if(IFrameSplitOperator.IsBool(option.AlwaysShowLab))this.AlwaysShowLab=option.AlwaysShowLab;if(option.Button){var item=option.Button;if(item.CloseIcon){this.Button.CloseIcon=CloneData(item.CloseIcon);if(!this.Button.CloseIcon.ID)this.Button.CloseIcon.ID=JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE;}else if(item.CloseIcon===null){this.Button.CloseIcon=null;}if(item.SettingIcon){this.Button.SettingIcon=CloneData(item.SettingIcon);if(!this.Button.SettingIcon.ID)this.Button.SettingIcon.ID=JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING;}else if(item.SettingIcon===null){this.Button.SettingIcon=null;}}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;}}if(option.TextMargin){var item=option.TextMargin;if(IFrameSplitOperator.IsNumber(item.Left))this.TextMargin.Left=item.Left;if(IFrameSplitOperator.IsNumber(item.Right))this.TextMargin.Right=item.Right;}}};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;/*
6092
+ this.IsPointIn=this.IsPointIn_XYValue_Line;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(option.Font)this.Font=option.Font;if(option.ValueTextColor)this.ValueTextColor=option.ValueTextColor;if(option.ButtonBGColor)this.ButtonBGColor=option.ButtonBGColor;if(IFrameSplitOperator.IsNumber(option.ButtonPosition))this.ButtonPosition=option.ButtonPosition;if(IFrameSplitOperator.IsNumber(option.RightSpaceWidth))this.RightSpaceWidth=option.RightSpaceWidth;if(IFrameSplitOperator.IsBool(option.AlwaysShowLab))this.AlwaysShowLab=option.AlwaysShowLab;if(option.Button){var item=option.Button;if(item.CloseIcon){this.Button.CloseIcon=CloneData(item.CloseIcon);if(!this.Button.CloseIcon.ID)this.Button.CloseIcon.ID=JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE;}else if(item.CloseIcon===null){this.Button.CloseIcon=null;}if(item.SettingIcon){this.Button.SettingIcon=CloneData(item.SettingIcon);if(!this.Button.SettingIcon.ID)this.Button.SettingIcon.ID=JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING;}else if(item.SettingIcon===null){this.Button.SettingIcon=null;}}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;}}if(option.TextMargin){var item=option.TextMargin;if(IFrameSplitOperator.IsNumber(item.Left))this.TextMargin.Left=item.Left;if(IFrameSplitOperator.IsNumber(item.Right))this.TextMargin.Right=item.Right;if(IFrameSplitOperator.IsNumber(item.Top))this.TextMargin.Top=item.Top;if(IFrameSplitOperator.IsNumber(item.Bottom))this.TextMargin.Bottom=item.Bottom;if(IFrameSplitOperator.IsNumber(item.YOffset))this.TextMargin.YOffset=item.YOffset;}}};this.ExportStorageData=function(){var storageData;if(this.Super_ExportStorageData){storageData=this.Super_ExportStorageData();if(this.Label)storageData.Label=this.Label;}return storageData;};/*
6092
6093
  this.GetXYCoordinate=function()
6093
6094
  {
6094
6095
  if (this.IsFrameMinSize()) return null;
@@ -6098,21 +6099,23 @@ this.SetOption=function(option){if(this.Super_SetOption)this.Super_SetOption(opt
6098
6099
  }
6099
6100
  */this.IsDrawMain=function()//选中绘制在动态绘图上, 没有选中绘制在背景上
6100
6101
  {if(!this.GetActiveDrawPicture)return true;var active=this.GetActiveDrawPicture();if(active.Select.Guid==this.Guid)return false;return true;};this.MainDraw=function(){this.Draw();};//获取需要显示的按钮 系统按钮+自定义按钮
6101
- this.GetShowButton=function(){var aryButton=[];var item=this.Button.SettingIcon;if(item&&item.Text)aryButton.push({Data:item,Width:null});item=this.Button.CloseIcon;if(item&&item.Text)aryButton.push({Data:item,Width:null});if(IFrameSplitOperator.IsNonEmptyArray(this.CustomButton)){for(var i=0;i<this.CustomButton.length;++i){item=this.CustomButton[i];if(item&&item.Text)aryButton.push({Data:item,Width:null});}}return aryButton;};this.Draw=function(moveonPoint,mouseStatus){this.AryShowButton=[];this.LinePoint=[];this.AryButton=[];this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;this.VerticalButtonInfo.Width=0;this.VerticalButtonInfo.Height=0;if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint();if(!drawPoint||drawPoint.length!=1)return;if(!this.Frame)return;if(this.Value.length!=1)return;var bVisibleRange=this.IsYValueInFrame(this.Value[0].YValue);//是否在可视范围
6102
+ this.GetShowButton=function(){var aryButton=[];var item=this.Button.SettingIcon;if(item&&item.Text)aryButton.push({Data:item,Width:null});item=this.Button.CloseIcon;if(item&&item.Text)aryButton.push({Data:item,Width:null});if(IFrameSplitOperator.IsNonEmptyArray(this.CustomButton)){for(var i=0;i<this.CustomButton.length;++i){item=this.CustomButton[i];if(item&&item.Text)aryButton.push({Data:item,Width:null});}}return aryButton;};this.Draw=function(moveonPoint,mouseStatus){this.AryShowButton=[];this.LinePoint=[];this.AryButton=[];this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;this.LableInfo=null;this.VerticalButtonInfo.Width=0;this.VerticalButtonInfo.Height=0;if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint();if(!drawPoint||drawPoint.length!=1)return;if(!this.Frame)return;if(this.Value.length!=1)return;var bVisibleRange=this.IsYValueInFrame(this.Value[0].YValue);//是否在可视范围
6102
6103
  if(!this.AlwaysShowLab&&!bVisibleRange)return;var isHScreen=this.Frame.IsHScreen;var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();if(isHScreen){left=this.Frame.ChartBorder.GetTop();right=this.Frame.ChartBorder.GetBottom();}this.ClipFrame();//画线段
6103
6104
  if(bVisibleRange){this.Canvas.strokeStyle=this.LineColor;this.SetLineWidth();this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(drawPoint[0].X,left);this.Canvas.lineTo(drawPoint[0].X,right);}else{this.Canvas.moveTo(left,ToFixedPoint(drawPoint[0].Y));this.Canvas.lineTo(right,ToFixedPoint(drawPoint[0].Y));}this.Canvas.stroke();this.RestoreLineWidth();}//画水平线段
6104
- 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);if(bVisibleRange){var yValue=this.Frame.GetYData(drawPoint[0].Y,false);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);this.AryShowButton=this.GetShowButton();//获取按钮
6105
- //框架内的描述信息
6106
- if(labInfo&&bVisibleRange)this.DrawLab(labInfo,drawPoint[0].Y);//画中心点
6105
+ 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);if(bVisibleRange)//在可视范围内
6106
+ {var yValue=this.Frame.GetYData(drawPoint[0].Y,false);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);}}if(this.GetLabelCallback)this.LableInfo=this.GetLabelCallback(this);this.AryShowButton=this.GetShowButton();//获取按钮
6107
+ if(bVisibleRange)this.DrawInternalLabel(drawPoint[0].Y);//内部价格标签
6108
+ //画中心点
6107
6109
  if(bVisibleRange){var xCenter=left+(right-left)/2;var point={X:xCenter,Y:drawPoint[0].Y};this.DrawPoint([point]);}this.Canvas.restore();//外部右侧显示价格
6108
- if(this.ShowPriceTextConfig.IsShow[2]){var rtDraw={};this.CalculateButtonSize();this.DrawValueText(drawPoint[0].Y,rtDraw,labInfo);if(labInfo)this.DrawRightLab(labInfo,rtDraw);if(labInfo&&bVisibleRange)this.DrawCustomHLine(labInfo,drawPoint[0].Y);}//鼠标是否在按钮上
6109
- 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;//背景色
6110
- 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;if(drawLeft<rtLeftDraw.Left)drawLeft=rtLeftDraw.Left;var drawRight=drawLeft+labSize.Width;var drawTop=rtLeftDraw.Bottom;var lineSpace=0;if(IFrameSplitOperator.IsNumber(labInfo.LineSpace))lineSpace=labInfo.LineSpace;//背景色
6111
- var rtLab={Left:drawLeft,Top:drawTop,Width:labSize.Width,Height:labSize.Height};rtLab.Right=rtLab.Left+rtLab.Width;rtLab.Bottom=rtLab.Top+rtLab.Height;if(labInfo.BGColor){this.Canvas.fillStyle=labInfo.BGColor;this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.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,drawRight-1,yText+1);}yText+=labSize.LineHeight+lineSpace;}this.DrawVerticalButton(rtLab);};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;if(item.Width<0)continue;var y=this.Frame.GetYFromData(item.Value);var yFixed=ToFixedPoint(y);var xRight=right;if(IFrameSplitOperator.IsPlusNumber(item.Width)){if(item.Width<1)xRight=left+item.Width*(right-left);//0.3 百分比
6110
+ if(this.ShowPriceTextConfig.IsShow[2]){var rtDraw={};this.CalculateButtonSize();this.DrawValueText(drawPoint[0].Y,rtDraw);this.DrawRightLabel(rtDraw);if(bVisibleRange)this.DrawCustomHLine(drawPoint[0].Y);}//鼠标是否在按钮上
6111
+ 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+(lineCount-1)*lineSpace,NameWidth:maxNameWidth,TextWidth:maxTextWidth,LineHeight:lineHeight};if(labInfo.LabelMargin){var item=labInfo.LabelMargin;if(IFrameSplitOperator.IsNumber(item.Left))size.Width+=item.Left;if(IFrameSplitOperator.IsNumber(item.Right))size.Width+=item.Right;if(IFrameSplitOperator.IsNumber(item.Top))size.Height+=item.Top;if(IFrameSplitOperator.IsNumber(item.Bottom))size.Height+=item.Bottom;}return size;};//绘制窗口内部标签
6112
+ this.DrawInternalLabel=function(y){if(!this.LableInfo||!IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText))return;if(this.LableInfo.Position==2)return;var border=this.Frame.GetBorder();var left=border.Left;var right=border.Right;var labSize=this.CalculateLabSize(this.LableInfo);var drawLeft=right-labSize.Width;var drawRight=drawLeft+labSize.Width;var drawTop=y-labSize.Height-1;if(drawTop<=border.TopEx)drawTop=y+1;var rtLabel={Left:drawLeft,Right:drawRight,Top:drawTop,Width:labSize.Width,Height:labSize.Height};rtLabel.Bottom=rtLabel.Top+rtLabel.Height;this.DrawLabel(this.LableInfo,labSize,rtLabel);};//绘制标签页
6113
+ this.DrawLabel=function(labelInfo,labelSize,rtLabel){//背景色
6114
+ if(labelInfo.BGColor){this.Canvas.fillStyle=labelInfo.BGColor;this.Canvas.fillRect(ToFixedRect(rtLabel.Left),ToFixedRect(rtLabel.Top),ToFixedRect(rtLabel.Width),ToFixedRect(rtLabel.Height));}var labelMargin=labelInfo.LabelMargin;var lineSpace=0;if(IFrameSplitOperator.IsNumber(labelInfo.LineSpace))lineSpace=labelInfo.LineSpace;var yText=rtLabel.Top;var xText=rtLabel.Left;var yRightText=rtLabel.Right;if(labelMargin){if(IFrameSplitOperator.IsNumber(labelMargin.Left))xText+=labelMargin.Left;if(IFrameSplitOperator.IsNumber(labelMargin.Right))yRightText-=labelMargin.Right;if(IFrameSplitOperator.IsNumber(labelMargin.Top))yText+=labelMargin.Top;}this.Canvas.font=this.TextFont;this.Canvas.textBaseline="top";for(var i=0;i<labelInfo.AryText.length;++i){if(i>0)yText+=lineSpace;var item=labelInfo.AryText[i];if(item.Name){this.Canvas.textAlign="left";this.Canvas.fillStyle=item.NameColor;this.Canvas.fillText(item.Name,xText,yText);}if(item.Text){this.Canvas.textAlign="right";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Text,yRightText,yText);}yText+=labelSize.LineHeight;}};this.DrawRightLabel=function(rtLeftDraw){if(!this.LableInfo||!IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText))return;if(this.LableInfo.Position!=2)return;var labSize=this.CalculateLabSize(this.LableInfo);var border=this.Frame.GetBorder();var drawLeft=rtLeftDraw.Right-labSize.Width;if(drawLeft<rtLeftDraw.Left)drawLeft=rtLeftDraw.Left;var drawRight=drawLeft+labSize.Width;var drawTop=rtLeftDraw.Bottom;var rtLabel={Left:drawLeft,Right:drawRight,Top:drawTop,Width:labSize.Width,Height:labSize.Height};rtLabel.Bottom=rtLabel.Top+rtLabel.Height;if(rtLabel.Bottom>border.Bottom)//标签页超过窗口底部 绘制到价格标签上面
6115
+ {rtLabel.Bottom=rtLeftDraw.Top;rtLabel.Top=rtLabel.Bottom-rtLabel.Height;}this.DrawLabel(this.LableInfo,labSize,rtLabel);this.DrawVerticalButton(rtLabel);};this.DrawCustomHLine=function(yLine){if(!this.LableInfo)return;if(!IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.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<this.LableInfo.AryLine.length;++i){var item=this.LableInfo.AryLine[i];if(!IFrameSplitOperator.IsNumber(item.Value))continue;if(item.Width<0)continue;var y=this.Frame.GetYFromData(item.Value);var yFixed=ToFixedPoint(y);var xRight=right;if(IFrameSplitOperator.IsPlusNumber(item.Width)){if(item.Width<1)xRight=left+item.Width*(right-left);//0.3 百分比
6112
6116
  else xRight=left+item.Width*pixelRatio;//>1 实际数值就是长度
6113
- }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();var top=this.Frame.ChartBorder.GetTopEx();var bottom=this.Frame.ChartBorder.GetBottomEx();var pixelTatio=GetDevicePixelRatio();if(labInfo&&IFrameSplitOperator.IsNumber(labInfo.TopOffset))top-=labInfo.TopOffset;if(labInfo&&IFrameSplitOperator.IsNumber(labInfo.BottomOffset))bottom+=labInfo.BottomOffset;var yValue=this.Frame.GetYData(y,false);var strValue=yValue.toFixed(this.Precision);if(labInfo&&labInfo.PriceSuffixText)strValue+=labInfo.PriceSuffixText;var bVisibleRange=true;if(y<top){y=top;bVisibleRange=false;}else if(y>bottom){y=bottom;bVisibleRange=false;}if(this.RightSpaceWidth>0){if(!bVisibleRange)this.Canvas.setLineDash([2*pixelTatio,3*pixelTatio]);//虚线
6114
- 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();if(!bVisibleRange)this.Canvas.setLineDash([]);}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;
6115
- rtBG.Bottom=rtBG.Top+rtBG.Height;rtBG.Width+=this.TextMargin.Left+this.TextMargin.Right;rtBG.Right=rtBG.Left+rtBG.Width;var xText=rtBG.Left+this.TextMargin.Left+2;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,xText,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(!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton))return;var totalWidth=0;for(var i=0;i<this.AryShowButton.length;++i){var item=this.AryShowButton[i];var icon=item.Data;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;item.Width=this.Canvas.measureText(icon.Text).width+2;item.Height=item.Width;if(icon.Margin){var margin=icon.Margin;if(IFrameSplitOperator.IsNumber(margin.Left))item.Width+=margin.Left;if(IFrameSplitOperator.IsNumber(margin.Right))item.Width+=margin.Right;if(IFrameSplitOperator.IsNumber(margin.Top))item.Height+=margin.Top;if(IFrameSplitOperator.IsNumber(margin.Bottom))item.Height+=margin.Bottom;}if(this.VerticalButtonInfo.Width<item.Width)this.VerticalButtonInfo.Width=item.Width;this.VerticalButtonInfo.Height+=item.Height;totalWidth+=item.Width;}this.ButtonBGWidth=totalWidth;};//垂直排列按钮
6117
+ }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&&this.LableInfo.VLine){var item=this.LableInfo.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){var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();var top=this.Frame.ChartBorder.GetTopEx();var bottom=this.Frame.ChartBorder.GetBottomEx();var pixelTatio=GetDevicePixelRatio();var labInfo=this.LabelInfo;if(labInfo&&IFrameSplitOperator.IsNumber(labInfo.TopOffset))top-=labInfo.TopOffset;if(labInfo&&IFrameSplitOperator.IsNumber(labInfo.BottomOffset))bottom+=labInfo.BottomOffset;var yValue=this.Frame.GetYData(y,false);var strValue=yValue.toFixed(this.Precision);if(labInfo&&labInfo.PriceSuffixText)strValue+=labInfo.PriceSuffixText;var bVisibleRange=true;if(y<top){y=top;bVisibleRange=false;}else if(y>bottom){y=bottom;bVisibleRange=false;}if(this.RightSpaceWidth>0){if(!bVisibleRange)this.Canvas.setLineDash([2*pixelTatio,3*pixelTatio]);//虚线
6118
+ 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();if(!bVisibleRange)this.Canvas.setLineDash([]);}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,YCenter:y,Width:textWidth,Height:lineHeight};rtBG.Height+=this.TextMargin.Top+this.TextMargin.Bottom;rtBG.Width+=this.TextMargin.Left+this.TextMargin.Right;rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Top=rtBG.YCenter-rtBG.Height/2;rtBG.Bottom=rtBG.Top+rtBG.Height;var xText=rtBG.Left+this.TextMargin.Left;var yText=rtBG.Top+this.TextMargin.Top+this.TextMargin.YOffset;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="top";this.Canvas.fillText(strValue,xText,yText);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(!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton))return;var totalWidth=0;for(var i=0;i<this.AryShowButton.length;++i){var item=this.AryShowButton[i];var icon=item.Data;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;item.Width=this.Canvas.measureText(icon.Text).width+2;item.Height=item.Width;if(icon.Margin){var margin=icon.Margin;if(IFrameSplitOperator.IsNumber(margin.Left))item.Width+=margin.Left;if(IFrameSplitOperator.IsNumber(margin.Right))item.Width+=margin.Right;if(IFrameSplitOperator.IsNumber(margin.Top))item.Height+=margin.Top;if(IFrameSplitOperator.IsNumber(margin.Bottom))item.Height+=margin.Bottom;}if(this.VerticalButtonInfo.Width<item.Width)this.VerticalButtonInfo.Width=item.Width;this.VerticalButtonInfo.Height+=item.Height;totalWidth+=item.Width;}this.ButtonBGWidth=totalWidth;};//垂直排列按钮
6116
6119
  this.DrawVerticalButton=function(rtLab){if(this.ButtonPosition!=3)return;if(!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton))return;if(this.VerticalButtonInfo.Height<=0)return;var rtBG={Left:rtLab.Right,Top:rtLab.Top,Width:this.VerticalButtonInfo.Width,Height:this.VerticalButtonInfo.Height};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));var pixelRatio=GetDevicePixelRatio();var yTop=rtLab.Top;for(var i=0;i<this.AryShowButton.length;++i){var item=this.AryShowButton[i];var icon=item.Data;var rtButton={Left:rtBG.Left,Top:yTop,Width:this.VerticalButtonInfo.Width,Height:item.Height};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 font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(icon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:icon.ID,TooltipText:icon.TooltipText,Data:icon.Data});yTop=rtButton.Bottom;}};this.DrawButton=function(drawTop,drawLeft,drawHeight,rtDraw){if(!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton))return;if(this.ButtonPosition==3)return;//垂直按钮在DrawVerticalButton()调用
6117
6120
  if(this.ButtonPosition==1){drawTop-=drawHeight;var chartWidth=this.Frame.ChartBorder.GetChartWidth();var chartLeft=this.Frame.ChartBorder.GetRight()+this.RightSpaceWidth;if(drawLeft+this.ButtonBGWidth>chartWidth)//右边不够了 往左移动
6118
6121
  {drawLeft=chartWidth-this.ButtonBGWidth;}if(rtDraw.Left>drawLeft)drawLeft=rtDraw.Left;}else if(this.ButtonPosition==2){drawTop-=drawHeight;drawLeft=rtDraw.Left;}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));var pixelRatio=GetDevicePixelRatio();for(var i=0;i<this.AryShowButton.length;++i){var item=this.AryShowButton[i];var icon=item.Data;var rtButton={Left:left,Top:drawTop,Width:item.Width,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 font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(icon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:icon.ID,TooltipText:icon.TooltipText,Data:icon.Data});left=rtButton.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,Data:item.Data};}}return null;};}//趋势线
@@ -13788,7 +13791,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
13788
13791
  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);};}/********************************************************************************
13789
13792
  * 版本信息输出
13790
13793
  *
13791
- */var HQCHART_VERSION="1.1.13753";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
13794
+ */var HQCHART_VERSION="1.1.13757";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
13792
13795
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
13793
13796
  // BaseIndex:BaseIndex,
13794
13797
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13754",
3
+ "version": "1.1.13758",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -58551,7 +58551,7 @@ function ChartDrawHLine()
58551
58551
  this.ButtonBGColor='rgb(190,190,190)';
58552
58552
  this.ButtonSpace=3;
58553
58553
 
58554
- this.TextMargin={ Left:0, Right:0 };
58554
+ this.TextMargin={ Left:0, Right:0, Top:0, Bottom:0, YOffset:4*GetDevicePixelRatio() };
58555
58555
 
58556
58556
  this.AlwaysShowLab=false; //总是显示标签
58557
58557
 
@@ -58575,7 +58575,9 @@ function ChartDrawHLine()
58575
58575
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
58576
58576
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
58577
58577
  ],
58578
- };
58578
+ };
58579
+
58580
+ this.LableInfo; //{ Position:2=右侧外部 }
58579
58581
 
58580
58582
  //内部变量
58581
58583
  this.ColseButtonSize=0;
@@ -58583,7 +58585,7 @@ function ChartDrawHLine()
58583
58585
  this.ButtonBGWidth=0;
58584
58586
  this.VerticalButtonInfo={ Width:0, Height:0 }; //垂直按钮信息
58585
58587
 
58586
-
58588
+ this.IsPointIn=this.IsPointIn_XYValue_Line;
58587
58589
 
58588
58590
  this.SetOption=function(option)
58589
58591
  {
@@ -58644,6 +58646,9 @@ function ChartDrawHLine()
58644
58646
  var item=option.TextMargin;
58645
58647
  if (IFrameSplitOperator.IsNumber(item.Left)) this.TextMargin.Left=item.Left;
58646
58648
  if (IFrameSplitOperator.IsNumber(item.Right)) this.TextMargin.Right=item.Right;
58649
+ if (IFrameSplitOperator.IsNumber(item.Top)) this.TextMargin.Top=item.Top;
58650
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) this.TextMargin.Bottom=item.Bottom;
58651
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) this.TextMargin.YOffset=item.YOffset;
58647
58652
  }
58648
58653
  }
58649
58654
  }
@@ -58660,10 +58665,6 @@ function ChartDrawHLine()
58660
58665
  return storageData;
58661
58666
  }
58662
58667
 
58663
-
58664
- this.IsPointIn=this.IsPointIn_XYValue_Line;
58665
-
58666
-
58667
58668
  /*
58668
58669
  this.GetXYCoordinate=function()
58669
58670
  {
@@ -58720,7 +58721,7 @@ function ChartDrawHLine()
58720
58721
  this.ColseButtonSize=0;
58721
58722
  this.SettingButtonSize=0;
58722
58723
  this.ButtonBGWidth=0;
58723
-
58724
+ this.LableInfo=null;
58724
58725
  this.VerticalButtonInfo.Width=0;
58725
58726
  this.VerticalButtonInfo.Height=0;
58726
58727
 
@@ -58783,7 +58784,7 @@ function ChartDrawHLine()
58783
58784
  }
58784
58785
  this.LinePoint.push(line);
58785
58786
 
58786
- if (bVisibleRange)
58787
+ if (bVisibleRange) //在可视范围内
58787
58788
  {
58788
58789
  var yValue=this.Frame.GetYData(drawPoint[0].Y, false);
58789
58790
  var strPrice=yValue.toFixed(this.Precision);
@@ -58797,15 +58798,11 @@ function ChartDrawHLine()
58797
58798
  this.DrawPriceText(strPrice, line.Start, line.End, 1);
58798
58799
  }
58799
58800
  }
58800
-
58801
- var labInfo;
58802
- if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
58801
+
58802
+ if (this.GetLabelCallback) this.LableInfo=this.GetLabelCallback(this);
58803
58803
 
58804
58804
  this.AryShowButton=this.GetShowButton(); //获取按钮
58805
-
58806
- //框架内的描述信息
58807
- if (labInfo && bVisibleRange)
58808
- this.DrawLab(labInfo, drawPoint[0].Y);
58805
+ if (bVisibleRange) this.DrawInternalLabel(drawPoint[0].Y); //内部价格标签
58809
58806
 
58810
58807
  //画中心点
58811
58808
  if (bVisibleRange)
@@ -58822,11 +58819,12 @@ function ChartDrawHLine()
58822
58819
  {
58823
58820
  var rtDraw={ };
58824
58821
  this.CalculateButtonSize();
58825
- this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
58826
- if (labInfo) this.DrawRightLab(labInfo, rtDraw);
58827
- if (labInfo && bVisibleRange) this.DrawCustomHLine(labInfo, drawPoint[0].Y);
58822
+ this.DrawValueText(drawPoint[0].Y, rtDraw);
58823
+ this.DrawRightLabel(rtDraw);
58824
+ if (bVisibleRange) this.DrawCustomHLine(drawPoint[0].Y);
58828
58825
  }
58829
58826
 
58827
+
58830
58828
  //鼠标是否在按钮上
58831
58829
  if (moveonPoint && mouseStatus)
58832
58830
  {
@@ -58874,113 +58872,130 @@ function ChartDrawHLine()
58874
58872
  ++lineCount;
58875
58873
  }
58876
58874
 
58877
- var size={ Width:maxWidth, Height: lineCount*(lineHeight+lineSpace)+lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
58875
+ var size={ Width:maxWidth, Height:lineCount*lineHeight+(lineCount-1)*lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
58876
+ if (labInfo.LabelMargin)
58877
+ {
58878
+ var item=labInfo.LabelMargin;
58879
+ if (IFrameSplitOperator.IsNumber(item.Left)) size.Width+=item.Left;
58880
+ if (IFrameSplitOperator.IsNumber(item.Right)) size.Width+=item.Right;
58881
+ if (IFrameSplitOperator.IsNumber(item.Top)) size.Height+=item.Top;
58882
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) size.Height+=item.Bottom;
58883
+ }
58878
58884
 
58879
58885
  return size;
58880
58886
  }
58881
58887
 
58882
- this.DrawLab=function(labInfo, y)
58888
+ //绘制窗口内部标签
58889
+ this.DrawInternalLabel=function(y)
58883
58890
  {
58884
- if (!labInfo) return;
58885
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
58886
- if (labInfo.Position===2) return;
58891
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText)) return;
58892
+ if (this.LableInfo.Position==2) return;
58887
58893
 
58888
- var left=this.Frame.ChartBorder.GetLeft();
58889
- var right=this.Frame.ChartBorder.GetRight();
58890
- var labSize=this.CalculateLabSize(labInfo);
58894
+ var border=this.Frame.GetBorder();
58895
+ var left=border.Left;
58896
+ var right=border.Right;
58897
+ var labSize=this.CalculateLabSize(this.LableInfo);
58891
58898
  var drawLeft=right-labSize.Width;
58899
+ var drawRight=drawLeft+labSize.Width;
58892
58900
  var drawTop=y-labSize.Height-1;
58901
+ if (drawTop<=border.TopEx) drawTop=y+1;
58902
+
58903
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
58904
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
58893
58905
 
58906
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
58907
+ }
58908
+
58909
+ //绘制标签页
58910
+ this.DrawLabel=function(labelInfo, labelSize, rtLabel)
58911
+ {
58894
58912
  //背景色
58895
- if (labInfo.BGColor)
58913
+ if (labelInfo.BGColor)
58896
58914
  {
58897
- this.Canvas.fillStyle=labInfo.BGColor;
58898
- var rtTop=y-labSize.Height-4;
58899
- this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(right+drawLeft),ToFixedRect(y-rtTop));
58915
+ this.Canvas.fillStyle=labelInfo.BGColor;
58916
+ this.Canvas.fillRect(ToFixedRect(rtLabel.Left),ToFixedRect(rtLabel.Top),ToFixedRect(rtLabel.Width),ToFixedRect(rtLabel.Height));
58900
58917
  }
58901
58918
 
58902
- var yText=drawTop;
58903
- for(var i=0;i<labInfo.AryText.length;++i)
58919
+ var labelMargin=labelInfo.LabelMargin;
58920
+ var lineSpace=0;
58921
+ if (IFrameSplitOperator.IsNumber(labelInfo.LineSpace)) lineSpace=labelInfo.LineSpace;
58922
+
58923
+ var yText=rtLabel.Top;
58924
+ var xText=rtLabel.Left;
58925
+ var yRightText=rtLabel.Right;
58926
+
58927
+ if (labelMargin)
58904
58928
  {
58905
- var item=labInfo.AryText[i];
58929
+ if (IFrameSplitOperator.IsNumber(labelMargin.Left)) xText+=labelMargin.Left;
58930
+ if (IFrameSplitOperator.IsNumber(labelMargin.Right)) yRightText-=labelMargin.Right;
58931
+ if (IFrameSplitOperator.IsNumber(labelMargin.Top)) yText+=labelMargin.Top;
58932
+
58933
+ }
58934
+
58935
+ this.Canvas.font=this.TextFont;
58936
+ this.Canvas.textBaseline="top";
58937
+ for(var i=0;i<labelInfo.AryText.length;++i)
58938
+ {
58939
+ if (i>0) yText+=lineSpace;
58940
+ var item=labelInfo.AryText[i];
58906
58941
  if (item.Name)
58907
58942
  {
58943
+ this.Canvas.textAlign="left";
58908
58944
  this.Canvas.fillStyle=item.NameColor;
58909
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
58945
+ this.Canvas.fillText(item.Name,xText,yText);
58910
58946
  }
58911
58947
 
58912
58948
  if (item.Text)
58913
58949
  {
58950
+ this.Canvas.textAlign="right";
58914
58951
  this.Canvas.fillStyle=item.TextColor;
58915
- this.Canvas.fillText(item.Text,drawLeft+labSize.NameWidth+1,yText+1);
58952
+ this.Canvas.fillText(item.Text,yRightText,yText);
58916
58953
  }
58917
58954
 
58918
- yText+=labSize.LineHeight;
58955
+ yText+=labelSize.LineHeight;
58919
58956
  }
58920
58957
  }
58921
58958
 
58922
- this.DrawRightLab=function(labInfo, rtLeftDraw)
58959
+ this.DrawRightLabel=function(rtLeftDraw)
58923
58960
  {
58924
- if (!labInfo) return;
58925
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
58926
- if (labInfo.Position!=2) return;
58927
- var labSize=this.CalculateLabSize(labInfo);
58961
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText)) return;
58962
+ if (this.LableInfo.Position!=2) return;
58963
+
58964
+ var labSize=this.CalculateLabSize(this.LableInfo);
58965
+ var border=this.Frame.GetBorder();
58928
58966
 
58929
58967
  var drawLeft=rtLeftDraw.Right-labSize.Width;
58930
58968
  if (drawLeft<rtLeftDraw.Left) drawLeft=rtLeftDraw.Left;
58931
58969
  var drawRight=drawLeft+labSize.Width;
58970
+
58932
58971
  var drawTop=rtLeftDraw.Bottom;
58933
- var lineSpace=0;
58934
- if (IFrameSplitOperator.IsNumber(labInfo.LineSpace)) lineSpace=labInfo.LineSpace;
58935
58972
 
58936
- //背景色
58937
- var rtLab={ Left:drawLeft, Top:drawTop, Width:labSize.Width, Height:labSize.Height }
58938
- rtLab.Right=rtLab.Left+rtLab.Width;
58939
- rtLab.Bottom=rtLab.Top+rtLab.Height;
58940
- if (labInfo.BGColor)
58973
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
58974
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
58975
+ if (rtLabel.Bottom>border.Bottom) //标签页超过窗口底部 绘制到价格标签上面
58941
58976
  {
58942
- this.Canvas.fillStyle=labInfo.BGColor;
58943
- this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.Height));
58977
+ rtLabel.Bottom=rtLeftDraw.Top;
58978
+ rtLabel.Top=rtLabel.Bottom-rtLabel.Height;
58944
58979
  }
58945
58980
 
58946
- var yText=drawTop+1+lineSpace;
58947
- this.Canvas.textBaseline="top";
58948
- for(var i=0;i<labInfo.AryText.length;++i)
58949
- {
58950
- var item=labInfo.AryText[i];
58951
- if (item.Name)
58952
- {
58953
- this.Canvas.textAlign="left";
58954
- this.Canvas.fillStyle=item.NameColor;
58955
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
58956
- }
58957
-
58958
- if (item.Text)
58959
- {
58960
- this.Canvas.textAlign="right";
58961
- this.Canvas.fillStyle=item.TextColor;
58962
- this.Canvas.fillText(item.Text,drawRight-1,yText+1);
58963
- }
58964
-
58965
- yText+=labSize.LineHeight+lineSpace;
58966
- }
58967
-
58968
- this.DrawVerticalButton(rtLab);
58981
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
58982
+
58983
+ this.DrawVerticalButton(rtLabel);
58969
58984
  }
58970
58985
 
58971
- this.DrawCustomHLine=function(labInfo, yLine)
58986
+ this.DrawCustomHLine=function(yLine)
58972
58987
  {
58973
- if (!labInfo) return;
58974
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryLine)) return;
58988
+ if (!this.LableInfo) return;
58989
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryLine)) return;
58975
58990
 
58976
58991
  var left=this.Frame.ChartBorder.GetLeft();
58977
58992
  var right=this.Frame.ChartBorder.GetRight();
58978
58993
  var pixelRatio=GetDevicePixelRatio();
58979
58994
 
58980
58995
  var yMax=yLine, yMin=yLine;
58981
- for(var i=0;i<labInfo.AryLine.length;++i)
58996
+ for(var i=0;i<this.LableInfo.AryLine.length;++i)
58982
58997
  {
58983
- var item=labInfo.AryLine[i];
58998
+ var item=this.LableInfo.AryLine[i];
58984
58999
  if (!IFrameSplitOperator.IsNumber(item.Value)) continue;
58985
59000
  if (item.Width<0) continue;
58986
59001
 
@@ -59005,9 +59020,9 @@ function ChartDrawHLine()
59005
59020
  if (yMin>yFixed) yMin=yFixed;
59006
59021
  }
59007
59022
 
59008
- if (yMax!=yMin && labInfo.VLine)
59023
+ if (yMax!=yMin && this.LableInfo.VLine)
59009
59024
  {
59010
- var item=labInfo.VLine;
59025
+ var item=this.LableInfo.VLine;
59011
59026
  var x=left+20*pixelRatio;
59012
59027
  if (IFrameSplitOperator.IsNumber(item.XOffset)) x=left+item.XOffset*pixelRatio;
59013
59028
  x=ToFixedPoint(x);
@@ -59021,14 +59036,14 @@ function ChartDrawHLine()
59021
59036
  }
59022
59037
  }
59023
59038
 
59024
- this.DrawValueText=function(y, rtDraw, labInfo)
59039
+ this.DrawValueText=function(y, rtDraw)
59025
59040
  {
59026
59041
  var left=this.Frame.ChartBorder.GetLeft();
59027
59042
  var right=this.Frame.ChartBorder.GetRight();
59028
59043
  var top=this.Frame.ChartBorder.GetTopEx();
59029
59044
  var bottom=this.Frame.ChartBorder.GetBottomEx();
59030
59045
  var pixelTatio = GetDevicePixelRatio();
59031
-
59046
+ var labInfo=this.LabelInfo;
59032
59047
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
59033
59048
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
59034
59049
 
@@ -59063,12 +59078,15 @@ function ChartDrawHLine()
59063
59078
  this.Canvas.font=this.Font;
59064
59079
  var textWidth=this.Canvas.measureText(strValue).width;
59065
59080
  var lineHeight=this.GetFontHeight();
59066
- var rtBG={ Left:right+this.RightSpaceWidth, Top:y- lineHeight/2, Width:textWidth+4, Height:lineHeight };
59067
- //rtBG.Right=rtBG.Left+rtBG.Width;
59068
- rtBG.Bottom=rtBG.Top+rtBG.Height;
59081
+ var rtBG={ Left:right+this.RightSpaceWidth, YCenter:y, Width:textWidth, Height:lineHeight };
59082
+ rtBG.Height+=(this.TextMargin.Top+this.TextMargin.Bottom);
59069
59083
  rtBG.Width+=(this.TextMargin.Left+this.TextMargin.Right);
59070
59084
  rtBG.Right=rtBG.Left+rtBG.Width;
59071
- var xText=rtBG.Left+this.TextMargin.Left+2;
59085
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
59086
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59087
+
59088
+ var xText=rtBG.Left+this.TextMargin.Left;
59089
+ var yText=rtBG.Top+this.TextMargin.Top+this.TextMargin.YOffset;
59072
59090
 
59073
59091
  if (this.ButtonPosition==1)
59074
59092
  {
@@ -59081,8 +59099,8 @@ function ChartDrawHLine()
59081
59099
 
59082
59100
  this.Canvas.fillStyle=this.ValueTextColor
59083
59101
  this.Canvas.textAlign="left";
59084
- this.Canvas.textBaseline="middle";
59085
- this.Canvas.fillText(strValue,xText,y);
59102
+ this.Canvas.textBaseline="top";
59103
+ this.Canvas.fillText(strValue,xText,yText);
59086
59104
 
59087
59105
  rtDraw.Left=rtBG.Left;
59088
59106
  rtDraw.Top=rtBG.Top;
@@ -62476,7 +62476,7 @@ function ChartDrawHLine()
62476
62476
  this.ButtonBGColor='rgb(190,190,190)';
62477
62477
  this.ButtonSpace=3;
62478
62478
 
62479
- this.TextMargin={ Left:0, Right:0 };
62479
+ this.TextMargin={ Left:0, Right:0, Top:0, Bottom:0, YOffset:4*GetDevicePixelRatio() };
62480
62480
 
62481
62481
  this.AlwaysShowLab=false; //总是显示标签
62482
62482
 
@@ -62500,7 +62500,9 @@ function ChartDrawHLine()
62500
62500
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
62501
62501
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
62502
62502
  ],
62503
- };
62503
+ };
62504
+
62505
+ this.LableInfo; //{ Position:2=右侧外部 }
62504
62506
 
62505
62507
  //内部变量
62506
62508
  this.ColseButtonSize=0;
@@ -62508,7 +62510,7 @@ function ChartDrawHLine()
62508
62510
  this.ButtonBGWidth=0;
62509
62511
  this.VerticalButtonInfo={ Width:0, Height:0 }; //垂直按钮信息
62510
62512
 
62511
-
62513
+ this.IsPointIn=this.IsPointIn_XYValue_Line;
62512
62514
 
62513
62515
  this.SetOption=function(option)
62514
62516
  {
@@ -62569,6 +62571,9 @@ function ChartDrawHLine()
62569
62571
  var item=option.TextMargin;
62570
62572
  if (IFrameSplitOperator.IsNumber(item.Left)) this.TextMargin.Left=item.Left;
62571
62573
  if (IFrameSplitOperator.IsNumber(item.Right)) this.TextMargin.Right=item.Right;
62574
+ if (IFrameSplitOperator.IsNumber(item.Top)) this.TextMargin.Top=item.Top;
62575
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) this.TextMargin.Bottom=item.Bottom;
62576
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) this.TextMargin.YOffset=item.YOffset;
62572
62577
  }
62573
62578
  }
62574
62579
  }
@@ -62585,10 +62590,6 @@ function ChartDrawHLine()
62585
62590
  return storageData;
62586
62591
  }
62587
62592
 
62588
-
62589
- this.IsPointIn=this.IsPointIn_XYValue_Line;
62590
-
62591
-
62592
62593
  /*
62593
62594
  this.GetXYCoordinate=function()
62594
62595
  {
@@ -62645,7 +62646,7 @@ function ChartDrawHLine()
62645
62646
  this.ColseButtonSize=0;
62646
62647
  this.SettingButtonSize=0;
62647
62648
  this.ButtonBGWidth=0;
62648
-
62649
+ this.LableInfo=null;
62649
62650
  this.VerticalButtonInfo.Width=0;
62650
62651
  this.VerticalButtonInfo.Height=0;
62651
62652
 
@@ -62708,7 +62709,7 @@ function ChartDrawHLine()
62708
62709
  }
62709
62710
  this.LinePoint.push(line);
62710
62711
 
62711
- if (bVisibleRange)
62712
+ if (bVisibleRange) //在可视范围内
62712
62713
  {
62713
62714
  var yValue=this.Frame.GetYData(drawPoint[0].Y, false);
62714
62715
  var strPrice=yValue.toFixed(this.Precision);
@@ -62722,15 +62723,11 @@ function ChartDrawHLine()
62722
62723
  this.DrawPriceText(strPrice, line.Start, line.End, 1);
62723
62724
  }
62724
62725
  }
62725
-
62726
- var labInfo;
62727
- if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
62726
+
62727
+ if (this.GetLabelCallback) this.LableInfo=this.GetLabelCallback(this);
62728
62728
 
62729
62729
  this.AryShowButton=this.GetShowButton(); //获取按钮
62730
-
62731
- //框架内的描述信息
62732
- if (labInfo && bVisibleRange)
62733
- this.DrawLab(labInfo, drawPoint[0].Y);
62730
+ if (bVisibleRange) this.DrawInternalLabel(drawPoint[0].Y); //内部价格标签
62734
62731
 
62735
62732
  //画中心点
62736
62733
  if (bVisibleRange)
@@ -62747,11 +62744,12 @@ function ChartDrawHLine()
62747
62744
  {
62748
62745
  var rtDraw={ };
62749
62746
  this.CalculateButtonSize();
62750
- this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
62751
- if (labInfo) this.DrawRightLab(labInfo, rtDraw);
62752
- if (labInfo && bVisibleRange) this.DrawCustomHLine(labInfo, drawPoint[0].Y);
62747
+ this.DrawValueText(drawPoint[0].Y, rtDraw);
62748
+ this.DrawRightLabel(rtDraw);
62749
+ if (bVisibleRange) this.DrawCustomHLine(drawPoint[0].Y);
62753
62750
  }
62754
62751
 
62752
+
62755
62753
  //鼠标是否在按钮上
62756
62754
  if (moveonPoint && mouseStatus)
62757
62755
  {
@@ -62799,113 +62797,130 @@ function ChartDrawHLine()
62799
62797
  ++lineCount;
62800
62798
  }
62801
62799
 
62802
- var size={ Width:maxWidth, Height: lineCount*(lineHeight+lineSpace)+lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
62800
+ var size={ Width:maxWidth, Height:lineCount*lineHeight+(lineCount-1)*lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
62801
+ if (labInfo.LabelMargin)
62802
+ {
62803
+ var item=labInfo.LabelMargin;
62804
+ if (IFrameSplitOperator.IsNumber(item.Left)) size.Width+=item.Left;
62805
+ if (IFrameSplitOperator.IsNumber(item.Right)) size.Width+=item.Right;
62806
+ if (IFrameSplitOperator.IsNumber(item.Top)) size.Height+=item.Top;
62807
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) size.Height+=item.Bottom;
62808
+ }
62803
62809
 
62804
62810
  return size;
62805
62811
  }
62806
62812
 
62807
- this.DrawLab=function(labInfo, y)
62813
+ //绘制窗口内部标签
62814
+ this.DrawInternalLabel=function(y)
62808
62815
  {
62809
- if (!labInfo) return;
62810
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
62811
- if (labInfo.Position===2) return;
62816
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText)) return;
62817
+ if (this.LableInfo.Position==2) return;
62812
62818
 
62813
- var left=this.Frame.ChartBorder.GetLeft();
62814
- var right=this.Frame.ChartBorder.GetRight();
62815
- var labSize=this.CalculateLabSize(labInfo);
62819
+ var border=this.Frame.GetBorder();
62820
+ var left=border.Left;
62821
+ var right=border.Right;
62822
+ var labSize=this.CalculateLabSize(this.LableInfo);
62816
62823
  var drawLeft=right-labSize.Width;
62824
+ var drawRight=drawLeft+labSize.Width;
62817
62825
  var drawTop=y-labSize.Height-1;
62826
+ if (drawTop<=border.TopEx) drawTop=y+1;
62827
+
62828
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
62829
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
62818
62830
 
62831
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
62832
+ }
62833
+
62834
+ //绘制标签页
62835
+ this.DrawLabel=function(labelInfo, labelSize, rtLabel)
62836
+ {
62819
62837
  //背景色
62820
- if (labInfo.BGColor)
62838
+ if (labelInfo.BGColor)
62821
62839
  {
62822
- this.Canvas.fillStyle=labInfo.BGColor;
62823
- var rtTop=y-labSize.Height-4;
62824
- this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(right+drawLeft),ToFixedRect(y-rtTop));
62840
+ this.Canvas.fillStyle=labelInfo.BGColor;
62841
+ this.Canvas.fillRect(ToFixedRect(rtLabel.Left),ToFixedRect(rtLabel.Top),ToFixedRect(rtLabel.Width),ToFixedRect(rtLabel.Height));
62825
62842
  }
62826
62843
 
62827
- var yText=drawTop;
62828
- for(var i=0;i<labInfo.AryText.length;++i)
62844
+ var labelMargin=labelInfo.LabelMargin;
62845
+ var lineSpace=0;
62846
+ if (IFrameSplitOperator.IsNumber(labelInfo.LineSpace)) lineSpace=labelInfo.LineSpace;
62847
+
62848
+ var yText=rtLabel.Top;
62849
+ var xText=rtLabel.Left;
62850
+ var yRightText=rtLabel.Right;
62851
+
62852
+ if (labelMargin)
62829
62853
  {
62830
- var item=labInfo.AryText[i];
62854
+ if (IFrameSplitOperator.IsNumber(labelMargin.Left)) xText+=labelMargin.Left;
62855
+ if (IFrameSplitOperator.IsNumber(labelMargin.Right)) yRightText-=labelMargin.Right;
62856
+ if (IFrameSplitOperator.IsNumber(labelMargin.Top)) yText+=labelMargin.Top;
62857
+
62858
+ }
62859
+
62860
+ this.Canvas.font=this.TextFont;
62861
+ this.Canvas.textBaseline="top";
62862
+ for(var i=0;i<labelInfo.AryText.length;++i)
62863
+ {
62864
+ if (i>0) yText+=lineSpace;
62865
+ var item=labelInfo.AryText[i];
62831
62866
  if (item.Name)
62832
62867
  {
62868
+ this.Canvas.textAlign="left";
62833
62869
  this.Canvas.fillStyle=item.NameColor;
62834
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
62870
+ this.Canvas.fillText(item.Name,xText,yText);
62835
62871
  }
62836
62872
 
62837
62873
  if (item.Text)
62838
62874
  {
62875
+ this.Canvas.textAlign="right";
62839
62876
  this.Canvas.fillStyle=item.TextColor;
62840
- this.Canvas.fillText(item.Text,drawLeft+labSize.NameWidth+1,yText+1);
62877
+ this.Canvas.fillText(item.Text,yRightText,yText);
62841
62878
  }
62842
62879
 
62843
- yText+=labSize.LineHeight;
62880
+ yText+=labelSize.LineHeight;
62844
62881
  }
62845
62882
  }
62846
62883
 
62847
- this.DrawRightLab=function(labInfo, rtLeftDraw)
62884
+ this.DrawRightLabel=function(rtLeftDraw)
62848
62885
  {
62849
- if (!labInfo) return;
62850
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
62851
- if (labInfo.Position!=2) return;
62852
- var labSize=this.CalculateLabSize(labInfo);
62886
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText)) return;
62887
+ if (this.LableInfo.Position!=2) return;
62888
+
62889
+ var labSize=this.CalculateLabSize(this.LableInfo);
62890
+ var border=this.Frame.GetBorder();
62853
62891
 
62854
62892
  var drawLeft=rtLeftDraw.Right-labSize.Width;
62855
62893
  if (drawLeft<rtLeftDraw.Left) drawLeft=rtLeftDraw.Left;
62856
62894
  var drawRight=drawLeft+labSize.Width;
62895
+
62857
62896
  var drawTop=rtLeftDraw.Bottom;
62858
- var lineSpace=0;
62859
- if (IFrameSplitOperator.IsNumber(labInfo.LineSpace)) lineSpace=labInfo.LineSpace;
62860
62897
 
62861
- //背景色
62862
- var rtLab={ Left:drawLeft, Top:drawTop, Width:labSize.Width, Height:labSize.Height }
62863
- rtLab.Right=rtLab.Left+rtLab.Width;
62864
- rtLab.Bottom=rtLab.Top+rtLab.Height;
62865
- if (labInfo.BGColor)
62898
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
62899
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
62900
+ if (rtLabel.Bottom>border.Bottom) //标签页超过窗口底部 绘制到价格标签上面
62866
62901
  {
62867
- this.Canvas.fillStyle=labInfo.BGColor;
62868
- this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.Height));
62902
+ rtLabel.Bottom=rtLeftDraw.Top;
62903
+ rtLabel.Top=rtLabel.Bottom-rtLabel.Height;
62869
62904
  }
62870
62905
 
62871
- var yText=drawTop+1+lineSpace;
62872
- this.Canvas.textBaseline="top";
62873
- for(var i=0;i<labInfo.AryText.length;++i)
62874
- {
62875
- var item=labInfo.AryText[i];
62876
- if (item.Name)
62877
- {
62878
- this.Canvas.textAlign="left";
62879
- this.Canvas.fillStyle=item.NameColor;
62880
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
62881
- }
62882
-
62883
- if (item.Text)
62884
- {
62885
- this.Canvas.textAlign="right";
62886
- this.Canvas.fillStyle=item.TextColor;
62887
- this.Canvas.fillText(item.Text,drawRight-1,yText+1);
62888
- }
62889
-
62890
- yText+=labSize.LineHeight+lineSpace;
62891
- }
62892
-
62893
- this.DrawVerticalButton(rtLab);
62906
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
62907
+
62908
+ this.DrawVerticalButton(rtLabel);
62894
62909
  }
62895
62910
 
62896
- this.DrawCustomHLine=function(labInfo, yLine)
62911
+ this.DrawCustomHLine=function(yLine)
62897
62912
  {
62898
- if (!labInfo) return;
62899
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryLine)) return;
62913
+ if (!this.LableInfo) return;
62914
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryLine)) return;
62900
62915
 
62901
62916
  var left=this.Frame.ChartBorder.GetLeft();
62902
62917
  var right=this.Frame.ChartBorder.GetRight();
62903
62918
  var pixelRatio=GetDevicePixelRatio();
62904
62919
 
62905
62920
  var yMax=yLine, yMin=yLine;
62906
- for(var i=0;i<labInfo.AryLine.length;++i)
62921
+ for(var i=0;i<this.LableInfo.AryLine.length;++i)
62907
62922
  {
62908
- var item=labInfo.AryLine[i];
62923
+ var item=this.LableInfo.AryLine[i];
62909
62924
  if (!IFrameSplitOperator.IsNumber(item.Value)) continue;
62910
62925
  if (item.Width<0) continue;
62911
62926
 
@@ -62930,9 +62945,9 @@ function ChartDrawHLine()
62930
62945
  if (yMin>yFixed) yMin=yFixed;
62931
62946
  }
62932
62947
 
62933
- if (yMax!=yMin && labInfo.VLine)
62948
+ if (yMax!=yMin && this.LableInfo.VLine)
62934
62949
  {
62935
- var item=labInfo.VLine;
62950
+ var item=this.LableInfo.VLine;
62936
62951
  var x=left+20*pixelRatio;
62937
62952
  if (IFrameSplitOperator.IsNumber(item.XOffset)) x=left+item.XOffset*pixelRatio;
62938
62953
  x=ToFixedPoint(x);
@@ -62946,14 +62961,14 @@ function ChartDrawHLine()
62946
62961
  }
62947
62962
  }
62948
62963
 
62949
- this.DrawValueText=function(y, rtDraw, labInfo)
62964
+ this.DrawValueText=function(y, rtDraw)
62950
62965
  {
62951
62966
  var left=this.Frame.ChartBorder.GetLeft();
62952
62967
  var right=this.Frame.ChartBorder.GetRight();
62953
62968
  var top=this.Frame.ChartBorder.GetTopEx();
62954
62969
  var bottom=this.Frame.ChartBorder.GetBottomEx();
62955
62970
  var pixelTatio = GetDevicePixelRatio();
62956
-
62971
+ var labInfo=this.LabelInfo;
62957
62972
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
62958
62973
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
62959
62974
 
@@ -62988,12 +63003,15 @@ function ChartDrawHLine()
62988
63003
  this.Canvas.font=this.Font;
62989
63004
  var textWidth=this.Canvas.measureText(strValue).width;
62990
63005
  var lineHeight=this.GetFontHeight();
62991
- var rtBG={ Left:right+this.RightSpaceWidth, Top:y- lineHeight/2, Width:textWidth+4, Height:lineHeight };
62992
- //rtBG.Right=rtBG.Left+rtBG.Width;
62993
- rtBG.Bottom=rtBG.Top+rtBG.Height;
63006
+ var rtBG={ Left:right+this.RightSpaceWidth, YCenter:y, Width:textWidth, Height:lineHeight };
63007
+ rtBG.Height+=(this.TextMargin.Top+this.TextMargin.Bottom);
62994
63008
  rtBG.Width+=(this.TextMargin.Left+this.TextMargin.Right);
62995
63009
  rtBG.Right=rtBG.Left+rtBG.Width;
62996
- var xText=rtBG.Left+this.TextMargin.Left+2;
63010
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
63011
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63012
+
63013
+ var xText=rtBG.Left+this.TextMargin.Left;
63014
+ var yText=rtBG.Top+this.TextMargin.Top+this.TextMargin.YOffset;
62997
63015
 
62998
63016
  if (this.ButtonPosition==1)
62999
63017
  {
@@ -63006,8 +63024,8 @@ function ChartDrawHLine()
63006
63024
 
63007
63025
  this.Canvas.fillStyle=this.ValueTextColor
63008
63026
  this.Canvas.textAlign="left";
63009
- this.Canvas.textBaseline="middle";
63010
- this.Canvas.fillText(strValue,xText,y);
63027
+ this.Canvas.textBaseline="top";
63028
+ this.Canvas.fillText(strValue,xText,yText);
63011
63029
 
63012
63030
  rtDraw.Left=rtBG.Left;
63013
63031
  rtDraw.Top=rtBG.Top;
@@ -138614,7 +138632,7 @@ function ScrollBarBGChart()
138614
138632
 
138615
138633
 
138616
138634
 
138617
- var HQCHART_VERSION="1.1.13753";
138635
+ var HQCHART_VERSION="1.1.13757";
138618
138636
 
138619
138637
  function PrintHQChartVersion()
138620
138638
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13753";
8
+ var HQCHART_VERSION="1.1.13757";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -62520,7 +62520,7 @@ function ChartDrawHLine()
62520
62520
  this.ButtonBGColor='rgb(190,190,190)';
62521
62521
  this.ButtonSpace=3;
62522
62522
 
62523
- this.TextMargin={ Left:0, Right:0 };
62523
+ this.TextMargin={ Left:0, Right:0, Top:0, Bottom:0, YOffset:4*GetDevicePixelRatio() };
62524
62524
 
62525
62525
  this.AlwaysShowLab=false; //总是显示标签
62526
62526
 
@@ -62544,7 +62544,9 @@ function ChartDrawHLine()
62544
62544
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
62545
62545
  `${12*GetDevicePixelRatio()}px 微软雅黑`,
62546
62546
  ],
62547
- };
62547
+ };
62548
+
62549
+ this.LableInfo; //{ Position:2=右侧外部 }
62548
62550
 
62549
62551
  //内部变量
62550
62552
  this.ColseButtonSize=0;
@@ -62552,7 +62554,7 @@ function ChartDrawHLine()
62552
62554
  this.ButtonBGWidth=0;
62553
62555
  this.VerticalButtonInfo={ Width:0, Height:0 }; //垂直按钮信息
62554
62556
 
62555
-
62557
+ this.IsPointIn=this.IsPointIn_XYValue_Line;
62556
62558
 
62557
62559
  this.SetOption=function(option)
62558
62560
  {
@@ -62613,6 +62615,9 @@ function ChartDrawHLine()
62613
62615
  var item=option.TextMargin;
62614
62616
  if (IFrameSplitOperator.IsNumber(item.Left)) this.TextMargin.Left=item.Left;
62615
62617
  if (IFrameSplitOperator.IsNumber(item.Right)) this.TextMargin.Right=item.Right;
62618
+ if (IFrameSplitOperator.IsNumber(item.Top)) this.TextMargin.Top=item.Top;
62619
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) this.TextMargin.Bottom=item.Bottom;
62620
+ if (IFrameSplitOperator.IsNumber(item.YOffset)) this.TextMargin.YOffset=item.YOffset;
62616
62621
  }
62617
62622
  }
62618
62623
  }
@@ -62629,10 +62634,6 @@ function ChartDrawHLine()
62629
62634
  return storageData;
62630
62635
  }
62631
62636
 
62632
-
62633
- this.IsPointIn=this.IsPointIn_XYValue_Line;
62634
-
62635
-
62636
62637
  /*
62637
62638
  this.GetXYCoordinate=function()
62638
62639
  {
@@ -62689,7 +62690,7 @@ function ChartDrawHLine()
62689
62690
  this.ColseButtonSize=0;
62690
62691
  this.SettingButtonSize=0;
62691
62692
  this.ButtonBGWidth=0;
62692
-
62693
+ this.LableInfo=null;
62693
62694
  this.VerticalButtonInfo.Width=0;
62694
62695
  this.VerticalButtonInfo.Height=0;
62695
62696
 
@@ -62752,7 +62753,7 @@ function ChartDrawHLine()
62752
62753
  }
62753
62754
  this.LinePoint.push(line);
62754
62755
 
62755
- if (bVisibleRange)
62756
+ if (bVisibleRange) //在可视范围内
62756
62757
  {
62757
62758
  var yValue=this.Frame.GetYData(drawPoint[0].Y, false);
62758
62759
  var strPrice=yValue.toFixed(this.Precision);
@@ -62766,15 +62767,11 @@ function ChartDrawHLine()
62766
62767
  this.DrawPriceText(strPrice, line.Start, line.End, 1);
62767
62768
  }
62768
62769
  }
62769
-
62770
- var labInfo;
62771
- if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
62770
+
62771
+ if (this.GetLabelCallback) this.LableInfo=this.GetLabelCallback(this);
62772
62772
 
62773
62773
  this.AryShowButton=this.GetShowButton(); //获取按钮
62774
-
62775
- //框架内的描述信息
62776
- if (labInfo && bVisibleRange)
62777
- this.DrawLab(labInfo, drawPoint[0].Y);
62774
+ if (bVisibleRange) this.DrawInternalLabel(drawPoint[0].Y); //内部价格标签
62778
62775
 
62779
62776
  //画中心点
62780
62777
  if (bVisibleRange)
@@ -62791,11 +62788,12 @@ function ChartDrawHLine()
62791
62788
  {
62792
62789
  var rtDraw={ };
62793
62790
  this.CalculateButtonSize();
62794
- this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
62795
- if (labInfo) this.DrawRightLab(labInfo, rtDraw);
62796
- if (labInfo && bVisibleRange) this.DrawCustomHLine(labInfo, drawPoint[0].Y);
62791
+ this.DrawValueText(drawPoint[0].Y, rtDraw);
62792
+ this.DrawRightLabel(rtDraw);
62793
+ if (bVisibleRange) this.DrawCustomHLine(drawPoint[0].Y);
62797
62794
  }
62798
62795
 
62796
+
62799
62797
  //鼠标是否在按钮上
62800
62798
  if (moveonPoint && mouseStatus)
62801
62799
  {
@@ -62843,113 +62841,130 @@ function ChartDrawHLine()
62843
62841
  ++lineCount;
62844
62842
  }
62845
62843
 
62846
- var size={ Width:maxWidth, Height: lineCount*(lineHeight+lineSpace)+lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
62844
+ var size={ Width:maxWidth, Height:lineCount*lineHeight+(lineCount-1)*lineSpace, NameWidth:maxNameWidth, TextWidth:maxTextWidth, LineHeight:lineHeight };
62845
+ if (labInfo.LabelMargin)
62846
+ {
62847
+ var item=labInfo.LabelMargin;
62848
+ if (IFrameSplitOperator.IsNumber(item.Left)) size.Width+=item.Left;
62849
+ if (IFrameSplitOperator.IsNumber(item.Right)) size.Width+=item.Right;
62850
+ if (IFrameSplitOperator.IsNumber(item.Top)) size.Height+=item.Top;
62851
+ if (IFrameSplitOperator.IsNumber(item.Bottom)) size.Height+=item.Bottom;
62852
+ }
62847
62853
 
62848
62854
  return size;
62849
62855
  }
62850
62856
 
62851
- this.DrawLab=function(labInfo, y)
62857
+ //绘制窗口内部标签
62858
+ this.DrawInternalLabel=function(y)
62852
62859
  {
62853
- if (!labInfo) return;
62854
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
62855
- if (labInfo.Position===2) return;
62860
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText)) return;
62861
+ if (this.LableInfo.Position==2) return;
62856
62862
 
62857
- var left=this.Frame.ChartBorder.GetLeft();
62858
- var right=this.Frame.ChartBorder.GetRight();
62859
- var labSize=this.CalculateLabSize(labInfo);
62863
+ var border=this.Frame.GetBorder();
62864
+ var left=border.Left;
62865
+ var right=border.Right;
62866
+ var labSize=this.CalculateLabSize(this.LableInfo);
62860
62867
  var drawLeft=right-labSize.Width;
62868
+ var drawRight=drawLeft+labSize.Width;
62861
62869
  var drawTop=y-labSize.Height-1;
62870
+ if (drawTop<=border.TopEx) drawTop=y+1;
62871
+
62872
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
62873
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
62862
62874
 
62875
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
62876
+ }
62877
+
62878
+ //绘制标签页
62879
+ this.DrawLabel=function(labelInfo, labelSize, rtLabel)
62880
+ {
62863
62881
  //背景色
62864
- if (labInfo.BGColor)
62882
+ if (labelInfo.BGColor)
62865
62883
  {
62866
- this.Canvas.fillStyle=labInfo.BGColor;
62867
- var rtTop=y-labSize.Height-4;
62868
- this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(right+drawLeft),ToFixedRect(y-rtTop));
62884
+ this.Canvas.fillStyle=labelInfo.BGColor;
62885
+ this.Canvas.fillRect(ToFixedRect(rtLabel.Left),ToFixedRect(rtLabel.Top),ToFixedRect(rtLabel.Width),ToFixedRect(rtLabel.Height));
62869
62886
  }
62870
62887
 
62871
- var yText=drawTop;
62872
- for(var i=0;i<labInfo.AryText.length;++i)
62888
+ var labelMargin=labelInfo.LabelMargin;
62889
+ var lineSpace=0;
62890
+ if (IFrameSplitOperator.IsNumber(labelInfo.LineSpace)) lineSpace=labelInfo.LineSpace;
62891
+
62892
+ var yText=rtLabel.Top;
62893
+ var xText=rtLabel.Left;
62894
+ var yRightText=rtLabel.Right;
62895
+
62896
+ if (labelMargin)
62873
62897
  {
62874
- var item=labInfo.AryText[i];
62898
+ if (IFrameSplitOperator.IsNumber(labelMargin.Left)) xText+=labelMargin.Left;
62899
+ if (IFrameSplitOperator.IsNumber(labelMargin.Right)) yRightText-=labelMargin.Right;
62900
+ if (IFrameSplitOperator.IsNumber(labelMargin.Top)) yText+=labelMargin.Top;
62901
+
62902
+ }
62903
+
62904
+ this.Canvas.font=this.TextFont;
62905
+ this.Canvas.textBaseline="top";
62906
+ for(var i=0;i<labelInfo.AryText.length;++i)
62907
+ {
62908
+ if (i>0) yText+=lineSpace;
62909
+ var item=labelInfo.AryText[i];
62875
62910
  if (item.Name)
62876
62911
  {
62912
+ this.Canvas.textAlign="left";
62877
62913
  this.Canvas.fillStyle=item.NameColor;
62878
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
62914
+ this.Canvas.fillText(item.Name,xText,yText);
62879
62915
  }
62880
62916
 
62881
62917
  if (item.Text)
62882
62918
  {
62919
+ this.Canvas.textAlign="right";
62883
62920
  this.Canvas.fillStyle=item.TextColor;
62884
- this.Canvas.fillText(item.Text,drawLeft+labSize.NameWidth+1,yText+1);
62921
+ this.Canvas.fillText(item.Text,yRightText,yText);
62885
62922
  }
62886
62923
 
62887
- yText+=labSize.LineHeight;
62924
+ yText+=labelSize.LineHeight;
62888
62925
  }
62889
62926
  }
62890
62927
 
62891
- this.DrawRightLab=function(labInfo, rtLeftDraw)
62928
+ this.DrawRightLabel=function(rtLeftDraw)
62892
62929
  {
62893
- if (!labInfo) return;
62894
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText)) return;
62895
- if (labInfo.Position!=2) return;
62896
- var labSize=this.CalculateLabSize(labInfo);
62930
+ if (!this.LableInfo || !IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryText)) return;
62931
+ if (this.LableInfo.Position!=2) return;
62932
+
62933
+ var labSize=this.CalculateLabSize(this.LableInfo);
62934
+ var border=this.Frame.GetBorder();
62897
62935
 
62898
62936
  var drawLeft=rtLeftDraw.Right-labSize.Width;
62899
62937
  if (drawLeft<rtLeftDraw.Left) drawLeft=rtLeftDraw.Left;
62900
62938
  var drawRight=drawLeft+labSize.Width;
62939
+
62901
62940
  var drawTop=rtLeftDraw.Bottom;
62902
- var lineSpace=0;
62903
- if (IFrameSplitOperator.IsNumber(labInfo.LineSpace)) lineSpace=labInfo.LineSpace;
62904
62941
 
62905
- //背景色
62906
- var rtLab={ Left:drawLeft, Top:drawTop, Width:labSize.Width, Height:labSize.Height }
62907
- rtLab.Right=rtLab.Left+rtLab.Width;
62908
- rtLab.Bottom=rtLab.Top+rtLab.Height;
62909
- if (labInfo.BGColor)
62942
+ var rtLabel={ Left:drawLeft, Right:drawRight, Top:drawTop, Width:labSize.Width, Height:labSize.Height };
62943
+ rtLabel.Bottom=rtLabel.Top+rtLabel.Height;
62944
+ if (rtLabel.Bottom>border.Bottom) //标签页超过窗口底部 绘制到价格标签上面
62910
62945
  {
62911
- this.Canvas.fillStyle=labInfo.BGColor;
62912
- this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.Height));
62946
+ rtLabel.Bottom=rtLeftDraw.Top;
62947
+ rtLabel.Top=rtLabel.Bottom-rtLabel.Height;
62913
62948
  }
62914
62949
 
62915
- var yText=drawTop+1+lineSpace;
62916
- this.Canvas.textBaseline="top";
62917
- for(var i=0;i<labInfo.AryText.length;++i)
62918
- {
62919
- var item=labInfo.AryText[i];
62920
- if (item.Name)
62921
- {
62922
- this.Canvas.textAlign="left";
62923
- this.Canvas.fillStyle=item.NameColor;
62924
- this.Canvas.fillText(item.Name,drawLeft+1,yText+1);
62925
- }
62926
-
62927
- if (item.Text)
62928
- {
62929
- this.Canvas.textAlign="right";
62930
- this.Canvas.fillStyle=item.TextColor;
62931
- this.Canvas.fillText(item.Text,drawRight-1,yText+1);
62932
- }
62933
-
62934
- yText+=labSize.LineHeight+lineSpace;
62935
- }
62936
-
62937
- this.DrawVerticalButton(rtLab);
62950
+ this.DrawLabel(this.LableInfo, labSize, rtLabel);
62951
+
62952
+ this.DrawVerticalButton(rtLabel);
62938
62953
  }
62939
62954
 
62940
- this.DrawCustomHLine=function(labInfo, yLine)
62955
+ this.DrawCustomHLine=function(yLine)
62941
62956
  {
62942
- if (!labInfo) return;
62943
- if (!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryLine)) return;
62957
+ if (!this.LableInfo) return;
62958
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.LableInfo.AryLine)) return;
62944
62959
 
62945
62960
  var left=this.Frame.ChartBorder.GetLeft();
62946
62961
  var right=this.Frame.ChartBorder.GetRight();
62947
62962
  var pixelRatio=GetDevicePixelRatio();
62948
62963
 
62949
62964
  var yMax=yLine, yMin=yLine;
62950
- for(var i=0;i<labInfo.AryLine.length;++i)
62965
+ for(var i=0;i<this.LableInfo.AryLine.length;++i)
62951
62966
  {
62952
- var item=labInfo.AryLine[i];
62967
+ var item=this.LableInfo.AryLine[i];
62953
62968
  if (!IFrameSplitOperator.IsNumber(item.Value)) continue;
62954
62969
  if (item.Width<0) continue;
62955
62970
 
@@ -62974,9 +62989,9 @@ function ChartDrawHLine()
62974
62989
  if (yMin>yFixed) yMin=yFixed;
62975
62990
  }
62976
62991
 
62977
- if (yMax!=yMin && labInfo.VLine)
62992
+ if (yMax!=yMin && this.LableInfo.VLine)
62978
62993
  {
62979
- var item=labInfo.VLine;
62994
+ var item=this.LableInfo.VLine;
62980
62995
  var x=left+20*pixelRatio;
62981
62996
  if (IFrameSplitOperator.IsNumber(item.XOffset)) x=left+item.XOffset*pixelRatio;
62982
62997
  x=ToFixedPoint(x);
@@ -62990,14 +63005,14 @@ function ChartDrawHLine()
62990
63005
  }
62991
63006
  }
62992
63007
 
62993
- this.DrawValueText=function(y, rtDraw, labInfo)
63008
+ this.DrawValueText=function(y, rtDraw)
62994
63009
  {
62995
63010
  var left=this.Frame.ChartBorder.GetLeft();
62996
63011
  var right=this.Frame.ChartBorder.GetRight();
62997
63012
  var top=this.Frame.ChartBorder.GetTopEx();
62998
63013
  var bottom=this.Frame.ChartBorder.GetBottomEx();
62999
63014
  var pixelTatio = GetDevicePixelRatio();
63000
-
63015
+ var labInfo=this.LabelInfo;
63001
63016
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
63002
63017
  if (labInfo && IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
63003
63018
 
@@ -63032,12 +63047,15 @@ function ChartDrawHLine()
63032
63047
  this.Canvas.font=this.Font;
63033
63048
  var textWidth=this.Canvas.measureText(strValue).width;
63034
63049
  var lineHeight=this.GetFontHeight();
63035
- var rtBG={ Left:right+this.RightSpaceWidth, Top:y- lineHeight/2, Width:textWidth+4, Height:lineHeight };
63036
- //rtBG.Right=rtBG.Left+rtBG.Width;
63037
- rtBG.Bottom=rtBG.Top+rtBG.Height;
63050
+ var rtBG={ Left:right+this.RightSpaceWidth, YCenter:y, Width:textWidth, Height:lineHeight };
63051
+ rtBG.Height+=(this.TextMargin.Top+this.TextMargin.Bottom);
63038
63052
  rtBG.Width+=(this.TextMargin.Left+this.TextMargin.Right);
63039
63053
  rtBG.Right=rtBG.Left+rtBG.Width;
63040
- var xText=rtBG.Left+this.TextMargin.Left+2;
63054
+ rtBG.Top=rtBG.YCenter-rtBG.Height/2;
63055
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
63056
+
63057
+ var xText=rtBG.Left+this.TextMargin.Left;
63058
+ var yText=rtBG.Top+this.TextMargin.Top+this.TextMargin.YOffset;
63041
63059
 
63042
63060
  if (this.ButtonPosition==1)
63043
63061
  {
@@ -63050,8 +63068,8 @@ function ChartDrawHLine()
63050
63068
 
63051
63069
  this.Canvas.fillStyle=this.ValueTextColor
63052
63070
  this.Canvas.textAlign="left";
63053
- this.Canvas.textBaseline="middle";
63054
- this.Canvas.fillText(strValue,xText,y);
63071
+ this.Canvas.textBaseline="top";
63072
+ this.Canvas.fillText(strValue,xText,yText);
63055
63073
 
63056
63074
  rtDraw.Left=rtBG.Left;
63057
63075
  rtDraw.Top=rtBG.Top;
@@ -143170,7 +143188,7 @@ function HQChartScriptWorker()
143170
143188
 
143171
143189
 
143172
143190
 
143173
- var HQCHART_VERSION="1.1.13753";
143191
+ var HQCHART_VERSION="1.1.13757";
143174
143192
 
143175
143193
  function PrintHQChartVersion()
143176
143194
  {