hqchart 1.1.13595 → 1.1.13606

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.
@@ -11070,6 +11070,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
11070
11070
  if (!subItem || !subItem.Frame) continue;
11071
11071
 
11072
11072
  var frame=subItem.Frame;
11073
+
11074
+ //自定义刻度每次都调用
11075
+ frame.YCustomSplit=true;
11076
+
11073
11077
  var key=frame.Identify;
11074
11078
  var item=
11075
11079
  {
@@ -14241,6 +14245,7 @@ function IChartFramePainting()
14241
14245
  this.SizeChange=true; //大小是否改变
14242
14246
  this.XYSplit=true; //XY轴坐标信息改变
14243
14247
  this.XSplit=true; //X轴变化
14248
+ this.YCustomSplit=true; //自定义Y轴分割线
14244
14249
 
14245
14250
  this.HorizontalMax; //Y轴最大值
14246
14251
  this.HorizontalMin; //Y轴最小值
@@ -14322,6 +14327,7 @@ function IChartFramePainting()
14322
14327
  this.SizeChange=false;
14323
14328
  this.XYSplit=false;
14324
14329
  this.XSplit=false;
14330
+ this.YCustomSplit=false; //自定义Y轴分割线
14325
14331
  }
14326
14332
 
14327
14333
  this.DrawFrame=function() { }
@@ -17477,7 +17483,18 @@ function MinuteFrame()
17477
17483
  //分割x,y轴坐标信息
17478
17484
  this.SplitXYCoordinate=function()
17479
17485
  {
17480
- if (this.XYSplit==false) return;
17486
+ if (this.XYSplit==false)
17487
+ {
17488
+ //计算自定义刻度
17489
+ if (this.YCustomSplit)
17490
+ {
17491
+ if (this.YSplitOperator && this.YSplitOperator.CustomCoordinate)
17492
+ this.YSplitOperator.CustomCoordinate();
17493
+ }
17494
+
17495
+ return;
17496
+ }
17497
+
17481
17498
  if (this.XSplitOperator!=null) this.XSplitOperator.Operator();
17482
17499
  if (this.YSplitOperator!=null) this.YSplitOperator.Operator();
17483
17500
  }
@@ -18935,6 +18952,8 @@ function OverlayMinuteFrame()
18935
18952
 
18936
18953
  this.SizeChange=false;
18937
18954
  this.XYSplit=false;
18955
+ this.XSplit=false;
18956
+ this.YCustomSplit=false; //自定义Y轴分割线
18938
18957
  }
18939
18958
 
18940
18959
  this.DrawToolbar=function()
@@ -18991,6 +19010,8 @@ function OverlayMinuteHScreenFrame()
18991
19010
 
18992
19011
  this.SizeChange=false;
18993
19012
  this.XYSplit=false;
19013
+ this.XSplit=false;
19014
+ this.YCustomSplit=false; //自定义Y轴分割线
18994
19015
  }
18995
19016
 
18996
19017
  //分割x,y轴坐标信息
@@ -19599,7 +19620,13 @@ function KLineFrame()
19599
19620
  if (this.XSplit)
19600
19621
  {
19601
19622
  if (this.XSplitOperator) this.XSplitOperator.Operator();
19602
- if (this.YSplitOperator && this.YSplitOperator.CustomCoordinate) this.YSplitOperator.CustomCoordinate();
19623
+ }
19624
+
19625
+ if (this.YCustomSplit)
19626
+ {
19627
+ //计算自定义刻度
19628
+ if (this.YSplitOperator && this.YSplitOperator.CustomCoordinate)
19629
+ this.YSplitOperator.CustomCoordinate();
19603
19630
  }
19604
19631
 
19605
19632
  return;
@@ -20371,6 +20398,7 @@ function OverlayKLineFrame()
20371
20398
  this.SizeChange=false;
20372
20399
  this.XYSplit=false;
