hqchart 1.1.13100 → 1.1.13107

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.
@@ -82,6 +82,7 @@ function JSReportChart(divElement)
82
82
  if (IFrameSplitOperator.IsBool(option.EnableDragRow)) chart.EnableDragRow=option.EnableDragRow;
83
83
  if (IFrameSplitOperator.IsNumber(option.DragRowType)) chart.DragRowType=option.DragRowType;
84
84
  if (IFrameSplitOperator.IsBool(option.EnableDragHeader)) chart.EnableDragHeader=option.EnableDragHeader;
85
+ if (option.VScrollbar) chart.SetVScrollbar(option.VScrollbar);
85
86
  if (option.SortInfo)
86
87
  {
87
88
  var item=option.SortInfo;
@@ -278,7 +279,7 @@ function JSReportChartContainer(uielement)
278
279
 
279
280
  this.FlashBG=new Map();
280
281
  this.FlashBGTimer=null; //闪烁背景 Value:{ LastTime:数据最后的时间, Data: { Key:ID, BGColor:, Time: , Count: 次数 } };
281
- this.GlobalOption={ FlashBGCount:0 }
282
+ this.GlobalOption={ FlashBGCount:0 };
282
283
 
283
284
  //this.FixedRowData.Data=[ [null, {Value:11, Text:"11" }], [null, null, null, {Value:12, Text:"ddddd", Color:"rgb(45,200,4)"}]];
284
285
 
@@ -320,6 +321,8 @@ function JSReportChartContainer(uielement)
320
321
 
321
322
  //拖拽滚动条
322
323
  this.DragXScroll=null; //{Start:{x,y}, End:{x, y}}
324
+ this.DragYScroll=null;
325
+ this.IsShowVScrollbar=false;
323
326
 
324
327
  this.IsDestroy=false; //是否已经销毁了
325
328
 
@@ -436,11 +439,24 @@ function JSReportChartContainer(uielement)
436
439
  chart.GlobalOption=this.GlobalOption;
437
440
  chart.FixedRowData=this.FixedRowData;
438
441
  chart.SortInfo=this.SortInfo;
442
+
439
443
  chart.Tab=new ChartReportTab();
440
444
  chart.Tab.Frame=this.Frame;
441
445
  chart.Tab.Canvas=this.Canvas;
442
446
  chart.Tab.ChartBorder=this.Frame.ChartBorder;
443
447
  chart.Tab.Report=chart;
448
+
449
+ chart.VScrollbar=new ChartVScrollbar();
450
+ chart.VScrollbar.Frame=this.Frame;
451
+ chart.VScrollbar.Canvas=this.Canvas;
452
+ chart.VScrollbar.ChartBorder=this.Frame.ChartBorder;
453
+ chart.VScrollbar.Report=chart;
454
+ chart.VScrollbar.IsShowCallback=()=>
455
+ {
456
+ if (this.DragYScroll) return true;
457
+ return this.IsShowVScrollbar;
458
+ }
459
+
444
460
  this.ChartPaint[0]=chart;
445
461
 
446
462
  //页脚
@@ -1342,6 +1358,7 @@ function JSReportChartContainer(uielement)
1342
1358
  this.UIOnMouseDown=function(e)
1343
1359
  {
1344
1360
  this.DragXScroll=null;
1361
+ this.DragYScroll=null;
1345
1362
  this.DragHeader=null;
1346
1363
  this.DragColumnWidth=null;
1347
1364
  this.DragMove={ Click:{ X:e.clientX, Y:e.clientY }, Move:{X:e.clientX, Y:e.clientY}, PreMove:{X:e.clientX, Y:e.clientY } };
@@ -1418,6 +1435,38 @@ function JSReportChartContainer(uielement)
1418
1435
  this.OnClickTab(tabData, e);
1419
1436
  }
1420
1437
  }
1438
+ else if (clickData.Type==5 && e.button==0) //右侧滚动条
1439
+ {
1440
+ var scroll=clickData.VScrollbar;
1441
+ if (scroll.Type==1) //顶部按钮
1442
+ {
1443
+ if (this.MoveYOffset(-1))
1444
+ {
1445
+ this.Draw();
1446
+ this.DelayUpdateStockData();
1447
+ }
1448
+ }
1449
+ else if (scroll.Type==2) //底部按钮
1450
+ {
1451
+ if (this.MoveYOffset(1))
1452
+ {
1453
+ this.Draw();
1454
+ this.DelayUpdateStockData();
1455
+ }
1456
+ }
1457
+ else if (scroll.Type==3) //滚动条
1458
+ {
1459
+ this.DragYScroll={ Click:{X:x, Y:y}, LastMove:{X:x, Y:y} };
1460
+ }
1461
+ else if (scroll.Type==4) //滚动条内部
1462
+ {
1463
+ if (this.SetYOffset(scroll.Pos))
1464
+ {
1465
+ this.Draw();
1466
+ this.DelayUpdateStockData();
1467
+ }
1468
+ }
1469
+ }
1421
1470
  }
1422
1471
  }
1423
1472
 
@@ -1464,6 +1513,7 @@ function JSReportChartContainer(uielement)
1464
1513
  var mouseStatus={ Cursor:"default", Name:"Default"};; //鼠标状态
1465
1514
  var report=this.GetReportChart();
1466
1515
  var cell=null;
1516
+ var bDraw=false;
1467
1517
  if (report)
1468
1518
  {
1469
1519
  var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);
@@ -1476,6 +1526,18 @@ function JSReportChartContainer(uielement)
1476
1526
  {
1477
1527
  cell=report.PtInCell(x,y); //是否在单元格(EnableTooltip)
1478
1528
  }
1529
+
1530
+ var scrollbar=report.VScrollbar;
1531
+ if (scrollbar.Enable)
1532
+ {
1533
+ var bShowScrollbar=report.PtInClient(x,y);
1534
+ this.IsShowVScrollbar=bShowScrollbar;
1535
+ if (!this.DragYScroll)
1536
+ {
1537
+ if (bShowScrollbar && !scrollbar.LastStatus.Draw) bDraw=true;
1538
+ else if (!bShowScrollbar && scrollbar.LastStatus.Draw) bDraw=true;
1539
+ }
1540
+ }
1479
1541
  }
1480
1542
 
1481
1543
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);
@@ -1486,16 +1548,32 @@ function JSReportChartContainer(uielement)
1486
1548
  }
1487
1549
 
1488
1550
  if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
1551
+
1552
+ if (bDraw) this.Draw();
1489
1553
  }
1490
1554
 
1491
1555
  this.UIOnMounseOut=function(e)
1492
1556
  {
1557
+ var bDraw=false;
1493
1558
  var tabChart=this.GetTabChart();
1494
1559
  if (tabChart && tabChart.MoveOnTabIndex>=0)
1495
1560
  {
1496
1561
  tabChart.MoveOnTabIndex=-1;
1562
+ bDraw=true;
1497
1563
  this.Draw();
1498
1564
  }
1565
+
1566
+ var scrollbar=this.GetVScrollbarChart();
1567
+ if (scrollbar.Enable)
1568
+ {
1569
+ this.IsShowVScrollbar=false;
1570
+ if (!this.DragYScroll)
1571
+ {
1572
+ if (scrollbar.LastStatus.Draw) bDraw=true;
1573
+ }
1574
+ }
1575
+
1576
+ if (bDraw) this.Draw();
1499
1577
  }
1500
1578
 
1501
1579
  this.UIOnMouseleave=function(e)
@@ -1587,6 +1665,21 @@ function JSReportChartContainer(uielement)
1587
1665
  var pos=chart.Tab.GetScrollPostionByPoint(x,y);
1588
1666
  if (this.SetXOffset(pos)) this.Draw();
1589
1667
  }
1668
+ else if (this.DragYScroll)
1669
+ {
1670
+ var chart=this.ChartPaint[0];
1671
+ if (!chart || !chart.VScrollbar) return;
1672
+
1673
+ this.DragYScroll.LastMove.X=x;
1674
+ this.DragYScroll.LastMove.Y=y;
1675
+
1676
+ var pos=chart.VScrollbar.GetScrollPostionByPoint(x,y);
1677
+ if (this.SetYOffset(pos))
1678
+ {
1679
+ this.Draw();
1680
+ this.DelayUpdateStockData();
1681
+ }
1682
+ }
1590
1683
  else if (this.DragHeader && this.DragHeader.ClickData) //表头拖拽
