hqchart 1.1.13526 → 1.1.13537

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.
@@ -4093,15 +4093,14 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4093
4093
  this.OnSize=function(option)
4094
4094
  {
4095
4095
  //画布大小通过div获取 如果有style里的大小 使用style里的
4096
+ var height=this.DivElement.offsetHeight;
4097
+ var width=this.DivElement.offsetWidth;
4096
4098
  if (this.DivElement.style.height && this.DivElement.style.width)
4097
4099
  {
4098
- var height=parseInt(this.DivElement.style.height.replace("px",""));
4099
- var width=parseInt(this.DivElement.style.width.replace("px",""));
4100
- }
4101
- else
4102
- {
4103
- var height=this.DivElement.offsetHeight;
4104
- var width=this.DivElement.offsetWidth;
4100
+ if (this.DivElement.style.height.includes("px"))
4101
+ height=parseInt(this.DivElement.style.height.replace("px",""));
4102
+ if (this.DivElement.style.width.includes("px"))
4103
+ width=parseInt(this.DivElement.style.width.replace("px",""));
4105
4104
  }
4106
4105
 
4107
4106
  if (this.ToolElement)
@@ -71167,9 +71166,9 @@ function JSChartResource()
71167
71166
  Mergin:{ Left:5, Right:5, Top:4, Bottom:2 },
71168
71167
 
71169
71168
  TabTitleColor:'rgb(60,60,60)',
71170
- TabSelectedTitleColor:'rgb(0,0,0)',
71171
- TabSelectedBGColor:"rgb(252,252,252)",
71172
- TabMoveOnTitleColor:"rgb(0,0,0)",
71169
+ TabSelectedTitleColor:'rgb(255,255,255)',
71170
+ TabSelectedBGColor:"rgb(234,85,4)",
71171
+ TabMoveOnTitleColor:"rgb(234,85,4)",
71173
71172
  TabBGColor:"rgb(220,220,220)"
71174
71173
  },
71175
71174
 
@@ -123587,7 +123586,7 @@ function GetBlackStyle()
123587
123586
 
123588
123587
  TabTitleColor:'rgb(153,153,153)',
123589
123588
  TabSelectedTitleColor:'rgb(255,255,255)',
123590
- TabSelectedBGColor:"rgb(13,12,15)",
123589
+ TabSelectedBGColor:"rgb(234,85,4)",
123591
123590
  TabMoveOnTitleColor:"rgb(255,255,255)",
123592
123591
  TabBGColor:"rgb(28,28,31)"
123593
123592
  },
@@ -125231,7 +125230,7 @@ function JSReportChart(divElement)
125231
125230
  var element=document.createElement("canvas");
125232
125231
  element.className='jsreportlist-drawing-extra';
125233
125232
  element.id=Guid();
125234
- if (name==JSChart.CorssCursorCanvasKey)
125233
+ if (name==JSReportChart.CorssCursorCanvasKey)
125235
125234
  element.setAttribute("tabindex",5);
125236
125235
  else
125237
125236
  element.setAttribute("tabindex",1);
@@ -125283,9 +125282,18 @@ function JSReportChart(divElement)
125283
125282
  this.OnSize=function()
