hqchart 1.1.15449 → 1.1.15455

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.15455",
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,14 +435,17 @@ 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); }
440
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
415
441
 
416
442
  /*
417
443
  this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
418
444
  this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
419
- this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
420
- this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
445
+
446
+
421
447
  this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
422
- this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
448
+
423
449
  */
424
450
 
425
451
  var frequency=500;
@@ -436,10 +462,76 @@ function JSStatusBarChartContainer(uielement)
436
462
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
437
463
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
438
464
 
439
- var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
440
- this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STATUSBAR_ITEM, ptClick, e);
465
+ if (e && e.button==0) //左键点击
466
+ {
467
+ var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
468
+ this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STATUSBAR_ITEM, ptClick, e);
469
+ }
470
+ }
471
+
472
+ this.UIOnContextMenu=function(e)
473
+ {
474
+ if (e) //去掉系统右键菜单
475
+ {
476
+ if (e.preventDefault) e.preventDefault();
477
+ if (e.stopPropagation) e.stopPropagation();
478
+ e.returnValue=false;
479
+ }
480
+ }
481
+
482
+ this.GetChartTooltipData=function(x,y,option)
483
+ {
484
+ var toolTip=new TooltipData();
485
+ for(var i=0;i<this.ChartPaint.length;++i)
486
+ {
487
+ var item=this.ChartPaint[i];
488
+ if (item.GetTooltipData(x,y,toolTip))
489
+ {
490
+ return toolTip;
491
+ }
492
+ }
493
+
494
+ return null;
495
+ }
496
+
497
+ this.UIOnMouseMove=function(e)
498
+ {
499
+ var pixelTatio = GetDevicePixelRatio();
500
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
501
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
502
+
503
+ //var bShowKLineTooltip=false;
504
+ var bShowMinuteTooltip=false;
505
+ var chartTooltipData=null;
506
+ var tooltipData=this.GetChartTooltipData(x,y);
507
+
508
+ if (tooltipData)
509
+ {
510
+ if (tooltipData.Type==121)
511
+ {
512
+ var item=tooltipData.Data;
513
+ if (item && item.Data && item.Data.Symbol)
514
+ {
515
+ bShowMinuteTooltip=true;
516
+ chartTooltipData={ Symbol:item.Data.Symbol, Rect:item.Rect, Position:1 };
517
+ }
518
+ }
519
+ }
520
+
521
+ //if (!bShowKLineTooltip) this.HideKLineChartTooltip();
522
+ if (!bShowMinuteTooltip) this.HideMinuteChartTooltip();
523
+
524
+ if (bShowMinuteTooltip) this.ShowMinuteChartTooltip(null, null, chartTooltipData);
525
+ //if (bShowKLineTooltip) this.ShowKLineChartTooltip(null, null, chartTooltipData);
526
+ }
527
+
528
+ this.UIOnMounseOut=function(e)
529
+ {
530
+ this.HideAllTooltip();
441
531
  }
442
532
 
533
+
534
+
443
535
  this.TryClickPaintEvent=function(eventID, ptClick, e)
444
536
  {
445
537
  var event=this.GetEventCallback(eventID);
@@ -521,6 +613,8 @@ function JSStatusBarChartContainer(uielement)
521
613
  this.SetSizeChange(true);
522
614
  this.Draw();
523
615
  }
616
+
617
+ if (this.TooltipMinuteChart) this.TooltipMinuteChart.ReloadResource(option); //分时图
524
618
  }
525
619
 
526
620
  this.SetColumn=function(aryColunm, option)
@@ -552,6 +646,36 @@ function JSStatusBarChartContainer(uielement)
552
646
 
553
647
  return chart;
554
648
  }
649
+
650
+ //data={ Symbol }
651
+ this.ShowMinuteChartTooltip=function(x,y, data)
652
+ {
653
+ if (!this.TooltipMinuteChart) return;
654
+
655
+ var rtClient=this.UIElement.getBoundingClientRect();
656
+ var rtScroll=GetScrollPosition();
657
+
658
+ var offsetLeft=rtClient.left+rtScroll.Left;
659
+ var offsetTop=rtClient.top+rtScroll.Top;
660
+
661
+ data.Offset={ Left:offsetLeft, Top:offsetTop };
662
+
663
+ this.TooltipMinuteChart.Show(data, x,y);
664
+ }
665
+
666
+ this.HideMinuteChartTooltip=function()
667
+ {
668
+ if (!this.TooltipMinuteChart) return;
669
+
670
+ this.TooltipMinuteChart.Hide();
671
+ }
672
+
673
+ this.HideAllTooltip=function()
674
+ {
675
+ //this.HideKLineChartTooltip();
676
+ this.HideMinuteChartTooltip();
677
+ }
678
+
555
679
  }
556
680
 
557
681
  function JSStatusBarFrame()
@@ -796,6 +920,7 @@ function ChartStatusBarStockData()
796
920
  if (!item || !item.Symbol) continue;
797
921
 
798
922
  var rtCell={ Left:itemPos.Left, Top:itemPos.Top, Bottom:itemPos.Bottom, Right:itemPos.Left };
923
+ if (i>0) rtCell.Left-=config.Separator.Right;
799
924
  this.DrawCellItem(item, itemPos );
800
925
  if (itemPos.CellCount>0)
801
926
  {
@@ -1055,7 +1180,7 @@ function ChartStatusBarStockData()
1055
1180
  {
1056
1181
  tooltip.Data=item;
1057
1182
  tooltip.ChartPaint=this;
1058
- tooltip.Type=21;
1183
+ tooltip.Type=121;
1059
1184
  return true;
1060
1185
  }
1061
1186
  }
@@ -1067,7 +1192,7 @@ function ChartStatusBarStockData()
1067
1192
  {
1068
1193
  tooltip.Data=item;
1069
1194
  tooltip.ChartPaint=this;
1070
- tooltip.Type=22;
1195
+ tooltip.Type=122;
1071
1196
  return true;
1072
1197
  }
1073
1198
  }
@@ -1075,3 +1200,9 @@ function ChartStatusBarStockData()
1075
1200
  return false;
1076
1201
  }
1077
1202
  }
1203
+
1204
+
1205
+
1206
+
1207
+
1208
+
@@ -111,6 +111,8 @@ function JSStockInfoChart(divElement)
111
111
 
112
112
  if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) chart.SetColumn(option.Column);
113
113
  if (IFrameSplitOperator.IsNonEmptyArray(option.HeaderColumn)) chart.SetHeaderColumn(option.HeaderColumn);
114
+ if (IFrameSplitOperator.IsNonEmptyArray(option.MouseOnKey)) chart.SetMouseOnKey(option.MouseOnKey);
115
+
114
116
  //是否自动更新
115
117
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
116
118
 
@@ -339,6 +341,7 @@ function JSStockInfoChartContainer(uielement)
339
341
  {
340
342
  if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) this.SetColumn(option.Column);
341
343
  if (IFrameSplitOperator.IsNumber(option.BuySellCount)) this.SetBuySellCount(option.BuySellCount);
344
+ if (IFrameSplitOperator.IsNonEmptyArray(option.MouseOnKey)) this.SetMouseOnKey(option.MouseOnKey);
342
345
  }
343
346
 
344
347
  this.Draw();
@@ -486,17 +489,95 @@ function JSStockInfoChartContainer(uielement)
486
489
  }
487
490
 
488
491
 
489
-
490
- /*
491
- this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
492
+ this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
492
493
  this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
493
494
  this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
494
495
  this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
495
496
  this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
496
- this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
497
+ /*
498
+ this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
499
+
497
500
  */
498
501
  }
499
502
 
