hqchart 1.1.13395 → 1.1.13403

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.
@@ -27521,6 +27521,14 @@ function ChartKLine()
27521
27521
  RightMargin:g_JSChartResource.OrderFlow_Style4.RightMargin,
27522
27522
  }
27523
27523
 
27524
+ this.OrderFlow_Style5=
27525
+ {
27526
+ AskBarColor:g_JSChartResource.OrderFlow_Style5.AskBarColor, //左
27527
+ BidBarColor:g_JSChartResource.OrderFlow_Style5.BidBarColor, //右
27528
+ LeftMargin:g_JSChartResource.OrderFlow_Style5.LeftMargin,
27529
+ RightMargin:g_JSChartResource.OrderFlow_Style5.RightMargin,
27530
+ }
27531
+
27524
27532
  this.IsShowOrderText=false;
27525
27533
 
27526
27534
  this.AryOrderFlowBorder=[]; //订单流边框 临时变量
@@ -31699,7 +31707,175 @@ function ChartKLine()
31699
31707
  //订单流样式5
31700
31708
  this.DrawOrderFlow_Style5=function()
31701
31709
  {
31710
+ var isHScreen=(this.ChartFrame.IsHScreen===true);
31711
+ var dataWidth=this.ChartFrame.DataWidth;
31712
+ var distanceWidth=this.ChartFrame.DistanceWidth;
31713
+ var border=this.ChartBorder.GetBorder();
31714
+ var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
31715
+ var chartright=border.RightEx;
31716
+ var xPointCount=this.ChartFrame.XPointCount;
31717
+ this.AryOrderFlowBorder=[];
31718
+
31719
+ if (isHScreen)
31720
+ {
31721
+ var border=this.ChartBorder.GetHScreenBorder();
31722
+ xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
31723
+ chartright=border.BottomEx;
31724
+ }
31725
+
31726
+ var upColor=this.OrderFlow_Style2.UpColor;
31727
+ var downColor=this.OrderFlow_Style2.DownColor;
31728
+ var unchagneColor=this.OrderFlow_Style2.UnchagneColor;
31729
+ var barWidth=ToFixedRect(this.OrderFlow_Style2.BarWidth);
31730
+ var textWidth=dataWidth-barWidth;
31731
+ if (textWidth/7<barWidth) barWidth=textWidth/7;
31732
+ if (barWidth<=1) barWidth=2;
31733
+
31734
+ this.ShowRange.Start=this.Data.DataOffset;
31735
+ this.ShowRange.End=this.ShowRange.Start;
31736
+ this.ShowRange.DataCount=0;
31737
+ this.ShowRange.ShowCount=xPointCount;
31738
+ this.DrawKRange.Start=this.Data.DataOffset;
31739
+
31740
+ this.DrawOrderFlowHBar(); //横向柱子
31741
+
31742
+ for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth),++this.ShowRange.DataCount)
31743
+ {
31744
+ var data=this.Data.Data[i];
31745
+ this.ShowRange.End=i;
31746
+ if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
31747
+
31748
+ var left=xOffset;
31749
+ var right=xOffset+dataWidth;
31750
+ if (right>chartright) break;
31751
+ var x=left+(right-left)/2;
31752
+ var yLow=this.GetYFromData(data.Low, false);
31753
+ var yHigh=this.GetYFromData(data.High, false);
31754
+ var yOpen=this.GetYFromData(data.Open, false);
31755
+ var yClose=this.GetYFromData(data.Close, false);
31756
+ var y=yHigh;
31757
+
31758
+ this.DrawKRange.End=i;
31759
+
31760
+ var barTop=Math.min(yOpen,yClose);
31761
+ var barBottom=Math.max(yOpen,yClose);
31762
+ var barLeft=ToFixedRect(left);
31763
+ var barRight=barLeft+barWidth
31764
+ if (data.Open<data.Close) this.Canvas.fillStyle=upColor;
31765
+ else if (data.Open>data.Close) this.Canvas.fillStyle=downColor;
31766
+ else this.Canvas.fillStyle=unchagneColor;
31767
+
31768
+ var cellHeight=0;
31769
+ if (data.OrderFlow && IFrameSplitOperator.IsNumber(data.OrderFlow.PriceOffset)) cellHeight=this.GetPriceYOffset(data.OrderFlow.PriceOffset);
31770
+
31771
+ this.Canvas.fillRect(barLeft,ToFixedRect(barTop-cellHeight/2),barWidth,ToFixedRect(barBottom-barTop+cellHeight));
31772
+ var yKline={ Low:yLow, High:yHigh, Open:yOpen, Close:yClose };
31773
+ var xKLine={ Left:barRight, Center:x, Right:right, DataWidth:(right-barRight) };
31774
+ xKLine.Center=xKLine.Left+xKLine.DataWidth/2;
31775
+ this.DrawOrderFlowBar_Style5(data.OrderFlow, data, xKLine, yKline, isHScreen);
31776
+ }
31777
+ }
31778
+
31779
+ this.DrawOrderFlowBar_Style5=function(orderFlow, kItem, xKLine, yKline, isHScreen)
31780
+ {
31781
+ var top=Math.min(yKline.Open, yKline.Close)
31782
+ var bottom=Math.max(yKline.Open, yKline.Close);
31783
+ var barHeight=Math.abs(yKline.Open-yKline.Close);
31784
+ var cellHeight=0;
31785
+ if (orderFlow && IFrameSplitOperator.IsNumber(orderFlow.PriceOffset)) cellHeight=this.GetPriceYOffset(orderFlow.PriceOffset);
31786
+ var textFont=this.GetDynamicOrderFlowFont(cellHeight, xKLine.DataWidth/2);
31787
+ this.IsShowOrderText=(cellHeight>5 && xKLine.DataWidth>10);
31788
+ if (this.OrderFlow.AlwaysShowOrderText) this.IsShowOrderText=true;
31789
+
31790
+ this.Canvas.textBaseline='middle';
31791
+
31792
+ this.Canvas.font=textFont;
31793
+ var textWidth=xKLine.DataWidth/2;
31794
+ if (orderFlow && IFrameSplitOperator.IsNonEmptyArray(orderFlow.Order))
31795
+ {
31796
+ var maxValue=orderFlow.MaxValue;
31797
+ for(var i=0;i<orderFlow.Order.length;++i)
31798
+ {
31799
+ var item=orderFlow.Order[i];
31800
+ var yPrice=this.GetYFromData(item.Price, false);
31801
+
31802
+ var rect={ Left:xKLine.Left, Right:xKLine.Center, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
31803
+ rect.Width=rect.Right-rect.Left;
31804
+ rect.Height=rect.Bottom-rect.Top;
31805
+
31806
+ if (IFrameSplitOperator.IsNumber(item.Ask.Value))
31807
+ {
31808
+ var color=this.OrderFlow_Style5.AskBarColor;
31809
+ if (item.Ask.BG) color=item.Ask.BG;
31810
+ this.Canvas.fillStyle=color;
31811
+ var barWidth=rect.Width*item.Ask.Value/maxValue;
31812
+ this.Canvas.fillRect(ToFixedRect(rect.Right),ToFixedRect(rect.Top),ToFixedRect(-barWidth),ToFixedRect(rect.Height));
31813
+
31814
+ var text=null;
31815
+ if (IFrameSplitOperator.IsString(item.Ask.Text)) text=item.Ask.Text;
31816
+ else text=item.Ask.Value.toString();
31817
+ if (text && this.IsShowOrderText)
31818
+ {
31819
+ var textColor=this.OrderFlow.Text.Color;
31820
+ if (item.Ask.Color) textColor=item.Ask.Color;
31821
+
31822
+ this.Canvas.fillStyle=textColor;
31823
+ this.Canvas.textAlign='right';
31824
+ var xText=rect.Right-this.OrderFlow_Style5.LeftMargin;
31825
+ if (item.Ask.Font)
31826
+ {
31827
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, xKLine.DataWidth/2, item.Ask.Font);
31828
+ this.Canvas.font=itemFont;
31829
+ this.Canvas.fillText(text,xText,yPrice);
31830
+ this.Canvas.font=textFont;
31831
+ }
31832
+ else
31833
+ {
31834
+ this.Canvas.fillText(text,xText,yPrice);
31835
+ }
31836
+ }
31837
+ }
31702
31838
 
31839
+
31840
+ var rect={ Left:xKLine.Center, Right:xKLine.Right, Bottom:yPrice+cellHeight/2, Top:yPrice-cellHeight/2 };
31841
+ rect.Width=rect.Right-rect.Left;
31842
+ rect.Height=rect.Bottom-rect.Top;
31843
+
31844
+ if (IFrameSplitOperator.IsNumber(item.Bid.Value))
31845
+ {
31846
+ var color=this.OrderFlow_Style5.BidBarColor;
31847
+ if (item.Bid.BG) color=item.Bid.BG;
31848
+ this.Canvas.fillStyle=color;
31849
+ var barWidth=rect.Width*item.Bid.Value/maxValue;
31850
+ this.Canvas.fillRect(ToFixedRect(rect.Left),ToFixedRect(rect.Top),ToFixedRect(barWidth),ToFixedRect(rect.Height));
31851
+
31852
+ var text=null;
31853
+ if (IFrameSplitOperator.IsString(item.Bid.Text)) text=item.Bid.Text;
31854
+ else text=item.Bid.Value.toString();
31855
+ if (text && this.IsShowOrderText)
31856
+ {
31857
+ var textColor=this.OrderFlow.Text.Color;
31858
+ if (item.Bid.Color)textColor=item.Bid.Color;
31859
+
31860
+ this.Canvas.fillStyle=textColor;
31861
+ this.Canvas.textAlign='left';
31862
+ var xText=rect.Left+this.OrderFlow_Style5.RightMargin
31863
+ if (item.Bid.Font)
31864
+ {
31865
+ var itemFont=this.GetDynamicOrderFlowFont(cellHeight, xKLine.DataWidth/2, item.Bid.Font);
31866
+ this.Canvas.font=itemFont;
31867
+ this.Canvas.fillText(text,xText,yPrice);
31868
+ this.Canvas.font=textFont;
31869
+ }
31870
+ else
31871
+ {
31872
+ this.Canvas.fillText(text,xText,yPrice);
31873
+ }
31874
+
31875
+ }
31876
+ }
31877
+ }
31878
+ }
31703
31879
  }
31704
31880
 
31705
31881
  //////////////////////////////////////////////////////////////
@@ -41479,6 +41655,8 @@ function ChartMultiText()
41479
41655
  var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
41480
41656
  var left=this.ChartBorder.GetTop();
41481
41657
  var right=this.ChartBorder.GetBottom();
41658
+ var top=border.RightEx;
41659
+ var bottom=border.LeftEx;
41482
41660
  }
41483
41661
  else
41484
41662
  {
@@ -41487,6 +41665,8 @@ function ChartMultiText()
41487
41665
  var chartright=border.RightEx;
41488
41666
  var left=this.ChartBorder.GetLeft();
41489
41667
  var right=this.ChartBorder.GetRight();
41668
+ var top=border.TopEx;
41669
+ var bottom=border.BottomEx;
41490
41670
  }
41491
41671
 
41492
41672
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
@@ -41621,6 +41801,8 @@ function ChartMultiText()
41621
41801
  for(var i in this.Texts)
41622
41802
  {
41623
41803
  var item=this.Texts[i];
41804
+ if (!IFrameSplitOperator.IsNumber(item.Value)) continue;
41805
+
41624
41806
  if (item.Index>=start && item.Index<end)
41625
41807
  {
41626
41808
  if (range.Max==null) range.Max=item.Value;
@@ -50226,7 +50408,7 @@ function FrameSplitKLinePriceY()
50226
50408
  this.Frame.HorizontalInfo[i]= new CoordinateInfo();
50227
50409
  this.Frame.HorizontalInfo[i].Value=value;
50228
50410
  if (this.IsShowLeftText) this.Frame.HorizontalInfo[i].Message[0]=value.toFixed(floatPrecision);
50229
- if (this.IsShowRightText) this.Frame.HorizontalInfo[i].Message[1]=value.toFixed(floatPrecision);
50411
+ if (this.IsShowRightText) this.Frame.HorizontalInfo[i].Message[1]=value.toFixed(floatPrecision);
50230
50412
  }
50231
50413
  }
