hqchart 1.1.13497 → 1.1.13502

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.
@@ -13790,7 +13790,7 @@ function IsRecvOverlap(rect1, rect2)
13790
13790
  return Math.max(rect1.Left,rect2.Left) < Math.min(rect1.Right,rect2.Right) && Math.max(rect1.Top,rect2.Top) < Math.min(rect1.Bottom,rect2.Bottom);
13791
13791
  }
13792
13792
 
13793
- function CopyMerginConfig(dest,src)
13793
+ function CopyMarginConfig(dest,src)
13794
13794
  {
13795
13795
  if (!src || !dest) return;
13796
13796
 
@@ -13800,6 +13800,9 @@ function CopyMerginConfig(dest,src)
13800
13800
  if (IFrameSplitOperator.IsNumber(src.Bottom)) dest.Bottom=src.Bottom;
13801
13801
  }
13802
13802
 
13803
+ //兼容老版本
13804
+ function CopyMerginConfig(dest,src) { CopyMarginConfig(dest,src); }
13805
+
13803
13806
 
13804
13807
  function Point()
13805
13808
  {
@@ -53037,6 +53040,9 @@ function ChartCorssCursor()
53037
53040
  Icon:g_JSChartResource.CorssCursor.RightButton.Icon
53038
53041
  };
53039
53042
 
53043
+ this.RightMargin={ Left:2, Right:2, Top:4, Bottom:3 };
53044
+ CopyMarginConfig(this.RightMargin, g_JSChartResource.CorssCursor.RightMargin);
53045
+
53040
53046
  //内部使用
53041
53047
  this.Close=null; //收盘价格
53042
53048
  this.Status=0; //当前状态 0=隐藏 1=显示
@@ -53404,6 +53410,7 @@ function ChartCorssCursor()
53404
53410
  var text=this.StringFormatY.Text;
53405
53411
  this.Canvas.font=this.Font;
53406
53412
  var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
53413
+ var textSize={ Width:textWidth, Height:this.TextHeight, Text:[] };
53407
53414
  var buttonData={Y:y, YValue:yValue, FrameID:yValueExtend.FrameID };
53408
53415
  if (this.Frame.ChartBorder.Left>=30 && this.ShowTextMode.Left==1)
53409
53416
  {
@@ -53433,38 +53440,37 @@ function ChartCorssCursor()
53433
53440
  this.Canvas.fillText(text,left+2,y,textWidth);
53434
53441
  }
53435
53442
 
53443
+ var complexText=
53444
+ {
53445
+ ShowType:0, //0=单行(默认) 1=多行
53446
+ Font:this.Font, Color:this.TextColor,
53447
+ Text:[ { Text:text, Margin:this.RightMargin } ],
53448
+ };
53449
+
53450
+ var yTop=y-this.TextHeight/2;
53451
+
53436
53452
  if (this.StringFormatY.PercentageText)
53437
53453
  {
53438
53454
  if (this.TextFormat.Right==0)
53439
53455
  {
53440
53456
  text=this.StringFormatY.PercentageText+'%';
53441
- textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
53457
+ complexText.Text[0].Text=text;
53442
53458
  }
53443
53459
  }
53444
53460
 
53445
53461
  if (this.StringFormatY.RText)
53446
53462
  {
53447
53463
  text=this.StringFormatY.RText;
53448
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
53464
+ complexText.Text[0].Text=text;
53449
53465
  }
53450
53466
 
53451
- var complexText=null;
53452
53467
  if (this.StringFormatY.RComplexText && IFrameSplitOperator.IsNonEmptyArray(this.StringFormatY.RComplexText.Text))
53453
53468
  {
53454
- var textWidth=0;
53455
53469
  complexText=this.StringFormatY.RComplexText;
53456
- for(var i=0; i<complexText.Text.length; ++i)
53457
- {
53458
- var item=complexText.Text[i];
53459
- var itemWidth=this.Canvas.measureText(item.Text).width+4; //前后各空2个像素
53460
-
53461
- if (i>0 && IFrameSplitOperator.IsNumber(complexText.Space))
53462
- textWidth+=complexText.Space;
53463
-
53464
- textWidth+=itemWidth;
53465
- }
53466
53470
  }
53467
53471
 
53472
+ this.CalculateComplexTextSize(complexText, textSize);
53473
+
53468
53474
  if (this.Frame.ChartBorder.Right>=30 && this.ShowTextMode.Right==1)
53469
53475
  {
53470
53476
  var isOverlayIndex=false; //是否有叠加子坐标
@@ -53473,66 +53479,52 @@ function ChartCorssCursor()
53473
53479
  {
53474
53480
  var frame=this.Frame.SubFrame[yValueExtend.FrameID];
53475
53481
  isOverlayIndex=frame.OverlayIndex.length>0;
53476
- overlayIndexInterval=frame.Interval;
53482
+ overlayIndexInterval=null
53483
+ if (isOverlayIndex)
53484
+ {
53485
+ for(var i=0;i<=frame.OverlayIndex.length;++i)
53486
+ {
53487
+ var item=frame.OverlayIndex[i];
53488
+ if (item.Frame.IsShow===false) continue;
53489
+ if (!item.Frame.GetXHorizontal) continue;
53490
+
53491
+ var overlayLeft=item.Frame.GetXHorizontal();
53492
+ overlayIndexInterval=overlayLeft-right;
53493
+ break;
53494
+ }
53495
+ }
53477
53496
  }
53478
53497
 
53479
- if (isOverlayIndex && textWidth>overlayIndexInterval) //大于子坐标宽度
53498
+ //叠加坐标
53499
+ if (isOverlayIndex && textSize.Width>overlayIndexInterval && overlayIndexInterval>0) //大于子坐标宽度
53480
53500
  {
53481
53501
  var drawRight=right+overlayIndexInterval;
53482
53502
  if (drawRight>chartRight) drawRight=chartRight;
53483
53503
 
53484
- var itemLeft=drawRight-2-textWidth;
53485
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53486
- if (complexText)
53487
- {
53488
- this.DrawComplexText(itemLeft,y,complexText);
53489
- }
53490
- else
53491
- {
53492
- this.Canvas.textAlign="right";
53493
- this.Canvas.textBaseline="middle";
53494
- this.Canvas.fillStyle=this.TextColor;
53495
- this.Canvas.fillText(text,drawRight-4,y,textWidth);
53496
- }
53504
+ var itemLeft=drawRight-2-textSize.Width;
53505
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53506
+ this.DrawComplexTextV2(itemLeft, yTop, complexText, textSize);
53507
+
53508
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, itemLeft,this.TextHeight,this.TextHeight,buttonData);
53497
53509
  }
53498
- else if (rightWidth<textWidth) //右边空白显示不下,
53510
+ else if (rightWidth<textSize.Width) //右边空白显示不下,
53499
53511
  {
53500
- var itemLeft=chartRight-2-textWidth;
53501
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53502
- if (complexText)
53503
- {
53504
- this.DrawComplexText(itemLeft,y,complexText);
53505
- }
53506
- else
53507
- {
53508
- this.Canvas.textAlign="right";
53509
- this.Canvas.textBaseline="middle";
53510
- this.Canvas.fillStyle=this.TextColor;
53511
- this.Canvas.fillText(text,chartRight-4,y,textWidth);
53512
- }
53513
-
53514
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, chartRight-2-textWidth,this.TextHeight,this.TextHeight,buttonData);
53512
+ var itemLeft=chartRight-2-textSize.Width;
53513
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53514
+ this.DrawComplexTextV2(itemLeft, yTop ,complexText, textSize);
53515
+
53516
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, chartRight-2-textSize.Width,this.TextHeight,this.TextHeight,buttonData);
53515
53517
  }
53516
53518
  else
53517
53519
  {
53518
53520
  var itemLeft=right+2;
53519
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53521
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53522
+ this.DrawComplexTextV2(itemLeft,yTop,complexText,textSize);
53520
53523
 
53521
- if (complexText)
53522
- {
53523
- this.DrawComplexText(itemLeft,y,complexText);
53524
- }
53525
- else
53526
- {
53527
- this.Canvas.textAlign="left";
53528
- this.Canvas.textBaseline="middle";
53529
- this.Canvas.fillStyle=this.TextColor;
53530
- this.Canvas.fillText(text,right+4,y,textWidth);
53531
- }
53532
-
53533
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, right+2,this.TextHeight,this.TextHeight,buttonData);
53524
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, right+2,this.TextHeight,this.TextHeight,buttonData);
53534
53525
  }
53535
53526
 
53527
+ /*
53536
53528
  if (this.StringFormatY.RExtendText && this.StringFormatY.RExtendText.length>0)
53537
53529
  {
53538
53530
  var yOffset=0;
@@ -53564,26 +53556,16 @@ function ChartCorssCursor()
53564
53556
  yOffset+=this.TextHeight;
53565
53557
  }
53566
53558
  }
53559
+ */
53567
53560
  }
53568
53561
  else if (this.ShowTextMode.Right==2)
53569
53562
  {
53570
53563
  this.Canvas.fillStyle=this.TextBGColor;
53571
- var showLeft=right-textWidth;
53572
- this.DrawTextBGRect(showLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53564
+ var showLeft=right-textSize.Width;
53565
+ this.DrawTextBGRect(showLeft,yTop,textSize.Width,textSize.Height);
53566
+ this.DrawComplexTextV2(showLeft,yTop,complexText,textSize);
53573
53567
 
53574
- if (complexText)
53575
- {
53576
- this.DrawComplexText(showLeft,y,complexText);
53577
- }
53578
- else
53579
- {
53580
- this.Canvas.textAlign="left";
53581
- this.Canvas.textBaseline="middle";
53582
- this.Canvas.fillStyle=this.TextColor;
53583
- this.Canvas.fillText(text,showLeft+2,y,textWidth);
53584
- }
53585
-
53586
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, showLeft,this.TextHeight,this.TextHeight,buttonData);
53568
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, showLeft,this.TextHeight,this.TextHeight,buttonData);
53587
53569
  }
53588
53570
  }
53589
53571
 
@@ -53703,6 +53685,137 @@ function ChartCorssCursor()
53703
53685
  }
53704
53686
  }
53705
53687
 
53688
+ this.DrawComplexTextV2=function(left, yTop, complexText, size)
53689
+ {
53690
+ this.Canvas.textAlign="left";
53691
+ this.Canvas.textBaseline="bottom";
53692
+ var showType=0;
53693
+ if (complexText.ShowType==1) showType=complexText.ShowType;
53694
+ if (showType==1) //多行
53695
+ {
53696
+ var xLeft=left;
53697
+ var yText=yTop; //顶
53698
+ for(var i=0; i<complexText.Text.length; ++i)
53699
+ {
53700
+ var item=complexText.Text[i];
53701
+ var itemSize=size.Text[i];
53702
+
53703
+ if (item.Font) this.Canvas.font=item.Font;
53704
+ else this.Canvas.font=complexText.Font;
53705
+
53706
+ if (item.Color) this.Canvas.fillStyle=item.Color;
53707
+ else this.Canvas.fillStyle=complexText.Color;
53708
+
53709
+ var y=yText+itemSize.Height;
53710
+ var x=xLeft;
53711
+ if (item.Margin)
53712
+ {
53713
+ var margin=item.Margin;
53714
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
53715
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
53716
+ }
53717
+
53718
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
53719
+
53720
+ yText+=itemSize.Height;
53721
+ }
53722
+ }
53723
+ else //水平 单行
53724
+ {
53725
+ var xText=left;
53726
+ var yBottom=yTop+size.Height;
53727
+ for(var i=0; i<complexText.Text.length; ++i)
53728
+ {
53729
+ var item=complexText.Text[i];
53730
+ var itemSize=size.Text[i];
53731
+
53732
+ if (item.Font) this.Canvas.font=item.Font;
53733
+ else this.Canvas.font=complexText.Font;
53734
+
53735
+ if (item.Color) this.Canvas.fillStyle=item.Color;
53736
+ else this.Canvas.fillStyle=complexText.Color;
53737
+
53738
+ var y=yBottom;
53739
+ var x=xText;
53740
+ if (item.Margin)
53741
+ {
53742
+ var margin=item.Margin;
53743
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
53744
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
53745
+ }
53746
+
53747
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
53748
+
53749
+ xText+=itemSize.Width;
53750
+ }
53751
+ }
53752
+ }
53753
+
53754
+ this.CalculateComplexTextSize=function(complexText, size)
53755
+ {
53756
+ if (!complexText || !IFrameSplitOperator.IsNonEmptyArray(complexText.Text)) return;
53757
+
53758
+ var showType=0;
53759
+ if (complexText.ShowType==1) showType=complexText.ShowType;
53760
+ if (showType==1) //多行
53761
+ {
53762
+ var textWidth=0, textHeight=0;
53763
+ for(var i=0; i<complexText.Text.length; ++i)
53764
+ {
53765
+ var item=complexText.Text[i];
53766
+ if (item.Font) this.Canvas.font=item.Font;
53767
+ else this.Canvas.font=complexText.Font;
53768
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
53769
+ var itemHeight=this.Canvas.measureText("擎").width;
53770
+ if (item.Margin)
53771
+ {
53772
+ var margin=item.Margin;
53773
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
53774
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
53775
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
53776
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
53777
+ }
53778
+
53779
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
53780
+
53781
+ if (textWidth<itemWidth) textWidth=itemWidth;
53782
+ textHeight+=itemHeight;
53783
+ }
53784
+
53785
+ size.Width=textWidth;
53786
+ size.Height=textHeight;
53787
+ }
53788
+ else //水平 单行
53789
+ {
53790
+ var textWidth=0, textHeight=0;
53791
+ for(var i=0; i<complexText.Text.length; ++i)
53792
+ {
53793
+ var item=complexText.Text[i];
53794
+ if (item.Font) this.Canvas.font=item.Font;
53795
+ else this.Canvas.font=complexText.Font;
53796
+
53797
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
53798
+ var itemHeight=this.Canvas.measureText("擎").width;
53799
+ if (item.Margin)
53800
+ {
53801
+ var margin=item.Margin;
53802
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
53803
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
53804
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
53805
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
53806
+ }
53807
+
53808
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
53809
+
53810
+ textWidth+=itemWidth;
53811
+ if (textHeight<itemHeight) textHeight=itemHeight;
53812
+ }
53813
+
53814
+ size.Width=textWidth;
53815
+ size.Height=textHeight;
53816
+ }
53817
+ }
53818
+
53706
53819
  this.DrawRightButton=function(drawTop, drawRight, drawWidth, drawHeight, data)
53707
53820
  {
53708
53821
  this.Canvas.fillStyle=this.RightButton.BGColor;
@@ -65506,7 +65619,7 @@ function ChartDrawMonitorLine()
65506
65619
  if (item.LineDash) dest.LineDash=item.LineDash;
65507
65620
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
65508
65621
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
65509
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
65622
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
65510
65623
  }
65511
65624
 
65512
65625
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -69507,7 +69620,7 @@ function ChartInfoLine()
69507
69620
  if (item.BGColor) dest.BGColor=item.BGColor;
69508
69621
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
69509
69622
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
69510
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
69623
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
69511
69624
  }
69512
69625
 
69513
69626
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -70167,7 +70280,9 @@ function JSChartResource()
70167
70280
  BGColor:'rgb(43,54,69)',
70168
70281
  PenColor:'rgb(255,255,255)',
70169
70282
  Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
70170
- }
70283
+ },
70284
+
70285
+ RightMargin: { Left:2, Right:2, Top:5, Bottom:3 }
70171
70286
  };
70172
70287
 
70173
70288
  this.LockBGColor = "rgb(220, 220, 220)"; //指标锁区域颜色
@@ -125376,6 +125491,7 @@ function JSReportChartContainer(uielement)
125376
125491
  this.IsDestroy=false; //是否已经销毁了
125377
125492
 
125378
125493
  this.JSPopMenu; //内置菜单
125494
+ this.IsShowRightMenu=true;
125379
125495
 
125380
125496
  this.ChartDestory=function() //销毁
125381
125497
  {
@@ -126599,6 +126715,18 @@ function JSReportChartContainer(uielement)
126599
126715
 
126600
126716
  //去掉右键菜单
126601
126717
  this.UIOnContextMenu=function(e)
126718
+ {
126719
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
126720
+
126721
+ if (!this.IsShowRightMenu) return;
126722
+
126723
+ var x = e.clientX-this.UIElement.getBoundingClientRect().left;
126724
+ var y = e.clientY-this.UIElement.getBoundingClientRect().top;
126725
+
126726
+ if(typeof(this.OnRightMenu)=='function') this.OnRightMenu(x,y,e); //右键菜单事件
126727
+ }
126728
+
126729
+ this.OnRightMenu=function(x,y,e)
126602
126730
  {
126603
126731
  e.preventDefault();
126604
126732
  }
@@ -128772,6 +128900,14 @@ function ChartReport()
128772
128900
  return null;
128773
128901
  }
128774
128902
 
128903
+ this.ClipClient=function()
128904
+ {
128905
+ this.Canvas.save();
128906
+ this.Canvas.beginPath();
128907
+ this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
128908
+ //this.Canvas.stroke(); //调试用
128909
+ this.Canvas.clip();
128910
+ }
128775
128911
 
128776
128912
  this.Draw=function()
128777
128913
  {
@@ -128783,12 +128919,7 @@ function ChartReport()
128783
128919
  if (this.SizeChange) this.CalculateSize();
128784
128920
  else this.UpdateCacheData();
128785
128921
 
128786
- this.Canvas.save();
128787
-
128788
- this.Canvas.beginPath();
128789
- this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
128790
- //this.Canvas.stroke(); //调试用
128791
- this.Canvas.clip();
128922
+ this.ClipClient();
128792
128923
 
128793
128924
  this.DrawHeader();
128794
128925
  this.DrawBody();
@@ -128801,7 +128932,9 @@ function ChartReport()
128801
128932
  this.Tab.DrawScrollbar(this.RectClient.Left,bottom-this.BottomToolbarHeight, this.RectClient.Right, bottom);
128802
128933
  }
128803
128934
 
128935
+ this.ClipClient();
128804
128936
  this.DrawBorder();
128937
+ this.Canvas.restore();
128805
128938
 
128806
128939
  this.DrawDragRow();
128807
128940
 
@@ -134526,7 +134659,7 @@ function ScrollBarBGChart()
134526
134659
 
134527
134660
 
134528
134661
 
134529
- var HQCHART_VERSION="1.1.13496";
134662
+ var HQCHART_VERSION="1.1.13501";
134530
134663
 
134531
134664
  function PrintHQChartVersion()
134532
134665
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13496";
8
+ var HQCHART_VERSION="1.1.13501";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {