hqchart 1.1.13497 → 1.1.13513

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,37 +53484,40 @@ 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
- }
53514
+ if (!complexText.Font) complexText.Font=this.Font;
53515
+ if (!complexText.Color) complexText.Color=this.TextColor;
53510
53516
  }
53517
+
53518
+
53519
+
53520
+ this.CalculateComplexTextSize(complexText, textSize);
53511
53521
 
53512
53522
  if (this.Frame.ChartBorder.Right>=30 && this.ShowTextMode.Right==1)
53513
53523
  {
@@ -53517,66 +53527,52 @@ function ChartCorssCursor()
53517
53527
  {
53518
53528
  var frame=this.Frame.SubFrame[yValueExtend.FrameID];
53519
53529
  isOverlayIndex=frame.OverlayIndex.length>0;
53520
- overlayIndexInterval=frame.Interval;
53530
+ overlayIndexInterval=null
53531
+ if (isOverlayIndex)
53532
+ {
53533
+ for(var i=0;i<=frame.OverlayIndex.length;++i)
53534
+ {
53535
+ var item=frame.OverlayIndex[i];
53536
+ if (item.Frame.IsShow===false) continue;
53537
+ if (!item.Frame.GetXHorizontal) continue;
53538
+
53539
+ var overlayLeft=item.Frame.GetXHorizontal();
53540
+ overlayIndexInterval=overlayLeft-right;
53541
+ break;
53542
+ }
53543
+ }
53521
53544
  }
53522
53545
 
53523
- if (isOverlayIndex && textWidth>overlayIndexInterval) //大于子坐标宽度
53546
+ //叠加坐标
53547
+ if (isOverlayIndex && textSize.Width>overlayIndexInterval && overlayIndexInterval>0) //大于子坐标宽度
53524
53548
  {
53525
53549
  var drawRight=right+overlayIndexInterval;
53526
53550
  if (drawRight>chartRight) drawRight=chartRight;
53527
53551
 
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
- }
53552
+ var itemLeft=drawRight-2-textSize.Width;
53553
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53554
+ this.DrawComplexTextV2(itemLeft, yTop, complexText, textSize);
53555
+
53556
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, itemLeft,this.TextHeight,this.TextHeight,buttonData);
53541
53557
  }
53542
- else if (rightWidth<textWidth) //右边空白显示不下,
53558
+ else if (rightWidth<textSize.Width) //右边空白显示不下,
53543
53559
  {
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);
53560
+ var itemLeft=chartRight-2-textSize.Width;
53561
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53562
+ this.DrawComplexTextV2(itemLeft, yTop ,complexText, textSize);
53563
+
53564
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, chartRight-2-textSize.Width,this.TextHeight,this.TextHeight,buttonData);
53559
53565
  }
53560
53566
  else
53561
53567
  {
53562
53568
  var itemLeft=right+2;
53563
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53569
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53570
+ this.DrawComplexTextV2(itemLeft,yTop,complexText,textSize);
53564
53571
 
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);
53572
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, right+2,this.TextHeight,this.TextHeight,buttonData);
53578
53573
  }
53579
53574
 
53575
+ /*
53580
53576
  if (this.StringFormatY.RExtendText && this.StringFormatY.RExtendText.length>0)
53581
53577
  {
53582
53578
  var yOffset=0;
@@ -53608,26 +53604,16 @@ function ChartCorssCursor()
53608
53604
  yOffset+=this.TextHeight;
53609
53605
  }
53610
53606
  }
53607
+ */
53611
53608
  }
53612
53609
  else if (this.ShowTextMode.Right==2)
53613
53610
  {
53614
53611
  this.Canvas.fillStyle=this.TextBGColor;
53615
- var showLeft=right-textWidth;
53616
- this.DrawTextBGRect(showLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53617
-
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
- }
53612
+ var showLeft=right-textSize.Width;
53613
+ this.DrawTextBGRect(showLeft,yTop,textSize.Width,textSize.Height);
53614
+ this.DrawComplexTextV2(showLeft,yTop,complexText,textSize);
53629
53615
 
53630
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, showLeft,this.TextHeight,this.TextHeight,buttonData);
53616
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, showLeft,this.TextHeight,this.TextHeight,buttonData);
53631
53617
  }
53632
53618
  }
53633
53619
 
@@ -53727,23 +53713,134 @@ function ChartCorssCursor()
53727
53713
  this.Status=1;
53728
53714
  }
53729
53715
 
53730
- this.DrawComplexText=function(left, y, complexText)
53716
+ this.DrawComplexTextV2=function(left, yTop, complexText, size)
53731
53717
  {
53732
53718
  this.Canvas.textAlign="left";
53733
- this.Canvas.textBaseline="middle";
53734
- var xText=left+2;
53735
- for(var i=0; i<complexText.Text.length; ++i)
53719
+ this.Canvas.textBaseline="bottom";
53720
+ var showType=0;
53721
+ if (complexText.ShowType==1) showType=complexText.ShowType;
53722
+ if (showType==1) //多行
53736
53723
  {
53737
- var item=complexText.Text[i];
53738
- var itemWidth=this.Canvas.measureText(item.Text).width+4; //前后各空2个像素
53739
- if (item.Color) this.Canvas.fillStyle=item.Color;
53740
- else is.Canvas.fillStyle=this.TextColor;
53741
- this.Canvas.fillText(item.Text,xText,y,itemWidth);
53724
+ var xLeft=left;
53725
+ var yText=yTop; //顶
53726
+ for(var i=0; i<complexText.Text.length; ++i)
53727
+ {
53728
+ var item=complexText.Text[i];
53729
+ var itemSize=size.Text[i];
53730
+
53731
+ if (item.Font) this.Canvas.font=item.Font;
53732
+ else this.Canvas.font=complexText.Font;
53733
+
53734
+ if (item.Color) this.Canvas.fillStyle=item.Color;
53735
+ else this.Canvas.fillStyle=complexText.Color;
53736
+
53737
+ var y=yText+itemSize.Height;
53738
+ var x=xLeft;
53739
+ if (item.Margin)
53740
+ {
53741
+ var margin=item.Margin;
53742
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
53743
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
53744
+ }
53745
+
53746
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
53747
+
53748
+ yText+=itemSize.Height;
53749
+ }
53750
+ }
53751
+ else //水平 单行
53752
+ {
53753
+ var xText=left;
53754
+ var yBottom=yTop+size.Height;
53755
+ for(var i=0; i<complexText.Text.length; ++i)
53756
+ {
53757
+ var item=complexText.Text[i];
53758
+ var itemSize=size.Text[i];
53759
+
53760
+ if (item.Font) this.Canvas.font=item.Font;
53761
+ else this.Canvas.font=complexText.Font;
53762
+
53763
+ if (item.Color) this.Canvas.fillStyle=item.Color;
53764
+ else this.Canvas.fillStyle=complexText.Color;
53765
+
53766
+ var y=yBottom;
53767
+ var x=xText;
53768
+ if (item.Margin)
53769
+ {
53770
+ var margin=item.Margin;
53771
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
53772
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
53773
+ }
53774
+
53775
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
53776
+
53777
+ xText+=itemSize.Width;
53778
+ }
53779
+ }
53780
+ }
53781
+
53782
+ this.CalculateComplexTextSize=function(complexText, size)
53783
+ {
53784
+ if (!complexText || !IFrameSplitOperator.IsNonEmptyArray(complexText.Text)) return;
53785
+
53786
+ var showType=0;
53787
+ if (complexText.ShowType==1) showType=complexText.ShowType;
53788
+ if (showType==1) //多行
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
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
53797
+ var itemHeight=this.Canvas.measureText("擎").width;
53798
+ if (item.Margin)
53799
+ {
53800
+ var margin=item.Margin;
53801
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
53802
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
53803
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
53804
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
53805
+ }
53806
+
53807
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
53808
+
53809
+ if (textWidth<itemWidth) textWidth=itemWidth;
53810
+ textHeight+=itemHeight;
53811
+ }
53812
+
53813
+ size.Width=textWidth;
53814
+ size.Height=textHeight;
53815
+ }
53816
+ else //水平 单行
53817
+ {
53818
+ var textWidth=0, textHeight=0;
53819
+ for(var i=0; i<complexText.Text.length; ++i)
53820
+ {
53821
+ var item=complexText.Text[i];
53822
+ if (item.Font) this.Canvas.font=item.Font;
53823
+ else this.Canvas.font=complexText.Font;
53824
+
53825
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
53826
+ var itemHeight=this.Canvas.measureText("擎").width;
53827
+ if (item.Margin)
53828
+ {
53829
+ var margin=item.Margin;
53830
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
53831
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
53832
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
53833
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
53834
+ }
53742
53835
 
53743
- if (i>0 && IFrameSplitOperator.IsNumber(complexText.Space))
53744
- xText+=complexText.Space;
53836
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
53837
+
53838
+ textWidth+=itemWidth;
53839
+ if (textHeight<itemHeight) textHeight=itemHeight;
53840
+ }
53745
53841
 
53746
- xText+=itemWidth;
53842
+ size.Width=textWidth;
53843
+ size.Height=textHeight;
53747
53844
  }
53748
53845
  }
53749
53846
 
@@ -65550,7 +65647,7 @@ function ChartDrawMonitorLine()
65550
65647
  if (item.LineDash) dest.LineDash=item.LineDash;
65551
65648
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
65552
65649
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
65553
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
65650
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
65554
65651
  }
65555
65652
 
65556
65653
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -69551,7 +69648,7 @@ function ChartInfoLine()
69551
69648
  if (item.BGColor) dest.BGColor=item.BGColor;
69552
69649
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
69553
69650
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
69554
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
69651
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
69555
69652
  }
69556
69653
 
69557
69654
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -70211,7 +70308,9 @@ function JSChartResource()
70211
70308
  BGColor:'rgb(43,54,69)',
70212
70309
  PenColor:'rgb(255,255,255)',
70213
70310
  Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
70214
- }
70311
+ },
70312
+
70313
+ RightMargin: { Left:2, Right:2, Top:5, Bottom:3 }
70215
70314
  };
70216
70315
 
70217
70316
  this.LockBGColor = "rgb(220, 220, 220)"; //指标锁区域颜色
@@ -125420,6 +125519,7 @@ function JSReportChartContainer(uielement)
125420
125519
  this.IsDestroy=false; //是否已经销毁了
125421
125520
 
125422
125521
  this.JSPopMenu; //内置菜单
125522
+ this.IsShowRightMenu=true;
125423
125523
 
125424
125524
  this.ChartDestory=function() //销毁
125425
125525
  {
@@ -126643,6 +126743,18 @@ function JSReportChartContainer(uielement)
126643
126743
 
126644
126744
  //去掉右键菜单
126645
126745
  this.UIOnContextMenu=function(e)
126746
+ {
126747
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
126748
+
126749
+ if (!this.IsShowRightMenu) return;
126750
+
126751
+ var x = e.clientX-this.UIElement.getBoundingClientRect().left;
126752
+ var y = e.clientY-this.UIElement.getBoundingClientRect().top;
126753
+
126754
+ if(typeof(this.OnRightMenu)=='function') this.OnRightMenu(x,y,e); //右键菜单事件
126755
+ }
126756
+
126757
+ this.OnRightMenu=function(x,y,e)
126646
126758
  {
126647
126759
  e.preventDefault();
126648
126760
  }
@@ -128816,6 +128928,14 @@ function ChartReport()
128816
128928
  return null;
128817
128929
  }
128818
128930
 
128931
+ this.ClipClient=function()
128932
+ {
128933
+ this.Canvas.save();
128934
+ this.Canvas.beginPath();
128935
+ this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
128936
+ //this.Canvas.stroke(); //调试用
128937
+ this.Canvas.clip();
128938
+ }
128819
128939
 
128820
128940
  this.Draw=function()
128821
128941
  {
@@ -128827,12 +128947,7 @@ function ChartReport()
128827
128947
  if (this.SizeChange) this.CalculateSize();
128828
128948
  else this.UpdateCacheData();
128829
128949
 
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();
128950
+ this.ClipClient();
128836
128951
 
128837
128952
  this.DrawHeader();
128838
128953
  this.DrawBody();
@@ -128845,7 +128960,9 @@ function ChartReport()
128845
128960
  this.Tab.DrawScrollbar(this.RectClient.Left,bottom-this.BottomToolbarHeight, this.RectClient.Right, bottom);
128846
128961
  }
128847
128962
 
128963
+ this.ClipClient();
128848
128964
  this.DrawBorder();
128965
+ this.Canvas.restore();
128849
128966
 
128850
128967
  this.DrawDragRow();
128851
128968
 
@@ -138467,7 +138584,7 @@ function HQChartScriptWorker()
138467
138584
 
138468
138585
 
138469
138586
 
138470
- var HQCHART_VERSION="1.1.13496";
138587
+ var HQCHART_VERSION="1.1.13512";
138471
138588
 
138472
138589
  function PrintHQChartVersion()
138473
138590
  {