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.
@@ -9865,7 +9865,7 @@ function IsRecvOverlap(rect1, rect2)
9865
9865
  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);
9866
9866
  }
9867
9867
 
9868
- function CopyMerginConfig(dest,src)
9868
+ function CopyMarginConfig(dest,src)
9869
9869
  {
9870
9870
  if (!src || !dest) return;
9871
9871
 
@@ -9875,6 +9875,9 @@ function CopyMerginConfig(dest,src)
9875
9875
  if (IFrameSplitOperator.IsNumber(src.Bottom)) dest.Bottom=src.Bottom;
9876
9876
  }
9877
9877
 
9878
+ //兼容老版本
9879
+ function CopyMerginConfig(dest,src) { CopyMarginConfig(dest,src); }
9880
+
9878
9881
 
9879
9882
  function Point()
9880
9883
  {
@@ -49112,6 +49115,9 @@ function ChartCorssCursor()
49112
49115
  Icon:g_JSChartResource.CorssCursor.RightButton.Icon
49113
49116
  };
49114
49117
 
49118
+ this.RightMargin={ Left:2, Right:2, Top:4, Bottom:3 };
49119
+ CopyMarginConfig(this.RightMargin, g_JSChartResource.CorssCursor.RightMargin);
49120
+
49115
49121
  //内部使用
49116
49122
  this.Close=null; //收盘价格
49117
49123
  this.Status=0; //当前状态 0=隐藏 1=显示
@@ -49479,6 +49485,7 @@ function ChartCorssCursor()
49479
49485
  var text=this.StringFormatY.Text;
49480
49486
  this.Canvas.font=this.Font;
49481
49487
  var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
49488
+ var textSize={ Width:textWidth, Height:this.TextHeight, Text:[] };
49482
49489
  var buttonData={Y:y, YValue:yValue, FrameID:yValueExtend.FrameID };
49483
49490
  if (this.Frame.ChartBorder.Left>=30 && this.ShowTextMode.Left==1)
49484
49491
  {
@@ -49508,38 +49515,37 @@ function ChartCorssCursor()
49508
49515
  this.Canvas.fillText(text,left+2,y,textWidth);
49509
49516
  }
49510
49517
 
49518
+ var complexText=
49519
+ {
49520
+ ShowType:0, //0=单行(默认) 1=多行
49521
+ Font:this.Font, Color:this.TextColor,
49522
+ Text:[ { Text:text, Margin:this.RightMargin } ],
49523
+ };
49524
+
49525
+ var yTop=y-this.TextHeight/2;
49526
+
49511
49527
  if (this.StringFormatY.PercentageText)
49512
49528
  {
49513
49529
  if (this.TextFormat.Right==0)
49514
49530
  {
49515
49531
  text=this.StringFormatY.PercentageText+'%';
49516
- textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
49532
+ complexText.Text[0].Text=text;
49517
49533
  }
49518
49534
  }
49519
49535
 
49520
49536
  if (this.StringFormatY.RText)
49521
49537
  {
49522
49538
  text=this.StringFormatY.RText;
49523
- var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
49539
+ complexText.Text[0].Text=text;
49524
49540
  }
49525
49541
 
49526
- var complexText=null;
49527
49542
  if (this.StringFormatY.RComplexText && IFrameSplitOperator.IsNonEmptyArray(this.StringFormatY.RComplexText.Text))
49528
49543
  {
49529
- var textWidth=0;
49530
49544
  complexText=this.StringFormatY.RComplexText;
49531
- for(var i=0; i<complexText.Text.length; ++i)
49532
- {
49533
- var item=complexText.Text[i];
49534
- var itemWidth=this.Canvas.measureText(item.Text).width+4; //前后各空2个像素
49535
-
49536
- if (i>0 && IFrameSplitOperator.IsNumber(complexText.Space))
49537
- textWidth+=complexText.Space;
49538
-
49539
- textWidth+=itemWidth;
49540
- }
49541
49545
  }
49542
49546
 
49547
+ this.CalculateComplexTextSize(complexText, textSize);
49548
+
49543
49549
  if (this.Frame.ChartBorder.Right>=30 && this.ShowTextMode.Right==1)
49544
49550
  {
49545
49551
  var isOverlayIndex=false; //是否有叠加子坐标
@@ -49548,66 +49554,52 @@ function ChartCorssCursor()
49548
49554
  {
49549
49555
  var frame=this.Frame.SubFrame[yValueExtend.FrameID];
49550
49556
  isOverlayIndex=frame.OverlayIndex.length>0;
49551
- overlayIndexInterval=frame.Interval;
49557
+ overlayIndexInterval=null
49558
+ if (isOverlayIndex)
49559
+ {
49560
+ for(var i=0;i<=frame.OverlayIndex.length;++i)
49561
+ {
49562
+ var item=frame.OverlayIndex[i];
49563
+ if (item.Frame.IsShow===false) continue;
49564
+ if (!item.Frame.GetXHorizontal) continue;
49565
+
49566
+ var overlayLeft=item.Frame.GetXHorizontal();
49567
+ overlayIndexInterval=overlayLeft-right;
49568
+ break;
49569
+ }
49570
+ }
49552
49571
  }
49553
49572
 
49554
- if (isOverlayIndex && textWidth>overlayIndexInterval) //大于子坐标宽度
49573
+ //叠加坐标
49574
+ if (isOverlayIndex && textSize.Width>overlayIndexInterval && overlayIndexInterval>0) //大于子坐标宽度
49555
49575
  {
49556
49576
  var drawRight=right+overlayIndexInterval;
49557
49577
  if (drawRight>chartRight) drawRight=chartRight;
49558
49578
 
49559
- var itemLeft=drawRight-2-textWidth;
49560
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
49561
- if (complexText)
49562
- {
49563
- this.DrawComplexText(itemLeft,y,complexText);
49564
- }
49565
- else
49566
- {
49567
- this.Canvas.textAlign="right";
49568
- this.Canvas.textBaseline="middle";
49569
- this.Canvas.fillStyle=this.TextColor;
49570
- this.Canvas.fillText(text,drawRight-4,y,textWidth);
49571
- }
49579
+ var itemLeft=drawRight-2-textSize.Width;
49580
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
49581
+ this.DrawComplexTextV2(itemLeft, yTop, complexText, textSize);
49582
+
49583
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, itemLeft,this.TextHeight,this.TextHeight,buttonData);
49572
49584
  }
49573
- else if (rightWidth<textWidth) //右边空白显示不下,
49585
+ else if (rightWidth<textSize.Width) //右边空白显示不下,
49574
49586
  {
49575
- var itemLeft=chartRight-2-textWidth;
49576
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
49577
- if (complexText)
49578
- {
49579
- this.DrawComplexText(itemLeft,y,complexText);
49580
- }
49581
- else
49582
- {
49583
- this.Canvas.textAlign="right";
49584
- this.Canvas.textBaseline="middle";
49585
- this.Canvas.fillStyle=this.TextColor;
49586
- this.Canvas.fillText(text,chartRight-4,y,textWidth);
49587
- }
49588
-
49589
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, chartRight-2-textWidth,this.TextHeight,this.TextHeight,buttonData);
49587
+ var itemLeft=chartRight-2-textSize.Width;
49588
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
49589
+ this.DrawComplexTextV2(itemLeft, yTop ,complexText, textSize);
49590
+
49591
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, chartRight-2-textSize.Width,this.TextHeight,this.TextHeight,buttonData);
49590
49592
  }
49591
49593
  else
49592
49594
  {
49593
49595
  var itemLeft=right+2;
49594
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
49595
-
49596
- if (complexText)
49597
- {
49598
- this.DrawComplexText(itemLeft,y,complexText);
49599
- }
49600
- else
49601
- {
49602
- this.Canvas.textAlign="left";
49603
- this.Canvas.textBaseline="middle";
49604
- this.Canvas.fillStyle=this.TextColor;
49605
- this.Canvas.fillText(text,right+4,y,textWidth);
49606
- }
49596
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
49597
+ this.DrawComplexTextV2(itemLeft,yTop,complexText,textSize);
49607
49598
 
49608
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, right+2,this.TextHeight,this.TextHeight,buttonData);
49599
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, right+2,this.TextHeight,this.TextHeight,buttonData);
49609
49600
  }
49610
49601
 
49602
+ /*
49611
49603
  if (this.StringFormatY.RExtendText && this.StringFormatY.RExtendText.length>0)
49612
49604
  {
49613
49605
  var yOffset=0;
@@ -49639,26 +49631,16 @@ function ChartCorssCursor()
49639
49631
  yOffset+=this.TextHeight;
49640
49632
  }
49641
49633
  }
49634
+ */
49642
49635
  }
49643
49636
  else if (this.ShowTextMode.Right==2)
49644
49637
  {
49645
49638
  this.Canvas.fillStyle=this.TextBGColor;
49646
- var showLeft=right-textWidth;
49647
- this.DrawTextBGRect(showLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
49648
-
49649
- if (complexText)
49650
- {
49651
- this.DrawComplexText(showLeft,y,complexText);
49652
- }
49653
- else
49654
- {
49655
- this.Canvas.textAlign="left";
49656
- this.Canvas.textBaseline="middle";
49657
- this.Canvas.fillStyle=this.TextColor;
49658
- this.Canvas.fillText(text,showLeft+2,y,textWidth);
49659
- }
49639
+ var showLeft=right-textSize.Width;
49640
+ this.DrawTextBGRect(showLeft,yTop,textSize.Width,textSize.Height);
49641
+ this.DrawComplexTextV2(showLeft,yTop,complexText,textSize);
49660
49642
 
49661
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, showLeft,this.TextHeight,this.TextHeight,buttonData);
49643
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, showLeft,this.TextHeight,this.TextHeight,buttonData);
49662
49644
  }
49663
49645
  }
49664
49646
 
@@ -49778,6 +49760,137 @@ function ChartCorssCursor()
49778
49760
  }
49779
49761
  }
49780
49762
 
49763
+ this.DrawComplexTextV2=function(left, yTop, complexText, size)
49764
+ {
49765
+ this.Canvas.textAlign="left";
49766
+ this.Canvas.textBaseline="bottom";
49767
+ var showType=0;
49768
+ if (complexText.ShowType==1) showType=complexText.ShowType;
49769
+ if (showType==1) //多行
49770
+ {
49771
+ var xLeft=left;
49772
+ var yText=yTop; //顶
49773
+ for(var i=0; i<complexText.Text.length; ++i)
49774
+ {
49775
+ var item=complexText.Text[i];
49776
+ var itemSize=size.Text[i];
49777
+
49778
+ if (item.Font) this.Canvas.font=item.Font;
49779
+ else this.Canvas.font=complexText.Font;
49780
+
49781
+ if (item.Color) this.Canvas.fillStyle=item.Color;
49782
+ else this.Canvas.fillStyle=complexText.Color;
49783
+
49784
+ var y=yText+itemSize.Height;
49785
+ var x=xLeft;
49786
+ if (item.Margin)
49787
+ {
49788
+ var margin=item.Margin;
49789
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
49790
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
49791
+ }
49792
+
49793
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
49794
+
49795
+ yText+=itemSize.Height;
49796
+ }
49797
+ }
49798
+ else //水平 单行
49799
+ {
49800
+ var xText=left;
49801
+ var yBottom=yTop+size.Height;
49802
+ for(var i=0; i<complexText.Text.length; ++i)
49803
+ {
49804
+ var item=complexText.Text[i];
49805
+ var itemSize=size.Text[i];
49806
+
49807
+ if (item.Font) this.Canvas.font=item.Font;
49808
+ else this.Canvas.font=complexText.Font;
49809
+
49810
+ if (item.Color) this.Canvas.fillStyle=item.Color;
49811
+ else this.Canvas.fillStyle=complexText.Color;
49812
+
49813
+ var y=yBottom;
49814
+ var x=xText;
49815
+ if (item.Margin)
49816
+ {
49817
+ var margin=item.Margin;
49818
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
49819
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
49820
+ }
49821
+
49822
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
49823
+
49824
+ xText+=itemSize.Width;
49825
+ }
49826
+ }
49827
+ }
49828
+
49829
+ this.CalculateComplexTextSize=function(complexText, size)
49830
+ {
49831
+ if (!complexText || !IFrameSplitOperator.IsNonEmptyArray(complexText.Text)) return;
49832
+
49833
+ var showType=0;
49834
+ if (complexText.ShowType==1) showType=complexText.ShowType;
49835
+ if (showType==1) //多行
49836
+ {
49837
+ var textWidth=0, textHeight=0;
49838
+ for(var i=0; i<complexText.Text.length; ++i)
49839
+ {
49840
+ var item=complexText.Text[i];
49841
+ if (item.Font) this.Canvas.font=item.Font;
49842
+ else this.Canvas.font=complexText.Font;
49843
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
49844
+ var itemHeight=this.Canvas.measureText("擎").width;
49845
+ if (item.Margin)
49846
+ {
49847
+ var margin=item.Margin;
49848
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
49849
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
49850
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
49851
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
49852
+ }
49853
+
49854
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
49855
+
49856
+ if (textWidth<itemWidth) textWidth=itemWidth;
49857
+ textHeight+=itemHeight;
49858
+ }
49859
+
49860
+ size.Width=textWidth;
49861
+ size.Height=textHeight;
49862
+ }
49863
+ else //水平 单行
49864
+ {
49865
+ var textWidth=0, textHeight=0;
49866
+ for(var i=0; i<complexText.Text.length; ++i)
49867
+ {
49868
+ var item=complexText.Text[i];
49869
+ if (item.Font) this.Canvas.font=item.Font;
49870
+ else this.Canvas.font=complexText.Font;
49871
+
49872
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
49873
+ var itemHeight=this.Canvas.measureText("擎").width;
49874
+ if (item.Margin)
49875
+ {
49876
+ var margin=item.Margin;
49877
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
49878
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
49879
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
49880
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
49881
+ }
49882
+
49883
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
49884
+
49885
+ textWidth+=itemWidth;
49886
+ if (textHeight<itemHeight) textHeight=itemHeight;
49887
+ }
49888
+
49889
+ size.Width=textWidth;
49890
+ size.Height=textHeight;
49891
+ }
49892
+ }
49893
+
49781
49894
  this.DrawRightButton=function(drawTop, drawRight, drawWidth, drawHeight, data)
49782
49895
  {
49783
49896
  this.Canvas.fillStyle=this.RightButton.BGColor;
@@ -61581,7 +61694,7 @@ function ChartDrawMonitorLine()
61581
61694
  if (item.LineDash) dest.LineDash=item.LineDash;
61582
61695
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
61583
61696
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
61584
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
61697
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
61585
61698
  }
61586
61699
 
61587
61700
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -65582,7 +65695,7 @@ function ChartInfoLine()
65582
65695
  if (item.BGColor) dest.BGColor=item.BGColor;
65583
65696
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
65584
65697
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
65585
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
65698
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
65586
65699
  }
65587
65700
 
65588
65701
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -66242,7 +66355,9 @@ function JSChartResource()
66242
66355
  BGColor:'rgb(43,54,69)',
66243
66356
  PenColor:'rgb(255,255,255)',
66244
66357
  Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
66245
- }
66358
+ },
66359
+
66360
+ RightMargin: { Left:2, Right:2, Top:5, Bottom:3 }
66246
66361
  };
66247
66362
 
66248
66363
  this.LockBGColor = "rgb(220, 220, 220)"; //指标锁区域颜色
@@ -346,6 +346,7 @@ function JSReportChartContainer(uielement)
346
346
  this.IsDestroy=false; //是否已经销毁了
347
347
 
348
348
  this.JSPopMenu; //内置菜单
349
+ this.IsShowRightMenu=true;
349
350
 
350
351
  this.ChartDestory=function() //销毁
351
352
  {
@@ -1569,6 +1570,18 @@ function JSReportChartContainer(uielement)
1569
1570
 
1570
1571
  //去掉右键菜单
1571
1572
  this.UIOnContextMenu=function(e)
1573
+ {
1574
+ if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
1575
+
1576
+ if (!this.IsShowRightMenu) return;
1577
+
1578
+ var x = e.clientX-this.UIElement.getBoundingClientRect().left;
1579
+ var y = e.clientY-this.UIElement.getBoundingClientRect().top;
1580
+
1581
+ if(typeof(this.OnRightMenu)=='function') this.OnRightMenu(x,y,e); //右键菜单事件
1582
+ }
1583
+
1584
+ this.OnRightMenu=function(x,y,e)
1572
1585
  {
1573
1586
  e.preventDefault();
1574
1587
  }
@@ -3742,6 +3755,14 @@ function ChartReport()
3742
3755
  return null;
3743
3756
  }
3744
3757
 
3758
+ this.ClipClient=function()
3759
+ {
3760
+ this.Canvas.save();
3761
+ this.Canvas.beginPath();
3762
+ this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
3763
+ //this.Canvas.stroke(); //调试用
3764
+ this.Canvas.clip();
3765
+ }
3745
3766
 
3746
3767
  this.Draw=function()
3747
3768
  {
@@ -3753,12 +3774,7 @@ function ChartReport()
3753
3774
  if (this.SizeChange) this.CalculateSize();
3754
3775
  else this.UpdateCacheData();
3755
3776
 
3756
- this.Canvas.save();
3757
-
3758
- this.Canvas.beginPath();
3759
- this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,(this.RectClient.Right-this.RectClient.Left),(this.RectClient.Bottom-this.RectClient.Top));
3760
- //this.Canvas.stroke(); //调试用
3761
- this.Canvas.clip();
3777
+ this.ClipClient();
3762
3778
 
3763
3779
  this.DrawHeader();
3764
3780
  this.DrawBody();
@@ -3771,7 +3787,9 @@ function ChartReport()
3771
3787
  this.Tab.DrawScrollbar(this.RectClient.Left,bottom-this.BottomToolbarHeight, this.RectClient.Right, bottom);
3772
3788
  }
3773
3789
 
3790
+ this.ClipClient();
3774
3791
  this.DrawBorder();
3792
+ this.Canvas.restore();
3775
3793
 
3776
3794
  this.DrawDragRow();
3777
3795