hqchart 1.1.15451 → 1.1.15474
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/lib/umychart.vue.js +70 -50
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +3 -0
- package/src/jscommon/umychart.PopKeyboard.js +28 -0
- package/src/jscommon/umychart.StatusBar.js +27 -4
- package/src/jscommon/umychart.StockInfo.js +398 -10
- package/src/jscommon/umychart.js +68 -64
- package/src/jscommon/umychart.report.js +9 -0
- package/src/jscommon/umychart.style.js +2 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +80 -65
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +536 -79
package/package.json
CHANGED
|
@@ -556,6 +556,7 @@ function JSDialogDrawTool()
|
|
|
556
556
|
this.Close=function(e)
|
|
557
557
|
{
|
|
558
558
|
if (!this.DivDialog) return;
|
|
559
|
+
if (!this.IsShow()) return;
|
|
559
560
|
|
|
560
561
|
this.DivDialog.style.visibility='hidden';
|
|
561
562
|
|
|
@@ -901,6 +902,8 @@ function JSDialogModifyDraw()
|
|
|
901
902
|
if (!this.DivDialog) return;
|
|
902
903
|
|
|
903
904
|
this.ChartPicture=null;
|
|
905
|
+
if (!this.IsShow()) return;
|
|
906
|
+
|
|
904
907
|
this.DivDialog.style.visibility='hidden';
|
|
905
908
|
|
|
906
909
|
if (this.HQChart) this.HQChart.RestoreFocus(this.RestoreFocusDelay);
|
|
@@ -271,6 +271,21 @@ function JSPopKeyboard()
|
|
|
271
271
|
var x=xRight-width;
|
|
272
272
|
var y=ybottom-height;
|
|
273
273
|
|
|
274
|
+
if (this.Keyboard.JSChart && this.Keyboard.JSChart.JSChartContainer)
|
|
275
|
+
{
|
|
276
|
+
var event=this.Keyboard.JSChart.JSChartContainer.GetEventCallback(JSCHART_EVENT_ID.ON_KEYBOARD_SHOW);
|
|
277
|
+
if (event && event.Callback)
|
|
278
|
+
{
|
|
279
|
+
var data={ PreventDefault:false, Y:y, X:x, Height:height, Width:width };
|
|
280
|
+
event.Callback(event, data, this);
|
|
281
|
+
if (data.PreventDefault) return;
|
|
282
|
+
|
|
283
|
+
//修改显示位置
|
|
284
|
+
x=data.X;
|
|
285
|
+
y=data.Y;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
274
289
|
this.DivDialog.style.visibility='visible';
|
|
275
290
|
this.DivDialog.style.top = y + "px";
|
|
276
291
|
this.DivDialog.style.left = x + "px";
|
|
@@ -296,6 +311,19 @@ function JSPopKeyboard()
|
|
|
296
311
|
return this.DivDialog.style.visibility==='visible';
|
|
297
312
|
}
|
|
298
313
|
|
|
314
|
+
this.PopKeyboard=function(search)
|
|
315
|
+
{
|
|
316
|
+
if (!this.DivDialog) return;
|
|
317
|
+
if (this.IsShow()) return;
|
|
318
|
+
|
|
319
|
+
this.Show();
|
|
320
|
+
this.InputDOM.focus();
|
|
321
|
+
if (this.InputDOM.value=="")
|
|
322
|
+
{
|
|
323
|
+
if (search) this.InputDOM.value=search;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
299
327
|
this.OnGlobalKeydown=function(event)
|
|
300
328
|
{
|
|
301
329
|
if (!this.DivDialog) return;
|
|
@@ -437,6 +437,7 @@ function JSStatusBarChartContainer(uielement)
|
|
|
437
437
|
this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
|
|
438
438
|
this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e); }
|
|
439
439
|
this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
|
|
440
|
+
this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
|
|
440
441
|
|
|
441
442
|
/*
|
|
442
443
|
this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
|
|
@@ -444,7 +445,7 @@ function JSStatusBarChartContainer(uielement)
|
|
|
444
445
|
|
|
445
446
|
|
|
446
447
|
this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
|
|
447
|
-
|
|
448
|
+
|
|
448
449
|
*/
|
|
449
450
|
|
|
450
451
|
var frequency=500;
|
|
@@ -461,8 +462,30 @@ function JSStatusBarChartContainer(uielement)
|
|
|
461
462
|
var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
|
|
462
463
|
var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
|
|
463
464
|
|
|
464
|
-
|
|
465
|
-
|
|
465
|
+
if (e)
|
|
466
|
+
{
|
|
467
|
+
if (e.button==0) //左键点击
|
|
468
|
+
{
|
|
469
|
+
var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
|
|
470
|
+
this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STATUSBAR_ITEM, ptClick, e);
|
|
471
|
+
}
|
|
472
|
+
else if (e.button==2) //右键点击
|
|
473
|
+
{
|
|
474
|
+
this.HideAllTooltip();
|
|
475
|
+
var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
|
|
476
|
+
this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_RCLICK_STATUSBAR_ITEM, ptClick, e);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
this.UIOnContextMenu=function(e)
|
|
482
|
+
{
|
|
483
|
+
if (e) //去掉系统右键菜单
|
|
484
|
+
{
|
|
485
|
+
if (e.preventDefault) e.preventDefault();
|
|
486
|
+
if (e.stopPropagation) e.stopPropagation();
|
|
487
|
+
e.returnValue=false;
|
|
488
|
+
}
|
|
466
489
|
}
|
|
467
490
|
|
|
468
491
|
this.GetChartTooltipData=function(x,y,option)
|
|
@@ -537,7 +560,7 @@ function JSStatusBarChartContainer(uielement)
|
|
|
537
560
|
{
|
|
538
561
|
if (toolTip.Data)
|
|
539
562
|
{
|
|
540
|
-
var data= { X:e.clientX, Y:e.clientY, Tooltip:toolTip };
|
|
563
|
+
var data= { X:e.clientX, Y:e.clientY, Tooltip:toolTip, e:e };
|
|
541
564
|
event.Callback(event, data, this);
|
|
542
565
|
return true;
|
|
543
566
|
}
|
|
@@ -72,6 +72,7 @@ function JSStockInfoChart(divElement)
|
|
|
72
72
|
this.DivElement.JSChart=this; //div中保存一份
|
|
73
73
|
|
|
74
74
|
if (option.EnableResize==true) this.CreateResizeListener();
|
|
75
|
+
if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
|
|
75
76
|
|
|
76
77
|
if (option.Symbol)
|
|
77
78
|
{
|
|
@@ -111,6 +112,8 @@ function JSStockInfoChart(divElement)
|
|
|
111
112
|
|
|
112
113
|
if (IFrameSplitOperator.IsNonEmptyArray(option.Column)) chart.SetColumn(option.Column);
|
|
113
114
|
if (IFrameSplitOperator.IsNonEmptyArray(option.HeaderColumn)) chart.SetHeaderColumn(option.HeaderColumn);
|
|
115
|
+
if (IFrameSplitOperator.IsNonEmptyArray(option.MouseOnKey)) chart.SetMouseOnKey(option.MouseOnKey);
|
|
116
|
+
|
|
114
117
|
//是否自动更新
|
|
115
118
|
if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
|
|
116
119
|
|
|
@@ -271,6 +274,8 @@ function JSStockInfoChartContainer(uielement)
|
|
|
271
274
|
this.AutoUpdateTimer=null;
|
|
272
275
|
this.AutoUpdateFrequency=15000; //15秒更新一次数据
|
|
273
276
|
|
|
277
|
+
this.JSPopMenu; //内置菜单
|
|
278
|
+
|
|
274
279
|
this.UIElement=uielement;
|
|
275
280
|
|
|
276
281
|
this.IsDestroy=false; //是否已经销毁了
|
|
@@ -279,6 +284,8 @@ function JSStockInfoChartContainer(uielement)
|
|
|
279
284
|
{
|
|
280
285
|
this.IsDestroy=true;
|
|
281
286
|
this.StopAutoUpdate();
|
|
287
|
+
|
|
288
|
+
this.DestroyPopMenu();
|
|
282
289
|
}
|
|
283
290
|
|
|
284
291
|
//设置事件回调
|
|
@@ -291,6 +298,37 @@ function JSStockInfoChartContainer(uielement)
|
|
|
291
298
|
this.mapEvent.set(object.event,data);
|
|
292
299
|
}
|
|
293
300
|
|
|
301
|
+
this.RemoveEventCallback=function(eventid)
|
|
302
|
+
{
|
|
303
|
+
if (!this.mapEvent.has(eventid)) return;
|
|
304
|
+
|
|
305
|
+
this.mapEvent.delete(eventid);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
this.GetEventCallback=function(id) //获取事件回调
|
|
309
|
+
{
|
|
310
|
+
if (!this.mapEvent.has(id)) return null;
|
|
311
|
+
var item=this.mapEvent.get(id);
|
|
312
|
+
return item;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
this.InitalPopMenu=function() //初始化弹出窗口
|
|
316
|
+
{
|
|
317
|
+
if (this.JSPopMenu) return;
|
|
318
|
+
|
|
319
|
+
this.JSPopMenu=new JSPopMenu(); //内置菜单
|
|
320
|
+
this.JSPopMenu.Inital();
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
this.DestroyPopMenu=function()
|
|
324
|
+
{
|
|
325
|
+
if (!this.JSPopMenu) return;
|
|
326
|
+
|
|
327
|
+
this.JSPopMenu.Destroy();
|
|
328
|
+
this.JSPopMenu=null;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
|
|
294
332
|
this.ClearData=function()
|
|
295
333
|
{
|
|
296
334
|
this.Data.Name=null;
|
|
@@ -332,13 +370,15 @@ function JSStockInfoChartContainer(uielement)
|
|
|
332
370
|
{
|
|
333
371
|
this.CancelAutoUpdate();
|
|
334
372
|
this.ClearData();
|
|
373
|
+
this.ChartClearMouseOnData();
|
|
335
374
|
this.Symbol=symbol;
|
|
336
375
|
this.Data.Symbol=symbol;
|
|
337
376
|
|
|
338
377
|
if (option)
|
|
339
378
|
{
|
|
340
|
-
if (IFrameSplitOperator.
|
|
379
|
+
if (IFrameSplitOperator.IsArray(option.Column)) this.SetColumn(option.Column);
|
|
341
380
|
if (IFrameSplitOperator.IsNumber(option.BuySellCount)) this.SetBuySellCount(option.BuySellCount);
|
|
381
|
+
if (IFrameSplitOperator.IsArray(option.MouseOnKey)) this.SetMouseOnKey(option.MouseOnKey);
|
|
342
382
|
}
|
|
343
383
|
|
|
344
384
|
this.Draw();
|
|
@@ -486,17 +526,220 @@ function JSStockInfoChartContainer(uielement)
|
|
|
486
526
|
}
|
|
487
527
|
|
|
488
528
|
|
|
489
|
-
|
|
490
|
-
/*
|
|
491
|
-
this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
|
|
529
|
+
this.UIElement.oncontextmenu=(e)=> { this.UIOnContextMenu(e); }
|
|
492
530
|
this.UIElement.onmousedown=(e)=> { this.UIOnMouseDown(e); }
|
|
493
531
|
this.UIElement.onmousemove=(e)=>{ this.UIOnMouseMove(e);}
|
|
494
532
|
this.UIElement.onmouseout=(e)=>{ this.UIOnMounseOut(e); }
|
|
495
533
|
this.UIElement.onmouseleave=(e)=>{ this.UIOnMouseleave(e); }
|
|
496
|
-
|
|
534
|
+
/*
|
|
535
|
+
this.UIElement.ondblclick=(e)=>{ this.UIOnDblClick(e); }
|
|
536
|
+
|
|
497
537
|
*/
|
|
498
538
|
}
|
|
499
539
|
|
|
540
|
+
this.UIOnMouseDown=function(e)
|
|
541
|
+
{
|
|
542
|
+
var pixelTatio = GetDevicePixelRatio();
|
|
543
|
+
this.ClickDownPoint={ X:e.clientX, Y:e.clientY };
|
|
544
|
+
var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
|
|
545
|
+
var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
|
|
546
|
+
|
|
547
|
+
if (e)
|
|
548
|
+
{
|
|
549
|
+
if (e.button==0) //左键点击
|
|
550
|
+
{
|
|
551
|
+
var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
|
|
552
|
+
this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICK_STOCKINFO_ITEM, ptClick, e);
|
|
553
|
+
}
|
|
554
|
+
else if (e.button==2) //右键点击
|
|
555
|
+
{
|
|
556
|
+
var ptClick={ X:this.ClickDownPoint.X, Y:this.ClickDownPoint.Y };
|
|
557
|
+
this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_RCLICK_STOCKINFO_ITEM, ptClick, e);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
this.UIOnContextMenu=function(e)
|
|
563
|
+
{
|
|
564
|
+
if (e) //去掉系统右键菜单
|
|
565
|
+
{
|
|
566
|
+
if (e.preventDefault) e.preventDefault();
|
|
567
|
+
if (e.stopPropagation) e.stopPropagation();
|
|
568
|
+
e.returnValue=false;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
var x = e.clientX-this.UIElement.getBoundingClientRect().left;
|
|
572
|
+
var y = e.clientY-this.UIElement.getBoundingClientRect().top;
|
|
573
|
+
|
|
574
|
+
this.OnRightMenu(x, y, e);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
this.OnRightMenu=function(x,y,e)
|
|
578
|
+
{
|
|
579
|
+
if (!this.JSPopMenu) return;
|
|
580
|
+
|
|
581
|
+
var pixelTatio = GetDevicePixelRatio();
|
|
582
|
+
var toolTip=new TooltipData();
|
|
583
|
+
var data=null;
|
|
584
|
+
for(var i=0;i<this.ChartPaint.length;++i)
|
|
585
|
+
{
|
|
586
|
+
var item=this.ChartPaint[i];
|
|
587
|
+
if (item.GetTooltipData(x*pixelTatio,y*pixelTatio,toolTip))
|
|
588
|
+
{
|
|
589
|
+
if (toolTip.Data)
|
|
590
|
+
{
|
|
591
|
+
data= { Cell:toolTip.Data};
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
if (!data) return;
|
|
598
|
+
|
|
599
|
+
data.e=e;
|
|
600
|
+
var menuData={ Menu:null, Position:JSPopMenu.POSITION_ID.RIGHT_MENU_ID };
|
|
601
|
+
menuData.ClickCallback=(data)=>{ this.OnClickRightMenu(data); }
|
|
602
|
+
|
|
603
|
+
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CREATE_RIGHT_MENU);
|
|
604
|
+
if (event && event.Callback)
|
|
605
|
+
{
|
|
606
|
+
var sendData={ MenuData:menuData, Data:data };
|
|
607
|
+
event.Callback(event, sendData, this);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
if (menuData.Menu) this.PopupMenuByRClick(menuData, x, y);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
//右键菜单
|
|
614
|
+
this.PopupMenuByRClick=function(menuData, x, y)
|
|
615
|
+
{
|
|
616
|
+
if (!this.JSPopMenu) return;
|
|
617
|
+
|
|
618
|
+
var rtClient=this.UIElement.getBoundingClientRect();
|
|
619
|
+
var rtScroll=GetScrollPosition();
|
|
620
|
+
|
|
621
|
+
x+=rtClient.left+rtScroll.Left;
|
|
622
|
+
y+=rtClient.top+rtScroll.Top;
|
|
623
|
+
|
|
624
|
+
this.JSPopMenu.CreatePopMenu(menuData);
|
|
625
|
+
this.JSPopMenu.PopupMenuByRight(x,y);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
//点击右键菜单
|
|
629
|
+
this.OnClickRightMenu=function(data)
|
|
630
|
+
{
|
|
631
|
+
JSConsole.Chart.Log('[JSStockInfoChartContainer::OnClickRightMenu] ',data);
|
|
632
|
+
if (!data || !data.Data) return;
|
|
633
|
+
|
|
634
|
+
var cmdID=data.Data.ID; //命令ID
|
|
635
|
+
var aryArgs=data.Data.Args; //参数
|
|
636
|
+
|
|
637
|
+
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MENU_COMMAND); //回调通知外部
|
|
638
|
+
if (event && event.Callback)
|
|
639
|
+
{
|
|
640
|
+
var data={ PreventDefault:false, CommandID:cmdID, Args:aryArgs, SrcData:data };
|
|
641
|
+
event.Callback(event,data,this);
|
|
642
|
+
if (data.PreventDefault) return;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
this.ExecuteMenuCommand(cmdID, aryArgs);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
this.ExecuteMenuCommand=function(cmdID, aryArgs)
|
|
649
|
+
{
|
|
650
|
+
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
this.UIOnMouseMove=function(e)
|
|
654
|
+
{
|
|
655
|
+
var pixelTatio = GetDevicePixelRatio();
|
|
656
|
+
var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
|
|
657
|
+
var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
|
|
658
|
+
|
|
659
|
+
var option={ Update:false };
|
|
660
|
+
|
|
661
|
+
this.OnChartMouseMove(x,y,e,option);
|
|
662
|
+
|
|
663
|
+
if (option.Update===true) this.Draw();
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
this.OnChartMouseMove=function(x, y, e, option)
|
|
667
|
+
{
|
|
668
|
+
for(var i=0;i<this.ChartPaint.length;++i)
|
|
669
|
+
{
|
|
670
|
+
var item=this.ChartPaint[i];
|
|
671
|
+
if (item && item.OnMouseMove)
|
|
672
|
+
{
|
|
673
|
+
if (item.OnMouseMove(x,y,e,option)) return true;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
return false;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
this.TryClickPaintEvent=function(eventID, ptClick, e)
|
|
681
|
+
{
|
|
682
|
+
var event=this.GetEventCallback(eventID);
|
|
683
|
+
if (!event) return false;
|
|
684
|
+
|
|
685
|
+
if (ptClick.X==e.clientX && ptClick.Y==e.clientY)
|
|
686
|
+
{
|
|
687
|
+
var pixelTatio = GetDevicePixelRatio();
|
|
688
|
+
var x = (e.clientX-uielement.getBoundingClientRect().left)*pixelTatio;
|
|
689
|
+
var y = (e.clientY-uielement.getBoundingClientRect().top)*pixelTatio;
|
|
690
|
+
|
|
691
|
+
var toolTip=new TooltipData();
|
|
692
|
+
for(var i=0;i<this.ChartPaint.length;++i)
|
|
693
|
+
{
|
|
694
|
+
var item=this.ChartPaint[i];
|
|
695
|
+
if (item.GetTooltipData(x,y,toolTip))
|
|
696
|
+
{
|
|
697
|
+
if (toolTip.Data)
|
|
698
|
+
{
|
|
699
|
+
var data= { X:e.clientX, Y:e.clientY, Tooltip:toolTip };
|
|
700
|
+
event.Callback(event, data, this);
|
|
701
|
+
return true;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
return false;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
this.UIOnMouseleave=function(e)
|
|
711
|
+
{
|
|
712
|
+
var option={ Update:false }
|
|
713
|
+
|
|
714
|
+
this.ChartClearMouseOnData(option);
|
|
715
|
+
|
|
716
|
+
if (option.Update===true) this.Draw();
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
this.UIOnMounseOut=function(e)
|
|
720
|
+
{
|
|
721
|
+
var option={ Update:false }
|
|
722
|
+
|
|
723
|
+
this.ChartClearMouseOnData(option);
|
|
724
|
+
|
|
725
|
+
if (option.Update===true) this.Draw();
|
|
726
|
+
|
|
727
|
+
//this.HideAllTooltip();
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
this.ChartClearMouseOnData=function(option)
|
|
731
|
+
{
|
|
732
|
+
for(var i=0;i<this.ChartPaint.length;++i)
|
|
733
|
+
{
|
|
734
|
+
var item=this.ChartPaint[i];
|
|
735
|
+
if (item && item.ClearMouseOnData)
|
|
736
|
+
{
|
|
737
|
+
item.ClearMouseOnData(option);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
|
|
500
743
|
this.Draw=function()
|
|
501
744
|
{
|
|
502
745
|
if (this.UIElement.width<=0 || this.UIElement.height<=0) return;
|
|
@@ -582,6 +825,14 @@ function JSStockInfoChartContainer(uielement)
|
|
|
582
825
|
|
|
583
826
|
if (option && option.Redraw) this.Draw();
|
|
584
827
|
}
|
|
828
|
+
|
|
829
|
+
this.SetMouseOnKey=function(aryKey)
|
|
830
|
+
{
|
|
831
|
+
var chart=this.ChartPaint[0];
|
|
832
|
+
if (!chart) return;
|
|
833
|
+
|
|
834
|
+
chart.SetMouseOnKey(aryKey);
|
|
835
|
+
}
|
|
585
836
|
}
|
|
586
837
|
|
|
587
838
|
function JSStockInfoFrame()
|
|
@@ -713,7 +964,15 @@ function ChartStockData()
|
|
|
713
964
|
[{ Name:"内盘", Key:"InVol", ColorType:4, FloatPrecision:0 }, { Name:"外盘", Key:"OutVol",ColorType:5, FloatPrecision:0 }],
|
|
714
965
|
[{ Name:"TTM", Key:"PE_TTM", FloatPrecision:2 }, { Name:"市净率", Key:"PB", FloatPrecision:2 }],
|
|
715
966
|
[{ Name:"流通市值", Key:"FlowMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }, { Name:"总市值", Key:"TotalMarketValue", FloatPrecision:0, Format:{ Type:3, ExFloatPrecision:2 } }],
|
|
716
|
-
]
|
|
967
|
+
];
|
|
968
|
+
|
|
969
|
+
this.AryCellRect=[];
|
|
970
|
+
this.MouseOnItem=null; //{ Key:, Rect: }
|
|
971
|
+
//this.MouseOnItem={ Key:"SELL_PRICE_0" };
|
|
972
|
+
this.MouseOnConfig=CloneData(g_JSChartResource.StockInfo.MouseOn);
|
|
973
|
+
|
|
974
|
+
this.MapMouseOnKey=new Map();
|
|
975
|
+
|
|
717
976
|
|
|
718
977
|
this.ReloadResource=function(resource)
|
|
719
978
|
{
|
|
@@ -727,6 +986,17 @@ function ChartStockData()
|
|
|
727
986
|
this.BuySellConfig=CloneData(g_JSChartResource.StockInfo.BuySell);
|
|
728
987
|
|
|
729
988
|
this.TableConfig=CloneData(g_JSChartResource.StockInfo.Table);
|
|
989
|
+
|
|
990
|
+
this.MouseOnConfig=CloneData(g_JSChartResource.StockInfo.MouseOn);
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
this.ClearMouseOnData=function(option)
|
|
994
|
+
{
|
|
995
|
+
if (this.MouseOnItem)
|
|
996
|
+
{
|
|
997
|
+
this.MouseOnItem=null;
|
|
998
|
+
if (option) option.Update=true; //需要更新
|
|
999
|
+
}
|
|
730
1000
|
}
|
|
731
1001
|
|
|
732
1002
|
this.SetColumn=function(aryColumn)
|
|
@@ -755,8 +1025,75 @@ function ChartStockData()
|
|
|
755
1025
|
}
|
|
756
1026
|
}
|
|
757
1027
|
|
|
1028
|
+
this.SetMouseOnKey=function(aryKey)
|
|
1029
|
+
{
|
|
1030
|
+
this.MapMouseOnKey.clear();
|
|
1031
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(aryKey)) return;
|
|
1032
|
+
|
|
1033
|
+
for(var i=0;i<aryKey.length;++i)
|
|
1034
|
+
{
|
|
1035
|
+
var key=aryKey[i];
|
|
1036
|
+
if (!key) continue;
|
|
1037
|
+
|
|
1038
|
+
this.MapMouseOnKey.set(key, { Key:key });
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
this.OnMouseMove=function(x, y, e, option)
|
|
1044
|
+
{
|
|
1045
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryCellRect)) return false;
|
|
1046
|
+
|
|
1047
|
+
if (this.MouseOnItem && this.MouseOnItem.Rect)
|
|
1048
|
+
{
|
|
1049
|
+
var rect=this.MouseOnItem.Rect;
|
|
1050
|
+
if (Path2DHelper.PtInRect(x,y,rect )) return true;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
for(var i=0;i<this.AryCellRect.length;++i)
|
|
1054
|
+
{
|
|
1055
|
+
var item=this.AryCellRect[i];
|
|
1056
|
+
var rect=item.Rect;
|
|
1057
|
+
if (Path2DHelper.PtInRect(x,y, rect))
|
|
1058
|
+
{
|
|
1059
|
+
this.MouseOnItem={ Key:item.Data.Key, Rect:rect };
|
|
1060
|
+
if (option) option.Update=true;
|
|
1061
|
+
return true;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
if (this.MouseOnItem)
|
|
1066
|
+
{
|
|
1067
|
+
this.MouseOnItem=null;
|
|
1068
|
+
if (option) option.Update=true;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
return false;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
this.GetTooltipData=function(x,y,tooltip)
|
|
1075
|
+
{
|
|
1076
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(this.AryCellRect)) return false;
|
|
1077
|
+
|
|
1078
|
+
for(var i=0;i<this.AryCellRect.length;++i)
|
|
1079
|
+
{
|
|
1080
|
+
var item=this.AryCellRect[i];
|
|
1081
|
+
var rect=item.Rect;
|
|
1082
|
+
if (Path2DHelper.PtInRect(x,y, rect))
|
|
1083
|
+
{
|
|
1084
|
+
tooltip.Data=item;
|
|
1085
|
+
tooltip.ChartPaint=this;
|
|
1086
|
+
tooltip.Type=151;
|
|
1087
|
+
return true;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
return false;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
758
1094
|
this.Draw=function()
|
|
759
1095
|
{
|
|
1096
|
+
this.AryCellRect=[];
|
|
760
1097
|
this.Decimal=GetfloatPrecision(this.Data.Symbol);
|
|
761
1098
|
var border=this.ChartBorder.GetBorder();
|
|
762
1099
|
var position = { Left:border.Left, Right:border.Right, Top:border.Top, Width:border.Right-border.Left, Border:border };
|
|
@@ -874,11 +1211,13 @@ function ChartStockData()
|
|
|
874
1211
|
{
|
|
875
1212
|
var xLeft=position.Border.Left, xRight=position.Border.Right;
|
|
876
1213
|
this.Canvas.strokeStyle=config.BottomLine.Color;
|
|
877
|
-
|
|
1214
|
+
var lineWidth=1*GetDevicePixelRatio();;
|
|
1215
|
+
this.Canvas.lineWidth=lineWidth;
|
|
878
1216
|
this.Canvas.beginPath();
|
|
879
1217
|
this.Canvas.moveTo(xLeft,ToFixedPoint(yText));
|
|
880
1218
|
this.Canvas.lineTo(xRight,ToFixedPoint(yText));
|
|
881
1219
|
this.Canvas.stroke();
|
|
1220
|
+
position.Top=ToFixedPoint(yText);
|
|
882
1221
|
}
|
|
883
1222
|
}
|
|
884
1223
|
|
|
@@ -905,7 +1244,7 @@ function ChartStockData()
|
|
|
905
1244
|
{
|
|
906
1245
|
xText=left;
|
|
907
1246
|
var item=this.Data.Sells[i];
|
|
908
|
-
this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
|
|
1247
|
+
this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight, { Type:1, Index:i});
|
|
909
1248
|
if (IFrameSplitOperator.IsNumber(item.Vol)) sellVol+=item.Vol;
|
|
910
1249
|
yText+=cellHeight;
|
|
911
1250
|
}
|
|
@@ -924,7 +1263,7 @@ function ChartStockData()
|
|
|
924
1263
|
{
|
|
925
1264
|
xText=left;
|
|
926
1265
|
var item=this.Data.Buys[i];
|
|
927
|
-
this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight);
|
|
1266
|
+
this.DrawBuySellItem(item, xText, yText, cellWidth, cellHeight, { Type:2, Index:i});
|
|
928
1267
|
if (IFrameSplitOperator.IsNumber(item.Vol)) buyVol+=item.Vol;
|
|
929
1268
|
yText+=cellHeight;
|
|
930
1269
|
}
|
|
@@ -989,7 +1328,8 @@ function ChartStockData()
|
|
|
989
1328
|
}
|
|
990
1329
|
}
|
|
991
1330
|
|
|
992
|
-
|
|
1331
|
+
//itemInfo={ Type:2(1=买 2=卖), Index:数据索引 }
|
|
1332
|
+
this.DrawBuySellItem=function(item, left, top, cellWidth, cellHeight, itemInfo)
|
|
993
1333
|
{
|
|
994
1334
|
var config=this.BuySellConfig;
|
|
995
1335
|
var xText=left;
|
|
@@ -1004,11 +1344,22 @@ function ChartStockData()
|
|
|
1004
1344
|
|
|
1005
1345
|
if (IFrameSplitOperator.IsNumber(item.Price))
|
|
1006
1346
|
{
|
|
1347
|
+
var key=`${itemInfo.Type==1?"BUY":"SELL"}_PRICE_${itemInfo.Index}`;
|
|
1348
|
+
var mouseOnItem=this.IsMouseOn(key);
|
|
1349
|
+
|
|
1007
1350
|
var text=item.Price.toFixed(this.Decimal);
|
|
1008
1351
|
var textWidth=this.Canvas.measureText(text).width;
|
|
1009
1352
|
var x=xText+cellWidth-textWidth-config.CellMargin.Right;
|
|
1353
|
+
var rtCell={ Left:xText, Width:cellWidth, Top:top, Height:cellHeight };
|
|
1354
|
+
rtCell.Right=rtCell.Left+rtCell.Width;
|
|
1355
|
+
rtCell.Bottom=rtCell.Top+rtCell.Height;
|
|
1356
|
+
if (mouseOnItem) this.DrawMouseOnRect(rtCell);
|
|
1357
|
+
|
|
1010
1358
|
this.Canvas.fillStyle=this.GetPriceColor(item.Price);
|
|
1011
1359
|
this.Canvas.fillText(text,x,yBottom);
|
|
1360
|
+
|
|
1361
|
+
if (this.MapMouseOnKey.has(key))
|
|
1362
|
+
this.AryCellRect.push({ Rect:rtCell, Data:{ Type:1, Key:key, Value:item.Price }});
|
|
1012
1363
|
}
|
|
1013
1364
|
xText+=cellWidth;
|
|
1014
1365
|
|
|
@@ -1024,6 +1375,25 @@ function ChartStockData()
|
|
|
1024
1375
|
}
|
|
1025
1376
|
}
|
|
1026
1377
|
|
|
1378
|
+
this.IsMouseOn=function(key)
|
|
1379
|
+
{
|
|
1380
|
+
if (!this.MouseOnItem) return null;
|
|
1381
|
+
|
|
1382
|
+
if (this.MouseOnItem.Key===key) return this.MouseOnItem;
|
|
1383
|
+
|
|
1384
|
+
return null;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
this.DrawMouseOnRect=function(rect)
|
|
1388
|
+
{
|
|
1389
|
+
if (!this.MouseOnItem) return;
|
|
1390
|
+
|
|
1391
|
+
this.Canvas.fillStyle=this.MouseOnConfig.BGColor;
|
|
1392
|
+
this.Canvas.fillRect(rect.Left, rect.Top, rect.Width, rect.Height);
|
|
1393
|
+
|
|
1394
|
+
this.MouseOnItem.Rect=rect;
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1027
1397
|
|
|
1028
1398
|
this.DrawTable=function(position)
|
|
1029
1399
|
{
|
|
@@ -1093,18 +1463,36 @@ function ChartStockData()
|
|
|
1093
1463
|
{
|
|
1094
1464
|
if (i==0 && item.ShowType==1) //整行显示
|
|
1095
1465
|
{
|
|
1466
|
+
var mouseOnItem=this.IsMouseOn(item.Key);
|
|
1096
1467
|
var textWidth=this.Canvas.measureText(text).width;
|
|
1097
1468
|
var x=xText+(cellWidth*3)-textWidth-config.CellMargin.Right;
|
|
1469
|
+
var rtCell={ Left:xText+cellWidth, Top:top, Width:cellWidth*2, Height:cellHeight};
|
|
1470
|
+
rtCell.Right=rtCell.Left+rtCell.Width;
|
|
1471
|
+
rtCell.Bottom=rtCell.Top+rtCell.Height;
|
|
1472
|
+
if (mouseOnItem) this.DrawMouseOnRect(rtCell);
|
|
1473
|
+
|
|
1098
1474
|
this.Canvas.fillStyle=color;
|
|
1099
1475
|
this.Canvas.fillText(text,x,yBottom);
|
|
1476
|
+
|
|
1477
|
+
if (this.MapMouseOnKey.has(item.Key))
|
|
1478
|
+
this.AryCellRect.push({ Rect:rtCell, Data:{ Type:2, Key:item.Key, Value:dataItem }});
|
|
1100
1479
|
break;
|
|
1101
1480
|
}
|
|
1102
1481
|
else
|
|
1103
1482
|
{
|
|
1483
|
+
var mouseOnItem=this.IsMouseOn(item.Key);
|
|
1104
1484
|
var textWidth=this.Canvas.measureText(text).width;
|
|
1105
1485
|
var x=xText+cellWidth-textWidth-config.CellMargin.Right;
|
|
1486
|
+
var rtCell={ Left:xText, Top:top, Width:cellWidth, Height:cellHeight};
|
|
1487
|
+
rtCell.Right=rtCell.Left+rtCell.Width;
|
|
1488
|
+
rtCell.Bottom=rtCell.Top+rtCell.Height;
|
|
1489
|
+
if (mouseOnItem) this.DrawMouseOnRect(rtCell);
|
|
1490
|
+
|
|
1106
1491
|
this.Canvas.fillStyle=color;
|
|
1107
1492
|
this.Canvas.fillText(text,x,yBottom);
|
|
1493
|
+
|
|
1494
|
+
if (this.MapMouseOnKey.has(item.Key))
|
|
1495
|
+
this.AryCellRect.push({ Rect:rtCell, Data:{ Type:2, Key:item.Key, Value:dataItem }});
|
|
1108
1496
|
}
|
|
1109
1497
|
|
|
1110
1498
|
}
|