hqchart 1.1.11291 → 1.1.11295

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.
@@ -2915,7 +2915,7 @@ else if(data.Open>data.Close)this.Canvas.strokeStyle=this.DownColor;//阳线
2915
2915
  else this.Canvas.strokeStyle=this.UnchagneColor;//平线
2916
2916
  if(this.ColorData)///五彩K线颜色设置
2917
2917
  {if(i<this.ColorData.length)upColor=downColor=unchagneColor=this.ColorData[i]>0?this.UpColor:this.DownColor;else upColor=downColor=unchagneColor=this.DownColor;}this.Canvas.beginPath();//最高-最低
2918
- if(isHScreen){this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow,ToFixedPoint(x));}else{this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow);}this.Canvas.stroke();if(dataWidth>=4){this.Canvas.beginPath();//开盘
2918
+ if(isHScreen){if(data.High==data.Low&&dataWidth<4){this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow-1,ToFixedPoint(x));}else{this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow,ToFixedPoint(x));}}else{if(data.High==data.Low&&dataWidth<4){this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow+1);}else{this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow);}}this.Canvas.stroke();if(dataWidth>=4){this.Canvas.beginPath();//开盘
2919
2919
  if(isHScreen){this.Canvas.moveTo(ToFixedPoint(yOpen),left);this.Canvas.lineTo(ToFixedPoint(yOpen),x);}else{this.Canvas.moveTo(left,ToFixedPoint(yOpen));this.Canvas.lineTo(x,ToFixedPoint(yOpen));}this.Canvas.stroke();this.Canvas.beginPath();//收盘
2920
2920
  if(isHScreen){this.Canvas.moveTo(ToFixedPoint(yClose),right);this.Canvas.lineTo(ToFixedPoint(yClose),x);}else{this.Canvas.moveTo(right,ToFixedPoint(yClose));this.Canvas.lineTo(x,ToFixedPoint(yClose));}this.Canvas.stroke();}if(this.Data.DataType==0){var infoItem={Xleft:left,XRight:right,YMax:yHigh,XCenter:x,YMin:yLow,DayData:data,Index:j};this.DrawInfo(infoItem);}}this.PtMax=ptMax;this.PtMin=ptMin;};this.DrawCloseArea=function()//收盘价面积图
2921
2921
  {var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var xPointCount=this.ChartFrame.XPointCount;if(isHScreen){var border=this.ChartBorder.GetHScreenBorder();var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.BottomEx;var borderLeft=border.TopEx;}else{var border=this.ChartBorder.GetBorder();var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;var borderLeft=border.LeftEx;}var bFirstPoint=true;var firstPoint=null;this.Canvas.beginPath();this.Canvas.strokeStyle=this.CloseLineColor;if(IFrameSplitOperator.IsNumber(this.CloseLineWidth))this.Canvas.lineWidth=this.CloseLineWidth;var ptLast=null;if(this.Data.DataOffset>0)//把最左边的一个点连上
@@ -2950,7 +2950,7 @@ else this.Canvas.fillRect(ToFixedRect(y),ToFixedRect(left),ToFixedRect(yClose-y)
2950
2950
  {this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(ToFixedPoint(y),ToFixedPoint(x));this.Canvas.lineTo(ToFixedPoint(yLow),ToFixedPoint(x));}else{if(isEmptyBar){var xFixed=left+dataWidth/2;this.Canvas.moveTo(ToFixedPoint(xFixed),ToFixedPoint(Math.max(yClose,yOpen)));this.Canvas.lineTo(ToFixedPoint(xFixed),ToFixedPoint(yLow));}else{this.Canvas.moveTo(ToFixedPoint(x),ToFixedPoint(y));this.Canvas.lineTo(ToFixedPoint(x),ToFixedPoint(yLow));}}this.Canvas.stroke();}}else{this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow,ToFixedPoint(x));}else{this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow);}this.Canvas.strokeStyle=downColor;this.Canvas.stroke();}};this.DrawKBar_Unchagne=function(data,dataWidth,unchagneColor,drawType,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen)//平线
