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.
@@ -9105,6 +9105,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9105
9105
  {
9106
9106
  this.ChartCorssCursor.LastPoint=this.LastPoint;
9107
9107
  this.ChartCorssCursor.CursorIndex=this.CursorIndex;
9108
+ if (this.EnableNewIndex)
9109
+ {
9110
+ this.ChartCorssCursor.CorssCursorIndex=this.CorssCursorIndex;
9111
+ this.ChartCorssCursor.EnableNewIndex=this.EnableNewIndex;
9112
+ }
9108
9113
 
9109
9114
  var bRestoreCanvas=false;
9110
9115
  if (this.CorssCursorCanvas) //独立的十字光标层
@@ -9467,6 +9472,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9467
9472
  {
9468
9473
  this.ChartCorssCursor.LastPoint=this.LastPoint;
9469
9474
  this.ChartCorssCursor.CursorIndex=this.CursorIndex;
9475
+ if (this.EnableNewIndex)
9476
+ {
9477
+ this.ChartCorssCursor.CorssCursorIndex=this.CorssCursorIndex;
9478
+ this.ChartCorssCursor.EnableNewIndex=this.EnableNewIndex;
9479
+ }
9470
9480
 
9471
9481
  var bRestoreCanvas=false;
9472
9482
  if (this.CorssCursorCanvas) //独立的十字光标层
@@ -12518,6 +12528,30 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12518
12528
 
12519
12529
  return aryData;
12520
12530
  }
12531
+
12532
+ //重置指标计数器
12533
+ this.ClearIndexRunCount=function()
12534
+ {
12535
+ //主图指标
12536
+ for(var i=0;i<this.WindowIndex.length;++i)
12537
+ {
12538
+ var item=this.WindowIndex[i];
12539
+ if (!item) continue;
12540
+
12541
+ item.RunCount=0;
12542
+ }
12543
+
12544
+ //叠加指标
12545
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
12546
+ {
12547
+ var item=this.Frame.SubFrame[i];
12548
+ for(var j=0; j<item.OverlayIndex.length; ++j)
12549
+ {
12550
+ var overlayItem=item.OverlayIndex[j];
12551
+ if (overlayItem.Script) overlayItem.Script.RunCount=0;
12552
+ }
12553
+ }
12554
+ }
12521
12555
  }
12522
12556
 
12523
12557
  function GetDevicePixelRatio()
@@ -49107,6 +49141,9 @@ function ChartCorssCursor()
49107
49141
  this.IsFixXLastTime=false; //是否修正X轴,超出当前时间的,X轴调整到当前最后的时间.
49108
49142
  this.IsDrawXRangeBG=false; //是否绘制十字光标背景
49109
49143
 
49144
+ this.EnableNewIndex=false; //分时图是否使用最新的索引结构 (由外部chart容器传入)
49145
+ this.CorssCursorIndex; //分时图新版本的索引结构 (由外部chart容器传入)
49146
+
49110
49147
  this.PointX;
49111
49148
  this.PointY;
49112
49149
 
@@ -49164,20 +49201,34 @@ function ChartCorssCursor()
49164
49201
 
49165
49202
  this.GetMinuteCloseYPoint=function(index)
49166
49203
  {
49167
- if (!IFrameSplitOperator.IsNumber(index)) return null;
49168
- index=parseInt(index);
49169
- if (!this.StringFormatX.Data) return null;
49170
- var data = this.StringFormatX.Data;
49171
- if (!data.Data || data.Data.length <= 0) return null;
49172
- var dataIndex = data.DataOffset + index;
49173
- if (dataIndex >= data.Data.length) dataIndex = data.Data.length - 1;
49174
- if (dataIndex < 0) return null;
49204
+ if (this.EnableNewIndex && this.CorssCursorIndex)
49205
+ {
49206
+ if (!this.StringFormatX || !this.StringFormatX.GetMinuteCloseYPoint) return null;
49207
+
49208
+ var closeData=this.StringFormatX.GetMinuteCloseYPoint(this.CorssCursorIndex);
49209
+ if (!closeData) return null;
49210
+
49211
+ this.Close=closeData.Price;
49212
+ return closeData.Y;
49213
+ }
49214
+ else
49215
+ {
49175
49216
 
49176
- var close = data.Data[dataIndex];
49177
- if (!IFrameSplitOperator.IsNumber(index)) return null;
49178
- this.Close=close;
49179
- var yPoint = this.Frame.GetYFromData(this.Close);
49180
- return yPoint;
49217
+ if (!IFrameSplitOperator.IsNumber(index)) return null;
49218
+ index=parseInt(index);
49219
+ if (!this.StringFormatX.Data) return null;
49220
+ var data = this.StringFormatX.Data;
49221
+ if (!data.Data || data.Data.length <= 0) return null;
49222
+ var dataIndex = data.DataOffset + index;
49223
+ if (dataIndex >= data.Data.length) dataIndex = data.Data.length - 1;
49224
+ if (dataIndex < 0) return null;
49225
+
49226
+ var close = data.Data[dataIndex];
49227
+ if (!IFrameSplitOperator.IsNumber(index)) return null;
49228
+ this.Close=close;
49229
+ var yPoint = this.Frame.GetYFromData(this.Close);
49230
+ return yPoint;
49231
+ }
49181
49232
  }
49182
49233
 
49183
49234
  this.GetDateTimeRange=function(index, option)
@@ -50844,6 +50895,7 @@ function HQMinuteTimeStringFormat()
50844
50895
  this.newMethod();
50845
50896
  delete this.newMethod;
50846
50897
 
50898
+ this.ClassName="HQMinuteTimeStringFormat";
50847
50899
  this.Frame;
50848
50900
  this.Symbol;
50849
50901
  this.Point;
@@ -50975,6 +51027,88 @@ function HQMinuteTimeStringFormat()
50975
51027
 
50976
51028
  return true;
50977
51029
  }
51030
+
51031
+ this.GetMinuteCloseYPoint=function(cursorIndexData)
51032
+ {
51033
+ var type=cursorIndexData.Type;
51034
+ if (type==1 || type==2 || type==3) //单日 1=主图 2=盘前 3=盘后
51035
+ {
51036
+ if (type==1)
51037
+ {
51038
+ if (!this.Data || this.Data.Data.length <= 0) return null;
51039
+ var index=cursorIndexData.DataIndex;
51040
+ if (index<0 || index>=this.Data.Data.length) index=this.Data.Data.length-1;
51041
+
51042
+ var close = this.Data.Data[index];
51043
+ var yPoint = this.Frame.GetYFromData(close);
51044
+ return { Price:close, Y:yPoint };
51045
+ }
51046
+ else if (type==2)
51047
+ {
51048
+ if (!this.BeforeOpenData || !this.BeforeOpenData.Data) return false;
51049
+ if (cursorIndexData.DataIndex<0 || cursorIndexData.DataIndex>=this.BeforeOpenData.Data.length) return null;
51050
+ var item=this.BeforeOpenData.Data[cursorIndexData.DataIndex];
51051
+
51052
+ var close=item.Price;
51053
+ var yPoint = this.Frame.GetYFromData(close);
51054
+ return { Price:close, Y:yPoint };
51055
+ }
51056
+ else if (type==3)
51057
+ {
51058
+ if (!this.AfterCloseData || !this.AfterCloseData.Data) return false;
51059
+ if (cursorIndexData.DataIndex<0 || cursorIndexData.DataIndex>=this.AfterCloseData.Data.length) return null;
51060
+ var item=this.AfterCloseData.Data[cursorIndexData.DataIndex];
51061
+
51062
+ var close=item.Price;
51063
+ var yPoint = this.Frame.GetYFromData(close);
51064
+ return { Price:close, Y:yPoint };
51065
+ }
51066
+ }
51067
+ else if (type==10 || type==20 || type==30) //多日 10=主图 20=盘前 30=盘后
51068
+ {
51069
+ if (type==10)
51070
+ {
51071
+ if (!this.Data || this.Data.Data.length <= 0) return null;
51072
+ var index=this.Frame.MinuteCount*cursorIndexData.DayIndex+cursorIndexData.DataIndex;
51073
+ if (index<0 || index>=this.Data.Data.length) index=this.Data.Data.length-1;
51074
+
51075
+ var close = this.Data.Data[index];
51076
+ var yPoint = this.Frame.GetYFromData(close);
51077
+ return { Price:close, Y:yPoint };
51078
+ }
51079
+ else if (type==20)
51080
+ {
51081
+ var multiDayBeforeOpenData=this.GetMultiDayBeforeOpenData();
51082
+ if (!multiDayBeforeOpenData) return null;
51083
+ if (cursorIndexData.DayIndex<0 || cursorIndexData.DayIndex>=multiDayBeforeOpenData.length) return null;
51084
+
51085
+ var dayItem=multiDayBeforeOpenData[cursorIndexData.DayIndex];
51086
+ if (cursorIndexData.DataIndex<0 || cursorIndexData.DataIndex>=dayItem.Data.length) return null;
51087
+ var item=dayItem.Data[cursorIndexData.DataIndex];
51088
+
51089
+ var close=item.Price;
51090
+ var yPoint = this.Frame.GetYFromData(close);
51091
+ return { Price:close, Y:yPoint };
51092
+ }
51093
+ else if (type==30)
51094
+ {
51095
+ var multiDayAfterCloseData=this.GetMultiDayAfterCloseData();
51096
+ if (!multiDayAfterCloseData) return null;
51097
+ if (cursorIndexData.DayIndex<0 || cursorIndexData.DayIndex>=multiDayAfterCloseData.length) return null;
51098
+
51099
+ var dayItem=multiDayAfterCloseData[cursorIndexData.DayIndex];
51100
+ if (cursorIndexData.DataIndex<0 || cursorIndexData.DataIndex>=dayItem.Data.length) return null;
51101
+ var item=dayItem.Data[cursorIndexData.DataIndex];
51102
+
51103
+ var close=item.Price;
51104
+ var yPoint = this.Frame.GetYFromData(close);
51105
+ return { Price:close, Y:yPoint };
51106
+ }
51107
+ }
51108
+
51109
+
51110
+ return null;
51111
+ }
50978
51112
  }
50979
51113
 
50980
51114
 
@@ -68385,22 +68519,27 @@ function KLineChartContainer(uielement,OffscreenElement)
68385
68519
  {
68386
68520
  if (!this.WindowIndex[windowIndex]) return;
68387
68521
 
68388
- if (typeof(this.WindowIndex[windowIndex].RequestData)=="function") //数据需要另外下载的.
68522
+ var item=this.WindowIndex[windowIndex];
68523
+ if (typeof(item.RequestData)=="function") //数据需要另外下载的.
68389
68524
  {
68390
- this.WindowIndex[windowIndex].RequestData(this,windowIndex,hisData, option);
68525
+ item.RequestData(this,windowIndex,hisData, option);
68391
68526
  return;
68392
68527
  }
68393
- if (typeof(this.WindowIndex[windowIndex].ExecuteScript)=='function')
68528
+
68529
+ if (typeof(item.ExecuteScript)=='function')
68394
68530
  {
68395
- this.WindowIndex[windowIndex].ExecuteScript(this,windowIndex,hisData);
68531
+ if (option && option.CheckRunCount)
68532
+ if (item.IsExcessRunCount()) return;
68533
+
68534
+ item.ExecuteScript(this,windowIndex,hisData);
68396
68535
  return;
68397
68536
  }
68398
68537
 
68399
- this.WindowIndex[windowIndex].BindData(this,windowIndex,hisData);
68538
+ item.BindData(this,windowIndex,hisData);
68400
68539
  }
68401
68540
 
68402
68541
  //叠加指标
