hqchart 1.1.13526 → 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.
@@ -125187,7 +125187,7 @@ function JSReportChart(divElement)
125187
125187
  var element=document.createElement("canvas");
125188
125188
  element.className='jsreportlist-drawing-extra';
125189
125189
  element.id=Guid();
125190
- if (name==JSChart.CorssCursorCanvasKey)
125190
+ if (name==JSReportChart.CorssCursorCanvasKey)
125191
125191
  element.setAttribute("tabindex",5);
125192
125192
  else
125193
125193
  element.setAttribute("tabindex",1);
@@ -125282,6 +125282,10 @@ function JSReportChart(divElement)
125282
125282
  this.DivElement.JSChart=this; //div中保存一份
125283
125283
 
125284
125284
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
125285
+ if (option.EnableTooltip)
125286
+ {
125287
+ this.CreateExtraCanvasElement(JSReportChart.TooltipCursorCanvasKey, { ZIndex:99 });
125288
+ }
125285
125289
 
125286
125290
  if (option.Symbol) chart.Symbol=option.Symbol;
125287
125291
  if (option.Name) chart.Name=option.Name;
@@ -125303,6 +125307,8 @@ function JSReportChart(divElement)
125303
125307
  this.CreateJSReportChartContainer=function(option)
125304
125308
  {
125305
125309
  var chart=new JSReportChartContainer(this.CanvasElement);
125310
+ chart.GetExtraCanvas=(name)=>{ return this.GetExtraCanvas(name); }
125311
+
125306
125312
  chart.Create(option);
125307
125313
 
125308
125314
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
@@ -125503,6 +125509,9 @@ function JSReportChartContainer(uielement)
125503
125509
  this.SplashTitle={ StockList:"下载码表中.....", MemberList:"下载成分中....." } ;
125504
125510
 
125505
125511
  this.Canvas=uielement.getContext("2d"); //画布
125512
+
125513
+ this.TooltipCanvas;
125514
+ this.ChartTooltip;
125506
125515
 
125507
125516
  this.Tooltip=document.createElement("div");
125508
125517
  this.Tooltip.className='jsreport-tooltip';
@@ -125574,6 +125583,8 @@ function JSReportChartContainer(uielement)
125574
125583
  this.JSPopMenu; //内置菜单
125575
125584
  this.IsShowRightMenu=true;
125576
125585
 
125586
+ this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null };
125587
+
125577
125588
  this.ChartDestory=function() //销毁
