hqchart 1.1.14269 → 1.1.14276

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.
@@ -155,15 +155,8 @@ function JSReportChart(divElement)
155
155
  if (option.EnableResize==true) this.CreateResizeListener();
156
156
 
157
157
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
158
- if (option.EnableTooltip)
159
- {
160
- this.CreateExtraCanvasElement(JSReportChart.TooltipCursorCanvasKey, { ZIndex:99 });
161
- }
162
-
163
- if (option.MinuteChartTooltip && option.MinuteChartTooltip.Enable)
164
- {
165
- chart.InitalMinuteChartTooltip(option.MinuteChartTooltip);
166
- }
158
+ if (option.FloatTooltip && option.FloatTooltip.Enable) chart.InitalFloatTooltip(option.FloatTooltip); //提示信息
159
+ if (option.MinuteChartTooltip && option.MinuteChartTooltip.Enable) chart.InitalMinuteChartTooltip(option.MinuteChartTooltip);
167
160
 
168
161
  if (option.Symbol) chart.Symbol=option.Symbol;
169
162
  if (option.Name) chart.Name=option.Name;
@@ -333,8 +326,6 @@ function JSReportChart(divElement)
333
326
  }
334
327
  }
335
328
 
336
- JSReportChart.TooltipCursorCanvasKey="hq_report_tooltip"; //提示信息
337
-
338
329
 
339
330
  JSReportChart.Init=function(divElement)
340
331
  {
@@ -413,9 +404,6 @@ function JSReportChartContainer(uielement)
413
404
  this.SplashTitle={ StockList:"下载码表中.....", MemberList:"下载成分中....." } ;
414
405
 
415
406
  this.Canvas=uielement.getContext("2d"); //画布
416
-
417
- this.TooltipCanvas;
418
- this.ChartTooltip;
419
407
 
420
408
  this.Tooltip=document.createElement("div");
421
409
  this.Tooltip.className='jsreport-tooltip';
@@ -499,6 +487,7 @@ function JSReportChartContainer(uielement)
499
487
  this.StopAutoUpdate();
500
488
 
501
489
  this.DestroyMinuteChartTooltip();
490
+ this.DestroyFloatTooltip();
502
491
  }
503
492
 
504
493
  this.StopAutoDragScrollTimer=function()
@@ -537,6 +526,51 @@ function JSReportChartContainer(uielement)
537
526
  this.TooltipMinuteChart=null;
538
527
  }
539
528
 
529
+ this.InitalFloatTooltip=function(option)
530
+ {
531
+ if (this.FloatTooltip) return;
532
+
533
+ this.FloatTooltip=new JSFloatTooltip();
534
+ this.FloatTooltip.Inital(this, option);
535
+ this.FloatTooltip.Create();
536
+ }
537
+
538
+ this.HideFloatTooltip=function()
539
+ {
540
+ if (!this.FloatTooltip) return;
541
+
542
+ this.FloatTooltip.Hide();
543
+ }
544
+
545
+ this.DestroyFloatTooltip=function()
546
+ {
547
+ if (!this.FloatTooltip) return;
548
+
549
+ this.FloatTooltip.Destroy();
550
+ this.FloatTooltip=null;
551
+ }
552
+
553
+ this.DrawFloatTooltip=function(point,toolTip)
554
+ {
555
+ if (!this.FloatTooltip) return;
556
+
557
+ this.UpdateFloatTooltip(point, toolTip)
558
+ }
559
+
560
+ this.UpdateFloatTooltip=function(point, toolTip)
561
+ {
562
+ if (!this.FloatTooltip) return;
563
+
564
+ var sendData=
565
+ {
566
+ Tooltip:toolTip,
567
+ Point:point,
568
+ DataType:3,
569
+ };
570
+
571
+ this.FloatTooltip.Update(sendData);
572
+ }
573
+
540
574
  //data={ Symbol }
541
575
  this.ShowMinuteChartTooltip=function(x,y, data)
542
576
  {
@@ -687,12 +721,6 @@ function JSReportChartContainer(uielement)
687
721
 
688
722
  this.ChartPaint[0]=chart;
689
723
 
690
- //提示信息
691
- var chartTooltip=new ChartCellTooltip();
692
- chartTooltip.Frame=this.Frame;
693
- chartTooltip.ChartBorder=this.Frame.ChartBorder;
694
- this.ChartTooltip=chartTooltip;
695
-
696
724
  //页脚
697
725
  if (option && option.PageInfo===true)
698
726
  {
@@ -714,6 +742,7 @@ function JSReportChartContainer(uielement)
714
742
  if (IFrameSplitOperator.IsNumber(option.FixedRowCount)) chart.FixedRowCount=option.FixedRowCount; //固定行
715
743
  if (IFrameSplitOperator.IsBool(option.ItemBorder)) chart.IsDrawBorder=option.ItemBorder; //单元格边框
716
744
  if (IFrameSplitOperator.IsNumber(option.SelectedModel)) chart.SelectedModel=option.SelectedModel;
745
+ if (IFrameSplitOperator.IsNumber(option.HeaderRowCount)) chart.HeaderRowCount=option.HeaderRowCount;
717
746
 
718
747
  if (IFrameSplitOperator.IsNonEmptyArray(option.FixedSymbol))
719
748
  {
@@ -805,8 +834,6 @@ function JSReportChartContainer(uielement)
805
834
  {
806
835
  this.DelayDraw(500);
807
836
  }
808
-
809
- this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
810
837
  }
811
838
 
812
839
  this.DelayDraw=function(frequency)
@@ -1738,6 +1765,7 @@ function JSReportChartContainer(uielement)
1738
1765
  {
1739
1766
  this.LastMouseStatus.TooltipStatus=null;
1740
1767
  this.HideMinuteChartTooltip();
1768
+ this.HideFloatTooltip();
1741
1769
  if (this.GotoNextItem(1))
1742
1770
  {
1743
1771
  this.Draw();
@@ -1748,6 +1776,7 @@ function JSReportChartContainer(uielement)
1748
1776
  {
1749
1777
  this.LastMouseStatus.TooltipStatus=null;
1750
1778
  this.HideMinuteChartTooltip();
1779
+ this.HideFloatTooltip();
1751
1780
  if (this.GotoNextItem(-1))
1752
1781
  {
1753
1782
  this.Draw();
@@ -1761,6 +1790,7 @@ function JSReportChartContainer(uielement)
1761
1790
  {
1762
1791
  this.LastMouseStatus.TooltipStatus=null;
1763
1792
  this.HideMinuteChartTooltip();
1793
+ this.HideFloatTooltip();
1764
1794
  if (this.GotoNextPage(this.PageUpDownCycle))
1765
1795
  {
1766
1796
  this.Draw();
@@ -1771,6 +1801,7 @@ function JSReportChartContainer(uielement)
1771
1801
  {
1772
1802
  this.LastMouseStatus.TooltipStatus=null;
1773
1803
  this.HideMinuteChartTooltip();
1804
+ this.HideFloatTooltip();
1774
1805
  if (this.GotoPreviousPage(this.PageUpDownCycle))
1775
1806
  {
1776
1807
  this.Draw();
@@ -1793,6 +1824,7 @@ function JSReportChartContainer(uielement)
1793
1824
  if (keyID==116) return; //F15刷新不处理
1794
1825
 
1795
1826
  this.HideMinuteChartTooltip();
1827
+ this.HideFloatTooltip();
1796
1828
  switch(keyID)
1797
1829
  {
1798
1830
  case 33: //page up
@@ -2193,7 +2225,17 @@ function JSReportChartContainer(uielement)
2193
2225
  if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
2194
2226
 
2195
2227
  if (bDraw || bDrawTab) this.Draw();
2196
- else if (bDrawTooltip) this.DrawTooltip(this.LastMouseStatus.TooltipStatus);
2228
+
2229
+ if (this.LastMouseStatus.TooltipStatus)
2230
+ {
2231
+ var xTooltip = e.clientX-this.UIElement.getBoundingClientRect().left;
2232
+ var yTooltip = e.clientY-this.UIElement.getBoundingClientRect().top;
2233
+ this.DrawFloatTooltip({X:xTooltip, Y:yTooltip, YMove:20/pixelTatio},this.LastMouseStatus.TooltipStatus.Data);
2234
+ }
2235
+ else
2236
+ {
2237
+ this.HideFloatTooltip();
2238
+ }
2197
2239
 
2198
2240
  if (bShowChartTooltip)
2199
2241
  {
@@ -2208,6 +2250,7 @@ function JSReportChartContainer(uielement)
2208
2250
  this.UIOnMounseOut=function(e)
2209
2251
  {
2210
2252
  this.HideMinuteChartTooltip();
2253
+ this.HideFloatTooltip();
2211
2254
 
2212
2255
  var bDraw=false;
2213
2256
  var tabChart=this.GetTabChart();
@@ -2234,6 +2277,7 @@ function JSReportChartContainer(uielement)
2234
2277
  this.UIOnMouseleave=function(e)
2235
2278
  {
2236
2279
  this.HideMinuteChartTooltip();
2280
+ this.HideFloatTooltip();
2237
2281
 
2238
2282
  var tabChart=this.GetTabChart();
2239
2283
  if (tabChart && tabChart.MoveOnTabIndex>=0)
@@ -3790,16 +3834,16 @@ function JSReportChartContainer(uielement)
3790
3834
  case REPORT_COLUMN_ID.VOL_OUT_ID:
3791
3835
  case REPORT_COLUMN_ID.DATE_ID:
3792
3836
 
3793
- case TREPORT_COLUMN_ID.RESERVE_NUMBER1_ID:
3794
- case TREPORT_COLUMN_ID.RESERVE_NUMBER2_ID:
3795
- case TREPORT_COLUMN_ID.RESERVE_NUMBER3_ID:
3796
- case TREPORT_COLUMN_ID.RESERVE_NUMBER4_ID:
3797
- case TREPORT_COLUMN_ID.RESERVE_NUMBER5_ID:
3798
- case TREPORT_COLUMN_ID.RESERVE_NUMBER6_ID:
3799
- case TREPORT_COLUMN_ID.RESERVE_NUMBER7_ID:
3800
- case TREPORT_COLUMN_ID.RESERVE_NUMBER8_ID:
3801
- case TREPORT_COLUMN_ID.RESERVE_NUMBER9_ID:
3802
- case TREPORT_COLUMN_ID.RESERVE_NUMBER10_ID:
3837
+ case REPORT_COLUMN_ID.RESERVE_NUMBER1_ID:
3838
+ case REPORT_COLUMN_ID.RESERVE_NUMBER2_ID:
3839
+ case REPORT_COLUMN_ID.RESERVE_NUMBER3_ID:
3840
+ case REPORT_COLUMN_ID.RESERVE_NUMBER4_ID:
3841
+ case REPORT_COLUMN_ID.RESERVE_NUMBER5_ID:
3842
+ case REPORT_COLUMN_ID.RESERVE_NUMBER6_ID:
3843
+ case REPORT_COLUMN_ID.RESERVE_NUMBER7_ID:
3844
+ case REPORT_COLUMN_ID.RESERVE_NUMBER8_ID:
3845
+ case REPORT_COLUMN_ID.RESERVE_NUMBER9_ID:
3846
+ case REPORT_COLUMN_ID.RESERVE_NUMBER10_ID:
3803
3847
 
3804
3848
  return this.LocalNumberSort(left, right, column, sortType);
3805
3849
  case REPORT_COLUMN_ID.CUSTOM_NUMBER_TEXT_ID: //自定义数值字段
@@ -4185,28 +4229,6 @@ function JSReportChartContainer(uielement)
4185
4229
 
4186
4230
  return true;
4187
4231
  }
4188
-
4189
- this.DrawTooltip=function(tooltipStatus)
4190
- {
4191
- if (!this.GetExtraCanvas) return;
4192
- if (!this.TooltipCanvas)
4193
- {
4194
- var finder=this.GetExtraCanvas(JSReportChart.TooltipCursorCanvasKey);
4195
- if (!finder) return;
4196
- this.TooltipCanvas=finder.Canvas;
4197
- }
4198
-
4199
- if (!this.TooltipCanvas) return;
4200
- this.ClearCanvas(this.TooltipCanvas);
4201
- if (!this.ChartTooltip) return;
4202
-
4203
- if (!tooltipStatus || !tooltipStatus.Data) return;
4204
-
4205
- this.ChartTooltip.Canvas=this.TooltipCanvas;
4206
- this.ChartTooltip.Point={ X:tooltipStatus.X, Y:tooltipStatus.Y };
4207
- this.ChartTooltip.Data=tooltipStatus.Data.Data;
4208
- this.ChartTooltip.Draw();
4209
- }
4210
4232
  }
4211
4233
 
4212
4234
 
@@ -4535,6 +4557,7 @@ function ChartReport()
4535
4557
  this.SelectedRow=-1; //选中行ID
4536
4558
  this.SelectedFixedRow=-1; //选中固定行ID
4537
4559
  this.IsDrawBorder=1; //是否绘制单元格边框
4560
+ this.HeaderRowCount=1; //表头行数
4538
4561
 
4539
4562
  //多选模式
4540
4563
  this.MultiSelectModel=0; //0=禁用 1=开启
@@ -4579,6 +4602,7 @@ function ChartReport()
4579
4602
  Margin:
4580
4603
  {
4581
4604
  Left:g_JSChartResource.Report.SortIcon.Margin.Left,
4605
+ Right:g_JSChartResource.Report.SortIcon.Margin.Right,
4582
4606
  Bottom:g_JSChartResource.Report.SortIcon.Margin.Bottom
4583
4607
  }
4584
4608
  }
@@ -4667,6 +4691,7 @@ function ChartReport()
4667
4691
  this.NameSymbolFont={ Symbol:null, Name:null };
4668
4692
  this.RowCount=0; //一屏显示行数
4669
4693
  this.HeaderHeight=0; //表头高度
4694
+ this.HeaderFontHeight=0; //表头字体高度
4670
4695
  this.FixedRowHeight=0; //固定行高度
4671
4696
  this.RowHeight=0; //行高度
4672
4697
  this.ItemTextLines=1; //单元格输出行数
@@ -4800,6 +4825,7 @@ function ChartReport()
4800
4825
  if (!colItem) return null;
4801
4826
 
4802
4827
  if (item.Title) colItem.Title=item.Title;
4828
+ if (IFrameSplitOperator.IsNonEmptyArray(item.AryTitle)) colItem.AryTitle=item.AryTitle;
4803
4829
  if (item.TextAlign) colItem.TextAlign=item.TextAlign;
4804
4830
  if (item.TextColor) colItem.TextColor=item.TextColor;
4805
4831
  if (item.HeaderColor) colItem.HeaderColor=item.HeaderColor;
@@ -5332,7 +5358,17 @@ function ChartReport()
5332
5358
  if (item.Width<itemWidth) item.Width=itemWidth;
5333
5359
  }
5334
5360
 
5335
- this.HeaderHeight=this.GetFontHeight(this.HeaderFont,"擎")+ this.HeaderMergin.Top+ this.HeaderMergin.Bottom;
5361
+ this.HeaderFontHeight=this.GetFontHeight(this.HeaderFont,"擎");
5362
+ if (this.HeaderRowCount<=1) //单行
5363
+ {
5364
+ this.HeaderHeight=this.HeaderFontHeight+(this.HeaderMergin.Top+this.HeaderMergin.Bottom);
5365
+ }
5366
+ else
5367
+ {
5368
+ this.HeaderHeight=(this.HeaderFontHeight*this.HeaderRowCount)+(this.HeaderMergin.Top+this.HeaderMergin.Bottom);
5369
+ }
5370
+
5371
+
5336
5372
  if (!this.IsShowHeader) this.HeaderHeight=0;
5337
5373
  if (this.FixedRowCount<=0) this.FixedRowHeight=0;
5338
5374
 
@@ -5349,90 +5385,68 @@ function ChartReport()
5349
5385
  this.IsShowAllColumn=(subWidth<reportWidth);
5350
5386
  }
5351
5387
 
5352
- this.DrawHeader=function()
5388
+ this.DrawHeaderItem=function(column, rtCell, index)
5353
5389
  {
5354
- if (!this.IsShowHeader) return;
5355
-
5356
- var left=this.RectClient.Left;
5357
- var top=this.RectClient.Top;
5358
- var y=top+this.HeaderMergin.Top+(this.HeaderHeight-this.HeaderMergin.Top-this.HeaderMergin.Bottom)/2;
5359
- var yBottom=top+this.HeaderHeight;
5360
- var bDrawSortBG=this.IsDrawSortBGIcon();
5361
-
5362
- this.Canvas.font=this.HeaderFont;
5363
-
5364
- var textLeft=left;
5365
- //固定列
5366
- for(var i=0;i<this.FixedColumn && i<this.Column.length;++i)
5390
+ if (column.HeaderBGColor) //背景色
5367
5391
  {
5368
- var item=this.Column[i];
5369
- var itemWidth=item.Width;
5370
- var textWidth=itemWidth-this.HeaderMergin.Left-this.HeaderMergin.Right;
5371
- var x=textLeft+this.HeaderMergin.Left;
5392
+ this.DrawItemBG({ Rect:rtCell, BGColor:column.HeaderBGColor });
5393
+ }
5372
5394
 
5373
- if (item.HeaderBGColor)
5374
- {
5375
- var rtBG={Left:textLeft, Top:top, Width:itemWidth, Height:this.HeaderHeight };
5376
- rtBG.Right=rtBG.Left+rtBG.Width;
5377
- rtBG.Bottom=rtBG.Top+rtBG.Height;
5378
- this.DrawItemBG({ Rect:rtBG, BGColor:item.HeaderBGColor });
5379
- }
5395
+ var textWidth=rtCell.Width-this.HeaderMergin.Left-this.HeaderMergin.Right;
5396
+ //AryText=[ { Text:标题, Sort:{Type:排序}, Icon:图标 }]
5397
+ var drawInfo={ Rect:rtCell, AryText:[ { Text:null} ], YText:rtCell.Bottom-this.HeaderMergin.Bottom, Index:index, TextWidth:textWidth };
5380
5398
 
5381
- var iconWidth=0;
5382
- if (item.Icon && item.Icon.Symbol) //图标
5399
+ if (this.HeaderRowCount>1) //多行
5400
+ {
5401
+ if (IFrameSplitOperator.IsNonEmptyArray(column.AryTitle))
5383
5402
  {
5384
- var iconWidth=item.Icon.Size;
5385
- if (item.Icon.Margin)
5403
+ drawInfo.AryText=[];
5404
+ for(var i=0;i<column.AryTitle.length && i<this.HeaderRowCount;++i)
5386
5405
  {
5387
- var margin=item.Icon.Margin;
5388
- if (IFrameSplitOperator.IsNumber(margin.Left)) iconWidth+=margin.Left;
5389
- if (IFrameSplitOperator.IsNumber(margin.Right)) iconWidth+=margin.Right;
5406
+ var text=column.AryTitle[i];
5407
+ drawInfo.AryText.push({ Text:text } );
5390
5408
  }
5391
- }
5392
- textWidth-=iconWidth;
5393
-
5394
- if (item.HeaderColor) this.Canvas.fillStyle=item.HeaderColor;
5395
- else this.Canvas.fillStyle=this.HeaderColor;
5396
-
5397
- var textSize={ }
5398
- if (this.SortInfo && this.SortInfo.Field==i && this.SortInfo.Sort>0)
5399
- {
5400
- this.DrawSortHeader(item.Title,item.TextAlign,x,yBottom,textWidth,this.SortInfo.Sort, textSize);
5401
- }
5402
- else if (item.Sort>0 && bDrawSortBG)
5403
- {
5404
- this.DrawSortHeader(item.Title,item.TextAlign,x,yBottom,textWidth,0,textSize);
5409
+ drawInfo.YText-=((this.HeaderRowCount-1)*this.HeaderFontHeight);
5405
5410
  }
5406
5411
  else
5407
5412
  {
5408
- this.DrawText(item.Title,item.TextAlign,x,yBottom,textWidth,textSize);
5413
+ if (column.Title) drawInfo.AryText[0].Text=column.Title;
5414
+ drawInfo.YText=rtCell.Bottom-this.HeaderMergin.Bottom-(this.HeaderRowCount*this.HeaderFontHeight)/2+this.HeaderFontHeight/2;
5409
5415
  }
5416
+ }
5417
+ else //单行
5418
+ {
5419
+ if (column.Title) drawInfo.AryText[0].Text=column.Title;
5420
+ }
5410
5421
 
5411
- if (iconWidth>0)
5412
- {
5413
- this.DrawHeaderIcon(item.Icon, textSize.Right, yBottom, i, item);
5414
- this.Canvas.font=this.HeaderFont;
5415
- }
5422
+ var lastItem=drawInfo.AryText[drawInfo.AryText.length-1];
5416
5423
 
5417
- this.Canvas.fillStyle=this.HeaderColor;
5424
+ //排序
5425
+ var bDrawSortBG=this.IsDrawSortBGIcon();
5426
+ if (this.SortInfo && this.SortInfo.Field==index && this.SortInfo.Sort>0) lastItem.Sort={ Type:this.SortInfo.Sort };
5427
+ else if (column.Sort>0 && bDrawSortBG && IFrameSplitOperator.IsNonEmptyArray(column.SortType) && column.SortType.length>=2) lastItem.Sort={ Type:0 };
5418
5428
 
5419
- textLeft+=item.Width;
5420
- }
5429
+ //图标
5430
+ if (column.Icon) lastItem.Icon=column.Icon;
5421
5431
 
5422
- for(var i=this.FixedColumn+this.Data.XOffset;i<this.Column.length;++i)
5423
- {
5424
- var item=this.Column[i];
5425
- var itemWidth=item.Width;
5426
- var textWidth=itemWidth-this.HeaderMergin.Left-this.HeaderMergin.Right;
5427
- var x=textLeft+this.HeaderMergin.Left;
5432
+ this.DrawHeaderText(column, drawInfo);
5433
+ }
5428
5434
 
5429
- if (item.HeaderBGColor)
5430
- {
5431
- var rtBG={Left:textLeft, Top:top, Width:itemWidth, Height:this.HeaderHeight };
5432
- rtBG.Right=rtBG.Left+rtBG.Width;
5433
- rtBG.Bottom=rtBG.Top+rtBG.Height;
5434
- this.DrawItemBG({ Rect:rtBG, BGColor:item.HeaderBGColor });
5435
- }
5435
+ this.DrawHeaderText=function(column, drawInfo)
5436
+ {
5437
+ if (column.HeaderColor) this.Canvas.fillStyle=column.HeaderColor;
5438
+ else this.Canvas.fillStyle=this.HeaderColor;
5439
+
5440
+ var pixelRatio=GetDevicePixelRatio();
5441
+ var cellWidth=drawInfo.Rect.Width;
5442
+ var bDrawSortBG=this.IsDrawSortBGIcon();
5443
+
5444
+ var y=drawInfo.YText;
5445
+ for(var i=0;i<drawInfo.AryText.length;++i)
5446
+ {
5447
+ var x=drawInfo.Rect.Left+this.HeaderMergin.Left;
5448
+ var item=drawInfo.AryText[i];
5449
+ var textSize={ TextMaxWidth:drawInfo.TextWidth };
5436
5450
 
5437
5451
  var iconWidth=0;
5438
5452
  if (item.Icon && item.Icon.Symbol) //图标
@@ -5445,81 +5459,123 @@ function ChartReport()
5445
5459
  if (IFrameSplitOperator.IsNumber(margin.Right)) iconWidth+=margin.Right;
5446
5460
  }
5447
5461
  }
5462
+ if (iconWidth>0) textSize.TextMaxWidth-=iconWidth;
5448
5463
 
5449
- textWidth-=iconWidth;
5450
-
5451
- if (item.HeaderColor) this.Canvas.fillStyle=item.HeaderColor;
5452
- else this.Canvas.fillStyle=this.HeaderColor;
5464
+ var sortWidth=0; //排序图标
5465
+ if (item.Sort && this.SortConfig && IFrameSplitOperator.IsPlusNumber(this.SortConfig.Size))
5466
+ {
5467
+ sortWidth=this.SortConfig.Size*pixelRatio;
5468
+ if (this.SortConfig.Margin)
5469
+ {
5470
+ var margin=this.SortConfig.Margin;
5471
+ if (IFrameSplitOperator.IsNumber(margin.Left)) sortWidth+=margin.Left;
5472
+ if (IFrameSplitOperator.IsNumber(margin.Right)) sortWidth+=margin.Right;
5473
+ }
5474
+ }
5475
+ if (sortWidth>0) textSize.TextMaxWidth-=sortWidth;
5476
+
5453
5477
 
5454
- var textSize={ }
5455
- if (this.SortInfo && this.SortInfo.Field==i && this.SortInfo.Sort>0)
5478
+ var textWidth=0;
5479
+ if (item.Text)
5456
5480
  {
5457
- this.DrawSortHeader(item.Title,item.TextAlign,x,yBottom,textWidth,this.SortInfo.Sort,textSize);
5481
+ this.Canvas.font=this.HeaderFont;
5482
+ textWidth=this.Canvas.measureText(item.Text).width;
5458
5483
  }
5459
- else if (item.Sort>0)
5484
+
5485
+ if (column.TextAlign=='center') x=x+(cellWidth-textWidth)/2;
5486
+ else if (column.TextAlign=='right') x=x+textSize.TextMaxWidth-textWidth;
5487
+
5488
+ if (item.Text) //文字
5460
5489
  {
5461
- this.DrawSortHeader(item.Title,item.TextAlign,x,yBottom,textWidth,0, textSize);
5490
+ this.Canvas.fillText(item.Text,x,y);
5491
+ x+=textWidth;
5462
5492
  }
5463
- else
5493
+
5494
+ if (sortWidth>1) //排序
5464
5495
  {
5465
- this.DrawText(item.Title,item.TextAlign,x,yBottom,textWidth,textSize);
5496
+ this.Canvas.font=this.SortFont;
5497
+ var xSort=x;
5498
+ if (this.SortConfig.Margin && IFrameSplitOperator.IsNumber(this.SortConfig.Margin.Left)) xSort+=this.SortConfig.Margin.Left;
5499
+ if (item.Sort.Type!=0 && bDrawSortBG) //背景
5500
+ {
5501
+ var sortText=this.SortConfig.Arrow[0];
5502
+ var sortColor=this.SortConfig.Color[0];
5503
+ this.Canvas.fillStyle=sortColor;
5504
+ this.Canvas.fillText(sortText,xSort,y-this.SortConfig.Margin.Bottom);
5505
+ }
5506
+
5507
+ var sortText=this.SortConfig.Arrow[item.Sort.Type];
5508
+ var sortColor=this.SortConfig.Color[item.Sort.Type];
5509
+ this.Canvas.fillStyle=sortColor;
5510
+ this.Canvas.fillText(sortText,xSort,y-this.SortConfig.Margin.Bottom);
5511
+ x+=sortWidth;
5466
5512
  }
5467
5513
 
5468
- if (iconWidth>0)
5514
+ if (iconWidth>1) //图标
5469
5515
  {
5470
- this.DrawHeaderIcon(item.Icon, textSize.Right, yBottom, i, item);
5471
- this.Canvas.font=this.HeaderFont;
5516
+ var icon=item.Icon;
5517
+ var iconFont=`${icon.Size}px ${icon.Family}`;
5518
+ this.Canvas.font=iconFont;
5519
+ if (icon.Color) this.Canvas.fillStyle=icon.Color;
5520
+ var yOffset=0, xOffset=0;
5521
+ if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Left)) xOffset=icon.Margin.Left;
5522
+ if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Bottom)) yOffset=-icon.Margin.Bottom;
5523
+ this.Canvas.fillText(icon.Symbol, x+xOffset, y+yOffset);
5524
+
5525
+ if (icon.Tooltip)
5526
+ {
5527
+ var rtIcon={ Left:x+xOffset, Bottom:y+yOffset, Width:icon.Size, Height:icon.Size };
5528
+ rtIcon.Right=rtIcon.Left+rtIcon.Width;
5529
+ rtIcon.Top=rtIcon.Bottom-rtIcon.Height;
5530
+
5531
+ var tooltipData={ Rect:rtIcon, Type:2, Column:column, Index:drawInfo.Index, Data:icon.Tooltip.Data };
5532
+ this.TooltipRect.push(tooltipData);
5533
+ }
5472
5534
  }
5473
5535
 
5474
- textLeft+=item.Width;
5475
- }
5536
+ y+=this.HeaderFontHeight;
5537
+ }
5476
5538
  }
5477
5539
 
5478
- this.DrawText=function(text, textAlign, x, yBottom, cellWidth, textSize)
5540
+ this.DrawHeader=function()
5479
5541
  {
5480
- var textWidth=this.Canvas.measureText(text).width;
5481
- if (textAlign=='center')
5482
- {
5483
- x=x+(cellWidth-textWidth)/2;
5484
- }
5485
- else if (textAlign=='right')
5486
- {
5487
- x=x+cellWidth-textWidth;
5488
- }
5542
+ if (!this.IsShowHeader) return;
5489
5543
 
5544
+ var left=this.RectClient.Left;
5545
+ var top=this.RectClient.Top;
5546
+ this.Canvas.font=this.HeaderFont;
5547
+
5548
+ var textLeft=left;
5490
5549
  this.Canvas.textAlign="left";
5491
5550
  this.Canvas.textBaseline="bottom";
5492
- this.Canvas.fillText(text,x,yBottom-this.HeaderMergin.Bottom);
5493
-
5494
- if (textSize)
5551
+ //固定列
5552
+ for(var i=0;i<this.FixedColumn && i<this.Column.length;++i)
5495
5553
  {
5496
- textSize.Right=x+textWidth;
5497
- textSize.Width=textWidth;
5498
- }
5499
- }
5554
+ var item=this.Column[i];
5555
+ var itemWidth=item.Width;
5556
+ //var textWidth=itemWidth-this.HeaderMergin.Left-this.HeaderMergin.Right;
5500
5557
 
5501
- this.DrawHeaderIcon=function(icon, x, yBottom, index, column)
5502
- {
5503
- var iconFont=`${icon.Size}px ${icon.Family}`;
5504
- this.Canvas.font=iconFont;
5505
- this.Canvas.textAlign="left";
5506
- if (icon.Color) this.Canvas.fillStyle=icon.Color;
5558
+ var rtCell={ Left:textLeft, Width:itemWidth, Top:top, Height:this.HeaderHeight };
5559
+ rtCell.Right=rtCell.Left+rtCell.Width;
5560
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
5507
5561
 
5508
- var xIcon=x;
5509
- var yIcon=yBottom;
5510
- if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Left)) xIcon+=icon.Margin.Left;
5511
- if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Bottom)) yIcon-=icon.Margin.Bottom;
5512
- this.Canvas.fillText(icon.Symbol, xIcon, yIcon);
5562
+ this.DrawHeaderItem(item, rtCell, i);
5563
+ textLeft+=item.Width;
5564
+ }
5513
5565
 
