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.
@@ -3996,6 +3996,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
3996
3996
  this.DivElement=divElement;
3997
3997
  this.DivToolElement=null; //工具条
3998
3998
  this.JSChartContainer; //画图控件
3999
+ this.ResizeListener;
3999
4000
 
4000
4001
  //h5 canvas
4001
4002
  this.CanvasElement=document.createElement("canvas");
@@ -5673,6 +5674,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5673
5674
  this.JSChartContainer=chart;
5674
5675
  chart.DivElement=this.DivElement;
5675
5676
 
5677
+ if (option.EnableResize==true) this.CreateResizeListener();
5678
+
5676
5679
  if (option.DefaultCursor) chart.DefaultCursor=option.DefaultCursor;
5677
5680
  if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
5678
5681
 
@@ -5715,6 +5718,19 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5715
5718
  }
5716
5719
  }
5717
5720
 
5721
+ this.CreateResizeListener=function()
5722
+ {
5723
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
5724
+ this.ResizeListener.observe(this.DivElement);
5725
+ }
5726
+
5727
+ this.OnDivResize=function(entries)
5728
+ {
5729
+ JSConsole.Chart.Log("[JSChart::OnDivResize] entries=", entries);
5730
+
5731
+ this.OnSize( {Type:1} );
5732
+ }
5733
+
5718
5734
  //创建工具条
5719
5735
  this.CreateToolbar=function(option)
5720
5736
  {
@@ -41950,6 +41966,7 @@ function ChartMultiText()
41950
41966
  {
41951
41967
  var border=this.ChartBorder.GetHScreenBorder();
41952
41968
  var chartright=border.BottomEx;
41969
+ var chartleft=border.TopEx;
41953
41970
  var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
41954
41971
  var left=this.ChartBorder.GetTop();
41955
41972
  var right=this.ChartBorder.GetBottom();
@@ -41961,6 +41978,7 @@ function ChartMultiText()
41961
41978
  var border=this.ChartBorder.GetBorder();
41962
41979
  var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
41963
41980
  var chartright=border.RightEx;
41981
+ var chartleft=border.LeftEx;
41964
41982
  var left=this.ChartBorder.GetLeft();
41965
41983
  var right=this.ChartBorder.GetRight();
41966
41984
  var top=border.TopEx;
@@ -41996,16 +42014,17 @@ function ChartMultiText()
41996
42014
 
41997
42015
  var textWidth=this.Canvas.measureText(item.Text).width;
41998
42016
  this.Canvas.textAlign='center';
41999
- if (x+textWidth/2>=right)
42017
+ if (x+textWidth/2>=chartright)
42000
42018
  {
42001
42019
  this.Canvas.textAlign='right';
42002
- x=right;
42020
+ x=chartright;
42003
42021
  }
42004
- else if (x-textWidth/2<left)
42022
+ else if (x-textWidth/2<chartleft)
42005
42023
  {
42006
42024
  this.Canvas.textAlign = 'left';
42007
- x=left;
42025
+ x=chartleft;
42008
42026
  }
42027
+
42009
42028
  if (item.Baseline==1) this.Canvas.textBaseline='top';
42010
42029
  else if (item.Baseline==2) this.Canvas.textBaseline='bottom';
42011
42030
  else this.Canvas.textBaseline = 'middle';
@@ -125190,18 +125209,76 @@ function JSReportChart(divElement)
125190
125209
  this.DivElement=divElement;
125191
125210
  this.JSChartContainer; //表格控件
125192
125211
 
125193
- //h5 canvas
125194
- this.CanvasElement=document.createElement("canvas");
125195
- this.CanvasElement.className='jsreportlist-drawing';
125196
- this.CanvasElement.id=Guid();
125197
- this.CanvasElement.setAttribute("tabindex",0);
125198
- if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
125199
- if(divElement.hasChildNodes())
125200
- {
125201
- JSConsole.Chart.Log("[JSReportChart::JSReportChart] divElement hasChildNodes", divElement.childNodes);
125202
- }
125203
- divElement.appendChild(this.CanvasElement);
125212
+ //h5 canvas
125213
+ this.CanvasElement=document.createElement("canvas");
125214
+ this.CanvasElement.className='jsreportlist-drawing';
125215
+ this.CanvasElement.id=Guid();
125216
+ this.CanvasElement.setAttribute("tabindex",0);
125217
+ if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
125218
+ if(divElement.hasChildNodes())
125219
+ {
125220
+ JSConsole.Chart.Log("[JSReportChart::JSReportChart] divElement hasChildNodes", divElement.childNodes);
125221
+ }
125222
+ divElement.appendChild(this.CanvasElement);
125223
+
125224
+ //额外的画布
125225
+ this.MapExtraCanvasElement=new Map(); //key=画布名字, value={ Element:, Canvas:}
125226
+
125227
+ this.CreateExtraCanvasElement=function(name, option)
125228
+ {
125229
+ if (this.MapExtraCanvasElement.has(name)) return this.MapExtraCanvasElement.get(name);
125230
+
125231
+ var element=document.createElement("canvas");
125232
+ element.className='jsreportlist-drawing-extra';
125233
+ element.id=Guid();
125234
+ if (name==JSReportChart.CorssCursorCanvasKey)
125235
+ element.setAttribute("tabindex",5);
125236
+ else
125237
+ element.setAttribute("tabindex",1);
125238
+
125239
+ if (element.style)
125240
+ {
125241
+ element.style.outline='none';
125242
+ element.style.position="absolute";
125243
+ element.style.left='0px';
125244
+ element.style.top='0px';
125245
+ element.style["pointer-events"]="none";
125246
+ }
125247
+
125248
+ if (option)
125249
+ {
125250
+ if (IFrameSplitOperator.IsNumber(option.TabIndex)) element.setAttribute("tabindex",option.TabIndex);
125251
+ if (IFrameSplitOperator.IsNumber(option.ZIndex)) element.style["z-index"]=option.ZIndex;
125252
+ }
125253
+
125254
+ if (this.CanvasElement)
125255
+ {
125256
+ element.height=this.CanvasElement.height;
125257
+ element.width=this.CanvasElement.width;
125258
+ if (element.style)
125259
+ {
125260
+ element.style.width=this.CanvasElement.style.width;
125261
+ element.style.height=this.CanvasElement.style.height
125262
+ }
125263
+ }
125264
+
125265
+ divElement.appendChild(element);
125266
+
125267
+ var item={ Element:element, Canvas:null };
125268
+ this.MapExtraCanvasElement.set(name, item);
125269
+ }
125270
+
125271
+ this.GetExtraCanvas=function(name)
125272
+ {
125273
+ if (!this.MapExtraCanvasElement.has(name)) return null;
125274
+
125275
+ var item=this.MapExtraCanvasElement.get(name);
125276
+ if (!item.Element) return null;
125204
125277
 
125278
+ if (!item.Canvas) item.Canvas=item.Element.getContext("2d");
125279
+
125280
+ return item;
125281
+ }
125205
125282
 
125206
125283
  this.OnSize=function()
125207
125284
  {
@@ -125216,6 +125293,19 @@ function JSReportChart(divElement)
125216
125293
  this.CanvasElement.height*=pixelTatio;
125217
125294
  this.CanvasElement.width*=pixelTatio;
125218
125295
 
125296
+ //扩展画布
125297
+ for(var mapItem of this.MapExtraCanvasElement)
125298
+ {
125299
+ var item=mapItem[1];
125300
+ var element=item.Element;
125301
+ if (!element) continue;
125302
+
125303
+ element.height=this.CanvasElement.height;
125304
+ element.width=this.CanvasElement.width;
125305
+ element.style.width=this.CanvasElement.style.width;
125306
+ element.style.height=this.CanvasElement.style.height;
125307
+ }
125308
+
125219
125309
  JSConsole.Chart.Log(`[JSReportChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
125220
125310
 
125221
125311
  if (this.JSChartContainer && this.JSChartContainer.OnSize)
@@ -125236,6 +125326,10 @@ function JSReportChart(divElement)
125236
125326
  this.DivElement.JSChart=this; //div中保存一份
125237
125327
 
125238
125328
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
125329
+ if (option.EnableTooltip)
125330
+ {
125331
+ this.CreateExtraCanvasElement(JSReportChart.TooltipCursorCanvasKey, { ZIndex:99 });
125332
+ }
125239
125333
 
125240
125334
  if (option.Symbol) chart.Symbol=option.Symbol;
125241
125335
  if (option.Name) chart.Name=option.Name;
@@ -125257,6 +125351,8 @@ function JSReportChart(divElement)
125257
125351
  this.CreateJSReportChartContainer=function(option)
125258
125352
  {
125259
125353
  var chart=new JSReportChartContainer(this.CanvasElement);
125354
+ chart.GetExtraCanvas=(name)=>{ return this.GetExtraCanvas(name); }
125355
+
125260
125356
  chart.Create(option);
125261
125357
 
125262
125358
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
@@ -125377,6 +125473,8 @@ function JSReportChart(divElement)
125377
125473
  }
125378
125474
  }
125379
125475
 
125476
+ JSReportChart.TooltipCursorCanvasKey="hq_report_tooltip"; //提示信息
125477
+
125380
125478
 
125381
125479
  JSReportChart.Init=function(divElement)
125382
125480
  {
@@ -125455,6 +125553,9 @@ function JSReportChartContainer(uielement)
125455
125553
  this.SplashTitle={ StockList:"下载码表中.....", MemberList:"下载成分中....." } ;
125456
125554
 
125457
125555
  this.Canvas=uielement.getContext("2d"); //画布
125556
+
125557
+ this.TooltipCanvas;
125558
+ this.ChartTooltip;
125458
125559
 
125459
125560
  this.Tooltip=document.createElement("div");
125460
125561
  this.Tooltip.className='jsreport-tooltip';
@@ -125526,6 +125627,8 @@ function JSReportChartContainer(uielement)
125526
125627
  this.JSPopMenu; //内置菜单
125527
125628
  this.IsShowRightMenu=true;
125528
125629
 
125630
+ this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null };
125631
+
125529
125632
  this.ChartDestory=function() //销毁
125530
125633
  {
125531
125634
  this.IsDestroy=true;
@@ -125595,6 +125698,15 @@ function JSReportChartContainer(uielement)
125595
125698
  }
125596
125699
 
125597
125700
 
125701
+ //清空画布
125702
+ this.ClearCanvas=function(canvas)
125703
+ {
125704
+ if (!canvas) return;
125705
+ if (!this.UIElement) return;
125706
+
125707
+ canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
125708
+ }
125709
+
125598
125710
  //清空固定行数据
125599
125711
  this.ClearFixedRowData=function()
125600
125712
  {
@@ -125667,6 +125779,12 @@ function JSReportChartContainer(uielement)
125667
125779
 
125668
125780
  this.ChartPaint[0]=chart;
125669
125781
 
125782
+ //提示信息
125783
+ var chartTooltip=new ChartCellTooltip();
125784
+ chartTooltip.Frame=this.Frame;
125785
+ chartTooltip.ChartBorder=this.Frame.ChartBorder;
125786
+ this.ChartTooltip=chartTooltip;
125787
+
125670
125788
  //页脚
125671
125789
  if (option && option.PageInfo===true)
125672
125790
  {
@@ -125778,6 +125896,8 @@ function JSReportChartContainer(uielement)
125778
125896
  {
125779
125897
  this.DelayDraw(500);
125780
125898
  }
125899
+
125900
+ this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
125781
125901
  }
125782
125902
 
125783
125903
  this.DelayDraw=function(frequency)
@@ -126544,6 +126664,7 @@ function JSReportChartContainer(uielement)
126544
126664
  console.log(`[OnWheel] wheelValue=${wheelValue}`);
126545
126665
  if (wheelValue<0) //下
126546
126666
  {
126667
+ this.LastMouseStatus.TooltipStatus=null;
126547
126668
  if (this.GotoNextItem(1))
126548
126669
  {
126549
126670
  this.Draw();
@@ -126552,6 +126673,7 @@ function JSReportChartContainer(uielement)
126552
126673
  }
126553
126674
  else if (wheelValue>0) //上
126554
126675
  {
126676
+ this.LastMouseStatus.TooltipStatus=null;
126555
126677
  if (this.GotoNextItem(-1))
126556
126678
  {
126557
126679
  this.Draw();
@@ -126563,6 +126685,7 @@ function JSReportChartContainer(uielement)
126563
126685
  {
126564
126686
  if (wheelValue<0) //下一页
126565
126687
  {
126688
+ this.LastMouseStatus.TooltipStatus=null;
126566
126689
  if (this.GotoNextPage(this.PageUpDownCycle))
126567
126690
  {
126568
126691
  this.Draw();
@@ -126571,6 +126694,7 @@ function JSReportChartContainer(uielement)
126571
126694
  }
126572
126695
  else if (wheelValue>0) //上一页
126573
126696
  {
126697
+ this.LastMouseStatus.TooltipStatus=null;
126574
126698
  if (this.GotoPreviousPage(this.PageUpDownCycle))
126575
126699
  {
126576
126700
  this.Draw();
@@ -126792,7 +126916,13 @@ function JSReportChartContainer(uielement)
126792
126916
  var pixelTatio = GetDevicePixelRatio();
126793
126917
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
126794
126918
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
126919
+
126920
+ this.LastMouseStatus.OnMouseMove=null;
126795
126921
 
126922
+ var bDrawTooltip=false;
126923
+ if (this.LastMouseStatus.TooltipStatus) bDrawTooltip=true;
126924
+ this.LastMouseStatus.TooltipStatus=null;
126925
+
126796
126926
  if (this.DragRow) return;
126797
126927
  if (this.DrawHeader) return;
126798
126928
  if (this.DragColumnWidth) return;
@@ -126812,10 +126942,11 @@ function JSReportChartContainer(uielement)
126812
126942
  }
126813
126943
  }
126814
126944
 
126945
+ this.LastMouseStatus.OnMouseMove={ X:x, Y:y };
126815
126946
  var mouseStatus={ Cursor:"default", Name:"Default"};; //鼠标状态
126816
126947
  var report=this.GetReportChart();
126817
- var cell=null;
126818
126948
  var bDraw=false;
126949
+
126819
126950
  if (report)
126820
126951
  {
126821
126952
  var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);
@@ -126826,7 +126957,12 @@ function JSReportChartContainer(uielement)
126826
126957
  }
126827
126958
  else
126828
126959
  {
126829
- cell=report.PtInCell(x,y); //是否在单元格(EnableTooltip)
126960
+ var tooltipData=report.GetTooltipData(x,y); //单元格提示信息
126961
+ if (tooltipData)
126962
+ {
126963
+ this.LastMouseStatus.TooltipStatus={ X:x, Y:y, Data:tooltipData };
126964
+ bDrawTooltip=true;
126965
+ }
126830
126966
  }
126831
126967
 
126832
126968
  var scrollbar=report.VScrollbar;
@@ -126842,16 +126978,20 @@ function JSReportChartContainer(uielement)
126842
126978
  }
126843
126979
  }
126844
126980
 
126981
+
126982
+ /* 目前没有用到
126845
126983
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);
126846
126984
  if (event)
126847
126985
  {
126848
126986
  var sendData={X:x, Y:y, Cell:cell };
126849
126987
  event.Callback(event,sendData,this);
126850
126988
  }
126989
+ */
126851
126990
 
126852
126991
  if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
126853
126992
 
126854
126993
  if (bDraw) this.Draw();
126994
+ else if (bDrawTooltip) this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
126855
126995
  }
126856
126996
 
126857
126997
  this.UIOnMounseOut=function(e)
@@ -128420,6 +128560,28 @@ function JSReportChartContainer(uielement)
128420
128560
 
128421
128561
  return true;
128422
128562
  }
128563
+
128564
+ this.DrawTooltip=function(tooltipStatus)
128565
+ {
128566
+ if (!this.GetExtraCanvas) return;
128567
+ if (!this.TooltipCanvas)
128568
+ {
128569
+ var finder=this.GetExtraCanvas(JSReportChart.TooltipCursorCanvasKey);
128570
+ if (!finder) return;
128571
+ this.TooltipCanvas=finder.Canvas;
128572
+ }
128573
+
128574
+ if (!this.TooltipCanvas) return;
128575
+ this.ClearCanvas(this.TooltipCanvas);
128576
+ if (!this.ChartTooltip) return;
128577
+
128578
+ if (!tooltipStatus || !tooltipStatus.Data) return;
128579
+
128580
+ this.ChartTooltip.Canvas=this.TooltipCanvas;
128581
+ this.ChartTooltip.Point={ X:tooltipStatus.X, Y:tooltipStatus.Y };
128582
+ this.ChartTooltip.Data=tooltipStatus.Data.Data;
128583
+ this.ChartTooltip.Draw();
128584
+ }
128423
128585
  }
128424
128586
 
128425
128587
 
@@ -128730,6 +128892,9 @@ function ChartReport()
128730
128892
 
128731
128893
  this.RectClient={};
128732
128894
 
128895
+ //{ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:{ AryText:[ {Text:xx} ]} };
128896
+ //Type:1=数据截断
128897
+ // { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }}
128733
128898
  this.TooltipRect=[];
128734
128899
 
128735
128900
  this.ReloadResource=function(resource)
@@ -128828,7 +128993,6 @@ function ChartReport()
128828
128993
  if (item.FullColBGColor) colItem.FullColBGColor=item.FullColBGColor; //整列背景色
128829
128994
  if (item.HeaderBGColor) colItem.HeaderBGColor=item.HeaderBGColor; //表头背景色
128830
128995
  if (IFrameSplitOperator.IsNumber(item.Sort)) colItem.Sort=item.Sort;
128831
- if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
128832
128996
  if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
128833
128997
  if (IFrameSplitOperator.IsBool(item.EnableDragWidth)) colItem.EnableDragWidth=item.EnableDragWidth;
128834
128998
  if (IFrameSplitOperator.IsBool(item.IsDrawCallback)) colItem.IsDrawCallback=item.IsDrawCallback;
@@ -128843,8 +129007,10 @@ function ChartReport()
128843
129007
  if (item.Type==REPORT_COLUMN_ID.CUSTOM_STRING_TEXT_ID)
128844
129008
  {
128845
129009
  if (!IFrameSplitOperator.IsNumber(item.DataIndex) && !IFrameSplitOperator.IsNumber(item.BlockIndex)) continue;
129010
+ colItem.FormatType=0; //0=默认格式 1=长度不够使用...
128846
129011
  if (IFrameSplitOperator.IsNumber(item.DataIndex)) colItem.DataIndex=item.DataIndex; //数据在扩展数据索引列
128847
129012
  if (IFrameSplitOperator.IsNumber(item.BlockIndex)) colItem.BlockIndex=item.BlockIndex;
129013
+ if (IFrameSplitOperator.IsNumber(item.FormatType)) colItem.FormatType=item.FormatType; //输出样式
128848
129014
  }
128849
129015
  else if (item.Type==REPORT_COLUMN_ID.CUSTOM_NUMBER_TEXT_ID)
128850
129016
  {
@@ -129542,7 +129708,7 @@ function ChartReport()
129542
129708
  var x=left+this.ItemMergin.Left;
129543
129709
  var textWidth=column.Width-this.ItemMergin.Left-this.ItemMergin.Right;
129544
129710
  var stock=data.Stock;
129545
- var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign };
129711
+ var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign, Tooltip:null };
129546
129712
  var rtItem={ Left:left, Top:top, Width:column.Width, Height:this.RowHeight };
129547
129713
  rtItem.Right=rtItem.Left+rtItem.Width;
129548
129714
  rtItem.Bottom=rtItem.Top+rtItem.Height;
@@ -129553,12 +129719,6 @@ function ChartReport()
129553
129719
  this.DrawItemBG({ Rect:rtItem, BGColor:column.FullColBGColor });
129554
129720
  }
129555
129721
 
129556
- //tooltip提示
129557
- if (column.EnableTooltip===true)
129558
- {
129559
- this.TooltipRect.push({ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType })
129560
- }
129561
-
129562
129722
  if (column.Type==REPORT_COLUMN_ID.INDEX_ID)
129563
129723
  {
129564
129724
  if (rowType==1) return; //固定行序号空
@@ -129800,10 +129960,84 @@ function ChartReport()
129800
129960
  }
129801
129961
 
129802
129962
  this.DrawItemBG(drawInfo);
129803
- this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
129963
+
129964
+ if (column.Type==REPORT_COLUMN_ID.CUSTOM_STRING_TEXT_ID)
129965
+ this.DrawCustomText(drawInfo,column, x, top, textWidth);
129966
+ else
129967
+ this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
129968
+ }
129969
+
129970
+ //tooltip提示
129971
+ if (drawInfo.Tooltip)
129972
+ {
129973
+ //Type:1=数据截断
129974
+ var tooltipData={ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:drawInfo.Tooltip.Data };
129975
+ this.TooltipRect.push(tooltipData);
129804
129976
  }
129805
129977
  }
129806
129978
 
129979
+ this.DrawCustomText=function(drawInfo, column, left, top, cellWidth)
129980
+ {
129981
+ if (!drawInfo.Text) return;
129982
+
129983
+ var text=drawInfo.Text;
129984
+ var x=left;
129985
+ if (drawInfo.TextAlign=='center')
129986
+ {
129987
+ x=left+cellWidth/2;
129988
+ this.Canvas.textAlign="center";
129989
+ }
129990
+ else if (drawInfo.TextAlign=='right')
129991
+ {
129992
+ x=left+cellWidth-2;
129993
+ this.Canvas.textAlign="right";
129994
+ }
129995
+ else
129996
+ {
129997
+ x+=2;
129998
+ this.Canvas.textAlign="left";
129999
+ }
130000
+
130001
+ var textWidth=this.Canvas.measureText(text).width+1;
130002
+ var bClip=false;
130003
+ if (textWidth>=cellWidth) //长度超过单元格 裁剪
130004
+ {
130005
+ if (column.FormatType==2)
130006
+ {
130007
+ var count=text.length+5;
130008
+ text="";
130009
+ for(var i=0;i<count;++i)
130010
+ text+="#";
130011
+ }
130012
+ else if (column.FormatType==1)
130013
+ {
130014
+ text=this.TextEllipsis(text, cellWidth, column.MaxText);
130015
+ }
130016
+
130017
+ this.Canvas.save();
130018
+ bClip=true;
130019
+
130020
+ var rtCell={ Left:left, Top:top+this.ItemMergin.Top, Width:cellWidth, Height:this.RowHeight };
130021
+ this.Canvas.beginPath();
130022
+ this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
130023
+ //this.Canvas.stroke(); //调试用
130024
+ this.Canvas.clip();
130025
+
130026
+ //数据截断提示信息
130027
+ drawInfo.Tooltip=
130028
+ {
130029
+ Type:1,
130030
+ Data:{ AryText:[ {Text:drawInfo.Text} ] }
130031
+ }
130032
+ }
130033
+
130034
+ this.Canvas.textBaseline="middle";
130035
+ this.Canvas.fillStyle=drawInfo.TextColor;
130036
+ this.Canvas.fillText(text,x,top+this.ItemMergin.Top+this.RowHeight/2);
130037
+
130038
+ if (bClip) this.Canvas.restore();
130039
+ }
130040
+
129807
130041
  this.DrawSymbolName=function(data, column, left, top, rowType)
129808
130042
  {
129809
130043
  var stock=data.Stock;
@@ -131072,8 +131306,7 @@ function ChartReport()
131072
131306
 
131073
131307
  }
131074
131308
 
131075
- //坐标所在单元格
131076
- this.PtInCell=function(x,y)
131309
+ this.GetTooltipData=function(x,y)
131077
131310
  {
131078
131311
  if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return null;
131079
131312
 
@@ -131085,9 +131318,11 @@ function ChartReport()
131085
131318
 
131086
131319
  if (x>=rt.Left && x<=rt.Right && y>=rt.Top && y<=rt.Bottom)
131087
131320
  {
131088
- return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index };
131321
+ return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index, Type:item.Type, Data:item.Data };
131089
131322
  }
131090
131323
  }
131324
+
131325
+ return null;
131091
131326
  }
131092
131327
 
131093
131328
  this.PtInHeaderDragBorder=function(x, y)
@@ -131679,6 +131914,169 @@ function ChartVScrollbar()
131679
131914
  return pos;
131680
131915
  }
131681
131916
  }
131917
+
131918
+
131919
+ function ChartCellTooltip()
131920
+ {
131921
+ this.Canvas; //画布
131922
+ this.ChartBorder; //边框信息
131923
+ this.ChartFrame; //框架画法
131924
+ this.Name; //名称
131925
+ this.ClassName='ChartCellTooltip'; //类名
131926
+
131927
+ this.BGColor="rgba(255,255,225, 0.9)";
131928
+ this.BorderColor="rgb(0,0,0)";
131929
+ this.Margin={ Left:5, Right:5, Top:4, Bottom:5 };
131930
+ this.Font=`${13*GetDevicePixelRatio()}px 微软雅黑`;
131931
+ this.TextColor="rgb(0,0,0)";
131932
+ this.YOffset=20;
131933
+ this.XOffset=5;
131934
+
131935
+ this.Point; //{ X, Y}
131936
+ this.Data; //{ AryText:[ { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }} ]}
131937
+
131938
+
131939
+ this.Draw=function()
131940
+ {
131941
+ if (!this.Canvas) return;
131942
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.AryText)) return;
131943
+ if (!this.Point) return;
131944
+
131945
+ var size={ Width:0, Height:0, Text:[] };
131946
+ this.CalculateTextSize(this.Data.AryText, size);
131947
+ if (!IFrameSplitOperator.IsNonEmptyArray(size.Text)) return;
131948
+
131949
+ this.DrawTooltip(this.Data.AryText, size);
131950
+ }
131951
+
131952
+ this.CalculateTextSize=function(aryText, size)
131953
+ {
131954
+ var width=0, height=0;
131955
+ for(var i=0;i<aryText.length;++i)
131956
+ {
131957
+ var item=aryText[i];
131958
+ var titleHeight=0, titleWidth=0;
131959
+ if (!item.Title && !item.Text) continue;
131960
+
131961
+ if (item.Title)
131962
+ {
131963
+ if (item.TitleFont) this.Canvas.font=item.TitleFont;
131964
+ else this.Canvas.font=this.Font;
131965
+
131966
+ titleWidth=this.Canvas.measureText(item.Title).width;
131967
+ titleHeight=this.Canvas.measureText("擎").width;
131968
+ }
131969
+
131970
+ var textWidth=0, textHeight=0;
131971
+ if (item.Text)
131972
+ {
131973
+ if (item.Font) this.Canvas.font=item.Font;
131974
+ else this.Canvas.font=this.Font;
131975
+
131976
+ textWidth=this.Canvas.measureText(item.Text).width;
131977
+ textHeight=this.Canvas.measureText("擎").width;
131978
+ }
131979
+
131980
+ var itemWidth=titleWidth+textWidth;
131981
+ var itemHeight=Math.max(textHeight,titleHeight);
131982
+
131983
+ if (IFrameSplitOperator.IsNumber(item.Space)) itemWidth+=item.Space;
131984
+
131985
+ if (item.Margin)
131986
+ {
131987
+ var margin=item.Margin;
131988
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
131989
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
131990
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
131991
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
131992
+ }
131993
+
131994
+ if (width<itemWidth) width=itemWidth;
131995
+ height+=itemHeight;
131996
+
131997
+ size.Text[i]={ Width: itemWidth, Height:itemHeight, TitleWidth:titleWidth, TextWidth:textWidth };
131998
+ }
131999
+
132000
+ if (this.Margin)
132001
+ {
132002
+ var margin=this.Margin;
132003
+ if (IFrameSplitOperator.IsNumber(margin.Left)) width+=margin.Left;
132004
+ if (IFrameSplitOperator.IsNumber(margin.Right)) width+=margin.Right;
132005
+ if (IFrameSplitOperator.IsNumber(margin.Top)) height+=margin.Top;
132006
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) height+=margin.Bottom;
132007
+ }
132008
+
132009
+ size.Width=width;
132010
+ size.Height=height;
132011
+ }
132012
+
132013
+ this.DrawTooltip=function(aryText, size)
132014
+ {
132015
+ var rtBG={ Left:this.Point.X+this.XOffset, Top:this.Point.Y+this.YOffset, Width:size.Width, Height:size.Height };
132016
+ rtBG.Right=rtBG.Left+rtBG.Width;
132017
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
132018
+
132019
+ var border=this.ChartBorder.GetBorder();
132020
+ if (rtBG.Bottom>border.ChartHeight)
132021
+ {
132022
+ rtBG.Bottom=this.Point.Y;
132023
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
132024
+ }
132025
+
132026
+ if (rtBG.Right>border.ChartWidth)
132027
+ {
132028
+ rtBG.Right=this.Point.X;
132029
+ rtBG.Left=rtBG.Right-rtBG.Width;
132030
+ }
132031
+
132032
+ if (this.BGColor)
132033
+ {
132034
+ this.Canvas.fillStyle=this.BGColor;
132035
+ this.Canvas.fillRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
132036
+ }
132037
+
132038
+ if (this.BorderColor)
132039
+ {
132040
+ this.Canvas.strokeStyle=this.BorderColor;
132041
+ this.Canvas.strokeRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
132042
+ }
132043
+
132044
+ var left=rtBG.Left;
132045
+ var top=rtBG.Top;
132046
+ if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Left)) left+=this.Margin.Left;
132047
+ if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Top)) top+=this.Margin.Top;
132048
+
132049
+ var xText, yText=top;
132050
+ for(var i=0;i<aryText.length;++i)
132051
+ {
132052
+ var item=aryText[i];
132053
+ if (!item.Title && !item.Text) continue;
132054
+ var itemSize=size.Text[i];
132055
+
132056
+ xText=left;
132057
+ yText+=itemSize.Height;
132058
+
132059
+ if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Left)) xText+=item.Margin.Left;
132060
+ if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Bottom)) yText-=item.Margin.Bottom;
132061
+ if (item.Title)
132062
+ {
132063
+ if (item.TitleColor) this.Canvas.fillStyle=item.TitleColor;
132064
+ else this.Canvas.fillStyle=this.TextColor;
132065
+ this.Canvas.fillText(item.Title,xText,yText,itemSize.TitleWidth);
132066
+ xText+=itemSize.titleWidth;
132067
+ if (IFrameSplitOperator.IsNumber(item.Space)) xText+=item.Space;
132068
+ }
132069
+
132070
+ if (item.Text)
132071
+ {
132072
+ if (item.Color) this.Canvas.fillStyle=item.Color;
132073
+ else this.Canvas.fillStyle=this.TextColor;
132074
+ this.Canvas.fillText(item.Text,xText,yText,itemSize.TextWidth);
132075
+ }
132076
+
132077
+ }
132078
+ }
132079
+ }
131682
132080
  /*
131683
132081
  Copyright (c) 2018 jones
131684
132082
 
@@ -138654,7 +139052,7 @@ function HQChartScriptWorker()
138654
139052
 
138655
139053
 
138656
139054
 
138657
- var HQCHART_VERSION="1.1.13519";
139055
+ var HQCHART_VERSION="1.1.13530";
138658
139056
 
138659
139057
  function PrintHQChartVersion()
138660
139058
  {