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.
@@ -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
 
@@ -2626,6 +2626,14 @@ JSChart.RegisterChartFrameClass=function(name, option)
2626
2626
  }
2627
2627
 
2628
2628
 
2629
+ //注册DOM对话框类
2630
+ //option:{ Create:创建类方法 }
2631
+ JSChart.RegisterDOMClass=function(name, option)
2632
+ {
2633
+ return g_JSDOMFactory.Add(name, option);
2634
+ }
2635
+
2636
+
2629
2637
  //一些公共函数
2630
2638
  JSChart.ToFixedPoint=function(value)
2631
2639
  {
@@ -12508,8 +12516,87 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
12508
12516
  if (!this.PressKeyboardConfig) return false;
12509
12517
  if (!this.PressKeyboardConfig.PauseUpdate) return false;
12510
12518
 
12519
+ return true;
12520
+ },
12521
+
12522
+ //启动|关闭锁指标 aryIndex=[{ IndexID:指标ID, LockData:{IsLocked:} } ]
12523
+ this.EnableLockIndex=function(aryIndex)
12524
+ {
12525
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryIndex)) return false;
12526
+
12527
+ var mapIndex=new Map();
12528
+ for(var i=0;i<aryIndex.length;++i)
12529
+ {
12530
+ var item=aryIndex[i];
12531
+ if (item.IndexID && item.LockData) mapIndex.set(item.IndexID, item);
12532
+ }
12533
+
12534
+ var aryUpdate=[];
12535
+ for(var i=0; i<this.WindowIndex.length; ++i)
12536
+ {
12537
+ var item=this.WindowIndex[i];
12538
+ if (!item) continue;
12539
+ if (mapIndex.has(item.ID))
12540
+ {
12541
+ var mapItem=mapIndex.get(item.ID);
12542
+ item.SetLock(mapItem.LockData); //设置锁
12543
+ aryUpdate.push({ ID:i});
12544
+ }
12545
+ }
12546
+
12547
+ for(var i=0; i<this.Frame.SubFrame.length; ++i)
12548
+ {
12549
+ var item=this.Frame.SubFrame[i];
12550
+ if (!IFrameSplitOperator.IsNonEmptyArray(item.OverlayIndex)) continue;
12551
+
12552
+ for(var j=0; j<item.OverlayIndex.length; ++j)
12553
+ {
12554
+ var overlayItem=item.OverlayIndex[j];
12555
+ var script=overlayItem.Script;
12556
+ if (mapIndex.has(script.ID))
12557
+ {
12558
+ var mapItem=mapIndex.get(script.ID);
12559
+ script.SetLock(mapItem.LockData);
12560
+ aryUpdate.push({OverlayID:overlayItem.Identify});
12561
+ }
12562
+ }
12563
+ }
12564
+
12565
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryUpdate)) return false;
12566
+
12567
+ this.UpdateWindowIndexV2(aryUpdate);
12511
12568
  return true;
12512
12569
  }
12570
+
12571
+ this.TryClickLock=function(x,y)
12572
+ {
12573
+ if (!this.Frame || !IFrameSplitOperator.IsNonEmptyArray(this.Frame.SubFrame)) return false;
12574
+
12575
+ for(var i=0;i<this.Frame.SubFrame.length; ++i)
12576
+ {
12577
+ var item=this.Frame.SubFrame[i];
12578
+ var chartLock=item.Frame.LockPaint;
12579
+ if (!chartLock || !chartLock.LockRect) continue;
12580
+
12581
+ var tooltip=new TooltipData();
12582
+ if (!chartLock.GetTooltipData(x,y,tooltip)) continue;
12583
+
12584
+ tooltip.HQChart=this;
12585
+
12586
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);
12587
+ if (event && event.Callback)
12588
+ {
12589
+ var sendData={ FrameID:item.Frame.Identify, Data:tooltip };
12590
+ event.Callback(event,sendData,this);
12591
+ }
12592
+
12593
+
12594
+ if (tooltip.Data.Callback) tooltip.Data.Callback(tooltip);
12595
+ return true;
12596
+ }
12597
+
12598
+ return false;
12599
+ }
12513
12600
  }
12514
12601
 
12515
12602
  function GetDevicePixelRatio()
@@ -13157,8 +13244,8 @@ function IChartFramePainting()
13157
13244
  this.XSplitOperator; //X轴分割
13158
13245
  this.Data; //主数据
13159
13246
 
13160
- this.IsLocked=false; //是否上锁
13161
- this.LockPaint = null;
13247
+ this.LockPaint = null; //锁图形
13248
+ this.IndexLock=new IndexLockData(); //指标锁
13162
13249
 
13163
13250
  this.YSpecificMaxMin=null; //指定Y轴最大最小值
13164
13251
  this.IsShowBorder = true; //是否显示边框
@@ -13430,15 +13517,8 @@ function IChartFramePainting()
13430
13517
 
13431
13518
  this.DrawLock=function()
13432
13519
  {
13433
- if (this.IsLocked)
13434
- {
13435
- if (this.LockPaint == null)
13436
- this.LockPaint = g_ChartPaintFactory.Create("ChartLock");//new ChartLock();
13437
- this.LockPaint.Canvas=this.Canvas;
13438
- this.LockPaint.ChartBorder=this.ChartBorder;
13439
- this.LockPaint.ChartFrame=this;
13440
- this.LockPaint.Draw(true);
13441
- }
13520
+ if (!this.LockPaint) return;
13521
+ this.LockPaint.Draw(true);
13442
13522
  }
13443
13523
 
13444
13524
  this.DrawLogo=function()
@@ -13494,46 +13574,28 @@ function IChartFramePainting()
13494
13574
  }
13495
13575
  }
13496
13576
 
13497
- this.CalculateLock=function()
13577
+ this.CalculateLock=function(aryData)
13498
13578
  {
13499
- if (this.IsLocked)
13500
- {
13501
- if (this.LockPaint == null)
13502
- this.LockPaint = g_ChartPaintFactory.Create("ChartLock"); // new ChartLock();
13503
- this.LockPaint.Canvas=this.Canvas;
13504
- this.LockPaint.ChartBorder=this.ChartBorder;
13505
- this.LockPaint.ChartFrame=this;
13506
- this.LockPaint.Draw(false);
13507
- }
13579
+ this.LockPaint.SetData(aryData);
13580
+ this.LockPaint.Draw(false);
13508
13581
  }
13509
13582
 
13510
- //设施上锁
13511
- this.SetLock=function(lockData)
13583
+ //创建锁图形
13584
+ this.CreateLockPaint=function()
13512
13585
  {
13513
- if (!lockData) //空数据不上锁
13514
- {
13515
- this.IsLocked=false;
13516
- return;
13517
- }
13518
-
13519
- this.IsLocked=true;
13520
- if (!this.LockPaint) this.LockPaint=g_ChartPaintFactory.Create("ChartLock"); //new ChartLock(); //创建锁
13586
+ this.LockPaint = g_ChartPaintFactory.Create("ChartLock"); // new ChartLock();
13587
+ this.LockPaint.Canvas=this.Canvas;
13588
+ this.LockPaint.ChartBorder=this.ChartBorder;
13589
+ this.LockPaint.ChartFrame=this;
13590
+ }
13521
13591
 
13522
- if (lockData.Callback) this.LockPaint.Callback=lockData.Callback; //回调
13523
- if (lockData.IndexName) this.LockPaint.IndexName=lockData.IndexName; //指标名字
13524
- if (lockData.IndexID) this.LockPaint.IndexID=lockData.IndexID; //指标ID
13525
- if (lockData.ID) this.LockPaint.LockID=lockData.ID; //锁ID
13526
- if (lockData.BG) this.LockPaint.BGColor=lockData.BG; //背景色
13527
- if (lockData.Text) this.LockPaint.Title= lockData.Text;
13528
- if (lockData.TextColor) this.LockPaint.TextColor=lockData.TextColor;
13529
- if (lockData.Font) this.LockPaint.Font=lockData.Font;
13530
- if (lockData.Count) this.LockPaint.LockCount=lockData.Count;
13531
- if (lockData.MinWidth>0) this.LockPaint.MinWidth=lockData.MinWidth;
13592
+ this.SetLock=function(lockData)
13593
+ {
13594
+ this.IndexLock.SetData(lockData);
13532
13595
  }
13533
13596
 
13534
13597
  this.GetLockRect=function()
13535
13598
  {
13536
- if (!this.IsLocked) return null;
13537
13599
  if (!this.LockPaint) return null;
13538
13600
  return this.LockPaint.LockRect;
13539
13601
  }
@@ -16290,7 +16352,7 @@ function AverageWidthFrame()
16290
16352
 
16291
16353
  if (this.ClassName=="MinuteFrame" || this.ClassName=="KLineFrame")
16292
16354
  {
16293
- this.DivFrameToolbar=new JSDivFrameToolbar();
16355
+ this.DivFrameToolbar=g_JSDOMFactory.Create('JSDivFrameToolbar');//new JSDivFrameToolbar();
16294
16356
  this.DivFrameToolbar.HQChart=hqchart;
16295
16357
  this.DivFrameToolbar.DivHQChart=divHQChart;
16296
16358
  this.DivFrameToolbar.FrameID=frameID;
@@ -18570,6 +18632,13 @@ function OverlayMinuteFrame()
18570
18632
  this.IsShareY=false; //使用和主框架公用Y轴
18571
18633
  this.IsCalculateYMaxMin=true; //是否计算Y最大最小值
18572
18634
  this.IsShowMainFrame=0; //是否显示在主框架坐标上 1=左边 2=右边
18635
+ this.MainFrame=null; //主框架
18636
+
18637
+ this.GetLockRect=function()
18638
+ {
18639
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
18640
+ return this.MainFrame.GetLockRect();
18641
+ }
18573
18642
 
18574
18643
  this.Draw=function()
18575
18644
  {
@@ -18628,6 +18697,13 @@ function OverlayMinuteHScreenFrame()
18628
18697
 
18629
18698
  this.ClassName="OverlayMinuteHScreenFrame";
18630
18699
  this.IsShow=true; //坐标是否显示
18700
+ this.MainFrame=null; //主框架
18701
+
18702
+ this.GetLockRect=function()
18703
+ {
18704
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
18705
+ return this.MainFrame.GetLockRect();
18706
+ }
18631
18707
 
18632
18708
  this.Draw=function()
18633
18709
  {
@@ -20015,6 +20091,12 @@ function OverlayKLineFrame()
20015
20091
  }
20016
20092
  }
20017
20093
 
20094
+ this.GetLockRect=function()
20095
+ {
20096
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
20097
+ return this.MainFrame.GetLockRect();
20098
+ }
20099
+
20018
20100
  this.Draw=function()
20019
20101
  {
20020
20102
  this.Buttons=[];
@@ -21327,6 +21409,12 @@ function OverlayKLineHScreenFrame()
21327
21409
  this.TitleColor=g_JSChartResource.OverlayFrame.TitleColor;
21328
21410
  this.TitleFont=g_JSChartResource.OverlayFrame.TitleFont;
21329
21411
 
21412
+ this.GetLockRect=function()
21413
+ {
21414
+ if (!this.MainFrame || !this.MainFrame.GetLockRect) return null;
21415
+ return this.MainFrame.GetLockRect();
21416
+ }
21417
+
21330
21418
  this.Draw=function()
21331
21419
  {
21332
21420
  this.SplitXYCoordinate();
@@ -22533,7 +22621,7 @@ function HQTradeFrame()
22533
22621
 
22534
22622
  this.DrawLock=function()
22535
22623
  {
22536
- for (var i in this.SubFrame)
22624
+ for (var i=0; i<this.SubFrame.length; ++i)
22537
22625
  {
22538
22626
  var item = this.SubFrame[i];
22539
22627
  item.Frame.DrawLock();
@@ -22555,10 +22643,21 @@ function HQTradeFrame()
22555
22643
 
22556
22644
  this.CalculateLock=function()
22557
22645
  {
22558
- for (var i in this.SubFrame)
22646
+ for (var i=0, j=0; i<this.SubFrame.length; ++i)
22559
22647
  {
22560
22648
  var item = this.SubFrame[i];
22561
- item.Frame.CalculateLock();
22649
+ var aryLockData=[];
22650
+ if (item.Frame.IndexLock.IsLocked) aryLockData.push({ Data:item.Frame.IndexLock, IsOverlay:false });
22651
+ for(j=0; j<item.OverlayIndex.length; ++j)
22652
+ {
22653
+ var subItem=item.OverlayIndex[j];
22654
+ if (subItem.Frame.IndexLock.IsLocked===true)
22655
+ {
22656
+ aryLockData.push({ Data:subItem.Frame.IndexLock, IsOverlay:true } );
22657
+ }
22658
+ }
22659
+
22660
+ item.Frame.CalculateLock(aryLockData);
22562
22661
  }
22563
22662
  }
22564
22663
 
@@ -26798,9 +26897,20 @@ function IChartPainting()
26798
26897
  var x=left+width/2;
26799
26898
  var y=top+height/2;
26800
26899
 
26900
+ var bHScreen=this.ChartFrame.IsHScreen;
26901
+ if (bHScreen)
26902
+ {
26903
+ this.Canvas.save();
26904
+ this.Canvas.translate(x, y);
26905
+ this.Canvas.rotate(90 * Math.PI / 180);
26906
+ x=0,y=0;
26907
+ }
26908
+
26801
26909
  this.Canvas.textAlign="center";
26802
26910
  this.Canvas.textBaseline="middle";
26803
26911
  this.Canvas.fillText(this.NotSupportMessage,x,y);
26912
+
26913
+ if (bHScreen) this.Canvas.restore();
26804
26914
  }
26805
26915
 
26806
26916
  this.GetTooltipData=function(x,y,tooltip)
@@ -38705,6 +38815,13 @@ function ChartStickLine()
38705
38815
  xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
38706
38816
  }
38707
38817
 
38818
+ var lockRect=this.GetLockRect();
38819
+ if (lockRect)
38820
+ {
38821
+ if (this.IsHScreen) chartright=lockRect.Top;
38822
+ else chartright=lockRect.Left;
38823
+ }
38824
+
38708
38825
  var isMinute=this.IsMinuteFrame();
38709
38826
 
38710
38827
  if (isMinute)
@@ -47780,6 +47897,39 @@ function ChartDrawFlagText()
47780
47897
  }
47781
47898
  }
47782
47899
 
47900
+ function IndexLockData()
47901
+ {
47902
+ this.IsLocked=false;
47903
+ this.LockCount = 20; // 锁最新的几个数据
47904
+ this.BGColor = g_JSChartResource.IndexLock.BGColor;
47905
+ this.TextColor = g_JSChartResource.IndexLock.TextColor;
47906
+ this.Font = g_JSChartResource.IndexLock.Font;
47907
+ this.Title = g_JSChartResource.IndexLock.Title;
47908
+ this.LockID; //锁ID
47909
+ this.IndexName; //指标名字
47910
+ this.IndexID; //指标ID
47911
+
47912
+ this.SetData=function(lockData)
47913
+ {
47914
+ if (!lockData) //空 解锁
47915
+ {
47916
+ this.IsLocked=false;
47917
+ return;
47918
+ }
47919
+
47920
+ this.IsLocked=true;
47921
+ if (lockData.Callback) this.Callback=lockData.Callback; //回调 !!废弃
47922
+ if (lockData.IndexName) this.IndexName=lockData.IndexName; //指标名字
47923
+ if (lockData.IndexID) this.IndexID=lockData.IndexID; //指标ID
47924
+ if (lockData.ID) this.LockID=lockData.ID; //锁ID
47925
+ if (lockData.BG) this.BGColor=lockData.BG; //背景色
47926
+ if (lockData.Text) this.Title= lockData.Text;
47927
+ if (lockData.TextColor) this.TextColor=lockData.TextColor;
47928
+ if (lockData.Font) this.Font=lockData.Font;
47929
+ if (lockData.Count) this.LockCount=lockData.Count;
47930
+ }
47931
+ }
47932
+
47783
47933
  //锁 支持横屏
47784
47934
  function ChartLock()
47785
47935
  {
@@ -47788,17 +47938,41 @@ function ChartLock()
47788
47938
  delete this.newMethod;
47789
47939
 
47790
47940
  this.ClassName="ChartLock";
47941
+ this.AryData=null;
47942
+ this.LockRect=null; //上锁区域
47943
+
47791
47944
  this.LockCount = 20; // 锁最新的几个数据
47792
47945
  this.BGColor = g_JSChartResource.IndexLock.BGColor;
47793
47946
  this.TextColor = g_JSChartResource.IndexLock.TextColor;
47794
47947
  this.Font = g_JSChartResource.IndexLock.Font;
47795
47948
  this.Title = g_JSChartResource.IndexLock.Title;
47796
- this.LockRect=null; //上锁区域
47949
+
47797
47950
  this.LockID; //锁ID
47798
47951
  this.Callback; //回调
47799
47952
  this.IndexName; //指标名字
47800
47953
  this.IndexID; //指标ID
47801
47954
 
47955
+ this.MinWidthText=" 付费指标 "
47956
+
47957
+ this.SetData=function(aryData)
47958
+ {
47959
+ this.AryData=aryData;
47960
+
47961
+ if (IFrameSplitOperator.IsNonEmptyArray(this.AryData))
47962
+ {
47963
+ var item=this.AryData[0].Data; //取第一个锁
47964
+
47965
+ this.LockCount = item.LockCount;
47966
+ this.BGColor = item.BGColor
47967
+ this.TextColor = item.TextColor
47968
+ this.Font = item.Font
47969
+ this.Title = item.Title
47970
+ this.LockID=item.LockID; //锁ID
47971
+ this.Callback=item.Callback; //回调
47972
+ this.IndexName=item.IndexName; //指标名字
47973
+ this.IndexID=item.IndexID; //指标ID
47974
+ }
47975
+ }
47802
47976
 
47803
47977
  this.CalculateTextSize=function(aryText, defaultFont, out)
47804
47978
  {
@@ -47820,7 +47994,7 @@ function ChartLock()
47820
47994
  }
47821
47995
  else
47822
47996
  {
47823
- if (item.Font)
47997
+ if (item.Font)
47824
47998
  {
47825
47999
  this.Canvas.font=item.Font;
47826
48000
  lineHeight=this.Canvas.measureText("擎").width;
@@ -47866,12 +48040,7 @@ function ChartLock()
47866
48040
  this.Draw=function(bDraw)
47867
48041
  {
47868
48042
  this.LockRect=null;
47869
- if (!bDraw) return;
47870
- if (this.NotSupportMessage)
47871
- {
47872
- this.DrawNotSupportmessage();
47873
- return;
47874
- }
48043
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryData)) return;
47875
48044
 
47876
48045
  var bHScreen=this.ChartFrame.IsHScreen;
47877
48046
  var bMinute=this.IsMinuteFrame();
@@ -47912,35 +48081,59 @@ function ChartLock()
47912
48081
  }
47913
48082
  }
47914
48083
 
48084
+ this.Canvas.font=this.Font;
48085
+ var minWidth=this.Canvas.measureText(this.MinWidthText).width;
48086
+
48087
+ var aryText=null;
48088
+ if (Array.isArray(this.Title)) aryText=this.Title;
48089
+ else aryText=[{Text:this.Title}];
48090
+
48091
+ var outSize={ };
48092
+ if (!this.CalculateTextSize(aryText, this.Font, outSize)) outSize=null;
48093
+ if (outSize && outSize.Width+8>minWidth) minWidth=outSize.Width+8; //确保文字可以显示
48094
+
47915
48095
  if (bHScreen)
47916
48096
  {
47917
48097
  var rtBG={ Left:border.Left, Right:border.RightEx, Top:left, Bottom:border.Bottom };
47918
48098
  rtBG.Width=rtBG.Right-rtBG.Left;
47919
48099
  rtBG.Height=rtBG.Bottom-rtBG.Top;
47920
-
47921
- var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
47922
- this.Canvas.fillStyle =bgColor;
47923
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
48100
+ if (rtBG.Height<minWidth)
48101
+ {
48102
+ rtBG.Height=minWidth;
48103
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
48104
+ }
47924
48105
  this.LockRect=rtBG; //保存上锁区域
48106
+
48107
+ if (bDraw)
48108
+ {
48109
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Right, rtBG.Top);
48110
+ this.Canvas.fillStyle =bgColor;
48111
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
48112
+ }
47925
48113
  }
47926
48114
  else
47927
48115
  {
47928
48116
  var rtBG={ Left:left, Right:border.RightEx, Top:border.TopTitle, Bottom:border.Bottom };
47929
48117
  rtBG.Width=rtBG.Right-rtBG.Left;
47930
48118
  rtBG.Height=rtBG.Bottom-rtBG.Top;
47931
- //上下渐变
47932
- var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
47933
- this.Canvas.fillStyle =bgColor;
47934
- this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
48119
+ if (rtBG.Width<minWidth)
48120
+ {
48121
+ rtBG.Width=minWidth;
48122
+ rtBG.Left=rtBG.Right-rtBG.Width;
48123
+ }
47935
48124
  this.LockRect=rtBG; //保存上锁区域
48125
+
48126
+ if (bDraw)
48127
+ {
48128
+ //上下渐变
48129
+ var bgColor=this.SetFillStyle(this.BGColor, rtBG.Left, rtBG.Top, rtBG.Left, rtBG.Bottom);
48130
+ this.Canvas.fillStyle =bgColor;
48131
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
48132
+ }
47936
48133
  }
47937
48134
 
47938
- var aryText=null;
47939
- if (Array.isArray(this.Title)) aryText=this.Title;
47940
- else aryText=[{Text:this.Title}];
47941
-
47942
- var outSize={ };
47943
- if (!this.CalculateTextSize(aryText, this.Font, outSize)) return;
48135
+ if (!bDraw) return;
48136
+ if (!outSize) return;
47944
48137
 
47945
48138
  this.Canvas.textAlign='left';
47946
48139
  this.Canvas.textBaseline='bottom';
@@ -47951,67 +48144,54 @@ function ChartLock()
47951
48144
  var top=rtBG.Top+(rtBG.Height-outSize.Width)/2;
47952
48145
  if (outSize.Width>rtBG.Height) top=rtBG.Bottom-outSize.Width;
47953
48146
  var left=rtBG.Left+(rtBG.Width-outSize.Height)/2;
47954
-
47955
48147
  this.Canvas.save();
47956
48148
  this.Canvas.translate(left, top);
47957
48149
  this.Canvas.rotate(90 * Math.PI / 180);
47958
- var yText=0,xText=0;
47959
- for(var i=0;i<outSize.AryText.length;++i)
47960
- {
47961
- var item=outSize.AryText[i];
47962
- if (item.Color) this.Canvas.fillStyle=item.Color;
47963
- else this.Canvas.fillStyle=this.TextColor;
47964
-
47965
- if (item.Font) this.Canvas.font = item.Font;
47966
- else this.Canvas.font = this.Font;
47967
-
47968
- yText+=item.Height;
47969
- this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
47970
- }
47971
-
47972
- this.Canvas.restore();
48150
+ var left=0,top=0;
47973
48151
  }
47974
48152
  else
47975
48153
  {
47976
48154
  var left=rtBG.Left+(rtBG.Width-outSize.Width)/2;
47977
48155
  if (outSize.Width>rtBG.Width) left=rtBG.Right-outSize.Width;
47978
48156
  var top=rtBG.Top+(rtBG.Height-outSize.Height)/2;
47979
-
47980
- var yText=top, xText=left;
47981
- for(var i=0;i<outSize.AryText.length;++i)
48157
+ }
48158
+
48159
+ var yText=top, xText=left;
48160
+ for(var i=0;i<outSize.AryText.length;++i)
48161
+ {
48162
+ var item=outSize.AryText[i];
48163
+ xText=left;
48164
+ if (item.Image)
47982
48165
  {
47983
- var item=outSize.AryText[i];
47984
- if (item.Image)
48166
+ if (item.Align===1)
47985
48167
  {
47986
- xText=left;
47987
- if (item.Align===1)
47988
- {
47989
- if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
47990
- }
47991
-
47992
- this.Canvas.drawImage(item.Image.Data, xText, yText, item.Image.Width, item.Image.Height);
47993
-
47994
- yText+=item.Height;
48168
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
47995
48169
  }
47996
- else
47997
- {
47998
- if (item.Color) this.Canvas.fillStyle=item.Color;
47999
- else this.Canvas.fillStyle=this.TextColor;
48000
48170
 
48001
- if (item.Font) this.Canvas.font = item.Font;
48002
- else this.Canvas.font = this.Font;
48171
+ this.Canvas.drawImage(item.Image.Data, xText, yText, item.Image.Width, item.Image.Height);
48003
48172
 
48004
- yText+=item.Height;
48005
- xText=left;
48006
- if (item.Align===1)
48007
- {
48008
- if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
48009
- }
48173
+ yText+=item.Height;
48174
+ }
48175
+ else
48176
+ {
48177
+ if (item.Color) this.Canvas.fillStyle=item.Color;
48178
+ else this.Canvas.fillStyle=this.TextColor;
48010
48179
 
48011
- this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
48180
+ if (item.Font) this.Canvas.font = item.Font;
48181
+ else this.Canvas.font = this.Font;
48182
+
48183
+ yText+=item.Height;
48184
+
48185
+ if (item.Align===1)
48186
+ {
48187
+ if (outSize.Width>item.Width) xText+=(outSize.Width-item.Width)/2;
48012
48188
  }
48013
- }
48189
+
48190
+ this.Canvas.fillText(item.Text, xText, yText+item.YOffset);
48191
+ }
48014
48192
  }
48193
+
48194
+ if (bHScreen) this.Canvas.restore();
48015
48195
  }
48016
48196
 
48017
48197
  //x,y是否在上锁区域
@@ -48021,7 +48201,7 @@ function ChartLock()
48021
48201
 
48022
48202
  if (Path2DHelper.PtInRect(x,y,this.LockRect))
48023
48203
  {
48024
- tooltip.Data={ ID:this.LockID, Callback:this.Callback, IndexName:this.IndexName, IndexID:this.IndexID };
48204
+ tooltip.Data={ ID:this.LockID, Callback:this.Callback, IndexName:this.IndexName, IndexID:this.IndexID, Data:this.AryData };
48025
48205
  tooltip.ChartPaint=this;
48026
48206
  return true;
48027
48207
  }
@@ -82978,6 +83158,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
82978
83158
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
82979
83159
  frame.GlobalOption=this.GlobalOption;
82980
83160
  frame.CreateDivFrameToolbar(this, i, this.UIElement.parentNode);
83161
+ frame.CreateLockPaint();
82981
83162
 
82982
83163
  frame.HorizontalMax=20;
82983
83164
  frame.HorizontalMin=10;
@@ -83079,6 +83260,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
83079
83260
  frame.XSplitOperator.Symbol=this.Symbol;
83080
83261
  frame.XSplitOperator.Period=this.Period;
83081
83262
  frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
83263
+ frame.CreateLockPaint();
83082
83264
 
83083
83265
  //K线数据绑定
83084
83266
  var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;
@@ -85538,7 +85720,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85538
85720
 
85539
85721
 
85540
85722
  subFrame.YSpecificMaxMin=null; //清空指定最大最小值
85541
- subFrame.IsLocked=false; //解除上锁
85542
85723
  subFrame.YSplitScale = null; //清空固定刻度
85543
85724
  subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType; //还原Y坐标分割模式
85544
85725
 
@@ -85836,7 +86017,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85836
86017
 
85837
86018
 
85838
86019
  this.Frame.SubFrame[windowIndex].Frame.YSpecificMaxMin=null; //清空指定最大最小值
85839
- this.Frame.SubFrame[windowIndex].Frame.IsLocked=false; //解除上锁
85840
86020
  this.Frame.SubFrame[windowIndex].Frame.YSplitScale = null; //清空固定刻度
85841
86021
 
85842
86022
  this.ChartPaint=paint;
@@ -85894,7 +86074,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
85894
86074
  }
85895
86075
  else if (obj.Script) //动态执行脚本
85896
86076
  {
85897
- indexInfo={ Script:obj.Script, ID:obj.indexName, Name:obj.indexName};
86077
+ indexInfo={ Script:obj.Script, ID:obj.IndexName, Name:obj.IndexName};
85898
86078
  if (obj.Name) indexInfo.Name=obj.Name;
85899
86079
  }
85900
86080
  else
@@ -86229,7 +86409,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86229
86409
  this.DeleteIndexPaint(i);
86230
86410
  var frame=this.Frame.SubFrame[i];
86231
86411
  frame.YSpecificMaxMin=null;
86232
- frame.IsLocked=false;
86233
86412
  frame.YSplitScale = null;
86234
86413
  }
86235
86414
 
@@ -86609,51 +86788,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86609
86788
  }
86610
86789
  }
86611
86790
 
86612
- //锁|解锁指标 { Index:指标名字,IsLocked:是否要锁上,Callback:回调 }
86613
- this.LockIndex=function(lockData)
86614
- {
86615
- if (!lockData) return;
86616
- if (!lockData.IndexName) return;
86617
-
86618
- for(let i in this.WindowIndex)
86619
- {
86620
- let item=this.WindowIndex[i];
86621
- if (!item) conintue;
86622
- if (item.Name==lockData.IndexName)
86623
- {
86624
- item.SetLock(lockData);
86625
- this.Update();
86626
- break;
86627
- }
86628
- }
86629
- }
86630
-
86631
- this.TryClickLock=function(x,y)
86632
- {
86633
- for(var i=0;i<this.Frame.SubFrame.length; ++i)
86634
- {
86635
- var item=this.Frame.SubFrame[i];
86636
- if (!item.Frame.IsLocked) continue;
86637
- if (!item.Frame.LockPaint) continue;
86638
-
86639
- var tooltip=new TooltipData();
86640
- if (!item.Frame.LockPaint.GetTooltipData(x,y,tooltip)) continue;
86641
-
86642
- tooltip.HQChart=this;
86643
- var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_INDEX_LOCK);
86644
- if (event && event.Callback)
86645
- {
86646
- var sendData={ FrameID:item.Frame.Identify, Data:tooltip };
86647
- event.Callback(event,sendData,this);
86648
- }
86649
-
86650
- if (tooltip.Data.Callback) tooltip.Data.Callback(tooltip);
86651
- return true;
86652
- }
86653
-
86654
- return false;
86655
- }
86656
-
86657
86791
  this.TryClickIndexTitle=function(x,y)
86658
86792
  {
86659
86793
  for(var i in this.TitlePaint)
@@ -92643,6 +92777,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92643
92777
  frame.XPointCount=243;
92644
92778
  frame.HQChart=this;
92645
92779
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
92780
+ frame.CreateLockPaint();
92646
92781
 
92647
92782
  if (i>=2)
92648
92783
  {
@@ -92754,6 +92889,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92754
92889
  frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
92755
92890
  frame.XSplitOperator.Symbol=this.Symbol;
92756
92891
  frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
92892
+ frame.CreateLockPaint();
92757
92893
 
92758
92894
  if (this.DayCount>1)
92759
92895
  {
@@ -92879,7 +93015,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
92879
93015
  //清空指定最大最小值
92880
93016
 
92881
93017
  subFrame.YSpecificMaxMin=null;
92882
- subFrame.IsLocked=false; //解除上锁
92883
93018
  subFrame.YSplitOperator.SplitType=subFrame.YSplitOperator.DefaultSplitType; //还原Y坐标分割模式
92884
93019
 
92885
93020
  this.ChartPaint=paint;
@@ -93112,7 +93247,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
93112
93247
  this.DeleteIndexPaint(i);
93113
93248
  var frame=this.Frame.SubFrame[i];
93114
93249
  frame.YSpecificMaxMin=null;
93115
- frame.IsLocked=false;
93116
93250
  frame.YSplitScale = null;
93117
93251
  }
93118
93252
 
@@ -95359,9 +95493,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
95359
95493
  {
95360
95494
  overlayFrame=new OverlayIndexItem();
95361
95495
  overlayFrame.Identify='Position_Line_Frame';
95362
-
95363
- if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
95364
- else frame=new OverlayMinuteHScreenFrame();
95496
+ frame=this.CreateOverlayFrame();
95497
+ //if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
95498
+ //else frame=new OverlayMinuteHScreenFrame();
95365
95499
 
95366
95500
  frame.Canvas=this.Canvas;
95367
95501
  frame.MainFrame=subFrame.Frame;
@@ -95544,9 +95678,9 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
95544
95678
  var subFrame=this.Frame.SubFrame[windowIndex];
95545
95679
  var overlayFrame=new OverlayIndexItem();
95546
95680
  if (obj.Identify) overlayFrame.Identify=obj.Identify; //由外部指定id
95547
- var frame=null;
95548
- if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
95549
- else frame=new OverlayMinuteHScreenFrame();
95681
+ var frame=this.CreateOverlayFrame();
95682
+ //if (this.ClassName=="MinuteChartContainer") frame=new OverlayMinuteFrame();
95683
+ //else frame=new OverlayMinuteHScreenFrame();
95550
95684
  frame.Canvas=this.Canvas;
95551
95685
  frame.MainFrame=subFrame.Frame;
95552
95686
  frame.ChartBorder=subFrame.Frame.ChartBorder;
@@ -96460,25 +96594,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96460
96594
 
96461
96595
  return false;
96462
96596
  }
96463
-
96464
- this.TryClickLock=function(x,y)
96465
- {
96466
- for(var i=0;i<this.Frame.SubFrame.length; ++i)
96467
- {
96468
- var item=this.Frame.SubFrame[i];
96469
- if (!item.Frame.IsLocked) continue;
96470
- if (!item.Frame.LockPaint) continue;
96471
-
96472
- var tooltip=new TooltipData();
96473
- if (!item.Frame.LockPaint.GetTooltipData(x,y,tooltip)) continue;
96474
-
96475
- tooltip.HQChart=this;
96476
- if (tooltip.Data.Callback) tooltip.Data.Callback(tooltip);
96477
- return true;
96478
- }
96479
-
96480
- return false;
96481
- }
96482
96597
  }
96483
96598
 
96484
96599
  //盘前数据
@@ -98430,6 +98545,7 @@ function KLineChartHScreenContainer(uielement)
98430
98545
  frame.RightSpaceCount=this.RightSpaceCount; //右边
98431
98546
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
98432
98547
  frame.GlobalOption=this.GlobalOption;
98548
+ frame.CreateLockPaint();
98433
98549
 
98434
98550
  frame.HorizontalMax=20;
98435
98551
  frame.HorizontalMin=10;
@@ -98618,6 +98734,7 @@ function MinuteChartHScreenContainer(uielement)
98618
98734
  frame.XPointCount=243;
98619
98735
  frame.HQChart=this;
98620
98736
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
98737
+ frame.CreateLockPaint();
98621
98738
 
98622
98739
  var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];
98623
98740
  frame.HorizontalMax=DEFAULT_HORIZONTAL[0];
@@ -105393,8 +105510,6 @@ function JSDivFrameToolbar()
105393
105510
  this.SetToolbar(aryButton); //重新设置按钮
105394
105511
  }
105395
105512
 
105396
-
105397
-
105398
105513
  this.Destroy=function()
105399
105514
  {
105400
105515
  if (this.DivToolbar)
@@ -105576,6 +105691,37 @@ JSDivFrameToolbar.GetDfaultButtons=function()
105576
105691
  }
105577
105692
 
105578
105693
 
105694
+
105695
+ //DOM工厂类
105696
+ function JSDOMFactory()
105697
+ {
105698
+ //[key:name, { Create:function(divElement) { return new class(divElement); }} ]
105699
+ this.DataMap=new Map(
105700
+ [
105701
+ ["JSDivFrameToolbar", { Create:function(option) { return new JSDivFrameToolbar(option); } }],
105702
+ ]);
105703
+
105704
+ this.Create=function(name, option)
105705
+ {
105706
+ if (!this.DataMap.has(name))
105707
+ {
105708
+ JSConsole.Chart.Warn(`[JSDOMFactory::Create] can't find class=${name}.`);
105709
+ return null;
105710
+ }
105711
+
105712
+ var item=this.DataMap.get(name);
105713
+ return item.Create(option);
105714
+ }
105715
+
105716
+ this.Add=function(name, option)
105717
+ {
105718
+ this.DataMap.set(name, { Create:option.Create } );
105719
+ }
105720
+ }
105721
+
105722
+ var g_JSDOMFactory=new JSDOMFactory();
105723
+
105724
+
105579
105725
  function JSToolbarTooltip()
105580
105726
  {
105581
105727
  this.DivTooltip=null;