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.
@@ -3952,6 +3952,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
3952
3952
  this.DivElement=divElement;
3953
3953
  this.DivToolElement=null; //工具条
3954
3954
  this.JSChartContainer; //画图控件
3955
+ this.ResizeListener;
3955
3956
 
3956
3957
  //h5 canvas
3957
3958
  this.CanvasElement=document.createElement("canvas");
@@ -5629,6 +5630,8 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5629
5630
  this.JSChartContainer=chart;
5630
5631
  chart.DivElement=this.DivElement;
5631
5632
 
5633
+ if (option.EnableResize==true) this.CreateResizeListener();
5634
+
5632
5635
  if (option.DefaultCursor) chart.DefaultCursor=option.DefaultCursor;
5633
5636
  if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
5634
5637
 
@@ -5671,6 +5674,19 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5671
5674
  }
5672
5675
  }
5673
5676
 
5677
+ this.CreateResizeListener=function()
5678
+ {
5679
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
5680
+ this.ResizeListener.observe(this.DivElement);
5681
+ }
5682
+
5683
+ this.OnDivResize=function(entries)
5684
+ {
5685
+ JSConsole.Chart.Log("[JSChart::OnDivResize] entries=", entries);
5686
+
5687
+ this.OnSize( {Type:1} );
5688
+ }
5689
+
5674
5690
  //创建工具条
5675
5691
  this.CreateToolbar=function(option)
5676
5692
  {
@@ -41906,6 +41922,7 @@ function ChartMultiText()
41906
41922
  {
41907
41923
  var border=this.ChartBorder.GetHScreenBorder();
41908
41924
  var chartright=border.BottomEx;
41925
+ var chartleft=border.TopEx;
41909
41926
  var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
41910
41927
  var left=this.ChartBorder.GetTop();
41911
41928
  var right=this.ChartBorder.GetBottom();
@@ -41917,6 +41934,7 @@ function ChartMultiText()
41917
41934
  var border=this.ChartBorder.GetBorder();
41918
41935
  var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
41919
41936
  var chartright=border.RightEx;
41937
+ var chartleft=border.LeftEx;
41920
41938
  var left=this.ChartBorder.GetLeft();
41921
41939
  var right=this.ChartBorder.GetRight();
41922
41940
  var top=border.TopEx;
@@ -41952,16 +41970,17 @@ function ChartMultiText()
41952
41970
 
41953
41971
  var textWidth=this.Canvas.measureText(item.Text).width;
41954
41972
  this.Canvas.textAlign='center';
41955
- if (x+textWidth/2>=right)
41973
+ if (x+textWidth/2>=chartright)
41956
41974
  {
41957
41975
  this.Canvas.textAlign='right';
41958
- x=right;
41976
+ x=chartright;
41959
41977
  }
41960
- else if (x-textWidth/2<left)
41978
+ else if (x-textWidth/2<chartleft)
41961
41979
  {
41962
41980
  this.Canvas.textAlign = 'left';
41963
- x=left;
41981
+ x=chartleft;
41964
41982
  }
41983
+
41965
41984
  if (item.Baseline==1) this.Canvas.textBaseline='top';
41966
41985
  else if (item.Baseline==2) this.Canvas.textBaseline='bottom';
41967
41986
  else this.Canvas.textBaseline = 'middle';
@@ -125146,18 +125165,76 @@ function JSReportChart(divElement)
125146
125165
  this.DivElement=divElement;
125147
125166
  this.JSChartContainer; //表格控件
125148
125167
 
125149
- //h5 canvas
125150
- this.CanvasElement=document.createElement("canvas");
125151
- this.CanvasElement.className='jsreportlist-drawing';
125152
- this.CanvasElement.id=Guid();
125153
- this.CanvasElement.setAttribute("tabindex",0);
125154
- if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
125155
- if(divElement.hasChildNodes())
125156
- {
125157
- JSConsole.Chart.Log("[JSReportChart::JSReportChart] divElement hasChildNodes", divElement.childNodes);
125158
- }
125159
- divElement.appendChild(this.CanvasElement);
125168
+ //h5 canvas
125169
+ this.CanvasElement=document.createElement("canvas");
125170
+ this.CanvasElement.className='jsreportlist-drawing';
125171
+ this.CanvasElement.id=Guid();
125172
+ this.CanvasElement.setAttribute("tabindex",0);
125173
+ if (this.CanvasElement.style) this.CanvasElement.style.outline='none';
125174
+ if(divElement.hasChildNodes())
125175
+ {
125176
+ JSConsole.Chart.Log("[JSReportChart::JSReportChart] divElement hasChildNodes", divElement.childNodes);
125177
+ }
125178
+ divElement.appendChild(this.CanvasElement);
125179
+
125180
+ //额外的画布
125181
+ this.MapExtraCanvasElement=new Map(); //key=画布名字, value={ Element:, Canvas:}
125182
+
125183
+ this.CreateExtraCanvasElement=function(name, option)
125184
+ {
125185
+ if (this.MapExtraCanvasElement.has(name)) return this.MapExtraCanvasElement.get(name);
125186
+
125187
+ var element=document.createElement("canvas");
125188
+ element.className='jsreportlist-drawing-extra';
125189
+ element.id=Guid();
125190
+ if (name==JSReportChart.CorssCursorCanvasKey)
125191
+ element.setAttribute("tabindex",5);
125192
+ else
125193
+ element.setAttribute("tabindex",1);
125194
+
125195
+ if (element.style)
125196
+ {
125197
+ element.style.outline='none';
125198
+ element.style.position="absolute";
125199
+ element.style.left='0px';
125200
+ element.style.top='0px';
125201
+ element.style["pointer-events"]="none";
125202
+ }
125203
+
125204
+ if (option)
125205
+ {
125206
+ if (IFrameSplitOperator.IsNumber(option.TabIndex)) element.setAttribute("tabindex",option.TabIndex);
125207
+ if (IFrameSplitOperator.IsNumber(option.ZIndex)) element.style["z-index"]=option.ZIndex;
125208
+ }
125209
+
125210
+ if (this.CanvasElement)
125211
+ {
125212
+ element.height=this.CanvasElement.height;
125213
+ element.width=this.CanvasElement.width;
125214
+ if (element.style)
125215
+ {
125216
+ element.style.width=this.CanvasElement.style.width;
125217
+ element.style.height=this.CanvasElement.style.height
125218
+ }
125219
+ }
125220
+
125221
+ divElement.appendChild(element);
125222
+
125223
+ var item={ Element:element, Canvas:null };
125224
+ this.MapExtraCanvasElement.set(name, item);
125225
+ }
125226
+
125227
+ this.GetExtraCanvas=function(name)
125228
+ {
125229
+ if (!this.MapExtraCanvasElement.has(name)) return null;
125230
+
125231
+ var item=this.MapExtraCanvasElement.get(name);
125232
+ if (!item.Element) return null;
125160
125233
 
125234
+ if (!item.Canvas) item.Canvas=item.Element.getContext("2d");
125235
+
125236
+ return item;
125237
+ }
125161
125238
 
125162
125239
  this.OnSize=function()
125163
125240
  {
@@ -125172,6 +125249,19 @@ function JSReportChart(divElement)
125172
125249
  this.CanvasElement.height*=pixelTatio;
125173
125250
  this.CanvasElement.width*=pixelTatio;
125174
125251
 
125252
+ //扩展画布
125253
+ for(var mapItem of this.MapExtraCanvasElement)
125254
+ {
125255
+ var item=mapItem[1];
125256
+ var element=item.Element;
125257
+ if (!element) continue;
125258
+
125259
+ element.height=this.CanvasElement.height;
125260
+ element.width=this.CanvasElement.width;
125261
+ element.style.width=this.CanvasElement.style.width;
125262
+ element.style.height=this.CanvasElement.style.height;
125263
+ }
125264
+
125175
125265
  JSConsole.Chart.Log(`[JSReportChart::OnSize] devicePixelRatio=${window.devicePixelRatio}, height=${this.CanvasElement.height}, width=${this.CanvasElement.width}`);
125176
125266
 
125177
125267
  if (this.JSChartContainer && this.JSChartContainer.OnSize)
@@ -125192,6 +125282,10 @@ function JSReportChart(divElement)
125192
125282
  this.DivElement.JSChart=this; //div中保存一份
125193
125283
 
125194
125284
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
125285
+ if (option.EnableTooltip)
125286
+ {
125287
+ this.CreateExtraCanvasElement(JSReportChart.TooltipCursorCanvasKey, { ZIndex:99 });
125288
+ }
125195
125289
 
125196
125290
  if (option.Symbol) chart.Symbol=option.Symbol;
125197
125291
  if (option.Name) chart.Name=option.Name;
@@ -125213,6 +125307,8 @@ function JSReportChart(divElement)
125213
125307
  this.CreateJSReportChartContainer=function(option)
125214
125308
  {
125215
125309
  var chart=new JSReportChartContainer(this.CanvasElement);
125310
+ chart.GetExtraCanvas=(name)=>{ return this.GetExtraCanvas(name); }
125311
+
125216
125312
  chart.Create(option);
125217
125313
 
125218
125314
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
@@ -125333,6 +125429,8 @@ function JSReportChart(divElement)
125333
125429
  }
125334
125430
  }
125335
125431
 
125432
+ JSReportChart.TooltipCursorCanvasKey="hq_report_tooltip"; //提示信息
125433
+
125336
125434
 
125337
125435
  JSReportChart.Init=function(divElement)
125338
125436
  {
@@ -125411,6 +125509,9 @@ function JSReportChartContainer(uielement)
125411
125509
  this.SplashTitle={ StockList:"下载码表中.....", MemberList:"下载成分中....." } ;
125412
125510
 
125413
125511
  this.Canvas=uielement.getContext("2d"); //画布
125512
+
125513
+ this.TooltipCanvas;
125514
+ this.ChartTooltip;
125414
125515
 
125415
125516
  this.Tooltip=document.createElement("div");
125416
125517
  this.Tooltip.className='jsreport-tooltip';
@@ -125482,6 +125583,8 @@ function JSReportChartContainer(uielement)
125482
125583
  this.JSPopMenu; //内置菜单
125483
125584
  this.IsShowRightMenu=true;
125484
125585
 
125586
+ this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null };
125587
+
125485
125588
  this.ChartDestory=function() //销毁
125486
125589
  {
125487
125590
  this.IsDestroy=true;
@@ -125551,6 +125654,15 @@ function JSReportChartContainer(uielement)
125551
125654
  }
125552
125655
 
125553
125656
 
125657
+ //清空画布
125658
+ this.ClearCanvas=function(canvas)
125659
+ {
125660
+ if (!canvas) return;
125661
+ if (!this.UIElement) return;
125662
+
125663
+ canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);
125664
+ }
125665
+
125554
125666
  //清空固定行数据
125555
125667
  this.ClearFixedRowData=function()
125556
125668
  {
@@ -125623,6 +125735,12 @@ function JSReportChartContainer(uielement)
125623
125735
 
125624
125736
  this.ChartPaint[0]=chart;
125625
125737
 
125738
+ //提示信息
125739
+ var chartTooltip=new ChartCellTooltip();
125740
+ chartTooltip.Frame=this.Frame;
125741
+ chartTooltip.ChartBorder=this.Frame.ChartBorder;
125742
+ this.ChartTooltip=chartTooltip;
125743
+
125626
125744
  //页脚
125627
125745
  if (option && option.PageInfo===true)
125628
125746
  {
@@ -125734,6 +125852,8 @@ function JSReportChartContainer(uielement)
125734
125852
  {
125735
125853
  this.DelayDraw(500);
125736
125854
  }
125855
+
125856
+ this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
125737
125857
  }
125738
125858
 
125739
125859
  this.DelayDraw=function(frequency)
@@ -126500,6 +126620,7 @@ function JSReportChartContainer(uielement)
126500
126620
  console.log(`[OnWheel] wheelValue=${wheelValue}`);
126501
126621
  if (wheelValue<0) //下
126502
126622
  {
126623
+ this.LastMouseStatus.TooltipStatus=null;
126503
126624
  if (this.GotoNextItem(1))
126504
126625
  {
126505
126626
  this.Draw();
@@ -126508,6 +126629,7 @@ function JSReportChartContainer(uielement)
126508
126629
  }
126509
126630
  else if (wheelValue>0) //上
126510
126631
  {
126632
+ this.LastMouseStatus.TooltipStatus=null;
126511
126633
  if (this.GotoNextItem(-1))
126512
126634
  {
126513
126635
  this.Draw();
@@ -126519,6 +126641,7 @@ function JSReportChartContainer(uielement)
126519
126641
  {
126520
126642
  if (wheelValue<0) //下一页
126521
126643
  {
126644
+ this.LastMouseStatus.TooltipStatus=null;
126522
126645
  if (this.GotoNextPage(this.PageUpDownCycle))
126523
126646
  {
126524
126647
  this.Draw();
@@ -126527,6 +126650,7 @@ function JSReportChartContainer(uielement)
126527
126650
  }
126528
126651
  else if (wheelValue>0) //上一页
126529
126652
  {
126653
+ this.LastMouseStatus.TooltipStatus=null;
126530
126654
  if (this.GotoPreviousPage(this.PageUpDownCycle))
126531
126655
  {
126532
126656
  this.Draw();
@@ -126748,7 +126872,13 @@ function JSReportChartContainer(uielement)
126748
126872
  var pixelTatio = GetDevicePixelRatio();
126749
126873
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
126750
126874
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
126875
+
126876
+ this.LastMouseStatus.OnMouseMove=null;
126751
126877
 
126878
+ var bDrawTooltip=false;
126879
+ if (this.LastMouseStatus.TooltipStatus) bDrawTooltip=true;
126880
+ this.LastMouseStatus.TooltipStatus=null;
126881
+
126752
126882
  if (this.DragRow) return;
126753
126883
  if (this.DrawHeader) return;
126754
126884
  if (this.DragColumnWidth) return;
@@ -126768,10 +126898,11 @@ function JSReportChartContainer(uielement)
126768
126898
  }
126769
126899
  }
126770
126900
 
126901
+ this.LastMouseStatus.OnMouseMove={ X:x, Y:y };
126771
126902
  var mouseStatus={ Cursor:"default", Name:"Default"};; //鼠标状态
126772
126903
  var report=this.GetReportChart();
126773
- var cell=null;
126774
126904
  var bDraw=false;
126905
+
126775
126906
  if (report)
126776
126907
  {
126777
126908
  var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);
@@ -126782,7 +126913,12 @@ function JSReportChartContainer(uielement)
126782
126913
  }
126783
126914
  else
126784
126915
  {
126785
- cell=report.PtInCell(x,y); //是否在单元格(EnableTooltip)
126916
+ var tooltipData=report.GetTooltipData(x,y); //单元格提示信息
126917
+ if (tooltipData)
126918
+ {
126919
+ this.LastMouseStatus.TooltipStatus={ X:x, Y:y, Data:tooltipData };
126920
+ bDrawTooltip=true;
126921
+ }
126786
126922
  }
126787
126923
 
126788
126924
  var scrollbar=report.VScrollbar;
@@ -126798,16 +126934,20 @@ function JSReportChartContainer(uielement)
126798
126934
  }
126799
126935
  }
126800
126936
 
126937
+
126938
+ /* 目前没有用到
126801
126939
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);
126802
126940
  if (event)
126803
126941
  {
126804
126942
  var sendData={X:x, Y:y, Cell:cell };
126805
126943
  event.Callback(event,sendData,this);
126806
126944
  }
126945
+ */
126807
126946
 
126808
126947
  if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
126809
126948
 
126810
126949
  if (bDraw) this.Draw();
126950
+ else if (bDrawTooltip) this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
126811
126951
  }
126812
126952
 
126813
126953
  this.UIOnMounseOut=function(e)
@@ -128376,6 +128516,28 @@ function JSReportChartContainer(uielement)
128376
128516
 
128377
128517
  return true;
128378
128518
  }
128519
+
128520
+ this.DrawTooltip=function(tooltipStatus)
128521
+ {
128522
+ if (!this.GetExtraCanvas) return;
128523
+ if (!this.TooltipCanvas)
128524
+ {
128525
+ var finder=this.GetExtraCanvas(JSReportChart.TooltipCursorCanvasKey);
128526
+ if (!finder) return;
128527
+ this.TooltipCanvas=finder.Canvas;
128528
+ }
128529
+
128530
+ if (!this.TooltipCanvas) return;
128531
+ this.ClearCanvas(this.TooltipCanvas);
128532
+ if (!this.ChartTooltip) return;
128533
+
128534
+ if (!tooltipStatus || !tooltipStatus.Data) return;
128535
+
128536
+ this.ChartTooltip.Canvas=this.TooltipCanvas;
128537
+ this.ChartTooltip.Point={ X:tooltipStatus.X, Y:tooltipStatus.Y };
128538
+ this.ChartTooltip.Data=tooltipStatus.Data.Data;
128539
+ this.ChartTooltip.Draw();
128540
+ }
128379
128541
  }
128380
128542
 
128381
128543
 
@@ -128686,6 +128848,9 @@ function ChartReport()
128686
128848
 
128687
128849
  this.RectClient={};
128688
128850
 
128851
+ //{ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:{ AryText:[ {Text:xx} ]} };
128852
+ //Type:1=数据截断
128853
+ // { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }}
128689
128854
  this.TooltipRect=[];
128690
128855
 
128691
128856
  this.ReloadResource=function(resource)
@@ -128784,7 +128949,6 @@ function ChartReport()
128784
128949
  if (item.FullColBGColor) colItem.FullColBGColor=item.FullColBGColor; //整列背景色
128785
128950
  if (item.HeaderBGColor) colItem.HeaderBGColor=item.HeaderBGColor; //表头背景色
128786
128951
  if (IFrameSplitOperator.IsNumber(item.Sort)) colItem.Sort=item.Sort;
128787
- if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
128788
128952
  if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
128789
128953
  if (IFrameSplitOperator.IsBool(item.EnableDragWidth)) colItem.EnableDragWidth=item.EnableDragWidth;
128790
128954
  if (IFrameSplitOperator.IsBool(item.IsDrawCallback)) colItem.IsDrawCallback=item.IsDrawCallback;
@@ -128799,8 +128963,10 @@ function ChartReport()
128799
128963
  if (item.Type==REPORT_COLUMN_ID.CUSTOM_STRING_TEXT_ID)
128800
128964
  {
128801
128965
  if (!IFrameSplitOperator.IsNumber(item.DataIndex) && !IFrameSplitOperator.IsNumber(item.BlockIndex)) continue;
128966
+ colItem.FormatType=0; //0=默认格式 1=长度不够使用...
128802
128967
  if (IFrameSplitOperator.IsNumber(item.DataIndex)) colItem.DataIndex=item.DataIndex; //数据在扩展数据索引列
128803
128968
  if (IFrameSplitOperator.IsNumber(item.BlockIndex)) colItem.BlockIndex=item.BlockIndex;
128969
+ if (IFrameSplitOperator.IsNumber(item.FormatType)) colItem.FormatType=item.FormatType; //输出样式
128804
128970
  }
128805
128971
  else if (item.Type==REPORT_COLUMN_ID.CUSTOM_NUMBER_TEXT_ID)
128806
128972
  {
@@ -129498,7 +129664,7 @@ function ChartReport()
129498
129664
  var x=left+this.ItemMergin.Left;
129499
129665
  var textWidth=column.Width-this.ItemMergin.Left-this.ItemMergin.Right;
129500
129666
  var stock=data.Stock;
129501
- var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign };
129667
+ var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign, Tooltip:null };
129502
129668
  var rtItem={ Left:left, Top:top, Width:column.Width, Height:this.RowHeight };
129503
129669
  rtItem.Right=rtItem.Left+rtItem.Width;
129504
129670
  rtItem.Bottom=rtItem.Top+rtItem.Height;
@@ -129509,12 +129675,6 @@ function ChartReport()
129509
129675
  this.DrawItemBG({ Rect:rtItem, BGColor:column.FullColBGColor });
129510
129676
  }
129511
129677
 
129512
- //tooltip提示
129513
- if (column.EnableTooltip===true)
129514
- {
129515
- this.TooltipRect.push({ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType })
129516
- }
129517
-
129518
129678
  if (column.Type==REPORT_COLUMN_ID.INDEX_ID)
129519
129679
  {
129520
129680
  if (rowType==1) return; //固定行序号空
@@ -129756,10 +129916,84 @@ function ChartReport()
129756
129916
  }
129757
129917
 
129758
129918
  this.DrawItemBG(drawInfo);
129759
- this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
129919
+
129920
+ if (column.Type==REPORT_COLUMN_ID.CUSTOM_STRING_TEXT_ID)
129921
+ this.DrawCustomText(drawInfo,column, x, top, textWidth);
129922
+ else
129923
+ this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
129924
+ }
129925
+
129926
+ //tooltip提示
129927
+ if (drawInfo.Tooltip)
129928
+ {
129929
+ //Type:1=数据截断
129930
+ var tooltipData={ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType, Type:drawInfo.Tooltip.Type, Data:drawInfo.Tooltip.Data };
129931
+ this.TooltipRect.push(tooltipData);
129760
129932
  }
