hqchart 1.1.14533 → 1.1.14542
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 +73 -39
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +4 -0
- package/src/jscommon/umychart.PopKLineChart.js +6 -4
- package/src/jscommon/umychart.PopMinuteChart.js +6 -3
- package/src/jscommon/umychart.js +381 -17
- package/src/jscommon/umychart.style.js +17 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +399 -18
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +415 -25
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)
|
|
@@ -23860,7 +23862,7 @@ function ChartData()
|
|
|
23860
23862
|
return result;
|
|
23861
23863
|
}
|
|
23862
23864
|
|
|
23863
|
-
this.MergeMinuteData=function(data) //合并数据
|
|
23865
|
+
this.MergeMinuteData=function(data, period) //合并数据
|
|
23864
23866
|
{
|
|
23865
23867
|
if (!this.Data || this.Data.length<=0)
|
|
23866
23868
|
{
|
|
@@ -23868,6 +23870,7 @@ function ChartData()
|
|
|
23868
23870
|
return true;
|
|
23869
23871
|
}
|
|
23870
23872
|
|
|
23873
|
+
var bDayPeriod=ChartData.IsDayPeriod(period, true);
|
|
23871
23874
|
var sourceFirstItem=this.Data[0];
|
|
23872
23875
|
var firstItemID=0;
|
|
23873
23876
|
var firstItem=null;
|
|
@@ -23881,11 +23884,23 @@ function ChartData()
|
|
|
23881
23884
|
break;
|
|
23882
23885
|
}
|
|
23883
23886
|
|
|
23884
|
-
if (
|
|
23887
|
+
if (bDayPeriod)
|
|
23885
23888
|
{
|
|
23886
|
-
|
|
23887
|
-
|
|
23888
|
-
|
|
23889
|
+
if (item.Date==sourceFirstItem.Date)
|
|
23890
|
+
{
|
|
23891
|
+
firstItemID=i;
|
|
23892
|
+
firstItem=item;
|
|
23893
|
+
break;
|
|
23894
|
+
}
|
|
23895
|
+
}
|
|
23896
|
+
else
|
|
23897
|
+
{
|
|
23898
|
+
if (item.Date==sourceFirstItem.Date && item.Time>=sourceFirstItem.Time)
|
|
23899
|
+
{
|
|
23900
|
+
firstItemID=i;
|
|
23901
|
+
firstItem=item;
|
|
23902
|
+
break;
|
|
23903
|
+
}
|
|
23889
23904
|
}
|
|
23890
23905
|
}
|
|
23891
23906
|
|
|
@@ -23898,11 +23913,23 @@ function ChartData()
|
|
|
23898
23913
|
var date=this.Data[i].Date;
|
|
23899
23914
|
var time=this.Data[i].Time;
|
|
23900
23915
|
|
|
23901
|
-
if (
|
|
23916
|
+
if (bDayPeriod)
|
|
23902
23917
|
{
|
|
23903
|
-
|
|
23904
|
-
|
|
23905
|
-
|
|
23918
|
+
if (firstItem.Date>date || firstItem.Date==date)
|
|
23919
|
+
{
|
|
23920
|
+
index=i;
|
|
23921
|
+
if (firstItem.Date==date) bFind=true;
|
|
23922
|
+
break;
|
|
23923
|
+
}
|
|
23924
|
+
}
|
|
23925
|
+
else
|
|
23926
|
+
{
|
|
23927
|
+
if (firstItem.Date>date || (firstItem.Date==date && firstItem.Time>=time) )
|
|
23928
|
+
{
|
|
23929
|
+
index=i;
|
|
23930
|
+
if (firstItem.Date==date && firstItem.Time==time) bFind=true;
|
|
23931
|
+
break;
|
|
23932
|
+
}
|
|
23906
23933
|
}
|
|
23907
23934
|
}
|
|
23908
23935
|
|
|
@@ -25816,9 +25843,30 @@ function ChartKLine()
|
|
|
25816
25843
|
DownAreaColor:g_JSChartResource.HLCArea.DownAreaColor,
|
|
25817
25844
|
}
|
|
25818
25845
|
|
|
25819
|
-
//虚线柱子
|
|
25846
|
+
//虚线柱子 (非交易日)
|
|
25820
25847
|
this.VirtualBarConfig={ Color:g_JSChartResource.VirtualKLine.Color, LineDash:g_JSChartResource.VirtualKLine.LineDash };
|
|
25821
25848
|
|
|
25849
|
+
//预测线配置
|
|
25850
|
+
this.PredictionConfig=
|
|
25851
|
+
{
|
|
25852
|
+
Line:
|
|
25853
|
+
{
|
|
25854
|
+
Color:g_JSChartResource.PredictionKLine.Line.Color,
|
|
25855
|
+
LineDash:g_JSChartResource.PredictionKLine.Line.LineDash,
|
|
25856
|
+
LineWidth:g_JSChartResource.PredictionKLine.Line.LineWidth
|
|
25857
|
+
},
|
|
25858
|
+
|
|
25859
|
+
Bar:
|
|
25860
|
+
{
|
|
25861
|
+
UpColor:g_JSChartResource.PredictionKLine.Bar.UpColor,
|
|
25862
|
+
DownColor:g_JSChartResource.PredictionKLine.Bar.DownColor,
|
|
25863
|
+
UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor ,
|
|
25864
|
+
DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
|
|
25865
|
+
},
|
|
25866
|
+
Enable:false, //是否启动
|
|
25867
|
+
};
|
|
25868
|
+
this.AryPredictionCache=[]; //预测数据
|
|
25869
|
+
|
|
25822
25870
|
//DrawType==14 自定义图形
|
|
25823
25871
|
this.FFKChart;
|
|
25824
25872
|
|
|
@@ -25956,6 +26004,22 @@ function ChartKLine()
|
|
|
25956
26004
|
this.OrderFlow.UnchagneColor= { BG:g_JSChartResource.OrderFlow.UnchagneColor.BG, Border:g_JSChartResource.OrderFlow.UnchagneColor.Border };
|
|
25957
26005
|
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
26006
|
this.OrderFlow.Line={ UpDownColor: g_JSChartResource.OrderFlow.Line.UpDownColor, MiddleColor:g_JSChartResource.OrderFlow.Line.MiddleColor };
|
|
26007
|
+
|
|
26008
|
+
this.PredictionConfig.Line=
|
|
26009
|
+
{
|
|
26010
|
+
Color:g_JSChartResource.PredictionKLine.Line.Color,
|
|
26011
|
+
LineDash:g_JSChartResource.PredictionKLine.Line.LineDash,
|
|
26012
|
+
LineWidth:g_JSChartResource.PredictionKLine.Line.LineWidth
|
|
26013
|
+
};
|
|
26014
|
+
|
|
26015
|
+
this.PredictionConfig.Bar=
|
|
26016
|
+
{
|
|
26017
|
+
UpColor:g_JSChartResource.PredictionKLine.Bar.UpColor,
|
|
26018
|
+
DownColor:g_JSChartResource.PredictionKLine.Bar.DownColor,
|
|
26019
|
+
UnchangeColor:g_JSChartResource.PredictionKLine.Bar.UnchangeColor,
|
|
26020
|
+
DrawType:g_JSChartResource.PredictionKLine.Bar.DrawType
|
|
26021
|
+
};
|
|
26022
|
+
|
|
25959
26023
|
}
|
|
25960
26024
|
|
|
25961
26025
|
this.ClearCustomKLine=function()
|
|
@@ -26326,6 +26390,8 @@ function ChartKLine()
|
|
|
26326
26390
|
this.DrawKRange.Start=this.Data.DataOffset;
|
|
26327
26391
|
|
|
26328
26392
|
var preKItemInfo=null;
|
|
26393
|
+
var prePoint=null;
|
|
26394
|
+
var xEnd=null; //最后一个点
|
|
26329
26395
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
26330
26396
|
{
|
|
26331
26397
|
var data=this.Data.Data[i];
|
|
@@ -26339,6 +26405,13 @@ function ChartKLine()
|
|
|
26339
26405
|
var yClose=this.GetYFromData(data.Close,false);
|
|
26340
26406
|
this.DrawKRange.End=i;
|
|
26341
26407
|
|
|
26408
|
+
if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
|
|
26409
|
+
{
|
|
26410
|
+
this.AryPredictionCache.push({ PrePoint:prePoint, Point:{ X:x, Y:yClose }});
|
|
26411
|
+
prePoint={ X:x, Y:yClose};
|
|
26412
|
+
continue;
|
|
26413
|
+
}
|
|
26414
|
+
|
|
26342
26415
|
if (bFirstPoint)
|
|
26343
26416
|
{
|
|
26344
26417
|
if (isHScreen)
|
|
@@ -26359,6 +26432,9 @@ function ChartKLine()
|
|
|
26359
26432
|
else this.Canvas.lineTo(x,yClose);
|
|
26360
26433
|
}
|
|
26361
26434
|
|
|
26435
|
+
xEnd=x;
|
|
26436
|
+
prePoint={ X:x, Y:yClose};
|
|
26437
|
+
|
|
26362
26438
|
if (i==this.Data.Data.length-1)
|
|
26363
26439
|
{
|
|
26364
26440
|
ptLast={ X:x, Y:yClose, XLeft:left, XRight:right, KItem:data, ChartRight:chartright };
|
|
@@ -26390,12 +26466,12 @@ function ChartKLine()
|
|
|
26390
26466
|
this.Canvas.stroke();
|
|
26391
26467
|
if (isHScreen)
|
|
26392
26468
|
{
|
|
26393
|
-
this.Canvas.lineTo(border.Left,
|
|
26469
|
+
this.Canvas.lineTo(border.Left,xEnd);
|
|
26394
26470
|
this.Canvas.lineTo(border.Left,firstPoint.Y);
|
|
26395
26471
|
}
|
|
26396
26472
|
else
|
|
26397
26473
|
{
|
|
26398
|
-
this.Canvas.lineTo(
|
|
26474
|
+
this.Canvas.lineTo(xEnd,border.Bottom);
|
|
26399
26475
|
this.Canvas.lineTo(firstPoint.X,border.Bottom);
|
|
26400
26476
|
}
|
|
26401
26477
|
this.Canvas.closePath();
|
|
@@ -26458,11 +26534,12 @@ function ChartKLine()
|
|
|
26458
26534
|
var mapBreakPoint=this.BuildBreakPoint(); //断点
|
|
26459
26535
|
|
|
26460
26536
|
var preKItemInfo=null;
|
|
26537
|
+
var prePoint=null;
|
|
26461
26538
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
26462
26539
|
{
|
|
26463
26540
|
var data=this.Data.Data[i];
|
|
26464
26541
|
this.ShowRange.End=i;
|
|
26465
|
-
if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
26542
|
+
if (!data || data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
26466
26543
|
|
|
26467
26544
|
var left=xOffset;
|
|
26468
26545
|
var right=xOffset+dataWidth;
|
|
@@ -26471,6 +26548,13 @@ function ChartKLine()
|
|
|
26471
26548
|
var yClose=this.GetYFromData(data.Close,false);
|
|
26472
26549
|
this.DrawKRange.End=i;
|
|
26473
26550
|
|
|
26551
|
+
if (data.IsVirtual && this.PredictionConfig.Enable) //预测数据|虚拟数据
|
|
26552
|
+
{
|
|
26553
|
+
this.AryPredictionCache.push({ PrePoint:prePoint, Point:{ X:x, Y:yClose }});
|
|
26554
|
+
prePoint={ X:x, Y:yClose};
|
|
26555
|
+
continue;
|
|
26556
|
+
}
|
|
26557
|
+
|
|
26474
26558
|
if (bFirstPoint)
|
|
26475
26559
|
{
|
|
26476
26560
|
if (isHScreen) this.Canvas.moveTo(yClose,x);
|
|
@@ -26484,6 +26568,8 @@ function ChartKLine()
|
|
|
26484
26568
|
}
|
|
26485
26569
|
++drawCount;
|
|
26486
26570
|
|
|
26571
|
+
prePoint={ X:x, Y:yClose};
|
|
26572
|
+
|
|
26487
26573
|
if (this.PriceGap.Enable)
|
|
26488
26574
|
{
|
|
26489
26575
|
var yLow=this.GetYFromData(data.Low, false);
|
|
@@ -26558,6 +26644,7 @@ function ChartKLine()
|
|
|
26558
26644
|
}
|
|
26559
26645
|
|
|
26560
26646
|
var preKItemInfo=null;
|
|
26647
|
+
var prePoint=null; //上一个点的位置
|
|
26561
26648
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
|
|
26562
26649
|
{
|
|
26563
26650
|
var data=this.Data.Data[i];
|
|
@@ -26607,6 +26694,10 @@ function ChartKLine()
|
|
|
26607
26694
|
{
|
|
26608
26695
|
this.DrawVirtualBar(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
26609
26696
|
}
|
|
26697
|
+
else if (data.IsVirtual && this.PredictionConfig.Enable)
|
|
26698
|
+
{
|
|
26699
|
+
this.DrawPredictionBar(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
26700
|
+
}
|
|
26610
26701
|
else if (kLineOption)
|
|
26611
26702
|
{
|
|
26612
26703
|
var barColor=kLineOption.Color;
|
|
@@ -26688,6 +26779,8 @@ function ChartKLine()
|
|
|
26688
26779
|
if (value>0)
|
|
26689
26780
|
this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
|
|
26690
26781
|
}
|
|
26782
|
+
|
|
26783
|
+
prePoint={ X:x, Y:yClose }; //上一个点
|
|
26691
26784
|
|
|
26692
26785
|
preKItemInfo=kItemInfo;
|
|
26693
26786
|
}
|
|
@@ -27559,6 +27652,82 @@ function ChartKLine()
|
|
|
27559
27652
|
this.Canvas.setLineDash([]);
|
|
27560
27653
|
}
|
|
27561
27654
|
|
|
27655
|
+
this.DrawPredictionBar=function(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen)
|
|
27656
|
+
{
|
|
27657
|
+
var config=this.PredictionConfig.Bar;
|
|
27658
|
+
var drawType=this.DrawType;
|
|
27659
|
+
if (IFrameSplitOperator.IsNumber(config.DrawType)) drawType=config.DrawType;
|
|
27660
|
+
|
|
27661
|
+
if (data.Open<data.Close) //阳线
|
|
27662
|
+
{
|
|
27663
|
+
this.DrawKBar_Up(data, dataWidth, config.UpColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
27664
|
+
}
|
|
27665
|
+
else if (data.Open>data.Close) //阴线
|
|
27666
|
+
{
|
|
27667
|
+
this.DrawKBar_Down(data, dataWidth, config.DownColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
27668
|
+
}
|
|
27669
|
+
else
|
|
27670
|
+
{
|
|
27671
|
+
this.DrawKBar_Unchagne(data, dataWidth, config.UnchangeColor, drawType, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen);
|
|
27672
|
+
}
|
|
27673
|
+
}
|
|
27674
|
+
|
|
27675
|
+
this.DrawPredictionLine=function()
|
|
27676
|
+
{
|
|
27677
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryPredictionCache)) return;
|
|
27678
|
+
|
|
27679
|
+
this.Canvas.save();
|
|
27680
|
+
|
|
27681
|
+
var bHScreen=(this.ChartFrame.IsHScreen===true);
|
|
27682
|
+
var bFirstPoint=true;
|
|
27683
|
+
var drawCount=0;
|
|
27684
|
+
for(var i=0;i<this.AryPredictionCache.length;++i)
|
|
27685
|
+
{
|
|
27686
|
+
var item=this.AryPredictionCache[i];
|
|
27687
|
+
if (bFirstPoint)
|
|
27688
|
+
{
|
|
27689
|
+
bFirstPoint=false;
|
|
27690
|
+
this.Canvas.beginPath();
|
|
27691
|
+
if (item.PrePoint)
|
|
27692
|
+
{
|
|
27693
|
+
var pt=item.PrePoint;
|
|
27694
|
+
if (bHScreen) this.Canvas.moveTo(pt.Y,pt.X); //横屏坐标轴对调
|
|
27695
|
+
else this.Canvas.moveTo(pt.X,pt.Y);
|
|
27696
|
+
|
|
27697
|
+
var pt=item.Point;
|
|
27698
|
+
if (bHScreen) this.Canvas.lineTo(pt.Y,pt.X);
|
|
27699
|
+
else this.Canvas.lineTo(pt.X,pt.Y);
|
|
27700
|
+
}
|
|
27701
|
+
else if (item.Point)
|
|
27702
|
+
{
|
|
27703
|
+
var pt=item.Point;
|
|
27704
|
+
if (bHScreen) this.Canvas.moveTo(pt.Y,pt.X); //横屏坐标轴对调
|
|
27705
|
+
else this.Canvas.moveTo(pt.X,pt.Y);
|
|
27706
|
+
}
|
|
27707
|
+
}
|
|
27708
|
+
else
|
|
27709
|
+
{
|
|
27710
|
+
var pt=item.Point;
|
|
27711
|
+
if (bHScreen) this.Canvas.lineTo(pt.Y,pt.X);
|
|
27712
|
+
else this.Canvas.lineTo(pt.X,pt.Y);
|
|
27713
|
+
}
|
|
27714
|
+
|
|
27715
|
+
++drawCount;
|
|
27716
|
+
}
|
|
27717
|
+
|
|
27718
|
+
if (drawCount>0)
|
|
27719
|
+
{
|
|
27720
|
+
var pixelRatio=GetDevicePixelRatio();
|
|
27721
|
+
var config=this.PredictionConfig.Line;
|
|
27722
|
+
this.Canvas.strokeStyle=config.Color;
|
|
27723
|
+
if (IFrameSplitOperator.IsNumber(config.LineWidth)) this.Canvas.lineWidth=config.LineWidth*pixelRatio;
|
|
27724
|
+
if (IFrameSplitOperator.IsNonEmptyArray(config.LineDash)) this.Canvas.setLineDash(config.LineDash)
|
|
27725
|
+
this.Canvas.stroke();
|
|
27726
|
+
}
|
|
27727
|
+
|
|
27728
|
+
this.Canvas.restore();
|
|
27729
|
+
}
|
|
27730
|
+
|
|
27562
27731
|
this.DrawRenkoCandle=function() //砖型K线
|
|
27563
27732
|
{
|
|
27564
27733
|
var isHScreen=(this.ChartFrame.IsHScreen===true);
|
|
@@ -28375,6 +28544,7 @@ function ChartKLine()
|
|
|
28375
28544
|
this.PtMin={X:null,Y:null,Value:null,Align:'left'}; //清空最小
|
|
28376
28545
|
this.DrawKRange={ Start:null, End:null };
|
|
28377
28546
|
this.AryPriceGapCache=[];
|
|
28547
|
+
this.AryPredictionCache=[];
|
|
28378
28548
|
|
|
28379
28549
|
this.ChartFrame.ChartKLine={Max:null, Min:null }; //保存K线上 显示最大最小值坐标
|
|
28380
28550
|
|
|
@@ -28415,6 +28585,7 @@ function ChartKLine()
|
|
|
28415
28585
|
{
|
|
28416
28586
|
this.DrawCloseLine();
|
|
28417
28587
|
this.Canvas.restore();
|
|
28588
|
+
this.DrawPredictionLine();
|
|
28418
28589
|
if (this.PriceGap.Enable) this.DrawPriceGap();
|
|
28419
28590
|
return;
|
|
28420
28591
|
}
|
|
@@ -28487,6 +28658,7 @@ function ChartKLine()
|
|
|
28487
28658
|
|
|
28488
28659
|
this.Canvas.restore();
|
|
28489
28660
|
|
|
28661
|
+
this.DrawPredictionLine();
|
|
28490
28662
|
if (this.PriceGap.Enable) this.DrawPriceGap();
|
|
28491
28663
|
|
|
28492
28664
|
if (this.IsShowMaxMinPrice) //标注最大值最小值
|
|
@@ -35266,6 +35438,7 @@ function ChartVolStick()
|
|
|
35266
35438
|
var value=this.Data.Data[i];
|
|
35267
35439
|
var kItem=this.HistoryData.Data[i];
|
|
35268
35440
|
if (value==null || kItem==null) continue;
|
|
35441
|
+
if (!IFrameSplitOperator.IsNumber(value)) continue;
|
|
35269
35442
|
if (value==0) continue;
|
|
35270
35443
|
|
|
35271
35444
|
var left=xOffset;
|
|
@@ -72203,6 +72376,24 @@ function JSChartResource()
|
|
|
72203
72376
|
LineDash:[2,2]
|
|
72204
72377
|
};
|
|
72205
72378
|
|
|
72379
|
+
this.PredictionKLine=
|
|
72380
|
+
{
|
|
72381
|
+
Line:
|
|
72382
|
+
{
|
|
72383
|
+
Color:"rgb(100,100,100)",
|
|
72384
|
+
LineDash:[3,5],
|
|
72385
|
+
LineWidth:2,
|
|
72386
|
+
},
|
|
72387
|
+
|
|
72388
|
+
Bar:
|
|
72389
|
+
{
|
|
72390
|
+
UpColor:"rgb(65,105,225)",
|
|
72391
|
+
DownColor:"rgb(65,105,225)",
|
|
72392
|
+
UnchangeColor:"rgb(65,105,225s)" ,
|
|
72393
|
+
DrawType:3
|
|
72394
|
+
}
|
|
72395
|
+
};
|
|
72396
|
+
|
|
72206
72397
|
this.PriceGapStyple=
|
|
72207
72398
|
{
|
|
72208
72399
|
Line:{ Color:"rgb(186,186,186)" },
|
|
@@ -73603,6 +73794,28 @@ function JSChartResource()
|
|
|
73603
73794
|
if (item.LineDash) this.VirtualKLine.LineDash=item.LineDash;
|
|
73604
73795
|
}
|
|
73605
73796
|
|
|
73797
|
+
if (style.PredictionKLine)
|
|
73798
|
+
{
|
|
73799
|
+
if (style.PredictionKLine.Line)
|
|
73800
|
+
{
|
|
73801
|
+
var item=style.PredictionKLine.Line;
|
|
73802
|
+
var dest=this.PredictionKLine.Line;
|
|
73803
|
+
if (item.Color) dest.Color=item.Color;
|
|
73804
|
+
if (item.LineDash) dest.LineDash=item.LineDash;
|
|
73805
|
+
if (IFrameSplitOperator.IsNumber(item.LineWidth)) dest.LineWidth=item.LineWidth;
|
|
73806
|
+
}
|
|
73807
|
+
|
|
73808
|
+
if (style.PredictionKLine.Bar)
|
|
73809
|
+
{
|
|
73810
|
+
var item=style.PredictionKLine.Bar;
|
|
73811
|
+
var dest=this.PredictionKLine.Bar;
|
|
73812
|
+
if (item.UpColor) dest.UpColor=item.UpColor;
|
|
73813
|
+
if (item.DownColor) dest.DownColor=item.DownColor;
|
|
73814
|
+
if (item.UnchangeColor) dest.UnchangeColor=item.UnchangeColor;
|
|
73815
|
+
if (IFrameSplitOperator.IsNumber(item.DrawType) || item.DrawType===null) dest.DrawType=item.DrawType;
|
|
73816
|
+
}
|
|
73817
|
+
}
|
|
73818
|
+
|
|
73606
73819
|
if (style.PriceGapStyple)
|
|
73607
73820
|
{
|
|
73608
73821
|
var item=style.PriceGapStyple;
|
|
@@ -77914,7 +78127,15 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
77914
78127
|
this.Symbol=data.symbol;
|
|
77915
78128
|
this.Name=data.name;
|
|
77916
78129
|
|
|
77917
|
-
|
|
78130
|
+
var chartOperator=null; //额外的图形控制
|
|
78131
|
+
if (data && data.ChartOperator)
|
|
78132
|
+
{
|
|
78133
|
+
var item=data.ChartOperator;
|
|
78134
|
+
chartOperator={ };
|
|
78135
|
+
if (item.IsShowAll===true) chartOperator.IsShowAll=true; //全部显示
|
|
78136
|
+
}
|
|
78137
|
+
|
|
78138
|
+
this.BindMainData(bindData,this.PageSize,chartOperator);
|
|
77918
78139
|
if (this.AfterBindMainData) this.AfterBindMainData("RecvHistoryData");
|
|
77919
78140
|
this.Frame.SetSizeChage(true);
|
|
77920
78141
|
|
|
@@ -78474,9 +78695,90 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78474
78695
|
});
|
|
78475
78696
|
}
|
|
78476
78697
|
|
|
78698
|
+
|
|
78699
|
+
this.RecvRealtimeDataV2=function(data)
|
|
78700
|
+
{
|
|
78701
|
+
var aryRealtimeData=KLineChartContainer.JsonDataToRealtimeDataV2(data,this.Symbol);
|
|
78702
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryRealtimeData)) return;
|
|
78703
|
+
|
|
78704
|
+
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
78705
|
+
var lastSourceDataCount=this.SourceData.Data.length;
|
|
78706
|
+
if (!this.SourceData.MergeMinuteData(aryRealtimeData, this.Period)) return;
|
|
78707
|
+
|
|
78708
|
+
var bindData=new ChartData();
|
|
78709
|
+
bindData.Data=this.SourceData.Data;
|
|
78710
|
+
bindData.Period=this.Period;
|
|
78711
|
+
bindData.Right=this.Right;
|
|
78712
|
+
bindData.DataType=this.SourceData.DataType;
|
|
78713
|
+
bindData.Symbol=this.Symbol;
|
|
78714
|
+
|
|
78715
|
+
//if (bindData.Right>0 && ChartData.IsDayPeriod(bindData.Period,true) && MARKET_SUFFIX_NAME.IsSHSZStockA(this.Symbol) && !this.IsApiPeriod) //复权(A股日线数据才复权)
|
|
78716
|
+
if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsEnableRight(bindData.Period,this.Symbol,this.RightFormula) && !this.IsApiPeriod && ChartData.IsDayPeriod(bindData.Period,true)) //复权
|
|
78717
|
+
{
|
|
78718
|
+
var rightData=bindData.GetRightData(bindData.Right,{ AlgorithmType: this.RightFormula });
|
|
78719
|
+
bindData.Data=rightData;
|
|
78720
|
+
}
|
|
78721
|
+
|
|
78722
|
+
if (!this.IsApiPeriod)
|
|
78723
|
+
{
|
|
78724
|
+
if (ChartData.IsDayPeriod(bindData.Period,false) || ChartData.IsMinutePeriod(bindData.Period,false)) //周期数据 (0= 日线,4=1分钟线 不需要处理)
|
|
78725
|
+
{
|
|
78726
|
+
var periodData=bindData.GetPeriodData(bindData.Period);
|
|
78727
|
+
bindData.Data=periodData;
|
|
78728
|
+
}
|
|
78729
|
+
}
|
|
78730
|
+
|
|
78731
|
+
var kLineCalculate=this.GetKLineCalulate();
|
|
78732
|
+
if (kLineCalculate) //额外的K线图形计算
|
|
78733
|
+
{
|
|
78734
|
+
var newBindData=kLineCalculate.RecvHistoryData(bindData, { Symbol:this.Symbol, Function:"RecvRealtimeData" });
|
|
78735
|
+
bindData=newBindData;
|
|
78736
|
+
this.FlowCapitalReady=true;
|
|
78737
|
+
}
|
|
78738
|
+
|
|
78739
|
+
this.UpdateMainData(bindData,lastDataCount);//更新主图数据
|
|
78740
|
+
this.UpdateOverlayRealtimeDataV2(data); //更新叠加股票数据
|
|
78741
|
+
this.BindInstructionIndexData(bindData); //执行指示脚本
|
|
78742
|
+
|
|
78743
|
+
for(var i=0; i<this.Frame.SubFrame.length; ++i)
|
|
78744
|
+
{
|
|
78745
|
+
this.BindIndexData(i,bindData, { CheckRunCount:true });
|
|
78746
|
+
}
|
|
78747
|
+
|
|
78748
|
+
this.BindAllOverlayIndexData(bindData, { CheckRunCount:true, SyncExecute:true }); //同步模式叠加指标
|
|
78749
|
+
|
|
78750
|
+
//刷新画图
|
|
78751
|
+
this.UpdataDataoffset(); //更新数据偏移
|
|
78752
|
+
this.UpdatePointByCursorIndex(1); //更新十字光标位子
|
|
78753
|
+
this.UpdateFrameMaxMin(); //调整坐标最大 最小值
|
|
78754
|
+
this.Frame.SetSizeChage(true);
|
|
78755
|
+
this.Draw();
|
|
78756
|
+
|
|
78757
|
+
this.SendKLineUpdateEvent(bindData);
|
|
78758
|
+
this.UpdateDOMTooltip(0, bindData);
|
|
78759
|
+
this.UpdateHQFloatTooltip(bindData);
|
|
78760
|
+
|
|
78761
|
+
//叠加指标计算
|
|
78762
|
+
this.BindAllOverlayIndexData(bindData, { CheckRunCount:true,SyncExecute:false }); //异步模式叠加指标
|
|
78763
|
+
|
|
78764
|
+
if (this.mapEvent.has(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA))
|
|
78765
|
+
{
|
|
78766
|
+
var event=this.mapEvent.get(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA);
|
|
78767
|
+
var data={ HistoryData:bindData, Stock:{Symbol:this.Symbol, Name:this.Name } }
|
|
78768
|
+
event.Callback(event,data,this);
|
|
78769
|
+
}
|
|
78770
|
+
}
|
|
78771
|
+
|
|
78477
78772
|
this.RecvRealtimeData=function(data)
|
|
78478
78773
|
{
|
|
78479
78774
|
if (this.IsOnTouch==true) return; //正在操作中不更新数据
|
|
78775
|
+
|
|
78776
|
+
if (data.Ver==3.0)
|
|
78777
|
+
{
|
|
78778
|
+
this.RecvRealtimeDataV2(data);
|
|
78779
|
+
return;
|
|
78780
|
+
}
|
|
78781
|
+
|
|
78480
78782
|
var realtimeData=KLineChartContainer.JsonDataToRealtimeData(data,this.Symbol);
|
|
78481
78783
|
if (!realtimeData) return;
|
|
78482
78784
|
|
|
@@ -78657,6 +78959,47 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78657
78959
|
}
|
|
78658
78960
|
}
|
|
78659
78961
|
|
|
78962
|
+
this.UpdateOverlayRealtimeDataV2=function(data)
|
|
78963
|
+
{
|
|
78964
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.OverlayChartPaint)) return;
|
|
78965
|
+
|
|
78966
|
+
for(var i=0; i<this.OverlayChartPaint.length; ++i)
|
|
78967
|
+
{
|
|
78968
|
+
var item=this.OverlayChartPaint[i];
|
|
78969
|
+
if (!item.Symbol) continue;
|
|
78970
|
+
if (!item.MainData) continue; //等待主图股票数据未下载完
|
|
78971
|
+
if (item.Status!=OVERLAY_STATUS_ID.STATUS_FINISHED_ID) continue;
|
|
78972
|
+
var aryRealtimeData=KLineChartContainer.JsonDataToRealtimeDataV2(data,item.Symbol); //获取叠加股票的最新数据
|
|
78973
|
+
if (!aryRealtimeData) continue;
|
|
78974
|
+
var sourceData=item.SourceData; //叠加股票的所有数据
|
|
78975
|
+
sourceData.MergeMinuteData(aryRealtimeData, this.Period);
|
|
78976
|
+
|
|
78977
|
+
var bindData=new ChartData();
|
|
78978
|
+
bindData.Data=sourceData.Data;
|
|
78979
|
+
bindData.Period=this.Period;
|
|
78980
|
+
bindData.Right=this.Right;
|
|
78981
|
+
bindData.DataType=0;
|
|
78982
|
+
|
|
78983
|
+
//if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsSHSZStockA(data.symbol) && !this.IsApiPeriod) //复权数据 ,A股才有有复权
|
|
78984
|
+
if (bindData.Right>0 && MARKET_SUFFIX_NAME.IsEnableRight(bindData.Right, data.Symbol) && !this.IsApiPeriod)
|
|
78985
|
+
{
|
|
78986
|
+
var rightData=bindData.GetRightData(bindData.Right, { AlgorithmType: this.RightFormula });
|
|
78987
|
+
bindData.Data=rightData;
|
|
78988
|
+
}
|
|
78989
|
+
|
|
78990
|
+
var aryOverlayData=this.SourceData.GetOverlayData(bindData.Data, this.IsApiPeriod); //和主图数据拟合以后的数据
|
|
78991
|
+
bindData.Data=aryOverlayData;
|
|
78992
|
+
|
|
78993
|
+
if (ChartData.IsDayPeriod(bindData.Period,false) && !this.IsApiPeriod) //周期数据
|
|
78994
|
+
{
|
|
78995
|
+
var periodData=bindData.GetPeriodData(bindData.Period);
|
|
78996
|
+
bindData.Data=periodData;
|
|
78997
|
+
}
|
|
78998
|
+
|
|
78999
|
+
item.Data=bindData;
|
|
79000
|
+
}
|
|
79001
|
+
}
|
|
79002
|
+
|
|
78660
79003
|
this.RequestMinuteRealtimeData=function()
|
|
78661
79004
|
{
|
|
78662
79005
|
var self=this;
|
|
@@ -78778,7 +79121,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78778
79121
|
if (this.IsApiPeriod) this.ReduceSourceData(); //减少数据
|
|
78779
79122
|
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
78780
79123
|
if (!this.SourceData) return;
|
|
78781
|
-
if (!this.SourceData.MergeMinuteData(aryMinuteData)) return;
|
|
79124
|
+
if (!this.SourceData.MergeMinuteData(aryMinuteData, this.Period)) return;
|
|
78782
79125
|
|
|
78783
79126
|
JSConsole.Chart.Log(`[KLineChartContainer::RecvMinuteRealtimeDataV2] update kline by 1 minute data [${lastDataCount}->${this.SourceData.Data.length}], IsAutoSyncDataOffset=${this.IsAutoSyncDataOffset}`);
|
|
78784
79127
|
|
|
@@ -78861,7 +79204,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78861
79204
|
if (this.IsApiPeriod) this.ReduceSourceData(); //减少数据
|
|
78862
79205
|
var lastDataCount=this.GetHistoryDataCount(); //保存下上一次的数据个数
|
|
78863
79206
|
var lastSourceDataCount=this.SourceData.Data.length;
|
|
78864
|
-
if (!this.SourceData.MergeMinuteData(realtimeData)) return;
|
|
79207
|
+
if (!this.SourceData.MergeMinuteData(realtimeData, this.Period)) return;
|
|
78865
79208
|
|
|
78866
79209
|
JSConsole.Chart.Log(`[KLineChartContainer::RecvMinuteRealtimeData] update kline by 1 minute data [${lastSourceDataCount}->${this.SourceData.Data.length}]`);
|
|
78867
79210
|
|
|
@@ -78932,7 +79275,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
|
|
|
78932
79275
|
var realtimeData=KLineChartContainer.JsonDataToMinuteRealtimeData(data,item.Symbol); //获取叠加股票的最新数据
|
|
78933
79276
|
if (!realtimeData) continue;
|
|
78934
79277
|
var sourceData=item.SourceData; //叠加股票的所有数据
|
|
78935
|
-
if (!sourceData.MergeMinuteData(realtimeData)) return;
|
|
79278
|
+
if (!sourceData.MergeMinuteData(realtimeData,this.Period)) return;
|
|
78936
79279
|
|
|
78937
79280
|
var bindData=new ChartData();
|
|
78938
79281
|
bindData.Data=sourceData.Data;
|
|
@@ -83763,6 +84106,27 @@ KLineChartContainer.JsonDataToHistoryData=function(data)
|
|
|
83763
84106
|
return aryDayData;
|
|
83764
84107
|
}
|
|
83765
84108
|
|
|
84109
|
+
|
|
84110
|
+
KLineChartContainer.JsonDataToRealtimeDataV2=function(data, symbol)
|
|
84111
|
+
{
|
|
84112
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(data.stock)) return null;
|
|
84113
|
+
|
|
84114
|
+
var finder=null;
|
|
84115
|
+
for(var i=0;i<data.stock.length;++i)
|
|
84116
|
+
{
|
|
84117
|
+
var item=data.stock[i];
|
|
84118
|
+
if (item.symbol==symbol)
|
|
84119
|
+
{
|
|
84120
|
+
finder=item;
|
|
84121
|
+
break;
|
|
84122
|
+
}
|
|
84123
|
+
}
|
|
84124
|
+
|
|
84125
|
+
if (!finder) return null;
|
|
84126
|
+
|
|
84127
|
+
return KLineChartContainer.JsonDataToHistoryData(finder);
|
|
84128
|
+
}
|
|
84129
|
+
|
|
83766
84130
|
KLineChartContainer.JsonDataToRealtimeData=function(data, symbol)
|
|
83767
84131
|
{
|
|
83768
84132
|
if (!data.stock) return null;
|
|
@@ -268,6 +268,23 @@ function GetBlackStyle()
|
|
|
268
268
|
LineDash:[2,2]
|
|
269
269
|
},
|
|
270
270
|
|
|
271
|
+
PredictionKLine:
|
|
272
|
+
{
|
|
273
|
+
Line:
|
|
274
|
+
{
|
|
275
|
+
Color:"rgb(220,220,220)",
|
|
276
|
+
LineDash:[3*GetDevicePixelRatio(),3*GetDevicePixelRatio()]
|
|
277
|
+
},
|
|
278
|
+
|
|
279
|
+
Bar:
|
|
280
|
+
{
|
|
281
|
+
UpColor:"rgb(30,144,255)",
|
|
282
|
+
DownColor:"rgb(30,144,255)",
|
|
283
|
+
UnchangeColor:"rgb(30,144,255)" ,
|
|
284
|
+
DrawType:3
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
|
|
271
288
|
PriceGapStyple:
|
|
272
289
|
{
|
|
273
290
|
Line:{ Color:"rgb(128,128,128)" },
|