hqchart 1.1.12463 → 1.1.12472

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.
@@ -5025,6 +5025,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5025
5025
  {
5026
5026
  this.ChartCorssCursor.LastPoint=this.LastPoint;
5027
5027
  this.ChartCorssCursor.CursorIndex=this.CursorIndex;
5028
+ if (this.EnableNewIndex)
5029
+ {
5030
+ this.ChartCorssCursor.CorssCursorIndex=this.CorssCursorIndex;
5031
+ this.ChartCorssCursor.EnableNewIndex=this.EnableNewIndex;
5032
+ }
5028
5033
 
5029
5034
  var bRestoreCanvas=false;
5030
5035
  if (this.CorssCursorCanvas) //独立的十字光标层
@@ -5387,6 +5392,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5387
5392
  {
5388
5393
  this.ChartCorssCursor.LastPoint=this.LastPoint;
5389
5394
  this.ChartCorssCursor.CursorIndex=this.CursorIndex;
5395
+ if (this.EnableNewIndex)
5396
+ {
5397
+ this.ChartCorssCursor.CorssCursorIndex=this.CorssCursorIndex;
5398
+ this.ChartCorssCursor.EnableNewIndex=this.EnableNewIndex;
5399
+ }
5390
5400
 
5391
5401
  var bRestoreCanvas=false;
5392
5402
  if (this.CorssCursorCanvas) //独立的十字光标层
@@ -8438,6 +8448,30 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8438
8448
 
8439
8449
  return aryData;
8440
8450
  }
8451
+
8452
+ //重置指标计数器
8453
+ this.ClearIndexRunCount=function()
8454
+ {
8455
+ //主图指标
8456
+ for(var i=0;i<this.WindowIndex.length;++i)
8457
+ {
8458
+ var item=this.WindowIndex[i];
8459
+ if (!item) continue;
8460
+
8461
+ item.RunCount=0;
8462
+ }
8463
+
8464
+ //叠加指标
8465
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
8466
+ {
8467
+ var item=this.Frame.SubFrame[i];
8468
+ for(var j=0; j<item.OverlayIndex.length; ++j)
8469
+ {
8470
+ var overlayItem=item.OverlayIndex[j];
8471
+ if (overlayItem.Script) overlayItem.Script.RunCount=0;
8472
+ }
8473
+ }
8474
+ }
8441
8475
  }
8442
8476
 
8443
8477
  function GetDevicePixelRatio()
@@ -45027,6 +45061,9 @@ function ChartCorssCursor()
45027
45061
  this.IsFixXLastTime=false; //是否修正X轴,超出当前时间的,X轴调整到当前最后的时间.
45028
45062
  this.IsDrawXRangeBG=false; //是否绘制十字光标背景
45029
45063
 
45064
+ this.EnableNewIndex=false; //分时图是否使用最新的索引结构 (由外部chart容器传入)
45065
+ this.CorssCursorIndex; //分时图新版本的索引结构 (由外部chart容器传入)
45066
+
45030
45067
  this.PointX;
45031
45068
  this.PointY;
45032
45069
 
@@ -45084,20 +45121,34 @@ function ChartCorssCursor()
45084
45121
 
45085
45122
  this.GetMinuteCloseYPoint=function(index)
45086
45123
  {
45087
- if (!IFrameSplitOperator.IsNumber(index)) return null;
45088
- index=parseInt(index);
45089
- if (!this.StringFormatX.Data) return null;
45090
- var data = this.StringFormatX.Data;
45091
- if (!data.Data || data.Data.length <= 0) return null;
45092
- var dataIndex = data.DataOffset + index;
45093
- if (dataIndex >= data.Data.length) dataIndex = data.Data.length - 1;
45094
- if (dataIndex < 0) return null;
45124
+ if (this.EnableNewIndex && this.CorssCursorIndex)
45125
+ {
45126
+ if (!this.StringFormatX || !this.StringFormatX.GetMinuteCloseYPoint) return null;
45127
+
45128
+ var closeData=this.StringFormatX.GetMinuteCloseYPoint(this.CorssCursorIndex);
45129
+ if (!closeData) return null;
45130
+
45131
+ this.Close=closeData.Price;
45132
+ return closeData.Y;
45133
+ }
45134
+ else
45135
+ {
45095
45136
 
45096
- var close = data.Data[dataIndex];
45097
- if (!IFrameSplitOperator.IsNumber(index)) return null;
45098
- this.Close=close;
45099
- var yPoint = this.Frame.GetYFromData(this.Close);
45100
- return yPoint;
45137
+ if (!IFrameSplitOperator.IsNumber(index)) return null;
45138
+ index=parseInt(index);
45139
+ if (!this.StringFormatX.Data) return null;
45140
+ var data = this.StringFormatX.Data;
45141
+ if (!data.Data || data.Data.length <= 0) return null;
45142
+ var dataIndex = data.DataOffset + index;
45143
+ if (dataIndex >= data.Data.length) dataIndex = data.Data.length - 1;
45144
+ if (dataIndex < 0) return null;
45145
+
45146
+ var close = data.Data[dataIndex];
45147
+ if (!IFrameSplitOperator.IsNumber(index)) return null;
45148
+ this.Close=close;
45149
+ var yPoint = this.Frame.GetYFromData(this.Close);
45150
+ return yPoint;
45151
+ }
45101
45152
  }
45102
45153
 
45103
45154
  this.GetDateTimeRange=function(index, option)
@@ -46764,6 +46815,7 @@ function HQMinuteTimeStringFormat()
46764
46815
  this.newMethod();
46765
46816
  delete this.newMethod;
46766
46817
 
46818
+ this.ClassName="HQMinuteTimeStringFormat";
46767
46819
  this.Frame;
46768
46820
  this.Symbol;
46769
46821
  this.Point;
@@ -46895,6 +46947,88 @@ function HQMinuteTimeStringFormat()
46895
46947
 
46896
46948
  return true;
46897
46949
  }
46950
+
46951
+ this.GetMinuteCloseYPoint=function(cursorIndexData)
46952
+ {
46953
+ var type=cursorIndexData.Type;
46954
+ if (type==1 || type==2 || type==3) //单日 1=主图 2=盘前 3=盘后
46955
+ {
46956
+ if (type==1)
46957
+ {
46958
+ if (!this.Data || this.Data.Data.length <= 0) return null;
46959
+ var index=cursorIndexData.DataIndex;
46960
+ if (index<0 || index>=this.Data.Data.length) index=this.Data.Data.length-1;
46961
+
46962
+ var close = this.Data.Data[index];
46963
+ var yPoint = this.Frame.GetYFromData(close);
46964
+ return { Price:close, Y:yPoint };
46965
+ }
46966
+ else if (type==2)
46967
+ {
46968
+ if (!this.BeforeOpenData || !this.BeforeOpenData.Data) return false;
46969
+ if (cursorIndexData.DataIndex<0 || cursorIndexData.DataIndex>=this.BeforeOpenData.Data.length) return null;
46970
+ var item=this.BeforeOpenData.Data[cursorIndexData.DataIndex];
46971
+
46972
+ var close=item.Price;
46973
+ var yPoint = this.Frame.GetYFromData(close);
46974
+ return { Price:close, Y:yPoint };
46975
+ }
46976
+ else if (type==3)
46977
+ {
46978
+ if (!this.AfterCloseData || !this.AfterCloseData.Data) return false;
46979
+ if (cursorIndexData.DataIndex<0 || cursorIndexData.DataIndex>=this.AfterCloseData.Data.length) return null;
46980
+ var item=this.AfterCloseData.Data[cursorIndexData.DataIndex];
46981
+
46982
+ var close=item.Price;
46983
+ var yPoint = this.Frame.GetYFromData(close);
46984
+ return { Price:close, Y:yPoint };
46985
+ }
46986
+ }
46987
+ else if (type==10 || type==20 || type==30) //多日 10=主图 20=盘前 30=盘后
46988
+ {
46989
+ if (type==10)
46990
+ {
46991
+ if (!this.Data || this.Data.Data.length <= 0) return null;
46992
+ var index=this.Frame.MinuteCount*cursorIndexData.DayIndex+cursorIndexData.DataIndex;
46993
+ if (index<0 || index>=this.Data.Data.length) index=this.Data.Data.length-1;
46994
+
46995
+ var close = this.Data.Data[index];
46996
+ var yPoint = this.Frame.GetYFromData(close);
46997
+ return { Price:close, Y:yPoint };
46998
+ }
46999
+ else if (type==20)
47000
+ {
47001
+ var multiDayBeforeOpenData=this.GetMultiDayBeforeOpenData();
47002
+ if (!multiDayBeforeOpenData) return null;
47003
+ if (cursorIndexData.DayIndex<0 || cursorIndexData.DayIndex>=multiDayBeforeOpenData.length) return null;
47004
+
47005
+ var dayItem=multiDayBeforeOpenData[cursorIndexData.DayIndex];
47006
+ if (cursorIndexData.DataIndex<0 || cursorIndexData.DataIndex>=dayItem.Data.length) return null;
47007
+ var item=dayItem.Data[cursorIndexData.DataIndex];
47008
+
47009
+ var close=item.Price;
47010
+ var yPoint = this.Frame.GetYFromData(close);
47011
+ return { Price:close, Y:yPoint };
47012
+ }
47013
+ else if (type==30)
47014
+ {
47015
+ var multiDayAfterCloseData=this.GetMultiDayAfterCloseData();
47016
+ if (!multiDayAfterCloseData) return null;
47017
+ if (cursorIndexData.DayIndex<0 || cursorIndexData.DayIndex>=multiDayAfterCloseData.length) return null;
47018
+
47019
+ var dayItem=multiDayAfterCloseData[cursorIndexData.DayIndex];
47020
+ if (cursorIndexData.DataIndex<0 || cursorIndexData.DataIndex>=dayItem.Data.length) return null;
47021
+ var item=dayItem.Data[cursorIndexData.DataIndex];
47022
+
47023
+ var close=item.Price;
47024
+ var yPoint = this.Frame.GetYFromData(close);
47025
+ return { Price:close, Y:yPoint };
47026
+ }
47027
+ }
47028
+
47029
+
47030
+ return null;
47031
+ }
46898
47032
  }
46899
47033
 
46900
47034
 
@@ -64305,22 +64439,27 @@ function KLineChartContainer(uielement,OffscreenElement)
64305
64439
  {
64306
64440
  if (!this.WindowIndex[windowIndex]) return;
64307
64441
 
64308
- if (typeof(this.WindowIndex[windowIndex].RequestData)=="function") //数据需要另外下载的.
64442
+ var item=this.WindowIndex[windowIndex];
64443
+ if (typeof(item.RequestData)=="function") //数据需要另外下载的.
64309
64444
  {
64310
- this.WindowIndex[windowIndex].RequestData(this,windowIndex,hisData, option);
64445
+ item.RequestData(this,windowIndex,hisData, option);
64311
64446
  return;
64312
64447
  }
64313
- if (typeof(this.WindowIndex[windowIndex].ExecuteScript)=='function')
64448
+
64449
+ if (typeof(item.ExecuteScript)=='function')
64314
64450
  {
64315
- this.WindowIndex[windowIndex].ExecuteScript(this,windowIndex,hisData);
64451
+ if (option && option.CheckRunCount)
64452
+ if (item.IsExcessRunCount()) return;
64453
+
64454
+ item.ExecuteScript(this,windowIndex,hisData);
64316
64455
  return;
64317
64456
  }
64318
64457
 
64319
- this.WindowIndex[windowIndex].BindData(this,windowIndex,hisData);
64458
+ item.BindData(this,windowIndex,hisData);
64320
64459
  }
64321
64460
 
64322
64461
  //叠加指标
64323
- this.BindOverlayIndexData=function(overlayItem, windowIndex, hisData)
64462
+ this.BindOverlayIndexData=function(overlayItem, windowIndex, hisData, option)
64324
64463
  {
64325
64464
  if (!overlayItem.Script) return;
64326
64465
 
@@ -64332,6 +64471,9 @@ function KLineChartContainer(uielement,OffscreenElement)
64332
64471
 
64333
64472
  if (typeof(overlayItem.Script.ExecuteScript)=='function')
64334
64473
  {
64474
+ if (option && option.CheckRunCount)
64475
+ if (overlayItem.Script.IsExcessRunCount()) return;
64476
+
64335
64477
  overlayItem.Script.ExecuteScript(this,windowIndex,hisData);
64336
64478
  return;
64337
64479
  }
@@ -64497,7 +64639,7 @@ function KLineChartContainer(uielement,OffscreenElement)
64497
64639
  });
