hqchart 1.1.12935 → 1.1.12943

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.
@@ -554,7 +554,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
554
554
  }
555
555
 
556
556
  //创建子窗口的指标
557
- let scriptData = new JSIndexScript();
557
+ var scriptData = new JSIndexScript();
558
558
 
559
559
  if (option.ColorIndex) //五彩K线
560
560
  {
@@ -609,6 +609,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
609
609
  }
610
610
  else
611
611
  {
612
+ var scriptData = new JSIndexScript();
612
613
  let indexInfo = scriptData.Get(item.Index);
613
614
  if (!indexInfo) continue;
614
615
  JSIndexScript.ModifyAttribute(indexInfo, item);
@@ -1450,7 +1451,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1450
1451
  if (IFrameSplitOperator.IsNonEmptyArray(option.Windows))
1451
1452
  {
1452
1453
  //创建子窗口的指标
1453
- let scriptData = new JSIndexScript();
1454
+
1454
1455
  for(var i=0;i<option.Windows.length;++i)
1455
1456
  {
1456
1457
  var item=option.Windows[i];
@@ -1468,6 +1469,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1468
1469
  }
1469
1470
  else
1470
1471
  {
1472
+ var scriptData = new JSIndexScript();
1471
1473
  let indexInfo = scriptData.Get(item.Index);
1472
1474
  if (!indexInfo) continue;
1473
1475
 
@@ -8254,6 +8256,45 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8254
8256
  return paint.ClearPoint();
8255
8257
  }
8256
8258
 
8259
+ //删除指定窗口的所有叠加指标
8260
+ this.DeleteWindowsOverlayIndex=function(windowIndex)
8261
+ {
8262
+ if (!IFrameSplitOperator.IsNumber(windowIndex)) return;
8263
+ if (windowIndex<0 || windowIndex>=this.Frame.SubFrame.length) return;
8264
+
8265
+ var subFrame=this.Frame.SubFrame[windowIndex];
8266
+ if (!IFrameSplitOperator.IsNonEmptyArray(subFrame.OverlayIndex)) return;
8267
+
8268
+ var aryIndexID=[];
8269
+ for(var i=0; i<subFrame.OverlayIndex.length; ++i)
8270
+ {
8271
+ var overlayItem=subFrame.OverlayIndex[i];
8272
+ aryIndexID.push(overlayItem.Identify);
8273
+
8274
+ for(var j=0;j<overlayItem.ChartPaint.length;++j) //图形销毁事件
8275
+ {
8276
+ var overlayChart=overlayItem.ChartPaint[j];
8277
+ if (overlayChart && overlayChart.OnDestroy) overlayChart.OnDestroy();
8278
+ }
8279
+
8280
+ overlayItem.ChartPaint=[];
8281
+ }
8282
+
8283
+ subFrame.OverlayIndex=[];
8284
+
8285
+ var titlePaint=this.TitlePaint[windowIndex+1];
8286
+ for(var i=0;i<aryIndexID.length;++i)
8287
+ {
8288
+ var identify=aryIndexID[i];
8289
+
8290
+ if (titlePaint.OverlayIndex.has(identify))
8291
+ titlePaint.OverlayIndex.delete(identify);
8292
+
8293
+ if (titlePaint.OverlayDynamicTitle.has(identify))
8294
+ titlePaint.OverlayDynamicTitle.delete(identify);
8295
+ }
8296
+ }
8297
+
8257
8298
  //删除叠加指标, 没有重绘
8258
8299
  this.DeleteOverlayIndex=function(identify, windowIndex)
8259
8300
  {
@@ -17390,7 +17431,7 @@ function HQTradeFrame()
17390
17431
  if (IFrameSplitOperator.IsNumber(this.OverlayBlankWidth)) overlayItem.Frame.BlankWidth=this.OverlayBlankWidth;
17391
17432
 
17392
17433
  overlayItem.Frame.Draw();
17393
- rightOffset+=overlayItem.RightWidth.Width;
17434
+ if (overlayItem.RightWidth) rightOffset+=overlayItem.RightWidth.Width;
17394
17435
  if (overlayItem.Frame.IsShow) ++index;
17395
17436
  }
17396
17437
  }
@@ -68287,14 +68328,15 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68287
68328
  if (count<=0) return;
68288
68329
  var currentLength=this.Frame.SubFrame.length;
68289
68330
 
68290
- var period=null, right=null;
68331
+ var period=null, right=null, symbol=null;
68332
+ if (option.Symbol) symbol=option.Symbol;
68291
68333
  if (option.KLine)
68292
68334
  {
68293
68335
  if (IFrameSplitOperator.IsNumber(option.KLine.Period) && option.KLine.Period!=this.Period) period=option.KLine.Period; //周期
68294
68336
  if (IFrameSplitOperator.IsNumber(option.KLine.Right) && option.KLine.Right!=this.Right) right=option.KLine.Right; //复权
68295
68337
  }
68296
68338
 
68297
- var bRefreshData= (period!=null || right!=null);
68339
+ var bRefreshData= (period!=null || right!=null || symbol!=null);
68298
68340
 
68299
68341
  //清空所有的指标图型
68300
68342
  for(var i=0;i<currentLength;++i)
@@ -68322,6 +68364,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68322
68364
 
68323
68365
  this.Frame.SubFrame.splice(count,currentLength-count);
68324
68366
  this.WindowIndex.splice(count,currentLength-count);
68367
+ this.TitlePaint.splice(count+1,currentLength-count);
68325
68368
  }
