hqchart 1.1.13531 → 1.1.13541

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.
@@ -4093,15 +4093,14 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
4093
4093
  this.OnSize=function(option)
4094
4094
  {
4095
4095
  //画布大小通过div获取 如果有style里的大小 使用style里的
4096
+ var height=this.DivElement.offsetHeight;
4097
+ var width=this.DivElement.offsetWidth;
4096
4098
  if (this.DivElement.style.height && this.DivElement.style.width)
4097
4099
  {
4098
- var height=parseInt(this.DivElement.style.height.replace("px",""));
4099
- var width=parseInt(this.DivElement.style.width.replace("px",""));
4100
- }
4101
- else
4102
- {
4103
- var height=this.DivElement.offsetHeight;
4104
- var width=this.DivElement.offsetWidth;
4100
+ if (this.DivElement.style.height.includes("px"))
4101
+ height=parseInt(this.DivElement.style.height.replace("px",""));
4102
+ if (this.DivElement.style.width.includes("px"))
4103
+ width=parseInt(this.DivElement.style.width.replace("px",""));
4105
4104
  }
4106
4105
 
4107
4106
  if (this.ToolElement)
@@ -71167,9 +71166,9 @@ function JSChartResource()
71167
71166
  Mergin:{ Left:5, Right:5, Top:4, Bottom:2 },
71168
71167
 
71169
71168
  TabTitleColor:'rgb(60,60,60)',
71170
- TabSelectedTitleColor:'rgb(0,0,0)',
71171
- TabSelectedBGColor:"rgb(252,252,252)",
71172
- TabMoveOnTitleColor:"rgb(0,0,0)",
71169
+ TabSelectedTitleColor:'rgb(255,255,255)',
71170
+ TabSelectedBGColor:"rgb(234,85,4)",
71171
+ TabMoveOnTitleColor:"rgb(234,85,4)",
71173
71172
  TabBGColor:"rgb(220,220,220)"
71174
71173
  },
71175
71174
 
@@ -123587,7 +123586,7 @@ function GetBlackStyle()
123587
123586
 
123588
123587
  TabTitleColor:'rgb(153,153,153)',
123589
123588
  TabSelectedTitleColor:'rgb(255,255,255)',
123590
- TabSelectedBGColor:"rgb(13,12,15)",
123589
+ TabSelectedBGColor:"rgb(234,85,4)",
123591
123590
  TabMoveOnTitleColor:"rgb(255,255,255)",
123592
123591
  TabBGColor:"rgb(28,28,31)"
123593
123592
  },
@@ -125283,9 +125282,18 @@ function JSReportChart(divElement)
125283
125282
  this.OnSize=function()
