hqchart 1.1.13395 → 1.1.13401

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.
@@ -23612,6 +23612,14 @@ function ChartKLine()
23612
23612
  RightMargin:g_JSChartResource.OrderFlow_Style4.RightMargin,
23613
23613
  }
23614
23614
 
23615
+ this.OrderFlow_Style5=
23616
+ {
23617
+ AskBarColor:g_JSChartResource.OrderFlow_Style5.AskBarColor, //左
23618
+ BidBarColor:g_JSChartResource.OrderFlow_Style5.BidBarColor, //右
23619
+ LeftMargin:g_JSChartResource.OrderFlow_Style5.LeftMargin,
23620
+ RightMargin:g_JSChartResource.OrderFlow_Style5.RightMargin,
23621
+ }
23622
+
23615
23623
  this.IsShowOrderText=false;
23616
23624
 
23617
23625
  this.AryOrderFlowBorder=[]; //订单流边框 临时变量
@@ -27790,7 +27798,175 @@ function ChartKLine()
27790
27798
  //订单流样式5
27791
27799
  this.DrawOrderFlow_Style5=function()
27792
27800
  {
27801
+ var isHScreen=(this.ChartFrame.IsHScreen===true);
27802
+ var dataWidth=this.ChartFrame.DataWidth;
27803
+ var distanceWidth=this.ChartFrame.DistanceWidth;
27804
+ var border=this.ChartBorder.GetBorder();
27805
+ var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
27806
+ var chartright=border.RightEx;
27807
+ var xPointCount=this.ChartFrame.XPointCount;
27808
+ this.AryOrderFlowBorder=[];
27809
+
27810
+ if (isHScreen)
27811
+ {
27812
+ var border=this.ChartBorder.GetHScreenBorder();
27813
+ xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
27814
+ chartright=border.BottomEx;
27815
+ }
27816
+
27817
+ var upColor=this.OrderFlow_Style2.UpColor;
27818
+ var downColor=this.OrderFlow_Style2.DownColor;
27819
+ var unchagneColor=this.OrderFlow_Style2.UnchagneColor;
27820
+ var barWidth=ToFixedRect(this.OrderFlow_Style2.BarWidth);
27821
+ var textWidth=dataWidth-barWidth;
27822
+ if (textWidth/7<barWidth) barWidth=textWidth/7;
27823
+ if (barWidth<=1) barWidth=2;
27824
+
27825
+ this.ShowRange.Start=this.Data.DataOffset;
27826
+ this.ShowRange.End=this.ShowRange.Start;
27827
+ this.ShowRange.DataCount=0;
27828
+ this.ShowRange.ShowCount=xPointCount;
27829
+ this.DrawKRange.Start=this.Data.DataOffset;
27830
+
27831
+ this.DrawOrderFlowHBar(); //横向柱子
27832
+
27833
+ for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
27834
+ {
27835
+ var data=this.Data.Data[i];
27836
+ this.ShowRange.End=i;
27837
+ if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
27838
+
27839
+ var left=xOffset;
27840
+ var right=xOffset+dataWidth;
27841
+ if (right>chartright) break;
27842
+ var x=left+(right-left)/2;
27843
+ var yLow=this.GetYFromData(data.Low, false);
27844
+ var yHigh=this.GetYFromData(data.High, false);
27845
+ var yOpen=this.GetYFromData(data.Open, false);
27846
+ var yClose=this.GetYFromData(data.Close, false);
27847
+ var y=yHigh;
27848
+
27849
+ this.DrawKRange.End=i;
27850
+
27851
+ var barTop=Math.min(yOpen,yClose);
27852
+ var barBottom=Math.max(yOpen,yClose);
27853
+ var barLeft=ToFixedRect(left);
27854
+ var barRight=barLeft+barWidth
27855
+ if (data.Open<data.Close) this.Canvas.fillStyle=upColor;
27856
+ else if (data.Open>data.Close) this.Canvas.fillStyle=downColor;
27857
+ else this.Canvas.fillStyle=unchagneColor;
27858
+
27859
+ var cellHeight=0;
27860
+ if (data.OrderFlow && IFrameSplitOperator.IsNumber(data.OrderFlow.PriceOffset)) cellHeight=this.GetPriceYOffset(data.OrderFlow.PriceOffset);
27861
+
27862
+ this.Canvas.fillRect(barLeft,ToFixedRect(barTop-cellHeight/2),barWidth,ToFixedRect(barBottom-barTop+cellHeight));
27863
+ var yKline={ Low:yLow, High:yHigh, Open:yOpen, Close:yClose };
27864
+ var xKLine={ Left:barRight, Center:x, Right:right, DataWidth:(right-barRight) };
27865
+ xKLine.Center=xKLine.Left+xKLine.DataWidth/2;
27866
+ this.DrawOrderFlowBar_Style5(data.OrderFlow, data, xKLine, yKline, isHScreen);
27867
+ }
27868
+ }
27869
+
27870
+ this.DrawOrderFlowBar_Style5=function(orderFlow, kItem, xKLine, yKline, isHScreen)
27871
+ {
27872
+ var top=Math.min(yKline.Open, yKline.Close)
27873
+ var bottom=Math.max(yKline.Open, yKline.Close);
27874
+ var barHeight=Math.abs(yKline.Open-yKline.Close);
27875
+ var cellHeight=0;
27876
+ if (orderFlow && IFrameSplitOperator.IsNumber(orderFlow.PriceOffset)) cellHeight=this.GetPriceYOffset(orderFlow.PriceOffset);
27877
+ var textFont=this.GetDynamicOrderFlowFont(cellHeight, xKLine.DataWidth/2);
27878
+ this.IsShowOrderText=(cellHeight>5 && xKLine.DataWidth>10);
27879
+ if (this.OrderFlow.AlwaysShowOrderText) this.IsShowOrderText=true;
27880
+
27881
+ this.Canvas.textBaseline='middle';
27882
+
27883
+ this.Canvas.font=textFont;
27884
+ var textWidth=xKLine.DataWidth/2;
27885
+ if (orderFlow && IFrameSplitOperator.IsNonEmptyArray(orderFlow.Order))
27886
+ {
27887
+ var maxValue=orderFlow.MaxValue;
27888
+ for(var i=0;i<orderFlow.Order.length;++i)
27889
+ {
27890
+ var item=orderFlow.Order[i];
27891
+ var yPrice=this.GetYFromData(item.Price, false);
27892
+
27893
+ var rect={ Left:xKLine.Left, Right:xKLine.Center, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
27894
+ rect.Width=rect.Right-rect.Left;
27895
+ rect.Height=rect.Bottom-rect.Top;
27896
+
27897
+ if (IFrameSplitOperator.IsNumber(item.Ask.Value))
27898
+ {
27899
+ var color=this.OrderFlow_Style5.AskBarColor;
27900
+ if (item.Ask.BG) color=item.Ask.BG;
27901
+ this.Canvas.fillStyle=color;
27902
+ var barWidth=rect.Width*item.Ask.Value/maxValue;
27903
+ this.Canvas.fillRect(ToFixedRect(rect.Right),ToFixedRect(rect.Top),ToFixedRect(-barWidth),ToFixedRect(rect.Height));
27904
+
27905
+ var text=null;
27906
+ if (IFrameSplitOperator.IsString(item.Ask.Text)) text=item.Ask.Text;
27907
+ else text=item.Ask.Value.toString();
27908
+ if (text && this.IsShowOrderText)
27909
+ {
27910
+ var textColor=this.OrderFlow.Text.Color;
27911
+ if (item.Ask.Color) textColor=item.Ask.Color;
27912
+
27913
+ this.Canvas.fillStyle=textColor;
27914
+ this.Canvas.textAlign='right';
27915
+ var xText=rect.Right-this.OrderFlow_Style5.LeftMargin;
27916
+ if (item.Ask.Font)
27917
+ {
27918
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, xKLine.DataWidth/2, item.Ask.Font);
27919
+ this.Canvas.font=itemFont;
27920
+ this.Canvas.fillText(text,xText,yPrice);
27921
+ this.Canvas.font=textFont;
27922
+ }
27923
+ else
27924
+ {
27925
+ this.Canvas.fillText(text,xText,yPrice);
27926
+ }
27927
+ }
27928
+ }
27929
+
27930
+
27931
+ var rect={ Left:xKLine.Center, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
27932
+ rect.Width=rect.Right-rect.Left;
27933
+ rect.Height=rect.Bottom-rect.Top;
27934
+
27935
+ if (IFrameSplitOperator.IsNumber(item.Bid.Value))
27936
+ {
27937
+ var color=this.OrderFlow_Style5.BidBarColor;
27938
+ if (item.Bid.BG) color=item.Bid.BG;
27939
+ this.Canvas.fillStyle=color;
27940
+ var barWidth=rect.Width*item.Bid.Value/maxValue;
27941
+ this.Canvas.fillRect(ToFixedRect(rect.Left),ToFixedRect(rect.Top),ToFixedRect(barWidth),ToFixedRect(rect.Height));
27942
+
27943
+ var text=null;
27944
+ if (IFrameSplitOperator.IsString(item.Bid.Text)) text=item.Bid.Text;
27945
+ else text=item.Bid.Value.toString();
27946
+ if (text && this.IsShowOrderText)
27947
+ {
27948
+ var textColor=this.OrderFlow.Text.Color;
27949
+ if (item.Bid.Color)textColor=item.Bid.Color;
27793
27950
 
27951
+ this.Canvas.fillStyle=textColor;
27952
+ this.Canvas.textAlign='left';
27953
+ var xText=rect.Left+this.OrderFlow_Style5.RightMargin
27954
+ if (item.Bid.Font)
27955
+ {
27956
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, xKLine.DataWidth/2, item.Bid.Font);
27957
+ this.Canvas.font=itemFont;
27958
+ this.Canvas.fillText(text,xText,yPrice);
27959
+ this.Canvas.font=textFont;
27960
+ }
27961
+ else
27962
+ {
27963
+ this.Canvas.fillText(text,xText,yPrice);
27964
+ }
27965
+
27966
+ }
27967
+ }
27968
+ }
27969
+ }
27794
27970
  }
27795
27971
 
27796
27972
  //////////////////////////////////////////////////////////////
@@ -37570,6 +37746,8 @@ function ChartMultiText()
37570
37746
  var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
37571
37747
  var left=this.ChartBorder.GetTop();
37572
37748
  var right=this.ChartBorder.GetBottom();
37749
+ var top=border.RightEx;
37750
+ var bottom=border.LeftEx;
37573
37751
  }
37574
37752
  else
37575
37753
  {
@@ -37578,6 +37756,8 @@ function ChartMultiText()
37578
37756
  var chartright=border.RightEx;
37579
37757
  var left=this.ChartBorder.GetLeft();
37580
37758
  var right=this.ChartBorder.GetRight();
37759
+ var top=border.TopEx;
37760
+ var bottom=border.BottomEx;
37581
37761
  }
37582
37762
 
37583
37763
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
@@ -37712,6 +37892,8 @@ function ChartMultiText()
37712
37892
  for(var i in this.Texts)
37713
37893
  {
37714
37894
  var item=this.Texts[i];
37895
+ if (!IFrameSplitOperator.IsNumber(item.Value)) continue;
37896
+
37715
37897
  if (item.Index>=start && item.Index<end)
37716
37898
  {
37717
37899
  if (range.Max==null) range.Max=item.Value;
@@ -46317,7 +46499,7 @@ function FrameSplitKLinePriceY()
46317
46499
  this.Frame.HorizontalInfo[i]= new CoordinateInfo();
46318
46500
  this.Frame.HorizontalInfo[i].Value=value;
46319
46501
  if (this.IsShowLeftText) this.Frame.HorizontalInfo[i].Message[0]=value.toFixed(floatPrecision);
46320
- if (this.IsShowRightText) this.Frame.HorizontalInfo[i].Message[1]=value.toFixed(floatPrecision);
46502
+ if (this.IsShowRightText) this.Frame.HorizontalInfo[i].Message[1]=value.toFixed(floatPrecision);
46321
46503
  }
46322
46504
  }
46323
46505
 
@@ -56751,6 +56933,8 @@ function ChartDrawHLine()
56751
56933
 
56752
56934
  this.TextMargin={ Left:0, Right:0 };
56753
56935
 
56936
+ this.AlwaysShowLab=false; //总是显示标签
56937
+
56754
56938
  this.Button=
56755
56939
  {
56756
56940
  CloseIcon: { Text:'\ue62b', Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE, TooltipText:null, Margin:{ Left:2, Right:2 } },
@@ -56797,7 +56981,9 @@ function ChartDrawHLine()
56797
56981
  if (option.ButtonBGColor) this.ButtonBGColor=option.ButtonBGColor;
56798
56982
  if (IFrameSplitOperator.IsNumber(option.ButtonPosition)) this.ButtonPosition=option.ButtonPosition;
56799
56983
  if (IFrameSplitOperator.IsNumber(option.RightSpaceWidth)) this.RightSpaceWidth=option.RightSpaceWidth;
56984
+ if (IFrameSplitOperator.IsBool(option.AlwaysShowLab)) this.AlwaysShowLab=option.AlwaysShowLab;
56800
56985
 
56986
+
56801
56987
  if (option.Button)
56802
56988
  {
56803
56989
  var item=option.Button;
@@ -56925,7 +57111,8 @@ function ChartDrawHLine()
56925
57111
  if (!drawPoint || drawPoint.length!=1) return;
56926
57112
  if (!this.Frame) return;
56927
57113
  if (this.Value.length!=1) return;
56928
- if (!this.IsYValueInFrame(this.Value[0].YValue)) return null;
57114
+ var bVisibleRange=this.IsYValueInFrame(this.Value[0].YValue); //是否在可视范围
57115
+ if (!this.AlwaysShowLab && !bVisibleRange) return;
56929
57116
 
56930
57117
  var isHScreen=this.Frame.IsHScreen;
56931
57118
  var left=this.Frame.ChartBorder.GetLeft();
@@ -56935,71 +57122,80 @@ function ChartDrawHLine()
56935
57122
  left=this.Frame.ChartBorder.GetTop();
56936
57123
  right=this.Frame.ChartBorder.GetBottom();
56937
57124
  }
57125
+
56938
57126
  this.ClipFrame();
56939
57127
 
56940
57128
  //画线段
56941
- this.Canvas.strokeStyle=this.LineColor;
56942
- this.SetLineWidth();
56943
- this.Canvas.beginPath();
56944
- if (isHScreen)
56945
- {
56946
- this.Canvas.moveTo(drawPoint[0].X,left);
56947
- this.Canvas.lineTo(drawPoint[0].X,right);
56948
- }
56949
- else
57129
+ if (bVisibleRange)
56950
57130
  {
56951
- this.Canvas.moveTo(left,ToFixedPoint(drawPoint[0].Y));
56952
- this.Canvas.lineTo(right,ToFixedPoint(drawPoint[0].Y));
57131
+ this.Canvas.strokeStyle=this.LineColor;
57132
+ this.SetLineWidth();
57133
+ this.Canvas.beginPath();
57134
+ if (isHScreen)
57135
+ {
57136
+ this.Canvas.moveTo(drawPoint[0].X,left);
57137
+ this.Canvas.lineTo(drawPoint[0].X,right);
57138
+ }
57139
+ else
57140
+ {
57141
+ this.Canvas.moveTo(left,ToFixedPoint(drawPoint[0].Y));
57142
+ this.Canvas.lineTo(right,ToFixedPoint(drawPoint[0].Y));
57143
+ }
57144
+ this.Canvas.stroke();
57145
+ this.RestoreLineWidth();
56953
57146
  }
56954
- this.Canvas.stroke();
56955
- this.RestoreLineWidth();
56956
57147
 
56957
57148
  //画水平线段
56958
- var line={Start:new Point(), End:new Point()};
56959
- if (isHScreen)
56960
- {
56961
- line.Start.X=drawPoint[0].X;
56962
- line.Start.Y=left;
56963
- line.End.X=drawPoint[0].X;
56964
- line.End.Y=right;
56965
- }
56966
- else
56967
- {
56968
- line.Start.X=left;
56969
- line.Start.Y=drawPoint[0].Y;
56970
- line.End.X=right;
56971
- line.End.Y=drawPoint[0].Y;
56972
- }
56973
- this.LinePoint.push(line);
56974
-
56975
- var yValue=this.Frame.GetYData(drawPoint[0].Y);
56976
- var strPrice=yValue.toFixed(this.Precision);
56977
- if (this.ShowPriceTextConfig.IsShow[0])
56978
- {
56979
- this.DrawPriceText(strPrice, line.Start, line.End, 0);
56980
- }
56981
-
56982
- if (this.ShowPriceTextConfig.IsShow[1])
57149
+ if (bVisibleRange)
56983
57150
  {
56984
- this.DrawPriceText(strPrice, line.Start, line.End, 1);
57151
+ var line={Start:new Point(), End:new Point()};
57152
+ if (isHScreen)
57153
+ {
57154
+ line.Start.X=drawPoint[0].X;
57155
+ line.Start.Y=left;
57156
+ line.End.X=drawPoint[0].X;
57157
+ line.End.Y=right;
57158
+ }
57159
+ else
57160
+ {
57161
+ line.Start.X=left;
57162
+ line.Start.Y=drawPoint[0].Y;
57163
+ line.End.X=right;
57164
+ line.End.Y=drawPoint[0].Y;
57165
+ }
57166
+ this.LinePoint.push(line);
57167
+
57168
+ var yValue=this.Frame.GetYData(drawPoint[0].Y, false);
57169
+ var strPrice=yValue.toFixed(this.Precision);
57170
+ if (this.ShowPriceTextConfig.IsShow[0])
57171
+ {
57172
+ this.DrawPriceText(strPrice, line.Start, line.End, 0);
57173
+ }
57174
+
57175
+ if (this.ShowPriceTextConfig.IsShow[1])
57176
+ {
57177
+ this.DrawPriceText(strPrice, line.Start, line.End, 1);
57178
+ }
56985
57179
  }
56986
-
57180
+
56987
57181
  var labInfo;
56988
57182
  if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
56989
57183
 
56990
57184
  this.AryShowButton=this.GetShowButton(); //获取按钮
56991
57185
 
56992
- //描述信息
56993
- if (labInfo)
57186
+ //框架内的描述信息
57187
+ if (labInfo && bVisibleRange)
56994
57188
  this.DrawLab(labInfo, drawPoint[0].Y);
56995
57189
 
56996
57190
  //画中心点
56997
- var xCenter=left+(right-left)/2;
56998
- var point={ X:xCenter, Y: drawPoint[0].Y };
56999
- this.DrawPoint([point]);
57191
+ if (bVisibleRange)
57192
+ {
57193
+ var xCenter=left+(right-left)/2;
57194
+ var point={ X:xCenter, Y: drawPoint[0].Y };
57195
+ this.DrawPoint([point]);
57196
+ }
57000
57197
 
57001
57198
  this.Canvas.restore();
57002
-
57003
57199
 
57004
57200
  //外部右侧显示价格
57005
57201
  if (this.ShowPriceTextConfig.IsShow[2])
@@ -57008,9 +57204,8 @@ function ChartDrawHLine()
57008
57204
  this.CalculateButtonSize();
57009
57205
  this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
57010
57206
  if (labInfo) this.DrawRightLab(labInfo, rtDraw);
57011
- if (labInfo) this.DrawCustomHLine(labInfo, drawPoint[0].Y);
57207
+ if (labInfo && bVisibleRange) this.DrawCustomHLine(labInfo, drawPoint[0].Y);
57012
57208
  }
57013
-
57014
57209
 
57015
57210
  //鼠标是否在按钮上
57016
57211
  if (moveonPoint && mouseStatus)
@@ -57210,9 +57405,32 @@ function ChartDrawHLine()
57210
57405
  {
57211
57406
  var left=this.Frame.ChartBorder.GetLeft();
57212
57407
  var right=this.Frame.ChartBorder.GetRight();
57408
+ var top=this.Frame.ChartBorder.GetTopEx();
57409
+ var bottom=this.Frame.ChartBorder.GetBottomEx();
57410
+ var pixelTatio = GetDevicePixelRatio();
57411
+
57412
+ if (IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
57413
+ if (IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
57414
+
57415
+ var yValue=this.Frame.GetYData(y,false);
57416
+ var strValue=yValue.toFixed(this.Precision);
57417
+ if (labInfo &&labInfo.PriceSuffixText) strValue+=labInfo.PriceSuffixText;
57418
+
57419
+ var bVisibleRange=true;
57420
+ if (y<top)
57421
+ {
57422
+ y=top;
57423
+ bVisibleRange=false;
57424
+ }
57425
+ else if (y>bottom)
57426
+ {
57427
+ y=bottom;
57428
+ bVisibleRange=false;
57429
+ }
57213
57430
 
57214
57431
  if (this.RightSpaceWidth>0)
57215
57432
  {
57433
+ if (!bVisibleRange) this.Canvas.setLineDash([2*pixelTatio,3*pixelTatio]); //虚线
57216
57434
  this.Canvas.strokeStyle=this.LineColor;
57217
57435
  this.Canvas.beginPath();
57218
57436
  this.Canvas.moveTo(right,ToFixedPoint(y));
@@ -57220,10 +57438,6 @@ function ChartDrawHLine()
57220
57438
  this.Canvas.stroke();
57221
57439
  }
57222
57440
 
57223
- var yValue=this.Frame.GetYData(y);
57224
- var strValue=yValue.toFixed(this.Precision);
57225
- if (labInfo &&labInfo.PriceSuffixText) strValue+=labInfo.PriceSuffixText;
57226
-
57227
57441
  this.Canvas.fillStyle=this.LineColor;
57228
57442
  this.Canvas.font=this.Font;
57229
57443
  var textWidth=this.Canvas.measureText(strValue).width;
@@ -65719,6 +65933,15 @@ function JSChartResource()
65719
65933
  LeftMargin:1,
65720
65934
  RightMargin:1
65721
65935
  };
65936
+
65937
+
65938
+ this.OrderFlow_Style5=
65939
+ {
65940
+ AskBarColor:"rgb(176,22,22)", //左
65941
+ BidBarColor:"rgb(98,126,176)", //右
65942
+ LeftMargin:3,
65943
+ RightMargin:2,
65944
+ };
65722
65945
 
65723
65946
 
65724
65947
  this.Index={};