hqchart 1.1.12516 → 1.1.12525
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 +36 -10
- package/package.json +1 -1
- package/src/jscommon/umychart.js +484 -4
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +485 -5
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +485 -5
- package/src/jscommon/umychart.wechat/umychart.chartpaint.wechat.js +13 -1
- package/src/jscommon/umychart.wechat/umychart.index.wechat.js +6 -0
package/src/jscommon/umychart.js
CHANGED
|
@@ -29015,6 +29015,7 @@ function ChartStick()
|
|
|
29015
29015
|
this.Draw=function()
|
|
29016
29016
|
{
|
|
29017
29017
|
if (!this.IsShow || this.ChartFrame.IsMinSize) return;
|
|
29018
|
+
if (this.IsHideScriptIndex()) return;
|
|
29018
29019
|
|
|
29019
29020
|
if (this.NotSupportMessage)
|
|
29020
29021
|
{
|
|
@@ -29040,6 +29041,8 @@ function ChartLineStick()
|
|
|
29040
29041
|
this.Draw=function()
|
|
29041
29042
|
{
|
|
29042
29043
|
if (!this.IsShow || this.ChartFrame.IsMinSize) return;
|
|
29044
|
+
if (this.IsShowIndexTitleOnly()) return;
|
|
29045
|
+
if (this.IsHideScriptIndex()) return;
|
|
29043
29046
|
|
|
29044
29047
|
if (this.NotSupportMessage)
|
|
29045
29048
|
{
|
|
@@ -39568,7 +39571,7 @@ function DrawToolsButton()
|
|
|
39568
39571
|
{ HTML: { Title: 'M头W底', IClass: 'iconfont icon-draw_wavemw', ID: 'icon-wavemw' }, Name: 'M头W底' },
|
|
39569
39572
|
{ HTML: { Title: '头肩型', IClass: 'iconfont icon-draw_head_shoulders_bt', ID: 'icon-Head-Shoulders' }, Name: '头肩型' },
|
|
39570
39573
|
{ HTML: { Title: '波浪尺', IClass: 'iconfont icon-waveruler', ID: 'icon-wave-ruler' }, Name: '波浪尺' },
|
|
39571
|
-
{ HTML: { Title: 'AB波浪尺', IClass: 'iconfont icon-waveruler', ID: 'icon-wave-
|
|
39574
|
+
{ HTML: { Title: 'AB波浪尺', IClass: 'iconfont icon-waveruler', ID: 'icon-wave-ruler2' }, Name: 'AB波浪尺' },
|
|
39572
39575
|
{ HTML: { Title: '箱型线', IClass: 'iconfont icon-draw_box', ID: 'icon-drawbox' }, Name: '箱型线' },
|
|
39573
39576
|
{ HTML: { Title: '涂鸦线段', IClass: 'iconfont icon-draw_line', ID: 'icon-segment2' }, Name: '涂鸦线段' },
|
|
39574
39577
|
|
|
@@ -48551,7 +48554,8 @@ function DynamicMinuteTitlePainting()
|
|
|
48551
48554
|
|
|
48552
48555
|
if (beforeItem && dataItem) //盘前数据
|
|
48553
48556
|
{
|
|
48554
|
-
if (beforeItem.Date>dataItem.Date || (beforeItem.Date==dataItem.Date && beforeItem.Time>dataItem.Time &&
|
|
48557
|
+
if (beforeItem.Date>dataItem.Date || (beforeItem.Date==dataItem.Date && beforeItem.Time>dataItem.Time && beforeDataVer==1.0)
|
|
48558
|
+
|| (beforeItem.Date==dataItem.Date && parseInt(beforeItem.Time>dataItem.Time) && beforeDataVer==2.0))
|
|
48555
48559
|
return { Type:2, Data:beforeItem, Ver: beforeDataVer, Explain:beforeExplain};
|
|
48556
48560
|
}
|
|
48557
48561
|
|
|
@@ -50641,6 +50645,7 @@ function IChartDrawPicture()
|
|
|
50641
50645
|
this.EnableCtrlMove=false; //是否按住Ctrl才能移动
|
|
50642
50646
|
this.OnlyMoveXIndex=false; //只能在X轴刻度上移动
|
|
50643
50647
|
this.IsSupportMagnet=false; //是否支持磁吸
|
|
50648
|
+
this.EnableMoveCheck=true; //允许移动时监测是否超出边界
|
|
50644
50649
|
|
|
50645
50650
|
this.IsDrawFirst=false;
|
|
50646
50651
|
this.IsShowYCoordinate=false; //是否在Y轴显示点的刻度
|
|
@@ -50989,6 +50994,8 @@ function IChartDrawPicture()
|
|
|
50989
50994
|
var index=parseInt(this.MovePointIndex);
|
|
50990
50995
|
if (index===100) //整体移动
|
|
50991
50996
|
{
|
|
50997
|
+
if (this.IsMoveOutOfBounds(this.Point, xStep, yStep)) return false;
|
|
50998
|
+
|
|
50992
50999
|
for(var i in this.Point)
|
|
50993
51000
|
{
|
|
50994
51001
|
this.Point[i].X+=xStep;
|
|
@@ -51009,6 +51016,56 @@ function IChartDrawPicture()
|
|
|
51009
51016
|
}
|
|
51010
51017
|
}
|
|
51011
51018
|
|
|
51019
|
+
//是否超出边界了
|
|
51020
|
+
this.IsMoveOutOfBounds=function(aryPoint,xStep,yStep)
|
|
51021
|
+
{
|
|
51022
|
+
if (!this.EnableMoveCheck) return false;
|
|
51023
|
+
|
|
51024
|
+
if (!this.Frame) return false;
|
|
51025
|
+
|
|
51026
|
+
if (this.Frame.ClassName=="MinuteFrame" || this.Frame.Class=="MinuteHScreenFrame")
|
|
51027
|
+
return false;
|
|
51028
|
+
|
|
51029
|
+
|
|
51030
|
+
var data=this.Frame.Data;
|
|
51031
|
+
if (!data) return false;
|
|
51032
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(data.Data)) return false;
|
|
51033
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryPoint)) return false;
|
|
51034
|
+
var isHScreen=this.Frame.IsHScreen;
|
|
51035
|
+
if (isHScreen)
|
|
51036
|
+
{
|
|
51037
|
+
//TODO:横屏以后再做
|
|
51038
|
+
return false;
|
|
51039
|
+
}
|
|
51040
|
+
else
|
|
51041
|
+
{
|
|
51042
|
+
var offset=data.DataOffset;
|
|
51043
|
+
var startIndex=0-offset;
|
|
51044
|
+
var endIndex=data.Data.length-offset;
|
|
51045
|
+
|
|
51046
|
+
if (xStep>0)
|
|
51047
|
+
{
|
|
51048
|
+
var xEnd=this.Frame.GetXFromIndex(endIndex-1,false);
|
|
51049
|
+
for(var i=0;i<aryPoint.length;++i)
|
|
51050
|
+
{
|
|
51051
|
+
var item=aryPoint[i];
|
|
51052
|
+
if (item.X+xStep>xEnd) return true;
|
|
51053
|
+
}
|
|
51054
|
+
}
|
|
51055
|
+
else if (xStep<0)
|
|
51056
|
+
{
|
|
51057
|
+
var xStart=this.Frame.GetXFromIndex(startIndex,false);
|
|
51058
|
+
for(var i=0;i<aryPoint.length;++i)
|
|
51059
|
+
{
|
|
51060
|
+
var item=aryPoint[i];
|
|
51061
|
+
if (item.X+xStep<xStart) return true;
|
|
51062
|
+
}
|
|
51063
|
+
}
|
|
51064
|
+
|
|
51065
|
+
return false;
|
|
51066
|
+
}
|
|
51067
|
+
}
|
|
51068
|
+
|
|
51012
51069
|
this.ClipFrame=function()
|
|
51013
51070
|
{
|
|
51014
51071
|
if (this.Frame.IsHScreen)
|
|
@@ -51965,7 +52022,9 @@ IChartDrawPicture.ArrayDrawPricture=
|
|
|
51965
52022
|
{ Name:"AnchoredText", ClassName:"ChartDrawAnchoredText", Create:function() { return new ChartDrawAnchoredText();} },
|
|
51966
52023
|
{ Name:"PriceLabel", ClassName:"ChartDrawPriceLabel", Create:function() { return new ChartDrawPriceLabel();} },
|
|
51967
52024
|
{ Name:"PriceNote", ClassName:"ChartDrawPriceNote", Create:function() { return new ChartDrawPriceNote();} },
|
|
51968
|
-
{ Name:"FibWedge", ClassName:"ChartDrawFibWedge", Create:function(){ return new ChartDrawFibWedge(); }}
|
|
52025
|
+
{ Name:"FibWedge", ClassName:"ChartDrawFibWedge", Create:function(){ return new ChartDrawFibWedge(); }},
|
|
52026
|
+
{ Name:"FibRetracement", ClassName:"ChartFibRetracement", Create:function() { return new ChartFibRetracement(); }}, //斐波那契回测
|
|
52027
|
+
{ Name:"FibSpeedResistanceFan", ClassName:"ChartFibSpeedResistanceFan", Create:function() { return new ChartFibSpeedResistanceFan(); }} //斐波那契扇形
|
|
51969
52028
|
];
|
|
51970
52029
|
|
|
51971
52030
|
IChartDrawPicture.MapIonFont=new Map(
|
|
@@ -52139,6 +52198,7 @@ function ChartDrawGraffitiLine()
|
|
|
52139
52198
|
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
52140
52199
|
this.GetXYCoordinate=null;
|
|
52141
52200
|
this.PointCount=2; //画点的个数
|
|
52201
|
+
this.EnableMoveCheck=false; //允许移动时不监测是否超出边界
|
|
52142
52202
|
|
|
52143
52203
|
this.PointToValue=function()
|
|
52144
52204
|
{
|
|
@@ -53163,6 +53223,8 @@ function ChartDrawPictureRect()
|
|
|
53163
53223
|
|
|
53164
53224
|
this.ClassName='ChartDrawPictureRect';
|
|
53165
53225
|
this.GetXYCoordinate=this.GetXYCoordinate_default;
|
|
53226
|
+
this.OnlyMoveXIndex=true;
|
|
53227
|
+
this.IsSupportMagnet=true;
|
|
53166
53228
|
|
|
53167
53229
|
this.Draw=function()
|
|
53168
53230
|
{
|
|
@@ -54236,7 +54298,7 @@ function ChartDrawPictureParallelChannel()
|
|
|
54236
54298
|
var ptCenter=new Point();
|
|
54237
54299
|
ptCenter.X=linePoint.Start.X+(linePoint.End.X-linePoint.Start.X)/2;
|
|
54238
54300
|
ptCenter.Y=linePoint.Start.Y+(linePoint.End.Y-linePoint.Start.Y)/2;
|
|
54239
|
-
drawPoint[
|
|
54301
|
+
drawPoint[2]=ptCenter;
|
|
54240
54302
|
|
|
54241
54303
|
this.Point[2]=ptCenter;
|
|
54242
54304
|
var xValue=parseInt(this.Frame.GetXData(ptCenter.X))+data.DataOffset;
|
|
@@ -54669,6 +54731,7 @@ function ChartDrawPictureGannFan()
|
|
|
54669
54731
|
else return 3;
|
|
54670
54732
|
}
|
|
54671
54733
|
|
|
54734
|
+
|
|
54672
54735
|
//isDotline 是否是虚线
|
|
54673
54736
|
this.DrawLine=function(ptStart,ptEnd,isDottedline)
|
|
54674
54737
|
{
|
|
@@ -59448,6 +59511,423 @@ function ChartDrawFibWedge()
|
|
|
59448
59511
|
|
|
59449
59512
|
}
|
|
59450
59513
|
|
|
59514
|
+
//////////////////////////////////////////////////////////////////////////////
|
|
59515
|
+
// 斐波那契回测
|
|
59516
|
+
//
|
|
59517
|
+
function ChartFibRetracement()
|
|
59518
|
+
{
|
|
59519
|
+
this.newMethod=IChartDrawPicture; //派生
|
|
59520
|
+
this.newMethod();
|
|
59521
|
+
delete this.newMethod;
|
|
59522
|
+
|
|
59523
|
+
this.ClassName='ChartFibRetracement';
|
|
59524
|
+
this.PointCount=2;
|
|
59525
|
+
this.Font=12*GetDevicePixelRatio() +"px 微软雅黑";
|
|
59526
|
+
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
59527
|
+
this.GetXYCoordinate=this.GetXYCoordinate_default;
|
|
59528
|
+
this.PointToValue_Default=this.PointToValue;
|
|
59529
|
+
this.OnlyMoveXIndex=true;
|
|
59530
|
+
this.IsSupportMagnet=true;
|
|
59531
|
+
this.LineDash=[6,3];
|
|
59532
|
+
this.LineWidth=1;
|
|
59533
|
+
this.EnableBGColor=true;
|
|
59534
|
+
this.ExtendLine={ Left:false, Right: false }; //延长线
|
|
59535
|
+
|
|
59536
|
+
this.AreaConfig=
|
|
59537
|
+
{
|
|
59538
|
+
AryData:
|
|
59539
|
+
[
|
|
59540
|
+
{ Value: 0, Color:"rgb(128,128,128)", Enable:true },
|
|
59541
|
+
{ Value: 0.236, Color:"rgb(242,52,69)", Enable:true },
|
|
59542
|
+
{ Value: 0.382, Color:"rgb(255,152,0)",Enable:true },
|
|
59543
|
+
{ Value: 0.5, Color:"rgb(76,175,80)", Enable:true },
|
|
59544
|
+
{ Value: 0.618, Color:"rgb(8,153,129)", Enable:true },
|
|
59545
|
+
{ Value: 0.786, Color:"rgb(0,188,212)" ,Enable:true },
|
|
59546
|
+
{ Value: 1, Color:"rgb(120,123,134)", Enable:true },
|
|
59547
|
+
{ Value: 1.618, Color:"rgb(41,98,255)",Enable:true },
|
|
59548
|
+
{ Value: 2.618, Color:"rgb(242,54,69)",Enable:false },
|
|
59549
|
+
],
|
|
59550
|
+
|
|
59551
|
+
Opacity:0.3
|
|
59552
|
+
}
|
|
59553
|
+
|
|
59554
|
+
this.SetOption=function(option)
|
|
59555
|
+
{
|
|
59556
|
+
if (!option) return;
|
|
59557
|
+
|
|
59558
|
+
if (option.Font) this.Font=option.Font;
|
|
59559
|
+
if (option.LineWidth) this.LineWidth=option.LineWidth;
|
|
59560
|
+
if (option.LineDash) this.LineDash=option.LineDash;
|
|
59561
|
+
if (IFrameSplitOperator.IsBool(option.EnableBGColor)) this.EnableBGColor=option.EnableBGColor;
|
|
59562
|
+
if (option.ExtendLine)
|
|
59563
|
+
{
|
|
59564
|
+
var item=option.ExtendLine;
|
|
59565
|
+
if (IFrameSplitOperator.IsBool(item.Left)) this.ExtendLine.Left=item.Left;
|
|
59566
|
+
if (IFrameSplitOperator.IsBool(item.Right)) this.ExtendLine.Left=item.Right;
|
|
59567
|
+
}
|
|
59568
|
+
|
|
59569
|
+
if (option.AreaConfig) this.AreaConfig=option.AreaConfig;
|
|
59570
|
+
}
|
|
59571
|
+
|
|
59572
|
+
//导出成存储格式
|
|
59573
|
+
this.ExportStorageData=function()
|
|
59574
|
+
{
|
|
59575
|
+
var storageData=this.ExportBaseData();
|
|
59576
|
+
|
|
59577
|
+
storageData.Value=[];
|
|
59578
|
+
for(var i=0;i<this.Value.length && i<this.PointCount;++i)
|
|
59579
|
+
{
|
|
59580
|
+
var item=this.Value[i];
|
|
59581
|
+
storageData.Value.push( { XValue:item.XValue, YValue:item.YValue } );
|
|
59582
|
+
}
|
|
59583
|
+
|
|
59584
|
+
storageData.Font=this.Font;
|
|
59585
|
+
storageData.EnableBGColor=this.EnableBGColor;
|
|
59586
|
+
storageData.LineDash=this.LineDash;
|
|
59587
|
+
storageData.ExtendLine={ Left:this.ExtendLine.Left, Right:this.ExtendLine.Right };
|
|
59588
|
+
storageData.AreaConfig=CloneData(this.AreaConfig);
|
|
59589
|
+
|
|
59590
|
+
return storageData;
|
|
59591
|
+
}
|
|
59592
|
+
|
|
59593
|
+
this.ImportStorageData=function(storageData)
|
|
59594
|
+
{
|
|
59595
|
+
if (storageData.Font) this.Font=storageData.Font;
|
|
59596
|
+
if (storageData.LineDash) this.LineDash=storageData.LineDash;
|
|
59597
|
+
if (IFrameSplitOperator.IsBool(storageData.EnableBGColor)) this.EnableBGColor=storageData.EnableBGColor;
|
|
59598
|
+
if (storageData.ExtendLine) this.ExtendLine=storageData.ExtendLine;
|
|
59599
|
+
if (storageData.AreaConfig) this.AreaConfig=storageData.AreaConfig;
|
|
59600
|
+
}
|
|
59601
|
+
|
|
59602
|
+
this.Draw=function()
|
|
59603
|
+
{
|
|
59604
|
+
this.LinePoint=[];
|
|
59605
|
+
if (this.IsFrameMinSize()) return;
|
|
59606
|
+
var bCheckXY=true;
|
|
59607
|
+
if (this.ExtendLine.Left || this.ExtendLine.Right) bCheckXY=false;
|
|
59608
|
+
var drawPoint=this.CalculateDrawPoint( {IsCheckX:bCheckXY, IsCheckY:bCheckXY} );
|
|
59609
|
+
if (!drawPoint) return;
|
|
59610
|
+
if (drawPoint.length!=2) return;
|
|
59611
|
+
|
|
59612
|
+
this.ClipFrame();
|
|
59613
|
+
|
|
59614
|
+
var ptStart=drawPoint[0];
|
|
59615
|
+
var ptEnd=drawPoint[1];
|
|
59616
|
+
|
|
59617
|
+
this.SetLineWidth();
|
|
59618
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
59619
|
+
this.Canvas.setLineDash(this.LineDash);
|
|
59620
|
+
this.Canvas.beginPath();
|
|
59621
|
+
this.Canvas.moveTo(ptStart.X,ptStart.Y);
|
|
59622
|
+
this.Canvas.lineTo(ptEnd.X,ptEnd.Y);
|
|
59623
|
+
this.Canvas.stroke();
|
|
59624
|
+
this.Canvas.setLineDash([]);
|
|
59625
|
+
|
|
59626
|
+
this.DrawBlock(ptStart, ptEnd);
|
|
59627
|
+
|
|
59628
|
+
this.RestoreLineWidth();
|
|
59629
|
+
|
|
59630
|
+
var line={Start:ptStart, End:ptEnd};
|
|
59631
|
+
this.LinePoint.push(line);
|
|
59632
|
+
|
|
59633
|
+
this.DrawPoint(drawPoint); //画点
|
|
59634
|
+
this.Canvas.restore();
|
|
59635
|
+
}
|
|
59636
|
+
|
|
59637
|
+
this.GetArrayAreaConfig=function()
|
|
59638
|
+
{
|
|
59639
|
+
var aryArea=[];
|
|
59640
|
+
for(var i=0;i<this.AreaConfig.AryData.length;++i)
|
|
59641
|
+
{
|
|
59642
|
+
var item=this.AreaConfig.AryData[i];
|
|
59643
|
+
if (item.Enable) aryArea.push(item);
|
|
59644
|
+
}
|
|
59645
|
+
|
|
59646
|
+
aryArea.sort((left,right)=>{ return right.Value-left.Value; })
|
|
59647
|
+
|
|
59648
|
+
return aryArea;
|
|
59649
|
+
}
|
|
59650
|
+
|
|
59651
|
+
this.DrawBlock=function(ptStart, ptEnd)
|
|
59652
|
+
{
|
|
59653
|
+
var yTop=Math.min(ptStart.Y, ptEnd.Y);
|
|
59654
|
+
var yBottom=Math.max(ptStart.Y, ptEnd.Y);
|
|
59655
|
+
var xLeft=Math.min(ptStart.X, ptEnd.X);
|
|
59656
|
+
var xRight=Math.max(ptStart.X, ptEnd.X);
|
|
59657
|
+
var height=yBottom-yTop;
|
|
59658
|
+
//var baseValue=Math.min(this.Value[0].YValue, this.Value[1].YValue);
|
|
59659
|
+
//var diffValue=Math.abs(this.Value[0].YValue-this.Value[1].YValue); //差值
|
|
59660
|
+
|
|
59661
|
+
if (this.ExtendLine.Right) xRight=this.Frame.ChartBorder.GetRight();
|
|
59662
|
+
if (this.ExtendLine.Left) xLeft=this.Frame.ChartBorder.GetLeft();
|
|
59663
|
+
|
|
59664
|
+
var aryArea=this.GetArrayAreaConfig();
|
|
59665
|
+
var yPre=null; //上一个点
|
|
59666
|
+
var clrArea=null;
|
|
59667
|
+
this.Canvas.font=this.Font;
|
|
59668
|
+
if (this.ExtendLine.Left) this.Canvas.textAlign="left";
|
|
59669
|
+
else this.Canvas.textAlign="right";
|
|
59670
|
+
this.Canvas.textBaseline="bottom";
|
|
59671
|
+
|
|
59672
|
+
for(var i=0;i<aryArea.length;++i)
|
|
59673
|
+
{
|
|
59674
|
+
var item=aryArea[i];
|
|
59675
|
+
var y=yBottom-height*item.Value;
|
|
59676
|
+
//var yValue=baseValue+diffValue*item.Value;
|
|
59677
|
+
yValue=this.Frame.GetYData(y,false);
|
|
59678
|
+
y=ToFixedPoint(y);
|
|
59679
|
+
if (this.EnableBGColor && IFrameSplitOperator.IsNumber(yPre))
|
|
59680
|
+
{
|
|
59681
|
+
var rtBG={ Left:xLeft, Right:xRight, Top:yPre, Bottom:y };
|
|
59682
|
+
rtBG.Width=rtBG.Right-rtBG.Left;
|
|
59683
|
+
rtBG.Height=rtBG.Bottom-rtBG.Top;
|
|
59684
|
+
this.Canvas.fillStyle=clrArea;
|
|
59685
|
+
this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
|
|
59686
|
+
}
|
|
59687
|
+
|
|
59688
|
+
this.Canvas.strokeStyle=item.Color;
|
|
59689
|
+
this.Canvas.beginPath();
|
|
59690
|
+
this.Canvas.moveTo(xLeft,y);
|
|
59691
|
+
this.Canvas.lineTo(xRight,y);
|
|
59692
|
+
this.Canvas.stroke();
|
|
59693
|
+
|
|
59694
|
+
var line={ Start:{X:xLeft, Y:y}, End:{X:xRight, Y:y} };
|
|
59695
|
+
this.LinePoint.push(line);
|
|
59696
|
+
|
|
59697
|
+
//文字
|
|
59698
|
+
var text=`${item.Value} (${yValue.toFixed(2)})`;
|
|
59699
|
+
this.Canvas.fillStyle=item.Color;
|
|
59700
|
+
if (this.ExtendLine.Left)
|
|
59701
|
+
this.Canvas.fillText(text,xLeft+2,y-2);
|
|
59702
|
+
else
|
|
59703
|
+
this.Canvas.fillText(text,xLeft-2,y-2);
|
|
59704
|
+
|
|
59705
|
+
yPre=y;
|
|
59706
|
+
clrArea=IChartDrawPicture.ColorToRGBA(item.Color, this.AreaConfig.Opacity);
|
|
59707
|
+
}
|
|
59708
|
+
}
|
|
59709
|
+
|
|
59710
|
+
}
|
|
59711
|
+
|
|
59712
|
+
|
|
59713
|
+
function ChartFibSpeedResistanceFan()
|
|
59714
|
+
{
|
|
59715
|
+
this.newMethod=IChartDrawPicture; //派生
|
|
59716
|
+
this.newMethod();
|
|
59717
|
+
delete this.newMethod;
|
|
59718
|
+
|
|
59719
|
+
this.ClassName='ChartFibSpeedResistanceFan';
|
|
59720
|
+
this.PointCount=2;
|
|
59721
|
+
this.Font=12*GetDevicePixelRatio() +"px 微软雅黑";
|
|
59722
|
+
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
59723
|
+
this.GetXYCoordinate=this.GetXYCoordinate_default;
|
|
59724
|
+
this.PointToValue_Default=this.PointToValue;
|
|
59725
|
+
this.OnlyMoveXIndex=true;
|
|
59726
|
+
this.IsSupportMagnet=true;
|
|
59727
|
+
this.LineWidth=1;
|
|
59728
|
+
this.EnableBGColor=true;
|
|
59729
|
+
|
|
59730
|
+
this.AreaConfig=
|
|
59731
|
+
{
|
|
59732
|
+
AryYData:
|
|
59733
|
+
[
|
|
59734
|
+
{ Value: 0, Color:"rgb(128,128,128)", Enable:true },
|
|
59735
|
+
{ Value: 0.25, Color:"rgb(242,52,69)", Enable:true },
|
|
59736
|
+
{ Value: 0.382, Color:"rgb(255,152,0)",Enable:true },
|
|
59737
|
+
{ Value: 0.5, Color:"rgb(76,175,80)", Enable:true },
|
|
59738
|
+
{ Value: 0.618, Color:"rgb(8,153,129)", Enable:true },
|
|
59739
|
+
{ Value: 0.75, Color:"rgb(0,188,212)" ,Enable:true },
|
|
59740
|
+
{ Value: 1, Color:"rgb(120,123,134)", Enable:true },
|
|
59741
|
+
|
|
59742
|
+
],
|
|
59743
|
+
|
|
59744
|
+
AryXData:
|
|
59745
|
+
[
|
|
59746
|
+
{ Value: 0, Color:"rgb(128,128,128)", Enable:true },
|
|
59747
|
+
{ Value: 0.25, Color:"rgb(242,52,69)", Enable:true },
|
|
59748
|
+
{ Value: 0.382, Color:"rgb(255,152,0)",Enable:true },
|
|
59749
|
+
{ Value: 0.5, Color:"rgb(76,175,80)", Enable:true },
|
|
59750
|
+
{ Value: 0.618, Color:"rgb(8,153,129)", Enable:true },
|
|
59751
|
+
{ Value: 0.75, Color:"rgb(0,188,212)" ,Enable:true },
|
|
59752
|
+
{ Value: 1, Color:"rgb(120,123,134)", Enable:true },
|
|
59753
|
+
],
|
|
59754
|
+
|
|
59755
|
+
Opacity:0.3
|
|
59756
|
+
}
|
|
59757
|
+
|
|
59758
|
+
this.Draw=function()
|
|
59759
|
+
{
|
|
59760
|
+
this.LinePoint=[];
|
|
59761
|
+
if (this.IsFrameMinSize()) return;
|
|
59762
|
+
var bCheckXY=false;
|
|
59763
|
+
var drawPoint=this.CalculateDrawPoint( {IsCheckX:bCheckXY, IsCheckY:bCheckXY} );
|
|
59764
|
+
if (!drawPoint) return;
|
|
59765
|
+
if (drawPoint.length!=2) return;
|
|
59766
|
+
|
|
59767
|
+
this.ClipFrame();
|
|
59768
|
+
|
|
59769
|
+
var ptStart=drawPoint[0];
|
|
59770
|
+
var ptEnd=drawPoint[1];
|
|
59771
|
+
|
|
59772
|
+
this.SetLineWidth();
|
|
59773
|
+
this.DrawBlock(ptEnd, ptStart);
|
|
59774
|
+
this.RestoreLineWidth();
|
|
59775
|
+
|
|
59776
|
+
this.DrawPoint(drawPoint); //画点
|
|
59777
|
+
this.Canvas.restore();
|
|
59778
|
+
}
|
|
59779
|
+
|
|
59780
|
+
//获取在第几象限
|
|
59781
|
+
this.GetQuadrant=function(ptStart,ptEnd)
|
|
59782
|
+
{
|
|
59783
|
+
if (ptStart.X<ptEnd.X && ptStart.Y>ptEnd.Y) return 1;
|
|
59784
|
+
else if (ptStart.X>ptEnd.X && ptStart.Y>ptEnd.Y) return 2;
|
|
59785
|
+
else if (ptStart.X<ptEnd.X && ptStart.Y< ptEnd.Y) return 4;
|
|
59786
|
+
else return 3;
|
|
59787
|
+
}
|
|
59788
|
+
|
|
59789
|
+
this.DrawBlock=function(ptStart, ptEnd)
|
|
59790
|
+
{
|
|
59791
|
+
var center=ptEnd;
|
|
59792
|
+
var xDiff=ptEnd.X-ptStart.X;
|
|
59793
|
+
var yDiff=ptEnd.Y-ptStart.Y;
|
|
59794
|
+
var quadrant=this.GetQuadrant(center,ptStart); //象限
|
|
59795
|
+
|
|
59796
|
+
var aryYData=this.GetArrayAreaConfig(this.AreaConfig.AryYData);
|
|
59797
|
+
var ptPre=null; //上一个点
|
|
59798
|
+
var clrArea=null;
|
|
59799
|
+
this.Canvas.font=this.Font;
|
|
59800
|
+
var textOffset=4;
|
|
59801
|
+
if (quadrant==1 || quadrant==4)
|
|
59802
|
+
{
|
|
59803
|
+
this.Canvas.textAlign="right";
|
|
59804
|
+
textOffset=-4;
|
|
59805
|
+
}
|
|
59806
|
+
else
|
|
59807
|
+
{
|
|
59808
|
+
this.Canvas.textAlign="left";
|
|
59809
|
+
textOffset=4;
|
|
59810
|
+
}
|
|
59811
|
+
this.Canvas.textBaseline="middle";
|
|
59812
|
+
for(var i=0;i<aryYData.length;++i)
|
|
59813
|
+
{
|
|
59814
|
+
var item=aryYData[i];
|
|
59815
|
+
var y=item.Value*yDiff+ptStart.Y;
|
|
59816
|
+
|
|
59817
|
+
var pt=this.CalculateExtendLineEndPoint([center, {X:ptStart.X, Y:y}]);
|
|
59818
|
+
|
|
59819
|
+
if (ptPre)
|
|
59820
|
+
{
|
|
59821
|
+
this.Canvas.beginPath();
|
|
59822
|
+
this.Canvas.moveTo(center.X,center.Y);
|
|
59823
|
+
this.Canvas.lineTo(ptPre.X,ptPre.Y);
|
|
59824
|
+
this.Canvas.lineTo(pt.X,pt.Y);
|
|
59825
|
+
this.Canvas.closePath();
|
|
59826
|
+
this.Canvas.fillStyle=clrArea;
|
|
59827
|
+
this.Canvas.fill();
|
|
59828
|
+
}
|
|
59829
|
+
|
|
59830
|
+
this.Canvas.strokeStyle=item.Color;
|
|
59831
|
+
this.Canvas.beginPath();
|
|
59832
|
+
this.Canvas.moveTo(center.X,center.Y);
|
|
59833
|
+
this.Canvas.lineTo(pt.X,pt.Y);
|
|
59834
|
+
this.Canvas.stroke();
|
|
59835
|
+
|
|
59836
|
+
this.LinePoint.push({Start:center, End:pt});
|
|
59837
|
+
|
|
59838
|
+
if (item.Value!=1)
|
|
59839
|
+
{
|
|
59840
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
59841
|
+
this.Canvas.beginPath();
|
|
59842
|
+
this.Canvas.moveTo(center.X,y);
|
|
59843
|
+
this.Canvas.lineTo(ptStart.X,y);
|
|
59844
|
+
this.Canvas.stroke();
|
|
59845
|
+
}
|
|
59846
|
+
|
|
59847
|
+
ptPre=pt;
|
|
59848
|
+
clrArea=IChartDrawPicture.ColorToRGBA(item.Color, this.AreaConfig.Opacity);
|
|
59849
|
+
|
|
59850
|
+
//文字
|
|
59851
|
+
var text=`${item.Value}`;
|
|
59852
|
+
this.Canvas.fillStyle=item.Color;
|
|
59853
|
+
this.Canvas.fillText(text,center.X+textOffset,y);
|
|
59854
|
+
}
|
|
59855
|
+
|
|
59856
|
+
var aryXData=this.GetArrayAreaConfig(this.AreaConfig.AryXData);
|
|
59857
|
+
var ptPre=null;
|
|
59858
|
+
this.Canvas.textAlign="center";
|
|
59859
|
+
if (quadrant==3 || quadrant==4)
|
|
59860
|
+
{
|
|
59861
|
+
this.Canvas.textBaseline="bottom";
|
|
59862
|
+
textOffset=-5;
|
|
59863
|
+
}
|
|
59864
|
+
else
|
|
59865
|
+
{
|
|
59866
|
+
this.Canvas.textBaseline="top";
|
|
59867
|
+
textOffset=5;
|
|
59868
|
+
}
|
|
59869
|
+
|
|
59870
|
+
for(var i=0;i<aryXData.length;++i)
|
|
59871
|
+
{
|
|
59872
|
+
var item=aryXData[i];
|
|
59873
|
+
var x=item.Value*xDiff+ptStart.X;
|
|
59874
|
+
|
|
59875
|
+
var pt=this.CalculateExtendLineEndPoint([center, {X:x, Y:ptStart.Y}]);
|
|
59876
|
+
|
|
59877
|
+
if (ptPre) //面积
|
|
59878
|
+
{
|
|
59879
|
+
this.Canvas.beginPath();
|
|
59880
|
+
this.Canvas.moveTo(center.X,center.Y);
|
|
59881
|
+
this.Canvas.lineTo(ptPre.X,ptPre.Y);
|
|
59882
|
+
this.Canvas.lineTo(pt.X,pt.Y);
|
|
59883
|
+
this.Canvas.closePath();
|
|
59884
|
+
this.Canvas.fillStyle=clrArea;
|
|
59885
|
+
this.Canvas.fill();
|
|
59886
|
+
}
|
|
59887
|
+
|
|
59888
|
+
this.Canvas.strokeStyle=item.Color;
|
|
59889
|
+
this.Canvas.beginPath();
|
|
59890
|
+
this.Canvas.moveTo(center.X,center.Y);
|
|
59891
|
+
this.Canvas.lineTo(pt.X,pt.Y);
|
|
59892
|
+
this.Canvas.stroke();
|
|
59893
|
+
|
|
59894
|
+
this.LinePoint.push({Start:center, End:pt});
|
|
59895
|
+
|
|
59896
|
+
if (item.Value!=1)
|
|
59897
|
+
{
|
|
59898
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
59899
|
+
this.Canvas.beginPath();
|
|
59900
|
+
this.Canvas.moveTo(x,center.Y);
|
|
59901
|
+
this.Canvas.lineTo(x,ptStart.Y);
|
|
59902
|
+
this.Canvas.stroke();
|
|
59903
|
+
}
|
|
59904
|
+
|
|
59905
|
+
ptPre=pt;
|
|
59906
|
+
clrArea=IChartDrawPicture.ColorToRGBA(item.Color, this.AreaConfig.Opacity);
|
|
59907
|
+
|
|
59908
|
+
//文字
|
|
59909
|
+
var text=`${item.Value}`;
|
|
59910
|
+
this.Canvas.fillStyle=item.Color;
|
|
59911
|
+
this.Canvas.fillText(text,x,center.Y+textOffset);
|
|
59912
|
+
}
|
|
59913
|
+
}
|
|
59914
|
+
|
|
59915
|
+
this.GetArrayAreaConfig=function(aryData)
|
|
59916
|
+
{
|
|
59917
|
+
var aryArea=[];
|
|
59918
|
+
for(var i=0;i<aryData.length;++i)
|
|
59919
|
+
{
|
|
59920
|
+
var item=aryData[i];
|
|
59921
|
+
if (item.Enable) aryArea.push(item);
|
|
59922
|
+
}
|
|
59923
|
+
|
|
59924
|
+
aryArea.sort((left,right)=>{ return right.Value-left.Value; })
|
|
59925
|
+
|
|
59926
|
+
return aryArea;
|
|
59927
|
+
}
|
|
59928
|
+
|
|
59929
|
+
}
|
|
59930
|
+
|
|
59451
59931
|
function ChartDrawStorage()
|
|
59452
59932
|
{
|
|
59453
59933
|
this.DrawData=new Map(); //画图工具数据 key=symbol-Period, value=Map() Key:Guid, Value:{Guid, Symbol, Period, ClassName, Value}
|