1591
1684
  {
1592
1685
  if (this.DragHeader.ClickData.Header.IsFixed) return;
@@ -1729,6 +1822,11 @@ function JSReportChartContainer(uielement)
1729
1822
 
1730
1823
  this.DragHeader=null;
1731
1824
  this.DragXScroll=null;
1825
+ if (this.DragYScroll)
1826
+ {
1827
+ bRedraw=true;
1828
+ this.DragYScroll=null;
1829
+ }
1732
1830
  this.DragRow=null;
1733
1831
  this.DragMove=null;
1734
1832
  this.DragColumnWidth=null;
@@ -2037,6 +2135,14 @@ function JSReportChartContainer(uielement)
2037
2135
  return chart.Tab;
2038
2136
  }
2039
2137
 
2138
+ this.GetVScrollbarChart=function()
2139
+ {
2140
+ var chart=this.ChartPaint[0];
2141
+ if (!chart) return null;
2142
+
2143
+ return chart.VScrollbar;
2144
+ }
2145
+
2040
2146
  this.GetReportChart=function()
2041
2147
  {
2042
2148
  var chart=this.ChartPaint[0];
@@ -2328,6 +2434,21 @@ function JSReportChartContainer(uielement)
2328
2434
  return true;
2329
2435
  }
2330
2436
 
2437
+ this.SetYOffset=function(pos)
2438
+ {
2439
+ if (!IFrameSplitOperator.IsNumber(pos)) return false;
2440
+ var chart=this.ChartPaint[0];
2441
+ if (!chart) return false;
2442
+
2443
+ var maxOffset=chart.GetYScrollRange();
2444
+ if (pos<0) pos=0;
2445
+ if (pos>maxOffset) pos=maxOffset;
2446
+
2447
+ this.Data.YOffset=pos;
2448
+
2449
+ return true;
2450
+ }
2451
+
2331
2452
  this.GotoLastPage=function()
2332
2453
  {
2333
2454
  var chart=this.ChartPaint[0];
@@ -2364,6 +2485,17 @@ function JSReportChartContainer(uielement)
2364
2485
  if (option && option.Redraw) this.Draw();
2365
2486
  }
2366
2487
 
2488
+ this.SetVScrollbar=function(option)
2489
+ {
2490
+ var chart=this.GetReportChart();
2491
+ if (!chart) return;
2492
+
2493
+ var scrollbar=chart.VScrollbar;
2494
+ if (!scrollbar) return;
2495
+
2496
+ if (IFrameSplitOperator.IsBool(option.Enable)) scrollbar.Enable=option.Enable;
2497
+ }
2498
+
2367
2499
  this.SetSelectedTab=function(index, opiton)
2368
2500
  {
2369
2501
  var chart=this.ChartPaint[0];;
@@ -3057,6 +3189,7 @@ function ChartReport()
3057
3189
  this.DragRow; //拖拽行
3058
3190
 
3059
3191
  this.Tab;
3192
+ this.VScrollbar;
3060
3193
 
3061
3194
  this.GlobalOption;
3062
3195
 
@@ -3239,6 +3372,7 @@ function ChartReport()
3239
3372
  }
3240
3373
 
3241
3374
  if (this.Tab) this.Tab.ReloadResource(resource);
3375
+ if (this.VScrollbar) this.VScrollbar.ReloadResource(resource);
3242
3376
  }
3243
3377
 
3244
3378
  this.SetColumn=function(aryColumn)
@@ -3338,6 +3472,15 @@ function ChartReport()
3338
3472
  var maxOffset=this.Column.length-this.FixedColumn-3;
3339
3473
  if (maxOffset<0) return 0;
3340
3474
 
3475
+ return maxOffset;
3476
+ }
3477
+
3478
+ this.GetYScrollRange=function()
3479
+ {
3480
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return 0;
3481
+
3482
+ var maxOffset=this.Data.Data.length-this.RowCount;
3483
+
3341
3484
  return maxOffset;
3342
3485
  }
3343
3486
 
@@ -3434,6 +3577,12 @@ function ChartReport()
3434
3577
 
3435
3578
  this.DrawDragRow();
3436
3579
 
3580
+ if (this.VScrollbar)
3581
+ {
3582
+ var bottom=this.ChartBorder.GetBottom();
3583
+ this.VScrollbar.DrawScrollbar(this.RectClient.Left,this.RectClient.Top+this.HeaderHeight, this.RectClient.Right, bottom-this.BottomToolbarHeight-4);
3584
+ }
3585
+
3437
3586
  this.SizeChange=false;
3438
3587
  }
3439
3588
 
@@ -3487,6 +3636,8 @@ function ChartReport()
3487
3636
  this.BottomToolbarHeight=0;
3488
3637
  }
3489
3638
 
3639
+ if (this.VScrollbar && this.VScrollbar.Enable) this.VScrollbar.CalculateSize();
3640
+
3490
3641
  this.UpdateCacheData();
3491
3642
 
3492
3643
  var pixelRatio=GetDevicePixelRatio();
@@ -5047,7 +5198,7 @@ function ChartReport()
5047
5198
  return GetFontHeight(this.Canvas, font, word);
5048
5199
  }
5049
5200
 
5050
- this.OnMouseDown=function(x,y,e) //Type: 1=tab 4=固定行 2=行 3=表头
5201
+ this.OnMouseDown=function(x,y,e) //Type: 1=tab 4=固定行 2=行 3=表头 5=右侧滚动条
5051
5202
  {
5052
5203
  if (!this.Data) return null;
5053
5204
 
@@ -5057,6 +5208,12 @@ function ChartReport()
5057
5208
  if (tab) return { Type:1, Tab: tab }; //底部工具栏
5058
5209
  }
5059
5210
 
5211
+ if (this.VScrollbar)
5212
+ {
5213
+ var item=this.VScrollbar.OnMouseDown(x,y,e);
5214
+ if (item) return { Type:5, VScrollbar:item }; //右侧滚动条
5215
+ }
5216
+
5060
5217
  var pixelTatio = GetDevicePixelRatio();
5061
5218
  var insidePoint={X:x/pixelTatio, Y:y/pixelTatio};
5062
5219
 
@@ -5181,6 +5338,13 @@ function ChartReport()
5181
5338
  return false;
5182
5339
  }
5183
5340
 
5341
+ this.PtInClient=function(x,y)
5342
+ {
5343
+ if (x>this.RectClient.Left && x<this.RectClient.Right && y>this.RectClient.Top && y<this.RectClient.Bottom) return true;
5344
+
5345
+ return false;
5346
+ }
5347
+
5184
5348
  this.PtInBody=function(x,y)
5185
5349
  {
5186
5350
  if (!this.Data) return null;
@@ -5811,3 +5975,161 @@ function ChartReportPageInfo()
5811
5975
  this.SizeChange=false;
5812
5976
  }
5813
5977
  }
