hqchart 1.1.12505 → 1.1.12513

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.
@@ -10370,6 +10370,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10370
10370
  return false;
10371
10371
  }
10372
10372
 
10373
+ this.IsMinuteContainer=function()
10374
+ {
10375
+ if (this.ClassName=="MinuteChartContainer" || this.ClassName=="MinuteChartHScreenContainer") return true;
10376
+
10377
+ return false;
10378
+ }
10379
+
10373
10380
  this.UpdatePointByCursorIndex=function(type) //type 1=根据十字光标更新 2=强制取消十字光标
10374
10381
  {
10375
10382
  var pt={X:null, Y:null};
@@ -24945,9 +24952,12 @@ function IChartPainting()
24945
24952
  }
24946
24953
  else if (valueType==3)
24947
24954
  {
24948
- var price=this.Data.Data[i].Close;
24949
- if (price==null) continue;
24950
- value=price/this.YClose*this.MainYClose;
24955
+ var minItem=this.Data.Data[i];
24956
+ var mainItem=this.MainData.Data[i];
24957
+ if (!minItem || !IFrameSplitOperator.IsNumber(minItem.Close) || !IFrameSplitOperator.IsNumber(minItem.YClose)) continue;
24958
+ if (!mainItem || !IFrameSplitOperator.IsNumber(mainItem.Close) || !IFrameSplitOperator.IsNumber(mainItem.YClose)) continue;
24959
+ var price=minItem.Close;
24960
+ var value=price/minItem.YClose*mainItem.YClose;
24951
24961
  }
24952
24962
  else if (valueType==4)
24953
24963
  {
@@ -25067,9 +25077,12 @@ function IChartPainting()
25067
25077
  }
25068
25078
  else if (valueType==3)
25069
25079
  {
25070
- var price=this.Data.Data[i].Close;
25071
- if (price==null) continue;
25072
- var value=price/this.YClose*this.MainYClose;
25080
+ var minItem=this.Data.Data[i];
25081
+ var mainItem=this.MainData.Data[i];
25082
+ if (!minItem || !IFrameSplitOperator.IsNumber(minItem.Close) || !IFrameSplitOperator.IsNumber(minItem.YClose)) continue;
25083
+ if (!mainItem || !IFrameSplitOperator.IsNumber(mainItem.Close) || !IFrameSplitOperator.IsNumber(mainItem.YClose)) continue;
25084
+ var price=minItem.Close;
25085
+ var value=price/minItem.YClose*mainItem.YClose;
25073
25086
  }
25074
25087
  else
