hqchart 1.1.14295 → 1.1.14299

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.
@@ -35730,6 +35730,127 @@ function ChartSimpleTable()
35730
35730
  }
35731
35731
  }
35732
35732
 
35733
+
35734
+ //饼图
35735
+ function ChartPie()
35736
+ {
35737
+ this.newMethod=IChartPainting; //派生
35738
+ this.newMethod();
35739
+ delete this.newMethod;
35740
+
35741
+ this.Radius = 100; //半径默认值
35742
+ this.Width=40;
35743
+ this.Height=50;
35744
+
35745
+ //this.Distance = 30; //指示线超出圆饼的距离
35746
+ //this.txtLine = 20; // 文本下划线
35747
+ //this.paddingX = 20 / 3;// 设置文本的移动
35748
+
35749
+
35750
+
35751
+ this.RectClient={ };
35752
+
35753
+ this.Draw=function()
35754
+ {
35755
+ if (!this.Data || !this.Data.Data || !(this.Data.Data.length>0)) return this.DrawEmptyData();
35756
+
35757
+
35758
+
35759
+ let left=this.ChartBorder.GetLeft();
35760
+ let right=this.ChartBorder.GetRight();
35761
+ let top=this.ChartBorder.GetTop();
35762
+ let bottom=this.ChartBorder.GetBottom();
35763
+ let width=this.ChartBorder.GetWidth();
35764
+ let height=this.ChartBorder.GetHeight();
35765
+
35766
+ if(isNaN(this.Radius)){
35767
+ let str = this.Radius.replace("%","");
35768
+ str = str/100;
35769
+ if(width >= height){
35770
+ this.Radius = str*height;
35771
+ }
35772
+ if(width < height) this.Radius = str*width;
35773
+ }
35774
+
35775
+
35776
+ this.Canvas.save();
35777
+ this.Canvas.translate(width/2,height/2);
35778
+
35779
+ let totalValue=0; //求和
35780
+ for(let i in this.Data.Data)
35781
+ {
35782
+ totalValue += this.Data.Data[i].Value;
35783
+ }
35784
+ let start = 0;
35785
+ let end = 0;
35786
+ //画饼图
35787
+ for(let i in this.Data.Data)
35788
+ {
35789
+ let item =this.Data.Data[i];
35790
+ let rate=(item.Value/totalValue).toFixed(2); //占比
35791
+ //JSConsole.Chart.Log('[ChartPie::Draw]', i, rate, item);
35792
+
35793
+ // 绘制扇形
35794
+ this.Canvas.beginPath();
35795
+ this.Canvas.moveTo(0,0);
35796
+
35797
+ end += rate*2*Math.PI;//终止角度
35798
+ this.Canvas.strokeStyle = "white";
35799
+ this.Canvas.fillStyle = item.Color;
35800
+ this.Canvas.arc(0,0,this.Radius,start,end);
35801
+ this.Canvas.fill();
35802
+ this.Canvas.closePath();
35803
+ this.Canvas.stroke();
35804
+
35805
+ // 绘制直线
35806
+ this.Canvas.beginPath();
35807
+ this.Canvas.strokeStyle = item.Color;
35808
+ this.Canvas.moveTo(0,0);
35809
+ let x = (this.Radius + this.Distance)*Math.cos(end- (end-start)/2);
35810
+ let y = (this.Radius + this.Distance)*Math.sin(end - (end-start)/2);
35811
+ this.Canvas.lineTo(x,y);
35812
+ // JSConsole.Chart.Log(x,y,"xy")
35813
+
35814
+ // 绘制横线
35815
+ let txtLine = this.txtLine;
35816
+ let paddingX = this.paddingX;
35817
+ this.Canvas.textAlign = 'left';
35818
+ if( end - (end-start)/2 < 1.5*Math.PI && end - (end-start)/2 > 0.5*Math.PI ){
35819
+
35820
+ txtLine = - this.txtLine;
35821
+ paddingX = - this.paddingX;
35822
+ this.Canvas.textAlign = 'right';
35823
+ }
35824
+ this.Canvas.lineTo( x + txtLine, y );
35825
+ this.Canvas.stroke();
35826
+
35827
+ // 写文字
35828
+ if(item.Text){
35829
+ this.Canvas.fillText( item.Text, x + txtLine + paddingX, y );
35830
+ }else{
35831
+ let text = `${item.Name}:${item.Value}`;
35832
+ this.Canvas.fillText( text, x + txtLine + paddingX, y );
35833
+ }
35834
+
35835
+
35836
+ start += rate*2*Math.PI;//起始角度
35837
+ }
35838
+
35839
+ this.Canvas.restore();
35840
+ }
35841
+
35842
+ //空数据
35843
+ this.DrawEmptyData=function()
35844
+ {
35845
+ JSConsole.Chart.Log('[ChartPie::DrawEmptyData]')
35846
+ }
35847
+
35848
+ this.GetMaxMin=function()
35849
+ {
35850
+ return { Min:null, Max:null };
35851
+ }
35852
+ }
35853
+
35733
35854
  //分钟成交量 支持横屏
35734
35855
  function ChartMinuteVolumBar()
35735
35856
  {
@@ -86503,6 +86624,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
86503
86624
  if (kData && IFrameSplitOperator.IsNonEmptyArray(kData.Data))
86504
86625
  {
86505
86626
  var index=parseInt(position.CursorIndex.toFixed(0));
86627
+ if (index>=kData.Data.length) index=kData.Data.length-1; //未开盘的时间,取最后一个数据的收盘价
86506
86628
  var item=kData.Data[index];
86507
86629
  if (item && IFrameSplitOperator.IsNumber(item.Close))
86508
86630
  {
@@ -119703,6 +119825,10 @@ function JSExplainer(ast,option)
119703
119825
  ["L2_VOLNUM", { Name:"L2_VOLNUM", Param:{ Count:2 }, ToString:function(args) { return `单数分档`; } }],
119704
119826
  ["L2_VOL", { Name:"L2_VOL", Param:{ Count:2 }, ToString:function(args) { return `成交量分档`; } }],
119705
119827
  ["L2_AMO", { Name:"L2_AMO", Param:{ Count:2 }, ToString:function(args) { return `成交额分档`; } }],
119828
+
119829
+ ["TABLE_CELL", { Name:"TABLE_CELL",Param:{ Dynamic:true }, ToString:function(args) { return `创建表格单元格`; } }],
119830
+ ["TABLE_ROW", { Name:"TABLE_ROW",Param:{ Dynamic:true }, ToString:function(args) { return `创建表格行`; } }],
119831
+ ["DRAWTABLE", { Name:"DRAWTABLE",Param:{ Dynamic:true }, ToString:function(args) { return `绘制表格`; } }]
119706
119832
 
119707
119833
  ]
119708
119834
  );
@@ -146633,7 +146759,7 @@ function JSPopKeyboard()
146633
146759
  }
146634
146760
  }
146635
146761
 
146636
- if ((code>=48 && code<=57) || (code>=65 && code<=90) || (code>=97 && code<=122) || code==8)
146762
+ if ((code>=48 && code<=57) || (code>=65 && code<=90) || (code>=96 && code<=122) || code==8)
146637
146763
  {
146638
146764
  var strText=this.InputDOM.value;
146639
146765
  strText=strText.toUpperCase();
@@ -146731,7 +146857,7 @@ function JSPopKeyboard()
146731
146857
  var code=event.keyCode;
146732
146858
  if (code==116) return; //F5不处理
146733
146859
 
146734
- if (!this.IsShow() && (code>=48 && code<=57) || (code>=65 && code<=90) || (code>=97 && code<=122))
146860
+ if (!this.IsShow() && (code>=48 && code<=57) || (code>=65 && code<=90) || (code>=96 && code<=122))
146735
146861
  {
146736
146862
  this.Show();
146737
146863
  this.InputDOM.focus();
@@ -151001,7 +151127,7 @@ function HQChartScriptWorker()
151001
151127
 
151002
151128
 
151003
151129
 
151004
- var HQCHART_VERSION="1.1.14294";
151130
+ var HQCHART_VERSION="1.1.14298";
151005
151131
 
151006
151132
  function PrintHQChartVersion()
151007
151133
  {