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.
@@ -13834,7 +13834,7 @@ function IsRecvOverlap(rect1, rect2)
13834
13834
  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);
13835
13835
  }
13836
13836
 
13837
- function CopyMerginConfig(dest,src)
13837
+ function CopyMarginConfig(dest,src)
13838
13838
  {
13839
13839
  if (!src || !dest) return;
13840
13840
 
@@ -13844,6 +13844,9 @@ function CopyMerginConfig(dest,src)
13844
13844
  if (IFrameSplitOperator.IsNumber(src.Bottom)) dest.Bottom=src.Bottom;
13845
13845
  }
13846
13846
 
13847
+ //兼容老版本
13848
+ function CopyMerginConfig(dest,src) { CopyMarginConfig(dest,src); }
13849
+
13847
13850
 
13848
13851
  function Point()
13849
13852
  {
@@ -53081,6 +53084,9 @@ function ChartCorssCursor()
53081
53084
  Icon:g_JSChartResource.CorssCursor.RightButton.Icon
53082
53085
  };
53083
53086
 
53087
+ this.RightMargin={ Left:2, Right:2, Top:4, Bottom:3 };
53088
+ CopyMarginConfig(this.RightMargin, g_JSChartResource.CorssCursor.RightMargin);
53089
+
53084
53090
  //内部使用
53085
53091
  this.Close=null; //收盘价格
53086
53092
  this.Status=0; //当前状态 0=隐藏 1=显示
@@ -53448,6 +53454,7 @@ function ChartCorssCursor()
53448
53454
  var text=this.StringFormatY.Text;
53449
53455
  this.Canvas.font=this.Font;
53450
53456
  var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
53457
+ var textSize={ Width:textWidth, Height:this.TextHeight, Text:[] };
53451
53458
  var buttonData={Y:y, YValue:yValue, FrameID:yValueExtend.FrameID };
53452
53459
  if (this.Frame.ChartBorder.Left>=30 && this.ShowTextMode.Left==1)
53453
53460
  {
@@ -53477,38 +53484,37 @@ function ChartCorssCursor()
53477
53484
  this.Canvas.fillText(text,left+2,y,textWidth);
53478
53485
  }
53479
53486
 
53487
+ var complexText=
53488
+ {
53489
+ ShowType:0, //0=单行(默认) 1=多行
53490
+ Font:this.Font, Color:this.TextColor,
53491
+ Text:[ { Text:text, Margin:this.RightMargin } ],
53492
+ };
53493
+
53494
+ var yTop=y-this.TextHeight/2;
53495
+
53480
53496
  if (this.StringFormatY.PercentageText)
53481
53497
  {
53482
53498
  if (this.TextFormat.Right==0)
53483
53499
  {
53484
53500
  text=this.StringFormatY.PercentageText+'%';
53485
- textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
53501
+ complexText.Text[0].Text=text;
53486
53502
  }
53487
53503
  }
53488
53504
 
53489
53505
  if (this.StringFormatY.RText)
53490
53506
  {
53491
53507
  text=this.StringFormatY.RText;
53492
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
53508
+ complexText.Text[0].Text=text;
53493
53509
  }
53494
53510
 
53495
- var complexText=null;
53496
53511
  if (this.StringFormatY.RComplexText && IFrameSplitOperator.IsNonEmptyArray(this.StringFormatY.RComplexText.Text))
53497
53512
  {
53498
- var textWidth=0;
53499
53513
  complexText=this.StringFormatY.RComplexText;
53500
- for(var i=0; i<complexText.Text.length; ++i)
53501
- {
53502
- var item=complexText.Text[i];
53503
- var itemWidth=this.Canvas.measureText(item.Text).width+4; //前后各空2个像素
53504
-
53505
- if (i>0 && IFrameSplitOperator.IsNumber(complexText.Space))
53506
- textWidth+=complexText.Space;
53507
-
53508
- textWidth+=itemWidth;
53509
- }
53510
53514
  }
53511
53515
 
53516
+ this.CalculateComplexTextSize(complexText, textSize);
53517
+
53512
53518
  if (this.Frame.ChartBorder.Right>=30 && this.ShowTextMode.Right==1)
53513
53519
  {
53514
53520
  var isOverlayIndex=false; //是否有叠加子坐标
@@ -53517,66 +53523,52 @@ function ChartCorssCursor()
53517
53523
  {
53518
53524
  var frame=this.Frame.SubFrame[yValueExtend.FrameID];
53519
53525
  isOverlayIndex=frame.OverlayIndex.length>0;
53520
- overlayIndexInterval=frame.Interval;
53526
+ overlayIndexInterval=null
53527
+ if (isOverlayIndex)
53528
+ {
53529
+ for(var i=0;i<=frame.OverlayIndex.length;++i)
53530
+ {
53531
+ var item=frame.OverlayIndex[i];
53532
+ if (item.Frame.IsShow===false) continue;
53533
+ if (!item.Frame.GetXHorizontal) continue;
53534
+
53535
+ var overlayLeft=item.Frame.GetXHorizontal();
53536
+ overlayIndexInterval=overlayLeft-right;
53537
+ break;
53538
+ }
53539
+ }
53521
53540
  }
53522
53541
 
53523
- if (isOverlayIndex && textWidth>overlayIndexInterval) //大于子坐标宽度
53542
+ //叠加坐标
53543
+ if (isOverlayIndex && textSize.Width>overlayIndexInterval && overlayIndexInterval>0) //大于子坐标宽度
53524
53544
  {
53525
53545
  var drawRight=right+overlayIndexInterval;
53526
53546
  if (drawRight>chartRight) drawRight=chartRight;
53527
53547
 
53528
- var itemLeft=drawRight-2-textWidth;
53529
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53530
- if (complexText)
53531
- {
53532
- this.DrawComplexText(itemLeft,y,complexText);
53533
- }
53534
- else
53535
- {
53536
- this.Canvas.textAlign="right";
53537
- this.Canvas.textBaseline="middle";
53538
- this.Canvas.fillStyle=this.TextColor;
53539
- this.Canvas.fillText(text,drawRight-4,y,textWidth);
53540
- }
53548
+ var itemLeft=drawRight-2-textSize.Width;
53549
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53550
+ this.DrawComplexTextV2(itemLeft, yTop, complexText, textSize);
53551
+
53552
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, itemLeft,this.TextHeight,this.TextHeight,buttonData);
53541
53553
  }
53542
- else if (rightWidth<textWidth) //右边空白显示不下,
53554
+ else if (rightWidth<textSize.Width) //右边空白显示不下,
53543
53555
  {
53544
- var itemLeft=chartRight-2-textWidth;
53545
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53546
- if (complexText)
53547
- {
53548
- this.DrawComplexText(itemLeft,y,complexText);
53549
- }
53550
- else
53551
- {
53552
- this.Canvas.textAlign="right";
53553
- this.Canvas.textBaseline="middle";
53554
- this.Canvas.fillStyle=this.TextColor;
53555
- this.Canvas.fillText(text,chartRight-4,y,textWidth);
53556
- }
53557
-
53558
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, chartRight-2-textWidth,this.TextHeight,this.TextHeight,buttonData);
53556
+ var itemLeft=chartRight-2-textSize.Width;
53557
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53558
+ this.DrawComplexTextV2(itemLeft, yTop ,complexText, textSize);
53559
+
53560
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, chartRight-2-textSize.Width,this.TextHeight,this.TextHeight,buttonData);
53559
53561
  }
53560
53562
  else
53561
53563
  {
53562
53564
  var itemLeft=right+2;
53563
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53565
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53566
+ this.DrawComplexTextV2(itemLeft,yTop,complexText,textSize);
53564
53567
 
53565
- if (complexText)
53566
- {
53567
- this.DrawComplexText(itemLeft,y,complexText);
53568
- }
53569
- else
53570
- {
53571
- this.Canvas.textAlign="left";
53572
- this.Canvas.textBaseline="middle";
53573
- this.Canvas.fillStyle=this.TextColor;
53574
- this.Canvas.fillText(text,right+4,y,textWidth);
53575
- }
53576
-
53577
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, right+2,this.TextHeight,this.TextHeight,buttonData);
53568
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, right+2,this.TextHeight,this.TextHeight,buttonData);
53578
53569
  }
53579
53570
 
53571
+ /*
53580
53572
  if (this.StringFormatY.RExtendText && this.StringFormatY.RExtendText.length>0)
53581
53573
  {
53582
53574
  var yOffset=0;
@@ -53608,26 +53600,16 @@ function ChartCorssCursor()
53608
53600
  yOffset+=this.TextHeight;
53609
53601
  }
53610
53602
  }
53603
+ */
53611
53604
  }
53612
53605
  else if (this.ShowTextMode.Right==2)
53613
53606
  {
53614
53607
  this.Canvas.fillStyle=this.TextBGColor;
53615
- var showLeft=right-textWidth;
53616
- this.DrawTextBGRect(showLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53608
+ var showLeft=right-textSize.Width;
53609
+ this.DrawTextBGRect(showLeft,yTop,textSize.Width,textSize.Height);
53610
+ this.DrawComplexTextV2(showLeft,yTop,complexText,textSize);
53617
53611
 
53618
- if (complexText)
53619
- {
53620
- this.DrawComplexText(showLeft,y,complexText);
53621
- }
53622
- else
53623
- {
53624
- this.Canvas.textAlign="left";
53625
- this.Canvas.textBaseline="middle";
53626
- this.Canvas.fillStyle=this.TextColor;
53627
- this.Canvas.fillText(text,showLeft+2,y,textWidth);
53628
- }
53629
-
53630
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, showLeft,this.TextHeight,this.TextHeight,buttonData);
53612
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, showLeft,this.TextHeight,this.TextHeight,buttonData);
53631
53613
  }
53632
53614
  }
53633
53615
 
@@ -53747,6 +53729,137 @@ function ChartCorssCursor()
53747
53729
  }
53748
53730
  }
53749
53731
 
53732
+ this.DrawComplexTextV2=function(left, yTop, complexText, size)
53733
+ {
53734
+ this.Canvas.textAlign="left";
53735
+ this.Canvas.textBaseline="bottom";
53736
+ var showType=0;
53737
+ if (complexText.ShowType==1) showType=complexText.ShowType;
53738
+ if (showType==1) //多行
53739
+ {
53740
+ var xLeft=left;
53741
+ var yText=yTop; //顶
53742
+ for(var i=0; i<complexText.Text.length; ++i)
53743
+ {
53744
+ var item=complexText.Text[i];
53745
+ var itemSize=size.Text[i];
53746
+
53747
+ if (item.Font) this.Canvas.font=item.Font;
53748
+ else this.Canvas.font=complexText.Font;
53749
+
53750
+ if (item.Color) this.Canvas.fillStyle=item.Color;
53751
+ else this.Canvas.fillStyle=complexText.Color;
53752
+
53753
+ var y=yText+itemSize.Height;
53754
+ var x=xLeft;
53755
+ if (item.Margin)
53756
+ {
53757
+ var margin=item.Margin;
53758
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
53759
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
53760
+ }
53761
+
53762
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
53763
+
53764
+ yText+=itemSize.Height;
53765
+ }
53766
+ }
53767
+ else //水平 单行
53768
+ {
53769
+ var xText=left;
53770
+ var yBottom=yTop+size.Height;
53771
+ for(var i=0; i<complexText.Text.length; ++i)
53772
+ {
53773
+ var item=complexText.Text[i];
53774
+ var itemSize=size.Text[i];
53775
+
53776
+ if (item.Font) this.Canvas.font=item.Font;
53777
+ else this.Canvas.font=complexText.Font;
53778
+
53779
+ if (item.Color) this.Canvas.fillStyle=item.Color;
53780
+ else this.Canvas.fillStyle=complexText.Color;
53781
+
53782
+ var y=yBottom;
53783
+ var x=xText;
53784
+ if (item.Margin)
53785
+ {
53786
+ var margin=item.Margin;
53787
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
53788
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
53789
+ }
53790
+
53791
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
53792
+
53793
+ xText+=itemSize.Width;
53794
+ }
53795
+ }
53796
+ }
53797
+
53798
+ this.CalculateComplexTextSize=function(complexText, size)
53799
+ {
53800
+ if (!complexText || !IFrameSplitOperator.IsNonEmptyArray(complexText.Text)) return;
53801
+
53802
+ var showType=0;
53803
+ if (complexText.ShowType==1) showType=complexText.ShowType;
53804
+ if (showType==1) //多行
53805
+ {
53806
+ var textWidth=0, textHeight=0;
53807
+ for(var i=0; i<complexText.Text.length; ++i)
53808
+ {
53809
+ var item=complexText.Text[i];
53810
+ if (item.Font) this.Canvas.font=item.Font;
53811
+ else this.Canvas.font=complexText.Font;
53812
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
53813
+ var itemHeight=this.Canvas.measureText("擎").width;
53814
+ if (item.Margin)
53815
+ {
53816
+ var margin=item.Margin;
53817
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
53818
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
53819
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
53820
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
53821
+ }
53822
+
53823
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
53824
+
53825
+ if (textWidth<itemWidth) textWidth=itemWidth;
53826
+ textHeight+=itemHeight;
53827
+ }
53828
+
53829
+ size.Width=textWidth;
53830
+ size.Height=textHeight;
53831
+ }
53832
+ else //水平 单行
53833
+ {
53834
+ var textWidth=0, textHeight=0;
53835
+ for(var i=0; i<complexText.Text.length; ++i)
53836
+ {
53837
+ var item=complexText.Text[i];
53838
+ if (item.Font) this.Canvas.font=item.Font;
53839
+ else this.Canvas.font=complexText.Font;
53840
+
53841
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
53842
+ var itemHeight=this.Canvas.measureText("擎").width;
53843
+ if (item.Margin)
53844
+ {
53845
+ var margin=item.Margin;
53846
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
53847
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
53848
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
53849
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
53850
+ }
53851
+
53852
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
53853
+
53854
+ textWidth+=itemWidth;
53855
+ if (textHeight<itemHeight) textHeight=itemHeight;
53856
+ }
53857
+
53858
+ size.Width=textWidth;
53859
+ size.Height=textHeight;
53860
+ }
53861
+ }
53862
+
53750
53863
  this.DrawRightButton=function(drawTop, drawRight, drawWidth, drawHeight, data)
53751
53864
  {
53752
53865
  this.Canvas.fillStyle=this.RightButton.BGColor;
@@ -65550,7 +65663,7 @@ function ChartDrawMonitorLine()
65550
65663
  if (item.LineDash) dest.LineDash=item.LineDash;
65551
65664
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
65552
65665
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
65553
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
65666
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
65554
65667
  }
65555
65668
 
65556
65669
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -69551,7 +69664,7 @@ function ChartInfoLine()
69551
69664
  if (item.BGColor) dest.BGColor=item.BGColor;
69552
69665
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
69553
69666
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
69554
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
69667
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
69555
69668
  }
69556
69669
 
69557
69670
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -70211,7 +70324,9 @@ function JSChartResource()
70211
70324
  BGColor:'rgb(43,54,69)',
70212
70325
  PenColor:'rgb(255,255,255)',
70213
70326
  Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
70214
- }
70327
+ },
70328
+
70329
+ RightMargin: { Left:2, Right:2, Top:5, Bottom:3 }
70215
70330
  };
70216
70331
 
70217
70332
  this.LockBGColor = "rgb(220, 220, 220)"; //指标锁区域颜色
@@ -125420,6 +125535,7 @@ function JSReportChartContainer(uielement)
125420
125535
  this.IsDestroy=false; //是否已经销毁了
125421
125536
 
125422
125537
  this.JSPopMenu; //内置菜单
125538
+ this.IsShowRightMenu=true;
125423
125539
 
125424
125540
  this.ChartDestory=function() //销毁
125425
125541
  {
@@ -126643,6 +126759,18 @@ function JSReportChartContainer(uielement)
126643
126759
 
126644
126760
  //去掉右键菜单
126645
126761
  this.UIOnContextMenu=function(e)
126762
+ {
126763
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
126764
+
126765
+ if (!this.IsShowRightMenu) return;
126766
+
126767
+ var x = e.clientX-this.UIElement.getBoundingClientRect().left;
126768
+ var y = e.clientY-this.UIElement.getBoundingClientRect().top;
126769
+
126770
+ if(typeof(this.OnRightMenu)=='function') this.OnRightMenu(x,y,e); //右键菜单事件
126771
+ }
126772
+
126773
+ this.OnRightMenu=function(x,y,e)
126646
126774
  {
126647
126775
  e.preventDefault();
126648
126776
  }
@@ -128816,6 +128944,14 @@ function ChartReport()
128816
128944
  return null;
128817
128945
  }
128818
128946
 
128947
+ this.ClipClient=function()
128948
+ {
128949
+ this.Canvas.save();
128950
+ this.Canvas.beginPath();
128951
+ this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
128952
+ //this.Canvas.stroke(); //调试用
128953
+ this.Canvas.clip();
128954
+ }
128819
128955
 
128820
128956
  this.Draw=function()
128821
128957
  {
@@ -128827,12 +128963,7 @@ function ChartReport()
128827
128963
  if (this.SizeChange) this.CalculateSize();
128828
128964
  else this.UpdateCacheData();
128829
128965
 
128830
- this.Canvas.save();
128831
-
128832
- this.Canvas.beginPath();
128833
- this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
128834
- //this.Canvas.stroke(); //调试用
128835
- this.Canvas.clip();
128966
+ this.ClipClient();
128836
128967
 
128837
128968
  this.DrawHeader();
128838
128969
  this.DrawBody();
@@ -128845,7 +128976,9 @@ function ChartReport()
128845
128976
  this.Tab.DrawScrollbar(this.RectClient.Left,bottom-this.BottomToolbarHeight, this.RectClient.Right, bottom);
128846
128977
  }
128847
128978
 
128979
+ this.ClipClient();
128848
128980
  this.DrawBorder();
128981
+ this.Canvas.restore();
128849
128982
 
128850
128983
  this.DrawDragRow();
128851
128984
 
@@ -138467,7 +138600,7 @@ function HQChartScriptWorker()
138467
138600
 
138468
138601
 
138469
138602
 
138470
- var HQCHART_VERSION="1.1.13496";
138603
+ var HQCHART_VERSION="1.1.13501";
138471
138604
 
138472
138605
  function PrintHQChartVersion()
138473
138606
  {