25075
25088
  {
@@ -35719,19 +35732,16 @@ function ChartOverlayMinutePriceLine()
35719
35732
 
35720
35733
  this.Color="rgb(65,105,225)";
35721
35734
  this.MainData; //主图数据
35722
- this.MainYClose; //主图股票的前收盘价
35723
35735
  this.SourceData; //原始数据
35724
35736
 
35725
35737
  this.ClassName="ChartOverlayMinutePriceLine";
35726
35738
  this.Title;
35727
35739
  this.Symbol; //叠加的股票代码
35728
- this.YClose; //叠加的股票前收盘
35729
35740
  this.Status=OVERLAY_STATUS_ID.STATUS_NONE_ID;
35730
35741
 
35731
35742
  this.OverlayType=0; //叠加方式 0=百分比叠加 1=绝对叠加
35732
35743
  this.IsCalcuateMaxMin=true; //是否参与计算Y轴的最大最小值
35733
35744
 
35734
-
35735
35745
  this.SetOption=function(option)
35736
35746
  {
35737
35747
  if (option)
@@ -35743,19 +35753,21 @@ function ChartOverlayMinutePriceLine()
35743
35753
 
35744
35754
  this.PtInChart=function(x,y)
35745
35755
  {
35746
- var option={ MinuteOverlayPrice:true, YClose:this.YClose, MainYClose:this.MainYClose, OverlayType:this.OverlayType };
35756
+ var option={ MinuteOverlayPrice:true, OverlayType:this.OverlayType };
35747
35757
  return this.PtInLine(x, y, option);
35748
35758
  }
35749
35759
 
35750
35760
  this.DrawSelectedStatus=function()
35751
35761
  {
35752
- var option={ MinuteOverlayPrice:true, YClose:this.YClose, MainYClose:this.MainYClose, OverlayType:this.OverlayType };
35762
+ var option={ MinuteOverlayPrice:true, OverlayType:this.OverlayType };
35753
35763
  this.DrawLinePoint(option);
35754
35764
  }
35755
35765
 
35756
35766
  this.Draw=function()
35757
35767
  {
35758
35768
  if (!this.Data) return;
35769
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
35770
+
35759
35771
  if (this.NotSupportMessage)
35760
35772
  {
35761
35773
  this.DrawNotSupportmessage();
@@ -35776,37 +35788,53 @@ function ChartOverlayMinutePriceLine()
35776
35788
  var bFirstPoint=true;
35777
35789
  var drawCount=0;
35778
35790
  var xOffset=0, showValue=0;
35791
+ var yClose=null, mainYClose=null;
35792
+ var pointCount=0;
35779
35793
  for(var i=this.Data.DataOffset+xOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
35780
35794
  {
35781
- var value=this.Data.Data[i].Close;
35782
- if (value==null) continue;
35795
+ var item=this.Data.Data[i];
35796
+ if (item && IFrameSplitOperator.IsNumber(item.Close))
35797
+ {
35798
+ if (bFirstPoint) //百分比使用每天的昨收计算
35799
+ {
35800
+ yClose=item.YClose;
35801
+ var minItem=this.MainData.Data[i];
35802
+ mainYClose=minItem.YClose;
35803
+ }
35783
35804
 
35784
- showValue=value; //绝对叠加
35785
- if (this.OverlayType==0) showValue=value/this.YClose*this.MainYClose; //百分比
35805
+ var value=item.Close;
35806
+ showValue=value; //绝对叠加
35786
35807
 
35787
- var x=this.ChartFrame.GetXFromIndex(j);
35788
- var y=this.ChartFrame.GetYFromData(showValue, false);
35808
+ if (this.OverlayType==0)
35809
+ showValue=value/yClose*mainYClose; //百分比
35789
35810
 
35790
- if (bFirstPoint)
35791
- {
35792
- this.Canvas.strokeStyle=this.Color;
35793
- this.Canvas.beginPath();
35794
- if (isHScreen) this.Canvas.moveTo(y,x);
35795
- else this.Canvas.moveTo(x,y);
35796
- bFirstPoint=false;
35797
- }
35798
- else
35799
- {
35800
- if (isHScreen) this.Canvas.lineTo(y,x);
35801
- else this.Canvas.lineTo(x,y);
35811
+ var x=this.ChartFrame.GetXFromIndex(j);
35812
+ var y=this.ChartFrame.GetYFromData(showValue, false);
35813
+
35814
+ if (bFirstPoint)
35815
+ {
35816
+ this.Canvas.strokeStyle=this.Color;
35817
+ this.Canvas.beginPath();
35818
+ if (isHScreen) this.Canvas.moveTo(y,x);
35819
+ else this.Canvas.moveTo(x,y);
35820
+ bFirstPoint=false;
35821
+ }
35822
+ else
35823
+ {
35824
+ if (isHScreen) this.Canvas.lineTo(y,x);
35825
+ else this.Canvas.lineTo(x,y);
35826
+ }
35827
+
35828
+ ++drawCount;
35802
35829
  }
35803
35830
 
35804
- ++drawCount;
35831
+ ++pointCount;
35805
35832
 
35806
- if (drawCount>=minuteCount) //上一天的数据和这天地数据线段要断开
35833
+ if (pointCount>=minuteCount) //上一天的数据和这天地数据线段要断开
35807
35834
  {
35808
35835
  bFirstPoint=true;
35809
- this.Canvas.stroke();
35836
+ pointCount=0;
35837
+ if (drawCount>0) this.Canvas.stroke();
35810
35838
  drawCount=0;
35811
35839
  }
35812
35840
  }
@@ -35819,24 +35847,46 @@ function ChartOverlayMinutePriceLine()
35819
35847
  this.GetMaxMin=function()
35820
35848
  {
35821
35849
  var xPointCount=this.ChartFrame.XPointCount;
35822
- var range={};
35850
+ var range={ Min:null, Max:null };
35823
35851
  if (!this.IsCalcuateMaxMin) return range;
35824
- if (this.YClose==null) return range;
35825
35852
 
35826
- range.Min=this.MainYClose;
35827
- range.Max=this.MainYClose;
35853
+ var minuteCount=this.ChartFrame.MinuteCount;
35854
+ var yClose=null, mainYClose=null;
35855
+ var bFirstPoint=true;
35856
+ var pointCount=0;
35828
35857
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
35829
35858
  {
35830
- var value=this.Data.Data[i].Close;
35831
- if (value==null) continue;
35859
+ var item=this.Data.Data[i];
35860
+ if (!item || !IFrameSplitOperator.IsNumber(item.Close))
35861
+ {
35862
+ ++pointCount;
35863
+ continue;
35864
+ }
35832
35865
 
35833
- if (this.OverlayType==0) value=value/this.YClose*this.MainYClose;
35866
+ if (bFirstPoint)
35867
+ {
35868
+ yClose=item.YClose;
35869
+ var minItem=this.MainData.Data[i];
35870
+ mainYClose=minItem.YClose;
35871
+ bFirstPoint=false;
35872
+ }
35873
+
35874
+ var value=item.Close;
35875
+ if (this.OverlayType==0) value=value/yClose*mainYClose;
35834
35876
 
35835
35877
  if (range.Max==null) range.Max=value;
35836
35878
  if (range.Min==null) range.Min=value;
35837
35879
 
35838
35880
  if (range.Max<value) range.Max=value;
35839
35881
  if (range.Min>value) range.Min=value;
35882
+
35883
+ ++pointCount;
35884
+
35885
+ if (pointCount>=minuteCount)
35886
+ {
35887
+ bFirstPoint=true;
35888
+ pointCount=0;
35889
+ }
35840
35890
  }
35841
35891
 
35842
35892
  //JSConsole.Chart.Log(`[ChartOverlayMinutePriceLine::GetMaxMin] max=${range.Max} min=${range.Min}`);
@@ -76964,7 +77014,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
76964
77014
  //叠加股票
76965
77015
  this.OverlaySymbol=function(symbol,option)
76966
77016
  {
76967
- for(var i in this.OverlayChartPaint)
77017
+ for(var i=0; i<this.OverlayChartPaint.length; ++i)
76968
77018
  {
76969
77019
  var item=this.OverlayChartPaint[i];
76970
77020
  if (item.Symbol==symbol)
@@ -76984,11 +77034,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
76984
77034
  if (option && option.Color) paint.Color=option.Color; //外部设置颜色
76985
77035
  else paint.Color=g_JSChartResource.OverlaySymbol.Color[g_JSChartResource.OverlaySymbol.Random%g_JSChartResource.OverlaySymbol.Color.length];
76986
77036
  ++g_JSChartResource.OverlaySymbol.Random;
76987
- if (this.ChartPaint[0].YClose>0 && this.ChartPaint[0].Data) //绑定主图数据
76988
- {
76989
- paint.MainData=this.ChartPaint[0].Data;
76990
- paint.MainYClose=this.ChartPaint[0].YClose;
76991
- }
77037
+ paint.MainData=this.SourceData; //绑定主图数据
76992
77038
 
76993
77039
  if (paint.SetOption) paint.SetOption(option);
76994
77040
 
@@ -77956,7 +78002,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77956
78002
  for(var i=0; i<this.OverlayChartPaint.length; ++i)
77957
78003
  {
77958
78004
  let item=this.OverlayChartPaint[i];
77959
- if (!item.MainData || !(item.MainYClose>0) ) continue;
78005
+ if (!item.MainData) continue;
77960
78006
  if (item.Status!=OVERLAY_STATUS_ID.STATUS_NONE_ID) continue;
77961
78007
  var symbol=item.Symbol;
77962
78008
  if (!symbol) continue;
@@ -78017,7 +78063,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78017
78063
  for(var j=0; j<this.OverlayChartPaint.length; ++j)
78018
78064
  {
78019
78065
  var item=this.OverlayChartPaint[j];
78020
- if (!item.MainData || !(item.MainYClose>0) ) continue;
78066
+ if (!item.MainData) continue;
78021
78067
  if (overlayData.symbol==item.Symbol)
78022
78068
  {
78023
78069
  this.RecvOverlayMinuteData(overlayData, item, { Redraw:false });
@@ -78178,6 +78224,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78178
78224
  {
78179
78225
  var empytData=new ChartData();
78180
78226
  empytData.Date=item.Date;
78227
+ empytData.Data.length=item.Data.length;
78181
78228
  overlayDayData.push(empytData);
78182
78229
  }
78183
78230
  }
@@ -78411,11 +78458,10 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78411
78458
  this.ExtendChartPaint[0].Name=this.Name;
78412
78459
  }
78413
78460
 
78414
- for(var i in this.OverlayChartPaint)
78461
+ for(var i=0; i<this.OverlayChartPaint.length; ++i)
78415
78462
  {
78416
78463
  var item=this.OverlayChartPaint[i];
78417
- item.MainData=this.ChartPaint[0].Data; //叠加股票
78418
- item.MainYClose=yClose;
78464
+ item.MainData=minuteData; //绑定主图数据
78419
78465
  }
78420
78466
  }
78421
78467
 
@@ -102201,6 +102247,36 @@ function JSDraw(errorHandler,symbolData)
102201
102247
  return result;
102202
102248
  }
102203
102249
 
102250
+ //叠加一个K线
102251
+ this.DRAWOVERLAYKLINE=function(open, high, low, close)
102252
+ {
102253
+ var drawData=[];
102254
+ var result={DrawData:drawData, DrawType:'DRAWOVERLAYKLINE'};
102255
+ var count=Math.max(high.length, open.length,low.length,close.length);
102256
+
102257
+ var kData=this.SymbolData.Data.Data;
102258
+ for(var i=0;i<count;++i)
102259
+ {
102260
+ var item={Open:null,High:null, Low:null, Close:null};
102261
+ var kItem=kData[i];
102262
+ if (i<high.length && i<open.length && i<low.length && i<close.length &&
102263
+ IFrameSplitOperator.IsNumber(open[i]) && IFrameSplitOperator.IsNumber(high[i]) && IFrameSplitOperator.IsNumber(low[i]) && IFrameSplitOperator.IsNumber(low[i]))
102264
+ {
102265
+
102266
+ item.Open=open[i];
102267
+ item.High=high[i];
102268
+ item.Low=low[i];
102269
+ item.Close=close[i];
102270
+ item.Date=kItem.Date;
102271
+ if (IFrameSplitOperator.IsNumber(kItem.Time)) item.Time=kItem.Time;
102272
+ }
102273
+
102274
+ drawData[i]=item;
102275
+ }
102276
+
102277
+ return result;
102278
+ }
102279
+
102204
102280
  /*
102205
102281
  DRAWCOLORKLINE 绘制K线
102206
102282
  用法:
@@ -103708,7 +103784,7 @@ JSDraw.prototype.IsDrawFunction=function(name)
103708
103784
  {
103709
103785
  let setFunctionName=new Set(
103710
103786
  [
103711
- "STICKLINE","DRAWTEXT",'SUPERDRAWTEXT','DRAWLINE','DRAWBAND','DRAWKLINE',"DRAWKLINE1",'DRAWKLINE_IF',"DRAWCOLORKLINE",'PLOYLINE',
103787
+ "STICKLINE","DRAWTEXT",'SUPERDRAWTEXT','DRAWLINE','DRAWBAND','DRAWKLINE',"DRAWKLINE1",'DRAWKLINE_IF',"DRAWCOLORKLINE",'PLOYLINE',"DRAWOVERLAYKLINE",
103712
103788
  'POLYLINE','DRAWNUMBER',"DRAWNUMBER_FIX",'DRAWICON','DRAWCHANNEL','PARTLINE','DRAWTEXT_FIX','DRAWGBK','DRAWTEXT_LINE','DRAWRECTREL',"DRAWTEXTABS","DRAWTEXTREL",
103713
103789
  'DRAWOVERLAYLINE',"FILLRGN", "FILLRGN2","FILLTOPRGN", "FILLBOTTOMRGN", "FILLVERTICALRGN","FLOATRGN","DRAWSL", "DRAWGBK2","DRAWGBK_DIV",
103714
103790
  "VERTLINE","HORLINE","TIPICON"
@@ -109992,6 +110068,10 @@ function JSExecute(ast,option)
109992
110068
  node.Draw=this.Draw.DRAWKLINE_IF(args[0],args[1],args[2],args[3],args[4]);
109993
110069
  node.Out=[];
109994
110070
  break;
110071
+ case "DRAWOVERLAYKLINE":
110072
+ node.Draw=this.Draw.DRAWOVERLAYKLINE(args[0],args[1],args[2],args[3]);
110073
+ node.Out=[];
110074
+ break;
109995
110075
  case "DRAWCOLORKLINE":
109996
110076
  node.Draw=this.Draw.DRAWCOLORKLINE(args[0],args[1],args[2]);
109997
110077
  node.Out=[];
@@ -112613,6 +112693,28 @@ function ScriptIndex(name,script,args,option)
112613
112693
  hqChart.ChartPaint.push(chart);
112614
112694
  }
112615
112695
 
112696
+ this.CreateOverlayKLine=function(hqChart,windowIndex,varItem,id)
112697
+ {
112698
+ var chart=null;
112699
+ if (hqChart.IsKLineContainer()) chart=new ChartOverlayKLine();
112700
+ else if (hqChart.IsMinuteContainer()) chart=new ChartOverlayMinutePriceLine();
112701
+ else return;
112702
+
112703
+ chart.Canvas=hqChart.Canvas;
112704
+ chart.Name=varItem.Name;
112705
+ chart.Identify=this.Guid;
112706
+ chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
112707
+ chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
112708
+
112709
+ if (varItem.Color) chart.Color=this.GetColor(varItem.Color); //如果设置了颜色,使用外面设置的颜色
112710
+ else chart.Color=this.GetDefaultColor(id);
112711
+
112712
+ chart.Data.Data=varItem.Draw.DrawData;
112713
+ chart.MainData=hqChart.ChartPaint[0].Data;//绑定K线
112714
+
112715
+ hqChart.ChartPaint.push(chart);
112716
+ }
112717
+
112616
112718
  this.CreateDrawColorKLine=function(hqChart,windowIndex,varItem,i)
112617
112719
  {
112618
112720
  let chart=new ChartColorKline();
@@ -113453,6 +113555,9 @@ function ScriptIndex(name,script,args,option)
113453
113555
  case "DRAWKLINE1":
113454
113556
  this.CreateKLine(hqChart,windowIndex,item,i);
113455
113557
  break;
113558
+ case "DRAWOVERLAYKLINE":
113559
+ this.CreateOverlayKLine(hqChart,windowIndex,item,i);
113560
+ break;
113456
113561
  case "DRAWCOLORKLINE":
113457
113562
  this.CreateDrawColorKLine(hqChart,windowIndex,item,i);
113458
113563
  break;
@@ -128322,7 +128427,7 @@ function ScrollBarBGChart()
128322
128427
 
128323
128428
 
128324
128429
 
128325
- var HQCHART_VERSION="1.1.12504";
128430
+ var HQCHART_VERSION="1.1.12512";
128326
128431
 
128327
128432
  function PrintHQChartVersion()
128328
128433
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12504";
8
+ var HQCHART_VERSION="1.1.12512";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -17,8 +17,8 @@
17
17
 
18
18
  function JSStockResource()
19
19
  {
20
- this.Domain = "https://opensource.zealink.com"; //API域名
21
- this.CacheDomain = "https://opensourcecache.zealink.com"; //缓存域名
20
+ this.Domain = "http://127.0.0.1:8886"; //API域名
21
+ this.CacheDomain = "http://127.0.0.1:8886"; //缓存域名
22
22
  }
23
23
 
24
24
  var g_JSStockResource = new JSStockResource();