hqchart 1.1.13933 → 1.1.13944

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.13933",
3
+ "version": "1.1.13944",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -42,6 +42,8 @@ function JSDialogTooltip()
42
42
 
43
43
  this.KItemCache=null;
44
44
  this.KItemCacheID=null;
45
+ this.LastValueCache=null; //最后的鼠标位置对应的数值
46
+ this.LastValueCacheID=null;
45
47
 
46
48
  this.Inital=function(hqchart, option)
47
49
  {
@@ -206,10 +208,23 @@ function JSDialogTooltip()
206
208
  if (this.HQChart.ClassName=='KLineChartContainer')
207
209
  {
208
210
  var strKItem=JSON.stringify(data.KItem);
211
+ var strLastValue=JSON.stringify(data.LastValue);
212
+ var bUpdata=false;
209
213
  if (this.KItemCacheID!=strKItem) //数据变动的才更新
210
214
  {
211
215
  this.KItemCache= JSON.parse(strKItem);
212
216
  this.KItemCacheID=strKItem;
217
+ bUpdata=true;
218
+ }
219
+ if (data.LastValue && data.LastValue.Y && IFrameSplitOperator.IsNumber(data.LastValue.Y.Value) && this.LastValueCacheID!=strLastValue)
220
+ {
221
+ this.LastValueCache=JSON.parse(strLastValue);
222
+ this.LastValueCacheID=strLastValue;
223
+ bUpdata=true;
224
+ }
225
+
226
+ if (bUpdata)
227
+ {
213
228
  this.UpdateTableDOM();
214
229
  }
215
230
  else
@@ -220,10 +235,23 @@ function JSDialogTooltip()
220
235
  else if (this.HQChart.ClassName=='MinuteChartContainer')
221
236
  {
222
237
  var strKItem=JSON.stringify(data.MinItem);
238
+ var strLastValue=JSON.stringify(data.LastValue);
239
+ var bUpdata=false;
223
240
  if (this.KItemCacheID!=strKItem) //数据变动的才更新
224
241
  {
225
242
  this.KItemCache= JSON.parse(strKItem);
226
243
  this.KItemCacheID=strKItem;
244
+ bUpdata=true;
245
+ }
246
+ if (data.LastValue && data.LastValue.Y && IFrameSplitOperator.IsNumber(data.LastValue.Y.Value) && this.LastValueCacheID!=strLastValue)
247
+ {
248
+ this.LastValueCache=JSON.parse(strLastValue);
249
+ this.LastValueCacheID=strLastValue;
250
+ bUpdata=true;
251
+ }
252
+
253
+ if (bUpdata)
254
+ {
227
255
  this.UpdateTableDOM();
228
256
  }
229
257
  }
@@ -372,6 +400,22 @@ function JSDialogTooltip()
372
400
  this.FormatAmplitude(data.High,data.Low,yClose,defaultfloatPrecision,'DialogTooltip-Amplitude',priceFormat),
373
401
  ];
374
402
 
403
+ if (this.LastValueCache && this.LastValueCache.Y)
404
+ {
405
+ var item=this.LastValueCache.Y;
406
+ var rowItem=null;
407
+ if (item.Extend.FrameID==0)
408
+ {
409
+ rowItem=this.ForamtPrice(item.Value,null, defaultfloatPrecision,'DialogTooltip-Value',2);
410
+ }
411
+ else
412
+ {
413
+ rowItem=this.ForamtValue(item.Value, 2,'DialogTooltip-Value');
414
+ }
415
+
416
+ if (rowItem) aryText.unshift(rowItem);
417
+ }
418
+
375
419
  if (this.Style==1)
376
420
  {
377
421
  if (timeItem) aryText.unshift(timeItem);
@@ -420,14 +464,31 @@ function JSDialogTooltip()
420
464
 
421
465
  aryText=
422
466
  [
423
- this.ForamtDate(item.Date,this.Style==1?"YYYY/MM/DD":"YYYY/MM/DD/W",'DialogTooltip-Date' ),
467
+ this.ForamtDate(item.Date,this.Style==1?"MM/DD/W":"YYYY/MM/DD/W",'DialogTooltip-Date' ),
424
468
  this.FormatTime(item.Time, null, "HH:MM", 'DialogTooltip-Time'),
425
469
  this.ForamtPrice(item.Close,item.YClose, defaultfloatPrecision,'DialogTooltip-Price', 1),
470
+ this.ForamtPrice(item.AvPrice,item.YClose, defaultfloatPrecision,'DialogTooltip-AvPrice', 1),
426
471
  this.FormatRisefall(item.Close,item.YClose, defaultfloatPrecision,'DialogTooltip-Risefall'),
427
472
  this.FormatIncrease(item.Close,item.YClose,defaultfloatPrecision,'DialogTooltip-Increase', 1),
428
473
  this.FormatVol(item.Vol,'DialogTooltip-Vol' ),
429
474
  this.FormatAmount(item.Amount,'DialogTooltip-Amount' ),
430
475
  ];
476
+
477
+ if (this.LastValueCache && this.LastValueCache.Y)
478
+ {
479
+ var item=this.LastValueCache.Y;
480
+ var rowItem=null;
481
+ if (item.Extend.FrameID==0)
482
+ {
483
+ rowItem=this.ForamtPrice(item.Value,null, defaultfloatPrecision,'DialogTooltip-Value',2);
484
+ }
485
+ else
486
+ {
487
+ rowItem=this.ForamtValue(item.Value, 2,'DialogTooltip-Value');
488
+ }
489
+
490
+ if (rowItem) aryText.splice(2,0,rowItem);
491
+ }
431
492
  }
432
493
  else if (data.Type==1) //集合竞价
433
494
  {
@@ -438,7 +499,7 @@ function JSDialogTooltip()
438
499
  if (item.Ver===1) timeForamt="HH:MM"
439
500
  aryText=
440
501
  [
441
- this.ForamtDate(item.Date,this.Style==1?"YYYY/MM/DD":"YYYY/MM/DD/W",'DialogTooltip-Date' ),
502
+ this.ForamtDate(item.Date,this.Style==1?"MM/DD/W":"YYYY/MM/DD/W",'DialogTooltip-Date' ),
442
503
  this.FormatTime(item.Time, null, timeForamt, 'DialogTooltip-Time'),
443
504
  this.ForamtPrice(item.Price,item.YClose, defaultfloatPrecision,'DialogTooltip-AC-Price',1),
444
505
  this.FormatIncrease(item.Price,item.YClose,defaultfloatPrecision,'DialogTooltip-AC-Increase',1),
@@ -510,7 +571,7 @@ function JSDialogTooltip()
510
571
 
511
572
 
512
573
  /////////////////////////////////////////////////////////////////////////////////////////////
513
- //数据格式化
574
+ //数据格式化 format=0 点差+涨幅 1=涨幅
514
575
  this.ForamtPrice=function(price, yClose, defaultfloatPrecision, TitleID, format)
515
576
  {
516
577
  var item=
@@ -522,6 +583,13 @@ function JSDialogTooltip()
522
583
 
523
584
  if (!IFrameSplitOperator.IsNumber(price)) return item;
524
585
 
586
+ if (format==2)
587
+ {
588
+ item.Text=price.toFixed(defaultfloatPrecision);
589
+ item.Color=this.TitleColor;
590
+ return item;
591
+ }
592
+
525
593
  if (IFrameSplitOperator.IsNumber(yClose) && format!=1)
526
594
  {
527
595
  var value=(price-yClose)/yClose*100;
@@ -538,6 +606,21 @@ function JSDialogTooltip()
538
606
  return item;
539
607
  }
540
608
 
609
+ this.ForamtValue=function(value, defaultfloatPrecision, TitleID)
610
+ {
611
+ var item=
612
+ {
613
+ Title:g_JSChartLocalization.GetText(TitleID,this.LanguageID),
614
+ Text:'--',
615
+ Color:this.TitleColor
616
+ };
617
+
618
+ if (!IFrameSplitOperator.IsNumber(value)) return item;
619
+
620
+ item.Text=IFrameSplitOperator.FormatValueStringV2(value,defaultfloatPrecision,2,this.LanguageID);
621
+ return item;
622
+ }
623
+
541
624
  this.FormatVol=function(vol, TitleID)
542
625
  {
543
626
  var item=
@@ -50821,6 +50821,7 @@ function ChartCorssCursor()
50821
50821
  this.XRangeBGColor=g_JSChartResource.CorssCursorXRangeBGColor;
50822
50822
  this.TextHeight=20; //文本字体高度
50823
50823
  this.LastPoint;
50824
+ this.LastValue; //{ Y:{ Value:, Extend: } }
50824
50825
  this.CursorIndex;
50825
50826
  this.IsOnlyDrawKLine=false; //是否只能画在K线上 (手机端)
50826
50827
  this.IsOnlyDrawMinute=false; //是否只能画在走势图价格线上
@@ -51052,6 +51053,7 @@ function ChartCorssCursor()
51052
51053
  {
51053
51054
  this.Status=0;
51054
51055
  this.RightButton.Rect=null;
51056
+ this.LastValue=null;
51055
51057
 
51056
51058
  if (!this.LastPoint) return;
51057
51059
 
@@ -51204,6 +51206,8 @@ function ChartCorssCursor()
51204
51206
  var yValue=this.Frame.GetYData(y,yValueExtend);
51205
51207
  if ( (this.IsOnlyDrawMinute || this.IsShowClose) && this.Close != null) yValue=this.Close;
51206
51208
 
51209
+ this.LastValue={ Y:{ Value:yValue, Extend:yValueExtend }}; //缓存十字光标对应的数值
51210
+
51207
51211
  //this.StringFormatX.Value=xValue;
51208
51212
  this.StringFormatX.Value=this.CursorIndex;
51209
51213
  this.StringFormatX.Point={X:x, Y:y};
@@ -71090,12 +71094,14 @@ function JSChartLocalization()
71090
71094
  ['DialogTooltip-Exchange', {CN:'换手率', EN:'Exchange', TC:'換手'}],
71091
71095
  ['DialogTooltip-Position', {CN:'持仓量', EN:'Position', TC:'持倉'}],
71092
71096
  ['DialogTooltip-Price', {CN:'价格', EN:'Price', TC:'價格'}],
71097
+ ['DialogTooltip-AvPrice', {CN:'均价', EN:'AVPrice:', TC:'均價'}],
71093
71098
  ['DialogTooltip-FClose', {CN:"结算价", EN:'Settlement', TC:'結算價'}],
71094
71099
  ['DialogTooltip-Amplitude', {CN:'振幅', EN:'amplitude', TC:'價格'}],
71095
71100
  ['DialogTooltip-AC-Price', {CN:'匹配价', EN:'Price', TC:'匹配價'}],
71096
71101
  ['DialogTooltip-AC-AvPrice', {CN:'匹配均价', EN:'AVPrice', TC:'匹配均價'}],
71097
71102
  ['DialogTooltip-AC-Increase', {CN:'竞价涨幅', EN:'Increase', TC:'競價漲幅'}],
71098
71103
  ['DialogTooltip-AC-Vol', {CN:'匹配量', EN:'Vol', TC:'匹配量'}],
71104
+ ['DialogTooltip-Value', {CN:'数值', EN:'Value', TC:'数值'}],
71099
71105
 
71100
71106
  //走势图PC tooltip
71101
71107
  ['PCTooltip-Date', {CN:'日期', EN:'Date', TC:"日期"}],
@@ -79420,6 +79426,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
79420
79426
  IsShowCorss:this.ChartCorssCursor.IsShowCorss, //是否显示十字线
79421
79427
  KItem:kItem,
79422
79428
  Symbol:this.Symbol, Name:this.Name,
79429
+ LastValue:this.ChartCorssCursor.LastValue,
79423
79430
  };
79424
79431
 
79425
79432
 
@@ -80886,11 +80893,38 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
80886
80893
  this.MouseDrag=drag;
80887
80894
  this.PhoneTouchInfo={ Start:{X:touches[0].clientX, Y:touches[0].clientY }, End:{ X:touches[0].clientX, Y:touches[0].clientY } };
80888
80895
  this.SelectChartDrawPicture=null;
80896
+
80897
+ var bStartTimer=true; //长按计时开始
80898
+ if (this.EnableClickModel)
80899
+ {
80900
+ if (this.ClickModel.IsShowCorssCursor==true) bStartTimer=false;
80901
+ else bStartTimer= true;
80902
+ }
80903
+
80904
+ if (bStartTimer)
80905
+ {
80906
+ this.StopDragTimer();
80907
+ this.DragTimer = setTimeout(()=>{
80908
+ this.IsPress=true;
80909
+ if (drag.Click.X == drag.LastMove.X && drag.Click.Y == drag.LastMove.Y) //手指没有移动,出现十字光标
80910
+ {
80911
+ this.MouseDrag = null;
80912
+ //移动十字光标
80913
+ var x = drag.Click.X;
80914
+ var y = drag.Click.Y;
80915
+ if (this.EnableClickModel===true) this.ClickModel.IsShowCorssCursor=true;
80916
+ self.MoveCorssCursor(drag.Click,e);//移动十字光标
80917
+ }
80889
80918
 
80890
- if (this.EnableScrollUpDown==false)
80891
- T_ShowCorssCursor(); //移动十字光标
80892
- else if (this.IsClickShowCorssCursor)
80893
- T_ShowCorssCursor();
80919
+ }, this.PressTime);
80920
+ }
80921
+ else if (!this.EnableClickModel)
80922
+ {
80923
+ if (this.EnableScrollUpDown==false)
80924
+ T_ShowCorssCursor(); //移动十字光标
80925
+ else if (this.IsClickShowCorssCursor)
80926
+ T_ShowCorssCursor();
80927
+ }
80894
80928
  }
80895
80929
 
80896
80930
  if (this.EnableZoomIndexWindow)
@@ -84604,6 +84638,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84604
84638
 
84605
84639
  this.OnTouchFinished=function()
84606
84640
  {
84641
+ if (this.EnableClickModel===true)
84642
+ {
84643
+ if (this.ClickModel.IsShowCorssCursor==true && this.TouchDrawCount>0) return;
84644
+
84645
+ this.ClickModel.IsShowCorssCursor=false;
84646
+ this.DrawDynamicInfo();
84647
+ return;
84648
+ }
84649
+
84607
84650
  if (this.CorssCursorTouchEnd===true) //手势离开十字光标消失
84608
84651
  {
84609
84652
  this.DrawDynamicInfo();
@@ -85232,6 +85275,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
85232
85275
  IsShowCorss:this.ChartCorssCursor.IsShowCorss, //是否显示十字线
85233
85276
  MinItem:minuteItem,
85234
85277
  Symbol:this.Symbol, Name:this.Name,
85278
+ LastValue:this.ChartCorssCursor.LastValue,
85235
85279
  };
85236
85280
 
85237
85281
 
@@ -54746,6 +54746,7 @@ function ChartCorssCursor()
54746
54746
  this.XRangeBGColor=g_JSChartResource.CorssCursorXRangeBGColor;
54747
54747
  this.TextHeight=20; //文本字体高度
54748
54748
  this.LastPoint;
54749
+ this.LastValue; //{ Y:{ Value:, Extend: } }
54749
54750
  this.CursorIndex;
54750
54751
  this.IsOnlyDrawKLine=false; //是否只能画在K线上 (手机端)
54751
54752
  this.IsOnlyDrawMinute=false; //是否只能画在走势图价格线上
@@ -54977,6 +54978,7 @@ function ChartCorssCursor()
54977
54978
  {
54978
54979
  this.Status=0;
54979
54980
  this.RightButton.Rect=null;
54981
+ this.LastValue=null;
54980
54982
 
54981
54983
  if (!this.LastPoint) return;
54982
54984
 
@@ -55129,6 +55131,8 @@ function ChartCorssCursor()
55129
55131
  var yValue=this.Frame.GetYData(y,yValueExtend);
55130
55132
  if ( (this.IsOnlyDrawMinute || this.IsShowClose) && this.Close != null) yValue=this.Close;
55131
55133
 
55134
+ this.LastValue={ Y:{ Value:yValue, Extend:yValueExtend }}; //缓存十字光标对应的数值
55135
+
55132
55136
  //this.StringFormatX.Value=xValue;
55133
55137
  this.StringFormatX.Value=this.CursorIndex;
55134
55138
  this.StringFormatX.Point={X:x, Y:y};
@@ -75015,12 +75019,14 @@ function JSChartLocalization()
75015
75019
  ['DialogTooltip-Exchange', {CN:'换手率', EN:'Exchange', TC:'換手'}],
75016
75020
  ['DialogTooltip-Position', {CN:'持仓量', EN:'Position', TC:'持倉'}],
75017
75021
  ['DialogTooltip-Price', {CN:'价格', EN:'Price', TC:'價格'}],
75022
+ ['DialogTooltip-AvPrice', {CN:'均价', EN:'AVPrice:', TC:'均價'}],
75018
75023
  ['DialogTooltip-FClose', {CN:"结算价", EN:'Settlement', TC:'結算價'}],
75019
75024
  ['DialogTooltip-Amplitude', {CN:'振幅', EN:'amplitude', TC:'價格'}],
75020
75025
  ['DialogTooltip-AC-Price', {CN:'匹配价', EN:'Price', TC:'匹配價'}],
75021
75026
  ['DialogTooltip-AC-AvPrice', {CN:'匹配均价', EN:'AVPrice', TC:'匹配均價'}],
75022
75027
  ['DialogTooltip-AC-Increase', {CN:'竞价涨幅', EN:'Increase', TC:'競價漲幅'}],
75023
75028
  ['DialogTooltip-AC-Vol', {CN:'匹配量', EN:'Vol', TC:'匹配量'}],
75029
+ ['DialogTooltip-Value', {CN:'数值', EN:'Value', TC:'数值'}],
75024
75030
 
75025
75031
  //走势图PC tooltip
75026
75032
  ['PCTooltip-Date', {CN:'日期', EN:'Date', TC:"日期"}],
@@ -83345,6 +83351,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
83345
83351
  IsShowCorss:this.ChartCorssCursor.IsShowCorss, //是否显示十字线
83346
83352
  KItem:kItem,
83347
83353
  Symbol:this.Symbol, Name:this.Name,
83354
+ LastValue:this.ChartCorssCursor.LastValue,
83348
83355
  };
83349
83356
 
83350
83357
 
@@ -84811,11 +84818,38 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
84811
84818
  this.MouseDrag=drag;
84812
84819
  this.PhoneTouchInfo={ Start:{X:touches[0].clientX, Y:touches[0].clientY }, End:{ X:touches[0].clientX, Y:touches[0].clientY } };
84813
84820
  this.SelectChartDrawPicture=null;
84821
+
84822
+ var bStartTimer=true; //长按计时开始
84823
+ if (this.EnableClickModel)
84824
+ {
84825
+ if (this.ClickModel.IsShowCorssCursor==true) bStartTimer=false;
84826
+ else bStartTimer= true;
84827
+ }
84828
+
84829
+ if (bStartTimer)
84830
+ {
84831
+ this.StopDragTimer();
84832
+ this.DragTimer = setTimeout(()=>{
84833
+ this.IsPress=true;
84834
+ if (drag.Click.X == drag.LastMove.X && drag.Click.Y == drag.LastMove.Y) //手指没有移动,出现十字光标
84835
+ {
84836
+ this.MouseDrag = null;
84837
+ //移动十字光标
84838
+ var x = drag.Click.X;
84839
+ var y = drag.Click.Y;
84840
+ if (this.EnableClickModel===true) this.ClickModel.IsShowCorssCursor=true;
84841
+ self.MoveCorssCursor(drag.Click,e);//移动十字光标
84842
+ }
84814
84843
 
84815
- if (this.EnableScrollUpDown==false)
84816
- T_ShowCorssCursor(); //移动十字光标
84817
- else if (this.IsClickShowCorssCursor)
84818
- T_ShowCorssCursor();
84844
+ }, this.PressTime);
84845
+ }
84846
+ else if (!this.EnableClickModel)
84847
+ {
84848
+ if (this.EnableScrollUpDown==false)
84849
+ T_ShowCorssCursor(); //移动十字光标
84850
+ else if (this.IsClickShowCorssCursor)
84851
+ T_ShowCorssCursor();
84852
+ }
84819
84853
  }
84820
84854
 
84821
84855
  if (this.EnableZoomIndexWindow)
@@ -88529,6 +88563,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
88529
88563
 
88530
88564
  this.OnTouchFinished=function()
88531
88565
  {
88566
+ if (this.EnableClickModel===true)
88567
+ {
88568
+ if (this.ClickModel.IsShowCorssCursor==true && this.TouchDrawCount>0) return;
88569
+
88570
+ this.ClickModel.IsShowCorssCursor=false;
88571
+ this.DrawDynamicInfo();
88572
+ return;
88573
+ }
88574
+
88532
88575
  if (this.CorssCursorTouchEnd===true) //手势离开十字光标消失
88533
88576
  {
88534
88577
  this.DrawDynamicInfo();
@@ -89157,6 +89200,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
89157
89200
  IsShowCorss:this.ChartCorssCursor.IsShowCorss, //是否显示十字线
89158
89201
  MinItem:minuteItem,
89159
89202
  Symbol:this.Symbol, Name:this.Name,
89203
+ LastValue:this.ChartCorssCursor.LastValue,
89160
89204
  };
89161
89205
 
89162
89206
 
@@ -139040,7 +139084,7 @@ function ScrollBarBGChart()
139040
139084
 
139041
139085
 
139042
139086
 
139043
- var HQCHART_VERSION="1.1.13932";
139087
+ var HQCHART_VERSION="1.1.13943";
139044
139088
 
139045
139089
  function PrintHQChartVersion()
139046
139090
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13932";
8
+ var HQCHART_VERSION="1.1.13943";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {