hqchart 1.1.14862 → 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 +85 -13
- package/package.json +1 -1
- package/src/jscommon/umychart.complier.js +1 -1
- package/src/jscommon/umychart.js +342 -69
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +344 -71
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +344 -71
|
@@ -18563,98 +18563,118 @@ function AverageWidthFrame()
|
|
|
18563
18563
|
this.DrawDayVertical(item, x, border);
|
|
18564
18564
|
}
|
|
18565
18565
|
|
|
18566
|
-
if (
|
|
18566
|
+
if (item.Message[0]!=null && this.ChartBorder.Bottom>5*pixelRatio)
|
|
18567
18567
|
{
|
|
18568
|
-
if (
|
|
18569
|
-
|
|
18570
|
-
var textLeft=0;
|
|
18571
|
-
|
|
18572
|
-
this.Canvas.strokeStyle=item.TextColor;
|
|
18573
|
-
var testWidth=this.Canvas.measureText(this.VerticalInfo[i].Message[0]).width;
|
|
18574
|
-
var textHeight=this.Canvas.measureText("擎").width;
|
|
18575
|
-
if (bottomTextExtend && bottomTextExtend.Align==1)
|
|
18568
|
+
if (IFrameSplitOperator.IsObject(item.Message[0]))
|
|
18576
18569
|
{
|
|
18577
|
-
|
|
18578
|
-
|
|
18579
|
-
|
|
18570
|
+
var textObj=item.Message[0];
|
|
18571
|
+
if (!textObj.Font) textObj.Font=item.Font;
|
|
18572
|
+
if (!textObj.TextColor) textObj.TextColor=item.TextColor;
|
|
18573
|
+
var drawInfo=this.GetMultiLineVTextSize(textObj);
|
|
18574
|
+
if (drawInfo)
|
|
18575
|
+
{
|
|
18576
|
+
drawInfo.XCenter=x;
|
|
18577
|
+
var rtBottom={ Left:0, Right:right, Top:bottom+2*pixelRatio, Bottom:border.Height };
|
|
18578
|
+
rtBottom.Width=rtBottom.Right-rtBottom.Left;
|
|
18579
|
+
rtBottom.Height=rtBottom.Bottom-rtBottom.Top;
|
|
18580
|
+
drawInfo.RectBottom=rtBottom;
|
|
18581
|
+
drawInfo.TextRightPrev=textRightPrev;
|
|
18582
|
+
this.DrawMultiLineVText(drawInfo);
|
|
18583
|
+
if (drawInfo.TextRight) textRightPrev=drawInfo.TextRight;
|
|
18584
|
+
}
|
|
18580
18585
|
}
|
|
18581
18586
|
else
|
|
18582
18587
|
{
|
|
18583
|
-
if (
|
|
18588
|
+
if (item.Font) this.Canvas.font=item.Font;
|
|
18589
|
+
var textLeft=0;
|
|
18590
|
+
|
|
18591
|
+
this.Canvas.strokeStyle=item.TextColor;
|
|
18592
|
+
var testWidth=this.Canvas.measureText(item.Message[0]).width;
|
|
18593
|
+
var textHeight=this.Canvas.measureText("擎").width;
|
|
18594
|
+
if (bottomTextExtend && bottomTextExtend.Align==1)
|
|
18584
18595
|
{
|
|
18585
18596
|
this.Canvas.textAlign="left";
|
|
18586
18597
|
this.Canvas.textBaseline="top";
|
|
18587
18598
|
textLeft=x;
|
|
18588
18599
|
}
|
|
18589
|
-
else if ((x + testWidth / 2) >= this.ChartBorder.GetChartWidth())
|
|
18590
|
-
{
|
|
18591
|
-
this.Canvas.textAlign = "right";
|
|
18592
|
-
this.Canvas.textBaseline="top";
|
|
18593
|
-
textLeft=x-testWidth;
|
|
18594
|
-
}
|
|
18595
18600
|
else
|
|
18596
18601
|
{
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
|
|
18602
|
+
if (x<testWidth/2)
|
|
18603
|
+
{
|
|
18604
|
+
this.Canvas.textAlign="left";
|
|
18605
|
+
this.Canvas.textBaseline="top";
|
|
18606
|
+
textLeft=x;
|
|
18607
|
+
}
|
|
18608
|
+
else if ((x + testWidth / 2) >= this.ChartBorder.GetChartWidth())
|
|
18609
|
+
{
|
|
18610
|
+
this.Canvas.textAlign = "right";
|
|
18611
|
+
this.Canvas.textBaseline="top";
|
|
18612
|
+
textLeft=x-testWidth;
|
|
18613
|
+
}
|
|
18614
|
+
else
|
|
18615
|
+
{
|
|
18616
|
+
this.Canvas.textAlign="center";
|
|
18617
|
+
this.Canvas.textBaseline="top";
|
|
18618
|
+
textLeft=x-(testWidth/2);
|
|
18619
|
+
}
|
|
18600
18620
|
}
|
|
18601
|
-
}
|
|
18602
18621
|
|
|
18603
|
-
|
|
18604
|
-
{
|
|
18605
|
-
var yText=bottom;
|
|
18606
|
-
if (item.LineType==3)
|
|
18622
|
+
if (textRightPrev==null || textLeft>textRightPrev)
|
|
18607
18623
|
{
|
|
18608
|
-
var
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18624
|
+
var yText=bottom;
|
|
18625
|
+
if (item.LineType==3)
|
|
18626
|
+
{
|
|
18627
|
+
var lineLength=this.ShortXLineLength*pixelRatio;
|
|
18628
|
+
this.Canvas.beginPath();
|
|
18629
|
+
this.Canvas.moveTo(xFixed,yText);
|
|
18630
|
+
this.Canvas.lineTo(xFixed,yText+lineLength);
|
|
18631
|
+
this.Canvas.stroke();
|
|
18613
18632
|
|
|
18614
|
-
|
|
18615
|
-
|
|
18633
|
+
yText+=lineLength+2*pixelRatio;
|
|
18634
|
+
}
|
|
18616
18635
|
|
|
18617
|
-
|
|
18618
|
-
{
|
|
18619
|
-
if (bottomLineExtend.Mode===1)
|
|
18636
|
+
if (bottomLineExtend)
|
|
18620
18637
|
{
|
|
18621
|
-
if (
|
|
18638
|
+
if (bottomLineExtend.Mode===1)
|
|
18622
18639
|
{
|
|
18623
|
-
if (
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
18627
|
-
|
|
18628
|
-
|
|
18640
|
+
if (item.Value>1)
|
|
18641
|
+
{
|
|
18642
|
+
if (bottomLineExtend.Color) this.Canvas.strokeStyle=bottomLineExtend.Color;
|
|
18643
|
+
this.Canvas.beginPath();
|
|
18644
|
+
this.Canvas.moveTo(xFixed,bottom);
|
|
18645
|
+
this.Canvas.lineTo(xFixed,border.ChartHeight);
|
|
18646
|
+
this.Canvas.stroke();
|
|
18647
|
+
x+=1;
|
|
18648
|
+
}
|
|
18629
18649
|
}
|
|
18630
|
-
|
|
18631
|
-
else if (bottomLineExtend.Mode===2)
|
|
18632
|
-
{
|
|
18633
|
-
if (bottomLineExtend.Width>=1)
|
|
18650
|
+
else if (bottomLineExtend.Mode===2)
|
|
18634
18651
|
{
|
|
18635
|
-
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18652
|
+
if (bottomLineExtend.Width>=1)
|
|
18653
|
+
{
|
|
18654
|
+
var lineLength=bottomLineExtend.Width;
|
|
18655
|
+
if (bottomLineExtend.Color) this.Canvas.strokeStyle=bottomLineExtend.Color;
|
|
18656
|
+
this.Canvas.beginPath();
|
|
18657
|
+
this.Canvas.moveTo(xFixed,yText);
|
|
18658
|
+
this.Canvas.lineTo(xFixed,yText+lineLength);
|
|
18659
|
+
this.Canvas.stroke();
|
|
18660
|
+
|
|
18661
|
+
yText+=lineLength+2;
|
|
18662
|
+
}
|
|
18643
18663
|
}
|
|
18644
18664
|
}
|
|
18645
|
-
}
|
|
18646
18665
|
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18666
|
+
//item.TextBGColor="rgb(0,255,0)";
|
|
18667
|
+
if (item.TextBGColor) //文字背景色
|
|
18668
|
+
{
|
|
18669
|
+
var rtText={ Left:textLeft, Top:yText+this.XBottomOffset, Width:testWidth, Height:textHeight };
|
|
18670
|
+
this.Canvas.fillStyle=item.TextBGColor;
|
|
18671
|
+
this.Canvas.fillRect(rtText.Left-1, rtText.Top, rtText.Width+2, rtText.Height);
|
|
18672
|
+
}
|
|
18654
18673
|
|
|
18655
|
-
|
|
18656
|
-
|
|
18657
|
-
|
|
18674
|
+
this.Canvas.fillStyle=item.TextColor;
|
|
18675
|
+
this.Canvas.fillText(this.VerticalInfo[i].Message[0],x,yText+this.XBottomOffset);
|
|
18676
|
+
textRightPrev=textLeft+testWidth;
|
|
18677
|
+
}
|
|
18658
18678
|
}
|
|
18659
18679
|
}
|
|
18660
18680
|
|
|
@@ -18662,6 +18682,113 @@ function AverageWidthFrame()
|
|
|
18662
18682
|
}
|
|
18663
18683
|
}
|
|
18664
18684
|
|
|
18685
|
+
//{Font:, AryText:[ { AryText:[{ Text:, Color: }], }, ] }
|
|
18686
|
+
this.GetMultiLineVTextSize=function(obj)
|
|
18687
|
+
{
|
|
18688
|
+
if (obj.Font) this.Canvas.font=obj.Font;
|
|
18689
|
+
|
|
18690
|
+
var lineHeight=this.Canvas.measureText('擎').width;
|
|
18691
|
+
var aryLine=[];
|
|
18692
|
+
for(var i=0;i<obj.AryText.length;++i)
|
|
18693
|
+
{
|
|
18694
|
+
var item=obj.AryText[i];
|
|
18695
|
+
var lineInfo={ Width:0, Height:lineHeight, AryText:[], Align:2, Margin:{ Top:1, Bottom:1 } , YOffset:-1 };
|
|
18696
|
+
if (item.Margin)
|
|
18697
|
+
{
|
|
18698
|
+
if (IFrameSplitOperator.IsNumber(item.Margin.Top)) lineInfo.Margin.Top=item.Margin.Top;
|
|
18699
|
+
if (IFrameSplitOperator.IsNumber(item.Margin.Bottom)) lineInfo.Margin.Bottom=item.Margin.Bottom;
|
|
18700
|
+
}
|
|
18701
|
+
if (IFrameSplitOperator.IsNumber(item.YOffset)) lineInfo.YOffset=item.YOffset;
|
|
18702
|
+
if (IFrameSplitOperator.IsNumber(item.Align)) lineInfo.Align=item.Align;
|
|
18703
|
+
|
|
18704
|
+
lineInfo.Height=lineHeight+lineInfo.Margin.Top+lineInfo.Margin.Bottom;
|
|
18705
|
+
|
|
18706
|
+
for(var j=0; j<item.AryText.length; ++j)
|
|
18707
|
+
{
|
|
18708
|
+
var subItem=item.AryText[j];
|
|
18709
|
+
if (!subItem || !subItem.Text) continue;
|
|
18710
|
+
var width=this.Canvas.measureText(subItem.Text).width;
|
|
18711
|
+
var textItem={ Width: width, Text:subItem.Text, Color:obj.TextColor , Margin:{Left:0, Right:0 }};
|
|
18712
|
+
if (subItem.Color) textItem.Color=subItem.Color;
|
|
18713
|
+
if (subItem.Margin)
|
|
18714
|
+
{
|
|
18715
|
+
if (IFrameSplitOperator.IsNumber(subItem.Margin.Left)) textItem.Margin.Left=subItem.Margin.Left;
|
|
18716
|
+
if (IFrameSplitOperator.IsNumber(subItem.Margin.Right)) textItem.Margin.Right=subItem.Margin.Right;
|
|
18717
|
+
}
|
|
18718
|
+
textItem.Width=width+textItem.Margin.Right+textItem.Margin.Left;
|
|
18719
|
+
|
|
18720
|
+
lineInfo.Width+=textItem.Width;
|
|
18721
|
+
|
|
18722
|
+
lineInfo.AryText.push(textItem);
|
|
18723
|
+
}
|
|
18724
|
+
|
|
18725
|
+
aryLine.push(lineInfo);
|
|
18726
|
+
}
|
|
18727
|
+
|
|
18728
|
+
if (aryLine.length<=0) return null;
|
|
18729
|
+
|
|
18730
|
+
var width=0, height=0;
|
|
18731
|
+
for(var i=0;i<aryLine.length;++i)
|
|
18732
|
+
{
|
|
18733
|
+
var item=aryLine[i];
|
|
18734
|
+
if (width<item.Width) width=item.Width;
|
|
18735
|
+
height+=item.Height;
|
|
18736
|
+
}
|
|
18737
|
+
|
|
18738
|
+
if (width<=0 || height<=0) return null;
|
|
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;
|
|
18744
|
+
}
|
|
18745
|
+
|
|
18746
|
+
//X轴底部文字多行输出
|
|
18747
|
+
this.DrawMultiLineVText=function(drawInfo)
|
|
18748
|
+
{
|
|
18749
|
+
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
18750
|
+
if (drawInfo.Align==1) xLeft=drawInfo.XCenter;
|
|
18751
|
+
if (drawInfo.TextRightPrev!=null && drawInfo.TextRightPrev>xLeft)
|
|
18752
|
+
return false;
|
|
18753
|
+
|
|
18754
|
+
this.Canvas.font=drawInfo.Font;
|
|
18755
|
+
this.Canvas.textAlign="left";
|
|
18756
|
+
this.Canvas.textBaseline="bottom";
|
|
18757
|
+
var yText=drawInfo.RectBottom.Top;
|
|
18758
|
+
var textRight=null;
|
|
18759
|
+
for(var i=0, j=0;i<drawInfo.AryLine.length;++i)
|
|
18760
|
+
{
|
|
18761
|
+
var lineItem=drawInfo.AryLine[i];
|
|
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
|
+
|
|
18775
|
+
if (xLeft<1) xLeft=1;
|
|
18776
|
+
yText+=lineItem.Height;
|
|
18777
|
+
for(j=0;j<lineItem.AryText.length;++j)
|
|
18778
|
+
{
|
|
18779
|
+
var item=lineItem.AryText[j];
|
|
18780
|
+
this.Canvas.fillStyle=item.Color;
|
|
18781
|
+
this.Canvas.fillText(item.Text,xLeft+item.Margin.Left,yText+lineItem.YOffset);
|
|
18782
|
+
xLeft+=item.Width;
|
|
18783
|
+
}
|
|
18784
|
+
|
|
18785
|
+
if (textRight==null || textRight<xLeft) textRight=xLeft;
|
|
18786
|
+
}
|
|
18787
|
+
|
|
18788
|
+
drawInfo.TextRight=textRight;
|
|
18789
|
+
return true;
|
|
18790
|
+
}
|
|
18791
|
+
|
|
18665
18792
|
//Y坐标转y轴数值
|
|
18666
18793
|
this.GetYData=function(y,isLimit)
|
|
18667
18794
|
{
|
|
@@ -23956,7 +24083,7 @@ function OverlayKLineFrame()
|
|
|
23956
24083
|
|
|
23957
24084
|
var text=item.Message[1];
|
|
23958
24085
|
if (Array.isArray(item.Message[1])) text=item.Message[1][0];
|
|
23959
|
-
|
|
24086
|
+
this.Canvas.fillStyle=item.TextColor;
|
|
23960
24087
|
if (rightExtendText && rightExtendText.Align)
|
|
23961
24088
|
{
|
|
23962
24089
|
var textWidth=rightWidth;
|
|
@@ -23968,7 +24095,6 @@ function OverlayKLineFrame()
|
|
|
23968
24095
|
{
|
|
23969
24096
|
var xText=right+2;
|
|
23970
24097
|
if (rightLine && rightLine.Width>0) xText+=rightLine.Width;
|
|
23971
|
-
this.Canvas.fillStyle=item.TextColor;
|
|
23972
24098
|
this.Canvas.textAlign="left";
|
|
23973
24099
|
this.Canvas.fillText(text,xText,y);
|
|
23974
24100
|
}
|
|
@@ -68332,9 +68458,14 @@ function IChartDrawPicture()
|
|
|
68332
68458
|
pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);
|
|
68333
68459
|
pt.Y=this.Frame.GetYFromData(item.YValue);
|
|
68334
68460
|
}
|
|
68461
|
+
|
|
68462
|
+
if (Path2DHelper.PtInPoint(x,y,pt,radius))
|
|
68463
|
+
return i;
|
|
68464
|
+
/*
|
|
68335
68465
|
this.Canvas.beginPath();
|
|
68336
68466
|
this.Canvas.arc(pt.X,pt.Y,radius,0,360);
|
|
68337
68467
|
if (this.Canvas.isPointInPath(x,y)) return i;
|
|
68468
|
+
*/
|
|
68338
68469
|
}
|
|
68339
68470
|
|
|
68340
68471
|
return -1;
|
|
@@ -68352,6 +68483,20 @@ function IChartDrawPicture()
|
|
|
68352
68483
|
var pixel=GetDevicePixelRatio();
|
|
68353
68484
|
lineWidth*=pixel;
|
|
68354
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)
|
|
68355
68500
|
{
|
|
68356
68501
|
var item=this.LinePoint[i];
|
|
68357
68502
|
var ptStart=item.Start;
|
|
@@ -68380,6 +68525,7 @@ function IChartDrawPicture()
|
|
|
68380
68525
|
}
|
|
68381
68526
|
|
|
68382
68527
|
return -1;
|
|
68528
|
+
*/
|
|
68383
68529
|
}
|
|
68384
68530
|
|
|
68385
68531
|
//0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
|
|
@@ -71073,6 +71219,18 @@ function ChartDrawPictureRect()
|
|
|
71073
71219
|
//点是否在线段上 水平线段
|
|
71074
71220
|
this.IsPointInLine=function(aryPoint,x,y,option)
|
|
71075
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
|
+
/*
|
|
71076
71234
|
var radius=5;
|
|
71077
71235
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
71078
71236
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -71087,11 +71245,14 @@ function ChartDrawPictureRect()
|
|
|
71087
71245
|
this.Canvas.closePath();
|
|
71088
71246
|
if (this.Canvas.isPointInPath(x,y))
|
|
71089
71247
|
return true;
|
|
71248
|
+
*/
|
|
71090
71249
|
}
|
|
71091
71250
|
|
|
71092
71251
|
//垂直线段
|
|
71093
71252
|
this.IsPointInLine2=function(aryPoint,x,y,option)
|
|
71094
71253
|
{
|
|
71254
|
+
return this.IsPointInLine(aryPoint,x,y,option);
|
|
71255
|
+
/*
|
|
71095
71256
|
var radius=5;
|
|
71096
71257
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
71097
71258
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -71106,6 +71267,7 @@ function ChartDrawPictureRect()
|
|
|
71106
71267
|
this.Canvas.closePath();
|
|
71107
71268
|
if (this.Canvas.isPointInPath(x,y))
|
|
71108
71269
|
return true;
|
|
71270
|
+
*/
|
|
71109
71271
|
}
|
|
71110
71272
|
}
|
|
71111
71273
|
|
|
@@ -107144,6 +107306,117 @@ function GetLocalTime(i) //得到标准时区的时间的函数
|
|
|
107144
107306
|
return new Date(utcTime + 3600000 * i);
|
|
107145
107307
|
}
|
|
107146
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
|
+
|
|
107147
107420
|
|
|
107148
107421
|
|
|
107149
107422
|
|
|
@@ -132386,7 +132659,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
|
|
|
132386
132659
|
var config=draw.Config;
|
|
132387
132660
|
if (IFrameSplitOperator.IsString(config.LineWidth)) outVarItem.LineWidth=config.LineWidth;
|
|
132388
132661
|
if (IFrameSplitOperator.IsNumber(config.LineType)) drawItem.DrawData.LineType=config.LineType;
|
|
132389
|
-
if (config.Color) outVarItem.Color=config.
|
|
132662
|
+
if (config.Color) outVarItem.Color=config.Color;
|
|
132390
132663
|
}
|
|
132391
132664
|
|
|
132392
132665
|
result.push(outVarItem);
|
|
@@ -161542,7 +161815,7 @@ function HQChartScriptWorker()
|
|
|
161542
161815
|
|
|
161543
161816
|
|
|
161544
161817
|
|
|
161545
|
-
var HQCHART_VERSION="1.1.
|
|
161818
|
+
var HQCHART_VERSION="1.1.14869";
|
|
161546
161819
|
|
|
161547
161820
|
function PrintHQChartVersion()
|
|
161548
161821
|
{
|