hqchart 1.1.13409 → 1.1.13441

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.
@@ -169,6 +169,8 @@ function JSIndexScript()
169
169
  ["ICHIMOKU",this.ICHIMOKU],["CDP-STD", this.CDP_STD],["TBP-STD",this.TBP_STD],
170
170
  ["ADX", this.ADX],
171
171
 
172
+ ["持仓量", this.VOL_POSITION], //成交量+持仓量
173
+
172
174
  //通达信特色指标
173
175
  ["散户线", this.ShareholderCount],["NXTS", this.NXTS],["FKX", this.FKX],["两融资金", this.Margin4],
174
176
  ["ZSDB",this.ZSDB],
@@ -3407,6 +3409,20 @@ JSIndexScript.prototype.CJL = function ()
3407
3409
  return data;
3408
3410
  }
3409
3411
 
3412
+ JSIndexScript.prototype.VOL_POSITION=function()
3413
+ {
3414
+ let data =
3415
+ {
3416
+ Name: '持仓量', Description: '持仓量', IsMainIndex: false,
3417
+ Args: [],
3418
+ Script: //脚本
3419
+ "成交量:VOL,VOLSTICK;\n\
3420
+ 持仓量:VOLINSTK,SINGLELINE;"
3421
+ };
3422
+
3423
+ return data;
3424
+ }
3425
+
3410
3426
  JSIndexScript.prototype.ASI = function ()
3411
3427
  {
3412
3428
  let data =
@@ -6532,7 +6548,7 @@ var JSCHART_EVENT_ID=
6532
6548
 
6533
6549
 
6534
6550
  ON_CHANGE_INDEX:150, //切换指标
6535
- ON_MENU_COMMAND:151, //菜单时间回调
6551
+ ON_MENU_COMMAND:151, //菜单事件回调
6536
6552
  ON_CREATE_RIGHT_MENU:152, //创建右键菜单
6537
6553
 
6538
6554
  ON_FORMAT_CALL_AUCTION_INDEX_TITLE:153, //集合竞价指标窗口标题内容
@@ -15168,7 +15184,19 @@ function AverageWidthFrame()
15168
15184
  }
15169
15185
  else //显示第1行
15170
15186
  {
15171
- this.Canvas.fillText(item.Message[1][0],xText+this.YTextPadding[1],yText);
15187
+ var text=item.Message[1][0];
15188
+
15189
+ if (item.TextColor2) this.Canvas.fillStyle=item.TextColor2;
15190
+ if (rightExtendText && rightExtendText.Align===2 && this.YRightTextInfo) //右对齐
15191
+ {
15192
+ this.Canvas.textAlign="right";
15193
+ var xRight=this.YRightTextInfo.MainTextWidth+right-this.YTextPadding[1];
15194
+ this.Canvas.fillText(text,xRight,yText);
15195
+ }
15196
+ else
15197
+ {
15198
+ this.Canvas.fillText(text,xText+this.YTextPadding[1],yText);
15199
+ }
15172
15200
  }
15173
15201
  }
15174
15202
  else
@@ -15178,7 +15206,7 @@ function AverageWidthFrame()
15178
15206
  if (!rtPreRight || (rtRight && !this.IsTextTopBottomOverlap(rtRight,rtPreRight)))
