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.
@@ -4049,15 +4049,14 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4049
4049
  this.OnSize=function(option)
4050
4050
  {
4051
4051
  //画布大小通过div获取 如果有style里的大小 使用style里的
4052
+ var height=this.DivElement.offsetHeight;
4053
+ var width=this.DivElement.offsetWidth;
4052
4054
  if (this.DivElement.style.height && this.DivElement.style.width)
4053
4055
  {
4054
- var height=parseInt(this.DivElement.style.height.replace("px",""));
4055
- var width=parseInt(this.DivElement.style.width.replace("px",""));
4056
- }
4057
- else
4058
- {
4059
- var height=this.DivElement.offsetHeight;
4060
- var width=this.DivElement.offsetWidth;
4056
+ if (this.DivElement.style.height.includes("px"))
4057
+ height=parseInt(this.DivElement.style.height.replace("px",""));
4058
+ if (this.DivElement.style.width.includes("px"))
4059
+ width=parseInt(this.DivElement.style.width.replace("px",""));
4061
4060
  }
4062
4061
 
4063
4062
  if (this.ToolElement)
@@ -71123,9 +71122,9 @@ function JSChartResource()
71123
71122
  Mergin:{ Left:5, Right:5, Top:4, Bottom:2 },
71124
71123
 
71125
71124
  TabTitleColor:'rgb(60,60,60)',
71126
- TabSelectedTitleColor:'rgb(0,0,0)',
71127
- TabSelectedBGColor:"rgb(252,252,252)",
71128
- TabMoveOnTitleColor:"rgb(0,0,0)",
71125
+ TabSelectedTitleColor:'rgb(255,255,255)',
71126
+ TabSelectedBGColor:"rgb(234,85,4)",
71127
+ TabMoveOnTitleColor:"rgb(234,85,4)",
71129
71128
  TabBGColor:"rgb(220,220,220)"
71130
71129
  },
71131
71130
 
@@ -123543,7 +123542,7 @@ function GetBlackStyle()
123543
123542
 
123544
123543
  TabTitleColor:'rgb(153,153,153)',
123545
123544
  TabSelectedTitleColor:'rgb(255,255,255)',
123546
- TabSelectedBGColor:"rgb(13,12,15)",
123545
+ TabSelectedBGColor:"rgb(234,85,4)",
123547
123546
  TabMoveOnTitleColor:"rgb(255,255,255)",
123548
123547
  TabBGColor:"rgb(28,28,31)"
123549
123548
  },
@@ -125187,7 +125186,7 @@ function JSReportChart(divElement)
125187
125186
  var element=document.createElement("canvas");
125188
125187
  element.className='jsreportlist-drawing-extra';
125189
125188
  element.id=Guid();
125190
- if (name==JSChart.CorssCursorCanvasKey)
125189
+ if (name==JSReportChart.CorssCursorCanvasKey)
125191
125190
  element.setAttribute("tabindex",5);
125192
125191
  else
125193
125192
  element.setAttribute("tabindex",1);
@@ -125239,9 +125238,18 @@ function JSReportChart(divElement)
125239
125238
  this.OnSize=function()
125240
125239
  {
125241
125240
  //画布大小通过div获取
125242
- var height=parseInt(this.DivElement.style.height.replace("px",""));
125241
+ var height=this.DivElement.offsetHeight;
125242
+ var width=this.DivElement.offsetWidth;
125243
+ if (this.DivElement.style.height && this.DivElement.style.width)
125244
+ {
125245
+ if (this.DivElement.style.height.includes("px"))
125246
+ height=parseInt(this.DivElement.style.height.replace("px",""));
125247
+ if (this.DivElement.style.width.includes("px"))
125248
+ width=parseInt(this.DivElement.style.width.replace("px",""));
125249
+ }
125250
+
125243
125251
  this.CanvasElement.height=height;
125244
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
125252
+ this.CanvasElement.width=width;
125245
125253
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
125246
125254
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
125247
125255
 
@@ -125281,7 +125289,13 @@ function JSReportChart(divElement)
125281
125289
  this.JSChartContainer=chart;
125282
125290
  this.DivElement.JSChart=this; //div中保存一份
125283
125291
 
125292
+ if (option.EnableResize==true) this.CreateResizeListener();
125293
+
125284
125294
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
125295
+ if (option.EnableTooltip)
125296
+ {
125297
+ this.CreateExtraCanvasElement(JSReportChart.TooltipCursorCanvasKey, { ZIndex:99 });
125298
+ }
125285
125299
 
125286
125300
  if (option.Symbol) chart.Symbol=option.Symbol;
125287
125301
  if (option.Name) chart.Name=option.Name;
@@ -125303,6 +125317,8 @@ function JSReportChart(divElement)
125303
125317
  this.CreateJSReportChartContainer=function(option)
125304
125318
  {
125305
125319
  var chart=new JSReportChartContainer(this.CanvasElement);
125320
+ chart.GetExtraCanvas=(name)=>{ return this.GetExtraCanvas(name); }
125321
+
125306
125322
  chart.Create(option);
125307
125323
 
125308
125324
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
@@ -125366,6 +125382,19 @@ function JSReportChart(divElement)
125366
125382
  chart.Frame.ChartBorder.Bottom*=pixelTatio;
125367
125383
  }
125368
125384
 
125385
+ this.CreateResizeListener=function()
125386
+ {
125387
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
125388
+ this.ResizeListener.observe(this.DivElement);
125389
+ }
125390
+
125391
+ this.OnDivResize=function(entries)
125392
+ {
125393
+ JSConsole.Chart.Log("[JSReportChart::OnDivResize] entries=", entries);
125394
+
125395
+ this.OnSize();
125396
+ }
125397
+
125369
125398
  /////////////////////////////////////////////////////////////////////////////
125370
125399
  //对外接口
125371
125400
 
@@ -125503,6 +125532,9 @@ function JSReportChartContainer(uielement)
125503
125532
  this.SplashTitle={ StockList:"下载码表中.....", MemberList:"下载成分中....." } ;
125504
125533
 
125505
125534
  this.Canvas=uielement.getContext("2d"); //画布
125535
+
125536
+ this.TooltipCanvas;
125537
+ this.ChartTooltip;
125506
125538
 
125507
125539
  this.Tooltip=document.createElement("div");
125508
125540
  this.Tooltip.className='jsreport-tooltip';
@@ -125574,6 +125606,8 @@ function JSReportChartContainer(uielement)
125574
125606
  this.JSPopMenu; //内置菜单
125575
125607
  this.IsShowRightMenu=true;
125576
125608
 
125609
+ this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null };
125610
+
125577
125611
  this.ChartDestory=function() //销毁
125578
125612
  {
125579
125613
  this.IsDestroy=true;
@@ -125724,6 +125758,12 @@ function JSReportChartContainer(uielement)
125724
125758
 
125725
125759
  this.ChartPaint[0]=chart;
125726
125760
 
125761
+ //提示信息
125762
+ var chartTooltip=new ChartCellTooltip();
125763
+ chartTooltip.Frame=this.Frame;
125764
+ chartTooltip.ChartBorder=this.Frame.ChartBorder;
125765
+ this.ChartTooltip=chartTooltip;
125766
+
125727
125767
  //页脚
125728
125768
  if (option && option.PageInfo===true)
125729
125769
  {
@@ -125835,6 +125875,8 @@ function JSReportChartContainer(uielement)
125835
125875
  {
125836
125876
  this.DelayDraw(500);
125837
125877
  }
125878
+
125879
+ this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
125838
125880
  }
125839
125881
 
125840
125882
  this.DelayDraw=function(frequency)
@@ -126601,6 +126643,7 @@ function JSReportChartContainer(uielement)
126601
126643
  console.log(`[OnWheel] wheelValue=${wheelValue}`);
126602
126644
  if (wheelValue<0) //下
126603
126645
  {
126646
+ this.LastMouseStatus.TooltipStatus=null;
126604
126647
  if (this.GotoNextItem(1))
126605
126648
  {
126606
126649
  this.Draw();
@@ -126609,6 +126652,7 @@ function JSReportChartContainer(uielement)
126609
126652
  }
126610
126653
  else if (wheelValue>0) //上
126611
126654
  {
126655
+ this.LastMouseStatus.TooltipStatus=null;
126612
126656
  if (this.GotoNextItem(-1))
126613
126657
  {
126614
126658
  this.Draw();
@@ -126620,6 +126664,7 @@ function JSReportChartContainer(uielement)
126620
126664
  {
126621
126665
  if (wheelValue<0) //下一页
126622
126666
  {
126667
+ this.LastMouseStatus.TooltipStatus=null;
126623
126668
  if (this.GotoNextPage(this.PageUpDownCycle))
126624
126669
  {
126625
126670
  this.Draw();
@@ -126628,6 +126673,7 @@ function JSReportChartContainer(uielement)
126628
126673
  }
126629
126674
  else if (wheelValue>0) //上一页
126630
126675
  {
126676
+ this.LastMouseStatus.TooltipStatus=null;
126631
126677
  if (this.GotoPreviousPage(this.PageUpDownCycle))
126632
126678
  {
126633
126679
  this.Draw();
@@ -126849,7 +126895,13 @@ function JSReportChartContainer(uielement)
126849
126895
  var pixelTatio = GetDevicePixelRatio();
126850
126896
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
126851
126897
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
126898
+
126899
+ this.LastMouseStatus.OnMouseMove=null;
126852
126900
 
126901
+ var bDrawTooltip=false;
126902
+ if (this.LastMouseStatus.TooltipStatus) bDrawTooltip=true;
126903
+ this.LastMouseStatus.TooltipStatus=null;
126904
+
126853
126905
  if (this.DragRow) return;
126854
126906
  if (this.DrawHeader) return;
126855
126907
  if (this.DragColumnWidth) return;
@@ -126869,10 +126921,11 @@ function JSReportChartContainer(uielement)
126869
126921
  }
126870
126922
  }
126871
126923
 
126924
+ this.LastMouseStatus.OnMouseMove={ X:x, Y:y };
126872
126925
  var mouseStatus={ Cursor:"default", Name:"Default"};; //鼠标状态
126873
126926
  var report=this.GetReportChart();
126874
- var cell=null;
126875
126927
  var bDraw=false;
126928
+
126876
126929
  if (report)
126877
126930
  {
126878
126931
  var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);
@@ -126883,7 +126936,12 @@ function JSReportChartContainer(uielement)
126883
126936
  }
126884
126937
  else
126885
126938
  {
126886
- cell=report.PtInCell(x,y); //是否在单元格(EnableTooltip)
126939
+ var tooltipData=report.GetTooltipData(x,y); //单元格提示信息
126940
+ if (tooltipData)
126941
+ {
126942
+ this.LastMouseStatus.TooltipStatus={ X:x, Y:y, Data:tooltipData };
126943
+ bDrawTooltip=true;
126944
+ }
126887
126945
  }
126888
126946
 
126889
126947
  var scrollbar=report.VScrollbar;
@@ -126899,16 +126957,20 @@ function JSReportChartContainer(uielement)
126899
126957
  }
126900
126958
  }
126901
126959
 
126960
+
126961
+ /* 目前没有用到
126902
126962
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);
126903
126963
  if (event)
126904
126964
  {
126905
126965
  var sendData={X:x, Y:y, Cell:cell };
126906
126966
  event.Callback(event,sendData,this);
126907
126967
  }
126968
+ */
126908
126969
 
126909
126970
  if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
126910
126971
 
126911
126972
  if (bDraw) this.Draw();
126973
+ else if (bDrawTooltip) this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
126912
126974
  }
126913
126975
 
126914
126976
  this.UIOnMounseOut=function(e)
@@ -128089,6 +128151,7 @@ function JSReportChartContainer(uielement)
128089
128151
  {
128090
128152
  this.ExecuteMenuCommand(tabData.Tab.CommandID, [tabData.Tab.ID]);
128091
128153
  this.SetSelectedTab(tabData.Index);
128154
+ redraw=true;
128092
128155
  }
128093
128156
  }
128094
128157
 
@@ -128187,6 +128250,7 @@ function JSReportChartContainer(uielement)
128187
128250
 
128188
128251
  case REPORT_COLUMN_ID.VOL_IN_ID:
128189
128252
  case REPORT_COLUMN_ID.VOL_OUT_ID:
128253
+ case REPORT_COLUMN_ID.DATE_ID:
128190
128254
 
128191
128255
  return this.LocalNumberSort(left, right, column, sortType);
128192
128256
  case REPORT_COLUMN_ID.CUSTOM_NUMBER_TEXT_ID: //自定义数值字段
@@ -128361,6 +128425,31 @@ function JSReportChartContainer(uielement)
128361
128425
  }
128362
128426
  }
128363
128427
 
128428
+ this.LoacCustomStringSort=function(left, right, column, sortType)
128429
+ {
128430
+ var leftValue="", rightValue="";
128431
+ if (sortType==2) rightValue=leftValue="啊啊啊啊啊";
128432
+
128433
+ var value=this.GetStockExtendData(left, column);
128434
+ if (IFrameSplitOperator.IsString(value)) leftValue=value;
128435
+
128436
+ var value=this.GetStockExtendData(right, column);
128437
+ if (IFrameSplitOperator.IsString(value)) rightValue=value;
128438
+
128439
+ if (sortType==1)
128440
+ {
128441
+ if (rightValue<leftValue) return -1;
128442
+ else if (rightValue<leftValue) return 1;
128443
+ else return 0;
128444
+ }
128445
+ else
128446
+ {
128447
+ if (leftValue<rightValue) return -1;
128448
+ else if (leftValue>rightValue) return 1;
128449
+ else return 0;
128450
+ }
128451
+ }
128452
+
128364
128453
  this.RequestStockSortData=function(column, filedid, sortType)
128365
128454
  {
128366
128455
  var chart=this.ChartPaint[0];
@@ -128477,6 +128566,28 @@ function JSReportChartContainer(uielement)
128477
128566
 
128478
128567
  return true;
128479
128568
  }
128569
+
128570
+ this.DrawTooltip=function(tooltipStatus)
128571
+ {
128572
+ if (!this.GetExtraCanvas) return;
128573
+ if (!this.TooltipCanvas)
128574
+ {
128575
+ var finder=this.GetExtraCanvas(JSReportChart.TooltipCursorCanvasKey);
128576
+ if (!finder) return;
128577
+ this.TooltipCanvas=finder.Canvas;
128578
+ }
128579
+
128580
+ if (!this.TooltipCanvas) return;
128581
+ this.ClearCanvas(this.TooltipCanvas);
128582
+ if (!this.ChartTooltip) return;
128583
+
128584
+ if (!tooltipStatus || !tooltipStatus.Data) return;
128585
+
128586
+ this.ChartTooltip.Canvas=this.TooltipCanvas;
128587
+ this.ChartTooltip.Point={ X:tooltipStatus.X, Y:tooltipStatus.Y };
128588
+ this.ChartTooltip.Data=tooltipStatus.Data.Data;
128589
+ this.ChartTooltip.Draw();
128590
+ }
128480
128591
  }
128481
128592
 
128482
128593
 
@@ -128645,6 +128756,8 @@ var MAP_COLUMN_FIELD=new Map([
128645
128756
  [REPORT_COLUMN_ID.VOL_OUT_ID,"VolOut"],
128646
128757
 
128647
128758
  [REPORT_COLUMN_ID.NAME_EX_ID, "NameEx"],
128759
+
128760
+ [REPORT_COLUMN_ID.DATE_ID, "Date"],
128648
128761
  ]);
128649
128762
 
128650
128763
  function ChartReport()
@@ -128777,7 +128890,11 @@ function ChartReport()
128777
128890
  this.BottomToolbarHeight=0; //底部工具条高度
128778
128891
  this.IsShowAllColumn=false; //是否已显示所有列
128779
128892
 
128780
- this.Column= //{ Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:文字最大宽度 , TextColor:文字颜色, Sort:0=不支持排序 1=本地排序 0=远程排序 }
128893
+ //{
128894
+ // Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:文字最大宽度 , TextColor:文字颜色, Sort:0=不支持排序 1=本地排序 0=远程排序,
128895
+ // Icon:{ Family:"iconfont", Size:12, Symbol:"", Margin: { Left:, Bottom }}
128896
+ //}
128897
+ this.Column=
128781
128898
  [
128782
128899
  { Type:REPORT_COLUMN_ID.INDEX_ID, Title:"序号", TextAlign:"center", Width:null, TextColor:g_JSChartResource.Report.FieldColor.Index, MaxText:"8888"},
128783
128900
  { Type:REPORT_COLUMN_ID.SYMBOL_ID, Title:"代码", TextAlign:"left", Width:null, TextColor:g_JSChartResource.Report.FieldColor.Symbol, MaxText:"888888"},
@@ -128787,6 +128904,9 @@ function ChartReport()
128787
128904
 
128788
128905
  this.RectClient={};
128789
128906
 
128907
+ //{ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:{ AryText:[ {Text:xx} ]} };
128908
+ //Type:1=数据截断
128909
+ // { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }}
128790
128910
  this.TooltipRect=[];
128791
128911
 
128792
128912
  this.ReloadResource=function(resource)
@@ -128885,11 +129005,11 @@ function ChartReport()
128885
129005
  if (item.FullColBGColor) colItem.FullColBGColor=item.FullColBGColor; //整列背景色
128886
129006
  if (item.HeaderBGColor) colItem.HeaderBGColor=item.HeaderBGColor; //表头背景色
128887
129007
  if (IFrameSplitOperator.IsNumber(item.Sort)) colItem.Sort=item.Sort;
128888
- if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
128889
129008
  if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
128890
129009
  if (IFrameSplitOperator.IsBool(item.EnableDragWidth)) colItem.EnableDragWidth=item.EnableDragWidth;
128891
129010
  if (IFrameSplitOperator.IsBool(item.IsDrawCallback)) colItem.IsDrawCallback=item.IsDrawCallback;
128892
129011
  else colItem.IsDrawCallback=false;
129012
+ if (item.Icon) colItem.Icon=item.Icon;
128893
129013
 
128894
129014
  if (item.Sort==1 || item.Sort==2) //1本地排序 2=远程排序
128895
129015
  {
@@ -129195,6 +129315,17 @@ function ChartReport()
129195
129315
 
129196
129316
  item.Width=itemWidth+4+this.ItemMergin.Left+this.ItemMergin.Right;
129197
129317
  }
129318
+
129319
+ if (item.Icon && item.Icon.Symbol)
129320
+ {
129321
+ item.Width+=item.Icon.Size;
129322
+ if (item.Icon.Margin)
129323
+ {
129324
+ var margin=item.Icon.Margin;
129325
+ if (IFrameSplitOperator.IsNumber(margin.Left)) item.Width+=margin.Left;
129326
+ if (IFrameSplitOperator.IsNumber(margin.Right)) item.Width+=margin.Right;
129327
+ }
129328
+ }
129198
129329
  }
129199
129330
 
129200
129331
  this.Canvas.font=this.HeaderFont;
@@ -129254,16 +129385,36 @@ function ChartReport()
129254
129385
  this.DrawItemBG({ Rect:rtBG, BGColor:item.HeaderBGColor });
129255
129386
  }
129256
129387
 
129388
+ var iconWidth=0;
129389
+ if (item.Icon && item.Icon.Symbol) //图标
129390
+ {
129391
+ var iconWidth=item.Icon.Size;
129392
+ if (item.Icon.Margin)
129393
+ {
129394
+ var margin=item.Icon.Margin;
129395
+ if (IFrameSplitOperator.IsNumber(margin.Left)) iconWidth+=margin.Left;
129396
+ if (IFrameSplitOperator.IsNumber(margin.Right)) iconWidth+=margin.Right;
129397
+ }
129398
+ }
129399
+ textWidth-=iconWidth;
129400
+
129257
129401
  if (item.HeaderColor) this.Canvas.fillStyle=item.HeaderColor;
129258
129402
  else this.Canvas.fillStyle=this.HeaderColor;
129259
129403
 
129404
+ var textSize={ }
129260
129405
  if (this.SortInfo && this.SortInfo.Field==i && this.SortInfo.Sort>0)
129261
129406
  {
129262
- this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort);
129407
+ this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort, textSize);
129263
129408
  }
129264
129409
  else
129265
129410
  {
129266
- this.DrawText(item.Title,item.TextAlign,x,y,textWidth);
129411
+ this.DrawText(item.Title,item.TextAlign,x,y,textWidth,textSize);
129412
+ }
129413
+
129414
+ if (iconWidth>0)
129415
+ {
129416
+ this.DrawHeaderIcon(item.Icon, textSize.Right, y, i, item);
129417
+ this.Canvas.font=this.HeaderFont;
129267
129418
  }
129268
129419
 
129269
129420
  this.Canvas.fillStyle=this.HeaderColor;
@@ -129286,44 +129437,91 @@ function ChartReport()
129286
129437
  this.DrawItemBG({ Rect:rtBG, BGColor:item.HeaderBGColor });
129287
129438
  }
129288
129439
 
129440
+ var iconWidth=0;
129441
+ if (item.Icon && item.Icon.Symbol) //图标
129442
+ {
129443
+ var iconWidth=item.Icon.Size;
129444
+ if (item.Icon.Margin)
129445
+ {
129446
+ var margin=item.Icon.Margin;
129447
+ if (IFrameSplitOperator.IsNumber(margin.Left)) iconWidth+=margin.Left;
129448
+ if (IFrameSplitOperator.IsNumber(margin.Right)) iconWidth+=margin.Right;
129449
+ }
129450
+ }
129451
+
129452
+ textWidth-=iconWidth;
129453
+
129289
129454
  if (item.HeaderColor) this.Canvas.fillStyle=item.HeaderColor;
129290
129455
  else this.Canvas.fillStyle=this.HeaderColor;
129291
129456
 
129457
+ var textSize={ }
129292
129458
  if (this.SortInfo && this.SortInfo.Field==i && this.SortInfo.Sort>0)
129293
129459
  {
129294
- this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort);
129460
+ this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort,textSize);
129295
129461
  }
129296
129462
  else
129297
129463
  {
129298
- this.DrawText(item.Title,item.TextAlign,x,y,textWidth);
129464
+ this.DrawText(item.Title,item.TextAlign,x,y,textWidth,textSize);
129465
+ }
129466
+
129467
+ if (iconWidth>0)
129468
+ {
129469
+ this.DrawHeaderIcon(item.Icon, textSize.Right, y, i, item);
129470
+ this.Canvas.font=this.HeaderFont;
129299
129471
  }
129300
129472
 
129301
129473
  textLeft+=item.Width;
129302
129474
  }
129303
129475
  }
129304
129476
 
129305
- this.DrawText=function(text, textAlign, x, y, textWidth)
129477
+ this.DrawText=function(text, textAlign, x, y, cellWidth, textSize)
129306
129478
  {
129479
+ var textWidth=this.Canvas.measureText(text).width;
129307
129480
  if (textAlign=='center')
129308
129481
  {
129309
- x=x+textWidth/2;
129310
- this.Canvas.textAlign="center";
129482
+ x=x+(cellWidth-textWidth)/2;
129311
129483
  }
129312
129484
  else if (textAlign=='right')
129313
129485
  {
129314
- x=x+textWidth;
129315
- this.Canvas.textAlign="right";
129316
- }
129317
- else
129318
- {
129319
- this.Canvas.textAlign="left";
129486
+ x=x+cellWidth-textWidth;
129320
129487
  }
129321
129488
 
129489
+ this.Canvas.textAlign="left";
129322
129490
  this.Canvas.textBaseline="middle";
129323
129491
  this.Canvas.fillText(text,x,y);
129492
+
129493
+ if (textSize)
129494
+ {
129495
+ textSize.Right=x+textWidth;
129496
+ textSize.Width=textWidth;
129497
+ }
129324
129498
  }
129325
129499
 
129326
- this.DrawSortHeader=function(text, textAlign, x, y, width, sortType)
129500
+ this.DrawHeaderIcon=function(icon, x, y, index, column)
129501
+ {
129502
+ var iconFont=`${icon.Size}px ${icon.Family}`;
129503
+ this.Canvas.font=iconFont;
129504
+ this.Canvas.textAlign="left";
129505
+ if (icon.Color) this.Canvas.fillStyle=icon.Color;
129506
+
129507
+ var xIcon=x;
129508
+ var yIcon=y;
129509
+ if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Left)) xIcon+=icon.Margin.Left;
129510
+ if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Bottom)) yIcon-=icon.Margin.Bottom;
129511
+ this.Canvas.fillText(icon.Symbol, xIcon, yIcon);
129512
+
129513
+ if (icon.Tooltip)
129514
+ {
129515
+ var rtIcon={ Left:xIcon, Top:yIcon-icon.Size/2, Width:icon.Size, Height:icon.Size };
129516
+ rtIcon.Right=rtIcon.Left+rtIcon.Width;
129517
+ rtIcon.Bottom=rtIcon.Top+rtIcon.Height;
129518
+
129519
+ var tooltipData={ Rect:rtIcon, Type:2, Column:column, Index:index, Data:icon.Tooltip.Data };
129520
+ this.TooltipRect.push(tooltipData);
129521
+ }
129522
+ }
129523
+
129524
+ this.DrawSortHeader=function(text, textAlign, x, y, width, sortType,textSize)
129327
129525
  {
129328
129526
  var sortText=sortType==1?"↓":"↑";
129329
129527
  var sortTextWidth=this.Canvas.measureText(sortText).width;
@@ -129339,15 +129537,17 @@ function ChartReport()
129339
129537
  {
129340
129538
  x=(x+width)-sortTextWidth-textWidth;
129341
129539
  }
129342
- else
129343
- {
129344
-
129345
- }
129346
129540
 
129347
129541
  this.Canvas.fillText(text,x,y);
129348
129542
  this.Canvas.fillStyle=this.SortColor;
129349
129543
  this.Canvas.fillText(sortText,x+textWidth,y);
129350
129544
  this.Canvas.fillStyle=this.HeaderColor;
129545
+
129546
+ if (textSize)
129547
+ {
129548
+ textSize.Right=x+textWidth+sortTextWidth;
129549
+ textSize.Width=textWidth+sortTextWidth;
129550
+ }
129351
129551
  }
129352
129552
 
129353
129553
 
@@ -129601,7 +129801,7 @@ function ChartReport()
129601
129801
  var x=left+this.ItemMergin.Left;
129602
129802
  var textWidth=column.Width-this.ItemMergin.Left-this.ItemMergin.Right;
129603
129803
  var stock=data.Stock;
129604
- var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign };
129804
+ var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign, Tooltip:null };
129605
129805
  var rtItem={ Left:left, Top:top, Width:column.Width, Height:this.RowHeight };
129606
129806
  rtItem.Right=rtItem.Left+rtItem.Width;
129607
129807
  rtItem.Bottom=rtItem.Top+rtItem.Height;
@@ -129612,12 +129812,6 @@ function ChartReport()
129612
129812
  this.DrawItemBG({ Rect:rtItem, BGColor:column.FullColBGColor });
129613
129813
  }
129614
129814
 
129615
- //tooltip提示
129616
- if (column.EnableTooltip===true)
129617
- {
129618
- this.TooltipRect.push({ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType })
129619
- }
129620
-
129621
129815
  if (column.Type==REPORT_COLUMN_ID.INDEX_ID)
129622
129816
  {
129623
129817
  if (rowType==1) return; //固定行序号空
@@ -129865,6 +130059,14 @@ function ChartReport()
129865
130059
  else
129866
130060
  this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
129867
130061
  }
130062
+
130063
+ //tooltip提示
130064
+ if (drawInfo.Tooltip)
130065
+ {
130066
+ //Type:1=数据截断
130067
+ var tooltipData={ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:drawInfo.Tooltip.Data };
130068
+ this.TooltipRect.push(tooltipData);
130069
+ }
129868
130070
  }
129869
130071
 
129870
130072
  this.DrawCustomText=function(drawInfo, column, left, top, cellWidth)
@@ -129913,6 +130115,13 @@ function ChartReport()
129913
130115
  this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
129914
130116
  //this.Canvas.stroke(); //调试用
129915
130117
  this.Canvas.clip();
130118
+
130119
+ //数据截断提示信息
130120
+ drawInfo.Tooltip=
130121
+ {
130122
+ Type:1,
130123
+ Data:{ AryText:[ {Text:drawInfo.Text} ] }
130124
+ }
129916
130125
  }
129917
130126
 
129918
130127
  this.Canvas.textBaseline="middle";
@@ -131190,8 +131399,7 @@ function ChartReport()
131190
131399
 
131191
131400
  }
131192
131401
 
131193
- //坐标所在单元格
131194
- this.PtInCell=function(x,y)
131402
+ this.GetTooltipData=function(x,y)
131195
131403
  {
131196
131404
  if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return null;
131197
131405
 
@@ -131203,9 +131411,11 @@ function ChartReport()
131203
131411
 
131204
131412
  if (x>=rt.Left && x<=rt.Right && y>=rt.Top && y<=rt.Bottom)
131205
131413
  {
131206
- return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index };
131414
+ return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index, Type:item.Type, Data:item.Data };
131207
131415
  }
131208
131416
  }
131417
+
131418
+ return null;
131209
131419
  }
131210
131420
 
131211
131421
  this.PtInHeaderDragBorder=function(x, y)
@@ -131797,6 +132007,169 @@ function ChartVScrollbar()
131797
132007
  return pos;
131798
132008
  }
131799
132009
  }