50232
50414
 
@@ -60660,6 +60842,8 @@ function ChartDrawHLine()
60660
60842
 
60661
60843
  this.TextMargin={ Left:0, Right:0 };
60662
60844
 
60845
+ this.AlwaysShowLab=false; //总是显示标签
60846
+
60663
60847
  this.Button=
60664
60848
  {
60665
60849
  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 } },
@@ -60706,7 +60890,9 @@ function ChartDrawHLine()
60706
60890
  if (option.ButtonBGColor) this.ButtonBGColor=option.ButtonBGColor;
60707
60891
  if (IFrameSplitOperator.IsNumber(option.ButtonPosition)) this.ButtonPosition=option.ButtonPosition;
60708
60892
  if (IFrameSplitOperator.IsNumber(option.RightSpaceWidth)) this.RightSpaceWidth=option.RightSpaceWidth;
60893
+ if (IFrameSplitOperator.IsBool(option.AlwaysShowLab)) this.AlwaysShowLab=option.AlwaysShowLab;
60709
60894
 
60895
+
60710
60896
  if (option.Button)
60711
60897
  {
60712
60898
  var item=option.Button;
@@ -60834,7 +61020,8 @@ function ChartDrawHLine()
60834
61020
  if (!drawPoint || drawPoint.length!=1) return;
60835
61021
  if (!this.Frame) return;
60836
61022
  if (this.Value.length!=1) return;
60837
- if (!this.IsYValueInFrame(this.Value[0].YValue)) return null;
61023
+ var bVisibleRange=this.IsYValueInFrame(this.Value[0].YValue); //是否在可视范围
61024
+ if (!this.AlwaysShowLab && !bVisibleRange) return;
60838
61025
 
60839
61026
  var isHScreen=this.Frame.IsHScreen;
60840
61027
  var left=this.Frame.ChartBorder.GetLeft();
@@ -60844,24 +61031,28 @@ function ChartDrawHLine()
60844
61031
  left=this.Frame.ChartBorder.GetTop();
60845
61032
  right=this.Frame.ChartBorder.GetBottom();
60846
61033
  }
61034
+
60847
61035
  this.ClipFrame();
60848
61036
 
60849
61037
  //画线段
60850
- this.Canvas.strokeStyle=this.LineColor;
60851
- this.SetLineWidth();
60852
- this.Canvas.beginPath();
60853
- if (isHScreen)
61038
+ if (bVisibleRange)
60854
61039
  {
60855
- this.Canvas.moveTo(drawPoint[0].X,left);
60856
- this.Canvas.lineTo(drawPoint[0].X,right);
60857
- }
60858
- else
60859
- {
60860
- this.Canvas.moveTo(left,ToFixedPoint(drawPoint[0].Y));
60861
- this.Canvas.lineTo(right,ToFixedPoint(drawPoint[0].Y));
61040
+ this.Canvas.strokeStyle=this.LineColor;
61041
+ this.SetLineWidth();
61042
+ this.Canvas.beginPath();
61043
+ if (isHScreen)
61044
+ {
61045
+ this.Canvas.moveTo(drawPoint[0].X,left);
61046
+ this.Canvas.lineTo(drawPoint[0].X,right);
61047
+ }
61048
+ else
61049
+ {
61050
+ this.Canvas.moveTo(left,ToFixedPoint(drawPoint[0].Y));
61051
+ this.Canvas.lineTo(right,ToFixedPoint(drawPoint[0].Y));
61052
+ }
61053
+ this.Canvas.stroke();
61054
+ this.RestoreLineWidth();
60862
61055
  }
60863
- this.Canvas.stroke();
60864
- this.RestoreLineWidth();
60865
61056
 
60866
61057
  //画水平线段
60867
61058
  var line={Start:new Point(), End:new Point()};
@@ -60881,34 +61072,39 @@ function ChartDrawHLine()
60881
61072
  }
60882
61073
  this.LinePoint.push(line);
60883
61074
 
60884
- var yValue=this.Frame.GetYData(drawPoint[0].Y);
60885
- var strPrice=yValue.toFixed(this.Precision);
60886
- if (this.ShowPriceTextConfig.IsShow[0])
61075
+ if (bVisibleRange)
60887
61076
  {
60888
- this.DrawPriceText(strPrice, line.Start, line.End, 0);
60889
- }
60890
-
60891
- if (this.ShowPriceTextConfig.IsShow[1])
60892
- {
60893
- this.DrawPriceText(strPrice, line.Start, line.End, 1);
61077
+ var yValue=this.Frame.GetYData(drawPoint[0].Y, false);
61078
+ var strPrice=yValue.toFixed(this.Precision);
61079
+ if (this.ShowPriceTextConfig.IsShow[0])
61080
+ {
61081
+ this.DrawPriceText(strPrice, line.Start, line.End, 0);
61082
+ }
61083
+
61084
+ if (this.ShowPriceTextConfig.IsShow[1])
61085
+ {
61086
+ this.DrawPriceText(strPrice, line.Start, line.End, 1);
61087
+ }
60894
61088
  }
60895
-
61089
+
60896
61090
  var labInfo;
60897
61091
  if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
60898
61092
 
60899
61093
  this.AryShowButton=this.GetShowButton(); //获取按钮
60900
61094
 
60901
- //描述信息
60902
- if (labInfo)
61095
+ //框架内的描述信息
61096
+ if (labInfo && bVisibleRange)
60903
61097
  this.DrawLab(labInfo, drawPoint[0].Y);
60904
61098
 
60905
61099
  //画中心点
60906
- var xCenter=left+(right-left)/2;
60907
- var point={ X:xCenter, Y: drawPoint[0].Y };
60908
- this.DrawPoint([point]);
61100
+ if (bVisibleRange)
61101
+ {
61102
+ var xCenter=left+(right-left)/2;
61103
+ var point={ X:xCenter, Y: drawPoint[0].Y };
61104
+ this.DrawPoint([point]);
61105
+ }
60909
61106
 
60910
61107
  this.Canvas.restore();
60911
-
60912
61108
 
60913
61109
  //外部右侧显示价格
60914
61110
  if (this.ShowPriceTextConfig.IsShow[2])
@@ -60917,9 +61113,8 @@ function ChartDrawHLine()
60917
61113
  this.CalculateButtonSize();
60918
61114
  this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
60919
61115
  if (labInfo) this.DrawRightLab(labInfo, rtDraw);
60920
- if (labInfo) this.DrawCustomHLine(labInfo, drawPoint[0].Y);
61116
+ if (labInfo && bVisibleRange) this.DrawCustomHLine(labInfo, drawPoint[0].Y);
60921
61117
  }
60922
-
60923
61118
 
60924
61119
  //鼠标是否在按钮上
60925
61120
  if (moveonPoint && mouseStatus)
@@ -61119,20 +61314,40 @@ function ChartDrawHLine()
61119
61314
  {
61120
61315
  var left=this.Frame.ChartBorder.GetLeft();
61121
61316
  var right=this.Frame.ChartBorder.GetRight();
61317
+ var top=this.Frame.ChartBorder.GetTopEx();
61318
+ var bottom=this.Frame.ChartBorder.GetBottomEx();
61319
+ var pixelTatio = GetDevicePixelRatio();
61320
+
61321
+ if (IFrameSplitOperator.IsNumber(labInfo.TopOffset)) top-=labInfo.TopOffset;
61322
+ if (IFrameSplitOperator.IsNumber(labInfo.BottomOffset)) bottom+=labInfo.BottomOffset;
61323
+
61324
+ var yValue=this.Frame.GetYData(y,false);
61325
+ var strValue=yValue.toFixed(this.Precision);
61326
+ if (labInfo &&labInfo.PriceSuffixText) strValue+=labInfo.PriceSuffixText;
61327
+
61328
+ var bVisibleRange=true;
61329
+ if (y<top)
61330
+ {
61331
+ y=top;
61332
+ bVisibleRange=false;
61333
+ }
61334
+ else if (y>bottom)
61335
+ {
61336
+ y=bottom;
61337
+ bVisibleRange=false;
61338
+ }
61122
61339
 
61123
61340
  if (this.RightSpaceWidth>0)
61124
61341
  {
61342
+ if (!bVisibleRange) this.Canvas.setLineDash([2*pixelTatio,3*pixelTatio]); //虚线
61125
61343
  this.Canvas.strokeStyle=this.LineColor;
61126
61344
  this.Canvas.beginPath();
61127
61345
  this.Canvas.moveTo(right,ToFixedPoint(y));
61128
61346
  this.Canvas.lineTo(right+this.RightSpaceWidth,ToFixedPoint(y));
61129
61347
  this.Canvas.stroke();
61348
+ if (!bVisibleRange) this.Canvas.setLineDash([]);
61130
61349
  }
61131
61350
 
61132
- var yValue=this.Frame.GetYData(y);
61133
- var strValue=yValue.toFixed(this.Precision);
61134
- if (labInfo &&labInfo.PriceSuffixText) strValue+=labInfo.PriceSuffixText;
61135
-
61136
61351
  this.Canvas.fillStyle=this.LineColor;
61137
61352
  this.Canvas.font=this.Font;
61138
61353
  var textWidth=this.Canvas.measureText(strValue).width;
@@ -69628,6 +69843,15 @@ function JSChartResource()
69628
69843
  LeftMargin:1,
69629
69844
  RightMargin:1
69630
69845
  };
69846
+
69847
+
69848
+ this.OrderFlow_Style5=
69849
+ {
69850
+ AskBarColor:"rgb(176,22,22)", //左
69851
+ BidBarColor:"rgb(98,126,176)", //右
69852
+ LeftMargin:3,
69853
+ RightMargin:2,
69854
+ };
69631
69855
 
69632
69856
 
69633
69857
  this.Index={};
@@ -133505,7 +133729,7 @@ function ScrollBarBGChart()
133505
133729
 
133506
133730
 
133507
133731
 
133508
- var HQCHART_VERSION="1.1.13395";
133732
+ var HQCHART_VERSION="1.1.13402";
133509
133733
 
133510
133734
  function PrintHQChartVersion()
133511
133735
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13395";
8
+ var HQCHART_VERSION="1.1.13402";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {