hqchart 1.1.13994 → 1.1.13998
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/umychart.vue.js
CHANGED
|
@@ -2397,20 +2397,22 @@ this.GetYData=function(y,isLimit){if(this.Logarithmic&&this.GetYLogarithmicFromD
|
|
|
2397
2397
|
{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轴数值
|
|
2398
2398
|
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轴坐标信息
|
|
2399
2399
|
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);}};//字体外部设置好
|
|
2400
|
-
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;
|
|
2400
|
+
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;if(item.BGColor)outItem.BGColor=item.BGColor;if(IFrameSplitOperator.IsBool(item.EnableBGColor))outItem.EnableBGColor=item.EnableBGColor;//是否启用背景色
|
|
2401
|
+
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
|
|
2401
2402
|
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){if(item.Font!=null)this.Canvas.font=item.Font;var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var itemLeft=left-textWidth;var fontHeight=this.GetFontHeight();var textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;this.Canvas.textAlign="right";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={Left:itemLeft,Width:itemText.Width,Bottom:yText,Height:textHeight};rtBG.Top=rtBG.Bottom-rtBG.Height;rtBG.Right=rtBG.Left+rtBG.Width;if(item.ExtendLine&&item.ExtendLine[0])//右侧延长线
|
|
2402
2403
|
{var exLine=item.ExtendLine[0];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(left,left-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);//虚线
|
|
2403
2404
|
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.Right-1*pixelTatio,rtBG.Top+rtBG.Height/2+1*pixelTatio);yText+=textHeight+1;}}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])//右侧延长线
|
|
2404
2405
|
{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);//虚线
|
|
2405
2406
|
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刻度
|
|
2406
|
-
{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=
|
|
2407
|
+
{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=5*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])// 左 position=2 集合竞价右侧
|
|
2407
2408
|
{if(borderLeft<10||position==1||position==2){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+')';//内部刻度 背景增加透明度
|
|
2408
2409
|
if(item.BGColor)bgColor=item.BGColor;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{if(position==2)left=border.LeftEx-textInfo.MaxWidth;var bgTop=yText-textHeight/2-1*pixelTatio;var textLeft=left+1*pixelTatio;if(item.ExtendLine&&item.ExtendLine[0]&&position==2)//左侧延长线
|
|
2409
2410
|
{var exLine=item.ExtendLine[0];if(IFrameSplitOperator.IsNumber(exLine.Width)){var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(exLine.Type))lineType=exLine.Type;//外部设置延长线样式
|
|
2410
2411
|
if(i==0){var yLine=border.LeftEx-exLine.Width;this.DrawLine(yLine,yLine+exLine.Width,y,item.LineColor,lineType,item);}textLeft-=exLine.Width;//rectLeft-=exLine.Width
|
|
2411
2412
|
}}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){if(position==2)this.DrawLine(border.LeftEx,right,yText,item.LineColor,item.LineType,item);else this.DrawLine(textLeft+itemText.Width,right,yText,item.LineColor,item.LineType,item);}if(item.ClickData)this.AddHorizontalLabel(textLeft,bgTop,itemText.Width,textHeight,item,i);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(item.ExtendLine&&item.ExtendLine[0])//右侧延长线
|
|
2412
2413
|
{var exLine=item.ExtendLine[0];if(IFrameSplitOperator.IsNumber(exLine.Width)){var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(exLine.Type))lineType=exLine.Type;//外部设置延长线样式
|
|
2413
|
-
|
|
2414
|
+
var exLineColor=item.LineColor;if(exLine.LineColor)exLineColor=exLine.LineColor;//设置线段颜色
|
|
2415
|
+
if(i==0)this.DrawLine(left,left-exLine.Width,y,exLineColor,lineType,item);textLeft-=exLine.Width;rectLeft-=exLine.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{if(!(itemText.EnableBGColor===false)){var textBGColor=item.LineColor;if(itemText.BGColor)textBGColor=itemText.BGColor;this.Canvas.fillStyle=textBGColor;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);if(item.ClickData)//点击事件
|
|
2414
2416
|
this.AddHorizontalLabel(textLeft,bgTop,itemText.Width,textHeight,item,i);yText+=textHeight+1*pixelTatio;}}}}else if(item.Message[1])//右
|
|
2415
2417
|
{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+')';//内部刻度 背景增加透明度
|
|
2416
2418
|
var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){var bgTop=bottom-itemText.Width;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(top,bgTop,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{if(itemText.Type===1){if(this.GetEventCallback){var bgTop=yText-textHeight/2-1*pixelTatio;var sendData={Top:bgTop,Right:right,Height:null,IsShow:true,BGColor:item.LineColor,TextColor:item.TextColor,PixelTatio:pixelTatio,Position:"Right",IsInside:true};if(this.SendDrawCountDownEvent(sendData)){if(IFrameSplitOperator.IsPlusNumber(sendData.Height))yText+=textHeight+1*pixelTatio;}}}else{var bgTop=yText-textHeight/2-1*pixelTatio;var textLeft=right-itemText.Width;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);//文本背景区域
|
|
@@ -13877,7 +13879,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
13877
13879
|
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);};}/********************************************************************************
|
|
13878
13880
|
* 版本信息输出
|
|
13879
13881
|
*
|
|
13880
|
-
*/var HQCHART_VERSION="1.1.
|
|
13882
|
+
*/var HQCHART_VERSION="1.1.13997";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();//把给外界调用的方法暴露出来
|
|
13881
13883
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
13882
13884
|
// BaseIndex:BaseIndex,
|
|
13883
13885
|
// ChartLine:ChartLine,
|
package/package.json
CHANGED
package/src/jscommon/umychart.js
CHANGED
|
@@ -12660,6 +12660,8 @@ function AverageWidthFrame()
|
|
|
12660
12660
|
if (value>width) width=value;
|
|
12661
12661
|
var outItem={ Text:text[i].Text, Width:value+2*pixelTatio };
|
|
12662
12662
|
if (item.TextColor) outItem.TextColor=item.TextColor;
|
|
12663
|
+
if (item.BGColor) outItem.BGColor=item.BGColor;
|
|
12664
|
+
if (IFrameSplitOperator.IsBool(item.EnableBGColor)) outItem.EnableBGColor=item.EnableBGColor; //是否启用背景色
|
|
12663
12665
|
aryText.push(outItem);
|
|
12664
12666
|
}
|
|
12665
12667
|
}
|
|
@@ -12868,7 +12870,7 @@ function AverageWidthFrame()
|
|
|
12868
12870
|
}
|
|
12869
12871
|
|
|
12870
12872
|
var pixelTatio = GetDevicePixelRatio();
|
|
12871
|
-
var defaultTextHeight=
|
|
12873
|
+
var defaultTextHeight=5*pixelTatio;
|
|
12872
12874
|
var textHeight=defaultTextHeight;
|
|
12873
12875
|
var y;
|
|
12874
12876
|
|
|
@@ -13018,9 +13020,11 @@ function AverageWidthFrame()
|
|
|
13018
13020
|
{
|
|
13019
13021
|
var lineType=item.LineType;
|
|
13020
13022
|
if (IFrameSplitOperator.IsNumber(exLine.Type)) lineType=exLine.Type; //外部设置延长线样式
|
|
13021
|
-
|
|
13023
|
+
var exLineColor=item.LineColor;
|
|
13024
|
+
if (exLine.LineColor) exLineColor=exLine.LineColor; //设置线段颜色
|
|
13025
|
+
if (i==0) this.DrawLine(left,left-exLine.Width,y,exLineColor,lineType,item);
|
|
13022
13026
|
textLeft-=exLine.Width;
|
|
13023
|
-
rectLeft-=exLine.Width
|
|
13027
|
+
rectLeft-=exLine.Width;
|
|
13024
13028
|
}
|
|
13025
13029
|
}
|
|
13026
13030
|
|
|
@@ -13035,8 +13039,14 @@ function AverageWidthFrame()
|
|
|
13035
13039
|
}
|
|
13036
13040
|
else
|
|
13037
13041
|
{
|
|
13038
|
-
|
|
13039
|
-
|
|
13042
|
+
if (!(itemText.EnableBGColor===false))
|
|
13043
|
+
{
|
|
13044
|
+
var textBGColor=item.LineColor;
|
|
13045
|
+
if (itemText.BGColor) textBGColor=itemText.BGColor;
|
|
13046
|
+
this.Canvas.fillStyle=textBGColor;
|
|
13047
|
+
this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);
|
|
13048
|
+
}
|
|
13049
|
+
|
|
13040
13050
|
this.Canvas.fillStyle = item.TextColor;
|
|
13041
13051
|
this.Canvas.fillText(itemText.Text, textLeft - 1*pixelTatio, yText);
|
|
13042
13052
|
}
|
|
@@ -16585,6 +16585,8 @@ function AverageWidthFrame()
|
|
|
16585
16585
|
if (value>width) width=value;
|
|
16586
16586
|
var outItem={ Text:text[i].Text, Width:value+2*pixelTatio };
|
|
16587
16587
|
if (item.TextColor) outItem.TextColor=item.TextColor;
|
|
16588
|
+
if (item.BGColor) outItem.BGColor=item.BGColor;
|
|
16589
|
+
if (IFrameSplitOperator.IsBool(item.EnableBGColor)) outItem.EnableBGColor=item.EnableBGColor; //是否启用背景色
|
|
16588
16590
|
aryText.push(outItem);
|
|
16589
16591
|
}
|
|
16590
16592
|
}
|
|
@@ -16793,7 +16795,7 @@ function AverageWidthFrame()
|
|
|
16793
16795
|
}
|
|
16794
16796
|
|
|
16795
16797
|
var pixelTatio = GetDevicePixelRatio();
|
|
16796
|
-
var defaultTextHeight=
|
|
16798
|
+
var defaultTextHeight=5*pixelTatio;
|
|
16797
16799
|
var textHeight=defaultTextHeight;
|
|
16798
16800
|
var y;
|
|
16799
16801
|
|
|
@@ -16943,9 +16945,11 @@ function AverageWidthFrame()
|
|
|
16943
16945
|
{
|
|
16944
16946
|
var lineType=item.LineType;
|
|
16945
16947
|
if (IFrameSplitOperator.IsNumber(exLine.Type)) lineType=exLine.Type; //外部设置延长线样式
|
|
16946
|
-
|
|
16948
|
+
var exLineColor=item.LineColor;
|
|
16949
|
+
if (exLine.LineColor) exLineColor=exLine.LineColor; //设置线段颜色
|
|
16950
|
+
if (i==0) this.DrawLine(left,left-exLine.Width,y,exLineColor,lineType,item);
|
|
16947
16951
|
textLeft-=exLine.Width;
|
|
16948
|
-
rectLeft-=exLine.Width
|
|
16952
|
+
rectLeft-=exLine.Width;
|
|
16949
16953
|
}
|
|
16950
16954
|
}
|
|
16951
16955
|
|
|
@@ -16960,8 +16964,14 @@ function AverageWidthFrame()
|
|
|
16960
16964
|
}
|
|
16961
16965
|
else
|
|
16962
16966
|
{
|
|
16963
|
-
|
|
16964
|
-
|
|
16967
|
+
if (!(itemText.EnableBGColor===false))
|
|
16968
|
+
{
|
|
16969
|
+
var textBGColor=item.LineColor;
|
|
16970
|
+
if (itemText.BGColor) textBGColor=itemText.BGColor;
|
|
16971
|
+
this.Canvas.fillStyle=textBGColor;
|
|
16972
|
+
this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);
|
|
16973
|
+
}
|
|
16974
|
+
|
|
16965
16975
|
this.Canvas.fillStyle = item.TextColor;
|
|
16966
16976
|
this.Canvas.fillText(itemText.Text, textLeft - 1*pixelTatio, yText);
|
|
16967
16977
|
}
|
|
@@ -138802,7 +138812,7 @@ function ScrollBarBGChart()
|
|
|
138802
138812
|
|
|
138803
138813
|
|
|
138804
138814
|
|
|
138805
|
-
var HQCHART_VERSION="1.1.
|
|
138815
|
+
var HQCHART_VERSION="1.1.13997";
|
|
138806
138816
|
|
|
138807
138817
|
function PrintHQChartVersion()
|
|
138808
138818
|
{
|
|
@@ -16629,6 +16629,8 @@ function AverageWidthFrame()
|
|
|
16629
16629
|
if (value>width) width=value;
|
|
16630
16630
|
var outItem={ Text:text[i].Text, Width:value+2*pixelTatio };
|
|
16631
16631
|
if (item.TextColor) outItem.TextColor=item.TextColor;
|
|
16632
|
+
if (item.BGColor) outItem.BGColor=item.BGColor;
|
|
16633
|
+
if (IFrameSplitOperator.IsBool(item.EnableBGColor)) outItem.EnableBGColor=item.EnableBGColor; //是否启用背景色
|
|
16632
16634
|
aryText.push(outItem);
|
|
16633
16635
|
}
|
|
16634
16636
|
}
|
|
@@ -16837,7 +16839,7 @@ function AverageWidthFrame()
|
|
|
16837
16839
|
}
|
|
16838
16840
|
|
|
16839
16841
|
var pixelTatio = GetDevicePixelRatio();
|
|
16840
|
-
var defaultTextHeight=
|
|
16842
|
+
var defaultTextHeight=5*pixelTatio;
|
|
16841
16843
|
var textHeight=defaultTextHeight;
|
|
16842
16844
|
var y;
|
|
16843
16845
|
|
|
@@ -16987,9 +16989,11 @@ function AverageWidthFrame()
|
|
|
16987
16989
|
{
|
|
16988
16990
|
var lineType=item.LineType;
|
|
16989
16991
|
if (IFrameSplitOperator.IsNumber(exLine.Type)) lineType=exLine.Type; //外部设置延长线样式
|
|
16990
|
-
|
|
16992
|
+
var exLineColor=item.LineColor;
|
|
16993
|
+
if (exLine.LineColor) exLineColor=exLine.LineColor; //设置线段颜色
|
|
16994
|
+
if (i==0) this.DrawLine(left,left-exLine.Width,y,exLineColor,lineType,item);
|
|
16991
16995
|
textLeft-=exLine.Width;
|
|
16992
|
-
rectLeft-=exLine.Width
|
|
16996
|
+
rectLeft-=exLine.Width;
|
|
16993
16997
|
}
|
|
16994
16998
|
}
|
|
16995
16999
|
|
|
@@ -17004,8 +17008,14 @@ function AverageWidthFrame()
|
|
|
17004
17008
|
}
|
|
17005
17009
|
else
|
|
17006
17010
|
{
|
|
17007
|
-
|
|
17008
|
-
|
|
17011
|
+
if (!(itemText.EnableBGColor===false))
|
|
17012
|
+
{
|
|
17013
|
+
var textBGColor=item.LineColor;
|
|
17014
|
+
if (itemText.BGColor) textBGColor=itemText.BGColor;
|
|
17015
|
+
this.Canvas.fillStyle=textBGColor;
|
|
17016
|
+
this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);
|
|
17017
|
+
}
|
|
17018
|
+
|
|
17009
17019
|
this.Canvas.fillStyle = item.TextColor;
|
|
17010
17020
|
this.Canvas.fillText(itemText.Text, textLeft - 1*pixelTatio, yText);
|
|
17011
17021
|
}
|
|
@@ -145184,7 +145194,7 @@ function HQChartScriptWorker()
|
|
|
145184
145194
|
|
|
145185
145195
|
|
|
145186
145196
|
|
|
145187
|
-
var HQCHART_VERSION="1.1.
|
|
145197
|
+
var HQCHART_VERSION="1.1.13997";
|
|
145188
145198
|
|
|
145189
145199
|
function PrintHQChartVersion()
|
|
145190
145200
|
{
|