125284
125283
  {
125285
125284
  //画布大小通过div获取
125286
- var height=parseInt(this.DivElement.style.height.replace("px",""));
125285
+ var height=this.DivElement.offsetHeight;
125286
+ var width=this.DivElement.offsetWidth;
125287
+ if (this.DivElement.style.height && this.DivElement.style.width)
125288
+ {
125289
+ if (this.DivElement.style.height.includes("px"))
125290
+ height=parseInt(this.DivElement.style.height.replace("px",""));
125291
+ if (this.DivElement.style.width.includes("px"))
125292
+ width=parseInt(this.DivElement.style.width.replace("px",""));
125293
+ }
125294
+
125287
125295
  this.CanvasElement.height=height;
125288
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
125296
+ this.CanvasElement.width=width;
125289
125297
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
125290
125298
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
125291
125299
 
@@ -125325,7 +125333,13 @@ function JSReportChart(divElement)
125325
125333
  this.JSChartContainer=chart;
125326
125334
  this.DivElement.JSChart=this; //div中保存一份
125327
125335
 
125336
+ if (option.EnableResize==true) this.CreateResizeListener();
125337
+
125328
125338
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
125339
+ if (option.EnableTooltip)
125340
+ {
125341
+ this.CreateExtraCanvasElement(JSReportChart.TooltipCursorCanvasKey, { ZIndex:99 });
125342
+ }
125329
125343
 
125330
125344
  if (option.Symbol) chart.Symbol=option.Symbol;
125331
125345
  if (option.Name) chart.Name=option.Name;
@@ -125347,6 +125361,8 @@ function JSReportChart(divElement)
125347
125361
  this.CreateJSReportChartContainer=function(option)
125348
125362
  {
125349
125363
  var chart=new JSReportChartContainer(this.CanvasElement);
125364
+ chart.GetExtraCanvas=(name)=>{ return this.GetExtraCanvas(name); }
125365
+
125350
125366
  chart.Create(option);
125351
125367
 
125352
125368
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
@@ -125410,6 +125426,19 @@ function JSReportChart(divElement)
125410
125426
  chart.Frame.ChartBorder.Bottom*=pixelTatio;
125411
125427
  }
125412
125428
 
125429
+ this.CreateResizeListener=function()
125430
+ {
125431
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
125432
+ this.ResizeListener.observe(this.DivElement);
125433
+ }
125434
+
125435
+ this.OnDivResize=function(entries)
125436
+ {
125437
+ JSConsole.Chart.Log("[JSReportChart::OnDivResize] entries=", entries);
125438
+
125439
+ this.OnSize();
125440
+ }
125441
+
125413
125442
  /////////////////////////////////////////////////////////////////////////////
125414
125443
  //对外接口
125415
125444
 
@@ -125547,6 +125576,9 @@ function JSReportChartContainer(uielement)
125547
125576
  this.SplashTitle={ StockList:"下载码表中.....", MemberList:"下载成分中....." } ;
125548
125577
 
125549
125578
  this.Canvas=uielement.getContext("2d"); //画布
125579
+
125580
+ this.TooltipCanvas;
125581
+ this.ChartTooltip;
125550
125582
 
125551
125583
  this.Tooltip=document.createElement("div");
125552
125584
  this.Tooltip.className='jsreport-tooltip';
@@ -125618,6 +125650,8 @@ function JSReportChartContainer(uielement)
125618
125650
  this.JSPopMenu; //内置菜单
125619
125651
  this.IsShowRightMenu=true;
125620
125652
 
125653
+ this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null };
125654
+
125621
125655
  this.ChartDestory=function() //销毁
