hqchart 1.1.14864 → 1.1.14870
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
|
@@ -2682,9 +2682,9 @@ for(var i=0;i<this.VerticalInfo.length;++i){var item=this.VerticalInfo[i];var x=
|
|
|
2682
2682
|
this.Canvas.beginPath();this.Canvas.moveTo(xFixed,top);this.Canvas.lineTo(xFixed,bottom);this.Canvas.stroke();this.Canvas.setLineDash([]);}else{this.Canvas.strokeStyle=this.VerticalInfo[i].LineColor;this.Canvas.beginPath();this.Canvas.moveTo(xFixed,top);this.Canvas.lineTo(xFixed,bottom);this.Canvas.stroke();}}}if(item.BG&&this.DrawDayVertical){this.DrawDayVertical(item,x,border);}if(item.Message[0]!=null&&this.ChartBorder.Bottom>5*pixelRatio){if(IFrameSplitOperator.IsObject(item.Message[0])){var textObj=item.Message[0];if(!textObj.Font)textObj.Font=item.Font;if(!textObj.TextColor)textObj.TextColor=item.TextColor;var drawInfo=this.GetMultiLineVTextSize(textObj);if(drawInfo){drawInfo.XCenter=x;var rtBottom={Left:0,Right:right,Top:bottom+2*pixelRatio,Bottom:border.Height};rtBottom.Width=rtBottom.Right-rtBottom.Left;rtBottom.Height=rtBottom.Bottom-rtBottom.Top;drawInfo.RectBottom=rtBottom;drawInfo.TextRightPrev=textRightPrev;this.DrawMultiLineVText(drawInfo);if(drawInfo.TextRight)textRightPrev=drawInfo.TextRight;}}else{if(item.Font)this.Canvas.font=item.Font;var textLeft=0;this.Canvas.strokeStyle=item.TextColor;var testWidth=this.Canvas.measureText(item.Message[0]).width;var textHeight=this.Canvas.measureText("擎").width;if(bottomTextExtend&&bottomTextExtend.Align==1){this.Canvas.textAlign="left";this.Canvas.textBaseline="top";textLeft=x;}else{if(x<testWidth/2){this.Canvas.textAlign="left";this.Canvas.textBaseline="top";textLeft=x;}else if(x+testWidth/2>=this.ChartBorder.GetChartWidth()){this.Canvas.textAlign="right";this.Canvas.textBaseline="top";textLeft=x-testWidth;}else{this.Canvas.textAlign="center";this.Canvas.textBaseline="top";textLeft=x-testWidth/2;}}if(textRightPrev==null||textLeft>textRightPrev){var yText=bottom;if(item.LineType==3){var lineLength=this.ShortXLineLength*pixelRatio;this.Canvas.beginPath();this.Canvas.moveTo(xFixed,yText);this.Canvas.lineTo(xFixed,yText+lineLength);this.Canvas.stroke();yText+=lineLength+2*pixelRatio;}if(bottomLineExtend){if(bottomLineExtend.Mode===1){if(item.Value>1){if(bottomLineExtend.Color)this.Canvas.strokeStyle=bottomLineExtend.Color;this.Canvas.beginPath();this.Canvas.moveTo(xFixed,bottom);this.Canvas.lineTo(xFixed,border.ChartHeight);this.Canvas.stroke();x+=1;}}else if(bottomLineExtend.Mode===2){if(bottomLineExtend.Width>=1){var lineLength=bottomLineExtend.Width;if(bottomLineExtend.Color)this.Canvas.strokeStyle=bottomLineExtend.Color;this.Canvas.beginPath();this.Canvas.moveTo(xFixed,yText);this.Canvas.lineTo(xFixed,yText+lineLength);this.Canvas.stroke();yText+=lineLength+2;}}}//item.TextBGColor="rgb(0,255,0)";
|
|
2683
2683
|
if(item.TextBGColor)//文字背景色
|
|
2684
2684
|
{var rtText={Left:textLeft,Top:yText+this.XBottomOffset,Width:testWidth,Height:textHeight};this.Canvas.fillStyle=item.TextBGColor;this.Canvas.fillRect(rtText.Left-1,rtText.Top,rtText.Width+2,rtText.Height);}this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(this.VerticalInfo[i].Message[0],x,yText+this.XBottomOffset);textRightPrev=textLeft+testWidth;}}}xPrev=x;}};//{Font:, AryText:[ { AryText:[{ Text:, Color: }], }, ] }
|
|
2685
|
-
this.GetMultiLineVTextSize=function(obj){if(obj.Font)this.Canvas.font=obj.Font;var lineHeight=this.Canvas.measureText('擎').width;var aryLine=[];for(var i=0;i<obj.AryText.length;++i){var item=obj.AryText[i];var lineInfo={Width:0,Height:lineHeight,AryText:[],Align:2,Margin:{Top:1,Bottom:1},YOffset:-1};if(item.Margin){if(IFrameSplitOperator.IsNumber(item.Margin.Top))lineInfo.Margin.Top=item.Margin.Top;if(IFrameSplitOperator.IsNumber(item.Margin.Bottom))lineInfo.Margin.Bottom=item.Margin.Bottom;}if(IFrameSplitOperator.IsNumber(item.YOffset))lineInfo.YOffset=item.YOffset;lineInfo.Height=lineHeight+lineInfo.Margin.Top+lineInfo.Margin.Bottom;for(var j=0;j<item.AryText.length;++j){var subItem=item.AryText[j];if(!subItem||!subItem.Text)continue;var width=this.Canvas.measureText(subItem.Text).width;var textItem={Width:width,Text:subItem.Text,Color:obj.TextColor,Margin:{Left:0,Right:0}};if(subItem.Color)textItem.Color=subItem.Color;if(subItem.Margin){if(IFrameSplitOperator.IsNumber(subItem.Margin.Left))textItem.Margin.Left=subItem.Margin.Left;if(IFrameSplitOperator.IsNumber(subItem.Margin.Right))textItem.Margin.Right=subItem.Margin.Right;}textItem.Width=width+textItem.Margin.Right+textItem.Margin.Left;lineInfo.Width+=textItem.Width;lineInfo.AryText.push(textItem);}aryLine.push(lineInfo);}if(aryLine.length<=0)return null;var width=0,height=0;for(var i=0;i<aryLine.length;++i){var item=aryLine[i];if(width<item.Width)width=item.Width;height+=item.Height;}if(width<=0||height<=0)return null;
|
|
2686
|
-
};//X轴底部文字多行输出
|
|
2687
|
-
this.DrawMultiLineVText=function(drawInfo){var xLeft=drawInfo.XCenter-drawInfo.Width/2;if(drawInfo.TextRightPrev!=null&&drawInfo.TextRightPrev>xLeft)return false;this.Canvas.font=drawInfo.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var yText=drawInfo.RectBottom.Top;var textRight=null;for(var i=0,j=0;i<drawInfo.AryLine.length;++i){var lineItem=drawInfo.AryLine[i];if(lineItem.Align==2)var xLeft=drawInfo.XCenter-lineItem.Width/2;if(xLeft<1)xLeft=1;yText+=lineItem.Height;for(j=0;j<lineItem.AryText.length;++j){var item=lineItem.AryText[j];this.Canvas.fillStyle=item.Color;this.Canvas.fillText(item.Text,xLeft+item.Margin.Left,yText+lineItem.YOffset);xLeft+=item.Width;}if(textRight==null||textRight<xLeft)textRight=xLeft;}drawInfo.TextRight=textRight;return true;};//Y坐标转y轴数值
|
|
2685
|
+
this.GetMultiLineVTextSize=function(obj){if(obj.Font)this.Canvas.font=obj.Font;var lineHeight=this.Canvas.measureText('擎').width;var aryLine=[];for(var i=0;i<obj.AryText.length;++i){var item=obj.AryText[i];var lineInfo={Width:0,Height:lineHeight,AryText:[],Align:2,Margin:{Top:1,Bottom:1},YOffset:-1};if(item.Margin){if(IFrameSplitOperator.IsNumber(item.Margin.Top))lineInfo.Margin.Top=item.Margin.Top;if(IFrameSplitOperator.IsNumber(item.Margin.Bottom))lineInfo.Margin.Bottom=item.Margin.Bottom;}if(IFrameSplitOperator.IsNumber(item.YOffset))lineInfo.YOffset=item.YOffset;if(IFrameSplitOperator.IsNumber(item.Align))lineInfo.Align=item.Align;lineInfo.Height=lineHeight+lineInfo.Margin.Top+lineInfo.Margin.Bottom;for(var j=0;j<item.AryText.length;++j){var subItem=item.AryText[j];if(!subItem||!subItem.Text)continue;var width=this.Canvas.measureText(subItem.Text).width;var textItem={Width:width,Text:subItem.Text,Color:obj.TextColor,Margin:{Left:0,Right:0}};if(subItem.Color)textItem.Color=subItem.Color;if(subItem.Margin){if(IFrameSplitOperator.IsNumber(subItem.Margin.Left))textItem.Margin.Left=subItem.Margin.Left;if(IFrameSplitOperator.IsNumber(subItem.Margin.Right))textItem.Margin.Right=subItem.Margin.Right;}textItem.Width=width+textItem.Margin.Right+textItem.Margin.Left;lineInfo.Width+=textItem.Width;lineInfo.AryText.push(textItem);}aryLine.push(lineInfo);}if(aryLine.length<=0)return null;var width=0,height=0;for(var i=0;i<aryLine.length;++i){var item=aryLine[i];if(width<item.Width)width=item.Width;height+=item.Height;}if(width<=0||height<=0)return null;var drawInfo={Width:width,Height:height,AryLine:aryLine,Align:2};//Align 1=left 2=center 3=right
|
|
2686
|
+
if(IFrameSplitOperator.IsNumber(obj.Align))drawInfo.Align=obj.Align;return drawInfo;};//X轴底部文字多行输出
|
|
2687
|
+
this.DrawMultiLineVText=function(drawInfo){var xLeft=drawInfo.XCenter-drawInfo.Width/2;if(drawInfo.Align==1)xLeft=drawInfo.XCenter;if(drawInfo.TextRightPrev!=null&&drawInfo.TextRightPrev>xLeft)return false;this.Canvas.font=drawInfo.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var yText=drawInfo.RectBottom.Top;var textRight=null;for(var i=0,j=0;i<drawInfo.AryLine.length;++i){var lineItem=drawInfo.AryLine[i];if(drawInfo.Align==1){var xLeft=drawInfo.XCenter-drawInfo.Width/2;if(lineItem.Align==1)xLeft=drawInfo.XCenter;else if(lineItem.Align==2)xLeft=drawInfo.XCenter+drawInfo.Width-lineItem.Width;}else{var xLeft=drawInfo.XCenter-lineItem.Width/2;if(lineItem.Align==1)xLeft=drawInfo.XCenter-drawInfo.Width/2;else if(lineItem.Align==2)xLeft=drawInfo.XCenter+drawInfo.Width/2-lineItem.Width;}if(xLeft<1)xLeft=1;yText+=lineItem.Height;for(j=0;j<lineItem.AryText.length;++j){var item=lineItem.AryText[j];this.Canvas.fillStyle=item.Color;this.Canvas.fillText(item.Text,xLeft+item.Margin.Left,yText+lineItem.YOffset);xLeft+=item.Width;}if(textRight==null||textRight<xLeft)textRight=xLeft;}drawInfo.TextRight=textRight;return true;};//Y坐标转y轴数值
|
|
2688
2688
|
this.GetYData=function(y,isLimit){if(this.Logarithmic&&this.GetYLogarithmicFromData){return this.GetYLogarithmicData(y);}if(this.CoordinateType==1)//反转坐标
|
|
2689
2689
|
{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轴数值
|
|
2690
2690
|
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轴坐标信息
|
|
@@ -2990,7 +2990,7 @@ for(var i=this.HorizontalInfo.length-1;i>=0;--i)//从上往下画分割线
|
|
|
2990
2990
|
{var item=this.HorizontalInfo[i];var y=this.GetYFromData(item.Value);if(y!=null&&Math.abs(y-yPrev)<this.MinYDistance)continue;//两个坐标在近了 就不画了
|
|
2991
2991
|
if(y>=bottom-2)this.Canvas.textBaseline='bottom';else if(y<=top+2)this.Canvas.textBaseline='top';else this.Canvas.textBaseline="middle";if(leftLine&&leftLine.Width>0)//左边
|
|
2992
2992
|
{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 不画坐标
|
|
2993
|
-
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.
|
|
2993
|
+
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];this.Canvas.fillStyle=item.TextColor;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.textAlign="left";this.Canvas.fillText(text,xText,y);}}yPrev=y;}};//画X轴
|
|
2994
2994
|
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刻度
|
|
2995
2995
|
{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);
|
|
2996
2996
|
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])// 左
|
|
@@ -6441,11 +6441,42 @@ var angle=Math.atan2(ptStart.Y-ptEnd.Y,ptStart.X-ptEnd.X)*180/Math.PI,angle1=(an
|
|
|
6441
6441
|
this.CalculateExtendLinePoint=function(ptStart,ptEnd){var result={};var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();var top=this.Frame.ChartBorder.GetTopEx();var bottom=this.Frame.ChartBorder.GetBottom();var a=ptEnd.X-ptStart.X;var b=ptEnd.Y-ptStart.Y;if(a>0){var b2=bottom-ptStart.Y;var a2=a*b2/b;var pt=new Point();pt.X=ptStart.X+a2;pt.Y=bottom;result.End=pt;var b2=ptEnd.Y-top;var a2=a*b2/b;var pt2=new Point();pt2.Y=top;pt2.X=ptEnd.X-a2;result.Start=pt2;}else{var b2=bottom-ptStart.Y;var a2=Math.abs(a)*b2/b;var pt=new Point();pt.X=ptStart.X-a2;;pt.Y=bottom;result.End=pt;var b2=ptEnd.Y-top;var a2=Math.abs(a)*b2/b;var pt2=new Point();pt2.Y=top;pt2.X=ptEnd.X+a2;result.Start=pt2;}return result;};//计算2个点线的,点0->点1->延长线的点
|
|
6442
6442
|
this.CalculateExtendLineEndPoint=function(aryPoint){var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();var bottom=this.Frame.ChartBorder.GetBottomEx();var top=this.Frame.ChartBorder.GetTopEx();var a=aryPoint[1].X-aryPoint[0].X;var b=aryPoint[1].Y-aryPoint[0].Y;if(a>0){var a1=right-aryPoint[0].X;var b1=a1*b/a;var y=b1+aryPoint[0].Y;if(y>=top&&y<=bottom){var pt=new Point();pt.X=right;pt.Y=y;return pt;}if(b>0){var b2=bottom-aryPoint[0].Y;var a2=a*b2/b;var x=a2+aryPoint[0].X;var pt2=new Point();pt2.X=x;pt2.Y=bottom;return pt2;}else if(b==0){var pt2=new Point();pt2.X=right;pt2.Y=aryPoint[0].Y;return pt2;}else{var b2=top-aryPoint[0].Y;var a2=a*b2/b;var x=a2+aryPoint[0].X;var pt2=new Point();pt2.X=x;pt2.Y=top;return pt2;}}else{var a1=aryPoint[0].X-left;var b1=a1*b/Math.abs(a);var y=b1+aryPoint[0].Y;if(y>=top&&y<=bottom){var pt=new Point();pt.X=left;pt.Y=y;return pt;}if(b>0){var b2=bottom-aryPoint[0].Y;var a2=a*b2/b;var x=a2+aryPoint[0].X;var pt2=new Point();pt2.X=x;pt2.Y=bottom;return pt2;}else if(b==0){var pt2=new Point();pt2.X=left;pt2.Y=aryPoint[0].Y;return pt2;}else{var b2=top-aryPoint[0].Y;var a2=a*b2/b;var x=a2+aryPoint[0].X;var pt2=new Point();pt2.X=x;pt2.Y=top;return pt2;}}};//坐标是否在点上 返回在第几个点上
|
|
6443
6443
|
this.IsPointInXYValue=function(x,y,option){if(!this.Frame)return-1;var data=this.Frame.Data;if(!data)return-1;if(!this.Value)return-1;var radius=5;if(option&&IFrameSplitOperator.IsNumber(option.Zoom))radius+=option.Zoom;else if(this.Option&&IFrameSplitOperator.IsNumber(this.Option.Zoom))radius+=this.Option.Zoom;var isHScreen=this.Frame.IsHScreen;radius*=GetDevicePixelRatio();for(var i=0;i<this.Value.length;++i)//是否在点上
|
|
6444
|
-
{var item=this.Value[i];var pt=new Point();if(isHScreen){pt.Y=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);pt.X=this.Frame.GetYFromData(item.YValue);}else{pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);pt.Y=this.Frame.GetYFromData(item.YValue);}
|
|
6445
|
-
this.
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6444
|
+
{var item=this.Value[i];var pt=new Point();if(isHScreen){pt.Y=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);pt.X=this.Frame.GetYFromData(item.YValue);}else{pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);pt.Y=this.Frame.GetYFromData(item.YValue);}if(Path2DHelper.PtInPoint(x,y,pt,radius))return i;/*
|
|
6445
|
+
this.Canvas.beginPath();
|
|
6446
|
+
this.Canvas.arc(pt.X,pt.Y,radius,0,360);
|
|
6447
|
+
if (this.Canvas.isPointInPath(x,y)) return i;
|
|
6448
|
+
*/}return-1;};//坐标是否在线段上 返回在第几个线段上
|
|
6449
|
+
this.IsPointInLine=function(x,y,option){if(!this.LinePoint)return-1;var lineWidth=5;if(option&&IFrameSplitOperator.IsNumber(option.Zoom))lineWidth+=option.Zoom;else if(this.Option&&IFrameSplitOperator.IsNumber(this.Option.Zoom))lineWidth+=this.Option.Zoom;var pixel=GetDevicePixelRatio();lineWidth*=pixel;for(var i=0;i<this.LinePoint.length;++i){var item=this.LinePoint[i];var ptStart=item.Start;var ptEnd=item.End;if(Path2DHelper.PtInLine(x,y,ptStart,ptEnd,lineWidth)){return i;}}return-1;/*
|
|
6450
|
+
for(var i=0;i<this.LinePoint.length; ++i)
|
|
6451
|
+
{
|
|
6452
|
+
var item=this.LinePoint[i];
|
|
6453
|
+
var ptStart=item.Start;
|
|
6454
|
+
var ptEnd=item.End;
|
|
6455
|
+
this.Canvas.beginPath();
|
|
6456
|
+
if (ptStart.X==ptEnd.X) //竖线
|
|
6457
|
+
{
|
|
6458
|
+
this.Canvas.moveTo(ptStart.X-lineWidth,ptStart.Y);
|
|
6459
|
+
this.Canvas.lineTo(ptStart.X+lineWidth,ptStart.Y);
|
|
6460
|
+
this.Canvas.lineTo(ptEnd.X+lineWidth,ptEnd.Y);
|
|
6461
|
+
this.Canvas.lineTo(ptEnd.X-lineWidth,ptEnd.Y);
|
|
6462
|
+
}
|
|
6463
|
+
else
|
|
6464
|
+
{
|
|
6465
|
+
this.Canvas.moveTo(ptStart.X,ptStart.Y+lineWidth);
|
|
6466
|
+
this.Canvas.lineTo(ptStart.X,ptStart.Y-lineWidth);
|
|
6467
|
+
this.Canvas.lineTo(ptEnd.X,ptEnd.Y-lineWidth);
|
|
6468
|
+
this.Canvas.lineTo(ptEnd.X,ptEnd.Y+lineWidth);
|
|
6469
|
+
}
|
|
6470
|
+
this.Canvas.closePath();
|
|
6471
|
+
|
|
6472
|
+
//this.Canvas.fillStyle='RGB(22,100,100)';
|
|
6473
|
+
//this.Canvas.fill();
|
|
6474
|
+
if (this.Canvas.isPointInPath(x,y))
|
|
6475
|
+
return i;
|
|
6476
|
+
}
|
|
6477
|
+
|
|
6478
|
+
return -1;
|
|
6479
|
+
*/};//0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
|
|
6449
6480
|
this.IsPointIn_XYValue_Line=function(x,y,option){if(this.Status!=10)return-1;var value=this.IsPointInXYValue(x,y,option);if(value>=0)return value;value=this.IsPointInLine(x,y,option);if(value>=0)return 100;return-1;};this.DrawLine=function(ptStart,ptEnd,isDottedline){if(isDottedline)this.Canvas.setLineDash([5,10]);this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(ptStart.X,ptStart.Y);this.Canvas.lineTo(ptEnd.X,ptEnd.Y);this.Canvas.stroke();if(isDottedline)this.Canvas.setLineDash([]);};this.CreateLineData=function(ptStart,ptEnd){var line={Start:new Point(),End:new Point()};line.Start.Y=ptStart.Y;line.Start.X=ptStart.X;line.End.Y=ptEnd.Y;line.End.X=ptEnd.X;return line;};//导出成存储格式
|
|
6450
6481
|
this.ExportStorageData=function(){var storageData={ClassName:this.ClassName,Symbol:this.Symbol,Guid:this.Guid,Period:this.Period,Value:[],FrameID:this.Frame.Identify,LineColor:this.LineColor,AreaColor:this.AreaColor,LineWidth:this.LineWidth,Right:this.Right,EnableSave:this.EnableSave,IsShowYCoordinate:this.IsShowYCoordinate};for(var i=0;i<this.Value.length;++i){var item=this.Value[i];storageData.Value.push({XValue:item.XValue,YValue:item.YValue,DateTime:item.DateTime});}if(this.Text)storageData.Text=this.Text;//如果有文本, 也导出
|
|
6451
6482
|
if(this.FontOption)storageData.FontOption=this.FontOption;//字体也导出
|
|
@@ -6633,8 +6664,38 @@ this.Canvas.fillStyle=this.AreaColor;this.Canvas.beginPath();this.Canvas.fillRec
|
|
|
6633
6664
|
this.DrawPoint(drawPoint);};//0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
|
|
6634
6665
|
this.IsPointIn=function(x,y,option){if(this.IsFrameMinSize())return-1;if(!this.Frame||this.Status!=10)return-1;var data=this.Frame.Data;if(!data)return-1;var nIndex=this.IsPointInXYValue(x,y,option);if(nIndex>=0)return nIndex;var aryPoint=this.CalculateDrawPoint({IsCheckX:true,IsCheckY:true});if(!aryPoint||aryPoint.length!=2)return-1;//是否在矩形边框上
|
|
6635
6666
|
var linePoint=[{X:aryPoint[0].X,Y:aryPoint[0].Y},{X:aryPoint[1].X,Y:aryPoint[0].Y}];if(this.IsPointInLine(linePoint,x,y,option))return 100;linePoint=[{X:aryPoint[1].X,Y:aryPoint[0].Y},{X:aryPoint[1].X,Y:aryPoint[1].Y}];if(this.IsPointInLine2(linePoint,x,y,option))return 100;linePoint=[{X:aryPoint[1].X,Y:aryPoint[1].Y},{X:aryPoint[0].X,Y:aryPoint[1].Y}];if(this.IsPointInLine(linePoint,x,y,option))return 100;linePoint=[{X:aryPoint[0].X,Y:aryPoint[1].Y},{X:aryPoint[0].X,Y:aryPoint[0].Y}];if(this.IsPointInLine2(linePoint,x,y,option))return 100;return-1;};//点是否在线段上 水平线段
|
|
6636
|
-
this.IsPointInLine=function(aryPoint,x,y,option){var
|
|
6637
|
-
|
|
6667
|
+
this.IsPointInLine=function(aryPoint,x,y,option){var lineWidth=5;var pixel=GetDevicePixelRatio();if(IFrameSplitOperator.IsPlusNumber(this.LineWidth)&&this.LineWidth>lineWidth)lineWidth=this.LineWidth;if(option&&IFrameSplitOperator.IsNumber(option.Zoom))lineWidth+=option.Zoom;else if(this.Option&&IFrameSplitOperator.IsNumber(this.Option.Zoom))lineWidth+=this.Option.Zoom;lineWidth*=pixel;if(Path2DHelper.PtInLine(x,y,aryPoint[0],aryPoint[1],lineWidth))return true;return false;/*
|
|
6668
|
+
var radius=5;
|
|
6669
|
+
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
6670
|
+
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
6671
|
+
var pixel=GetDevicePixelRatio();
|
|
6672
|
+
radius*=pixel;
|
|
6673
|
+
|
|
6674
|
+
this.Canvas.beginPath();
|
|
6675
|
+
this.Canvas.moveTo(aryPoint[0].X,aryPoint[0].Y+radius);
|
|
6676
|
+
this.Canvas.lineTo(aryPoint[0].X,aryPoint[0].Y-radius);
|
|
6677
|
+
this.Canvas.lineTo(aryPoint[1].X,aryPoint[1].Y-radius);
|
|
6678
|
+
this.Canvas.lineTo(aryPoint[1].X,aryPoint[1].Y+radius);
|
|
6679
|
+
this.Canvas.closePath();
|
|
6680
|
+
if (this.Canvas.isPointInPath(x,y))
|
|
6681
|
+
return true;
|
|
6682
|
+
*/};//垂直线段
|
|
6683
|
+
this.IsPointInLine2=function(aryPoint,x,y,option){return this.IsPointInLine(aryPoint,x,y,option);/*
|
|
6684
|
+
var radius=5;
|
|
6685
|
+
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
6686
|
+
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
6687
|
+
var pixel=GetDevicePixelRatio();
|
|
6688
|
+
radius*=pixel;
|
|
6689
|
+
|
|
6690
|
+
this.Canvas.beginPath();
|
|
6691
|
+
this.Canvas.moveTo(aryPoint[0].X-radius,aryPoint[0].Y);
|
|
6692
|
+
this.Canvas.lineTo(aryPoint[0].X+radius,aryPoint[0].Y);
|
|
6693
|
+
this.Canvas.lineTo(aryPoint[1].X+radius,aryPoint[1].Y);
|
|
6694
|
+
this.Canvas.lineTo(aryPoint[1].X-radius,aryPoint[1].Y);
|
|
6695
|
+
this.Canvas.closePath();
|
|
6696
|
+
if (this.Canvas.isPointInPath(x,y))
|
|
6697
|
+
return true;
|
|
6698
|
+
*/};}//画图工具-弧形
|
|
6638
6699
|
function ChartDrawPictureArc(){this.newMethod=IChartDrawPicture;//派生
|
|
6639
6700
|
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawPictureArc';this.Draw=function(){if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint();if(!drawPoint||drawPoint.length!=2)return;this.ClipFrame();//this.Canvas.beginPath();
|
|
6640
6701
|
//this.Canvas.rect(drawPoint[0].X,drawPoint[0].Y,drawPoint[1].X-drawPoint[0].X,drawPoint[1].Y-drawPoint[0].Y);
|
|
@@ -10249,7 +10310,15 @@ return stock;}function GetLocalTime(i)//得到标准时区的时间的函数
|
|
|
10249
10310
|
{if(typeof i!=='number')return;var d=new Date();//得到1970年一月一日到现在的秒数
|
|
10250
10311
|
var len=d.getTime();//本地时间与GMT时间的时间偏移差
|
|
10251
10312
|
var offset=d.getTimezoneOffset()*60000;//得到现在的格林尼治时间
|
|
10252
|
-
var utcTime=len+offset;return new Date(utcTime+3600000*i);}
|
|
10313
|
+
var utcTime=len+offset;return new Date(utcTime+3600000*i);}//图形路径方法
|
|
10314
|
+
function Path2DHelper(){}var PI2=Math.PI*2;//点是否在线段上
|
|
10315
|
+
Path2DHelper.PtInLine=function(x,y,pt,pt2,lineWidth){if(lineWidth<=0)return false;var x0=pt.X,y0=pt.Y;var x1=pt2.X,y1=pt2.Y;var _l=lineWidth;var _a=0;var _b=x0;// Quick reject
|
|
10316
|
+
if(y>y0+_l&&y>y1+_l||y<y0-_l&&y<y1-_l||x>x0+_l&&x>x1+_l||x<x0-_l&&x<x1-_l){return false;}if(x0!==x1){_a=(y0-y1)/(x0-x1);_b=(x0*y1-x1*y0)/(x0-x1);}else{return Math.abs(x-x0)<=_l/2;}var tmp=_a*x-y+_b;var _s=tmp*tmp/(_a*_a+1);return _s<=_l/2*_l/2;};//点是否在圆点上
|
|
10317
|
+
Path2DHelper.PtInPoint=function(x,y,ptCenter,radius){if(radius<=0)return false;var cx=ptCenter.X;var cy=ptCenter.Y;x-=cx;y-=cy;var d=Math.sqrt(x*x+y*y);//到圆心的距离
|
|
10318
|
+
if(d>radius)return false;return true;};Path2DHelper.PtInArc=function(x,y,ptCenter,radius,startAngle,endAngle,lineWidth,anticlockwise){if(lineWidth<=0)return false;var _l=lineWidth;var cx=ptCenter.X;var cy=ptCenter.Y;x-=cx;y-=cy;var d=Math.sqrt(x*x+y*y);if(d-_l>r||d+_l<r)return false;// TODO
|
|
10319
|
+
if(Math.abs(startAngle-endAngle)%PI2<1e-4){// Is a circle
|
|
10320
|
+
return true;}if(anticlockwise){var tmp=startAngle;startAngle=Path2DHelper.FormatRadian(endAngle);endAngle=Path2DHelper.FormatRadian(tmp);}else{startAngle=Path2DHelper.FormatRadian(startAngle);endAngle=Path2DHelper.FormatRadian(endAngle);}if(startAngle>endAngle)endAngle+=PI2;var angle=Math.atan2(y,x);if(angle<0)angle+=PI2;return angle>=startAngle&&angle<=endAngle||angle+PI2>=startAngle&&angle+PI2<=endAngle;};//统一弧度方向
|
|
10321
|
+
Path2DHelper.FormatRadian=function(angle){angle%=PI2;if(angle<0)angle+=PI2;return angle;};/*
|
|
10253
10322
|
Copyright (c) 2018 jones
|
|
10254
10323
|
|
|
10255
10324
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -15096,7 +15165,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
15096
15165
|
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);};}/********************************************************************************
|
|
15097
15166
|
* 版本信息输出
|
|
15098
15167
|
*
|
|
15099
|
-
*/var HQCHART_VERSION="1.1.
|
|
15168
|
+
*/var HQCHART_VERSION="1.1.14869";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();//把给外界调用的方法暴露出来
|
|
15100
15169
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
15101
15170
|
// BaseIndex:BaseIndex,
|
|
15102
15171
|
// ChartLine:ChartLine,
|
package/package.json
CHANGED
package/src/jscommon/umychart.js
CHANGED
|
@@ -14559,6 +14559,7 @@ function AverageWidthFrame()
|
|
|
14559
14559
|
if (IFrameSplitOperator.IsNumber(item.Margin.Bottom)) lineInfo.Margin.Bottom=item.Margin.Bottom;
|
|
14560
14560
|
}
|
|
14561
14561
|
if (IFrameSplitOperator.IsNumber(item.YOffset)) lineInfo.YOffset=item.YOffset;
|
|
14562
|
+
if (IFrameSplitOperator.IsNumber(item.Align)) lineInfo.Align=item.Align;
|
|
14562
14563
|
|
|
14563
14564
|
lineInfo.Height=lineHeight+lineInfo.Margin.Top+lineInfo.Margin.Bottom;
|
|
14564
14565
|
|
|
@@ -14596,13 +14597,17 @@ function AverageWidthFrame()
|
|
|
14596
14597
|
|
|
14597
14598
|
if (width<=0 || height<=0) return null;
|
|
14598
14599
|
|
|
14599
|
-
|
|
14600
|
+
var drawInfo={ Width:width, Height:height, AryLine:aryLine, Align:2 }; //Align 1=left 2=center 3=right
|
|
14601
|
+
if (IFrameSplitOperator.IsNumber(obj.Align)) drawInfo.Align=obj.Align;
|
|
14602
|
+
|
|
14603
|
+
return drawInfo;
|
|
14600
14604
|
}
|
|
14601
14605
|
|
|
14602
14606
|
//X轴底部文字多行输出
|
|
14603
14607
|
this.DrawMultiLineVText=function(drawInfo)
|
|
14604
14608
|
{
|
|
14605
14609
|
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
14610
|
+
if (drawInfo.Align==1) xLeft=drawInfo.XCenter;
|
|
14606
14611
|
if (drawInfo.TextRightPrev!=null && drawInfo.TextRightPrev>xLeft)
|
|
14607
14612
|
return false;
|
|
14608
14613
|
|
|
@@ -14614,8 +14619,19 @@ function AverageWidthFrame()
|
|
|
14614
14619
|
for(var i=0, j=0;i<drawInfo.AryLine.length;++i)
|
|
14615
14620
|
{
|
|
14616
14621
|
var lineItem=drawInfo.AryLine[i];
|
|
14617
|
-
if (
|
|
14618
|
-
|
|
14622
|
+
if (drawInfo.Align==1)
|
|
14623
|
+
{
|
|
14624
|
+
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
14625
|
+
if (lineItem.Align==1) xLeft=drawInfo.XCenter;
|
|
14626
|
+
else if (lineItem.Align==2) xLeft=drawInfo.XCenter+drawInfo.Width-lineItem.Width;
|
|
14627
|
+
}
|
|
14628
|
+
else
|
|
14629
|
+
{
|
|
14630
|
+
var xLeft=drawInfo.XCenter-lineItem.Width/2;
|
|
14631
|
+
if (lineItem.Align==1) xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
14632
|
+
else if (lineItem.Align==2) xLeft=drawInfo.XCenter+drawInfo.Width/2-lineItem.Width;
|
|
14633
|
+
}
|
|
14634
|
+
|
|
14619
14635
|
if (xLeft<1) xLeft=1;
|
|
14620
14636
|
yText+=lineItem.Height;
|
|
14621
14637
|
for(j=0;j<lineItem.AryText.length;++j)
|
|
@@ -19927,7 +19943,7 @@ function OverlayKLineFrame()
|
|
|
19927
19943
|
|
|
19928
19944
|
var text=item.Message[1];
|
|
19929
19945
|
if (Array.isArray(item.Message[1])) text=item.Message[1][0];
|
|
19930
|
-
|
|
19946
|
+
this.Canvas.fillStyle=item.TextColor;
|
|
19931
19947
|
if (rightExtendText && rightExtendText.Align)
|
|
19932
19948
|
{
|
|
19933
19949
|
var textWidth=rightWidth;
|
|
@@ -19939,7 +19955,6 @@ function OverlayKLineFrame()
|
|
|
19939
19955
|
{
|
|
19940
19956
|
var xText=right+2;
|
|
19941
19957
|
if (rightLine && rightLine.Width>0) xText+=rightLine.Width;
|
|
19942
|
-
this.Canvas.fillStyle=item.TextColor;
|
|
19943
19958
|
this.Canvas.textAlign="left";
|
|
19944
19959
|
this.Canvas.fillText(text,xText,y);
|
|
19945
19960
|
}
|
|
@@ -64303,9 +64318,14 @@ function IChartDrawPicture()
|
|
|
64303
64318
|
pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);
|
|
64304
64319
|
pt.Y=this.Frame.GetYFromData(item.YValue);
|
|
64305
64320
|
}
|
|
64321
|
+
|
|
64322
|
+
if (Path2DHelper.PtInPoint(x,y,pt,radius))
|
|
64323
|
+
return i;
|
|
64324
|
+
/*
|
|
64306
64325
|
this.Canvas.beginPath();
|
|
64307
64326
|
this.Canvas.arc(pt.X,pt.Y,radius,0,360);
|
|
64308
64327
|
if (this.Canvas.isPointInPath(x,y)) return i;
|
|
64328
|
+
*/
|
|
64309
64329
|
}
|
|
64310
64330
|
|
|
64311
64331
|
return -1;
|
|
@@ -64323,6 +64343,20 @@ function IChartDrawPicture()
|
|
|
64323
64343
|
var pixel=GetDevicePixelRatio();
|
|
64324
64344
|
lineWidth*=pixel;
|
|
64325
64345
|
for(var i=0;i<this.LinePoint.length; ++i)
|
|
64346
|
+
{
|
|
64347
|
+
var item=this.LinePoint[i];
|
|
64348
|
+
var ptStart=item.Start;
|
|
64349
|
+
var ptEnd=item.End;
|
|
64350
|
+
|
|
64351
|
+
if (Path2DHelper.PtInLine(x, y, ptStart, ptEnd, lineWidth))
|
|
64352
|
+
{
|
|
64353
|
+
return i;
|
|
64354
|
+
}
|
|
64355
|
+
}
|
|
64356
|
+
return -1;
|
|
64357
|
+
|
|
64358
|
+
/*
|
|
64359
|
+
for(var i=0;i<this.LinePoint.length; ++i)
|
|
64326
64360
|
{
|
|
64327
64361
|
var item=this.LinePoint[i];
|
|
64328
64362
|
var ptStart=item.Start;
|
|
@@ -64351,6 +64385,7 @@ function IChartDrawPicture()
|
|
|
64351
64385
|
}
|
|
64352
64386
|
|
|
64353
64387
|
return -1;
|
|
64388
|
+
*/
|
|
64354
64389
|
}
|
|
64355
64390
|
|
|
64356
64391
|
//0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
|
|
@@ -67044,6 +67079,18 @@ function ChartDrawPictureRect()
|
|
|
67044
67079
|
//点是否在线段上 水平线段
|
|
67045
67080
|
this.IsPointInLine=function(aryPoint,x,y,option)
|
|
67046
67081
|
{
|
|
67082
|
+
var lineWidth=5;
|
|
67083
|
+
var pixel=GetDevicePixelRatio();
|
|
67084
|
+
if (IFrameSplitOperator.IsPlusNumber(this.LineWidth) && this.LineWidth>lineWidth) lineWidth=this.LineWidth;
|
|
67085
|
+
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) lineWidth+=option.Zoom;
|
|
67086
|
+
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) lineWidth+=this.Option.Zoom;
|
|
67087
|
+
lineWidth*=pixel;
|
|
67088
|
+
if (Path2DHelper.PtInLine(x,y,aryPoint[0], aryPoint[1], lineWidth))
|
|
67089
|
+
return true;
|
|
67090
|
+
|
|
67091
|
+
return false;
|
|
67092
|
+
|
|
67093
|
+
/*
|
|
67047
67094
|
var radius=5;
|
|
67048
67095
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
67049
67096
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -67058,11 +67105,14 @@ function ChartDrawPictureRect()
|
|
|
67058
67105
|
this.Canvas.closePath();
|
|
67059
67106
|
if (this.Canvas.isPointInPath(x,y))
|
|
67060
67107
|
return true;
|
|
67108
|
+
*/
|
|
67061
67109
|
}
|
|
67062
67110
|
|
|
67063
67111
|
//垂直线段
|
|
67064
67112
|
this.IsPointInLine2=function(aryPoint,x,y,option)
|
|
67065
67113
|
{
|
|
67114
|
+
return this.IsPointInLine(aryPoint,x,y,option);
|
|
67115
|
+
/*
|
|
67066
67116
|
var radius=5;
|
|
67067
67117
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
67068
67118
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -67077,6 +67127,7 @@ function ChartDrawPictureRect()
|
|
|
67077
67127
|
this.Canvas.closePath();
|
|
67078
67128
|
if (this.Canvas.isPointInPath(x,y))
|
|
67079
67129
|
return true;
|
|
67130
|
+
*/
|
|
67080
67131
|
}
|
|
67081
67132
|
}
|
|
67082
67133
|
|
|
@@ -103115,6 +103166,117 @@ function GetLocalTime(i) //得到标准时区的时间的函数
|
|
|
103115
103166
|
return new Date(utcTime + 3600000 * i);
|
|
103116
103167
|
}
|
|
103117
103168
|
|
|
103169
|
+
//图形路径方法
|
|
103170
|
+
function Path2DHelper() { }
|
|
103171
|
+
const PI2 = Math.PI * 2;
|
|
103172
|
+
|
|
103173
|
+
//点是否在线段上
|
|
103174
|
+
Path2DHelper.PtInLine=function(x, y, pt, pt2, lineWidth)
|
|
103175
|
+
{
|
|
103176
|
+
if (lineWidth<=0) return false;
|
|
103177
|
+
|
|
103178
|
+
var x0=pt.X, y0=pt.Y;
|
|
103179
|
+
var x1=pt2.X, y1=pt2.Y;
|
|
103180
|
+
|
|
103181
|
+
const _l = lineWidth;
|
|
103182
|
+
let _a = 0;
|
|
103183
|
+
let _b = x0;
|
|
103184
|
+
|
|
103185
|
+
// Quick reject
|
|
103186
|
+
if (
|
|
103187
|
+
(y > y0 + _l && y > y1 + _l)
|
|
103188
|
+
|| (y < y0 - _l && y < y1 - _l)
|
|
103189
|
+
|| (x > x0 + _l && x > x1 + _l)
|
|
103190
|
+
|| (x < x0 - _l && x < x1 - _l)
|
|
103191
|
+
)
|
|
103192
|
+
{
|
|
103193
|
+
return false;
|
|
103194
|
+
}
|
|
103195
|
+
|
|
103196
|
+
if (x0 !== x1)
|
|
103197
|
+
{
|
|
103198
|
+
_a = (y0 - y1) / (x0 - x1);
|
|
103199
|
+
_b = (x0 * y1 - x1 * y0) / (x0 - x1);
|
|
103200
|
+
}
|
|
103201
|
+
else
|
|
103202
|
+
{
|
|
103203
|
+
return Math.abs(x - x0) <= _l / 2;
|
|
103204
|
+
}
|
|
103205
|
+
|
|
103206
|
+
const tmp = _a * x - y + _b;
|
|
103207
|
+
const _s = tmp * tmp / (_a * _a + 1);
|
|
103208
|
+
return _s <= _l / 2 * _l / 2;
|
|
103209
|
+
}
|
|
103210
|
+
|
|
103211
|
+
//点是否在圆点上
|
|
103212
|
+
Path2DHelper.PtInPoint=function(x,y, ptCenter, radius)
|
|
103213
|
+
{
|
|
103214
|
+
if (radius<=0) return false;
|
|
103215
|
+
|
|
103216
|
+
var cx=ptCenter.X;
|
|
103217
|
+
var cy=ptCenter.Y;
|
|
103218
|
+
|
|
103219
|
+
x -= cx;
|
|
103220
|
+
y -= cy;
|
|
103221
|
+
const d = Math.sqrt(x * x + y * y); //到圆心的距离
|
|
103222
|
+
|
|
103223
|
+
if (d>radius) return false;
|
|
103224
|
+
|
|
103225
|
+
return true;
|
|
103226
|
+
}
|
|
103227
|
+
|
|
103228
|
+
Path2DHelper.PtInArc=function(x, y, ptCenter, radius, startAngle, endAngle,lineWidth, anticlockwise)
|
|
103229
|
+
{
|
|
103230
|
+
if (lineWidth<=0) return false;
|
|
103231
|
+
|
|
103232
|
+
const _l = lineWidth;
|
|
103233
|
+
var cx=ptCenter.X;
|
|
103234
|
+
var cy=ptCenter.Y;
|
|
103235
|
+
|
|
103236
|
+
x -= cx;
|
|
103237
|
+
y -= cy;
|
|
103238
|
+
const d = Math.sqrt(x * x + y * y);
|
|
103239
|
+
|
|
103240
|
+
if ((d - _l > r) || (d + _l < r))
|
|
103241
|
+
return false;
|
|
103242
|
+
|
|
103243
|
+
// TODO
|
|
103244
|
+
if (Math.abs(startAngle - endAngle) % PI2 < 1e-4)
|
|
103245
|
+
{
|
|
103246
|
+
// Is a circle
|
|
103247
|
+
return true;
|
|
103248
|
+
}
|
|
103249
|
+
|
|
103250
|
+
if (anticlockwise)
|
|
103251
|
+
{
|
|
103252
|
+
const tmp = startAngle;
|
|
103253
|
+
startAngle = Path2DHelper.FormatRadian(endAngle);
|
|
103254
|
+
endAngle = Path2DHelper.FormatRadian(tmp);
|
|
103255
|
+
}
|
|
103256
|
+
else
|
|
103257
|
+
{
|
|
103258
|
+
startAngle = Path2DHelper.FormatRadian(startAngle);
|
|
103259
|
+
endAngle = Path2DHelper.FormatRadian(endAngle);
|
|
103260
|
+
}
|
|
103261
|
+
|
|
103262
|
+
if (startAngle > endAngle)
|
|
103263
|
+
endAngle += PI2;
|
|
103264
|
+
|
|
103265
|
+
var angle = Math.atan2(y, x);
|
|
103266
|
+
if (angle < 0)
|
|
103267
|
+
angle += PI2;
|
|
103268
|
+
|
|
103269
|
+
return (angle >= startAngle && angle <= endAngle) || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
|
|
103270
|
+
}
|
|
103271
|
+
|
|
103272
|
+
//统一弧度方向
|
|
103273
|
+
Path2DHelper.FormatRadian=function(angle)
|
|
103274
|
+
{
|
|
103275
|
+
angle%= PI2;
|
|
103276
|
+
if (angle<0) angle += PI2;
|
|
103277
|
+
return angle;
|
|
103278
|
+
}
|
|
103279
|
+
|
|
103118
103280
|
|
|
103119
103281
|
|
|
103120
103282
|
|
|
@@ -18655,6 +18655,7 @@ function AverageWidthFrame()
|
|
|
18655
18655
|
if (IFrameSplitOperator.IsNumber(item.Margin.Bottom)) lineInfo.Margin.Bottom=item.Margin.Bottom;
|
|
18656
18656
|
}
|
|
18657
18657
|
if (IFrameSplitOperator.IsNumber(item.YOffset)) lineInfo.YOffset=item.YOffset;
|
|
18658
|
+
if (IFrameSplitOperator.IsNumber(item.Align)) lineInfo.Align=item.Align;
|
|
18658
18659
|
|
|
18659
18660
|
lineInfo.Height=lineHeight+lineInfo.Margin.Top+lineInfo.Margin.Bottom;
|
|
18660
18661
|
|
|
@@ -18692,13 +18693,17 @@ function AverageWidthFrame()
|
|
|
18692
18693
|
|
|
18693
18694
|
if (width<=0 || height<=0) return null;
|
|
18694
18695
|
|
|
18695
|
-
|
|
18696
|
+
var drawInfo={ Width:width, Height:height, AryLine:aryLine, Align:2 }; //Align 1=left 2=center 3=right
|
|
18697
|
+
if (IFrameSplitOperator.IsNumber(obj.Align)) drawInfo.Align=obj.Align;
|
|
18698
|
+
|
|
18699
|
+
return drawInfo;
|
|
18696
18700
|
}
|
|
18697
18701
|
|
|
18698
18702
|
//X轴底部文字多行输出
|
|
18699
18703
|
this.DrawMultiLineVText=function(drawInfo)
|
|
18700
18704
|
{
|
|
18701
18705
|
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
18706
|
+
if (drawInfo.Align==1) xLeft=drawInfo.XCenter;
|
|
18702
18707
|
if (drawInfo.TextRightPrev!=null && drawInfo.TextRightPrev>xLeft)
|
|
18703
18708
|
return false;
|
|
18704
18709
|
|
|
@@ -18710,8 +18715,19 @@ function AverageWidthFrame()
|
|
|
18710
18715
|
for(var i=0, j=0;i<drawInfo.AryLine.length;++i)
|
|
18711
18716
|
{
|
|
18712
18717
|
var lineItem=drawInfo.AryLine[i];
|
|
18713
|
-
if (
|
|
18714
|
-
|
|
18718
|
+
if (drawInfo.Align==1)
|
|
18719
|
+
{
|
|
18720
|
+
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
18721
|
+
if (lineItem.Align==1) xLeft=drawInfo.XCenter;
|
|
18722
|
+
else if (lineItem.Align==2) xLeft=drawInfo.XCenter+drawInfo.Width-lineItem.Width;
|
|
18723
|
+
}
|
|
18724
|
+
else
|
|
18725
|
+
{
|
|
18726
|
+
var xLeft=drawInfo.XCenter-lineItem.Width/2;
|
|
18727
|
+
if (lineItem.Align==1) xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
18728
|
+
else if (lineItem.Align==2) xLeft=drawInfo.XCenter+drawInfo.Width/2-lineItem.Width;
|
|
18729
|
+
}
|
|
18730
|
+
|
|
18715
18731
|
if (xLeft<1) xLeft=1;
|
|
18716
18732
|
yText+=lineItem.Height;
|
|
18717
18733
|
for(j=0;j<lineItem.AryText.length;++j)
|
|
@@ -24023,7 +24039,7 @@ function OverlayKLineFrame()
|
|
|
24023
24039
|
|
|
24024
24040
|
var text=item.Message[1];
|
|
24025
24041
|
if (Array.isArray(item.Message[1])) text=item.Message[1][0];
|
|
24026
|
-
|
|
24042
|
+
this.Canvas.fillStyle=item.TextColor;
|
|
24027
24043
|
if (rightExtendText && rightExtendText.Align)
|
|
24028
24044
|
{
|
|
24029
24045
|
var textWidth=rightWidth;
|
|
@@ -24035,7 +24051,6 @@ function OverlayKLineFrame()
|
|
|
24035
24051
|
{
|
|
24036
24052
|
var xText=right+2;
|
|
24037
24053
|
if (rightLine && rightLine.Width>0) xText+=rightLine.Width;
|
|
24038
|
-
this.Canvas.fillStyle=item.TextColor;
|
|
24039
24054
|
this.Canvas.textAlign="left";
|
|
24040
24055
|
this.Canvas.fillText(text,xText,y);
|
|
24041
24056
|
}
|
|
@@ -68399,9 +68414,14 @@ function IChartDrawPicture()
|
|
|
68399
68414
|
pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);
|
|
68400
68415
|
pt.Y=this.Frame.GetYFromData(item.YValue);
|
|
68401
68416
|
}
|
|
68417
|
+
|
|
68418
|
+
if (Path2DHelper.PtInPoint(x,y,pt,radius))
|
|
68419
|
+
return i;
|
|
68420
|
+
/*
|
|
68402
68421
|
this.Canvas.beginPath();
|
|
68403
68422
|
this.Canvas.arc(pt.X,pt.Y,radius,0,360);
|
|
68404
68423
|
if (this.Canvas.isPointInPath(x,y)) return i;
|
|
68424
|
+
*/
|
|
68405
68425
|
}
|
|
68406
68426
|
|
|
68407
68427
|
return -1;
|
|
@@ -68419,6 +68439,20 @@ function IChartDrawPicture()
|
|
|
68419
68439
|
var pixel=GetDevicePixelRatio();
|
|
68420
68440
|
lineWidth*=pixel;
|
|
68421
68441
|
for(var i=0;i<this.LinePoint.length; ++i)
|
|
68442
|
+
{
|
|
68443
|
+
var item=this.LinePoint[i];
|
|
68444
|
+
var ptStart=item.Start;
|
|
68445
|
+
var ptEnd=item.End;
|
|
68446
|
+
|
|
68447
|
+
if (Path2DHelper.PtInLine(x, y, ptStart, ptEnd, lineWidth))
|
|
68448
|
+
{
|
|
68449
|
+
return i;
|
|
68450
|
+
}
|
|
68451
|
+
}
|
|
68452
|
+
return -1;
|
|
68453
|
+
|
|
68454
|
+
/*
|
|
68455
|
+
for(var i=0;i<this.LinePoint.length; ++i)
|
|
68422
68456
|
{
|
|
68423
68457
|
var item=this.LinePoint[i];
|
|
68424
68458
|
var ptStart=item.Start;
|
|
@@ -68447,6 +68481,7 @@ function IChartDrawPicture()
|
|
|
68447
68481
|
}
|
|
68448
68482
|
|
|
68449
68483
|
return -1;
|
|
68484
|
+
*/
|
|
68450
68485
|
}
|
|
68451
68486
|
|
|
68452
68487
|
//0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
|
|
@@ -71140,6 +71175,18 @@ function ChartDrawPictureRect()
|
|
|
71140
71175
|
//点是否在线段上 水平线段
|
|
71141
71176
|
this.IsPointInLine=function(aryPoint,x,y,option)
|
|
71142
71177
|
{
|
|
71178
|
+
var lineWidth=5;
|
|
71179
|
+
var pixel=GetDevicePixelRatio();
|
|
71180
|
+
if (IFrameSplitOperator.IsPlusNumber(this.LineWidth) && this.LineWidth>lineWidth) lineWidth=this.LineWidth;
|
|
71181
|
+
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) lineWidth+=option.Zoom;
|
|
71182
|
+
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) lineWidth+=this.Option.Zoom;
|
|
71183
|
+
lineWidth*=pixel;
|
|
71184
|
+
if (Path2DHelper.PtInLine(x,y,aryPoint[0], aryPoint[1], lineWidth))
|
|
71185
|
+
return true;
|
|
71186
|
+
|
|
71187
|
+
return false;
|
|
71188
|
+
|
|
71189
|
+
/*
|
|
71143
71190
|
var radius=5;
|
|
71144
71191
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
71145
71192
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -71154,11 +71201,14 @@ function ChartDrawPictureRect()
|
|
|
71154
71201
|
this.Canvas.closePath();
|
|
71155
71202
|
if (this.Canvas.isPointInPath(x,y))
|
|
71156
71203
|
return true;
|
|
71204
|
+
*/
|
|
71157
71205
|
}
|
|
71158
71206
|
|
|
71159
71207
|
//垂直线段
|
|
71160
71208
|
this.IsPointInLine2=function(aryPoint,x,y,option)
|
|
71161
71209
|
{
|
|
71210
|
+
return this.IsPointInLine(aryPoint,x,y,option);
|
|
71211
|
+
/*
|
|
71162
71212
|
var radius=5;
|
|
71163
71213
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
71164
71214
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -71173,6 +71223,7 @@ function ChartDrawPictureRect()
|
|
|
71173
71223
|
this.Canvas.closePath();
|
|
71174
71224
|
if (this.Canvas.isPointInPath(x,y))
|
|
71175
71225
|
return true;
|
|
71226
|
+
*/
|
|
71176
71227
|
}
|
|
71177
71228
|
}
|
|
71178
71229
|
|
|
@@ -107211,6 +107262,117 @@ function GetLocalTime(i) //得到标准时区的时间的函数
|
|
|
107211
107262
|
return new Date(utcTime + 3600000 * i);
|
|
107212
107263
|
}
|
|
107213
107264
|
|
|
107265
|
+
//图形路径方法
|
|
107266
|
+
function Path2DHelper() { }
|
|
107267
|
+
const PI2 = Math.PI * 2;
|
|
107268
|
+
|
|
107269
|
+
//点是否在线段上
|
|
107270
|
+
Path2DHelper.PtInLine=function(x, y, pt, pt2, lineWidth)
|
|
107271
|
+
{
|
|
107272
|
+
if (lineWidth<=0) return false;
|
|
107273
|
+
|
|
107274
|
+
var x0=pt.X, y0=pt.Y;
|
|
107275
|
+
var x1=pt2.X, y1=pt2.Y;
|
|
107276
|
+
|
|
107277
|
+
const _l = lineWidth;
|
|
107278
|
+
let _a = 0;
|
|
107279
|
+
let _b = x0;
|
|
107280
|
+
|
|
107281
|
+
// Quick reject
|
|
107282
|
+
if (
|
|
107283
|
+
(y > y0 + _l && y > y1 + _l)
|
|
107284
|
+
|| (y < y0 - _l && y < y1 - _l)
|
|
107285
|
+
|| (x > x0 + _l && x > x1 + _l)
|
|
107286
|
+
|| (x < x0 - _l && x < x1 - _l)
|
|
107287
|
+
)
|
|
107288
|
+
{
|
|
107289
|
+
return false;
|
|
107290
|
+
}
|
|
107291
|
+
|
|
107292
|
+
if (x0 !== x1)
|
|
107293
|
+
{
|
|
107294
|
+
_a = (y0 - y1) / (x0 - x1);
|
|
107295
|
+
_b = (x0 * y1 - x1 * y0) / (x0 - x1);
|
|
107296
|
+
}
|
|
107297
|
+
else
|
|
107298
|
+
{
|
|
107299
|
+
return Math.abs(x - x0) <= _l / 2;
|
|
107300
|
+
}
|
|
107301
|
+
|
|
107302
|
+
const tmp = _a * x - y + _b;
|
|
107303
|
+
const _s = tmp * tmp / (_a * _a + 1);
|
|
107304
|
+
return _s <= _l / 2 * _l / 2;
|
|
107305
|
+
}
|
|
107306
|
+
|
|
107307
|
+
//点是否在圆点上
|
|
107308
|
+
Path2DHelper.PtInPoint=function(x,y, ptCenter, radius)
|
|
107309
|
+
{
|
|
107310
|
+
if (radius<=0) return false;
|
|
107311
|
+
|
|
107312
|
+
var cx=ptCenter.X;
|
|
107313
|
+
var cy=ptCenter.Y;
|
|
107314
|
+
|
|
107315
|
+
x -= cx;
|
|
107316
|
+
y -= cy;
|
|
107317
|
+
const d = Math.sqrt(x * x + y * y); //到圆心的距离
|
|
107318
|
+
|
|
107319
|
+
if (d>radius) return false;
|
|
107320
|
+
|
|
107321
|
+
return true;
|
|
107322
|
+
}
|
|
107323
|
+
|
|
107324
|
+
Path2DHelper.PtInArc=function(x, y, ptCenter, radius, startAngle, endAngle,lineWidth, anticlockwise)
|
|
107325
|
+
{
|
|
107326
|
+
if (lineWidth<=0) return false;
|
|
107327
|
+
|
|
107328
|
+
const _l = lineWidth;
|
|
107329
|
+
var cx=ptCenter.X;
|
|
107330
|
+
var cy=ptCenter.Y;
|
|
107331
|
+
|
|
107332
|
+
x -= cx;
|
|
107333
|
+
y -= cy;
|
|
107334
|
+
const d = Math.sqrt(x * x + y * y);
|
|
107335
|
+
|
|
107336
|
+
if ((d - _l > r) || (d + _l < r))
|
|
107337
|
+
return false;
|
|
107338
|
+
|
|
107339
|
+
// TODO
|
|
107340
|
+
if (Math.abs(startAngle - endAngle) % PI2 < 1e-4)
|
|
107341
|
+
{
|
|
107342
|
+
// Is a circle
|
|
107343
|
+
return true;
|
|
107344
|
+
}
|
|
107345
|
+
|
|
107346
|
+
if (anticlockwise)
|
|
107347
|
+
{
|
|
107348
|
+
const tmp = startAngle;
|
|
107349
|
+
startAngle = Path2DHelper.FormatRadian(endAngle);
|
|
107350
|
+
endAngle = Path2DHelper.FormatRadian(tmp);
|
|
107351
|
+
}
|
|
107352
|
+
else
|
|
107353
|
+
{
|
|
107354
|
+
startAngle = Path2DHelper.FormatRadian(startAngle);
|
|
107355
|
+
endAngle = Path2DHelper.FormatRadian(endAngle);
|
|
107356
|
+
}
|
|
107357
|
+
|
|
107358
|
+
if (startAngle > endAngle)
|
|
107359
|
+
endAngle += PI2;
|
|
107360
|
+
|
|
107361
|
+
var angle = Math.atan2(y, x);
|
|
107362
|
+
if (angle < 0)
|
|
107363
|
+
angle += PI2;
|
|
107364
|
+
|
|
107365
|
+
return (angle >= startAngle && angle <= endAngle) || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
|
|
107366
|
+
}
|
|
107367
|
+
|
|
107368
|
+
//统一弧度方向
|
|
107369
|
+
Path2DHelper.FormatRadian=function(angle)
|
|
107370
|
+
{
|
|
107371
|
+
angle%= PI2;
|
|
107372
|
+
if (angle<0) angle += PI2;
|
|
107373
|
+
return angle;
|
|
107374
|
+
}
|
|
107375
|
+
|
|
107214
107376
|
|
|
107215
107377
|
|
|
107216
107378
|
|
|
@@ -150433,7 +150595,7 @@ function ScrollBarBGChart()
|
|
|
150433
150595
|
|
|
150434
150596
|
|
|
150435
150597
|
|
|
150436
|
-
var HQCHART_VERSION="1.1.
|
|
150598
|
+
var HQCHART_VERSION="1.1.14869";
|
|
150437
150599
|
|
|
150438
150600
|
function PrintHQChartVersion()
|
|
150439
150601
|
{
|
|
@@ -18699,6 +18699,7 @@ function AverageWidthFrame()
|
|
|
18699
18699
|
if (IFrameSplitOperator.IsNumber(item.Margin.Bottom)) lineInfo.Margin.Bottom=item.Margin.Bottom;
|
|
18700
18700
|
}
|
|
18701
18701
|
if (IFrameSplitOperator.IsNumber(item.YOffset)) lineInfo.YOffset=item.YOffset;
|
|
18702
|
+
if (IFrameSplitOperator.IsNumber(item.Align)) lineInfo.Align=item.Align;
|
|
18702
18703
|
|
|
18703
18704
|
lineInfo.Height=lineHeight+lineInfo.Margin.Top+lineInfo.Margin.Bottom;
|
|
18704
18705
|
|
|
@@ -18736,13 +18737,17 @@ function AverageWidthFrame()
|
|
|
18736
18737
|
|
|
18737
18738
|
if (width<=0 || height<=0) return null;
|
|
18738
18739
|
|
|
18739
|
-
|
|
18740
|
+
var drawInfo={ Width:width, Height:height, AryLine:aryLine, Align:2 }; //Align 1=left 2=center 3=right
|
|
18741
|
+
if (IFrameSplitOperator.IsNumber(obj.Align)) drawInfo.Align=obj.Align;
|
|
18742
|
+
|
|
18743
|
+
return drawInfo;
|
|
18740
18744
|
}
|
|
18741
18745
|
|
|
18742
18746
|
//X轴底部文字多行输出
|
|
18743
18747
|
this.DrawMultiLineVText=function(drawInfo)
|
|
18744
18748
|
{
|
|
18745
18749
|
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
18750
|
+
if (drawInfo.Align==1) xLeft=drawInfo.XCenter;
|
|
18746
18751
|
if (drawInfo.TextRightPrev!=null && drawInfo.TextRightPrev>xLeft)
|
|
18747
18752
|
return false;
|
|
18748
18753
|
|
|
@@ -18754,8 +18759,19 @@ function AverageWidthFrame()
|
|
|
18754
18759
|
for(var i=0, j=0;i<drawInfo.AryLine.length;++i)
|
|
18755
18760
|
{
|
|
18756
18761
|
var lineItem=drawInfo.AryLine[i];
|
|
18757
|
-
if (
|
|
18758
|
-
|
|
18762
|
+
if (drawInfo.Align==1)
|
|
18763
|
+
{
|
|
18764
|
+
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
18765
|
+
if (lineItem.Align==1) xLeft=drawInfo.XCenter;
|
|
18766
|
+
else if (lineItem.Align==2) xLeft=drawInfo.XCenter+drawInfo.Width-lineItem.Width;
|
|
18767
|
+
}
|
|
18768
|
+
else
|
|
18769
|
+
{
|
|
18770
|
+
var xLeft=drawInfo.XCenter-lineItem.Width/2;
|
|
18771
|
+
if (lineItem.Align==1) xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
18772
|
+
else if (lineItem.Align==2) xLeft=drawInfo.XCenter+drawInfo.Width/2-lineItem.Width;
|
|
18773
|
+
}
|
|
18774
|
+
|
|
18759
18775
|
if (xLeft<1) xLeft=1;
|
|
18760
18776
|
yText+=lineItem.Height;
|
|
18761
18777
|
for(j=0;j<lineItem.AryText.length;++j)
|
|
@@ -24067,7 +24083,7 @@ function OverlayKLineFrame()
|
|
|
24067
24083
|
|
|
24068
24084
|
var text=item.Message[1];
|
|
24069
24085
|
if (Array.isArray(item.Message[1])) text=item.Message[1][0];
|
|
24070
|
-
|
|
24086
|
+
this.Canvas.fillStyle=item.TextColor;
|
|
24071
24087
|
if (rightExtendText && rightExtendText.Align)
|
|
24072
24088
|
{
|
|
24073
24089
|
var textWidth=rightWidth;
|
|
@@ -24079,7 +24095,6 @@ function OverlayKLineFrame()
|
|
|
24079
24095
|
{
|
|
24080
24096
|
var xText=right+2;
|
|
24081
24097
|
if (rightLine && rightLine.Width>0) xText+=rightLine.Width;
|
|
24082
|
-
this.Canvas.fillStyle=item.TextColor;
|
|
24083
24098
|
this.Canvas.textAlign="left";
|
|
24084
24099
|
this.Canvas.fillText(text,xText,y);
|
|
24085
24100
|
}
|
|
@@ -68443,9 +68458,14 @@ function IChartDrawPicture()
|
|
|
68443
68458
|
pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);
|
|
68444
68459
|
pt.Y=this.Frame.GetYFromData(item.YValue);
|
|
68445
68460
|
}
|
|
68461
|
+
|
|
68462
|
+
if (Path2DHelper.PtInPoint(x,y,pt,radius))
|
|
68463
|
+
return i;
|
|
68464
|
+
/*
|
|
68446
68465
|
this.Canvas.beginPath();
|
|
68447
68466
|
this.Canvas.arc(pt.X,pt.Y,radius,0,360);
|
|
68448
68467
|
if (this.Canvas.isPointInPath(x,y)) return i;
|
|
68468
|
+
*/
|
|
68449
68469
|
}
|
|
68450
68470
|
|
|
68451
68471
|
return -1;
|
|
@@ -68463,6 +68483,20 @@ function IChartDrawPicture()
|
|
|
68463
68483
|
var pixel=GetDevicePixelRatio();
|
|
68464
68484
|
lineWidth*=pixel;
|
|
68465
68485
|
for(var i=0;i<this.LinePoint.length; ++i)
|
|
68486
|
+
{
|
|
68487
|
+
var item=this.LinePoint[i];
|
|
68488
|
+
var ptStart=item.Start;
|
|
68489
|
+
var ptEnd=item.End;
|
|
68490
|
+
|
|
68491
|
+
if (Path2DHelper.PtInLine(x, y, ptStart, ptEnd, lineWidth))
|
|
68492
|
+
{
|
|
68493
|
+
return i;
|
|
68494
|
+
}
|
|
68495
|
+
}
|
|
68496
|
+
return -1;
|
|
68497
|
+
|
|
68498
|
+
/*
|
|
68499
|
+
for(var i=0;i<this.LinePoint.length; ++i)
|
|
68466
68500
|
{
|
|
68467
68501
|
var item=this.LinePoint[i];
|
|
68468
68502
|
var ptStart=item.Start;
|
|
@@ -68491,6 +68525,7 @@ function IChartDrawPicture()
|
|
|
68491
68525
|
}
|
|
68492
68526
|
|
|
68493
68527
|
return -1;
|
|
68528
|
+
*/
|
|
68494
68529
|
}
|
|
68495
68530
|
|
|
68496
68531
|
//0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
|
|
@@ -71184,6 +71219,18 @@ function ChartDrawPictureRect()
|
|
|
71184
71219
|
//点是否在线段上 水平线段
|
|
71185
71220
|
this.IsPointInLine=function(aryPoint,x,y,option)
|
|
71186
71221
|
{
|
|
71222
|
+
var lineWidth=5;
|
|
71223
|
+
var pixel=GetDevicePixelRatio();
|
|
71224
|
+
if (IFrameSplitOperator.IsPlusNumber(this.LineWidth) && this.LineWidth>lineWidth) lineWidth=this.LineWidth;
|
|
71225
|
+
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) lineWidth+=option.Zoom;
|
|
71226
|
+
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) lineWidth+=this.Option.Zoom;
|
|
71227
|
+
lineWidth*=pixel;
|
|
71228
|
+
if (Path2DHelper.PtInLine(x,y,aryPoint[0], aryPoint[1], lineWidth))
|
|
71229
|
+
return true;
|
|
71230
|
+
|
|
71231
|
+
return false;
|
|
71232
|
+
|
|
71233
|
+
/*
|
|
71187
71234
|
var radius=5;
|
|
71188
71235
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
71189
71236
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -71198,11 +71245,14 @@ function ChartDrawPictureRect()
|
|
|
71198
71245
|
this.Canvas.closePath();
|
|
71199
71246
|
if (this.Canvas.isPointInPath(x,y))
|
|
71200
71247
|
return true;
|
|
71248
|
+
*/
|
|
71201
71249
|
}
|
|
71202
71250
|
|
|
71203
71251
|
//垂直线段
|
|
71204
71252
|
this.IsPointInLine2=function(aryPoint,x,y,option)
|
|
71205
71253
|
{
|
|
71254
|
+
return this.IsPointInLine(aryPoint,x,y,option);
|
|
71255
|
+
/*
|
|
71206
71256
|
var radius=5;
|
|
71207
71257
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
71208
71258
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -71217,6 +71267,7 @@ function ChartDrawPictureRect()
|
|
|
71217
71267
|
this.Canvas.closePath();
|
|
71218
71268
|
if (this.Canvas.isPointInPath(x,y))
|
|
71219
71269
|
return true;
|
|
71270
|
+
*/
|
|
71220
71271
|
}
|
|
71221
71272
|
}
|
|
71222
71273
|
|
|
@@ -107255,6 +107306,117 @@ function GetLocalTime(i) //得到标准时区的时间的函数
|
|
|
107255
107306
|
return new Date(utcTime + 3600000 * i);
|
|
107256
107307
|
}
|
|
107257
107308
|
|
|
107309
|
+
//图形路径方法
|
|
107310
|
+
function Path2DHelper() { }
|
|
107311
|
+
const PI2 = Math.PI * 2;
|
|
107312
|
+
|
|
107313
|
+
//点是否在线段上
|
|
107314
|
+
Path2DHelper.PtInLine=function(x, y, pt, pt2, lineWidth)
|
|
107315
|
+
{
|
|
107316
|
+
if (lineWidth<=0) return false;
|
|
107317
|
+
|
|
107318
|
+
var x0=pt.X, y0=pt.Y;
|
|
107319
|
+
var x1=pt2.X, y1=pt2.Y;
|
|
107320
|
+
|
|
107321
|
+
const _l = lineWidth;
|
|
107322
|
+
let _a = 0;
|
|
107323
|
+
let _b = x0;
|
|
107324
|
+
|
|
107325
|
+
// Quick reject
|
|
107326
|
+
if (
|
|
107327
|
+
(y > y0 + _l && y > y1 + _l)
|
|
107328
|
+
|| (y < y0 - _l && y < y1 - _l)
|
|
107329
|
+
|| (x > x0 + _l && x > x1 + _l)
|
|
107330
|
+
|| (x < x0 - _l && x < x1 - _l)
|
|
107331
|
+
)
|
|
107332
|
+
{
|
|
107333
|
+
return false;
|
|
107334
|
+
}
|
|
107335
|
+
|
|
107336
|
+
if (x0 !== x1)
|
|
107337
|
+
{
|
|
107338
|
+
_a = (y0 - y1) / (x0 - x1);
|
|
107339
|
+
_b = (x0 * y1 - x1 * y0) / (x0 - x1);
|
|
107340
|
+
}
|
|
107341
|
+
else
|
|
107342
|
+
{
|
|
107343
|
+
return Math.abs(x - x0) <= _l / 2;
|
|
107344
|
+
}
|
|
107345
|
+
|
|
107346
|
+
const tmp = _a * x - y + _b;
|
|
107347
|
+
const _s = tmp * tmp / (_a * _a + 1);
|
|
107348
|
+
return _s <= _l / 2 * _l / 2;
|
|
107349
|
+
}
|
|
107350
|
+
|
|
107351
|
+
//点是否在圆点上
|
|
107352
|
+
Path2DHelper.PtInPoint=function(x,y, ptCenter, radius)
|
|
107353
|
+
{
|
|
107354
|
+
if (radius<=0) return false;
|
|
107355
|
+
|
|
107356
|
+
var cx=ptCenter.X;
|
|
107357
|
+
var cy=ptCenter.Y;
|
|
107358
|
+
|
|
107359
|
+
x -= cx;
|
|
107360
|
+
y -= cy;
|
|
107361
|
+
const d = Math.sqrt(x * x + y * y); //到圆心的距离
|
|
107362
|
+
|
|
107363
|
+
if (d>radius) return false;
|
|
107364
|
+
|
|
107365
|
+
return true;
|
|
107366
|
+
}
|
|
107367
|
+
|
|
107368
|
+
Path2DHelper.PtInArc=function(x, y, ptCenter, radius, startAngle, endAngle,lineWidth, anticlockwise)
|
|
107369
|
+
{
|
|
107370
|
+
if (lineWidth<=0) return false;
|
|
107371
|
+
|
|
107372
|
+
const _l = lineWidth;
|
|
107373
|
+
var cx=ptCenter.X;
|
|
107374
|
+
var cy=ptCenter.Y;
|
|
107375
|
+
|
|
107376
|
+
x -= cx;
|
|
107377
|
+
y -= cy;
|
|
107378
|
+
const d = Math.sqrt(x * x + y * y);
|
|
107379
|
+
|
|
107380
|
+
if ((d - _l > r) || (d + _l < r))
|
|
107381
|
+
return false;
|
|
107382
|
+
|
|
107383
|
+
// TODO
|
|
107384
|
+
if (Math.abs(startAngle - endAngle) % PI2 < 1e-4)
|
|
107385
|
+
{
|
|
107386
|
+
// Is a circle
|
|
107387
|
+
return true;
|
|
107388
|
+
}
|
|
107389
|
+
|
|
107390
|
+
if (anticlockwise)
|
|
107391
|
+
{
|
|
107392
|
+
const tmp = startAngle;
|
|
107393
|
+
startAngle = Path2DHelper.FormatRadian(endAngle);
|
|
107394
|
+
endAngle = Path2DHelper.FormatRadian(tmp);
|
|
107395
|
+
}
|
|
107396
|
+
else
|
|
107397
|
+
{
|
|
107398
|
+
startAngle = Path2DHelper.FormatRadian(startAngle);
|
|
107399
|
+
endAngle = Path2DHelper.FormatRadian(endAngle);
|
|
107400
|
+
}
|
|
107401
|
+
|
|
107402
|
+
if (startAngle > endAngle)
|
|
107403
|
+
endAngle += PI2;
|
|
107404
|
+
|
|
107405
|
+
var angle = Math.atan2(y, x);
|
|
107406
|
+
if (angle < 0)
|
|
107407
|
+
angle += PI2;
|
|
107408
|
+
|
|
107409
|
+
return (angle >= startAngle && angle <= endAngle) || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
|
|
107410
|
+
}
|
|
107411
|
+
|
|
107412
|
+
//统一弧度方向
|
|
107413
|
+
Path2DHelper.FormatRadian=function(angle)
|
|
107414
|
+
{
|
|
107415
|
+
angle%= PI2;
|
|
107416
|
+
if (angle<0) angle += PI2;
|
|
107417
|
+
return angle;
|
|
107418
|
+
}
|
|
107419
|
+
|
|
107258
107420
|
|
|
107259
107421
|
|
|
107260
107422
|
|
|
@@ -161653,7 +161815,7 @@ function HQChartScriptWorker()
|
|
|
161653
161815
|
|
|
161654
161816
|
|
|
161655
161817
|
|
|
161656
|
-
var HQCHART_VERSION="1.1.
|
|
161818
|
+
var HQCHART_VERSION="1.1.14869";
|
|
161657
161819
|
|
|
161658
161820
|
function PrintHQChartVersion()
|
|
161659
161821
|
{
|