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.
@@ -7514,6 +7514,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7514
7514
  this.DialogSearchIndex; //指标搜索
7515
7515
  this.DialogModifyIndexParam; //指标参数修改
7516
7516
  this.SmallFloatTooltipGroup; //小浮框tooltip信息集合
7517
+ this.JSToolbarTooltip; //指标标题工具栏tooltip信息
7517
7518
 
7518
7519
 
7519
7520
  this.RestoreFocusTimer=null; //恢复焦点定时器
@@ -13976,6 +13977,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
13976
13977
  if (overlayItem.Frame && overlayItem.Frame.ReloadResource) overlayItem.Frame.ReloadResource(resource);
13977
13978
  }
13978
13979
  }
13980
+
13981
+ if (this.JSToolbarTooltip) this.JSToolbarTooltip.ReloadResource(resource); //工具栏提示框
13979
13982
  }
13980
13983
 
13981
13984
  this.ReloadChartPaint=function(resource)
@@ -14504,6 +14507,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
14504
14507
  if (!option) return;
14505
14508
 
14506
14509
  var frame=subFrame.Frame;
14510
+ var pixelRatio=GetDevicePixelRatio();
14507
14511
 
14508
14512
  if (option.Window)
14509
14513
  {
@@ -14543,6 +14547,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
14543
14547
  if (IFrameSplitOperator.IsBool(option.IsShowYLine)) subFrame.Frame.IsShowYLine=option.IsShowYLine;
14544
14548
  if (IFrameSplitOperator.IsBool(option.IsShowIndexTitle)) subFrame.Frame.IsShowIndexTitle=option.IsShowIndexTitle;
14545
14549
  if (IFrameSplitOperator.IsNumber(option.Height)) subFrame.Height=option.Height; //高度
14550
+ if (IFrameSplitOperator.IsNumber(option.TopSpace)) frame.ChartBorder.TopSpace=option.TopSpace*pixelRatio;
14551
+ if (IFrameSplitOperator.IsNumber(option.BottomSpace)) frame.ChartBorder.BottomSpace=option.BottomSpace*pixelRatio;
14546
14552
 
14547
14553
 
14548
14554
  if (IFrameSplitOperator.IsBool(option.IsShowLeftText))
@@ -17712,6 +17718,8 @@ function AverageWidthFrame()
17712
17718
  this.BeforeDrawXYCallback; //坐标绘制前回调,绘制深度图
17713
17719
  this.GetEventCallback; //事件回调
17714
17720
 
17721
+ this.DivFrameToolbar;
17722
+
17715
17723
  //工具栏的按钮样式
17716
17724
  this.ToolbarButtonStyle=g_JSChartResource.ToolbarButtonStyle;
17717
17725
  this.CloseWindowButton=CloneData(g_JSChartResource.Buttons.CloseWindow);
@@ -17761,6 +17769,8 @@ function AverageWidthFrame()
17761
17769
  this.ButtonTooltip=CloneData(g_JSChartResource.Buttons.Tooltip);
17762
17770
  this.AddIndexWindowButton=CloneData(g_JSChartResource.Buttons.AddIndexWindow);
17763
17771
  }
17772
+
17773
+ if (this.DivFrameToolbar) this.DivFrameToolbar.ReloadResource(resource);
17764
17774
  }
17765
17775
 
17766
17776
  this.DrawFrame=function()
@@ -20330,7 +20340,6 @@ function AverageWidthFrame()
20330
20340
  }
20331
20341
  }
20332
20342
 
20333
-
20334
20343
  if (IFrameSplitOperator.IsNumber(width.Right)) width.Right+=rightExtendWidth;
20335
20344
  if (IFrameSplitOperator.IsNumber(width.Left)) width.Left+=this.YTextPadding[0]+leftExtendLineWidth;
20336
20345
  if (IFrameSplitOperator.IsNumber(width.Right)) width.Right+=this.YTextPadding[1]+rightExtendLineWidth;
@@ -20338,25 +20347,34 @@ function AverageWidthFrame()
20338
20347
  return { TextWidth:width };
20339
20348
  }
20340
20349
 
20350
+ this.CreateDivFrameToolbar=function(hqchart, frameID, divHQChart)
20351
+ {
20352
+ if (this.ToolbarButtonStyle==1) return;
20353
+ if (this.DivFrameToolbar) return;
20354
+
20355
+ if (this.ClassName=="MinuteFrame" || this.ClassName=="KLineFrame")
20356
+ {
20357
+ this.DivFrameToolbar=new JSDivFrameToolbar();
20358
+ this.DivFrameToolbar.HQChart=hqchart;
20359
+ this.DivFrameToolbar.DivHQChart=divHQChart;
20360
+ this.DivFrameToolbar.FrameID=frameID;
20361
+ this.DivFrameToolbar.Create(this);
20362
+ }
20363
+ }
20364
+
20341
20365
  this.ClearToolbar=function()
20342
20366
  {
20343
- if (!this.ToolbarID) return;
20367
+ if (!this.DivFrameToolbar) return;
20344
20368
 
20345
- var divToolbar=document.getElementById(this.ToolbarID);
20346
- if (!divToolbar) return;
20347
- this.ChartBorder.UIElement.parentNode.removeChild(divToolbar);
20348
- this.ToolbarRect=null;
20369
+ this.DivFrameToolbar.Destroy();
20370
+ this.DivFrameToolbar=null;
20349
20371
  }
