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.
@@ -236,6 +236,7 @@ JSIndexScript.ModifyAttribute=function(indexInfo, attribute)
236
236
  if (IFrameSplitOperator.IsBool(attribute.IsShortTitle)) indexInfo.IsShortTitle=attribute.IsShortTitle;
237
237
  if (attribute.TitleFont) indexInfo.TitleFont=attribute.TitleFont;
238
238
  if (attribute.Lock) indexInfo.Lock=attribute.Lock;
239
+ if (IFrameSplitOperator.IsNumber(attribute.YSplitType)) indexInfo.YSplitType=attribute.YSplitType;
239
240
 
240
241
  if (attribute.YAxis)
241
242
  {
@@ -4789,7 +4790,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4789
4790
  }
4790
4791
 
4791
4792
  //创建子窗口的指标
4792
- let scriptData = new JSIndexScript();
4793
+ var scriptData = new JSIndexScript();
4793
4794
 
4794
4795
  if (option.ColorIndex) //五彩K线
4795
4796
  {
@@ -4844,6 +4845,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4844
4845
  }
4845
4846
  else
4846
4847
  {
4848
+ var scriptData = new JSIndexScript();
4847
4849
  let indexInfo = scriptData.Get(item.Index);
4848
4850
  if (!indexInfo) continue;
4849
4851
  JSIndexScript.ModifyAttribute(indexInfo, item);
@@ -5685,7 +5687,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5685
5687
  if (IFrameSplitOperator.IsNonEmptyArray(option.Windows))
5686
5688
  {
5687
5689
  //创建子窗口的指标
5688
- let scriptData = new JSIndexScript();
5690
+
5689
5691
  for(var i=0;i<option.Windows.length;++i)
5690
5692
  {
5691
5693
  var item=option.Windows[i];
@@ -5703,6 +5705,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5703
5705
  }
5704
5706
  else
5705
5707
  {
5708
+ var scriptData = new JSIndexScript();
5706
5709
  let indexInfo = scriptData.Get(item.Index);
5707
5710
  if (!indexInfo) continue;
5708
5711
 
@@ -12489,6 +12492,45 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12489
12492
  return paint.ClearPoint();
12490
12493
  }
12491
12494
 
12495
+ //删除指定窗口的所有叠加指标
12496
+ this.DeleteWindowsOverlayIndex=function(windowIndex)
12497
+ {
12498
+ if (!IFrameSplitOperator.IsNumber(windowIndex)) return;
12499
+ if (windowIndex<0 || windowIndex>=this.Frame.SubFrame.length) return;
12500
+
12501
+ var subFrame=this.Frame.SubFrame[windowIndex];
12502
+ if (!IFrameSplitOperator.IsNonEmptyArray(subFrame.OverlayIndex)) return;
12503
+
12504
+ var aryIndexID=[];
12505
+ for(var i=0; i<subFrame.OverlayIndex.length; ++i)
12506
+ {
12507
+ var overlayItem=subFrame.OverlayIndex[i];
12508
+ aryIndexID.push(overlayItem.Identify);
12509
+
12510
+ for(var j=0;j<overlayItem.ChartPaint.length;++j) //图形销毁事件
12511
+ {
12512
+ var overlayChart=overlayItem.ChartPaint[j];
12513
+ if (overlayChart && overlayChart.OnDestroy) overlayChart.OnDestroy();
12514
+ }
12515
+
12516
+ overlayItem.ChartPaint=[];
12517
+ }
12518
+
12519
+ subFrame.OverlayIndex=[];
12520
+
12521
+ var titlePaint=this.TitlePaint[windowIndex+1];
12522
+ for(var i=0;i<aryIndexID.length;++i)
12523
+ {
12524
+ var identify=aryIndexID[i];
12525
+
12526
+ if (titlePaint.OverlayIndex.has(identify))
12527
+ titlePaint.OverlayIndex.delete(identify);
12528
+
12529
+ if (titlePaint.OverlayDynamicTitle.has(identify))
12530
+ titlePaint.OverlayDynamicTitle.delete(identify);
12531
+ }
12532
+ }
12533
+
12492
12534
  //删除叠加指标, 没有重绘
12493
12535
  this.DeleteOverlayIndex=function(identify, windowIndex)
12494
12536
  {
@@ -21625,7 +21667,7 @@ function HQTradeFrame()
21625
21667
  if (IFrameSplitOperator.IsNumber(this.OverlayBlankWidth)) overlayItem.Frame.BlankWidth=this.OverlayBlankWidth;
21626
21668
 
21627
21669
  overlayItem.Frame.Draw();
21628
- rightOffset+=overlayItem.RightWidth.Width;
21670
+ if (overlayItem.RightWidth) rightOffset+=overlayItem.RightWidth.Width;
21629
21671
  if (overlayItem.Frame.IsShow) ++index;
21630
21672
  }
21631
21673
  }
@@ -72522,14 +72564,15 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72522
72564
  if (count<=0) return;
72523
72565
  var currentLength=this.Frame.SubFrame.length;
72524
72566
 
72525
- var period=null, right=null;
72567
+ var period=null, right=null, symbol=null;
72568
+ if (option.Symbol) symbol=option.Symbol;
72526
72569
  if (option.KLine)
72527
72570
  {
72528
72571
  if (IFrameSplitOperator.IsNumber(option.KLine.Period) && option.KLine.Period!=this.Period) period=option.KLine.Period; //周期
72529
72572
  if (IFrameSplitOperator.IsNumber(option.KLine.Right) && option.KLine.Right!=this.Right) right=option.KLine.Right; //复权
72530
72573
  }
72531
72574
 
72532
- var bRefreshData= (period!=null || right!=null);
72575
+ var bRefreshData= (period!=null || right!=null || symbol!=null);
72533
72576
 
72534
72577
  //清空所有的指标图型
72535
72578
  for(var i=0;i<currentLength;++i)
@@ -72557,6 +72600,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72557
72600
 
72558
72601
  this.Frame.SubFrame.splice(count,currentLength-count);
72559
72602
  this.WindowIndex.splice(count,currentLength-count);
72603
+ this.TitlePaint.splice(count+1,currentLength-count);
72560
72604
  }
72561
72605
  else
72562
72606
  {
@@ -72573,8 +72617,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72573
72617
  this.TitlePaint[i+1]=titlePaint;
72574
72618
  }
72575
72619
  }
72576
-
72577
- var systemScript = new JSIndexScript();
72620
+
72578
72621
  for(var i=0;i<count;++i)
72579
72622
  {
72580
72623
  var windowIndex=i;
@@ -72584,7 +72627,10 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72584
72627
  var titleIndex=windowIndex+1;
72585
72628
  this.TitlePaint[titleIndex].Data=[];
72586
72629
  this.TitlePaint[titleIndex].Title=null;
72630
+ var frame=this.Frame.SubFrame[i];
72587
72631
 
72632
+ this.DeleteWindowsOverlayIndex(i); //清空叠加指标
72633
+
72588
72634
  if (item.Script) //自定义指标脚本
72589
72635
  {
72590
72636
  this.WindowIndex[i]=new ScriptIndex(item.Name,item.Script,item.Args,item); //脚本执行
@@ -72605,6 +72651,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72605
72651
  }
72606
72652
  else
72607
72653
  {
72654
+ var systemScript = new JSIndexScript();
72608
72655
  var indexInfo = systemScript.Get(indexID);
72609
72656
  if (indexInfo)
72610
72657
  {
@@ -72614,7 +72661,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72614
72661
  }
72615
72662
  }
72616
72663
 
72617
- this.SetSubFrameAttribute(this.Frame.SubFrame[i], item, frameItem);
72664
+ this.SetSubFrameAttribute(frame, item, frameItem);
72618
72665
  }
72619
72666
 
72620
72667
  //最后一个显示X轴坐标
@@ -72625,6 +72672,23 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72625
72672
  else item.XSplitOperator.ShowText=false;
72626
72673
  }
72627
72674
 
72675
+ //叠加指标
72676
+ var aryOverlayIndex=[];
72677
+ if (IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex))
72678
+ {
72679
+ for(var i=0;i<option.OverlayIndex.length;++i)
72680
+ {
72681
+ var item=option.OverlayIndex[i];
72682
+ if (item.Index) item.IndexName=item.Index;
72683
+ if (item.Windows>=0) item.WindowIndex=item.Windows;
72684
+
72685
+ var overlay=this.CreateOverlayWindowsIndex(item);
72686
+ if (!overlay) continue;
72687
+
72688
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
72689
+ }
72690
+ }
72691
+
72628
72692
  if (!bRefreshData)
72629
72693
  {
72630
72694
  var bindData=this.ChartPaint[0].Data;
@@ -72633,6 +72697,12 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72633
72697
  this.BindIndexData(i,bindData);
72634
72698
  }
72635
72699
 
72700
+ for(var i=0;i<aryOverlayIndex.length;++i)
72701
+ {
72702
+ var item=aryOverlayIndex[i];
72703
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
72704
+ }
72705
+
72636
72706
  this.UpdataDataoffset(); //更新数据偏移
72637
72707
  this.Frame.SetSizeChage(true);
72638
72708
  this.ResetFrameXYSplit();
@@ -72641,9 +72711,13 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72641
72711
  }
72642
72712
  else
72643
72713
  {
72644
- this.Frame.SetSizeChage(true);
72645
- if (period!=null) this.ChangePeriod(period, option);
72646
- else if (right!=null) this.ChangeRight(right);
72714
+ if (!symbol) symbol=this.Symbol;
72715
+
72716
+ var optionData={ KLine:{} };
72717
+ if (IFrameSplitOperator.IsNumber(period)) optionData.KLine.Period=period;
72718
+ if (IFrameSplitOperator.IsNumber(right)) optionData.KLine.Right=right;
72719
+
72720
+ this.ChangeSymbol(symbol, optionData);
72647
72721
  }
72648
72722
  }
72649
72723
 
@@ -73088,11 +73162,11 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73088
73162
 
73089
73163
  if (option)
73090
73164
  {
73091
- if (option.Windows && Array.isArray(option.Windows) && option.Windows.length>0)
73165
+ if (IFrameSplitOperator.IsNonEmptyArray(option.Windows))
73092
73166
  {
73093
73167
  var windows=option.Windows;
73094
- var systemScript = new JSIndexScript();
73095
- for(var i in windows)
73168
+
73169
+ for(var i=0; i<windows.length; ++i)
73096
73170
  {
73097
73171
  if (i>=this.WindowIndex.length) break; //暂时不支持 动态增加/减少
73098
73172
  var item=windows[i];
@@ -73110,11 +73184,11 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
73110
73184
  else
73111
73185
  {
73112
73186
  var indexID=item.Index;
73187
+ var systemScript = new JSIndexScript();
73113
73188
  var indexInfo = systemScript.Get(indexID);
73114
73189
  if (indexInfo)
73115
73190
  {
73116
- var args=indexInfo.Args;
73117
- if (item.Args) indexInfo.Args=item.Args;
73191
+ JSIndexScript.ModifyAttribute(indexInfo,item);
73118
73192
  indexInfo.ID=indexID;
73119
73193
  this.WindowIndex[i]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo); //脚本执行
73120
73194
  }
@@ -77863,25 +77937,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77863
77937
  if (windowIndex<2) windowIndex=2;
77864
77938
  if (windowIndex>=this.Frame.SubFrame.length) windowIndex=2;
77865
77939
 
77866
- let indexData =
77867
- {
77868
- Name:indexInfo.Name, Script:indexInfo.Script, Args: indexInfo.Args, ID:indexName ,
77869
- //扩展属性 可以是空
77870
- KLineType:indexInfo.KLineType, YSpecificMaxMin:indexInfo.YSpecificMaxMin, YSplitScale:indexInfo.YSplitScale,
77871
- FloatPrecision:indexInfo.FloatPrecision, Condition:indexInfo.Condition,StringFormat:indexInfo.StringFormat,
77872
- OutName:indexInfo.OutName
77873
- };
77940
+ JSIndexScript.ModifyAttribute(indexInfo, option)
77874
77941
 
77875
- if (option)
77876
- {
77877
- if (option.FloatPrecision>=0) indexData.FloatPrecision=option.FloatPrecision;
77878
- if (option.StringFormat>0) indexData.StringFormat=option.StringFormat;
77879
- if (option.Args) indexData.Args=option.Args;
77880
- if (IFrameSplitOperator.IsNumber(option.YSplitType)) indexData.YSplitType=option.YSplitType;
77881
- if (option.Lock) indexData.Lock=option.Lock;
77882
- }
77883
-
77884
- return this.ChangeScriptIndex(windowIndex, indexData,option);
77942
+ return this.ChangeScriptIndex(windowIndex, indexInfo, option);
77885
77943
  }
77886
77944
 
77887
77945
  //设置指标窗口个数
@@ -77995,6 +78053,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
77995
78053
 
77996
78054
  this.Frame.SubFrame.splice(count,currentLength-count);
77997
78055
  this.WindowIndex.splice(count,currentLength-count);
78056
+ this.TitlePaint.splice(count+1,currentLength-count);
77998
78057
  }
77999
78058
  else
78000
78059
  {
@@ -78012,8 +78071,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78012
78071
  }
78013
78072
  }
78014
78073
 
78015
- var systemScript = new JSIndexScript();
78016
-
78017
78074
  for(var i=0;i<count;++i)
78018
78075
  {
78019
78076
  var windowIndex=i;
@@ -78047,22 +78104,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78047
78104
  }
78048
78105
  else
