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.
@@ -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,37 +53440,40 @@ 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
- }
53470
+ if (!complexText.Font) complexText.Font=this.Font;
53471
+ if (!complexText.Color) complexText.Color=this.TextColor;
53466
53472
  }
53473
+
53474
+
53475
+
53476
+ this.CalculateComplexTextSize(complexText, textSize);
53467
53477
 
53468
53478
  if (this.Frame.ChartBorder.Right>=30 && this.ShowTextMode.Right==1)
53469
53479
  {
@@ -53473,66 +53483,52 @@ function ChartCorssCursor()
53473
53483
  {
53474
53484
  var frame=this.Frame.SubFrame[yValueExtend.FrameID];
53475
53485
  isOverlayIndex=frame.OverlayIndex.length>0;
53476
- overlayIndexInterval=frame.Interval;
53486
+ overlayIndexInterval=null
53487
+ if (isOverlayIndex)
53488
+ {
53489
+ for(var i=0;i<=frame.OverlayIndex.length;++i)
53490
+ {
53491
+ var item=frame.OverlayIndex[i];
53492
+ if (item.Frame.IsShow===false) continue;
53493
+ if (!item.Frame.GetXHorizontal) continue;
53494
+
53495
+ var overlayLeft=item.Frame.GetXHorizontal();
53496
+ overlayIndexInterval=overlayLeft-right;
53497
+ break;
53498
+ }
53499
+ }
53477
53500
  }
53478
53501
 
53479
- if (isOverlayIndex && textWidth>overlayIndexInterval) //大于子坐标宽度
53502
+ //叠加坐标
53503
+ if (isOverlayIndex && textSize.Width>overlayIndexInterval && overlayIndexInterval>0) //大于子坐标宽度
53480
53504
  {
53481
53505
  var drawRight=right+overlayIndexInterval;
53482
53506
  if (drawRight>chartRight) drawRight=chartRight;
53483
53507
 
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
- }
53508
+ var itemLeft=drawRight-2-textSize.Width;
53509
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53510
+ this.DrawComplexTextV2(itemLeft, yTop, complexText, textSize);
53511
+
53512
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, itemLeft,this.TextHeight,this.TextHeight,buttonData);
53497
53513
  }
53498
- else if (rightWidth<textWidth) //右边空白显示不下,
53514
+ else if (rightWidth<textSize.Width) //右边空白显示不下,
53499
53515
  {
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);
53516
+ var itemLeft=chartRight-2-textSize.Width;
53517
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53518
+ this.DrawComplexTextV2(itemLeft, yTop ,complexText, textSize);
53519
+
53520
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, chartRight-2-textSize.Width,this.TextHeight,this.TextHeight,buttonData);
53515
53521
  }
53516
53522
  else
53517
53523
  {
53518
53524
  var itemLeft=right+2;
53519
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53525
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
53526
+ this.DrawComplexTextV2(itemLeft,yTop,complexText,textSize);
53520
53527
 
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);
53528
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, right+2,this.TextHeight,this.TextHeight,buttonData);
53534
53529
  }
53535
53530
 
53531
+ /*
53536
53532
  if (this.StringFormatY.RExtendText && this.StringFormatY.RExtendText.length>0)
53537
53533
  {
53538
53534
  var yOffset=0;
@@ -53564,26 +53560,16 @@ function ChartCorssCursor()
53564
53560
  yOffset+=this.TextHeight;
53565
53561
  }
53566
53562
  }
53563
+ */
53567
53564
  }
53568
53565
  else if (this.ShowTextMode.Right==2)
53569
53566
  {
53570
53567
  this.Canvas.fillStyle=this.TextBGColor;
53571
- var showLeft=right-textWidth;
53572
- this.DrawTextBGRect(showLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
53573
-
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
- }
53568
+ var showLeft=right-textSize.Width;
53569
+ this.DrawTextBGRect(showLeft,yTop,textSize.Width,textSize.Height);
53570
+ this.DrawComplexTextV2(showLeft,yTop,complexText,textSize);
53585
53571
 
53586
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, showLeft,this.TextHeight,this.TextHeight,buttonData);
53572
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, showLeft,this.TextHeight,this.TextHeight,buttonData);
53587
53573
  }
53588
53574
  }
53589
53575
 
@@ -53683,23 +53669,134 @@ function ChartCorssCursor()
53683
53669
  this.Status=1;
53684
53670
  }
53685
53671
 