125622
125656
  {
125623
125657
  this.IsDestroy=true;
@@ -125768,6 +125802,12 @@ function JSReportChartContainer(uielement)
125768
125802
 
125769
125803
  this.ChartPaint[0]=chart;
125770
125804
 
125805
+ //提示信息
125806
+ var chartTooltip=new ChartCellTooltip();
125807
+ chartTooltip.Frame=this.Frame;
125808
+ chartTooltip.ChartBorder=this.Frame.ChartBorder;
125809
+ this.ChartTooltip=chartTooltip;
125810
+
125771
125811
  //页脚
125772
125812
  if (option && option.PageInfo===true)
125773
125813
  {
@@ -125879,6 +125919,8 @@ function JSReportChartContainer(uielement)
125879
125919
  {
125880
125920
  this.DelayDraw(500);
125881
125921
  }
125922
+
125923
+ this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
125882
125924
  }
125883
125925
 
125884
125926
  this.DelayDraw=function(frequency)
@@ -126645,6 +126687,7 @@ function JSReportChartContainer(uielement)
126645
126687
  console.log(`[OnWheel] wheelValue=${wheelValue}`);
126646
126688
  if (wheelValue<0) //下
126647
126689
  {
126690
+ this.LastMouseStatus.TooltipStatus=null;
126648
126691
  if (this.GotoNextItem(1))
126649
126692
  {
126650
126693
  this.Draw();
@@ -126653,6 +126696,7 @@ function JSReportChartContainer(uielement)
126653
126696
  }
126654
126697
  else if (wheelValue>0) //上
126655
126698
  {
126699
+ this.LastMouseStatus.TooltipStatus=null;
126656
126700
  if (this.GotoNextItem(-1))
126657
126701
  {
126658
126702
  this.Draw();
@@ -126664,6 +126708,7 @@ function JSReportChartContainer(uielement)
126664
126708
  {
126665
126709
  if (wheelValue<0) //下一页
126666
126710
  {
126711
+ this.LastMouseStatus.TooltipStatus=null;
126667
126712
  if (this.GotoNextPage(this.PageUpDownCycle))
126668
126713
  {
126669
126714
  this.Draw();
@@ -126672,6 +126717,7 @@ function JSReportChartContainer(uielement)
126672
126717
  }
126673
126718
  else if (wheelValue>0) //上一页
126674
126719
  {
126720
+ this.LastMouseStatus.TooltipStatus=null;
126675
126721
  if (this.GotoPreviousPage(this.PageUpDownCycle))
126676
126722
  {
126677
126723
  this.Draw();
@@ -126893,7 +126939,13 @@ function JSReportChartContainer(uielement)
126893
126939
  var pixelTatio = GetDevicePixelRatio();
126894
126940
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
126895
126941
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
126942
+
126943
+ this.LastMouseStatus.OnMouseMove=null;
126896
126944
 
126945
+ var bDrawTooltip=false;
126946
+ if (this.LastMouseStatus.TooltipStatus) bDrawTooltip=true;
126947
+ this.LastMouseStatus.TooltipStatus=null;
126948
+
126897
126949
  if (this.DragRow) return;
126898
126950
  if (this.DrawHeader) return;
126899
126951
  if (this.DragColumnWidth) return;
@@ -126913,10 +126965,11 @@ function JSReportChartContainer(uielement)
126913
126965
  }
126914
126966
  }
126915
126967
 
126968
+ this.LastMouseStatus.OnMouseMove={ X:x, Y:y };
126916
126969
  var mouseStatus={ Cursor:"default", Name:"Default"};; //鼠标状态
126917
126970
  var report=this.GetReportChart();
126918
- var cell=null;
126919
126971
  var bDraw=false;
126972
+
126920
126973
  if (report)
126921
126974
  {
126922
126975
  var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);
@@ -126927,7 +126980,12 @@ function JSReportChartContainer(uielement)
126927
126980
  }
126928
126981
  else
126929
126982
  {
126930
- cell=report.PtInCell(x,y); //是否在单元格(EnableTooltip)
126983
+ var tooltipData=report.GetTooltipData(x,y); //单元格提示信息
126984
+ if (tooltipData)
126985
+ {
126986
+ this.LastMouseStatus.TooltipStatus={ X:x, Y:y, Data:tooltipData };
126987
+ bDrawTooltip=true;
126988
+ }
126931
126989
  }
126932
126990
 
126933
126991
  var scrollbar=report.VScrollbar;
@@ -126943,16 +127001,20 @@ function JSReportChartContainer(uielement)
126943
127001
  }
126944
127002
  }
126945
127003
 
127004
+
127005
+ /* 目前没有用到
126946
127006
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);
126947
127007
  if (event)
126948
127008
  {
126949
127009
  var sendData={X:x, Y:y, Cell:cell };
126950
127010
  event.Callback(event,sendData,this);
126951
127011
  }
127012
+ */
126952
127013
 
126953
127014
  if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
126954
127015
 
126955
127016
  if (bDraw) this.Draw();
127017
+ else if (bDrawTooltip) this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
126956
127018
  }
126957
127019
 
126958
127020
  this.UIOnMounseOut=function(e)
@@ -128133,6 +128195,7 @@ function JSReportChartContainer(uielement)
128133
128195
  {
128134
128196
  this.ExecuteMenuCommand(tabData.Tab.CommandID, [tabData.Tab.ID]);
128135
128197
  this.SetSelectedTab(tabData.Index);
128198
+ redraw=true;
128136
128199
  }
128137
128200
  }
128138
128201
 
@@ -128231,6 +128294,7 @@ function JSReportChartContainer(uielement)
128231
128294
 
128232
128295
  case REPORT_COLUMN_ID.VOL_IN_ID:
128233
128296
  case REPORT_COLUMN_ID.VOL_OUT_ID:
128297
+ case REPORT_COLUMN_ID.DATE_ID:
128234
128298
 
128235
128299
  return this.LocalNumberSort(left, right, column, sortType);
128236
128300
  case REPORT_COLUMN_ID.CUSTOM_NUMBER_TEXT_ID: //自定义数值字段
@@ -128405,6 +128469,31 @@ function JSReportChartContainer(uielement)
128405
128469
  }
128406
128470
  }
128407
128471
 
128472
+ this.LoacCustomStringSort=function(left, right, column, sortType)
128473
+ {
128474
+ var leftValue="", rightValue="";
128475
+ if (sortType==2) rightValue=leftValue="啊啊啊啊啊";
128476
+
128477
+ var value=this.GetStockExtendData(left, column);
128478
+ if (IFrameSplitOperator.IsString(value)) leftValue=value;
128479
+
128480
+ var value=this.GetStockExtendData(right, column);
128481
+ if (IFrameSplitOperator.IsString(value)) rightValue=value;
128482
+
128483
+ if (sortType==1)
128484
+ {
128485
+ if (rightValue<leftValue) return -1;
128486
+ else if (rightValue<leftValue) return 1;
128487
+ else return 0;
128488
+ }
128489
+ else
128490
+ {
128491
+ if (leftValue<rightValue) return -1;
128492
+ else if (leftValue>rightValue) return 1;
128493
+ else return 0;
128494
+ }
128495
+ }
128496
+
128408
128497
  this.RequestStockSortData=function(column, filedid, sortType)
