hqchart 1.1.15449 → 1.1.15451

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.15449",
3
+ "version": "1.1.15451",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -778,26 +778,52 @@ function JSTooltipMinuteChart()
778
778
  }
779
779
  else if (data.Rect)
780
780
  {
781
- var rtCell=data.Rect;
782
- var pixelRatio=GetDevicePixelRatio();
783
- var rtItem={ Left:rtCell.Left/pixelRatio, Right:rtCell.Right/pixelRatio, Bottom:rtCell.Bottom/pixelRatio, Top:rtCell.Top/pixelRatio };
784
- rtItem.Width=rtItem.Right-rtItem.Left;
785
- rtItem.Height=rtItem.Bottom-rtItem.Top;
786
-
787
- //超出窗口调整位置
788
- var height=this.DivDialog.offsetHeight;
789
- var width=this.DivDialog.offsetWidth;
790
- var x=rtItem.Right+data.Offset.Left;
791
- var y=rtItem.Bottom+data.Offset.Top;
792
-
793
- var xRight=window.innerWidth-5;
794
- var ybottom=window.innerHeight-5;
795
- if (x+width>xRight) x=(rtItem.Left+data.Offset.Left)-width;
796
- if (y+height>ybottom) y=(rtItem.Top+data.Offset.Top)-height;
797
-
798
- this.DivDialog.style.visibility='visible';
799
- this.DivDialog.style.top = y + "px";
800
- this.DivDialog.style.left = x + "px";
781
+ if (data.Position===1) //上左位置
782
+ {
783
+ var rtCell=data.Rect;
784
+ var pixelRatio=GetDevicePixelRatio();
785
+ var rtItem={ Left:rtCell.Left/pixelRatio, Right:rtCell.Right/pixelRatio, Bottom:rtCell.Bottom/pixelRatio, Top:rtCell.Top/pixelRatio };
786
+ rtItem.Width=rtItem.Right-rtItem.Left;
787
+ rtItem.Height=rtItem.Bottom-rtItem.Top;
788
+
789
+ //超出窗口调整位置
790
+ var height=this.DivDialog.offsetHeight;
791
+ var width=this.DivDialog.offsetWidth;
792
+ var x=rtItem.Left+data.Offset.Left;
793
+ var y=rtItem.Top+data.Offset.Top;
794
+
795
+ var xRight=window.innerWidth-5;
796
+ var ybottom=window.innerHeight-5;
797
+ if (x+width>xRight) x=(rtItem.Left+data.Offset.Left)-width;
798
+ if (y+height>ybottom) y=(rtItem.Top+data.Offset.Top)-height;
799
+
800
+ this.DivDialog.style.visibility='visible';
801
+ this.DivDialog.style.top = y + "px";
802
+ this.DivDialog.style.left = x + "px";
803
+ }
804
+ else
805
+ {
806
+ var rtCell=data.Rect;
807
+ var pixelRatio=GetDevicePixelRatio();
808
+ var rtItem={ Left:rtCell.Left/pixelRatio, Right:rtCell.Right/pixelRatio, Bottom:rtCell.Bottom/pixelRatio, Top:rtCell.Top/pixelRatio };
809
+ rtItem.Width=rtItem.Right-rtItem.Left;
810
+ rtItem.Height=rtItem.Bottom-rtItem.Top;
811
+
812
+ //超出窗口调整位置
813
+ var height=this.DivDialog.offsetHeight;
814
+ var width=this.DivDialog.offsetWidth;
815
+ var x=rtItem.Right+data.Offset.Left;
816
+ var y=rtItem.Bottom+data.Offset.Top;
817
+
818
+ var xRight=window.innerWidth-5;
819
+ var ybottom=window.innerHeight-5;
820
+ if (x+width>xRight) x=(rtItem.Left+data.Offset.Left)-width;
821
+ if (y+height>ybottom) y=(rtItem.Top+data.Offset.Top)-height;
822
+
823
+ this.DivDialog.style.visibility='visible';
824
+ this.DivDialog.style.top = y + "px";
825
+ this.DivDialog.style.left = x + "px";
826
+ }
801
827
  }
802
828
  }
803
829
 
@@ -73,6 +73,8 @@ function JSStatusBarChart(divElement)
73
73
 
74
74
  if (option.EnableResize==true) this.CreateResizeListener();
75
75
 
76
+ if (option.MinuteChartTooltip && option.MinuteChartTooltip.Enable) chart.InitalMinuteChartTooltip(option.MinuteChartTooltip);
77
+
76
78
  chart.Draw();
77
79
  chart.RequestData();
78
80
  }
@@ -222,6 +224,8 @@ function JSStatusBarChartContainer(uielement)
222
224
 
223
225
  this.ToolbarTimer=null;
224
226
 
227
+ this.TooltipMinuteChart; //分时图
228
+
225
229
  this.UIElement=uielement;
226
230
 
227
231
  this.IsDestroy=false; //是否已经销毁了
@@ -236,6 +240,25 @@ function JSStatusBarChartContainer(uielement)
236
240
  clearInterval(this.ToolbarTimer);
237
241
  this.ToolbarTimer=null;
238
242
  }
243
+
244
+ this.DestroyMinuteChartTooltip();
245
+ }
246
+
247
+ this.InitalMinuteChartTooltip=function(option)
248
+ {
249
+ if (this.TooltipMinuteChart) return;
250
+
251
+ this.TooltipMinuteChart=new JSTooltipMinuteChart();
252
+ this.TooltipMinuteChart.Inital(this, option);
253
+ this.TooltipMinuteChart.Create();
254
+ }
255
+
256
+ this.DestroyMinuteChartTooltip=function()
257
+ {
258
+ if (!this.TooltipMinuteChart) return;
259
+
260
+ this.TooltipMinuteChart.Destroy();
261
+ this.TooltipMinuteChart=null;
239
262
  }
240
263
 
241
264
  //设置事件回调
@@ -412,12 +435,14 @@ function JSStatusBarChartContainer(uielement)
412
435
  }
413
436
 
414
437
  this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
438
+ this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e); }
439
+ this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
415
440
 
416
441
  /*
417
442
  this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
418
443
  this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
419
- this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
420
- this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
444
+
445
+
421
446
  this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
422
447
  this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
423
448
  */
@@ -440,6 +465,59 @@ function JSStatusBarChartContainer(uielement)
440
465
  this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STATUSBAR_ITEM, ptClick, e);
441
466
  }
442
467
 
468
+ this.GetChartTooltipData=function(x,y,option)
469
+ {
470
+ var toolTip=new TooltipData();
471
+ for(var i=0;i<this.ChartPaint.length;++i)
472
+ {
473
+ var item=this.ChartPaint[i];
474
+ if (item.GetTooltipData(x,y,toolTip))
475
+ {
476
+ return toolTip;
477
+ }
478
+ }
479
+
480
+ return null;
481
+ }
482
+
483
+ this.UIOnMouseMove=function(e)
484
+ {
485
+ var pixelTatio = GetDevicePixelRatio();
486
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
487
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
488
+
489
+ //var bShowKLineTooltip=false;
490
+ var bShowMinuteTooltip=false;
491
+ var chartTooltipData=null;
492
+ var tooltipData=this.GetChartTooltipData(x,y);
493
+
494
+ if (tooltipData)
495
+ {
496
+ if (tooltipData.Type==121)
497
+ {
498
+ var item=tooltipData.Data;
499
+ if (item && item.Data && item.Data.Symbol)
500
+ {
501
+ bShowMinuteTooltip=true;
502
+ chartTooltipData={ Symbol:item.Data.Symbol, Rect:item.Rect, Position:1 };
503
+ }
504
+ }
505
+ }
506
+
507
+ //if (!bShowKLineTooltip) this.HideKLineChartTooltip();
508
+ if (!bShowMinuteTooltip) this.HideMinuteChartTooltip();
509
+
510
+ if (bShowMinuteTooltip) this.ShowMinuteChartTooltip(null, null, chartTooltipData);
511
+ //if (bShowKLineTooltip) this.ShowKLineChartTooltip(null, null, chartTooltipData);
512
+ }
513
+
514
+ this.UIOnMounseOut=function(e)
515
+ {
516
+ this.HideAllTooltip();
517
+ }
518
+
519
+
520
+
443
521
  this.TryClickPaintEvent=function(eventID, ptClick, e)