68403
- this.BindOverlayIndexData=function(overlayItem, windowIndex, hisData)
68542
+ this.BindOverlayIndexData=function(overlayItem, windowIndex, hisData, option)
68404
68543
  {
68405
68544
  if (!overlayItem.Script) return;
68406
68545
 
@@ -68412,6 +68551,9 @@ function KLineChartContainer(uielement,OffscreenElement)
68412
68551
 
68413
68552
  if (typeof(overlayItem.Script.ExecuteScript)=='function')
68414
68553
  {
68554
+ if (option && option.CheckRunCount)
68555
+ if (overlayItem.Script.IsExcessRunCount()) return;
68556
+
68415
68557
  overlayItem.Script.ExecuteScript(this,windowIndex,hisData);
68416
68558
  return;
68417
68559
  }
@@ -68577,7 +68719,7 @@ function KLineChartContainer(uielement,OffscreenElement)
68577
68719
  });
68578
68720
  }
68579
68721
 
68580
- this.BindAllOverlayIndexData=function(hisData)
68722
+ this.BindAllOverlayIndexData=function(hisData, option)
68581
68723
  {
68582
68724
  if (!this.Frame || !this.Frame.SubFrame) return;
68583
68725
 
@@ -68588,7 +68730,7 @@ function KLineChartContainer(uielement,OffscreenElement)
68588
68730
  for(var j in item.OverlayIndex)
68589
68731
  {
68590
68732
  var overlayItem=item.OverlayIndex[j];
68591
- this.BindOverlayIndexData(overlayItem,i,hisData)
68733
+ this.BindOverlayIndexData(overlayItem,i,hisData,option)
68592
68734
  }
68593
68735
  }
68594
68736
  }
@@ -69271,7 +69413,7 @@ function KLineChartContainer(uielement,OffscreenElement)
69271
69413
 
69272
69414
  for(var i=0; i<this.Frame.SubFrame.length; ++i)
69273
69415
  {
69274
- this.BindIndexData(i,bindData);
69416
+ this.BindIndexData(i,bindData, { CheckRunCount:true });
69275
69417
  }
69276
69418
 
69277
69419
  //刷新画图
@@ -69284,7 +69426,7 @@ function KLineChartContainer(uielement,OffscreenElement)
69284
69426
  this.SendKLineUpdateEvent(bindData);
69285
69427
 
69286
69428
  //叠加指标计算
69287
- this.BindAllOverlayIndexData(bindData);
69429
+ this.BindAllOverlayIndexData(bindData,{ CheckRunCount:true });
69288
69430
 
69289
69431
  if (this.mapEvent.has(JSCHART_EVENT_ID.ON_RECV_REALTIME_DATA))
69290
69432
  {
@@ -70009,6 +70151,7 @@ function KLineChartContainer(uielement,OffscreenElement)
70009
70151
  this.ClearRectSelect(true);
70010
70152
  this.Frame.ClearUpDonwFrameYData();
70011
70153
  this.ClearCustomKLine();
70154
+
70012
70155
 
70013
70156
  var kLineDrawType=this.GetKLineDrawType();
70014
70157
  if (kLineDrawType==10 || kLineDrawType==11 || kLineDrawType==12 || kLineDrawType==16) isDataTypeChange=true;
@@ -70030,6 +70173,7 @@ function KLineChartContainer(uielement,OffscreenElement)
70030
70173
 
70031
70174
  if (isDataTypeChange==false && !this.IsApiPeriod)
70032
70175
  {
70176
+ this.ClearIndexRunCount();
70033
70177
  this.Update( {UpdateCursorIndexType:2} ); //更新的时候 取消显示十字光标
70034
70178
  return;
70035
70179
  }
@@ -70042,6 +70186,7 @@ function KLineChartContainer(uielement,OffscreenElement)
70042
70186
  this.AutoUpdateEvent(false,'KLineChartContainer::ChangePeriod'); //切换周期先停止更新
70043
70187
  this.ResetScrollBar();
70044
70188
  this.ResetOverlaySymbolStatus();
70189
+ this.ClearIndexRunCount();
70045
70190
  this.RequestHistoryData(); //请求日线数据
70046
70191
  //this.ReqeustKLineInfoData();
70047
70192
  }
@@ -70051,6 +70196,7 @@ function KLineChartContainer(uielement,OffscreenElement)
70051
70196
  this.AutoUpdateEvent(false,'KLineChartContainer::ChangePeriod'); //切换周期先停止更新
70052
70197
  this.ResetScrollBar();
70053
70198
  this.ResetOverlaySymbolStatus();
70199
+ this.ClearIndexRunCount();
70054
70200
  this.ReqeustHistoryMinuteData(); //请求分钟数据
70055
70201
  }
70056
70202
  else if (ChartData.IsTickPeriod(this.Period))
@@ -70058,6 +70204,7 @@ function KLineChartContainer(uielement,OffscreenElement)
70058
70204
  this.CancelAutoUpdate(); //先停止定时器
70059
70205
  this.AutoUpdateEvent(false,'KLineChartContainer::ChangePeriod');
70060
70206
  this.ResetScrollBar();
70207
+ this.ClearIndexRunCount();
70061
70208
  this.RequestTickData(); //请求分笔数据
70062
70209
  }
70063
70210
  }
@@ -71358,6 +71505,7 @@ function KLineChartContainer(uielement,OffscreenElement)
71358
71505
  this.ClearKLineCaluate();
71359
71506
  this.HideTooltip();
71360
71507
  this.ResetScrollBar();
71508
+ this.ClearIndexRunCount();
71361
71509
 
71362
71510
  this.Symbol=symbol;
71363
71511
  if (!symbol)
@@ -76455,6 +76603,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
76455
76603
  this.ClearIndexPaint(); //清空指标
76456
76604
  this.ResetOverlaySymbolStatus();
76457
76605
  this.ReloadChartDrawPicture();
76606
+ this.ClearIndexRunCount();
76458
76607
 
76459
76608
  if (option)
76460
76609
  {
@@ -77843,7 +77992,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77843
77992
  }
77844
77993
  }
77845
77994
 
77846
- this.BindIndexData=function(windowIndex,hisData)
77995
+ this.BindIndexData=function(windowIndex, hisData, option)
77847
77996
  {
77848
77997
  if (!this.WindowIndex[windowIndex]) return;
77849
77998
 
@@ -78288,7 +78437,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78288
78437
  }
78289
78438
 
78290
78439
  //计算叠加指标
78291
- this.BindAllOverlayIndexData=function(hisData)
78440
+ this.BindAllOverlayIndexData=function(hisData, option)
78292
78441
  {
78293
78442
  if (!this.Frame || !this.Frame.SubFrame) return;
78294
78443
 
@@ -78299,13 +78448,13 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78299
78448
  for(var j in item.OverlayIndex)
78300
78449
  {
78301
78450
  var overlayItem=item.OverlayIndex[j];
78302
- this.BindOverlayIndexData(overlayItem,i,hisData)
78451
+ this.BindOverlayIndexData(overlayItem,i,hisData,option)
78303
78452
  }
78304
78453
  }
78305
78454
  }
78306
78455
 
78307
78456
  //叠加指标
78308
- this.BindOverlayIndexData=function(overlayItem, windowIndex, hisData)
78457
+ this.BindOverlayIndexData=function(overlayItem, windowIndex, hisData, option)
78309
78458
  {
78310
78459
  if (!overlayItem.Script) return;
78311
78460
 
@@ -111223,6 +111372,9 @@ function ScriptIndex(name,script,args,option)
111223
111372
  this.IsSync=false; //是否是同步计算 (无数据请求)
111224
111373
  this.IsShow=true; //是否显示图形
111225
111374
 
111375
+ this.RunCount=0; //已执行次数
111376
+ this.MaxRunCount=-1; //最大执行次数 -1=无限
111377
+
111226
111378
  if (option)
111227
111379
  {
111228
111380
  if (option.FloatPrecision>=0) this.FloatPrecision=option.FloatPrecision;
@@ -111238,6 +111390,7 @@ function ScriptIndex(name,script,args,option)
111238
111390
  if (option.OutName) this.OutName=option.OutName;
111239
111391
  if (IFrameSplitOperator.IsNumber(option.YSplitType)) this.YSplitType=option.YSplitType;
111240
111392
  if (IFrameSplitOperator.IsBool(option.IsSync)) this.IsSync=option.IsSync;
111393
+ if (IFrameSplitOperator.IsNumber(option.MaxRunCount)) this.MaxRunCount=option.MaxRunCount;
111241
111394
 
111242
111395
  if (option.Debug)
111243
111396
  {
@@ -111307,6 +111460,14 @@ function ScriptIndex(name,script,args,option)
111307
111460
  }
111308
111461
  }
111309
111462
 
111463
+ //是否超出执行的最大次数
111464
+ this.IsExcessRunCount=function()
111465
+ {
111466
+ if (this.MaxRunCount<=0) return false; //没有限制
111467
+
111468
+ return this.RunCount>=this.MaxRunCount;
111469
+ }
111470
+
111310
111471
  this.ExecuteScript=function(hqChart,windowIndex,hisData)
111311
111472
  {
111312
111473
  this.OutVar=[];
@@ -111376,6 +111537,7 @@ function ScriptIndex(name,script,args,option)
111376
111537
  return;
111377
111538
  }
111378
111539
 
111540
+ ++this.RunCount;
111379
111541
  let code=this.Script;
111380
111542
  let run=JSComplier.Execute(code,option,hqChart.ScriptErrorCallback);
111381
111543
  }
@@ -114419,6 +114581,8 @@ function APIScriptIndex(name,script,args,option, isOverlay)
114419
114581
  if (hqDataType==HQ_DATA_TYPE.MULTIDAY_MINUTE_ID || hqDataType==HQ_DATA_TYPE.MINUTE_ID) postData.daycount=hqChart.DayCount;
114420
114582
  this.HQDataType=hqDataType;
114421
114583
 
114584
+ ++this.RunCount;
114585
+
114422
114586
  if (hqChart.NetworkFilter)
114423
114587
  {
114424
114588
  var obj=
@@ -127802,7 +127966,7 @@ function ScrollBarBGChart()
127802
127966
 
127803
127967
 
127804
127968
 
127805
- var HQCHART_VERSION="1.1.12464";
127969
+ var HQCHART_VERSION="1.1.12469";
127806
127970
 
127807
127971
  function PrintHQChartVersion()
127808
127972
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12464";
8
+ var HQCHART_VERSION="1.1.12471";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -4971,7 +4971,7 @@ var MINUTE_5DAY_DATA={
4971
4971
  ]
4972
4972
  ],
4973
4973
  "date": 20230706,
4974
- "yclose": 7.21
4974
+ "yclose": 7.24
4975
4975
  },
4976
4976
  {
4977
4977
  "minute": [
@@ -7650,7 +7650,7 @@ var MINUTE_5DAY_DATA={
7650
7650
  ]
7651
7651
  ],
7652
7652
  "date": 20230705,
7653
- "yclose": 7.21
7653
+ "yclose": 7.18
7654
7654
  },
7655
7655
  {
7656
7656
  "minute": [
@@ -10329,7 +10329,7 @@ var MINUTE_5DAY_DATA={
10329
10329
  ]
10330
10330
  ],
10331
10331
  "date": 20230704,
10332
- "yclose": 7.21
10332
+ "yclose": 7.20
10333
10333
  },
10334
10334
  {
10335
10335
  "minute": [
@@ -13008,7 +13008,7 @@ var MINUTE_5DAY_DATA={
13008
13008
  ]
13009
13009
  ],
13010
13010
  "date": 20230703,
13011
- "yclose": 7.21
13011
+ "yclose": 7.25
13012
13012
  }
13013
13013
  ],
13014
13014
  "code": 0