5978
+
5979
+
5980
+ function ChartVScrollbar()
5981
+ {
5982
+ this.Canvas; //画布
5983
+ this.ChartBorder; //边框信息
5984
+ this.ChartFrame; //框架画法
5985
+ this.Name; //名称
5986
+ this.ClassName='ChartReportTab'; //类名
5987
+ this.IsDrawFirst=false;
5988
+ this.GetEventCallback; //获取事件
5989
+ this.Report;
5990
+
5991
+ this.MaxPos=15; //滚动条可移动长度
5992
+ this.CurrentPos=15; //当前滚动条移动位置
5993
+ this.Step=1; //滚动条移动步长
5994
+ this.ButtonSize=25;
5995
+ this.Enable=false;
5996
+ this.LastStatus={ Draw:false, };
5997
+ this.GlobalOption;
5998
+
5999
+ this.ScrollBarHeight=g_JSChartResource.Report.VScrollbar.ScrollBarHeight;
6000
+ this.ButtonColor=g_JSChartResource.Report.VScrollbar.ButtonColor;
6001
+ this.BarColor=g_JSChartResource.Report.VScrollbar.BarColor;
6002
+ this.BorderColor=g_JSChartResource.Report.VScrollbar.BorderColor;
6003
+ this.BGColor=g_JSChartResource.Report.VScrollbar.BGColor;
6004
+ this.Mergin={ Left:2, Right:2, Top:2, Bottom:2 };
6005
+ this.BarWithConfig={ Size:g_JSChartResource.Report.VScrollbar.BarWidth.Size };
6006
+
6007
+ this.RectScroll={ Top:null, Bottom:null, Bar:null, Client:null }; //滚动条区域
6008
+
6009
+ this.ReloadResource=function(resource)
6010
+ {
6011
+ this.ScrollBarHeight=g_JSChartResource.Report.VScrollbar.ScrollBarHeight;
6012
+ this.ButtonColor=g_JSChartResource.Report.VScrollbar.ButtonColor;
6013
+ this.BarColor=g_JSChartResource.Report.VScrollbar.BarColor;
6014
+ this.BorderColor=g_JSChartResource.Report.VScrollbar.BorderColor;
6015
+ this.BGColor=g_JSChartResource.Report.VScrollbar.BGColor;
6016
+ this.BarWithConfig={ Size:g_JSChartResource.Report.VScrollbar.BarWidth.Size };
6017
+ }
6018
+
6019
+ this.CalculateSize=function()
6020
+ {
6021
+ var pixelRatio=GetDevicePixelRatio();
6022
+
6023
+ var width=this.BarWithConfig.Size*pixelRatio+this.Mergin.Left+this.Mergin.Right;
6024
+ this.ButtonSize=Math.min(25, width);
6025
+ }
6026
+
6027
+ this.DrawScrollbar=function(left, top, right, bottom)
6028
+ {
6029
+ this.LastStatus.Draw=false;
6030
+ this.RectScroll={ Left:null, Right:null, Bar:null, Client:null };
6031
+ if (!this.Enable) return;
6032
+
6033
+ var isShow=this.IsShowCallback();
6034
+ if (!isShow) return;
6035
+
6036
+ var pageInfo=this.Report.GetCurrentPageStatus();
6037
+ if (pageInfo.IsSinglePage) return;
6038
+
6039
+ var xOffset=pageInfo.Start;
6040
+ var dataCount=pageInfo.DataCount-pageInfo.PageSize;
6041
+ var buttonSize=this.ButtonSize;
6042
+
6043
+ this.MaxPos=dataCount;
6044
+ this.CurrentPos=xOffset;
6045
+
6046
+ var rtTop={ Right:right-this.Mergin.Right, Top:top+this.Mergin.Top, Width:buttonSize, Height:buttonSize };
6047
+ rtTop.Left=rtTop.Right-buttonSize;
6048
+ rtTop.Bottom=rtTop.Top+buttonSize;
6049
+
6050
+ var rtBottom={ Right:right-this.Mergin.Right, Bottom:bottom-this.Mergin.Bottom, Width:buttonSize, Height:buttonSize };
6051
+ rtBottom.Left=rtBottom.Right-buttonSize;
6052
+ rtBottom.Top=rtBottom.Bottom-buttonSize;
6053
+
6054
+ var centerHeight=(rtBottom.Top-2)-(rtTop.Bottom+2);
6055
+ var value = centerHeight - this.ScrollBarHeight;
6056
+ var yOffset = (value * this.CurrentPos) / this.MaxPos;
6057
+ var y = rtTop.Bottom + 2 + yOffset;
6058
+
6059
+ var rtBar = {Right:right-this.Mergin.Right, Top:y, Width:buttonSize, Height: this.ScrollBarHeight };
6060
+ rtBar.Left=rtBar.Right-buttonSize;
6061
+ rtBar.Bottom=rtBar.Top+rtBar.Height;
6062
+
6063
+ this.RectScroll.Top=rtTop;
6064
+ this.RectScroll.Bottom=rtBottom;
6065
+ this.RectScroll.Bar=rtBar;
6066
+ this.RectScroll.Client={ Left:rtTop.Left, Right: rtTop.Right, Top:rtTop.Bottom, Bottom:rtBottom.Top };
6067
+
6068
+ var rtBG={ Right:right, Top:top, Bottom:bottom, Width:buttonSize+this.Mergin.Right+this.Mergin.Left };
6069
+ rtBG.Left=rtBG.Right-rtBG.Width;
6070
+ rtBG.Height=rtBG.Bottom-rtBG.Top;
6071
+ this.Canvas.fillStyle=this.BGColor;
6072
+ this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);
6073
+
6074
+ this.Canvas.fillStyle=this.ButtonColor;
6075
+ this.Canvas.fillRect(rtTop.Left,rtTop.Top,rtTop.Width,rtTop.Height);
6076
+ this.Canvas.fillRect(rtBottom.Left,rtBottom.Top,rtBottom.Width,rtBottom.Height);
6077
+
6078
+ this.Canvas.strokeStyle=this.BorderColor;
6079
+ this.Canvas.strokeRect(rtTop.Left,rtTop.Top,rtTop.Width,rtTop.Height);
6080
+ this.Canvas.strokeRect(rtBottom.Left,rtBottom.Top,rtBottom.Width,rtBottom.Height);
6081
+
6082
+ this.Canvas.fillStyle=this.BarColor;
6083
+ this.Canvas.fillRect(rtBar.Left,rtBar.Top,rtBar.Width,rtBar.Height);
6084
+
6085
+ this.LastStatus.Draw=true;
6086
+ }
6087
+
6088
+ this.OnMouseDown=function(x,y, e)
6089
+ {
6090
+ return this.PtInScroll(x,y);
6091
+ }
6092
+
6093
+ // Type 1-4 滚动条
6094
+ this.PtInScroll=function(x,y)
6095
+ {
6096
+ if (!this.RectScroll) return null;
6097
+
6098
+ if (this.RectScroll.Top)
6099
+ {
6100
+ var rtItem=this.RectScroll.Top;
6101
+ if (x>=rtItem.Left && x<=rtItem.Right && y>=rtItem.Top && y<=rtItem.Bottom) return { Type: 1, Rect: rtItem };
6102
+ }
6103
+
6104
+ if (this.RectScroll.Bottom)
6105
+ {
6106
+ var rtItem=this.RectScroll.Bottom;
6107
+ if (x>=rtItem.Left && x<=rtItem.Right && y>=rtItem.Top && y<=rtItem.Bottom) return { Type: 2, Rect: rtItem };
6108
+ }
6109
+
6110
+ if (this.RectScroll.Bar)
6111
+ {
6112
+ var rtItem=this.RectScroll.Bar;
6113
+ if (x>=rtItem.Left && x<=rtItem.Right && y>=rtItem.Top && y<=rtItem.Bottom) return { Type: 3, Rect: rtItem };
6114
+ }
6115
+
6116
+ if (this.RectScroll.Client)
6117
+ {
6118
+ var rtItem=this.RectScroll.Client;
6119
+ if (x>=rtItem.Left && x<=rtItem.Right && y>=rtItem.Top && y<=rtItem.Bottom)
6120
+ {
6121
+ return { Type: 4, Rect: rtItem , Pos: this.GetScrollPostionByPoint(x,y) };
6122
+ }
6123
+ }
6124
+
6125
+ return null;
6126
+ }
6127
+
6128
+ this.GetScrollPostionByPoint=function(x,y)
6129
+ {
6130
+ var rtItem=this.RectScroll.Client;
6131
+ var value=rtItem.Bottom-rtItem.Top-this.ScrollBarHeight;
6132
+ var pos =parseInt((this.MaxPos * (y - rtItem.Top)) / value);
6133
+ return pos;
6134
+ }
6135
+ }
@@ -595,6 +595,16 @@ function GetBlackStyle()
595
595
 
596
596
  MoveRowColor:'rgb(135,206,250)',
597
597
  SrcRowColor:'rgb(49,48,56)',
598
+ },
599
+
600
+ VScrollbar:
601
+ {
602
+ BarWidth:40,
603
+ ScrollBarHeight:60,
604
+ ButtonColor:"rgba(13,12,15,0.8)",
605
+ BarColor:"rgba(48,48,48,0.9)",
606
+ BorderColor:'rgba(48,48,48,0.9)',
607
+ BGColor:"rgba(211,211,211,0.5)",
598
608
  }
599
609
  },
600
610