53686
- this.DrawComplexText=function(left, y, complexText)
53672
+ this.DrawComplexTextV2=function(left, yTop, complexText, size)
53687
53673
  {
53688
53674
  this.Canvas.textAlign="left";
53689
- this.Canvas.textBaseline="middle";
53690
- var xText=left+2;
53691
- for(var i=0; i<complexText.Text.length; ++i)
53675
+ this.Canvas.textBaseline="bottom";
53676
+ var showType=0;
53677
+ if (complexText.ShowType==1) showType=complexText.ShowType;
53678
+ if (showType==1) //多行
53692
53679
  {
53693
- var item=complexText.Text[i];
53694
- var itemWidth=this.Canvas.measureText(item.Text).width+4; //前后各空2个像素
53695
- if (item.Color) this.Canvas.fillStyle=item.Color;
53696
- else is.Canvas.fillStyle=this.TextColor;
53697
- this.Canvas.fillText(item.Text,xText,y,itemWidth);
53680
+ var xLeft=left;
53681
+ var yText=yTop; //顶
53682
+ for(var i=0; i<complexText.Text.length; ++i)
53683
+ {
53684
+ var item=complexText.Text[i];
53685
+ var itemSize=size.Text[i];
53686
+
53687
+ if (item.Font) this.Canvas.font=item.Font;
53688
+ else this.Canvas.font=complexText.Font;
53689
+
53690
+ if (item.Color) this.Canvas.fillStyle=item.Color;
53691
+ else this.Canvas.fillStyle=complexText.Color;
53692
+
53693
+ var y=yText+itemSize.Height;
53694
+ var x=xLeft;
53695
+ if (item.Margin)
53696
+ {
53697
+ var margin=item.Margin;
53698
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
53699
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
53700
+ }
53701
+
53702
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
53703
+
53704
+ yText+=itemSize.Height;
53705
+ }
53706
+ }
53707
+ else //水平 单行
53708
+ {
53709
+ var xText=left;
53710
+ var yBottom=yTop+size.Height;
53711
+ for(var i=0; i<complexText.Text.length; ++i)
53712
+ {
53713
+ var item=complexText.Text[i];
53714
+ var itemSize=size.Text[i];
53715
+
53716
+ if (item.Font) this.Canvas.font=item.Font;
53717
+ else this.Canvas.font=complexText.Font;
53718
+
53719
+ if (item.Color) this.Canvas.fillStyle=item.Color;
53720
+ else this.Canvas.fillStyle=complexText.Color;
53721
+
53722
+ var y=yBottom;
53723
+ var x=xText;
53724
+ if (item.Margin)
53725
+ {
53726
+ var margin=item.Margin;
53727
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
53728
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
53729
+ }
53730
+
53731
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
53732
+
53733
+ xText+=itemSize.Width;
53734
+ }
53735
+ }
53736
+ }
53737
+
53738
+ this.CalculateComplexTextSize=function(complexText, size)
53739
+ {
53740
+ if (!complexText || !IFrameSplitOperator.IsNonEmptyArray(complexText.Text)) return;
53741
+
53742
+ var showType=0;
53743
+ if (complexText.ShowType==1) showType=complexText.ShowType;
53744
+ if (showType==1) //多行
53745
+ {
53746
+ var textWidth=0, textHeight=0;
53747
+ for(var i=0; i<complexText.Text.length; ++i)
53748
+ {
53749
+ var item=complexText.Text[i];
53750
+ if (item.Font) this.Canvas.font=item.Font;
53751
+ else this.Canvas.font=complexText.Font;
53752
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
53753
+ var itemHeight=this.Canvas.measureText("擎").width;
53754
+ if (item.Margin)
53755
+ {
53756
+ var margin=item.Margin;
53757
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
53758
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
53759
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
53760
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
53761
+ }
53762
+
53763
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
53764
+
53765
+ if (textWidth<itemWidth) textWidth=itemWidth;
53766
+ textHeight+=itemHeight;
53767
+ }
53768
+
53769
+ size.Width=textWidth;
53770
+ size.Height=textHeight;
53771
+ }
53772
+ else //水平 单行
53773
+ {
53774
+ var textWidth=0, textHeight=0;
53775
+ for(var i=0; i<complexText.Text.length; ++i)
53776
+ {
53777
+ var item=complexText.Text[i];
53778
+ if (item.Font) this.Canvas.font=item.Font;
53779
+ else this.Canvas.font=complexText.Font;
53780
+
53781
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
53782
+ var itemHeight=this.Canvas.measureText("擎").width;
53783
+ if (item.Margin)
53784
+ {
53785
+ var margin=item.Margin;
53786
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
53787
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
53788
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
53789
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
53790
+ }
53698
53791
 
53699
- if (i>0 && IFrameSplitOperator.IsNumber(complexText.Space))
53700
- xText+=complexText.Space;
53792
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
53793
+
53794
+ textWidth+=itemWidth;
53795
+ if (textHeight<itemHeight) textHeight=itemHeight;
53796
+ }
53701
53797
 
53702
- xText+=itemWidth;
53798
+ size.Width=textWidth;
53799
+ size.Height=textHeight;
53703
53800
  }
53704
53801
  }
53705
53802
 
@@ -65506,7 +65603,7 @@ function ChartDrawMonitorLine()
65506
65603
  if (item.LineDash) dest.LineDash=item.LineDash;
65507
65604
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
65508
65605
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
65509
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
65606
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
65510
65607
  }
65511
65608
 
65512
65609
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -69507,7 +69604,7 @@ function ChartInfoLine()
69507
69604
  if (item.BGColor) dest.BGColor=item.BGColor;
69508
69605
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
69509
69606
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
69510
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
69607
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
69511
69608
  }
69512
69609
 
69513
69610
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -70167,7 +70264,9 @@ function JSChartResource()
70167
70264
  BGColor:'rgb(43,54,69)',
70168
70265
  PenColor:'rgb(255,255,255)',
70169
70266
  Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
70170
- }
70267
+ },
70268
+
70269
+ RightMargin: { Left:2, Right:2, Top:5, Bottom:3 }
70171
70270
  };
70172
70271
 
70173
70272
  this.LockBGColor = "rgb(220, 220, 220)"; //指标锁区域颜色
@@ -125376,6 +125475,7 @@ function JSReportChartContainer(uielement)
125376
125475
  this.IsDestroy=false; //是否已经销毁了
125377
125476
 
125378
125477
  this.JSPopMenu; //内置菜单
125478
+ this.IsShowRightMenu=true;
125379
125479
 
125380
125480
  this.ChartDestory=function() //销毁
125381
125481
  {
@@ -126599,6 +126699,18 @@ function JSReportChartContainer(uielement)
126599
126699
 
126600
126700
  //去掉右键菜单
126601
126701
  this.UIOnContextMenu=function(e)
126702
+ {
126703
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
126704
+
126705
+ if (!this.IsShowRightMenu) return;
126706
+
126707
+ var x = e.clientX-this.UIElement.getBoundingClientRect().left;
126708
+ var y = e.clientY-this.UIElement.getBoundingClientRect().top;
126709
+
126710
+ if(typeof(this.OnRightMenu)=='function') this.OnRightMenu(x,y,e); //右键菜单事件
126711
+ }
126712
+
126713
+ this.OnRightMenu=function(x,y,e)
126602
126714
  {
126603
126715
  e.preventDefault();
126604
126716
  }
@@ -128772,6 +128884,14 @@ function ChartReport()
128772
128884
  return null;
128773
128885
  }
128774
128886
 
128887
+ this.ClipClient=function()
128888
+ {
128889
+ this.Canvas.save();
128890
+ this.Canvas.beginPath();
128891
+ this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
128892
+ //this.Canvas.stroke(); //调试用
128893
+ this.Canvas.clip();
128894
+ }
128775
128895
 
128776
128896
  this.Draw=function()
128777
128897
  {
@@ -128783,12 +128903,7 @@ function ChartReport()
128783
128903
  if (this.SizeChange) this.CalculateSize();
128784
128904
  else this.UpdateCacheData();
128785
128905
 
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();
128906
+ this.ClipClient();
128792
128907
 
128793
128908
  this.DrawHeader();
128794
128909
  this.DrawBody();
@@ -128801,7 +128916,9 @@ function ChartReport()
128801
128916
  this.Tab.DrawScrollbar(this.RectClient.Left,bottom-this.BottomToolbarHeight, this.RectClient.Right, bottom);
128802
128917
  }
128803
128918
 
128919
+ this.ClipClient();
128804
128920
  this.DrawBorder();
128921
+ this.Canvas.restore();
128805
128922
 
128806
128923
  this.DrawDragRow();
128807
128924
 
@@ -134526,7 +134643,7 @@ function ScrollBarBGChart()
134526
134643
 
134527
134644
 
134528
134645
 
134529
- var HQCHART_VERSION="1.1.13496";
134646
+ var HQCHART_VERSION="1.1.13512";
134530
134647
 
134531
134648
  function PrintHQChartVersion()
134532
134649
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13496";
8
+ var HQCHART_VERSION="1.1.13512";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {