hqchart 1.1.12655 → 1.1.12674

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.
@@ -3591,6 +3591,48 @@ function JSAlgorithm(errorHandler, symbolData)
3591
3591
  return result;
3592
3592
  }
3593
3593
 
3594
+ //STDDEV(X,N) 返回标准偏差
3595
+ //将标准差除以样本大小N的平方根即可得出标准误差。标准误差 = σ/sqrt(n)
3596
+ this.STDDEV=function(data,n)
3597
+ {
3598
+ var result=[];
3599
+
3600
+ if (!Array.isArray(data)) return result;
3601
+ var nStart=this.GetFirstVaildIndex(data);
3602
+ if (!IFrameSplitOperator.IsNumber(n)) return result;
3603
+ if(nStart+n>data.length || n<1) return result;
3604
+
3605
+ var i=nStart, j=0, bFirst=true, dTotal=0, dAvg=0;
3606
+ for(i+=n-1;i<data.length;++i)
3607
+ {
3608
+ dTotal = 0;
3609
+ if(bFirst)
3610
+ {
3611
+ bFirst = false;
3612
+ for(j=i-n+1;j<=i;++j)
3613
+ {
3614
+ dAvg += data[j];
3615
+ }
3616
+
3617
+ dAvg /= n;
3618
+ }
3619
+ else
3620
+ {
3621
+ dAvg += (data[i]-data[i-n])/n;
3622
+ }
3623
+
3624
+ for(j=i-n+1;j<=i;++j)
3625
+ {
3626
+ dTotal += (data[j]-dAvg)*(data[j]-dAvg);
3627
+ }
3628
+
3629
+
3630
+ result[i] = Math.sqrt(dTotal/(n-1))/Math.sqrt(n);
3631
+ }
3632
+
3633
+ return result;
3634
+ }
3635
+
3594
3636
  //平均绝对方差
3595
3637
  this.AVEDEV=function(data,n)
3596
3638
  {
@@ -7709,6 +7751,8 @@ function JSAlgorithm(errorHandler, symbolData)
7709
7751
  return this.AVEDEV(args[0], args[1]);
7710
7752
  case 'STD':
7711
7753
  return this.STD(args[0], args[1]);
7754
+ case "STDDEV":
7755
+ return this.STDDEV(args[0], args[1]);
7712
7756
  case 'IF':
7713
7757
  case 'IFF':
7714
7758
  case "IFELSE":
@@ -30,7 +30,7 @@ function JSCanvasElement()
30
30
 
31
31
  //获取画布
32
32
  this.GetContext = function ()
33
- {
33
+ {
34
34
  var canvas;
35
35
  if (this.IsDingTalk)
36
36
  {
@@ -2025,6 +2025,8 @@ function HQPriceStringFormat()
2025
2025
  this.Text=IFrameSplitOperator.FormatValueThousandsString(this.Value,defaultfloatPrecision);
2026
2026
  else
2027
2027
  this.Text = this.Value.toFixed(defaultfloatPrecision);
2028
+
2029
+ if (this.YClose>0) this.PercentageText=((this.Value-this.YClose)*100/this.YClose).toFixed(2); //走势图右边坐标显示百分比
2028
2030
  }
2029
2031
  else
2030
2032
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12599";
8
+ var HQCHART_VERSION="1.1.12666";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -628,6 +628,7 @@ function JSChart(element)
628
628
  if (IFrameSplitOperator.IsBool(option.CorssCursorInfo.IsFixXLastTime)) chart.ChartCorssCursor.IsFixXLastTime=option.CorssCursorInfo.IsFixXLastTime;
629
629
  if (IFrameSplitOperator.IsNumber(item.PriceFormatType)) chart.ChartCorssCursor.StringFormatY.PriceFormatType=item.PriceFormatType;
630
630
  if (IFrameSplitOperator.IsNumber(item.DataFormatType)) chart.ChartCorssCursor.StringFormatY.DataFormatType=item.DataFormatType;
631
+ if (IFrameSplitOperator.IsNumber(item.RightTextFormat)) chart.ChartCorssCursor.TextFormat.Right=item.RightTextFormat;
631
632
  }
632
633
 
633
634
  if (option.MinuteInfo) chart.CreateMinuteInfo(option.MinuteInfo);