64498
64640
  }
64499
64641
 
64500
- this.BindAllOverlayIndexData=function(hisData)
64642
+ this.BindAllOverlayIndexData=function(hisData, option)
64501
64643
  {
64502
64644
  if (!this.Frame || !this.Frame.SubFrame) return;
64503
64645
 
@@ -64508,7 +64650,7 @@ function KLineChartContainer(uielement,OffscreenElement)
64508
64650
  for(var j in item.OverlayIndex)
64509
64651
  {
64510
64652
  var overlayItem=item.OverlayIndex[j];
64511
- this.BindOverlayIndexData(overlayItem,i,hisData)
64653
+ this.BindOverlayIndexData(overlayItem,i,hisData,option)
64512
64654
  }
64513
64655
  }
64514
64656
  }
@@ -65191,7 +65333,7 @@ function KLineChartContainer(uielement,OffscreenElement)
65191
65333
 
65192
65334
  for(var i=0; i<this.Frame.SubFrame.length; ++i)
65193
65335
  {
65194
- this.BindIndexData(i,bindData);
65336
+ this.BindIndexData(i,bindData, { CheckRunCount:true });
65195
65337
  }
65196
65338
 
65197
65339
  //刷新画图
@@ -65204,7 +65346,7 @@ function KLineChartContainer(uielement,OffscreenElement)
65204
65346
  this.SendKLineUpdateEvent(bindData);
65205
65347
 
65206
65348
  //叠加指标计算
65207
- this.BindAllOverlayIndexData(bindData);
65349
+ this.BindAllOverlayIndexData(bindData,{ CheckRunCount:true });
65208
65350
 
65209
65351
  if (this.mapEvent.has(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA))
65210
65352
  {
@@ -65929,6 +66071,7 @@ function KLineChartContainer(uielement,OffscreenElement)
65929
66071
  this.ClearRectSelect(true);
65930
66072
  this.Frame.ClearUpDonwFrameYData();
65931
66073
  this.ClearCustomKLine();
66074
+
65932
66075
 
65933
66076
  var kLineDrawType=this.GetKLineDrawType();
65934
66077
  if (kLineDrawType==10 || kLineDrawType==11 || kLineDrawType==12 || kLineDrawType==16) isDataTypeChange=true;
@@ -65950,6 +66093,7 @@ function KLineChartContainer(uielement,OffscreenElement)
65950
66093
 
65951
66094
  if (isDataTypeChange==false && !this.IsApiPeriod)
65952
66095
  {
66096
+ this.ClearIndexRunCount();
65953
66097
  this.Update( {UpdateCursorIndexType:2} ); //更新的时候 取消显示十字光标
65954
66098
  return;
65955
66099
  }
@@ -65962,6 +66106,7 @@ function KLineChartContainer(uielement,OffscreenElement)
65962
66106
  this.AutoUpdateEvent(false,'KLineChartContainer::ChangePeriod'); //切换周期先停止更新
65963
66107
  this.ResetScrollBar();
65964
66108
  this.ResetOverlaySymbolStatus();
66109
+ this.ClearIndexRunCount();
65965
66110
  this.RequestHistoryData(); //请求日线数据
65966
66111
  //this.ReqeustKLineInfoData();
65967
66112
  }
@@ -65971,6 +66116,7 @@ function KLineChartContainer(uielement,OffscreenElement)
65971
66116
  this.AutoUpdateEvent(false,'KLineChartContainer::ChangePeriod'); //切换周期先停止更新
65972
66117
  this.ResetScrollBar();
65973
66118
  this.ResetOverlaySymbolStatus();
66119
+ this.ClearIndexRunCount();
65974
66120
  this.ReqeustHistoryMinuteData(); //请求分钟数据
65975
66121
  }
65976
66122
  else if (ChartData.IsTickPeriod(this.Period))
@@ -65978,6 +66124,7 @@ function KLineChartContainer(uielement,OffscreenElement)
65978
66124
  this.CancelAutoUpdate(); //先停止定时器
65979
66125
  this.AutoUpdateEvent(false,'KLineChartContainer::ChangePeriod');
65980
66126
  this.ResetScrollBar();
66127
+ this.ClearIndexRunCount();
65981
66128
  this.RequestTickData(); //请求分笔数据
65982
66129
  }
65983
66130
  }
@@ -67278,6 +67425,7 @@ function KLineChartContainer(uielement,OffscreenElement)
67278
67425
  this.ClearKLineCaluate();
67279
67426
  this.HideTooltip();
67280
67427
  this.ResetScrollBar();
67428
+ this.ClearIndexRunCount();
67281
67429
 
67282
67430
  this.Symbol=symbol;
67283
67431
  if (!symbol)
@@ -72375,6 +72523,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
72375
72523
  this.ClearIndexPaint(); //清空指标
72376
72524
  this.ResetOverlaySymbolStatus();
72377
72525
  this.ReloadChartDrawPicture();
72526
+ this.ClearIndexRunCount();
72378
72527
 
72379
72528
  if (option)
72380
72529
  {
@@ -73763,7 +73912,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73763
73912
  }
73764
73913
  }
73765
73914
 
73766
- this.BindIndexData=function(windowIndex,hisData)
73915
+ this.BindIndexData=function(windowIndex, hisData, option)
73767
73916
  {
73768
73917
  if (!this.WindowIndex[windowIndex]) return;
73769
73918
 
@@ -74208,7 +74357,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
74208
74357
  }
74209
74358
 
74210
74359
  //计算叠加指标
74211
- this.BindAllOverlayIndexData=function(hisData)
74360
+ this.BindAllOverlayIndexData=function(hisData, option)
74212
74361
  {
74213
74362
  if (!this.Frame || !this.Frame.SubFrame) return;
74214
74363
 
@@ -74219,13 +74368,13 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
74219
74368
  for(var j in item.OverlayIndex)
74220
74369
  {
74221
74370
  var overlayItem=item.OverlayIndex[j];
74222
- this.BindOverlayIndexData(overlayItem,i,hisData)
74371
+ this.BindOverlayIndexData(overlayItem,i,hisData,option)
74223
74372
  }
74224
74373
  }
74225
74374
  }
74226
74375
 
74227
74376
  //叠加指标
74228
- this.BindOverlayIndexData=function(overlayItem, windowIndex, hisData)
74377
+ this.BindOverlayIndexData=function(overlayItem, windowIndex, hisData, option)
74229
74378
  {
74230
74379
  if (!overlayItem.Script) return;
74231
74380
 
@@ -4919,7 +4919,7 @@ var MINUTE_5DAY_DATA={
4919
4919
  ]
4920
4920
  ],
4921
4921
  "date": 20230706,
4922
- "yclose": 7.21
4922
+ "yclose": 7.24
4923
4923
  },
4924
4924
  {
4925
4925
  "minute": [
@@ -7598,7 +7598,7 @@ var MINUTE_5DAY_DATA={
7598
7598
  ]
7599
7599
  ],
7600
7600
  "date": 20230705,
7601
- "yclose": 7.21
7601
+ "yclose": 7.18
7602
7602
  },
7603
7603
  {
7604
7604
  "minute": [
@@ -10277,7 +10277,7 @@ var MINUTE_5DAY_DATA={
10277
10277
  ]
10278
10278
  ],
10279
10279
  "date": 20230704,
10280
- "yclose": 7.21
10280
+ "yclose": 7.20
10281
10281
  },
10282
10282
  {
10283
10283
  "minute": [
@@ -12956,7 +12956,7 @@ var MINUTE_5DAY_DATA={
12956
12956
  ]
12957
12957
  ],
12958
12958
  "date": 20230703,
12959
- "yclose": 7.21
12959
+ "yclose": 7.25
12960
12960
  }
12961
12961
  ],
12962
12962
  "code": 0