hqchart 1.1.12685 → 1.1.12693

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.
@@ -633,7 +633,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
633
633
  }
634
634
 
635
635
  //叠加指标宽度
636
- if (option.OverlayIndexFrameWidth>40) chart.OverlayIndexFrameWidth=option.OverlayIndexFrameWidth;
636
+ if (option.OverlayIndexFrameWidth>40) chart.Frame.FixedRightWidth.Overlay=option.OverlayIndexFrameWidth;
637
637
 
638
638
  //叠加指标
639
639
  if (IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex))
@@ -2517,7 +2517,9 @@ var JSCHART_EVENT_ID=
2517
2517
  ON_CUSTOM_DRAG_DOC_MOUSE_UP:115,
2518
2518
  ON_CUSTOM_DRAG_MOUSE_MOVE:116,
2519
2519
 
2520
- ON_KEYDOWN:117
2520
+ ON_KEYDOWN:117,
2521
+
2522
+ ON_CREATE_OVERLAY_FRAME:118, //创建叠加框架回调
2521
2523
  }
2522
2524
 
2523
2525
  var JSCHART_OPERATOR_ID=
@@ -4630,6 +4632,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4630
4632
  this.UpdatePointByCursorIndex();
4631
4633
  this.UpdataDataoffset();
4632
4634
  this.UpdateFrameMaxMin();
4635
+ //this.ResetFrameXSplit();
4633
4636
  this.Draw();
4634
4637
  this.ShowTooltipByKeyDown();
4635
4638
  this.StopDragTimer();
@@ -4644,6 +4647,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4644
4647
  this.UpdataDataoffset();
4645
4648
  this.UpdatePointByCursorIndex();
4646
4649
  this.UpdateFrameMaxMin();
4650
+ //this.ResetFrameXSplit();
4647
4651
  this.Draw();
4648
4652
  this.ShowTooltipByKeyDown();
4649
4653
  this.StopDragTimer();
@@ -6790,6 +6794,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6790
6794
  frame.HorizontalMax=max;
6791
6795
  frame.HorizontalMin=min;
6792
6796
  }
6797
+ else
6798
+ {
6799
+ frame.XSplit=true;
6800
+ }
6793
6801
 
6794
6802
  //共享Y轴叠加指标同步下坐标
6795
6803
  for(var j=0;j<item.OverlayFrame.length;++j)
@@ -8352,7 +8360,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8352
8360
  else
8353
8361
  {
8354
8362
  var subFrame=this.Frame.SubFrame[dest.WindowIndex];
8355
- subFrame.Interval=this.OverlayIndexFrameWidth;
8356
8363
  var overlayFrame=new OverlayIndexItem();
8357
8364
  var frame=this.CreateOverlayFrame();
8358
8365
  frame.Canvas=this.Canvas;
@@ -8369,6 +8376,15 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8369
8376
  frame.YSplitOperator.GetEventCallback=(id)=> { return this.GetEventCallback(id); };
8370
8377
 
8371
8378
  overlayFrame.Frame=frame;
8379
+
8380
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_OVERLAY_FRAME);
8381
+ if (event && event.Callback)
8382
+ {
8383
+ var sendData={ OverlayFrame:overlayFrame, WindowIndex:dest.WindowIndex, SubFrame:subFrame };
8384
+ event.Callback(event, sendData, this);
8385
+ }
8386
+
8387
+
8372
8388
  var scriptIndex;
8373
8389
  if (findItem)
8374
8390
  {
@@ -8859,7 +8875,7 @@ function CoordinateInfo()
8859
8875
  this.Font=g_JSChartResource.FrameSplitTextFont; //字体
8860
8876
  this.LineColor=g_JSChartResource.FrameSplitPen; //线段颜色
8861
8877
  this.LineDash=null; //当线段类型==2时 可以设置虚线样式
8862
- this.LineType=1; //线段类型 -1 不画线段 2 虚线 8,9=集合竞价坐标
8878
+ this.LineType=1; //线段类型 -1=不画线段 2=虚线, 8,9=集合竞价坐标
8863
8879
  this.LineWidth; //线段宽度
8864
8880
  this.ExtendData; //扩展属性
8865
8881
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
@@ -9219,6 +9235,9 @@ function IChartFramePainting()
9219
9235
  this.LogoBGColor=g_JSChartResource.FrameLogo.BGColor;
9220
9236
  this.GlobalOption;
9221
9237
 
9238
+ //this.IsDrawLeftBorder;
9239
+ this.IsDrawRightBorder=false; //是否绘制右侧刻度空白的边框
9240
+
9222
9241
  this.PtInButtons=function(x,y) //坐标是否在按钮上
9223
9242
  {
9224
9243
  for(var i=0;i<this.Buttons.length;++i)
@@ -9298,8 +9317,22 @@ function IChartFramePainting()
9298
9317
  //JSConsole.Chart.Log(`[IChartFramePainting.DrawBorder] left=${left} `);
9299
9318
  if (this.BorderLine==null)
9300
9319
  {
9301
- this.Canvas.strokeStyle=this.PenBorder;
9302
- this.Canvas.strokeRect(left,top,width,height);
9320
+ if (this.IsDrawRightBorder)
9321
+ {
9322
+ var xRight=ToFixedPoint(border.ChartWidth);
9323
+ this.Canvas.strokeStyle=this.PenBorder;
9324
+ this.Canvas.strokeRect(left,top,xRight-left,height);
9325
+
9326
+ this.Canvas.beginPath();
9327
+ this.Canvas.moveTo(right,top);
9328
+ this.Canvas.lineTo(right,bottom);
9329
+ this.Canvas.stroke();
9330
+ }
9331
+ else
9332
+ {
9333
+ this.Canvas.strokeStyle=this.PenBorder;
9334
+ this.Canvas.strokeRect(left,top,width,height);
9335
+ }
9303
9336
  }
9304
9337
  else if (IFrameSplitOperator.IsPlusNumber(this.BorderLine)) //单独绘制每个边框
9305
9338
  {
@@ -9333,7 +9366,20 @@ function IChartFramePainting()
9333
9366
  this.Canvas.stroke();
9334
9367
  }
9335
9368
 
9336
-
9369
+ /*
9370
+ if (this.IsDrawRightBorder)
9371
+ {
9372
+ var xRight=ToFixedPoint(border.ChartWidth);
9373
+ var xLeft=right;
9374
+ this.Canvas.beginPath();
9375
+ this.Canvas.moveTo(xLeft,top);
9376
+ this.Canvas.lineTo(xRight,top);
9377
+ this.Canvas.lineTo(xRight,bottom);
9378
+ this.Canvas.lineTo(xLeft,bottom);
9379
+
9380
+ this.Canvas.stroke();
9381
+ }
9382
+ */
9337
9383
  }
9338
9384
 
9339
9385
  //画标题背景色
@@ -9578,6 +9624,11 @@ function AverageWidthFrame()
9578
9624
 
9579
9625
  this.ButtonTooltip=CloneData(g_JSChartResource.Buttons.Tooltip);
9580
9626
 
9627
+ //Y轴刻度长线
9628
+ this.YLineExtend; //[0]=左 [1]=右 { Width:5, Color:颜色, }
9629
+ this.YTextExtend; //[0]=左 [1]=右 { Align:0=默认 1=左对齐 2=右对齐 }
9630
+ this.YRightTextInfo;
9631
+
9581
9632
  //画图工具刻度
9582
9633
 
9583
9634
  this.DrawPicture={
@@ -9816,6 +9867,18 @@ function AverageWidthFrame()
9816
9867
  var isDrawLeft=borderLeft>10 && this.IsShowYText[0]===true && this.YTextPosition[0]!=2;
9817
9868
  var isDrawRight=borderRight>10 && this.IsShowYText[1]===true && this.YTextPosition[1]!=2;
9818
9869
 
9870
+ var rightExtendLine=null; //右侧延长线
9871
+ if (IFrameSplitOperator.IsNonEmptyArray(this.YLineExtend))
9872
+ {
9873
+ rightExtendLine=this.YLineExtend[1];
9874
+ }
9875
+
9876
+ var rightExtendText=null; //右侧文字设置
9877
+ if (IFrameSplitOperator.IsNonEmptyArray(this.YTextExtend))
9878
+ {
9879
+ rightExtendText=this.YTextExtend[1];
9880
+ }
9881
+
9819
9882
  var yPrev=null; //上一个坐标y的值
9820
9883
  var pixelRatio=GetDevicePixelRatio();
9821
9884
  var itemHeight=(border.BottomEx-border.TopEx)/this.HorizontalInfo.length;
@@ -9829,6 +9892,7 @@ function AverageWidthFrame()
9829
9892
  if (y!=null && yPrev!=null && Math.abs(y-yPrev)<this.MinYDistance) continue; //两个坐标在近了 就不画了
9830
9893
 
9831
9894
  var yFixed=ToFixedPoint(y);
9895
+ //绘制刻度线
9832
9896
  if (y!=bottom && this.IsShowYLine)
9833
9897
  {
9834
9898
  var bChangeLineWidth=false;
@@ -9905,7 +9969,7 @@ function AverageWidthFrame()
9905
9969
  textBaseline=1;
9906
9970
  }
9907
9971
 
9908
- //坐标信息 左边 间距小于10 不画坐标
9972
+ //左边 坐标信息 间距小于10 不画坐标
9909
9973
  this.Canvas.strokeStyle=item.TextColor;
9910
9974
  this.Canvas.fillStyle=item.TextColor;
9911
9975
 
@@ -9922,7 +9986,7 @@ function AverageWidthFrame()
9922
9986
  }
9923
9987
  }
9924
9988
 
9925
- //坐标信息 右边 间距小于10 不画坐标
9989
+ //右边 坐标信息 间距小于10 不画坐标
9926
9990
  if (item.Message[1]!=null && isDrawRight)
9927
9991
  {
9928
9992
  if (item.Font!=null) this.Canvas.font=item.Font;
@@ -9939,6 +10003,21 @@ function AverageWidthFrame()
9939
10003
  xText+=lineLength;
9940
10004
  }
9941
10005
 
10006
+ //右侧延长线
10007
+ if (rightExtendLine && rightExtendLine.Width>1)
10008
+ {
10009
+ var lineLength=rightExtendLine.Width;
10010
+ if (rightExtendLine.Color) this.Canvas.strokeStyle=rightExtendLine.Color;
10011
+ else this.Canvas.strokeStyle=item.LineColor;
10012
+ this.Canvas.beginPath();
10013
+ this.Canvas.moveTo(xText,yFixed);
10014
+ this.Canvas.lineTo(xText+lineLength,yFixed);
10015
+ this.Canvas.stroke();
10016
+
10017
+ xText+=lineLength+2;
10018
+ }
10019
+
10020
+
9942
10021
  this.Canvas.textAlign="left";
9943
10022
  if (Array.isArray(item.Message[1]))
9944
10023
  {
@@ -9981,7 +10060,17 @@ function AverageWidthFrame()
9981
10060
  if (!rtPreRight || (rtRight && !this.IsTextTopBottomOverlap(rtRight,rtPreRight)))
9982
10061
  {
9983
10062
  if (item.TextColor2) this.Canvas.fillStyle=item.TextColor2;
9984
- this.Canvas.fillText(item.Message[1],xText+this.YTextPadding[1],yText);
10063
+ if (rightExtendText && rightExtendText.Align && this.YRightTextInfo)
10064
+ {
10065
+ this.Canvas.textAlign="right";
10066
+ var xRight=this.YRightTextInfo.MainTextWidth+right-this.YTextPadding[1];
10067
+ this.Canvas.fillText(item.Message[1],xRight,yText);
10068
+ }
10069
+ else
10070
+ {
10071
+ this.Canvas.fillText(item.Message[1],xText+this.YTextPadding[1],yText);
10072
+ }
10073
+
9985
10074
  rtPreRight=rtRight;
9986
10075
  }
9987
10076
  }
@@ -9990,7 +10079,33 @@ function AverageWidthFrame()
9990
10079
  yPrev=y;
9991
10080
  }
9992
10081
 
9993
- if (IFrameSplitOperator.IsNonEmptyArray(aryMultiText) && this.MultiTextFormat==1) this.DrawHorizontalMuText(aryMultiText)
10082
+ if (IFrameSplitOperator.IsNonEmptyArray(aryMultiText) && this.MultiTextFormat==1) this.DrawHorizontalMuText(aryMultiText);
10083
+
10084
+ if (isDrawRight && this.IsDrawRightBorder && this.YRightTextInfo)
10085
+ {
10086
+ var xRight=this.YRightTextInfo.MainTextWidth+right;
10087
+ xLine=ToFixedPoint(xRight);
10088
+ this.Canvas.strokeStyle=this.PenBorder;
10089
+ this.Canvas.beginPath();
10090
+ this.Canvas.moveTo(xLine,top);
10091
+ this.Canvas.lineTo(xLine,bottom);
10092
+ this.Canvas.stroke();
10093
+
10094
+ if (IFrameSplitOperator.IsNonEmptyArray(this.YRightTextInfo.AryOverlayWidth))
10095
+ {
10096
+ this.Canvas.beginPath();
10097
+ for(var i=0;i<this.YRightTextInfo.AryOverlayWidth.length;++i)
10098
+ {
10099
+ var width=this.YRightTextInfo.AryOverlayWidth[i];
10100
+ xRight+=width;
10101
+ xLine=ToFixedPoint(xRight);
10102
+ this.Canvas.moveTo(xLine,top);
10103
+ this.Canvas.lineTo(xLine,bottom);
10104
+ }
10105
+ this.Canvas.stroke();
10106
+
10107
+ }
10108
+ }
9994
10109
  }
9995
10110
 
9996
10111
  //上下区域是否重叠
@@ -10654,7 +10769,9 @@ function AverageWidthFrame()
10654
10769
  {
10655
10770
  var value=this.Canvas.measureText(text[i].Text).width;
10656
10771
  if (value>width) width=value;
10657
- aryText.push({Text:text[i].Text, Width:value+2*pixelTatio});
10772
+ var outItem={ Text:text[i].Text, Width:value+2*pixelTatio };
10773
+ if (item.TextColor) outItem.TextColor=item.TextColor;
10774
+ aryText.push(outItem);
10658
10775
  }
10659
10776
  }
10660
10777
 
@@ -10879,7 +10996,8 @@ function AverageWidthFrame()
10879
10996
  var textLeft=right-itemText.Width;
10880
10997
  this.Canvas.fillStyle=bgColor;
10881
10998
  this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight); //文本背景区域
10882
- this.Canvas.fillStyle = item.TextColor;
10999
+ if (itemText.TextColor) this.Canvas.fillStyle=itemText.TextColor;
11000
+ else this.Canvas.fillStyle = item.TextColor;
10883
11001
  this.Canvas.fillText(itemText.Text, textLeft + 1*pixelTatio, yText);
10884
11002
  if (i==0) this.DrawLine(left,textLeft,yText,item.LineColor,item.LineType,item);
10885
11003
  yText+=textHeight+1*pixelTatio;
@@ -10991,7 +11109,8 @@ function AverageWidthFrame()
10991
11109
  {
10992
11110
  this.Canvas.fillStyle=item.LineColor;
10993
11111
  this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);
10994
- this.Canvas.fillStyle = item.TextColor;
11112
+ if (itemText.TextColor) this.Canvas.fillStyle=itemText.TextColor;
11113
+ else this.Canvas.fillStyle = item.TextColor;
10995
11114
  this.Canvas.fillText(itemText.Text, textLeft + 1*pixelTatio, yText);
10996
11115
  }
10997
11116
 
@@ -14585,8 +14704,13 @@ function OverlayKLineFrame()
14585
14704
  this.Title=null;
14586
14705
  this.TitleColor=g_JSChartResource.OverlayFrame.TitleColor;
14587
14706
  this.TitleFont=g_JSChartResource.OverlayFrame.TitleFont;
14707
+ this.IsShowTitle=true;
14588
14708
 
14589
14709
  this.IsYDrawMainFrame=false; //Y轴自定刻度绘制在主图框架上
14710
+ this.BlankWidth=0;
14711
+ this.Style=0; //0=Y轴在BlankWidth 1=Y轴在左边
14712
+
14713
+ this.YLineExtend=[ { Width:2 }, null]; //[0]=左 [1]=右 { Width:5, Color:颜色, }
14590
14714
 
14591
14715
  this.Buttons=[];
14592
14716
 
@@ -14626,21 +14750,69 @@ function OverlayKLineFrame()
14626
14750
  this.XSplit=false;
14627
14751
  }
14628
14752
 
14753
+
14754
+ //Y轴刻度线 x坐标
14755
+ this.GetXHorizontal=function()
14756
+ {
14757
+ var border=this.ChartBorder.GetBorder();
14758
+ var x=border.Right;
14759
+ x+=this.RightOffset;
14760
+
14761
+ if (this.Style==1)
14762
+ {
14763
+
14764
+ }
14765
+ else
14766
+ {
14767
+ x+=this.BlankWidth;
14768
+ }
14769
+
14770
+ return x;
14771
+ }
14772
+
14773
+ this.GetHorizontalWidth=function()
14774
+ {
14775
+ var width=null;
14776
+ if (this.YRightTextInfo && IFrameSplitOperator.IsNumber(this.TextWidthIndex))
14777
+ width=this.YRightTextInfo.AryOverlayWidth[this.TextWidthIndex];
14778
+
14779
+ return width;
14780
+ }
14781
+
14629
14782
  this.DrawTitle=function() //画标题
14630
14783
  {
14784
+ if (!this.IsShowTitle) return;
14631
14785
  if (!this.Title) return;
14632
14786
  var border=this.ChartBorder.GetBorder();
14633
14787
  var top = this.ChartBorder.GetTopTitle();
14634
14788
  var bottom = border.Bottom;
14635
- var right=border.Right;
14636
- right+=this.RightOffset;
14637
-
14789
+
14790
+ var xText=this.GetXHorizontal();
14791
+ var leftLine=null, rightLine=null;
14792
+ if (IFrameSplitOperator.IsNonEmptyArray(this.YLineExtend))
14793
+ {
14794
+ rightLine=this.YLineExtend[1];
14795
+ leftLine=this.YLineExtend[0];
14796
+ }
14797
+
14798
+ if (this.Style==1)
14799
+ {
14800
+ this.Canvas.textBaseline="bottom";
14801
+ if (rightLine && rightLine.Width>0) xText+=rightLine.Width+1;
14802
+ else xText+=1;
14803
+ }
14804
+ else
14805
+ {
14806
+ this.Canvas.textBaseline="top";
14807
+ if (leftLine && leftLine.Width>0) xText-=leftLine.Width;
14808
+ else xText-=2;
14809
+ }
14810
+
14811
+ var yText=top+(bottom-top)/2;
14638
14812
  this.Canvas.fillStyle=this.TitleColor;
14639
14813
  this.Canvas.font=this.TitleFont;
14640
14814
  this.Canvas.textAlign="center";
14641
- this.Canvas.textBaseline="top";
14642
-
14643
- var xText=right-2,yText=top+(bottom-top)/2;
14815
+
14644
14816
  this.Canvas.save();
14645
14817
  this.Canvas.translate(xText, yText);
14646
14818
  this.Canvas.rotate(90 * Math.PI / 180);
@@ -14679,10 +14851,18 @@ function OverlayKLineFrame()
14679
14851
  if (item.Font!=null) this.Canvas.font=item.Font;
14680
14852
 
14681
14853
  textWidth=this.Canvas.measureText(item.Message[1]).width;
14854
+ if (this.YTextPadding && IFrameSplitOperator.IsNumber(this.YTextPadding[1]))
14855
+ textWidth+=this.YTextPadding[1];
14682
14856
  if (width.Right<textWidth) width.Right=textWidth;
14683
14857
  }
14684
14858
  }
14685
14859
 
14860
+ if (IFrameSplitOperator.IsNonEmptyArray(this.YLineExtend))
14861
+ {
14862
+ var line=this.YLineExtend[1];
14863
+ if (line && line.Width>0) width.Right+=line.Width;
14864
+ }
14865
+
14686
14866
  return { TextWidth:width };
14687
14867
  }
14688
14868
 
@@ -14722,7 +14902,23 @@ function OverlayKLineFrame()
14722
14902
  var top = this.ChartBorder.GetTopTitle();
14723
14903
  var borderRight=this.ChartBorder.Right;
14724
14904
  right+=this.RightOffset;
14905
+ var xLine=this.GetXHorizontal();
14906
+ if (IFrameSplitOperator.IsNumber(this.BlankWidth)) right+=this.BlankWidth;
14725
14907
 
14908
+ var rightExtendText=null; //右侧文字设置
14909
+ if (IFrameSplitOperator.IsNonEmptyArray(this.YTextExtend))
14910
+ {
14911
+ rightExtendText=this.YTextExtend[1];
14912
+ }
14913
+
14914
+ var leftLine=null, rightLine=null;
14915
+ if (IFrameSplitOperator.IsNonEmptyArray(this.YLineExtend))
14916
+ {
14917
+ rightLine=this.YLineExtend[1];
14918
+ leftLine=this.YLineExtend[0];
14919
+ }
14920
+
14921
+ var rightWidth=this.GetHorizontalWidth(); //右侧宽度
14726
14922
  var yPrev=null; //上一个坐标y的值
14727
14923
  for(var i=this.HorizontalInfo.length-1; i>=0; --i) //从上往下画分割线
14728
14924
  {
@@ -14734,11 +14930,24 @@ function OverlayKLineFrame()
14734
14930
  else if (y <= top + 2) this.Canvas.textBaseline = 'top';
14735
14931
  else this.Canvas.textBaseline = "middle";
14736
14932
 
14737
- this.Canvas.strokeStyle=this.PenBorder;
14738
- this.Canvas.beginPath();
14739
- this.Canvas.moveTo(right-2,ToFixedPoint(y));
14740
- this.Canvas.lineTo(right,ToFixedPoint(y));
14741
- this.Canvas.stroke();
14933
+
14934
+ if (leftLine && leftLine.Width>0) //左边
14935
+ {
14936
+ this.Canvas.strokeStyle=this.PenBorder;
14937
+ this.Canvas.beginPath();
14938
+ this.Canvas.moveTo(xLine-leftLine.Width,ToFixedPoint(y));
14939
+ this.Canvas.lineTo(xLine,ToFixedPoint(y));
14940
+ this.Canvas.stroke();
14941
+ }
14942
+
14943
+ if (rightLine && rightLine.Width>0)
14944
+ {
14945
+ this.Canvas.strokeStyle=this.PenBorder;
14946
+ this.Canvas.beginPath();
14947
+ this.Canvas.moveTo(xLine+rightLine.Width,ToFixedPoint(y));
14948
+ this.Canvas.lineTo(xLine,ToFixedPoint(y));
14949
+ this.Canvas.stroke();
14950
+ }
14742
14951
 
14743
14952
  //坐标信息 右边 间距小于10 不画坐标
14744
14953
  if (item.Message[1]!=null && borderRight>10)
@@ -14747,10 +14956,22 @@ function OverlayKLineFrame()
14747
14956
 
14748
14957
  var text=item.Message[1];
14749
14958
  if (Array.isArray(item.Message[1])) text=item.Message[1][0];
14750
-
14751
- this.Canvas.fillStyle=item.TextColor;
14752
- this.Canvas.textAlign="left";
14753
- this.Canvas.fillText(text,right+2,y);
14959
+
14960
+ if (rightExtendText && rightExtendText.Align)
14961
+ {
14962
+ var textWidth=rightWidth;
14963
+ this.Canvas.textAlign="right";
14964
+ var xRight=border.Right+this.RightOffset+textWidth-this.YTextPadding[1];
14965
+ this.Canvas.fillText(text,xRight,y);
14966
+ }
14967
+ else
14968
+ {
14969
+ var xText=right+2;
14970
+ if (rightLine && rightLine.Width>0) xText+=rightLine.Width;
14971
+ this.Canvas.fillStyle=item.TextColor;
14972
+ this.Canvas.textAlign="left";
14973
+ this.Canvas.fillText(text,xText,y);
14974
+ }
14754
14975
  }
14755
14976
 
14756
14977
  yPrev=y;
@@ -14762,10 +14983,8 @@ function OverlayKLineFrame()
14762
14983
  {
14763
14984
  var border=this.ChartBorder.GetBorder();
14764
14985
  var top=border.TopEx;
14765
- //var left=this.ChartBorder.GetLeft();
14766
- var right=border.Right;
14767
14986
  var bottom=border.BottomEx;
14768
- right+=this.RightOffset;
14987
+ var right=this.GetXHorizontal();
14769
14988
 
14770
14989
  this.Canvas.strokeStyle=this.PenBorder;
14771
14990
  this.Canvas.beginPath();
@@ -14811,14 +15030,15 @@ function OverlayKLineFrame()
14811
15030
 
14812
15031
  var border=this.ChartBorder.GetBorder();
14813
15032
  var yButton=border.Top+this.ChartBorder.TitleHeight/2;
14814
- var xBotton=border.Right+this.RightOffset+this.CloseButton.MerginLeft;
15033
+ var rightWidth=this.GetHorizontalWidth();
15034
+ var xBotton=border.Right+this.RightOffset+rightWidth-this.CloseButton.MerginLeft;
14815
15035
 
14816
- for(var i=0;i<aryButton.length;++i)
15036
+ for(var i=aryButton.length-1;i>=0;--i)
14817
15037
  {
14818
15038
  var item=aryButton[i];
14819
15039
  var size=item.Style.Size;
14820
15040
  var font=`${size}px ${item.Style.Family}`;
14821
- var rtButton={ Left:xBotton, Top:yButton-size/2, Right:xBotton+size+item.Style.MerginLeft, Bottom:yButton+size/2, Width:size+item.Style.MerginLeft, Height:size };
15041
+ var rtButton={ Left:xBotton-size-item.Style.MerginLeft, Top:yButton-size/2, Right:xBotton, Bottom:yButton+size/2, Width:size+item.Style.MerginLeft, Height:size };
14822
15042
  var color=this.CloseButton.Color;
14823
15043
  if (moveonPoint && (moveonPoint.X>=rtButton.Left && moveonPoint.X<rtButton.Right && moveonPoint.Y>=rtButton.Top && moveonPoint.Y<=rtButton.Bottom))
14824
15044
  {
@@ -14829,13 +15049,13 @@ function OverlayKLineFrame()
14829
15049
 
14830
15050
  this.Canvas.fillStyle=color;
14831
15051
  this.Canvas.font=font;
14832
- this.Canvas.textAlign="left";
15052
+ this.Canvas.textAlign="right";
14833
15053
  this.Canvas.textBaseline="middle";
14834
15054
  this.Canvas.fillText(item.Style.Text, xBotton, yButton);
14835
15055
 
14836
15056
  this.Buttons.push({ ID:item.ID, Rect:rtButton });
14837
15057
 
14838
- xBotton=rtButton.Right;
15058
+ xBotton=rtButton.Left;
14839
15059
  }
14840
15060
  }
14841
15061
 
@@ -15912,7 +16132,7 @@ function SubFrameItem()
15912
16132
  this.Frame;
15913
16133
  this.Height;
15914
16134
  this.OverlayIndex=[]; //叠加指标
15915
- this.Interval=60; //子坐标间间距
16135
+ //this.Interval=60; //子坐标间间距
15916
16136
  }
15917
16137
 
15918
16138
  function OverlayIndexItem()
@@ -15980,8 +16200,11 @@ function HQTradeFrame()
15980
16200
 
15981
16201
  this.AutoLeftBorder=null; //{ Blank:10 留白宽度, MinWidth:最小宽度 }
15982
16202
  this.AutoRightBorder=null; //{ Blank:10 留白宽度, MinWidth:最小宽度 }
15983
- this.OverlayBlankWidth=40;
15984
- this.AuotRightWidth; //右边主坐标刻度宽度
16203
+ this.OverlayBlankWidth=30;
16204
+ this.AuotRightWidth; //右边主坐标刻度宽度 (自动模式)
16205
+
16206
+ //固定模式右侧宽度
16207
+ this.FixedRightWidth={ Main:60, Overlay:80 };
15985
16208
 
15986
16209
  this.ZoomWindowsInfo=null; //附图指标缩放,备份信息
15987
16210
  this.ZoomStartWindowIndex=1; //允许缩放窗口起始位置
@@ -16490,7 +16713,7 @@ function HQTradeFrame()
16490
16713
 
16491
16714
  overlayItem.Frame.YSplitOperator.Operator();
16492
16715
  var value=overlayItem.Frame.GetScaleTextWidth();
16493
-
16716
+
16494
16717
  overlayItem.Frame.HorizontalMax=maxValue;
16495
16718
  overlayItem.Frame.HorizontalMin=minValue;
16496
16719
 
@@ -16547,6 +16770,8 @@ function HQTradeFrame()
16547
16770
  width.OverlayRight+=value;
16548
16771
  }
16549
16772
 
16773
+ width.AryOverlayWidth=overlayWidth;
16774
+
16550
16775
  return width;
16551
16776
  }
16552
16777
 
@@ -16601,59 +16826,104 @@ function HQTradeFrame()
16601
16826
  }
16602
16827
  }
16603
16828
 
16604
- if (IFrameSplitOperator.IsNumber(textWidth.Right) && this.AutoRightBorder)
16829
+ if (IFrameSplitOperator.IsNumber(textWidth.Right))
16605
16830
  {
16606
- var blank=0;
16607
- if (IFrameSplitOperator.IsNumber(this.AutoRightBorder.Blank)) blank=this.AutoRightBorder.Blank;
16608
- var value=textWidth.Right+blank;
16609
- if (IFrameSplitOperator.IsNumber(this.AutoRightBorder.MinWidth))
16831
+ if (this.AutoRightBorder) //自动调整右侧间距
16610
16832
  {
16611
- if (this.AutoRightBorder.MinWidth>value) value=this.AutoRightBorder.MinWidth;
16612
- }
16833
+ var rightTextInfo={ };
16834
+ var blank=0;
16835
+ if (IFrameSplitOperator.IsNumber(this.AutoRightBorder.Blank)) blank=this.AutoRightBorder.Blank;
16836
+ var value=textWidth.Right+blank;
16837
+ if (IFrameSplitOperator.IsNumber(this.AutoRightBorder.MinWidth))
16838
+ {
16839
+ if (this.AutoRightBorder.MinWidth>value) value=this.AutoRightBorder.MinWidth;
16840
+ }
16613
16841
 
16614
- this.AuotRightWidth=value;
16615
- if (IFrameSplitOperator.IsPlusNumber(textWidth.OverlayRight))
16616
- {
16617
- value+=this.OverlayBlankWidth;
16618
16842
  this.AuotRightWidth=value;
16619
- value+=textWidth.OverlayRight;
16620
- }
16843
+ rightTextInfo.MainTextWidth=value; //主图坐标宽度
16844
+ if (IFrameSplitOperator.IsNonEmptyArray(textWidth.AryOverlayWidth)) rightTextInfo.AryOverlayWidth=textWidth.AryOverlayWidth;
16621
16845
 
16622
- if (this.GetExtendChartRightWidth)
16623
- {
16624
- var extendWidth=this.GetExtendChartRightWidth();
16846
+ if (IFrameSplitOperator.IsPlusNumber(textWidth.OverlayRight))
16847
+ {
16848
+ this.AuotRightWidth=value;
16849
+ value+=textWidth.OverlayRight;
16850
+ }
16625
16851
 
16626
- if (this.GetExtendChartByClassName)
16852
+ if (this.GetExtendChartRightWidth)
16627
16853
  {
16628
- var finder=this.GetExtendChartByClassName("StockChip");
16629
- if (finder && finder.Chart)
16854
+ var extendWidth=this.GetExtendChartRightWidth();
16855
+
16856
+ if (this.GetExtendChartByClassName)
16630
16857
  {
16631
- finder.Chart.Left=value;
16858
+ var finder=this.GetExtendChartByClassName("StockChip");
16859
+ if (finder && finder.Chart)
16860
+ {
16861
+ finder.Chart.Left=value;
16862
+ }
16632
16863
  }
16864
+
16865
+ value+=extendWidth;
16633
16866
  }
16634
16867
 
16635
- value+=extendWidth;
16636
- }
16868
+ if (this.IsHScreen)
16869
+ {
16870
+ if (this.ChartBorder.Bottom!=value) bSizeChange=true;
16871
+ this.ChartBorder.Bottom=value;
16872
+ }
16873
+ else
16874
+ {
16875
+ if (this.ChartBorder.Right!=value) bSizeChange=true;
16876
+ this.ChartBorder.Right=value;
16877
+ }
16637
16878
 
16638
- if (this.IsHScreen)
16639
- {
16640
- if (this.ChartBorder.Bottom!=value) bSizeChange=true;
16641
- this.ChartBorder.Bottom=value;
16879
+ for(var i=0; i<this.SubFrame.length; ++i)
16880
+ {
16881
+ var item=this.SubFrame[i];
16882
+ if (this.IsHScreen) item.Frame.ChartBorder.Bottom=value;
16883
+ else item.Frame.ChartBorder.Right=value;
16884
+
16885
+ item.Frame.ReDrawToolbar=true;
16886
+ item.Frame.YRightTextInfo=rightTextInfo;
16887
+
16888
+ for(var j=0;j<item.OverlayIndex.length;++j)
16889
+ {
16890
+ var overlayItem=item.OverlayIndex[j];
16891
+ overlayItem.Frame.YRightTextInfo=rightTextInfo;
16892
+ }
16893
+ }
16642
16894
  }
16643
- else
16895
+ else
16644
16896
  {
16645
- if (this.ChartBorder.Right!=value) bSizeChange=true;
16646
- this.ChartBorder.Right=value;
16647
- }
16897
+ var rightTextInfo={ };
16898
+ rightTextInfo.MainTextWidth=this.FixedRightWidth.Main;
16899
+ if (textWidth.OverlayRight==0) //无叠加直接最右边
16900
+ {
16901
+ if (this.IsHScreen)
16902
+ rightTextInfo.MainTextWidth=this.ChartBorder.Bottom;
16903
+ else
16904
+ rightTextInfo.MainTextWidth=this.ChartBorder.Right;
16905
+ }
16906
+ else if (IFrameSplitOperator.IsNonEmptyArray(textWidth.AryOverlayWidth))
16907
+ {
16908
+ for(var i=0;i<textWidth.AryOverlayWidth.length;++i)
16909
+ textWidth.AryOverlayWidth[i]=this.FixedRightWidth.Overlay;
16648
16910
 
16649
- for(var i=0; i<this.SubFrame.length; ++i)
16650
- {
16651
- var item=this.SubFrame[i];
16652
- if (this.IsHScreen) item.Frame.ChartBorder.Bottom=value;
16653
- else item.Frame.ChartBorder.Right=value;
16911
+ rightTextInfo.AryOverlayWidth=textWidth.AryOverlayWidth;
16912
+ }
16654
16913
 
16655
- item.Frame.ReDrawToolbar=true;
16656
- item.Interval=this.AuotRightWidth;
16914
+ for(var i=0; i<this.SubFrame.length; ++i)
16915
+ {
16916
+ var item=this.SubFrame[i];
16917
+
16918
+ item.Frame.ReDrawToolbar=true;
16919
+ item.Frame.YRightTextInfo=rightTextInfo;
16920
+
16921
+ for(var j=0;j<item.OverlayIndex.length;++j)
16922
+ {
16923
+ var overlayItem=item.OverlayIndex[j];
16924
+ overlayItem.Frame.YRightTextInfo=rightTextInfo;
16925
+ }
16926
+ }
16657
16927
  }
16658
16928
  }
16659
16929
 