20350
20372
 
20351
20373
  this.HideToolbar=function()
20352
20374
  {
20353
- if (!this.ToolbarID) return;
20354
-
20355
- this.ToolbarRect=null;
20356
- var divToolbar=document.getElementById(this.ToolbarID);
20357
- if (!divToolbar) return;
20375
+ if (!this.DivFrameToolbar) return;
20358
20376
 
20359
- if (divToolbar.style.display!='none') divToolbar.style.display='none';
20377
+ this.DivFrameToolbar.Hide();
20360
20378
  }
20361
20379
 
20362
20380
  this.GetMainOverlayFrame=function()
@@ -20394,7 +20412,6 @@ function MinuteFrame()
20394
20412
  this.MultiDayBorderPen=g_JSChartResource.MultiDayBorderPen;
20395
20413
  this.CustomHorizontalInfo=[];
20396
20414
  this.RightFrame=null; //右侧多重坐标
20397
- this.ToolbarID=Guid(); //工具条Div id
20398
20415
  this.ReDrawToolbar=false;
20399
20416
  this.DayCount=1; //显示天数
20400
20417
 
@@ -20407,7 +20424,6 @@ function MinuteFrame()
20407
20424
  this.OverlayIndex=g_JSChartResource.MinuteToolbar.OverlayIndex; //是否显示叠加指标
20408
20425
  this.AddIndexWindow=g_JSChartResource.MinuteToolbar.AddIndexWindow; //是否显示'增加指标窗口'菜单
20409
20426
 
20410
- this.ToolbarRect=null; //保存工具条的位置
20411
20427
  this.IsShowPositionTitle=false; //是否显示持仓标题
20412
20428
 
20413
20429
  this.LastCalculateStatus={ Width:0, XPointCount:0 }; //最后一次计算宽度的状态
@@ -20539,112 +20555,8 @@ function MinuteFrame()
20539
20555
  if (this.ToolbarButtonStyle==1) return;
20540
20556
  if (g_JSChartResource.IsDOMFrameToolbar===true) return;
20541
20557
 
20542
- if (typeof($)=="undefined") return;
20543
-
20544
- if (this.Identify<2) return;
20545
- if (!this.ChartBorder.UIElement) return;
20546
-
20547
- var divToolbar=document.getElementById(this.ToolbarID);
20548
- if (divToolbar && this.SizeChange==false && this.ReDrawToolbar==false) return;
20549
-
20550
- if (!divToolbar)
20551
- {
20552
- divToolbar=document.createElement("div");
20553
- divToolbar.className='klineframe-toolbar';
20554
- divToolbar.id=this.ToolbarID;
20555
- divToolbar.oncontextmenu = function() { return false;}; //屏蔽右键系统菜单
20556
- //为divToolbar添加属性identify
20557
- divToolbar.setAttribute("identify",this.Identify.toString());
20558
- this.ChartBorder.UIElement.parentNode.appendChild(divToolbar);
20559
- }
20560
-
20561
- if (!this.ModifyIndex && !this.ChangeIndex && !this.OverlayIndex && !this.CloseIndex)
20562
- {
20563
- if (divToolbar.style.display!='none')
20564
- divToolbar.style.display='none';
20565
- return;
20566
- }
20567
-
20568
- //使用外城div尺寸 画图尺寸是被放大的
20569
- var pixelTatio = GetDevicePixelRatio();
20570
- var chartWidth=parseInt(this.ChartBorder.UIElement.parentElement.style.width.replace("px",""));
20571
- var chartHeight=parseInt(this.ChartBorder.UIElement.parentElement.style.height.replace("px",""));
20572
- //JSConsole.Chart.Log('[KLineFrame::DrawToolbar] ',chartWidth,chartHeight,pixelTatio);
20573
-
20574
- var toolbarWidth=100;
20575
- var toolbarHeight=this.ChartBorder.GetTitleHeight();
20576
- var left=chartWidth-(this.ChartBorder.Right/pixelTatio)-toolbarWidth;
20577
- var top=this.ChartBorder.GetTop()/pixelTatio;
20578
-
20579
- if (this.ToolbarRect)
20580
- {
20581
- //尺寸变动移动才重新设置DOM
20582
- if (this.ToolbarRect.Left==left && this.ToolbarRect.Top==top &&
20583
- this.ToolbarRect.Width==toolbarWidth && this.ToolbarRect.Height==toolbarHeight/pixelTatio)
20584
- {
20585
- return;
20586
- }
20587
- }
20588
-
20589
- this.ToolbarRect={ Left:left, Top:top, Width:toolbarWidth, Height:toolbarHeight/pixelTatio };
20590
-
20591
- const modifyButton=`<span class='index_param icon iconfont icon-index_param' id='modifyindex' style='cursor:pointer;margin-left:2px;margin-right:2px;' title='调整指标参数'></span>`;
20592
- const changeButton=`<span class='index_change icon iconfont icon-change_index' id='changeindex' style='cursor:pointer;margin-left:2px;margin-right:2px;' title='切换指标'></span>`;
20593
- const closeButton=`<span class='index_close icon iconfont icon-close' id='closeindex' style='cursor:pointer;margin-left:2px;margin-right:2px;' title='关闭指标窗口'></span>`;
20594
-
20595
- var spanIcon=modifyButton+changeButton;
20596
- if (this.CloseIndex)
20597
- {
20598
- spanIcon+=closeButton;
20599
- }
20600
-
20601
- //var scrollPos=GetScrollPosition();
20602
- //left = left+scrollPos.Left;
20603
- //top = top+scrollPos.Top;
20604
- divToolbar.style.left = left + "px";
20605
- divToolbar.style.top = top + "px";
20606
- divToolbar.style.width=toolbarWidth+"px"; //宽度先不调整吧
20607
- divToolbar.style.height=(toolbarHeight/pixelTatio)+'px'; //只调整高度
20608
- divToolbar.innerHTML=spanIcon;
20609
-
20610
- var chart=this.ChartBorder.UIElement.JSChartContainer;
20611
- var identify=this.Identify;
20612
- if (!this.ModifyIndex) //隐藏'改参数'
20613
- $("#"+divToolbar.id+" .index_param").hide();
20614
- else if (typeof(this.ModifyIndexEvent)=='function') //绑定点击事件
20615
- $("#"+divToolbar.id+" .index_param").click(
20616
- {
20617
- Chart:this.ChartBorder.UIElement.JSChartContainer,
20618
- Identify:this.Identify
20619
- },this.ModifyIndexEvent);
20620
-
20621
- if (!this.ChangeIndex) //隐藏'换指标'
20622
- {
20623
- $("#"+divToolbar.id+" .index_change").hide();
20624
- }
20625
- else if (typeof(this.ChangeIndexEvent)=='function')
20626
- {
20627
- $("#"+divToolbar.id+" .index_change").click(
20628
- {
20629
- Chart:this.ChartBorder.UIElement.JSChartContainer,
20630
- Identify:this.Identify,
20631
- IsOverlay:false
20632
- },this.ChangeIndexEvent);
20633
- }
20634
-
20635
- $("#"+divToolbar.id+" .index_close").click(
20636
- {
20637
- Chart:this.ChartBorder.UIElement.JSChartContainer,
20638
- Identify:this.Identify
20639
- },
20640
- function(event)
20641
- {
20642
- var hqChart=event.data.Chart;
20643
- var id=event.data.Identify;
20644
- hqChart.RemoveIndexWindow(id);
20645
- });
20646
-
20647
- divToolbar.style.display = "block";
20558
+ if (!this.DivFrameToolbar) return;
20559
+ this.DivFrameToolbar.Show(this.Identify);
20648
20560
  }
