hqchart 1.1.13520 → 1.1.13531
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 +225 -197
- package/package.json +1 -1
- package/src/jscommon/umychart.js +23 -4
- package/src/jscommon/umychart.report.js +404 -25
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +428 -30
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +428 -30
|
@@ -16,18 +16,76 @@ function JSReportChart(divElement)
|
|
|
16
16
|
this.DivElement=divElement;
|
|
17
17
|
this.JSChartContainer; //表格控件
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
//h5 canvas
|
|
20
|
+
this.CanvasElement=document.createElement("canvas");
|
|
21
|
+
this.CanvasElement.className='jsreportlist-drawing';
|
|
22
|
+
this.CanvasElement.id=Guid();
|
|
23
|
+
this.CanvasElement.setAttribute("tabindex",0);
|
|
24
|
+
if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
|
|
25
|
+
if(divElement.hasChildNodes())
|
|
26
|
+
{
|
|
27
|
+
JSConsole.Chart.Log("[JSReportChart::JSReportChart] divElement hasChildNodes", divElement.childNodes);
|
|
28
|
+
}
|
|
29
|
+
divElement.appendChild(this.CanvasElement);
|
|
30
|
+
|
|
31
|
+
//额外的画布
|
|
32
|
+
this.MapExtraCanvasElement=new Map(); //key=画布名字, value={ Element:, Canvas:}
|
|
33
|
+
|
|
34
|
+
this.CreateExtraCanvasElement=function(name, option)
|
|
35
|
+
{
|
|
36
|
+
if (this.MapExtraCanvasElement.has(name)) return this.MapExtraCanvasElement.get(name);
|
|
37
|
+
|
|
38
|
+
var element=document.createElement("canvas");
|
|
39
|
+
element.className='jsreportlist-drawing-extra';
|
|
40
|
+
element.id=Guid();
|
|
41
|
+
if (name==JSReportChart.CorssCursorCanvasKey)
|
|
42
|
+
element.setAttribute("tabindex",5);
|
|
43
|
+
else
|
|
44
|
+
element.setAttribute("tabindex",1);
|
|
45
|
+
|
|
46
|
+
if (element.style)
|
|
47
|
+
{
|
|
48
|
+
element.style.outline='none';
|
|
49
|
+
element.style.position="absolute";
|
|
50
|
+
element.style.left='0px';
|
|
51
|
+
element.style.top='0px';
|
|
52
|
+
element.style["pointer-events"]="none";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (option)
|
|
56
|
+
{
|
|
57
|
+
if (IFrameSplitOperator.IsNumber(option.TabIndex)) element.setAttribute("tabindex",option.TabIndex);
|
|
58
|
+
if (IFrameSplitOperator.IsNumber(option.ZIndex)) element.style["z-index"]=option.ZIndex;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (this.CanvasElement)
|
|
62
|
+
{
|
|
63
|
+
element.height=this.CanvasElement.height;
|
|
64
|
+
element.width=this.CanvasElement.width;
|
|
65
|
+
if (element.style)
|
|
66
|
+
{
|
|
67
|
+
element.style.width=this.CanvasElement.style.width;
|
|
68
|
+
element.style.height=this.CanvasElement.style.height
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
divElement.appendChild(element);
|
|
73
|
+
|
|
74
|
+
var item={ Element:element, Canvas:null };
|
|
75
|
+
this.MapExtraCanvasElement.set(name, item);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.GetExtraCanvas=function(name)
|
|
79
|
+
{
|
|
80
|
+
if (!this.MapExtraCanvasElement.has(name)) return null;
|
|
81
|
+
|
|
82
|
+
var item=this.MapExtraCanvasElement.get(name);
|
|
83
|
+
if (!item.Element) return null;
|
|
30
84
|
|
|
85
|
+
if (!item.Canvas) item.Canvas=item.Element.getContext("2d");
|
|
86
|
+
|
|
87
|
+
return item;
|
|
88
|
+
}
|
|
31
89
|
|
|
32
90
|
this.OnSize=function()
|
|
33
91
|
{
|
|
@@ -42,6 +100,19 @@ function JSReportChart(divElement)
|
|
|
42
100
|
this.CanvasElement.height*=pixelTatio;
|
|
43
101
|
this.CanvasElement.width*=pixelTatio;
|
|
44
102
|
|
|
103
|
+
//扩展画布
|
|
104
|
+
for(var mapItem of this.MapExtraCanvasElement)
|
|
105
|
+
{
|
|
106
|
+
var item=mapItem[1];
|
|
107
|
+
var element=item.Element;
|
|
108
|
+
if (!element) continue;
|
|
109
|
+
|
|
110
|
+
element.height=this.CanvasElement.height;
|
|
111
|
+
element.width=this.CanvasElement.width;
|
|
112
|
+
element.style.width=this.CanvasElement.style.width;
|
|
113
|
+
element.style.height=this.CanvasElement.style.height;
|
|
114
|
+
}
|
|
115
|
+
|
|
45
116
|
JSConsole.Chart.Log(`[JSReportChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
|
|
46
117
|
|
|
47
118
|
if (this.JSChartContainer && this.JSChartContainer.OnSize)
|
|
@@ -62,6 +133,10 @@ function JSReportChart(divElement)
|
|
|
62
133
|
this.DivElement.JSChart=this; //div中保存一份
|
|
63
134
|
|
|
64
135
|
if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
|
|
136
|
+
if (option.EnableTooltip)
|
|
137
|
+
{
|
|
138
|
+
this.CreateExtraCanvasElement(JSReportChart.TooltipCursorCanvasKey, { ZIndex:99 });
|
|
139
|
+
}
|
|
65
140
|
|
|
66
141
|
if (option.Symbol) chart.Symbol=option.Symbol;
|
|
67
142
|
if (option.Name) chart.Name=option.Name;
|
|
@@ -83,6 +158,8 @@ function JSReportChart(divElement)
|
|
|
83
158
|
this.CreateJSReportChartContainer=function(option)
|
|
84
159
|
{
|
|
85
160
|
var chart=new JSReportChartContainer(this.CanvasElement);
|
|
161
|
+
chart.GetExtraCanvas=(name)=>{ return this.GetExtraCanvas(name); }
|
|
162
|
+
|
|
86
163
|
chart.Create(option);
|
|
87
164
|
|
|
88
165
|
if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
|
|
@@ -203,6 +280,8 @@ function JSReportChart(divElement)
|
|
|
203
280
|
}
|
|
204
281
|
}
|
|
205
282
|
|
|
283
|
+
JSReportChart.TooltipCursorCanvasKey="hq_report_tooltip"; //提示信息
|
|
284
|
+
|
|
206
285
|
|
|
207
286
|
JSReportChart.Init=function(divElement)
|
|
208
287
|
{
|
|
@@ -281,6 +360,9 @@ function JSReportChartContainer(uielement)
|
|
|
281
360
|
this.SplashTitle={ StockList:"下载码表中.....", MemberList:"下载成分中....." } ;
|
|
282
361
|
|
|
283
362
|
this.Canvas=uielement.getContext("2d"); //画布
|
|
363
|
+
|
|
364
|
+
this.TooltipCanvas;
|
|
365
|
+
this.ChartTooltip;
|
|
284
366
|
|
|
285
367
|
this.Tooltip=document.createElement("div");
|
|
286
368
|
this.Tooltip.className='jsreport-tooltip';
|
|
@@ -352,6 +434,8 @@ function JSReportChartContainer(uielement)
|
|
|
352
434
|
this.JSPopMenu; //内置菜单
|
|
353
435
|
this.IsShowRightMenu=true;
|
|
354
436
|
|
|
437
|
+
this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null };
|
|
438
|
+
|
|
355
439
|
this.ChartDestory=function() //销毁
|
|
356
440
|
{
|
|
357
441
|
this.IsDestroy=true;
|
|
@@ -421,6 +505,15 @@ function JSReportChartContainer(uielement)
|
|
|
421
505
|
}
|
|
422
506
|
|
|
423
507
|
|
|
508
|
+
//清空画布
|
|
509
|
+
this.ClearCanvas=function(canvas)
|
|
510
|
+
{
|
|
511
|
+
if (!canvas) return;
|
|
512
|
+
if (!this.UIElement) return;
|
|
513
|
+
|
|
514
|
+
canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
|
|
515
|
+
}
|
|
516
|
+
|
|
424
517
|
//清空固定行数据
|
|
425
518
|
this.ClearFixedRowData=function()
|
|
426
519
|
{
|
|
@@ -493,6 +586,12 @@ function JSReportChartContainer(uielement)
|
|
|
493
586
|
|
|
494
587
|
this.ChartPaint[0]=chart;
|
|
495
588
|
|
|
589
|
+
//提示信息
|
|
590
|
+
var chartTooltip=new ChartCellTooltip();
|
|
591
|
+
chartTooltip.Frame=this.Frame;
|
|
592
|
+
chartTooltip.ChartBorder=this.Frame.ChartBorder;
|
|
593
|
+
this.ChartTooltip=chartTooltip;
|
|
594
|
+
|
|
496
595
|
//页脚
|
|
497
596
|
if (option && option.PageInfo===true)
|
|
498
597
|
{
|
|
@@ -604,6 +703,8 @@ function JSReportChartContainer(uielement)
|
|
|
604
703
|
{
|
|
605
704
|
this.DelayDraw(500);
|
|
606
705
|
}
|
|
706
|
+
|
|
707
|
+
this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
|
|
607
708
|
}
|
|
608
709
|
|
|
609
710
|
this.DelayDraw=function(frequency)
|
|
@@ -1370,6 +1471,7 @@ function JSReportChartContainer(uielement)
|
|
|
1370
1471
|
console.log(`[OnWheel] wheelValue=${wheelValue}`);
|
|
1371
1472
|
if (wheelValue<0) //下
|
|
1372
1473
|
{
|
|
1474
|
+
this.LastMouseStatus.TooltipStatus=null;
|
|
1373
1475
|
if (this.GotoNextItem(1))
|
|
1374
1476
|
{
|
|
1375
1477
|
this.Draw();
|
|
@@ -1378,6 +1480,7 @@ function JSReportChartContainer(uielement)
|
|
|
1378
1480
|
}
|
|
1379
1481
|
else if (wheelValue>0) //上
|
|
1380
1482
|
{
|
|
1483
|
+
this.LastMouseStatus.TooltipStatus=null;
|
|
1381
1484
|
if (this.GotoNextItem(-1))
|
|
1382
1485
|
{
|
|
1383
1486
|
this.Draw();
|
|
@@ -1389,6 +1492,7 @@ function JSReportChartContainer(uielement)
|
|
|
1389
1492
|
{
|
|
1390
1493
|
if (wheelValue<0) //下一页
|
|
1391
1494
|
{
|
|
1495
|
+
this.LastMouseStatus.TooltipStatus=null;
|
|
1392
1496
|
if (this.GotoNextPage(this.PageUpDownCycle))
|
|
1393
1497
|
{
|
|
1394
1498
|
this.Draw();
|
|
@@ -1397,6 +1501,7 @@ function JSReportChartContainer(uielement)
|
|
|
1397
1501
|
}
|
|
1398
1502
|
else if (wheelValue>0) //上一页
|
|
1399
1503
|
{
|
|
1504
|
+
this.LastMouseStatus.TooltipStatus=null;
|
|
1400
1505
|
if (this.GotoPreviousPage(this.PageUpDownCycle))
|
|
1401
1506
|
{
|
|
1402
1507
|
this.Draw();
|
|
@@ -1618,7 +1723,13 @@ function JSReportChartContainer(uielement)
|
|
|
1618
1723
|
var pixelTatio = GetDevicePixelRatio();
|
|
1619
1724
|
var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
|
|
1620
1725
|
var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
|
|
1726
|
+
|
|
1727
|
+
this.LastMouseStatus.OnMouseMove=null;
|
|
1621
1728
|
|
|
1729
|
+
var bDrawTooltip=false;
|
|
1730
|
+
if (this.LastMouseStatus.TooltipStatus) bDrawTooltip=true;
|
|
1731
|
+
this.LastMouseStatus.TooltipStatus=null;
|
|
1732
|
+
|
|
1622
1733
|
if (this.DragRow) return;
|
|
1623
1734
|
if (this.DrawHeader) return;
|
|
1624
1735
|
if (this.DragColumnWidth) return;
|
|
@@ -1638,10 +1749,11 @@ function JSReportChartContainer(uielement)
|
|
|
1638
1749
|
}
|
|
1639
1750
|
}
|
|
1640
1751
|
|
|
1752
|
+
this.LastMouseStatus.OnMouseMove={ X:x, Y:y };
|
|
1641
1753
|
var mouseStatus={ Cursor:"default", Name:"Default"};; //鼠标状态
|
|
1642
1754
|
var report=this.GetReportChart();
|
|
1643
|
-
var cell=null;
|
|
1644
1755
|
var bDraw=false;
|
|
1756
|
+
|
|
1645
1757
|
if (report)
|
|
1646
1758
|
{
|
|
1647
1759
|
var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);
|
|
@@ -1652,7 +1764,12 @@ function JSReportChartContainer(uielement)
|
|
|
1652
1764
|
}
|
|
1653
1765
|
else
|
|
1654
1766
|
{
|
|
1655
|
-
|
|
1767
|
+
var tooltipData=report.GetTooltipData(x,y); //单元格提示信息
|
|
1768
|
+
if (tooltipData)
|
|
1769
|
+
{
|
|
1770
|
+
this.LastMouseStatus.TooltipStatus={ X:x, Y:y, Data:tooltipData };
|
|
1771
|
+
bDrawTooltip=true;
|
|
1772
|
+
}
|
|
1656
1773
|
}
|
|
1657
1774
|
|
|
1658
1775
|
var scrollbar=report.VScrollbar;
|
|
@@ -1668,16 +1785,20 @@ function JSReportChartContainer(uielement)
|
|
|
1668
1785
|
}
|
|
1669
1786
|
}
|
|
1670
1787
|
|
|
1788
|
+
|
|
1789
|
+
/* 目前没有用到
|
|
1671
1790
|
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);
|
|
1672
1791
|
if (event)
|
|
1673
1792
|
{
|
|
1674
1793
|
var sendData={X:x, Y:y, Cell:cell };
|
|
1675
1794
|
event.Callback(event,sendData,this);
|
|
1676
1795
|
}
|
|
1796
|
+
*/
|
|
1677
1797
|
|
|
1678
1798
|
if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
|
|
1679
1799
|
|
|
1680
1800
|
if (bDraw) this.Draw();
|
|
1801
|
+
else if (bDrawTooltip) this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
|
|
1681
1802
|
}
|
|
1682
1803
|
|
|
1683
1804
|
this.UIOnMounseOut=function(e)
|
|
@@ -3246,6 +3367,28 @@ function JSReportChartContainer(uielement)
|
|
|
3246
3367
|
|
|
3247
3368
|
return true;
|
|
3248
3369
|
}
|
|
3370
|
+
|
|
3371
|
+
this.DrawTooltip=function(tooltipStatus)
|
|
3372
|
+
{
|
|
3373
|
+
if (!this.GetExtraCanvas) return;
|
|
3374
|
+
if (!this.TooltipCanvas)
|
|
3375
|
+
{
|
|
3376
|
+
var finder=this.GetExtraCanvas(JSReportChart.TooltipCursorCanvasKey);
|
|
3377
|
+
if (!finder) return;
|
|
3378
|
+
this.TooltipCanvas=finder.Canvas;
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
if (!this.TooltipCanvas) return;
|
|
3382
|
+
this.ClearCanvas(this.TooltipCanvas);
|
|
3383
|
+
if (!this.ChartTooltip) return;
|
|
3384
|
+
|
|
3385
|
+
if (!tooltipStatus || !tooltipStatus.Data) return;
|
|
3386
|
+
|
|
3387
|
+
this.ChartTooltip.Canvas=this.TooltipCanvas;
|
|
3388
|
+
this.ChartTooltip.Point={ X:tooltipStatus.X, Y:tooltipStatus.Y };
|
|
3389
|
+
this.ChartTooltip.Data=tooltipStatus.Data.Data;
|
|
3390
|
+
this.ChartTooltip.Draw();
|
|
3391
|
+
}
|
|
3249
3392
|
}
|
|
3250
3393
|
|
|
3251
3394
|
|
|
@@ -3556,6 +3699,9 @@ function ChartReport()
|
|
|
3556
3699
|
|
|
3557
3700
|
this.RectClient={};
|
|
3558
3701
|
|
|
3702
|
+
//{ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:{ AryText:[ {Text:xx} ]} };
|
|
3703
|
+
//Type:1=数据截断
|
|
3704
|
+
// { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }}
|
|
3559
3705
|
this.TooltipRect=[];
|
|
3560
3706
|
|
|
3561
3707
|
this.ReloadResource=function(resource)
|
|
@@ -3654,7 +3800,6 @@ function ChartReport()
|
|
|
3654
3800
|
if (item.FullColBGColor) colItem.FullColBGColor=item.FullColBGColor; //整列背景色
|
|
3655
3801
|
if (item.HeaderBGColor) colItem.HeaderBGColor=item.HeaderBGColor; //表头背景色
|
|
3656
3802
|
if (IFrameSplitOperator.IsNumber(item.Sort)) colItem.Sort=item.Sort;
|
|
3657
|
-
if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
|
|
3658
3803
|
if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
|
|
3659
3804
|
if (IFrameSplitOperator.IsBool(item.EnableDragWidth)) colItem.EnableDragWidth=item.EnableDragWidth;
|
|
3660
3805
|
if (IFrameSplitOperator.IsBool(item.IsDrawCallback)) colItem.IsDrawCallback=item.IsDrawCallback;
|
|
@@ -3669,8 +3814,10 @@ function ChartReport()
|
|
|
3669
3814
|
if (item.Type==REPORT_COLUMN_ID.CUSTOM_STRING_TEXT_ID)
|
|
3670
3815
|
{
|
|
3671
3816
|
if (!IFrameSplitOperator.IsNumber(item.DataIndex) && !IFrameSplitOperator.IsNumber(item.BlockIndex)) continue;
|
|
3817
|
+
colItem.FormatType=0; //0=默认格式 1=长度不够使用...
|
|
3672
3818
|
if (IFrameSplitOperator.IsNumber(item.DataIndex)) colItem.DataIndex=item.DataIndex; //数据在扩展数据索引列
|
|
3673
3819
|
if (IFrameSplitOperator.IsNumber(item.BlockIndex)) colItem.BlockIndex=item.BlockIndex;
|
|
3820
|
+
if (IFrameSplitOperator.IsNumber(item.FormatType)) colItem.FormatType=item.FormatType; //输出样式
|
|
3674
3821
|
}
|
|
3675
3822
|
else if (item.Type==REPORT_COLUMN_ID.CUSTOM_NUMBER_TEXT_ID)
|
|
3676
3823
|
{
|
|
@@ -4368,7 +4515,7 @@ function ChartReport()
|
|
|
4368
4515
|
var x=left+this.ItemMergin.Left;
|
|
4369
4516
|
var textWidth=column.Width-this.ItemMergin.Left-this.ItemMergin.Right;
|
|
4370
4517
|
var stock=data.Stock;
|
|
4371
|
-
var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign };
|
|
4518
|
+
var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign, Tooltip:null };
|
|
4372
4519
|
var rtItem={ Left:left, Top:top, Width:column.Width, Height:this.RowHeight };
|
|
4373
4520
|
rtItem.Right=rtItem.Left+rtItem.Width;
|
|
4374
4521
|
rtItem.Bottom=rtItem.Top+rtItem.Height;
|
|
@@ -4379,12 +4526,6 @@ function ChartReport()
|
|
|
4379
4526
|
this.DrawItemBG({ Rect:rtItem, BGColor:column.FullColBGColor });
|
|
4380
4527
|
}
|
|
4381
4528
|
|
|
4382
|
-
//tooltip提示
|
|
4383
|
-
if (column.EnableTooltip===true)
|
|
4384
|
-
{
|
|
4385
|
-
this.TooltipRect.push({ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType })
|
|
4386
|
-
}
|
|
4387
|
-
|
|
4388
4529
|
if (column.Type==REPORT_COLUMN_ID.INDEX_ID)
|
|
4389
4530
|
{
|
|
4390
4531
|
if (rowType==1) return; //固定行序号空
|
|
@@ -4626,10 +4767,84 @@ function ChartReport()
|
|
|
4626
4767
|
}
|
|
4627
4768
|
|
|
4628
4769
|
this.DrawItemBG(drawInfo);
|
|
4629
|
-
|
|
4770
|
+
|
|
4771
|
+
if (column.Type==REPORT_COLUMN_ID.CUSTOM_STRING_TEXT_ID)
|
|
4772
|
+
this.DrawCustomText(drawInfo,column, x, top, textWidth);
|
|
4773
|
+
else
|
|
4774
|
+
this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
|
|
4775
|
+
}
|
|
4776
|
+
|
|
4777
|
+
//tooltip提示
|
|
4778
|
+
if (drawInfo.Tooltip)
|
|
4779
|
+
{
|
|
4780
|
+
//Type:1=数据截断
|
|
4781
|
+
var tooltipData={ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:drawInfo.Tooltip.Data };
|
|
4782
|
+
this.TooltipRect.push(tooltipData);
|
|
4630
4783
|
}
|
|
4631
4784
|
}
|
|
4632
4785
|
|
|
4786
|
+
this.DrawCustomText=function(drawInfo, column, left, top, cellWidth)
|
|
4787
|
+
{
|
|
4788
|
+
if (!drawInfo.Text) return;
|
|
4789
|
+
|
|
4790
|
+
var text=drawInfo.Text;
|
|
4791
|
+
var x=left;
|
|
4792
|
+
if (drawInfo.TextAlign=='center')
|
|
4793
|
+
{
|
|
4794
|
+
x=left+cellWidth/2;
|
|
4795
|
+
this.Canvas.textAlign="center";
|
|
4796
|
+
}
|
|
4797
|
+
else if (drawInfo.TextAlign=='right')
|
|
4798
|
+
{
|
|
4799
|
+
x=left+cellWidth-2;
|
|
4800
|
+
this.Canvas.textAlign="right";
|
|
4801
|
+
}
|
|
4802
|
+
else
|
|
4803
|
+
{
|
|
4804
|
+
x+=2;
|
|
4805
|
+
this.Canvas.textAlign="left";
|
|
4806
|
+
}
|
|
4807
|
+
|
|
4808
|
+
var textWidth=this.Canvas.measureText(text).width+1;
|
|
4809
|
+
var bClip=false;
|
|
4810
|
+
if (textWidth>=cellWidth) //长度超过单元格 裁剪
|
|
4811
|
+
{
|
|
4812
|
+
if (column.FormatType==2)
|
|
4813
|
+
{
|
|
4814
|
+
var count=text.length+5;
|
|
4815
|
+
text="";
|
|
4816
|
+
for(var i=0;i<count;++i)
|
|
4817
|
+
text+="#";
|
|
4818
|
+
}
|
|
4819
|
+
else if (column.FormatType==1)
|
|
4820
|
+
{
|
|
4821
|
+
text=this.TextEllipsis(text, cellWidth, column.MaxText);
|
|
4822
|
+
}
|
|
4823
|
+
|
|
4824
|
+
this.Canvas.save();
|
|
4825
|
+
bClip=true;
|
|
4826
|
+
|
|
4827
|
+
var rtCell={ Left:left, Top:top+this.ItemMergin.Top, Width:cellWidth, Height:this.RowHeight };
|
|
4828
|
+
this.Canvas.beginPath();
|
|
4829
|
+
this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
|
|
4830
|
+
//this.Canvas.stroke(); //调试用
|
|
4831
|
+
this.Canvas.clip();
|
|
4832
|
+
|
|
4833
|
+
//数据截断提示信息
|
|
4834
|
+
drawInfo.Tooltip=
|
|
4835
|
+
{
|
|
4836
|
+
Type:1,
|
|
4837
|
+
Data:{ AryText:[ {Text:drawInfo.Text} ] }
|
|
4838
|
+
}
|
|
4839
|
+
}
|
|
4840
|
+
|
|
4841
|
+
this.Canvas.textBaseline="middle";
|
|
4842
|
+
this.Canvas.fillStyle=drawInfo.TextColor;
|
|
4843
|
+
this.Canvas.fillText(text,x,top+this.ItemMergin.Top+this.RowHeight/2);
|
|
4844
|
+
|
|
4845
|
+
if (bClip) this.Canvas.restore();
|
|
4846
|
+
}
|
|
4847
|
+
|
|
4633
4848
|
this.DrawSymbolName=function(data, column, left, top, rowType)
|
|
4634
4849
|
{
|
|
4635
4850
|
var stock=data.Stock;
|
|
@@ -5898,8 +6113,7 @@ function ChartReport()
|
|
|
5898
6113
|
|
|
5899
6114
|
}
|
|
5900
6115
|
|
|
5901
|
-
|
|
5902
|
-
this.PtInCell=function(x,y)
|
|
6116
|
+
this.GetTooltipData=function(x,y)
|
|
5903
6117
|
{
|
|
5904
6118
|
if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return null;
|
|
5905
6119
|
|
|
@@ -5911,9 +6125,11 @@ function ChartReport()
|
|
|
5911
6125
|
|
|
5912
6126
|
if (x>=rt.Left && x<=rt.Right && y>=rt.Top && y<=rt.Bottom)
|
|
5913
6127
|
{
|
|
5914
|
-
return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index };
|
|
6128
|
+
return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index, Type:item.Type, Data:item.Data };
|
|
5915
6129
|
}
|
|
5916
6130
|
}
|
|
6131
|
+
|
|
6132
|
+
return null;
|
|
5917
6133
|
}
|
|
5918
6134
|
|
|
5919
6135
|
this.PtInHeaderDragBorder=function(x, y)
|
|
@@ -6505,3 +6721,166 @@ function ChartVScrollbar()
|
|
|
6505
6721
|
return pos;
|
|
6506
6722
|
}
|
|
6507
6723
|
}
|
|
6724
|
+
|
|
6725
|
+
|
|
6726
|
+
function ChartCellTooltip()
|
|
6727
|
+
{
|
|
6728
|
+
this.Canvas; //画布
|
|
6729
|
+
this.ChartBorder; //边框信息
|
|
6730
|
+
this.ChartFrame; //框架画法
|
|
6731
|
+
this.Name; //名称
|
|
6732
|
+
this.ClassName='ChartCellTooltip'; //类名
|
|
6733
|
+
|
|
6734
|
+
this.BGColor="rgba(255,255,225, 0.9)";
|
|
6735
|
+
this.BorderColor="rgb(0,0,0)";
|
|
6736
|
+
this.Margin={ Left:5, Right:5, Top:4, Bottom:5 };
|
|
6737
|
+
this.Font=`${13*GetDevicePixelRatio()}px 微软雅黑`;
|
|
6738
|
+
this.TextColor="rgb(0,0,0)";
|
|
6739
|
+
this.YOffset=20;
|
|
6740
|
+
this.XOffset=5;
|
|
6741
|
+
|
|
6742
|
+
this.Point; //{ X, Y}
|
|
6743
|
+
this.Data; //{ AryText:[ { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }} ]}
|
|
6744
|
+
|
|
6745
|
+
|
|
6746
|
+
this.Draw=function()
|
|
6747
|
+
{
|
|
6748
|
+
if (!this.Canvas) return;
|
|
6749
|
+
if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.AryText)) return;
|
|
6750
|
+
if (!this.Point) return;
|
|
6751
|
+
|
|
6752
|
+
var size={ Width:0, Height:0, Text:[] };
|
|
6753
|
+
this.CalculateTextSize(this.Data.AryText, size);
|
|
6754
|
+
if (!IFrameSplitOperator.IsNonEmptyArray(size.Text)) return;
|
|
6755
|
+
|
|
6756
|
+
this.DrawTooltip(this.Data.AryText, size);
|
|
6757
|
+
}
|
|
6758
|
+
|
|
6759
|
+
this.CalculateTextSize=function(aryText, size)
|
|
6760
|
+
{
|
|
6761
|
+
var width=0, height=0;
|
|
6762
|
+
for(var i=0;i<aryText.length;++i)
|
|
6763
|
+
{
|
|
6764
|
+
var item=aryText[i];
|
|
6765
|
+
var titleHeight=0, titleWidth=0;
|
|
6766
|
+
if (!item.Title && !item.Text) continue;
|
|
6767
|
+
|
|
6768
|
+
if (item.Title)
|
|
6769
|
+
{
|
|
6770
|
+
if (item.TitleFont) this.Canvas.font=item.TitleFont;
|
|
6771
|
+
else this.Canvas.font=this.Font;
|
|
6772
|
+
|
|
6773
|
+
titleWidth=this.Canvas.measureText(item.Title).width;
|
|
6774
|
+
titleHeight=this.Canvas.measureText("擎").width;
|
|
6775
|
+
}
|
|
6776
|
+
|
|
6777
|
+
var textWidth=0, textHeight=0;
|
|
6778
|
+
if (item.Text)
|
|
6779
|
+
{
|
|
6780
|
+
if (item.Font) this.Canvas.font=item.Font;
|
|
6781
|
+
else this.Canvas.font=this.Font;
|
|
6782
|
+
|
|
6783
|
+
textWidth=this.Canvas.measureText(item.Text).width;
|
|
6784
|
+
textHeight=this.Canvas.measureText("擎").width;
|
|
6785
|
+
}
|
|
6786
|
+
|
|
6787
|
+
var itemWidth=titleWidth+textWidth;
|
|
6788
|
+
var itemHeight=Math.max(textHeight,titleHeight);
|
|
6789
|
+
|
|
6790
|
+
if (IFrameSplitOperator.IsNumber(item.Space)) itemWidth+=item.Space;
|
|
6791
|
+
|
|
6792
|
+
if (item.Margin)
|
|
6793
|
+
{
|
|
6794
|
+
var margin=item.Margin;
|
|
6795
|
+
if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
|
|
6796
|
+
if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
|
|
6797
|
+
if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
|
|
6798
|
+
if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
|
|
6799
|
+
}
|
|
6800
|
+
|
|
6801
|
+
if (width<itemWidth) width=itemWidth;
|
|
6802
|
+
height+=itemHeight;
|
|
6803
|
+
|
|
6804
|
+
size.Text[i]={ Width: itemWidth, Height:itemHeight, TitleWidth:titleWidth, TextWidth:textWidth };
|
|
6805
|
+
}
|
|
6806
|
+
|
|
6807
|
+
if (this.Margin)
|
|
6808
|
+
{
|
|
6809
|
+
var margin=this.Margin;
|
|
6810
|
+
if (IFrameSplitOperator.IsNumber(margin.Left)) width+=margin.Left;
|
|
6811
|
+
if (IFrameSplitOperator.IsNumber(margin.Right)) width+=margin.Right;
|
|
6812
|
+
if (IFrameSplitOperator.IsNumber(margin.Top)) height+=margin.Top;
|
|
6813
|
+
if (IFrameSplitOperator.IsNumber(margin.Bottom)) height+=margin.Bottom;
|
|
6814
|
+
}
|
|
6815
|
+
|
|
6816
|
+
size.Width=width;
|
|
6817
|
+
size.Height=height;
|
|
6818
|
+
}
|
|
6819
|
+
|
|
6820
|
+
this.DrawTooltip=function(aryText, size)
|
|
6821
|
+
{
|
|
6822
|
+
var rtBG={ Left:this.Point.X+this.XOffset, Top:this.Point.Y+this.YOffset, Width:size.Width, Height:size.Height };
|
|
6823
|
+
rtBG.Right=rtBG.Left+rtBG.Width;
|
|
6824
|
+
rtBG.Bottom=rtBG.Top+rtBG.Height;
|
|
6825
|
+
|
|
6826
|
+
var border=this.ChartBorder.GetBorder();
|
|
6827
|
+
if (rtBG.Bottom>border.ChartHeight)
|
|
6828
|
+
{
|
|
6829
|
+
rtBG.Bottom=this.Point.Y;
|
|
6830
|
+
rtBG.Top=rtBG.Bottom-rtBG.Height;
|
|
6831
|
+
}
|
|
6832
|
+
|
|
6833
|
+
if (rtBG.Right>border.ChartWidth)
|
|
6834
|
+
{
|
|
6835
|
+
rtBG.Right=this.Point.X;
|
|
6836
|
+
rtBG.Left=rtBG.Right-rtBG.Width;
|
|
6837
|
+
}
|
|
6838
|
+
|
|
6839
|
+
if (this.BGColor)
|
|
6840
|
+
{
|
|
6841
|
+
this.Canvas.fillStyle=this.BGColor;
|
|
6842
|
+
this.Canvas.fillRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
|
|
6843
|
+
}
|
|
6844
|
+
|
|
6845
|
+
if (this.BorderColor)
|
|
6846
|
+
{
|
|
6847
|
+
this.Canvas.strokeStyle=this.BorderColor;
|
|
6848
|
+
this.Canvas.strokeRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
|
|
6849
|
+
}
|
|
6850
|
+
|
|
6851
|
+
var left=rtBG.Left;
|
|
6852
|
+
var top=rtBG.Top;
|
|
6853
|
+
if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Left)) left+=this.Margin.Left;
|
|
6854
|
+
if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Top)) top+=this.Margin.Top;
|
|
6855
|
+
|
|
6856
|
+
var xText, yText=top;
|
|
6857
|
+
for(var i=0;i<aryText.length;++i)
|
|
6858
|
+
{
|
|
6859
|
+
var item=aryText[i];
|
|
6860
|
+
if (!item.Title && !item.Text) continue;
|
|
6861
|
+
var itemSize=size.Text[i];
|
|
6862
|
+
|
|
6863
|
+
xText=left;
|
|
6864
|
+
yText+=itemSize.Height;
|
|
6865
|
+
|
|
6866
|
+
if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Left)) xText+=item.Margin.Left;
|
|
6867
|
+
if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Bottom)) yText-=item.Margin.Bottom;
|
|
6868
|
+
if (item.Title)
|
|
6869
|
+
{
|
|
6870
|
+
if (item.TitleColor) this.Canvas.fillStyle=item.TitleColor;
|
|
6871
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
6872
|
+
this.Canvas.fillText(item.Title,xText,yText,itemSize.TitleWidth);
|
|
6873
|
+
xText+=itemSize.titleWidth;
|
|
6874
|
+
if (IFrameSplitOperator.IsNumber(item.Space)) xText+=item.Space;
|
|
6875
|
+
}
|
|
6876
|
+
|
|
6877
|
+
if (item.Text)
|
|
6878
|
+
{
|
|
6879
|
+
if (item.Color) this.Canvas.fillStyle=item.Color;
|
|
6880
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
6881
|
+
this.Canvas.fillText(item.Text,xText,yText,itemSize.TextWidth);
|
|
6882
|
+
}
|
|
6883
|
+
|
|
6884
|
+
}
|
|
6885
|
+
}
|
|
6886
|
+
}
|