128409
128498
  {
128410
128499
  var chart=this.ChartPaint[0];
@@ -128521,6 +128610,28 @@ function JSReportChartContainer(uielement)
128521
128610
 
128522
128611
  return true;
128523
128612
  }
128613
+
128614
+ this.DrawTooltip=function(tooltipStatus)
128615
+ {
128616
+ if (!this.GetExtraCanvas) return;
128617
+ if (!this.TooltipCanvas)
128618
+ {
128619
+ var finder=this.GetExtraCanvas(JSReportChart.TooltipCursorCanvasKey);
128620
+ if (!finder) return;
128621
+ this.TooltipCanvas=finder.Canvas;
128622
+ }
128623
+
128624
+ if (!this.TooltipCanvas) return;
128625
+ this.ClearCanvas(this.TooltipCanvas);
128626
+ if (!this.ChartTooltip) return;
128627
+
128628
+ if (!tooltipStatus || !tooltipStatus.Data) return;
128629
+
128630
+ this.ChartTooltip.Canvas=this.TooltipCanvas;
128631
+ this.ChartTooltip.Point={ X:tooltipStatus.X, Y:tooltipStatus.Y };
128632
+ this.ChartTooltip.Data=tooltipStatus.Data.Data;
128633
+ this.ChartTooltip.Draw();
128634
+ }
128524
128635
  }
128525
128636
 
128526
128637
 
@@ -128689,6 +128800,8 @@ var MAP_COLUMN_FIELD=new Map([
128689
128800
  [REPORT_COLUMN_ID.VOL_OUT_ID,"VolOut"],
128690
128801
 
128691
128802
  [REPORT_COLUMN_ID.NAME_EX_ID, "NameEx"],
128803
+
128804
+ [REPORT_COLUMN_ID.DATE_ID, "Date"],
128692
128805
  ]);
128693
128806
 
128694
128807
  function ChartReport()
@@ -128821,7 +128934,11 @@ function ChartReport()
128821
128934
  this.BottomToolbarHeight=0; //底部工具条高度
128822
128935
  this.IsShowAllColumn=false; //是否已显示所有列
128823
128936
 
128824
- this.Column= //{ Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:文字最大宽度 , TextColor:文字颜色, Sort:0=不支持排序 1=本地排序 0=远程排序 }
128937
+ //{
128938
+ // Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:文字最大宽度 , TextColor:文字颜色, Sort:0=不支持排序 1=本地排序 0=远程排序,
128939
+ // Icon:{ Family:"iconfont", Size:12, Symbol:"", Margin: { Left:, Bottom }}
128940
+ //}
128941
+ this.Column=
128825
128942
  [
128826
128943
  { Type:REPORT_COLUMN_ID.INDEX_ID, Title:"序号", TextAlign:"center", Width:null, TextColor:g_JSChartResource.Report.FieldColor.Index, MaxText:"8888"},
128827
128944
  { Type:REPORT_COLUMN_ID.SYMBOL_ID, Title:"代码", TextAlign:"left", Width:null, TextColor:g_JSChartResource.Report.FieldColor.Symbol, MaxText:"888888"},
@@ -128831,6 +128948,9 @@ function ChartReport()
128831
128948
 
128832
128949
  this.RectClient={};
128833
128950
 
128951
+ //{ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:{ AryText:[ {Text:xx} ]} };
128952
+ //Type:1=数据截断
128953
+ // { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }}
128834
128954
  this.TooltipRect=[];
128835
128955
 
128836
128956
  this.ReloadResource=function(resource)
@@ -128929,11 +129049,11 @@ function ChartReport()
128929
129049
  if (item.FullColBGColor) colItem.FullColBGColor=item.FullColBGColor; //整列背景色
128930
129050
  if (item.HeaderBGColor) colItem.HeaderBGColor=item.HeaderBGColor; //表头背景色
128931
129051
  if (IFrameSplitOperator.IsNumber(item.Sort)) colItem.Sort=item.Sort;
128932
- if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
128933
129052
  if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
128934
129053
  if (IFrameSplitOperator.IsBool(item.EnableDragWidth)) colItem.EnableDragWidth=item.EnableDragWidth;
128935
129054
  if (IFrameSplitOperator.IsBool(item.IsDrawCallback)) colItem.IsDrawCallback=item.IsDrawCallback;
128936
129055
  else colItem.IsDrawCallback=false;
129056
+ if (item.Icon) colItem.Icon=item.Icon;
128937
129057
 
128938
129058
  if (item.Sort==1 || item.Sort==2) //1本地排序 2=远程排序
128939
129059
  {
@@ -129239,6 +129359,17 @@ function ChartReport()
129239
129359
 
129240
129360
  item.Width=itemWidth+4+this.ItemMergin.Left+this.ItemMergin.Right;
129241
129361
  }
129362
+
129363
+ if (item.Icon && item.Icon.Symbol)
129364
+ {
129365
+ item.Width+=item.Icon.Size;
129366
+ if (item.Icon.Margin)
129367
+ {
129368
+ var margin=item.Icon.Margin;
129369
+ if (IFrameSplitOperator.IsNumber(margin.Left)) item.Width+=margin.Left;
129370
+ if (IFrameSplitOperator.IsNumber(margin.Right)) item.Width+=margin.Right;
129371
+ }
129372
+ }
129242
129373
  }
129243
129374
 
129244
129375
  this.Canvas.font=this.HeaderFont;
@@ -129298,16 +129429,36 @@ function ChartReport()
129298
129429
  this.DrawItemBG({ Rect:rtBG, BGColor:item.HeaderBGColor });
129299
129430
  }
129300
129431
 
129432
+ var iconWidth=0;
129433
+ if (item.Icon && item.Icon.Symbol) //图标
129434
+ {
129435
+ var iconWidth=item.Icon.Size;
129436
+ if (item.Icon.Margin)
129437
+ {
129438
+ var margin=item.Icon.Margin;
129439
+ if (IFrameSplitOperator.IsNumber(margin.Left)) iconWidth+=margin.Left;
129440
+ if (IFrameSplitOperator.IsNumber(margin.Right)) iconWidth+=margin.Right;
129441
+ }
129442
+ }
129443
+ textWidth-=iconWidth;
129444
+
129301
129445
  if (item.HeaderColor) this.Canvas.fillStyle=item.HeaderColor;
129302
129446
  else this.Canvas.fillStyle=this.HeaderColor;
129303
129447
 
129448
+ var textSize={ }
129304
129449
  if (this.SortInfo && this.SortInfo.Field==i && this.SortInfo.Sort>0)
129305
129450
  {
129306
- this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort);
129451
+ this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort, textSize);
129307
129452
  }
129308
129453
  else
129309
129454
  {
129310
- this.DrawText(item.Title,item.TextAlign,x,y,textWidth);
129455
+ this.DrawText(item.Title,item.TextAlign,x,y,textWidth,textSize);
129456
+ }
129457
+
129458
+ if (iconWidth>0)
129459
+ {
129460
+ this.DrawHeaderIcon(item.Icon, textSize.Right, y, i, item);
129461
+ this.Canvas.font=this.HeaderFont;
129311
129462
  }
129312
129463
 
129313
129464
  this.Canvas.fillStyle=this.HeaderColor;
@@ -129330,44 +129481,91 @@ function ChartReport()
129330
129481
  this.DrawItemBG({ Rect:rtBG, BGColor:item.HeaderBGColor });
129331
129482
  }
129332
129483
 
129484
+ var iconWidth=0;
129485
+ if (item.Icon && item.Icon.Symbol) //图标
129486
+ {
129487
+ var iconWidth=item.Icon.Size;
129488
+ if (item.Icon.Margin)
129489
+ {
129490
+ var margin=item.Icon.Margin;
129491
+ if (IFrameSplitOperator.IsNumber(margin.Left)) iconWidth+=margin.Left;
129492
+ if (IFrameSplitOperator.IsNumber(margin.Right)) iconWidth+=margin.Right;
129493
+ }
129494
+ }
129495
+
129496
+ textWidth-=iconWidth;
129497
+
129333
129498
  if (item.HeaderColor) this.Canvas.fillStyle=item.HeaderColor;
129334
129499
  else this.Canvas.fillStyle=this.HeaderColor;
129335
129500
 
129501
+ var textSize={ }
129336
129502
  if (this.SortInfo && this.SortInfo.Field==i && this.SortInfo.Sort>0)
129337
129503
  {
129338
- this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort);
129504
+ this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort,textSize);
129339
129505
  }
129340
129506
  else
129341
129507
  {
129342
- this.DrawText(item.Title,item.TextAlign,x,y,textWidth);
129508
+ this.DrawText(item.Title,item.TextAlign,x,y,textWidth,textSize);
129509
+ }
129510
+
129511
+ if (iconWidth>0)
129512
+ {
129513
+ this.DrawHeaderIcon(item.Icon, textSize.Right, y, i, item);
129514
+ this.Canvas.font=this.HeaderFont;
129343
129515
  }
129344
129516
 
129345
129517
  textLeft+=item.Width;
129346
129518
  }
129347
129519
  }
129348
129520
 