125284
125283
  {
125285
125284
  //画布大小通过div获取
125286
- var height=parseInt(this.DivElement.style.height.replace("px",""));
125285
+ var height=this.DivElement.offsetHeight;
125286
+ var width=this.DivElement.offsetWidth;
125287
+ if (this.DivElement.style.height && this.DivElement.style.width)
125288
+ {
125289
+ if (this.DivElement.style.height.includes("px"))
125290
+ height=parseInt(this.DivElement.style.height.replace("px",""));
125291
+ if (this.DivElement.style.width.includes("px"))
125292
+ width=parseInt(this.DivElement.style.width.replace("px",""));
125293
+ }
125294
+
125287
125295
  this.CanvasElement.height=height;
125288
- this.CanvasElement.width=parseInt(this.DivElement.style.width.replace("px",""));
125296
+ this.CanvasElement.width=width;
125289
125297
  this.CanvasElement.style.width=this.CanvasElement.width+'px';
125290
125298
  this.CanvasElement.style.height=this.CanvasElement.height+'px';
125291
125299
 
@@ -125325,6 +125333,8 @@ function JSReportChart(divElement)
125325
125333
  this.JSChartContainer=chart;
125326
125334
  this.DivElement.JSChart=this; //div中保存一份
125327
125335
 
125336
+ if (option.EnableResize==true) this.CreateResizeListener();
125337
+
125328
125338
  if (option.EnablePopMenuV2===true) chart.InitalPopMenu();
125329
125339
  if (option.EnableTooltip)
125330
125340
  {
@@ -125416,6 +125426,19 @@ function JSReportChart(divElement)
125416
125426
  chart.Frame.ChartBorder.Bottom*=pixelTatio;
125417
125427
  }
125418
125428
 
125429
+ this.CreateResizeListener=function()
125430
+ {
125431
+ this.ResizeListener = new ResizeObserver((entries)=>{ this.OnDivResize(entries); });
125432
+ this.ResizeListener.observe(this.DivElement);
125433
+ }
125434
+
125435
+ this.OnDivResize=function(entries)
125436
+ {
125437
+ JSConsole.Chart.Log("[JSReportChart::OnDivResize] entries=", entries);
125438
+
125439
+ this.OnSize();
125440
+ }
125441
+
125419
125442
  /////////////////////////////////////////////////////////////////////////////
125420
125443
  //对外接口
125421
125444
 
@@ -126960,7 +126983,7 @@ function JSReportChartContainer(uielement)
126960
126983
  var tooltipData=report.GetTooltipData(x,y); //单元格提示信息
126961
126984
  if (tooltipData)
126962
126985
  {
126963
- this.LastMouseStatus.TooltipStatus={ X:x, Y:y, Data:tooltipData };
126986
+ this.LastMouseStatus.TooltipStatus={ X:e.clientX, Y:e.clientY, Data:tooltipData };
126964
126987
  bDrawTooltip=true;
126965
126988
  }
126966
126989
  }
@@ -128172,6 +128195,7 @@ function JSReportChartContainer(uielement)
128172
128195
  {
128173
128196
  this.ExecuteMenuCommand(tabData.Tab.CommandID, [tabData.Tab.ID]);
128174
128197
  this.SetSelectedTab(tabData.Index);
128198
+ redraw=true;
128175
128199
  }
128176
128200
  }
128177
128201
 
@@ -128270,6 +128294,7 @@ function JSReportChartContainer(uielement)
128270
128294
 
128271
128295
  case REPORT_COLUMN_ID.VOL_IN_ID:
128272
128296
  case REPORT_COLUMN_ID.VOL_OUT_ID:
128297
+ case REPORT_COLUMN_ID.DATE_ID:
128273
128298
 
128274
128299
  return this.LocalNumberSort(left, right, column, sortType);
128275
128300
  case REPORT_COLUMN_ID.CUSTOM_NUMBER_TEXT_ID: //自定义数值字段
@@ -128444,6 +128469,31 @@ function JSReportChartContainer(uielement)
128444
128469
  }
128445
128470
  }
128446
128471
 
128472
+ this.LoacCustomStringSort=function(left, right, column, sortType)
128473
+ {
128474
+ var leftValue="", rightValue="";
128475
+ if (sortType==2) rightValue=leftValue="啊啊啊啊啊";
128476
+
128477
+ var value=this.GetStockExtendData(left, column);
128478
+ if (IFrameSplitOperator.IsString(value)) leftValue=value;
128479
+
128480
+ var value=this.GetStockExtendData(right, column);
128481
+ if (IFrameSplitOperator.IsString(value)) rightValue=value;
128482
+
128483
+ if (sortType==1)
128484
+ {
128485
+ if (rightValue<leftValue) return -1;
128486
+ else if (rightValue<leftValue) return 1;
128487
+ else return 0;
128488
+ }
128489
+ else
128490
+ {
128491
+ if (leftValue<rightValue) return -1;
128492
+ else if (leftValue>rightValue) return 1;
128493
+ else return 0;
128494
+ }
128495
+ }
128496
+
128447
128497
  this.RequestStockSortData=function(column, filedid, sortType)
128448
128498
  {
128449
128499
  var chart=this.ChartPaint[0];
@@ -128750,6 +128800,8 @@ var MAP_COLUMN_FIELD=new Map([
128750
128800
  [REPORT_COLUMN_ID.VOL_OUT_ID,"VolOut"],
128751
128801
 
128752
128802
  [REPORT_COLUMN_ID.NAME_EX_ID, "NameEx"],
128803
+
128804
+ [REPORT_COLUMN_ID.DATE_ID, "Date"],
128753
128805
  ]);
128754
128806
 
128755
128807
  function ChartReport()
@@ -128882,7 +128934,11 @@ function ChartReport()
128882
128934
  this.BottomToolbarHeight=0; //底部工具条高度
128883
128935
  this.IsShowAllColumn=false; //是否已显示所有列
128884
128936
 
128885
- this.Column= //{ Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:文字最大宽度 , TextColor:文字颜色, Sort:0=不支持排序 1=本地排序 0=远程排序 }
128937
+ //{
128938
+ // Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:文字最大宽度 , TextColor:文字颜色, Sort:0=不支持排序 1=本地排序 0=远程排序,
128939
+ // Icon:{ Family:"iconfont", Size:12, Symbol:"", Margin: { Left:, Bottom }}
128940
+ //}
128941
+ this.Column=
128886
128942
  [
128887
128943
  { Type:REPORT_COLUMN_ID.INDEX_ID, Title:"序号", TextAlign:"center", Width:null, TextColor:g_JSChartResource.Report.FieldColor.Index, MaxText:"8888"},
128888
128944
  { Type:REPORT_COLUMN_ID.SYMBOL_ID, Title:"代码", TextAlign:"left", Width:null, TextColor:g_JSChartResource.Report.FieldColor.Symbol, MaxText:"888888"},
@@ -128997,6 +129053,7 @@ function ChartReport()
128997
129053
  if (IFrameSplitOperator.IsBool(item.EnableDragWidth)) colItem.EnableDragWidth=item.EnableDragWidth;
128998
129054
  if (IFrameSplitOperator.IsBool(item.IsDrawCallback)) colItem.IsDrawCallback=item.IsDrawCallback;
128999
129055
  else colItem.IsDrawCallback=false;
129056
+ if (item.Icon) colItem.Icon=item.Icon;
129000
129057
 
129001
129058
  if (item.Sort==1 || item.Sort==2) //1本地排序 2=远程排序
129002
129059
  {
@@ -129302,6 +129359,17 @@ function ChartReport()
129302
129359
 
129303
129360
  item.Width=itemWidth+4+this.ItemMergin.Left+this.ItemMergin.Right;
129304
129361
  }
129362
+
129363
+ if (item.Icon && item.Icon.Symbol)
129364
+ {
129365
+ item.Width+=item.Icon.Size;
129366
+ if (item.Icon.Margin)
129367
+ {
129368
+ var margin=item.Icon.Margin;
129369
+ if (IFrameSplitOperator.IsNumber(margin.Left)) item.Width+=margin.Left;
129370
+ if (IFrameSplitOperator.IsNumber(margin.Right)) item.Width+=margin.Right;
129371
+ }
129372
+ }
129305
129373
  }
129306
129374
 
129307
129375
  this.Canvas.font=this.HeaderFont;
@@ -129361,16 +129429,36 @@ function ChartReport()
129361
129429
  this.DrawItemBG({ Rect:rtBG, BGColor:item.HeaderBGColor });
129362
129430
  }
129363
129431
 
129432
+ var iconWidth=0;
129433
+ if (item.Icon && item.Icon.Symbol) //图标
129434
+ {
129435
+ var iconWidth=item.Icon.Size;
129436
+ if (item.Icon.Margin)
129437
+ {
129438
+ var margin=item.Icon.Margin;
129439
+ if (IFrameSplitOperator.IsNumber(margin.Left)) iconWidth+=margin.Left;
129440
+ if (IFrameSplitOperator.IsNumber(margin.Right)) iconWidth+=margin.Right;
129441
+ }
129442
+ }
129443
+ textWidth-=iconWidth;
129444
+
129364
129445
  if (item.HeaderColor) this.Canvas.fillStyle=item.HeaderColor;
129365
129446
  else this.Canvas.fillStyle=this.HeaderColor;
129366
129447
 
129448
+ var textSize={ }
129367
129449
  if (this.SortInfo && this.SortInfo.Field==i && this.SortInfo.Sort>0)
129368
129450
  {
129369
- this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort);
129451
+ this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort, textSize);
129370
129452
  }
129371
129453
  else
129372
129454
  {
129373
- this.DrawText(item.Title,item.TextAlign,x,y,textWidth);
129455
+ this.DrawText(item.Title,item.TextAlign,x,y,textWidth,textSize);
129456
+ }
129457
+
129458
+ if (iconWidth>0)
129459
+ {
129460
+ this.DrawHeaderIcon(item.Icon, textSize.Right, y, i, item);
129461
+ this.Canvas.font=this.HeaderFont;
129374
129462
  }
129375
129463
 
129376
129464
  this.Canvas.fillStyle=this.HeaderColor;
@@ -129393,44 +129481,91 @@ function ChartReport()
129393
129481
  this.DrawItemBG({ Rect:rtBG, BGColor:item.HeaderBGColor });
129394
129482
  }
129395
129483
 
129484
+ var iconWidth=0;
129485
+ if (item.Icon && item.Icon.Symbol) //图标
129486
+ {
129487
+ var iconWidth=item.Icon.Size;
129488
+ if (item.Icon.Margin)
129489
+ {
129490
+ var margin=item.Icon.Margin;
129491
+ if (IFrameSplitOperator.IsNumber(margin.Left)) iconWidth+=margin.Left;
129492
+ if (IFrameSplitOperator.IsNumber(margin.Right)) iconWidth+=margin.Right;
129493
+ }
129494
+ }
129495
+
129496
+ textWidth-=iconWidth;
129497
+
129396
129498
  if (item.HeaderColor) this.Canvas.fillStyle=item.HeaderColor;
129397
129499
  else this.Canvas.fillStyle=this.HeaderColor;
129398
129500
 
129501
+ var textSize={ }
129399
129502
  if (this.SortInfo && this.SortInfo.Field==i && this.SortInfo.Sort>0)
129400
129503
  {
129401
- this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort);
129504
+ this.DrawSortHeader(item.Title,item.TextAlign,x,y,textWidth,this.SortInfo.Sort,textSize);
129402
129505
  }
129403
129506
  else
129404
129507
  {
129405
- this.DrawText(item.Title,item.TextAlign,x,y,textWidth);
129508
+ this.DrawText(item.Title,item.TextAlign,x,y,textWidth,textSize);
129509
+ }
129510
+
129511
+ if (iconWidth>0)
129512
+ {
129513
+ this.DrawHeaderIcon(item.Icon, textSize.Right, y, i, item);
129514
+ this.Canvas.font=this.HeaderFont;
129406
129515
  }
129407
129516
 
129408
129517
  textLeft+=item.Width;
129409
129518
  }
129410
129519
  }
129411
129520
 
129412
- this.DrawText=function(text, textAlign, x, y, textWidth)
129521
+ this.DrawText=function(text, textAlign, x, y, cellWidth, textSize)
129413
129522
  {
129523
+ var textWidth=this.Canvas.measureText(text).width;
129414
129524
  if (textAlign=='center')
129415
129525
  {
129416
- x=x+textWidth/2;
129417
- this.Canvas.textAlign="center";
129526
+ x=x+(cellWidth-textWidth)/2;
129418
129527
  }
129419
129528
  else if (textAlign=='right')
129420
129529
  {
129421
- x=x+textWidth;
129422
- this.Canvas.textAlign="right";
129423
- }
129424
- else
129425
- {
129426
- this.Canvas.textAlign="left";
129530
+ x=x+cellWidth-textWidth;
129427
129531
  }
129428
129532
 
129533
+ this.Canvas.textAlign="left";
129429
129534
  this.Canvas.textBaseline="middle";
129430
129535
  this.Canvas.fillText(text,x,y);
129536
+
129537
+ if (textSize)
129538
+ {
129539
+ textSize.Right=x+textWidth;
129540
+ textSize.Width=textWidth;
129541
+ }
129431
129542
  }
129432
129543
 
129433
- this.DrawSortHeader=function(text, textAlign, x, y, width, sortType)
129544
+ this.DrawHeaderIcon=function(icon, x, y, index, column)
129545
+ {
129546
+ var iconFont=`${icon.Size}px ${icon.Family}`;
129547
+ this.Canvas.font=iconFont;
129548
+ this.Canvas.textAlign="left";
129549
+ if (icon.Color) this.Canvas.fillStyle=icon.Color;
129550
+
129551
+ var xIcon=x;
129552
+ var yIcon=y;
129553
+ if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Left)) xIcon+=icon.Margin.Left;
129554
+ if (icon.Margin && IFrameSplitOperator.IsNumber(icon.Margin.Bottom)) yIcon-=icon.Margin.Bottom;
129555
+ this.Canvas.fillText(icon.Symbol, xIcon, yIcon);
129556
+
129557
+ if (icon.Tooltip)
129558
+ {
129559
+ var rtIcon={ Left:xIcon, Top:yIcon-icon.Size/2, Width:icon.Size, Height:icon.Size };
129560
+ rtIcon.Right=rtIcon.Left+rtIcon.Width;
129561
+ rtIcon.Bottom=rtIcon.Top+rtIcon.Height;
129562
+
129563
+ var tooltipData={ Rect:rtIcon, Type:2, Column:column, Index:index, Data:icon.Tooltip.Data };
129564
+ this.TooltipRect.push(tooltipData);
129565
+ }
129566
+ }
129567
+
129568
+ this.DrawSortHeader=function(text, textAlign, x, y, width, sortType,textSize)
129434
129569
  {
129435
129570
  var sortText=sortType==1?"↓":"↑";
129436
129571
  var sortTextWidth=this.Canvas.measureText(sortText).width;
@@ -129446,15 +129581,17 @@ function ChartReport()
129446
129581
  {
129447
129582
  x=(x+width)-sortTextWidth-textWidth;
129448
129583
  }
129449
- else
129450
- {
129451
-
129452
- }
129453
129584
 
129454
129585
  this.Canvas.fillText(text,x,y);
129455
129586
  this.Canvas.fillStyle=this.SortColor;
129456
129587
  this.Canvas.fillText(sortText,x+textWidth,y);
129457
129588
  this.Canvas.fillStyle=this.HeaderColor;
129589
+
129590
+ if (textSize)
129591
+ {
129592
+ textSize.Right=x+textWidth+sortTextWidth;
129593
+ textSize.Width=textWidth+sortTextWidth;
129594
+ }
129458
129595
  }
129459
129596
 
129460
129597
 
@@ -132063,7 +132200,7 @@ function ChartCellTooltip()
132063
132200
  if (item.TitleColor) this.Canvas.fillStyle=item.TitleColor;
132064
132201
  else this.Canvas.fillStyle=this.TextColor;
132065
132202
  this.Canvas.fillText(item.Title,xText,yText,itemSize.TitleWidth);
132066
- xText+=itemSize.titleWidth;
132203
+ xText+=itemSize.TitleWidth;
132067
132204
  if (IFrameSplitOperator.IsNumber(item.Space)) xText+=item.Space;
132068
132205
  }
132069
132206
 
@@ -139052,7 +139189,7 @@ function HQChartScriptWorker()
139052
139189
 
139053
139190
 
139054
139191
 
139055
- var HQCHART_VERSION="1.1.13530";
139192
+ var HQCHART_VERSION="1.1.13540";
139056
139193
 
139057
139194
  function PrintHQChartVersion()
139058
139195
  {