2951
2951
  {if(dataWidth>=4){if(dataWidth%2!=0)dataWidth-=1;this.Canvas.strokeStyle=unchagneColor;this.Canvas.beginPath();if(data.High>data.Close)//上影线
2952
2952
  {if(isHScreen){this.Canvas.moveTo(y,ToFixedPoint(x));this.Canvas.lineTo(yOpen,ToFixedPoint(x));}else{var xFixed=ToFixedPoint(left+dataWidth/2);this.Canvas.moveTo(xFixed,y);this.Canvas.lineTo(xFixed,yOpen);}y=yOpen;}else{y=yOpen;}if(isHScreen){this.Canvas.moveTo(ToFixedPoint(y),ToFixedPoint(left));this.Canvas.lineTo(ToFixedPoint(y),ToFixedPoint(right));}else{this.Canvas.moveTo(ToFixedPoint(left),ToFixedPoint(y));this.Canvas.lineTo(ToFixedPoint(left+dataWidth),ToFixedPoint(y));}if(data.Open>data.Low)//下影线
2953
- {if(isHScreen){this.Canvas.moveTo(ToFixedPoint(y),ToFixedPoint(x));this.Canvas.lineTo(ToFixedPoint(yLow),ToFixedPoint(x));}else{var xFixed=ToFixedPoint(left+dataWidth/2);this.Canvas.moveTo(xFixed,ToFixedPoint(y));this.Canvas.lineTo(xFixed,ToFixedPoint(yLow));}}this.Canvas.stroke();}else{this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow,ToFixedPoint(x));}else{this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow);}this.Canvas.strokeStyle=unchagneColor;this.Canvas.stroke();}};this.DrawKBar_Custom=function(data,dataWidth,barColor,drawType,option,x,y,left,right,yLow,yHigh,yOpen,yClose,border,isHScreen){if(option.BGColor)//画背景色
2953
+ {if(isHScreen){this.Canvas.moveTo(ToFixedPoint(y),ToFixedPoint(x));this.Canvas.lineTo(ToFixedPoint(yLow),ToFixedPoint(x));}else{var xFixed=ToFixedPoint(left+dataWidth/2);this.Canvas.moveTo(xFixed,ToFixedPoint(y));this.Canvas.lineTo(xFixed,ToFixedPoint(yLow));}}this.Canvas.stroke();}else{this.Canvas.beginPath();if(isHScreen){if(data.High==data.Low){this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow-1,ToFixedPoint(x));}else{this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow,ToFixedPoint(x));}}else{if(data.High==data.Low){this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow+1);}else{this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow);}}this.Canvas.strokeStyle=unchagneColor;this.Canvas.stroke();}};this.DrawKBar_Custom=function(data,dataWidth,barColor,drawType,option,x,y,left,right,yLow,yHigh,yOpen,yClose,border,isHScreen){if(option.BGColor)//画背景色
2954
2954
  {this.Canvas.fillStyle=option.BGColor;var distanceWidth=this.ChartFrame.DistanceWidth;if(isHScreen){var yLeft=left-distanceWidth/2;var yRight=right+distanceWidth/2;var xTop=border.RightEx;var xBottom=border.LeftEx;this.Canvas.fillRect(ToFixedRect(xBottom),ToFixedRect(yLeft),ToFixedRect(xTop-xBottom),ToFixedRect(yRight-yLeft));}else{var xLeft=left-distanceWidth/2;var xRight=right+distanceWidth/2;var yTop=border.TopEx;var yBottom=border.BottomEx;this.Canvas.fillRect(ToFixedRect(xLeft),ToFixedRect(yTop),ToFixedRect(xRight-xLeft),ToFixedRect(yBottom-yTop));}}if(dataWidth>=4){this.Canvas.strokeStyle=barColor;if(data.High>data.Close)//上影线
2955
2955
  {this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(ToFixedPoint(y),ToFixedPoint(x));this.Canvas.lineTo(ToFixedPoint(drawType==3?Math.max(yClose,yOpen):yClose),ToFixedPoint(x));}else{this.Canvas.moveTo(ToFixedPoint(x),ToFixedPoint(y));this.Canvas.lineTo(ToFixedPoint(x),ToFixedPoint(drawType==3?Math.min(yClose,yOpen):yClose));}this.Canvas.stroke();y=yClose;}else{y=yClose;}this.Canvas.fillStyle=barColor;if(isHScreen){if(Math.abs(yOpen-y)<1){this.Canvas.fillRect(ToFixedRect(y),ToFixedRect(left),1,ToFixedRect(dataWidth));//高度小于1,统一使用高度1
2956
2956
  }else{if(drawType==3)//空心柱
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "hqchart",
3
3
  "description": "stock chart",
4
4
  "author": "jones2000",
5
- "version": "1.1.11291",
5
+ "version": "1.1.11295",
6
6
  "main": "lib/main.js",
7
7
  "private": false,
8
8
  "license": "Apache License 2.0",
@@ -22347,13 +22347,29 @@ function ChartKLine()
22347
22347
  this.Canvas.beginPath(); //最高-最低
22348
22348
  if (isHScreen)
22349
22349
  {
22350
- this.Canvas.moveTo(yHigh,ToFixedPoint(x));
22351
- this.Canvas.lineTo(yLow,ToFixedPoint(x));
22350
+ if (data.High==data.Low && dataWidth<4)
22351
+ {
22352
+ this.Canvas.moveTo(yHigh,ToFixedPoint(x));
22353
+ this.Canvas.lineTo(yLow-1,ToFixedPoint(x));
22354
+ }
22355
+ else
22356
+ {
22357
+ this.Canvas.moveTo(yHigh,ToFixedPoint(x));
22358
+ this.Canvas.lineTo(yLow,ToFixedPoint(x));
22359
+ }
22352
22360
  }
22353
22361
  else
22354
22362
  {
22355
- this.Canvas.moveTo(ToFixedPoint(x),yHigh);
22356
- this.Canvas.lineTo(ToFixedPoint(x),yLow);
22363
+ if (data.High==data.Low && dataWidth<4)
22364
+ {
22365
+ this.Canvas.moveTo(ToFixedPoint(x),yHigh);
22366
+ this.Canvas.lineTo(ToFixedPoint(x),yLow+1);
22367
+ }
22368
+ else
22369
+ {
22370
+ this.Canvas.moveTo(ToFixedPoint(x),yHigh);
22371
+ this.Canvas.lineTo(ToFixedPoint(x),yLow);
22372
+ }
22357
22373
  }
22358
22374
 
22359
22375
  this.Canvas.stroke();
@@ -23032,13 +23048,29 @@ function ChartKLine()
23032
23048
  this.Canvas.beginPath();
23033
23049
  if (isHScreen)
23034
23050
  {
23035
- this.Canvas.moveTo(yHigh,ToFixedPoint(x));
23036
- this.Canvas.lineTo(yLow,ToFixedPoint(x));
23051
+ if (data.High==data.Low)
23052
+ {
23053
+ this.Canvas.moveTo(yHigh,ToFixedPoint(x));
23054
+ this.Canvas.lineTo(yLow-1,ToFixedPoint(x));
23055
+ }
23056
+ else
23057
+ {
23058
+ this.Canvas.moveTo(yHigh,ToFixedPoint(x));
23059
+ this.Canvas.lineTo(yLow,ToFixedPoint(x));
23060
+ }
23037
23061
  }
23038
23062
  else
23039
23063
  {
23040
- this.Canvas.moveTo(ToFixedPoint(x),yHigh);
23041
- this.Canvas.lineTo(ToFixedPoint(x),yLow);
23064
+ if (data.High==data.Low)
23065
+ {
23066
+ this.Canvas.moveTo(ToFixedPoint(x),yHigh);
23067
+ this.Canvas.lineTo(ToFixedPoint(x),yLow+1);
23068
+ }
23069
+ else
23070
+ {
23071
+ this.Canvas.moveTo(ToFixedPoint(x),yHigh);
23072
+ this.Canvas.lineTo(ToFixedPoint(x),yLow);
23073
+ }
23042
23074
  }
23043
23075
  this.Canvas.strokeStyle=unchagneColor;
23044
23076
  this.Canvas.stroke();
@@ -22391,13 +22391,29 @@ function ChartKLine()
22391
22391
  this.Canvas.beginPath(); //最高-最低
22392
22392
  if (isHScreen)
22393
22393
  {
22394
- this.Canvas.moveTo(yHigh,ToFixedPoint(x));
22395
- this.Canvas.lineTo(yLow,ToFixedPoint(x));
22394
+ if (data.High==data.Low && dataWidth<4)
22395
+ {
22396
+ this.Canvas.moveTo(yHigh,ToFixedPoint(x));
22397
+ this.Canvas.lineTo(yLow-1,ToFixedPoint(x));
22398
+ }
22399
+ else
22400
+ {
22401
+ this.Canvas.moveTo(yHigh,ToFixedPoint(x));
22402
+ this.Canvas.lineTo(yLow,ToFixedPoint(x));
22403
+ }
22396
22404
  }
22397
22405
  else
22398
22406
  {
22399
- this.Canvas.moveTo(ToFixedPoint(x),yHigh);
22400
- this.Canvas.lineTo(ToFixedPoint(x),yLow);
22407
+ if (data.High==data.Low && dataWidth<4)
22408
+ {
22409
+ this.Canvas.moveTo(ToFixedPoint(x),yHigh);
22410
+ this.Canvas.lineTo(ToFixedPoint(x),yLow+1);
22411
+ }
22412
+ else
22413
+ {
22414
+ this.Canvas.moveTo(ToFixedPoint(x),yHigh);
22415
+ this.Canvas.lineTo(ToFixedPoint(x),yLow);
22416
+ }
22401
22417
  }
22402
22418
 
22403
22419
  this.Canvas.stroke();
@@ -23076,13 +23092,29 @@ function ChartKLine()
23076
23092
  this.Canvas.beginPath();
23077
23093
  if (isHScreen)
23078
23094
  {
23079
- this.Canvas.moveTo(yHigh,ToFixedPoint(x));
23080
- this.Canvas.lineTo(yLow,ToFixedPoint(x));
23095
+ if (data.High==data.Low)
23096
+ {
23097
+ this.Canvas.moveTo(yHigh,ToFixedPoint(x));
23098
+ this.Canvas.lineTo(yLow-1,ToFixedPoint(x));
23099
+ }
23100
+ else
23101
+ {
23102
+ this.Canvas.moveTo(yHigh,ToFixedPoint(x));
23103
+ this.Canvas.lineTo(yLow,ToFixedPoint(x));
23104
+ }
23081
23105
  }
23082
23106
  else
23083
23107
  {
23084
- this.Canvas.moveTo(ToFixedPoint(x),yHigh);
23085
- this.Canvas.lineTo(ToFixedPoint(x),yLow);
23108
+ if (data.High==data.Low)
23109
+ {
23110
+ this.Canvas.moveTo(ToFixedPoint(x),yHigh);
23111
+ this.Canvas.lineTo(ToFixedPoint(x),yLow+1);
23112
+ }
23113
+ else
23114
+ {
23115
+ this.Canvas.moveTo(ToFixedPoint(x),yHigh);
23116
+ this.Canvas.lineTo(ToFixedPoint(x),yLow);
23117
+ }
23086
23118
  }
23087
23119
  this.Canvas.strokeStyle=unchagneColor;
23088
23120
  this.Canvas.stroke();