132010
+
132011
+
132012
+ function ChartCellTooltip()
132013
+ {
132014
+ this.Canvas; //画布
132015
+ this.ChartBorder; //边框信息
132016
+ this.ChartFrame; //框架画法
132017
+ this.Name; //名称
132018
+ this.ClassName='ChartCellTooltip'; //类名
132019
+
132020
+ this.BGColor="rgba(255,255,225, 0.9)";
132021
+ this.BorderColor="rgb(0,0,0)";
132022
+ this.Margin={ Left:5, Right:5, Top:4, Bottom:5 };
132023
+ this.Font=`${13*GetDevicePixelRatio()}px 微软雅黑`;
132024
+ this.TextColor="rgb(0,0,0)";
132025
+ this.YOffset=20;
132026
+ this.XOffset=5;
132027
+
132028
+ this.Point; //{ X, Y}
132029
+ this.Data; //{ AryText:[ { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }} ]}
132030
+
132031
+
132032
+ this.Draw=function()
132033
+ {
132034
+ if (!this.Canvas) return;
132035
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.AryText)) return;
132036
+ if (!this.Point) return;
132037
+
132038
+ var size={ Width:0, Height:0, Text:[] };
132039
+ this.CalculateTextSize(this.Data.AryText, size);
132040
+ if (!IFrameSplitOperator.IsNonEmptyArray(size.Text)) return;
132041
+
132042
+ this.DrawTooltip(this.Data.AryText, size);
132043
+ }
132044
+
132045
+ this.CalculateTextSize=function(aryText, size)
132046
+ {
132047
+ var width=0, height=0;
132048
+ for(var i=0;i<aryText.length;++i)
132049
+ {
132050
+ var item=aryText[i];
132051
+ var titleHeight=0, titleWidth=0;
132052
+ if (!item.Title && !item.Text) continue;
132053
+
132054
+ if (item.Title)
132055
+ {
132056
+ if (item.TitleFont) this.Canvas.font=item.TitleFont;
132057
+ else this.Canvas.font=this.Font;
132058
+
132059
+ titleWidth=this.Canvas.measureText(item.Title).width;
132060
+ titleHeight=this.Canvas.measureText("擎").width;
132061
+ }
132062
+
132063
+ var textWidth=0, textHeight=0;
132064
+ if (item.Text)
132065
+ {
132066
+ if (item.Font) this.Canvas.font=item.Font;
132067
+ else this.Canvas.font=this.Font;
132068
+
132069
+ textWidth=this.Canvas.measureText(item.Text).width;
132070
+ textHeight=this.Canvas.measureText("擎").width;
132071
+ }
132072
+
132073
+ var itemWidth=titleWidth+textWidth;
132074
+ var itemHeight=Math.max(textHeight,titleHeight);
132075
+
132076
+ if (IFrameSplitOperator.IsNumber(item.Space)) itemWidth+=item.Space;
132077
+
132078
+ if (item.Margin)
132079
+ {
132080
+ var margin=item.Margin;
132081
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
132082
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
132083
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
132084
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
132085
+ }
132086
+
132087
+ if (width<itemWidth) width=itemWidth;
132088
+ height+=itemHeight;
132089
+
132090
+ size.Text[i]={ Width: itemWidth, Height:itemHeight, TitleWidth:titleWidth, TextWidth:textWidth };
132091
+ }
132092
+
132093
+ if (this.Margin)
132094
+ {
132095
+ var margin=this.Margin;
132096
+ if (IFrameSplitOperator.IsNumber(margin.Left)) width+=margin.Left;
132097
+ if (IFrameSplitOperator.IsNumber(margin.Right)) width+=margin.Right;
132098
+ if (IFrameSplitOperator.IsNumber(margin.Top)) height+=margin.Top;
132099
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) height+=margin.Bottom;
132100
+ }
132101
+
132102
+ size.Width=width;
132103
+ size.Height=height;
132104
+ }
132105
+
132106
+ this.DrawTooltip=function(aryText, size)
132107
+ {
132108
+ var rtBG={ Left:this.Point.X+this.XOffset, Top:this.Point.Y+this.YOffset, Width:size.Width, Height:size.Height };
132109
+ rtBG.Right=rtBG.Left+rtBG.Width;
132110
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
132111
+
132112
+ var border=this.ChartBorder.GetBorder();
132113
+ if (rtBG.Bottom>border.ChartHeight)
132114
+ {
132115
+ rtBG.Bottom=this.Point.Y;
132116
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
132117
+ }
132118
+
132119
+ if (rtBG.Right>border.ChartWidth)
132120
+ {
132121
+ rtBG.Right=this.Point.X;
132122
+ rtBG.Left=rtBG.Right-rtBG.Width;
132123
+ }
132124
+
132125
+ if (this.BGColor)
132126
+ {
132127
+ this.Canvas.fillStyle=this.BGColor;
132128
+ this.Canvas.fillRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
132129
+ }
132130
+
132131
+ if (this.BorderColor)
132132
+ {
132133
+ this.Canvas.strokeStyle=this.BorderColor;
132134
+ this.Canvas.strokeRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
132135
+ }
132136
+
132137
+ var left=rtBG.Left;
132138
+ var top=rtBG.Top;
132139
+ if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Left)) left+=this.Margin.Left;
132140
+ if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Top)) top+=this.Margin.Top;
132141
+
132142
+ var xText, yText=top;
132143
+ for(var i=0;i<aryText.length;++i)
132144
+ {
132145
+ var item=aryText[i];
132146
+ if (!item.Title && !item.Text) continue;
132147
+ var itemSize=size.Text[i];
132148
+
132149
+ xText=left;
132150
+ yText+=itemSize.Height;
132151
+
132152
+ if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Left)) xText+=item.Margin.Left;
132153
+ if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Bottom)) yText-=item.Margin.Bottom;
132154
+ if (item.Title)
132155
+ {
132156
+ if (item.TitleColor) this.Canvas.fillStyle=item.TitleColor;
132157
+ else this.Canvas.fillStyle=this.TextColor;
132158
+ this.Canvas.fillText(item.Title,xText,yText,itemSize.TitleWidth);
132159
+ xText+=itemSize.TitleWidth;
132160
+ if (IFrameSplitOperator.IsNumber(item.Space)) xText+=item.Space;
132161
+ }
132162
+
132163
+ if (item.Text)
132164
+ {
132165
+ if (item.Color) this.Canvas.fillStyle=item.Color;
132166
+ else this.Canvas.fillStyle=this.TextColor;
132167
+ this.Canvas.fillText(item.Text,xText,yText,itemSize.TextWidth);
132168
+ }
132169
+
132170
+ }
132171
+ }
132172
+ }
131800
132173
  /*
131801
132174
  Copyright (c) 2018 jones
131802
132175
 
@@ -134875,7 +135248,7 @@ function ScrollBarBGChart()
134875
135248
 
134876
135249
 
134877
135250
 
134878
- var HQCHART_VERSION="1.1.13525";
135251
+ var HQCHART_VERSION="1.1.13536";
134879
135252
 
134880
135253
  function PrintHQChartVersion()
134881
135254
  {