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.
@@ -125231,7 +125231,7 @@ function JSReportChart(divElement)
125231
125231
  var element=document.createElement("canvas");
125232
125232
  element.className='jsreportlist-drawing-extra';
125233
125233
  element.id=Guid();
125234
- if (name==JSChart.CorssCursorCanvasKey)
125234
+ if (name==JSReportChart.CorssCursorCanvasKey)
125235
125235
  element.setAttribute("tabindex",5);
125236
125236
  else
125237
125237
  element.setAttribute("tabindex",1);
@@ -125326,6 +125326,10 @@ function JSReportChart(divElement)
125326
125326
  this.DivElement.JSChart=this; //div中保存一份
125327
125327
 
125328
125328
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
125329
+ if (option.EnableTooltip)
125330
+ {
125331
+ this.CreateExtraCanvasElement(JSReportChart.TooltipCursorCanvasKey, { ZIndex:99 });
125332
+ }
125329
125333
 
125330
125334
  if (option.Symbol) chart.Symbol=option.Symbol;
125331
125335
  if (option.Name) chart.Name=option.Name;
@@ -125347,6 +125351,8 @@ function JSReportChart(divElement)
125347
125351
  this.CreateJSReportChartContainer=function(option)
125348
125352
  {
125349
125353
  var chart=new JSReportChartContainer(this.CanvasElement);
125354
+ chart.GetExtraCanvas=(name)=>{ return this.GetExtraCanvas(name); }
125355
+
125350
125356
  chart.Create(option);
125351
125357
 
125352
125358
  if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
@@ -125547,6 +125553,9 @@ function JSReportChartContainer(uielement)
125547
125553
  this.SplashTitle={ StockList:"下载码表中.....", MemberList:"下载成分中....." } ;
125548
125554
 
125549
125555
  this.Canvas=uielement.getContext("2d"); //画布
125556
+
125557
+ this.TooltipCanvas;
125558
+ this.ChartTooltip;
125550
125559
 
125551
125560
  this.Tooltip=document.createElement("div");
125552
125561
  this.Tooltip.className='jsreport-tooltip';
@@ -125618,6 +125627,8 @@ function JSReportChartContainer(uielement)
125618
125627
  this.JSPopMenu; //内置菜单
125619
125628
  this.IsShowRightMenu=true;
125620
125629
 
125630
+ this.LastMouseStatus={ MoveStatus:null, TooltipStatus:null };
125631
+
125621
125632
  this.ChartDestory=function() //销毁
125622
125633
  {
125623
125634
  this.IsDestroy=true;
@@ -125768,6 +125779,12 @@ function JSReportChartContainer(uielement)
125768
125779
 
125769
125780
  this.ChartPaint[0]=chart;
125770
125781
 
125782
+ //提示信息
125783
+ var chartTooltip=new ChartCellTooltip();
125784
+ chartTooltip.Frame=this.Frame;
125785
+ chartTooltip.ChartBorder=this.Frame.ChartBorder;
125786
+ this.ChartTooltip=chartTooltip;
125787
+
125771
125788
  //页脚
125772
125789
  if (option && option.PageInfo===true)
125773
125790
  {
@@ -125879,6 +125896,8 @@ function JSReportChartContainer(uielement)
125879
125896
  {
125880
125897
  this.DelayDraw(500);
125881
125898
  }
125899
+
125900
+ this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
125882
125901
  }
125883
125902
 
125884
125903
  this.DelayDraw=function(frequency)
@@ -126645,6 +126664,7 @@ function JSReportChartContainer(uielement)
126645
126664
  console.log(`[OnWheel] wheelValue=${wheelValue}`);
126646
126665
  if (wheelValue<0) //下
126647
126666
  {
126667
+ this.LastMouseStatus.TooltipStatus=null;
126648
126668
  if (this.GotoNextItem(1))
126649
126669
  {
126650
126670
  this.Draw();
@@ -126653,6 +126673,7 @@ function JSReportChartContainer(uielement)
126653
126673
  }
126654
126674
  else if (wheelValue>0) //上
126655
126675
  {
126676
+ this.LastMouseStatus.TooltipStatus=null;
126656
126677
  if (this.GotoNextItem(-1))
126657
126678
  {
126658
126679
  this.Draw();
@@ -126664,6 +126685,7 @@ function JSReportChartContainer(uielement)
126664
126685
  {
126665
126686
  if (wheelValue<0) //下一页
126666
126687
  {
126688
+ this.LastMouseStatus.TooltipStatus=null;
126667
126689
  if (this.GotoNextPage(this.PageUpDownCycle))
126668
126690
  {
126669
126691
  this.Draw();
@@ -126672,6 +126694,7 @@ function JSReportChartContainer(uielement)
126672
126694
  }
126673
126695
  else if (wheelValue>0) //上一页
126674
126696
  {
126697
+ this.LastMouseStatus.TooltipStatus=null;
126675
126698
  if (this.GotoPreviousPage(this.PageUpDownCycle))
126676
126699
  {
126677
126700
  this.Draw();
@@ -126893,7 +126916,13 @@ function JSReportChartContainer(uielement)
126893
126916
  var pixelTatio = GetDevicePixelRatio();
126894
126917
  var x = (e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;
126895
126918
  var y = (e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;
126919
+
126920
+ this.LastMouseStatus.OnMouseMove=null;
126896
126921
 
126922
+ var bDrawTooltip=false;
126923
+ if (this.LastMouseStatus.TooltipStatus) bDrawTooltip=true;
126924
+ this.LastMouseStatus.TooltipStatus=null;
126925
+
126897
126926
  if (this.DragRow) return;
126898
126927
  if (this.DrawHeader) return;
126899
126928
  if (this.DragColumnWidth) return;
@@ -126913,10 +126942,11 @@ function JSReportChartContainer(uielement)
126913
126942
  }
126914
126943
  }
126915
126944
 
126945
+ this.LastMouseStatus.OnMouseMove={ X:x, Y:y };
126916
126946
  var mouseStatus={ Cursor:"default", Name:"Default"};; //鼠标状态
126917
126947
  var report=this.GetReportChart();
126918
- var cell=null;
126919
126948
  var bDraw=false;
126949
+
126920
126950
  if (report)
126921
126951
  {
126922
126952
  var dragHeaderWidth=report.PtInHeaderDragBorder(x,y);
@@ -126927,7 +126957,12 @@ function JSReportChartContainer(uielement)
126927
126957
  }
126928
126958
  else
126929
126959
  {
126930
- 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
+ }
126931
126966
  }
126932
126967
 
126933
126968
  var scrollbar=report.VScrollbar;
@@ -126943,16 +126978,20 @@ function JSReportChartContainer(uielement)
126943
126978
  }
126944
126979
  }
126945
126980
 
126981
+
126982
+ /* 目前没有用到
126946
126983
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_REPORT_MOUSE_MOVE);
126947
126984
  if (event)
126948
126985
  {
126949
126986
  var sendData={X:x, Y:y, Cell:cell };
126950
126987
  event.Callback(event,sendData,this);
126951
126988
  }
126989
+ */
126952
126990
 
126953
126991
  if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
126954
126992
 
126955
126993
  if (bDraw) this.Draw();
126994
+ else if (bDrawTooltip) this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
126956
126995
  }
126957
126996
 
126958
126997
  this.UIOnMounseOut=function(e)
@@ -128521,6 +128560,28 @@ function JSReportChartContainer(uielement)
128521
128560
 
128522
128561
  return true;
128523
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
+ }
128524
128585
  }
128525
128586
 
128526
128587
 
@@ -128831,6 +128892,9 @@ function ChartReport()
128831
128892
 
128832
128893
  this.RectClient={};
128833
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 }}
128834
128898
  this.TooltipRect=[];
128835
128899
 
128836
128900
  this.ReloadResource=function(resource)
@@ -128929,7 +128993,6 @@ function ChartReport()
128929
128993
  if (item.FullColBGColor) colItem.FullColBGColor=item.FullColBGColor; //整列背景色
128930
128994
  if (item.HeaderBGColor) colItem.HeaderBGColor=item.HeaderBGColor; //表头背景色
128931
128995
  if (IFrameSplitOperator.IsNumber(item.Sort)) colItem.Sort=item.Sort;
128932
- if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
128933
128996
  if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
128934
128997
  if (IFrameSplitOperator.IsBool(item.EnableDragWidth)) colItem.EnableDragWidth=item.EnableDragWidth;
128935
128998
  if (IFrameSplitOperator.IsBool(item.IsDrawCallback)) colItem.IsDrawCallback=item.IsDrawCallback;
@@ -129645,7 +129708,7 @@ function ChartReport()
129645
129708
  var x=left+this.ItemMergin.Left;
129646
129709
  var textWidth=column.Width-this.ItemMergin.Left-this.ItemMergin.Right;
129647
129710
  var stock=data.Stock;
129648
- var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign };
129711
+ var drawInfo={ Text:null, TextColor:column.TextColor , TextAlign:column.TextAlign, Tooltip:null };
129649
129712
  var rtItem={ Left:left, Top:top, Width:column.Width, Height:this.RowHeight };
