hqchart 1.1.14280 → 1.1.14283

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.
@@ -31501,6 +31501,225 @@ function ChartKLineTable()
31501
31501
  }
31502
31502
  }
31503
31503
 
31504
+ //表格
31505
+ function ChartSimpleTable()
31506
+ {
31507
+ this.newMethod=IChartPainting; //派生
31508
+ this.newMethod();
31509
+ delete this.newMethod;
31510
+
31511
+ this.ClassName='ChartSimpleTable'; //类名
31512
+ //this.Data;
31513
+
31514
+ this.TextFontConfig=CloneData(g_JSChartResource.ChartSimpleTable.TextFont);
31515
+ this.ItemMargin=CloneData(g_JSChartResource.ChartSimpleTable.ItemMargin);
31516
+ this.TextColor=g_JSChartResource.ChartSimpleTable.TextColor; //默认颜色
31517
+ this.BGColor=g_JSChartResource.ChartSimpleTable.BGColor; //背景色
31518
+ this.BorderColor=g_JSChartResource.ChartSimpleTable.BorderColor; //边框颜色
31519
+ this.Offset={ X:-3, Y:0 }, //位置偏移
31520
+
31521
+
31522
+ this.DefaultCellWidth=30;
31523
+
31524
+ this.RectClient={ };
31525
+ this.AryColumnCache=[]; //列缓存
31526
+ this.TextFontHeight;
31527
+ this.TextFont;
31528
+ this.RowHeight; //行高
31529
+
31530
+ this.ReloadResource=function(resource)
31531
+ {
31532
+ this.TextFontConfig=CloneData(g_JSChartResource.ChartSimpleTable.TextFont);
31533
+ this.ItemMargin=CloneData(g_JSChartResource.ChartSimpleTable.ItemMargin);
31534
+ this.TextColor=g_JSChartResource.ChartSimpleTable.TextColor; //默认颜色
31535
+ this.BGColor=g_JSChartResource.ChartSimpleTable.BGColor; //背景色
31536
+ this.BorderColor=g_JSChartResource.ChartSimpleTable.BorderColor; //边框颜色
31537
+ }
31538
+
31539
+ this.CalculateSize=function()
31540
+ {
31541
+ this.AryColumnCache=[];
31542
+
31543
+ var pixelRatio=GetDevicePixelRatio();
31544
+ this.TextFont=`${this.TextFontConfig.Size*pixelRatio}px ${ this.TextFontConfig.Name}`;
31545
+ this.TextFontHeight=this.GetFontHeight(this.TextFont,"擎");
31546
+ this.RowHeight=this.TextFontHeight+this.ItemMargin.Top+this.ItemMargin.Bottom;
31547
+
31548
+ var rowCount=this.Data.Data.length;
31549
+ for(var i=0, j=0;i<rowCount;++i)
31550
+ {
31551
+ var rowItem=this.Data.Data[i];
31552
+ for(j=0;j<rowItem.AryCell.length;++j)
31553
+ {
31554
+ if (!this.AryColumnCache[j]) this.AryColumnCache[j]={ Width:this.DefaultCellWidth };
31555
+ var colItem=this.AryColumnCache[j];
31556
+
31557
+ var cellItem=rowItem.AryCell[j];
31558
+ var textWidth=this.Canvas.measureText(cellItem.Text).width;
31559
+ if (colItem.Width<textWidth) colItem.Width=textWidth;
31560
+ }
31561
+ }
31562
+
31563
+ var tableWidth=0;
31564
+ for(var i=0;i<this.AryColumnCache.length;++i)
31565
+ {
31566
+ var item=this.AryColumnCache[i];
31567
+ item.Width+=(this.ItemMargin.Left+this.ItemMargin.Right); //增加左右间距
31568
+
31569
+ tableWidth+=item.Width;
31570
+ }
31571
+
31572
+ this.RectClient={ Width:tableWidth, Height:this.RowHeight*rowCount };
31573
+
31574
+ var border=this.ChartFrame.GetBorder();
31575
+ this.RectClient.Right=border.Right+this.Offset.X;
31576
+ this.RectClient.Top=border.TopEx+this.Offset.Y;
31577
+ this.RectClient.Left=this.RectClient.Right-this.RectClient.Width;
31578
+ this.RectClient.Bottom=this.RectClient.Top+this.RectClient.Height;
31579
+ }
31580
+
31581
+ this.Draw=function()
31582
+ {
31583
+ if (!this.IsShow || this.ChartFrame.IsMinSize) return;
31584
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
31585
+
31586
+ var isHScreen=(this.ChartFrame.IsHScreen===true);
31587
+ if (isHScreen) return;
31588
+
31589
+ this.CalculateSize();
31590
+
31591
+ if (this.BGColor)
31592
+ {
31593
+ this.Canvas.fillStyle=this.BGColor;
31594
+ this.Canvas.fillRect(this.RectClient.Left, this.RectClient.Top, this.RectClient.Width, this.RectClient.Height);
31595
+ }
31596
+
31597
+ var itemHeight=this.RowHeight;
31598
+ this.Canvas.font=this.TextFont;
31599
+ this.Canvas.textBaseline='bottom';
31600
+ this.Canvas.textAlign='left';
31601
+ var rtRow={ Left:this.RectClient.Left, Top:this.RectClient.Top, Width:this.RectClient.Width, Height:itemHeight };
31602
+ rtRow.Right=rtRow.Left+rtRow.Width;
31603
+ rtRow.Bottom=rtRow.Top+rtRow.Height;
31604
+ var rowCount=this.Data.Data.length;
31605
+ for(var i=0;i<rowCount;++i)
31606
+ {
31607
+ var rowItem=this.Data.Data[i];
31608
+ this.DrawRow(rowItem, rtRow);
31609
+
31610
+ rtRow.Top+=itemHeight;
31611
+ rtRow.Bottom+=itemHeight;
31612
+ }
31613
+
31614
+ this.DrawBorder();
31615
+ }
31616
+
31617
+ this.DrawBorder=function()
31618
+ {
31619
+ if (!this.BorderColor) return;
31620
+
31621
+ var rowCount=this.Data.Data.length;
31622
+ var colCount=this.AryColumnCache.length;
31623
+ this.Canvas.strokeStyle=this.BorderColor;
31624
+ this.Canvas.beginPath();
31625
+
31626
+ //横线
31627
+ var rowTop=this.RectClient.Top;
31628
+ var left=this.RectClient.Left, right=this.RectClient.Right;
31629
+ var bottom=this.RectClient.Bottom, top=this.RectClient.Top;
31630
+ for(var i=0;i<rowCount;++i)
31631
+ {
31632
+ if (i==0)
31633
+ {
31634
+ var drawTop=ToFixedPoint(rowTop);
31635
+ this.Canvas.moveTo(left,drawTop);
31636
+ this.Canvas.lineTo(right,drawTop);
31637
+ }
31638
+
31639
+ var drawTop=ToFixedPoint(rowTop+this.RowHeight);
31640
+ this.Canvas.moveTo(left,drawTop);
31641
+ this.Canvas.lineTo(right,drawTop);
31642
+
31643
+ rowTop+=this.RowHeight;
31644
+ }
31645
+
31646
+ //竖线
31647
+ var columnLeft=this.RectClient.Left;
31648
+ for(var i=0;i<colCount; ++i)
31649
+ {
31650
+ var item=this.AryColumnCache[i];
31651
+
31652
+ if (i==0)
31653
+ {
31654
+ var drawLeft=ToFixedPoint(columnLeft);
31655
+ this.Canvas.moveTo(drawLeft,top);
31656
+ this.Canvas.lineTo(drawLeft,bottom);
31657
+ }
31658
+
31659
+ var drawLeft=ToFixedPoint(columnLeft+item.Width);
31660
+ this.Canvas.moveTo(drawLeft,top);
31661
+ this.Canvas.lineTo(drawLeft,bottom);
31662
+
31663
+ columnLeft+=item.Width;
31664
+ }
31665
+
31666
+ this.Canvas.stroke();
31667
+ }
31668
+
31669
+ this.DrawRow=function(data, rtRow)
31670
+ {
31671
+ if (!IFrameSplitOperator.IsNonEmptyArray(data.AryCell)) return;
31672
+
31673
+ var x=rtRow.Left,y=rtRow.Top, width=rtRow.Width;
31674
+ for(var i=0;i<data.AryCell.length;++i)
31675
+ {
31676
+ var item=data.AryCell[i];
31677
+ var colItem=this.AryColumnCache[i];
31678
+
31679
+ var rtBG={Left:x, Top:rtRow.Top, Bottom:rtRow.Bottom, Height:this.RowHeight, Width:colItem.Width };
31680
+ rtBG.Right=rtBG.Top+rtBG.Height;
31681
+
31682
+ if (item)
31683
+ {
31684
+ if (item.BGColor)
31685
+ {
31686
+ this.Canvas.fillStyle=item.BGColor;
31687
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
31688
+ }
31689
+
31690
+ if (item.Text && rtBG.Width>10)
31691
+ {
31692
+ if (item.Color) this.Canvas.fillStyle=item.Color;
31693
+ else this.Canvas.fillStyle=this.TextColor
31694
+
31695
+ var xText=x+this.ItemMargin.Left;
31696
+ var yText=rtBG.Bottom-this.ItemMargin.Bottom;
31697
+
31698
+ if (item.TextAlign=='right')
31699
+ {
31700
+ var textWidth=this.Canvas.measureText(item.Text).width;
31701
+ xText=rtBG.Right-this.ItemMargin.Right-textWidth;
31702
+ }
31703
+ else if (item.TextAlign=='center')
31704
+ {
31705
+ var textWidth=this.Canvas.measureText(item.Text).width;
31706
+ xText=rtBG.Left+rtBG.Width/2-textWidth/2;
31707
+ }
31708
+
31709
+ this.Canvas.fillText(item.Text,xText,yText);
31710
+ }
31711
+ }
31712
+
31713
+ x+=rtBG.Width;
31714
+ }
31715
+ }
31716
+
31717
+ this.GetMaxMin=function()
31718
+ {
31719
+ return { Min:null, Max:null };
31720
+ }
31721
+ }
31722
+
31504
31723
  //分钟成交量 支持横屏
