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.
@@ -7101,6 +7101,10 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7101
7101
  if (!subItem || !subItem.Frame) continue;
7102
7102
 
7103
7103
  var frame=subItem.Frame;
7104
+
7105
+ //自定义刻度每次都调用
7106
+ frame.YCustomSplit=true;
7107
+
7104
7108
  var key=frame.Identify;
7105
7109
  var item=
7106
7110
  {
@@ -10272,6 +10276,7 @@ function IChartFramePainting()
10272
10276
  this.SizeChange=true; //大小是否改变
10273
10277
  this.XYSplit=true; //XY轴坐标信息改变
10274
10278
  this.XSplit=true; //X轴变化
10279
+ this.YCustomSplit=true; //自定义Y轴分割线
10275
10280
 
10276
10281
  this.HorizontalMax; //Y轴最大值
10277
10282
  this.HorizontalMin; //Y轴最小值
@@ -10353,6 +10358,7 @@ function IChartFramePainting()
10353
10358
  this.SizeChange=false;
10354
10359
  this.XYSplit=false;
10355
10360
  this.XSplit=false;
10361
+ this.YCustomSplit=false; //自定义Y轴分割线
10356
10362
  }
10357
10363
 
10358
10364
  this.DrawFrame=function() { }
@@ -13508,7 +13514,18 @@ function MinuteFrame()
13508
13514
  //分割x,y轴坐标信息
13509
13515
  this.SplitXYCoordinate=function()
13510
13516
  {
13511
- if (this.XYSplit==false) return;
13517
+ if (this.XYSplit==false)
13518
+ {
13519
+ //计算自定义刻度
13520
+ if (this.YCustomSplit)
13521
+ {
13522
+ if (this.YSplitOperator && this.YSplitOperator.CustomCoordinate)
13523
+ this.YSplitOperator.CustomCoordinate();
13524
+ }
13525
+
13526
+ return;
13527
+ }
13528
+
13512
13529
  if (this.XSplitOperator!=null) this.XSplitOperator.Operator();
13513
13530
  if (this.YSplitOperator!=null) this.YSplitOperator.Operator();
13514
13531
  }
@@ -14966,6 +14983,8 @@ function OverlayMinuteFrame()
14966
14983
 
14967
14984
  this.SizeChange=false;
14968
14985
  this.XYSplit=false;
14986
+ this.XSplit=false;
14987
+ this.YCustomSplit=false; //自定义Y轴分割线
14969
14988
  }
14970
14989
 
14971
14990
  this.DrawToolbar=function()
@@ -15022,6 +15041,8 @@ function OverlayMinuteHScreenFrame()
15022
15041
 
15023
15042
  this.SizeChange=false;
15024
15043
  this.XYSplit=false;
15044
+ this.XSplit=false;
15045
+ this.YCustomSplit=false; //自定义Y轴分割线
15025
15046
  }
15026
15047
 
15027
15048
  //分割x,y轴坐标信息
@@ -15630,7 +15651,13 @@ function KLineFrame()
15630
15651
  if (this.XSplit)
15631
15652
  {
15632
15653
  if (this.XSplitOperator) this.XSplitOperator.Operator();
15633
- if (this.YSplitOperator && this.YSplitOperator.CustomCoordinate) this.YSplitOperator.CustomCoordinate();
15654
+ }
15655
+
15656
+ if (this.YCustomSplit)
15657
+ {
15658
+ //计算自定义刻度
15659
+ if (this.YSplitOperator && this.YSplitOperator.CustomCoordinate)
15660
+ this.YSplitOperator.CustomCoordinate();
15634
15661
  }
15635
15662
 
15636
15663
  return;
@@ -16402,6 +16429,7 @@ function OverlayKLineFrame()
16402
16429
  this.SizeChange=false;
16403
16430
  this.XYSplit=false;
16404
16431
  this.XSplit=false;
16432
+ this.YCustomSplit=false; //自定义Y轴分割线
16405
16433
  }
16406
16434
 
16407
16435
 
@@ -17689,6 +17717,8 @@ function OverlayKLineHScreenFrame()
17689
17717
 
17690
17718
  this.SizeChange=false;
17691
17719
  this.XYSplit=false;
17720
+ this.XSplit=false;
17721
+ this.YCustomSplit=false; //自定义Y轴分割线
17692
17722
  }
17693
17723
 
17694
17724
  this.DrawTitle=function() //画标题
@@ -48133,6 +48163,8 @@ function FrameSplitMinutePriceY()
48133
48163
 
48134
48164
  this.CustomCoordinate=function() //自定义刻度
48135
48165
  {
48166
+ this.Frame.CustomHorizontalInfo=[];
48167
+
48136
48168
  var data=this.InvokeCustomYCoordinateCallback();
48137
48169
  if (data && data.PreventDefault==true) return;
48138
48170
 
@@ -56413,6 +56445,7 @@ IChartDrawPicture.ArrayDrawPricture=
56413
56445
  { Name:"FibSpeedResistanceFan", ClassName:"ChartFibSpeedResistanceFan", Create:function() { return new ChartFibSpeedResistanceFan(); }}, //斐波那契扇形
56414
56446
  { Name:"PriceRange", ClassName:"ChartPriceRange", Create:function() { return new ChartPriceRange(); }},
56415
56447
  { Name:"DateRange", ClassName:"ChartDateRange", Create:function() { return new ChartDateRange(); }},
56448
+ { Name:"DatePriceRange", ClassName:"ChartDatePriceRange", Create:function() { return new ChartDatePriceRange(); }},
56416
56449
  { Name:"InfoLine", ClassName:"ChartInfoLine", Create:function() { return new ChartInfoLine(); }},
56417
56450
  { Name:"TrendAngle", ClassName:"ChartTrendAngle", Create:function() { return new ChartTrendAngle(); }},
56418
56451
  { Name:"ArrowMarker", ClassName:"ChartArrowMarker", Create:function() { return new ChartArrowMarker(); } },
@@ -56949,10 +56982,10 @@ function ChartArrowMarker()
56949
56982
  this.ClassName='ChartArrowMarker';
56950
56983
  this.IsPointIn=this.IsPointIn_XYValue_Line;
56951
56984
 
56952
- this.InsideAngle=25;
56985
+ this.InsideLineConfig={ Angle:25, MaxWidth:70, WidthRate:0.3 };
56953
56986
  this.InsideWidth=70;
56954
-
56955
- this.OutAngle=35;
56987
+
56988
+ this.OutLineConfig={ Angle:35, MaxWidth:100, WidthRate:0.4 };
56956
56989
  this.OutWidth=100;
56957
56990
 
56958
56991
  this.GetXYCoordinate=this.GetXYCoordinate_default;
@@ -56985,6 +57018,19 @@ function ChartArrowMarker()
56985
57018
  return { Top:{X:topX+ptEnd.X, Y:topY+ptEnd.Y}, Bottom:{X:botX+ptEnd.X, Y:botY+ptEnd.Y} };
56986
57019
  }
56987
57020
 
57021
+ this.CalculateLineWidth=function(ptStart, ptEnd)
57022
+ {
57023
+ var a=ptStart.X-ptEnd.X;
57024
+ var b=ptStart.Y-ptEnd.Y;
57025
+ var c=Math.sqrt(a*a+b*b);
57026
+
57027
+ this.InsideWidth=c*this.InsideLineConfig.WidthRate;
57028
+ this.OutWidth=c*this.OutLineConfig.WidthRate;
57029
+
57030
+ if (this.InsideWidth>this.InsideLineConfig.MaxWidth) this.InsideWidth=this.InsideLineConfig.MaxWidth;
57031
+ if (this.OutWidth>this.OutLineConfig.MaxWidth) this.OutWidth=this.OutLineConfig.MaxWidth;
57032
+ }
57033
+
56988
57034
  this.Draw=function()
56989
57035
  {
56990
57036
  this.LinePoint=[];
@@ -57000,9 +57046,11 @@ function ChartArrowMarker()
57000
57046
  var ptStart=drawPoint[0];
57001
57047
  var ptEnd=drawPoint[1];
57002
57048
 
57049
+ this.CalculateLineWidth(ptStart, ptEnd);
57050
+
57003
57051
  //计算箭头 的两条边线坐标
57004
- var outArrow=this.CalculatePoint(this.OutAngle, ptStart, ptEnd, this.OutWidth);
57005
- var insideArrow=this.CalculatePoint(this.InsideAngle, ptStart, ptEnd, this.InsideWidth);
57052
+ var outArrow=this.CalculatePoint(this.OutLineConfig.Angle, ptStart, ptEnd, this.OutWidth);
57053
+ var insideArrow=this.CalculatePoint(this.InsideLineConfig.Angle, ptStart, ptEnd, this.InsideWidth);
57006
57054
 
57007
57055
  this.Canvas.beginPath();
57008
57056
  this.Canvas.moveTo(ptStart.X,ptStart.Y);
@@ -65950,8 +65998,12 @@ function ChartDateRange()
65950
65998
 
65951
65999
  //文字输出
65952
66000
  var bottom=this.Frame.ChartBorder.GetBottomEx();
66001
+ var top=this.Frame.ChartBorder.GetTopEx();
65953
66002
  var startIndex=this.Frame.GetXData(ptStart.X,false);
65954
66003
  var endIndex=this.Frame.GetXData(ptEnd.X,false);
66004
+ var startValue=this.Frame.GetYData(ptStart.Y,false);
66005
+ var endValue=this.Frame.GetYData(ptEnd.Y,false);
66006
+ var diffValue=endValue-startValue;
65955
66007
  var barCount=endIndex-startIndex+1;
65956
66008
  var text=`${barCount} bars`;
65957
66009
 
@@ -65959,13 +66011,27 @@ function ChartDateRange()
65959
66011
  var textHeight=this.GetFontHeight();
65960
66012
  var textWidth=this.Canvas.measureText(text).width+4+(this.Label.LeftMargin+this.Label.RightMargin);
65961
66013
  var rtTextBG={ Left:xCenter-textWidth/2, Top:ptEnd.Y+4, Width:textWidth, Height:textHeight+2 };
66014
+ if (diffValue>0) rtTextBG.Top=ptEnd.Y-rtTextBG.Height-4;
66015
+ else rtTextBG.Top=ptEnd.Y+4;
65962
66016
  rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
65963
66017
 
65964
- if (rtTextBG.Bottom>=bottom)
66018
+ if (diffValue>0)
65965
66019
  {
65966
- rtTextBG.Bottom=bottom;
65967
- rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
66020
+ if (rtTextBG.Top<=top)
66021
+ {
66022
+ rtTextBG.Top=top;
66023
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
66024
+ }
66025
+ }
66026
+ else
66027
+ {
66028
+ if (rtTextBG.Bottom>=bottom)
66029
+ {
66030
+ rtTextBG.Bottom=bottom;
66031
+ rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
66032
+ }
65968
66033
  }
66034
+
65969
66035
 
65970
66036
  if (this.Label.EnableBGColor)
65971
66037
  {
@@ -65983,6 +66049,169 @@ function ChartDateRange()
65983
66049
  }
65984
66050
  }
65985
66051
 
66052
+ function ChartDatePriceRange()
66053
+ {
66054
+ this.newMethod=IChartDrawPicture; //派生
66055
+ this.newMethod();
66056
+ delete this.newMethod;
66057
+
66058
+ this.ClassName='ChartDatePriceRange';
66059
+ this.PointCount=2;
66060
+ this.Font=12*GetDevicePixelRatio() +"px 微软雅黑";
66061
+ this.TextColor=this.LineColor;
66062
+ this.IsPointIn=this.IsPointIn_XYValue_Line;
66063
+ this.GetXYCoordinate=this.GetXYCoordinate_default;
66064
+ this.PointToValue_Default=this.PointToValue;
66065
+ this.OnlyMoveXIndex=true;
66066
+ this.IsSupportMagnet=true;
66067
+ this.LineWidth=1;
66068
+ this.EnableBGColor=true;
66069
+ this.BGColor=IChartDrawPicture.ColorToRGBA(this.LineColor,0.15);
66070
+ this.ExtendLine={ Top:false, Bottom: false }; //延长线
66071
+
66072
+ this.Label={ TextColor:"rgb(0,0,0)", BGColor:"rgb(211,211,211)", EnableBGColor:true, LeftMargin:5, RightMargin:5 };
66073
+
66074
+ this.Draw=function()
66075
+ {
66076
+ this.LinePoint=[];
66077
+ if (this.IsFrameMinSize()) return;
66078
+ if (!this.IsShow) return;
66079
+
66080
+ var bCheckXY=true;
66081
+ var drawPoint=this.CalculateDrawPoint( {IsCheckX:bCheckXY, IsCheckY:bCheckXY} );
66082
+ if (!drawPoint) return;
66083
+ if (drawPoint.length!=2) return;
66084
+
66085
+ this.ClipFrame();
66086
+
66087
+ var ptStart=drawPoint[0];
66088
+ var ptEnd=drawPoint[1];
66089
+
66090
+ this.SetLineWidth();
66091
+ this.DrawRange(ptStart,ptEnd);
66092
+ this.RestoreLineWidth();
66093
+
66094
+ this.DrawPoint(drawPoint); //画点
66095
+ this.Canvas.restore();
66096
+ }
66097
+
66098
+ this.DrawRange=function(ptStart, ptEnd)
66099
+ {
66100
+ var yTop=Math.min(ptStart.Y, ptEnd.Y);
66101
+ var yBottom=Math.max(ptStart.Y, ptEnd.Y);
66102
+ var xLeft=Math.min(ptStart.X, ptEnd.X);
66103
+ var xRight=Math.max(ptStart.X, ptEnd.X);
66104
+ var height=yBottom-yTop;
66105
+ var width=xRight-xLeft;
66106
+ var yCenter=ptStart.Y+(ptEnd.Y-ptStart.Y)/2;
66107
+ var xCenter=ptStart.X+(ptEnd.X-ptStart.X)/2;
66108
+
66109
+ if (this.ExtendLine.Top) yTop=this.Frame.ChartBorder.GetTopEx();
66110
+ if (this.ExtendLine.Bottom) yBottom=this.Frame.ChartBorder.GetBottomEx();
66111
+
66112
+ if (this.EnableBGColor)
66113
+ {
66114
+ var rtBG={ Left:xLeft, Top:yTop, Right:xRight, Bottom:yBottom };
66115
+ rtBG.Width=rtBG.Right-rtBG.Left;
66116
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
66117
+ this.Canvas.fillStyle=this.BGColor;
66118
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
66119
+ }
66120
+
66121
+ this.Canvas.strokeStyle=this.LineColor;
66122
+ this.Canvas.beginPath();
66123
+ this.Canvas.moveTo(ToFixedPoint(xLeft),yTop);
66124
+ this.Canvas.lineTo(ToFixedPoint(xLeft),yBottom);
66125
+
66126
+ this.Canvas.moveTo(ToFixedPoint(xRight),yTop);
66127
+ this.Canvas.lineTo(ToFixedPoint(xRight),yBottom);
66128
+
66129
+ this.Canvas.moveTo(ToFixedPoint(xLeft),ToFixedPoint(yCenter));
66130
+ this.Canvas.lineTo(ToFixedPoint(xRight),ToFixedPoint(yCenter));
66131
+
66132
+ this.Canvas.moveTo(ToFixedPoint(xCenter),ToFixedPoint(yTop));
66133
+ this.Canvas.lineTo(ToFixedPoint(xCenter),ToFixedPoint(yBottom));
66134
+
66135
+ this.Canvas.stroke();
66136
+
66137
+ this.LinePoint.push({ Start:{X:xLeft, Y:yTop}, End:{X:xLeft, Y:yBottom} });
66138
+ this.LinePoint.push({ Start:{X:xRight, Y:yTop}, End:{X:xRight, Y:yBottom} });
66139
+ this.LinePoint.push({ Start:{X:xLeft, Y:yCenter}, End:{X:xRight, Y:yCenter} });
66140
+
66141
+ this.DrawArrow({X:ptStart.X, Y:ToFixedPoint(yCenter)}, {X:ptEnd.X, Y:ToFixedPoint(yCenter)});
66142
+ this.DrawArrow({X:ToFixedPoint(xCenter), Y:ptStart.Y}, {X:ToFixedPoint(xCenter), Y:ptEnd.Y});
66143
+
66144
+ //文字输出
66145
+ var bottom=this.Frame.ChartBorder.GetBottomEx();
66146
+ var top=this.Frame.ChartBorder.GetTopEx();
66147
+ var startIndex=this.Frame.GetXData(ptStart.X,false);
66148
+ var endIndex=this.Frame.GetXData(ptEnd.X,false);
66149
+ var barCount=endIndex-startIndex+1;
66150
+ var startValue=this.Frame.GetYData(ptStart.Y,false);
66151
+ var endValue=this.Frame.GetYData(ptEnd.Y,false);
66152
+ var diffValue=endValue-startValue;
66153
+
66154
+ var rate=(diffValue/startValue)*100;
66155
+ var aryText=
66156
+ [
66157
+ `${diffValue.toFixed(2)} (${rate.toFixed(2)}%)`,
66158
+ `${barCount} bars`
66159
+ ];
66160
+
66161
+ this.Canvas.font=this.Font;
66162
+ var textHeight=this.GetFontHeight();
66163
+ var textWidth=0;
66164
+ for(var i=0;i<aryText.length;++i)
66165
+ {
66166
+ var text=aryText[i];
66167
+ var value=this.Canvas.measureText(text).width;
66168
+ if (textWidth<value) textWidth=value;
66169
+ }
66170
+ textWidth+=(this.Label.LeftMargin+this.Label.RightMargin);
66171
+
66172
+ var rtTextBG={ Left:xCenter-textWidth/2, Top:ptEnd.Y+4, Width:textWidth, Height:aryText.length*textHeight+2 };
66173
+ if (diffValue>0) rtTextBG.Top=ptEnd.Y-rtTextBG.Height-4;
66174
+ else rtTextBG.Top=ptEnd.Y+4;
66175
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
66176
+
66177
+ if (diffValue>0)
66178
+ {
66179
+ if (rtTextBG.Top<=top)
66180
+ {
66181
+ rtTextBG.Top=top;
66182
+ rtTextBG.Bottom=rtTextBG.Top+rtTextBG.Height;
66183
+ }
66184
+ }
66185
+ else
66186
+ {
66187
+ if (rtTextBG.Bottom>=bottom)
66188
+ {
66189
+ rtTextBG.Bottom=bottom;
66190
+ rtTextBG.Top=rtTextBG.Bottom-rtTextBG.Height;
66191
+ }
66192
+ }
66193
+
66194
+ if (this.Label.EnableBGColor)
66195
+ {
66196
+ var path=new Path2D();
66197
+ path.roundRect(ToFixedPoint(rtTextBG.Left), ToFixedPoint(rtTextBG.Top), ToFixedRect(rtTextBG.Width), ToFixedRect(rtTextBG.Height), [3]);
66198
+ this.Canvas.fillStyle=this.Label.BGColor;
66199
+ this.Canvas.fill(path);
66200
+ }
66201
+
66202
+ this.Canvas.fillStyle=this.Label.TextColor;
66203
+ this.Canvas.textAlign="left";
66204
+ this.Canvas.textBaseline="bottom";
66205
+ var yText=rtTextBG.Bottom-2;
66206
+ for(var i=0;i<aryText.length;++i)
66207
+ {
66208
+ var text=aryText[i];
66209
+ this.Canvas.fillText(text,rtTextBG.Left+2+this.Label.LeftMargin,yText);
66210
+ yText-=textHeight;
66211
+ }
66212
+ }
66213
+ }
66214
+
65986
66215
  //线段信息统计
65987
66216
  function ChartInfoLine()
65988
66217
  {
@@ -7032,7 +7032,14 @@ function ChartReport()
7032
7032
 
7033
7033
  if (buttonData.Type===0) //checkbox
7034
7034
  {
7035
- var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, Data:buttonData.Data, PreventDefault: false };
7035
+ var sendData=
7036
+ {
7037
+ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, ColumnIndex:buttonData.ColumnIndex,
7038
+ Data:buttonData.Data, Value:true,
7039
+ PreventDefault: false
7040
+ };
7041
+ if (IFrameSplitOperator.IsBool(buttonData.Data.Checked)) sendData.Value=!buttonData.Data.Checked;
7042
+
7036
7043
  this.SendClickEvent(JSCHART_EVENT_ID.ON_CLICK_REPORT_CHECKBOX, sendData)
7037
7044
 
7038
7045
  if (!sendData.PreventDefault)
@@ -7048,7 +7055,7 @@ function ChartReport()
7048
7055
  }
7049
7056
  else if (buttonData.Type===1) //button
7050
7057
  {
7051
- var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, Data:buttonData.Data };
7058
+ var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, ColumnIndex:buttonData.ColumnIndex, Data:buttonData.Data };
7052
7059
  this.SendClickEvent(JSCHART_EVENT_ID.ON_CLICK_REPORT_BUTTON, sendData)
7053
7060
 
7054
7061
  status.Redraw=true;
@@ -7056,7 +7063,7 @@ function ChartReport()
7056
7063
  }
7057
7064
  else if (buttonData.Type===2) //link
7058
7065
  {
7059
- var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, Data:buttonData.Data };
7066
+ var sendData={ Column:buttonData.Column, Index:buttonData.Index, Stock:buttonData.Stock, ColumnIndex:buttonData.ColumnIndex, Data:buttonData.Data };
7060
7067
  this.SendClickEvent(JSCHART_EVENT_ID.ON_CLICK_REPORT_LINK, sendData)
7061
7068
 
7062
7069
  status.Redraw=true;