129761
129933
  }
129762
129934
 
129935
+ this.DrawCustomText=function(drawInfo, column, left, top, cellWidth)
129936
+ {
129937
+ if (!drawInfo.Text) return;
129938
+
129939
+ var text=drawInfo.Text;
129940
+ var x=left;
129941
+ if (drawInfo.TextAlign=='center')
129942
+ {
129943
+ x=left+cellWidth/2;
129944
+ this.Canvas.textAlign="center";
129945
+ }
129946
+ else if (drawInfo.TextAlign=='right')
129947
+ {
129948
+ x=left+cellWidth-2;
129949
+ this.Canvas.textAlign="right";
129950
+ }
129951
+ else
129952
+ {
129953
+ x+=2;
129954
+ this.Canvas.textAlign="left";
129955
+ }
129956
+
129957
+ var textWidth=this.Canvas.measureText(text).width+1;
129958
+ var bClip=false;
129959
+ if (textWidth>=cellWidth) //长度超过单元格 裁剪
129960
+ {
129961
+ if (column.FormatType==2)
129962
+ {
129963
+ var count=text.length+5;
129964
+ text="";
129965
+ for(var i=0;i<count;++i)
129966
+ text+="#";
129967
+ }
129968
+ else if (column.FormatType==1)
129969
+ {
129970
+ text=this.TextEllipsis(text, cellWidth, column.MaxText);
129971
+ }
129972
+
129973
+ this.Canvas.save();
129974
+ bClip=true;
129975
+
129976
+ var rtCell={ Left:left, Top:top+this.ItemMergin.Top, Width:cellWidth, Height:this.RowHeight };
129977
+ this.Canvas.beginPath();
129978
+ this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
129979
+ //this.Canvas.stroke(); //调试用
129980
+ this.Canvas.clip();
129981
+
129982
+ //数据截断提示信息
129983
+ drawInfo.Tooltip=
129984
+ {
129985
+ Type:1,
129986
+ Data:{ AryText:[ {Text:drawInfo.Text} ] }
129987
+ }
129988
+ }
129989
+
129990
+ this.Canvas.textBaseline="middle";
129991
+ this.Canvas.fillStyle=drawInfo.TextColor;
129992
+ this.Canvas.fillText(text,x,top+this.ItemMergin.Top+this.RowHeight/2);
129993
+
129994
+ if (bClip) this.Canvas.restore();
129995
+ }
129996
+
129763
129997
  this.DrawSymbolName=function(data, column, left, top, rowType)
129764
129998
  {
129765
129999
  var stock=data.Stock;
@@ -131028,8 +131262,7 @@ function ChartReport()
131028
131262
 
131029
131263
  }
131030
131264
 
131031
- //坐标所在单元格
131032
- this.PtInCell=function(x,y)
131265
+ this.GetTooltipData=function(x,y)
131033
131266
  {
131034
131267
  if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return null;
131035
131268
 
@@ -131041,9 +131274,11 @@ function ChartReport()
131041
131274
 
131042
131275
  if (x>=rt.Left && x<=rt.Right && y>=rt.Top && y<=rt.Bottom)
131043
131276
  {
131044
- return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index };
131277
+ return { Rect:item.Rect, Stock:item.Stock, Column:item.Column, Index:item.Index, Type:item.Type, Data:item.Data };
131045
131278
  }
131046
131279
  }
131280
+
131281
+ return null;
131047
131282
  }
131048
131283
 
131049
131284
  this.PtInHeaderDragBorder=function(x, y)
@@ -131635,6 +131870,169 @@ function ChartVScrollbar()
131635
131870
  return pos;
131636
131871
  }
131637
131872
  }
131873
+
131874
+
131875
+ function ChartCellTooltip()
131876
+ {
131877
+ this.Canvas; //画布
131878
+ this.ChartBorder; //边框信息
131879
+ this.ChartFrame; //框架画法
131880
+ this.Name; //名称
131881
+ this.ClassName='ChartCellTooltip'; //类名
131882
+
131883
+ this.BGColor="rgba(255,255,225, 0.9)";
131884
+ this.BorderColor="rgb(0,0,0)";
131885
+ this.Margin={ Left:5, Right:5, Top:4, Bottom:5 };
131886
+ this.Font=`${13*GetDevicePixelRatio()}px 微软雅黑`;
131887
+ this.TextColor="rgb(0,0,0)";
131888
+ this.YOffset=20;
131889
+ this.XOffset=5;
131890
+
131891
+ this.Point; //{ X, Y}
131892
+ this.Data; //{ AryText:[ { Text, Color, Title:, TitleColor, Space, Margin:{ Left, Top, Right, Bottom }} ]}
131893
+
131894
+
131895
+ this.Draw=function()
131896
+ {
131897
+ if (!this.Canvas) return;
131898
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.AryText)) return;
131899
+ if (!this.Point) return;
131900
+
131901
+ var size={ Width:0, Height:0, Text:[] };
131902
+ this.CalculateTextSize(this.Data.AryText, size);
131903
+ if (!IFrameSplitOperator.IsNonEmptyArray(size.Text)) return;
131904
+
131905
+ this.DrawTooltip(this.Data.AryText, size);
131906
+ }
131907
+
131908
+ this.CalculateTextSize=function(aryText, size)
131909
+ {
131910
+ var width=0, height=0;
131911
+ for(var i=0;i<aryText.length;++i)
131912
+ {
131913
+ var item=aryText[i];
131914
+ var titleHeight=0, titleWidth=0;
131915
+ if (!item.Title && !item.Text) continue;
131916
+
131917
+ if (item.Title)
131918
+ {
131919
+ if (item.TitleFont) this.Canvas.font=item.TitleFont;
131920
+ else this.Canvas.font=this.Font;
131921
+
131922
+ titleWidth=this.Canvas.measureText(item.Title).width;
131923
+ titleHeight=this.Canvas.measureText("擎").width;
131924
+ }
131925
+
131926
+ var textWidth=0, textHeight=0;
131927
+ if (item.Text)
131928
+ {
131929
+ if (item.Font) this.Canvas.font=item.Font;
131930
+ else this.Canvas.font=this.Font;
131931
+
131932
+ textWidth=this.Canvas.measureText(item.Text).width;
131933
+ textHeight=this.Canvas.measureText("擎").width;
131934
+ }
131935
+
131936
+ var itemWidth=titleWidth+textWidth;
131937
+ var itemHeight=Math.max(textHeight,titleHeight);
131938
+
131939
+ if (IFrameSplitOperator.IsNumber(item.Space)) itemWidth+=item.Space;
131940
+
131941
+ if (item.Margin)
131942
+ {
131943
+ var margin=item.Margin;
131944
+ if (IFrameSplitOperator.IsNumber(margin.Left)) itemWidth+=margin.Left;
131945
+ if (IFrameSplitOperator.IsNumber(margin.Right)) itemWidth+=margin.Right;
131946
+ if (IFrameSplitOperator.IsNumber(margin.Top)) itemHeight+=margin.Top;
131947
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) itemHeight+=margin.Bottom;
131948
+ }
131949
+
131950
+ if (width<itemWidth) width=itemWidth;
131951
+ height+=itemHeight;
131952
+
131953
+ size.Text[i]={ Width: itemWidth, Height:itemHeight, TitleWidth:titleWidth, TextWidth:textWidth };
131954
+ }
131955
+
131956
+ if (this.Margin)
131957
+ {
131958
+ var margin=this.Margin;
131959
+ if (IFrameSplitOperator.IsNumber(margin.Left)) width+=margin.Left;
131960
+ if (IFrameSplitOperator.IsNumber(margin.Right)) width+=margin.Right;
131961
+ if (IFrameSplitOperator.IsNumber(margin.Top)) height+=margin.Top;
131962
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) height+=margin.Bottom;
131963
+ }
131964
+
131965
+ size.Width=width;
131966
+ size.Height=height;
131967
+ }
131968
+
131969
+ this.DrawTooltip=function(aryText, size)
131970
+ {
131971
+ var rtBG={ Left:this.Point.X+this.XOffset, Top:this.Point.Y+this.YOffset, Width:size.Width, Height:size.Height };
131972
+ rtBG.Right=rtBG.Left+rtBG.Width;
131973
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
131974
+
131975
+ var border=this.ChartBorder.GetBorder();
131976
+ if (rtBG.Bottom>border.ChartHeight)
131977
+ {
131978
+ rtBG.Bottom=this.Point.Y;
131979
+ rtBG.Top=rtBG.Bottom-rtBG.Height;
131980
+ }
131981
+
131982
+ if (rtBG.Right>border.ChartWidth)
131983
+ {
131984
+ rtBG.Right=this.Point.X;
131985
+ rtBG.Left=rtBG.Right-rtBG.Width;
131986
+ }
131987
+
131988
+ if (this.BGColor)
131989
+ {
131990
+ this.Canvas.fillStyle=this.BGColor;
131991
+ this.Canvas.fillRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
131992
+ }
131993
+
131994
+ if (this.BorderColor)
131995
+ {
131996
+ this.Canvas.strokeStyle=this.BorderColor;
131997
+ this.Canvas.strokeRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
131998
+ }
131999
+
132000
+ var left=rtBG.Left;
132001
+ var top=rtBG.Top;
132002
+ if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Left)) left+=this.Margin.Left;
132003
+ if (this.Margin && IFrameSplitOperator.IsNumber(this.Margin.Top)) top+=this.Margin.Top;
132004
+
132005
+ var xText, yText=top;
132006
+ for(var i=0;i<aryText.length;++i)
132007
+ {
132008
+ var item=aryText[i];
132009
+ if (!item.Title && !item.Text) continue;
132010
+ var itemSize=size.Text[i];
132011
+
132012
+ xText=left;
132013
+ yText+=itemSize.Height;
132014
+
132015
+ if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Left)) xText+=item.Margin.Left;
132016
+ if (item.Margin && IFrameSplitOperator.IsNumber(item.Margin.Bottom)) yText-=item.Margin.Bottom;
132017
+ if (item.Title)
132018
+ {
132019
+ if (item.TitleColor) this.Canvas.fillStyle=item.TitleColor;
132020
+ else this.Canvas.fillStyle=this.TextColor;
132021
+ this.Canvas.fillText(item.Title,xText,yText,itemSize.TitleWidth);
132022
+ xText+=itemSize.titleWidth;
132023
+ if (IFrameSplitOperator.IsNumber(item.Space)) xText+=item.Space;
132024
+ }
132025
+
132026
+ if (item.Text)
132027
+ {
132028
+ if (item.Color) this.Canvas.fillStyle=item.Color;
132029
+ else this.Canvas.fillStyle=this.TextColor;
132030
+ this.Canvas.fillText(item.Text,xText,yText,itemSize.TextWidth);
132031
+ }
132032
+
132033
+ }
132034
+ }
132035
+ }
131638
132036
  /*
131639
132037
  Copyright (c) 2018 jones
131640
132038
 
@@ -134713,7 +135111,7 @@ function ScrollBarBGChart()
134713
135111
 
134714
135112
 
134715
135113
 
134716
- var HQCHART_VERSION="1.1.13519";
135114
+ var HQCHART_VERSION="1.1.13530";
134717
135115
 
134718
135116
  function PrintHQChartVersion()
134719
135117
  {