hqchart 1.1.14538 → 1.1.14552
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 +80 -42
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +4 -0
- package/src/jscommon/umychart.js +533 -144
- package/src/jscommon/umychart.style.js +17 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +551 -145
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +555 -145
|
@@ -4501,6 +4501,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
4501
4501
|
if (IFrameSplitOperator.IsBool(item.PriceGap.Enable)) klineChart.PriceGap.Enable=item.PriceGap.Enable;
|
|
4502
4502
|
if (IFrameSplitOperator.IsNumber(item.PriceGap.Count)) klineChart.PriceGap.Count=item.PriceGap.Count;
|
|
4503
4503
|
}
|
|
4504
|
+
|
|
4505
|
+
if (IFrameSplitOperator.IsBool(item.EnablePrediction)) klineChart.PredictionConfig.Enable=item.EnablePrediction;
|
|
4504
4506
|
}
|
|
4505
4507
|
|
|
4506
4508
|
if(option.KLineTitle)
|
|
@@ -7348,6 +7350,51 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
7348
7350
|
this.DialogSearchIndex=null;
|
|
7349
7351
|
}
|
|
7350
7352
|
|
|
7353
|
+
this.DestroyDialogDrawTool=function()
|
|
7354
|
+
{
|
|
7355
|
+
if (!this.DialogDrawTool) return;
|
|
7356
|
+
|
|
7357
|
+
this.DialogDrawTool.Destroy();
|
|
7358
|
+
this.DialogDrawTool=null;
|
|
7359
|
+
}
|
|
7360
|
+
|
|
7361
|
+
this.DestroyDialogModifyIndexParam=function()
|
|
7362
|
+
{
|
|
7363
|
+
if (this.DialogModifyIndexParam) return;
|
|
7364
|
+
|
|
7365
|
+
this.DialogModifyIndexParam.Destroy();
|
|
7366
|
+
this.DialogModifyIndexParam=null;
|
|
7367
|
+
}
|
|
7368
|
+
|
|
7369
|
+
this.DestroyDialogSelectRect=function()
|
|
7370
|
+
{
|
|
7371
|
+
if (!this.DialogSelectRect) return;
|
|
7372
|
+
|
|
7373
|
+
this.DialogSelectRect.Destroy();
|
|
7374
|
+
this.DialogSelectRect=null;
|
|
7375
|
+
}
|
|
7376
|
+
|
|
7377
|
+
this.DestroyDialogModifyDraw=function()
|
|
7378
|
+
{
|
|
7379
|
+
if (!this.DialogModifyDraw) return;
|
|
7380
|
+
|
|
7381
|
+
this.DialogModifyDraw.Destroy();
|
|
7382
|
+
this.DialogModifyDraw=null;
|
|
7383
|
+
}
|
|
7384
|
+
|
|
7385
|
+
//隐藏内置的弹框div
|
|
7386
|
+
this.HideAllPopDiv=function()
|
|
7387
|
+
{
|
|
7388
|
+
this.HideFloatTooltip();
|
|
7389
|
+
this.CloseTooltipDialog();
|
|
7390
|
+
|
|
7391
|
+
if (this.DialogDrawTool) this.DialogDrawTool.Close();
|
|
7392
|
+
this.CloseModifyDrawDialog();
|
|
7393
|
+
|
|
7394
|
+
if (this.DialogSelectRect) this.DialogSelectRect.Close();
|
|
7395
|
+
if (this.DialogSearchIndex) this.DialogSearchIndex.Close();
|
|
7396
|
+
if (this.DialogModifyIndexParam) this.DialogModifyIndexParam.Close();
|
|
7397
|
+
}
|
|
7351
7398
|
|
|
7352
7399
|
|
|
7353
7400
|
//obj={ Element:, Canvas: }
|
|
@@ -7399,9 +7446,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
7399
7446
|
{
|
|
7400
7447
|
this.IsDestroy=true;
|
|
7401
7448
|
this.StopAutoUpdate();
|
|
7449
|
+
|
|
7402
7450
|
this.DestroyTooltipDialog();
|
|
7403
7451
|
this.DestroyFloatTooltip();
|
|
7452
|
+
|
|
7404
7453
|
this.DestroySearchIndexDialog();
|
|
7454
|
+
this.DestroyDialogModifyIndexParam();
|
|
7455
|
+
|
|
7456
|
+
this.DestroyDialogDrawTool();
|
|
7457
|
+
this.DestroyDialogModifyDraw();
|
|
7458
|
+
|
|
7459
|
+
this.DestroyDialogSelectRect();
|
|
7405
7460
|
}
|
|
7406
7461
|
|
|
7407
7462
|
this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
|
|
@@ -27785,7 +27840,7 @@ function ChartData()
|
|
|
27785
27840
|
return result;
|
|
27786
27841
|
}
|
|
27787
27842
|
|
|
27788
|
-
this.MergeMinuteData=function(data) //合并数据
|
|
27843
|
+
this.MergeMinuteData=function(data, period) //合并数据
|
|
27789
27844
|
{
|
|
27790
27845
|
if (!this.Data || this.Data.length<=0)
|
|
27791
27846
|
{
|
|
@@ -27793,6 +27848,7 @@ function ChartData()
|
|
|
27793
27848
|
return true;
|
|
27794
27849
|
}
|
|
27795
27850
|
|
|
27851
|
+
var bDayPeriod=ChartData.IsDayPeriod(period, true);
|
|
27796
27852
|
var sourceFirstItem=this.Data[0];
|
|
27797
27853
|
var firstItemID=0;
|
|
27798
27854
|
var firstItem=null;
|
|
@@ -27806,11 +27862,23 @@ function ChartData()
|
|
|
27806
27862
|
break;
|
|
27807
27863
|
}
|
|
27808
27864
|
|
|
27809
|
-
if (
|
|
27865
|
+
if (bDayPeriod)
|
|
27810
27866
|
{
|
|
27811
|
-
|
|
27812
|
-
|
|
27813
|
-
|
|
27867
|
+
if (item.Date==sourceFirstItem.Date)
|
|
27868
|
+
{
|
|
27869
|
+
firstItemID=i;
|
|
27870
|
+
firstItem=item;
|
|
27871
|
+
break;
|
|
27872
|
+
}
|
|
27873
|
+
}
|
|
27874
|
+
else
|
|
27875
|
+
{
|
|
27876
|
+
if (item.Date==sourceFirstItem.Date && item.Time>=sourceFirstItem.Time)
|
|
27877
|
+
{
|
|
27878
|
+
firstItemID=i;
|
|
27879
|
+
firstItem=item;
|
|
27880
|
+
break;
|
|
27881
|
+
}
|
|
27814
27882
|
}
|
|
27815
27883
|
}
|
|
27816
27884
|
|
|
@@ -27823,11 +27891,23 @@ function ChartData()
|
|
|
27823
27891
|
var date=this.Data[i].Date;
|
|
27824
27892
|
var time=this.Data[i].Time;
|
|
27825
27893
|
|
|
27826
|
-
if (
|
|
27894
|
+
if (bDayPeriod)
|
|
27827
27895
|
{
|
|
27828
|
-
|
|
27829
|
-
|
|
27830
|
-
|
|
27896
|
+
if (firstItem.Date>date || firstItem.Date==date)
|
|
27897
|
+
{
|
|
27898
|
+
index=i;
|
|
27899
|
+
if (firstItem.Date==date) bFind=true;
|
|
27900
|
+
break;
|
|
27901
|
+
}
|
|
27902
|
+
}
|
|
27903
|
+
else
|
|
27904
|
+
{
|
|
27905
|
+
if (firstItem.Date>date || (firstItem.Date==date && firstItem.Time>=time) )
|
|
27906
|
+
{
|
|
27907
|
+
index=i;
|
|
27908
|
+
if (firstItem.Date==date && firstItem.Time==time) bFind=true;
|
|
27909
|
+
break;
|
|
27910
|
+
}
|
|
27831
27911
|
}
|
|
27832
27912
|
}
|
|
27833
27913
|
|
|
@@ -29741,9 +29821,30 @@ function ChartKLine()
|
|
|
29741
29821
|
DownAreaColor:g_JSChartResource.HLCArea.DownAreaColor,
|
|
29742
29822
|
}
|
|
29743
29823
|
|
|
29744
|
-
//虚线柱子
|
|
29824
|
+
//虚线柱子 (非交易日)
|
|
29745
29825
|
this.VirtualBarConfig={ Color:g_JSChartResource.VirtualKLine.Color, LineDash:g_JSChartResource.VirtualKLine.LineDash };
|
|
29746
29826
|
|
|
29827
|
+
//预测线配置
|
|
29828
|
+
this.PredictionConfig=
|
|
29829
|
+
{
|
|
29830
|
+
Line:
|
|
29831
|
+
{
|
|
29832
|
+
Color:g_JSChartResource.PredictionKLine.Line.Color,
|
|
29833
|
+
LineDash:g_JSChartResource.PredictionKLine.Line.LineDash,
|
|
29834
|
+
LineWidth:g_JSChartResource.PredictionKLine.Line.LineWidth
|
|
29835
|
+
},
|
|
29836
|
+
|
|
29837
|
+
Bar:
|
|
29838
|
+
{
|
|
29839
|
+
UpColor:g_JSChartResource.PredictionKLine.Bar.UpColor,
|
|
29840
|
+
DownColor:g_JSChartResource.PredictionKLine.Bar.DownColor,
|
|
29841
|
+
UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor ,
|
|
29842
|
+
DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
|
|
29843
|
+
},
|
|
29844
|
+
Enable:false, //是否启动
|
|
29845
|
+
};
|
|
29846
|
+
this.AryPredictionCache=[]; //预测数据
|
|
29847
|
+
|
|
29747
29848
|
//DrawType==14 自定义图形
|
|
29748
29849
|
this.FFKChart;
|
|
29749
29850
|
|
|
@@ -29881,6 +29982,22 @@ function ChartKLine()
|
|
|
29881
29982
|
this.OrderFlow.UnchagneColor= { BG:g_JSChartResource.OrderFlow.UnchagneColor.BG, Border:g_JSChartResource.OrderFlow.UnchagneColor.Border };
|
|
29882
29983
|
this.OrderFlow.Text={ Color: g_JSChartResource.OrderFlow.Text.Color , Family:g_JSChartResource.OrderFlow.Text.Family, FontMaxSize:g_JSChartResource.OrderFlow.Text.FontMaxSize, MaxValue:g_JSChartResource.OrderFlow.Text.MaxValue };
|
|
29883
29984
|
this.OrderFlow.Line={ UpDownColor: g_JSChartResource.OrderFlow.Line.UpDownColor, MiddleColor:g_JSChartResource.OrderFlow.Line.MiddleColor };
|
|
29985
|
+
|
|
29986
|
+
this.PredictionConfig.Line=
|
|
29987
|
+
{
|
|
29988
|
+
Color:g_JSChartResource.PredictionKLine.Line.Color,
|
|
29989
|
+
LineDash:g_JSChartResource.PredictionKLine.Line.LineDash,
|
|
29990
|
+
LineWidth:g_JSChartResource.PredictionKLine.Line.LineWidth
|
|
29991
|
+
};
|
|
29992
|
+
|
|
29993
|
+
this.PredictionConfig.Bar=
|
|
29994
|
+
{
|
|
29995
|
+
UpColor:g_JSChartResource.PredictionKLine.Bar.UpColor,
|
|
29996
|
+
DownColor:g_JSChartResource.PredictionKLine.Bar.DownColor,
|
|
29997
|
+
UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor,
|
|
29998
|
+
DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
|
|
29999
|
+
};
|
|
30000
|
+
|
|
29884
30001
|
}
|
|
29885
30002
|
|
|
29886
30003
|
this.ClearCustomKLine=function()
|
|
@@ -30251,6 +30368,8 @@ function ChartKLine()
|
|
|
30251
30368
|
this.DrawKRange.Start=this.Data.DataOffset;
|
|
30252
30369
|
|
|
30253
30370
|
var preKItemInfo=null;
|
|
30371
|
+
var prePoint=null;
|
|
30372
|
+
var xEnd=null; //最后一个点
|
|
30254
30373
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
30255
30374
|
{
|
|
30256
30375
|
var data=this.Data.Data[i];
|
|
@@ -30264,6 +30383,13 @@ function ChartKLine()
|
|
|
30264
30383
|
var yClose=this.GetYFromData(data.Close,false);
|
|
30265
30384
|
this.DrawKRange.End=i;
|
|
30266
30385
|
|
|
30386
|
+
if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
|
|
30387
|
+
{
|
|
30388
|
+
this.AryPredictionCache.push({ PrePoint:prePoint, Point:{ X:x, Y:yClose }});
|
|
30389
|
+
prePoint={ X:x, Y:yClose};
|
|
30390
|
+
continue;
|
|
30391
|
+
}
|
|
30392
|
+
|
|
30267
30393
|
if (bFirstPoint)
|
|
30268
30394
|
{
|
|
30269
30395
|
if (isHScreen)
|
|
@@ -30284,6 +30410,9 @@ function ChartKLine()
|
|
|
30284
30410
|
else this.Canvas.lineTo(x,yClose);
|
|
30285
30411
|
}
|
|
30286
30412
|
|
|
30413
|
+
xEnd=x;
|
|
30414
|
+
prePoint={ X:x, Y:yClose};
|
|
30415
|
+
|
|
30287
30416
|
if (i==this.Data.Data.length-1)
|
|
30288
30417
|
{
|
|
30289
30418
|
ptLast={ X:x, Y:yClose, XLeft:left, XRight:right, KItem:data, ChartRight:chartright };
|
|
@@ -30315,12 +30444,12 @@ function ChartKLine()
|
|
|
30315
30444
|
this.Canvas.stroke();
|
|
30316
30445
|
if (isHScreen)
|
|
30317
30446
|
{
|
|
30318
|
-
this.Canvas.lineTo(border.Left,
|
|
30447
|
+
this.Canvas.lineTo(border.Left,xEnd);
|
|
30319
30448
|
this.Canvas.lineTo(border.Left,firstPoint.Y);
|
|
30320
30449
|
}
|
|
30321
30450
|
else
|
|
30322
30451
|
{
|
|
30323
|
-
this.Canvas.lineTo(
|
|
30452
|
+
this.Canvas.lineTo(xEnd,border.Bottom);
|
|
30324
30453
|
this.Canvas.lineTo(firstPoint.X,border.Bottom);
|
|
30325
30454
|
}
|
|
30326
30455
|
this.Canvas.closePath();
|
|
@@ -30383,11 +30512,12 @@ function ChartKLine()
|
|
|
30383
30512
|
var mapBreakPoint=this.BuildBreakPoint(); //断点
|
|
30384
30513
|
|
|
30385
30514
|
var preKItemInfo=null;
|
|
30515
|
+
var prePoint=null;
|
|
30386
30516
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
30387
30517
|
{
|
|
30388
30518
|
var data=this.Data.Data[i];
|
|
30389
30519
|
this.ShowRange.End=i;
|
|
30390
|
-
if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
30520
|
+
if (!data || data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
30391
30521
|
|
|
30392
30522
|
var left=xOffset;
|
|
30393
30523
|
var right=xOffset+dataWidth;
|
|
@@ -30396,6 +30526,13 @@ function ChartKLine()
|
|
|
30396
30526
|
var yClose=this.GetYFromData(data.Close,false);
|
|
30397
30527
|
this.DrawKRange.End=i;
|
|
30398
30528
|
|
|
30529
|
+
if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
|
|
30530
|
+
{
|
|
30531
|
+
this.AryPredictionCache.push({ PrePoint:prePoint, Point:{ X:x, Y:yClose }});
|
|
30532
|
+
prePoint={ X:x, Y:yClose};
|
|
30533
|
+
continue;
|
|
30534
|
+
}
|
|
30535
|
+
|
|
30399
30536
|
if (bFirstPoint)
|
|
30400
30537
|
{
|
|
30401
30538
|
if (isHScreen) this.Canvas.moveTo(yClose,x);
|
|
@@ -30409,6 +30546,8 @@ function ChartKLine()
|
|
|
30409
30546
|
}
|
|
30410
30547
|
++drawCount;
|
|
30411
30548
|
|
|
30549
|
+
prePoint={ X:x, Y:yClose};
|
|
30550
|
+
|
|
30412
30551
|
if (this.PriceGap.Enable)
|
|
30413
30552
|
{
|
|
30414
30553
|
var yLow=this.GetYFromData(data.Low, false);
|
|
@@ -30483,6 +30622,7 @@ function ChartKLine()
|
|
|
30483
30622
|
}
|
|
30484
30623
|
|
|
30485
30624
|
var preKItemInfo=null;
|
|
30625
|
+
var prePoint=null; //上一个点的位置
|
|
30486
30626
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
30487
30627
|
{
|
|
30488
30628
|
var data=this.Data.Data[i];
|
|
@@ -30532,6 +30672,10 @@ function ChartKLine()
|
|
|
30532
30672
|
{
|
|
30533
30673
|
this.DrawVirtualBar(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
30534
30674
|
}
|
|
30675
|
+
else if (data.IsVirtual && this.PredictionConfig.Enable)
|
|
30676
|
+
{
|
|
30677
|
+
this.DrawPredictionBar(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
30678
|
+
}
|
|
30535
30679
|
else if (kLineOption)
|
|
30536
30680
|
{
|
|
30537
30681
|
var barColor=kLineOption.Color;
|
|
@@ -30613,6 +30757,8 @@ function ChartKLine()
|
|
|
30613
30757
|
if (value>0)
|
|
30614
30758
|
this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
|
|
30615
30759
|
}
|
|
30760
|
+
|
|
30761
|
+
prePoint={ X:x, Y:yClose }; //上一个点
|
|
30616
30762
|
|
|
30617
30763
|
preKItemInfo=kItemInfo;
|
|
30618
30764
|
}
|
|
@@ -31484,6 +31630,82 @@ function ChartKLine()
|
|
|
31484
31630
|
this.Canvas.setLineDash([]);
|
|
31485
31631
|
}
|
|
31486
31632
|
|
|
31633
|
+
this.DrawPredictionBar=function(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen)
|
|
31634
|
+
{
|
|
31635
|
+
var config=this.PredictionConfig.Bar;
|
|
31636
|
+
var drawType=this.DrawType;
|
|
31637
|
+
if (IFrameSplitOperator.IsNumber(config.DrawType)) drawType=config.DrawType;
|
|
31638
|
+
|
|
31639
|
+
if (data.Open<data.Close) //阳线
|
|
31640
|
+
{
|
|
31641
|
+
this.DrawKBar_Up(data, dataWidth, config.UpColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
31642
|
+
}
|
|
31643
|
+
else if (data.Open>data.Close) //阴线
|
|
31644
|
+
{
|
|
31645
|
+
this.DrawKBar_Down(data, dataWidth, config.DownColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
31646
|
+
}
|
|
31647
|
+
else
|
|
31648
|
+
{
|
|
31649
|
+
this.DrawKBar_Unchagne(data, dataWidth, config.UnchangeColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
31650
|
+
}
|
|
31651
|
+
}
|
|
31652
|
+
|
|
31653
|
+
this.DrawPredictionLine=function()
|
|
31654
|
+
{
|
|
31655
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryPredictionCache)) return;
|
|
31656
|
+
|
|
31657
|
+
this.Canvas.save();
|
|
31658
|
+
|
|
31659
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
31660
|
+
var bFirstPoint=true;
|
|
31661
|
+
var drawCount=0;
|
|
31662
|
+
for(var i=0;i<this.AryPredictionCache.length;++i)
|
|
31663
|
+
{
|
|
31664
|
+
var item=this.AryPredictionCache[i];
|
|
31665
|
+
if (bFirstPoint)
|
|
31666
|
+
{
|
|
31667
|
+
bFirstPoint=false;
|
|
31668
|
+
this.Canvas.beginPath();
|
|
31669
|
+
if (item.PrePoint)
|
|
31670
|
+
{
|
|
31671
|
+
var pt=item.PrePoint;
|
|
31672
|
+
if (bHScreen) this.Canvas.moveTo(pt.Y,pt.X); //横屏坐标轴对调
|
|
31673
|
+
else this.Canvas.moveTo(pt.X,pt.Y);
|
|
31674
|
+
|
|
31675
|
+
var pt=item.Point;
|
|
31676
|
+
if (bHScreen) this.Canvas.lineTo(pt.Y,pt.X);
|
|
31677
|
+
else this.Canvas.lineTo(pt.X,pt.Y);
|
|
31678
|
+
}
|
|
31679
|
+
else if (item.Point)
|
|
31680
|
+
{
|
|
31681
|
+
var pt=item.Point;
|
|
31682
|
+
if (bHScreen) this.Canvas.moveTo(pt.Y,pt.X); //横屏坐标轴对调
|
|
31683
|
+
else this.Canvas.moveTo(pt.X,pt.Y);
|
|
31684
|
+
}
|
|
31685
|
+
}
|
|
31686
|
+
else
|
|
31687
|
+
{
|
|
31688
|
+
var pt=item.Point;
|
|
31689
|
+
if (bHScreen) this.Canvas.lineTo(pt.Y,pt.X);
|
|
31690
|
+
else this.Canvas.lineTo(pt.X,pt.Y);
|
|
31691
|
+
}
|
|
31692
|
+
|
|
31693
|
+
++drawCount;
|
|
31694
|
+
}
|
|
31695
|
+
|
|
31696
|
+
if (drawCount>0)
|
|
31697
|
+
{
|
|
31698
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
31699
|
+
var config=this.PredictionConfig.Line;
|
|
31700
|
+
this.Canvas.strokeStyle=config.Color;
|
|
31701
|
+
if (IFrameSplitOperator.IsNumber(config.LineWidth)) this.Canvas.lineWidth=config.LineWidth*pixelRatio;
|
|
31702
|
+
if (IFrameSplitOperator.IsNonEmptyArray(config.LineDash)) this.Canvas.setLineDash(config.LineDash)
|
|
31703
|
+
this.Canvas.stroke();
|
|
31704
|
+
}
|
|
31705
|
+
|
|
31706
|
+
this.Canvas.restore();
|
|
31707
|
+
}
|
|
31708
|
+
|
|
31487
31709
|
this.DrawRenkoCandle=function() //砖型K线
|
|
31488
31710
|
{
|
|
31489
31711
|
var isHScreen=(this.ChartFrame.IsHScreen===true);
|
|
@@ -32300,6 +32522,7 @@ function ChartKLine()
|
|
|
32300
32522
|
this.PtMin={X:null,Y:null,Value:null,Align:'left'}; //清空最小
|
|
32301
32523
|
this.DrawKRange={ Start:null, End:null };
|
|
32302
32524
|
this.AryPriceGapCache=[];
|
|
32525
|
+
this.AryPredictionCache=[];
|
|
32303
32526
|
|
|
32304
32527
|
this.ChartFrame.ChartKLine={Max:null, Min:null }; //保存K线上 显示最大最小值坐标
|
|
32305
32528
|
|
|
@@ -32340,6 +32563,7 @@ function ChartKLine()
|
|
|
32340
32563
|
{
|
|
32341
32564
|
this.DrawCloseLine();
|
|
32342
32565
|
this.Canvas.restore();
|
|
32566
|
+
this.DrawPredictionLine();
|
|
32343
32567
|
if (this.PriceGap.Enable) this.DrawPriceGap();
|
|
32344
32568
|
return;
|
|
32345
32569
|
}
|
|
@@ -32412,6 +32636,7 @@ function ChartKLine()
|
|
|
32412
32636
|
|
|
32413
32637
|
this.Canvas.restore();
|
|
32414
32638
|
|
|
32639
|
+
this.DrawPredictionLine();
|
|
32415
32640
|
if (this.PriceGap.Enable) this.DrawPriceGap();
|
|
32416
32641
|
|
|
32417
32642
|
if (this.IsShowMaxMinPrice) //标注最大值最小值
|
|
@@ -39191,6 +39416,7 @@ function ChartVolStick()
|
|
|
39191
39416
|
var value=this.Data.Data[i];
|
|
39192
39417
|
var kItem=this.HistoryData.Data[i];
|
|
39193
39418
|
if (value==null || kItem==null) continue;
|
|
39419
|
+
if (!IFrameSplitOperator.IsNumber(value)) continue;
|
|
39194
39420
|
if (value==0) continue;
|
|
39195
39421
|
|
|
39196
39422
|
var left=xOffset;
|
|
@@ -39780,23 +40006,22 @@ function ChartStickLine()
|
|
|
39780
40006
|
delete this.newMethod;
|
|
39781
40007
|
|
|
39782
40008
|
this.ClassName='ChartStickLine'; //类名
|
|
39783
|
-
this.Color="rgb(255,193,37)";
|
|
39784
|
-
this.BarType=0;
|
|
39785
|
-
this.LineDotted=[3,3];
|
|
39786
|
-
this.Width=0;
|
|
40009
|
+
this.Color="rgb(255,193,37)"; //线段颜色
|
|
40010
|
+
this.BarType=0; //柱子类型 0=实心 1=空心 -1=画虚线空心柱
|
|
40011
|
+
this.LineDotted=[3,3]; //虚线设置
|
|
40012
|
+
this.Width=0; //柱子宽度 0=1 3,50=k线宽度 101=K线宽度+间距宽度
|
|
40013
|
+
this.IsHScreen=false;
|
|
40014
|
+
|
|
40015
|
+
this.EmptyBGColor=null; //空心柱子背景色(缓存)
|
|
40016
|
+
this.BarCache={ }; //Type:1=线段 2=柱子
|
|
39787
40017
|
|
|
39788
40018
|
this.SetEmptyBar=function() //设置空心柱子
|
|
39789
40019
|
{
|
|
39790
40020
|
if (this.BarType!=1 && this.BarType!=-1) return false;
|
|
39791
40021
|
|
|
39792
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
39793
|
-
this.Canvas.strokeStyle=this.Color;
|
|
39794
40022
|
var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
|
|
39795
|
-
if (emptyBGColor) this.
|
|
39796
|
-
if (this.BarType==-1)
|
|
39797
|
-
{
|
|
39798
|
-
this.Canvas.setLineDash(this.LineDotted); //虚线
|
|
39799
|
-
}
|
|
40023
|
+
if (emptyBGColor) this.BarCache.EmptyBGColor=emptyBGColor;
|
|
40024
|
+
if (this.BarType==-1) this.BarCache.LineDotted=this.LineDotted;
|
|
39800
40025
|
|
|
39801
40026
|
return true;
|
|
39802
40027
|
}
|
|
@@ -39806,13 +40031,6 @@ function ChartStickLine()
|
|
|
39806
40031
|
return (this.BarType==1 || this.BarType==-1);
|
|
39807
40032
|
}
|
|
39808
40033
|
|
|
39809
|
-
this.CalculateBarHeight=function(y,y2)
|
|
39810
|
-
{
|
|
39811
|
-
var barHeight=Math.abs(y-y2);
|
|
39812
|
-
if (barHeight<=0) barHeight=1;
|
|
39813
|
-
return barHeight;
|
|
39814
|
-
}
|
|
39815
|
-
|
|
39816
40034
|
this.Draw=function()
|
|
39817
40035
|
{
|
|
39818
40036
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
@@ -39827,81 +40045,93 @@ function ChartStickLine()
|
|
|
39827
40045
|
|
|
39828
40046
|
if (!this.Data || !this.Data.Data) return;
|
|
39829
40047
|
|
|
39830
|
-
var
|
|
40048
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
40049
|
+
this.BarCache={ Color:this.Color, EmptyBGColor:null, Width:1*pixelRatio, Type:0, LineDotted:null };
|
|
40050
|
+
|
|
40051
|
+
this.IsHScreen=(this.ChartFrame.IsHScreen===true);;
|
|
39831
40052
|
var dataWidth=this.ChartFrame.DataWidth;
|
|
39832
40053
|
var distanceWidth=this.ChartFrame.DistanceWidth;
|
|
39833
40054
|
var chartright=this.ChartBorder.GetRight();
|
|
39834
|
-
var zoomIndex=this.ChartFrame.ZoomIndex;
|
|
39835
|
-
if (isHScreen) chartright=this.ChartBorder.GetBottom();
|
|
39836
40055
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
39837
40056
|
var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
39838
|
-
if (
|
|
40057
|
+
if (this.IsHScreen)
|
|
40058
|
+
{
|
|
40059
|
+
chartright=this.ChartBorder.GetBottom();
|
|
40060
|
+
xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
40061
|
+
}
|
|
39839
40062
|
|
|
39840
40063
|
var isMinute=this.IsMinuteFrame();
|
|
39841
40064
|
|
|
39842
|
-
this.Canvas.save();
|
|
39843
|
-
var bFillBar=false;
|
|
39844
|
-
var bFillKLine=false;
|
|
39845
|
-
var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
|
|
39846
|
-
|
|
39847
40065
|
if (isMinute)
|
|
39848
40066
|
{
|
|
39849
|
-
if (this.Width>1) this.
|
|
39850
|
-
|
|
39851
|
-
this.Canvas.strokeStyle=this.Color;
|
|
40067
|
+
if (this.Width>1) this.BarCache.Width=2*pixelRatio;
|
|
40068
|
+
this.BarCache.Type=1;
|
|
39852
40069
|
}
|
|
39853
|
-
else if(this.Width
|
|
40070
|
+
else if(this.Width<=0) //宽度时0,使用宽度1
|
|
39854
40071
|
{
|
|
40072
|
+
this.BarCache.Type=1;
|
|
39855
40073
|
this.SetEmptyBar();
|
|
39856
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
39857
|
-
this.Canvas.strokeStyle=this.Color;
|
|
39858
40074
|
}
|
|
39859
40075
|
else if (this.Width==3 || this.Width==50) //3和50 K线宽度
|
|
39860
40076
|
{
|
|
40077
|
+
this.BarCache.Type=1;
|
|
39861
40078
|
if (dataWidth>=4)
|
|
39862
40079
|
{
|
|
39863
|
-
|
|
40080
|
+
this.BarCache.Type=2;
|
|
40081
|
+
this.BarCache.Width=dataWidth;
|
|
39864
40082
|
this.SetEmptyBar();
|
|
39865
|
-
if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
|
|
39866
|
-
this.Canvas.strokeStyle=this.Color;
|
|
39867
40083
|
}
|
|
39868
|
-
else //太细了 画竖线
|
|
39869
|
-
{
|
|
39870
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
39871
|
-
this.Canvas.strokeStyle=this.Color;
|
|
39872
|
-
}
|
|
39873
40084
|
}
|
|
39874
|
-
else if (this.Width==101)
|
|
40085
|
+
else if (this.Width==101) //柱子+间距
|
|
39875
40086
|
{
|
|
39876
|
-
|
|
39877
|
-
|
|
39878
|
-
|
|
40087
|
+
this.BarCache.Type=1;
|
|
40088
|
+
var lineWidth=dataWidth+distanceWidth+1*pixelRatio;
|
|
40089
|
+
if (lineWidth>=4)
|
|
40090
|
+
{
|
|
40091
|
+
this.BarCache.Type=2;
|
|
40092
|
+
this.BarCache.Width=lineWidth
|
|
40093
|
+
this.SetEmptyBar();
|
|
40094
|
+
}
|
|
39879
40095
|
}
|
|
39880
40096
|
else if (this.Width<=3)
|
|
39881
40097
|
{
|
|
39882
|
-
var minWidth=2*
|
|
40098
|
+
var minWidth=2*pixelRatio;
|
|
39883
40099
|
var barWidth=dataWidth*(this.Width/3);
|
|
39884
40100
|
if (barWidth<minWidth) barWidth=minWidth;
|
|
39885
|
-
this.
|
|
39886
|
-
if (
|
|
39887
|
-
|
|
40101
|
+
this.BarCache.Type=1;
|
|
40102
|
+
if (barWidth>=4)
|
|
40103
|
+
{
|
|
40104
|
+
this.BarCache.Type=2;
|
|
40105
|
+
this.BarCache.Width=barWidth;
|
|
40106
|
+
this.SetEmptyBar();
|
|
40107
|
+
}
|
|
39888
40108
|
}
|
|
39889
40109
|
else
|
|
39890
40110
|
{
|
|
39891
|
-
var barWidth=this.Width*
|
|
40111
|
+
var barWidth=this.Width*pixelRatio+dataWidth;
|
|
40112
|
+
this.BarCache.Type=2;
|
|
40113
|
+
this.BarCache.Width=barWidth;
|
|
39892
40114
|
this.SetEmptyBar();
|
|
39893
|
-
if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
|
|
39894
|
-
bFillBar=true;
|
|
39895
40115
|
}
|
|
39896
40116
|
|
|
40117
|
+
this.Canvas.save();
|
|
40118
|
+
this.ClipClient(this.IsHScreen);
|
|
40119
|
+
|
|
40120
|
+
this.Canvas.strokeStyle=this.BarCache.Color;
|
|
40121
|
+
if (this.BarCache.EmptyBGColor) this.Canvas.fillStyle=this.BarCache.EmptyBGColor; //空心柱子
|
|
40122
|
+
else this.Canvas.fillStyle=this.BarCache.Color;
|
|
40123
|
+
if (IFrameSplitOperator.IsNonEmptyArray(this.BarCache.LineDotted)) this.Canvas.setLineDash(this.BarCache.LineDotted); //虚线
|
|
40124
|
+
if (this.BarCache.Type==1) this.Canvas.lineWidth=this.BarCache.Width;
|
|
40125
|
+
|
|
39897
40126
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
39898
40127
|
{
|
|
39899
40128
|
var value=this.Data.Data[i];
|
|
39900
|
-
if (value
|
|
40129
|
+
if (!value) continue;
|
|
40130
|
+
if (!IFrameSplitOperator.IsNumber(value.Value)) continue;
|
|
39901
40131
|
|
|
39902
40132
|
var price=value.Value;
|
|
39903
|
-
var price2=
|
|
39904
|
-
if (
|
|
40133
|
+
var price2=0;
|
|
40134
|
+
if (IFrameSplitOperator.IsNumber(value.Value2)) price2=value.Value2;
|
|
39905
40135
|
|
|
39906
40136
|
if (isMinute)
|
|
39907
40137
|
{
|
|
@@ -39914,103 +40144,79 @@ function ChartStickLine()
|
|
|
39914
40144
|
var x=left+(right-left)/2;
|
|
39915
40145
|
}
|
|
39916
40146
|
|
|
39917
|
-
var y=this.ChartFrame.GetYFromData(price);
|
|
39918
|
-
var y2=this.ChartFrame.GetYFromData(price2);
|
|
40147
|
+
var y=this.ChartFrame.GetYFromData(price,false);
|
|
40148
|
+
var y2=this.ChartFrame.GetYFromData(price2,false);
|
|
39919
40149
|
|
|
39920
40150
|
if (x>chartright) break;
|
|
39921
40151
|
|
|
39922
|
-
|
|
39923
|
-
|
|
39924
|
-
|
|
39925
|
-
{
|
|
39926
|
-
var left=x-barWidth/2;
|
|
39927
|
-
var width=barWidth;
|
|
39928
|
-
if (this.IsEmptyBar()) //空心
|
|
39929
|
-
{
|
|
39930
|
-
this.Canvas.beginPath();
|
|
39931
|
-
this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
|
|
39932
|
-
this.Canvas.stroke();
|
|
39933
|
-
}
|
|
39934
|
-
else
|
|
39935
|
-
{
|
|
39936
|
-
this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
|
|
39937
|
-
}
|
|
39938
|
-
}
|
|
39939
|
-
else
|
|
39940
|
-
{
|
|
39941
|
-
var left=x-barWidth/2;
|
|
39942
|
-
var width=barWidth;
|
|
39943
|
-
if (left+width>chartright) width=chartright-left; //不要超过右边框子
|
|
39944
|
-
if (this.IsEmptyBar()) //空心
|
|
39945
|
-
{
|
|
39946
|
-
if (emptyBGColor)
|
|
39947
|
-
this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(Math.abs(y-y2)));
|
|
40152
|
+
var xCenter=x;
|
|
40153
|
+
var yTop=Math.min(y,y2);
|
|
40154
|
+
var barHeight=Math.abs(y-y2); //柱子高度
|
|
39948
40155
|
|
|
39949
|
-
|
|
39950
|
-
|
|
39951
|
-
|
|
39952
|
-
|
|
39953
|
-
|
|
39954
|
-
|
|
39955
|
-
|
|
39956
|
-
|
|
39957
|
-
|
|
40156
|
+
this.DrawBar(xCenter, yTop, barHeight);
|
|
40157
|
+
}
|
|
40158
|
+
|
|
40159
|
+
this.Canvas.restore();
|
|
40160
|
+
}
|
|
40161
|
+
|
|
40162
|
+
this.DrawBar=function(xCenter, ytop, barHeight)
|
|
40163
|
+
{
|
|
40164
|
+
if (barHeight<1) barHeight=1;
|
|
40165
|
+
|
|
40166
|
+
if (this.BarCache.Type==1) //线段
|
|
40167
|
+
{
|
|
40168
|
+
if (this.IsHScreen)
|
|
40169
|
+
{
|
|
40170
|
+
this.Canvas.beginPath();
|
|
40171
|
+
this.Canvas.moveTo(ytop,ToFixedPoint(xCenter));
|
|
40172
|
+
this.Canvas.lineTo(ytop+barHeight,ToFixedPoint(xCenter));
|
|
40173
|
+
this.Canvas.stroke();
|
|
39958
40174
|
}
|
|
39959
|
-
else
|
|
40175
|
+
else
|
|
40176
|
+
{
|
|
40177
|
+
this.Canvas.beginPath();
|
|
40178
|
+
this.Canvas.moveTo(ToFixedPoint(xCenter),ytop);
|
|
40179
|
+
this.Canvas.lineTo(ToFixedPoint(xCenter),ytop+barHeight);
|
|
40180
|
+
this.Canvas.stroke();
|
|
40181
|
+
}
|
|
40182
|
+
}
|
|
40183
|
+
else if (this.BarCache.Type==2) //柱子
|
|
40184
|
+
{
|
|
40185
|
+
if (this.IsHScreen)
|
|
39960
40186
|
{
|
|
39961
|
-
|
|
40187
|
+
var xLeft=xCenter-this.BarCache.Width/2;
|
|
40188
|
+
if (this.IsEmptyBar()) //空心
|
|
39962
40189
|
{
|
|
39963
|
-
if (
|
|
39964
|
-
|
|
39965
|
-
this.Canvas.beginPath();
|
|
39966
|
-
this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
|
|
39967
|
-
this.Canvas.stroke();
|
|
39968
|
-
}
|
|
39969
|
-
else
|
|
39970
|
-
{
|
|
39971
|
-
if (emptyBGColor)
|
|
39972
|
-
this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(y-y2)));
|
|
40190
|
+
if (this.BarCache.EmptyBGColor) //背景色填充
|
|
40191
|
+
this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
39973
40192
|
|
|
39974
|
-
|
|
39975
|
-
|
|
39976
|
-
|
|
39977
|
-
}
|
|
40193
|
+
this.Canvas.beginPath();
|
|
40194
|
+
this.Canvas.rect(ToFixedPoint(ytop),ToFixedPoint(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
40195
|
+
this.Canvas.stroke();
|
|
39978
40196
|
}
|
|
39979
40197
|
else
|
|
39980
40198
|
{
|
|
39981
|
-
|
|
39982
|
-
{
|
|
39983
|
-
this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
|
|
39984
|
-
}
|
|
39985
|
-
else
|
|
39986
|
-
{
|
|
39987
|
-
this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(this.CalculateBarHeight(y,y2)));
|
|
39988
|
-
}
|
|
39989
|
-
|
|
40199
|
+
this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
39990
40200
|
}
|
|
39991
40201
|
}
|
|
39992
40202
|
else
|
|
39993
40203
|
{
|
|
39994
|
-
|
|
40204
|
+
var xLeft=xCenter-this.BarCache.Width/2;
|
|
40205
|
+
if (this.IsEmptyBar()) //空心
|
|
39995
40206
|
{
|
|
40207
|
+
if (this.BarCache.EmptyBGColor) //背景色填充
|
|
40208
|
+
this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
40209
|
+
|
|
39996
40210
|
this.Canvas.beginPath();
|
|
39997
|
-
this.Canvas.
|
|
39998
|
-
this.Canvas.lineTo(y2,ToFixedPoint(x));
|
|
40211
|
+
this.Canvas.rect(ToFixedPoint(xLeft),ToFixedPoint(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
39999
40212
|
this.Canvas.stroke();
|
|
40000
40213
|
}
|
|
40001
40214
|
else
|
|
40002
40215
|
{
|
|
40003
|
-
|
|
40004
|
-
this.Canvas.beginPath();
|
|
40005
|
-
this.Canvas.moveTo(xFix,y);
|
|
40006
|
-
if (Math.abs(y-y2)>0) this.Canvas.lineTo(xFix,y2);
|
|
40007
|
-
else this.Canvas.lineTo(xFix,y+1); //太窄了,就画一个像素的宽度
|
|
40008
|
-
this.Canvas.stroke();
|
|
40216
|
+
this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
40009
40217
|
}
|
|
40010
40218
|
}
|
|
40011
40219
|
}
|
|
40012
|
-
|
|
40013
|
-
this.Canvas.restore();
|
|
40014
40220
|
}
|
|
40015
40221
|
|
|
40016
40222
|
this.GetMaxMin=function()
|
|
@@ -76128,6 +76334,24 @@ function JSChartResource()
|
|
|
76128
76334
|
LineDash:[2,2]
|
|
76129
76335
|
};
|
|
76130
76336
|
|
|
76337
|
+
this.PredictionKLine=
|
|
76338
|
+
{
|
|
76339
|
+
Line:
|
|
76340
|
+
{
|
|
76341
|
+
Color:"rgb(100,100,100)",
|
|
76342
|
+
LineDash:[3,5],
|
|
76343
|
+
LineWidth:2,
|
|
76344
|
+
},
|
|
76345
|
+
|
|
76346
|
+
Bar:
|
|
76347
|
+
{
|
|
76348
|
+
UpColor:"rgb(65,105,225)",
|
|
76349
|
+
DownColor:"rgb(65,105,225)",
|
|
76350
|
+
UnchangeColor:"rgb(65,105,225s)" ,
|
|
76351
|
+
DrawType:3
|
|
76352
|
+
}
|
|
76353
|
+
};
|
|
76354
|
+
|
|
76131
76355
|
this.PriceGapStyple=
|
|
76132
76356
|
{
|
|
76133
76357
|
Line:{ Color:"rgb(186,186,186)" },
|
|
@@ -77528,6 +77752,28 @@ function JSChartResource()
|
|
|
77528
77752
|
if (item.LineDash) this.VirtualKLine.LineDash=item.LineDash;
|
|
77529
77753
|
}
|
|
77530
77754
|
|
|
77755
|
+
if (style.PredictionKLine)
|
|
77756
|
+
{
|
|
77757
|
+
if (style.PredictionKLine.Line)
|
|
77758
|
+
{
|
|
77759
|
+
var item=style.PredictionKLine.Line;
|
|
77760
|
+
var dest=this.PredictionKLine.Line;
|
|
77761
|
+
if (item.Color) dest.Color=item.Color;
|
|
77762
|
+
if (item.LineDash) dest.LineDash=item.LineDash;
|
|
77763
|
+
if (IFrameSplitOperator.IsNumber(item.LineWidth)) dest.LineWidth=item.LineWidth;
|
|
77764
|
+
}
|
|
77765
|
+
|
|
77766
|
+
if (style.PredictionKLine.Bar)
|
|
77767
|
+
{
|
|
77768
|
+
var item=style.PredictionKLine.Bar;
|
|
77769
|
+
var dest=this.PredictionKLine.Bar;
|
|
77770
|
+
if (item.UpColor) dest.UpColor=item.UpColor;
|
|
77771
|
+
if (item.DownColor) dest.DownColor=item.DownColor;
|
|
77772
|
+
if (item.UnchangeColor) dest.UnchangeColor=item.UnchangeColor;
|
|
77773
|
+
if (IFrameSplitOperator.IsNumber(item.DrawType) || item.DrawType===null) dest.DrawType=item.DrawType;
|
|
77774
|
+
}
|
|
77775
|
+
}
|
|
77776
|
+
|
|
77531
77777
|
if (style.PriceGapStyple)
|
|
77532
77778
|
{
|
|
77533
77779
|
var item=style.PriceGapStyple;
|
|
@@ -82407,9 +82653,90 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82407
82653
|
});
|
|
82408
82654
|
}
|
|
82409
82655
|
|
|
82656
|
+
|
|
82657
|
+
this.RecvRealtimeDataV2=function(data)
|
|
82658
|
+
{
|
|
82659
|
+
var aryRealtimeData=KLineChartContainer.JsonDataToRealtimeDataV2(data,this.Symbol);
|
|
82660
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryRealtimeData)) return;
|
|
82661
|
+
|
|
82662
|
+
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
82663
|
+
var lastSourceDataCount=this.SourceData.Data.length;
|
|
82664
|
+
if (!this.SourceData.MergeMinuteData(aryRealtimeData, this.Period)) return;
|
|
82665
|
+
|
|
82666
|
+
var bindData=new ChartData();
|
|
82667
|
+
bindData.Data=this.SourceData.Data;
|
|
82668
|
+
bindData.Period=this.Period;
|
|
82669
|
+
bindData.Right=this.Right;
|
|
82670
|
+
bindData.DataType=this.SourceData.DataType;
|
|
82671
|
+
bindData.Symbol=this.Symbol;
|
|
82672
|
+
|
|
82673
|
+
//if (bindData.Right>0 && ChartData.IsDayPeriod(bindData.Period,true) && MARKET_SUFFIX_NAME.IsSHSZStockA(this.Symbol) && !this.IsApiPeriod) //复权(A股日线数据才复权)
|
|
82674
|
+
if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsEnableRight(bindData.Period,this.Symbol,this.RightFormula) && !this.IsApiPeriod && ChartData.IsDayPeriod(bindData.Period,true)) //复权
|
|
82675
|
+
{
|
|
82676
|
+
var rightData=bindData.GetRightData(bindData.Right,{ AlgorithmType: this.RightFormula });
|
|
82677
|
+
bindData.Data=rightData;
|
|
82678
|
+
}
|
|
82679
|
+
|
|
82680
|
+
if (!this.IsApiPeriod)
|
|
82681
|
+
{
|
|
82682
|
+
if (ChartData.IsDayPeriod(bindData.Period,false) || ChartData.IsMinutePeriod(bindData.Period,false)) //周期数据 (0= 日线,4=1分钟线 不需要处理)
|
|
82683
|
+
{
|
|
82684
|
+
var periodData=bindData.GetPeriodData(bindData.Period);
|
|
82685
|
+
bindData.Data=periodData;
|
|
82686
|
+
}
|
|
82687
|
+
}
|
|
82688
|
+
|
|
82689
|
+
var kLineCalculate=this.GetKLineCalulate();
|
|
82690
|
+
if (kLineCalculate) //额外的K线图形计算
|
|
82691
|
+
{
|
|
82692
|
+
var newBindData=kLineCalculate.RecvHistoryData(bindData, { Symbol:this.Symbol, Function:"RecvRealtimeData" });
|
|
82693
|
+
bindData=newBindData;
|
|
82694
|
+
this.FlowCapitalReady=true;
|
|
82695
|
+
}
|
|
82696
|
+
|
|
82697
|
+
this.UpdateMainData(bindData,lastDataCount);//更新主图数据
|
|
82698
|
+
this.UpdateOverlayRealtimeDataV2(data); //更新叠加股票数据
|
|
82699
|
+
this.BindInstructionIndexData(bindData); //执行指示脚本
|
|
82700
|
+
|
|
82701
|
+
for(var i=0; i<this.Frame.SubFrame.length; ++i)
|
|
82702
|
+
{
|
|
82703
|
+
this.BindIndexData(i,bindData, { CheckRunCount:true });
|
|
82704
|
+
}
|
|
82705
|
+
|
|
82706
|
+
this.BindAllOverlayIndexData(bindData, { CheckRunCount:true, SyncExecute:true }); //同步模式叠加指标
|
|
82707
|
+
|
|
82708
|
+
//刷新画图
|
|
82709
|
+
this.UpdataDataoffset(); //更新数据偏移
|
|
82710
|
+
this.UpdatePointByCursorIndex(1); //更新十字光标位子
|
|
82711
|
+
this.UpdateFrameMaxMin(); //调整坐标最大 最小值
|
|
82712
|
+
this.Frame.SetSizeChage(true);
|
|
82713
|
+
this.Draw();
|
|
82714
|
+
|
|
82715
|
+
this.SendKLineUpdateEvent(bindData);
|
|
82716
|
+
this.UpdateDOMTooltip(0, bindData);
|
|
82717
|
+
this.UpdateHQFloatTooltip(bindData);
|
|
82718
|
+
|
|
82719
|
+
//叠加指标计算
|
|
82720
|
+
this.BindAllOverlayIndexData(bindData, { CheckRunCount:true,SyncExecute:false }); //异步模式叠加指标
|
|
82721
|
+
|
|
82722
|
+
if (this.mapEvent.has(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA))
|
|
82723
|
+
{
|
|
82724
|
+
var event=this.mapEvent.get(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA);
|
|
82725
|
+
var data={ HistoryData:bindData, Stock:{Symbol:this.Symbol, Name:this.Name } }
|
|
82726
|
+
event.Callback(event,data,this);
|
|
82727
|
+
}
|
|
82728
|
+
}
|
|
82729
|
+
|
|
82410
82730
|
this.RecvRealtimeData=function(data)
|
|
82411
82731
|
{
|
|
82412
82732
|
if (this.IsOnTouch==true) return; //正在操作中不更新数据
|
|
82733
|
+
|
|
82734
|
+
if (data.Ver==3.0)
|
|
82735
|
+
{
|
|
82736
|
+
this.RecvRealtimeDataV2(data);
|
|
82737
|
+
return;
|
|
82738
|
+
}
|
|
82739
|
+
|
|
82413
82740
|
var realtimeData=KLineChartContainer.JsonDataToRealtimeData(data,this.Symbol);
|
|
82414
82741
|
if (!realtimeData) return;
|
|
82415
82742
|
|
|
@@ -82590,6 +82917,47 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82590
82917
|
}
|
|
82591
82918
|
}
|
|
82592
82919
|
|
|
82920
|
+
this.UpdateOverlayRealtimeDataV2=function(data)
|
|
82921
|
+
{
|
|
82922
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.OverlayChartPaint)) return;
|
|
82923
|
+
|
|
82924
|
+
for(var i=0; i<this.OverlayChartPaint.length; ++i)
|
|
82925
|
+
{
|
|
82926
|
+
var item=this.OverlayChartPaint[i];
|
|
82927
|
+
if (!item.Symbol) continue;
|
|
82928
|
+
if (!item.MainData) continue; //等待主图股票数据未下载完
|
|
82929
|
+
if (item.Status!=OVERLAY_STATUS_ID.STATUS_FINISHED_ID) continue;
|
|
82930
|
+
var aryRealtimeData=KLineChartContainer.JsonDataToRealtimeDataV2(data,item.Symbol); //获取叠加股票的最新数据
|
|
82931
|
+
if (!aryRealtimeData) continue;
|
|
82932
|
+
var sourceData=item.SourceData; //叠加股票的所有数据
|
|
82933
|
+
sourceData.MergeMinuteData(aryRealtimeData, this.Period);
|
|
82934
|
+
|
|
82935
|
+
var bindData=new ChartData();
|
|
82936
|
+
bindData.Data=sourceData.Data;
|
|
82937
|
+
bindData.Period=this.Period;
|
|
82938
|
+
bindData.Right=this.Right;
|
|
82939
|
+
bindData.DataType=0;
|
|
82940
|
+
|
|
82941
|
+
//if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsSHSZStockA(data.symbol) && !this.IsApiPeriod) //复权数据 ,A股才有有复权
|
|
82942
|
+
if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsEnableRight(bindData.Right, data.Symbol) && !this.IsApiPeriod)
|
|
82943
|
+
{
|
|
82944
|
+
var rightData=bindData.GetRightData(bindData.Right, { AlgorithmType: this.RightFormula });
|
|
82945
|
+
bindData.Data=rightData;
|
|
82946
|
+
}
|
|
82947
|
+
|
|
82948
|
+
var aryOverlayData=this.SourceData.GetOverlayData(bindData.Data, this.IsApiPeriod); //和主图数据拟合以后的数据
|
|
82949
|
+
bindData.Data=aryOverlayData;
|
|
82950
|
+
|
|
82951
|
+
if (ChartData.IsDayPeriod(bindData.Period,false) && !this.IsApiPeriod) //周期数据
|
|
82952
|
+
{
|
|
82953
|
+
var periodData=bindData.GetPeriodData(bindData.Period);
|
|
82954
|
+
bindData.Data=periodData;
|
|
82955
|
+
}
|
|
82956
|
+
|
|
82957
|
+
item.Data=bindData;
|
|
82958
|
+
}
|
|
82959
|
+
}
|
|
82960
|
+
|
|
82593
82961
|
this.RequestMinuteRealtimeData=function()
|
|
82594
82962
|
{
|
|
82595
82963
|
var self=this;
|
|
@@ -82711,7 +83079,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82711
83079
|
if (this.IsApiPeriod) this.ReduceSourceData(); //减少数据
|
|
82712
83080
|
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
82713
83081
|
if (!this.SourceData) return;
|
|
82714
|
-
if (!this.SourceData.MergeMinuteData(aryMinuteData)) return;
|
|
83082
|
+
if (!this.SourceData.MergeMinuteData(aryMinuteData, this.Period)) return;
|
|
82715
83083
|
|
|
82716
83084
|
JSConsole.Chart.Log(`[KLineChartContainer::RecvMinuteRealtimeDataV2] update kline by 1 minute data [${lastDataCount}->${this.SourceData.Data.length}], IsAutoSyncDataOffset=${this.IsAutoSyncDataOffset}`);
|
|
82717
83085
|
|
|
@@ -82794,7 +83162,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82794
83162
|
if (this.IsApiPeriod) this.ReduceSourceData(); //减少数据
|
|
82795
83163
|
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
82796
83164
|
var lastSourceDataCount=this.SourceData.Data.length;
|
|
82797
|
-
if (!this.SourceData.MergeMinuteData(realtimeData)) return;
|
|
83165
|
+
if (!this.SourceData.MergeMinuteData(realtimeData, this.Period)) return;
|
|
82798
83166
|
|
|
82799
83167
|
JSConsole.Chart.Log(`[KLineChartContainer::RecvMinuteRealtimeData] update kline by 1 minute data [${lastSourceDataCount}->${this.SourceData.Data.length}]`);
|
|
82800
83168
|
|
|
@@ -82865,7 +83233,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82865
83233
|
var realtimeData=KLineChartContainer.JsonDataToMinuteRealtimeData(data,item.Symbol); //获取叠加股票的最新数据
|
|
82866
83234
|
if (!realtimeData) continue;
|
|
82867
83235
|
var sourceData=item.SourceData; //叠加股票的所有数据
|
|
82868
|
-
if (!sourceData.MergeMinuteData(realtimeData)) return;
|
|
83236
|
+
if (!sourceData.MergeMinuteData(realtimeData,this.Period)) return;
|
|
82869
83237
|
|
|
82870
83238
|
var bindData=new ChartData();
|
|
82871
83239
|
bindData.Data=sourceData.Data;
|
|
@@ -87696,6 +88064,27 @@ KLineChartContainer.JsonDataToHistoryData=function(data)
|
|
|
87696
88064
|
return aryDayData;
|
|
87697
88065
|
}
|
|
87698
88066
|
|
|
88067
|
+
|
|
88068
|
+
KLineChartContainer.JsonDataToRealtimeDataV2=function(data, symbol)
|
|
88069
|
+
{
|
|
88070
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(data.stock)) return null;
|
|
88071
|
+
|
|
88072
|
+
var finder=null;
|
|
88073
|
+
for(var i=0;i<data.stock.length;++i)
|
|
88074
|
+
{
|
|
88075
|
+
var item=data.stock[i];
|
|
88076
|
+
if (item.symbol==symbol)
|
|
88077
|
+
{
|
|
88078
|
+
finder=item;
|
|
88079
|
+
break;
|
|
88080
|
+
}
|
|
88081
|
+
}
|
|
88082
|
+
|
|
88083
|
+
if (!finder) return null;
|
|
88084
|
+
|
|
88085
|
+
return KLineChartContainer.JsonDataToHistoryData(finder);
|
|
88086
|
+
}
|
|
88087
|
+
|
|
87699
88088
|
KLineChartContainer.JsonDataToRealtimeData=function(data, symbol)
|
|
87700
88089
|
{
|
|
87701
88090
|
if (!data.stock) return null;
|
|
@@ -129376,6 +129765,23 @@ function GetBlackStyle()
|
|
|
129376
129765
|
LineDash:[2,2]
|
|
129377
129766
|
},
|
|
129378
129767
|
|
|
129768
|
+
PredictionKLine:
|
|
129769
|
+
{
|
|
129770
|
+
Line:
|
|
129771
|
+
{
|
|
129772
|
+
Color:"rgb(220,220,220)",
|
|
129773
|
+
LineDash:[3*GetDevicePixelRatio(),3*GetDevicePixelRatio()]
|
|
129774
|
+
},
|
|
129775
|
+
|
|
129776
|
+
Bar:
|
|
129777
|
+
{
|
|
129778
|
+
UpColor:"rgb(30,144,255)",
|
|
129779
|
+
DownColor:"rgb(30,144,255)",
|
|
129780
|
+
UnchangeColor:"rgb(30,144,255)" ,
|
|
129781
|
+
DrawType:3
|
|
129782
|
+
}
|
|
129783
|
+
},
|
|
129784
|
+
|
|
129379
129785
|
PriceGapStyple:
|
|
129380
129786
|
{
|
|
129381
129787
|
Line:{ Color:"rgb(128,128,128)" },
|
|
@@ -144520,7 +144926,7 @@ function ScrollBarBGChart()
|
|
|
144520
144926
|
|
|
144521
144927
|
|
|
144522
144928
|
|
|
144523
|
-
var HQCHART_VERSION="1.1.
|
|
144929
|
+
var HQCHART_VERSION="1.1.14551";
|
|
144524
144930
|
|
|
144525
144931
|
function PrintHQChartVersion()
|
|
144526
144932
|
{
|