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
|
@@ -33139,6 +33139,7 @@ function ChartStick()
|
|
|
33139
33139
|
this.Draw=function()
|
|
33140
33140
|
{
|
|
33141
33141
|
if (!this.IsShow || this.ChartFrame.IsMinSize) return;
|
|
33142
|
+
if (this.IsHideScriptIndex()) return;
|
|
33142
33143
|
|
|
33143
33144
|
if (this.NotSupportMessage)
|
|
33144
33145
|
{
|
|
@@ -33164,6 +33165,8 @@ function ChartLineStick()
|
|
|
33164
33165
|
this.Draw=function()
|
|
33165
33166
|
{
|
|
33166
33167
|
if (!this.IsShow || this.ChartFrame.IsMinSize) return;
|
|
33168
|
+
if (this.IsShowIndexTitleOnly()) return;
|
|
33169
|
+
if (this.IsHideScriptIndex()) return;
|
|
33167
33170
|
|
|
33168
33171
|
if (this.NotSupportMessage)
|
|
33169
33172
|
{
|
|
@@ -43692,7 +43695,7 @@ function DrawToolsButton()
|
|
|
43692
43695
|
{ HTML: { Title: 'M头W底', IClass: 'iconfont icon-draw_wavemw', ID: 'icon-wavemw' }, Name: 'M头W底' },
|
|
43693
43696
|
{ HTML: { Title: '头肩型', IClass: 'iconfont icon-draw_head_shoulders_bt', ID: 'icon-Head-Shoulders' }, Name: '头肩型' },
|
|
43694
43697
|
{ HTML: { Title: '波浪尺', IClass: 'iconfont icon-waveruler', ID: 'icon-wave-ruler' }, Name: '波浪尺' },
|
|
43695
|
-
{ HTML: { Title: 'AB波浪尺', IClass: 'iconfont icon-waveruler', ID: 'icon-wave-
|
|
43698
|
+
{ HTML: { Title: 'AB波浪尺', IClass: 'iconfont icon-waveruler', ID: 'icon-wave-ruler2' }, Name: 'AB波浪尺' },
|
|
43696
43699
|
{ HTML: { Title: '箱型线', IClass: 'iconfont icon-draw_box', ID: 'icon-drawbox' }, Name: '箱型线' },
|
|
43697
43700
|
{ HTML: { Title: '涂鸦线段', IClass: 'iconfont icon-draw_line', ID: 'icon-segment2' }, Name: '涂鸦线段' },
|
|
43698
43701
|
|
|
@@ -52675,7 +52678,8 @@ function DynamicMinuteTitlePainting()
|
|
|
52675
52678
|
|
|
52676
52679
|
if (beforeItem && dataItem) //盘前数据
|
|
52677
52680
|
{
|
|
52678
|
-
if (beforeItem.Date>dataItem.Date || (beforeItem.Date==dataItem.Date && beforeItem.Time>dataItem.Time &&
|
|
52681
|
+
if (beforeItem.Date>dataItem.Date || (beforeItem.Date==dataItem.Date && beforeItem.Time>dataItem.Time && beforeDataVer==1.0)
|
|
52682
|
+
|| (beforeItem.Date==dataItem.Date && parseInt(beforeItem.Time>dataItem.Time) && beforeDataVer==2.0))
|
|
52679
52683
|
return { Type:2, Data:beforeItem, Ver: beforeDataVer, Explain:beforeExplain};
|
|
52680
52684
|
}
|
|
52681
52685
|
|
|
@@ -54765,6 +54769,7 @@ function IChartDrawPicture()
|
|
|
54765
54769
|
this.EnableCtrlMove=false; //是否按住Ctrl才能移动
|
|
54766
54770
|
this.OnlyMoveXIndex=false; //只能在X轴刻度上移动
|
|
54767
54771
|
this.IsSupportMagnet=false; //是否支持磁吸
|
|
54772
|
+
this.EnableMoveCheck=true; //允许移动时监测是否超出边界
|
|
54768
54773
|
|
|
54769
54774
|
this.IsDrawFirst=false;
|
|
54770
54775
|
this.IsShowYCoordinate=false; //是否在Y轴显示点的刻度
|
|
@@ -55113,6 +55118,8 @@ function IChartDrawPicture()
|
|
|
55113
55118
|
var index=parseInt(this.MovePointIndex);
|
|
55114
55119
|
if (index===100) //整体移动
|
|
55115
55120
|
{
|
|
55121
|
+
if (this.IsMoveOutOfBounds(this.Point, xStep, yStep)) return false;
|
|
55122
|
+
|
|
55116
55123
|
for(var i in this.Point)
|
|
55117
55124
|
{
|
|
55118
55125
|
this.Point[i].X+=xStep;
|
|
@@ -55133,6 +55140,56 @@ function IChartDrawPicture()
|
|
|
55133
55140
|
}
|
|
55134
55141
|
}
|
|
55135
55142
|
|
|
55143
|
+
//是否超出边界了
|
|
55144
|
+
this.IsMoveOutOfBounds=function(aryPoint,xStep,yStep)
|
|
55145
|
+
{
|
|
55146
|
+
if (!this.EnableMoveCheck) return false;
|
|
55147
|
+
|
|
55148
|
+
if (!this.Frame) return false;
|
|
55149
|
+
|
|
55150
|
+
if (this.Frame.ClassName=="MinuteFrame" || this.Frame.Class=="MinuteHScreenFrame")
|
|
55151
|
+
return false;
|
|
55152
|
+
|
|
55153
|
+
|
|
55154
|
+
var data=this.Frame.Data;
|
|
55155
|
+
if (!data) return false;
|
|
55156
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(data.Data)) return false;
|
|
55157
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryPoint)) return false;
|
|
55158
|
+
var isHScreen=this.Frame.IsHScreen;
|
|
55159
|
+
if (isHScreen)
|
|
55160
|
+
{
|
|
55161
|
+
//TODO:横屏以后再做
|
|
55162
|
+
return false;
|
|
55163
|
+
}
|
|
55164
|
+
else
|
|
55165
|
+
{
|
|
55166
|
+
var offset=data.DataOffset;
|
|
55167
|
+
var startIndex=0-offset;
|
|
55168
|
+
var endIndex=data.Data.length-offset;
|
|
55169
|
+
|
|
55170
|
+
if (xStep>0)
|
|
55171
|
+
{
|
|
55172
|
+
var xEnd=this.Frame.GetXFromIndex(endIndex-1,false);
|
|
55173
|
+
for(var i=0;i<aryPoint.length;++i)
|
|
55174
|
+
{
|
|
55175
|
+
var item=aryPoint[i];
|
|
55176
|
+
if (item.X+xStep>xEnd) return true;
|
|
55177
|
+
}
|
|
55178
|
+
}
|
|
55179
|
+
else if (xStep<0)
|
|
55180
|
+
{
|
|
55181
|
+
var xStart=this.Frame.GetXFromIndex(startIndex,false);
|
|
55182
|
+
for(var i=0;i<aryPoint.length;++i)
|
|
55183
|
+
{
|
|
55184
|
+
var item=aryPoint[i];
|
|
55185
|
+
if (item.X+xStep<xStart) return true;
|
|
55186
|
+
}
|
|
55187
|
+
}
|
|
55188
|
+
|
|
55189
|
+
return false;
|
|
55190
|
+
}
|
|
55191
|
+
}
|
|
55192
|
+
|
|
55136
55193
|
this.ClipFrame=function()
|
|
55137
55194
|
{
|
|
55138
55195
|
if (this.Frame.IsHScreen)
|
|
@@ -56089,7 +56146,9 @@ IChartDrawPicture.ArrayDrawPricture=
|
|
|
56089
56146
|
{ Name:"AnchoredText", ClassName:"ChartDrawAnchoredText", Create:function() { return new ChartDrawAnchoredText();} },
|
|
56090
56147
|
{ Name:"PriceLabel", ClassName:"ChartDrawPriceLabel", Create:function() { return new ChartDrawPriceLabel();} },
|
|
56091
56148
|
{ Name:"PriceNote", ClassName:"ChartDrawPriceNote", Create:function() { return new ChartDrawPriceNote();} },
|
|
56092
|
-
{ Name:"FibWedge", ClassName:"ChartDrawFibWedge", Create:function(){ return new ChartDrawFibWedge(); }}
|
|
56149
|
+
{ Name:"FibWedge", ClassName:"ChartDrawFibWedge", Create:function(){ return new ChartDrawFibWedge(); }},
|
|
56150
|
+
{ Name:"FibRetracement", ClassName:"ChartFibRetracement", Create:function() { return new ChartFibRetracement(); }}, //斐波那契回测
|
|
56151
|
+
{ Name:"FibSpeedResistanceFan", ClassName:"ChartFibSpeedResistanceFan", Create:function() { return new ChartFibSpeedResistanceFan(); }} //斐波那契扇形
|
|
56093
56152
|
];
|
|
56094
56153
|
|
|
56095
56154
|
IChartDrawPicture.MapIonFont=new Map(
|
|
@@ -56263,6 +56322,7 @@ function ChartDrawGraffitiLine()
|
|
|
56263
56322
|
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
56264
56323
|
this.GetXYCoordinate=null;
|
|
56265
56324
|
this.PointCount=2; //画点的个数
|
|
56325
|
+
this.EnableMoveCheck=false; //允许移动时不监测是否超出边界
|
|
56266
56326
|
|
|
56267
56327
|
this.PointToValue=function()
|
|
56268
56328
|
{
|
|
@@ -57287,6 +57347,8 @@ function ChartDrawPictureRect()
|
|
|
57287
57347
|
|
|
57288
57348
|
this.ClassName='ChartDrawPictureRect';
|
|
57289
57349
|
this.GetXYCoordinate=this.GetXYCoordinate_default;
|
|
57350
|
+
this.OnlyMoveXIndex=true;
|
|
57351
|
+
this.IsSupportMagnet=true;
|
|
57290
57352
|
|
|
57291
57353
|
this.Draw=function()
|
|
57292
57354
|
{
|
|
@@ -58360,7 +58422,7 @@ function ChartDrawPictureParallelChannel()
|
|
|
58360
58422
|
var ptCenter=new Point();
|
|
58361
58423
|
ptCenter.X=linePoint.Start.X+(linePoint.End.X-linePoint.Start.X)/2;
|
|
58362
58424
|
ptCenter.Y=linePoint.Start.Y+(linePoint.End.Y-linePoint.Start.Y)/2;
|
|
58363
|
-
drawPoint[
|
|
58425
|
+
drawPoint[2]=ptCenter;
|
|
58364
58426
|
|
|
58365
58427
|
this.Point[2]=ptCenter;
|
|
58366
58428
|
var xValue=parseInt(this.Frame.GetXData(ptCenter.X))+data.DataOffset;
|
|
@@ -58793,6 +58855,7 @@ function ChartDrawPictureGannFan()
|
|
|
58793
58855
|
else return 3;
|
|
58794
58856
|
}
|
|
58795
58857
|
|
|
58858
|
+
|
|
58796
58859
|
//isDotline 是否是虚线
|
|
58797
58860
|
this.DrawLine=function(ptStart,ptEnd,isDottedline)
|
|
58798
58861
|
{
|
|
@@ -63572,6 +63635,423 @@ function ChartDrawFibWedge()
|
|
|
63572
63635
|
|
|
63573
63636
|
}
|
|
63574
63637
|
|
|
63638
|
+
//////////////////////////////////////////////////////////////////////////////
|
|
63639
|
+
// 斐波那契回测
|
|
63640
|
+
//
|
|
63641
|
+
function ChartFibRetracement()
|
|
63642
|
+
{
|
|
63643
|
+
this.newMethod=IChartDrawPicture; //派生
|
|
63644
|
+
this.newMethod();
|
|
63645
|
+
delete this.newMethod;
|
|
63646
|
+
|
|
63647
|
+
this.ClassName='ChartFibRetracement';
|
|
63648
|
+
this.PointCount=2;
|
|
63649
|
+
this.Font=12*GetDevicePixelRatio() +"px 微软雅黑";
|
|
63650
|
+
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
63651
|
+
this.GetXYCoordinate=this.GetXYCoordinate_default;
|
|
63652
|
+
this.PointToValue_Default=this.PointToValue;
|
|
63653
|
+
this.OnlyMoveXIndex=true;
|
|
63654
|
+
this.IsSupportMagnet=true;
|
|
63655
|
+
this.LineDash=[6,3];
|
|
63656
|
+
this.LineWidth=1;
|
|
63657
|
+
this.EnableBGColor=true;
|
|
63658
|
+
this.ExtendLine={ Left:false, Right: false }; //延长线
|
|
63659
|
+
|
|
63660
|
+
this.AreaConfig=
|
|
63661
|
+
{
|
|
63662
|
+
AryData:
|
|
63663
|
+
[
|
|
63664
|
+
{ Value: 0, Color:"rgb(128,128,128)", Enable:true },
|
|
63665
|
+
{ Value: 0.236, Color:"rgb(242,52,69)", Enable:true },
|
|
63666
|
+
{ Value: 0.382, Color:"rgb(255,152,0)",Enable:true },
|
|
63667
|
+
{ Value: 0.5, Color:"rgb(76,175,80)", Enable:true },
|
|
63668
|
+
{ Value: 0.618, Color:"rgb(8,153,129)", Enable:true },
|
|
63669
|
+
{ Value: 0.786, Color:"rgb(0,188,212)" ,Enable:true },
|
|
63670
|
+
{ Value: 1, Color:"rgb(120,123,134)", Enable:true },
|
|
63671
|
+
{ Value: 1.618, Color:"rgb(41,98,255)",Enable:true },
|
|
63672
|
+
{ Value: 2.618, Color:"rgb(242,54,69)",Enable:false },
|
|
63673
|
+
],
|
|
63674
|
+
|
|
63675
|
+
Opacity:0.3
|
|
63676
|
+
}
|
|
63677
|
+
|
|
63678
|
+
this.SetOption=function(option)
|
|
63679
|
+
{
|
|
63680
|
+
if (!option) return;
|
|
63681
|
+
|
|
63682
|
+
if (option.Font) this.Font=option.Font;
|
|
63683
|
+
if (option.LineWidth) this.LineWidth=option.LineWidth;
|
|
63684
|
+
if (option.LineDash) this.LineDash=option.LineDash;
|
|
63685
|
+
if (IFrameSplitOperator.IsBool(option.EnableBGColor)) this.EnableBGColor=option.EnableBGColor;
|
|
63686
|
+
if (option.ExtendLine)
|
|
63687
|
+
{
|
|
63688
|
+
var item=option.ExtendLine;
|
|
63689
|
+
if (IFrameSplitOperator.IsBool(item.Left)) this.ExtendLine.Left=item.Left;
|
|
63690
|
+
if (IFrameSplitOperator.IsBool(item.Right)) this.ExtendLine.Left=item.Right;
|
|
63691
|
+
}
|
|
63692
|
+
|
|
63693
|
+
if (option.AreaConfig) this.AreaConfig=option.AreaConfig;
|
|
63694
|
+
}
|
|
63695
|
+
|
|
63696
|
+
//导出成存储格式
|
|
63697
|
+
this.ExportStorageData=function()
|
|
63698
|
+
{
|
|
63699
|
+
var storageData=this.ExportBaseData();
|
|
63700
|
+
|
|
63701
|
+
storageData.Value=[];
|
|
63702
|
+
for(var i=0;i<this.Value.length && i<this.PointCount;++i)
|
|
63703
|
+
{
|
|
63704
|
+
var item=this.Value[i];
|
|
63705
|
+
storageData.Value.push( { XValue:item.XValue, YValue:item.YValue } );
|
|
63706
|
+
}
|
|
63707
|
+
|
|
63708
|
+
storageData.Font=this.Font;
|
|
63709
|
+
storageData.EnableBGColor=this.EnableBGColor;
|
|
63710
|
+
storageData.LineDash=this.LineDash;
|
|
63711
|
+
storageData.ExtendLine={ Left:this.ExtendLine.Left, Right:this.ExtendLine.Right };
|
|
63712
|
+
storageData.AreaConfig=CloneData(this.AreaConfig);
|
|
63713
|
+
|
|
63714
|
+
return storageData;
|
|
63715
|
+
}
|
|
63716
|
+
|
|
63717
|
+
this.ImportStorageData=function(storageData)
|
|
63718
|
+
{
|
|
63719
|
+
if (storageData.Font) this.Font=storageData.Font;
|
|
63720
|
+
if (storageData.LineDash) this.LineDash=storageData.LineDash;
|
|
63721
|
+
if (IFrameSplitOperator.IsBool(storageData.EnableBGColor)) this.EnableBGColor=storageData.EnableBGColor;
|
|
63722
|
+
if (storageData.ExtendLine) this.ExtendLine=storageData.ExtendLine;
|
|
63723
|
+
if (storageData.AreaConfig) this.AreaConfig=storageData.AreaConfig;
|
|
63724
|
+
}
|
|
63725
|
+
|
|
63726
|
+
this.Draw=function()
|
|
63727
|
+
{
|
|
63728
|
+
this.LinePoint=[];
|
|
63729
|
+
if (this.IsFrameMinSize()) return;
|
|
63730
|
+
var bCheckXY=true;
|
|
63731
|
+
if (this.ExtendLine.Left || this.ExtendLine.Right) bCheckXY=false;
|
|
63732
|
+
var drawPoint=this.CalculateDrawPoint( {IsCheckX:bCheckXY, IsCheckY:bCheckXY} );
|
|
63733
|
+
if (!drawPoint) return;
|
|
63734
|
+
if (drawPoint.length!=2) return;
|
|
63735
|
+
|
|
63736
|
+
this.ClipFrame();
|
|
63737
|
+
|
|
63738
|
+
var ptStart=drawPoint[0];
|
|
63739
|
+
var ptEnd=drawPoint[1];
|
|
63740
|
+
|
|
63741
|
+
this.SetLineWidth();
|
|
63742
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
63743
|
+
this.Canvas.setLineDash(this.LineDash);
|
|
63744
|
+
this.Canvas.beginPath();
|
|
63745
|
+
this.Canvas.moveTo(ptStart.X,ptStart.Y);
|
|
63746
|
+
this.Canvas.lineTo(ptEnd.X,ptEnd.Y);
|
|
63747
|
+
this.Canvas.stroke();
|
|
63748
|
+
this.Canvas.setLineDash([]);
|
|
63749
|
+
|
|
63750
|
+
this.DrawBlock(ptStart, ptEnd);
|
|
63751
|
+
|
|
63752
|
+
this.RestoreLineWidth();
|
|
63753
|
+
|
|
63754
|
+
var line={Start:ptStart, End:ptEnd};
|
|
63755
|
+
this.LinePoint.push(line);
|
|
63756
|
+
|
|
63757
|
+
this.DrawPoint(drawPoint); //画点
|
|
63758
|
+
this.Canvas.restore();
|
|
63759
|
+
}
|
|
63760
|
+
|
|
63761
|
+
this.GetArrayAreaConfig=function()
|
|
63762
|
+
{
|
|
63763
|
+
var aryArea=[];
|
|
63764
|
+
for(var i=0;i<this.AreaConfig.AryData.length;++i)
|
|
63765
|
+
{
|
|
63766
|
+
var item=this.AreaConfig.AryData[i];
|
|
63767
|
+
if (item.Enable) aryArea.push(item);
|
|
63768
|
+
}
|
|
63769
|
+
|
|
63770
|
+
aryArea.sort((left,right)=>{ return right.Value-left.Value; })
|
|
63771
|
+
|
|
63772
|
+
return aryArea;
|
|
63773
|
+
}
|
|
63774
|
+
|
|
63775
|
+
this.DrawBlock=function(ptStart, ptEnd)
|
|
63776
|
+
{
|
|
63777
|
+
var yTop=Math.min(ptStart.Y, ptEnd.Y);
|
|
63778
|
+
var yBottom=Math.max(ptStart.Y, ptEnd.Y);
|
|
63779
|
+
var xLeft=Math.min(ptStart.X, ptEnd.X);
|
|
63780
|
+
var xRight=Math.max(ptStart.X, ptEnd.X);
|
|
63781
|
+
var height=yBottom-yTop;
|
|
63782
|
+
//var baseValue=Math.min(this.Value[0].YValue, this.Value[1].YValue);
|
|
63783
|
+
//var diffValue=Math.abs(this.Value[0].YValue-this.Value[1].YValue); //差值
|
|
63784
|
+
|
|
63785
|
+
if (this.ExtendLine.Right) xRight=this.Frame.ChartBorder.GetRight();
|
|
63786
|
+
if (this.ExtendLine.Left) xLeft=this.Frame.ChartBorder.GetLeft();
|
|
63787
|
+
|
|
63788
|
+
var aryArea=this.GetArrayAreaConfig();
|
|
63789
|
+
var yPre=null; //上一个点
|
|
63790
|
+
var clrArea=null;
|
|
63791
|
+
this.Canvas.font=this.Font;
|
|
63792
|
+
if (this.ExtendLine.Left) this.Canvas.textAlign="left";
|
|
63793
|
+
else this.Canvas.textAlign="right";
|
|
63794
|
+
this.Canvas.textBaseline="bottom";
|
|
63795
|
+
|
|
63796
|
+
for(var i=0;i<aryArea.length;++i)
|
|
63797
|
+
{
|
|
63798
|
+
var item=aryArea[i];
|
|
63799
|
+
var y=yBottom-height*item.Value;
|
|
63800
|
+
//var yValue=baseValue+diffValue*item.Value;
|
|
63801
|
+
yValue=this.Frame.GetYData(y,false);
|
|
63802
|
+
y=ToFixedPoint(y);
|
|
63803
|
+
if (this.EnableBGColor && IFrameSplitOperator.IsNumber(yPre))
|
|
63804
|
+
{
|
|
63805
|
+
var rtBG={ Left:xLeft, Right:xRight, Top:yPre, Bottom:y };
|
|
63806
|
+
rtBG.Width=rtBG.Right-rtBG.Left;
|
|
63807
|
+
rtBG.Height=rtBG.Bottom-rtBG.Top;
|
|
63808
|
+
this.Canvas.fillStyle=clrArea;
|
|
63809
|
+
this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
|
|
63810
|
+
}
|
|
63811
|
+
|
|
63812
|
+
this.Canvas.strokeStyle=item.Color;
|
|
63813
|
+
this.Canvas.beginPath();
|
|
63814
|
+
this.Canvas.moveTo(xLeft,y);
|
|
63815
|
+
this.Canvas.lineTo(xRight,y);
|
|
63816
|
+
this.Canvas.stroke();
|
|
63817
|
+
|
|
63818
|
+
var line={ Start:{X:xLeft, Y:y}, End:{X:xRight, Y:y} };
|
|
63819
|
+
this.LinePoint.push(line);
|
|
63820
|
+
|
|
63821
|
+
//文字
|
|
63822
|
+
var text=`${item.Value} (${yValue.toFixed(2)})`;
|
|
63823
|
+
this.Canvas.fillStyle=item.Color;
|
|
63824
|
+
if (this.ExtendLine.Left)
|
|
63825
|
+
this.Canvas.fillText(text,xLeft+2,y-2);
|
|
63826
|
+
else
|
|
63827
|
+
this.Canvas.fillText(text,xLeft-2,y-2);
|
|
63828
|
+
|
|
63829
|
+
yPre=y;
|
|
63830
|
+
clrArea=IChartDrawPicture.ColorToRGBA(item.Color, this.AreaConfig.Opacity);
|
|
63831
|
+
}
|
|
63832
|
+
}
|
|
63833
|
+
|
|
63834
|
+
}
|
|
63835
|
+
|
|
63836
|
+
|
|
63837
|
+
function ChartFibSpeedResistanceFan()
|
|
63838
|
+
{
|
|
63839
|
+
this.newMethod=IChartDrawPicture; //派生
|
|
63840
|
+
this.newMethod();
|
|
63841
|
+
delete this.newMethod;
|
|
63842
|
+
|
|
63843
|
+
this.ClassName='ChartFibSpeedResistanceFan';
|
|
63844
|
+
this.PointCount=2;
|
|
63845
|
+
this.Font=12*GetDevicePixelRatio() +"px 微软雅黑";
|
|
63846
|
+
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
63847
|
+
this.GetXYCoordinate=this.GetXYCoordinate_default;
|
|
63848
|
+
this.PointToValue_Default=this.PointToValue;
|
|
63849
|
+
this.OnlyMoveXIndex=true;
|
|
63850
|
+
this.IsSupportMagnet=true;
|
|
63851
|
+
this.LineWidth=1;
|
|
63852
|
+
this.EnableBGColor=true;
|
|
63853
|
+
|
|
63854
|
+
this.AreaConfig=
|
|
63855
|
+
{
|
|
63856
|
+
AryYData:
|
|
63857
|
+
[
|
|
63858
|
+
{ Value: 0, Color:"rgb(128,128,128)", Enable:true },
|
|
63859
|
+
{ Value: 0.25, Color:"rgb(242,52,69)", Enable:true },
|
|
63860
|
+
{ Value: 0.382, Color:"rgb(255,152,0)",Enable:true },
|
|
63861
|
+
{ Value: 0.5, Color:"rgb(76,175,80)", Enable:true },
|
|
63862
|
+
{ Value: 0.618, Color:"rgb(8,153,129)", Enable:true },
|
|
63863
|
+
{ Value: 0.75, Color:"rgb(0,188,212)" ,Enable:true },
|
|
63864
|
+
{ Value: 1, Color:"rgb(120,123,134)", Enable:true },
|
|
63865
|
+
|
|
63866
|
+
],
|
|
63867
|
+
|
|
63868
|
+
AryXData:
|
|
63869
|
+
[
|
|
63870
|
+
{ Value: 0, Color:"rgb(128,128,128)", Enable:true },
|
|
63871
|
+
{ Value: 0.25, Color:"rgb(242,52,69)", Enable:true },
|
|
63872
|
+
{ Value: 0.382, Color:"rgb(255,152,0)",Enable:true },
|
|
63873
|
+
{ Value: 0.5, Color:"rgb(76,175,80)", Enable:true },
|
|
63874
|
+
{ Value: 0.618, Color:"rgb(8,153,129)", Enable:true },
|
|
63875
|
+
{ Value: 0.75, Color:"rgb(0,188,212)" ,Enable:true },
|
|
63876
|
+
{ Value: 1, Color:"rgb(120,123,134)", Enable:true },
|
|
63877
|
+
],
|
|
63878
|
+
|
|
63879
|
+
Opacity:0.3
|
|
63880
|
+
}
|
|
63881
|
+
|
|
63882
|
+
this.Draw=function()
|
|
63883
|
+
{
|
|
63884
|
+
this.LinePoint=[];
|
|
63885
|
+
if (this.IsFrameMinSize()) return;
|
|
63886
|
+
var bCheckXY=false;
|
|
63887
|
+
var drawPoint=this.CalculateDrawPoint( {IsCheckX:bCheckXY, IsCheckY:bCheckXY} );
|
|
63888
|
+
if (!drawPoint) return;
|
|
63889
|
+
if (drawPoint.length!=2) return;
|
|
63890
|
+
|
|
63891
|
+
this.ClipFrame();
|
|
63892
|
+
|
|
63893
|
+
var ptStart=drawPoint[0];
|
|
63894
|
+
var ptEnd=drawPoint[1];
|
|
63895
|
+
|
|
63896
|
+
this.SetLineWidth();
|
|
63897
|
+
this.DrawBlock(ptEnd, ptStart);
|
|
63898
|
+
this.RestoreLineWidth();
|
|
63899
|
+
|
|
63900
|
+
this.DrawPoint(drawPoint); //画点
|
|
63901
|
+
this.Canvas.restore();
|
|
63902
|
+
}
|
|
63903
|
+
|
|
63904
|
+
//获取在第几象限
|
|
63905
|
+
this.GetQuadrant=function(ptStart,ptEnd)
|
|
63906
|
+
{
|
|
63907
|
+
if (ptStart.X<ptEnd.X && ptStart.Y>ptEnd.Y) return 1;
|
|
63908
|
+
else if (ptStart.X>ptEnd.X && ptStart.Y>ptEnd.Y) return 2;
|
|
63909
|
+
else if (ptStart.X<ptEnd.X && ptStart.Y< ptEnd.Y) return 4;
|
|
63910
|
+
else return 3;
|
|
63911
|
+
}
|
|
63912
|
+
|
|
63913
|
+
this.DrawBlock=function(ptStart, ptEnd)
|
|
63914
|
+
{
|
|
63915
|
+
var center=ptEnd;
|
|
63916
|
+
var xDiff=ptEnd.X-ptStart.X;
|
|
63917
|
+
var yDiff=ptEnd.Y-ptStart.Y;
|
|
63918
|
+
var quadrant=this.GetQuadrant(center,ptStart); //象限
|
|
63919
|
+
|
|
63920
|
+
var aryYData=this.GetArrayAreaConfig(this.AreaConfig.AryYData);
|
|
63921
|
+
var ptPre=null; //上一个点
|
|
63922
|
+
var clrArea=null;
|
|
63923
|
+
this.Canvas.font=this.Font;
|
|
63924
|
+
var textOffset=4;
|
|
63925
|
+
if (quadrant==1 || quadrant==4)
|
|
63926
|
+
{
|
|
63927
|
+
this.Canvas.textAlign="right";
|
|
63928
|
+
textOffset=-4;
|
|
63929
|
+
}
|
|
63930
|
+
else
|
|
63931
|
+
{
|
|
63932
|
+
this.Canvas.textAlign="left";
|
|
63933
|
+
textOffset=4;
|
|
63934
|
+
}
|
|
63935
|
+
this.Canvas.textBaseline="middle";
|
|
63936
|
+
for(var i=0;i<aryYData.length;++i)
|
|
63937
|
+
{
|
|
63938
|
+
var item=aryYData[i];
|
|
63939
|
+
var y=item.Value*yDiff+ptStart.Y;
|
|
63940
|
+
|
|
63941
|
+
var pt=this.CalculateExtendLineEndPoint([center, {X:ptStart.X, Y:y}]);
|
|
63942
|
+
|
|
63943
|
+
if (ptPre)
|
|
63944
|
+
{
|
|
63945
|
+
this.Canvas.beginPath();
|
|
63946
|
+
this.Canvas.moveTo(center.X,center.Y);
|
|
63947
|
+
this.Canvas.lineTo(ptPre.X,ptPre.Y);
|
|
63948
|
+
this.Canvas.lineTo(pt.X,pt.Y);
|
|
63949
|
+
this.Canvas.closePath();
|
|
63950
|
+
this.Canvas.fillStyle=clrArea;
|
|
63951
|
+
this.Canvas.fill();
|
|
63952
|
+
}
|
|
63953
|
+
|
|
63954
|
+
this.Canvas.strokeStyle=item.Color;
|
|
63955
|
+
this.Canvas.beginPath();
|
|
63956
|
+
this.Canvas.moveTo(center.X,center.Y);
|
|
63957
|
+
this.Canvas.lineTo(pt.X,pt.Y);
|
|
63958
|
+
this.Canvas.stroke();
|
|
63959
|
+
|
|
63960
|
+
this.LinePoint.push({Start:center, End:pt});
|
|
63961
|
+
|
|
63962
|
+
if (item.Value!=1)
|
|
63963
|
+
{
|
|
63964
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
63965
|
+
this.Canvas.beginPath();
|
|
63966
|
+
this.Canvas.moveTo(center.X,y);
|
|
63967
|
+
this.Canvas.lineTo(ptStart.X,y);
|
|
63968
|
+
this.Canvas.stroke();
|
|
63969
|
+
}
|
|
63970
|
+
|
|
63971
|
+
ptPre=pt;
|
|
63972
|
+
clrArea=IChartDrawPicture.ColorToRGBA(item.Color, this.AreaConfig.Opacity);
|
|
63973
|
+
|
|
63974
|
+
//文字
|
|
63975
|
+
var text=`${item.Value}`;
|
|
63976
|
+
this.Canvas.fillStyle=item.Color;
|
|
63977
|
+
this.Canvas.fillText(text,center.X+textOffset,y);
|
|
63978
|
+
}
|
|
63979
|
+
|
|
63980
|
+
var aryXData=this.GetArrayAreaConfig(this.AreaConfig.AryXData);
|
|
63981
|
+
var ptPre=null;
|
|
63982
|
+
this.Canvas.textAlign="center";
|
|
63983
|
+
if (quadrant==3 || quadrant==4)
|
|
63984
|
+
{
|
|
63985
|
+
this.Canvas.textBaseline="bottom";
|
|
63986
|
+
textOffset=-5;
|
|
63987
|
+
}
|
|
63988
|
+
else
|
|
63989
|
+
{
|
|
63990
|
+
this.Canvas.textBaseline="top";
|
|
63991
|
+
textOffset=5;
|
|
63992
|
+
}
|
|
63993
|
+
|
|
63994
|
+
for(var i=0;i<aryXData.length;++i)
|
|
63995
|
+
{
|
|
63996
|
+
var item=aryXData[i];
|
|
63997
|
+
var x=item.Value*xDiff+ptStart.X;
|
|
63998
|
+
|
|
63999
|
+
var pt=this.CalculateExtendLineEndPoint([center, {X:x, Y:ptStart.Y}]);
|
|
64000
|
+
|
|
64001
|
+
if (ptPre) //面积
|
|
64002
|
+
{
|
|
64003
|
+
this.Canvas.beginPath();
|
|
64004
|
+
this.Canvas.moveTo(center.X,center.Y);
|
|
64005
|
+
this.Canvas.lineTo(ptPre.X,ptPre.Y);
|
|
64006
|
+
this.Canvas.lineTo(pt.X,pt.Y);
|
|
64007
|
+
this.Canvas.closePath();
|
|
64008
|
+
this.Canvas.fillStyle=clrArea;
|
|
64009
|
+
this.Canvas.fill();
|
|
64010
|
+
}
|
|
64011
|
+
|
|
64012
|
+
this.Canvas.strokeStyle=item.Color;
|
|
64013
|
+
this.Canvas.beginPath();
|
|
64014
|
+
this.Canvas.moveTo(center.X,center.Y);
|
|
64015
|
+
this.Canvas.lineTo(pt.X,pt.Y);
|
|
64016
|
+
this.Canvas.stroke();
|
|
64017
|
+
|
|
64018
|
+
this.LinePoint.push({Start:center, End:pt});
|
|
64019
|
+
|
|
64020
|
+
if (item.Value!=1)
|
|
64021
|
+
{
|
|
64022
|
+
this.Canvas.strokeStyle=this.LineColor;
|
|
64023
|
+
this.Canvas.beginPath();
|
|
64024
|
+
this.Canvas.moveTo(x,center.Y);
|
|
64025
|
+
this.Canvas.lineTo(x,ptStart.Y);
|
|
64026
|
+
this.Canvas.stroke();
|
|
64027
|
+
}
|
|
64028
|
+
|
|
64029
|
+
ptPre=pt;
|
|
64030
|
+
clrArea=IChartDrawPicture.ColorToRGBA(item.Color, this.AreaConfig.Opacity);
|
|
64031
|
+
|
|
64032
|
+
//文字
|
|
64033
|
+
var text=`${item.Value}`;
|
|
64034
|
+
this.Canvas.fillStyle=item.Color;
|
|
64035
|
+
this.Canvas.fillText(text,x,center.Y+textOffset);
|
|
64036
|
+
}
|
|
64037
|
+
}
|
|
64038
|
+
|
|
64039
|
+
this.GetArrayAreaConfig=function(aryData)
|
|
64040
|
+
{
|
|
64041
|
+
var aryArea=[];
|
|
64042
|
+
for(var i=0;i<aryData.length;++i)
|
|
64043
|
+
{
|
|
64044
|
+
var item=aryData[i];
|
|
64045
|
+
if (item.Enable) aryArea.push(item);
|
|
64046
|
+
}
|
|
64047
|
+
|
|
64048
|
+
aryArea.sort((left,right)=>{ return right.Value-left.Value; })
|
|
64049
|
+
|
|
64050
|
+
return aryArea;
|
|
64051
|
+
}
|
|
64052
|
+
|
|
64053
|
+
}
|
|
64054
|
+
|
|
63575
64055
|
function ChartDrawStorage()
|
|
63576
64056
|
{
|
|
63577
64057
|
this.DrawData=new Map(); //画图工具数据 key=symbol-Period, value=Map() Key:Guid, Value:{Guid, Symbol, Period, ClassName, Value}
|
|
@@ -128616,7 +129096,7 @@ function HQChartScriptWorker()
|
|
|
128616
129096
|
|
|
128617
129097
|
|
|
128618
129098
|
|
|
128619
|
-
var HQCHART_VERSION="1.1.
|
|
129099
|
+
var HQCHART_VERSION="1.1.12523";
|
|
128620
129100
|
|
|
128621
129101
|
function PrintHQChartVersion()
|
|
128622
129102
|
{
|
|
@@ -98,6 +98,7 @@ function IChartPainting()
|
|
|
98
98
|
this.Name; //名称
|
|
99
99
|
this.ClassName = 'IChartPainting'; //类名
|
|
100
100
|
this.Data = new ChartData(); //数据区
|
|
101
|
+
this.Script; //图形对应的指标脚本 (只有指标图形才有)
|
|
101
102
|
|
|
102
103
|
this.NotSupportMessage = null;
|
|
103
104
|
this.MessageFont = g_JSChartPaintResource.Index.NotSupport.Font;
|
|
@@ -123,6 +124,13 @@ function IChartPainting()
|
|
|
123
124
|
return isMinute
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
//是否隐藏指标
|
|
128
|
+
this.IsHideScriptIndex=function()
|
|
129
|
+
{
|
|
130
|
+
if (this.Script && this.Script.IsShow==false) return true;
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
|
|
126
134
|
this.DrawNotSupportmessage = function ()
|
|
127
135
|
{
|
|
128
136
|
this.Canvas.font = this.MessageFont;
|
|
@@ -3303,6 +3311,7 @@ function ChartLine()
|
|
|
3303
3311
|
this.Draw = function ()
|
|
3304
3312
|
{
|
|
3305
3313
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
3314
|
+
if (this.IsHideScriptIndex()) return;
|
|
3306
3315
|
if (this.NotSupportMessage)
|
|
3307
3316
|
{
|
|
3308
3317
|
this.DrawNotSupportmessage();
|
|
@@ -3804,6 +3813,7 @@ function ChartStick()
|
|
|
3804
3813
|
this.DrawLine = function ()
|
|
3805
3814
|
{
|
|
3806
3815
|
if (this.ChartFrame.IsMinSize) return;
|
|
3816
|
+
if (this.IsHideScriptIndex()) return;
|
|
3807
3817
|
if (!this.Data || !this.Data.Data) return;
|
|
3808
3818
|
|
|
3809
3819
|
var isHScreen = (this.ChartFrame.IsHScreen === true);
|
|
@@ -3915,7 +3925,7 @@ function ChartLineStick()
|
|
|
3915
3925
|
this.Draw = function ()
|
|
3916
3926
|
{
|
|
3917
3927
|
if (!this.IsShow || this.ChartFrame.IsMinSize) return;
|
|
3918
|
-
|
|
3928
|
+
if (this.IsHideScriptIndex()) return;
|
|
3919
3929
|
if (this.NotSupportMessage)
|
|
3920
3930
|
{
|
|
3921
3931
|
this.DrawNotSupportmessage();
|
|
@@ -5936,6 +5946,7 @@ function ChartMACD()
|
|
|
5936
5946
|
this.Draw = function ()
|
|
5937
5947
|
{
|
|
5938
5948
|
if (this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
5949
|
+
if (this.IsHideScriptIndex()) return;
|
|
5939
5950
|
if (this.NotSupportMessage)
|
|
5940
5951
|
{
|
|
5941
5952
|
this.DrawNotSupportmessage();
|
|
@@ -7010,6 +7021,7 @@ function ChartVolStick()
|
|
|
7010
7021
|
this.Draw = function ()
|
|
7011
7022
|
{
|
|
7012
7023
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
7024
|
+
if (this.IsHideScriptIndex()) return;
|
|
7013
7025
|
if (this.ChartFrame.IsHScreen === true)
|
|
7014
7026
|
{
|
|
7015
7027
|
this.HScreenDraw();
|
|
@@ -216,6 +216,8 @@ function ScriptIndex(name, script, args, option)
|
|
|
216
216
|
this.TitleFont=g_JSChartResource.DynamicTitleFont; //标题字体
|
|
217
217
|
this.IsShortTitle=false; //是否显示指标参数
|
|
218
218
|
|
|
219
|
+
this.IsShow=true; //是否显示图形
|
|
220
|
+
|
|
219
221
|
if (option)
|
|
220
222
|
{
|
|
221
223
|
if (option.FloatPrecision >= 0) this.FloatPrecision = option.FloatPrecision;
|
|
@@ -1476,6 +1478,10 @@ function ScriptIndex(name, script, args, option)
|
|
|
1476
1478
|
{
|
|
1477
1479
|
if (this.Name) chart.IndexName=this.Name;
|
|
1478
1480
|
else if (this.ID) chart.IndexName==this.ID;
|
|
1481
|
+
|
|
1482
|
+
if (this.ID) chart.IndexID=this.ID;
|
|
1483
|
+
|
|
1484
|
+
chart.Script=this; //指标内容绑定上去
|
|
1479
1485
|
}
|
|
1480
1486
|
}
|
|
1481
1487
|
|