hqchart 1.1.13385 → 1.1.13395

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13385",
3
+ "version": "1.1.13395",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -10456,6 +10456,11 @@ function JSDraw(errorHandler,symbolData)
10456
10456
  return color;
10457
10457
  }
10458
10458
 
10459
+ this.STICKTYPE=function(value)
10460
+ {
10461
+ return value;
10462
+ }
10463
+
10459
10464
  //数据左右偏移
10460
10465
  this.XMOVE=function(offset)
10461
10466
  {
@@ -17211,7 +17216,7 @@ function JSExecute(ast,option)
17211
17216
  {
17212
17217
  let varName;
17213
17218
  let draw;
17214
- let color, upColor, downColor;
17219
+ let color, upColor, downColor, stickType;
17215
17220
  let lineWidth;
17216
17221
  let colorStick=false;
17217
17222
  let pointDot=false;
@@ -17356,6 +17361,10 @@ function JSExecute(ast,option)
17356
17361
  {
17357
17362
  downColor=itemExpression.Out;
17358
17363
  }
17364
+ else if (itemExpression.Callee.Name=="STICKTYPE")
17365
+ {
17366
+ stickType=itemExpression.Out;
17367
+ }
17359
17368
  else if (itemExpression.Callee.Name=="XMOVE")
17360
17369
  {
17361
17370
  xOffset=itemExpression.Out;
@@ -17496,6 +17505,7 @@ function JSExecute(ast,option)
17496
17505
  if (upColor) value.UpColor=upColor;
17497
17506
  if (downColor) value.DownColor=downColor;
17498
17507
  if (lineWidth) value.LineWidth=lineWidth;
17508
+ if (IFrameSplitOperator.IsNumber(stickType)) value.StickType=stickType;
17499
17509
  this.OutVarTable.push(value);
17500
17510
  }
17501
17511
  else if (lineArea && varName) //LINEAREA 面积
@@ -18030,6 +18040,9 @@ function JSExecute(ast,option)
18030
18040
  case "DOWNCOLOR":
18031
18041
  node.Out=this.Draw.DOWNCOLOR(args[0]);
18032
18042
  break;
18043
+ case "STICKTYPE": //柱子类型
18044
+ node.Out=this.Draw.STICKTYPE(args[0]);
18045
+ break;
18033
18046
  case "XMOVE":
18034
18047
  node.Out=this.Draw.XMOVE(args[0]);
18035
18048
  break;
@@ -19183,6 +19196,7 @@ function JSExplainer(ast,option)
19183
19196
  return `上涨颜色${args[0]}`;
19184
19197
  case "DOWNCOLOR":
19185
19198
  return `下跌颜色${args[0]}`;
19199
+ case "STICKTYPE":
19186
19200
  case "FIRSTDRAW":
19187
19201
  return "";
19188
19202
 
@@ -20711,6 +20725,7 @@ function ScriptIndex(name,script,args,option)
20711
20725
 
20712
20726
  if (varItem.UpColor) chart.UpColor=varItem.UpColor;
20713
20727
  if (varItem.DownColor) chart.DownColor=varItem.DownColor;
20728
+ if (IFrameSplitOperator.IsNumber(varItem.StickType)) chart.BarType=varItem.StickType;
20714
20729
  if (varItem.LineWidth)
20715
20730
  {
20716
20731
  let width=parseInt(varItem.LineWidth.replace("LINETHICK",""));
@@ -22622,6 +22637,7 @@ function OverlayScriptIndex(name,script,args,option)
22622
22637
 
22623
22638
  if (varItem.UpColor) chart.UpColor=varItem.UpColor;
22624
22639
  if (varItem.DownColor) chart.DownColor=varItem.DownColor;
22640
+ if (IFrameSplitOperator.IsNumber(varItem.StickType)) chart.BarType=varItem.StickType;
22625
22641
  if (varItem.LineWidth)
22626
22642
  {
22627
22643
  let width=parseInt(varItem.LineWidth.replace("LINETHICK",""));
@@ -79,7 +79,7 @@ function JSIndexScript()
79
79
  ['BOLL', this.BOLL],['BOLL副图', this.BOLL2],['BBI', this.BBI],
80
80
  ['DKX', this.DKX],['MIKE', this.MIKE],['PBX', this.PBX],
81
81
  ['ENE', this.ENE],['MACD', this.MACD],['KDJ', this.KDJ],["MACD2", this.MACD2],
82
- ['VOL', this.VOL],["VOL_OVERLAY", this.VOL_OVERLAY], ['RSI', this.RSI],['BRAR', this.BRAR],
82
+ ['VOL', this.VOL],['VOL2', this.VOL2],["VOL_OVERLAY", this.VOL_OVERLAY], ['RSI', this.RSI],['BRAR', this.BRAR],
83
83
  ['WR', this.WR],['BIAS', this.BIAS],['OBV', this.OBV],
84
84
  ['DMI', this.DMI],['CR', this.CR],['PSY', this.PSY],
85
85
  ['CCI', this.CCI],['DMA', this.DMA],['TRIX', this.TRIX],
@@ -643,6 +643,23 @@ MA2:MA(VOL,M2);'
643
643
  return data;
644
644
  }
645
645
 
646
+ JSIndexScript.prototype.VOL2=function()
647
+ {
648
+ let data=
649
+ {
650
+ Name:'VOL', Description:'成交量', IsMainIndex:false,FloatPrecision:0,
651
+ Args:[ { Name:'M1', Value:5}, { Name:'M2', Value:10} ],
652
+ OutName:[ {Name:'MA1',DynamicName:"MA{M1}" }, {Name:'MA2',DynamicName:"MA{M2}" }],
653
+ Script: //脚本
654
+ 'VOL:VOL,VOLSTICK,STICKTYPE(1);\n\
655
+ MA1:MA(VOL,M1);\n\
656
+ MA2:MA(VOL,M2);'
657
+
658
+ };
659
+
660
+ return data;
661
+ }
662
+
646
663
  JSIndexScript.prototype.VOL_OVERLAY=function()
647
664
  {
648
665
  let data=
@@ -3371,6 +3371,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3371
3371
 
3372
3372
  if (this.TryClickButton(x,y,e))
3373
3373
  {
3374
+ this.IsOnTouch=false;
3374
3375
  return;
3375
3376
  }
3376
3377
 
@@ -3403,11 +3404,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3403
3404
 
3404
3405
  if (this.TryClickCrossCursor(x,y, e))
3405
3406
  {
3407
+ this.IsOnTouch=false;
3406
3408
  return;
3407
3409
  }
3408
3410
 
3409
3411
  if (this.TryClickChartTooltipData && this.TryClickChartTooltipData(x,y,e)) //预留给外部点击图标什么用的
3410
3412
  {
3413
+ this.IsOnTouch=false;
3411
3414
  return;
3412
3415
  }
3413
3416
 
@@ -7794,6 +7797,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7794
7797
 
7795
7798
  if (this.Frame && this.Frame.SetLanguage) this.Frame.SetLanguage(this.LanguageID);
7796
7799
 
7800
+ //this.Frame.ClearYCoordinateMaxMin();
7801
+ this.ResetFrameXYSplit();
7797
7802
  this.Frame.SetSizeChage(true);
7798
7803
  this.Draw();
7799
7804
  }
@@ -23479,6 +23484,7 @@ function ChartKLine()
23479
23484
  // 15=HLC Area
23480
23485
  // 16=kagi
23481
23486
  // 17=订单流样式4
23487
+ // 18=订单流样式5
23482
23488
 
23483
23489
  this.CloseLineColor=g_JSChartResource.CloseLineColor;
23484
23490
  this.CloseLineAreaColor=g_JSChartResource.CloseLineAreaColor;
@@ -25141,200 +25147,7 @@ function ChartKLine()
25141
25147
  }
25142
25148
  }
25143
25149
 
25144
- /*
25145
- this.DrawKBarV2=function(data, colorData, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen)
25146
- {
25147
- var isDrawBorder=false;
25148
- var isEmptyBar=false;
25149
- if (colorData.border) isDrawBorder=true;
25150
- if (colorData.Type===0) isEmptyBar=true;
25151
-
25152
- if (dataWidth>=4)
25153
- {
25154
- if (isDrawBorder)
25155
- {
25156
- if ((dataWidth%2)!=0) dataWidth-=1;
25157
- }
25158
-
25159
- if (data.High>data.Close) //上影线
25160
- {
25161
- if (colorData.Line)
25162
- {
25163
- this.Canvas.strokeStyle=colorData.Line.Color;
25164
- this.Canvas.beginPath();
25165
- if (isHScreen)
25166
- {
25167
- this.Canvas.moveTo(ToFixedPoint(y),ToFixedPoint(x));
25168
- this.Canvas.lineTo(ToFixedPoint(Math.max(yClose,yOpen)),ToFixedPoint(x));
25169
- }
25170
- else
25171
- {
25172
- if (isDrawBorder)
25173
- {
25174
- var xFixed=left+dataWidth/2;
25175
- this.Canvas.moveTo(ToFixedPoint(xFixed),ToFixedPoint(y));
25176
- this.Canvas.lineTo(ToFixedPoint(xFixed),ToFixedPoint(Math.min(yClose,yOpen)));
25177
- }
25178
- else
25179
- {
25180
- this.Canvas.moveTo(ToFixedPoint(x),ToFixedPoint(y));
25181
- this.Canvas.lineTo(ToFixedPoint(x),ToFixedPoint(Math.min(yClose,yOpen)));
25182
- }
25183
- }
25184
- this.Canvas.stroke();
25185
- }
25186
-
25187
- y=yClose;
25188
- }
25189
- else
25190
- {
25191
- y=yClose;
25192
- }
25193
-
25194
- if (isHScreen)
25195
- {
25196
- //实心
25197
- if (!isEmptyBar && colorData.BarColor)
25198
- {
25199
- this.Canvas.fillStyle=colorData.BarColor;
25200
- if (Math.abs(yOpen-y)<1)
25201
- {
25202
- this.Canvas.fillRect(ToFixedRect(y),ToFixedRect(left),1,ToFixedRect(dataWidth)); //高度小于1,统一使用高度1
25203
- }
25204
- else
25205
- {
25206
- this.Canvas.fillRect(ToFixedRect(y),ToFixedRect(left),ToFixedRect(yOpen-y),ToFixedRect(dataWidth));
25207
- }
25208
- }
25209
-
25210
- if (colorData.Border) //空心
25211
- {
25212
- if (Math.abs(yOpen-y)<1)
25213
- {
25214
- this.Canvas.fillStyle=colorData.Border.Color;
25215
- this.Canvas.fillRect(ToFixedRect(y),ToFixedRect(left),1,ToFixedRect(dataWidth)); //高度小于1,统一使用高度1
25216
- }
25217
- else
25218
- {
25219
- this.Canvas.strokeStyle=colorData.Border.Color;
25220
- this.Canvas.beginPath();
25221
- this.Canvas.rect(ToFixedPoint(y),ToFixedPoint(left),ToFixedRect(yOpen-y),ToFixedRect(dataWidth));
25222
- this.Canvas.stroke();
25223
- }
25224
- }
25225
- }
25226
- else
25227
- {
25228
-
25229
- //实心
25230
- if (!isEmptyBar && colorData.BarColor)
25231
- {
25232
- this.Canvas.fillStyle=colorData.BarColor;
25233
- if (Math.abs(yOpen-y)<1)
25234
- {
25235
- this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(y),ToFixedRect(dataWidth),1); //高度小于1,统一使用高度1
25236
- }
25237
- else
25238
- {
25239
- this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,yOpen)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(yOpen-y)));
25240
- }
25241
- }
25242
-
25243
- if (colorData.Border) //空心
25244
- {
25245
- if (Math.abs(yOpen-y)<1)
25246
- {
25247
- this.Canvas.fillStyle=colorData.Border.Color;
25248
- this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(y),ToFixedRect(dataWidth),1); //高度小于1,统一使用高度1
25249
- }
25250
- else
25251
- {
25252
- this.Canvas.strokeStyle=colorData.Border.Color;
25253
- this.Canvas.beginPath();
25254
- this.Canvas.rect(ToFixedPoint(left),ToFixedPoint(y),ToFixedRect(dataWidth),ToFixedRect(yOpen-y));
25255
- this.Canvas.stroke();
25256
- }
25257
- }
25258
- }
25259
-
25260
- if (data.Open>data.Low) //下影线
25261
- {
25262
- if (colorData.Line)
25263
- {
25264
- this.Canvas.strokeStyle=colorData.Line.Color;
25265
- this.Canvas.beginPath();
25266
- if (isHScreen)
25267
- {
25268
- this.Canvas.moveTo(ToFixedPoint(Math.min(yClose,yOpen)),ToFixedPoint(x));
25269
- this.Canvas.lineTo(ToFixedPoint(yLow),ToFixedPoint(x));
25270
- }
25271
- else
25272
- {
25273
- if (isDrawBorder)
25274
- {
25275
- var xFixed=left+dataWidth/2;
25276
- this.Canvas.moveTo(ToFixedPoint(xFixed),ToFixedPoint(Math.max(yClose,yOpen)));
25277
- this.Canvas.lineTo(ToFixedPoint(xFixed),ToFixedPoint(yLow));
25278
- }
25279
- else
25280
- {
25281
- this.Canvas.moveTo(ToFixedPoint(x),ToFixedPoint(Math.max(yClose,yOpen)));
25282
- this.Canvas.lineTo(ToFixedPoint(x),ToFixedPoint(yLow));
25283
- }
25284
- }
25285
- this.Canvas.stroke();
25286
- }
25287
- }
25288
- }
25289
- else
25290
- {
25291
- var lineColor;
25292
- if (isEmptyBar && colorData.Border)
25293
- {
25294
- lineColor=colorData.Border.Color;
25295
- }
25296
- else if (!isEmptyBar && colorData.BarColor)
25297
- {
25298
- lineColor=colorData.BarColor;
25299
- }
25300
-
25301
- if (lineColor)
25302
- {
25303
- this.Canvas.strokeStyle=lineColor;
25304
- this.Canvas.beginPath();
25305
- if (isHScreen)
25306
- {
25307
- if (data.High==data.Low)
25308
- {
25309
- this.Canvas.moveTo(yHigh,ToFixedPoint(x));
25310
- this.Canvas.lineTo(yLow-1,ToFixedPoint(x));
25311
- }
25312
- else
25313
- {
25314
- this.Canvas.moveTo(yHigh,ToFixedPoint(x));
25315
- this.Canvas.lineTo(yLow,ToFixedPoint(x));
25316
- }
25317
- }
25318
- else
25319
- {
25320
- if (data.High==data.Low)
25321
- {
25322
- this.Canvas.moveTo(ToFixedPoint(x),yHigh);
25323
- this.Canvas.lineTo(ToFixedPoint(x),yLow+1);
25324
- }
25325
- else
25326
- {
25327
- this.Canvas.moveTo(ToFixedPoint(x),yHigh);
25328
- this.Canvas.lineTo(ToFixedPoint(x),yLow);
25329
- }
25330
-
25331
- }
25332
- this.Canvas.stroke();
25333
- }
25334
- }
25335
- }
25336
- */
25337
-
25150
+
25338
25151
  this.DrawVirtualBar=function(data, dataWidth, x, y, left, right, yLow, yHigh, yOpen, yClose, isHScreen)
25339
25152
  {
25340
25153
  var yTop=Math.min(yHigh,yLow), yBottom=Math.max(yHigh,yLow);
@@ -26290,6 +26103,10 @@ function ChartKLine()
26290
26103
  {
26291
26104
  this.DrawOrderFlow_Style4();
26292
26105
  }
26106
+ else if (this.DrawType==18)
26107
+ {
26108
+ this.DrawOrderFlow_Style5();
26109
+ }
26293
26110
  else
26294
26111
  {
26295
26112
  this.DrawKBar();
@@ -27969,6 +27786,13 @@ function ChartKLine()
27969
27786
  }
27970
27787
  }
27971
27788
 
27789
+ ////////////////////////////////////////////////////////////////////////////////
27790
+ //订单流样式5
27791
+ this.DrawOrderFlow_Style5=function()
27792
+ {
27793
+
27794
+ }
27795
+
27972
27796
  //////////////////////////////////////////////////////////////
27973
27797
  // high low bar
27974
27798
  //
@@ -31778,10 +31602,11 @@ function ChartVolStick()
31778
31602
  this.DownColor=g_JSChartResource.DownBarColor;
31779
31603
  this.HistoryData; //历史数据
31780
31604
  this.KLineDrawType=0;
31605
+
31781
31606
  this.ClassName='ChartVolStick';
31782
31607
 
31783
- this.BarWidth; //固定宽度 目前只支持宽度为1
31784
-
31608
+ this.BarWidth; //固定宽度 目前只支持宽度为1
31609
+ this.BarType; //柱子状态 1=实心 0=空心 2=涨实跌空 如果设置了这个属性, 属性KLineDrawType无效
31785
31610
  this.PtInChart=this.PtInBar;
31786
31611
  this.DrawSelectedStatus=this.DrawLinePoint;
31787
31612
 
@@ -31828,28 +31653,24 @@ function ChartVolStick()
31828
31653
  var y=this.ChartFrame.GetYFromData(value);
31829
31654
  var barColor=this.GetBarColor(kItem);
31830
31655
  var bUp=barColor.IsUp;
31831
- this.Canvas.fillStyle=barColor.Color;
31656
+
31832
31657
 
31833
31658
  var height=ToFixedRect(Math.abs(yBottom-y)>=1?yBottom-y:1);//高度调整为整数, 如果小于1, 统一使用1
31834
31659
  y=yBottom-height;
31835
- if (this.KLineDrawType==6) //完全空心柱
31660
+ var bSolidBar=this.IsSolidBar(bUp); //实心柱子
31661
+
31662
+ if (bSolidBar)
31836
31663
  {
31837
- this.Canvas.strokeStyle=barColor.Color;
31838
- this.Canvas.beginPath();
31839
- this.Canvas.rect(ToFixedPoint(left),ToFixedPoint(y),ToFixedRect(dataWidth),height);
31840
- this.Canvas.stroke();
31664
+ this.Canvas.fillStyle=barColor.Color;
31665
+ this.Canvas.fillRect(ToFixedRect(left),y,ToFixedRect(dataWidth),height);
31841
31666
  }
31842
- else if (bUp && (this.KLineDrawType==1 || this.KLineDrawType==2 || this.KLineDrawType==3)) //空心柱子
31667
+ else
31843
31668
  {
31844
- this.Canvas.strokeStyle=this.UpColor;
31669
+ this.Canvas.strokeStyle=barColor.Color;
31845
31670
  this.Canvas.beginPath();
31846
31671
  this.Canvas.rect(ToFixedPoint(left),ToFixedPoint(y),ToFixedRect(dataWidth),height);
31847
31672
  this.Canvas.stroke();
31848
31673
  }
31849
- else
31850
- {
31851
- this.Canvas.fillRect(ToFixedRect(left),y,ToFixedRect(dataWidth),height);
31852
- }
31853
31674
  }
31854
31675
  }
31855
31676
  else //太细了直接话线
@@ -31922,19 +31743,21 @@ function ChartVolStick()
31922
31743
  var y=this.ChartFrame.GetYFromData(value);
31923
31744
  var barColor=this.GetBarColor(kItem);
31924
31745
  var bUp=barColor.IsUp;
31925
- this.Canvas.fillStyle=barColor.Color;
31926
31746
 
31927
31747
  var height=ToFixedRect(y-yBottom); //高度调整为整数
31928
- if (bUp && (this.KLineDrawType==1 || this.KLineDrawType==2 || this.KLineDrawType==3)) //空心柱子
31748
+ var bSolidBar=this.IsSolidBar(bUp); //实心柱子
31749
+
31750
+ if (bSolidBar)
31929
31751
  {
31930
- this.Canvas.strokeStyle=this.UpColor;
31931
- this.Canvas.beginPath();
31932
- this.Canvas.rect(ToFixedPoint(yBottom),ToFixedPoint(left),height,ToFixedRect(dataWidth));
31933
- this.Canvas.stroke();
31752
+ this.Canvas.fillStyle=barColor.Color;
31753
+ this.Canvas.fillRect(yBottom,ToFixedRect(left),height,ToFixedRect(dataWidth));
31934
31754
  }
31935
31755
  else
31936
31756
  {
31937
- this.Canvas.fillRect(yBottom,ToFixedRect(left),height,ToFixedRect(dataWidth));
31757
+ this.Canvas.strokeStyle=barColor.Color;
31758
+ this.Canvas.beginPath();
31759
+ this.Canvas.rect(ToFixedPoint(yBottom),ToFixedPoint(left),height,ToFixedRect(dataWidth));
31760
+ this.Canvas.stroke();
31938
31761
  }
31939
31762
  }
31940
31763
  }
@@ -32010,6 +31833,29 @@ function ChartVolStick()
32010
31833
  else return { Color:this.DownColor, IsUp:false };
32011
31834
  }
32012
31835
 
31836
+ //true=实心 false=空心
31837
+ this.IsSolidBar=function(bUp)
31838
+ {
31839
+ var bSolidBar=true; //实心柱子
31840
+
31841
+ if (this.BarType===0 || this.BarType===1 || this.BarType===2)
31842
+ {
31843
+ if (this.BarType===0) //空心
31844
+ bSolidBar=false;
31845
+ else if (this.BarType===2) //涨实跌空
31846
+ bSolidBar=bUp;
31847
+ }
31848
+ else
31849
+ {
31850
+ if (this.KLineDrawType==6) //完全空心柱
31851
+ bSolidBar=false;
31852
+ else if (bUp && (this.KLineDrawType==1 || this.KLineDrawType==2 || this.KLineDrawType==3)) //空心柱子
31853
+ bSolidBar=false;
31854
+ }
31855
+
31856
+ return bSolidBar;
31857
+ }
31858
+
32013
31859
  this.GetMinuteBarColor=function(kItem, preItem)
32014
31860
  {
32015
31861
  var prePrice=kItem.YClose;