444
522
  {
445
523
  var event=this.GetEventCallback(eventID);
@@ -521,6 +599,8 @@ function JSStatusBarChartContainer(uielement)
521
599
  this.SetSizeChange(true);
522
600
  this.Draw();
523
601
  }
602
+
603
+ if (this.TooltipMinuteChart) this.TooltipMinuteChart.ReloadResource(option); //分时图
524
604
  }
525
605
 
526
606
  this.SetColumn=function(aryColunm, option)
@@ -552,6 +632,36 @@ function JSStatusBarChartContainer(uielement)
552
632
 
553
633
  return chart;
554
634
  }
635
+
636
+ //data={ Symbol }
637
+ this.ShowMinuteChartTooltip=function(x,y, data)
638
+ {
639
+ if (!this.TooltipMinuteChart) return;
640
+
641
+ var rtClient=this.UIElement.getBoundingClientRect();
642
+ var rtScroll=GetScrollPosition();
643
+
644
+ var offsetLeft=rtClient.left+rtScroll.Left;
645
+ var offsetTop=rtClient.top+rtScroll.Top;
646
+
647
+ data.Offset={ Left:offsetLeft, Top:offsetTop };
648
+
649
+ this.TooltipMinuteChart.Show(data, x,y);
650
+ }
651
+
652
+ this.HideMinuteChartTooltip=function()
653
+ {
654
+ if (!this.TooltipMinuteChart) return;
655
+
656
+ this.TooltipMinuteChart.Hide();
657
+ }
658
+
659
+ this.HideAllTooltip=function()
660
+ {
661
+ //this.HideKLineChartTooltip();
662
+ this.HideMinuteChartTooltip();
663
+ }
664
+
555
665
  }
556
666
 
557
667
  function JSStatusBarFrame()
@@ -796,6 +906,7 @@ function ChartStatusBarStockData()
796
906
  if (!item || !item.Symbol) continue;
797
907
 
798
908
  var rtCell={ Left:itemPos.Left, Top:itemPos.Top, Bottom:itemPos.Bottom, Right:itemPos.Left };
909
+ if (i>0) rtCell.Left-=config.Separator.Right;
799
910
  this.DrawCellItem(item, itemPos );
800
911
  if (itemPos.CellCount>0)
801
912
  {
@@ -1055,7 +1166,7 @@ function ChartStatusBarStockData()
1055
1166
  {
1056
1167
  tooltip.Data=item;
1057
1168
  tooltip.ChartPaint=this;
1058
- tooltip.Type=21;
1169
+ tooltip.Type=121;
1059
1170
  return true;
1060
1171
  }
1061
1172
  }
@@ -1067,7 +1178,7 @@ function ChartStatusBarStockData()
1067
1178
  {
1068
1179
  tooltip.Data=item;
1069
1180
  tooltip.ChartPaint=this;
1070
- tooltip.Type=22;
1181
+ tooltip.Type=122;
1071
1182
  return true;
1072
1183
  }
1073
1184
  }
@@ -1075,3 +1186,9 @@ function ChartStatusBarStockData()
1075
1186
  return false;
1076
1187
  }
1077
1188
  }
1189
+
1190
+
1191
+
1192
+
1193
+
1194
+
@@ -156514,7 +156514,7 @@ function ScrollBarBGChart()
156514
156514
 
156515
156515
 
156516
156516
 
156517
- var HQCHART_VERSION="1.1.15448";
156517
+ var HQCHART_VERSION="1.1.15450";
156518
156518
 
156519
156519
  function PrintHQChartVersion()
156520
156520
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.15448";
8
+ var HQCHART_VERSION="1.1.15450";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {