hqchart 1.1.13771 → 1.1.13773

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.
@@ -2147,6 +2147,8 @@ this.ExtendData;//扩展属性
2147
2147
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
2148
2148
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
2149
2149
  this.AreaData;//区域: { Start:, End:, BGColor:, Position:[0=左, 1=右] }
2150
+ //不在当前屏范围
2151
+ //this.OutRange={ BGColor:"", TextColor:, BorderColor: TopYOffset:, BottomYOffset: }
2150
2152
  }//边框信息
2151
2153
  function ChartBorder(){this.UIElement;//四周间距
2152
2154
  this.Left=50;this.Right=80;this.Top=50;this.Bottom=50;this.TitleHeight=24;//标题高度
@@ -2346,8 +2348,11 @@ this.GetYData=function(y,isLimit){if(this.Logarithmic&&this.GetYLogarithmicFromD
2346
2348
  {if(isLimit==false){return(y-this.ChartBorder.GetTopEx())/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}else{if(y<this.ChartBorder.GetTopEx())return this.HorizontalMin;if(y>this.ChartBorder.GetBottomEx())return this.HorizontalMax;return(y-this.ChartBorder.GetTopEx())/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}}else{if(isLimit==false){return(this.ChartBorder.GetBottomEx()-y)/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}else{if(y<this.ChartBorder.GetTopEx())return this.HorizontalMax;if(y>this.ChartBorder.GetBottomEx())return this.HorizontalMin;return(this.ChartBorder.GetBottomEx()-y)/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}}};//X坐标转x轴数值
2347
2349
  this.GetXData=function(x){if(x<=this.ChartBorder.GetLeft())return 0;if(x>=this.ChartBorder.GetRight())return this.XPointCount;return(x-this.ChartBorder.GetLeft())*(this.XPointCount*1.0/this.ChartBorder.GetWidth());};//选中的画图工具X,Y轴坐标信息
2348
2350
  this.DrawPictureXCoordinate=function(drawPicture,range,option){if(this.IsHScreen)return;if(!range)return;if(!IFrameSplitOperator.IsNonEmptyArray(range.Points))return;var border=this.GetBorder();var left=border.Left;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";if(range.X){var xRange=range.X;var xLeft=xRange.Min.X;var xRight=xRange.Max.X;if(xLeft<left)xLeft=left;if(xRight>right)xRight=right;this.Canvas.fillStyle=this.DrawPicture.BGColor;this.Canvas.fillRect(xLeft,border.Bottom,xRight-xLeft,fontHeight);}for(var i=0;i<range.Points.length;++i){var item=range.Points[i];if(item.X<left||item.X>right)continue;var index=this.GetXData(item.X,false);var index=Math.round(index);var kItem=this.GetKItem(index);if(kItem){var text=IFrameSplitOperator.FormatDateString(kItem.Date,null);if(ChartData.IsMinutePeriod(option.Period))text+=" "+IFrameSplitOperator.FormatTimeString(kItem.Time,"HH:MM");else if(ChartData.IsMilliSecondPeriod(option.Period))text+=" "+IFrameSplitOperator.FormatTimeString(kItem.Time,"HH:MM:SS.fff");var textWidth=this.Canvas.measureText(text).width+2;var textLeft=item.X-textWidth/2;if(textLeft<left)textLeft=left;this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(textLeft,border.Bottom,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yCenter=border.Bottom+fontHeight;this.Canvas.fillText(text,textLeft+1,yCenter);}}};this.GetKItem=function(currentIndex){if(!this.Data)return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return null;var index=this.Data.DataOffset+currentIndex;return this.Data.Data[index];};this.DrawPictureYCoordinate=function(drawPicture,range,option){if(this.IsHScreen)return;if(!range)return;if(!IFrameSplitOperator.IsNonEmptyArray(range.Points))return;var border=this.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var defaultfloatPrecision=2;if(option&&option.Symbol)defaultfloatPrecision=GetfloatPrecision(option.Symbol);var textWidth=0;for(var i=0;i<range.Points.length;++i){var item=range.Points[i];var Value=this.GetYData(item.Y);var text=Value.toFixed(defaultfloatPrecision);var value=this.Canvas.measureText(text).width;if(textWidth<value)textWidth=value;range.Points[i].Text=text;}textWidth+=this.YTextPadding[1]+2;if(range.Y){var yRange=range.Y;var yTop=yRange.Min.Y;var yBottom=yRange.Max.Y;if(yRange.Min.Y<top)yTop=top;if(yRange.Max.Y>bottom)yBottom=bottom;this.Canvas.fillStyle=this.DrawPicture.BGColor;this.Canvas.fillRect(right,yTop,textWidth+5,yBottom-yTop);}for(var i=0;i<range.Points.length;++i){var item=range.Points[i];if(item.Y<top||item.Y>bottom)continue;this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(right,item.Y-fontHeight/2,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yText=item.Y+fontHeight/2;this.Canvas.fillText(item.Text,right+this.YTextPadding[1],yText);}};this.DrawPicturePointYCoordinate=function(drawPicture,option){if(this.IsHScreen)return;if(!drawPicture.GetYCoordinatePoint)return;var aryPoint=drawPicture.GetYCoordinatePoint();if(!IFrameSplitOperator.IsNonEmptyArray(aryPoint))return;var border=this.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var defaultfloatPrecision=2;if(option&&option.Symbol)defaultfloatPrecision=GetfloatPrecision(option.Symbol);for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];if(!item)continue;if(item.Y<top||item.Y>bottom)continue;var text=item.YValue.toFixed(defaultfloatPrecision);var textWidth=this.Canvas.measureText(text).width+2;textWidth+=this.YTextPadding[1];this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(right,item.Y-fontHeight/2,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yText=item.Y+fontHeight/2;this.Canvas.fillText(text,right+this.YTextPadding[1],yText);}};//字体外部设置好
2349
- this.GetCustomItemTextInfo=function(item,bLeft,pixelTatio){var text=bLeft?item.Message[0]:item.Message[1];var aryText=[];var width=0;if(Array.isArray(text)){for(var i=0;i<text.length;++i){var item=text[i];if(item.Type===1){aryText.push({Type:item.Type});}else{var value=this.Canvas.measureText(text[i].Text).width;if(value>width)width=value;var outItem={Text:text[i].Text,Width:value+2*pixelTatio};if(item.TextColor)outItem.TextColor=item.TextColor;aryText.push(outItem);}}if(width>0)width+=2*pixelTatio;}else{width=this.Canvas.measureText(text).width+2*pixelTatio;aryText.push({Text:text,Width:width});}return{MaxWidth:width,Text:aryText};};this.DrawCustomItem=function(item,mapTextRect)//显示自定义Y刻度
2350
- {if(!item.Message[1]&&!item.Message[0])return;if(item.Value>this.HorizontalMax||item.Value<this.HorizontalMin){this.SendDrawCountDownEvent({IsShow:false});return;}var border=this.GetBorder();var left=border.Left;var right=border.Right;var bottom=border.Bottom;var top=border.Top;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var titleHeight=this.ChartBorder.TitleHeight;if(this.IsHScreen){borderLeft=this.ChartBorder.Top;borderRight=this.ChartBorder.Bottom;top=border.Top;bottom=border.Bottom;}var pixelTatio=GetDevicePixelRatio();var defaultTextHeight=18*pixelTatio;var textHeight=defaultTextHeight;var y;if(item.Value=="TopEx")y=border.TopEx;else if(item.Value=="TopTitle")y=border.TopTitle;else if(item.Value=="Top")y=border.Top;else if(item.Value=="BottomEx")y=border.BottomEx;else if(item.Value=="Bottom")y=border.Bottom;else y=this.GetYFromData(item.Value);if(IFrameSplitOperator.IsNumber(item.YOffset))y+=item.YOffset;var position=0;var emptyBGColor;if(item.ExtendData&&item.ExtendData.Custom){var customItem=item.ExtendData.Custom;if(IFrameSplitOperator.IsNumber(customItem.Position))position=customItem.Position;if(customItem.EmptyBGColor)emptyBGColor=customItem.EmptyBGColor;}if(item.Message[0])// 左
2351
+ this.GetCustomItemTextInfo=function(item,bLeft,pixelTatio){var text=bLeft?item.Message[0]:item.Message[1];var aryText=[];var width=0;if(Array.isArray(text)){for(var i=0;i<text.length;++i){var item=text[i];if(item.Type===1){aryText.push({Type:item.Type});}else{var value=this.Canvas.measureText(text[i].Text).width;if(value>width)width=value;var outItem={Text:text[i].Text,Width:value+2*pixelTatio};if(item.TextColor)outItem.TextColor=item.TextColor;aryText.push(outItem);}}if(width>0)width+=2*pixelTatio;}else{width=this.Canvas.measureText(text).width+2*pixelTatio;aryText.push({Text:text,Width:width});}return{MaxWidth:width,Text:aryText};};this.DrawOutRangeCustomItem=function(item,mapTextRect){if(this.IsHScreen===true)return;if(!this.IsShow&&!this.IsYDrawMainFrame)return;if(!item.Message[1]&&!item.Message[0])return;if(!item.OutRange)return;var position=0;//1=top 2=bottom
2352
+ if(item.Value>this.HorizontalMax)position=1;else if(item.Value<this.HorizontalMin)position=2;else return;this.Canvas.save();var outRange=item.OutRange;var border=this.GetBorder();var left=border.Left;var right=border.Right;var bottom=border.Bottom;var top=border.Top;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var titleHeight=this.ChartBorder.TitleHeight;if(this.IsHScreen){borderLeft=this.ChartBorder.Top;borderRight=this.ChartBorder.Bottom;top=border.Top;bottom=border.Bottom;}var pixelTatio=GetDevicePixelRatio();var defaultTextHeight=18*pixelTatio;var textHeight=defaultTextHeight;if(item.Message[0]&&borderLeft>=10){}else if(item.Message[1]&&borderRight>=10){if(item.Font!=null)this.Canvas.font=item.Font;var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);var textWidth=textInfo.MaxWidth;var itemRight=right+textWidth;var fontHeight=this.GetFontHeight();var textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var yText=null;if(position==1){yText=border.TopEx;if(IFrameSplitOperator.IsNumber(outRange.TopYOffset))yText+=outRange.TopYOffset;}else if(position==2){yText=border.BottomEx+textHeight;if(IFrameSplitOperator.IsNumber(outRange.BottomYOffset))yText+=outRange.BottomYOffset;}for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];var rtBG={Right:itemRight,Width:itemText.Width,Bottom:yText,Height:textHeight};rtBG.Top=rtBG.Bottom-rtBG.Height;rtBG.Left=rtBG.Right-rtBG.Width;if(item.ExtendLine&&item.ExtendLine[1])//右侧延长线
2353
+ {var exLine=item.ExtendLine[1];if(IFrameSplitOperator.IsNumber(exLine.Width)){var yLine=rtBG.Bottom;if(position==2)yLine=rtBG.Top;var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(outRange.ExtendLine.Type))lineType=outRange.ExtendLine.Type;if(i==0)this.DrawLine(right,right+exLine.Width,yLine,item.LineColor,lineType,item);rtBG.Left+=exLine.Width;rtBG.Right+=exLine.Width;}}this.Canvas.fillStyle=outRange.BGColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);if(outRange.Border&&outRange.Border.Color){if(IFrameSplitOperator.IsNonEmptyArray(outRange.Border.LineDash))this.Canvas.setLineDash(outRange.Border.LineDash);//虚线
2354
+ this.Canvas.strokeStyle=outRange.Border.Color;this.Canvas.strokeRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));}this.Canvas.fillStyle=outRange.TextColor;this.Canvas.fillText(itemText.Text,rtBG.Left+1*pixelTatio,rtBG.Top+rtBG.Height/2+1*pixelTatio);yText+=textHeight+1;}}this.Canvas.restore();};this.DrawCustomItem=function(item,mapTextRect)//显示自定义Y刻度
2355
+ {if(!item.Message[1]&&!item.Message[0])return;if(item.Value>this.HorizontalMax||item.Value<this.HorizontalMin){this.DrawOutRangeCustomItem(item,mapTextRect);this.SendDrawCountDownEvent({IsShow:false});return;}var border=this.GetBorder();var left=border.Left;var right=border.Right;var bottom=border.Bottom;var top=border.Top;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var titleHeight=this.ChartBorder.TitleHeight;if(this.IsHScreen){borderLeft=this.ChartBorder.Top;borderRight=this.ChartBorder.Bottom;top=border.Top;bottom=border.Bottom;}var pixelTatio=GetDevicePixelRatio();var defaultTextHeight=18*pixelTatio;var textHeight=defaultTextHeight;var y;if(item.Value=="TopEx")y=border.TopEx;else if(item.Value=="TopTitle")y=border.TopTitle;else if(item.Value=="Top")y=border.Top;else if(item.Value=="BottomEx")y=border.BottomEx;else if(item.Value=="Bottom")y=border.Bottom;else y=this.GetYFromData(item.Value);if(IFrameSplitOperator.IsNumber(item.YOffset))y+=item.YOffset;var position=0;var emptyBGColor;if(item.ExtendData&&item.ExtendData.Custom){var customItem=item.ExtendData.Custom;if(IFrameSplitOperator.IsNumber(customItem.Position))position=customItem.Position;if(customItem.EmptyBGColor)emptyBGColor=customItem.EmptyBGColor;}if(item.Message[0])// 左
2351
2356
  {if(borderLeft<10||position==1){if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
2352
2357
  var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){var bgTop=top;var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,itemText.Width);this.DrawHScreenText({X:yText,Y:bgTop},{Text:itemText.Text,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});if(i==0)this.DrawLine(bgTop+itemText.Width,bottom,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{if(itemText.Type===1){}else{var bgTop=yText-textHeight/2-1*pixelTatio;var textLeft=left+1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);if(i==0)this.DrawLine(textLeft+itemText.Width,right,yText,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;}}}}else{if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){if(i==0)var bgTop=top-itemText.Width;else var bgTop=top-textWidth;var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,itemText.Width);this.DrawHScreenText({X:yText,Y:bgTop},{Text:itemText.Text,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});if(i==0)this.DrawLine(bgTop+itemText.Width,bottom,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{var bgTop=yText-textHeight/2-1*pixelTatio;if(i==0){var rectLeft=left-itemText.Width;var textLeft=left;}else{var rectLeft=left-textWidth;var textLeft=left-(textWidth-itemText.Width);}if(emptyBGColor){this.Canvas.fillStyle=emptyBGColor;this.Canvas.fillRect(rectLeft-1,bgTop,itemText.Width+1,textHeight);this.Canvas.strokeStyle=item.LineColor;this.Canvas.strokeRect(ToFixedPoint(rectLeft-1),ToFixedPoint(bgTop),ToFixedPoint(itemText.Width+1),ToFixedPoint(textHeight));this.Canvas.fillStyle=item.LineColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}else{this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}if(i==0)this.DrawLine(left,right,yText,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;}}}}else if(item.Message[1])//右
2353
2358
  {if(borderRight<10||position==1){if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
@@ -2627,7 +2632,8 @@ if(y>=bottom-2)this.Canvas.textBaseline='bottom';else if(y<=top+2)this.Canvas.te
2627
2632
  {this.Canvas.strokeStyle=this.PenBorder;this.Canvas.beginPath();this.Canvas.moveTo(xLine-leftLine.Width,ToFixedPoint(y));this.Canvas.lineTo(xLine,ToFixedPoint(y));this.Canvas.stroke();}if(rightLine&&rightLine.Width>0){this.Canvas.strokeStyle=this.PenBorder;this.Canvas.beginPath();this.Canvas.moveTo(xLine+rightLine.Width,ToFixedPoint(y));this.Canvas.lineTo(xLine,ToFixedPoint(y));this.Canvas.stroke();}//坐标信息 右边 间距小于10 不画坐标
2628
2633
  if(item.Message[1]!=null&&borderRight>10){if(item.Font!=null)this.Canvas.font=item.Font;var text=item.Message[1];if(Array.isArray(item.Message[1]))text=item.Message[1][0];if(rightExtendText&&rightExtendText.Align){var textWidth=rightWidth;this.Canvas.textAlign="right";var xRight=border.Right+this.RightOffset+textWidth-this.YTextPadding[1];this.Canvas.fillText(text,xRight,y);}else{var xText=right+2;if(rightLine&&rightLine.Width>0)xText+=rightLine.Width;this.Canvas.fillStyle=item.TextColor;this.Canvas.textAlign="left";this.Canvas.fillText(text,xText,y);}}yPrev=y;}};//画X轴
2629
2634
  this.DrawVertical=function(){var border=this.ChartBorder.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var right=this.GetXHorizontal();this.Canvas.strokeStyle=this.PenBorder;this.Canvas.beginPath();this.Canvas.moveTo(ToFixedPoint(right),ToFixedPoint(top));this.Canvas.lineTo(ToFixedPoint(right),ToFixedPoint(bottom));this.Canvas.stroke();};this.DrawToolbar=function(moveonPoint,isMinSize,mouseStatus){this.Buttons=[];if(isMinSize==true)return;if(this.ChartBorder.IsShowTitleOnly)return;if(this.ChartBorder.TitleHeight<5)return;if(!this.IsShowToolbar)return;var aryButton=[];aryButton.push({ID:JSCHART_BUTTON_ID.MODIFY_OVERLAY_INDEX_PARAM,Style:this.ModifyIndexParamButton});aryButton.push({ID:JSCHART_BUTTON_ID.CLOSE_OVERLAY_INDEX,Style:this.CloseWindowButton});if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_OVERLAY_TOOLBAR);if(event&&event.Callback){var sendData={PreventDefault:false,DefaultButton:aryButton,AryButton:null,Guid:this.Guid};event.Callback(event,sendData,this);if(sendData.PreventDefault){this.DrawToolbarButton(sendData.AryButton,moveonPoint,mouseStatus);return;}}}this.DrawToolbarButton(aryButton,moveonPoint,mouseStatus);};this.DrawToolbarButton=function(aryButton,moveonPoint,mouseStatus){if(!IFrameSplitOperator.IsNonEmptyArray(aryButton))return;var border=this.ChartBorder.GetBorder();var yButton=border.Top+this.ChartBorder.TitleHeight/2;var rightWidth=this.GetHorizontalWidth();var xBotton=border.Right+this.RightOffset+rightWidth-this.CloseButton.MerginLeft;for(var i=aryButton.length-1;i>=0;--i){var item=aryButton[i];var size=item.Style.Size;var font=size+'px '+item.Style.Family;var rtButton={Left:xBotton-size-item.Style.MerginLeft,Top:yButton-size/2,Right:xBotton,Bottom:yButton+size/2,Width:size+item.Style.MerginLeft,Height:size};var color=this.CloseButton.Color;if(moveonPoint&&moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom){color=item.Style.MoveOnColor;if(mouseStatus)mouseStatus.MouseOnToolbar={Rect:rtButton,Item:item,Frame:this,Point:{X:moveonPoint.X,Y:moveonPoint.Y}};}this.Canvas.fillStyle=color;this.Canvas.font=font;this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillText(item.Style.Text,xBotton,yButton);this.Buttons.push({ID:item.ID,Rect:rtButton});xBotton=rtButton.Left;}};this.DrawCustomItem=function(item,mapTextRect)//显示自定义Y刻度
2630
- {if(!this.IsShow&&!this.IsYDrawMainFrame)return;if(!item.Message[1]&&!item.Message[0])return;if(item.Value>this.HorizontalMax||item.Value<this.HorizontalMin){this.SendDrawCountDownEvent({IsShow:false});return;}var border=this.GetBorder();var left=border.Left;var right=border.Right+this.RightOffset;if(this.IsYDrawMainFrame)right=border.Right;var bottom=border.Bottom;var top=border.Top;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var titleHeight=this.ChartBorder.TitleHeight;if(this.IsHScreen){borderLeft=this.ChartBorder.Top;borderRight=this.ChartBorder.Bottom;top=border.Top;bottom=border.Bottom;}var pixelTatio=GetDevicePixelRatio();var defaultTextHeight=18*pixelTatio;var textHeight=defaultTextHeight;var y=this.GetYFromData(item.Value);var position=0;var emptyBGColor;if(item.ExtendData&&item.ExtendData.Custom){var customItem=item.ExtendData.Custom;if(IFrameSplitOperator.IsNumber(customItem.Position))position=customItem.Position;if(customItem.EmptyBGColor)emptyBGColor=customItem.EmptyBGColor;}if(item.Message[0])// 左
2635
+ {if(!this.IsShow&&!this.IsYDrawMainFrame)return;if(!item.Message[1]&&!item.Message[0])return;if(item.Value>this.HorizontalMax||item.Value<this.HorizontalMin){//this.DrawOutRangeCustomItem(item, mapTextRect);
2636
+ this.SendDrawCountDownEvent({IsShow:false});return;}var border=this.GetBorder();var left=border.Left;var right=border.Right+this.RightOffset;if(this.IsYDrawMainFrame)right=border.Right;var bottom=border.Bottom;var top=border.Top;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var titleHeight=this.ChartBorder.TitleHeight;if(this.IsHScreen){borderLeft=this.ChartBorder.Top;borderRight=this.ChartBorder.Bottom;top=border.Top;bottom=border.Bottom;}var pixelTatio=GetDevicePixelRatio();var defaultTextHeight=18*pixelTatio;var textHeight=defaultTextHeight;var y=this.GetYFromData(item.Value);var position=0;var emptyBGColor;if(item.ExtendData&&item.ExtendData.Custom){var customItem=item.ExtendData.Custom;if(IFrameSplitOperator.IsNumber(customItem.Position))position=customItem.Position;if(customItem.EmptyBGColor)emptyBGColor=customItem.EmptyBGColor;}if(item.Message[0])// 左
2631
2637
  {if(borderLeft<10||position==1){if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
2632
2638
  var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){var bgTop=top;var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,itemText.Width);this.DrawHScreenText({X:yText,Y:bgTop},{Text:itemText.Text,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});if(i==0)this.DrawLine(bgTop+itemText.Width,bottom,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{if(itemText.Type===1){}else{var bgTop=yText-textHeight/2-1*pixelTatio;var textLeft=left+1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);if(i==0)this.DrawLine(textLeft+itemText.Width,right,yText,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;}}}}else{if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){if(i==0)var bgTop=top-itemText.Width;else var bgTop=top-textWidth;var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,itemText.Width);this.DrawHScreenText({X:yText,Y:bgTop},{Text:itemText.Text,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});if(i==0)this.DrawLine(bgTop+itemText.Width,bottom,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{var bgTop=yText-textHeight/2-1*pixelTatio;if(i==0){var rectLeft=left-itemText.Width;var textLeft=left;}else{var rectLeft=left-textWidth;var textLeft=left-(textWidth-itemText.Width);}if(emptyBGColor){this.Canvas.fillStyle=emptyBGColor;this.Canvas.fillRect(rectLeft-1,bgTop,itemText.Width+1,textHeight);this.Canvas.strokeStyle=item.LineColor;this.Canvas.strokeRect(ToFixedPoint(rectLeft-1),ToFixedPoint(bgTop),ToFixedPoint(itemText.Width+1),ToFixedPoint(textHeight));this.Canvas.fillStyle=item.LineColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}else{this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}if(i==0)this.DrawLine(left,right,yText,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;}}}}else if(item.Message[1])//右
2633
2639
  {if(borderRight<10||position==1){if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13771",
3
+ "version": "1.1.13773",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -10017,6 +10017,9 @@ function CoordinateInfo()
10017
10017
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
10018
10018
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
10019
10019
  this.AreaData; //区域: { Start:, End:, BGColor:, Position:[0=左, 1=右] }
10020
+
10021
+ //不在当前屏范围
10022
+ //this.OutRange={ BGColor:"", TextColor:, BorderColor: TopYOffset:, BottomYOffset: }
10020
10023
  }
10021
10024
 
10022
10025
 
@@ -12201,11 +12204,117 @@ function AverageWidthFrame()
12201
12204
  return { MaxWidth:width, Text:aryText };
12202
12205
  }
12203
12206
 
12207
+ this.DrawOutRangeCustomItem=function(item, mapTextRect)
12208
+ {
12209
+ if (this.IsHScreen===true) return;
12210
+ if (!this.IsShow && !this.IsYDrawMainFrame) return;
12211
+ if (!item.Message[1] && !item.Message[0]) return;
12212
+ if (!item.OutRange) return;
12213
+ var position=0; //1=top 2=bottom
12214
+ if (item.Value>this.HorizontalMax) position=1;
12215
+ else if (item.Value<this.HorizontalMin) position=2;
12216
+ else return;
12217
+
12218
+ this.Canvas.save();
12219
+ var outRange=item.OutRange;
12220
+ var border=this.GetBorder();
12221
+ var left=border.Left;
12222
+ var right=border.Right;
12223
+ var bottom=border.Bottom;
12224
+ var top=border.Top;
12225
+ var borderRight = this.ChartBorder.Right;
12226
+ var borderLeft = this.ChartBorder.Left;
12227
+ var titleHeight = this.ChartBorder.TitleHeight;
12228
+
12229
+ if (this.IsHScreen)
12230
+ {
12231
+ borderLeft=this.ChartBorder.Top;
12232
+ borderRight=this.ChartBorder.Bottom;
12233
+ top=border.Top;
12234
+ bottom=border.Bottom;
12235
+ }
12236
+
12237
+ var pixelTatio = GetDevicePixelRatio();
12238
+ var defaultTextHeight=18*pixelTatio;
12239
+ var textHeight=defaultTextHeight;
12240
+
12241
+ if (item.Message[0] && borderLeft>=10)
12242
+ {
12243
+
12244
+ }
12245
+ else if (item.Message[1] && borderRight>=10)
12246
+ {
12247
+ if (item.Font != null) this.Canvas.font = item.Font;
12248
+ var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);
12249
+ var textWidth=textInfo.MaxWidth;
12250
+ var itemRight=right+textWidth;
12251
+ var fontHeight=this.GetFontHeight();
12252
+ var textHeight=fontHeight>defaultTextHeight? fontHeight:defaultTextHeight;
12253
+ this.Canvas.textAlign = "left";
12254
+ this.Canvas.textBaseline = "middle";
12255
+
12256
+ var yText=null;
12257
+ if (position==1)
12258
+ {
12259
+ yText=border.TopEx;
12260
+ if (IFrameSplitOperator.IsNumber(outRange.TopYOffset)) yText+=outRange.TopYOffset;
12261
+ }
12262
+ else if (position==2)
12263
+ {
12264
+ yText=border.BottomEx+textHeight;
12265
+ if (IFrameSplitOperator.IsNumber(outRange.BottomYOffset)) yText+=outRange.BottomYOffset;
12266
+ }
12267
+
12268
+ for(var i=0;i<textInfo.Text.length;++i)
12269
+ {
12270
+ var itemText=textInfo.Text[i];
12271
+ var rtBG={ Right:itemRight, Width:itemText.Width, Bottom:yText, Height:textHeight };
12272
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
12273
+ rtBG.Left=rtBG.Right-rtBG.Width;
12274
+
12275
+ if (item.ExtendLine && item.ExtendLine[1]) //右侧延长线
12276
+ {
12277
+ var exLine=item.ExtendLine[1];
12278
+ if (IFrameSplitOperator.IsNumber(exLine.Width))
12279
+ {
12280
+ var yLine=rtBG.Bottom;
12281
+ if (position==2) yLine=rtBG.Top;
12282
+ var lineType=item.LineType;
12283
+ if (IFrameSplitOperator.IsNumber(outRange.ExtendLine.Type)) lineType=outRange.ExtendLine.Type;
12284
+ if (i==0) this.DrawLine(right,right+exLine.Width,yLine,item.LineColor,lineType,item);
12285
+
12286
+ rtBG.Left+=exLine.Width;
12287
+ rtBG.Right+=exLine.Width;
12288
+ }
12289
+ }
12290
+
12291
+ this.Canvas.fillStyle=outRange.BGColor;
12292
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
12293
+ if (outRange.Border && outRange.Border.Color)
12294
+ {
12295
+ if (IFrameSplitOperator.IsNonEmptyArray(outRange.Border.LineDash))
12296
+ this.Canvas.setLineDash(outRange.Border.LineDash); //虚线
12297
+
12298
+ this.Canvas.strokeStyle = outRange.Border.Color;
12299
+ this.Canvas.strokeRect(ToFixedPoint(rtBG.Left), ToFixedPoint(rtBG.Top), ToFixedRect(rtBG.Width), ToFixedRect(rtBG.Height));
12300
+ }
12301
+
12302
+ this.Canvas.fillStyle = outRange.TextColor;
12303
+ this.Canvas.fillText(itemText.Text, rtBG.Left + 1*pixelTatio, rtBG.Top+rtBG.Height/2+1*pixelTatio);
12304
+
12305
+ yText+=textHeight+1;
12306
+ }
12307
+ }
12308
+
12309
+ this.Canvas.restore();
12310
+ }
12311
+
12204
12312
  this.DrawCustomItem=function(item, mapTextRect) //显示自定义Y刻度
12205
12313
  {
12206
12314
  if (!item.Message[1] && !item.Message[0]) return;
12207
12315
  if (item.Value>this.HorizontalMax || item.Value<this.HorizontalMin)
12208
12316
  {
12317
+ this.DrawOutRangeCustomItem(item, mapTextRect);
12209
12318
  this.SendDrawCountDownEvent( { IsShow:false } );
12210
12319
  return;
12211
12320
  }
@@ -17058,6 +17167,7 @@ function OverlayKLineFrame()
17058
17167
  if (!item.Message[1] && !item.Message[0]) return;
17059
17168
  if (item.Value>this.HorizontalMax || item.Value<this.HorizontalMin)
17060
17169
  {
17170
+ //this.DrawOutRangeCustomItem(item, mapTextRect);
17061
17171
  this.SendDrawCountDownEvent( { IsShow:false } );
17062
17172
  return;
17063
17173
  }
@@ -13942,6 +13942,9 @@ function CoordinateInfo()
13942
13942
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
13943
13943
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
13944
13944
  this.AreaData; //区域: { Start:, End:, BGColor:, Position:[0=左, 1=右] }
13945
+
13946
+ //不在当前屏范围
13947
+ //this.OutRange={ BGColor:"", TextColor:, BorderColor: TopYOffset:, BottomYOffset: }
13945
13948
  }
13946
13949
 
13947
13950
 
@@ -16126,11 +16129,117 @@ function AverageWidthFrame()
16126
16129
  return { MaxWidth:width, Text:aryText };
16127
16130
  }
16128
16131
 
16132
+ this.DrawOutRangeCustomItem=function(item, mapTextRect)
16133
+ {
16134
+ if (this.IsHScreen===true) return;
16135
+ if (!this.IsShow && !this.IsYDrawMainFrame) return;
16136
+ if (!item.Message[1] && !item.Message[0]) return;
16137
+ if (!item.OutRange) return;
16138
+ var position=0; //1=top 2=bottom
16139
+ if (item.Value>this.HorizontalMax) position=1;
16140
+ else if (item.Value<this.HorizontalMin) position=2;
16141
+ else return;
16142
+
16143
+ this.Canvas.save();
16144
+ var outRange=item.OutRange;
16145
+ var border=this.GetBorder();
16146
+ var left=border.Left;
16147
+ var right=border.Right;
16148
+ var bottom=border.Bottom;
16149
+ var top=border.Top;
16150
+ var borderRight = this.ChartBorder.Right;
16151
+ var borderLeft = this.ChartBorder.Left;
16152
+ var titleHeight = this.ChartBorder.TitleHeight;
16153
+
16154
+ if (this.IsHScreen)
16155
+ {
16156
+ borderLeft=this.ChartBorder.Top;
16157
+ borderRight=this.ChartBorder.Bottom;
16158
+ top=border.Top;
16159
+ bottom=border.Bottom;
16160
+ }
16161
+
16162
+ var pixelTatio = GetDevicePixelRatio();
16163
+ var defaultTextHeight=18*pixelTatio;
16164
+ var textHeight=defaultTextHeight;
16165
+
16166
+ if (item.Message[0] && borderLeft>=10)
16167
+ {
16168
+
16169
+ }
16170
+ else if (item.Message[1] && borderRight>=10)
16171
+ {
16172
+ if (item.Font != null) this.Canvas.font = item.Font;
16173
+ var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);
16174
+ var textWidth=textInfo.MaxWidth;
16175
+ var itemRight=right+textWidth;
16176
+ var fontHeight=this.GetFontHeight();
16177
+ var textHeight=fontHeight>defaultTextHeight? fontHeight:defaultTextHeight;
16178
+ this.Canvas.textAlign = "left";
16179
+ this.Canvas.textBaseline = "middle";
16180
+
16181
+ var yText=null;
16182
+ if (position==1)
16183
+ {
16184
+ yText=border.TopEx;
16185
+ if (IFrameSplitOperator.IsNumber(outRange.TopYOffset)) yText+=outRange.TopYOffset;
16186
+ }
16187
+ else if (position==2)
16188
+ {
16189
+ yText=border.BottomEx+textHeight;
16190
+ if (IFrameSplitOperator.IsNumber(outRange.BottomYOffset)) yText+=outRange.BottomYOffset;
16191
+ }
16192
+
16193
+ for(var i=0;i<textInfo.Text.length;++i)
16194
+ {
16195
+ var itemText=textInfo.Text[i];
16196
+ var rtBG={ Right:itemRight, Width:itemText.Width, Bottom:yText, Height:textHeight };
16197
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
16198
+ rtBG.Left=rtBG.Right-rtBG.Width;
16199
+
16200
+ if (item.ExtendLine && item.ExtendLine[1]) //右侧延长线
16201
+ {
16202
+ var exLine=item.ExtendLine[1];
16203
+ if (IFrameSplitOperator.IsNumber(exLine.Width))
16204
+ {
16205
+ var yLine=rtBG.Bottom;
16206
+ if (position==2) yLine=rtBG.Top;
16207
+ var lineType=item.LineType;
16208
+ if (IFrameSplitOperator.IsNumber(outRange.ExtendLine.Type)) lineType=outRange.ExtendLine.Type;
16209
+ if (i==0) this.DrawLine(right,right+exLine.Width,yLine,item.LineColor,lineType,item);
16210
+
16211
+ rtBG.Left+=exLine.Width;
16212
+ rtBG.Right+=exLine.Width;
16213
+ }
16214
+ }
16215
+
16216
+ this.Canvas.fillStyle=outRange.BGColor;
16217
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
16218
+ if (outRange.Border && outRange.Border.Color)
16219
+ {
16220
+ if (IFrameSplitOperator.IsNonEmptyArray(outRange.Border.LineDash))
16221
+ this.Canvas.setLineDash(outRange.Border.LineDash); //虚线
16222
+
16223
+ this.Canvas.strokeStyle = outRange.Border.Color;
16224
+ this.Canvas.strokeRect(ToFixedPoint(rtBG.Left), ToFixedPoint(rtBG.Top), ToFixedRect(rtBG.Width), ToFixedRect(rtBG.Height));
16225
+ }
16226
+
16227
+ this.Canvas.fillStyle = outRange.TextColor;
16228
+ this.Canvas.fillText(itemText.Text, rtBG.Left + 1*pixelTatio, rtBG.Top+rtBG.Height/2+1*pixelTatio);
16229
+
16230
+ yText+=textHeight+1;
16231
+ }
16232
+ }
16233
+
16234
+ this.Canvas.restore();
16235
+ }
16236
+
16129
16237
  this.DrawCustomItem=function(item, mapTextRect) //显示自定义Y刻度
16130
16238
  {
16131
16239
  if (!item.Message[1] && !item.Message[0]) return;
16132
16240
  if (item.Value>this.HorizontalMax || item.Value<this.HorizontalMin)
16133
16241
  {
16242
+ this.DrawOutRangeCustomItem(item, mapTextRect);
16134
16243
  this.SendDrawCountDownEvent( { IsShow:false } );
16135
16244
  return;
16136
16245
  }
@@ -20983,6 +21092,7 @@ function OverlayKLineFrame()
20983
21092
  if (!item.Message[1] && !item.Message[0]) return;
20984
21093
  if (item.Value>this.HorizontalMax || item.Value<this.HorizontalMin)
20985
21094
  {
21095
+ //this.DrawOutRangeCustomItem(item, mapTextRect);
20986
21096
  this.SendDrawCountDownEvent( { IsShow:false } );
20987
21097
  return;
20988
21098
  }
@@ -13986,6 +13986,9 @@ function CoordinateInfo()
13986
13986
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
13987
13987
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
13988
13988
  this.AreaData; //区域: { Start:, End:, BGColor:, Position:[0=左, 1=右] }
13989
+
13990
+ //不在当前屏范围
13991
+ //this.OutRange={ BGColor:"", TextColor:, BorderColor: TopYOffset:, BottomYOffset: }
13989
13992
  }
13990
13993
 
13991
13994
 
@@ -16170,11 +16173,117 @@ function AverageWidthFrame()
16170
16173
  return { MaxWidth:width, Text:aryText };
16171
16174
  }
16172
16175
 
