hqchart 1.1.15446 → 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.15446",
3
+ "version": "1.1.15451",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -165,10 +165,38 @@ function JSPopMinuteChart()
165
165
  {
166
166
  data.Request.Data.date=this.Date;
167
167
  data.Name="MinuteChartContainer::RequestPopMinuteData";
168
- data.Explain="指定日期分时数据"
169
- };
168
+ data.Explain="指定日期分时数据";
169
+ this.HQChart.NetworkFilter(data, (recv)=>{ this.OnRecvPopMinuteData(recv, callback); });
170
+ }
171
+ else
172
+ {
173
+ this.HQChart.NetworkFilter(data, callback);
174
+ }
175
+ }
170
176
 
171
- this.HQChart.NetworkFilter(data, callback);
177
+ this.OnRecvPopMinuteData=function(recv, callback)
178
+ {
179
+ var bUpdateTitle=false;
180
+ if (recv && IFrameSplitOperator.IsNonEmptyArray(recv.stock))
181
+ {
182
+ var stockItem=recv.stock[0];
183
+ if (stockItem)
184
+ {
185
+ if (stockItem.Title)
186
+ {
187
+ this.Name=stockItem.Title;
188
+ bUpdateTitle=true;
189
+ }
190
+ else if (stockItem.name)
191
+ {
192
+ this.Name=stockItem.name;
193
+ bUpdateTitle=true;
194
+ }
195
+ }
196
+ }
197
+
198
+ if (bUpdateTitle) this.UpdateDialogTitle();
199
+ callback(recv);
172
200
  }
173
201
 
174
202
  this.OnCreateHQChart=function(chart)
@@ -750,26 +778,52 @@ function JSTooltipMinuteChart()
750
778
  }
751
779
  else if (data.Rect)
752
780
  {
753
- var rtCell=data.Rect;
754
- var pixelRatio=GetDevicePixelRatio();
755
- var rtItem={ Left:rtCell.Left/pixelRatio, Right:rtCell.Right/pixelRatio, Bottom:rtCell.Bottom/pixelRatio, Top:rtCell.Top/pixelRatio };
756
- rtItem.Width=rtItem.Right-rtItem.Left;
757
- rtItem.Height=rtItem.Bottom-rtItem.Top;
758
-
759
- //超出窗口调整位置
760
- var height=this.DivDialog.offsetHeight;
761
- var width=this.DivDialog.offsetWidth;
762
- var x=rtItem.Right+data.Offset.Left;
763
- var y=rtItem.Bottom+data.Offset.Top;
764
-
765
- var xRight=window.innerWidth-5;
766
- var ybottom=window.innerHeight-5;
767
- if (x+width>xRight) x=(rtItem.Left+data.Offset.Left)-width;
768
- if (y+height>ybottom) y=(rtItem.Top+data.Offset.Top)-height;
769
-
770
- this.DivDialog.style.visibility='visible';
771
- this.DivDialog.style.top = y + "px";
772
- 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
+ }
773
827
  }
774
828
  }
775
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)
@@ -544,6 +624,44 @@ function JSStatusBarChartContainer(uielement)
544
624
 
545
625
  if (option && option.Redraw) this.Draw();
546
626
  }
627
+
628
+ this.GetStatusBarChart=function()
629
+ {
630
+ var chart=this.ChartPaint[0];
631
+ if (!chart) return null;
632
+
633
+ return chart;
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
+
547
665
  }
548
666
 
549
667
  function JSStatusBarFrame()
@@ -788,6 +906,7 @@ function ChartStatusBarStockData()
788
906
  if (!item || !item.Symbol) continue;
789
907
 
790
908
  var rtCell={ Left:itemPos.Left, Top:itemPos.Top, Bottom:itemPos.Bottom, Right:itemPos.Left };
909
+ if (i>0) rtCell.Left-=config.Separator.Right;
791
910
  this.DrawCellItem(item, itemPos );
792
911
  if (itemPos.CellCount>0)
793
912
  {
@@ -1047,7 +1166,7 @@ function ChartStatusBarStockData()
1047
1166
  {
1048
1167
  tooltip.Data=item;
1049
1168
  tooltip.ChartPaint=this;
1050
- tooltip.Type=21;
1169
+ tooltip.Type=121;
1051
1170
  return true;
1052
1171
  }
1053
1172
  }
@@ -1059,7 +1178,7 @@ function ChartStatusBarStockData()
1059
1178
  {
1060
1179
  tooltip.Data=item;
1061
1180
  tooltip.ChartPaint=this;
1062
- tooltip.Type=22;
1181
+ tooltip.Type=122;
1063
1182
  return true;
1064
1183
  }
1065
1184
  }
@@ -1067,3 +1186,9 @@ function ChartStatusBarStockData()
1067
1186
  return false;
1068
1187
  }
1069
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.15445";
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.15445";
8
+ var HQCHART_VERSION="1.1.15450";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {