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
|
@@ -4545,6 +4545,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
4545
4545
|
if (IFrameSplitOperator.IsBool(item.PriceGap.Enable)) klineChart.PriceGap.Enable=item.PriceGap.Enable;
|
|
4546
4546
|
if (IFrameSplitOperator.IsNumber(item.PriceGap.Count)) klineChart.PriceGap.Count=item.PriceGap.Count;
|
|
4547
4547
|
}
|
|
4548
|
+
|
|
4549
|
+
if (IFrameSplitOperator.IsBool(item.EnablePrediction)) klineChart.PredictionConfig.Enable=item.EnablePrediction;
|
|
4548
4550
|
}
|
|
4549
4551
|
|
|
4550
4552
|
if(option.KLineTitle)
|
|
@@ -7392,6 +7394,51 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
7392
7394
|
this.DialogSearchIndex=null;
|
|
7393
7395
|
}
|
|
7394
7396
|
|
|
7397
|
+
this.DestroyDialogDrawTool=function()
|
|
7398
|
+
{
|
|
7399
|
+
if (!this.DialogDrawTool) return;
|
|
7400
|
+
|
|
7401
|
+
this.DialogDrawTool.Destroy();
|
|
7402
|
+
this.DialogDrawTool=null;
|
|
7403
|
+
}
|
|
7404
|
+
|
|
7405
|
+
this.DestroyDialogModifyIndexParam=function()
|
|
7406
|
+
{
|
|
7407
|
+
if (this.DialogModifyIndexParam) return;
|
|
7408
|
+
|
|
7409
|
+
this.DialogModifyIndexParam.Destroy();
|
|
7410
|
+
this.DialogModifyIndexParam=null;
|
|
7411
|
+
}
|
|
7412
|
+
|
|
7413
|
+
this.DestroyDialogSelectRect=function()
|
|
7414
|
+
{
|
|
7415
|
+
if (!this.DialogSelectRect) return;
|
|
7416
|
+
|
|
7417
|
+
this.DialogSelectRect.Destroy();
|
|
7418
|
+
this.DialogSelectRect=null;
|
|
7419
|
+
}
|
|
7420
|
+
|
|
7421
|
+
this.DestroyDialogModifyDraw=function()
|
|
7422
|
+
{
|
|
7423
|
+
if (!this.DialogModifyDraw) return;
|
|
7424
|
+
|
|
7425
|
+
this.DialogModifyDraw.Destroy();
|
|
7426
|
+
this.DialogModifyDraw=null;
|
|
7427
|
+
}
|
|
7428
|
+
|
|
7429
|
+
//隐藏内置的弹框div
|
|
7430
|
+
this.HideAllPopDiv=function()
|
|
7431
|
+
{
|
|
7432
|
+
this.HideFloatTooltip();
|
|
7433
|
+
this.CloseTooltipDialog();
|
|
7434
|
+
|
|
7435
|
+
if (this.DialogDrawTool) this.DialogDrawTool.Close();
|
|
7436
|
+
this.CloseModifyDrawDialog();
|
|
7437
|
+
|
|
7438
|
+
if (this.DialogSelectRect) this.DialogSelectRect.Close();
|
|
7439
|
+
if (this.DialogSearchIndex) this.DialogSearchIndex.Close();
|
|
7440
|
+
if (this.DialogModifyIndexParam) this.DialogModifyIndexParam.Close();
|
|
7441
|
+
}
|
|
7395
7442
|
|
|
7396
7443
|
|
|
7397
7444
|
//obj={ Element:, Canvas: }
|
|
@@ -7443,9 +7490,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
7443
7490
|
{
|
|
7444
7491
|
this.IsDestroy=true;
|
|
7445
7492
|
this.StopAutoUpdate();
|
|
7493
|
+
|
|
7446
7494
|
this.DestroyTooltipDialog();
|
|
7447
7495
|
this.DestroyFloatTooltip();
|
|
7496
|
+
|
|
7448
7497
|
this.DestroySearchIndexDialog();
|
|
7498
|
+
this.DestroyDialogModifyIndexParam();
|
|
7499
|
+
|
|
7500
|
+
this.DestroyDialogDrawTool();
|
|
7501
|
+
this.DestroyDialogModifyDraw();
|
|
7502
|
+
|
|
7503
|
+
this.DestroyDialogSelectRect();
|
|
7449
7504
|
}
|
|
7450
7505
|
|
|
7451
7506
|
this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
|
|
@@ -27829,7 +27884,7 @@ function ChartData()
|
|
|
27829
27884
|
return result;
|
|
27830
27885
|
}
|
|
27831
27886
|
|
|
27832
|
-
this.MergeMinuteData=function(data) //合并数据
|
|
27887
|
+
this.MergeMinuteData=function(data, period) //合并数据
|
|
27833
27888
|
{
|
|
27834
27889
|
if (!this.Data || this.Data.length<=0)
|
|
27835
27890
|
{
|
|
@@ -27837,6 +27892,7 @@ function ChartData()
|
|
|
27837
27892
|
return true;
|
|
27838
27893
|
}
|
|
27839
27894
|
|
|
27895
|
+
var bDayPeriod=ChartData.IsDayPeriod(period, true);
|
|
27840
27896
|
var sourceFirstItem=this.Data[0];
|
|
27841
27897
|
var firstItemID=0;
|
|
27842
27898
|
var firstItem=null;
|
|
@@ -27850,11 +27906,23 @@ function ChartData()
|
|
|
27850
27906
|
break;
|
|
27851
27907
|
}
|
|
27852
27908
|
|
|
27853
|
-
if (
|
|
27909
|
+
if (bDayPeriod)
|
|
27854
27910
|
{
|
|
27855
|
-
|
|
27856
|
-
|
|
27857
|
-
|
|
27911
|
+
if (item.Date==sourceFirstItem.Date)
|
|
27912
|
+
{
|
|
27913
|
+
firstItemID=i;
|
|
27914
|
+
firstItem=item;
|
|
27915
|
+
break;
|
|
27916
|
+
}
|
|
27917
|
+
}
|
|
27918
|
+
else
|
|
27919
|
+
{
|
|
27920
|
+
if (item.Date==sourceFirstItem.Date && item.Time>=sourceFirstItem.Time)
|
|
27921
|
+
{
|
|
27922
|
+
firstItemID=i;
|
|
27923
|
+
firstItem=item;
|
|
27924
|
+
break;
|
|
27925
|
+
}
|
|
27858
27926
|
}
|
|
27859
27927
|
}
|
|
27860
27928
|
|
|
@@ -27867,11 +27935,23 @@ function ChartData()
|
|
|
27867
27935
|
var date=this.Data[i].Date;
|
|
27868
27936
|
var time=this.Data[i].Time;
|
|
27869
27937
|
|
|
27870
|
-
if (
|
|
27938
|
+
if (bDayPeriod)
|
|
27871
27939
|
{
|
|
27872
|
-
|
|
27873
|
-
|
|
27874
|
-
|
|
27940
|
+
if (firstItem.Date>date || firstItem.Date==date)
|
|
27941
|
+
{
|
|
27942
|
+
index=i;
|
|
27943
|
+
if (firstItem.Date==date) bFind=true;
|
|
27944
|
+
break;
|
|
27945
|
+
}
|
|
27946
|
+
}
|
|
27947
|
+
else
|
|
27948
|
+
{
|
|
27949
|
+
if (firstItem.Date>date || (firstItem.Date==date && firstItem.Time>=time) )
|
|
27950
|
+
{
|
|
27951
|
+
index=i;
|
|
27952
|
+
if (firstItem.Date==date && firstItem.Time==time) bFind=true;
|
|
27953
|
+
break;
|
|
27954
|
+
}
|
|
27875
27955
|
}
|
|
27876
27956
|
}
|
|
27877
27957
|
|
|
@@ -29785,9 +29865,30 @@ function ChartKLine()
|
|
|
29785
29865
|
DownAreaColor:g_JSChartResource.HLCArea.DownAreaColor,
|
|
29786
29866
|
}
|
|
29787
29867
|
|
|
29788
|
-
//虚线柱子
|
|
29868
|
+
//虚线柱子 (非交易日)
|
|
29789
29869
|
this.VirtualBarConfig={ Color:g_JSChartResource.VirtualKLine.Color, LineDash:g_JSChartResource.VirtualKLine.LineDash };
|
|
29790
29870
|
|
|
29871
|
+
//预测线配置
|
|
29872
|
+
this.PredictionConfig=
|
|
29873
|
+
{
|
|
29874
|
+
Line:
|
|
29875
|
+
{
|
|
29876
|
+
Color:g_JSChartResource.PredictionKLine.Line.Color,
|
|
29877
|
+
LineDash:g_JSChartResource.PredictionKLine.Line.LineDash,
|
|
29878
|
+
LineWidth:g_JSChartResource.PredictionKLine.Line.LineWidth
|
|
29879
|
+
},
|
|
29880
|
+
|
|
29881
|
+
Bar:
|
|
29882
|
+
{
|
|
29883
|
+
UpColor:g_JSChartResource.PredictionKLine.Bar.UpColor,
|
|
29884
|
+
DownColor:g_JSChartResource.PredictionKLine.Bar.DownColor,
|
|
29885
|
+
UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor ,
|
|
29886
|
+
DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
|
|
29887
|
+
},
|
|
29888
|
+
Enable:false, //是否启动
|
|
29889
|
+
};
|
|
29890
|
+
this.AryPredictionCache=[]; //预测数据
|
|
29891
|
+
|
|
29791
29892
|
//DrawType==14 自定义图形
|
|
29792
29893
|
this.FFKChart;
|
|
29793
29894
|
|
|
@@ -29925,6 +30026,22 @@ function ChartKLine()
|
|
|
29925
30026
|
this.OrderFlow.UnchagneColor= { BG:g_JSChartResource.OrderFlow.UnchagneColor.BG, Border:g_JSChartResource.OrderFlow.UnchagneColor.Border };
|
|
29926
30027
|
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 };
|
|
29927
30028
|
this.OrderFlow.Line={ UpDownColor: g_JSChartResource.OrderFlow.Line.UpDownColor, MiddleColor:g_JSChartResource.OrderFlow.Line.MiddleColor };
|
|
30029
|
+
|
|
30030
|
+
this.PredictionConfig.Line=
|
|
30031
|
+
{
|
|
30032
|
+
Color:g_JSChartResource.PredictionKLine.Line.Color,
|
|
30033
|
+
LineDash:g_JSChartResource.PredictionKLine.Line.LineDash,
|
|
30034
|
+
LineWidth:g_JSChartResource.PredictionKLine.Line.LineWidth
|
|
30035
|
+
};
|
|
30036
|
+
|
|
30037
|
+
this.PredictionConfig.Bar=
|
|
30038
|
+
{
|
|
30039
|
+
UpColor:g_JSChartResource.PredictionKLine.Bar.UpColor,
|
|
30040
|
+
DownColor:g_JSChartResource.PredictionKLine.Bar.DownColor,
|
|
30041
|
+
UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor,
|
|
30042
|
+
DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
|
|
30043
|
+
};
|
|
30044
|
+
|
|
29928
30045
|
}
|
|
29929
30046
|
|
|
29930
30047
|
this.ClearCustomKLine=function()
|
|
@@ -30295,6 +30412,8 @@ function ChartKLine()
|
|
|
30295
30412
|
this.DrawKRange.Start=this.Data.DataOffset;
|
|
30296
30413
|
|
|
30297
30414
|
var preKItemInfo=null;
|
|
30415
|
+
var prePoint=null;
|
|
30416
|
+
var xEnd=null; //最后一个点
|
|
30298
30417
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
30299
30418
|
{
|
|
30300
30419
|
var data=this.Data.Data[i];
|
|
@@ -30308,6 +30427,13 @@ function ChartKLine()
|
|
|
30308
30427
|
var yClose=this.GetYFromData(data.Close,false);
|
|
30309
30428
|
this.DrawKRange.End=i;
|
|
30310
30429
|
|
|
30430
|
+
if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
|
|
30431
|
+
{
|
|
30432
|
+
this.AryPredictionCache.push({ PrePoint:prePoint, Point:{ X:x, Y:yClose }});
|
|
30433
|
+
prePoint={ X:x, Y:yClose};
|
|
30434
|
+
continue;
|
|
30435
|
+
}
|
|
30436
|
+
|
|
30311
30437
|
if (bFirstPoint)
|
|
30312
30438
|
{
|
|
30313
30439
|
if (isHScreen)
|
|
@@ -30328,6 +30454,9 @@ function ChartKLine()
|
|
|
30328
30454
|
else this.Canvas.lineTo(x,yClose);
|
|
30329
30455
|
}
|
|
30330
30456
|
|
|
30457
|
+
xEnd=x;
|
|
30458
|
+
prePoint={ X:x, Y:yClose};
|
|
30459
|
+
|
|
30331
30460
|
if (i==this.Data.Data.length-1)
|
|
30332
30461
|
{
|
|
30333
30462
|
ptLast={ X:x, Y:yClose, XLeft:left, XRight:right, KItem:data, ChartRight:chartright };
|
|
@@ -30359,12 +30488,12 @@ function ChartKLine()
|
|
|
30359
30488
|
this.Canvas.stroke();
|
|
30360
30489
|
if (isHScreen)
|
|
30361
30490
|
{
|
|
30362
|
-
this.Canvas.lineTo(border.Left,
|
|
30491
|
+
this.Canvas.lineTo(border.Left,xEnd);
|
|
30363
30492
|
this.Canvas.lineTo(border.Left,firstPoint.Y);
|
|
30364
30493
|
}
|
|
30365
30494
|
else
|
|
30366
30495
|
{
|
|
30367
|
-
this.Canvas.lineTo(
|
|
30496
|
+
this.Canvas.lineTo(xEnd,border.Bottom);
|
|
30368
30497
|
this.Canvas.lineTo(firstPoint.X,border.Bottom);
|
|
30369
30498
|
}
|
|
30370
30499
|
this.Canvas.closePath();
|
|
@@ -30427,11 +30556,12 @@ function ChartKLine()
|
|
|
30427
30556
|
var mapBreakPoint=this.BuildBreakPoint(); //断点
|
|
30428
30557
|
|
|
30429
30558
|
var preKItemInfo=null;
|
|
30559
|
+
var prePoint=null;
|
|
30430
30560
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
30431
30561
|
{
|
|
30432
30562
|
var data=this.Data.Data[i];
|
|
30433
30563
|
this.ShowRange.End=i;
|
|
30434
|
-
if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
30564
|
+
if (!data || data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
30435
30565
|
|
|
30436
30566
|
var left=xOffset;
|
|
30437
30567
|
var right=xOffset+dataWidth;
|
|
@@ -30440,6 +30570,13 @@ function ChartKLine()
|
|
|
30440
30570
|
var yClose=this.GetYFromData(data.Close,false);
|
|
30441
30571
|
this.DrawKRange.End=i;
|
|
30442
30572
|
|
|
30573
|
+
if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
|
|
30574
|
+
{
|
|
30575
|
+
this.AryPredictionCache.push({ PrePoint:prePoint, Point:{ X:x, Y:yClose }});
|
|
30576
|
+
prePoint={ X:x, Y:yClose};
|
|
30577
|
+
continue;
|
|
30578
|
+
}
|
|
30579
|
+
|
|
30443
30580
|
if (bFirstPoint)
|
|
30444
30581
|
{
|
|
30445
30582
|
if (isHScreen) this.Canvas.moveTo(yClose,x);
|
|
@@ -30453,6 +30590,8 @@ function ChartKLine()
|
|
|
30453
30590
|
}
|
|
30454
30591
|
++drawCount;
|
|
30455
30592
|
|
|
30593
|
+
prePoint={ X:x, Y:yClose};
|
|
30594
|
+
|
|
30456
30595
|
if (this.PriceGap.Enable)
|
|
30457
30596
|
{
|
|
30458
30597
|
var yLow=this.GetYFromData(data.Low, false);
|
|
@@ -30527,6 +30666,7 @@ function ChartKLine()
|
|
|
30527
30666
|
}
|
|
30528
30667
|
|
|
30529
30668
|
var preKItemInfo=null;
|
|
30669
|
+
var prePoint=null; //上一个点的位置
|
|
30530
30670
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
30531
30671
|
{
|
|
30532
30672
|
var data=this.Data.Data[i];
|
|
@@ -30576,6 +30716,10 @@ function ChartKLine()
|
|
|
30576
30716
|
{
|
|
30577
30717
|
this.DrawVirtualBar(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
30578
30718
|
}
|
|
30719
|
+
else if (data.IsVirtual && this.PredictionConfig.Enable)
|
|
30720
|
+
{
|
|
30721
|
+
this.DrawPredictionBar(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
30722
|
+
}
|
|
30579
30723
|
else if (kLineOption)
|
|
30580
30724
|
{
|
|
30581
30725
|
var barColor=kLineOption.Color;
|
|
@@ -30657,6 +30801,8 @@ function ChartKLine()
|
|
|
30657
30801
|
if (value>0)
|
|
30658
30802
|
this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
|
|
30659
30803
|
}
|
|
30804
|
+
|
|
30805
|
+
prePoint={ X:x, Y:yClose }; //上一个点
|
|
30660
30806
|
|
|
30661
30807
|
preKItemInfo=kItemInfo;
|
|
30662
30808
|
}
|
|
@@ -31528,6 +31674,82 @@ function ChartKLine()
|
|
|
31528
31674
|
this.Canvas.setLineDash([]);
|
|
31529
31675
|
}
|
|
31530
31676
|
|
|
31677
|
+
this.DrawPredictionBar=function(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen)
|
|
31678
|
+
{
|
|
31679
|
+
var config=this.PredictionConfig.Bar;
|
|
31680
|
+
var drawType=this.DrawType;
|
|
31681
|
+
if (IFrameSplitOperator.IsNumber(config.DrawType)) drawType=config.DrawType;
|
|
31682
|
+
|
|
31683
|
+
if (data.Open<data.Close) //阳线
|
|
31684
|
+
{
|
|
31685
|
+
this.DrawKBar_Up(data, dataWidth, config.UpColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
31686
|
+
}
|
|
31687
|
+
else if (data.Open>data.Close) //阴线
|
|
31688
|
+
{
|
|
31689
|
+
this.DrawKBar_Down(data, dataWidth, config.DownColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
31690
|
+
}
|
|
31691
|
+
else
|
|
31692
|
+
{
|
|
31693
|
+
this.DrawKBar_Unchagne(data, dataWidth, config.UnchangeColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
31694
|
+
}
|
|
31695
|
+
}
|
|
31696
|
+
|
|
31697
|
+
this.DrawPredictionLine=function()
|
|
31698
|
+
{
|
|
31699
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryPredictionCache)) return;
|
|
31700
|
+
|
|
31701
|
+
this.Canvas.save();
|
|
31702
|
+
|
|
31703
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
31704
|
+
var bFirstPoint=true;
|
|
31705
|
+
var drawCount=0;
|
|
31706
|
+
for(var i=0;i<this.AryPredictionCache.length;++i)
|
|
31707
|
+
{
|
|
31708
|
+
var item=this.AryPredictionCache[i];
|
|
31709
|
+
if (bFirstPoint)
|
|
31710
|
+
{
|
|
31711
|
+
bFirstPoint=false;
|
|
31712
|
+
this.Canvas.beginPath();
|
|
31713
|
+
if (item.PrePoint)
|
|
31714
|
+
{
|
|
31715
|
+
var pt=item.PrePoint;
|
|
31716
|
+
if (bHScreen) this.Canvas.moveTo(pt.Y,pt.X); //横屏坐标轴对调
|
|
31717
|
+
else this.Canvas.moveTo(pt.X,pt.Y);
|
|
31718
|
+
|
|
31719
|
+
var pt=item.Point;
|
|
31720
|
+
if (bHScreen) this.Canvas.lineTo(pt.Y,pt.X);
|
|
31721
|
+
else this.Canvas.lineTo(pt.X,pt.Y);
|
|
31722
|
+
}
|
|
31723
|
+
else if (item.Point)
|
|
31724
|
+
{
|
|
31725
|
+
var pt=item.Point;
|
|
31726
|
+
if (bHScreen) this.Canvas.moveTo(pt.Y,pt.X); //横屏坐标轴对调
|
|
31727
|
+
else this.Canvas.moveTo(pt.X,pt.Y);
|
|
31728
|
+
}
|
|
31729
|
+
}
|
|
31730
|
+
else
|
|
31731
|
+
{
|
|
31732
|
+
var pt=item.Point;
|
|
31733
|
+
if (bHScreen) this.Canvas.lineTo(pt.Y,pt.X);
|
|
31734
|
+
else this.Canvas.lineTo(pt.X,pt.Y);
|
|
31735
|
+
}
|
|
31736
|
+
|
|
31737
|
+
++drawCount;
|
|
31738
|
+
}
|
|
31739
|
+
|
|
31740
|
+
if (drawCount>0)
|
|
31741
|
+
{
|
|
31742
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
31743
|
+
var config=this.PredictionConfig.Line;
|
|
31744
|
+
this.Canvas.strokeStyle=config.Color;
|
|
31745
|
+
if (IFrameSplitOperator.IsNumber(config.LineWidth)) this.Canvas.lineWidth=config.LineWidth*pixelRatio;
|
|
31746
|
+
if (IFrameSplitOperator.IsNonEmptyArray(config.LineDash)) this.Canvas.setLineDash(config.LineDash)
|
|
31747
|
+
this.Canvas.stroke();
|
|
31748
|
+
}
|
|
31749
|
+
|
|
31750
|
+
this.Canvas.restore();
|
|
31751
|
+
}
|
|
31752
|
+
|
|
31531
31753
|
this.DrawRenkoCandle=function() //砖型K线
|
|
31532
31754
|
{
|
|
31533
31755
|
var isHScreen=(this.ChartFrame.IsHScreen===true);
|
|
@@ -32344,6 +32566,7 @@ function ChartKLine()
|
|
|
32344
32566
|
this.PtMin={X:null,Y:null,Value:null,Align:'left'}; //清空最小
|
|
32345
32567
|
this.DrawKRange={ Start:null, End:null };
|
|
32346
32568
|
this.AryPriceGapCache=[];
|
|
32569
|
+
this.AryPredictionCache=[];
|
|
32347
32570
|
|
|
32348
32571
|
this.ChartFrame.ChartKLine={Max:null, Min:null }; //保存K线上 显示最大最小值坐标
|
|
32349
32572
|
|
|
@@ -32384,6 +32607,7 @@ function ChartKLine()
|
|
|
32384
32607
|
{
|
|
32385
32608
|
this.DrawCloseLine();
|
|
32386
32609
|
this.Canvas.restore();
|
|
32610
|
+
this.DrawPredictionLine();
|
|
32387
32611
|
if (this.PriceGap.Enable) this.DrawPriceGap();
|
|
32388
32612
|
return;
|
|
32389
32613
|
}
|
|
@@ -32456,6 +32680,7 @@ function ChartKLine()
|
|
|
32456
32680
|
|
|
32457
32681
|
this.Canvas.restore();
|
|
32458
32682
|
|
|
32683
|
+
this.DrawPredictionLine();
|
|
32459
32684
|
if (this.PriceGap.Enable) this.DrawPriceGap();
|
|
32460
32685
|
|
|
32461
32686
|
if (this.IsShowMaxMinPrice) //标注最大值最小值
|
|
@@ -39235,6 +39460,7 @@ function ChartVolStick()
|
|
|
39235
39460
|
var value=this.Data.Data[i];
|
|
39236
39461
|
var kItem=this.HistoryData.Data[i];
|
|
39237
39462
|
if (value==null || kItem==null) continue;
|
|
39463
|
+
if (!IFrameSplitOperator.IsNumber(value)) continue;
|
|
39238
39464
|
if (value==0) continue;
|
|
39239
39465
|
|
|
39240
39466
|
var left=xOffset;
|
|
@@ -39824,23 +40050,22 @@ function ChartStickLine()
|
|
|
39824
40050
|
delete this.newMethod;
|
|
39825
40051
|
|
|
39826
40052
|
this.ClassName='ChartStickLine'; //类名
|
|
39827
|
-
this.Color="rgb(255,193,37)";
|
|
39828
|
-
this.BarType=0;
|
|
39829
|
-
this.LineDotted=[3,3];
|
|
39830
|
-
this.Width=0;
|
|
40053
|
+
this.Color="rgb(255,193,37)"; //线段颜色
|
|
40054
|
+
this.BarType=0; //柱子类型 0=实心 1=空心 -1=画虚线空心柱
|
|
40055
|
+
this.LineDotted=[3,3]; //虚线设置
|
|
40056
|
+
this.Width=0; //柱子宽度 0=1 3,50=k线宽度 101=K线宽度+间距宽度
|
|
40057
|
+
this.IsHScreen=false;
|
|
40058
|
+
|
|
40059
|
+
this.EmptyBGColor=null; //空心柱子背景色(缓存)
|
|
40060
|
+
this.BarCache={ }; //Type:1=线段 2=柱子
|
|
39831
40061
|
|
|
39832
40062
|
this.SetEmptyBar=function() //设置空心柱子
|
|
39833
40063
|
{
|
|
39834
40064
|
if (this.BarType!=1 && this.BarType!=-1) return false;
|
|
39835
40065
|
|
|
39836
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
39837
|
-
this.Canvas.strokeStyle=this.Color;
|
|
39838
40066
|
var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
|
|
39839
|
-
if (emptyBGColor) this.
|
|
39840
|
-
if (this.BarType==-1)
|
|
39841
|
-
{
|
|
39842
|
-
this.Canvas.setLineDash(this.LineDotted); //虚线
|
|
39843
|
-
}
|
|
40067
|
+
if (emptyBGColor) this.BarCache.EmptyBGColor=emptyBGColor;
|
|
40068
|
+
if (this.BarType==-1) this.BarCache.LineDotted=this.LineDotted;
|
|
39844
40069
|
|
|
39845
40070
|
return true;
|
|
39846
40071
|
}
|
|
@@ -39850,13 +40075,6 @@ function ChartStickLine()
|
|
|
39850
40075
|
return (this.BarType==1 || this.BarType==-1);
|
|
39851
40076
|
}
|
|
39852
40077
|
|
|
39853
|
-
this.CalculateBarHeight=function(y,y2)
|
|
39854
|
-
{
|
|
39855
|
-
var barHeight=Math.abs(y-y2);
|
|
39856
|
-
if (barHeight<=0) barHeight=1;
|
|
39857
|
-
return barHeight;
|
|
39858
|
-
}
|
|
39859
|
-
|
|
39860
40078
|
this.Draw=function()
|
|
39861
40079
|
{
|
|
39862
40080
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
@@ -39871,81 +40089,93 @@ function ChartStickLine()
|
|
|
39871
40089
|
|
|
39872
40090
|
if (!this.Data || !this.Data.Data) return;
|
|
39873
40091
|
|
|
39874
|
-
var
|
|
40092
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
40093
|
+
this.BarCache={ Color:this.Color, EmptyBGColor:null, Width:1*pixelRatio, Type:0, LineDotted:null };
|
|
40094
|
+
|
|
40095
|
+
this.IsHScreen=(this.ChartFrame.IsHScreen===true);;
|
|
39875
40096
|
var dataWidth=this.ChartFrame.DataWidth;
|
|
39876
40097
|
var distanceWidth=this.ChartFrame.DistanceWidth;
|
|
39877
40098
|
var chartright=this.ChartBorder.GetRight();
|
|
39878
|
-
var zoomIndex=this.ChartFrame.ZoomIndex;
|
|
39879
|
-
if (isHScreen) chartright=this.ChartBorder.GetBottom();
|
|
39880
40099
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
39881
40100
|
var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
39882
|
-
if (
|
|
40101
|
+
if (this.IsHScreen)
|
|
40102
|
+
{
|
|
40103
|
+
chartright=this.ChartBorder.GetBottom();
|
|
40104
|
+
xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
40105
|
+
}
|
|
39883
40106
|
|
|
39884
40107
|
var isMinute=this.IsMinuteFrame();
|
|
39885
40108
|
|
|
39886
|
-
this.Canvas.save();
|
|
39887
|
-
var bFillBar=false;
|
|
39888
|
-
var bFillKLine=false;
|
|
39889
|
-
var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
|
|
39890
|
-
|
|
39891
40109
|
if (isMinute)
|
|
39892
40110
|
{
|
|
39893
|
-
if (this.Width>1) this.
|
|
39894
|
-
|
|
39895
|
-
this.Canvas.strokeStyle=this.Color;
|
|
40111
|
+
if (this.Width>1) this.BarCache.Width=2*pixelRatio;
|
|
40112
|
+
this.BarCache.Type=1;
|
|
39896
40113
|
}
|
|
39897
|
-
else if(this.Width
|
|
40114
|
+
else if(this.Width<=0) //宽度时0,使用宽度1
|
|
39898
40115
|
{
|
|
40116
|
+
this.BarCache.Type=1;
|
|
39899
40117
|
this.SetEmptyBar();
|
|
39900
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
39901
|
-
this.Canvas.strokeStyle=this.Color;
|
|
39902
40118
|
}
|
|
39903
40119
|
else if (this.Width==3 || this.Width==50) //3和50 K线宽度
|
|
39904
40120
|
{
|
|
40121
|
+
this.BarCache.Type=1;
|
|
39905
40122
|
if (dataWidth>=4)
|
|
39906
40123
|
{
|
|
39907
|
-
|
|
40124
|
+
this.BarCache.Type=2;
|
|
40125
|
+
this.BarCache.Width=dataWidth;
|
|
39908
40126
|
this.SetEmptyBar();
|
|
39909
|
-
if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
|
|
39910
|
-
this.Canvas.strokeStyle=this.Color;
|
|
39911
40127
|
}
|
|
39912
|
-
else //太细了 画竖线
|
|
39913
|
-
{
|
|
39914
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
39915
|
-
this.Canvas.strokeStyle=this.Color;
|
|
39916
|
-
}
|
|
39917
40128
|
}
|
|
39918
|
-
else if (this.Width==101)
|
|
40129
|
+
else if (this.Width==101) //柱子+间距
|
|
39919
40130
|
{
|
|
39920
|
-
|
|
39921
|
-
|
|
39922
|
-
|
|
40131
|
+
this.BarCache.Type=1;
|
|
40132
|
+
var lineWidth=dataWidth+distanceWidth+1*pixelRatio;
|
|
40133
|
+
if (lineWidth>=4)
|
|
40134
|
+
{
|
|
40135
|
+
this.BarCache.Type=2;
|
|
40136
|
+
this.BarCache.Width=lineWidth
|
|
40137
|
+
this.SetEmptyBar();
|
|
40138
|
+
}
|
|
39923
40139
|
}
|
|
39924
40140
|
else if (this.Width<=3)
|
|
39925
40141
|
{
|
|
39926
|
-
var minWidth=2*
|
|
40142
|
+
var minWidth=2*pixelRatio;
|
|
39927
40143
|
var barWidth=dataWidth*(this.Width/3);
|
|
39928
40144
|
if (barWidth<minWidth) barWidth=minWidth;
|
|
39929
|
-
this.
|
|
39930
|
-
if (
|
|
39931
|
-
|
|
40145
|
+
this.BarCache.Type=1;
|
|
40146
|
+
if (barWidth>=4)
|
|
40147
|
+
{
|
|
40148
|
+
this.BarCache.Type=2;
|
|
40149
|
+
this.BarCache.Width=barWidth;
|
|
40150
|
+
this.SetEmptyBar();
|
|
40151
|
+
}
|
|
39932
40152
|
}
|
|
39933
40153
|
else
|
|
39934
40154
|
{
|
|
39935
|
-
var barWidth=this.Width*
|
|
40155
|
+
var barWidth=this.Width*pixelRatio+dataWidth;
|
|
40156
|
+
this.BarCache.Type=2;
|
|
40157
|
+
this.BarCache.Width=barWidth;
|
|
39936
40158
|
this.SetEmptyBar();
|
|
39937
|
-
if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
|
|
39938
|
-
bFillBar=true;
|
|
39939
40159
|
}
|
|
39940
40160
|
|
|
40161
|
+
this.Canvas.save();
|
|
40162
|
+
this.ClipClient(this.IsHScreen);
|
|
40163
|
+
|
|
40164
|
+
this.Canvas.strokeStyle=this.BarCache.Color;
|
|
40165
|
+
if (this.BarCache.EmptyBGColor) this.Canvas.fillStyle=this.BarCache.EmptyBGColor; //空心柱子
|
|
40166
|
+
else this.Canvas.fillStyle=this.BarCache.Color;
|
|
40167
|
+
if (IFrameSplitOperator.IsNonEmptyArray(this.BarCache.LineDotted)) this.Canvas.setLineDash(this.BarCache.LineDotted); //虚线
|
|
40168
|
+
if (this.BarCache.Type==1) this.Canvas.lineWidth=this.BarCache.Width;
|
|
40169
|
+
|
|
39941
40170
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
39942
40171
|
{
|
|
39943
40172
|
var value=this.Data.Data[i];
|
|
39944
|
-
if (value
|
|
40173
|
+
if (!value) continue;
|
|
40174
|
+
if (!IFrameSplitOperator.IsNumber(value.Value)) continue;
|
|
39945
40175
|
|
|
39946
40176
|
var price=value.Value;
|
|
39947
|
-
var price2=
|
|
39948
|
-
if (
|
|
40177
|
+
var price2=0;
|
|
40178
|
+
if (IFrameSplitOperator.IsNumber(value.Value2)) price2=value.Value2;
|
|
39949
40179
|
|
|
39950
40180
|
if (isMinute)
|
|
39951
40181
|
{
|
|
@@ -39958,103 +40188,79 @@ function ChartStickLine()
|
|
|
39958
40188
|
var x=left+(right-left)/2;
|
|
39959
40189
|
}
|
|
39960
40190
|
|
|
39961
|
-
var y=this.ChartFrame.GetYFromData(price);
|
|
39962
|
-
var y2=this.ChartFrame.GetYFromData(price2);
|
|
40191
|
+
var y=this.ChartFrame.GetYFromData(price,false);
|
|
40192
|
+
var y2=this.ChartFrame.GetYFromData(price2,false);
|
|
39963
40193
|
|
|
39964
40194
|
if (x>chartright) break;
|
|
39965
40195
|
|
|
39966
|
-
|
|
39967
|
-
|
|
39968
|
-
|
|
39969
|
-
{
|
|
39970
|
-
var left=x-barWidth/2;
|
|
39971
|
-
var width=barWidth;
|
|
39972
|
-
if (this.IsEmptyBar()) //空心
|
|
39973
|
-
{
|
|
39974
|
-
this.Canvas.beginPath();
|
|
39975
|
-
this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
|
|
39976
|
-
this.Canvas.stroke();
|
|
39977
|
-
}
|
|
39978
|
-
else
|
|
39979
|
-
{
|
|
39980
|
-
this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
|
|
39981
|
-
}
|
|
39982
|
-
}
|
|
39983
|
-
else
|
|
39984
|
-
{
|
|
39985
|
-
var left=x-barWidth/2;
|
|
39986
|
-
var width=barWidth;
|
|
39987
|
-
if (left+width>chartright) width=chartright-left; //不要超过右边框子
|
|
39988
|
-
if (this.IsEmptyBar()) //空心
|
|
39989
|
-
{
|
|
39990
|
-
if (emptyBGColor)
|
|
39991
|
-
this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(Math.abs(y-y2)));
|
|
40196
|
+
var xCenter=x;
|
|
40197
|
+
var yTop=Math.min(y,y2);
|
|
40198
|
+
var barHeight=Math.abs(y-y2); //柱子高度
|
|
39992
40199
|
|
|
39993
|
-
|
|
39994
|
-
|
|
39995
|
-
|
|
39996
|
-
|
|
39997
|
-
|
|
39998
|
-
|
|
39999
|
-
|
|
40000
|
-
|
|
40001
|
-
|
|
40200
|
+
this.DrawBar(xCenter, yTop, barHeight);
|
|
40201
|
+
}
|
|
40202
|
+
|
|
40203
|
+
this.Canvas.restore();
|
|
40204
|
+
}
|
|
40205
|
+
|
|
40206
|
+
this.DrawBar=function(xCenter, ytop, barHeight)
|
|
40207
|
+
{
|
|
40208
|
+
if (barHeight<1) barHeight=1;
|
|
40209
|
+
|
|
40210
|
+
if (this.BarCache.Type==1) //线段
|
|
40211
|
+
{
|
|
40212
|
+
if (this.IsHScreen)
|
|
40213
|
+
{
|
|
40214
|
+
this.Canvas.beginPath();
|
|
40215
|
+
this.Canvas.moveTo(ytop,ToFixedPoint(xCenter));
|
|
40216
|
+
this.Canvas.lineTo(ytop+barHeight,ToFixedPoint(xCenter));
|
|
40217
|
+
this.Canvas.stroke();
|
|
40218
|
+
}
|
|
40219
|
+
else
|
|
40220
|
+
{
|
|
40221
|
+
this.Canvas.beginPath();
|
|
40222
|
+
this.Canvas.moveTo(ToFixedPoint(xCenter),ytop);
|
|
40223
|
+
this.Canvas.lineTo(ToFixedPoint(xCenter),ytop+barHeight);
|
|
40224
|
+
this.Canvas.stroke();
|
|
40002
40225
|
}
|
|
40003
|
-
|
|
40226
|
+
}
|
|
40227
|
+
else if (this.BarCache.Type==2) //柱子
|
|
40228
|
+
{
|
|
40229
|
+
if (this.IsHScreen)
|
|
40004
40230
|
{
|
|
40005
|
-
|
|
40231
|
+
var xLeft=xCenter-this.BarCache.Width/2;
|
|
40232
|
+
if (this.IsEmptyBar()) //空心
|
|
40006
40233
|
{
|
|
40007
|
-
if (
|
|
40008
|
-
|
|
40009
|
-
this.Canvas.beginPath();
|
|
40010
|
-
this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
|
|
40011
|
-
this.Canvas.stroke();
|
|
40012
|
-
}
|
|
40013
|
-
else
|
|
40014
|
-
{
|
|
40015
|
-
if (emptyBGColor)
|
|
40016
|
-
this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(y-y2)));
|
|
40234
|
+
if (this.BarCache.EmptyBGColor) //背景色填充
|
|
40235
|
+
this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
40017
40236
|
|
|
40018
|
-
|
|
40019
|
-
|
|
40020
|
-
|
|
40021
|
-
}
|
|
40237
|
+
this.Canvas.beginPath();
|
|
40238
|
+
this.Canvas.rect(ToFixedPoint(ytop),ToFixedPoint(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
40239
|
+
this.Canvas.stroke();
|
|
40022
40240
|
}
|
|
40023
40241
|
else
|
|
40024
40242
|
{
|
|
40025
|
-
|
|
40026
|
-
{
|
|
40027
|
-
this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
|
|
40028
|
-
}
|
|
40029
|
-
else
|
|
40030
|
-
{
|
|
40031
|
-
this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(this.CalculateBarHeight(y,y2)));
|
|
40032
|
-
}
|
|
40033
|
-
|
|
40243
|
+
this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
40034
40244
|
}
|
|
40035
40245
|
}
|
|
40036
40246
|
else
|
|
40037
40247
|
{
|
|
40038
|
-
|
|
40248
|
+
var xLeft=xCenter-this.BarCache.Width/2;
|
|
40249
|
+
if (this.IsEmptyBar()) //空心
|
|
40039
40250
|
{
|
|
40251
|
+
if (this.BarCache.EmptyBGColor) //背景色填充
|
|
40252
|
+
this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
40253
|
+
|
|
40040
40254
|
this.Canvas.beginPath();
|
|
40041
|
-
this.Canvas.
|
|
40042
|
-
this.Canvas.lineTo(y2,ToFixedPoint(x));
|
|
40255
|
+
this.Canvas.rect(ToFixedPoint(xLeft),ToFixedPoint(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
40043
40256
|
this.Canvas.stroke();
|
|
40044
40257
|
}
|
|
40045
40258
|
else
|
|
40046
40259
|
{
|
|
40047
|
-
|
|
40048
|
-
this.Canvas.beginPath();
|
|
40049
|
-
this.Canvas.moveTo(xFix,y);
|
|
40050
|
-
if (Math.abs(y-y2)>0) this.Canvas.lineTo(xFix,y2);
|
|
40051
|
-
else this.Canvas.lineTo(xFix,y+1); //太窄了,就画一个像素的宽度
|
|
40052
|
-
this.Canvas.stroke();
|
|
40260
|
+
this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
40053
40261
|
}
|
|
40054
40262
|
}
|
|
40055
40263
|
}
|
|
40056
|
-
|
|
40057
|
-
this.Canvas.restore();
|
|
40058
40264
|
}
|
|
40059
40265
|
|
|
40060
40266
|
this.GetMaxMin=function()
|
|
@@ -76172,6 +76378,24 @@ function JSChartResource()
|
|
|
76172
76378
|
LineDash:[2,2]
|
|
76173
76379
|
};
|
|
76174
76380
|
|
|
76381
|
+
this.PredictionKLine=
|
|
76382
|
+
{
|
|
76383
|
+
Line:
|
|
76384
|
+
{
|
|
76385
|
+
Color:"rgb(100,100,100)",
|
|
76386
|
+
LineDash:[3,5],
|
|
76387
|
+
LineWidth:2,
|
|
76388
|
+
},
|
|
76389
|
+
|
|
76390
|
+
Bar:
|
|
76391
|
+
{
|
|
76392
|
+
UpColor:"rgb(65,105,225)",
|
|
76393
|
+
DownColor:"rgb(65,105,225)",
|
|
76394
|
+
UnchangeColor:"rgb(65,105,225s)" ,
|
|
76395
|
+
DrawType:3
|
|
76396
|
+
}
|
|
76397
|
+
};
|
|
76398
|
+
|
|
76175
76399
|
this.PriceGapStyple=
|
|
76176
76400
|
{
|
|
76177
76401
|
Line:{ Color:"rgb(186,186,186)" },
|
|
@@ -77572,6 +77796,28 @@ function JSChartResource()
|
|
|
77572
77796
|
if (item.LineDash) this.VirtualKLine.LineDash=item.LineDash;
|
|
77573
77797
|
}
|
|
77574
77798
|
|
|
77799
|
+
if (style.PredictionKLine)
|
|
77800
|
+
{
|
|
77801
|
+
if (style.PredictionKLine.Line)
|
|
77802
|
+
{
|
|
77803
|
+
var item=style.PredictionKLine.Line;
|
|
77804
|
+
var dest=this.PredictionKLine.Line;
|
|
77805
|
+
if (item.Color) dest.Color=item.Color;
|
|
77806
|
+
if (item.LineDash) dest.LineDash=item.LineDash;
|
|
77807
|
+
if (IFrameSplitOperator.IsNumber(item.LineWidth)) dest.LineWidth=item.LineWidth;
|
|
77808
|
+
}
|
|
77809
|
+
|
|
77810
|
+
if (style.PredictionKLine.Bar)
|
|
77811
|
+
{
|
|
77812
|
+
var item=style.PredictionKLine.Bar;
|
|
77813
|
+
var dest=this.PredictionKLine.Bar;
|
|
77814
|
+
if (item.UpColor) dest.UpColor=item.UpColor;
|
|
77815
|
+
if (item.DownColor) dest.DownColor=item.DownColor;
|
|
77816
|
+
if (item.UnchangeColor) dest.UnchangeColor=item.UnchangeColor;
|
|
77817
|
+
if (IFrameSplitOperator.IsNumber(item.DrawType) || item.DrawType===null) dest.DrawType=item.DrawType;
|
|
77818
|
+
}
|
|
77819
|
+
}
|
|
77820
|
+
|
|
77575
77821
|
if (style.PriceGapStyple)
|
|
77576
77822
|
{
|
|
77577
77823
|
var item=style.PriceGapStyple;
|
|
@@ -82451,9 +82697,90 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82451
82697
|
});
|
|
82452
82698
|
}
|
|
82453
82699
|
|
|
82700
|
+
|
|
82701
|
+
this.RecvRealtimeDataV2=function(data)
|
|
82702
|
+
{
|
|
82703
|
+
var aryRealtimeData=KLineChartContainer.JsonDataToRealtimeDataV2(data,this.Symbol);
|
|
82704
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryRealtimeData)) return;
|
|
82705
|
+
|
|
82706
|
+
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
82707
|
+
var lastSourceDataCount=this.SourceData.Data.length;
|
|
82708
|
+
if (!this.SourceData.MergeMinuteData(aryRealtimeData, this.Period)) return;
|
|
82709
|
+
|
|
82710
|
+
var bindData=new ChartData();
|
|
82711
|
+
bindData.Data=this.SourceData.Data;
|
|
82712
|
+
bindData.Period=this.Period;
|
|
82713
|
+
bindData.Right=this.Right;
|
|
82714
|
+
bindData.DataType=this.SourceData.DataType;
|
|
82715
|
+
bindData.Symbol=this.Symbol;
|
|
82716
|
+
|
|
82717
|
+
//if (bindData.Right>0 && ChartData.IsDayPeriod(bindData.Period,true) && MARKET_SUFFIX_NAME.IsSHSZStockA(this.Symbol) && !this.IsApiPeriod) //复权(A股日线数据才复权)
|
|
82718
|
+
if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsEnableRight(bindData.Period,this.Symbol,this.RightFormula) && !this.IsApiPeriod && ChartData.IsDayPeriod(bindData.Period,true)) //复权
|
|
82719
|
+
{
|
|
82720
|
+
var rightData=bindData.GetRightData(bindData.Right,{ AlgorithmType: this.RightFormula });
|
|
82721
|
+
bindData.Data=rightData;
|
|
82722
|
+
}
|
|
82723
|
+
|
|
82724
|
+
if (!this.IsApiPeriod)
|
|
82725
|
+
{
|
|
82726
|
+
if (ChartData.IsDayPeriod(bindData.Period,false) || ChartData.IsMinutePeriod(bindData.Period,false)) //周期数据 (0= 日线,4=1分钟线 不需要处理)
|
|
82727
|
+
{
|
|
82728
|
+
var periodData=bindData.GetPeriodData(bindData.Period);
|
|
82729
|
+
bindData.Data=periodData;
|
|
82730
|
+
}
|
|
82731
|
+
}
|
|
82732
|
+
|
|
82733
|
+
var kLineCalculate=this.GetKLineCalulate();
|
|
82734
|
+
if (kLineCalculate) //额外的K线图形计算
|
|
82735
|
+
{
|
|
82736
|
+
var newBindData=kLineCalculate.RecvHistoryData(bindData, { Symbol:this.Symbol, Function:"RecvRealtimeData" });
|
|
82737
|
+
bindData=newBindData;
|
|
82738
|
+
this.FlowCapitalReady=true;
|
|
82739
|
+
}
|
|
82740
|
+
|
|
82741
|
+
this.UpdateMainData(bindData,lastDataCount);//更新主图数据
|
|
82742
|
+
this.UpdateOverlayRealtimeDataV2(data); //更新叠加股票数据
|
|
82743
|
+
this.BindInstructionIndexData(bindData); //执行指示脚本
|
|
82744
|
+
|
|
82745
|
+
for(var i=0; i<this.Frame.SubFrame.length; ++i)
|
|
82746
|
+
{
|
|
82747
|
+
this.BindIndexData(i,bindData, { CheckRunCount:true });
|
|
82748
|
+
}
|
|
82749
|
+
|
|
82750
|
+
this.BindAllOverlayIndexData(bindData, { CheckRunCount:true, SyncExecute:true }); //同步模式叠加指标
|
|
82751
|
+
|
|
82752
|
+
//刷新画图
|
|
82753
|
+
this.UpdataDataoffset(); //更新数据偏移
|
|
82754
|
+
this.UpdatePointByCursorIndex(1); //更新十字光标位子
|
|
82755
|
+
this.UpdateFrameMaxMin(); //调整坐标最大 最小值
|
|
82756
|
+
this.Frame.SetSizeChage(true);
|
|
82757
|
+
this.Draw();
|
|
82758
|
+
|
|
82759
|
+
this.SendKLineUpdateEvent(bindData);
|
|
82760
|
+
this.UpdateDOMTooltip(0, bindData);
|
|
82761
|
+
this.UpdateHQFloatTooltip(bindData);
|
|
82762
|
+
|
|
82763
|
+
//叠加指标计算
|
|
82764
|
+
this.BindAllOverlayIndexData(bindData, { CheckRunCount:true,SyncExecute:false }); //异步模式叠加指标
|
|
82765
|
+
|
|
82766
|
+
if (this.mapEvent.has(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA))
|
|
82767
|
+
{
|
|
82768
|
+
var event=this.mapEvent.get(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA);
|
|
82769
|
+
var data={ HistoryData:bindData, Stock:{Symbol:this.Symbol, Name:this.Name } }
|
|
82770
|
+
event.Callback(event,data,this);
|
|
82771
|
+
}
|
|
82772
|
+
}
|
|
82773
|
+
|
|
82454
82774
|
this.RecvRealtimeData=function(data)
|
|
82455
82775
|
{
|
|
82456
82776
|
if (this.IsOnTouch==true) return; //正在操作中不更新数据
|
|
82777
|
+
|
|
82778
|
+
if (data.Ver==3.0)
|
|
82779
|
+
{
|
|
82780
|
+
this.RecvRealtimeDataV2(data);
|
|
82781
|
+
return;
|
|
82782
|
+
}
|
|
82783
|
+
|
|
82457
82784
|
var realtimeData=KLineChartContainer.JsonDataToRealtimeData(data,this.Symbol);
|
|
82458
82785
|
if (!realtimeData) return;
|
|
82459
82786
|
|
|
@@ -82634,6 +82961,47 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82634
82961
|
}
|
|
82635
82962
|
}
|
|
82636
82963
|
|
|
82964
|
+
this.UpdateOverlayRealtimeDataV2=function(data)
|
|
82965
|
+
{
|
|
82966
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.OverlayChartPaint)) return;
|
|
82967
|
+
|
|
82968
|
+
for(var i=0; i<this.OverlayChartPaint.length; ++i)
|
|
82969
|
+
{
|
|
82970
|
+
var item=this.OverlayChartPaint[i];
|
|
82971
|
+
if (!item.Symbol) continue;
|
|
82972
|
+
if (!item.MainData) continue; //等待主图股票数据未下载完
|
|
82973
|
+
if (item.Status!=OVERLAY_STATUS_ID.STATUS_FINISHED_ID) continue;
|
|
82974
|
+
var aryRealtimeData=KLineChartContainer.JsonDataToRealtimeDataV2(data,item.Symbol); //获取叠加股票的最新数据
|
|
82975
|
+
if (!aryRealtimeData) continue;
|
|
82976
|
+
var sourceData=item.SourceData; //叠加股票的所有数据
|
|
82977
|
+
sourceData.MergeMinuteData(aryRealtimeData, this.Period);
|
|
82978
|
+
|
|
82979
|
+
var bindData=new ChartData();
|
|
82980
|
+
bindData.Data=sourceData.Data;
|
|
82981
|
+
bindData.Period=this.Period;
|
|
82982
|
+
bindData.Right=this.Right;
|
|
82983
|
+
bindData.DataType=0;
|
|
82984
|
+
|
|
82985
|
+
//if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsSHSZStockA(data.symbol) && !this.IsApiPeriod) //复权数据 ,A股才有有复权
|
|
82986
|
+
if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsEnableRight(bindData.Right, data.Symbol) && !this.IsApiPeriod)
|
|
82987
|
+
{
|
|
82988
|
+
var rightData=bindData.GetRightData(bindData.Right, { AlgorithmType: this.RightFormula });
|
|
82989
|
+
bindData.Data=rightData;
|
|
82990
|
+
}
|
|
82991
|
+
|
|
82992
|
+
var aryOverlayData=this.SourceData.GetOverlayData(bindData.Data, this.IsApiPeriod); //和主图数据拟合以后的数据
|
|
82993
|
+
bindData.Data=aryOverlayData;
|
|
82994
|
+
|
|
82995
|
+
if (ChartData.IsDayPeriod(bindData.Period,false) && !this.IsApiPeriod) //周期数据
|
|
82996
|
+
{
|
|
82997
|
+
var periodData=bindData.GetPeriodData(bindData.Period);
|
|
82998
|
+
bindData.Data=periodData;
|
|
82999
|
+
}
|
|
83000
|
+
|
|
83001
|
+
item.Data=bindData;
|
|
83002
|
+
}
|
|
83003
|
+
}
|
|
83004
|
+
|
|
82637
83005
|
this.RequestMinuteRealtimeData=function()
|
|
82638
83006
|
{
|
|
82639
83007
|
var self=this;
|
|
@@ -82755,7 +83123,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82755
83123
|
if (this.IsApiPeriod) this.ReduceSourceData(); //减少数据
|
|
82756
83124
|
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
82757
83125
|
if (!this.SourceData) return;
|
|
82758
|
-
if (!this.SourceData.MergeMinuteData(aryMinuteData)) return;
|
|
83126
|
+
if (!this.SourceData.MergeMinuteData(aryMinuteData, this.Period)) return;
|
|
82759
83127
|
|
|
82760
83128
|
JSConsole.Chart.Log(`[KLineChartContainer::RecvMinuteRealtimeDataV2] update kline by 1 minute data [${lastDataCount}->${this.SourceData.Data.length}], IsAutoSyncDataOffset=${this.IsAutoSyncDataOffset}`);
|
|
82761
83129
|
|
|
@@ -82838,7 +83206,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82838
83206
|
if (this.IsApiPeriod) this.ReduceSourceData(); //减少数据
|
|
82839
83207
|
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
82840
83208
|
var lastSourceDataCount=this.SourceData.Data.length;
|
|
82841
|
-
if (!this.SourceData.MergeMinuteData(realtimeData)) return;
|
|
83209
|
+
if (!this.SourceData.MergeMinuteData(realtimeData, this.Period)) return;
|
|
82842
83210
|
|
|
82843
83211
|
JSConsole.Chart.Log(`[KLineChartContainer::RecvMinuteRealtimeData] update kline by 1 minute data [${lastSourceDataCount}->${this.SourceData.Data.length}]`);
|
|
82844
83212
|
|
|
@@ -82909,7 +83277,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
82909
83277
|
var realtimeData=KLineChartContainer.JsonDataToMinuteRealtimeData(data,item.Symbol); //获取叠加股票的最新数据
|
|
82910
83278
|
if (!realtimeData) continue;
|
|
82911
83279
|
var sourceData=item.SourceData; //叠加股票的所有数据
|
|
82912
|
-
if (!sourceData.MergeMinuteData(realtimeData)) return;
|
|
83280
|
+
if (!sourceData.MergeMinuteData(realtimeData,this.Period)) return;
|
|
82913
83281
|
|
|
82914
83282
|
var bindData=new ChartData();
|
|
82915
83283
|
bindData.Data=sourceData.Data;
|
|
@@ -87740,6 +88108,27 @@ KLineChartContainer.JsonDataToHistoryData=function(data)
|
|
|
87740
88108
|
return aryDayData;
|
|
87741
88109
|
}
|
|
87742
88110
|
|
|
88111
|
+
|
|
88112
|
+
KLineChartContainer.JsonDataToRealtimeDataV2=function(data, symbol)
|
|
88113
|
+
{
|
|
88114
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(data.stock)) return null;
|
|
88115
|
+
|
|
88116
|
+
var finder=null;
|
|
88117
|
+
for(var i=0;i<data.stock.length;++i)
|
|
88118
|
+
{
|
|
88119
|
+
var item=data.stock[i];
|
|
88120
|
+
if (item.symbol==symbol)
|
|
88121
|
+
{
|
|
88122
|
+
finder=item;
|
|
88123
|
+
break;
|
|
88124
|
+
}
|
|
88125
|
+
}
|
|
88126
|
+
|
|
88127
|
+
if (!finder) return null;
|
|
88128
|
+
|
|
88129
|
+
return KLineChartContainer.JsonDataToHistoryData(finder);
|
|
88130
|
+
}
|
|
88131
|
+
|
|
87743
88132
|
KLineChartContainer.JsonDataToRealtimeData=function(data, symbol)
|
|
87744
88133
|
{
|
|
87745
88134
|
if (!data.stock) return null;
|
|
@@ -129420,6 +129809,23 @@ function GetBlackStyle()
|
|
|
129420
129809
|
LineDash:[2,2]
|
|
129421
129810
|
},
|
|
129422
129811
|
|
|
129812
|
+
PredictionKLine:
|
|
129813
|
+
{
|
|
129814
|
+
Line:
|
|
129815
|
+
{
|
|
129816
|
+
Color:"rgb(220,220,220)",
|
|
129817
|
+
LineDash:[3*GetDevicePixelRatio(),3*GetDevicePixelRatio()]
|
|
129818
|
+
},
|
|
129819
|
+
|
|
129820
|
+
Bar:
|
|
129821
|
+
{
|
|
129822
|
+
UpColor:"rgb(30,144,255)",
|
|
129823
|
+
DownColor:"rgb(30,144,255)",
|
|
129824
|
+
UnchangeColor:"rgb(30,144,255)" ,
|
|
129825
|
+
DrawType:3
|
|
129826
|
+
}
|
|
129827
|
+
},
|
|
129828
|
+
|
|
129423
129829
|
PriceGapStyple:
|
|
129424
129830
|
{
|
|
129425
129831
|
Line:{ Color:"rgb(128,128,128)" },
|
|
@@ -149193,6 +149599,10 @@ function JSDialogModifyDraw()
|
|
|
149193
149599
|
bShowLineColor=false;
|
|
149194
149600
|
bAdvanced=true;
|
|
149195
149601
|
}
|
|
149602
|
+
else if (chart.ClassName=="ChartDrawPictureIconFont")
|
|
149603
|
+
{
|
|
149604
|
+
bShowFontZoom=true;
|
|
149605
|
+
}
|
|
149196
149606
|
|
|
149197
149607
|
if (this.ColorButton)
|
|
149198
149608
|
{
|
|
@@ -154786,7 +155196,7 @@ function HQChartScriptWorker()
|
|
|
154786
155196
|
|
|
154787
155197
|
|
|
154788
155198
|
|
|
154789
|
-
var HQCHART_VERSION="1.1.
|
|
155199
|
+
var HQCHART_VERSION="1.1.14551";
|
|
154790
155200
|
|
|
154791
155201
|
function PrintHQChartVersion()
|
|
154792
155202
|
{
|