hqchart 1.1.15060 → 1.1.15070

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.
@@ -7470,6 +7470,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7470
7470
  this.DialogSearchIndex; //指标搜索
7471
7471
  this.DialogModifyIndexParam; //指标参数修改
7472
7472
  this.SmallFloatTooltipGroup; //小浮框tooltip信息集合
7473
+ this.JSToolbarTooltip; //指标标题工具栏tooltip信息
7473
7474
 
7474
7475
 
7475
7476
  this.RestoreFocusTimer=null; //恢复焦点定时器
@@ -13932,6 +13933,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13932
13933
  if (overlayItem.Frame && overlayItem.Frame.ReloadResource) overlayItem.Frame.ReloadResource(resource);
13933
13934
  }
13934
13935
  }
13936
+
13937
+ if (this.JSToolbarTooltip) this.JSToolbarTooltip.ReloadResource(resource); //工具栏提示框
13935
13938
  }
13936
13939
 
13937
13940
  this.ReloadChartPaint=function(resource)
@@ -14460,6 +14463,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
14460
14463
  if (!option) return;
14461
14464
 
14462
14465
  var frame=subFrame.Frame;
14466
+ var pixelRatio=GetDevicePixelRatio();
14463
14467
 
14464
14468
  if (option.Window)
14465
14469
  {
@@ -14499,6 +14503,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
14499
14503
  if (IFrameSplitOperator.IsBool(option.IsShowYLine)) subFrame.Frame.IsShowYLine=option.IsShowYLine;
14500
14504
  if (IFrameSplitOperator.IsBool(option.IsShowIndexTitle)) subFrame.Frame.IsShowIndexTitle=option.IsShowIndexTitle;
14501
14505
  if (IFrameSplitOperator.IsNumber(option.Height)) subFrame.Height=option.Height; //高度
14506
+ if (IFrameSplitOperator.IsNumber(option.TopSpace)) frame.ChartBorder.TopSpace=option.TopSpace*pixelRatio;
14507
+ if (IFrameSplitOperator.IsNumber(option.BottomSpace)) frame.ChartBorder.BottomSpace=option.BottomSpace*pixelRatio;
14502
14508
 
14503
14509
 
14504
14510
  if (IFrameSplitOperator.IsBool(option.IsShowLeftText))
@@ -17668,6 +17674,8 @@ function AverageWidthFrame()
17668
17674
  this.BeforeDrawXYCallback; //坐标绘制前回调,绘制深度图
17669
17675
  this.GetEventCallback; //事件回调
17670
17676
 
17677
+ this.DivFrameToolbar;
17678
+
17671
17679
  //工具栏的按钮样式
17672
17680
  this.ToolbarButtonStyle=g_JSChartResource.ToolbarButtonStyle;
17673
17681
  this.CloseWindowButton=CloneData(g_JSChartResource.Buttons.CloseWindow);
@@ -17717,6 +17725,8 @@ function AverageWidthFrame()
17717
17725
  this.ButtonTooltip=CloneData(g_JSChartResource.Buttons.Tooltip);
17718
17726
  this.AddIndexWindowButton=CloneData(g_JSChartResource.Buttons.AddIndexWindow);
17719
17727
  }
17728
+
17729
+ if (this.DivFrameToolbar) this.DivFrameToolbar.ReloadResource(resource);
17720
17730
  }
17721
17731
 
17722
17732
  this.DrawFrame=function()
@@ -20286,7 +20296,6 @@ function AverageWidthFrame()
20286
20296
  }
20287
20297
  }
20288
20298
 
20289
-
20290
20299
  if (IFrameSplitOperator.IsNumber(width.Right)) width.Right+=rightExtendWidth;
20291
20300
  if (IFrameSplitOperator.IsNumber(width.Left)) width.Left+=this.YTextPadding[0]+leftExtendLineWidth;
20292
20301
  if (IFrameSplitOperator.IsNumber(width.Right)) width.Right+=this.YTextPadding[1]+rightExtendLineWidth;
@@ -20294,25 +20303,34 @@ function AverageWidthFrame()
20294
20303
  return { TextWidth:width };
20295
20304
  }
20296
20305
 
20306
+ this.CreateDivFrameToolbar=function(hqchart, frameID, divHQChart)
20307
+ {
20308
+ if (this.ToolbarButtonStyle==1) return;
20309
+ if (this.DivFrameToolbar) return;
20310
+
20311
+ if (this.ClassName=="MinuteFrame" || this.ClassName=="KLineFrame")
20312
+ {
20313
+ this.DivFrameToolbar=new JSDivFrameToolbar();
20314
+ this.DivFrameToolbar.HQChart=hqchart;
20315
+ this.DivFrameToolbar.DivHQChart=divHQChart;
20316
+ this.DivFrameToolbar.FrameID=frameID;
20317
+ this.DivFrameToolbar.Create(this);
20318
+ }
20319
+ }
20320
+
20297
20321
  this.ClearToolbar=function()
20298
20322
  {
20299
- if (!this.ToolbarID) return;
20323
+ if (!this.DivFrameToolbar) return;
20300
20324
 
20301
- var divToolbar=document.getElementById(this.ToolbarID);
20302
- if (!divToolbar) return;
20303
- this.ChartBorder.UIElement.parentNode.removeChild(divToolbar);
20304
- this.ToolbarRect=null;
20325
+ this.DivFrameToolbar.Destroy();
20326
+ this.DivFrameToolbar=null;
20305
20327
  }
20306
20328
 
20307
20329
  this.HideToolbar=function()
20308
20330
  {
20309
- if (!this.ToolbarID) return;
20331
+ if (!this.DivFrameToolbar) return;
20310
20332
 
20311
- this.ToolbarRect=null;
20312
- var divToolbar=document.getElementById(this.ToolbarID);
20313
- if (!divToolbar) return;
20314
-
20315
- if (divToolbar.style.display!='none') divToolbar.style.display='none';
20333
+ this.DivFrameToolbar.Hide();
20316
20334
  }
20317
20335
 
20318
20336
  this.GetMainOverlayFrame=function()
@@ -20350,7 +20368,6 @@ function MinuteFrame()
20350
20368
  this.MultiDayBorderPen=g_JSChartResource.MultiDayBorderPen;
20351
20369
  this.CustomHorizontalInfo=[];
20352
20370
  this.RightFrame=null; //右侧多重坐标
20353
- this.ToolbarID=Guid(); //工具条Div id
20354
20371
  this.ReDrawToolbar=false;
20355
20372
  this.DayCount=1; //显示天数
20356
20373
 
@@ -20363,7 +20380,6 @@ function MinuteFrame()
20363
20380
  this.OverlayIndex=g_JSChartResource.MinuteToolbar.OverlayIndex; //是否显示叠加指标
20364
20381
  this.AddIndexWindow=g_JSChartResource.MinuteToolbar.AddIndexWindow; //是否显示'增加指标窗口'菜单
20365
20382
 
20366
- this.ToolbarRect=null; //保存工具条的位置
20367
20383
  this.IsShowPositionTitle=false; //是否显示持仓标题
20368
20384
 
20369
20385
  this.LastCalculateStatus={ Width:0, XPointCount:0 }; //最后一次计算宽度的状态
@@ -20495,112 +20511,8 @@ function MinuteFrame()
20495
20511
  if (this.ToolbarButtonStyle==1) return;
20496
20512
  if (g_JSChartResource.IsDOMFrameToolbar===true) return;
20497
20513
 
20498
- if (typeof($)=="undefined") return;
20499
-
20500
- if (this.Identify<2) return;
20501
- if (!this.ChartBorder.UIElement) return;
20502
-
20503
- var divToolbar=document.getElementById(this.ToolbarID);
20504
- if (divToolbar && this.SizeChange==false && this.ReDrawToolbar==false) return;
20505
-
20506
- if (!divToolbar)
20507
- {
20508
- divToolbar=document.createElement("div");
20509
- divToolbar.className='klineframe-toolbar';
20510
- divToolbar.id=this.ToolbarID;
20511
- divToolbar.oncontextmenu = function() { return false;}; //屏蔽右键系统菜单
20512
- //为divToolbar添加属性identify
20513
- divToolbar.setAttribute("identify",this.Identify.toString());
20514
- this.ChartBorder.UIElement.parentNode.appendChild(divToolbar);
20515
- }
20516
-
20517
- if (!this.ModifyIndex && !this.ChangeIndex && !this.OverlayIndex && !this.CloseIndex)
20518
- {
20519
- if (divToolbar.style.display!='none')
20520
- divToolbar.style.display='none';
20521
- return;
20522
- }
20523
-
20524
- //使用外城div尺寸 画图尺寸是被放大的
20525
- var pixelTatio = GetDevicePixelRatio();
20526
- var chartWidth=parseInt(this.ChartBorder.UIElement.parentElement.style.width.replace("px",""));
20527
- var chartHeight=parseInt(this.ChartBorder.UIElement.parentElement.style.height.replace("px",""));
20528
- //JSConsole.Chart.Log('[KLineFrame::DrawToolbar] ',chartWidth,chartHeight,pixelTatio);
20529
-
20530
- var toolbarWidth=100;
20531
- var toolbarHeight=this.ChartBorder.GetTitleHeight();
20532
- var left=chartWidth-(this.ChartBorder.Right/pixelTatio)-toolbarWidth;
20533
- var top=this.ChartBorder.GetTop()/pixelTatio;
20534
-
20535
- if (this.ToolbarRect)
20536
- {
20537
- //尺寸变动移动才重新设置DOM
20538
- if (this.ToolbarRect.Left==left && this.ToolbarRect.Top==top &&
20539
- this.ToolbarRect.Width==toolbarWidth && this.ToolbarRect.Height==toolbarHeight/pixelTatio)
20540
- {
20541
- return;
20542
- }
20543
- }
20544
-
20545
- this.ToolbarRect={ Left:left, Top:top, Width:toolbarWidth, Height:toolbarHeight/pixelTatio };
20546
-
20547
- const modifyButton=`<span class='index_param icon iconfont icon-index_param' id='modifyindex' style='cursor:pointer;margin-left:2px;margin-right:2px;' title='调整指标参数'></span>`;
20548
- const changeButton=`<span class='index_change icon iconfont icon-change_index' id='changeindex' style='cursor:pointer;margin-left:2px;margin-right:2px;' title='切换指标'></span>`;
20549
- const closeButton=`<span class='index_close icon iconfont icon-close' id='closeindex' style='cursor:pointer;margin-left:2px;margin-right:2px;' title='关闭指标窗口'></span>`;
20550
-
20551
- var spanIcon=modifyButton+changeButton;
20552
- if (this.CloseIndex)
20553
- {
20554
- spanIcon+=closeButton;
20555
- }
20556
-
20557
- //var scrollPos=GetScrollPosition();
20558
- //left = left+scrollPos.Left;
20559
- //top = top+scrollPos.Top;
20560
- divToolbar.style.left = left + "px";
20561
- divToolbar.style.top = top + "px";
20562
- divToolbar.style.width=toolbarWidth+"px"; //宽度先不调整吧
20563
- divToolbar.style.height=(toolbarHeight/pixelTatio)+'px'; //只调整高度
20564
- divToolbar.innerHTML=spanIcon;
20565
-
20566
- var chart=this.ChartBorder.UIElement.JSChartContainer;
20567
- var identify=this.Identify;
20568
- if (!this.ModifyIndex) //隐藏'改参数'
20569
- $("#"+divToolbar.id+" .index_param").hide();
20570
- else if (typeof(this.ModifyIndexEvent)=='function') //绑定点击事件
20571
- $("#"+divToolbar.id+" .index_param").click(
20572
- {
20573
- Chart:this.ChartBorder.UIElement.JSChartContainer,
20574
- Identify:this.Identify
20575
- },this.ModifyIndexEvent);
20576
-
20577
- if (!this.ChangeIndex) //隐藏'换指标'
20578
- {
20579
- $("#"+divToolbar.id+" .index_change").hide();
20580
- }
20581
- else if (typeof(this.ChangeIndexEvent)=='function')
20582
- {
20583
- $("#"+divToolbar.id+" .index_change").click(
20584
- {
20585
- Chart:this.ChartBorder.UIElement.JSChartContainer,
20586
- Identify:this.Identify,
20587
- IsOverlay:false
20588
- },this.ChangeIndexEvent);
20589
- }
20590
-
20591
- $("#"+divToolbar.id+" .index_close").click(
20592
- {
20593
- Chart:this.ChartBorder.UIElement.JSChartContainer,
20594
- Identify:this.Identify
20595
- },
20596
- function(event)
20597
- {
20598
- var hqChart=event.data.Chart;
20599
- var id=event.data.Identify;
20600
- hqChart.RemoveIndexWindow(id);
20601
- });
20602
-
20603
- divToolbar.style.display = "block";
20514
+ if (!this.DivFrameToolbar) return;
20515
+ this.DivFrameToolbar.Show(this.Identify);
20604
20516
  }
20605
20517
 
20606
20518
  //手绘,不用DOM,使用DOM太麻烦了
@@ -22782,7 +22694,6 @@ function KLineFrame()
22782
22694
  delete this.newMethod;
22783
22695
 
22784
22696
  this.ClassName='KLineFrame';
22785
- this.ToolbarID=Guid(); //工具条Div id
22786
22697
 
22787
22698
  this.ModifyIndex=g_JSChartResource.KLineToolbar.ModifyIndex; //是否显示'改参数'菜单
22788
22699
  this.ChangeIndex=g_JSChartResource.KLineToolbar.ChangeIndex; //是否显示'换指标'菜单
@@ -22795,7 +22706,6 @@ function KLineFrame()
22795
22706
 
22796
22707
  this.SelBorderColor=g_JSChartResource.SelFrameBorderColor;
22797
22708
 
22798
- this.ToolbarRect=null; //保存工具条的位置
22799
22709
  this.ReDrawToolbar=false;
22800
22710
 
22801
22711
  this.LastCalculateStatus={ Width:0, XPointCount:0 }; //最后一次计算宽度的状态
@@ -22819,6 +22729,11 @@ function KLineFrame()
22819
22729
  {
22820
22730
  if (this.ToolbarButtonStyle==1) return;
22821
22731
  if (g_JSChartResource.IsDOMFrameToolbar===true) return;
22732
+ if (!this.DivFrameToolbar) return;
22733
+
22734
+ this.DivFrameToolbar.Show(this.Identify);
22735
+
22736
+ return;
22822
22737
 
22823
22738
  if (typeof($)=="undefined") return;
22824
22739
 
@@ -57240,6 +57155,10 @@ function KLineCountDownPaint()
57240
57155
  this.CanvasEx.fillStyle=out.BGColor;
57241
57156
  this.CanvasEx.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
57242
57157
  }
57158
+ else
57159
+ {
57160
+ return;
57161
+ }
57243
57162
 
57244
57163
  this.Canvas.textAlign = "left";
57245
57164
  this.Canvas.textBaseline = "bottom";
@@ -70833,7 +70752,7 @@ function ChartDrawPictureHorizontalLine()
70833
70752
  {
70834
70753
  Left:{ IsShow:true, Margin:{ Left:5, Top:4, Bottom:2, Right:5 } },
70835
70754
  Right:{ IsShow:true, Margin:{ Left:5, Top:4, Bottom:2, Right:5 } },
70836
- Font:`${12*GetDevicePixelRatio()}px 微软雅黑`, TextColor:"rgb(255,255,255)"
70755
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`, TextColor:"rgb(255,255,255)", BGColor:null
70837
70756
  };
70838
70757
 
70839
70758
  this.InsideLabelConfig=
@@ -70842,7 +70761,8 @@ function ChartDrawPictureHorizontalLine()
70842
70761
  Font:`${14*GetDevicePixelRatio()}px 微软雅黑`,
70843
70762
  Margin:{ Left:5, Top:4, Bottom:2, Right:5 },
70844
70763
  TextColor:"rgb(255,255,255)",
70845
- BGAlpha:0.8, //背景色透明度
70764
+ BGAlpha:0.8, //背景色透明度,
70765
+ IsShow:true
70846
70766
  }
70847
70767
 
70848
70768
  this.LabelTitle;
@@ -70871,7 +70791,8 @@ function ChartDrawPictureHorizontalLine()
70871
70791
  }
70872
70792
 
70873
70793
  if (item.Font) this.LabelConfig.Font=item.Font;
70874
- if (item.TextColor) this.LabelConfig.FoTextColornt=item.TextColor;
70794
+ if (item.TextColor) this.LabelConfig.TextColor=item.TextColor;
70795
+ if (item.BGColor) this.LabelConfig.BGColor=item.BGColor;
70875
70796
  }
70876
70797
 
70877
70798
  if (option.InsideLabel)
@@ -70881,6 +70802,7 @@ function ChartDrawPictureHorizontalLine()
70881
70802
  if (item.TextColor) this.InsideLabelConfig.TextColor=item.TextColor;
70882
70803
  if (IFrameSplitOperator.IsNumber(item.Position)) this.InsideLabelConfig.Position=item.Position;
70883
70804
  if (IFrameSplitOperator.IsNumber(item.BGAlpha)) this.InsideLabelConfig.BGAlpha=item.BGAlpha;
70805
+ if (IFrameSplitOperator.IsBool(item.IsShow)) this.InsideLabelConfig.IsShow=item.IsShow;
70884
70806
  }
70885
70807
  }
70886
70808
  }
@@ -70892,6 +70814,8 @@ function ChartDrawPictureHorizontalLine()
70892
70814
  {
70893
70815
  storageData=this.Super_ExportStorageData();
70894
70816
  if (this.LabelTitle) storageData.LabelTitle=this.LabelTitle;
70817
+ if (this.LabelConfig) storageData.Label=this.LabelConfig;
70818
+ if (this.InsideLabelConfig) storageData.InsideLabel=this.InsideLabelConfig;
70895
70819
  }
70896
70820
 
70897
70821
  return storageData;
@@ -70998,7 +70922,8 @@ function ChartDrawPictureHorizontalLine()
70998
70922
  rtBG.Bottom=rtBG.Top+rtBG.Height;
70999
70923
  rtBG.Left=rtBG.Right-rtBG.Width;
71000
70924
 
71001
- this.Canvas.fillStyle=this.LineColor;
70925
+ if (config.BGColor) this.Canvas.fillStyle=config.BGColor;
70926
+ else this.Canvas.fillStyle=this.LineColor;
71002
70927
  this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
71003
70928
 
71004
70929
  this.Canvas.textAlign="left";
@@ -71016,7 +70941,9 @@ function ChartDrawPictureHorizontalLine()
71016
70941
  rtBG.Top=y-textHeight/2-margin.Top;
71017
70942
  rtBG.Bottom=rtBG.Top+rtBG.Height;
71018
70943
  rtBG.Right=rtBG.Left+rtBG.Width;
71019
- this.Canvas.fillStyle=this.LineColor;
70944
+
70945
+ if (config.BGColor) this.Canvas.fillStyle=config.BGColor;
70946
+ else this.Canvas.fillStyle=this.LineColor;
71020
70947
  this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
71021
70948
 
71022
70949
  this.Canvas.textAlign="left";
@@ -71034,6 +70961,7 @@ function ChartDrawPictureHorizontalLine()
71034
70961
 
71035
70962
  var isHScreen=this.Frame.IsHScreen;
71036
70963
  var config=this.InsideLabelConfig;
70964
+ if (!config.IsShow) return;
71037
70965
  if (config.Position!=0 && config.Position!=1) return;
71038
70966
  var margin=config.Margin;
71039
70967
 
@@ -81573,6 +81501,12 @@ function JSChartResource()
81573
81501
  Mergin:{ Left:4, Right:4, Top:2, Bottom:3 },
81574
81502
  }
81575
81503
  }
81504
+
81505
+ this.DivFrameToolbar=
81506
+ {
81507
+ Icon:{ Color:"rgb(0,0,0)", HoverColor:"rgb(30,144,255)" },
81508
+ Tooltip:{ BGColor:"rgb(255,255,255)", TextColor:"rgb(71,71,71)", BorderColor:"rgb(0,0,0)" },
81509
+ }
81576
81510
 
81577
81511
  //画图工具
81578
81512
  this.DrawPicture=
@@ -83551,6 +83485,29 @@ function JSChartResource()
83551
83485
  if (style.KLineCountDownPaint) this.SetKLineCountDownPaint(style.KLineCountDownPaint);
83552
83486
 
83553
83487
  if (style.SmallFloatTooltipV2) this.SetSmallFloatTooltipV2(style.SmallFloatTooltipV2);
83488
+
83489
+ if (style.DivFrameToolbar) this.SetDivFrameToolbar(style.DivFrameToolbar);
83490
+ }
83491
+
83492
+ this.SetDivFrameToolbar=function(style)
83493
+ {
83494
+ var dest=this.DivFrameToolbar;
83495
+ if (style.Icon)
83496
+ {
83497
+ var item=style.Icon;
83498
+ var subDest=dest.Icon;
83499
+ if (item.Color) subDest.Color=item.Color;
83500
+ if (item.HoverColor) subDest.HoverColor=item.HoverColor;
83501
+ }
83502
+
83503
+ if (style.Tooltip)
83504
+ {
83505
+ var item=style.Tooltip;
83506
+ var subDest=dest.Tooltip;
83507
+ if (item.TextColor) subDest.TextColor=item.TextColor;
83508
+ if (item.BorderColor) subDest.BorderColor=item.BorderColor;
83509
+ if (item.BGColor) subDest.BGColor=item.BGColor;
83510
+ }
83554
83511
  }
83555
83512
 
83556
83513
  this.SetSmallFloatTooltipV2=function(style)
@@ -86887,6 +86844,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86887
86844
  frame.RightSpaceCount=this.RightSpaceCount; //右边
86888
86845
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
86889
86846
  frame.GlobalOption=this.GlobalOption;
86847
+ frame.CreateDivFrameToolbar(this, i, this.UIElement.parentNode);
86890
86848
 
86891
86849
  frame.HorizontalMax=20;
86892
86850
  frame.HorizontalMin=10;
@@ -86987,6 +86945,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86987
86945
  frame.YSplitOperator.HQChart=this;
86988
86946
  frame.XSplitOperator.Symbol=this.Symbol;
86989
86947
  frame.XSplitOperator.Period=this.Period;
86948
+ frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
86990
86949
 
86991
86950
  //K线数据绑定
86992
86951
  var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;
@@ -89577,7 +89536,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
89577
89536
  if (bChanged)
89578
89537
  {
89579
89538
  frame.SizeChange=true;
89580
- frame.ToolbarRect=null; //清空工具栏缓存
89581
89539
  frame.DrawToolbar();
89582
89540
  }
89583
89541
  }
@@ -96548,7 +96506,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96548
96506
 
96549
96507
  if (i>=2)
96550
96508
  {
96551
-
96509
+ frame.CreateDivFrameToolbar(this, i, this.UIElement.parentNode);
96552
96510
  }
96553
96511
 
96554
96512
  var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];
@@ -96655,6 +96613,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96655
96613
  frame.XSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
96656
96614
  frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
96657
96615
  frame.XSplitOperator.Symbol=this.Symbol;
96616
+ frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
96658
96617
 
96659
96618
  if (this.DayCount>1)
96660
96619
  {
@@ -109401,6 +109360,375 @@ Path2DHelper.PtInRect=function(x, y, rect)
109401
109360
  }
109402
109361
 
109403
109362
 
109363
+ ////////////////////////////////////////////////////////////////////////////////////
109364
+ // 指标窗口顶部工具条
109365
+ //
109366
+ //
109367
+ ///////////////////////////////////////////////////////////////////////////////////
109368
+
109369
+
109370
+ function JSDivFrameToolbar()
109371
+ {
109372
+ this.DivToolbar=null;
109373
+ this.DivHQChart=null;
109374
+ this.HQChart=null;
109375
+ this.FrameID=-1; //指标窗口ID
109376
+ this.ID=Guid();
109377
+ this.Left=-1;
109378
+ this.Top=-1;
109379
+
109380
+ this.IconConfig=
109381
+ {
109382
+ Color:g_JSChartResource.DivFrameToolbar.Icon.Color,
109383
+ HoverColor:g_JSChartResource.DivFrameToolbar.Icon.HoverColor
109384
+ }
109385
+
109386
+ this.AryButton=[]; //按钮数组
109387
+
109388
+ //创建按钮
109389
+ this.CreateArrayButton=function(aryButton)
109390
+ {
109391
+ for(var i=0;i<aryButton.length; i++)
109392
+ {
109393
+ var item=aryButton[i];
109394
+ if (!item.ID || !item.ClassName) continue;
109395
+ var newItem={ ID:item.ID, ClassName:item.ClassName, Span:null,Div:null, TooltipSpan:null };
109396
+ if (item.Tooltip && item.Tooltip.Text) newItem.Tooltip={ Text:item.Tooltip.Text };
109397
+
109398
+ this.AryButton.push(newItem);
109399
+
109400
+ if (this.DivToolbar) this.CreateButton(newItem, this.DivToolbar);
109401
+ }
109402
+ }
109403
+
109404
+ //清空原来的按钮
109405
+ this.ClearAllButtons=function()
109406
+ {
109407
+ //清空原来的按钮
109408
+ for(var i=0; i<this.AryButton.length; i++)
109409
+ {
109410
+ var item=this.AryButton[i];
109411
+ if (item.Div && this.DivToolbar) this.DivToolbar.removeChild(item.Div);
109412
+ item.Div=null;
109413
+ item.Span=null;
109414
+ item.TooltipSpan=null;
109415
+ }
109416
+
109417
+ this.AryButton=[];
109418
+ }
109419
+
109420
+ this.GetShowButtons=function(subFrame)
109421
+ {
109422
+ var frame=subFrame;
109423
+ if (!frame && this.FrameID>=0 && this.FrameID<this.HQChart.Frame.SubFrame.length)
109424
+ frame=this.HQChart.Frame.SubFrame[this.FrameID].Frame;
109425
+
109426
+ var aryDefaultButton=JSDivFrameToolbar.GetDfaultButtons();
109427
+ var aryButton=[];
109428
+ for(var i=0;i<aryDefaultButton.length; i++)
109429
+ {
109430
+ var item=aryDefaultButton[i];
109431
+ if (this.FrameID==0 && item.ID==JSCHART_BUTTON_ID.CLOSE_INDEX_WINDOW) continue; //第一个指标窗口不显示关闭按钮
109432
+
109433
+ if (item.ID==JSCHART_BUTTON_ID.MODIFY_INDEX_PARAM && frame && frame.ModifyIndex===false) continue;
109434
+ if (item.ID==JSCHART_BUTTON_ID.CHANGE_INDEX && frame && frame.ChangeIndex===false) continue;
109435
+ if (item.ID==JSCHART_BUTTON_ID.OVERLAY_INDEX && frame && frame.OverlayIndex===false) continue;
109436
+ if (item.ID==JSCHART_BUTTON_ID.CLOSE_INDEX_WINDOW && frame && frame.CloseIndex===false) continue;
109437
+
109438
+ aryButton.push(item);
109439
+ }
109440
+
109441
+ return aryButton;
109442
+ }
109443
+
109444
+ this.SetToolbar=function(aryButton)
109445
+ {
109446
+ this.ClearAllButtons(); //清空原来的按钮
109447
+
109448
+ this.CreateArrayButton(aryButton); //重新创建
109449
+
109450
+ this.UpdateStyle();
109451
+ }
109452
+
109453
+ this.UpdateButton=function()
109454
+ {
109455
+ if (!this.DivToolbar) return;
109456
+
109457
+ var aryButton=this.GetShowButtons();
109458
+ var bChange=false;
109459
+ if (aryButton.length!=this.AryButton.length)
109460
+ {
109461
+ bChange=true;
109462
+ }
109463
+ else
109464
+ {
109465
+ for(var i=0;i<this.AryButton.length;++i)
109466
+ {
109467
+ var leftItem=this.AryButton[i];
109468
+ var rightItem=aryButton[i];
109469
+
109470
+ if (leftItem.ID!=rightItem.ID || leftItem.ClassName!=rightItem.ClassName)
109471
+ {
109472
+ bChange=true;
109473
+ break;
109474
+ }
109475
+ }
109476
+ }
109477
+
109478
+ if (!bChange) return;
109479
+
109480
+ this.SetToolbar(aryButton); //重新设置按钮
109481
+ }
109482
+
109483
+
109484
+
109485
+ this.Destroy=function()
109486
+ {
109487
+ if (this.DivToolbar)
109488
+ {
109489
+ if (this.DivHQChart.removeChild) this.DivHQChart.removeChild(this.DivToolbar);
109490
+ this.DivToolbar=null;
109491
+ }
109492
+
109493
+ this.HQChart=null;
109494
+ this.DivHQChart=null;
109495
+ this.FrameID=-1;
109496
+ }
109497
+
109498
+ this.Create=function(frame)
109499
+ {
109500
+ var divToolbar=document.createElement("div");
109501
+ divToolbar.className='UMyChart_FrameToolbar_Div';
109502
+ divToolbar.id=this.ID;
109503
+ divToolbar.oncontextmenu = function() { return false; }; //屏蔽右键系统菜单
109504
+ this.DivToolbar=divToolbar;
109505
+
109506
+ var aryButtons=this.GetShowButtons(frame);
109507
+ this.CreateArrayButton(aryButtons)
109508
+
109509
+ this.DivHQChart.appendChild(divToolbar);
109510
+
109511
+ this.UpdateStyle();
109512
+
109513
+ if (!this.HQChart.JSToolbarTooltip)
109514
+ {
109515
+ this.HQChart.JSToolbarTooltip=new JSToolbarTooltip();
109516
+ this.HQChart.JSToolbarTooltip.DivHQChart=this.DivHQChart;
109517
+ this.HQChart.JSToolbarTooltip.Create();
109518
+ }
109519
+ }
109520
+
109521
+ this.UpdateStyle=function()
109522
+ {
109523
+ if (!this.DivToolbar) return;
109524
+
109525
+ for(var i=0;i<this.AryButton.length; i++)
109526
+ {
109527
+ var item=this.AryButton[i]
109528
+ if (!item.Span) continue;
109529
+ item.Span.style["color"]=this.IconConfig.Color;
109530
+ }
109531
+ }
109532
+
109533
+ this.ReloadResource=function(option)
109534
+ {
109535
+ this.IconConfig.Color=g_JSChartResource.DivFrameToolbar.Icon.Color,
109536
+ this.IconConfig.HoverColor=g_JSChartResource.DivFrameToolbar.Icon.HoverColor;
109537
+
109538
+ this.UpdateStyle();
109539
+ }
109540
+
109541
+ this.CreateButton=function(item, divDom)
109542
+ {
109543
+ var btnDiv=document.createElement("div");
109544
+ btnDiv.className="UMyChart_FrameToolbar_Div_Button";
109545
+ btnDiv.onmouseover=(e)=> { this.OnHoverButton(e, item); }
109546
+ btnDiv.onmouseout=(e)=>{ this.OnLeaveButton(e, item); }
109547
+ item.Div=btnDiv;
109548
+
109549
+ var spanDom=document.createElement("span");
109550
+ spanDom.className=item.ClassName;
109551
+ spanDom.onmousedown=(e)=>{ this.OnClickButton(e, item); };
109552
+ item.Span=spanDom;
109553
+ btnDiv.appendChild(spanDom);
109554
+
109555
+ divDom.appendChild(btnDiv);
109556
+ }
109557
+
109558
+ this.OnClickButton=function(e, item)
109559
+ {
109560
+ if (!this.FrameID<0) return;
109561
+ if (!this.HQChart) return;
109562
+
109563
+ var frame=this.HQChart.Frame.SubFrame[this.FrameID].Frame;
109564
+
109565
+ var button={ ID:item.ID, Frame:frame };
109566
+ this.HQChart.ClickFrameButton(button, e);
109567
+ }
109568
+
109569
+ this.OnHoverButton=function(e, item)
109570
+ {
109571
+ if (!item.Span) return;
109572
+
109573
+ item.Span.style["color"]=this.IconConfig.HoverColor;
109574
+
109575
+ this.ShowTooltip(e, item);
109576
+ }
109577
+
109578
+ this.OnLeaveButton=function(e, item)
109579
+ {
109580
+ if (!item.Span) return;
109581
+ item.Span.style["color"]=this.IconConfig.Color;
109582
+
109583
+ this.HideTooltip();
109584
+ }
109585
+
109586
+ this.Show=function(frameID)
109587
+ {
109588
+ this.FrameID=frameID;
109589
+ if (!this.FrameID<0) return;
109590
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.HQChart.Frame.SubFrame)) return;
109591
+ if (!this.HQChart.Frame.SubFrame[this.FrameID]) return;
109592
+
109593
+ var pixelTatio = GetDevicePixelRatio();
109594
+ var frame=this.HQChart.Frame.SubFrame[this.FrameID].Frame;
109595
+ var border=frame.GetBorder();
109596
+
109597
+ var top=border.Top/pixelTatio;
109598
+ var right=border.RightEx/pixelTatio;
109599
+ var left=right-this.DivToolbar.offsetWidth-2;
109600
+
109601
+ if (this.Top!=top || this.Left!=left)
109602
+ {
109603
+ this.DivToolbar.style.top = top + "px";
109604
+ this.DivToolbar.style.left = left + "px";
109605
+ this.DivToolbar.style.height=frame.ChartBorder.TitleHeight/pixelTatio + "px";
109606
+ this.Top=top;
109607
+ this.Left=left;
109608
+ }
109609
+
109610
+ if (this.DivToolbar.style.visibility!='visible') this.DivToolbar.style.visibility='visible';
109611
+ }
109612
+
109613
+ this.Hide=function()
109614
+ {
109615
+ if (this.DivToolbar) this.DivToolbar.style.visibility="hidden";
109616
+ }
109617
+
109618
+ this.HideTooltip=function()
109619
+ {
109620
+ if (this.HQChart.JSToolbarTooltip) this.HQChart.JSToolbarTooltip.Hide();
109621
+ }
109622
+
109623
+ this.ShowTooltip=function(e, item)
109624
+ {
109625
+ if (!this.HQChart.JSToolbarTooltip) return;
109626
+ if (!item.Div) return;
109627
+
109628
+ var rtButton=item.Div.getBoundingClientRect();
109629
+ var rtHQChart=this.DivHQChart.getBoundingClientRect();
109630
+ var left=rtButton.left-rtHQChart.left;
109631
+ var top=rtButton.bottom-rtHQChart.top+2;
109632
+ this.HQChart.JSToolbarTooltip.Show(top, left, { Text:item.Tooltip.Text });
109633
+ }
109634
+ }
109635
+
109636
+ JSDivFrameToolbar.GetDfaultButtons=function()
109637
+ {
109638
+ var aryButton=
109639
+ [
109640
+
109641
+ {
109642
+ ID:JSCHART_BUTTON_ID.MODIFY_INDEX_PARAM, ClassName:"UMyChart_FrameToolbar_Span_Button icon iconfont icon-index_param", Tooltip:{ Text:"修改参数"},
109643
+ Span:null, Div:null, TooltipSpan:null
109644
+ },
109645
+ {
109646
+ ID:JSCHART_BUTTON_ID.CHANGE_INDEX, ClassName:"UMyChart_FrameToolbar_Span_Button icon iconfont icon-change_index", Tooltip:{ Text:"切换指标"},
109647
+ Span:null,Div:null, TooltipSpan:null
109648
+ },
109649
+ {
109650
+ ID:JSCHART_BUTTON_ID.OVERLAY_INDEX, ClassName:"UMyChart_FrameToolbar_Span_Button icon iconfont icon-overlay_index", Tooltip:{ Text:"叠加指标"},
109651
+ Span:null,Div:null, TooltipSpan:null
109652
+ },
109653
+ {
109654
+ ID:JSCHART_BUTTON_ID.CLOSE_INDEX_WINDOW, ClassName:"UMyChart_FrameToolbar_Span_Button icon iconfont icon-close", Tooltip:{ Text:"关闭窗口"},
109655
+ Span:null,Div:null, TooltipSpan:null
109656
+ },
109657
+ ];
109658
+
109659
+ return aryButton
109660
+ }
109661
+
109662
+
109663
+ function JSToolbarTooltip()
109664
+ {
109665
+ this.DivTooltip=null;
109666
+ this.DivHQChart=null;
109667
+ this.Text=null;
109668
+ this.Left=-1;
109669
+ this.Top=-1;
109670
+
109671
+ this.BGColor=g_JSChartResource.DivFrameToolbar.Tooltip.BGColor;
109672
+ this.TextColor=g_JSChartResource.DivFrameToolbar.Tooltip.TextColor;
109673
+ this.BorderColor=g_JSChartResource.DivFrameToolbar.Tooltip.BorderColor;
109674
+
109675
+ this.Create=function()
109676
+ {
109677
+ var divDom=document.createElement("div");
109678
+ divDom.className='UMyChart_Toolbar_Tooltip_Div';
109679
+ this.DivHQChart.appendChild(divDom);
109680
+
109681
+ this.DivTooltip=divDom;
109682
+
109683
+ this.UpdateStyle();
109684
+ }
109685
+
109686
+ this.ReloadResource=function(option)
109687
+ {
109688
+ this.BGColor=g_JSChartResource.DivFrameToolbar.Tooltip.BGColor;
109689
+ this.TextColor=g_JSChartResource.DivFrameToolbar.Tooltip.TextColor;
109690
+ this.BorderColor=g_JSChartResource.DivFrameToolbar.Tooltip.BorderColor;
109691
+
109692
+ this.UpdateStyle();
109693
+ }
109694
+
109695
+ this.UpdateStyle=function()
109696
+ {
109697
+ if (!this.DivTooltip) return;
109698
+
109699
+ this.DivTooltip.style["background-color"]=this.BGColor;
109700
+ this.DivTooltip.style["color"]=this.TextColor;
109701
+ this.DivTooltip.style["border"]="1px solid " + this.BorderColor;
109702
+ }
109703
+
109704
+ this.Show=function(top, left, tooltipData)
109705
+ {
109706
+ if (!this.DivTooltip) return;
109707
+
109708
+ if (this.Text!=tooltipData.Text) this.DivTooltip.innerHTML=tooltipData.Text;
109709
+ var right=left+this.DivTooltip.offsetWidth;
109710
+ if ((right+5)>=window.innerWidth) left=left-this.DivTooltip.offsetWidth;
109711
+
109712
+ if (this.Top!=top || this.Left!=left)
109713
+ {
109714
+ this.DivTooltip.style.top = top + "px";
109715
+ this.DivTooltip.style.left = left + "px";
109716
+ this.Top=top;
109717
+ this.Left=left;
109718
+ }
109719
+
109720
+ if (this.DivTooltip.style.visibility!='visible') this.DivTooltip.style.visibility='visible';
109721
+ }
109722
+
109723
+ this.Hide=function()
109724
+ {
109725
+ if (!this.DivTooltip) return;
109726
+
109727
+ if (this.DivTooltip.style["visibility"]!='hidden') this.DivTooltip.style["visibility"]="hidden";
109728
+ }
109729
+ }
109730
+
109731
+
109404
109732
 
109405
109733
 
109406
109734
 
@@ -136627,6 +136955,12 @@ function GetBlackStyle()
136627
136955
  //Mergin:{ Left:4, Right:4, Top:2, Bottom:4 },
136628
136956
  }
136629
136957
  },
136958
+
136959
+ DivFrameToolbar:
136960
+ {
136961
+ Icon:{ Color:"rgb(156,156,156)", HoverColor:"rgb(255,255,255)" },
136962
+ Tooltip:{ BGColor:"rgb(32,32,32)", TextColor:"rgb(204,204,204)", BorderColor:"rgb(69,69,69)" },
136963
+ },
136630
136964
 
136631
136965
  DrawPicture: //画图工具
136632
136966
  {
@@ -153365,7 +153699,7 @@ function ScrollBarBGChart()
153365
153699
 
153366
153700
 
153367
153701
 
153368
- var HQCHART_VERSION="1.1.15059";
153702
+ var HQCHART_VERSION="1.1.15069";
153369
153703
 
153370
153704
  function PrintHQChartVersion()
153371
153705
  {