31505
31724
  function ChartMinuteVolumBar()
31506
31725
  {
@@ -70097,6 +70316,15 @@ function JSChartResource()
70097
70316
  ItemMergin:{ Left:5, Right:5, Top:4, Bottom:2 },
70098
70317
  };
70099
70318
 
70319
+ this.ChartSimpleTable=
70320
+ {
70321
+ TextFont:{ Family:'微软雅黑' , Size:14 },
70322
+ ItemMargin:{ Left:5, Right:5, Top:4, Bottom:2 },
70323
+ TextColor:"rgb(0,0,0)",
70324
+ BGColor:"rgba(255,255,255,0.95)",
70325
+ BorderColor:"rgb(217,217,217)",
70326
+ }
70327
+
70100
70328
  //手机端tooltip
70101
70329
  this.TooltipPaint = {
70102
70330
  BGColor:'rgba(250,250,250,0.8)', //背景色
@@ -71325,6 +71553,8 @@ function JSChartResource()
71325
71553
  if (style.Title.PositionColor) this.Title.PositionColor=style.Title.PositionColor;
71326
71554
  }
71327
71555
 
71556
+ if (style.ChartSimpleTable) this.SetChartSimpleTable(style.ChartSimpleTable);
71557
+
71328
71558
  if (style.DRAWICON)
71329
71559
  {
71330
71560
  if (style.DRAWICON.Icon)
@@ -71584,7 +71814,7 @@ function JSChartResource()
71584
71814
  {
71585
71815
  var mergin=header.Mergin;
71586
71816
  if (IFrameSplitOperator.IsNumber(mergin.Left)) this.DealList.Header.Mergin.Left=mergin.Left;
71587
- if (IFrameSplitOperator.IsNumber(mergin.Right)) this.DealList.Header.Mergin.Left=mergin.Right;
71817
+ if (IFrameSplitOperator.IsNumber(mergin.Right)) this.DealList.Header.Mergin.Right=mergin.Right;
71588
71818
  if (IFrameSplitOperator.IsNumber(mergin.Top)) this.DealList.Header.Mergin.Top=mergin.Top;
71589
71819
  if (IFrameSplitOperator.IsNumber(mergin.Bottom)) this.DealList.Header.Mergin.Bottom=mergin.Bottom;
71590
71820
  }
@@ -72370,6 +72600,32 @@ function JSChartResource()
72370
72600
  if (IFrameSplitOperator.IsBool(style.AddIndexWindow)) dest.AddIndexWindow=style.AddIndexWindow;
72371
72601
  }
72372
72602
 
72603
+
72604
+ this.SetChartSimpleTable=function(style)
72605
+ {
72606
+ var dest=this.ChartSimpleTable;
72607
+
72608
+ if (style.TextColor) dest.TextColor=style.TextColor;
72609
+ if (style.BGColor) dest.BGColor=style.BGColor;
72610
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
72611
+
72612
+ if (style.TextFont)
72613
+ {
72614
+ var item=style.TextFont;
72615
+ if (item.Name) dest.TextFont.Name=item.Name;
72616
+ if (IFrameSplitOperator.IsNumber(item.Size)) dest.TextFont.Size=item.Size;
72617
+ }
72618
+
72619
+ if (style.ItemMargin)
72620
+ {
72621
+ var margin=style.ItemMargin;
72622
+ if (IFrameSplitOperator.IsNumber(margin.Left)) dest.ItemMargin.Left=margin.Left;
72623
+ if (IFrameSplitOperator.IsNumber(margin.Right)) dest.ItemMargin.Right=margin.Right;
72624
+ if (IFrameSplitOperator.IsNumber(margin.Top)) dest.ItemMargin.Top=margin.Top;
72625
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) dest.ItemMargin.Bottom=margin.Bottom;
72626
+ }
72627
+ }
72628
+
72373
72629
  }
72374
72630
 
72375
72631
  var g_JSChartResource=new JSChartResource();
@@ -534,6 +534,13 @@ function GetBlackStyle()
534
534
  }
535
535
  },
536
536
 
537
+ ChartSimpleTable:
538
+ {
539
+ TextColor:"rgb(250,250,250)",
540
+ BGColor:"rgba(0,0,0,0.85)",
541
+ BorderColor:"rgb(90,90,90)",
542
+ },
543
+
537
544
  ChartDrawVolProfile:
538
545
  {
539
546
  BGColor:"rgba(244,250,254,0.3)",