129349
- this.DrawText=function(text, textAlign, x, y, textWidth)
129521
+ this.DrawText=function(text, textAlign, x, y, cellWidth, textSize)
129350
129522
  {
129523
+ var textWidth=this.Canvas.measureText(text).width;
129351
129524
  if (textAlign=='center')
129352
129525
  {
129353
- x=x+textWidth/2;
129354
- this.Canvas.textAlign="center";
129526
+ x=x+(cellWidth-textWidth)/2;
129355
129527
  }
129356
129528
  else if (textAlign=='right')
129357
129529
  {
129358
- x=x+textWidth;
129359
- this.Canvas.textAlign="right";
129360
- }
129361
- else
129362
- {
129363
- this.Canvas.textAlign="left";
129530
+ x=x+cellWidth-textWidth;
129364
129531
  }
129365
129532
 
129533
+ this.Canvas.textAlign="left";
129366
129534
  this.Canvas.textBaseline="middle";
129367
129535
  this.Canvas.fillText(text,x,y);
129536
+
129537
+ if (textSize)
129538
+ {
129539
+ textSize.Right=x+textWidth;
129540
+ textSize.Width=textWidth;
129541
+ }
129368
129542
  }
129369
129543
 
129370
- this.DrawSortHeader=function(text, textAlign, x, y, width, sortType)
129544
+ this.DrawHeaderIcon=function(icon, x, y, index, column)
129545
+ {
129546
+ var iconFont=`${icon.Size}px ${icon.Family}`;
129547
+ this.Canvas.font=iconFont;
129548
+ this.Canvas.textAlign="left";
129549
+ if (icon.Color) this.Canvas.fillStyle=icon.Color;
129550
+
129551
+ var xIcon=x;
129552
+ var yIcon=y;
129553
+ if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Left)) xIcon+=icon.Margin.Left;
129554
+ if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Bottom)) yIcon-=icon.Margin.Bottom;
129555
+ this.Canvas.fillText(icon.Symbol, xIcon, yIcon);
129556
+
129557
+ if (icon.Tooltip)
129558
+ {
129559
+ var rtIcon={ Left:xIcon, Top:yIcon-icon.Size/2, Width:icon.Size, Height:icon.Size };
129560
+ rtIcon.Right=rtIcon.Left+rtIcon.Width;
129561
+ rtIcon.Bottom=rtIcon.Top+rtIcon.Height;
129562
+
129563
+ var tooltipData={ Rect:rtIcon, Type:2, Column:column, Index:index, Data:icon.Tooltip.Data };
129564
+ this.TooltipRect.push(tooltipData);
129565
+ }
129566
+ }
129567
+
129568
+ this.DrawSortHeader=function(text, textAlign, x, y, width, sortType,textSize)
129371
129569
  {
129372
129570
  var sortText=sortType==1?"↓":"↑";
129373
129571
  var sortTextWidth=this.Canvas.measureText(sortText).width;
@@ -129383,15 +129581,17 @@ function ChartReport()
129383
129581
  {
129384
129582
  x=(x+width)-sortTextWidth-textWidth;
129385
129583
  }
129386
- else
129387
- {
129388
-
129389
- }
129390
129584
 
129391
129585
  this.Canvas.fillText(text,x,y);
129392
129586
  this.Canvas.fillStyle=this.SortColor;
129393
129587
  this.Canvas.fillText(sortText,x+textWidth,y);
129394
129588
  this.Canvas.fillStyle=this.HeaderColor;
129589
+
129590
+ if (textSize)
129591
+ {
129592
+ textSize.Right=x+textWidth+sortTextWidth;
129593
+ textSize.Width=textWidth+sortTextWidth;
129594
+ }
129395
129595
  }
129396
129596
 
129397
129597
 
@@ -129645,7 +129845,7 @@ function ChartReport()
129645
129845
  var x=left+this.ItemMergin.Left;
129646
129846
  var textWidth=column.Width-this.ItemMergin.Left-this.ItemMergin.Right;
129647
129847
  var stock=data.Stock;
129648
- var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign };
129848
+ var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign, Tooltip:null };
129649
129849
  var rtItem={ Left:left, Top:top, Width:column.Width, Height:this.RowHeight };
129650
129850
  rtItem.Right=rtItem.Left+rtItem.Width;
129651
129851
  rtItem.Bottom=rtItem.Top+rtItem.Height;
@@ -129656,12 +129856,6 @@ function ChartReport()
129656
129856
  this.DrawItemBG({ Rect:rtItem, BGColor:column.FullColBGColor });
129657
129857
  }
129658
129858
 
129659
- //tooltip提示
129660
- if (column.EnableTooltip===true)
129661
- {
129662
- this.TooltipRect.push({ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType })
129663
- }
129664
-
129665
129859
  if (column.Type==REPORT_COLUMN_ID.INDEX_ID)
129666
129860
  {
129667
129861
  if (rowType==1) return; //固定行序号空
@@ -129909,6 +130103,14 @@ function ChartReport()
129909
130103
  else
129910
130104
  this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
129911
130105
  }
130106
+
130107
+ //tooltip提示
130108
+ if (drawInfo.Tooltip)
130109
+ {
130110
+ //Type:1=数据截断
130111
+ var tooltipData={ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:drawInfo.Tooltip.Data };
130112
+ this.TooltipRect.push(tooltipData);
130113
+ }
129912
130114
  }
129913
130115
 
129914
130116
  this.DrawCustomText=function(drawInfo, column, left, top, cellWidth)
@@ -129957,6 +130159,13 @@ function ChartReport()
129957
130159
  this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
129958
130160
  //this.Canvas.stroke(); //调试用
129959
130161
  this.Canvas.clip();
130162
+
130163
+ //数据截断提示信息
130164
+ drawInfo.Tooltip=
130165
+ {
130166
+ Type:1,
130167
+ Data:{ AryText:[ {Text:drawInfo.Text} ] }
130168
+ }
129960
130169
  }
129961
130170
 
129962
130171
  this.Canvas.textBaseline="middle";
@@ -131234,8 +131443,7 @@ function ChartReport()
131234
131443
 
131235
131444
  }
131236
131445
 
131237
- //坐标所在单元格
131238
- this.PtInCell=function(x,y)
131446
+ this.GetTooltipData=function(x,y)
131239
131447
  {
131240
131448
  if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return null;
131241
131449
 
@@ -131247,9 +131455,11 @@ function ChartReport()
131247
131455
 
131248
131456
  if (x>=rt.Left && x<=rt.Right && y>=rt.Top && y<=rt.Bottom)
131249
131457
  {
131250
- return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index };
131458
+ return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index, Type:item.Type, Data:item.Data };
131251
131459
  }
131252
131460
  }
131461
+
131462
+ return null;
131253
131463
  }
131254
131464
 
131255
131465
  this.PtInHeaderDragBorder=function(x, y)
@@ -131841,6 +132051,169 @@ function ChartVScrollbar()
131841
132051
  return pos;
131842
132052
  }
131843
132053
  }
132054
+
132055
+
132056
+ function ChartCellTooltip()
132057
+ {
132058
+ this.Canvas; //画布
132059
+ this.ChartBorder; //边框信息
132060
+ this.ChartFrame; //框架画法
132061
+ this.Name; //名称
132062
+ this.ClassName='ChartCellTooltip'; //类名
132063
+
132064
+ this.BGColor="rgba(255,255,225, 0.9)";
132065
+ this.BorderColor="rgb(0,0,0)";
132066
+ this.Margin={ Left:5, Right:5, Top:4, Bottom:5 };
132067
+ this.Font=`${13*GetDevicePixelRatio()}px 微软雅黑`;
132068
+ this.TextColor="rgb(0,0,0)";
132069
+ this.YOffset=20;
132070
+ this.XOffset=5;
132071
+
132072
+ this.Point; //{ X, Y}
132073
+ this.Data; //{ AryText:[ { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }} ]}
132074
+
132075
+
132076
+ this.Draw=function()
132077
+ {
132078
+ if (!this.Canvas) return;
132079
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.AryText)) return;
132080
+ if (!this.Point) return;
132081
+
132082
+ var size={ Width:0, Height:0, Text:[] };
132083
+ this.CalculateTextSize(this.Data.AryText, size);
132084
+ if (!IFrameSplitOperator.IsNonEmptyArray(size.Text)) return;
132085
+
132086
+ this.DrawTooltip(this.Data.AryText, size);
132087
+ }
132088
+
132089
+ this.CalculateTextSize=function(aryText, size)
132090
+ {
132091
+ var width=0, height=0;
132092
+ for(var i=0;i<aryText.length;++i)
132093
+ {
132094
+ var item=aryText[i];
132095
+ var titleHeight=0, titleWidth=0;
132096
+ if (!item.Title && !item.Text) continue;
132097
+
132098
+ if (item.Title)
132099
+ {
132100
+ if (item.TitleFont) this.Canvas.font=item.TitleFont;
132101
+ else this.Canvas.font=this.Font;
132102
+
132103
+ titleWidth=this.Canvas.measureText(item.Title).width;
132104
+ titleHeight=this.Canvas.measureText("擎").width;
132105
+ }
132106
+
132107
+ var textWidth=0, textHeight=0;
132108
+ if (item.Text)
132109
+ {
132110
+ if (item.Font) this.Canvas.font=item.Font;
132111
+ else this.Canvas.font=this.Font;
132112
+
132113
+ textWidth=this.Canvas.measureText(item.Text).width;
132114
+ textHeight=this.Canvas.measureText("擎").width;
132115
+ }
132116
+
132117
+ var itemWidth=titleWidth+textWidth;
132118
+ var itemHeight=Math.max(textHeight,titleHeight);
132119
+
132120
+ if (IFrameSplitOperator.IsNumber(item.Space)) itemWidth+=item.Space;
132121
+
132122
+ if (item.Margin)
132123
+ {
132124
+ var margin=item.Margin;
132125
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
132126
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
132127
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
132128
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
132129
+ }
132130
+
132131
+ if (width<itemWidth) width=itemWidth;
132132
+ height+=itemHeight;
132133
+
132134
+ size.Text[i]={ Width: itemWidth, Height:itemHeight, TitleWidth:titleWidth, TextWidth:textWidth };
132135
+ }
132136
+
132137
+ if (this.Margin)
132138
+ {
132139
+ var margin=this.Margin;
132140
+ if (IFrameSplitOperator.IsNumber(margin.Left)) width+=margin.Left;
132141
+ if (IFrameSplitOperator.IsNumber(margin.Right)) width+=margin.Right;
132142
+ if (IFrameSplitOperator.IsNumber(margin.Top)) height+=margin.Top;
132143
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) height+=margin.Bottom;
132144
+ }
132145
+
132146
+ size.Width=width;
132147
+ size.Height=height;
132148
+ }
132149
+
132150
+ this.DrawTooltip=function(aryText, size)
132151
+ {
132152
+ var rtBG={ Left:this.Point.X+this.XOffset, Top:this.Point.Y+this.YOffset, Width:size.Width, Height:size.Height };
132153
+ rtBG.Right=rtBG.Left+rtBG.Width;
132154
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
132155
+
132156
+ var border=this.ChartBorder.GetBorder();
132157
+ if (rtBG.Bottom>border.ChartHeight)
132158
+ {
132159
+ rtBG.Bottom=this.Point.Y;
132160
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
132161
+ }
132162
+
132163
+ if (rtBG.Right>border.ChartWidth)
132164
+ {
132165
+ rtBG.Right=this.Point.X;
132166
+ rtBG.Left=rtBG.Right-rtBG.Width;
132167
+ }
132168
+
132169
+ if (this.BGColor)
132170
+ {
132171
+ this.Canvas.fillStyle=this.BGColor;
132172
+ this.Canvas.fillRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
132173
+ }
132174
+
132175
+ if (this.BorderColor)
132176
+ {
132177
+ this.Canvas.strokeStyle=this.BorderColor;
132178
+ this.Canvas.strokeRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
132179
+ }
132180
+
132181
+ var left=rtBG.Left;
132182
+ var top=rtBG.Top;
132183
+ if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Left)) left+=this.Margin.Left;
132184
+ if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Top)) top+=this.Margin.Top;
132185
+
132186
+ var xText, yText=top;
132187
+ for(var i=0;i<aryText.length;++i)
132188
+ {
132189
+ var item=aryText[i];
132190
+ if (!item.Title && !item.Text) continue;
132191
+ var itemSize=size.Text[i];
132192
+
132193
+ xText=left;
132194
+ yText+=itemSize.Height;
132195
+
132196
+ if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Left)) xText+=item.Margin.Left;
132197
+ if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Bottom)) yText-=item.Margin.Bottom;
132198
+ if (item.Title)
132199
+ {
132200
+ if (item.TitleColor) this.Canvas.fillStyle=item.TitleColor;
132201
+ else this.Canvas.fillStyle=this.TextColor;
132202
+ this.Canvas.fillText(item.Title,xText,yText,itemSize.TitleWidth);
132203
+ xText+=itemSize.TitleWidth;
132204
+ if (IFrameSplitOperator.IsNumber(item.Space)) xText+=item.Space;
132205
+ }
132206
+
132207
+ if (item.Text)
132208
+ {
132209
+ if (item.Color) this.Canvas.fillStyle=item.Color;
132210
+ else this.Canvas.fillStyle=this.TextColor;
132211
+ this.Canvas.fillText(item.Text,xText,yText,itemSize.TextWidth);
132212
+ }
132213
+
132214
+ }
132215
+ }
132216
+ }
131844
132217
  /*
131845
132218
  Copyright (c) 2018 jones
131846
132219
 
@@ -138816,7 +139189,7 @@ function HQChartScriptWorker()
138816
139189
 
138817
139190
 
138818
139191
 
138819
- var HQCHART_VERSION="1.1.13525";
139192
+ var HQCHART_VERSION="1.1.13536";
138820
139193
 
138821
139194
  function PrintHQChartVersion()
138822
139195
  {