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
|
@@ -18519,98 +18519,118 @@ function AverageWidthFrame()
|
|
|
18519
18519
|
this.DrawDayVertical(item, x, border);
|
|
18520
18520
|
}
|
|
18521
18521
|
|
|
18522
|
-
if (
|
|
18522
|
+
if (item.Message[0]!=null && this.ChartBorder.Bottom>5*pixelRatio)
|
|
18523
18523
|
{
|
|
18524
|
-
if (
|
|
18525
|
-
|
|
18526
|
-
var textLeft=0;
|
|
18527
|
-
|
|
18528
|
-
this.Canvas.strokeStyle=item.TextColor;
|
|
18529
|
-
var testWidth=this.Canvas.measureText(this.VerticalInfo[i].Message[0]).width;
|
|
18530
|
-
var textHeight=this.Canvas.measureText("擎").width;
|
|
18531
|
-
if (bottomTextExtend && bottomTextExtend.Align==1)
|
|
18524
|
+
if (IFrameSplitOperator.IsObject(item.Message[0]))
|
|
18532
18525
|
{
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18526
|
+
var textObj=item.Message[0];
|
|
18527
|
+
if (!textObj.Font) textObj.Font=item.Font;
|
|
18528
|
+
if (!textObj.TextColor) textObj.TextColor=item.TextColor;
|
|
18529
|
+
var drawInfo=this.GetMultiLineVTextSize(textObj);
|
|
18530
|
+
if (drawInfo)
|
|
18531
|
+
{
|
|
18532
|
+
drawInfo.XCenter=x;
|
|
18533
|
+
var rtBottom={ Left:0, Right:right, Top:bottom+2*pixelRatio, Bottom:border.Height };
|
|
18534
|
+
rtBottom.Width=rtBottom.Right-rtBottom.Left;
|
|
18535
|
+
rtBottom.Height=rtBottom.Bottom-rtBottom.Top;
|
|
18536
|
+
drawInfo.RectBottom=rtBottom;
|
|
18537
|
+
drawInfo.TextRightPrev=textRightPrev;
|
|
18538
|
+
this.DrawMultiLineVText(drawInfo);
|
|
18539
|
+
if (drawInfo.TextRight) textRightPrev=drawInfo.TextRight;
|
|
18540
|
+
}
|
|
18536
18541
|
}
|
|
18537
18542
|
else
|
|
18538
18543
|
{
|
|
18539
|
-
if (
|
|
18544
|
+
if (item.Font) this.Canvas.font=item.Font;
|
|
18545
|
+
var textLeft=0;
|
|
18546
|
+
|
|
18547
|
+
this.Canvas.strokeStyle=item.TextColor;
|
|
18548
|
+
var testWidth=this.Canvas.measureText(item.Message[0]).width;
|
|
18549
|
+
var textHeight=this.Canvas.measureText("擎").width;
|
|
18550
|
+
if (bottomTextExtend && bottomTextExtend.Align==1)
|
|
18540
18551
|
{
|
|
18541
18552
|
this.Canvas.textAlign="left";
|
|
18542
18553
|
this.Canvas.textBaseline="top";
|
|
18543
18554
|
textLeft=x;
|
|
18544
18555
|
}
|
|
18545
|
-
else if ((x + testWidth / 2) >= this.ChartBorder.GetChartWidth())
|
|
18546
|
-
{
|
|
18547
|
-
this.Canvas.textAlign = "right";
|
|
18548
|
-
this.Canvas.textBaseline="top";
|
|
18549
|
-
textLeft=x-testWidth;
|
|
18550
|
-
}
|
|
18551
18556
|
else
|
|
18552
18557
|
{
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
|
|
18558
|
+
if (x<testWidth/2)
|
|
18559
|
+
{
|
|
18560
|
+
this.Canvas.textAlign="left";
|
|
18561
|
+
this.Canvas.textBaseline="top";
|
|
18562
|
+
textLeft=x;
|
|
18563
|
+
}
|
|
18564
|
+
else if ((x + testWidth / 2) >= this.ChartBorder.GetChartWidth())
|
|
18565
|
+
{
|
|
18566
|
+
this.Canvas.textAlign = "right";
|
|
18567
|
+
this.Canvas.textBaseline="top";
|
|
18568
|
+
textLeft=x-testWidth;
|
|
18569
|
+
}
|
|
18570
|
+
else
|
|
18571
|
+
{
|
|
18572
|
+
this.Canvas.textAlign="center";
|
|
18573
|
+
this.Canvas.textBaseline="top";
|
|
18574
|
+
textLeft=x-(testWidth/2);
|
|
18575
|
+
}
|
|
18556
18576
|
}
|
|
18557
|
-
}
|
|
18558
18577
|
|
|
18559
|
-
|
|
18560
|
-
{
|
|
18561
|
-
var yText=bottom;
|
|
18562
|
-
if (item.LineType==3)
|
|
18578
|
+
if (textRightPrev==null || textLeft>textRightPrev)
|
|
18563
18579
|
{
|
|
18564
|
-
var
|
|
18565
|
-
|
|
18566
|
-
|
|
18567
|
-
|
|
18568
|
-
|
|
18580
|
+
var yText=bottom;
|
|
18581
|
+
if (item.LineType==3)
|
|
18582
|
+
{
|
|
18583
|
+
var lineLength=this.ShortXLineLength*pixelRatio;
|
|
18584
|
+
this.Canvas.beginPath();
|
|
18585
|
+
this.Canvas.moveTo(xFixed,yText);
|
|
18586
|
+
this.Canvas.lineTo(xFixed,yText+lineLength);
|
|
18587
|
+
this.Canvas.stroke();
|
|
18569
18588
|
|
|
18570
|
-
|
|
18571
|
-
|
|
18589
|
+
yText+=lineLength+2*pixelRatio;
|
|
18590
|
+
}
|
|
18572
18591
|
|
|
18573
|
-
|
|
18574
|
-
{
|
|
18575
|
-
if (bottomLineExtend.Mode===1)
|
|
18592
|
+
if (bottomLineExtend)
|
|
18576
18593
|
{
|
|
18577
|
-
if (
|
|
18594
|
+
if (bottomLineExtend.Mode===1)
|
|
18578
18595
|
{
|
|
18579
|
-
if (
|
|
18580
|
-
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18596
|
+
if (item.Value>1)
|
|
18597
|
+
{
|
|
18598
|
+
if (bottomLineExtend.Color) this.Canvas.strokeStyle=bottomLineExtend.Color;
|
|
18599
|
+
this.Canvas.beginPath();
|
|
18600
|
+
this.Canvas.moveTo(xFixed,bottom);
|
|
18601
|
+
this.Canvas.lineTo(xFixed,border.ChartHeight);
|
|
18602
|
+
this.Canvas.stroke();
|
|
18603
|
+
x+=1;
|
|
18604
|
+
}
|
|
18585
18605
|
}
|
|
18586
|
-
|
|
18587
|
-
else if (bottomLineExtend.Mode===2)
|
|
18588
|
-
{
|
|
18589
|
-
if (bottomLineExtend.Width>=1)
|
|
18606
|
+
else if (bottomLineExtend.Mode===2)
|
|
18590
18607
|
{
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18608
|
+
if (bottomLineExtend.Width>=1)
|
|
18609
|
+
{
|
|
18610
|
+
var lineLength=bottomLineExtend.Width;
|
|
18611
|
+
if (bottomLineExtend.Color) this.Canvas.strokeStyle=bottomLineExtend.Color;
|
|
18612
|
+
this.Canvas.beginPath();
|
|
18613
|
+
this.Canvas.moveTo(xFixed,yText);
|
|
18614
|
+
this.Canvas.lineTo(xFixed,yText+lineLength);
|
|
18615
|
+
this.Canvas.stroke();
|
|
18616
|
+
|
|
18617
|
+
yText+=lineLength+2;
|
|
18618
|
+
}
|
|
18599
18619
|
}
|
|
18600
18620
|
}
|
|
18601
|
-
}
|
|
18602
18621
|
|
|
18603
|
-
|
|
18604
|
-
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
|
|
18622
|
+
//item.TextBGColor="rgb(0,255,0)";
|
|
18623
|
+
if (item.TextBGColor) //文字背景色
|
|
18624
|
+
{
|
|
18625
|
+
var rtText={ Left:textLeft, Top:yText+this.XBottomOffset, Width:testWidth, Height:textHeight };
|
|
18626
|
+
this.Canvas.fillStyle=item.TextBGColor;
|
|
18627
|
+
this.Canvas.fillRect(rtText.Left-1, rtText.Top, rtText.Width+2, rtText.Height);
|
|
18628
|
+
}
|
|
18610
18629
|
|
|
18611
|
-
|
|
18612
|
-
|
|
18613
|
-
|
|
18630
|
+
this.Canvas.fillStyle=item.TextColor;
|
|
18631
|
+
this.Canvas.fillText(this.VerticalInfo[i].Message[0],x,yText+this.XBottomOffset);
|
|
18632
|
+
textRightPrev=textLeft+testWidth;
|
|
18633
|
+
}
|
|
18614
18634
|
}
|
|
18615
18635
|
}
|
|
18616
18636
|
|
|
@@ -18618,6 +18638,113 @@ function AverageWidthFrame()
|
|
|
18618
18638
|
}
|
|
18619
18639
|
}
|
|
18620
18640
|
|
|
18641
|
+
//{Font:, AryText:[ { AryText:[{ Text:, Color: }], }, ] }
|
|
18642
|
+
this.GetMultiLineVTextSize=function(obj)
|
|
18643
|
+
{
|
|
18644
|
+
if (obj.Font) this.Canvas.font=obj.Font;
|
|
18645
|
+
|
|
18646
|
+
var lineHeight=this.Canvas.measureText('擎').width;
|
|
18647
|
+
var aryLine=[];
|
|
18648
|
+
for(var i=0;i<obj.AryText.length;++i)
|
|
18649
|
+
{
|
|
18650
|
+
var item=obj.AryText[i];
|
|
18651
|
+
var lineInfo={ Width:0, Height:lineHeight, AryText:[], Align:2, Margin:{ Top:1, Bottom:1 } , YOffset:-1 };
|
|
18652
|
+
if (item.Margin)
|
|
18653
|
+
{
|
|
18654
|
+
if (IFrameSplitOperator.IsNumber(item.Margin.Top)) lineInfo.Margin.Top=item.Margin.Top;
|
|
18655
|
+
if (IFrameSplitOperator.IsNumber(item.Margin.Bottom)) lineInfo.Margin.Bottom=item.Margin.Bottom;
|
|
18656
|
+
}
|
|
18657
|
+
if (IFrameSplitOperator.IsNumber(item.YOffset)) lineInfo.YOffset=item.YOffset;
|
|
18658
|
+
if (IFrameSplitOperator.IsNumber(item.Align)) lineInfo.Align=item.Align;
|
|
18659
|
+
|
|
18660
|
+
lineInfo.Height=lineHeight+lineInfo.Margin.Top+lineInfo.Margin.Bottom;
|
|
18661
|
+
|
|
18662
|
+
for(var j=0; j<item.AryText.length; ++j)
|
|
18663
|
+
{
|
|
18664
|
+
var subItem=item.AryText[j];
|
|
18665
|
+
if (!subItem || !subItem.Text) continue;
|
|
18666
|
+
var width=this.Canvas.measureText(subItem.Text).width;
|
|
18667
|
+
var textItem={ Width: width, Text:subItem.Text, Color:obj.TextColor , Margin:{Left:0, Right:0 }};
|
|
18668
|
+
if (subItem.Color) textItem.Color=subItem.Color;
|
|
18669
|
+
if (subItem.Margin)
|
|
18670
|
+
{
|
|
18671
|
+
if (IFrameSplitOperator.IsNumber(subItem.Margin.Left)) textItem.Margin.Left=subItem.Margin.Left;
|
|
18672
|
+
if (IFrameSplitOperator.IsNumber(subItem.Margin.Right)) textItem.Margin.Right=subItem.Margin.Right;
|
|
18673
|
+
}
|
|
18674
|
+
textItem.Width=width+textItem.Margin.Right+textItem.Margin.Left;
|
|
18675
|
+
|
|
18676
|
+
lineInfo.Width+=textItem.Width;
|
|
18677
|
+
|
|
18678
|
+
lineInfo.AryText.push(textItem);
|
|
18679
|
+
}
|
|
18680
|
+
|
|
18681
|
+
aryLine.push(lineInfo);
|
|
18682
|
+
}
|
|
18683
|
+
|
|
18684
|
+
if (aryLine.length<=0) return null;
|
|
18685
|
+
|
|
18686
|
+
var width=0, height=0;
|
|
18687
|
+
for(var i=0;i<aryLine.length;++i)
|
|
18688
|
+
{
|
|
18689
|
+
var item=aryLine[i];
|
|
18690
|
+
if (width<item.Width) width=item.Width;
|
|
18691
|
+
height+=item.Height;
|
|
18692
|
+
}
|
|
18693
|
+
|
|
18694
|
+
if (width<=0 || height<=0) return null;
|
|
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;
|
|
18700
|
+
}
|
|
18701
|
+
|
|
18702
|
+
//X轴底部文字多行输出
|
|
18703
|
+
this.DrawMultiLineVText=function(drawInfo)
|
|
18704
|
+
{
|
|
18705
|
+
var xLeft=drawInfo.XCenter-drawInfo.Width/2;
|
|
18706
|
+
if (drawInfo.Align==1) xLeft=drawInfo.XCenter;
|
|
18707
|
+
if (drawInfo.TextRightPrev!=null && drawInfo.TextRightPrev>xLeft)
|
|
18708
|
+
return false;
|
|
18709
|
+
|
|
18710
|
+
this.Canvas.font=drawInfo.Font;
|
|
18711
|
+
this.Canvas.textAlign="left";
|
|
18712
|
+
this.Canvas.textBaseline="bottom";
|
|
18713
|
+
var yText=drawInfo.RectBottom.Top;
|
|
18714
|
+
var textRight=null;
|
|
18715
|
+
for(var i=0, j=0;i<drawInfo.AryLine.length;++i)
|
|
18716
|
+
{
|
|
18717
|
+
var lineItem=drawInfo.AryLine[i];
|
|
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
|
+
|
|
18731
|
+
if (xLeft<1) xLeft=1;
|
|
18732
|
+
yText+=lineItem.Height;
|
|
18733
|
+
for(j=0;j<lineItem.AryText.length;++j)
|
|
18734
|
+
{
|
|
18735
|
+
var item=lineItem.AryText[j];
|
|
18736
|
+
this.Canvas.fillStyle=item.Color;
|
|
18737
|
+
this.Canvas.fillText(item.Text,xLeft+item.Margin.Left,yText+lineItem.YOffset);
|
|
18738
|
+
xLeft+=item.Width;
|
|
18739
|
+
}
|
|
18740
|
+
|
|
18741
|
+
if (textRight==null || textRight<xLeft) textRight=xLeft;
|
|
18742
|
+
}
|
|
18743
|
+
|
|
18744
|
+
drawInfo.TextRight=textRight;
|
|
18745
|
+
return true;
|
|
18746
|
+
}
|
|
18747
|
+
|
|
18621
18748
|
//Y坐标转y轴数值
|
|
18622
18749
|
this.GetYData=function(y,isLimit)
|
|
18623
18750
|
{
|
|
@@ -23912,7 +24039,7 @@ function OverlayKLineFrame()
|
|
|
23912
24039
|
|
|
23913
24040
|
var text=item.Message[1];
|
|
23914
24041
|
if (Array.isArray(item.Message[1])) text=item.Message[1][0];
|
|
23915
|
-
|
|
24042
|
+
this.Canvas.fillStyle=item.TextColor;
|
|
23916
24043
|
if (rightExtendText && rightExtendText.Align)
|
|
23917
24044
|
{
|
|
23918
24045
|
var textWidth=rightWidth;
|
|
@@ -23924,7 +24051,6 @@ function OverlayKLineFrame()
|
|
|
23924
24051
|
{
|
|
23925
24052
|
var xText=right+2;
|
|
23926
24053
|
if (rightLine && rightLine.Width>0) xText+=rightLine.Width;
|
|
23927
|
-
this.Canvas.fillStyle=item.TextColor;
|
|
23928
24054
|
this.Canvas.textAlign="left";
|
|
23929
24055
|
this.Canvas.fillText(text,xText,y);
|
|
23930
24056
|
}
|
|
@@ -68288,9 +68414,14 @@ function IChartDrawPicture()
|
|
|
68288
68414
|
pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset);
|
|
68289
68415
|
pt.Y=this.Frame.GetYFromData(item.YValue);
|
|
68290
68416
|
}
|
|
68417
|
+
|
|
68418
|
+
if (Path2DHelper.PtInPoint(x,y,pt,radius))
|
|
68419
|
+
return i;
|
|
68420
|
+
/*
|
|
68291
68421
|
this.Canvas.beginPath();
|
|
68292
68422
|
this.Canvas.arc(pt.X,pt.Y,radius,0,360);
|
|
68293
68423
|
if (this.Canvas.isPointInPath(x,y)) return i;
|
|
68424
|
+
*/
|
|
68294
68425
|
}
|
|
68295
68426
|
|
|
68296
68427
|
return -1;
|
|
@@ -68308,6 +68439,20 @@ function IChartDrawPicture()
|
|
|
68308
68439
|
var pixel=GetDevicePixelRatio();
|
|
68309
68440
|
lineWidth*=pixel;
|
|
68310
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)
|
|
68311
68456
|
{
|
|
68312
68457
|
var item=this.LinePoint[i];
|
|
68313
68458
|
var ptStart=item.Start;
|
|
@@ -68336,6 +68481,7 @@ function IChartDrawPicture()
|
|
|
68336
68481
|
}
|
|
68337
68482
|
|
|
68338
68483
|
return -1;
|
|
68484
|
+
*/
|
|
68339
68485
|
}
|
|
68340
68486
|
|
|
68341
68487
|
//0-10 鼠标对应的点索引 100=鼠标在正个图形上 -1 鼠标不在图形上
|
|
@@ -71029,6 +71175,18 @@ function ChartDrawPictureRect()
|
|
|
71029
71175
|
//点是否在线段上 水平线段
|
|
71030
71176
|
this.IsPointInLine=function(aryPoint,x,y,option)
|
|
71031
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
|
+
/*
|
|
71032
71190
|
var radius=5;
|
|
71033
71191
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
71034
71192
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -71043,11 +71201,14 @@ function ChartDrawPictureRect()
|
|
|
71043
71201
|
this.Canvas.closePath();
|
|
71044
71202
|
if (this.Canvas.isPointInPath(x,y))
|
|
71045
71203
|
return true;
|
|
71204
|
+
*/
|
|
71046
71205
|
}
|
|
71047
71206
|
|
|
71048
71207
|
//垂直线段
|
|
71049
71208
|
this.IsPointInLine2=function(aryPoint,x,y,option)
|
|
71050
71209
|
{
|
|
71210
|
+
return this.IsPointInLine(aryPoint,x,y,option);
|
|
71211
|
+
/*
|
|
71051
71212
|
var radius=5;
|
|
71052
71213
|
if (option && IFrameSplitOperator.IsNumber(option.Zoom)) radius+=option.Zoom;
|
|
71053
71214
|
else if (this.Option && IFrameSplitOperator.IsNumber(this.Option.Zoom)) radius+=this.Option.Zoom;
|
|
@@ -71062,6 +71223,7 @@ function ChartDrawPictureRect()
|
|
|
71062
71223
|
this.Canvas.closePath();
|
|
71063
71224
|
if (this.Canvas.isPointInPath(x,y))
|
|
71064
71225
|
return true;
|
|
71226
|
+
*/
|
|
71065
71227
|
}
|
|
71066
71228
|
}
|
|
71067
71229
|
|
|
@@ -107100,6 +107262,117 @@ function GetLocalTime(i) //得到标准时区的时间的函数
|
|
|
107100
107262
|
return new Date(utcTime + 3600000 * i);
|
|
107101
107263
|
}
|
|
107102
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
|
+
|
|
107103
107376
|
|
|
107104
107377
|
|
|
107105
107378
|
|
|
@@ -132342,7 +132615,7 @@ function APIScriptIndex(name,script,args,option, isOverlay)
|
|
|
132342
132615
|
var config=draw.Config;
|
|
132343
132616
|
if (IFrameSplitOperator.IsString(config.LineWidth)) outVarItem.LineWidth=config.LineWidth;
|
|
132344
132617
|
if (IFrameSplitOperator.IsNumber(config.LineType)) drawItem.DrawData.LineType=config.LineType;
|
|
132345
|
-
if (config.Color) outVarItem.Color=config.
|
|
132618
|
+
if (config.Color) outVarItem.Color=config.Color;
|
|
132346
132619
|
}
|
|
132347
132620
|
|
|
132348
132621
|
result.push(outVarItem);
|
|
@@ -150322,7 +150595,7 @@ function ScrollBarBGChart()
|
|
|
150322
150595
|
|
|
150323
150596
|
|
|
150324
150597
|
|
|
150325
|
-
var HQCHART_VERSION="1.1.
|
|
150598
|
+
var HQCHART_VERSION="1.1.14869";
|
|
150326
150599
|
|
|
150327
150600
|
function PrintHQChartVersion()
|
|
150328
150601
|
{
|