78049
78106
  {
78107
+ var systemScript = new JSIndexScript();
78050
78108
  var indexInfo = systemScript.Get(indexID);
78051
78109
  if (indexInfo)
78052
78110
  {
78053
- var args=indexInfo.Args;
78054
- if (item.Args) args=item.Args;
78055
- let indexData =
78056
- {
78057
- Name:indexInfo.Name, Script:indexInfo.Script, Args: args, ID:indexID ,
78058
- //扩展属性 可以是空
78059
- KLineType:indexInfo.KLineType, YSpecificMaxMin:indexInfo.YSpecificMaxMin, YSplitScale:indexInfo.YSplitScale,
78060
- FloatPrecision:indexInfo.FloatPrecision, Condition:indexInfo.Condition,
78061
- OutName:indexInfo.OutName
78062
- };
78063
- if (item.TitleFont) indexData.TitleFont=item.TitleFont;
78064
-
78065
- this.WindowIndex[windowIndex]=new ScriptIndex(indexData.Name,indexData.Script,indexData.Args,indexData); //脚本执行
78111
+ JSIndexScript.ModifyAttribute(indexInfo,item);
78112
+ this.WindowIndex[windowIndex]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo); //脚本执行
78066
78113
  }
78067
78114
  }
78068
78115
  }
@@ -78071,6 +78118,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78071
78118
  this.SetSubFrameAttribute(this.Frame.SubFrame[windowIndex], item, frameItem);
78072
78119
  }
78073
78120
 
78121
+ //清空叠加指标
78122
+ for(var i=0;i<this.Frame.SubFrame.length;++i)
78123
+ {
78124
+ this.DeleteWindowsOverlayIndex(i);
78125
+ }
78126
+
78074
78127
  //最后一个显示X轴坐标
78075
78128
  for(var i=0;i<this.Frame.SubFrame.length;++i)
78076
78129
  {
@@ -78079,6 +78132,23 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78079
78132
  else item.XSplitOperator.ShowText=false;
78080
78133
  }
78081
78134
 
78135
+ //叠加指标
78136
+ var aryOverlayIndex=[];
78137
+ if (IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex))
78138
+ {
78139
+ for(var i=0;i<option.OverlayIndex.length;++i)
78140
+ {
78141
+ var item=option.OverlayIndex[i];
78142
+ if (item.Index) item.IndexName=item.Index;
78143
+ if (item.Windows>=0) item.WindowIndex=item.Windows;
78144
+
78145
+ var overlay=this.CreateOverlayWindowsIndex(item);
78146
+ if (!overlay) continue;
78147
+
78148
+ aryOverlayIndex.push({ WindowsIndex:item.WindowIndex, Overlay:overlay });
78149
+ }
78150
+ }
78151
+
78082
78152
  if (!bRefreshData)
78083
78153
  {
78084
78154
  var bindData=this.SourceData;
@@ -78086,6 +78156,13 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78086
78156
  {
78087
78157
  this.BindIndexData(i,bindData); //执行脚本
78088
78158
  }
78159
+
78160
+ for(var i=0;i<aryOverlayIndex.length;++i)
78161
+ {
78162
+ var item=aryOverlayIndex[i];
78163
+ this.BindOverlayIndexData(item.Overlay,item.WindowsIndex,bindData);
78164
+ }
78165
+
78089
78166
  this.UpdataDataoffset(); //更新数据偏移
78090
78167
  this.Frame.SetSizeChage(true);
78091
78168
  if (this.UpdateXShowText) this.UpdateXShowText();
@@ -78260,7 +78337,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78260
78337
 
78261
78338
  if (IFrameSplitOperator.IsNonEmptyArray(option.Windows)) //切换指标
78262
78339
  {
78263
- var systemScript = new JSIndexScript();
78340
+
78264
78341
  for(var i=0; i<option.Windows.length; ++i)
78265
78342
  {
78266
78343
  var index=2+i;
@@ -78280,12 +78357,12 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
78280
78357
  }
78281
78358
  else
78282
78359
  {
78360
+ var systemScript = new JSIndexScript();
78283
78361
  var indexID=item.Index;
78284
78362
  var indexInfo = systemScript.Get(indexID);
78285
78363
  if (indexInfo)
78286
78364
  {
78287
- var args=indexInfo.Args;
78288
- if (item.Args) indexInfo.Args=item.Args;
78365
+ JSIndexScript.ModifyAttribute(indexInfo,item);
78289
78366
  indexInfo.ID=indexID;
78290
78367
  this.WindowIndex[index]=new ScriptIndex(indexInfo.Name,indexInfo.Script,indexInfo.Args,indexInfo); //脚本执行
78291
78368
  }
@@ -129466,7 +129543,7 @@ function HQChartScriptWorker()
129466
129543
 
129467
129544
 
129468
129545
 
129469
- var HQCHART_VERSION="1.1.12934";
129546
+ var HQCHART_VERSION="1.1.12942";
129470
129547
 
129471
129548
  function PrintHQChartVersion()
129472
129549
  {