129650
129713
  rtItem.Right=rtItem.Left+rtItem.Width;
129651
129714
  rtItem.Bottom=rtItem.Top+rtItem.Height;
@@ -129656,12 +129719,6 @@ function ChartReport()
129656
129719
  this.DrawItemBG({ Rect:rtItem, BGColor:column.FullColBGColor });
129657
129720
  }
129658
129721
 
129659
- //tooltip提示
129660
- if (column.EnableTooltip===true)
129661
- {
129662
- this.TooltipRect.push({ Rect:rtItem, Stock:stock, Index:index, Column:column, RowType:rowType })
129663
- }
129664
-
129665
129722
  if (column.Type==REPORT_COLUMN_ID.INDEX_ID)
129666
129723
  {
129667
129724
  if (rowType==1) return; //固定行序号空
@@ -129909,6 +129966,14 @@ function ChartReport()
129909
129966
  else
129910
129967
  this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
129911
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);
129976
+ }
129912
129977
  }
129913
129978
 
129914
129979
  this.DrawCustomText=function(drawInfo, column, left, top, cellWidth)
@@ -129957,6 +130022,13 @@ function ChartReport()
129957
130022
  this.Canvas.rect(rtCell.Left, rtCell.Top, rtCell.Width, rtCell.Height);
129958
130023
  //this.Canvas.stroke(); //调试用
129959
130024
  this.Canvas.clip();
130025
+
130026
+ //数据截断提示信息
130027
+ drawInfo.Tooltip=
130028
+ {
130029
+ Type:1,
130030
+ Data:{ AryText:[ {Text:drawInfo.Text} ] }
130031
+ }
129960
130032
  }
129961
130033
 
129962
130034
  this.Canvas.textBaseline="middle";
@@ -131234,8 +131306,7 @@ function ChartReport()
131234
131306
 
131235
131307
  }
131236
131308
 
131237
- //坐标所在单元格
131238
- this.PtInCell=function(x,y)
131309
+ this.GetTooltipData=function(x,y)
131239
131310
  {
131240
131311
  if (!IFrameSplitOperator.IsNonEmptyArray(this.TooltipRect)) return null;
131241
131312
 
@@ -131247,9 +131318,11 @@ function ChartReport()
131247
131318
 
131248
131319
  if (x>=rt.Left && x<=rt.Right && y>=rt.Top && y<=rt.Bottom)
131249
131320
  {
131250
- 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 };
131251
131322
  }
131252
131323
  }
131324
+
131325
+ return null;
131253
131326
  }
131254
131327
 
131255
131328
  this.PtInHeaderDragBorder=function(x, y)
@@ -131841,6 +131914,169 @@ function ChartVScrollbar()
131841
131914
  return pos;
131842
131915
  }
131843
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
+ }
131844
132080
  /*
131845
132081
  Copyright (c) 2018 jones
131846
132082
 
@@ -138816,7 +139052,7 @@ function HQChartScriptWorker()
138816
139052
 
138817
139053
 
138818
139054
 
138819
- var HQCHART_VERSION="1.1.13525";
139055
+ var HQCHART_VERSION="1.1.13530";
138820
139056
 
138821
139057
  function PrintHQChartVersion()
138822
139058
  {