68326
68369
  else
68327
68370
  {
@@ -68338,8 +68381,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68338
68381
  this.TitlePaint[i+1]=titlePaint;
68339
68382
  }
68340
68383
  }
68341
-
68342
- var systemScript = new JSIndexScript();
68384
+
68343
68385
  for(var i=0;i<count;++i)
68344
68386
  {
68345
68387
  var windowIndex=i;
@@ -68349,7 +68391,10 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68349
68391
  var titleIndex=windowIndex+1;
68350
68392
  this.TitlePaint[titleIndex].Data=[];
68351
68393
  this.TitlePaint[titleIndex].Title=null;
68394
+ var frame=this.Frame.SubFrame[i];
68352
68395
 
68396
+ this.DeleteWindowsOverlayIndex(i); //清空叠加指标
68397
+
68353
68398
  if (item.Script) //自定义指标脚本
68354
68399
  {
68355
68400
  this.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item); //脚本执行
@@ -68370,6 +68415,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68370
68415
  }
68371
68416
  else
68372
68417
  {
68418
+ var systemScript = new JSIndexScript();
68373
68419
  var indexInfo = systemScript.Get(indexID);
68374
68420
  if (indexInfo)
68375
68421
  {
@@ -68379,7 +68425,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68379
68425
  }
68380
68426
  }
68381
68427
 
68382
- this.SetSubFrameAttribute(this.Frame.SubFrame[i], item, frameItem);
68428
+ this.SetSubFrameAttribute(frame, item, frameItem);
68383
68429
  }
68384
68430
 
68385
68431
  //最后一个显示X轴坐标
@@ -68390,6 +68436,23 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68390
68436
  else item.XSplitOperator.ShowText=false;
68391
68437
  }
68392
68438
 
68439
+ //叠加指标
68440
+ var aryOverlayIndex=[];
68441
+ if (IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex))
68442
+ {
68443
+ for(var i=0;i<option.OverlayIndex.length;++i)
68444
+ {
68445
+ var item=option.OverlayIndex[i];
68446
+ if (item.Index) item.IndexName=item.Index;
68447
+ if (item.Windows>=0) item.WindowIndex=item.Windows;
68448
+
68449
+ var overlay=this.CreateOverlayWindowsIndex(item);
68450
+ if (!overlay) continue;
68451
+
68452
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
68453
+ }
68454
+ }
68455
+
68393
68456
  if (!bRefreshData)
68394
68457
  {
68395
68458
  var bindData=this.ChartPaint[0].Data;
@@ -68398,6 +68461,12 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68398
68461
  this.BindIndexData(i,bindData);
68399
68462
  }
68400
68463
 
68464
+ for(var i=0;i<aryOverlayIndex.length;++i)
68465
+ {
68466
+ var item=aryOverlayIndex[i];
68467
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
68468
+ }
68469
+
68401
68470
  this.UpdataDataoffset(); //更新数据偏移
68402
68471
  this.Frame.SetSizeChage(true);
68403
68472
  this.ResetFrameXYSplit();
@@ -68406,9 +68475,13 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68406
68475
  }
68407
68476
  else
68408
68477
  {
68409
- this.Frame.SetSizeChage(true);
68410
- if (period!=null) this.ChangePeriod(period, option);
68411
- else if (right!=null) this.ChangeRight(right);
68478
+ if (!symbol) symbol=this.Symbol;
68479
+
68480
+ var optionData={ KLine:{} };
68481
+ if (IFrameSplitOperator.IsNumber(period)) optionData.KLine.Period=period;
68482
+ if (IFrameSplitOperator.IsNumber(right)) optionData.KLine.Right=right;
68483
+
68484
+ this.ChangeSymbol(symbol, optionData);
68412
68485
  }
68413
68486
  }
68414
68487
 
@@ -68853,11 +68926,11 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68853
68926
 
68854
68927
  if (option)
68855
68928
  {
68856
- if (option.Windows && Array.isArray(option.Windows) && option.Windows.length>0)
68929
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Windows))
68857
68930
  {
68858
68931
  var windows=option.Windows;
68859
- var systemScript = new JSIndexScript();
68860
- for(var i in windows)
68932
+
68933
+ for(var i=0; i<windows.length; ++i)
68861
68934
  {
68862
68935
  if (i>=this.WindowIndex.length) break; //暂时不支持 动态增加/减少
68863
68936
  var item=windows[i];
@@ -68875,11 +68948,11 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68875
68948
  else
68876
68949
  {
68877
68950
  var indexID=item.Index;
68951
+ var systemScript = new JSIndexScript();
68878
68952
  var indexInfo = systemScript.Get(indexID);
68879
68953
  if (indexInfo)
68880
68954
  {
68881
- var args=indexInfo.Args;
68882
- if (item.Args) indexInfo.Args=item.Args;
68955
+ JSIndexScript.ModifyAttribute(indexInfo,item);
68883
68956
  indexInfo.ID=indexID;
68884
68957
  this.WindowIndex[i]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo); //脚本执行
68885
68958
  }
@@ -73628,25 +73701,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73628
73701
  if (windowIndex<2) windowIndex=2;
73629
73702
  if (windowIndex>=this.Frame.SubFrame.length) windowIndex=2;
73630
73703
 
73631
- let indexData =
73632
- {
73633
- Name:indexInfo.Name, Script:indexInfo.Script, Args: indexInfo.Args, ID:indexName ,
73634
- //扩展属性 可以是空
73635
- KLineType:indexInfo.KLineType, YSpecificMaxMin:indexInfo.YSpecificMaxMin, YSplitScale:indexInfo.YSplitScale,
73636
- FloatPrecision:indexInfo.FloatPrecision, Condition:indexInfo.Condition,StringFormat:indexInfo.StringFormat,
73637
- OutName:indexInfo.OutName
73638
- };
73704
+ JSIndexScript.ModifyAttribute(indexInfo, option)
73639
73705
 
73640
- if (option)
73641
- {
73642
- if (option.FloatPrecision>=0) indexData.FloatPrecision=option.FloatPrecision;
73643
- if (option.StringFormat>0) indexData.StringFormat=option.StringFormat;
73644
- if (option.Args) indexData.Args=option.Args;
73645
- if (IFrameSplitOperator.IsNumber(option.YSplitType)) indexData.YSplitType=option.YSplitType;
73646
- if (option.Lock) indexData.Lock=option.Lock;
73647
- }
73648
-
73649
- return this.ChangeScriptIndex(windowIndex, indexData,option);
73706
+ return this.ChangeScriptIndex(windowIndex, indexInfo, option);
73650
73707
  }
73651
73708
 
73652
73709
  //设置指标窗口个数
@@ -73760,6 +73817,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73760
73817
 
73761
73818
  this.Frame.SubFrame.splice(count,currentLength-count);
73762
73819
  this.WindowIndex.splice(count,currentLength-count);
73820
+ this.TitlePaint.splice(count+1,currentLength-count);
73763
73821
  }
73764
73822
  else
73765
73823
  {
@@ -73777,8 +73835,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73777
73835
  }
73778
73836
  }
73779
73837
 
73780
- var systemScript = new JSIndexScript();
73781
-
73782
73838
  for(var i=0;i<count;++i)
73783
73839
  {
73784
73840
  var windowIndex=i;
@@ -73812,22 +73868,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73812
73868
  }
73813
73869
  else
73814
73870
  {
73871
+ var systemScript = new JSIndexScript();
73815
73872
  var indexInfo = systemScript.Get(indexID);
73816
73873
  if (indexInfo)
73817
73874
  {
73818
- var args=indexInfo.Args;
73819
- if (item.Args) args=item.Args;
73820
- let indexData =
73821
- {
73822
- Name:indexInfo.Name, Script:indexInfo.Script, Args: args, ID:indexID ,
73823
- //扩展属性 可以是空
73824
- KLineType:indexInfo.KLineType, YSpecificMaxMin:indexInfo.YSpecificMaxMin, YSplitScale:indexInfo.YSplitScale,
73825
- FloatPrecision:indexInfo.FloatPrecision, Condition:indexInfo.Condition,
73826
- OutName:indexInfo.OutName
73827
- };
73828
- if (item.TitleFont) indexData.TitleFont=item.TitleFont;
73829
-
73830
- this.WindowIndex[windowIndex]=new ScriptIndex(indexData.Name,indexData.Script,indexData.Args,indexData); //脚本执行
73875
+ JSIndexScript.ModifyAttribute(indexInfo,item);
73876
+ this.WindowIndex[windowIndex]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo); //脚本执行
73831
73877
  }
73832
73878
  }
73833
73879
  }
@@ -73836,6 +73882,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73836
73882
  this.SetSubFrameAttribute(this.Frame.SubFrame[windowIndex], item, frameItem);
73837
73883
  }
73838
73884
 
73885
+ //清空叠加指标
73886
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
73887
+ {
73888
+ this.DeleteWindowsOverlayIndex(i);
73889
+ }
73890
+
73839
73891
  //最后一个显示X轴坐标
73840
73892
  for(var i=0;i<this.Frame.SubFrame.length;++i)
73841
73893
  {
@@ -73844,6 +73896,23 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73844
73896
  else item.XSplitOperator.ShowText=false;
73845
73897
  }
73846
73898
 
73899
+ //叠加指标
73900
+ var aryOverlayIndex=[];
73901
+ if (IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex))
73902
+ {
73903
+ for(var i=0;i<option.OverlayIndex.length;++i)
73904
+ {
73905
+ var item=option.OverlayIndex[i];
73906
+ if (item.Index) item.IndexName=item.Index;
73907
+ if (item.Windows>=0) item.WindowIndex=item.Windows;
73908
+
73909
+ var overlay=this.CreateOverlayWindowsIndex(item);
73910
+ if (!overlay) continue;
73911
+
73912
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
73913
+ }
73914
+ }
73915
+
73847
73916
  if (!bRefreshData)
73848
73917
  {
73849
73918
  var bindData=this.SourceData;
@@ -73851,6 +73920,13 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
73851
73920
  {
73852
73921
  this.BindIndexData(i,bindData); //执行脚本
73853
73922
  }
73923
+
73924
+ for(var i=0;i<aryOverlayIndex.length;++i)
73925
+ {
73926
+ var item=aryOverlayIndex[i];
73927
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
73928
+ }
73929
+
73854
73930
  this.UpdataDataoffset(); //更新数据偏移
73855
73931
  this.Frame.SetSizeChage(true);
73856
73932
  if (this.UpdateXShowText) this.UpdateXShowText();
@@ -74025,7 +74101,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
74025
74101
 
74026
74102
  if (IFrameSplitOperator.IsNonEmptyArray(option.Windows)) //切换指标
74027
74103
  {
74028
- var systemScript = new JSIndexScript();
74104
+
74029
74105
  for(var i=0; i<option.Windows.length; ++i)
74030
74106
  {
74031
74107
  var index=2+i;
@@ -74045,12 +74121,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
74045
74121
  }
74046
74122
  else
74047
74123
  {
74124
+ var systemScript = new JSIndexScript();
74048
74125
  var indexID=item.Index;
74049
74126
  var indexInfo = systemScript.Get(indexID);
74050
74127
  if (indexInfo)
74051
74128
  {
74052
- var args=indexInfo.Args;
74053
- if (item.Args) indexInfo.Args=item.Args;
74129
+ JSIndexScript.ModifyAttribute(indexInfo,item);
74054
74130
  indexInfo.ID=indexID;
74055
74131
  this.WindowIndex[index]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo); //脚本执行
74056
74132
  }