5514
- if (icon.Tooltip)
5566
+ for(var i=this.FixedColumn+this.Data.XOffset;i<this.Column.length;++i)
5515
5567
  {
5516
- var rtIcon={ Left:xIcon, Bottom:yIcon, Width:icon.Size, Height:icon.Size };
5517
- rtIcon.Right=rtIcon.Left+rtIcon.Width;
5518
- rtIcon.Top=rtIcon.Bottom-rtIcon.Height;
5568
+ var item=this.Column[i];
5569
+ var itemWidth=item.Width;
5570
+ //var textWidth=itemWidth-this.HeaderMergin.Left-this.HeaderMergin.Right;
5519
5571
 
5520
- var tooltipData={ Rect:rtIcon, Type:2, Column:column, Index:index, Data:icon.Tooltip.Data };
5521
- this.TooltipRect.push(tooltipData);
5522
- }
5572
+ var rtCell={ Left:textLeft, Width:itemWidth, Top:top, Height:this.HeaderHeight };
5573
+ rtCell.Right=rtCell.Left+rtCell.Width;
5574
+ rtCell.Bottom=rtCell.Top+rtCell.Height;
5575
+
5576
+ this.DrawHeaderItem(item, rtCell, i);
5577
+ textLeft+=item.Width;
5578
+ }
5523
5579
  }