15179
15207
  {
15180
15208
  if (item.TextColor2) this.Canvas.fillStyle=item.TextColor2;
15181
- if (rightExtendText && rightExtendText.Align===2 && this.YRightTextInfo)
15209
+ if (rightExtendText && rightExtendText.Align===2 && this.YRightTextInfo) //右对齐
15182
15210
  {
15183
15211
  this.Canvas.textAlign="right";
15184
15212
  var xRight=this.YRightTextInfo.MainTextWidth+right-this.YTextPadding[1];
@@ -24708,6 +24736,7 @@ function ChartData()
24708
24736
  var yClose=this.Data[index].YClose;
24709
24737
 
24710
24738
  result[index]=HistoryData.Copy(this.Data[index]);
24739
+ result[index].RightSeed=seed;
24711
24740
 
24712
24741
  for(--index; index>=0; --index)
24713
24742
  {
@@ -24738,6 +24767,7 @@ function ChartData()
24738
24767
  var seed=1;
24739
24768
  var close=this.Data[index].Close;
24740
24769
  result[index]=HistoryData.Copy(this.Data[index]);
24770
+ result[index].RightSeed=seed;
24741
24771
 
24742
24772
  for(++index;index<this.Data.length;++index)
24743
24773
  {
@@ -35067,6 +35097,86 @@ function ChartOverlayLine()
35067
35097
  }
35068
35098
  }
35069
35099
 
35100
+ //独立线段
35101
+ function ChartSingleLine()
35102
+ {
35103
+ this.newMethod=ChartLine; //派生
35104
+ this.newMethod();
35105
+ delete this.newMethod;
35106
+
35107
+ this.ClassName='ChartSingleLine'; //类名
35108
+ this.MaxMin=null; //当前的显示范围
35109
+
35110
+ this.Draw=function()
35111
+ {
35112
+ this.MaxMin=null;
35113
+ if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
35114
+ if (this.IsShowIndexTitleOnly()) return;
35115
+ if (this.IsHideScriptIndex()) return;
35116
+
35117
+ if (!this.Data || !this.Data.Data) return;
35118
+
35119
+ this.MaxMin=this.GetCurrentMaxMin();
35120
+ if (!this.MaxMin) return;
35121
+ if (!IFrameSplitOperator.IsNumber(this.MaxMin.Max) || !IFrameSplitOperator.IsNumber(this.MaxMin.Min)) return;
35122
+
35123
+ switch(this.DrawType)
35124
+ {
35125
+
35126
+ default:
35127
+ return this.DrawStraightLine();
35128
+ }
35129
+ }
35130
+
35131
+ //获取当前页的最大最小值
35132
+ this.GetCurrentMaxMin=function()
35133
+ {
35134
+ var xPointCount=this.ChartFrame.XPointCount;
35135
+ var range={ Max:null, Min:null };
35136
+
35137
+ for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j)
35138
+ {
35139
+ var value=this.Data.Data[i];
35140
+ if (!IFrameSplitOperator.IsNumber(value)) continue;
35141
+
35142
+ if (range.Max==null) range.Max=value;
35143
+ if (range.Min==null) range.Min=value;
35144
+
35145
+ if (range.Max<value) range.Max=value;
35146
+ if (range.Min>value) range.Min=value;
35147
+ }
35148
+
35149
+ return range;
35150
+ }
35151
+
35152
+ this.GetMaxMin=function()
35153
+ {
35154
+ return { Max:null, Min:null };
35155
+ }
35156
+
35157
+ this.GetYFromData=function(value)
35158
+ {
35159
+ var bHScreen = (this.ChartFrame.IsHScreen === true);
35160
+
35161
+ if (bHScreen)
35162
+ {
35163
+ if (value <= this.MaxMin.Min) return this.ChartBorder.GetLeftEx();
35164
+ if (value >= this.MaxMin.Max) return this.ChartBorder.GetRightEx();
35165
+
35166
+ var width = this.ChartBorder.GetWidthEx() * (value - this.MaxMin.Min) / (this.MaxMin.Max - this.MaxMin.Min);
35167
+ return this.ChartBorder.GetLeftEx() + width;
35168
+ }
35169
+ else
35170
+ {
35171
+ if(value<=this.MaxMin.Min) return this.ChartBorder.GetBottomEx();
35172
+ if(value>=this.MaxMin.Max) return this.ChartBorder.GetTopEx();
35173
+
35174
+ var height=this.ChartBorder.GetHeightEx()*(value-this.MaxMin.Min)/(this.MaxMin.Max-this.MaxMin.Min);
35175
+ return this.ChartBorder.GetBottomEx()-height;
35176
+ }
35177
+ }
35178
+ }
35179
+
35070
35180
  //彩色线段
35071
35181
  function ChartPartLine()
35072
35182
  {
@@ -35837,6 +35947,8 @@ function ChartVolStick()
35837
35947
 
35838
35948
  var yBottom=this.ChartFrame.GetYFromData(0);
35839
35949
 
35950
+ this.Canvas.save();
35951
+
35840
35952
  if (dataWidth>=4 && !(this.BarWidth===1))
35841
35953
  {
35842
35954
  yBottom=ToFixedRect(yBottom);
@@ -35878,6 +35990,7 @@ function ChartVolStick()
35878
35990
  {
35879
35991
  var preKItem=null;
35880
35992
  var barColor=null;
35993
+ this.Canvas.linewidth=1*GetDevicePixelRatio();
35881
35994
  for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
35882
35995
  {
35883
35996
  var value=this.Data.Data[i];
@@ -35912,6 +36025,8 @@ function ChartVolStick()
35912
36025
  preKItem=kItem;
35913
36026
  }
35914
36027
  }
36028
+
36029
+ this.Canvas.restore();
35915
36030
  }
35916
36031
 
35917
36032
  this.HScreenDraw=function() //横屏画法
@@ -37987,8 +38102,8 @@ function ChartMinutePriceLine()
37987
38102
  if (isHScreen===true) chartright=this.ChartBorder.GetBottom();
37988
38103
  var xPointCount=this.ChartFrame.XPointCount;
37989
38104
  var minuteCount=this.ChartFrame.MinuteCount;
37990
- var bottom=this.ChartBorder.GetBottomEx();
37991
- var left=this.ChartBorder.GetLeftEx();
38105
+ var bottom=this.ChartBorder.GetBottom();
38106
+ var left=this.ChartBorder.GetLeft();
37992
38107
  var data=this.Data;
37993
38108
 
37994
38109
  this.DrawBeforeOpen(); //盘前
@@ -113882,6 +113997,7 @@ function JSExecute(ast,option)
113882
113997
  let isExData=false;
113883
113998
  let isDotLine=false;
113884
113999
  let isOverlayLine=false; //叠加线
114000
+ let isSingleLine=false; //独立线段
113885
114001
  var isNoneName=false;
113886
114002
  var isShowTitle=true;
113887
114003
  //显示在位置之上,对于DRAWTEXT和DRAWNUMBER等函数有用,放在语句的最后面(不能与LINETHICK等函数共用),比如:
@@ -113938,9 +114054,11 @@ function JSExecute(ast,option)
113938
114054
  else if (value==="DRAWCENTER") isDrawCenter=true;
113939
114055
  else if (value=="DRAWBELOW") isDrawBelow=true;
113940
114056
  else if (value=="STEPLINE") stepLine=true;
114057
+ else if (value=="SINGLELINE") isSingleLine=true;
113941
114058
  else if (value.indexOf('COLOR')==0) color=value;
113942
114059
  else if (value.indexOf("RGBX")==0 && value.length==10) color=value; //RGBX+“RRGGBB”
113943
114060
  else if (value.indexOf('LINETHICK')==0) lineWidth=value;
114061
+
113944
114062
 
113945
114063
  else if (value=="ALIGN0") drawAlign=0;
113946
114064
  else if (value=="ALIGN1") drawAlign=1;
@@ -114189,6 +114307,7 @@ function JSExecute(ast,option)
114189
114307
  if (isExData==true) value.IsExData = true;
114190
114308
  if (isDotLine==true) value.IsDotLine=true;
114191
114309
  if (isOverlayLine==true) value.IsOverlayLine=true;
114310
+ if (isSingleLine==true) value.IsSingleLine=true;
114192
114311
  if (isNoneName==true) value.NoneName=true;
114193
114312
  if (isShowTitle==false) value.IsShowTitle=false;
114194
114313
  if (stepLine==true) value.Type=7;
@@ -114224,6 +114343,7 @@ function JSExecute(ast,option)
114224
114343
  if (isExData==true) value.IsExData = true;
114225
114344
  if (isDotLine==true) value.IsDotLine=true;
114226
114345
  if (isOverlayLine==true) value.IsOverlayLine=true;
114346
+ if (isSingleLine==true) value.IsSingleLine=true;
114227
114347
  if (isShowTitle==false) value.IsShowTitle=false;
114228
114348
  if (stepLine==true) value.Type=7;
114229
114349
  this.OutVarTable.push(value);
@@ -117051,6 +117171,54 @@ function ScriptIndex(name,script,args,option)
117051
117171
  hqChart.ChartPaint.push(line);
117052
117172
  }
117053
117173
 
117174
+ this.CreateSingleLine=function(hqChart,windowIndex,varItem,id,lineType)
117175
+ {
117176
+ var line=new ChartSingleLine();
117177
+ line.Canvas=hqChart.Canvas;
117178
+ line.DrawType=1;
117179
+ line.Name=varItem.Name;
117180
+ line.ChartBorder=hqChart.Frame.SubFrame[windowIndex].Frame.ChartBorder;
117181
+ line.ChartFrame=hqChart.Frame.SubFrame[windowIndex].Frame;
117182
+ line.Identify=this.Guid;
117183
+ if (varItem.Color) line.Color=this.GetColor(varItem.Color);
117184
+ else line.Color=this.GetDefaultColor(id);
117185
+
117186
+ if (varItem.LineWidth)
117187
+ {
117188
+ let width=parseInt(varItem.LineWidth.replace("LINETHICK",""));
117189
+ if (!isNaN(width) && width>0) line.LineWidth=width;
117190
+ }
117191
+
117192
+ if (varItem.IsDotLine) line.IsDotLine=true; //虚线
117193
+ if (varItem.IsShow==false) line.IsShow=false;
117194
+
117195
+ let titleIndex=windowIndex+1;
117196
+ line.Data.Data=varItem.Data;
117197
+
117198
+ this.ReloadChartResource(hqChart,windowIndex,line);
117199
+
117200
+ if (varItem.IsShowTitle===false) //NOTEXT 不绘制标题
117201
+ {
117202
+
117203
+ }
117204
+ else if (IFrameSplitOperator.IsString(varItem.Name) && varItem.Name.indexOf("NOTEXT")==0) //标题中包含NOTEXT不绘制标题
117205
+ {
117206
+
117207
+ }
117208
+ else
117209
+ {
117210
+ if (varItem.NoneName)
117211
+ hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,null,line.Color);
117212
+ else
117213
+ hqChart.TitlePaint[titleIndex].Data[id]=new DynamicTitleData(line.Data,varItem.Name,line.Color);
117214
+
117215
+ this.SetTitleData(hqChart.TitlePaint[titleIndex].Data[id],line);
117216
+ }
117217
+
117218
+ this.SetChartIndexName(line);
117219
+ hqChart.ChartPaint.push(line);
117220
+ }
117221
+
117054
117222
  //创建柱子
117055
117223
  this.CreateBar=function(hqChart,windowIndex,varItem,id)
117056
117224
  {
@@ -118355,6 +118523,7 @@ function ScriptIndex(name,script,args,option)
118355
118523
  if (item.Type==0)
118356
118524
  {
118357
118525
  if (item.IsOverlayLine) this.CreateOverlayLine(hqChart,windowIndex,item,i,item.Type);
118526
+ else if (item.IsSingleLine) this.CreateSingleLine(hqChart,windowIndex,item,i,item.Type);
118358
118527
  else this.CreateLine(hqChart,windowIndex,item,i,item.Type);
118359
118528
  }
118360
118529
  else if (item.Type==1)
@@ -137974,7 +138143,7 @@ function HQChartScriptWorker()
137974
138143
 
137975
138144
 
137976
138145
 
137977
- var HQCHART_VERSION="1.1.13408";
138146
+ var HQCHART_VERSION="1.1.13440";
137978
138147
 
137979
138148
  function PrintHQChartVersion()
137980
138149
  {