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.
@@ -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,37 +49515,40 @@ 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
- }
49545
+ if (!complexText.Font) complexText.Font=this.Font;
49546
+ if (!complexText.Color) complexText.Color=this.TextColor;
49541
49547
  }
49548
+
49549
+
49550
+
49551
+ this.CalculateComplexTextSize(complexText, textSize);
49542
49552
 
49543
49553
  if (this.Frame.ChartBorder.Right>=30 && this.ShowTextMode.Right==1)
49544
49554
  {
@@ -49548,66 +49558,52 @@ function ChartCorssCursor()
49548
49558
  {
49549
49559
  var frame=this.Frame.SubFrame[yValueExtend.FrameID];
49550
49560
  isOverlayIndex=frame.OverlayIndex.length>0;
49551
- overlayIndexInterval=frame.Interval;
49561
+ overlayIndexInterval=null
49562
+ if (isOverlayIndex)
49563
+ {
49564
+ for(var i=0;i<=frame.OverlayIndex.length;++i)
49565
+ {
49566
+ var item=frame.OverlayIndex[i];
49567
+ if (item.Frame.IsShow===false) continue;
49568
+ if (!item.Frame.GetXHorizontal) continue;
49569
+
49570
+ var overlayLeft=item.Frame.GetXHorizontal();
49571
+ overlayIndexInterval=overlayLeft-right;
49572
+ break;
49573
+ }
49574
+ }
49552
49575
  }
49553
49576
 
49554
- if (isOverlayIndex && textWidth>overlayIndexInterval) //大于子坐标宽度
49577
+ //叠加坐标
49578
+ if (isOverlayIndex && textSize.Width>overlayIndexInterval && overlayIndexInterval>0) //大于子坐标宽度
49555
49579
  {
49556
49580
  var drawRight=right+overlayIndexInterval;
49557
49581
  if (drawRight>chartRight) drawRight=chartRight;
49558
49582
 
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
- }
49583
+ var itemLeft=drawRight-2-textSize.Width;
49584
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
49585
+ this.DrawComplexTextV2(itemLeft, yTop, complexText, textSize);
49586
+
49587
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, itemLeft,this.TextHeight,this.TextHeight,buttonData);
49572
49588
  }
49573
- else if (rightWidth<textWidth) //右边空白显示不下,
49589
+ else if (rightWidth<textSize.Width) //右边空白显示不下,
49574
49590
  {
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);
49591
+ var itemLeft=chartRight-2-textSize.Width;
49592
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
49593
+ this.DrawComplexTextV2(itemLeft, yTop ,complexText, textSize);
49594
+
49595
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, chartRight-2-textSize.Width,this.TextHeight,this.TextHeight,buttonData);
49590
49596
  }
49591
49597
  else
49592
49598
  {
49593
49599
  var itemLeft=right+2;
49594
- this.DrawTextBGRect(itemLeft,y-this.TextHeight/2,textWidth,this.TextHeight);
49600
+ this.DrawTextBGRect(itemLeft,yTop,textSize.Width,textSize.Height);
49601
+ this.DrawComplexTextV2(itemLeft,yTop,complexText,textSize);
49595
49602
 
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
- }
49607
-
49608
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, right+2,this.TextHeight,this.TextHeight,buttonData);
49603
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, right+2,this.TextHeight,this.TextHeight,buttonData);
49609
49604
  }
49610
49605
 
49606
+ /*
49611
49607
  if (this.StringFormatY.RExtendText && this.StringFormatY.RExtendText.length>0)
49612
49608
  {
49613
49609
  var yOffset=0;
@@ -49639,26 +49635,16 @@ function ChartCorssCursor()
49639
49635
  yOffset+=this.TextHeight;
49640
49636
  }
49641
49637
  }
49638
+ */
49642
49639
  }
49643
49640
  else if (this.ShowTextMode.Right==2)
49644
49641
  {
49645
49642
  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
- }
49643
+ var showLeft=right-textSize.Width;
49644
+ this.DrawTextBGRect(showLeft,yTop,textSize.Width,textSize.Height);
49645
+ this.DrawComplexTextV2(showLeft,yTop,complexText,textSize);
49660
49646
 
49661
- if (this.RightButton.Enable) this.DrawRightButton(y-this.TextHeight/2, showLeft,this.TextHeight,this.TextHeight,buttonData);
49647
+ if (this.RightButton.Enable) this.DrawRightButton(yTop, showLeft,this.TextHeight,this.TextHeight,buttonData);
49662
49648
  }
49663
49649
  }
49664
49650
 
@@ -49758,23 +49744,134 @@ function ChartCorssCursor()
49758
49744
  this.Status=1;
49759
49745
  }
49760
49746
 
49761
- this.DrawComplexText=function(left, y, complexText)
49747
+ this.DrawComplexTextV2=function(left, yTop, complexText, size)
49762
49748
  {
49763
49749
  this.Canvas.textAlign="left";
49764
- this.Canvas.textBaseline="middle";
49765
- var xText=left+2;
49766
- for(var i=0; i<complexText.Text.length; ++i)
49750
+ this.Canvas.textBaseline="bottom";
49751
+ var showType=0;
49752
+ if (complexText.ShowType==1) showType=complexText.ShowType;
49753
+ if (showType==1) //多行
49767
49754
  {
49768
- var item=complexText.Text[i];
49769
- var itemWidth=this.Canvas.measureText(item.Text).width+4; //前后各空2个像素
49770
- if (item.Color) this.Canvas.fillStyle=item.Color;
49771
- else is.Canvas.fillStyle=this.TextColor;
49772
- this.Canvas.fillText(item.Text,xText,y,itemWidth);
49755
+ var xLeft=left;
49756
+ var yText=yTop; //顶
49757
+ for(var i=0; i<complexText.Text.length; ++i)
49758
+ {
49759
+ var item=complexText.Text[i];
49760
+ var itemSize=size.Text[i];
49761
+
49762
+ if (item.Font) this.Canvas.font=item.Font;
49763
+ else this.Canvas.font=complexText.Font;
49764
+
49765
+ if (item.Color) this.Canvas.fillStyle=item.Color;
49766
+ else this.Canvas.fillStyle=complexText.Color;
49767
+
49768
+ var y=yText+itemSize.Height;
49769
+ var x=xLeft;
49770
+ if (item.Margin)
49771
+ {
49772
+ var margin=item.Margin;
49773
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
49774
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
49775
+ }
49776
+
49777
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
49778
+
49779
+ yText+=itemSize.Height;
49780
+ }
49781
+ }
49782
+ else //水平 单行
49783
+ {
49784
+ var xText=left;
49785
+ var yBottom=yTop+size.Height;
49786
+ for(var i=0; i<complexText.Text.length; ++i)
49787
+ {
49788
+ var item=complexText.Text[i];
49789
+ var itemSize=size.Text[i];
49790
+
49791
+ if (item.Font) this.Canvas.font=item.Font;
49792
+ else this.Canvas.font=complexText.Font;
49793
+
49794
+ if (item.Color) this.Canvas.fillStyle=item.Color;
49795
+ else this.Canvas.fillStyle=complexText.Color;
49773
49796
 
49774
- if (i>0 && IFrameSplitOperator.IsNumber(complexText.Space))
49775
- xText+=complexText.Space;
49797
+ var y=yBottom;
49798
+ var x=xText;
49799
+ if (item.Margin)
49800
+ {
49801
+ var margin=item.Margin;
49802
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) y-=margin.Bottom;
49803
+ if (IFrameSplitOperator.IsNumber(margin.Left)) x+=margin.Left;
49804
+ }
49776
49805
 
49777
- xText+=itemWidth;
49806
+ this.Canvas.fillText(item.Text,x,y,itemSize.Width);
49807
+
49808
+ xText+=itemSize.Width;
49809
+ }
49810
+ }
49811
+ }
49812
+
49813
+ this.CalculateComplexTextSize=function(complexText, size)
49814
+ {
49815
+ if (!complexText || !IFrameSplitOperator.IsNonEmptyArray(complexText.Text)) return;
49816
+
49817
+ var showType=0;
49818
+ if (complexText.ShowType==1) showType=complexText.ShowType;
49819
+ if (showType==1) //多行
49820
+ {
49821
+ var textWidth=0, textHeight=0;
49822
+ for(var i=0; i<complexText.Text.length; ++i)
49823
+ {
49824
+ var item=complexText.Text[i];
49825
+ if (item.Font) this.Canvas.font=item.Font;
49826
+ else this.Canvas.font=complexText.Font;
49827
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
49828
+ var itemHeight=this.Canvas.measureText("擎").width;
49829
+ if (item.Margin)
49830
+ {
49831
+ var margin=item.Margin;
49832
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
49833
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
49834
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
49835
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
49836
+ }
49837
+
49838
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
49839
+
49840
+ if (textWidth<itemWidth) textWidth=itemWidth;
49841
+ textHeight+=itemHeight;
49842
+ }
49843
+
49844
+ size.Width=textWidth;
49845
+ size.Height=textHeight;
49846
+ }
49847
+ else //水平 单行
49848
+ {
49849
+ var textWidth=0, textHeight=0;
49850
+ for(var i=0; i<complexText.Text.length; ++i)
49851
+ {
49852
+ var item=complexText.Text[i];
49853
+ if (item.Font) this.Canvas.font=item.Font;
49854
+ else this.Canvas.font=complexText.Font;
49855
+
49856
+ var itemWidth=this.Canvas.measureText(item.Text).width; //前后各空2个像素
49857
+ var itemHeight=this.Canvas.measureText("擎").width;
49858
+ if (item.Margin)
49859
+ {
49860
+ var margin=item.Margin;
49861
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
49862
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
49863
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
49864
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
49865
+ }
49866
+
49867
+ size.Text[i]={ Width:itemWidth, Height:itemHeight }; //保存所有文字的大小信息
49868
+
49869
+ textWidth+=itemWidth;
49870
+ if (textHeight<itemHeight) textHeight=itemHeight;
49871
+ }
49872
+
49873
+ size.Width=textWidth;
49874
+ size.Height=textHeight;
49778
49875
  }
49779
49876
  }
49780
49877
 
@@ -61581,7 +61678,7 @@ function ChartDrawMonitorLine()
61581
61678
  if (item.LineDash) dest.LineDash=item.LineDash;
61582
61679
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
61583
61680
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
61584
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
61681
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
61585
61682
  }
61586
61683
 
61587
61684
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -65582,7 +65679,7 @@ function ChartInfoLine()
65582
65679
  if (item.BGColor) dest.BGColor=item.BGColor;
65583
65680
  if (IFrameSplitOperator.IsNumber(item.LineSpace)) dest.LineSpace=item.LineSpace;
65584
65681
  if (IFrameSplitOperator.IsNumber(item.TextAlign)) dest.TextAlign=item.TextAlign;
65585
- if (item.Mergin) CopyMerginConfig(dest.Mergin, item.Mergin);
65682
+ if (item.Mergin) CopyMarginConfig(dest.Mergin, item.Mergin);
65586
65683
  }
65587
65684
 
65588
65685
  if (option.FormatLabelTextCallback) this.FormatLabelTextCallback=option.FormatLabelTextCallback;
@@ -66242,7 +66339,9 @@ function JSChartResource()
66242
66339
  BGColor:'rgb(43,54,69)',
66243
66340
  PenColor:'rgb(255,255,255)',
66244
66341
  Icon: { Text:'\ue6a3', Color:'rgb(255,255,255)', Family:"iconfont", Size:18 }
66245
- }
66342
+ },
66343
+
66344
+ RightMargin: { Left:2, Right:2, Top:5, Bottom:3 }
66246
66345
  };
66247
66346
 
66248
66347
  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