503
+ this.UIOnMouseDown=function(e)
504
+ {
505
+ var pixelTatio = GetDevicePixelRatio();
506
+ this.ClickDownPoint={ X:e.clientX, Y:e.clientY };
507
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
508
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
509
+ }
510
+
511
+ this.UIOnContextMenu=function(e)
512
+ {
513
+ if (e) //去掉系统右键菜单
514
+ {
515
+ if (e.preventDefault) e.preventDefault();
516
+ if (e.stopPropagation) e.stopPropagation();
517
+ e.returnValue=false;
518
+ }
519
+ }
520
+
521
+ this.UIOnMouseMove=function(e)
522
+ {
523
+ var pixelTatio = GetDevicePixelRatio();
524
+ var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
525
+ var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
526
+
527
+ var option={ Update:false };
528
+
529
+ this.OnChartMouseMove(x,y,e,option);
530
+
531
+ if (option.Update===true) this.Draw();
532
+ }
533
+
534
+ this.OnChartMouseMove=function(x, y, e, option)
535
+ {
536
+ for(var i=0;i<this.ChartPaint.length;++i)
537
+ {
538
+ var item=this.ChartPaint[i];
539
+ if (item && item.OnMouseMove)
540
+ {
541
+ if (item.OnMouseMove(x,y,e,option)) return true;
542
+ }
543
+ }
544
+
545
+ return false;
546
+ }
547
+
548
+ this.UIOnMouseleave=function(e)
549
+ {
550
+ var option={ Update:false }
551
+
552
+ this.ChartClearMouseOnData(option);
553
+
554
+ if (option.Update===true) this.Draw();
555
+ }
556
+
557
+ this.UIOnMounseOut=function(e)
558
+ {
559
+ var option={ Update:false }
560
+
561
+ this.ChartClearMouseOnData(option);
562
+
563
+ if (option.Update===true) this.Draw();
564
+
565
+ //this.HideAllTooltip();
566
+ }
567
+
568
+ this.ChartClearMouseOnData=function(option)
569
+ {
570
+ for(var i=0;i<this.ChartPaint.length;++i)
571
+ {
572
+ var item=this.ChartPaint[i];
573
+ if (item && item.ClearMouseOnData)
574
+ {
575
+ item.ClearMouseOnData(option);
576
+ }
577
+ }
578
+ }
579
+
580
+
500
581
  this.Draw=function()
501
582
  {
502
583
  if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
@@ -582,6 +663,14 @@ function JSStockInfoChartContainer(uielement)
582
663
 
583
664
  if (option && option.Redraw) this.Draw();
584
665
  }
666
+
667
+ this.SetMouseOnKey=function(aryKey)
668
+ {
669
+ var chart=this.ChartPaint[0];
670
+ if (!chart) return;
671
+
672
+ chart.SetMouseOnKey(aryKey);
673
+ }
585
674
  }
586
675
 
587
676
  function JSStockInfoFrame()
@@ -713,7 +802,15 @@ function ChartStockData()
713
802
  [{ Name:"内盘", Key:"InVol", ColorType:4, FloatPrecision:0 }, { Name:"外盘", Key:"OutVol",ColorType:5, FloatPrecision:0 }],
714
803
  [{ Name:"TTM", Key:"PE_TTM", FloatPrecision:2 }, { Name:"市净率", Key:"PB", FloatPrecision:2 }],
715
804
  [{ Name:"流通市值", Key:"FlowMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }, { Name:"总市值", Key:"TotalMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }],
716
- ]
805
+ ];
806
+
807
+ this.AryCellRect=[];
808
+ this.MouseOnItem=null; //{ Key:, Rect: }
809
+ //this.MouseOnItem={ Key:"SELL_PRICE_0" };
810
+ this.MouseOnConfig=CloneData(g_JSChartResource.StockInfo.MouseOn);
811
+
812
+ this.MapMouseOnKey=new Map();
813
+
717
814
 
718
815
  this.ReloadResource=function(resource)
719
816
  {
@@ -727,6 +824,17 @@ function ChartStockData()
727
824
  this.BuySellConfig=CloneData(g_JSChartResource.StockInfo.BuySell);
728
825
 
729
826
  this.TableConfig=CloneData(g_JSChartResource.StockInfo.Table);
827
+
828
+ this.MouseOnConfig=CloneData(g_JSChartResource.StockInfo.MouseOn);
829
+ }
830
+
831
+ this.ClearMouseOnData=function(option)
832
+ {
833
+ if (!this.MouseOnItem)
834
+ {
835
+ this.MouseOnItem=null;
836
+ if (option) option.Update=true; //需要更新
837
+ }
730
838
  }
731
839
 
732
840
  this.SetColumn=function(aryColumn)
@@ -755,8 +863,55 @@ function ChartStockData()
755
863
  }
756
864
  }
757
865
 
866
+ this.SetMouseOnKey=function(aryKey)
867
+ {
868
+ this.MapMouseOnKey.clear();
869
+ if (!IFrameSplitOperator.IsNonEmptyArray(aryKey)) return;
870
+
871
+ for(var i=0;i<aryKey.length;++i)
872
+ {
873
+ var key=aryKey[i];
874
+ if (!key) continue;
875
+
876
+ this.MapMouseOnKey.set(key, { Key:key });
877
+ }
878
+
879
+ }
880
+
881
+ this.OnMouseMove=function(x, y, e, option)
882
+ {
883
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryCellRect)) return false;
884
+
885
+ if (this.MouseOnItem && this.MouseOnItem.Rect)
886
+ {
887
+ var rect=this.MouseOnItem.Rect;
888
+ if (Path2DHelper.PtInRect(x,y,rect )) return true;
889
+ }
890
+
891
+ for(var i=0;i<this.AryCellRect.length;++i)
892
+ {
893
+ var item=this.AryCellRect[i];
894
+ var rect=item.Rect;
895
+ if (Path2DHelper.PtInRect(x,y, rect))
896
+ {
897
+ this.MouseOnItem={ Key:item.Data.Key, Rect:rect };
898
+ if (option) option.Update=true;
899
+ return true;
900
+ }
901
+ }
902
+
903
+ if (this.MouseOnItem)
904
+ {
905
+ this.MouseOnItem=null;
906
+ if (option) option.Update=true;
907
+ }
908
+
909
+ return false;
910
+ }
911
+
758
912
  this.Draw=function()
759
913
  {
914
+ this.AryCellRect=[];
760
915
  this.Decimal=GetfloatPrecision(this.Data.Symbol);
761
916
  var border=this.ChartBorder.GetBorder();
762
917
  var position = { Left:border.Left, Right:border.Right, Top:border.Top, Width:border.Right-border.Left, Border:border };
@@ -874,11 +1029,13 @@ function ChartStockData()
874
1029
  {
875
1030
  var xLeft=position.Border.Left, xRight=position.Border.Right;
876
1031
  this.Canvas.strokeStyle=config.BottomLine.Color;
877
- this.Canvas.lineWidth=1*GetDevicePixelRatio();
1032
+ var lineWidth=1*GetDevicePixelRatio();;
1033
+ this.Canvas.lineWidth=lineWidth;
878
1034
  this.Canvas.beginPath();
879
1035
  this.Canvas.moveTo(xLeft,ToFixedPoint(yText));
880
1036
  this.Canvas.lineTo(xRight,ToFixedPoint(yText));
881
1037
  this.Canvas.stroke();
1038
+ position.Top=ToFixedPoint(yText);
882
1039
  }
883
1040
  }
884
1041
 
@@ -905,7 +1062,7 @@ function ChartStockData()
905
1062
  {
906
1063
  xText=left;
907
1064
  var item=this.Data.Sells[i];
908
- this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
1065
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight, { Type:1, Index:i});
909
1066
  if (IFrameSplitOperator.IsNumber(item.Vol)) sellVol+=item.Vol;
910
1067
  yText+=cellHeight;
911
1068
  }
@@ -924,7 +1081,7 @@ function ChartStockData()
924
1081
  {
925
1082
  xText=left;
926
1083
  var item=this.Data.Buys[i];
927
- this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
1084
+ this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight, { Type:2, Index:i});
928
1085
  if (IFrameSplitOperator.IsNumber(item.Vol)) buyVol+=item.Vol;
929
1086
  yText+=cellHeight;
930
1087
  }
@@ -989,7 +1146,8 @@ function ChartStockData()
989
1146
  }
990
1147
  }
991
1148
 
992
- this.DrawBuySellItem=function(item, left, top, cellWidth, cellHeight)
1149
+ //itemInfo={ Type:2(1=买 2=卖), Index:数据索引 }
1150
+ this.DrawBuySellItem=function(item, left, top, cellWidth, cellHeight, itemInfo)
993
1151
  {
994
1152
  var config=this.BuySellConfig;
995
1153
  var xText=left;
@@ -1004,11 +1162,22 @@ function ChartStockData()
1004
1162
 
1005
1163
  if (IFrameSplitOperator.IsNumber(item.Price))
1006
1164
  {
1165
+ var key=`${itemInfo.Type==1?"BUY":"SELL"}_PRICE_${itemInfo.Index}`;
1166
+ var mouseOnItem=this.IsMouseOn(key);
1167
+
1007
1168
  var text=item.Price.toFixed(this.Decimal);
1008
1169
  var textWidth=this.Canvas.measureText(text).width;
1009
1170
  var x=xText+cellWidth-textWidth-config.CellMargin.Right;
1171
+ var rtCell={ Left:xText, Width:cellWidth, Top:top, Height:cellHeight };
1172
+ rtCell.Right=rtCell.Left+rtCell.Width;
1173
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
1174
+ if (mouseOnItem) this.DrawMouseOnRect(rtCell);
1175
+
1010
1176
  this.Canvas.fillStyle=this.GetPriceColor(item.Price);
1011
1177
  this.Canvas.fillText(text,x,yBottom);
1178
+
1179
+ if (this.MapMouseOnKey.has(key))
1180
+ this.AryCellRect.push({ Rect:rtCell, Data:{ Type:1, Key:key, Value:item.Price }});
1012
1181
  }
1013
1182
  xText+=cellWidth;
1014
1183
 
@@ -1024,6 +1193,25 @@ function ChartStockData()
1024
1193
  }
1025
1194
  }
1026
1195
 
1196
+ this.IsMouseOn=function(key)
1197
+ {
1198
+ if (!this.MouseOnItem) return null;
1199
+
1200
+ if (this.MouseOnItem.Key===key) return this.MouseOnItem;
1201
+
1202
+ return null;
1203
+ }
1204
+
1205
+ this.DrawMouseOnRect=function(rect)
1206
+ {
1207
+ if (!this.MouseOnItem) return;
1208
+
1209
+ this.Canvas.fillStyle=this.MouseOnConfig.BGColor;
1210
+ this.Canvas.fillRect(rect.Left, rect.Top, rect.Width, rect.Height);
1211
+
1212
+ this.MouseOnItem.Rect=rect;
1213
+ }
1214
+
1027
1215
 
1028
1216
  this.DrawTable=function(position)
1029
1217
  {
@@ -1093,18 +1281,36 @@ function ChartStockData()
1093
1281
  {
1094
1282
  if (i==0 && item.ShowType==1) //整行显示
1095
1283
  {
1284
+ var mouseOnItem=this.IsMouseOn(item.Key);
1096
1285
  var textWidth=this.Canvas.measureText(text).width;
1097
1286
  var x=xText+(cellWidth*3)-textWidth-config.CellMargin.Right;
1287
+ var rtCell={ Left:xText+cellWidth, Top:top, Width:cellWidth*2, Height:cellHeight};
1288
+ rtCell.Right=rtCell.Left+rtCell.Width;
1289
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
1290
+ if (mouseOnItem) this.DrawMouseOnRect(rtCell);
1291
+
1098
1292
  this.Canvas.fillStyle=color;
1099
1293
  this.Canvas.fillText(text,x,yBottom);
1294
+
1295
+ if (this.MapMouseOnKey.has(item.Key))
1296
+ this.AryCellRect.push({ Rect:rtCell, Data:{ Type:2, Key:item.Key, Value:dataItem }});
1100
1297
  break;
1101
1298
  }
1102
1299
  else
1103
1300
  {
1301
+ var mouseOnItem=this.IsMouseOn(item.Key);
1104
1302
  var textWidth=this.Canvas.measureText(text).width;
1105
1303
  var x=xText+cellWidth-textWidth-config.CellMargin.Right;
1304
+ var rtCell={ Left:xText, Top:top, Width:cellWidth, Height:cellHeight};
1305
+ rtCell.Right=rtCell.Left+rtCell.Width;
1306
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
1307
+ if (mouseOnItem) this.DrawMouseOnRect(rtCell);
1308
+
1106
1309
  this.Canvas.fillStyle=color;
1107
1310
  this.Canvas.fillText(text,x,yBottom);
1311
+
1312
+ if (this.MapMouseOnKey.has(item.Key))
1313
+ this.AryCellRect.push({ Rect:rtCell, Data:{ Type:2, Key:item.Key, Value:dataItem }});
1108
1314
  }
1109
1315
 
1110
1316
  }
@@ -56826,6 +56826,8 @@ function FrameSplitKLinePriceY()
56826
56826
  isLast=pageInfo.IsLast;
56827
56827
  }
56828
56828
  }
56829
+
56830
+ if (!latestItem || !IFrameSplitOperator.IsNumber(latestItem.Close)) return null;
56829
56831
 
56830
56832
  var info=new CoordinateInfo();
56831
56833
  info.Type=0;
@@ -79928,7 +79930,7 @@ function JSChartResource()
79928
79930
  TitleColor:"rgb(90,90,90)",
79929
79931
  VolColor:"rgb(90,90,90)",
79930
79932
  Margin:{ Left:0, Top:0, Bottom:0, Right:0 },
79931
- CellMargin:{ Top:5, Bottom:5, Left:5, Right:5, YOffset:0 },
79933
+ CellMargin:{ Top:3*GetDevicePixelRatio(), Bottom:3*GetDevicePixelRatio(), Left:5*GetDevicePixelRatio(), Right:5*GetDevicePixelRatio(), YOffset:1*GetDevicePixelRatio() },
79932
79934
  BottomLine:{ Enable:true, Color:"rgb(192,192,192)"}, //底部分割线
79933
79935
  TopLine:{ Enable:false, Color:"rgb(192,192,192)"}, //底部分割线
79934
79936
 
@@ -79944,10 +79946,12 @@ function JSChartResource()
79944
79946
  Font:14*GetDevicePixelRatio() +'px 微软雅黑',
79945
79947
  TitleColor:"rgb(90,90,90)",
79946
79948
  TextColor:"rgb(90,90,90)",
79947
- Margin:{ Left:0, Top:0, Bottom:0, Right:0 },
79948
- CellMargin:{ Top:5, Bottom:5, Left:5, Right:5, YOffset:0 },
79949
+ Margin:{ Left:0, Top:2*GetDevicePixelRatio(), Bottom:0, Right:0 },
79950
+ CellMargin:{ Top:3*GetDevicePixelRatio(), Bottom:3*GetDevicePixelRatio(), Left:5, Right:5, YOffset:1*GetDevicePixelRatio() },
79949
79951
  },
79950
79952
 
79953
+ MouseOn:{ BGColor:"rgb(169,169,169)" },
79954
+
79951
79955
  UpTextColor:"rgb(238,21,21)", //上涨文字颜色
79952
79956
  DownTextColor:"rgb(25,158,0)", //下跌文字颜色
79953
79957
  UnchangeTextColor:"rgb(90,90,90)", //平盘文字颜色
@@ -81150,6 +81154,12 @@ function JSChartResource()
81150
81154
  }
81151
81155
  }
81152
81156
 
81157
+ if (style.MouseOn)
81158
+ {
81159
+ var item=style.MouseOn;
81160
+ if (item.BGColor) dest.MouseOn.BGColor=item.BGColor;
81161
+ }
81162
+
81153
81163
  if (style.UpTextColor) dest.UpTextColor=style.UpTextColor;
81154
81164
  if (style.DownTextColor) dest.DownTextColor=style.DownTextColor;
81155
81165
  if (style.UnchangeTextColor) dest.UnchangeTextColor=style.UnchangeTextColor;