20373
20400
  this.XSplit=false;
20401
+ this.YCustomSplit=false; //自定义Y轴分割线
20374
20402
  }
20375
20403
 
20376
20404
 
@@ -21658,6 +21686,8 @@ function OverlayKLineHScreenFrame()
21658
21686
 
21659
21687
  this.SizeChange=false;
21660
21688
  this.XYSplit=false;
21689
+ this.XSplit=false;
21690
+ this.YCustomSplit=false; //自定义Y轴分割线
21661
21691
  }
21662
21692
 
21663
21693
  this.DrawTitle=function() //画标题
@@ -52102,6 +52132,8 @@ function FrameSplitMinutePriceY()
52102
52132
 
52103
52133
  this.CustomCoordinate=function() //自定义刻度
52104
52134
  {
52135
+ this.Frame.CustomHorizontalInfo=[];
52136
+
52105
52137
  var data=this.InvokeCustomYCoordinateCallback();
52106
52138
  if (data && data.PreventDefault==true) return;
52107
52139
 
@@ -60382,6 +60414,7 @@ IChartDrawPicture.ArrayDrawPricture=
60382
60414
  { Name:"FibSpeedResistanceFan", ClassName:"ChartFibSpeedResistanceFan", Create:function() { return new ChartFibSpeedResistanceFan(); }}, //斐波那契扇形
60383
60415
  { Name:"PriceRange", ClassName:"ChartPriceRange", Create:function() { return new ChartPriceRange(); }},
60384
60416
  { Name:"DateRange", ClassName:"ChartDateRange", Create:function() { return new ChartDateRange(); }},
60417
+ { Name:"DatePriceRange", ClassName:"ChartDatePriceRange", Create:function() { return new ChartDatePriceRange(); }},
60385
60418
  { Name:"InfoLine", ClassName:"ChartInfoLine", Create:function() { return new ChartInfoLine(); }},
60386
60419
  { Name:"TrendAngle", ClassName:"ChartTrendAngle", Create:function() { return new ChartTrendAngle(); }},
60387
60420
  { Name:"ArrowMarker", ClassName:"ChartArrowMarker", Create:function() { return new ChartArrowMarker(); } },
@@ -60918,10 +60951,10 @@ function ChartArrowMarker()
60918
60951
  this.ClassName='ChartArrowMarker';
60919
60952
  this.IsPointIn=this.IsPointIn_XYValue_Line;
60920
60953
 
60921
- this.InsideAngle=25;
60954
+ this.InsideLineConfig={ Angle:25, MaxWidth:70, WidthRate:0.3 };
60922
60955
  this.InsideWidth=70;
60923
-
60924
- this.OutAngle=35;
60956
+
60957
+ this.OutLineConfig={ Angle:35, MaxWidth:100, WidthRate:0.4 };
60925
60958
  this.OutWidth=100;
60926
60959
 
60927
60960
  this.GetXYCoordinate=this.GetXYCoordinate_default;
@@ -60954,6 +60987,19 @@ function ChartArrowMarker()
60954
60987
  return { Top:{X:topX+ptEnd.X, Y:topY+ptEnd.Y}, Bottom:{X:botX+ptEnd.X, Y:botY+ptEnd.Y} };
60955
60988
  }
60956
60989
 
60990
+ this.CalculateLineWidth=function(ptStart, ptEnd)
60991
+ {
60992
+ var a=ptStart.X-ptEnd.X;
60993
+ var b=ptStart.Y-ptEnd.Y;
60994
+ var c=Math.sqrt(a*a+b*b);
60995
+
60996
+ this.InsideWidth=c*this.InsideLineConfig.WidthRate;
60997
+ this.OutWidth=c*this.OutLineConfig.WidthRate;
60998
+
60999
+ if (this.InsideWidth>this.InsideLineConfig.MaxWidth) this.InsideWidth=this.InsideLineConfig.MaxWidth;
61000
+ if (this.OutWidth>this.OutLineConfig.MaxWidth) this.OutWidth=this.OutLineConfig.MaxWidth;
61001
+ }
61002
+
60957
61003
  this.Draw=function()
60958
61004
  {
60959
61005
  this.LinePoint=[];
@@ -60969,9 +61015,11 @@ function ChartArrowMarker()
60969
61015
  var ptStart=drawPoint[0];
60970
61016
  var ptEnd=drawPoint[1];
60971
61017
 
61018
+ this.CalculateLineWidth(ptStart, ptEnd);
61019
+
60972
61020
  //计算箭头 的两条边线坐标
60973
- var outArrow=this.CalculatePoint(this.OutAngle, ptStart, ptEnd, this.OutWidth);
60974
- var insideArrow=this.CalculatePoint(this.InsideAngle, ptStart, ptEnd, this.InsideWidth);
61021
+ var outArrow=this.CalculatePoint(this.OutLineConfig.Angle, ptStart, ptEnd, this.OutWidth);
61022
+ var insideArrow=this.CalculatePoint(this.InsideLineConfig.Angle, ptStart, ptEnd, this.InsideWidth);
60975
61023
 
60976
61024
  this.Canvas.beginPath();
60977
61025
  this.Canvas.moveTo(ptStart.X,ptStart.Y);
@@ -69919,8 +69967,12 @@ function ChartDateRange()
69919
69967
 
69920
69968
  //文字输出
69921
69969
  var bottom=this.Frame.ChartBorder.GetBottomEx();
69970
+ var top=this.Frame.ChartBorder.GetTopEx();
69922
69971
  var startIndex=this.Frame.GetXData(ptStart.X,false);
69923
69972
  var endIndex=this.Frame.GetXData(ptEnd.X,false);
69973
+ var startValue=this.Frame.GetYData(ptStart.Y,false);
69974
+ var endValue=this.Frame.GetYData(ptEnd.Y,false);
69975
+ var diffValue=endValue-startValue;
69924
69976
  var barCount=endIndex-startIndex+1;
69925
69977
  var text=`${barCount} bars`;
69926
69978
 
@@ -69928,13 +69980,27 @@ function ChartDateRange()
69928
69980
  var textHeight=this.GetFontHeight();
69929
69981
  var textWidth=this.Canvas.measureText(text).width+4+(this.Label.LeftMargin+this.Label.RightMargin);
69930
69982
  var rtTextBG={ Left:xCenter-textWidth/2, Top:ptEnd.Y+4, Width:textWidth, Height:textHeight+2 };
69983
+ if (diffValue>0) rtTextBG.Top=ptEnd.Y-rtTextBG.Height-4;
69984
+ else rtTextBG.Top=ptEnd.Y+4;
69931
69985
  rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
69932
69986
 
69933
- if (rtTextBG.Bottom>=bottom)
69987
+ if (diffValue>0)
69988
+ {
69989
+ if (rtTextBG.Top<=top)
69990
+ {
69991
+ rtTextBG.Top=top;
69992
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
69993
+ }
69994
+ }
69995
+ else
69934
69996
  {
69935
- rtTextBG.Bottom=bottom;
69936
- rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
69997
+ if (rtTextBG.Bottom>=bottom)
69998
+ {
69999
+ rtTextBG.Bottom=bottom;
70000
+ rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
70001
+ }
69937
70002
  }
70003
+
69938
70004
 
69939
70005
  if (this.Label.EnableBGColor)
69940
70006
  {
@@ -69952,6 +70018,169 @@ function ChartDateRange()
69952
70018
  }
69953
70019
  }
69954
70020
 
70021
+ function ChartDatePriceRange()
70022
+ {
70023
+ this.newMethod=IChartDrawPicture; //派生
70024
+ this.newMethod();
70025
+ delete this.newMethod;
70026
+
70027
+ this.ClassName='ChartDatePriceRange';
70028
+ this.PointCount=2;
70029
+ this.Font=12*GetDevicePixelRatio() +"px 微软雅黑";
70030
+ this.TextColor=this.LineColor;
70031
+ this.IsPointIn=this.IsPointIn_XYValue_Line;
70032
+ this.GetXYCoordinate=this.GetXYCoordinate_default;
70033
+ this.PointToValue_Default=this.PointToValue;
70034
+ this.OnlyMoveXIndex=true;
70035
+ this.IsSupportMagnet=true;
70036
+ this.LineWidth=1;
70037
+ this.EnableBGColor=true;
70038
+ this.BGColor=IChartDrawPicture.ColorToRGBA(this.LineColor,0.15);
70039
+ this.ExtendLine={ Top:false, Bottom: false }; //延长线
70040
+
70041
+ this.Label={ TextColor:"rgb(0,0,0)", BGColor:"rgb(211,211,211)", EnableBGColor:true, LeftMargin:5, RightMargin:5 };
70042
+
70043
+ this.Draw=function()
70044
+ {
70045
+ this.LinePoint=[];
70046
+ if (this.IsFrameMinSize()) return;
70047
+ if (!this.IsShow) return;
70048
+
70049
+ var bCheckXY=true;
70050
+ var drawPoint=this.CalculateDrawPoint( {IsCheckX:bCheckXY, IsCheckY:bCheckXY} );
70051
+ if (!drawPoint) return;
70052
+ if (drawPoint.length!=2) return;
70053
+
70054
+ this.ClipFrame();
70055
+
70056
+ var ptStart=drawPoint[0];
70057
+ var ptEnd=drawPoint[1];
70058
+
70059
+ this.SetLineWidth();
70060
+ this.DrawRange(ptStart,ptEnd);
70061
+ this.RestoreLineWidth();
70062
+
70063
+ this.DrawPoint(drawPoint); //画点
70064
+ this.Canvas.restore();
70065
+ }
70066
+
70067
+ this.DrawRange=function(ptStart, ptEnd)
70068
+ {
70069
+ var yTop=Math.min(ptStart.Y, ptEnd.Y);
70070
+ var yBottom=Math.max(ptStart.Y, ptEnd.Y);
70071
+ var xLeft=Math.min(ptStart.X, ptEnd.X);
70072
+ var xRight=Math.max(ptStart.X, ptEnd.X);
70073
+ var height=yBottom-yTop;
70074
+ var width=xRight-xLeft;
70075
+ var yCenter=ptStart.Y+(ptEnd.Y-ptStart.Y)/2;
70076
+ var xCenter=ptStart.X+(ptEnd.X-ptStart.X)/2;
70077
+
70078
+ if (this.ExtendLine.Top) yTop=this.Frame.ChartBorder.GetTopEx();
70079
+ if (this.ExtendLine.Bottom) yBottom=this.Frame.ChartBorder.GetBottomEx();
70080
+
70081
+ if (this.EnableBGColor)
70082
+ {
70083
+ var rtBG={ Left:xLeft, Top:yTop, Right:xRight, Bottom:yBottom };
70084
+ rtBG.Width=rtBG.Right-rtBG.Left;
70085
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
70086
+ this.Canvas.fillStyle=this.BGColor;
70087
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
70088
+ }
70089
+
70090
+ this.Canvas.strokeStyle=this.LineColor;
70091
+ this.Canvas.beginPath();
70092
+ this.Canvas.moveTo(ToFixedPoint(xLeft),yTop);
70093
+ this.Canvas.lineTo(ToFixedPoint(xLeft),yBottom);
70094
+
70095
+ this.Canvas.moveTo(ToFixedPoint(xRight),yTop);
70096
+ this.Canvas.lineTo(ToFixedPoint(xRight),yBottom);
70097
+
70098
+ this.Canvas.moveTo(ToFixedPoint(xLeft),ToFixedPoint(yCenter));
70099
+ this.Canvas.lineTo(ToFixedPoint(xRight),ToFixedPoint(yCenter));
70100
+
70101
+ this.Canvas.moveTo(ToFixedPoint(xCenter),ToFixedPoint(yTop));
70102
+ this.Canvas.lineTo(ToFixedPoint(xCenter),ToFixedPoint(yBottom));
70103
+
70104
+ this.Canvas.stroke();
70105
+
70106
+ this.LinePoint.push({ Start:{X:xLeft, Y:yTop}, End:{X:xLeft, Y:yBottom} });
70107
+ this.LinePoint.push({ Start:{X:xRight, Y:yTop}, End:{X:xRight, Y:yBottom} });
70108
+ this.LinePoint.push({ Start:{X:xLeft, Y:yCenter}, End:{X:xRight, Y:yCenter} });
70109
+
70110
+ this.DrawArrow({X:ptStart.X, Y:ToFixedPoint(yCenter)}, {X:ptEnd.X, Y:ToFixedPoint(yCenter)});
70111
+ this.DrawArrow({X:ToFixedPoint(xCenter), Y:ptStart.Y}, {X:ToFixedPoint(xCenter), Y:ptEnd.Y});
70112
+
70113
+ //文字输出
70114
+ var bottom=this.Frame.ChartBorder.GetBottomEx();
70115
+ var top=this.Frame.ChartBorder.GetTopEx();
70116
+ var startIndex=this.Frame.GetXData(ptStart.X,false);
70117
+ var endIndex=this.Frame.GetXData(ptEnd.X,false);
70118
+ var barCount=endIndex-startIndex+1;
70119
+ var startValue=this.Frame.GetYData(ptStart.Y,false);
70120
+ var endValue=this.Frame.GetYData(ptEnd.Y,false);
70121
+ var diffValue=endValue-startValue;
70122
+
70123
+ var rate=(diffValue/startValue)*100;
70124
+ var aryText=
70125
+ [
70126
+ `${diffValue.toFixed(2)} (${rate.toFixed(2)}%)`,
70127
+ `${barCount} bars`
70128
+ ];
70129
+
70130
+ this.Canvas.font=this.Font;
70131
+ var textHeight=this.GetFontHeight();
70132
+ var textWidth=0;
70133
+ for(var i=0;i<aryText.length;++i)
70134
+ {
70135
+ var text=aryText[i];
70136
+ var value=this.Canvas.measureText(text).width;
70137
+ if (textWidth<value) textWidth=value;
70138
+ }
70139
+ textWidth+=(this.Label.LeftMargin+this.Label.RightMargin);
70140
+
70141
+ var rtTextBG={ Left:xCenter-textWidth/2, Top:ptEnd.Y+4, Width:textWidth, Height:aryText.length*textHeight+2 };
70142
+ if (diffValue>0) rtTextBG.Top=ptEnd.Y-rtTextBG.Height-4;
70143
+ else rtTextBG.Top=ptEnd.Y+4;
70144
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
70145
+
70146
+ if (diffValue>0)
70147
+ {
70148
+ if (rtTextBG.Top<=top)
70149
+ {
70150
+ rtTextBG.Top=top;
70151
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
70152
+ }
70153
+ }
70154
+ else
70155
+ {
70156
+ if (rtTextBG.Bottom>=bottom)
70157
+ {
70158
+ rtTextBG.Bottom=bottom;
70159
+ rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
70160
+ }
70161
+ }
70162
+
70163
+ if (this.Label.EnableBGColor)
70164
+ {
70165
+ var path=new Path2D();
70166
+ path.roundRect(ToFixedPoint(rtTextBG.Left), ToFixedPoint(rtTextBG.Top), ToFixedRect(rtTextBG.Width), ToFixedRect(rtTextBG.Height), [3]);
70167
+ this.Canvas.fillStyle=this.Label.BGColor;
70168
+ this.Canvas.fill(path);
70169
+ }
70170
+
70171
+ this.Canvas.fillStyle=this.Label.TextColor;
70172
+ this.Canvas.textAlign="left";
70173
+ this.Canvas.textBaseline="bottom";
70174
+ var yText=rtTextBG.Bottom-2;
70175
+ for(var i=0;i<aryText.length;++i)
70176
+ {
70177
+ var text=aryText[i];
70178
+ this.Canvas.fillText(text,rtTextBG.Left+2+this.Label.LeftMargin,yText);
70179
+ yText-=textHeight;
70180
+ }
70181
+ }
70182
+ }
70183
+
69955
70184
  //线段信息统计
69956
70185
  function ChartInfoLine()
69957
70186
  {
@@ -132726,7 +132955,14 @@ function ChartReport()
132726
132955
 
132727
132956
  if (buttonData.Type===0) //checkbox
132728
132957
  {
132729
- var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, Data:buttonData.Data, PreventDefault: false };
132958
+ var sendData=
132959
+ {
132960
+ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, ColumnIndex:buttonData.ColumnIndex,
132961
+ Data:buttonData.Data, Value:true,
132962
+ PreventDefault: false
132963
+ };
132964
+ if (IFrameSplitOperator.IsBool(buttonData.Data.Checked)) sendData.Value=!buttonData.Data.Checked;
132965
+
132730
132966
  this.SendClickEvent(JSCHART_EVENT_ID.ON_CLICK_REPORT_CHECKBOX, sendData)
132731
132967
 
132732
132968
  if (!sendData.PreventDefault)
@@ -132742,7 +132978,7 @@ function ChartReport()
132742
132978
  }
132743
132979
  else if (buttonData.Type===1) //button
132744
132980
  {
132745
- var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, Data:buttonData.Data };
132981
+ var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, ColumnIndex:buttonData.ColumnIndex, Data:buttonData.Data };
132746
132982
  this.SendClickEvent(JSCHART_EVENT_ID.ON_CLICK_REPORT_BUTTON, sendData)
132747
132983
 
132748
132984
  status.Redraw=true;
@@ -132750,7 +132986,7 @@ function ChartReport()
132750
132986
  }
132751
132987
  else if (buttonData.Type===2) //link
132752
132988
  {
132753
- var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, Data:buttonData.Data };
132989
+ var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, ColumnIndex:buttonData.ColumnIndex, Data:buttonData.Data };
132754
132990
  this.SendClickEvent(JSCHART_EVENT_ID.ON_CLICK_REPORT_LINK, sendData)
132755
132991
 
132756
132992
  status.Redraw=true;
@@ -139798,6 +140034,7 @@ function JSDialogDrawTool()
139798
140034
  [
139799
140035
  { Title: '价格范围', ClassName: 'hqchart_drawtool icon-shijianfanwei', Type:0, Data:{ ID:"PriceRange" } },
139800
140036
  { Title: '时间范围', ClassName: 'hqchart_drawtool icon-jiagefanwei', Type:0, Data:{ ID:"DateRange" } },
140037
+ { Title: "价格和时间范围", ClassName:"hqchart_drawtool icon-jiagefanwei", Type:0, Data:{ ID:"DatePriceRange" } },
139801
140038
  { Title: "监测线", ClassName:"hqchart_drawtool icon-jiance", Type:0, Data:{ ID:"MonitorLine"} },
139802
140039
  ]
139803
140040
  },
@@ -140817,7 +141054,7 @@ function HQChartScriptWorker()
140817
141054
 
140818
141055
 
140819
141056
 
140820
- var HQCHART_VERSION="1.1.13594";
141057
+ var HQCHART_VERSION="1.1.13605";
140821
141058
 
140822
141059
  function PrintHQChartVersion()
140823
141060
  {