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.
@@ -2219,12 +2219,12 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
2219
2219
  }
2220
2220
 
2221
2221
  //锁指标
2222
- this.LockIndex=function(lockData)
2222
+ this.EnableLockIndex=function(aryData)
2223
2223
  {
2224
- if(this.JSChartContainer && typeof(this.JSChartContainer.LockIndex)=='function')
2224
+ if(this.JSChartContainer && typeof(this.JSChartContainer.EnableLockIndex)=='function')
2225
2225
  {
2226
- JSConsole.Chart.Log('[JSChart:LockIndex] lockData', lockData);
2227
- this.JSChartContainer.LockIndex(lockData);
2226
+ JSConsole.Chart.Log('[JSChart:EnableLockIndex] aryData', aryData);
2227
+ this.JSChartContainer.EnableLockIndex(lockData);
2228
2228
  }
2229
2229
  }
2230
2230
 
@@ -2618,12 +2618,6 @@ JSChart.RegisterScriptIndexChart=function(name, option)
2618
2618
  return g_ScriptIndexChartFactory.Add(name, option);
2619
2619
  }
2620
2620
 
2621
- //注册设置对话框类
2622
- //option:{ Create:创建类方法 }
2623
- JSChart.RegisterDialogClass=function(name, option)
2624
- {
2625
- return g_DialogFactory.Add(name, option);
2626
- }
2627
2621
 
2628
2622
  //注册框架类
2629
2623
  JSChart.RegisterChartFrameClass=function(name, option)
@@ -12514,6 +12508,55 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12514
12508
  if (!this.PressKeyboardConfig) return false;
12515
12509
  if (!this.PressKeyboardConfig.PauseUpdate) return false;
12516
12510
 
12511
+ return true;
12512
+ },
12513
+
12514
+ //启动|关闭锁指标 aryIndex=[{ IndexID:指标ID, LockData:{IsLocked:} } ]
12515
+ this.EnableLockIndex=function(aryIndex)
12516
+ {
12517
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryIndex)) return false;
12518
+
12519
+ var mapIndex=new Map();
12520
+ for(var i=0;i<aryIndex.length;++i)
12521
+ {
12522
+ var item=aryIndex[i];
12523
+ if (item.IndexID && item.LockData) mapIndex.set(item.IndexID, item);
12524
+ }
12525
+
12526
+ var aryUpdate=[];
12527
+ for(var i=0; i<this.WindowIndex.length; ++i)
12528
+ {
12529
+ var item=this.WindowIndex[i];
12530
+ if (!item) continue;
12531
+ if (mapIndex.has(item.ID))
12532
+ {
12533
+ var mapItem=mapIndex.get(item.ID);
12534
+ item.SetLock(mapItem.LockData); //设置锁
12535
+ aryUpdate.push({ ID:i});
12536
+ }
12537
+ }
12538
+
12539
+ for(var i=0; i<this.Frame.SubFrame.length; ++i)
12540
+ {
12541
+ var item=this.Frame.SubFrame[i];
12542
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex)) continue;
12543
+
12544
+ for(var j=0; j<item.OverlayIndex.length; ++j)
12545
+ {
12546
+ var overlayItem=item.OverlayIndex[j];
12547
+ var script=overlayItem.Script;
12548
+ if (mapIndex.has(script.ID))
12549
+ {
12550
+ var mapItem=mapIndex.get(script.ID);
12551
+ script.SetLock(mapItem.LockData);
12552
+ aryUpdate.push({OverlayID:overlayItem.Identify});
12553
+ }
12554
+ }
12555
+ }
12556
+
12557
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryUpdate)) return false;
12558
+
12559
+ this.UpdateWindowIndexV2(aryUpdate);
12517
12560
  return true;
12518
12561
  }
12519
12562
  }
@@ -13163,8 +13206,8 @@ function IChartFramePainting()
13163
13206
  this.XSplitOperator; //X轴分割
13164
13207
  this.Data; //主数据
13165
13208
 
13166
- this.IsLocked=false; //是否上锁
13167
- this.LockPaint = null;
13209
+ this.LockPaint = null; //锁图形
13210
+ this.IndexLock=new IndexLockData(); //指标锁
13168
13211
 
13169
13212
  this.YSpecificMaxMin=null; //指定Y轴最大最小值
13170
13213
  this.IsShowBorder = true; //是否显示边框
@@ -13436,15 +13479,8 @@ function IChartFramePainting()
13436
13479
 
13437
13480
  this.DrawLock=function()
13438
13481
  {
13439
- if (this.IsLocked)
13440
- {
13441
- if (this.LockPaint == null)
13442
- this.LockPaint = g_ChartPaintFactory.Create("ChartLock");//new ChartLock();
13443
- this.LockPaint.Canvas=this.Canvas;
13444
- this.LockPaint.ChartBorder=this.ChartBorder;
13445
- this.LockPaint.ChartFrame=this;
13446
- this.LockPaint.Draw(true);
13447
- }
13482
+ if (!this.LockPaint) return;
13483
+ this.LockPaint.Draw(true);
13448
13484
  }
13449
13485
 
13450
13486
  this.DrawLogo=function()
@@ -13500,46 +13536,28 @@ function IChartFramePainting()
13500
13536
  }
13501
13537
  }
13502
13538
 
13503
- this.CalculateLock=function()
13539
+ this.CalculateLock=function(aryData)
13504
13540
  {
13505
- if (this.IsLocked)
13506
- {
13507
- if (this.LockPaint == null)
13508
- this.LockPaint = g_ChartPaintFactory.Create("ChartLock"); // new ChartLock();
13509
- this.LockPaint.Canvas=this.Canvas;
13510
- this.LockPaint.ChartBorder=this.ChartBorder;
13511
- this.LockPaint.ChartFrame=this;
13512
- this.LockPaint.Draw(false);
13513
- }
13541
+ this.LockPaint.SetData(aryData);
13542
+ this.LockPaint.Draw(false);
13514
13543
  }
13515
13544
 
13516
- //设施上锁
13517
- this.SetLock=function(lockData)
13545
+ //创建锁图形
13546
+ this.CreateLockPaint=function()
13518
13547
  {
13519
- if (!lockData) //空数据不上锁
13520
- {
13521
- this.IsLocked=false;
13522
- return;
13523
- }
13524
-
13525
- this.IsLocked=true;
13526
- if (!this.LockPaint) this.LockPaint=g_ChartPaintFactory.Create("ChartLock"); //new ChartLock(); //创建锁
13548
+ this.LockPaint = g_ChartPaintFactory.Create("ChartLock"); // new ChartLock();
13549
+ this.LockPaint.Canvas=this.Canvas;
13550
+ this.LockPaint.ChartBorder=this.ChartBorder;
13551
+ this.LockPaint.ChartFrame=this;
13552
+ }
13527
13553
 
13528
- if (lockData.Callback) this.LockPaint.Callback=lockData.Callback; //回调
13529
- if (lockData.IndexName) this.LockPaint.IndexName=lockData.IndexName; //指标名字
13530
- if (lockData.IndexID) this.LockPaint.IndexID=lockData.IndexID; //指标ID
13531
- if (lockData.ID) this.LockPaint.LockID=lockData.ID; //锁ID
13532
- if (lockData.BG) this.LockPaint.BGColor=lockData.BG; //背景色
13533
- if (lockData.Text) this.LockPaint.Title= lockData.Text;
13534
- if (lockData.TextColor) this.LockPaint.TextColor=lockData.TextColor;
13535
- if (lockData.Font) this.LockPaint.Font=lockData.Font;
13536
- if (lockData.Count) this.LockPaint.LockCount=lockData.Count;
13537
- if (lockData.MinWidth>0) this.LockPaint.MinWidth=lockData.MinWidth;
13554
+ this.SetLock=function(lockData)
13555
+ {
13556
+ this.IndexLock.SetData(lockData);
13538
13557
  }
13539
13558
 
13540
13559
  this.GetLockRect=function()
13541
13560
  {
13542
- if (!this.IsLocked) return null;
13543
13561
  if (!this.LockPaint) return null;
13544
13562
  return this.LockPaint.LockRect;
13545
13563
  }
@@ -18576,6 +18594,13 @@ function OverlayMinuteFrame()
18576
18594
  this.IsShareY=false; //使用和主框架公用Y轴
18577
18595
  this.IsCalculateYMaxMin=true; //是否计算Y最大最小值
18578
18596
  this.IsShowMainFrame=0; //是否显示在主框架坐标上 1=左边 2=右边
18597
+ this.MainFrame=null; //主框架
18598
+
18599
+ this.GetLockRect=function()
18600
+ {
18601
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
18602
+ return this.MainFrame.GetLockRect();
18603
+ }
18579
18604
 
18580
18605
  this.Draw=function()
18581
18606
  {
@@ -18634,6 +18659,13 @@ function OverlayMinuteHScreenFrame()
18634
18659
 
18635
18660
  this.ClassName="OverlayMinuteHScreenFrame";
18636
18661
  this.IsShow=true; //坐标是否显示
18662
+ this.MainFrame=null; //主框架
18663
+
18664
+ this.GetLockRect=function()
18665
+ {
18666
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
18667
+ return this.MainFrame.GetLockRect();
18668
+ }
18637
18669
 
18638
18670
  this.Draw=function()
18639
18671
  {
@@ -20021,6 +20053,12 @@ function OverlayKLineFrame()
20021
20053
  }
20022
20054
  }
20023
20055
 
20056
+ this.GetLockRect=function()
20057
+ {
20058
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
20059
+ return this.MainFrame.GetLockRect();
20060
+ }
20061
+
20024
20062
  this.Draw=function()
20025
20063
  {
20026
20064
  this.Buttons=[];
@@ -21333,6 +21371,12 @@ function OverlayKLineHScreenFrame()
21333
21371
  this.TitleColor=g_JSChartResource.OverlayFrame.TitleColor;
21334
21372
  this.TitleFont=g_JSChartResource.OverlayFrame.TitleFont;
21335
21373
 
21374
+ this.GetLockRect=function()
21375
+ {
21376
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
21377
+ return this.MainFrame.GetLockRect();
21378
+ }
21379
+
21336
21380
  this.Draw=function()
21337
21381
  {
21338
21382
  this.SplitXYCoordinate();
@@ -22539,7 +22583,7 @@ function HQTradeFrame()
22539
22583
 
22540
22584
  this.DrawLock=function()
22541
22585
  {
22542
- for (var i in this.SubFrame)
22586
+ for (var i=0; i<this.SubFrame.length; ++i)
22543
22587
  {
22544
22588
  var item = this.SubFrame[i];
22545
22589
  item.Frame.DrawLock();
@@ -22561,10 +22605,21 @@ function HQTradeFrame()
22561
22605
 
22562
22606
  this.CalculateLock=function()
22563
22607
  {
22564
- for (var i in this.SubFrame)
22608
+ for (var i=0, j=0; i<this.SubFrame.length; ++i)
22565
22609
  {
22566
22610
  var item = this.SubFrame[i];
22567
- item.Frame.CalculateLock();
22611
+ var aryLockData=[];
22612
+ if (item.Frame.IndexLock.IsLocked) aryLockData.push({ Data:item.Frame.IndexLock, IsOverlay:false });
22613
+ for(j=0; j<item.OverlayIndex.length; ++j)
22614
+ {
22615
+ var subItem=item.OverlayIndex[j];
22616
+ if (subItem.Frame.IndexLock.IsLocked===true)
22617
+ {
22618
+ aryLockData.push({ Data:subItem.Frame.IndexLock, IsOverlay:true } );
22619
+ }
22620
+ }
22621
+
22622
+ item.Frame.CalculateLock(aryLockData);
22568
22623
  }
22569
22624
  }
22570
22625
 
@@ -38711,6 +38766,13 @@ function ChartStickLine()
38711
38766
  xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
38712
38767
  }
38713
38768
 
38769
+ var lockRect=this.GetLockRect();
38770
+ if (lockRect)
38771
+ {
38772
+ if (this.IsHScreen) chartright=lockRect.Top;
38773
+ else chartright=lockRect.Left;
38774
+ }
38775
+
38714
38776
  var isMinute=this.IsMinuteFrame();
38715
38777
 
38716
38778
  if (isMinute)
@@ -47786,6 +47848,39 @@ function ChartDrawFlagText()
47786
47848
  }
47787
47849
  }
47788
47850
 
47851
+ function IndexLockData()
47852
+ {
47853
+ this.IsLocked=false;
47854
+ this.LockCount = 20; // 锁最新的几个数据
47855
+ this.BGColor = g_JSChartResource.IndexLock.BGColor;
47856
+ this.TextColor = g_JSChartResource.IndexLock.TextColor;
47857
+ this.Font = g_JSChartResource.IndexLock.Font;
47858
+ this.Title = g_JSChartResource.IndexLock.Title;
47859
+ this.LockID; //锁ID
47860
+ this.IndexName; //指标名字
47861
+ this.IndexID; //指标ID
47862
+
47863
+ this.SetData=function(lockData)
47864
+ {
47865
+ if (!lockData) //空 解锁
47866
+ {
47867
+ this.IsLocked=false;
47868
+ return;
47869
+ }
47870
+
47871
+ this.IsLocked=true;
47872
+ if (lockData.Callback) this.Callback=lockData.Callback; //回调 !!废弃
47873
+ if (lockData.IndexName) this.IndexName=lockData.IndexName; //指标名字
47874
+ if (lockData.IndexID) this.IndexID=lockData.IndexID; //指标ID
47875
+ if (lockData.ID) this.LockID=lockData.ID; //锁ID
47876
+ if (lockData.BG) this.BGColor=lockData.BG; //背景色
47877
+ if (lockData.Text) this.Title= lockData.Text;
47878
+ if (lockData.TextColor) this.TextColor=lockData.TextColor;
47879
+ if (lockData.Font) this.Font=lockData.Font;
47880
+ if (lockData.Count) this.LockCount=lockData.Count;
47881
+ }
47882
+ }
47883
+
47789
47884
  //锁 支持横屏
47790
47885
  function ChartLock()
47791
47886
  {
@@ -47794,34 +47889,79 @@ function ChartLock()
47794
47889
  delete this.newMethod;
47795
47890
 
47796
47891
  this.ClassName="ChartLock";
47892
+ this.AryData=null;
47893
+ this.LockRect=null; //上锁区域
47894
+
47797
47895
  this.LockCount = 20; // 锁最新的几个数据
47798
47896
  this.BGColor = g_JSChartResource.IndexLock.BGColor;
47799
47897
  this.TextColor = g_JSChartResource.IndexLock.TextColor;
47800
47898
  this.Font = g_JSChartResource.IndexLock.Font;
47801
47899
  this.Title = g_JSChartResource.IndexLock.Title;
47802
- this.LockRect=null; //上锁区域
47900
+
47803
47901
  this.LockID; //锁ID
47804
47902
  this.Callback; //回调
47805
47903
  this.IndexName; //指标名字
47806
47904
  this.IndexID; //指标ID
47807
47905
 
47906
+ this.SetData=function(aryData)
47907
+ {
47908
+ this.AryData=aryData;
47909
+
47910
+ if (IFrameSplitOperator.IsNonEmptyArray(this.AryData))
47911
+ {
47912
+ var item=this.AryData[0].Data; //取第一个锁
47913
+
47914
+ this.LockCount = item.LockCount;
47915
+ this.BGColor = item.BGColor
47916
+ this.TextColor = item.TextColor
47917
+ this.Font = item.Font
47918
+ this.Title = item.Title
47919
+ this.LockID=item.LockID; //锁ID
47920
+ this.Callback=item.Callback; //回调
47921
+ this.IndexName=item.IndexName; //指标名字
47922
+ this.IndexID=item.IndexID; //指标ID
47923
+ }
47924
+ }
47808
47925
 
47809
47926
  this.CalculateTextSize=function(aryText, defaultFont, out)
47810
47927
  {
47811
47928
  if (!out || !IFrameSplitOperator.IsNonEmptyArray(aryText)) return false;
47812
47929
 
47813
47930
  this.Canvas.font=defaultFont;
47814
- var lineHeight=this.Canvas.measureText("擎").width; //行高
47931
+ var defaultLineHeight=this.Canvas.measureText("擎").width; //行高
47932
+ var lineHeight=defaultLineHeight;
47815
47933
  var height=0, width=0;
47816
47934
  out.AryText=[];
47817
47935
  for(var i=0;i<aryText.length;++i)
47818
47936
  {
47819
47937
  var item=aryText[i];
47820
- if (!item || !item.Text) continue;
47821
- var textWidth=this.Canvas.measureText(item.Text).width;
47938
+ if (!item || (!item.Text && !item.Image)) continue;
47939
+ if (item.Image)
47940
+ {
47941
+ textWidth=item.Image.Width;
47942
+ lineHeight=item.Image.Height;
47943
+ }
47944
+ else
47945
+ {
47946
+ if (item.Font)
47947
+ {
47948
+ this.Canvas.font=item.Font;
47949
+ lineHeight=this.Canvas.measureText("擎").width;
47950
+ }
47951
+ else
47952
+ {
47953
+ this.Canvas.font=defaultFont;
47954
+ lineHeight=defaultLineHeight;
47955
+ }
47956
+
47957
+ var textWidth=this.Canvas.measureText(item.Text).width;
47958
+ }
47822
47959
 
47823
47960
  var lineItem={ Text:item.Text, Width:textWidth, Height:lineHeight, Color:item.Color, TextMargin:{ Top:0, Bottom:0, Left:0, Right:0 }, YOffset:0 };
47824
47961
  if (IFrameSplitOperator.IsNumber(item.YOffset)) lineItem.YOffset=item.YOffset;
47962
+ if (item.Font) lineItem.Font=item.Font;
47963
+ if (IFrameSplitOperator.IsNumber(item.Align)) lineItem.Align=item.Align; //左右对齐 0=左 1=中 2=右
47964
+ if (item.Image) lineItem.Image=item.Image;
47825
47965
  if (item.TextMargin)
47826
47966
  {
47827
47967
  var margin=item.TextMargin;
@@ -47849,12 +47989,7 @@ function ChartLock()
47849
47989
  this.Draw=function(bDraw)
47850
47990
  {
47851
47991
  this.LockRect=null;
47852
- if (!bDraw) return;
47853
- if (this.NotSupportMessage)
47854
- {
47855
- this.DrawNotSupportmessage();
47856
- return;
47857
- }
47992
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryData)) return;
47858
47993
 
47859
47994
  var bHScreen=this.ChartFrame.IsHScreen;
47860
47995
  var bMinute=this.IsMinuteFrame();
@@ -47900,24 +48035,33 @@ function ChartLock()
47900
48035
  var rtBG={ Left:border.Left, Right:border.RightEx, Top:left, Bottom:border.Bottom };
47901
48036
  rtBG.Width=rtBG.Right-rtBG.Left;
47902
48037
  rtBG.Height=rtBG.Bottom-rtBG.Top;
47903
-
47904
- var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
47905
- this.Canvas.fillStyle =bgColor;
47906
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
47907
48038
  this.LockRect=rtBG; //保存上锁区域
48039
+
48040
+ if (bDraw)
48041
+ {
48042
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
48043
+ this.Canvas.fillStyle =bgColor;
48044
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
48045
+ }
47908
48046
  }
47909
48047
  else
47910
48048
  {
47911
48049
  var rtBG={ Left:left, Right:border.RightEx, Top:border.TopTitle, Bottom:border.Bottom };
47912
48050
  rtBG.Width=rtBG.Right-rtBG.Left;
47913
48051
  rtBG.Height=rtBG.Bottom-rtBG.Top;
47914
- //上下渐变
47915
- var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
47916
- this.Canvas.fillStyle =bgColor;
47917
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
47918
48052
  this.LockRect=rtBG; //保存上锁区域
48053
+
48054
+ if (bDraw)
48055
+ {
48056
+ //上下渐变
48057
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
48058
+ this.Canvas.fillStyle =bgColor;
48059
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
48060
+ }
47919
48061
  }
47920
48062
 
48063
+ if (!bDraw) return;
48064
+
47921
48065
  var aryText=null;
47922
48066
  if (Array.isArray(this.Title)) aryText=this.Title;
47923
48067
  else aryText=[{Text:this.Title}];
@@ -47934,40 +48078,54 @@ function ChartLock()
47934
48078
  var top=rtBG.Top+(rtBG.Height-outSize.Width)/2;
47935
48079
  if (outSize.Width>rtBG.Height) top=rtBG.Bottom-outSize.Width;
47936
48080
  var left=rtBG.Left+(rtBG.Width-outSize.Height)/2;
47937
-
47938
48081
  this.Canvas.save();
47939
48082
  this.Canvas.translate(left, top);
47940
48083
  this.Canvas.rotate(90 * Math.PI / 180);
47941
- var yText=0,xText=0;
47942
- for(var i=0;i<outSize.AryText.length;++i)
47943
- {
47944
- var item=outSize.AryText[i];
47945
- if (item.Color) this.Canvas.fillStyle=item.Color;
47946
- else this.Canvas.fillStyle=this.TextColor;
47947
-
47948
- yText+=item.Height;
47949
- this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
47950
- }
47951
-
47952
- this.Canvas.restore();
48084
+ var left=0,top=0;
47953
48085
  }
47954
48086
  else
47955
48087
  {
47956
48088
  var left=rtBG.Left+(rtBG.Width-outSize.Width)/2;
47957
48089
  if (outSize.Width>rtBG.Width) left=rtBG.Right-outSize.Width;
47958
48090
  var top=rtBG.Top+(rtBG.Height-outSize.Height)/2;
47959
-
47960
- var yText=top, xText=left;
47961
- for(var i=0;i<outSize.AryText.length;++i)
48091
+ }
48092
+
48093
+ var yText=top, xText=left;
48094
+ for(var i=0;i<outSize.AryText.length;++i)
48095
+ {
48096
+ var item=outSize.AryText[i];
48097
+ xText=left;
48098
+ if (item.Image)
48099
+ {
48100
+ if (item.Align===1)
48101
+ {
48102
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
48103
+ }
48104
+
48105
+ this.Canvas.drawImage(item.Image.Data, xText, yText, item.Image.Width, item.Image.Height);
48106
+
48107
+ yText+=item.Height;
48108
+ }
48109
+ else
47962
48110
  {
47963
- var item=outSize.AryText[i];
47964
48111
  if (item.Color) this.Canvas.fillStyle=item.Color;
47965
48112
  else this.Canvas.fillStyle=this.TextColor;
47966
48113
 
48114
+ if (item.Font) this.Canvas.font = item.Font;
48115
+ else this.Canvas.font = this.Font;
48116
+
47967
48117
  yText+=item.Height;
48118
+
48119
+ if (item.Align===1)
48120
+ {
48121
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
48122
+ }
48123
+
47968
48124
  this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
47969
- }
48125
+ }
47970
48126
  }
48127
+
48128
+ if (bHScreen) this.Canvas.restore();
47971
48129
  }
47972
48130
 
47973
48131
  //x,y是否在上锁区域
@@ -47977,7 +48135,7 @@ function ChartLock()
47977
48135
 
47978
48136
  if (Path2DHelper.PtInRect(x,y,this.LockRect))
47979
48137
  {
47980
- tooltip.Data={ ID:this.LockID, Callback:this.Callback, IndexName:this.IndexName, IndexID:this.IndexID };
48138
+ tooltip.Data={ ID:this.LockID, Callback:this.Callback, IndexName:this.IndexName, IndexID:this.IndexID, Data:this.AryData };
47981
48139
  tooltip.ChartPaint=this;
47982
48140
  return true;
47983
48141
  }
@@ -82934,6 +83092,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
82934
83092
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
82935
83093
  frame.GlobalOption=this.GlobalOption;
82936
83094
  frame.CreateDivFrameToolbar(this, i, this.UIElement.parentNode);
83095
+ frame.CreateLockPaint();
82937
83096
 
82938
83097
  frame.HorizontalMax=20;
82939
83098
  frame.HorizontalMin=10;
@@ -83035,6 +83194,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
83035
83194
  frame.XSplitOperator.Symbol=this.Symbol;
83036
83195
  frame.XSplitOperator.Period=this.Period;
83037
83196
  frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
83197
+ frame.CreateLockPaint();
83038
83198
 
83039
83199
  //K线数据绑定
83040
83200
  var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;
@@ -85494,7 +85654,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85494
85654
 
85495
85655
 
85496
85656
  subFrame.YSpecificMaxMin=null; //清空指定最大最小值
85497
- subFrame.IsLocked=false; //解除上锁
85498
85657
  subFrame.YSplitScale = null; //清空固定刻度
85499
85658
  subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType; //还原Y坐标分割模式
85500
85659
 
@@ -85792,7 +85951,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85792
85951
 
85793
85952
 
85794
85953
  this.Frame.SubFrame[windowIndex].Frame.YSpecificMaxMin=null; //清空指定最大最小值
85795
- this.Frame.SubFrame[windowIndex].Frame.IsLocked=false; //解除上锁
85796
85954
  this.Frame.SubFrame[windowIndex].Frame.YSplitScale = null; //清空固定刻度
85797
85955
 
85798
85956
  this.ChartPaint=paint;
@@ -85850,7 +86008,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85850
86008
  }
85851
86009
  else if (obj.Script) //动态执行脚本
85852
86010
  {
85853
- indexInfo={ Script:obj.Script, ID:obj.indexName, Name:obj.indexName};
86011
+ indexInfo={ Script:obj.Script, ID:obj.IndexName, Name:obj.IndexName};
85854
86012
  if (obj.Name) indexInfo.Name=obj.Name;
85855
86013
  }
85856
86014
  else
@@ -86185,7 +86343,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86185
86343
  this.DeleteIndexPaint(i);
86186
86344
  var frame=this.Frame.SubFrame[i];
86187
86345
  frame.YSpecificMaxMin=null;
86188
- frame.IsLocked=false;
86189
86346
  frame.YSplitScale = null;
86190
86347
  }
86191
86348
 
@@ -86565,35 +86722,16 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86565
86722
  }
86566
86723
  }
86567
86724
 
86568
- //锁|解锁指标 { Index:指标名字,IsLocked:是否要锁上,Callback:回调 }
86569
- this.LockIndex=function(lockData)
86570
- {
86571
- if (!lockData) return;
86572
- if (!lockData.IndexName) return;
86573
-
86574
- for(let i in this.WindowIndex)
86575
- {
86576
- let item=this.WindowIndex[i];
86577
- if (!item) conintue;
86578
- if (item.Name==lockData.IndexName)
86579
- {
86580
- item.SetLock(lockData);
86581
- this.Update();
86582
- break;
86583
- }
86584
- }
86585
- }
86586
-
86587
86725
  this.TryClickLock=function(x,y)
86588
86726
  {
86589
86727
  for(var i=0;i<this.Frame.SubFrame.length; ++i)
86590
86728
  {
86591
86729
  var item=this.Frame.SubFrame[i];
86592
- if (!item.Frame.IsLocked) continue;
86593
- if (!item.Frame.LockPaint) continue;
86730
+ var chartLock=item.Frame.LockPaint;
86731
+ if (!chartLock || !chartLock.LockRect) continue;
86594
86732
 
86595
86733
  var tooltip=new TooltipData();
86596
- if (!item.Frame.LockPaint.GetTooltipData(x,y,tooltip)) continue;
86734
+ if (!chartLock.GetTooltipData(x,y,tooltip)) continue;
86597
86735
 
86598
86736
  tooltip.HQChart=this;
86599
86737
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);
@@ -92599,6 +92737,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92599
92737
  frame.XPointCount=243;
92600
92738
  frame.HQChart=this;
92601
92739
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
92740
+ frame.CreateLockPaint();
92602
92741
 
92603
92742
  if (i>=2)
92604
92743
  {
@@ -92710,6 +92849,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92710
92849
  frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
92711
92850
  frame.XSplitOperator.Symbol=this.Symbol;
92712
92851
  frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
92852
+ frame.CreateLockPaint();
92713
92853
 
92714
92854
  if (this.DayCount>1)
92715
92855
  {
@@ -92835,7 +92975,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92835
92975
  //清空指定最大最小值
92836
92976
 
92837
92977
  subFrame.YSpecificMaxMin=null;
92838
- subFrame.IsLocked=false; //解除上锁
92839
92978
  subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType; //还原Y坐标分割模式
92840
92979
 
92841
92980
  this.ChartPaint=paint;
@@ -93068,7 +93207,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
93068
93207
  this.DeleteIndexPaint(i);
93069
93208
  var frame=this.Frame.SubFrame[i];
93070
93209
  frame.YSpecificMaxMin=null;
93071
- frame.IsLocked=false;
93072
93210
  frame.YSplitScale = null;
93073
93211
  }
93074
93212
 
@@ -95315,9 +95453,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
95315
95453
  {
95316
95454
  overlayFrame=new OverlayIndexItem();
95317
95455
  overlayFrame.Identify='Position_Line_Frame';
95318
-
95319
- if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
95320
- else frame=new OverlayMinuteHScreenFrame();
95456
+ frame=this.CreateOverlayFrame();
95457
+ //if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
95458
+ //else frame=new OverlayMinuteHScreenFrame();
95321
95459
 
95322
95460
  frame.Canvas=this.Canvas;
95323
95461
  frame.MainFrame=subFrame.Frame;
@@ -95500,9 +95638,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
95500
95638
  var subFrame=this.Frame.SubFrame[windowIndex];
95501
95639
  var overlayFrame=new OverlayIndexItem();
95502
95640
  if (obj.Identify) overlayFrame.Identify=obj.Identify; //由外部指定id
95503
- var frame=null;
95504
- if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
95505
- else frame=new OverlayMinuteHScreenFrame();
95641
+ var frame=this.CreateOverlayFrame();
95642
+ //if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
95643
+ //else frame=new OverlayMinuteHScreenFrame();
95506
95644
  frame.Canvas=this.Canvas;
95507
95645
  frame.MainFrame=subFrame.Frame;
95508
95646
  frame.ChartBorder=subFrame.Frame.ChartBorder;
@@ -96422,13 +96560,22 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96422
96560
  for(var i=0;i<this.Frame.SubFrame.length; ++i)
96423
96561
  {
96424
96562
  var item=this.Frame.SubFrame[i];
96425
- if (!item.Frame.IsLocked) continue;
96426
- if (!item.Frame.LockPaint) continue;
96563
+ var chartLock=item.Frame.LockPaint;
96564
+ if (!chartLock || !chartLock.LockRect) continue;
96427
96565
 
96428
96566
  var tooltip=new TooltipData();
96429
- if (!item.Frame.LockPaint.GetTooltipData(x,y,tooltip)) continue;
96567
+ if (!chartLock.GetTooltipData(x,y,tooltip)) continue;
96430
96568
 
96431
96569
  tooltip.HQChart=this;
96570
+
96571
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);
96572
+ if (event && event.Callback)
96573
+ {
96574
+ var sendData={ FrameID:item.Frame.Identify, Data:tooltip };
96575
+ event.Callback(event,sendData,this);
96576
+ }
96577
+
96578
+
96432
96579
  if (tooltip.Data.Callback) tooltip.Data.Callback(tooltip);
96433
96580
  return true;
96434
96581
  }
@@ -100963,239 +101110,9 @@ function IsFundSymbol(symbol)
100963
101110
  return false;
100964
101111
  }
100965
101112
 
100966
- //设置对话框工厂类
100967
- function DialogFactory()
100968
- {
100969
- //[key:name, { Create:function(divElement) { return new class(divElement); }} ]
100970
- this.DataMap=new Map(
100971
- [
100972
- ["ChartPictureSettingMenu", { Create:function(divElement) { return new ChartPictureSettingMenu(divElement); } }],
100973
- ]);
100974
-
100975
- this.Create=function(name, option)
100976
- {
100977
- if (!this.DataMap.has(name))
100978
- {
100979
- JSConsole.Chart.Warn(`[DialogFactory::Create] can't find class=${name}.`);
100980
- return null;
100981
- }
100982
-
100983
- var item=this.DataMap.get(name);
100984
- return item.Create(option);
100985
- }
100986
-
100987
- this.Add=function(name, option)
100988
- {
100989
- this.DataMap.set(name, { Create:option.Create } );
100990
- }
100991
- }
100992
-
100993
- var g_DialogFactory=new DialogFactory();
100994
-
100995
- //设置窗口基类
100996
- function IDivDialog(divElement)
100997
- {
100998
- this.DivElement=divElement; //父节点
100999
- this.ID=null; //div id
101000
- this.TimeOut=null; //定时器
101001
-
101002
- //隐藏窗口
101003
- this.Hide=function()
101004
- {
101005
- $("#"+this.ID).hide();
101006
- }
101007
-
101008
- //显示窗口
101009
- this.Show=function(left,top,width,height)
101010
- {
101011
- var cssData={display:'block'};
101012
- if (IFrameSplitOperator.IsNumber(left)) cssData.left=left+'px';
101013
- if (IFrameSplitOperator.IsNumber(top)) cssData.top=top+'px';
101014
- if (IFrameSplitOperator.IsNumber(width)) cssData.width=width+'px';
101015
- if (IFrameSplitOperator.IsNumber(height)) cssData.height=height+'px';
101016
-
101017
- $("#"+this.ID).css(cssData);
101018
- }
101019
- }
101020
-
101021
- //等待动画窗口
101022
- function WaitDialog(divElement)
101023
- {
101024
- this.newMethod=IDivDialog; //派生
101025
- this.newMethod(divElement);
101026
- delete this.newMethod;
101027
-
101028
- this.Title='加载中......';
101029
- this.Dialog;
101030
-
101031
- //隐藏窗口
101032
- this.Close=function()
101033
- {
101034
- if (this.Dialog)
101035
- {
101036
- this.DivElement.removeChild(this.Dialog);
101037
- this.Dialog=null;
101038
- }
101039
- }
101040
-
101041
- this.SetTitle=function(title)
101042
- {
101043
- this.Title=title;
101044
- if (!this.Dialog) return;
101045
- //TODO: 更新标题数据
101046
- }
101047
-
101048
- this.Create=function()
101049
- {
101050
- this.ID=Guid();
101051
- var div=document.createElement('div');
101052
- div.className='jchart-wait-box';
101053
- div.id=this.ID;
101054
- div.innerHTML=
101055
- `<div class='parameter jchart-kline-match-box'>
101056
- <div class='parameter-header'>
101057
- <span>${this.Title}</span>
101058
- </div>
101059
- </div>`.trim();
101060
-
101061
- this.DivElement.appendChild(div);
101062
- this.Dialog=div;
101063
- }
101064
-
101065
- //显示
101066
- this.DoModal=function(event)
101067
- {
101068
- this.Title=event.data.Title;
101069
- var chart=event.data.Chart;
101070
- if (this.ID==null) this.Create(); //第1次 需要创建div
101071
-
101072
- //居中显示
101073
- var border=chart.Frame.ChartBorder;
101074
- var scrollPos=GetScrollPosition();
101075
- var left=border.GetWidth()/2;
101076
- var top=border.GetHeight()/2;
101077
-
101078
- this.Show(left,top,200,40); //显示
101079
- }
101080
- }
101081
-
101082
- //画图工具 单个图形设置
101083
- function ChartPictureSettingMenu(divElement)
101084
- {
101085
- this.newMethod=IDivDialog; //派生
101086
- this.newMethod(divElement);
101087
- delete this.newMethod;
101088
-
101089
- this.HQChart;
101090
- this.ChartPicture;
101091
- this.SubToolsDiv;
101092
- this.SettingMenu;
101093
- this.SettingPV;
101094
-
101095
- this.DoModal=function(event)
101096
- {
101097
- var $body;
101098
- if (!this.SubToolsDiv)
101099
- {
101100
- this.ID=Guid();
101101
- var div=document.createElement("div");
101102
- div.className='subTolls';
101103
- div.id=this.ID;
101104
- this.DivElement.appendChild(div);
101105
- //$body = $("."+event.data.HQChart.ClassName).context.body;
101106
- //$body.append(div);
101107
- this.SubToolsDiv=div;
101108
- }
101109
- this.HQChart=event.data.HQChart;
101110
- this.ChartPicture=event.data.ChartPicture;
101111
-
101112
- var pixelTatio = GetDevicePixelRatio();
101113
- var frame=this.HQChart.Frame.SubFrame[0].Frame;
101114
- // var top=frame.ChartBorder.GetTopTitle();
101115
- var top=frame.ChartBorder.Top + 40;
101116
- // var right=frame.ChartBorder.GetRight();
101117
- var right=frame.ChartBorder.Right;
101118
- var left=frame.ChartBorder.GetLeft();
101119
- var className = this.ChartPicture.ClassName; //='ChartDrawPictureText'时加“设置”
101120
- var lineColor=this.ChartPicture.LineColor;
101121
- if (lineColor.indexOf("rgb(")==0 || lineColor.indexOf("RGB(")==0)
101122
- lineColor=IChartDrawPicture.RGBToHex(lineColor.toLowerCase());
101123
- var toolsDiv = "";
101124
- if(className === 'ChartDrawPictureText')
101125
- {
101126
- toolsDiv = '<span class="changes-color" title="改变图形颜色">'+
101127
- '<i class="iconfont icon-bianji"></i>'+
101128
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'">'+
101129
- '</span>\n' +
101130
- '<span class="subtool-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
101131
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
101132
- }
101133
- else if (className=="ChartDrawVolProfile")
101134
- {
101135
- toolsDiv='<span class="vp-set" title="设置"><i class="iconfont icon-shezhi"></i></span>'+
101136
- '<span class="subtool-del"><i class="iconfont icon-recycle_bin"></i></span>';
101137
- }
101138
- else
101139
- {
101140
- toolsDiv =
101141
- '<p class="changes-color" title="改变图形颜色"><i class="iconfont icon-bianji"></i>' +
101142
- '<input type="color" name="color" id="color" class="change-color" value="'+ lineColor +'"></p>\n' +
101143
- ' <p class="subtool-del"><i class="iconfont icon-recycle_bin"></i></p>';
101144
- }
101145
-
101146
-
101147
- this.SubToolsDiv.style.right = right/pixelTatio + "px";
101148
- this.SubToolsDiv.style.top = top/pixelTatio + "px";
101149
- this.SubToolsDiv.innerHTML = toolsDiv;
101150
- this.SubToolsDiv.style.position = "absolute";
101151
- this.SubToolsDiv.style.display = "block";
101152
-
101153
- var hqChart = this.HQChart;
101154
- var picture = this.ChartPicture;
101155
- var subToolDiv = this.SubToolsDiv;
101156
- $(".subtool-del").click(function(){
101157
- hqChart.SelectChartDrawPicture=null;
101158
- hqChart.ClearChartDrawPicture(picture);
101159
- // subToolDiv.innerHTML = "";
101160
- $(".subTolls").css("display","none");
101161
- });
101162
- var self = this;
101163
- $(".subtool-set").click(function(){
101164
- $(self.SubToolsDiv).hide();
101165
- //创建div设置窗口
101166
- if (!self.SettingMenu) self.SettingMenu=new ChartPictureTextSettingMenu(frame.ChartBorder.UIElement.parentNode);
101167
-
101168
- self.SettingMenu.ChartPicture=picture;
101169
- self.SettingMenu.HQChart=hqChart;
101170
- self.SettingMenu.Position={Left:right + 80,Top:top + 20};
101171
- self.SettingMenu.DoModal();
101172
- });
101173
- $(".changes-color").click(function () {
101174
- document.getElementById('color').click();
101175
- $(".change-color").change(function () {
101176
- var color = $(".change-color").val();
101177
- picture.LineColor = color;
101178
- picture.PointColor = color;
101179
- if (hqChart.ChartDrawStorage) hqChart.ChartDrawStorage.SaveDrawData(picture); //保存下
101180
- });
101181
- });
101182
-
101183
- //成交量分布图设置
101184
- $(".vp-set").click(function()
101185
- {
101186
- if (!self.SettingPV) self.SettingPV=new ChartPictureVolProfileSettingMenu(frame.ChartBorder.UIElement.parentNode);
101187
- self.SettingPV.ChartPicture=picture;
101188
- self.SettingPV.HQChart=hqChart;
101189
- self.SettingPV.Position={Left:right + 80,Top:top + 20};
101190
- self.SettingPV.DoModal();
101191
- });
101192
-
101193
-
101194
- JSConsole.Chart.Log("[ChartPictureSettingMenu::DoModal]", {Top:top,Left:left, Right:right});
101195
- }
101196
- }
101197
101113
 
101198
101114
 
101115
+ /*
101199
101116
  function ChartPictureVolProfileSettingMenu(divElement)
101200
101117
  {
101201
101118
  this.newMethod=IDivDialog; //派生
@@ -101284,6 +101201,7 @@ function ChartPictureVolProfileSettingMenu(divElement)
101284
101201
  }
101285
101202
  }
101286
101203
  }
101204
+ */
101287
101205
 
101288
101206
 
101289
101207