@@ -16671,39 +16941,47 @@ function HQTradeFrame()
16671
16941
  {
16672
16942
  var rightOffset=this.AuotRightWidth;
16673
16943
 
16674
- for(var j=0; j<item.OverlayIndex.length; ++j)
16944
+ for(var j=0, index=0; j<item.OverlayIndex.length; ++j)
16675
16945
  {
16676
16946
  var overlayItem=item.OverlayIndex[j];
16677
16947
  //把主坐标部分设置给子坐标下来
16678
16948
  overlayItem.Frame.DataWidth=item.Frame.DataWidth;
16679
16949
  overlayItem.Frame.DistanceWidth=item.Frame.DistanceWidth;
16680
16950
  overlayItem.Frame.XPointCount=item.Frame.XPointCount;
16681
- if (overlayItem.ChartPaint.length>0 && overlayItem.Frame)
16682
- {
16683
- overlayItem.Frame.RightOffset=rightOffset;
16684
- overlayItem.Frame.Draw();
16685
- rightOffset+=overlayItem.RightWidth.Width;
16686
- }
16951
+ overlayItem.Frame.RightOffset=rightOffset;
16952
+ overlayItem.Frame.BlankWidth=0;
16953
+ overlayItem.Frame.TextWidthIndex=index;
16954
+ if (IFrameSplitOperator.IsNumber(this.OverlayBlankWidth)) overlayItem.Frame.BlankWidth=this.OverlayBlankWidth;
16955
+
16956
+ overlayItem.Frame.Draw();
16957
+ rightOffset+=overlayItem.RightWidth.Width;
16958
+ if (overlayItem.Frame.IsShow) ++index;
16687
16959
  }
16688
-
16689
16960
  }
16690
16961
  else
16691
16962
  {
16692
- var rightOffset=item.Interval;
16963
+ var rightOffset=this.FixedRightWidth.Main;
16693
16964
  if (item.Frame.RightTextMaxWidth>rightOffset) rightOffset=item.Frame.RightTextMaxWidth;
16694
- for(var j in item.OverlayIndex)
16965
+
16966
+ for(var j =0, index=0; j<item.OverlayIndex.length;++j)
16695
16967
  {
16696
16968
  var overlayItem=item.OverlayIndex[j];
16697
16969
  //把主坐标部分设置给子坐标下来
16698
16970
  overlayItem.Frame.DataWidth=item.Frame.DataWidth;
16699
16971
  overlayItem.Frame.DistanceWidth=item.Frame.DistanceWidth;
16700
16972
  overlayItem.Frame.XPointCount=item.Frame.XPointCount;
16701
- if (overlayItem.ChartPaint.length>0 && overlayItem.Frame)
16973
+ overlayItem.Frame.RightOffset=rightOffset;
16974
+ overlayItem.Frame.BlankWidth=0;
16975
+ overlayItem.Frame.TextWidthIndex=index;
16976
+ if (IFrameSplitOperator.IsNumber(this.OverlayBlankWidth)) overlayItem.Frame.BlankWidth=this.OverlayBlankWidth;
16977
+
16978
+ overlayItem.Frame.Draw();
16979
+ if (overlayItem.Frame.IsShow)
16702
16980
  {
16703
- overlayItem.Frame.RightOffset=rightOffset;
16704
- overlayItem.Frame.Draw();
16705
- if (overlayItem.Frame.IsShow) rightOffset+=item.Interval;
16981
+ rightOffset+=this.FixedRightWidth.Overlay;
16982
+ ++index;
16706
16983
  }
16984
+
16707
16985
  }
16708
16986
  }
16709
16987
  }
@@ -16910,6 +17188,7 @@ function HQTradeFrame()
16910
17188
  {
16911
17189
  var overlayItem=item.OverlayIndex[j];
16912
17190
  var overlayFrame=overlayItem.Frame;
17191
+ if (!overlayFrame.IsShow) continue;
16913
17192
  if (overlayFrame.DrawToolbar) overlayFrame.DrawToolbar(moveonPoint, frame.IsMinSize, mouseStatus);
16914
17193
  }
16915
17194
  }
@@ -46395,36 +46674,35 @@ function ChartCorssCursor()
46395
46674
  if (yValueExtend.FrameID>=0)
46396
46675
  {
46397
46676
  var frame=this.Frame.SubFrame[yValueExtend.FrameID];
46398
- var isAutoRightBorder=false;
46399
- if (this.Frame.AutoRightBorder) isAutoRightBorder=true;
46400
46677
  var overlayLeft=right;
46401
- if (isAutoRightBorder) overlayLeft=right+this.Frame.AuotRightWidth;
46402
46678
  this.Canvas.font=this.Font;
46403
- for(var i in frame.OverlayIndex)
46679
+ for(var i=0; i<frame.OverlayIndex.length; ++i)
46404
46680
  {
46405
46681
  var item=frame.OverlayIndex[i];
46406
46682
  if (item.Frame.IsShow===false) continue;
46407
46683
 
46408
- if (!isAutoRightBorder) overlayLeft+=frame.Interval;
46684
+ overlayLeft=item.Frame.GetXHorizontal();
46409
46685
 
46410
- if (overlayLeft+30>chartRight) break;
46686
+ //if (overlayLeft+30>chartRight) break;
46411
46687
  var yValue=item.Frame.GetYData(y);
46412
-
46413
- for(var i=2;i>=0;--i)
46688
+ var text=IFrameSplitOperator.FormatValueString(yValue,2);
46689
+ var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
46690
+
46691
+ /*
46692
+ for(var j=2;j>=0;--j)
46414
46693
  {
46415
- var text=IFrameSplitOperator.FormatValueString(yValue,i);
46694
+ var text=IFrameSplitOperator.FormatValueString(yValue,j);
46416
46695
  var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
46417
46696
  if (textWidth<frame.Interval) break;
46418
46697
  }
46698
+ */
46419
46699
 
46420
46700
  this.Canvas.fillStyle=this.TextBGColor;
46421
- this.Canvas.fillRect(overlayLeft+2,y-this.TextHeight/2,textWidth,this.TextHeight);
46701
+ this.Canvas.fillRect(overlayLeft+1,y-this.TextHeight/2,textWidth,this.TextHeight);
46422
46702
  this.Canvas.textAlign="left";
46423
46703
  this.Canvas.textBaseline="middle";
46424
46704
  this.Canvas.fillStyle=this.TextColor;
46425
46705
  this.Canvas.fillText(text,overlayLeft+4,y,textWidth);
46426
-
46427
- if (isAutoRightBorder) overlayLeft+=item.RightWidth.Width;
46428
46706
  }
46429
46707
  }
