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.
@@ -35470,6 +35470,225 @@ function ChartKLineTable()
35470
35470
  }
35471
35471
  }
35472
35472
 
35473
+ //表格
35474
+ function ChartSimpleTable()
35475
+ {
35476
+ this.newMethod=IChartPainting; //派生
35477
+ this.newMethod();
35478
+ delete this.newMethod;
35479
+
35480
+ this.ClassName='ChartSimpleTable'; //类名
35481
+ //this.Data;
35482
+
35483
+ this.TextFontConfig=CloneData(g_JSChartResource.ChartSimpleTable.TextFont);
35484
+ this.ItemMargin=CloneData(g_JSChartResource.ChartSimpleTable.ItemMargin);
35485
+ this.TextColor=g_JSChartResource.ChartSimpleTable.TextColor; //默认颜色
35486
+ this.BGColor=g_JSChartResource.ChartSimpleTable.BGColor; //背景色
35487
+ this.BorderColor=g_JSChartResource.ChartSimpleTable.BorderColor; //边框颜色
35488
+ this.Offset={ X:-3, Y:0 }, //位置偏移
35489
+
35490
+
35491
+ this.DefaultCellWidth=30;
35492
+
35493
+ this.RectClient={ };
35494
+ this.AryColumnCache=[]; //列缓存
35495
+ this.TextFontHeight;
35496
+ this.TextFont;
35497
+ this.RowHeight; //行高
35498
+
35499
+ this.ReloadResource=function(resource)
35500
+ {
35501
+ this.TextFontConfig=CloneData(g_JSChartResource.ChartSimpleTable.TextFont);
35502
+ this.ItemMargin=CloneData(g_JSChartResource.ChartSimpleTable.ItemMargin);
35503
+ this.TextColor=g_JSChartResource.ChartSimpleTable.TextColor; //默认颜色
35504
+ this.BGColor=g_JSChartResource.ChartSimpleTable.BGColor; //背景色
35505
+ this.BorderColor=g_JSChartResource.ChartSimpleTable.BorderColor; //边框颜色
35506
+ }
35507
+
35508
+ this.CalculateSize=function()
35509
+ {
35510
+ this.AryColumnCache=[];
35511
+
35512
+ var pixelRatio=GetDevicePixelRatio();
35513
+ this.TextFont=`${this.TextFontConfig.Size*pixelRatio}px ${ this.TextFontConfig.Name}`;
35514
+ this.TextFontHeight=this.GetFontHeight(this.TextFont,"擎");
35515
+ this.RowHeight=this.TextFontHeight+this.ItemMargin.Top+this.ItemMargin.Bottom;
35516
+
35517
+ var rowCount=this.Data.Data.length;
35518
+ for(var i=0, j=0;i<rowCount;++i)
35519
+ {
35520
+ var rowItem=this.Data.Data[i];
35521
+ for(j=0;j<rowItem.AryCell.length;++j)
35522
+ {
35523
+ if (!this.AryColumnCache[j]) this.AryColumnCache[j]={ Width:this.DefaultCellWidth };
35524
+ var colItem=this.AryColumnCache[j];
35525
+
35526
+ var cellItem=rowItem.AryCell[j];
35527
+ var textWidth=this.Canvas.measureText(cellItem.Text).width;
35528
+ if (colItem.Width<textWidth) colItem.Width=textWidth;
35529
+ }
35530
+ }
35531
+
35532
+ var tableWidth=0;
35533
+ for(var i=0;i<this.AryColumnCache.length;++i)
35534
+ {
35535
+ var item=this.AryColumnCache[i];
35536
+ item.Width+=(this.ItemMargin.Left+this.ItemMargin.Right); //增加左右间距
35537
+
35538
+ tableWidth+=item.Width;
35539
+ }
35540
+
35541
+ this.RectClient={ Width:tableWidth, Height:this.RowHeight*rowCount };
35542
+
35543
+ var border=this.ChartFrame.GetBorder();
35544
+ this.RectClient.Right=border.Right+this.Offset.X;
35545
+ this.RectClient.Top=border.TopEx+this.Offset.Y;
35546
+ this.RectClient.Left=this.RectClient.Right-this.RectClient.Width;
35547
+ this.RectClient.Bottom=this.RectClient.Top+this.RectClient.Height;
35548
+ }
35549
+
35550
+ this.Draw=function()
35551
+ {
35552
+ if (!this.IsShow || this.ChartFrame.IsMinSize) return;
35553
+ if (!this.Data || !IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return;
35554
+
35555
+ var isHScreen=(this.ChartFrame.IsHScreen===true);
35556
+ if (isHScreen) return;
35557
+
35558
+ this.CalculateSize();
35559
+
35560
+ if (this.BGColor)
35561
+ {
35562
+ this.Canvas.fillStyle=this.BGColor;
35563
+ this.Canvas.fillRect(this.RectClient.Left, this.RectClient.Top, this.RectClient.Width, this.RectClient.Height);
35564
+ }
35565
+
35566
+ var itemHeight=this.RowHeight;
35567
+ this.Canvas.font=this.TextFont;
35568
+ this.Canvas.textBaseline='bottom';
35569
+ this.Canvas.textAlign='left';
35570
+ var rtRow={ Left:this.RectClient.Left, Top:this.RectClient.Top, Width:this.RectClient.Width, Height:itemHeight };
35571
+ rtRow.Right=rtRow.Left+rtRow.Width;
35572
+ rtRow.Bottom=rtRow.Top+rtRow.Height;
35573
+ var rowCount=this.Data.Data.length;
35574
+ for(var i=0;i<rowCount;++i)
35575
+ {
35576
+ var rowItem=this.Data.Data[i];
35577
+ this.DrawRow(rowItem, rtRow);
35578
+
35579
+ rtRow.Top+=itemHeight;
35580
+ rtRow.Bottom+=itemHeight;
35581
+ }
35582
+
35583
+ this.DrawBorder();
35584
+ }
35585
+
35586
+ this.DrawBorder=function()
35587
+ {
35588
+ if (!this.BorderColor) return;
35589
+
35590
+ var rowCount=this.Data.Data.length;
35591
+ var colCount=this.AryColumnCache.length;
35592
+ this.Canvas.strokeStyle=this.BorderColor;
35593
+ this.Canvas.beginPath();
35594
+
35595
+ //横线
35596
+ var rowTop=this.RectClient.Top;
35597
+ var left=this.RectClient.Left, right=this.RectClient.Right;
35598
+ var bottom=this.RectClient.Bottom, top=this.RectClient.Top;
35599
+ for(var i=0;i<rowCount;++i)
35600
+ {
35601
+ if (i==0)
35602
+ {
35603
+ var drawTop=ToFixedPoint(rowTop);
35604
+ this.Canvas.moveTo(left,drawTop);
35605
+ this.Canvas.lineTo(right,drawTop);
35606
+ }
35607
+
35608
+ var drawTop=ToFixedPoint(rowTop+this.RowHeight);
35609
+ this.Canvas.moveTo(left,drawTop);
35610
+ this.Canvas.lineTo(right,drawTop);
35611
+
35612
+ rowTop+=this.RowHeight;
35613
+ }
35614
+
35615
+ //竖线
35616
+ var columnLeft=this.RectClient.Left;
35617
+ for(var i=0;i<colCount; ++i)
35618
+ {
35619
+ var item=this.AryColumnCache[i];
35620
+
35621
+ if (i==0)
35622
+ {
35623
+ var drawLeft=ToFixedPoint(columnLeft);
35624
+ this.Canvas.moveTo(drawLeft,top);
35625
+ this.Canvas.lineTo(drawLeft,bottom);
35626
+ }
35627
+
35628
+ var drawLeft=ToFixedPoint(columnLeft+item.Width);
35629
+ this.Canvas.moveTo(drawLeft,top);
35630
+ this.Canvas.lineTo(drawLeft,bottom);
35631
+
35632
+ columnLeft+=item.Width;
35633
+ }
35634
+
35635
+ this.Canvas.stroke();
35636
+ }
35637
+
35638
+ this.DrawRow=function(data, rtRow)
35639
+ {
35640
+ if (!IFrameSplitOperator.IsNonEmptyArray(data.AryCell)) return;
35641
+
35642
+ var x=rtRow.Left,y=rtRow.Top, width=rtRow.Width;
35643
+ for(var i=0;i<data.AryCell.length;++i)
35644
+ {
35645
+ var item=data.AryCell[i];
35646
+ var colItem=this.AryColumnCache[i];
35647
+
35648
+ var rtBG={Left:x, Top:rtRow.Top, Bottom:rtRow.Bottom, Height:this.RowHeight, Width:colItem.Width };
35649
+ rtBG.Right=rtBG.Top+rtBG.Height;
35650
+
35651
+ if (item)
35652
+ {
35653
+ if (item.BGColor)
35654
+ {
35655
+ this.Canvas.fillStyle=item.BGColor;
35656
+ this.Canvas.fillRect(rtBG.Left, rtBG.Top, rtBG.Width, rtBG.Height);
35657
+ }
35658
+
35659
+ if (item.Text && rtBG.Width>10)
35660
+ {
35661
+ if (item.Color) this.Canvas.fillStyle=item.Color;
35662
+ else this.Canvas.fillStyle=this.TextColor
35663
+
35664
+ var xText=x+this.ItemMargin.Left;
35665
+ var yText=rtBG.Bottom-this.ItemMargin.Bottom;
35666
+
35667
+ if (item.TextAlign=='right')
35668
+ {
35669
+ var textWidth=this.Canvas.measureText(item.Text).width;
35670
+ xText=rtBG.Right-this.ItemMargin.Right-textWidth;
35671
+ }
35672
+ else if (item.TextAlign=='center')
35673
+ {
35674
+ var textWidth=this.Canvas.measureText(item.Text).width;
35675
+ xText=rtBG.Left+rtBG.Width/2-textWidth/2;
35676
+ }
35677
+
35678
+ this.Canvas.fillText(item.Text,xText,yText);
35679
+ }
35680
+ }
35681
+
35682
+ x+=rtBG.Width;
35683
+ }
35684
+ }
35685
+
35686
+ this.GetMaxMin=function()
35687
+ {
35688
+ return { Min:null, Max:null };
35689
+ }
35690
+ }
35691
+
35473
35692
  //分钟成交量 支持横屏
35474
35693
  function ChartMinuteVolumBar()
35475
35694
  {
@@ -74066,6 +74285,15 @@ function JSChartResource()
74066
74285
  ItemMergin:{ Left:5, Right:5, Top:4, Bottom:2 },
74067
74286
  };
74068
74287
 
74288
+ this.ChartSimpleTable=
74289
+ {
74290
+ TextFont:{ Family:'微软雅黑' , Size:14 },
74291
+ ItemMargin:{ Left:5, Right:5, Top:4, Bottom:2 },
74292
+ TextColor:"rgb(0,0,0)",
74293
+ BGColor:"rgba(255,255,255,0.95)",
74294
+ BorderColor:"rgb(217,217,217)",
74295
+ }
74296
+
74069
74297
  //手机端tooltip
74070
74298
  this.TooltipPaint = {
74071
74299
  BGColor:'rgba(250,250,250,0.8)', //背景色
@@ -75294,6 +75522,8 @@ function JSChartResource()
75294
75522
  if (style.Title.PositionColor) this.Title.PositionColor=style.Title.PositionColor;
75295
75523
  }
75296
75524
 
75525
+ if (style.ChartSimpleTable) this.SetChartSimpleTable(style.ChartSimpleTable);
75526
+
75297
75527
  if (style.DRAWICON)
75298
75528
  {
75299
75529
  if (style.DRAWICON.Icon)
@@ -75553,7 +75783,7 @@ function JSChartResource()
75553
75783
  {
75554
75784
  var mergin=header.Mergin;
75555
75785
  if (IFrameSplitOperator.IsNumber(mergin.Left)) this.DealList.Header.Mergin.Left=mergin.Left;
75556
- if (IFrameSplitOperator.IsNumber(mergin.Right)) this.DealList.Header.Mergin.Left=mergin.Right;
75786
+ if (IFrameSplitOperator.IsNumber(mergin.Right)) this.DealList.Header.Mergin.Right=mergin.Right;
75557
75787
  if (IFrameSplitOperator.IsNumber(mergin.Top)) this.DealList.Header.Mergin.Top=mergin.Top;
75558
75788
  if (IFrameSplitOperator.IsNumber(mergin.Bottom)) this.DealList.Header.Mergin.Bottom=mergin.Bottom;
75559
75789
  }
@@ -76339,6 +76569,32 @@ function JSChartResource()
76339
76569
  if (IFrameSplitOperator.IsBool(style.AddIndexWindow)) dest.AddIndexWindow=style.AddIndexWindow;
76340
76570
  }
76341
76571
 
76572
+
76573
+ this.SetChartSimpleTable=function(style)
76574
+ {
76575
+ var dest=this.ChartSimpleTable;
76576
+
76577
+ if (style.TextColor) dest.TextColor=style.TextColor;
76578
+ if (style.BGColor) dest.BGColor=style.BGColor;
76579
+ if (style.BorderColor) dest.BorderColor=style.BorderColor;
76580
+
76581
+ if (style.TextFont)
76582
+ {
76583
+ var item=style.TextFont;
76584
+ if (item.Name) dest.TextFont.Name=item.Name;
76585
+ if (IFrameSplitOperator.IsNumber(item.Size)) dest.TextFont.Size=item.Size;
76586
+ }
76587
+
76588
+ if (style.ItemMargin)
76589
+ {
76590
+ var margin=style.ItemMargin;
76591
+ if (IFrameSplitOperator.IsNumber(margin.Left)) dest.ItemMargin.Left=margin.Left;
76592
+ if (IFrameSplitOperator.IsNumber(margin.Right)) dest.ItemMargin.Right=margin.Right;
76593
+ if (IFrameSplitOperator.IsNumber(margin.Top)) dest.ItemMargin.Top=margin.Top;
76594
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) dest.ItemMargin.Bottom=margin.Bottom;
76595
+ }
76596
+ }
76597
+
76342
76598
  }
76343
76599
 
76344
76600
  var g_JSChartResource=new JSChartResource();
@@ -121213,6 +121469,29 @@ function ScriptIndex(name,script,args,option)
121213
121469
  hqChart.ChartPaint.push(chart);
121214
121470
  }
121215
121471
 
121472
+ this.CreateSimpleTable=function(hqChart,windowIndex,varItem,id)
121473
+ {
121474
+ var chart=new ChartSimpleTable();
121475
+ chart.Canvas=hqChart.Canvas;
121476
+ chart.Name=varItem.Name;
121477
+ chart.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
121478
+ chart.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
121479
+
121480
+ if (varItem.Draw && varItem.Draw.DrawData)
121481
+ {
121482
+ var drawData=varItem.Draw.DrawData;
121483
+ if (drawData.TableData) chart.Data.Data=drawData.TableData;
121484
+ if (drawData.BGColor) chart.BGColor=drawData.BGColor;
121485
+ if (drawData.BorderColor) chart.BorderColor=drawData.BorderColor;
121486
+ if (drawData.TextFont) chart.TextFontConfig=drawData.TextFont;
121487
+ if (drawData.TextColor) chart.TextColor=drawData.TextColor;
121488
+ if (IFrameSplitOperator.IsNumber(drawData.XOffset)) chart.Offset.X=drawData.XOffset;
121489
+ if (IFrameSplitOperator.IsNumber(drawData.YOffset)) chart.Offset.Y=drawData.YOffset;
121490
+ }
121491
+
121492
+ hqChart.ChartPaint.push(chart);
121493
+ }
121494
+
121216
121495
  this.CreateTradeIcon=function(hqChart,windowIndex,varItem,id)
121217
121496
  {
121218
121497
  var chart=new ChartTradeIcon();
@@ -122078,6 +122357,9 @@ function ScriptIndex(name,script,args,option)
122078
122357
  case "MULTI_POINT_LINE":
122079
122358
  this.CreateLineMultiData(hqChart,windowIndex,item,i);
122080
122359
  break;
122360
+ case "DRAW_SIMPLE_TABLE":
122361
+ this.CreateSimpleTable(hqChart,windowIndex,item,i);
122362
+ break;
122081
122363
  case "BUY":
122082
122364
  case "SELL":
122083
122365
  case "SELLSHORT":
@@ -122425,6 +122707,10 @@ function OverlayScriptIndex(name,script,args,option)
122425
122707
  this.CreateMulitHtmlDom(hqChart,windowIndex,item,i);
122426
122708
  break;
122427
122709
 
122710
+ case "DRAW_SIMPLE_TABLE":
122711
+ this.CreateSimpleTable(hqChart,windowIndex,item,i);
122712
+ break;
122713
+
122428
122714
  case "KLINE_BG":
122429
122715
  this.CreateBackgroud(hqChart,windowIndex,item,i);
122430
122716
  break;
@@ -123434,6 +123720,33 @@ function OverlayScriptIndex(name,script,args,option)
123434
123720
  frame.ChartPaint.push(chart);
123435
123721
  }
123436
123722
 
123723
+ this.CreateSimpleTable=function(hqChart,windowIndex,varItem,i)
123724
+ {
123725
+ var overlayIndex=this.OverlayIndex;
123726
+ var frame=overlayIndex.Frame;
123727
+ var chart=new ChartSimpleTable();
123728
+ chart.Canvas=hqChart.Canvas;
123729
+ chart.Name=varItem.Name;
123730
+ chart.ChartBorder=frame.Frame.ChartBorder;
123731
+ chart.ChartFrame=frame.Frame;
123732
+ chart.Identify=overlayIndex.Identify;
123733
+ chart.HQChart=hqChart;
123734
+
123735
+ if (varItem.Draw && varItem.Draw.DrawData)
123736
+ {
123737
+ var drawData=varItem.Draw.DrawData;
123738
+ if (drawData.TableData) chart.Data.Data=drawData.TableData;
123739
+ if (drawData.BGColor) chart.BGColor=drawData.BGColor;
123740
+ if (drawData.BorderColor) chart.BorderColor=drawData.BorderColor;
123741
+ if (drawData.TextFont) chart.TextFontConfig=drawData.TextFont;
123742
+ if (drawData.TextColor) chart.TextColor=drawData.TextColor;
123743
+ if (IFrameSplitOperator.IsNumber(drawData.XOffset)) chart.Offset.X=drawData.XOffset;
123744
+ if (IFrameSplitOperator.IsNumber(drawData.YOffset)) chart.Offset.Y=drawData.YOffset;
123745
+ }
123746
+
123747
+ frame.ChartPaint.push(chart);
123748
+ }
123749
+
123437
123750
  this.CreateChartVericaltLine=function(hqChart,windowIndex,varItem,id)
123438
123751
  {
123439
123752
  var overlayIndex=this.OverlayIndex;
@@ -124625,6 +124938,17 @@ function APIScriptIndex(name,script,args,option, isOverlay)
124625
124938
 
124626
124939
  result.push(outVarItem);
124627
124940
  }
124941
+ else if (draw.DrawType=="DRAW_SIMPLE_TABLE")
124942
+ {
124943
+ drawItem.Name=draw.Name;
124944
+ drawItem.Type=draw.Type;
124945
+
124946
+ drawItem.DrawType=draw.DrawType;
124947
+ drawItem.DrawData=draw.DrawData; //{ TableData:[ [ {AryCell:[{Text:, Color: }]}, ], ], BGColor:, TextFont:{ Size:, Name: } };
124948
+
124949
+ outVarItem.Draw=drawItem;
124950
+ result.push(outVarItem);
124951
+ }
124628
124952
  else
124629
124953
  {
124630
124954
  var find=g_ScriptIndexChartFactory.Get(draw.DrawType); //外部挂接
@@ -126229,6 +126553,13 @@ function GetBlackStyle()
126229
126553
  }
126230
126554
  },
126231
126555
 
126556
+ ChartSimpleTable:
126557
+ {
126558
+ TextColor:"rgb(250,250,250)",
126559
+ BGColor:"rgba(0,0,0,0.85)",
126560
+ BorderColor:"rgb(90,90,90)",
126561
+ },
126562
+
126232
126563
  ChartDrawVolProfile:
126233
126564
  {
126234
126565
  BGColor:"rgba(244,250,254,0.3)",
@@ -150368,7 +150699,7 @@ function HQChartScriptWorker()
150368
150699
 
150369
150700
 
150370
150701
 
150371
- var HQCHART_VERSION="1.1.14279";
150702
+ var HQCHART_VERSION="1.1.14282";
150372
150703
 
150373
150704
  function PrintHQChartVersion()
150374
150705
  {