20649
20561
 
20650
20562
  //手绘,不用DOM,使用DOM太麻烦了
@@ -22826,7 +22738,6 @@ function KLineFrame()
22826
22738
  delete this.newMethod;
22827
22739
 
22828
22740
  this.ClassName='KLineFrame';
22829
- this.ToolbarID=Guid(); //工具条Div id
22830
22741
 
22831
22742
  this.ModifyIndex=g_JSChartResource.KLineToolbar.ModifyIndex; //是否显示'改参数'菜单
22832
22743
  this.ChangeIndex=g_JSChartResource.KLineToolbar.ChangeIndex; //是否显示'换指标'菜单
@@ -22839,7 +22750,6 @@ function KLineFrame()
22839
22750
 
22840
22751
  this.SelBorderColor=g_JSChartResource.SelFrameBorderColor;
22841
22752
 
22842
- this.ToolbarRect=null; //保存工具条的位置
22843
22753
  this.ReDrawToolbar=false;
22844
22754
 
22845
22755
  this.LastCalculateStatus={ Width:0, XPointCount:0 }; //最后一次计算宽度的状态
@@ -22863,6 +22773,11 @@ function KLineFrame()
22863
22773
  {
22864
22774
  if (this.ToolbarButtonStyle==1) return;
22865
22775
  if (g_JSChartResource.IsDOMFrameToolbar===true) return;
22776
+ if (!this.DivFrameToolbar) return;
22777
+
22778
+ this.DivFrameToolbar.Show(this.Identify);
22779
+
22780
+ return;
22866
22781
 
22867
22782
  if (typeof($)=="undefined") return;
22868
22783
 
@@ -57284,6 +57199,10 @@ function KLineCountDownPaint()
57284
57199
  this.CanvasEx.fillStyle=out.BGColor;
57285
57200
  this.CanvasEx.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
57286
57201
  }
57202
+ else
57203
+ {
57204
+ return;
57205
+ }
57287
57206
 
57288
57207
  this.Canvas.textAlign = "left";
57289
57208
  this.Canvas.textBaseline = "bottom";
@@ -70877,7 +70796,7 @@ function ChartDrawPictureHorizontalLine()
70877
70796
  {
70878
70797
  Left:{ IsShow:true, Margin:{ Left:5, Top:4, Bottom:2, Right:5 } },
70879
70798
  Right:{ IsShow:true, Margin:{ Left:5, Top:4, Bottom:2, Right:5 } },
70880
- Font:`${12*GetDevicePixelRatio()}px 微软雅黑`, TextColor:"rgb(255,255,255)"
70799
+ Font:`${12*GetDevicePixelRatio()}px 微软雅黑`, TextColor:"rgb(255,255,255)", BGColor:null
70881
70800
  };
70882
70801
 
70883
70802
  this.InsideLabelConfig=
@@ -70886,7 +70805,8 @@ function ChartDrawPictureHorizontalLine()
70886
70805
  Font:`${14*GetDevicePixelRatio()}px 微软雅黑`,
70887
70806
  Margin:{ Left:5, Top:4, Bottom:2, Right:5 },
70888
70807
  TextColor:"rgb(255,255,255)",
70889
- BGAlpha:0.8, //背景色透明度
70808
+ BGAlpha:0.8, //背景色透明度,
70809
+ IsShow:true
70890
70810
  }
70891
70811
 
70892
70812
  this.LabelTitle;
@@ -70915,7 +70835,8 @@ function ChartDrawPictureHorizontalLine()
70915
70835
  }
70916
70836
 
70917
70837
  if (item.Font) this.LabelConfig.Font=item.Font;
70918
- if (item.TextColor) this.LabelConfig.FoTextColornt=item.TextColor;
70838
+ if (item.TextColor) this.LabelConfig.TextColor=item.TextColor;
70839
+ if (item.BGColor) this.LabelConfig.BGColor=item.BGColor;
70919
70840
  }
70920
70841
 
70921
70842
  if (option.InsideLabel)
@@ -70925,6 +70846,7 @@ function ChartDrawPictureHorizontalLine()
70925
70846
  if (item.TextColor) this.InsideLabelConfig.TextColor=item.TextColor;
70926
70847
  if (IFrameSplitOperator.IsNumber(item.Position)) this.InsideLabelConfig.Position=item.Position;
70927
70848
  if (IFrameSplitOperator.IsNumber(item.BGAlpha)) this.InsideLabelConfig.BGAlpha=item.BGAlpha;
70849
+ if (IFrameSplitOperator.IsBool(item.IsShow)) this.InsideLabelConfig.IsShow=item.IsShow;
70928
70850
  }
70929
70851
  }
70930
70852
  }
@@ -70936,6 +70858,8 @@ function ChartDrawPictureHorizontalLine()
70936
70858
  {
70937
70859
  storageData=this.Super_ExportStorageData();
70938
70860
  if (this.LabelTitle) storageData.LabelTitle=this.LabelTitle;
70861
+ if (this.LabelConfig) storageData.Label=this.LabelConfig;
70862
+ if (this.InsideLabelConfig) storageData.InsideLabel=this.InsideLabelConfig;
70939
70863
  }
70940
70864
 
70941
70865
  return storageData;
@@ -71042,7 +70966,8 @@ function ChartDrawPictureHorizontalLine()
71042
70966
  rtBG.Bottom=rtBG.Top+rtBG.Height;
71043
70967
  rtBG.Left=rtBG.Right-rtBG.Width;
71044
70968
 
71045
- this.Canvas.fillStyle=this.LineColor;
70969
+ if (config.BGColor) this.Canvas.fillStyle=config.BGColor;
70970
+ else this.Canvas.fillStyle=this.LineColor;
71046
70971
  this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
71047
70972
 
71048
70973
  this.Canvas.textAlign="left";
@@ -71060,7 +70985,9 @@ function ChartDrawPictureHorizontalLine()
71060
70985
  rtBG.Top=y-textHeight/2-margin.Top;
71061
70986
  rtBG.Bottom=rtBG.Top+rtBG.Height;
71062
70987
  rtBG.Right=rtBG.Left+rtBG.Width;
71063
- this.Canvas.fillStyle=this.LineColor;
70988
+
70989
+ if (config.BGColor) this.Canvas.fillStyle=config.BGColor;
70990
+ else this.Canvas.fillStyle=this.LineColor;
71064
70991
  this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
71065
70992
 
71066
70993
  this.Canvas.textAlign="left";
@@ -71078,6 +71005,7 @@ function ChartDrawPictureHorizontalLine()
71078
71005
 
71079
71006
  var isHScreen=this.Frame.IsHScreen;
71080
71007
  var config=this.InsideLabelConfig;
71008
+ if (!config.IsShow) return;
71081
71009
  if (config.Position!=0 && config.Position!=1) return;
71082
71010
  var margin=config.Margin;
71083
71011
 
@@ -81617,6 +81545,12 @@ function JSChartResource()
81617
81545
  Mergin:{ Left:4, Right:4, Top:2, Bottom:3 },
81618
81546
  }
81619
81547
  }
81548
+
81549
+ this.DivFrameToolbar=
81550
+ {
81551
+ Icon:{ Color:"rgb(0,0,0)", HoverColor:"rgb(30,144,255)" },
81552
+ Tooltip:{ BGColor:"rgb(255,255,255)", TextColor:"rgb(71,71,71)", BorderColor:"rgb(0,0,0)" },
81553
+ }
81620
81554
 
81621
81555
  //画图工具
81622
81556
  this.DrawPicture=
@@ -83595,6 +83529,29 @@ function JSChartResource()
83595
83529
  if (style.KLineCountDownPaint) this.SetKLineCountDownPaint(style.KLineCountDownPaint);
83596
83530
 
83597
83531
  if (style.SmallFloatTooltipV2) this.SetSmallFloatTooltipV2(style.SmallFloatTooltipV2);
83532
+
83533
+ if (style.DivFrameToolbar) this.SetDivFrameToolbar(style.DivFrameToolbar);
83534
+ }
83535
+
83536
+ this.SetDivFrameToolbar=function(style)
83537
+ {
83538
+ var dest=this.DivFrameToolbar;
83539
+ if (style.Icon)
83540
+ {
83541
+ var item=style.Icon;
83542
+ var subDest=dest.Icon;
83543
+ if (item.Color) subDest.Color=item.Color;
83544
+ if (item.HoverColor) subDest.HoverColor=item.HoverColor;
83545
+ }
83546
+
83547
+ if (style.Tooltip)
83548
+ {
83549
+ var item=style.Tooltip;
83550
+ var subDest=dest.Tooltip;
83551
+ if (item.TextColor) subDest.TextColor=item.TextColor;
83552
+ if (item.BorderColor) subDest.BorderColor=item.BorderColor;
83553
+ if (item.BGColor) subDest.BGColor=item.BGColor;
83554
+ }
83598
83555
  }
83599
83556
 
83600
83557
  this.SetSmallFloatTooltipV2=function(style)
@@ -86931,6 +86888,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
86931
86888
  frame.RightSpaceCount=this.RightSpaceCount; //右边
86932
86889
  frame.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
86933
86890
  frame.GlobalOption=this.GlobalOption;
86891
+ frame.CreateDivFrameToolbar(this, i, this.UIElement.parentNode);
86934
86892
 
86935
86893
  frame.HorizontalMax=20;
86936
86894
  frame.HorizontalMin=10;
@@ -87031,6 +86989,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
87031
86989
  frame.YSplitOperator.HQChart=this;
87032
86990
  frame.XSplitOperator.Symbol=this.Symbol;
87033
86991
  frame.XSplitOperator.Period=this.Period;
86992
+ frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
87034
86993
 
87035
86994
  //K线数据绑定
87036
86995
  var xPointCouont=this.Frame.SubFrame[0].Frame.XPointCount;
@@ -89621,7 +89580,6 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
89621
89580
  if (bChanged)
89622
89581
  {
89623
89582
  frame.SizeChange=true;
89624
- frame.ToolbarRect=null; //清空工具栏缓存
89625
89583
  frame.DrawToolbar();
89626
89584
  }
89627
89585
  }
@@ -96592,7 +96550,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96592
96550
 
96593
96551
  if (i>=2)
96594
96552
  {
96595
-
96553
+ frame.CreateDivFrameToolbar(this, i, this.UIElement.parentNode);
96596
96554
  }
96597
96555
 
96598
96556
  var DEFAULT_HORIZONTAL=[9,8,7,6,5,4,3,2,1];
@@ -96699,6 +96657,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
96699
96657
  frame.XSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
96700
96658
  frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); }
96701
96659
  frame.XSplitOperator.Symbol=this.Symbol;
96660
+ frame.CreateDivFrameToolbar(this, id, this.UIElement.parentNode);
96702
96661
 
96703
96662
  if (this.DayCount>1)
96704
96663
  {
@@ -109445,6 +109404,375 @@ Path2DHelper.PtInRect=function(x, y, rect)
109445
109404
  }
109446
109405
 
109447
109406
 
109407
+ ////////////////////////////////////////////////////////////////////////////////////
109408
+ // 指标窗口顶部工具条
109409
+ //
109410
+ //
109411
+ ///////////////////////////////////////////////////////////////////////////////////
109412
+
109413
+
109414
+ function JSDivFrameToolbar()
109415
+ {
109416
+ this.DivToolbar=null;
109417
+ this.DivHQChart=null;
109418
+ this.HQChart=null;
109419
+ this.FrameID=-1; //指标窗口ID
109420
+ this.ID=Guid();
109421
+ this.Left=-1;
109422
+ this.Top=-1;
109423
+
109424
+ this.IconConfig=
109425
+ {
109426
+ Color:g_JSChartResource.DivFrameToolbar.Icon.Color,
109427
+ HoverColor:g_JSChartResource.DivFrameToolbar.Icon.HoverColor
109428
+ }
109429
+
109430
+ this.AryButton=[]; //按钮数组
109431
+
109432
+ //创建按钮
109433
+ this.CreateArrayButton=function(aryButton)
109434
+ {
109435
+ for(var i=0;i<aryButton.length; i++)
109436
+ {
109437
+ var item=aryButton[i];
109438
+ if (!item.ID || !item.ClassName) continue;
109439
+ var newItem={ ID:item.ID, ClassName:item.ClassName, Span:null,Div:null, TooltipSpan:null };
109440
+ if (item.Tooltip && item.Tooltip.Text) newItem.Tooltip={ Text:item.Tooltip.Text };
109441
+
109442
+ this.AryButton.push(newItem);
109443
+
109444
+ if (this.DivToolbar) this.CreateButton(newItem, this.DivToolbar);
109445
+ }
109446
+ }
109447
+
109448
+ //清空原来的按钮
109449
+ this.ClearAllButtons=function()
109450
+ {
109451
+ //清空原来的按钮
109452
+ for(var i=0; i<this.AryButton.length; i++)
109453
+ {
109454
+ var item=this.AryButton[i];
109455
+ if (item.Div && this.DivToolbar) this.DivToolbar.removeChild(item.Div);
109456
+ item.Div=null;
109457
+ item.Span=null;
109458
+ item.TooltipSpan=null;
109459
+ }
109460
+
109461
+ this.AryButton=[];
109462
+ }
109463
+
109464
+ this.GetShowButtons=function(subFrame)
109465
+ {
109466
+ var frame=subFrame;
109467
+ if (!frame && this.FrameID>=0 && this.FrameID<this.HQChart.Frame.SubFrame.length)
109468
+ frame=this.HQChart.Frame.SubFrame[this.FrameID].Frame;
109469
+
109470
+ var aryDefaultButton=JSDivFrameToolbar.GetDfaultButtons();
109471
+ var aryButton=[];
109472
+ for(var i=0;i<aryDefaultButton.length; i++)
109473
+ {
109474
+ var item=aryDefaultButton[i];
109475
+ if (this.FrameID==0 && item.ID==JSCHART_BUTTON_ID.CLOSE_INDEX_WINDOW) continue; //第一个指标窗口不显示关闭按钮
109476
+
109477
+ if (item.ID==JSCHART_BUTTON_ID.MODIFY_INDEX_PARAM && frame && frame.ModifyIndex===false) continue;
109478
+ if (item.ID==JSCHART_BUTTON_ID.CHANGE_INDEX && frame && frame.ChangeIndex===false) continue;
109479
+ if (item.ID==JSCHART_BUTTON_ID.OVERLAY_INDEX && frame && frame.OverlayIndex===false) continue;
109480
+ if (item.ID==JSCHART_BUTTON_ID.CLOSE_INDEX_WINDOW && frame && frame.CloseIndex===false) continue;
109481
+
109482
+ aryButton.push(item);
109483
+ }
109484
+
109485
+ return aryButton;
109486
+ }
109487
+
109488
+ this.SetToolbar=function(aryButton)
109489
+ {
109490
+ this.ClearAllButtons(); //清空原来的按钮
109491
+
109492
+ this.CreateArrayButton(aryButton); //重新创建
109493
+
109494
+ this.UpdateStyle();
109495
+ }
109496
+
109497
+ this.UpdateButton=function()
109498
+ {
109499
+ if (!this.DivToolbar) return;
109500
+
109501
+ var aryButton=this.GetShowButtons();
109502
+ var bChange=false;
109503
+ if (aryButton.length!=this.AryButton.length)
109504
+ {
109505
+ bChange=true;
109506
+ }
109507
+ else
109508
+ {
109509
+ for(var i=0;i<this.AryButton.length;++i)
109510
+ {
109511
+ var leftItem=this.AryButton[i];
109512
+ var rightItem=aryButton[i];
109513
+
109514
+ if (leftItem.ID!=rightItem.ID || leftItem.ClassName!=rightItem.ClassName)
109515
+ {
109516
+ bChange=true;
109517
+ break;
109518
+ }
109519
+ }
109520
+ }
109521
+
109522
+ if (!bChange) return;
109523
+
109524
+ this.SetToolbar(aryButton); //重新设置按钮
109525
+ }
109526
+
109527
+
109528
+
109529
+ this.Destroy=function()
109530
+ {
109531
+ if (this.DivToolbar)
109532
+ {
109533
+ if (this.DivHQChart.removeChild) this.DivHQChart.removeChild(this.DivToolbar);
109534
+ this.DivToolbar=null;
109535
+ }
109536
+
109537
+ this.HQChart=null;
109538
+ this.DivHQChart=null;
109539
+ this.FrameID=-1;
109540
+ }
109541
+
109542
+ this.Create=function(frame)
109543
+ {
109544
+ var divToolbar=document.createElement("div");
109545
+ divToolbar.className='UMyChart_FrameToolbar_Div';
109546
+ divToolbar.id=this.ID;
109547
+ divToolbar.oncontextmenu = function() { return false; }; //屏蔽右键系统菜单
109548
+ this.DivToolbar=divToolbar;
109549
+
109550
+ var aryButtons=this.GetShowButtons(frame);
109551
+ this.CreateArrayButton(aryButtons)
109552
+
109553
+ this.DivHQChart.appendChild(divToolbar);
109554
+
109555
+ this.UpdateStyle();
109556
+
109557
+ if (!this.HQChart.JSToolbarTooltip)
109558
+ {
109559
+ this.HQChart.JSToolbarTooltip=new JSToolbarTooltip();
109560
+ this.HQChart.JSToolbarTooltip.DivHQChart=this.DivHQChart;
109561
+ this.HQChart.JSToolbarTooltip.Create();
109562
+ }
109563
+ }
109564
+
109565
+ this.UpdateStyle=function()
109566
+ {
109567
+ if (!this.DivToolbar) return;
109568
+
109569
+ for(var i=0;i<this.AryButton.length; i++)
109570
+ {
109571
+ var item=this.AryButton[i]
109572
+ if (!item.Span) continue;
109573
+ item.Span.style["color"]=this.IconConfig.Color;
109574
+ }
109575
+ }
109576
+
109577
+ this.ReloadResource=function(option)
109578
+ {
109579
+ this.IconConfig.Color=g_JSChartResource.DivFrameToolbar.Icon.Color,
109580
+ this.IconConfig.HoverColor=g_JSChartResource.DivFrameToolbar.Icon.HoverColor;
109581
+
109582
+ this.UpdateStyle();
109583
+ }
109584
+
109585
+ this.CreateButton=function(item, divDom)
109586
+ {
109587
+ var btnDiv=document.createElement("div");
109588
+ btnDiv.className="UMyChart_FrameToolbar_Div_Button";
109589
+ btnDiv.onmouseover=(e)=> { this.OnHoverButton(e, item); }
109590
+ btnDiv.onmouseout=(e)=>{ this.OnLeaveButton(e, item); }
109591
+ item.Div=btnDiv;
109592
+
109593
+ var spanDom=document.createElement("span");
109594
+ spanDom.className=item.ClassName;
109595
+ spanDom.onmousedown=(e)=>{ this.OnClickButton(e, item); };
109596
+ item.Span=spanDom;
109597
+ btnDiv.appendChild(spanDom);
109598
+
109599
+ divDom.appendChild(btnDiv);
109600
+ }
109601
+
109602
+ this.OnClickButton=function(e, item)
109603
+ {
109604
+ if (!this.FrameID<0) return;
109605
+ if (!this.HQChart) return;
109606
+
109607
+ var frame=this.HQChart.Frame.SubFrame[this.FrameID].Frame;
109608
+
109609
+ var button={ ID:item.ID, Frame:frame };
109610
+ this.HQChart.ClickFrameButton(button, e);
109611
+ }
109612
+
109613
+ this.OnHoverButton=function(e, item)
109614
+ {
109615
+ if (!item.Span) return;
109616
+
109617
+ item.Span.style["color"]=this.IconConfig.HoverColor;
109618
+
109619
+ this.ShowTooltip(e, item);
109620
+ }
109621
+
109622
+ this.OnLeaveButton=function(e, item)
109623
+ {
109624
+ if (!item.Span) return;
109625
+ item.Span.style["color"]=this.IconConfig.Color;
109626
+
109627
+ this.HideTooltip();
109628
+ }
109629
+
109630
+ this.Show=function(frameID)
109631
+ {
109632
+ this.FrameID=frameID;
109633
+ if (!this.FrameID<0) return;
109634
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.HQChart.Frame.SubFrame)) return;
109635
+ if (!this.HQChart.Frame.SubFrame[this.FrameID]) return;
109636
+
109637
+ var pixelTatio = GetDevicePixelRatio();
109638
+ var frame=this.HQChart.Frame.SubFrame[this.FrameID].Frame;
109639
+ var border=frame.GetBorder();
109640
+
109641
+ var top=border.Top/pixelTatio;
109642
+ var right=border.RightEx/pixelTatio;
109643
+ var left=right-this.DivToolbar.offsetWidth-2;
109644
+
109645
+ if (this.Top!=top || this.Left!=left)
109646
+ {
109647
+ this.DivToolbar.style.top = top + "px";
109648
+ this.DivToolbar.style.left = left + "px";
109649
+ this.DivToolbar.style.height=frame.ChartBorder.TitleHeight/pixelTatio + "px";
109650
+ this.Top=top;
109651
+ this.Left=left;
109652
+ }
109653
+
109654
+ if (this.DivToolbar.style.visibility!='visible') this.DivToolbar.style.visibility='visible';
109655
+ }
109656
+
109657
+ this.Hide=function()
109658
+ {
109659
+ if (this.DivToolbar) this.DivToolbar.style.visibility="hidden";
109660
+ }
109661
+
109662
+ this.HideTooltip=function()
109663
+ {
109664
+ if (this.HQChart.JSToolbarTooltip) this.HQChart.JSToolbarTooltip.Hide();
109665
+ }
109666
+
109667
+ this.ShowTooltip=function(e, item)
109668
+ {
109669
+ if (!this.HQChart.JSToolbarTooltip) return;
109670
+ if (!item.Div) return;
109671
+
109672
+ var rtButton=item.Div.getBoundingClientRect();
109673
+ var rtHQChart=this.DivHQChart.getBoundingClientRect();
109674
+ var left=rtButton.left-rtHQChart.left;
109675
+ var top=rtButton.bottom-rtHQChart.top+2;
109676
+ this.HQChart.JSToolbarTooltip.Show(top, left, { Text:item.Tooltip.Text });
109677
+ }
109678
+ }
109679
+
109680
+ JSDivFrameToolbar.GetDfaultButtons=function()
109681
+ {
109682
+ var aryButton=
109683
+ [
109684
+
109685
+ {
109686
+ ID:JSCHART_BUTTON_ID.MODIFY_INDEX_PARAM, ClassName:"UMyChart_FrameToolbar_Span_Button icon iconfont icon-index_param", Tooltip:{ Text:"修改参数"},
109687
+ Span:null, Div:null, TooltipSpan:null
109688
+ },
109689
+ {
109690
+ ID:JSCHART_BUTTON_ID.CHANGE_INDEX, ClassName:"UMyChart_FrameToolbar_Span_Button icon iconfont icon-change_index", Tooltip:{ Text:"切换指标"},
109691
+ Span:null,Div:null, TooltipSpan:null
109692
+ },
109693
+ {
109694
+ ID:JSCHART_BUTTON_ID.OVERLAY_INDEX, ClassName:"UMyChart_FrameToolbar_Span_Button icon iconfont icon-overlay_index", Tooltip:{ Text:"叠加指标"},
109695
+ Span:null,Div:null, TooltipSpan:null
109696
+ },
109697
+ {
109698
+ ID:JSCHART_BUTTON_ID.CLOSE_INDEX_WINDOW, ClassName:"UMyChart_FrameToolbar_Span_Button icon iconfont icon-close", Tooltip:{ Text:"关闭窗口"},
109699
+ Span:null,Div:null, TooltipSpan:null
109700
+ },
109701
+ ];
109702
+
109703
+ return aryButton
109704
+ }
109705
+
109706
+
109707
+ function JSToolbarTooltip()
109708
+ {
109709
+ this.DivTooltip=null;
109710
+ this.DivHQChart=null;
109711
+ this.Text=null;
109712
+ this.Left=-1;
109713
+ this.Top=-1;
109714
+
109715
+ this.BGColor=g_JSChartResource.DivFrameToolbar.Tooltip.BGColor;
109716
+ this.TextColor=g_JSChartResource.DivFrameToolbar.Tooltip.TextColor;
109717
+ this.BorderColor=g_JSChartResource.DivFrameToolbar.Tooltip.BorderColor;
109718
+
109719
+ this.Create=function()
109720
+ {
109721
+ var divDom=document.createElement("div");
109722
+ divDom.className='UMyChart_Toolbar_Tooltip_Div';
109723
+ this.DivHQChart.appendChild(divDom);
109724
+
109725
+ this.DivTooltip=divDom;
109726
+
109727
+ this.UpdateStyle();
109728
+ }
109729
+
109730
+ this.ReloadResource=function(option)
109731
+ {
109732
+ this.BGColor=g_JSChartResource.DivFrameToolbar.Tooltip.BGColor;
109733
+ this.TextColor=g_JSChartResource.DivFrameToolbar.Tooltip.TextColor;
109734
+ this.BorderColor=g_JSChartResource.DivFrameToolbar.Tooltip.BorderColor;
109735
+
109736
+ this.UpdateStyle();
109737
+ }
109738
+
109739
+ this.UpdateStyle=function()
109740
+ {
109741
+ if (!this.DivTooltip) return;
109742
+
109743
+ this.DivTooltip.style["background-color"]=this.BGColor;
109744
+ this.DivTooltip.style["color"]=this.TextColor;
109745
+ this.DivTooltip.style["border"]="1px solid " + this.BorderColor;
109746
+ }
109747
+
109748
+ this.Show=function(top, left, tooltipData)
109749
+ {
109750
+ if (!this.DivTooltip) return;
109751
+
109752
+ if (this.Text!=tooltipData.Text) this.DivTooltip.innerHTML=tooltipData.Text;
109753
+ var right=left+this.DivTooltip.offsetWidth;
109754
+ if ((right+5)>=window.innerWidth) left=left-this.DivTooltip.offsetWidth;
109755
+
109756
+ if (this.Top!=top || this.Left!=left)
109757
+ {
109758
+ this.DivTooltip.style.top = top + "px";
109759
+ this.DivTooltip.style.left = left + "px";
109760
+ this.Top=top;
109761
+ this.Left=left;
109762
+ }
109763
+
109764
+ if (this.DivTooltip.style.visibility!='visible') this.DivTooltip.style.visibility='visible';
109765
+ }
109766
+
109767
+ this.Hide=function()
109768
+ {
109769
+ if (!this.DivTooltip) return;
109770
+
109771
+ if (this.DivTooltip.style["visibility"]!='hidden') this.DivTooltip.style["visibility"]="hidden";
109772
+ }
109773
+ }
109774
+
109775
+
109448
109776
 
109449
109777
 
109450
109778
 
@@ -136671,6 +136999,12 @@ function GetBlackStyle()
136671
136999
  //Mergin:{ Left:4, Right:4, Top:2, Bottom:4 },
136672
137000
  }
136673
137001
  },
137002
+
137003
+ DivFrameToolbar:
137004
+ {
137005
+ Icon:{ Color:"rgb(156,156,156)", HoverColor:"rgb(255,255,255)" },
137006
+ Tooltip:{ BGColor:"rgb(32,32,32)", TextColor:"rgb(204,204,204)", BorderColor:"rgb(69,69,69)" },
137007
+ },
136674
137008
 
136675
137009
  DrawPicture: //画图工具
136676
137010
  {
@@ -165245,7 +165579,7 @@ function HQChartScriptWorker()
165245
165579
 
165246
165580
 
165247
165581
 
165248
- var HQCHART_VERSION="1.1.15059";
165582
+ var HQCHART_VERSION="1.1.15069";
165249
165583
 
165250
165584
  function PrintHQChartVersion()
165251
165585
  {