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
package/src/jscommon/umychart.js
CHANGED
|
@@ -576,6 +576,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
|
|
|
576
576
|
if (IFrameSplitOperator.IsBool(item.PriceGap.Enable)) klineChart.PriceGap.Enable=item.PriceGap.Enable;
|
|
577
577
|
if (IFrameSplitOperator.IsNumber(item.PriceGap.Count)) klineChart.PriceGap.Count=item.PriceGap.Count;
|
|
578
578
|
}
|
|
579
|
+
|
|
580
|
+
if (IFrameSplitOperator.IsBool(item.EnablePrediction)) klineChart.PredictionConfig.Enable=item.EnablePrediction;
|
|
579
581
|
}
|
|
580
582
|
|
|
581
583
|
if(option.KLineTitle)
|
|
@@ -3423,6 +3425,51 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
3423
3425
|
this.DialogSearchIndex=null;
|
|
3424
3426
|
}
|
|
3425
3427
|
|
|
3428
|
+
this.DestroyDialogDrawTool=function()
|
|
3429
|
+
{
|
|
3430
|
+
if (!this.DialogDrawTool) return;
|
|
3431
|
+
|
|
3432
|
+
this.DialogDrawTool.Destroy();
|
|
3433
|
+
this.DialogDrawTool=null;
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3436
|
+
this.DestroyDialogModifyIndexParam=function()
|
|
3437
|
+
{
|
|
3438
|
+
if (this.DialogModifyIndexParam) return;
|
|
3439
|
+
|
|
3440
|
+
this.DialogModifyIndexParam.Destroy();
|
|
3441
|
+
this.DialogModifyIndexParam=null;
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
this.DestroyDialogSelectRect=function()
|
|
3445
|
+
{
|
|
3446
|
+
if (!this.DialogSelectRect) return;
|
|
3447
|
+
|
|
3448
|
+
this.DialogSelectRect.Destroy();
|
|
3449
|
+
this.DialogSelectRect=null;
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3452
|
+
this.DestroyDialogModifyDraw=function()
|
|
3453
|
+
{
|
|
3454
|
+
if (!this.DialogModifyDraw) return;
|
|
3455
|
+
|
|
3456
|
+
this.DialogModifyDraw.Destroy();
|
|
3457
|
+
this.DialogModifyDraw=null;
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
//隐藏内置的弹框div
|
|
3461
|
+
this.HideAllPopDiv=function()
|
|
3462
|
+
{
|
|
3463
|
+
this.HideFloatTooltip();
|
|
3464
|
+
this.CloseTooltipDialog();
|
|
3465
|
+
|
|
3466
|
+
if (this.DialogDrawTool) this.DialogDrawTool.Close();
|
|
3467
|
+
this.CloseModifyDrawDialog();
|
|
3468
|
+
|
|
3469
|
+
if (this.DialogSelectRect) this.DialogSelectRect.Close();
|
|
3470
|
+
if (this.DialogSearchIndex) this.DialogSearchIndex.Close();
|
|
3471
|
+
if (this.DialogModifyIndexParam) this.DialogModifyIndexParam.Close();
|
|
3472
|
+
}
|
|
3426
3473
|
|
|
3427
3474
|
|
|
3428
3475
|
//obj={ Element:, Canvas: }
|
|
@@ -3474,9 +3521,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
3474
3521
|
{
|
|
3475
3522
|
this.IsDestroy=true;
|
|
3476
3523
|
this.StopAutoUpdate();
|
|
3524
|
+
|
|
3477
3525
|
this.DestroyTooltipDialog();
|
|
3478
3526
|
this.DestroyFloatTooltip();
|
|
3527
|
+
|
|
3479
3528
|
this.DestroySearchIndexDialog();
|
|
3529
|
+
this.DestroyDialogModifyIndexParam();
|
|
3530
|
+
|
|
3531
|
+
this.DestroyDialogDrawTool();
|
|
3532
|
+
this.DestroyDialogModifyDraw();
|
|
3533
|
+
|
|
3534
|
+
this.DestroyDialogSelectRect();
|
|
3480
3535
|
}
|
|
3481
3536
|
|
|
3482
3537
|
this.ChartDestory=this.ChartDestroy; //老版本写错了,需要兼容下
|
|
@@ -23860,7 +23915,7 @@ function ChartData()
|
|
|
23860
23915
|
return result;
|
|
23861
23916
|
}
|
|
23862
23917
|
|
|
23863
|
-
this.MergeMinuteData=function(data) //合并数据
|
|
23918
|
+
this.MergeMinuteData=function(data, period) //合并数据
|
|
23864
23919
|
{
|
|
23865
23920
|
if (!this.Data || this.Data.length<=0)
|
|
23866
23921
|
{
|
|
@@ -23868,6 +23923,7 @@ function ChartData()
|
|
|
23868
23923
|
return true;
|
|
23869
23924
|
}
|
|
23870
23925
|
|
|
23926
|
+
var bDayPeriod=ChartData.IsDayPeriod(period, true);
|
|
23871
23927
|
var sourceFirstItem=this.Data[0];
|
|
23872
23928
|
var firstItemID=0;
|
|
23873
23929
|
var firstItem=null;
|
|
@@ -23881,11 +23937,23 @@ function ChartData()
|
|
|
23881
23937
|
break;
|
|
23882
23938
|
}
|
|
23883
23939
|
|
|
23884
|
-
if (
|
|
23940
|
+
if (bDayPeriod)
|
|
23885
23941
|
{
|
|
23886
|
-
|
|
23887
|
-
|
|
23888
|
-
|
|
23942
|
+
if (item.Date==sourceFirstItem.Date)
|
|
23943
|
+
{
|
|
23944
|
+
firstItemID=i;
|
|
23945
|
+
firstItem=item;
|
|
23946
|
+
break;
|
|
23947
|
+
}
|
|
23948
|
+
}
|
|
23949
|
+
else
|
|
23950
|
+
{
|
|
23951
|
+
if (item.Date==sourceFirstItem.Date && item.Time>=sourceFirstItem.Time)
|
|
23952
|
+
{
|
|
23953
|
+
firstItemID=i;
|
|
23954
|
+
firstItem=item;
|
|
23955
|
+
break;
|
|
23956
|
+
}
|
|
23889
23957
|
}
|
|
23890
23958
|
}
|
|
23891
23959
|
|
|
@@ -23898,11 +23966,23 @@ function ChartData()
|
|
|
23898
23966
|
var date=this.Data[i].Date;
|
|
23899
23967
|
var time=this.Data[i].Time;
|
|
23900
23968
|
|
|
23901
|
-
if (
|
|
23969
|
+
if (bDayPeriod)
|
|
23902
23970
|
{
|
|
23903
|
-
|
|
23904
|
-
|
|
23905
|
-
|
|
23971
|
+
if (firstItem.Date>date || firstItem.Date==date)
|
|
23972
|
+
{
|
|
23973
|
+
index=i;
|
|
23974
|
+
if (firstItem.Date==date) bFind=true;
|
|
23975
|
+
break;
|
|
23976
|
+
}
|
|
23977
|
+
}
|
|
23978
|
+
else
|
|
23979
|
+
{
|
|
23980
|
+
if (firstItem.Date>date || (firstItem.Date==date && firstItem.Time>=time) )
|
|
23981
|
+
{
|
|
23982
|
+
index=i;
|
|
23983
|
+
if (firstItem.Date==date && firstItem.Time==time) bFind=true;
|
|
23984
|
+
break;
|
|
23985
|
+
}
|
|
23906
23986
|
}
|
|
23907
23987
|
}
|
|
23908
23988
|
|
|
@@ -25816,9 +25896,30 @@ function ChartKLine()
|
|
|
25816
25896
|
DownAreaColor:g_JSChartResource.HLCArea.DownAreaColor,
|
|
25817
25897
|
}
|
|
25818
25898
|
|
|
25819
|
-
//虚线柱子
|
|
25899
|
+
//虚线柱子 (非交易日)
|
|
25820
25900
|
this.VirtualBarConfig={ Color:g_JSChartResource.VirtualKLine.Color, LineDash:g_JSChartResource.VirtualKLine.LineDash };
|
|
25821
25901
|
|
|
25902
|
+
//预测线配置
|
|
25903
|
+
this.PredictionConfig=
|
|
25904
|
+
{
|
|
25905
|
+
Line:
|
|
25906
|
+
{
|
|
25907
|
+
Color:g_JSChartResource.PredictionKLine.Line.Color,
|
|
25908
|
+
LineDash:g_JSChartResource.PredictionKLine.Line.LineDash,
|
|
25909
|
+
LineWidth:g_JSChartResource.PredictionKLine.Line.LineWidth
|
|
25910
|
+
},
|
|
25911
|
+
|
|
25912
|
+
Bar:
|
|
25913
|
+
{
|
|
25914
|
+
UpColor:g_JSChartResource.PredictionKLine.Bar.UpColor,
|
|
25915
|
+
DownColor:g_JSChartResource.PredictionKLine.Bar.DownColor,
|
|
25916
|
+
UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor ,
|
|
25917
|
+
DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
|
|
25918
|
+
},
|
|
25919
|
+
Enable:false, //是否启动
|
|
25920
|
+
};
|
|
25921
|
+
this.AryPredictionCache=[]; //预测数据
|
|
25922
|
+
|
|
25822
25923
|
//DrawType==14 自定义图形
|
|
25823
25924
|
this.FFKChart;
|
|
25824
25925
|
|
|
@@ -25956,6 +26057,22 @@ function ChartKLine()
|
|
|
25956
26057
|
this.OrderFlow.UnchagneColor= { BG:g_JSChartResource.OrderFlow.UnchagneColor.BG, Border:g_JSChartResource.OrderFlow.UnchagneColor.Border };
|
|
25957
26058
|
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 };
|
|
25958
26059
|
this.OrderFlow.Line={ UpDownColor: g_JSChartResource.OrderFlow.Line.UpDownColor, MiddleColor:g_JSChartResource.OrderFlow.Line.MiddleColor };
|
|
26060
|
+
|
|
26061
|
+
this.PredictionConfig.Line=
|
|
26062
|
+
{
|
|
26063
|
+
Color:g_JSChartResource.PredictionKLine.Line.Color,
|
|
26064
|
+
LineDash:g_JSChartResource.PredictionKLine.Line.LineDash,
|
|
26065
|
+
LineWidth:g_JSChartResource.PredictionKLine.Line.LineWidth
|
|
26066
|
+
};
|
|
26067
|
+
|
|
26068
|
+
this.PredictionConfig.Bar=
|
|
26069
|
+
{
|
|
26070
|
+
UpColor:g_JSChartResource.PredictionKLine.Bar.UpColor,
|
|
26071
|
+
DownColor:g_JSChartResource.PredictionKLine.Bar.DownColor,
|
|
26072
|
+
UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor,
|
|
26073
|
+
DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
|
|
26074
|
+
};
|
|
26075
|
+
|
|
25959
26076
|
}
|
|
25960
26077
|
|
|
25961
26078
|
this.ClearCustomKLine=function()
|
|
@@ -26326,6 +26443,8 @@ function ChartKLine()
|
|
|
26326
26443
|
this.DrawKRange.Start=this.Data.DataOffset;
|
|
26327
26444
|
|
|
26328
26445
|
var preKItemInfo=null;
|
|
26446
|
+
var prePoint=null;
|
|
26447
|
+
var xEnd=null; //最后一个点
|
|
26329
26448
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
26330
26449
|
{
|
|
26331
26450
|
var data=this.Data.Data[i];
|
|
@@ -26339,6 +26458,13 @@ function ChartKLine()
|
|
|
26339
26458
|
var yClose=this.GetYFromData(data.Close,false);
|
|
26340
26459
|
this.DrawKRange.End=i;
|
|
26341
26460
|
|
|
26461
|
+
if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
|
|
26462
|
+
{
|
|
26463
|
+
this.AryPredictionCache.push({ PrePoint:prePoint, Point:{ X:x, Y:yClose }});
|
|
26464
|
+
prePoint={ X:x, Y:yClose};
|
|
26465
|
+
continue;
|
|
26466
|
+
}
|
|
26467
|
+
|
|
26342
26468
|
if (bFirstPoint)
|
|
26343
26469
|
{
|
|
26344
26470
|
if (isHScreen)
|
|
@@ -26359,6 +26485,9 @@ function ChartKLine()
|
|
|
26359
26485
|
else this.Canvas.lineTo(x,yClose);
|
|
26360
26486
|
}
|
|
26361
26487
|
|
|
26488
|
+
xEnd=x;
|
|
26489
|
+
prePoint={ X:x, Y:yClose};
|
|
26490
|
+
|
|
26362
26491
|
if (i==this.Data.Data.length-1)
|
|
26363
26492
|
{
|
|
26364
26493
|
ptLast={ X:x, Y:yClose, XLeft:left, XRight:right, KItem:data, ChartRight:chartright };
|
|
@@ -26390,12 +26519,12 @@ function ChartKLine()
|
|
|
26390
26519
|
this.Canvas.stroke();
|
|
26391
26520
|
if (isHScreen)
|
|
26392
26521
|
{
|
|
26393
|
-
this.Canvas.lineTo(border.Left,
|
|
26522
|
+
this.Canvas.lineTo(border.Left,xEnd);
|
|
26394
26523
|
this.Canvas.lineTo(border.Left,firstPoint.Y);
|
|
26395
26524
|
}
|
|
26396
26525
|
else
|
|
26397
26526
|
{
|
|
26398
|
-
this.Canvas.lineTo(
|
|
26527
|
+
this.Canvas.lineTo(xEnd,border.Bottom);
|
|
26399
26528
|
this.Canvas.lineTo(firstPoint.X,border.Bottom);
|
|
26400
26529
|
}
|
|
26401
26530
|
this.Canvas.closePath();
|
|
@@ -26458,11 +26587,12 @@ function ChartKLine()
|
|
|
26458
26587
|
var mapBreakPoint=this.BuildBreakPoint(); //断点
|
|
26459
26588
|
|
|
26460
26589
|
var preKItemInfo=null;
|
|
26590
|
+
var prePoint=null;
|
|
26461
26591
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
26462
26592
|
{
|
|
26463
26593
|
var data=this.Data.Data[i];
|
|
26464
26594
|
this.ShowRange.End=i;
|
|
26465
|
-
if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
26595
|
+
if (!data || data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
26466
26596
|
|
|
26467
26597
|
var left=xOffset;
|
|
26468
26598
|
var right=xOffset+dataWidth;
|
|
@@ -26471,6 +26601,13 @@ function ChartKLine()
|
|
|
26471
26601
|
var yClose=this.GetYFromData(data.Close,false);
|
|
26472
26602
|
this.DrawKRange.End=i;
|
|
26473
26603
|
|
|
26604
|
+
if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
|
|
26605
|
+
{
|
|
26606
|
+
this.AryPredictionCache.push({ PrePoint:prePoint, Point:{ X:x, Y:yClose }});
|
|
26607
|
+
prePoint={ X:x, Y:yClose};
|
|
26608
|
+
continue;
|
|
26609
|
+
}
|
|
26610
|
+
|
|
26474
26611
|
if (bFirstPoint)
|
|
26475
26612
|
{
|
|
26476
26613
|
if (isHScreen) this.Canvas.moveTo(yClose,x);
|
|
@@ -26484,6 +26621,8 @@ function ChartKLine()
|
|
|
26484
26621
|
}
|
|
26485
26622
|
++drawCount;
|
|
26486
26623
|
|
|
26624
|
+
prePoint={ X:x, Y:yClose};
|
|
26625
|
+
|
|
26487
26626
|
if (this.PriceGap.Enable)
|
|
26488
26627
|
{
|
|
26489
26628
|
var yLow=this.GetYFromData(data.Low, false);
|
|
@@ -26558,6 +26697,7 @@ function ChartKLine()
|
|
|
26558
26697
|
}
|
|
26559
26698
|
|
|
26560
26699
|
var preKItemInfo=null;
|
|
26700
|
+
var prePoint=null; //上一个点的位置
|
|
26561
26701
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
26562
26702
|
{
|
|
26563
26703
|
var data=this.Data.Data[i];
|
|
@@ -26607,6 +26747,10 @@ function ChartKLine()
|
|
|
26607
26747
|
{
|
|
26608
26748
|
this.DrawVirtualBar(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
26609
26749
|
}
|
|
26750
|
+
else if (data.IsVirtual && this.PredictionConfig.Enable)
|
|
26751
|
+
{
|
|
26752
|
+
this.DrawPredictionBar(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
26753
|
+
}
|
|
26610
26754
|
else if (kLineOption)
|
|
26611
26755
|
{
|
|
26612
26756
|
var barColor=kLineOption.Color;
|
|
@@ -26688,6 +26832,8 @@ function ChartKLine()
|
|
|
26688
26832
|
if (value>0)
|
|
26689
26833
|
this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
|
|
26690
26834
|
}
|
|
26835
|
+
|
|
26836
|
+
prePoint={ X:x, Y:yClose }; //上一个点
|
|
26691
26837
|
|
|
26692
26838
|
preKItemInfo=kItemInfo;
|
|
26693
26839
|
}
|
|
@@ -27559,6 +27705,82 @@ function ChartKLine()
|
|
|
27559
27705
|
this.Canvas.setLineDash([]);
|
|
27560
27706
|
}
|
|
27561
27707
|
|
|
27708
|
+
this.DrawPredictionBar=function(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen)
|
|
27709
|
+
{
|
|
27710
|
+
var config=this.PredictionConfig.Bar;
|
|
27711
|
+
var drawType=this.DrawType;
|
|
27712
|
+
if (IFrameSplitOperator.IsNumber(config.DrawType)) drawType=config.DrawType;
|
|
27713
|
+
|
|
27714
|
+
if (data.Open<data.Close) //阳线
|
|
27715
|
+
{
|
|
27716
|
+
this.DrawKBar_Up(data, dataWidth, config.UpColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
27717
|
+
}
|
|
27718
|
+
else if (data.Open>data.Close) //阴线
|
|
27719
|
+
{
|
|
27720
|
+
this.DrawKBar_Down(data, dataWidth, config.DownColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
27721
|
+
}
|
|
27722
|
+
else
|
|
27723
|
+
{
|
|
27724
|
+
this.DrawKBar_Unchagne(data, dataWidth, config.UnchangeColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
27725
|
+
}
|
|
27726
|
+
}
|
|
27727
|
+
|
|
27728
|
+
this.DrawPredictionLine=function()
|
|
27729
|
+
{
|
|
27730
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryPredictionCache)) return;
|
|
27731
|
+
|
|
27732
|
+
this.Canvas.save();
|
|
27733
|
+
|
|
27734
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
27735
|
+
var bFirstPoint=true;
|
|
27736
|
+
var drawCount=0;
|
|
27737
|
+
for(var i=0;i<this.AryPredictionCache.length;++i)
|
|
27738
|
+
{
|
|
27739
|
+
var item=this.AryPredictionCache[i];
|
|
27740
|
+
if (bFirstPoint)
|
|
27741
|
+
{
|
|
27742
|
+
bFirstPoint=false;
|
|
27743
|
+
this.Canvas.beginPath();
|
|
27744
|
+
if (item.PrePoint)
|
|
27745
|
+
{
|
|
27746
|
+
var pt=item.PrePoint;
|
|
27747
|
+
if (bHScreen) this.Canvas.moveTo(pt.Y,pt.X); //横屏坐标轴对调
|
|
27748
|
+
else this.Canvas.moveTo(pt.X,pt.Y);
|
|
27749
|
+
|
|
27750
|
+
var pt=item.Point;
|
|
27751
|
+
if (bHScreen) this.Canvas.lineTo(pt.Y,pt.X);
|
|
27752
|
+
else this.Canvas.lineTo(pt.X,pt.Y);
|
|
27753
|
+
}
|
|
27754
|
+
else if (item.Point)
|
|
27755
|
+
{
|
|
27756
|
+
var pt=item.Point;
|
|
27757
|
+
if (bHScreen) this.Canvas.moveTo(pt.Y,pt.X); //横屏坐标轴对调
|
|
27758
|
+
else this.Canvas.moveTo(pt.X,pt.Y);
|
|
27759
|
+
}
|
|
27760
|
+
}
|
|
27761
|
+
else
|
|
27762
|
+
{
|
|
27763
|
+
var pt=item.Point;
|
|
27764
|
+
if (bHScreen) this.Canvas.lineTo(pt.Y,pt.X);
|
|
27765
|
+
else this.Canvas.lineTo(pt.X,pt.Y);
|
|
27766
|
+
}
|
|
27767
|
+
|
|
27768
|
+
++drawCount;
|
|
27769
|
+
}
|
|
27770
|
+
|
|
27771
|
+
if (drawCount>0)
|
|
27772
|
+
{
|
|
27773
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
27774
|
+
var config=this.PredictionConfig.Line;
|
|
27775
|
+
this.Canvas.strokeStyle=config.Color;
|
|
27776
|
+
if (IFrameSplitOperator.IsNumber(config.LineWidth)) this.Canvas.lineWidth=config.LineWidth*pixelRatio;
|
|
27777
|
+
if (IFrameSplitOperator.IsNonEmptyArray(config.LineDash)) this.Canvas.setLineDash(config.LineDash)
|
|
27778
|
+
this.Canvas.stroke();
|
|
27779
|
+
}
|
|
27780
|
+
|
|
27781
|
+
this.Canvas.restore();
|
|
27782
|
+
}
|
|
27783
|
+
|
|
27562
27784
|
this.DrawRenkoCandle=function() //砖型K线
|
|
27563
27785
|
{
|
|
27564
27786
|
var isHScreen=(this.ChartFrame.IsHScreen===true);
|
|
@@ -28375,6 +28597,7 @@ function ChartKLine()
|
|
|
28375
28597
|
this.PtMin={X:null,Y:null,Value:null,Align:'left'}; //清空最小
|
|
28376
28598
|
this.DrawKRange={ Start:null, End:null };
|
|
28377
28599
|
this.AryPriceGapCache=[];
|
|
28600
|
+
this.AryPredictionCache=[];
|
|
28378
28601
|
|
|
28379
28602
|
this.ChartFrame.ChartKLine={Max:null, Min:null }; //保存K线上 显示最大最小值坐标
|
|
28380
28603
|
|
|
@@ -28415,6 +28638,7 @@ function ChartKLine()
|
|
|
28415
28638
|
{
|
|
28416
28639
|
this.DrawCloseLine();
|
|
28417
28640
|
this.Canvas.restore();
|
|
28641
|
+
this.DrawPredictionLine();
|
|
28418
28642
|
if (this.PriceGap.Enable) this.DrawPriceGap();
|
|
28419
28643
|
return;
|
|
28420
28644
|
}
|
|
@@ -28487,6 +28711,7 @@ function ChartKLine()
|
|
|
28487
28711
|
|
|
28488
28712
|
this.Canvas.restore();
|
|
28489
28713
|
|
|
28714
|
+
this.DrawPredictionLine();
|
|
28490
28715
|
if (this.PriceGap.Enable) this.DrawPriceGap();
|
|
28491
28716
|
|
|
28492
28717
|
if (this.IsShowMaxMinPrice) //标注最大值最小值
|
|
@@ -35266,6 +35491,7 @@ function ChartVolStick()
|
|
|
35266
35491
|
var value=this.Data.Data[i];
|
|
35267
35492
|
var kItem=this.HistoryData.Data[i];
|
|
35268
35493
|
if (value==null || kItem==null) continue;
|
|
35494
|
+
if (!IFrameSplitOperator.IsNumber(value)) continue;
|
|
35269
35495
|
if (value==0) continue;
|
|
35270
35496
|
|
|
35271
35497
|
var left=xOffset;
|
|
@@ -35855,23 +36081,22 @@ function ChartStickLine()
|
|
|
35855
36081
|
delete this.newMethod;
|
|
35856
36082
|
|
|
35857
36083
|
this.ClassName='ChartStickLine'; //类名
|
|
35858
|
-
this.Color="rgb(255,193,37)";
|
|
35859
|
-
this.BarType=0;
|
|
35860
|
-
this.LineDotted=[3,3];
|
|
35861
|
-
this.Width=0;
|
|
36084
|
+
this.Color="rgb(255,193,37)"; //线段颜色
|
|
36085
|
+
this.BarType=0; //柱子类型 0=实心 1=空心 -1=画虚线空心柱
|
|
36086
|
+
this.LineDotted=[3,3]; //虚线设置
|
|
36087
|
+
this.Width=0; //柱子宽度 0=1 3,50=k线宽度 101=K线宽度+间距宽度
|
|
36088
|
+
this.IsHScreen=false;
|
|
36089
|
+
|
|
36090
|
+
this.EmptyBGColor=null; //空心柱子背景色(缓存)
|
|
36091
|
+
this.BarCache={ }; //Type:1=线段 2=柱子
|
|
35862
36092
|
|
|
35863
36093
|
this.SetEmptyBar=function() //设置空心柱子
|
|
35864
36094
|
{
|
|
35865
36095
|
if (this.BarType!=1 && this.BarType!=-1) return false;
|
|
35866
36096
|
|
|
35867
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
35868
|
-
this.Canvas.strokeStyle=this.Color;
|
|
35869
36097
|
var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
|
|
35870
|
-
if (emptyBGColor) this.
|
|
35871
|
-
if (this.BarType==-1)
|
|
35872
|
-
{
|
|
35873
|
-
this.Canvas.setLineDash(this.LineDotted); //虚线
|
|
35874
|
-
}
|
|
36098
|
+
if (emptyBGColor) this.BarCache.EmptyBGColor=emptyBGColor;
|
|
36099
|
+
if (this.BarType==-1) this.BarCache.LineDotted=this.LineDotted;
|
|
35875
36100
|
|
|
35876
36101
|
return true;
|
|
35877
36102
|
}
|
|
@@ -35881,13 +36106,6 @@ function ChartStickLine()
|
|
|
35881
36106
|
return (this.BarType==1 || this.BarType==-1);
|
|
35882
36107
|
}
|
|
35883
36108
|
|
|
35884
|
-
this.CalculateBarHeight=function(y,y2)
|
|
35885
|
-
{
|
|
35886
|
-
var barHeight=Math.abs(y-y2);
|
|
35887
|
-
if (barHeight<=0) barHeight=1;
|
|
35888
|
-
return barHeight;
|
|
35889
|
-
}
|
|
35890
|
-
|
|
35891
36109
|
this.Draw=function()
|
|
35892
36110
|
{
|
|
35893
36111
|
if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
|
|
@@ -35902,81 +36120,93 @@ function ChartStickLine()
|
|
|
35902
36120
|
|
|
35903
36121
|
if (!this.Data || !this.Data.Data) return;
|
|
35904
36122
|
|
|
35905
|
-
var
|
|
36123
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
36124
|
+
this.BarCache={ Color:this.Color, EmptyBGColor:null, Width:1*pixelRatio, Type:0, LineDotted:null };
|
|
36125
|
+
|
|
36126
|
+
this.IsHScreen=(this.ChartFrame.IsHScreen===true);;
|
|
35906
36127
|
var dataWidth=this.ChartFrame.DataWidth;
|
|
35907
36128
|
var distanceWidth=this.ChartFrame.DistanceWidth;
|
|
35908
36129
|
var chartright=this.ChartBorder.GetRight();
|
|
35909
|
-
var zoomIndex=this.ChartFrame.ZoomIndex;
|
|
35910
|
-
if (isHScreen) chartright=this.ChartBorder.GetBottom();
|
|
35911
36130
|
var xPointCount=this.ChartFrame.XPointCount;
|
|
35912
36131
|
var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
35913
|
-
if (
|
|
36132
|
+
if (this.IsHScreen)
|
|
36133
|
+
{
|
|
36134
|
+
chartright=this.ChartBorder.GetBottom();
|
|
36135
|
+
xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
36136
|
+
}
|
|
35914
36137
|
|
|
35915
36138
|
var isMinute=this.IsMinuteFrame();
|
|
35916
36139
|
|
|
35917
|
-
this.Canvas.save();
|
|
35918
|
-
var bFillBar=false;
|
|
35919
|
-
var bFillKLine=false;
|
|
35920
|
-
var emptyBGColor=g_JSChartResource.EmptyBarBGColor;
|
|
35921
|
-
|
|
35922
36140
|
if (isMinute)
|
|
35923
36141
|
{
|
|
35924
|
-
if (this.Width>1) this.
|
|
35925
|
-
|
|
35926
|
-
this.Canvas.strokeStyle=this.Color;
|
|
36142
|
+
if (this.Width>1) this.BarCache.Width=2*pixelRatio;
|
|
36143
|
+
this.BarCache.Type=1;
|
|
35927
36144
|
}
|
|
35928
|
-
else if(this.Width
|
|
36145
|
+
else if(this.Width<=0) //宽度时0,使用宽度1
|
|
35929
36146
|
{
|
|
36147
|
+
this.BarCache.Type=1;
|
|
35930
36148
|
this.SetEmptyBar();
|
|
35931
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
35932
|
-
this.Canvas.strokeStyle=this.Color;
|
|
35933
36149
|
}
|
|
35934
36150
|
else if (this.Width==3 || this.Width==50) //3和50 K线宽度
|
|
35935
36151
|
{
|
|
36152
|
+
this.BarCache.Type=1;
|
|
35936
36153
|
if (dataWidth>=4)
|
|
35937
36154
|
{
|
|
35938
|
-
|
|
36155
|
+
this.BarCache.Type=2;
|
|
36156
|
+
this.BarCache.Width=dataWidth;
|
|
35939
36157
|
this.SetEmptyBar();
|
|
35940
|
-
if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
|
|
35941
|
-
this.Canvas.strokeStyle=this.Color;
|
|
35942
36158
|
}
|
|
35943
|
-
else //太细了 画竖线
|
|
35944
|
-
{
|
|
35945
|
-
this.Canvas.lineWidth=GetDevicePixelRatio();
|
|
35946
|
-
this.Canvas.strokeStyle=this.Color;
|
|
35947
|
-
}
|
|
35948
36159
|
}
|
|
35949
|
-
else if (this.Width==101)
|
|
36160
|
+
else if (this.Width==101) //柱子+间距
|
|
35950
36161
|
{
|
|
35951
|
-
|
|
35952
|
-
|
|
35953
|
-
|
|
36162
|
+
this.BarCache.Type=1;
|
|
36163
|
+
var lineWidth=dataWidth+distanceWidth+1*pixelRatio;
|
|
36164
|
+
if (lineWidth>=4)
|
|
36165
|
+
{
|
|
36166
|
+
this.BarCache.Type=2;
|
|
36167
|
+
this.BarCache.Width=lineWidth
|
|
36168
|
+
this.SetEmptyBar();
|
|
36169
|
+
}
|
|
35954
36170
|
}
|
|
35955
36171
|
else if (this.Width<=3)
|
|
35956
36172
|
{
|
|
35957
|
-
var minWidth=2*
|
|
36173
|
+
var minWidth=2*pixelRatio;
|
|
35958
36174
|
var barWidth=dataWidth*(this.Width/3);
|
|
35959
36175
|
if (barWidth<minWidth) barWidth=minWidth;
|
|
35960
|
-
this.
|
|
35961
|
-
if (
|
|
35962
|
-
|
|
36176
|
+
this.BarCache.Type=1;
|
|
36177
|
+
if (barWidth>=4)
|
|
36178
|
+
{
|
|
36179
|
+
this.BarCache.Type=2;
|
|
36180
|
+
this.BarCache.Width=barWidth;
|
|
36181
|
+
this.SetEmptyBar();
|
|
36182
|
+
}
|
|
35963
36183
|
}
|
|
35964
36184
|
else
|
|
35965
36185
|
{
|
|
35966
|
-
var barWidth=this.Width*
|
|
36186
|
+
var barWidth=this.Width*pixelRatio+dataWidth;
|
|
36187
|
+
this.BarCache.Type=2;
|
|
36188
|
+
this.BarCache.Width=barWidth;
|
|
35967
36189
|
this.SetEmptyBar();
|
|
35968
|
-
if (!this.IsEmptyBar()) this.Canvas.fillStyle=this.Color;
|
|
35969
|
-
bFillBar=true;
|
|
35970
36190
|
}
|
|
35971
36191
|
|
|
36192
|
+
this.Canvas.save();
|
|
36193
|
+
this.ClipClient(this.IsHScreen);
|
|
36194
|
+
|
|
36195
|
+
this.Canvas.strokeStyle=this.BarCache.Color;
|
|
36196
|
+
if (this.BarCache.EmptyBGColor) this.Canvas.fillStyle=this.BarCache.EmptyBGColor; //空心柱子
|
|
36197
|
+
else this.Canvas.fillStyle=this.BarCache.Color;
|
|
36198
|
+
if (IFrameSplitOperator.IsNonEmptyArray(this.BarCache.LineDotted)) this.Canvas.setLineDash(this.BarCache.LineDotted); //虚线
|
|
36199
|
+
if (this.BarCache.Type==1) this.Canvas.lineWidth=this.BarCache.Width;
|
|
36200
|
+
|
|
35972
36201
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
35973
36202
|
{
|
|
35974
36203
|
var value=this.Data.Data[i];
|
|
35975
|
-
if (value
|
|
36204
|
+
if (!value) continue;
|
|
36205
|
+
if (!IFrameSplitOperator.IsNumber(value.Value)) continue;
|
|
35976
36206
|
|
|
35977
36207
|
var price=value.Value;
|
|
35978
|
-
var price2=
|
|
35979
|
-
if (
|
|
36208
|
+
var price2=0;
|
|
36209
|
+
if (IFrameSplitOperator.IsNumber(value.Value2)) price2=value.Value2;
|
|
35980
36210
|
|
|
35981
36211
|
if (isMinute)
|
|
35982
36212
|
{
|
|
@@ -35989,103 +36219,79 @@ function ChartStickLine()
|
|
|
35989
36219
|
var x=left+(right-left)/2;
|
|
35990
36220
|
}
|
|
35991
36221
|
|
|
35992
|
-
var y=this.ChartFrame.GetYFromData(price);
|
|
35993
|
-
var y2=this.ChartFrame.GetYFromData(price2);
|
|
36222
|
+
var y=this.ChartFrame.GetYFromData(price,false);
|
|
36223
|
+
var y2=this.ChartFrame.GetYFromData(price2,false);
|
|
35994
36224
|
|
|
35995
36225
|
if (x>chartright) break;
|
|
35996
36226
|
|
|
35997
|
-
|
|
35998
|
-
|
|
35999
|
-
|
|
36000
|
-
{
|
|
36001
|
-
var left=x-barWidth/2;
|
|
36002
|
-
var width=barWidth;
|
|
36003
|
-
if (this.IsEmptyBar()) //空心
|
|
36004
|
-
{
|
|
36005
|
-
this.Canvas.beginPath();
|
|
36006
|
-
this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
|
|
36007
|
-
this.Canvas.stroke();
|
|
36008
|
-
}
|
|
36009
|
-
else
|
|
36010
|
-
{
|
|
36011
|
-
this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(left),ToFixedRect(Math.abs(y-y2)),ToFixedRect(width));
|
|
36012
|
-
}
|
|
36013
|
-
}
|
|
36014
|
-
else
|
|
36015
|
-
{
|
|
36016
|
-
var left=x-barWidth/2;
|
|
36017
|
-
var width=barWidth;
|
|
36018
|
-
if (left+width>chartright) width=chartright-left; //不要超过右边框子
|
|
36019
|
-
if (this.IsEmptyBar()) //空心
|
|
36020
|
-
{
|
|
36021
|
-
if (emptyBGColor)
|
|
36022
|
-
this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,y2)),ToFixedRect(width),ToFixedRect(Math.abs(y-y2)));
|
|
36227
|
+
var xCenter=x;
|
|
36228
|
+
var yTop=Math.min(y,y2);
|
|
36229
|
+
var barHeight=Math.abs(y-y2); //柱子高度
|
|
36023
36230
|
|
|
36024
|
-
|
|
36025
|
-
|
|
36026
|
-
|
|
36027
|
-
|
|
36028
|
-
|
|
36029
|
-
|
|
36030
|
-
|
|
36031
|
-
|
|
36032
|
-
|
|
36231
|
+
this.DrawBar(xCenter, yTop, barHeight);
|
|
36232
|
+
}
|
|
36233
|
+
|
|
36234
|
+
this.Canvas.restore();
|
|
36235
|
+
}
|
|
36236
|
+
|
|
36237
|
+
this.DrawBar=function(xCenter, ytop, barHeight)
|
|
36238
|
+
{
|
|
36239
|
+
if (barHeight<1) barHeight=1;
|
|
36240
|
+
|
|
36241
|
+
if (this.BarCache.Type==1) //线段
|
|
36242
|
+
{
|
|
36243
|
+
if (this.IsHScreen)
|
|
36244
|
+
{
|
|
36245
|
+
this.Canvas.beginPath();
|
|
36246
|
+
this.Canvas.moveTo(ytop,ToFixedPoint(xCenter));
|
|
36247
|
+
this.Canvas.lineTo(ytop+barHeight,ToFixedPoint(xCenter));
|
|
36248
|
+
this.Canvas.stroke();
|
|
36249
|
+
}
|
|
36250
|
+
else
|
|
36251
|
+
{
|
|
36252
|
+
this.Canvas.beginPath();
|
|
36253
|
+
this.Canvas.moveTo(ToFixedPoint(xCenter),ytop);
|
|
36254
|
+
this.Canvas.lineTo(ToFixedPoint(xCenter),ytop+barHeight);
|
|
36255
|
+
this.Canvas.stroke();
|
|
36033
36256
|
}
|
|
36034
|
-
|
|
36257
|
+
}
|
|
36258
|
+
else if (this.BarCache.Type==2) //柱子
|
|
36259
|
+
{
|
|
36260
|
+
if (this.IsHScreen)
|
|
36035
36261
|
{
|
|
36036
|
-
|
|
36262
|
+
var xLeft=xCenter-this.BarCache.Width/2;
|
|
36263
|
+
if (this.IsEmptyBar()) //空心
|
|
36037
36264
|
{
|
|
36038
|
-
if (
|
|
36039
|
-
|
|
36040
|
-
this.Canvas.beginPath();
|
|
36041
|
-
this.Canvas.rect(ToFixedPoint(Math.min(y,y2)),ToFixedPoint(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
|
|
36042
|
-
this.Canvas.stroke();
|
|
36043
|
-
}
|
|
36044
|
-
else
|
|
36045
|
-
{
|
|
36046
|
-
if (emptyBGColor)
|
|
36047
|
-
this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(y-y2)));
|
|
36265
|
+
if (this.BarCache.EmptyBGColor) //背景色填充
|
|
36266
|
+
this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
36048
36267
|
|
|
36049
|
-
|
|
36050
|
-
|
|
36051
|
-
|
|
36052
|
-
}
|
|
36268
|
+
this.Canvas.beginPath();
|
|
36269
|
+
this.Canvas.rect(ToFixedPoint(ytop),ToFixedPoint(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
36270
|
+
this.Canvas.stroke();
|
|
36053
36271
|
}
|
|
36054
36272
|
else
|
|
36055
36273
|
{
|
|
36056
|
-
|
|
36057
|
-
{
|
|
36058
|
-
this.Canvas.fillRect(ToFixedRect(Math.min(y,y2)),ToFixedRect(xOffset),ToFixedRect(Math.abs(y-y2)),ToFixedRect(dataWidth));
|
|
36059
|
-
}
|
|
36060
|
-
else
|
|
36061
|
-
{
|
|
36062
|
-
this.Canvas.fillRect(ToFixedRect(xOffset),ToFixedRect(Math.min(y,y2)),ToFixedRect(dataWidth),ToFixedRect(this.CalculateBarHeight(y,y2)));
|
|
36063
|
-
}
|
|
36064
|
-
|
|
36274
|
+
this.Canvas.fillRect(ToFixedRect(ytop),ToFixedRect(xLeft),ToFixedRect(barHeight),ToFixedRect(this.BarCache.Width));
|
|
36065
36275
|
}
|
|
36066
36276
|
}
|
|
36067
36277
|
else
|
|
36068
36278
|
{
|
|
36069
|
-
|
|
36279
|
+
var xLeft=xCenter-this.BarCache.Width/2;
|
|
36280
|
+
if (this.IsEmptyBar()) //空心
|
|
36070
36281
|
{
|
|
36282
|
+
if (this.BarCache.EmptyBGColor) //背景色填充
|
|
36283
|
+
this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
36284
|
+
|
|
36071
36285
|
this.Canvas.beginPath();
|
|
36072
|
-
this.Canvas.
|
|
36073
|
-
this.Canvas.lineTo(y2,ToFixedPoint(x));
|
|
36286
|
+
this.Canvas.rect(ToFixedPoint(xLeft),ToFixedPoint(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
36074
36287
|
this.Canvas.stroke();
|
|
36075
36288
|
}
|
|
36076
36289
|
else
|
|
36077
36290
|
{
|
|
36078
|
-
|
|
36079
|
-
this.Canvas.beginPath();
|
|
36080
|
-
this.Canvas.moveTo(xFix,y);
|
|
36081
|
-
if (Math.abs(y-y2)>0) this.Canvas.lineTo(xFix,y2);
|
|
36082
|
-
else this.Canvas.lineTo(xFix,y+1); //太窄了,就画一个像素的宽度
|
|
36083
|
-
this.Canvas.stroke();
|
|
36291
|
+
this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(ytop),ToFixedRect(this.BarCache.Width),ToFixedRect(barHeight));
|
|
36084
36292
|
}
|
|
36085
36293
|
}
|
|
36086
36294
|
}
|
|
36087
|
-
|
|
36088
|
-
this.Canvas.restore();
|
|
36089
36295
|
}
|
|
36090
36296
|
|
|
36091
36297
|
this.GetMaxMin=function()
|
|
@@ -72203,6 +72409,24 @@ function JSChartResource()
|
|
|
72203
72409
|
LineDash:[2,2]
|
|
72204
72410
|
};
|
|
72205
72411
|
|
|
72412
|
+
this.PredictionKLine=
|
|
72413
|
+
{
|
|
72414
|
+
Line:
|
|
72415
|
+
{
|
|
72416
|
+
Color:"rgb(100,100,100)",
|
|
72417
|
+
LineDash:[3,5],
|
|
72418
|
+
LineWidth:2,
|
|
72419
|
+
},
|
|
72420
|
+
|
|
72421
|
+
Bar:
|
|
72422
|
+
{
|
|
72423
|
+
UpColor:"rgb(65,105,225)",
|
|
72424
|
+
DownColor:"rgb(65,105,225)",
|
|
72425
|
+
UnchangeColor:"rgb(65,105,225s)" ,
|
|
72426
|
+
DrawType:3
|
|
72427
|
+
}
|
|
72428
|
+
};
|
|
72429
|
+
|
|
72206
72430
|
this.PriceGapStyple=
|
|
72207
72431
|
{
|
|
72208
72432
|
Line:{ Color:"rgb(186,186,186)" },
|
|
@@ -73603,6 +73827,28 @@ function JSChartResource()
|
|
|
73603
73827
|
if (item.LineDash) this.VirtualKLine.LineDash=item.LineDash;
|
|
73604
73828
|
}
|
|
73605
73829
|
|
|
73830
|
+
if (style.PredictionKLine)
|
|
73831
|
+
{
|
|
73832
|
+
if (style.PredictionKLine.Line)
|
|
73833
|
+
{
|
|
73834
|
+
var item=style.PredictionKLine.Line;
|
|
73835
|
+
var dest=this.PredictionKLine.Line;
|
|
73836
|
+
if (item.Color) dest.Color=item.Color;
|
|
73837
|
+
if (item.LineDash) dest.LineDash=item.LineDash;
|
|
73838
|
+
if (IFrameSplitOperator.IsNumber(item.LineWidth)) dest.LineWidth=item.LineWidth;
|
|
73839
|
+
}
|
|
73840
|
+
|
|
73841
|
+
if (style.PredictionKLine.Bar)
|
|
73842
|
+
{
|
|
73843
|
+
var item=style.PredictionKLine.Bar;
|
|
73844
|
+
var dest=this.PredictionKLine.Bar;
|
|
73845
|
+
if (item.UpColor) dest.UpColor=item.UpColor;
|
|
73846
|
+
if (item.DownColor) dest.DownColor=item.DownColor;
|
|
73847
|
+
if (item.UnchangeColor) dest.UnchangeColor=item.UnchangeColor;
|
|
73848
|
+
if (IFrameSplitOperator.IsNumber(item.DrawType) || item.DrawType===null) dest.DrawType=item.DrawType;
|
|
73849
|
+
}
|
|
73850
|
+
}
|
|
73851
|
+
|
|
73606
73852
|
if (style.PriceGapStyple)
|
|
73607
73853
|
{
|
|
73608
73854
|
var item=style.PriceGapStyple;
|
|
@@ -78482,9 +78728,90 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78482
78728
|
});
|
|
78483
78729
|
}
|
|
78484
78730
|
|
|
78731
|
+
|
|
78732
|
+
this.RecvRealtimeDataV2=function(data)
|
|
78733
|
+
{
|
|
78734
|
+
var aryRealtimeData=KLineChartContainer.JsonDataToRealtimeDataV2(data,this.Symbol);
|
|
78735
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryRealtimeData)) return;
|
|
78736
|
+
|
|
78737
|
+
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
78738
|
+
var lastSourceDataCount=this.SourceData.Data.length;
|
|
78739
|
+
if (!this.SourceData.MergeMinuteData(aryRealtimeData, this.Period)) return;
|
|
78740
|
+
|
|
78741
|
+
var bindData=new ChartData();
|
|
78742
|
+
bindData.Data=this.SourceData.Data;
|
|
78743
|
+
bindData.Period=this.Period;
|
|
78744
|
+
bindData.Right=this.Right;
|
|
78745
|
+
bindData.DataType=this.SourceData.DataType;
|
|
78746
|
+
bindData.Symbol=this.Symbol;
|
|
78747
|
+
|
|
78748
|
+
//if (bindData.Right>0 && ChartData.IsDayPeriod(bindData.Period,true) && MARKET_SUFFIX_NAME.IsSHSZStockA(this.Symbol) && !this.IsApiPeriod) //复权(A股日线数据才复权)
|
|
78749
|
+
if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsEnableRight(bindData.Period,this.Symbol,this.RightFormula) && !this.IsApiPeriod && ChartData.IsDayPeriod(bindData.Period,true)) //复权
|
|
78750
|
+
{
|
|
78751
|
+
var rightData=bindData.GetRightData(bindData.Right,{ AlgorithmType: this.RightFormula });
|
|
78752
|
+
bindData.Data=rightData;
|
|
78753
|
+
}
|
|
78754
|
+
|
|
78755
|
+
if (!this.IsApiPeriod)
|
|
78756
|
+
{
|
|
78757
|
+
if (ChartData.IsDayPeriod(bindData.Period,false) || ChartData.IsMinutePeriod(bindData.Period,false)) //周期数据 (0= 日线,4=1分钟线 不需要处理)
|
|
78758
|
+
{
|
|
78759
|
+
var periodData=bindData.GetPeriodData(bindData.Period);
|
|
78760
|
+
bindData.Data=periodData;
|
|
78761
|
+
}
|
|
78762
|
+
}
|
|
78763
|
+
|
|
78764
|
+
var kLineCalculate=this.GetKLineCalulate();
|
|
78765
|
+
if (kLineCalculate) //额外的K线图形计算
|
|
78766
|
+
{
|
|
78767
|
+
var newBindData=kLineCalculate.RecvHistoryData(bindData, { Symbol:this.Symbol, Function:"RecvRealtimeData" });
|
|
78768
|
+
bindData=newBindData;
|
|
78769
|
+
this.FlowCapitalReady=true;
|
|
78770
|
+
}
|
|
78771
|
+
|
|
78772
|
+
this.UpdateMainData(bindData,lastDataCount);//更新主图数据
|
|
78773
|
+
this.UpdateOverlayRealtimeDataV2(data); //更新叠加股票数据
|
|
78774
|
+
this.BindInstructionIndexData(bindData); //执行指示脚本
|
|
78775
|
+
|
|
78776
|
+
for(var i=0; i<this.Frame.SubFrame.length; ++i)
|
|
78777
|
+
{
|
|
78778
|
+
this.BindIndexData(i,bindData, { CheckRunCount:true });
|
|
78779
|
+
}
|
|
78780
|
+
|
|
78781
|
+
this.BindAllOverlayIndexData(bindData, { CheckRunCount:true, SyncExecute:true }); //同步模式叠加指标
|
|
78782
|
+
|
|
78783
|
+
//刷新画图
|
|
78784
|
+
this.UpdataDataoffset(); //更新数据偏移
|
|
78785
|
+
this.UpdatePointByCursorIndex(1); //更新十字光标位子
|
|
78786
|
+
this.UpdateFrameMaxMin(); //调整坐标最大 最小值
|
|
78787
|
+
this.Frame.SetSizeChage(true);
|
|
78788
|
+
this.Draw();
|
|
78789
|
+
|
|
78790
|
+
this.SendKLineUpdateEvent(bindData);
|
|
78791
|
+
this.UpdateDOMTooltip(0, bindData);
|
|
78792
|
+
this.UpdateHQFloatTooltip(bindData);
|
|
78793
|
+
|
|
78794
|
+
//叠加指标计算
|
|
78795
|
+
this.BindAllOverlayIndexData(bindData, { CheckRunCount:true,SyncExecute:false }); //异步模式叠加指标
|
|
78796
|
+
|
|
78797
|
+
if (this.mapEvent.has(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA))
|
|
78798
|
+
{
|
|
78799
|
+
var event=this.mapEvent.get(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA);
|
|
78800
|
+
var data={ HistoryData:bindData, Stock:{Symbol:this.Symbol, Name:this.Name } }
|
|
78801
|
+
event.Callback(event,data,this);
|
|
78802
|
+
}
|
|
78803
|
+
}
|
|
78804
|
+
|
|
78485
78805
|
this.RecvRealtimeData=function(data)
|
|
78486
78806
|
{
|
|
78487
78807
|
if (this.IsOnTouch==true) return; //正在操作中不更新数据
|
|
78808
|
+
|
|
78809
|
+
if (data.Ver==3.0)
|
|
78810
|
+
{
|
|
78811
|
+
this.RecvRealtimeDataV2(data);
|
|
78812
|
+
return;
|
|
78813
|
+
}
|
|
78814
|
+
|
|
78488
78815
|
var realtimeData=KLineChartContainer.JsonDataToRealtimeData(data,this.Symbol);
|
|
78489
78816
|
if (!realtimeData) return;
|
|
78490
78817
|
|
|
@@ -78665,6 +78992,47 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78665
78992
|
}
|
|
78666
78993
|
}
|
|
78667
78994
|
|
|
78995
|
+
this.UpdateOverlayRealtimeDataV2=function(data)
|
|
78996
|
+
{
|
|
78997
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.OverlayChartPaint)) return;
|
|
78998
|
+
|
|
78999
|
+
for(var i=0; i<this.OverlayChartPaint.length; ++i)
|
|
79000
|
+
{
|
|
79001
|
+
var item=this.OverlayChartPaint[i];
|
|
79002
|
+
if (!item.Symbol) continue;
|
|
79003
|
+
if (!item.MainData) continue; //等待主图股票数据未下载完
|
|
79004
|
+
if (item.Status!=OVERLAY_STATUS_ID.STATUS_FINISHED_ID) continue;
|
|
79005
|
+
var aryRealtimeData=KLineChartContainer.JsonDataToRealtimeDataV2(data,item.Symbol); //获取叠加股票的最新数据
|
|
79006
|
+
if (!aryRealtimeData) continue;
|
|
79007
|
+
var sourceData=item.SourceData; //叠加股票的所有数据
|
|
79008
|
+
sourceData.MergeMinuteData(aryRealtimeData, this.Period);
|
|
79009
|
+
|
|
79010
|
+
var bindData=new ChartData();
|
|
79011
|
+
bindData.Data=sourceData.Data;
|
|
79012
|
+
bindData.Period=this.Period;
|
|
79013
|
+
bindData.Right=this.Right;
|
|
79014
|
+
bindData.DataType=0;
|
|
79015
|
+
|
|
79016
|
+
//if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsSHSZStockA(data.symbol) && !this.IsApiPeriod) //复权数据 ,A股才有有复权
|
|
79017
|
+
if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsEnableRight(bindData.Right, data.Symbol) && !this.IsApiPeriod)
|
|
79018
|
+
{
|
|
79019
|
+
var rightData=bindData.GetRightData(bindData.Right, { AlgorithmType: this.RightFormula });
|
|
79020
|
+
bindData.Data=rightData;
|
|
79021
|
+
}
|
|
79022
|
+
|
|
79023
|
+
var aryOverlayData=this.SourceData.GetOverlayData(bindData.Data, this.IsApiPeriod); //和主图数据拟合以后的数据
|
|
79024
|
+
bindData.Data=aryOverlayData;
|
|
79025
|
+
|
|
79026
|
+
if (ChartData.IsDayPeriod(bindData.Period,false) && !this.IsApiPeriod) //周期数据
|
|
79027
|
+
{
|
|
79028
|
+
var periodData=bindData.GetPeriodData(bindData.Period);
|
|
79029
|
+
bindData.Data=periodData;
|
|
79030
|
+
}
|
|
79031
|
+
|
|
79032
|
+
item.Data=bindData;
|
|
79033
|
+
}
|
|
79034
|
+
}
|
|
79035
|
+
|
|
78668
79036
|
this.RequestMinuteRealtimeData=function()
|
|
78669
79037
|
{
|
|
78670
79038
|
var self=this;
|
|
@@ -78786,7 +79154,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78786
79154
|
if (this.IsApiPeriod) this.ReduceSourceData(); //减少数据
|
|
78787
79155
|
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
78788
79156
|
if (!this.SourceData) return;
|
|
78789
|
-
if (!this.SourceData.MergeMinuteData(aryMinuteData)) return;
|
|
79157
|
+
if (!this.SourceData.MergeMinuteData(aryMinuteData, this.Period)) return;
|
|
78790
79158
|
|
|
78791
79159
|
JSConsole.Chart.Log(`[KLineChartContainer::RecvMinuteRealtimeDataV2] update kline by 1 minute data [${lastDataCount}->${this.SourceData.Data.length}], IsAutoSyncDataOffset=${this.IsAutoSyncDataOffset}`);
|
|
78792
79160
|
|
|
@@ -78869,7 +79237,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78869
79237
|
if (this.IsApiPeriod) this.ReduceSourceData(); //减少数据
|
|
78870
79238
|
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
78871
79239
|
var lastSourceDataCount=this.SourceData.Data.length;
|
|
78872
|
-
if (!this.SourceData.MergeMinuteData(realtimeData)) return;
|
|
79240
|
+
if (!this.SourceData.MergeMinuteData(realtimeData, this.Period)) return;
|
|
78873
79241
|
|
|
78874
79242
|
JSConsole.Chart.Log(`[KLineChartContainer::RecvMinuteRealtimeData] update kline by 1 minute data [${lastSourceDataCount}->${this.SourceData.Data.length}]`);
|
|
78875
79243
|
|
|
@@ -78940,7 +79308,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78940
79308
|
var realtimeData=KLineChartContainer.JsonDataToMinuteRealtimeData(data,item.Symbol); //获取叠加股票的最新数据
|
|
78941
79309
|
if (!realtimeData) continue;
|
|
78942
79310
|
var sourceData=item.SourceData; //叠加股票的所有数据
|
|
78943
|
-
if (!sourceData.MergeMinuteData(realtimeData)) return;
|
|
79311
|
+
if (!sourceData.MergeMinuteData(realtimeData,this.Period)) return;
|
|
78944
79312
|
|
|
78945
79313
|
var bindData=new ChartData();
|
|
78946
79314
|
bindData.Data=sourceData.Data;
|
|
@@ -83771,6 +84139,27 @@ KLineChartContainer.JsonDataToHistoryData=function(data)
|
|
|
83771
84139
|
return aryDayData;
|
|
83772
84140
|
}
|
|
83773
84141
|
|
|
84142
|
+
|
|
84143
|
+
KLineChartContainer.JsonDataToRealtimeDataV2=function(data, symbol)
|
|
84144
|
+
{
|
|
84145
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(data.stock)) return null;
|
|
84146
|
+
|
|
84147
|
+
var finder=null;
|
|
84148
|
+
for(var i=0;i<data.stock.length;++i)
|
|
84149
|
+
{
|
|
84150
|
+
var item=data.stock[i];
|
|
84151
|
+
if (item.symbol==symbol)
|
|
84152
|
+
{
|
|
84153
|
+
finder=item;
|
|
84154
|
+
break;
|
|
84155
|
+
}
|
|
84156
|
+
}
|
|
84157
|
+
|
|
84158
|
+
if (!finder) return null;
|
|
84159
|
+
|
|
84160
|
+
return KLineChartContainer.JsonDataToHistoryData(finder);
|
|
84161
|
+
}
|
|
84162
|
+
|
|
83774
84163
|
KLineChartContainer.JsonDataToRealtimeData=function(data, symbol)
|
|
83775
84164
|
{
|
|
83776
84165
|
if (!data.stock) return null;
|