16176
+ this.DrawOutRangeCustomItem=function(item, mapTextRect)
16177
+ {
16178
+ if (this.IsHScreen===true) return;
16179
+ if (!this.IsShow && !this.IsYDrawMainFrame) return;
16180
+ if (!item.Message[1] && !item.Message[0]) return;
16181
+ if (!item.OutRange) return;
16182
+ var position=0; //1=top 2=bottom
16183
+ if (item.Value>this.HorizontalMax) position=1;
16184
+ else if (item.Value<this.HorizontalMin) position=2;
16185
+ else return;
16186
+
16187
+ this.Canvas.save();
16188
+ var outRange=item.OutRange;
16189
+ var border=this.GetBorder();
16190
+ var left=border.Left;
16191
+ var right=border.Right;
16192
+ var bottom=border.Bottom;
16193
+ var top=border.Top;
16194
+ var borderRight = this.ChartBorder.Right;
16195
+ var borderLeft = this.ChartBorder.Left;
16196
+ var titleHeight = this.ChartBorder.TitleHeight;
16197
+
16198
+ if (this.IsHScreen)
16199
+ {
16200
+ borderLeft=this.ChartBorder.Top;
16201
+ borderRight=this.ChartBorder.Bottom;
16202
+ top=border.Top;
16203
+ bottom=border.Bottom;
16204
+ }
16205
+
16206
+ var pixelTatio = GetDevicePixelRatio();
16207
+ var defaultTextHeight=18*pixelTatio;
16208
+ var textHeight=defaultTextHeight;
16209
+
16210
+ if (item.Message[0] && borderLeft>=10)
16211
+ {
16212
+
16213
+ }
16214
+ else if (item.Message[1] && borderRight>=10)
16215
+ {
16216
+ if (item.Font != null) this.Canvas.font = item.Font;
16217
+ var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);
16218
+ var textWidth=textInfo.MaxWidth;
16219
+ var itemRight=right+textWidth;
16220
+ var fontHeight=this.GetFontHeight();
16221
+ var textHeight=fontHeight>defaultTextHeight? fontHeight:defaultTextHeight;
16222
+ this.Canvas.textAlign = "left";
16223
+ this.Canvas.textBaseline = "middle";
16224
+
16225
+ var yText=null;
16226
+ if (position==1)
16227
+ {
16228
+ yText=border.TopEx;
16229
+ if (IFrameSplitOperator.IsNumber(outRange.TopYOffset)) yText+=outRange.TopYOffset;
16230
+ }
16231
+ else if (position==2)
16232
+ {
16233
+ yText=border.BottomEx+textHeight;
16234
+ if (IFrameSplitOperator.IsNumber(outRange.BottomYOffset)) yText+=outRange.BottomYOffset;
16235
+ }
16236
+
16237
+ for(var i=0;i<textInfo.Text.length;++i)
16238
+ {
16239
+ var itemText=textInfo.Text[i];
16240
+ var rtBG={ Right:itemRight, Width:itemText.Width, Bottom:yText, Height:textHeight };
16241
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
16242
+ rtBG.Left=rtBG.Right-rtBG.Width;
16243
+
16244
+ if (item.ExtendLine && item.ExtendLine[1]) //右侧延长线
16245
+ {
16246
+ var exLine=item.ExtendLine[1];
16247
+ if (IFrameSplitOperator.IsNumber(exLine.Width))
16248
+ {
16249
+ var yLine=rtBG.Bottom;
16250
+ if (position==2) yLine=rtBG.Top;
16251
+ var lineType=item.LineType;
16252
+ if (IFrameSplitOperator.IsNumber(outRange.ExtendLine.Type)) lineType=outRange.ExtendLine.Type;
16253
+ if (i==0) this.DrawLine(right,right+exLine.Width,yLine,item.LineColor,lineType,item);
16254
+
16255
+ rtBG.Left+=exLine.Width;
16256
+ rtBG.Right+=exLine.Width;
16257
+ }
16258
+ }
16259
+
16260
+ this.Canvas.fillStyle=outRange.BGColor;
16261
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
16262
+ if (outRange.Border && outRange.Border.Color)
16263
+ {
16264
+ if (IFrameSplitOperator.IsNonEmptyArray(outRange.Border.LineDash))
16265
+ this.Canvas.setLineDash(outRange.Border.LineDash); //虚线
16266
+
16267
+ this.Canvas.strokeStyle = outRange.Border.Color;
16268
+ this.Canvas.strokeRect(ToFixedPoint(rtBG.Left), ToFixedPoint(rtBG.Top), ToFixedRect(rtBG.Width), ToFixedRect(rtBG.Height));
16269
+ }
16270
+
16271
+ this.Canvas.fillStyle = outRange.TextColor;
16272
+ this.Canvas.fillText(itemText.Text, rtBG.Left + 1*pixelTatio, rtBG.Top+rtBG.Height/2+1*pixelTatio);
16273
+
16274
+ yText+=textHeight+1;
16275
+ }
16276
+ }
16277
+
16278
+ this.Canvas.restore();
16279
+ }
16280
+
16173
16281
  this.DrawCustomItem=function(item, mapTextRect) //显示自定义Y刻度
16174
16282
  {
16175
16283
  if (!item.Message[1] && !item.Message[0]) return;
16176
16284
  if (item.Value>this.HorizontalMax || item.Value<this.HorizontalMin)
16177
16285
  {
16286
+ this.DrawOutRangeCustomItem(item, mapTextRect);
16178
16287
  this.SendDrawCountDownEvent( { IsShow:false } );
16179
16288
  return;
16180
16289
  }
@@ -21027,6 +21136,7 @@ function OverlayKLineFrame()
21027
21136
  if (!item.Message[1] && !item.Message[0]) return;
21028
21137
  if (item.Value>this.HorizontalMax || item.Value<this.HorizontalMin)
21029
21138
  {
21139
+ //this.DrawOutRangeCustomItem(item, mapTextRect);
21030
21140
  this.SendDrawCountDownEvent( { IsShow:false } );
21031
21141
  return;
21032
21142
  }