5524
5580
 
5525
5581
  //是否绘制排序背景图标
@@ -5534,57 +5590,6 @@ function ChartReport()
5534
5590
  return true;
5535
5591
  }
5536
5592
 
5537
- this.DrawSortHeader=function(text, textAlign, x, yBottom, width, sortType,textSize)
5538
- {
5539
- var pixelRatio=GetDevicePixelRatio();
5540
- var sortText=this.SortConfig.Arrow[sortType];
5541
- var sortBGText=this.SortConfig.Arrow[0];
5542
- var sortBGColor=this.SortConfig.Color[0];
5543
- this.Canvas.font=this.HeaderFont;
5544
- var textWidth=this.Canvas.measureText(text).width;
5545
- var sortTextWidth=this.SortConfig.Size*pixelRatio+this.SortConfig.Margin.Left;
5546
-
5547
- if (textAlign=='center')
5548
- {
5549
- x=x+width/2-(sortTextWidth+textWidth)/2;
5550
- }
5551
- else if (textAlign=='right')
5552
- {
5553
- x=(x+width)-sortTextWidth-textWidth;
5554
- }
5555
-
5556
- this.Canvas.textBaseline="bottom";
5557
- this.Canvas.textAlign="left";
5558
-
5559
- var xText=x;
5560
- this.Canvas.font=this.HeaderFont;
5561
- this.Canvas.fillStyle=this.HeaderColor;
5562
- this.Canvas.fillText(text,xText,yBottom-this.HeaderMergin.Bottom);
5563
-
5564
- xText+=(textWidth+this.SortConfig.Margin.Left);
5565
- this.Canvas.font=this.SortFont;
5566
- if (sortBGText && sortBGColor)
5567
- {
5568
- this.Canvas.fillStyle=sortBGColor;
5569
- this.Canvas.fillText(sortBGText,xText,yBottom-this.SortConfig.Margin.Bottom);
5570
- }
5571
-
5572
- if (sortType>0)
5573
- {
5574
- this.Canvas.fillStyle=this.SortConfig.Color[sortType];
5575
- this.Canvas.fillText(sortText,xText,yBottom-this.SortConfig.Margin.Bottom);
5576
- }
5577
-
5578
- this.Canvas.font=this.HeaderFont;
5579
- this.Canvas.fillStyle=this.HeaderColor;
5580
-
5581
- if (textSize)
5582
- {
5583
- textSize.Right=x+textWidth+sortTextWidth;
5584
- textSize.Width=textWidth+sortTextWidth;
5585
- }
5586
- }
5587
-
5588
5593
  this.DrawBorder=function()
5589
5594
  {
5590
5595
  if (!this.IsDrawBorder) return;
@@ -6208,9 +6213,7 @@ function ChartReport()
6208
6213
  {
6209
6214
  this.FormatReserveNumber(column, stock, drawInfo);
6210
6215
  }
6211
- else if ([REPORT_COLUMN_ID.RESERVE_STRING1_ID,REPORT_COLUMN_ID.RESERVE_STRING2_ID,REPORT_COLUMN_ID.RESERVE_STRING3_ID,REPORT_COLUMN_ID.RESERVE_STRING4_ID,
6212
- REPORT_COLUMN_ID.RESERVE_STRING5_ID,REPORT_COLUMN_ID.RESERVE_STRING6_ID,REPORT_COLUMN_ID.RESERVE_STRING7_ID,REPORT_COLUMN_ID.RESERVE_STRING8_ID,
6213
- REPORT_COLUMN_ID.RESERVE_STRING9_ID,REPORT_COLUMN_ID.RESERVE_STRING10_ID].includes(column.Type))
6216
+ else if (this.IsReserveString(column.Type))
6214
6217
  {
6215
6218
  this.FormatReserveString(column, stock, drawInfo);
6216
6219
  }
@@ -6269,7 +6272,7 @@ function ChartReport()
6269
6272
 
6270
6273
  this.DrawItemBG(drawInfo);
6271
6274
 
6272
- if (column.Type==REPORT_COLUMN_ID.CUSTOM_STRING_TEXT_ID)
6275
+ if (column.Type==REPORT_COLUMN_ID.CUSTOM_STRING_TEXT_ID || this.IsReserveString(column.Type))
6273
6276
  this.DrawCustomText(drawInfo,column, x, top, textWidth);
6274
6277
  else
6275
6278
  this.DrawItemText(drawInfo.Text, drawInfo.TextColor, drawInfo.TextAlign, x, top, textWidth, drawInfo.BGColor);
@@ -6321,6 +6324,20 @@ function ChartReport()
6321
6324
  return ARARY_TYPE.includes(value);
6322
6325
  }
6323
6326
 
6327
+ this.IsReserveString=function(value)
6328
+ {
6329
+ var ARARY_TYPE=
6330
+ [
6331
+ REPORT_COLUMN_ID.RESERVE_STRING1_ID,REPORT_COLUMN_ID.RESERVE_STRING2_ID,REPORT_COLUMN_ID.RESERVE_STRING3_ID,REPORT_COLUMN_ID.RESERVE_STRING4_ID,
6332
+ REPORT_COLUMN_ID.RESERVE_STRING5_ID,REPORT_COLUMN_ID.RESERVE_STRING6_ID,REPORT_COLUMN_ID.RESERVE_STRING7_ID,REPORT_COLUMN_ID.RESERVE_STRING8_ID,
6333
+ REPORT_COLUMN_ID.RESERVE_STRING9_ID,REPORT_COLUMN_ID.RESERVE_STRING10_ID
6334
+ ];
6335
+
6336
+ return ARARY_TYPE.includes(value);
6337
+ }
6338
+
6339
+
6340
+
6324
6341
  this.DrawCustomText=function(drawInfo, column, left, top, cellWidth)
6325
6342
  {
6326
6343
  if (!drawInfo.Text) return;
@@ -9050,7 +9067,7 @@ function ChartVScrollbar()
9050
9067
  }
9051
9068
  }
9052
9069
 
9053
-
9070
+ /* 使用div替换掉了
9054
9071
  function ChartCellTooltip()
9055
9072
  {
9056
9073
  this.Canvas; //画布
@@ -9212,3 +9229,4 @@ function ChartCellTooltip()
9212
9229
  }
9213
9230
  }
9214
9231
  }
9232
+ */