hqchart 1.1.15104 → 1.1.15111

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
 
@@ -6714,12 +6714,6 @@ JSChart.RegisterScriptIndexChart=function(name, option)
6714
6714
  return g_ScriptIndexChartFactory.Add(name, option);
6715
6715
  }
6716
6716
 
6717
- //注册设置对话框类
6718
- //option:{ Create:创建类方法 }
6719
- JSChart.RegisterDialogClass=function(name, option)
6720
- {
6721
- return g_DialogFactory.Add(name, option);
6722
- }
6723
6717
 
6724
6718
  //注册框架类
6725
6719
  JSChart.RegisterChartFrameClass=function(name, option)
@@ -16610,6 +16604,55 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
16610
16604
  if (!this.PressKeyboardConfig) return false;
16611
16605
  if (!this.PressKeyboardConfig.PauseUpdate) return false;
16612
16606
 
16607
+ return true;
16608
+ },
16609
+
16610
+ //启动|关闭锁指标 aryIndex=[{ IndexID:指标ID, LockData:{IsLocked:} } ]
16611
+ this.EnableLockIndex=function(aryIndex)
16612
+ {
16613
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryIndex)) return false;
16614
+
16615
+ var mapIndex=new Map();
16616
+ for(var i=0;i<aryIndex.length;++i)
16617
+ {
16618
+ var item=aryIndex[i];
16619
+ if (item.IndexID && item.LockData) mapIndex.set(item.IndexID, item);
16620
+ }
16621
+
16622
+ var aryUpdate=[];
16623
+ for(var i=0; i<this.WindowIndex.length; ++i)
16624
+ {
16625
+ var item=this.WindowIndex[i];
16626
+ if (!item) continue;
16627
+ if (mapIndex.has(item.ID))
16628
+ {
16629
+ var mapItem=mapIndex.get(item.ID);
16630
+ item.SetLock(mapItem.LockData); //设置锁
16631
+ aryUpdate.push({ ID:i});
16632
+ }
16633
+ }
16634
+
16635
+ for(var i=0; i<this.Frame.SubFrame.length; ++i)
16636
+ {
16637
+ var item=this.Frame.SubFrame[i];
16638
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex)) continue;
16639
+
16640
+ for(var j=0; j<item.OverlayIndex.length; ++j)
16641
+ {
16642
+ var overlayItem=item.OverlayIndex[j];
16643
+ var script=overlayItem.Script;
16644
+ if (mapIndex.has(script.ID))
16645
+ {
16646
+ var mapItem=mapIndex.get(script.ID);
16647
+ script.SetLock(mapItem.LockData);
16648
+ aryUpdate.push({OverlayID:overlayItem.Identify});
16649
+ }
16650
+ }
16651
+ }
16652
+
16653
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryUpdate)) return false;
16654
+
16655
+ this.UpdateWindowIndexV2(aryUpdate);
16613
16656
  return true;
16614
16657
  }
16615
16658
  }
@@ -17259,8 +17302,8 @@ function IChartFramePainting()
17259
17302
  this.XSplitOperator; //X轴分割
17260
17303
  this.Data; //主数据
17261
17304
 
17262
- this.IsLocked=false; //是否上锁
17263
- this.LockPaint = null;
17305
+ this.LockPaint = null; //锁图形
17306
+ this.IndexLock=new IndexLockData(); //指标锁
17264
17307
 
17265
17308
  this.YSpecificMaxMin=null; //指定Y轴最大最小值
17266
17309
  this.IsShowBorder = true; //是否显示边框
@@ -17532,15 +17575,8 @@ function IChartFramePainting()
17532
17575
 
17533
17576
  this.DrawLock=function()
17534
17577
  {
17535
- if (this.IsLocked)
17536
- {
17537
- if (this.LockPaint == null)
17538
- this.LockPaint = g_ChartPaintFactory.Create("ChartLock");//new ChartLock();
17539
- this.LockPaint.Canvas=this.Canvas;
17540
- this.LockPaint.ChartBorder=this.ChartBorder;
17541
- this.LockPaint.ChartFrame=this;
17542
- this.LockPaint.Draw(true);
17543
- }
17578
+ if (!this.LockPaint) return;
17579
+ this.LockPaint.Draw(true);
17544
17580
  }
17545
17581
 
17546
17582
  this.DrawLogo=function()
@@ -17596,46 +17632,28 @@ function IChartFramePainting()
17596
17632
  }
17597
17633
  }
17598
17634
 
17599
- this.CalculateLock=function()
17635
+ this.CalculateLock=function(aryData)
17600
17636
  {
17601
- if (this.IsLocked)
17602
- {
17603
- if (this.LockPaint == null)
17604
- this.LockPaint = g_ChartPaintFactory.Create("ChartLock"); // new ChartLock();
17605
- this.LockPaint.Canvas=this.Canvas;
17606
- this.LockPaint.ChartBorder=this.ChartBorder;
17607
- this.LockPaint.ChartFrame=this;
17608
- this.LockPaint.Draw(false);
17609
- }
17637
+ this.LockPaint.SetData(aryData);
17638
+ this.LockPaint.Draw(false);
17610
17639
  }
17611
17640
 
17612
- //设施上锁
17613
- this.SetLock=function(lockData)
17641
+ //创建锁图形
17642
+ this.CreateLockPaint=function()
17614
17643
  {
17615
- if (!lockData) //空数据不上锁
17616
- {
17617
- this.IsLocked=false;
17618
- return;
17619
- }
17620
-
17621
- this.IsLocked=true;
17622
- if (!this.LockPaint) this.LockPaint=g_ChartPaintFactory.Create("ChartLock"); //new ChartLock(); //创建锁
17644
+ this.LockPaint = g_ChartPaintFactory.Create("ChartLock"); // new ChartLock();
17645
+ this.LockPaint.Canvas=this.Canvas;
17646
+ this.LockPaint.ChartBorder=this.ChartBorder;
17647
+ this.LockPaint.ChartFrame=this;
17648
+ }
17623
17649
 
17624
- if (lockData.Callback) this.LockPaint.Callback=lockData.Callback; //回调
17625
- if (lockData.IndexName) this.LockPaint.IndexName=lockData.IndexName; //指标名字
17626
- if (lockData.IndexID) this.LockPaint.IndexID=lockData.IndexID; //指标ID
17627
- if (lockData.ID) this.LockPaint.LockID=lockData.ID; //锁ID
17628
- if (lockData.BG) this.LockPaint.BGColor=lockData.BG; //背景色
17629
- if (lockData.Text) this.LockPaint.Title= lockData.Text;
17630
- if (lockData.TextColor) this.LockPaint.TextColor=lockData.TextColor;
17631
- if (lockData.Font) this.LockPaint.Font=lockData.Font;
17632
- if (lockData.Count) this.LockPaint.LockCount=lockData.Count;
17633
- if (lockData.MinWidth>0) this.LockPaint.MinWidth=lockData.MinWidth;
17650
+ this.SetLock=function(lockData)
17651
+ {
17652
+ this.IndexLock.SetData(lockData);
17634
17653
  }
17635
17654
 
17636
17655
  this.GetLockRect=function()
17637
17656
  {
17638
- if (!this.IsLocked) return null;
17639
17657
  if (!this.LockPaint) return null;
17640
17658
  return this.LockPaint.LockRect;
17641
17659
  }
@@ -22672,6 +22690,13 @@ function OverlayMinuteFrame()
22672
22690
  this.IsShareY=false; //使用和主框架公用Y轴
22673
22691
  this.IsCalculateYMaxMin=true; //是否计算Y最大最小值
22674
22692
  this.IsShowMainFrame=0; //是否显示在主框架坐标上 1=左边 2=右边
22693
+ this.MainFrame=null; //主框架
22694
+
22695
+ this.GetLockRect=function()
22696
+ {
22697
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
22698
+ return this.MainFrame.GetLockRect();
22699
+ }
22675
22700
 
22676
22701
  this.Draw=function()
22677
22702
  {
@@ -22730,6 +22755,13 @@ function OverlayMinuteHScreenFrame()
22730
22755
 
22731
22756
  this.ClassName="OverlayMinuteHScreenFrame";
22732
22757
  this.IsShow=true; //坐标是否显示
22758
+ this.MainFrame=null; //主框架
22759
+
22760
+ this.GetLockRect=function()
22761
+ {
22762
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
22763
+ return this.MainFrame.GetLockRect();
22764
+ }
22733
22765
 
22734
22766
  this.Draw=function()
22735
22767
  {
@@ -24117,6 +24149,12 @@ function OverlayKLineFrame()
24117
24149
  }
24118
24150
  }
24119
24151
 
24152
+ this.GetLockRect=function()
24153
+ {
24154
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
24155
+ return this.MainFrame.GetLockRect();
24156
+ }
24157
+
24120
24158
  this.Draw=function()
24121
24159
  {
24122
24160
  this.Buttons=[];
@@ -25429,6 +25467,12 @@ function OverlayKLineHScreenFrame()
25429
25467
  this.TitleColor=g_JSChartResource.OverlayFrame.TitleColor;
25430
25468
  this.TitleFont=g_JSChartResource.OverlayFrame.TitleFont;
25431
25469
 
25470
+ this.GetLockRect=function()
25471
+ {
25472
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
25473
+ return this.MainFrame.GetLockRect();
25474
+ }
25475
+
25432
25476
  this.Draw=function()
25433
25477
  {
25434
25478
  this.SplitXYCoordinate();
@@ -26635,7 +26679,7 @@ function HQTradeFrame()
26635
26679
 
26636
26680
  this.DrawLock=function()
26637
26681
  {
26638
- for (var i in this.SubFrame)
26682
+ for (var i=0; i<this.SubFrame.length; ++i)
26639
26683
  {
26640
26684
  var item = this.SubFrame[i];
26641
26685
  item.Frame.DrawLock();
@@ -26657,10 +26701,21 @@ function HQTradeFrame()
26657
26701
 
26658
26702
  this.CalculateLock=function()
26659
26703
  {
26660
- for (var i in this.SubFrame)
26704
+ for (var i=0, j=0; i<this.SubFrame.length; ++i)
26661
26705
  {
26662
26706
  var item = this.SubFrame[i];
26663
- item.Frame.CalculateLock();
26707
+ var aryLockData=[];
26708
+ if (item.Frame.IndexLock.IsLocked) aryLockData.push({ Data:item.Frame.IndexLock, IsOverlay:false });
26709
+ for(j=0; j<item.OverlayIndex.length; ++j)
26710
+ {
26711
+ var subItem=item.OverlayIndex[j];
26712
+ if (subItem.Frame.IndexLock.IsLocked===true)
26713
+ {
26714
+ aryLockData.push({ Data:subItem.Frame.IndexLock, IsOverlay:true } );
26715
+ }
26716
+ }
26717
+
26718
+ item.Frame.CalculateLock(aryLockData);
26664
26719
  }
26665
26720
  }
26666
26721
 
@@ -42807,6 +42862,13 @@ function ChartStickLine()
42807
42862
  xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
42808
42863
  }
42809
42864
 
42865
+ var lockRect=this.GetLockRect();
42866
+ if (lockRect)
42867
+ {
42868
+ if (this.IsHScreen) chartright=lockRect.Top;
42869
+ else chartright=lockRect.Left;
42870
+ }
42871
+
42810
42872
  var isMinute=this.IsMinuteFrame();
42811
42873
 
42812
42874
  if (isMinute)
@@ -51882,6 +51944,39 @@ function ChartDrawFlagText()
51882
51944
  }
51883
51945
  }
51884
51946
 
51947
+ function IndexLockData()
51948
+ {
51949
+ this.IsLocked=false;
51950
+ this.LockCount = 20; // 锁最新的几个数据
51951
+ this.BGColor = g_JSChartResource.IndexLock.BGColor;
51952
+ this.TextColor = g_JSChartResource.IndexLock.TextColor;
51953
+ this.Font = g_JSChartResource.IndexLock.Font;
51954
+ this.Title = g_JSChartResource.IndexLock.Title;
51955
+ this.LockID; //锁ID
51956
+ this.IndexName; //指标名字
51957
+ this.IndexID; //指标ID
51958
+
51959
+ this.SetData=function(lockData)
51960
+ {
51961
+ if (!lockData) //空 解锁
51962
+ {
51963
+ this.IsLocked=false;
51964
+ return;
51965
+ }
51966
+
51967
+ this.IsLocked=true;
51968
+ if (lockData.Callback) this.Callback=lockData.Callback; //回调 !!废弃
51969
+ if (lockData.IndexName) this.IndexName=lockData.IndexName; //指标名字
51970
+ if (lockData.IndexID) this.IndexID=lockData.IndexID; //指标ID
51971
+ if (lockData.ID) this.LockID=lockData.ID; //锁ID
51972
+ if (lockData.BG) this.BGColor=lockData.BG; //背景色
51973
+ if (lockData.Text) this.Title= lockData.Text;
51974
+ if (lockData.TextColor) this.TextColor=lockData.TextColor;
51975
+ if (lockData.Font) this.Font=lockData.Font;
51976
+ if (lockData.Count) this.LockCount=lockData.Count;
51977
+ }
51978
+ }
51979
+
51885
51980
  //锁 支持横屏
51886
51981
  function ChartLock()
51887
51982
  {
@@ -51890,34 +51985,79 @@ function ChartLock()
51890
51985
  delete this.newMethod;
51891
51986
 
51892
51987
  this.ClassName="ChartLock";
51988
+ this.AryData=null;
51989
+ this.LockRect=null; //上锁区域
51990
+
51893
51991
  this.LockCount = 20; // 锁最新的几个数据
51894
51992
  this.BGColor = g_JSChartResource.IndexLock.BGColor;
51895
51993
  this.TextColor = g_JSChartResource.IndexLock.TextColor;
51896
51994
  this.Font = g_JSChartResource.IndexLock.Font;
51897
51995
  this.Title = g_JSChartResource.IndexLock.Title;
51898
- this.LockRect=null; //上锁区域
51996
+
51899
51997
  this.LockID; //锁ID
51900
51998
  this.Callback; //回调
51901
51999
  this.IndexName; //指标名字
51902
52000
  this.IndexID; //指标ID
51903
52001
 
52002
+ this.SetData=function(aryData)
52003
+ {
52004
+ this.AryData=aryData;
52005
+
52006
+ if (IFrameSplitOperator.IsNonEmptyArray(this.AryData))
52007
+ {
52008
+ var item=this.AryData[0].Data; //取第一个锁
52009
+
52010
+ this.LockCount = item.LockCount;
52011
+ this.BGColor = item.BGColor
52012
+ this.TextColor = item.TextColor
52013
+ this.Font = item.Font
52014
+ this.Title = item.Title
52015
+ this.LockID=item.LockID; //锁ID
52016
+ this.Callback=item.Callback; //回调
52017
+ this.IndexName=item.IndexName; //指标名字
52018
+ this.IndexID=item.IndexID; //指标ID
52019
+ }
52020
+ }
51904
52021
 
51905
52022
  this.CalculateTextSize=function(aryText, defaultFont, out)
51906
52023
  {
51907
52024
  if (!out || !IFrameSplitOperator.IsNonEmptyArray(aryText)) return false;
51908
52025
 
51909
52026
  this.Canvas.font=defaultFont;
51910
- var lineHeight=this.Canvas.measureText("擎").width; //行高
52027
+ var defaultLineHeight=this.Canvas.measureText("擎").width; //行高
52028
+ var lineHeight=defaultLineHeight;
51911
52029
  var height=0, width=0;
51912
52030
  out.AryText=[];
51913
52031
  for(var i=0;i<aryText.length;++i)
51914
52032
  {
51915
52033
  var item=aryText[i];
51916
- if (!item || !item.Text) continue;
51917
- var textWidth=this.Canvas.measureText(item.Text).width;
52034
+ if (!item || (!item.Text && !item.Image)) continue;
52035
+ if (item.Image)
52036
+ {
52037
+ textWidth=item.Image.Width;
52038
+ lineHeight=item.Image.Height;
52039
+ }
52040
+ else
52041
+ {
52042
+ if (item.Font)
52043
+ {
52044
+ this.Canvas.font=item.Font;
52045
+ lineHeight=this.Canvas.measureText("擎").width;
52046
+ }
52047
+ else
52048
+ {
52049
+ this.Canvas.font=defaultFont;
52050
+ lineHeight=defaultLineHeight;
52051
+ }
52052
+
52053
+ var textWidth=this.Canvas.measureText(item.Text).width;
52054
+ }
51918
52055
 
51919
52056
  var lineItem={ Text:item.Text, Width:textWidth, Height:lineHeight, Color:item.Color, TextMargin:{ Top:0, Bottom:0, Left:0, Right:0 }, YOffset:0 };
51920
52057
  if (IFrameSplitOperator.IsNumber(item.YOffset)) lineItem.YOffset=item.YOffset;
52058
+ if (item.Font) lineItem.Font=item.Font;
52059
+ if (IFrameSplitOperator.IsNumber(item.Align)) lineItem.Align=item.Align; //左右对齐 0=左 1=中 2=右
52060
+ if (item.Image) lineItem.Image=item.Image;
51921
52061
  if (item.TextMargin)
51922
52062
  {
51923
52063
  var margin=item.TextMargin;
@@ -51945,12 +52085,7 @@ function ChartLock()
51945
52085
  this.Draw=function(bDraw)
51946
52086
  {
51947
52087
  this.LockRect=null;
51948
- if (!bDraw) return;
51949
- if (this.NotSupportMessage)
51950
- {
51951
- this.DrawNotSupportmessage();
51952
- return;
51953
- }
52088
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryData)) return;
51954
52089
 
51955
52090
  var bHScreen=this.ChartFrame.IsHScreen;
51956
52091
  var bMinute=this.IsMinuteFrame();
@@ -51996,24 +52131,33 @@ function ChartLock()
51996
52131
  var rtBG={ Left:border.Left, Right:border.RightEx, Top:left, Bottom:border.Bottom };
51997
52132
  rtBG.Width=rtBG.Right-rtBG.Left;
51998
52133
  rtBG.Height=rtBG.Bottom-rtBG.Top;
51999
-
52000
- var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
52001
- this.Canvas.fillStyle =bgColor;
52002
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
52003
52134
  this.LockRect=rtBG; //保存上锁区域
52135
+
52136
+ if (bDraw)
52137
+ {
52138
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
52139
+ this.Canvas.fillStyle =bgColor;
52140
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
52141
+ }
52004
52142
  }
52005
52143
  else
52006
52144
  {
52007
52145
  var rtBG={ Left:left, Right:border.RightEx, Top:border.TopTitle, Bottom:border.Bottom };
52008
52146
  rtBG.Width=rtBG.Right-rtBG.Left;
52009
52147
  rtBG.Height=rtBG.Bottom-rtBG.Top;
52010
- //上下渐变
52011
- var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
52012
- this.Canvas.fillStyle =bgColor;
52013
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
52014
52148
  this.LockRect=rtBG; //保存上锁区域
52149
+
52150
+ if (bDraw)
52151
+ {
52152
+ //上下渐变
52153
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
52154
+ this.Canvas.fillStyle =bgColor;
52155
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
52156
+ }
52015
52157
  }
52016
52158
 
52159
+ if (!bDraw) return;
52160
+
52017
52161
  var aryText=null;
52018
52162
  if (Array.isArray(this.Title)) aryText=this.Title;
52019
52163
  else aryText=[{Text:this.Title}];
@@ -52030,40 +52174,54 @@ function ChartLock()
52030
52174
  var top=rtBG.Top+(rtBG.Height-outSize.Width)/2;
52031
52175
  if (outSize.Width>rtBG.Height) top=rtBG.Bottom-outSize.Width;
52032
52176
  var left=rtBG.Left+(rtBG.Width-outSize.Height)/2;
52033
-
52034
52177
  this.Canvas.save();
52035
52178
  this.Canvas.translate(left, top);
52036
52179
  this.Canvas.rotate(90 * Math.PI / 180);
52037
- var yText=0,xText=0;
52038
- for(var i=0;i<outSize.AryText.length;++i)
52039
- {
52040
- var item=outSize.AryText[i];
52041
- if (item.Color) this.Canvas.fillStyle=item.Color;
52042
- else this.Canvas.fillStyle=this.TextColor;
52043
-
52044
- yText+=item.Height;
52045
- this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52046
- }
52047
-
52048
- this.Canvas.restore();
52180
+ var left=0,top=0;
52049
52181
  }
52050
52182
  else
52051
52183
  {
52052
52184
  var left=rtBG.Left+(rtBG.Width-outSize.Width)/2;
52053
52185
  if (outSize.Width>rtBG.Width) left=rtBG.Right-outSize.Width;
52054
52186
  var top=rtBG.Top+(rtBG.Height-outSize.Height)/2;
52055
-
52056
- var yText=top, xText=left;
52057
- for(var i=0;i<outSize.AryText.length;++i)
52187
+ }
52188
+
52189
+ var yText=top, xText=left;
52190
+ for(var i=0;i<outSize.AryText.length;++i)
52191
+ {
52192
+ var item=outSize.AryText[i];
52193
+ xText=left;
52194
+ if (item.Image)
52195
+ {
52196
+ if (item.Align===1)
52197
+ {
52198
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52199
+ }
52200
+
52201
+ this.Canvas.drawImage(item.Image.Data, xText, yText, item.Image.Width, item.Image.Height);
52202
+
52203
+ yText+=item.Height;
52204
+ }
52205
+ else
52058
52206
  {
52059
- var item=outSize.AryText[i];
52060
52207
  if (item.Color) this.Canvas.fillStyle=item.Color;
52061
52208
  else this.Canvas.fillStyle=this.TextColor;
52062
52209
 
52210
+ if (item.Font) this.Canvas.font = item.Font;
52211
+ else this.Canvas.font = this.Font;
52212
+
52063
52213
  yText+=item.Height;
52214
+
52215
+ if (item.Align===1)
52216
+ {
52217
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
52218
+ }
52219
+
52064
52220
  this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
52065
- }
52221
+ }
52066
52222
  }
52223
+
52224
+ if (bHScreen) this.Canvas.restore();
52067
52225
  }
52068
52226
 
52069
52227
  //x,y是否在上锁区域
@@ -52073,7 +52231,7 @@ function ChartLock()
52073
52231
 
52074
52232
  if (Path2DHelper.PtInRect(x,y,this.LockRect))
52075
52233
  {
52076
- tooltip.Data={ ID:this.LockID, Callback:this.Callback, IndexName:this.IndexName, IndexID:this.IndexID };
52234
+ tooltip.Data={ ID:this.LockID, Callback:this.Callback, IndexName:this.IndexName, IndexID:this.IndexID, Data:this.AryData };
52077
52235
  tooltip.ChartPaint=this;
52078
52236
  return true;
52079
52237
  }
@@ -87030,6 +87188,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87030
87188
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
87031
87189
  frame.GlobalOption=this.GlobalOption;
87032
87190
  frame.CreateDivFrameToolbar(this, i, this.UIElement.parentNode);
87191
+ frame.CreateLockPaint();
87033
87192
 
87034
87193
  frame.HorizontalMax=20;
87035
87194
  frame.HorizontalMin=10;
@@ -87131,6 +87290,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87131
87290
  frame.XSplitOperator.Symbol=this.Symbol;
87132
87291
  frame.XSplitOperator.Period=this.Period;
87133
87292
  frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
87293
+ frame.CreateLockPaint();
87134
87294
 
87135
87295
  //K线数据绑定
87136
87296
  var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;
@@ -89590,7 +89750,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
89590
89750
 
89591
89751
 
89592
89752
  subFrame.YSpecificMaxMin=null; //清空指定最大最小值
89593
- subFrame.IsLocked=false; //解除上锁
89594
89753
  subFrame.YSplitScale = null; //清空固定刻度
89595
89754
  subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType; //还原Y坐标分割模式
89596
89755
 
@@ -89888,7 +90047,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
89888
90047
 
89889
90048
 
89890
90049
  this.Frame.SubFrame[windowIndex].Frame.YSpecificMaxMin=null; //清空指定最大最小值
89891
- this.Frame.SubFrame[windowIndex].Frame.IsLocked=false; //解除上锁
89892
90050
  this.Frame.SubFrame[windowIndex].Frame.YSplitScale = null; //清空固定刻度
89893
90051
 
89894
90052
  this.ChartPaint=paint;
@@ -89946,7 +90104,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
89946
90104
  }
89947
90105
  else if (obj.Script) //动态执行脚本
89948
90106
  {
89949
- indexInfo={ Script:obj.Script, ID:obj.indexName, Name:obj.indexName};
90107
+ indexInfo={ Script:obj.Script, ID:obj.IndexName, Name:obj.IndexName};
89950
90108
  if (obj.Name) indexInfo.Name=obj.Name;
89951
90109
  }
89952
90110
  else
@@ -90281,7 +90439,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
90281
90439
  this.DeleteIndexPaint(i);
90282
90440
  var frame=this.Frame.SubFrame[i];
90283
90441
  frame.YSpecificMaxMin=null;
90284
- frame.IsLocked=false;
90285
90442
  frame.YSplitScale = null;
90286
90443
  }
90287
90444
 
@@ -90661,35 +90818,16 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
90661
90818
  }
90662
90819
  }
90663
90820
 
90664
- //锁|解锁指标 { Index:指标名字,IsLocked:是否要锁上,Callback:回调 }
90665
- this.LockIndex=function(lockData)
90666
- {
90667
- if (!lockData) return;
90668
- if (!lockData.IndexName) return;
90669
-
90670
- for(let i in this.WindowIndex)
90671
- {
90672
- let item=this.WindowIndex[i];
90673
- if (!item) conintue;
90674
- if (item.Name==lockData.IndexName)
90675
- {
90676
- item.SetLock(lockData);
90677
- this.Update();
90678
- break;
90679
- }
90680
- }
90681
- }
90682
-
90683
90821
  this.TryClickLock=function(x,y)
90684
90822
  {
90685
90823
  for(var i=0;i<this.Frame.SubFrame.length; ++i)
90686
90824
  {
90687
90825
  var item=this.Frame.SubFrame[i];
90688
- if (!item.Frame.IsLocked) continue;
90689
- if (!item.Frame.LockPaint) continue;
90826
+ var chartLock=item.Frame.LockPaint;
90827
+ if (!chartLock || !chartLock.LockRect) continue;
90690
90828
 
90691
90829
  var tooltip=new TooltipData();
90692
- if (!item.Frame.LockPaint.GetTooltipData(x,y,tooltip)) continue;
90830
+ if (!chartLock.GetTooltipData(x,y,tooltip)) continue;
90693
90831
 
90694
90832
  tooltip.HQChart=this;
90695
90833
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);
@@ -96695,6 +96833,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96695
96833
  frame.XPointCount=243;
96696
96834
  frame.HQChart=this;
96697
96835
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
96836
+ frame.CreateLockPaint();
96698
96837
 
96699
96838
  if (i>=2)
96700
96839
  {
@@ -96806,6 +96945,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96806
96945
  frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
96807
96946
  frame.XSplitOperator.Symbol=this.Symbol;
96808
96947
  frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
96948
+ frame.CreateLockPaint();
96809
96949
 
96810
96950
  if (this.DayCount>1)
96811
96951
  {
@@ -96931,7 +97071,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96931
97071
  //清空指定最大最小值
96932
97072
 
96933
97073
  subFrame.YSpecificMaxMin=null;
96934
- subFrame.IsLocked=false; //解除上锁
96935
97074
  subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType; //还原Y坐标分割模式
96936
97075
 
96937
97076
  this.ChartPaint=paint;
@@ -97164,7 +97303,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
97164
97303
  this.DeleteIndexPaint(i);
97165
97304
  var frame=this.Frame.SubFrame[i];
97166
97305
  frame.YSpecificMaxMin=null;
97167
- frame.IsLocked=false;
97168
97306
  frame.YSplitScale = null;
97169
97307
  }
97170
97308
 
@@ -99411,9 +99549,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
99411
99549
  {
99412
99550
  overlayFrame=new OverlayIndexItem();
99413
99551
  overlayFrame.Identify='Position_Line_Frame';
99414
-
99415
- if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
99416
- else frame=new OverlayMinuteHScreenFrame();
99552
+ frame=this.CreateOverlayFrame();
99553
+ //if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
99554
+ //else frame=new OverlayMinuteHScreenFrame();
99417
99555
 
99418
99556
  frame.Canvas=this.Canvas;
99419
99557
  frame.MainFrame=subFrame.Frame;
@@ -99596,9 +99734,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
99596
99734
  var subFrame=this.Frame.SubFrame[windowIndex];
99597
99735
  var overlayFrame=new OverlayIndexItem();
99598
99736
  if (obj.Identify) overlayFrame.Identify=obj.Identify; //由外部指定id
99599
- var frame=null;
99600
- if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
99601
- else frame=new OverlayMinuteHScreenFrame();
99737
+ var frame=this.CreateOverlayFrame();
99738
+ //if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
99739
+ //else frame=new OverlayMinuteHScreenFrame();
99602
99740
  frame.Canvas=this.Canvas;
99603
99741
  frame.MainFrame=subFrame.Frame;
99604
99742
  frame.ChartBorder=subFrame.Frame.ChartBorder;
@@ -100518,13 +100656,22 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
100518
100656
  for(var i=0;i<this.Frame.SubFrame.length; ++i)
100519
100657
  {
100520
100658
  var item=this.Frame.SubFrame[i];
100521
- if (!item.Frame.IsLocked) continue;
100522
- if (!item.Frame.LockPaint) continue;
100659
+ var chartLock=item.Frame.LockPaint;
100660
+ if (!chartLock || !chartLock.LockRect) continue;
100523
100661
 
100524
100662
  var tooltip=new TooltipData();
100525
- if (!item.Frame.LockPaint.GetTooltipData(x,y,tooltip)) continue;
100663
+ if (!chartLock.GetTooltipData(x,y,tooltip)) continue;
100526
100664
 
100527
100665
  tooltip.HQChart=this;
100666
+
100667
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);
100668
+ if (event && event.Callback)
100669
+ {
100670
+ var sendData={ FrameID:item.Frame.Identify, Data:tooltip };
100671
+ event.Callback(event,sendData,this);
100672
+ }
100673
+
100674
+
100528
100675
  if (tooltip.Data.Callback) tooltip.Data.Callback(tooltip);
100529
100676
  return true;
100530
100677
  }
@@ -105059,239 +105206,9 @@ function IsFundSymbol(symbol)
105059
105206
  return false;
105060
105207
  }
105061
105208
 
105062
- //设置对话框工厂类
105063
- function DialogFactory()
105064
- {
105065
- //[key:name, { Create:function(divElement) { return new class(divElement); }} ]
105066
- this.DataMap=new Map(
105067
- [
105068
- ["ChartPictureSettingMenu", { Create:function(divElement) { return new ChartPictureSettingMenu(divElement); } }],
105069
- ]);
105070
-
105071
- this.Create=function(name, option)
105072
- {
105073
- if (!this.DataMap.has(name))
105074
- {
105075
- JSConsole.Chart.Warn(`[DialogFactory::Create] can't find class=${name}.`);
105076
- return null;
105077
- }
105078
-
105079
- var item=this.DataMap.get(name);
105080
- return item.Create(option);
105081
- }
105082
-
105083
- this.Add=function(name, option)
105084
- {
105085
- this.DataMap.set(name, { Create:option.Create } );
105086
- }
105087
- }
105088
-
105089
- var g_DialogFactory=new DialogFactory();
105090
-
105091
- //设置窗口基类
105092
- function IDivDialog(divElement)
105093
- {
105094
- this.DivElement=divElement; //父节点
105095
- this.ID=null; //div id
105096
- this.TimeOut=null; //定时器
105097
-
105098
- //隐藏窗口
105099
- this.Hide=function()
105100
- {
105101
- $("#"+this.ID).hide();
105102
- }
105103
-
105104
- //显示窗口
105105
- this.Show=function(left,top,width,height)
105106
- {
105107
- var cssData={display:'block'};
105108
- if (IFrameSplitOperator.IsNumber(left)) cssData.left=left+'px';
105109
- if (IFrameSplitOperator.IsNumber(top)) cssData.top=top+'px';
105110
- if (IFrameSplitOperator.IsNumber(width)) cssData.width=width+'px';
105111
- if (IFrameSplitOperator.IsNumber(height)) cssData.height=height+'px';
105112
-
105113
- $("#"+this.ID).css(cssData);
105114
- }
105115
- }
105116
-
105117
- //等待动画窗口
105118
- function WaitDialog(divElement)
105119
- {
105120
- this.newMethod=IDivDialog; //派生
105121
- this.newMethod(divElement);
105122
- delete this.newMethod;
105123
-
105124
- this.Title='加载中......';
105125
- this.Dialog;
105126
-
105127
- //隐藏窗口
105128
- this.Close=function()
105129
- {
105130
- if (this.Dialog)
105131
- {
105132
- this.DivElement.removeChild(this.Dialog);
105133
- this.Dialog=null;
105134
- }
105135
- }
105136
-
105137
- this.SetTitle=function(title)
105138
- {
105139
- this.Title=title;
105140
- if (!this.Dialog) return;
105141
- //TODO: 更新标题数据
105142
- }
105143
-
105144
- this.Create=function()
105145
- {
105146
- this.ID=Guid();
105147
- var div=document.createElement('div');
105148
- div.className='jchart-wait-box';
105149
- div.id=this.ID;
105150
- div.innerHTML=
105151
- `<div class='parameter jchart-kline-match-box'>
105152
- <div class='parameter-header'>
105153
- <span>${this.Title}</span>
105154
- </div>
105155
- </div>`.trim();
105156
-
105157
- this.DivElement.appendChild(div);
105158
- this.Dialog=div;
105159
- }
105160
-
105161
- //显示
105162
- this.DoModal=function(event)
105163
- {
105164
- this.Title=event.data.Title;
105165
- var chart=event.data.Chart;
105166
- if (this.ID==null) this.Create(); //第1次 需要创建div
105167
-
105168
- //居中显示
105169
- var border=chart.Frame.ChartBorder;
105170
- var scrollPos=GetScrollPosition();
105171
- var left=border.GetWidth()/2;
105172
- var top=border.GetHeight()/2;
105173
-
105174
- this.Show(left,top,200,40); //显示
105175
- }
105176
- }
105177
-
105178
- //画图工具 单个图形设置
105179
- function ChartPictureSettingMenu(divElement)
105180
- {
105181
- this.newMethod=IDivDialog; //派生
105182
- this.newMethod(divElement);
105183
- delete this.newMethod;
105184
-
105185
- this.HQChart;
105186
- this.ChartPicture;
105187
- this.SubToolsDiv;
105188
- this.SettingMenu;
105189
- this.SettingPV;
105190
-
105191
- this.DoModal=function(event)
105192
- {
105193
- var $body;
105194
- if (!this.SubToolsDiv)
105195
- {
105196
- this.ID=Guid();
105197
- var div=document.createElement("div");
105198
- div.className='subTolls';
105199
- div.id=this.ID;
105200
- this.DivElement.appendChild(div);
105201
- //$body = $("."+event.data.HQChart.ClassName).context.body;
105202
- //$body.append(div);
105203
- this.SubToolsDiv=div;
105204
- }
105205
- this.HQChart=event.data.HQChart;
105206
- this.ChartPicture=event.data.ChartPicture;
105207
-
105208
- var pixelTatio = GetDevicePixelRatio();
105209
- var frame=this.HQChart.Frame.SubFrame[0].Frame;
105210
- // var top=frame.ChartBorder.GetTopTitle();
105211
- var top=frame.ChartBorder.Top + 40;
105212
- // var right=frame.ChartBorder.GetRight();
105213
- var right=frame.ChartBorder.Right;
105214
- var left=frame.ChartBorder.GetLeft();
105215
- var className = this.ChartPicture.ClassName; //='ChartDrawPictureText'时加“设置”
105216
- var lineColor=this.ChartPicture.LineColor;
105217
- if (lineColor.indexOf("rgb(")==0 || lineColor.indexOf("RGB(")==0)
105218
- lineColor=IChartDrawPicture.RGBToHex(lineColor.toLowerCase());
105219
- var toolsDiv = "";
105220
- if(className === 'ChartDrawPictureText')
105221
- {
105222
- toolsDiv = '<span class="changes-color" title="改变图形颜色">'+
105223
- '<i class="iconfont icon-bianji"></i>'+
105224
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'">'+
105225
- '</span>\n' +
105226
- '<span class="subtool-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
105227
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
105228
- }
105229
- else if (className=="ChartDrawVolProfile")
105230
- {
105231
- toolsDiv='<span class="vp-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
105232
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
105233
- }
105234
- else
105235
- {
105236
- toolsDiv =
105237
- '<p class="changes-color" title="改变图形颜色"><i class="iconfont icon-bianji"></i>' +
105238
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'"></p>\n' +
105239
- ' <p class="subtool-del"><i class="iconfont icon-recycle_bin"></i></p>';
105240
- }
105241
-
105242
-
105243
- this.SubToolsDiv.style.right = right/pixelTatio + "px";
105244
- this.SubToolsDiv.style.top = top/pixelTatio + "px";
105245
- this.SubToolsDiv.innerHTML = toolsDiv;
105246
- this.SubToolsDiv.style.position = "absolute";
105247
- this.SubToolsDiv.style.display = "block";
105248
-
105249
- var hqChart = this.HQChart;
105250
- var picture = this.ChartPicture;
105251
- var subToolDiv = this.SubToolsDiv;
105252
- $(".subtool-del").click(function(){
105253
- hqChart.SelectChartDrawPicture=null;
105254
- hqChart.ClearChartDrawPicture(picture);
105255
- // subToolDiv.innerHTML = "";
105256
- $(".subTolls").css("display","none");
105257
- });
105258
- var self = this;
105259
- $(".subtool-set").click(function(){
105260
- $(self.SubToolsDiv).hide();
105261
- //创建div设置窗口
105262
- if (!self.SettingMenu) self.SettingMenu=new ChartPictureTextSettingMenu(frame.ChartBorder.UIElement.parentNode);
105263
-
105264
- self.SettingMenu.ChartPicture=picture;
105265
- self.SettingMenu.HQChart=hqChart;
105266
- self.SettingMenu.Position={Left:right + 80,Top:top + 20};
105267
- self.SettingMenu.DoModal();
105268
- });
105269
- $(".changes-color").click(function () {
105270
- document.getElementById('color').click();
105271
- $(".change-color").change(function () {
105272
- var color = $(".change-color").val();
105273
- picture.LineColor = color;
105274
- picture.PointColor = color;
105275
- if (hqChart.ChartDrawStorage) hqChart.ChartDrawStorage.SaveDrawData(picture); //保存下
105276
- });
105277
- });
105278
-
105279
- //成交量分布图设置
105280
- $(".vp-set").click(function()
105281
- {
105282
- if (!self.SettingPV) self.SettingPV=new ChartPictureVolProfileSettingMenu(frame.ChartBorder.UIElement.parentNode);
105283
- self.SettingPV.ChartPicture=picture;
105284
- self.SettingPV.HQChart=hqChart;
105285
- self.SettingPV.Position={Left:right + 80,Top:top + 20};
105286
- self.SettingPV.DoModal();
105287
- });
105288
-
105289
-
105290
- JSConsole.Chart.Log("[ChartPictureSettingMenu::DoModal]", {Top:top,Left:left, Right:right});
105291
- }
105292
- }
105293
105209
 
105294
105210
 
105211
+ /*
105295
105212
  function ChartPictureVolProfileSettingMenu(divElement)
105296
105213
  {
105297
105214
  this.newMethod=IDivDialog; //派生
@@ -105380,6 +105297,7 @@ function ChartPictureVolProfileSettingMenu(divElement)
105380
105297
  }
105381
105298
  }
105382
105299
  }
105300
+ */
105383
105301
 
105384
105302
 
105385
105303
 
@@ -130469,7 +130387,7 @@ function ScriptIndex(name,script,args,option)
130469
130387
  Name:hqChart.Name,
130470
130388
  Data:hisData,
130471
130389
  SourceData:hqChart.SourceData,
130472
- Callback:this.RecvResultData, CallbackParam:param,
130390
+ Callback:(arg1, arg2)=>{ this.RecvResultData(arg1, arg2); }, CallbackParam:param,
130473
130391
  Async:true,
130474
130392
  MaxRequestDataCount:hqChart.MaxRequestDataCount,
130475
130393
  MaxRequestMinuteDayCount:hqChart.MaxRequestMinuteDayCount,
@@ -133158,6 +133076,18 @@ function OverlayScriptIndex(name,script,args,option)
133158
133076
  param.Self.OutVar=outVar;
133159
133077
  param.Self.BindData(hqChart,windowIndex,hisData);
133160
133078
 
133079
+ var frame=this.OverlayIndex.Frame.Frame;
133080
+ if (this.IsLocked==false) //不上锁
133081
+ {
133082
+ frame.SetLock(null);
133083
+ }
133084
+ else //上锁
133085
+ {
133086
+ let lockData={ IsLocked:true,Callback:this.LockCallback,IndexName:this.Name ,ID:this.LockID, IndexID:this.ID,
133087
+ BG:this.LockBG,Text:this.LockText,TextColor:this.LockTextColor, Font:this.LockFont, Count:this.LockCount, MinWidth:this.LockMinWidth };
133088
+ frame.SetLock(lockData);
133089
+ }
133090
+
133161
133091
  param.HQChart.UpdataDataoffset(); //更新数据偏移
133162
133092
  param.HQChart.UpdateFrameMaxMin(); //调整坐标最大 最小值
133163
133093
 
@@ -135018,20 +134948,20 @@ function APIScriptIndex(name,script,args,option, isOverlay)
135018
134948
  }
135019
134949
  this.BindData(hqChart,windowIndex,hisData);
135020
134950
 
135021
- if (!this.IsOverlayIndex)
134951
+ var frame=hqChart.Frame.SubFrame[windowIndex].Frame;
134952
+ if (this.IsOverlayIndex) frame=this.OverlayIndex.Frame.Frame;
134953
+
134954
+ if (this.IsLocked==false) //不上锁
135022
134955
  {
135023
- if (this.IsLocked==false) //不上锁
135024
- {
135025
- hqChart.Frame.SubFrame[windowIndex].Frame.SetLock(null);
135026
- }
135027
- else //上锁
135028
- {
135029
- let lockData={ IsLocked:true,Callback:this.LockCallback,IndexName:this.Name ,ID:this.LockID,
135030
- BG:this.LockBG,Text:this.LockText,TextColor:this.LockTextColor, Font:this.LockFont, Count:this.LockCount, MinWidth:this.LockMinWidth };
135031
- hqChart.Frame.SubFrame[windowIndex].Frame.SetLock(lockData);
135032
- }
134956
+ frame.SetLock(null);
135033
134957
  }
135034
-
134958
+ else //上锁
134959
+ {
134960
+ let lockData={ IsLocked:true,Callback:this.LockCallback,IndexName:this.Name ,ID:this.LockID,IndexID:this.ID,
134961
+ BG:this.LockBG,Text:this.LockText,TextColor:this.LockTextColor, Font:this.LockFont, Count:this.LockCount, MinWidth:this.LockMinWidth };
134962
+ frame.SetLock(lockData);
134963
+ }
134964
+
135035
134965
  hqChart.UpdataDataoffset(); //更新数据偏移
135036
134966
  hqChart.UpdateFrameMaxMin(); //调整坐标最大 最小值
135037
134967
 
@@ -153902,7 +153832,7 @@ function ScrollBarBGChart()
153902
153832
 
153903
153833
 
153904
153834
 
153905
- var HQCHART_VERSION="1.1.15103";
153835
+ var HQCHART_VERSION="1.1.15110";
153906
153836
 
153907
153837
  function PrintHQChartVersion()
153908
153838
  {