46430
46708
 
@@ -62481,6 +62759,14 @@ function JSChartResource()
62481
62759
  if (item.EmptyBGColor) this.FrameLatestPrice.EmptyBGColor = item.EmptyBGColor;
62482
62760
  }
62483
62761
 
62762
+ if (style.OverlayFrame)
62763
+ {
62764
+ var item=style.OverlayFrame;
62765
+ if (style.OverlayFrame.BolderPen) this.OverlayFrame.BolderPen = style.OverlayFrame.BolderPen;
62766
+ if (style.OverlayFrame.TitleColor) this.OverlayFrame.TitleColor = style.OverlayFrame.TitleColor;
62767
+ if (style.OverlayFrame.TitleFont) this.OverlayFrame.TitleFont = style.OverlayFrame.TitleFont;
62768
+ }
62769
+
62484
62770
  if (style.CorssCursorBGColor) this.CorssCursorBGColor = style.CorssCursorBGColor;
62485
62771
  if (style.CorssCursorTextColor) this.CorssCursorTextColor = style.CorssCursorTextColor;
62486
62772
  if (style.CorssCursorTextFont) this.CorssCursorTextFont = style.CorssCursorTextFont;
@@ -64768,7 +65054,6 @@ function KLineChartContainer(uielement,OffscreenElement)
64768
65054
  this.CtrlMoveStep=5; //Ctrl+(Left/Right) 移动数据个数
64769
65055
 
64770
65056
  this.CustomShow=null; //首先显示的K线的起始日期 { Date:日期 PageSize:}
64771
- this.OverlayIndexFrameWidth=60; //叠加指标框架宽度
64772
65057
  this.ZoomType=0; //缩放模式 0=最右边固定缩放, 1=十字光标两边缩放
64773
65058
  this.IsZoomLockRight=false;
64774
65059
  this.KLineSize=null; //{ DataWidth:, }
@@ -65052,6 +65337,7 @@ function KLineChartContainer(uielement,OffscreenElement)
65052
65337
  this.UpdataDataoffset();
65053
65338
  this.UpdatePointByCursorIndex();
65054
65339
  this.UpdateFrameMaxMin();
65340
+ this.ResetFrameXSplit();
65055
65341
  this.Draw();
65056
65342
  }
65057
65343
  else if (id===JSCHART_OPERATOR_ID.OP_GOTO_HOME)
@@ -65507,6 +65793,7 @@ function KLineChartContainer(uielement,OffscreenElement)
65507
65793
  {
65508
65794
  this.UpdataDataoffset(); //更新数据偏移
65509
65795
  this.UpdateFrameMaxMin(); //调整坐标最大 最小值
65796
+ this.ResetFrameXSplit();
65510
65797
  this.Frame.SetSizeChage(true);
65511
65798
  this.Draw();
65512
65799
  this.UpdatePointByCursorIndex(); //更新十字光标位子
@@ -68377,10 +68664,10 @@ function KLineChartContainer(uielement,OffscreenElement)
68377
68664
  }
68378
68665
 
68379
68666
  var subFrame=this.Frame.SubFrame[windowIndex];
68380
- subFrame.Interval=this.OverlayIndexFrameWidth;
68381
68667
  var overlayFrame=new OverlayIndexItem();
68382
68668
  if (obj.Identify) overlayFrame.Identify=obj.Identify; //由外部指定id
68383
- var frame= this.ClassName==='KLineChartHScreenContainer' ? new OverlayKLineHScreenFrame() : new OverlayKLineFrame();
68669
+ //var frame= this.ClassName==='KLineChartHScreenContainer' ? new OverlayKLineHScreenFrame() : new OverlayKLineFrame();
68670
+ var frame=this.CreateOverlayFrame();
68384
68671
  frame.Canvas=this.Canvas;
68385
68672
  frame.MainFrame=subFrame.Frame;
68386
68673
  frame.ChartBorder=subFrame.Frame.ChartBorder;
@@ -68409,11 +68696,18 @@ function KLineChartContainer(uielement,OffscreenElement)
68409
68696
  var item=obj.Frame;
68410
68697
  if (item.Custom) frame.YSplitOperator.Custom=item.Custom;
68411
68698
  if (IFrameSplitOperator.IsBool(item.IsYDrawMainFrame)) frame.IsYDrawMainFrame=item.IsYDrawMainFrame; //自定义刻度绘制在主图上
68412
- if (IFrameSplitOperator.IsBool(item.IsShowToolbar)) frame.IsShowToolbar=item.IsShowToolbar; //自定义刻度绘制在主图上
68699
+ if (IFrameSplitOperator.IsBool(item.IsShowToolbar)) frame.IsShowToolbar=item.IsShowToolbar; //是否显示工具栏
68413
68700
  }
68414
68701
 
68415
68702
  overlayFrame.Frame=frame;
68416
68703
 
68704
+ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_OVERLAY_FRAME);
68705
+ if (event && event.Callback)
68706
+ {
68707
+ var sendData={ OverlayFrame:overlayFrame, WindowIndex:windowIndex, SubFrame:subFrame };
68708
+ event.Callback(event, sendData, this);
68709
+ }
68710
+
68417
68711
  if (apiItem)
68418
68712
  {
68419
68713
  var apiIndex=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,obj, true);
@@ -76220,7 +76514,6 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
76220
76514
  }
76221
76515
 
76222
76516
  var subFrame=this.Frame.SubFrame[windowIndex];
76223
- subFrame.Interval=this.OverlayIndexFrameWidth;
76224
76517
  var overlayFrame=new OverlayIndexItem();
76225
76518
  if (obj.Identify) overlayFrame.Identify=obj.Identify; //由外部指定id
76226
76519
  var frame=null;