hqchart 1.1.15106 → 1.1.15121

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.
@@ -6315,12 +6315,12 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
6315
6315
  }
6316
6316
 
6317
6317
  //锁指标
6318
- this.LockIndex=function(lockData)
6318
+ this.EnableLockIndex=function(aryData)
6319
6319
  {
6320
- if(this.JSChartContainer && typeof(this.JSChartContainer.LockIndex)=='function')
6320
+ if(this.JSChartContainer && typeof(this.JSChartContainer.EnableLockIndex)=='function')
6321
6321
  {
6322
- JSConsole.Chart.Log('[JSChart:LockIndex] lockData', lockData);
6323
- this.JSChartContainer.LockIndex(lockData);
6322
+ JSConsole.Chart.Log('[JSChart:EnableLockIndex] aryData', aryData);
6323
+ this.JSChartContainer.EnableLockIndex(lockData);
6324
6324
  }
6325
6325
  }
6326
6326
 
@@ -6722,6 +6722,14 @@ JSChart.RegisterChartFrameClass=function(name, option)
6722
6722
  }
6723
6723
 
6724
6724
 
6725
+ //注册DOM对话框类
6726
+ //option:{ Create:创建类方法 }
6727
+ JSChart.RegisterDOMClass=function(name, option)
6728
+ {
6729
+ return g_JSDOMFactory.Add(name, option);
6730
+ }
6731
+
6732
+
6725
6733
  //一些公共函数
6726
6734
  JSChart.ToFixedPoint=function(value)
6727
6735
  {
@@ -16605,6 +16613,85 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
16605
16613
  if (!this.PressKeyboardConfig.PauseUpdate) return false;
16606
16614
 
16607
16615
  return true;
16616
+ },
16617
+
16618
+ //启动|关闭锁指标 aryIndex=[{ IndexID:指标ID, LockData:{IsLocked:} } ]
16619
+ this.EnableLockIndex=function(aryIndex)
16620
+ {
16621
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryIndex)) return false;
16622
+
16623
+ var mapIndex=new Map();
16624
+ for(var i=0;i<aryIndex.length;++i)
16625
+ {
16626
+ var item=aryIndex[i];
16627
+ if (item.IndexID && item.LockData) mapIndex.set(item.IndexID, item);
16628
+ }
16629
+
16630
+ var aryUpdate=[];
16631
+ for(var i=0; i<this.WindowIndex.length; ++i)
16632
+ {
16633
+ var item=this.WindowIndex[i];
16634
+ if (!item) continue;
16635
+ if (mapIndex.has(item.ID))
16636
+ {
16637
+ var mapItem=mapIndex.get(item.ID);
16638
+ item.SetLock(mapItem.LockData); //设置锁
16639
+ aryUpdate.push({ ID:i});
16640
+ }
16641
+ }
16642
+
16643
+ for(var i=0; i<this.Frame.SubFrame.length; ++i)
16644
+ {
16645
+ var item=this.Frame.SubFrame[i];
16646
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex)) continue;
16647
+
16648
+ for(var j=0; j<item.OverlayIndex.length; ++j)
16649
+ {
16650
+ var overlayItem=item.OverlayIndex[j];
16651
+ var script=overlayItem.Script;
16652
+ if (mapIndex.has(script.ID))
16653
+ {
16654
+ var mapItem=mapIndex.get(script.ID);
16655
+ script.SetLock(mapItem.LockData);
16656
+ aryUpdate.push({OverlayID:overlayItem.Identify});
16657
+ }
16658
+ }
16659
+ }
16660
+
16661
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryUpdate)) return false;
16662
+
16663
+ this.UpdateWindowIndexV2(aryUpdate);
16664
+ return true;
16665
+ }
16666
+
16667
+ this.TryClickLock=function(x,y)
16668
+ {
16669
+ if (!this.Frame || !IFrameSplitOperator.IsNonEmptyArray(this.Frame.SubFrame)) return false;
16670
+
16671
+ for(var i=0;i<this.Frame.SubFrame.length; ++i)
16672
+ {
16673
+ var item=this.Frame.SubFrame[i];
16674
+ var chartLock=item.Frame.LockPaint;
16675
+ if (!chartLock || !chartLock.LockRect) continue;
16676
+
16677
+ var tooltip=new TooltipData();
16678
+ if (!chartLock.GetTooltipData(x,y,tooltip)) continue;
16679
+
16680
+ tooltip.HQChart=this;
16681
+
16682
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);
16683
+ if (event && event.Callback)
16684
+ {
16685
+ var sendData={ FrameID:item.Frame.Identify, Data:tooltip };
16686
+ event.Callback(event,sendData,this);
16687
+ }
16688
+
16689
+
16690
+ if (tooltip.Data.Callback) tooltip.Data.Callback(tooltip);
16691
+ return true;
16692
+ }
16693
+
16694
+ return false;
16608
16695
  }
16609
16696
  }
16610
16697
 
@@ -17253,8 +17340,8 @@ function IChartFramePainting()
17253
17340
  this.XSplitOperator; //X轴分割
17254
17341
  this.Data; //主数据
17255
17342
 
17256
- this.IsLocked=false; //是否上锁
17257
- this.LockPaint = null;
17343
+ this.LockPaint = null; //锁图形
17344
+ this.IndexLock=new IndexLockData(); //指标锁
17258
17345
 
17259
17346
  this.YSpecificMaxMin=null; //指定Y轴最大最小值
17260
17347
  this.IsShowBorder = true; //是否显示边框
@@ -17526,15 +17613,8 @@ function IChartFramePainting()
17526
17613
 
17527
17614
  this.DrawLock=function()
17528
17615
  {
17529
- if (this.IsLocked)
17530
- {
17531
- if (this.LockPaint == null)
17532
- this.LockPaint = g_ChartPaintFactory.Create("ChartLock");//new ChartLock();
17533
- this.LockPaint.Canvas=this.Canvas;
17534
- this.LockPaint.ChartBorder=this.ChartBorder;
17535
- this.LockPaint.ChartFrame=this;
17536
- this.LockPaint.Draw(true);
17537
- }
17616
+ if (!this.LockPaint) return;
17617
+ this.LockPaint.Draw(true);
17538
17618
  }
17539
17619
 
17540
17620
  this.DrawLogo=function()
@@ -17590,46 +17670,28 @@ function IChartFramePainting()
17590
17670
  }
17591
17671
  }
17592
17672
 
17593
- this.CalculateLock=function()
17673
+ this.CalculateLock=function(aryData)
17594
17674
  {
17595
- if (this.IsLocked)
17596
- {
17597
- if (this.LockPaint == null)
17598
- this.LockPaint = g_ChartPaintFactory.Create("ChartLock"); // new ChartLock();
17599
- this.LockPaint.Canvas=this.Canvas;
17600
- this.LockPaint.ChartBorder=this.ChartBorder;
17601
- this.LockPaint.ChartFrame=this;
17602
- this.LockPaint.Draw(false);
17603
- }
17675
+ this.LockPaint.SetData(aryData);
17676
+ this.LockPaint.Draw(false);
17604
17677
  }
17605
17678
 
17606
- //设施上锁
17607
- this.SetLock=function(lockData)
17679
+ //创建锁图形
17680
+ this.CreateLockPaint=function()
17608
17681
  {
17609
- if (!lockData) //空数据不上锁
17610
- {
17611
- this.IsLocked=false;
17612
- return;
17613
- }
17614
-
17615
- this.IsLocked=true;
17616
- if (!this.LockPaint) this.LockPaint=g_ChartPaintFactory.Create("ChartLock"); //new ChartLock(); //创建锁
17682
+ this.LockPaint = g_ChartPaintFactory.Create("ChartLock"); // new ChartLock();
17683
+ this.LockPaint.Canvas=this.Canvas;
17684
+ this.LockPaint.ChartBorder=this.ChartBorder;
17685
+ this.LockPaint.ChartFrame=this;
17686
+ }
17617
17687
 
17618
- if (lockData.Callback) this.LockPaint.Callback=lockData.Callback; //回调
17619
- if (lockData.IndexName) this.LockPaint.IndexName=lockData.IndexName; //指标名字
17620
- if (lockData.IndexID) this.LockPaint.IndexID=lockData.IndexID; //指标ID
17621
- if (lockData.ID) this.LockPaint.LockID=lockData.ID; //锁ID
17622
- if (lockData.BG) this.LockPaint.BGColor=lockData.BG; //背景色
17623
- if (lockData.Text) this.LockPaint.Title= lockData.Text;
17624
- if (lockData.TextColor) this.LockPaint.TextColor=lockData.TextColor;
17625
- if (lockData.Font) this.LockPaint.Font=lockData.Font;
17626
- if (lockData.Count) this.LockPaint.LockCount=lockData.Count;
17627
- if (lockData.MinWidth>0) this.LockPaint.MinWidth=lockData.MinWidth;
17688
+ this.SetLock=function(lockData)
17689
+ {
17690
+ this.IndexLock.SetData(lockData);
17628
17691
  }
17629
17692
 
17630
17693
  this.GetLockRect=function()
17631
17694
  {
17632
- if (!this.IsLocked) return null;
17633
17695
  if (!this.LockPaint) return null;
17634
17696
  return this.LockPaint.LockRect;
17635
17697
  }
@@ -20386,7 +20448,7 @@ function AverageWidthFrame()
20386
20448
 
20387
20449
  if (this.ClassName=="MinuteFrame" || this.ClassName=="KLineFrame")
20388
20450
  {
20389
- this.DivFrameToolbar=new JSDivFrameToolbar();
20451
+ this.DivFrameToolbar=g_JSDOMFactory.Create('JSDivFrameToolbar');//new JSDivFrameToolbar();
20390
20452
  this.DivFrameToolbar.HQChart=hqchart;
20391
20453
  this.DivFrameToolbar.DivHQChart=divHQChart;
20392
20454
  this.DivFrameToolbar.FrameID=frameID;
@@ -22666,6 +22728,13 @@ function OverlayMinuteFrame()
22666
22728
  this.IsShareY=false; //使用和主框架公用Y轴
22667
22729
  this.IsCalculateYMaxMin=true; //是否计算Y最大最小值
22668
22730
  this.IsShowMainFrame=0; //是否显示在主框架坐标上 1=左边 2=右边
22731
+ this.MainFrame=null; //主框架
22732
+
22733
+ this.GetLockRect=function()
22734
+ {
22735
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
22736
+ return this.MainFrame.GetLockRect();
22737
+ }
22669
22738
 
22670
22739
  this.Draw=function()
22671
22740
  {
@@ -22724,6 +22793,13 @@ function OverlayMinuteHScreenFrame()
22724
22793
 
22725
22794
  this.ClassName="OverlayMinuteHScreenFrame";
22726
22795
  this.IsShow=true; //坐标是否显示
22796
+ this.MainFrame=null; //主框架
22797
+
22798
+ this.GetLockRect=function()
22799
+ {
22800
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
22801
+ return this.MainFrame.GetLockRect();
22802
+ }
22727
22803
 
22728
22804
  this.Draw=function()
22729
22805
  {
@@ -24111,6 +24187,12 @@ function OverlayKLineFrame()
24111
24187
  }
24112
24188
  }
24113
24189
 
24190
+ this.GetLockRect=function()
24191
+ {
24192
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
24193
+ return this.MainFrame.GetLockRect();
24194
+ }
24195
+
24114
24196
  this.Draw=function()
24115
24197
  {
24116
24198
  this.Buttons=[];
@@ -25423,6 +25505,12 @@ function OverlayKLineHScreenFrame()
25423
25505
  this.TitleColor=g_JSChartResource.OverlayFrame.TitleColor;
25424
25506
  this.TitleFont=g_JSChartResource.OverlayFrame.TitleFont;
25425
25507
 
25508
+ this.GetLockRect=function()
25509
+ {
25510
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
25511
+ return this.MainFrame.GetLockRect();
25512
+ }
25513
+
25426
25514
  this.Draw=function()
25427
25515
  {
25428
25516
  this.SplitXYCoordinate();
@@ -26629,7 +26717,7 @@ function HQTradeFrame()
26629
26717
 
26630
26718
  this.DrawLock=function()
26631
26719
  {
26632
- for (var i in this.SubFrame)
26720
+ for (var i=0; i<this.SubFrame.length; ++i)
26633
26721
  {
26634
26722
  var item = this.SubFrame[i];
26635
26723
  item.Frame.DrawLock();
@@ -26651,10 +26739,21 @@ function HQTradeFrame()
26651
26739
 
26652
26740
  this.CalculateLock=function()
26653
26741
  {
26654
- for (var i in this.SubFrame)
26742
+ for (var i=0, j=0; i<this.SubFrame.length; ++i)
26655
26743
  {
26656
26744
  var item = this.SubFrame[i];
26657
- item.Frame.CalculateLock();
26745
+ var aryLockData=[];
26746
+ if (item.Frame.IndexLock.IsLocked) aryLockData.push({ Data:item.Frame.IndexLock, IsOverlay:false });
26747
+ for(j=0; j<item.OverlayIndex.length; ++j)
26748
+ {
26749
+ var subItem=item.OverlayIndex[j];
26750
+ if (subItem.Frame.IndexLock.IsLocked===true)
26751
+ {
26752
+ aryLockData.push({ Data:subItem.Frame.IndexLock, IsOverlay:true } );
26753
+ }
26754
+ }
26755
+
26756
+ item.Frame.CalculateLock(aryLockData);
26658
26757
  }
26659
26758
  }
26660
26759
 
@@ -30894,9 +30993,20 @@ function IChartPainting()
30894
30993
  var x=left+width/2;
30895
30994
  var y=top+height/2;
30896
30995
 
30996
+ var bHScreen=this.ChartFrame.IsHScreen;
30997
+ if (bHScreen)
30998
+ {
30999
+ this.Canvas.save();
31000
+ this.Canvas.translate(x, y);
31001
+ this.Canvas.rotate(90 * Math.PI / 180);
31002
+ x=0,y=0;
31003
+ }
31004
+
30897
31005
  this.Canvas.textAlign="center";
30898
31006
  this.Canvas.textBaseline="middle";
30899
31007
  this.Canvas.fillText(this.NotSupportMessage,x,y);
31008
+
31009
+ if (bHScreen) this.Canvas.restore();
30900
31010
  }
30901
31011
 
30902
31012
  this.GetTooltipData=function(x,y,tooltip)
@@ -42801,6 +42911,13 @@ function ChartStickLine()
42801
42911
  xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
42802
42912
  }
42803
42913
 
42914
+ var lockRect=this.GetLockRect();
42915
+ if (lockRect)
42916
+ {
42917
+ if (this.IsHScreen) chartright=lockRect.Top;
42918
+ else chartright=lockRect.Left;
42919
+ }
42920
+
42804
42921
  var isMinute=this.IsMinuteFrame();
42805
42922
 
42806
42923
  if (isMinute)
@@ -51876,6 +51993,39 @@ function ChartDrawFlagText()
51876
51993
  }
51877
51994
  }
51878
51995
 
51996
+ function IndexLockData()
51997
+ {
51998
+ this.IsLocked=false;
51999
+ this.LockCount = 20; // 锁最新的几个数据
52000
+ this.BGColor = g_JSChartResource.IndexLock.BGColor;
52001
+ this.TextColor = g_JSChartResource.IndexLock.TextColor;
52002
+ this.Font = g_JSChartResource.IndexLock.Font;
52003
+ this.Title = g_JSChartResource.IndexLock.Title;
52004
+ this.LockID; //锁ID
52005
+ this.IndexName; //指标名字
52006
+ this.IndexID; //指标ID
52007
+
52008
+ this.SetData=function(lockData)
52009
+ {
52010
+ if (!lockData) //空 解锁
52011
+ {
52012
+ this.IsLocked=false;
52013
+ return;
52014
+ }
52015
+
52016
+ this.IsLocked=true;
52017
+ if (lockData.Callback) this.Callback=lockData.Callback; //回调 !!废弃
52018
+ if (lockData.IndexName) this.IndexName=lockData.IndexName; //指标名字
52019
+ if (lockData.IndexID) this.IndexID=lockData.IndexID; //指标ID
52020
+ if (lockData.ID) this.LockID=lockData.ID; //锁ID
52021
+ if (lockData.BG) this.BGColor=lockData.BG; //背景色
52022
+ if (lockData.Text) this.Title= lockData.Text;
52023
+ if (lockData.TextColor) this.TextColor=lockData.TextColor;
52024
+ if (lockData.Font) this.Font=lockData.Font;
52025
+ if (lockData.Count) this.LockCount=lockData.Count;
52026
+ }
52027
+ }
52028
+
51879
52029
  //锁 支持横屏
51880
52030
  function ChartLock()
51881
52031
  {
@@ -51884,17 +52034,41 @@ function ChartLock()
51884
52034
  delete this.newMethod;
51885
52035
 
51886
52036
  this.ClassName="ChartLock";
52037
+ this.AryData=null;
52038
+ this.LockRect=null; //上锁区域
52039
+
51887
52040
  this.LockCount = 20; // 锁最新的几个数据
51888
52041
  this.BGColor = g_JSChartResource.IndexLock.BGColor;
51889
52042
  this.TextColor = g_JSChartResource.IndexLock.TextColor;
51890
52043
  this.Font = g_JSChartResource.IndexLock.Font;
51891
52044
  this.Title = g_JSChartResource.IndexLock.Title;
51892
- this.LockRect=null; //上锁区域
52045
+
51893
52046
  this.LockID; //锁ID
51894
52047
  this.Callback; //回调
51895
52048
  this.IndexName; //指标名字
51896
52049
  this.IndexID; //指标ID
51897
52050
 
52051
+ this.MinWidthText=" 付费指标 "
52052
+
52053
+ this.SetData=function(aryData)
52054
+ {
52055
+ this.AryData=aryData;
52056
+
52057
+ if (IFrameSplitOperator.IsNonEmptyArray(this.AryData))
52058
+ {
52059
+ var item=this.AryData[0].Data; //取第一个锁
52060
+
52061
+ this.LockCount = item.LockCount;
52062
+ this.BGColor = item.BGColor
52063
+ this.TextColor = item.TextColor
52064
+ this.Font = item.Font
52065
+ this.Title = item.Title
52066
+ this.LockID=item.LockID; //锁ID
52067
+ this.Callback=item.Callback; //回调
52068
+ this.IndexName=item.IndexName; //指标名字
52069
+ this.IndexID=item.IndexID; //指标ID
52070
+ }
52071
+ }
51898
52072
 
51899
52073
  this.CalculateTextSize=function(aryText, defaultFont, out)
51900
52074
  {
@@ -51916,7 +52090,7 @@ function ChartLock()
51916
52090
  }
51917
52091
  else
51918
52092
  {
51919
- if (item.Font)
52093
+ if (item.Font)
51920
52094
  {
51921
52095
  this.Canvas.font=item.Font;
51922
52096
  lineHeight=this.Canvas.measureText("擎").width;
@@ -51962,12 +52136,7 @@ function ChartLock()
51962
52136
  this.Draw=function(bDraw)
51963
52137
  {
51964
52138
  this.LockRect=null;
51965
- if (!bDraw) return;
51966
- if (this.NotSupportMessage)
51967
- {
51968
- this.DrawNotSupportmessage();
51969
- return;
51970
- }
52139
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryData)) return;
51971
52140
 
51972
52141
  var bHScreen=this.ChartFrame.IsHScreen;
51973
52142
  var bMinute=this.IsMinuteFrame();
@@ -52008,35 +52177,59 @@ function ChartLock()
52008
52177
  }
52009
52178
  }
52010
52179
 
52180
+ this.Canvas.font=this.Font;
52181
+ var minWidth=this.Canvas.measureText(this.MinWidthText).width;
52182
+
52183
+ var aryText=null;
52184
+ if (Array.isArray(this.Title)) aryText=this.Title;
52185
+ else aryText=[{Text:this.Title}];
52186
+
52187
+ var outSize={ };
52188
+ if (!this.CalculateTextSize(aryText, this.Font, outSize)) outSize=null;
52189
+ if (outSize && outSize.Width+8>minWidth) minWidth=outSize.Width+8; //确保文字可以显示
52190
+
52011
52191
  if (bHScreen)
52012
52192
  {
52013
52193
  var rtBG={ Left:border.Left, Right:border.RightEx, Top:left, Bottom:border.Bottom };
52014
52194
  rtBG.Width=rtBG.Right-rtBG.Left;
52015
52195
  rtBG.Height=rtBG.Bottom-rtBG.Top;
52016
-
52017
- var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
52018
- this.Canvas.fillStyle =bgColor;
52019
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
52196
+ if (rtBG.Height<minWidth)
52197
+ {
52198
+ rtBG.Height=minWidth;
52199
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
52200
+ }
52020
52201
  this.LockRect=rtBG; //保存上锁区域
52202
+
52203
+ if (bDraw)
52204
+ {
52205
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
52206
+ this.Canvas.fillStyle =bgColor;
52207
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
52208
+ }
52021
52209
  }
52022
52210
  else
52023
52211
  {
52024
52212
  var rtBG={ Left:left, Right:border.RightEx, Top:border.TopTitle, Bottom:border.Bottom };
52025
52213
  rtBG.Width=rtBG.Right-rtBG.Left;
52026
52214
  rtBG.Height=rtBG.Bottom-rtBG.Top;
52027
- //上下渐变
52028
- var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
52029
- this.Canvas.fillStyle =bgColor;
52030
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
52215
+ if (rtBG.Width<minWidth)
52216
+ {
52217
+ rtBG.Width=minWidth;
52218
+ rtBG.Left=rtBG.Right-rtBG.Width;
52219
+ }
52031
52220
  this.LockRect=rtBG; //保存上锁区域
52221
+
52222
+ if (bDraw)
52223
+ {
52224
+ //上下渐变
52225
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
52226
+ this.Canvas.fillStyle =bgColor;
52227
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
52228
+ }
52032
52229
  }
52033
52230
 
52034
- var aryText=null;
52035
- if (Array.isArray(this.Title)) aryText=this.Title;
52036
- else aryText=[{Text:this.Title}];
52037
-
52038
- var outSize={ };
52039
- if (!this.CalculateTextSize(aryText, this.Font, outSize)) return;
52231
+ if (!bDraw) return;
52232
+ if (!outSize) return;
52040
52233
 
52041
52234
  this.Canvas.textAlign='left';
52042
52235
  this.Canvas.textBaseline='bottom';
@@ -52047,67 +52240,54 @@ function ChartLock()
52047
52240
  var top=rtBG.Top+(rtBG.Height-outSize.Width)/2;
52048
52241
  if (outSize.Width>rtBG.Height) top=rtBG.Bottom-outSize.Width;
52049
52242
  var left=rtBG.Left+(rtBG.Width-outSize.Height)/2;
52050
-
52051
52243
  this.Canvas.save();
52052
52244
  this.Canvas.translate(left, top);
52053
52245
  this.Canvas.rotate(90 * Math.PI / 180);
52054
- var yText=0,xText=0;
52055
- for(var i=0;i<outSize.AryText.length;++i)
52056
- {
52057
- var item=outSize.AryText[i];
52058
- if (item.Color) this.Canvas.fillStyle=item.Color;
52059
- else this.Canvas.fillStyle=this.TextColor;
52060
-
52061
- if (item.Font) this.Canvas.font = item.Font;
52062
- else this.Canvas.font = this.Font;
52063
-
52064
- yText+=item.Height;
52065
- this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52066
- }
52067
-
52068
- this.Canvas.restore();
52246
+ var left=0,top=0;
52069
52247
  }
52070
52248
  else
52071
52249
  {
52072
52250
  var left=rtBG.Left+(rtBG.Width-outSize.Width)/2;
52073
52251
  if (outSize.Width>rtBG.Width) left=rtBG.Right-outSize.Width;
52074
52252
  var top=rtBG.Top+(rtBG.Height-outSize.Height)/2;
52075
-
52076
- var yText=top, xText=left;
52077
- for(var i=0;i<outSize.AryText.length;++i)
52253
+ }
52254
+
52255
+ var yText=top, xText=left;
52256
+ for(var i=0;i<outSize.AryText.length;++i)
52257
+ {
52258
+ var item=outSize.AryText[i];
52259
+ xText=left;
52260
+ if (item.Image)
52078
52261
  {
52079
- var item=outSize.AryText[i];
52080
- if (item.Image)
52262
+ if (item.Align===1)
52081
52263
  {
52082
- xText=left;
52083
- if (item.Align===1)
52084
- {
52085
- if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52086
- }
52087
-
52088
- this.Canvas.drawImage(item.Image.Data, xText, yText, item.Image.Width, item.Image.Height);
52089
-
52090
- yText+=item.Height;
52264
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52091
52265
  }
52092
- else
52093
- {
52094
- if (item.Color) this.Canvas.fillStyle=item.Color;
52095
- else this.Canvas.fillStyle=this.TextColor;
52096
52266
 
52097
- if (item.Font) this.Canvas.font = item.Font;
52098
- else this.Canvas.font = this.Font;
52267
+ this.Canvas.drawImage(item.Image.Data, xText, yText, item.Image.Width, item.Image.Height);
52099
52268
 
52100
- yText+=item.Height;
52101
- xText=left;
52102
- if (item.Align===1)
52103
- {
52104
- if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52105
- }
52269
+ yText+=item.Height;
52270
+ }
52271
+ else
52272
+ {
52273
+ if (item.Color) this.Canvas.fillStyle=item.Color;
52274
+ else this.Canvas.fillStyle=this.TextColor;
52275
+
52276
+ if (item.Font) this.Canvas.font = item.Font;
52277
+ else this.Canvas.font = this.Font;
52106
52278
 
52107
- this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52279
+ yText+=item.Height;
52280
+
52281
+ if (item.Align===1)
52282
+ {
52283
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52108
52284
  }
52109
- }
52285
+
52286
+ this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52287
+ }
52110
52288
  }
52289
+
52290
+ if (bHScreen) this.Canvas.restore();
52111
52291
  }
52112
52292
 
52113
52293
  //x,y是否在上锁区域
@@ -52117,7 +52297,7 @@ function ChartLock()
52117
52297
 
52118
52298
  if (Path2DHelper.PtInRect(x,y,this.LockRect))
52119
52299
  {
52120
- tooltip.Data={ ID:this.LockID, Callback:this.Callback, IndexName:this.IndexName, IndexID:this.IndexID };
52300
+ tooltip.Data={ ID:this.LockID, Callback:this.Callback, IndexName:this.IndexName, IndexID:this.IndexID, Data:this.AryData };
52121
52301
  tooltip.ChartPaint=this;
52122
52302
  return true;
52123
52303
  }
@@ -87074,6 +87254,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87074
87254
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
87075
87255
  frame.GlobalOption=this.GlobalOption;
87076
87256
  frame.CreateDivFrameToolbar(this, i, this.UIElement.parentNode);
87257
+ frame.CreateLockPaint();
87077
87258
 
87078
87259
  frame.HorizontalMax=20;
87079
87260
  frame.HorizontalMin=10;
@@ -87175,6 +87356,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87175
87356
  frame.XSplitOperator.Symbol=this.Symbol;
87176
87357
  frame.XSplitOperator.Period=this.Period;
87177
87358
  frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
87359
+ frame.CreateLockPaint();
87178
87360
 
87179
87361
  //K线数据绑定
87180
87362
  var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;
@@ -89634,7 +89816,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
89634
89816
 
89635
89817
 
89636
89818
  subFrame.YSpecificMaxMin=null; //清空指定最大最小值
89637
- subFrame.IsLocked=false; //解除上锁
89638
89819
  subFrame.YSplitScale = null; //清空固定刻度
89639
89820
  subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType; //还原Y坐标分割模式
89640
89821
 
@@ -89932,7 +90113,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
89932
90113
 
89933
90114
 
89934
90115
  this.Frame.SubFrame[windowIndex].Frame.YSpecificMaxMin=null; //清空指定最大最小值
89935
- this.Frame.SubFrame[windowIndex].Frame.IsLocked=false; //解除上锁
89936
90116
  this.Frame.SubFrame[windowIndex].Frame.YSplitScale = null; //清空固定刻度
89937
90117
 
89938
90118
  this.ChartPaint=paint;
@@ -89990,7 +90170,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
89990
90170
  }
89991
90171
  else if (obj.Script) //动态执行脚本
89992
90172
  {
89993
- indexInfo={ Script:obj.Script, ID:obj.indexName, Name:obj.indexName};
90173
+ indexInfo={ Script:obj.Script, ID:obj.IndexName, Name:obj.IndexName};
89994
90174
  if (obj.Name) indexInfo.Name=obj.Name;
89995
90175
  }
89996
90176
  else
@@ -90325,7 +90505,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
90325
90505
  this.DeleteIndexPaint(i);
90326
90506
  var frame=this.Frame.SubFrame[i];
90327
90507
  frame.YSpecificMaxMin=null;
90328
- frame.IsLocked=false;
90329
90508
  frame.YSplitScale = null;
90330
90509
  }
90331
90510
 
@@ -90705,51 +90884,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
90705
90884
  }
90706
90885
  }
90707
90886
 
90708
- //锁|解锁指标 { Index:指标名字,IsLocked:是否要锁上,Callback:回调 }
90709
- this.LockIndex=function(lockData)
90710
- {
90711
- if (!lockData) return;
90712
- if (!lockData.IndexName) return;
90713
-
90714
- for(let i in this.WindowIndex)
90715
- {
90716
- let item=this.WindowIndex[i];
90717
- if (!item) conintue;
90718
- if (item.Name==lockData.IndexName)
90719
- {
90720
- item.SetLock(lockData);
90721
- this.Update();
90722
- break;
90723
- }
90724
- }
90725
- }
90726
-
90727
- this.TryClickLock=function(x,y)
90728
- {
90729
- for(var i=0;i<this.Frame.SubFrame.length; ++i)
90730
- {
90731
- var item=this.Frame.SubFrame[i];
90732
- if (!item.Frame.IsLocked) continue;
90733
- if (!item.Frame.LockPaint) continue;
90734
-
90735
- var tooltip=new TooltipData();
90736
- if (!item.Frame.LockPaint.GetTooltipData(x,y,tooltip)) continue;
90737
-
90738
- tooltip.HQChart=this;
90739
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);
90740
- if (event && event.Callback)
90741
- {
90742
- var sendData={ FrameID:item.Frame.Identify, Data:tooltip };
90743
- event.Callback(event,sendData,this);
90744
- }
90745
-
90746
- if (tooltip.Data.Callback) tooltip.Data.Callback(tooltip);
90747
- return true;
90748
- }
90749
-
90750
- return false;
90751
- }
90752
-
90753
90887
  this.TryClickIndexTitle=function(x,y)
90754
90888
  {
90755
90889
  for(var i in this.TitlePaint)
@@ -96739,6 +96873,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96739
96873
  frame.XPointCount=243;
96740
96874
  frame.HQChart=this;
96741
96875
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
96876
+ frame.CreateLockPaint();
96742
96877
 
96743
96878
  if (i>=2)
96744
96879
  {
@@ -96850,6 +96985,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96850
96985
  frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
96851
96986
  frame.XSplitOperator.Symbol=this.Symbol;
96852
96987
  frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
96988
+ frame.CreateLockPaint();
96853
96989
 
96854
96990
  if (this.DayCount>1)
96855
96991
  {
@@ -96975,7 +97111,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96975
97111
  //清空指定最大最小值
96976
97112
 
96977
97113
  subFrame.YSpecificMaxMin=null;
96978
- subFrame.IsLocked=false; //解除上锁
96979
97114
  subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType; //还原Y坐标分割模式
96980
97115
 
96981
97116
  this.ChartPaint=paint;
@@ -97208,7 +97343,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
97208
97343
  this.DeleteIndexPaint(i);
97209
97344
  var frame=this.Frame.SubFrame[i];
97210
97345
  frame.YSpecificMaxMin=null;
97211
- frame.IsLocked=false;
97212
97346
  frame.YSplitScale = null;
97213
97347
  }
97214
97348
 
@@ -99455,9 +99589,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
99455
99589
  {
99456
99590
  overlayFrame=new OverlayIndexItem();
99457
99591
  overlayFrame.Identify='Position_Line_Frame';
99458
-
99459
- if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
99460
- else frame=new OverlayMinuteHScreenFrame();
99592
+ frame=this.CreateOverlayFrame();
99593
+ //if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
99594
+ //else frame=new OverlayMinuteHScreenFrame();
99461
99595
 
99462
99596
  frame.Canvas=this.Canvas;
99463
99597
  frame.MainFrame=subFrame.Frame;
@@ -99640,9 +99774,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
99640
99774
  var subFrame=this.Frame.SubFrame[windowIndex];
99641
99775
  var overlayFrame=new OverlayIndexItem();
99642
99776
  if (obj.Identify) overlayFrame.Identify=obj.Identify; //由外部指定id
99643
- var frame=null;
99644
- if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
99645
- else frame=new OverlayMinuteHScreenFrame();
99777
+ var frame=this.CreateOverlayFrame();
99778
+ //if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
99779
+ //else frame=new OverlayMinuteHScreenFrame();
99646
99780
  frame.Canvas=this.Canvas;
99647
99781
  frame.MainFrame=subFrame.Frame;
99648
99782
  frame.ChartBorder=subFrame.Frame.ChartBorder;
@@ -100556,25 +100690,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
100556
100690
 
100557
100691
  return false;
100558
100692
  }
100559
-
100560
- this.TryClickLock=function(x,y)
100561
- {
100562
- for(var i=0;i<this.Frame.SubFrame.length; ++i)
100563
- {
100564
- var item=this.Frame.SubFrame[i];
100565
- if (!item.Frame.IsLocked) continue;
100566
- if (!item.Frame.LockPaint) continue;
100567
-
100568
- var tooltip=new TooltipData();
100569
- if (!item.Frame.LockPaint.GetTooltipData(x,y,tooltip)) continue;
100570
-
100571
- tooltip.HQChart=this;
100572
- if (tooltip.Data.Callback) tooltip.Data.Callback(tooltip);
100573
- return true;
100574
- }
100575
-
100576
- return false;
100577
- }
100578
100693
  }
100579
100694
 
100580
100695
  //盘前数据
@@ -102526,6 +102641,7 @@ function KLineChartHScreenContainer(uielement)
102526
102641
  frame.RightSpaceCount=this.RightSpaceCount; //右边
102527
102642
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
102528
102643
  frame.GlobalOption=this.GlobalOption;
102644
+ frame.CreateLockPaint();
102529
102645
 
102530
102646
  frame.HorizontalMax=20;
102531
102647
  frame.HorizontalMin=10;
@@ -102714,6 +102830,7 @@ function MinuteChartHScreenContainer(uielement)
102714
102830
  frame.XPointCount=243;
102715
102831
  frame.HQChart=this;
102716
102832
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
102833
+ frame.CreateLockPaint();
102717
102834
 
102718
102835
  var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];
102719
102836
  frame.HorizontalMax=DEFAULT_HORIZONTAL[0];
@@ -109489,8 +109606,6 @@ function JSDivFrameToolbar()
109489
109606
  this.SetToolbar(aryButton); //重新设置按钮
109490
109607
  }
109491
109608
 
109492
-
109493
-
109494
109609
  this.Destroy=function()
109495
109610
  {
109496
109611
  if (this.DivToolbar)
@@ -109672,6 +109787,37 @@ JSDivFrameToolbar.GetDfaultButtons=function()
109672
109787
  }
109673
109788
 
109674
109789
 
109790
+
109791
+ //DOM工厂类
109792
+ function JSDOMFactory()
109793
+ {
109794
+ //[key:name, { Create:function(divElement) { return new class(divElement); }} ]
109795
+ this.DataMap=new Map(
109796
+ [
109797
+ ["JSDivFrameToolbar", { Create:function(option) { return new JSDivFrameToolbar(option); } }],
109798
+ ]);
109799
+
109800
+ this.Create=function(name, option)
109801
+ {
109802
+ if (!this.DataMap.has(name))
109803
+ {
109804
+ JSConsole.Chart.Warn(`[JSDOMFactory::Create] can't find class=${name}.`);
109805
+ return null;
109806
+ }
109807
+
109808
+ var item=this.DataMap.get(name);
109809
+ return item.Create(option);
109810
+ }
109811
+
109812
+ this.Add=function(name, option)
109813
+ {
109814
+ this.DataMap.set(name, { Create:option.Create } );
109815
+ }
109816
+ }
109817
+
109818
+ var g_JSDOMFactory=new JSDOMFactory();
109819
+
109820
+
109675
109821
  function JSToolbarTooltip()
109676
109822
  {
109677
109823
  this.DivTooltip=null;
@@ -130284,7 +130430,7 @@ function ScriptIndex(name,script,args,option)
130284
130430
  Name:hqChart.Name,
130285
130431
  Data:hisData,
130286
130432
  SourceData:hqChart.SourceData,
130287
- Callback:this.RecvResultData, CallbackParam:param,
130433
+ Callback:(arg1, arg2)=>{ this.RecvResultData(arg1, arg2); }, CallbackParam:param,
130288
130434
  Async:true,
130289
130435
  MaxRequestDataCount:hqChart.MaxRequestDataCount,
130290
130436
  MaxRequestMinuteDayCount:hqChart.MaxRequestMinuteDayCount,
@@ -132973,6 +133119,18 @@ function OverlayScriptIndex(name,script,args,option)
132973
133119
  param.Self.OutVar=outVar;
132974
133120
  param.Self.BindData(hqChart,windowIndex,hisData);
132975
133121
 
133122
+ var frame=this.OverlayIndex.Frame.Frame;
133123
+ if (this.IsLocked==false) //不上锁
133124
+ {
133125
+ frame.SetLock(null);
133126
+ }
133127
+ else //上锁
133128
+ {
133129
+ let lockData={ IsLocked:true,Callback:this.LockCallback,IndexName:this.Name ,ID:this.LockID, IndexID:this.ID,
133130
+ BG:this.LockBG,Text:this.LockText,TextColor:this.LockTextColor, Font:this.LockFont, Count:this.LockCount, MinWidth:this.LockMinWidth };
133131
+ frame.SetLock(lockData);
133132
+ }
133133
+
132976
133134
  param.HQChart.UpdataDataoffset(); //更新数据偏移
132977
133135
  param.HQChart.UpdateFrameMaxMin(); //调整坐标最大 最小值
132978
133136
 
@@ -134833,20 +134991,20 @@ function APIScriptIndex(name,script,args,option, isOverlay)
134833
134991
  }
134834
134992
  this.BindData(hqChart,windowIndex,hisData);
134835
134993
 
134836
- if (!this.IsOverlayIndex)
134994
+ var frame=hqChart.Frame.SubFrame[windowIndex].Frame;
134995
+ if (this.IsOverlayIndex) frame=this.OverlayIndex.Frame.Frame;
134996
+
134997
+ if (this.IsLocked==false) //不上锁
134837
134998
  {
134838
- if (this.IsLocked==false) //不上锁
134839
- {
134840
- hqChart.Frame.SubFrame[windowIndex].Frame.SetLock(null);
134841
- }
134842
- else //上锁
134843
- {
134844
- let lockData={ IsLocked:true,Callback:this.LockCallback,IndexName:this.Name ,ID:this.LockID,
134845
- BG:this.LockBG,Text:this.LockText,TextColor:this.LockTextColor, Font:this.LockFont, Count:this.LockCount, MinWidth:this.LockMinWidth };
134846
- hqChart.Frame.SubFrame[windowIndex].Frame.SetLock(lockData);
134847
- }
134999
+ frame.SetLock(null);
134848
135000
  }
134849
-
135001
+ else //上锁
135002
+ {
135003
+ let lockData={ IsLocked:true,Callback:this.LockCallback,IndexName:this.Name ,ID:this.LockID,IndexID:this.ID,
135004
+ BG:this.LockBG,Text:this.LockText,TextColor:this.LockTextColor, Font:this.LockFont, Count:this.LockCount, MinWidth:this.LockMinWidth };
135005
+ frame.SetLock(lockData);
135006
+ }
135007
+
134850
135008
  hqChart.UpdataDataoffset(); //更新数据偏移
134851
135009
  hqChart.UpdateFrameMaxMin(); //调整坐标最大 最小值
134852
135010
 
@@ -153717,7 +153875,7 @@ function ScrollBarBGChart()
153717
153875
 
153718
153876
 
153719
153877
 
153720
- var HQCHART_VERSION="1.1.15105";
153878
+ var HQCHART_VERSION="1.1.15120";
153721
153879
 
153722
153880
  function PrintHQChartVersion()
153723
153881
  {
@@ -153873,6 +154031,7 @@ export default {
153873
154031
  JSCHART_MENU_ID:JSCHART_MENU_ID,
153874
154032
  JSCHART_TRADE_STATUS_ID:JSCHART_TRADE_STATUS_ID, //交易状态
153875
154033
  JSCHART_CORSSCURSOR_STATUS_ID:JSCHART_CORSSCURSOR_STATUS_ID, //十字光标状态
154034
+ CONDITION_PERIOD:CONDITION_PERIOD, //指标周期条件枚举
153876
154035
  },
153877
154036
  }
153878
154037