125578
125589
  {
125579
125590
  this.IsDestroy=true;
@@ -125724,6 +125735,12 @@ function JSReportChartContainer(uielement)
125724
125735
 
125725
125736
  this.ChartPaint[0]=chart;
125726
125737
 
125738
+ //提示信息
125739
+ var chartTooltip=new ChartCellTooltip();
125740
+ chartTooltip.Frame=this.Frame;
125741
+ chartTooltip.ChartBorder=this.Frame.ChartBorder;
125742
+ this.ChartTooltip=chartTooltip;
125743
+
125727
125744
  //页脚
125728
125745
  if (option && option.PageInfo===true)
125729
125746
  {
@@ -125835,6 +125852,8 @@ function JSReportChartContainer(uielement)
125835
125852
  {
125836
125853
  this.DelayDraw(500);
125837
125854
  }
125855
+
125856
+ this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
125838
125857
  }
125839
125858
 
125840
125859
  this.DelayDraw=function(frequency)
@@ -126601,6 +126620,7 @@ function JSReportChartContainer(uielement)
126601
126620
  console.log(`[OnWheel] wheelValue=${wheelValue}`);
126602
126621
  if (wheelValue<0) //下
126603
126622
  {
126623
+ this.LastMouseStatus.TooltipStatus=null;
126604
126624
  if (this.GotoNextItem(1))
126605
126625
  {
126606
126626
  this.Draw();
@@ -126609,6 +126629,7 @@ function JSReportChartContainer(uielement)
126609
126629
  }
126610
126630
  else if (wheelValue>0) //上
126611
126631
  {
126632
+ this.LastMouseStatus.TooltipStatus=null;
126612
126633
  if (this.GotoNextItem(-1))
126613
126634
  {
126614
126635
  this.Draw();
@@ -126620,6 +126641,7 @@ function JSReportChartContainer(uielement)
126620
126641
  {
126621
126642
  if (wheelValue<0) //下一页
126622
126643
  {
126644
+ this.LastMouseStatus.TooltipStatus=null;
126623
126645
  if (this.GotoNextPage(this.PageUpDownCycle))
126624
126646
  {
126625
126647
  this.Draw();
@@ -126628,6 +126650,7 @@ function JSReportChartContainer(uielement)
126628
126650
  }
126629
126651
  else if (wheelValue>0) //上一页
126630
126652
  {
126653
+ this.LastMouseStatus.TooltipStatus=null;
126631
126654
  if (this.GotoPreviousPage(this.PageUpDownCycle))
126632
126655
  {
126633
126656
  this.Draw();
@@ -126849,7 +126872,13 @@ function JSReportChartContainer(uielement)
126849
126872
  var pixelTatio = GetDevicePixelRatio();
126850
126873
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
126851
126874
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
126875
+
126876
+ this.LastMouseStatus.OnMouseMove=null;
126852
126877
 
126878
+ var bDrawTooltip=false;
126879
+ if (this.LastMouseStatus.TooltipStatus) bDrawTooltip=true;
126880
+ this.LastMouseStatus.TooltipStatus=null;
126881
+
126853
126882
  if (this.DragRow) return;
126854
126883
  if (this.DrawHeader) return;
126855
126884
  if (this.DragColumnWidth) return;
@@ -126869,10 +126898,11 @@ function JSReportChartContainer(uielement)
126869
126898
  }
126870
126899
  }
126871
126900
 
126901
+ this.LastMouseStatus.OnMouseMove={ X:x, Y:y };
126872
126902
  var mouseStatus={ Cursor:"default", Name:"Default"};; //鼠标状态
126873
126903
  var report=this.GetReportChart();
126874
- var cell=null;
126875
126904
  var bDraw=false;
126905
+
126876
126906
  if (report)
126877
126907
  {
126878
126908
  var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);
@@ -126883,7 +126913,12 @@ function JSReportChartContainer(uielement)
126883
126913
  }
126884
126914
  else
126885
126915
  {
126886
- 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
+ }
126887
126922
  }
126888
126923
 
126889
126924
  var scrollbar=report.VScrollbar;
@@ -126899,16 +126934,20 @@ function JSReportChartContainer(uielement)
126899
126934
  }
126900
126935
  }
126901
126936
 
126937
+
126938
+ /* 目前没有用到
126902
126939
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);
126903
126940
  if (event)
126904
126941
  {
126905
126942
  var sendData={X:x, Y:y, Cell:cell };
126906
126943
  event.Callback(event,sendData,this);
126907
126944
  }
126945
+ */
126908
126946
 
126909
126947
  if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
126910
126948
 
126911
126949
  if (bDraw) this.Draw();
126950
+ else if (bDrawTooltip) this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
126912
126951
  }
126913
126952
 
126914
126953
  this.UIOnMounseOut=function(e)
@@ -128477,6 +128516,28 @@ function JSReportChartContainer(uielement)
128477
128516
 
128478
128517
  return true;
128479
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
+ }
128480
128541
  }
128481
128542
 
128482
128543
 
@@ -128787,6 +128848,9 @@ function ChartReport()
128787
128848
 
128788
128849
  this.RectClient={};
128789
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 }}
128790
128854
  this.TooltipRect=[];
128791
128855
 
128792
128856
  this.ReloadResource=function(resource)
@@ -128885,7 +128949,6 @@ function ChartReport()
128885
128949
  if (item.FullColBGColor) colItem.FullColBGColor=item.FullColBGColor; //整列背景色
128886
128950
  if (item.HeaderBGColor) colItem.HeaderBGColor=item.HeaderBGColor; //表头背景色
128887
128951
  if (IFrameSplitOperator.IsNumber(item.Sort)) colItem.Sort=item.Sort;
128888
- if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
128889
128952
  if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
128890
128953
  if (IFrameSplitOperator.IsBool(item.EnableDragWidth)) colItem.EnableDragWidth=item.EnableDragWidth;
128891
128954
  if (IFrameSplitOperator.IsBool(item.IsDrawCallback)) colItem.IsDrawCallback=item.IsDrawCallback;
@@ -129601,7 +129664,7 @@ function ChartReport()
129601
129664
  var x=left+this.ItemMergin.Left;
129602
129665
  var textWidth=column.Width-this.ItemMergin.Left-this.ItemMergin.Right;
129603
129666
  var stock=data.Stock;
129604
- var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign };
129667
+ var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign, Tooltip:null };
129605
129668
  var rtItem={ Left:left, Top:top, Width:column.Width, Height:this.RowHeight };
129606
129669
  rtItem.Right=rtItem.Left+rtItem.Width;
129607
129670
  rtItem.Bottom=rtItem.Top+rtItem.Height;
@@ -129612,12 +129675,6 @@ function ChartReport()
129612
129675
  this.DrawItemBG({ Rect:rtItem, BGColor:column.FullColBGColor });
129613
129676
  }
129614
129677
 
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
129678
  if (column.Type==REPORT_COLUMN_ID.INDEX_ID)
129622
129679
  {
129623
129680
  if (rowType==1) return; //固定行序号空
@@ -129865,6 +129922,14 @@ function ChartReport()
129865
129922
  else
129866
129923
  this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
129867
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);
129932
+ }
129868
129933
  }
129869
129934
 
129870
129935
  this.DrawCustomText=function(drawInfo, column, left, top, cellWidth)
@@ -129913,6 +129978,13 @@ function ChartReport()
129913
129978
  this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
129914
129979
  //this.Canvas.stroke(); //调试用
129915
129980
  this.Canvas.clip();
129981
+
129982
+ //数据截断提示信息
129983
+ drawInfo.Tooltip=
129984
+ {
129985
+ Type:1,
129986
+ Data:{ AryText:[ {Text:drawInfo.Text} ] }
129987
+ }
129916
129988
  }
129917
129989
 
129918
129990
  this.Canvas.textBaseline="middle";
@@ -131190,8 +131262,7 @@ function ChartReport()
131190
131262
 
131191
131263
  }
131192
131264
 
131193
- //坐标所在单元格
131194
- this.PtInCell=function(x,y)
131265
+ this.GetTooltipData=function(x,y)
131195
131266
  {
131196
131267
  if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return null;
131197
131268
 
@@ -131203,9 +131274,11 @@ function ChartReport()
131203
131274
 
131204
131275
  if (x>=rt.Left && x<=rt.Right && y>=rt.Top && y<=rt.Bottom)
131205
131276
  {
131206
- 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 };
131207
131278
  }
131208
131279
  }
131280
+
131281
+ return null;
131209
131282
  }
131210
131283
 
131211
131284
  this.PtInHeaderDragBorder=function(x, y)
@@ -131797,6 +131870,169 @@ function ChartVScrollbar()
131797
131870
  return pos;
131798
131871
  }
131799
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
+ }
131800
132036
  /*
131801
132037
  Copyright (c) 2018 jones
131802
132038
 
@@ -134875,7 +135111,7 @@ function ScrollBarBGChart()
134875
135111
 
134876
135112
 
134877
135113
 
134878
- var HQCHART_VERSION="1.1.13525";
135114
+ var HQCHART_VERSION="1.1.13530";
134879
135115
 
134880
135116
  function PrintHQChartVersion()
134881
135117
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13525";
8
+ var HQCHART_VERSION="1.1.13530";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {