hqchart 1.1.13077 → 1.1.13079

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.
@@ -4103,7 +4103,9 @@ this.IconSize={Max:g_JSChartResource.DRAWICON.Icon.MaxSize,Min:g_JSChartResource
4103
4103
  Zoom:{Type:g_JSChartResource.DRAWICON.Icon.Zoom.Type,Value:g_JSChartResource.DRAWICON.Icon.Zoom.Value//放大倍数
4104
4104
  }};this.Family;this.Color=g_JSChartResource.DefaultTextColor;this.IsHScreen=false;this.IconRect=[];//0=序号,1=区域
4105
4105
  this.MapCache=null;//key=date/date-time value={ Data:[] }
4106
- this.BuildKey=function(item){if(IFrameSplitOperator.IsNumber(item.Time))return item.Date+'-'+item.Time;else return item.Date;};this.BuildCacheData=function(){var mapData=new _map2.default();this.MapCache=mapData;if(!IFrameSplitOperator.IsNonEmptyArray(this.AryIcon))return;for(var i=0;i<this.AryIcon.length;++i){var item=this.AryIcon[i];var key=this.BuildKey(item);if(mapData.has(key)){var mapItem=mapData.get(key);mapItem.Data.push(item);}else{mapData.set(key,{Data:[item]});}}};this.Draw=function(){this.IconRect=[];if(!this.IsShow||this.ChartFrame.IsMinSize||!this.IsVisible)return;if(this.IsShowIndexTitleOnly())return;if(this.IsHideScriptIndex())return;if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;//k线数据
4106
+ this.BuildKey=function(item){if(IFrameSplitOperator.IsNumber(item.Time))return item.Date+'-'+item.Time;else return item.Date;};this.BuildCacheData=function(){var mapData=new _map2.default();this.MapCache=mapData;if(!IFrameSplitOperator.IsNonEmptyArray(this.AryIcon))return;for(var i=0;i<this.AryIcon.length;++i){var item=this.AryIcon[i];var key=this.BuildKey(item);if(mapData.has(key)){var mapItem=mapData.get(key);mapItem.Data.push(item);}else{mapData.set(key,{Data:[item]});}}};this.ClipClient=function(isHScreen)//裁剪客户端
4107
+ {if(isHScreen==true){var left=this.ChartBorder.GetLeft();var right=this.ChartBorder.GetRight();var top=this.ChartBorder.GetTop();var bottom=this.ChartBorder.GetBottom();}else{var left=this.ChartBorder.GetLeft();var right=this.ChartBorder.GetRight();var top=this.ChartBorder.GetTop();var bottom=this.ChartBorder.GetBottom();}this.Canvas.beginPath();this.Canvas.rect(left,top,right-left,bottom-top);//this.Canvas.stroke(); //调试用
4108
+ this.Canvas.clip();};this.Draw=function(){this.IconRect=[];if(!this.IsShow||this.ChartFrame.IsMinSize||!this.IsVisible)return;if(this.IsShowIndexTitleOnly())return;if(this.IsHideScriptIndex())return;if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;//k线数据
4107
4109
  if(!this.Family)return;if(!this.MapCache||this.MapCache.size<=0)return;this.IsHScreen=this.ChartFrame.IsHScreen===true;var xPointCount=this.ChartFrame.XPointCount;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var isMinute=this.IsMinuteFrame();var border=this.GetBorder();if(this.IsHScreen){var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.BottomEx;var chartLeft=border.TopEx;}else{var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;var chartLeft=border.LeftEx;}this.Canvas.save();this.ClipClient(this.ChartFrame.IsHScreen);var fontSize=this.GetDynamicIconSize(dataWidth,distanceWidth,this.IconSize.Max,this.IconSize.Min,this.IconSize.Zoom);this.Canvas.font=fontSize+'px '+this.Family;var drawInfo={Left:chartLeft,Right:chartright,FontSize:fontSize,DataWidth:dataWidth,DistanceWidth:distanceWidth};for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth){var kItem=this.Data.Data[i];var key=this.BuildKey(kItem);if(!this.MapCache.has(key))continue;var mapItem=this.MapCache.get(key);if(isMinute){var x=this.ChartFrame.GetXFromIndex(j);}else{var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;}this.DrawItem(mapItem,kItem,x,drawInfo);}this.Canvas.restore();};this.GetKValue=function(kItem,valueName){switch(valueName){case"HIGH":case"H":return kItem.High;case"L":case"LOW":return kItem.Low;case"C":case"CLOSE":return kItem.Close;case"O":case"OPEN":return KItem.Open;default:return null;}};this.DrawItem=function(groupItem,kItem,x,drawInfo){if(!IFrameSplitOperator.IsNonEmptyArray(groupItem.Data))return;var fontSize=drawInfo.FontSize;var left=drawInfo.Left,right=drawInfo.Right;var dataWidth=drawInfo.DataWidth;//var distanceWidth=drawInfo.DistanceWidth;
4108
4110
  for(var i=0;i<groupItem.Data.length;++i){var item=groupItem.Data[i];var value=item.Value;if(IFrameSplitOperator.IsString(item.Value))value=this.GetKValue(kItem,item.Value);if(!IFrameSplitOperator.IsNumber(value))continue;var y=this.ChartFrame.GetYFromData(item.Value,false);if(item.Color)this.Canvas.fillStyle=item.Color;else this.Canvas.fillStyle=this.Color;var textWidth=this.Canvas.measureText(item.Symbol).width;this.Canvas.textAlign='center';var rtIcon=new Rect(x-fontSize/2,y-fontSize/2,fontSize,fontSize);if(item.Baseline==1){this.Canvas.textBaseline='top';rtIcon.Y=y;}else if(item.Baseline==2){this.Canvas.textBaseline='bottom';rtIcon.Y=y-fontSize;}else{this.Canvas.textBaseline='middle';rtIcon.Y=y-fontSize/2;}if(this.IsHScreen){this.Canvas.save();this.Canvas.translate(y,x);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillText(item.Symbol,0,0);this.Canvas.restore();}else{if(IFrameSplitOperator.IsNumber(item.YMove))y+=item.YMove;this.Canvas.fillText(item.Symbol,x,y);if(item.Text)this.IconRect.push({Rect:rtIcon,Item:item,KItem:kItem});}if(item.Line){var price=item.Line.KData=="H"?kItem.High:kItem.Low;var yPrice=this.ChartFrame.GetYFromData(price,false);var yText=y;if(Array.isArray(item.Line.Offset)&&item.Line.Offset.length==2){if(yText>yPrice)//文字在下方
4109
4111
  {yText-=item.Line.Offset[1];yPrice+=item.Line.Offset[0];}else if(yText<yPrice){yText+=item.Line.Offset[1];yPrice-=item.Line.Offset[0];}}this.Canvas.save();if(item.Line.Dash)this.Canvas.setLineDash(item.Line.Dash);//虚线
@@ -12697,7 +12699,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
12697
12699
  this.ExecuteScript(item,data);}this.Status=0;}};this.OnExecuteFinish=function(data,indexInfo,jsExectute,jobInfo){var message={Data:data,IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.FINISH_EXECUTE_SCRIPT,JobInfo:jobInfo};postMessage(message);};this.OnExecuteError=function(error,indexInfo,jobData){var message={IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.ERROR_EXECUTE_SCRIPT,Error:error};postMessage(message);};}/********************************************************************************
12698
12700
  * 版本信息输出
12699
12701
  *
12700
- */var HQCHART_VERSION="1.1.13076";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
12702
+ */var HQCHART_VERSION="1.1.13078";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
12701
12703
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
12702
12704
  // BaseIndex:BaseIndex,
12703
12705
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13077",
3
+ "version": "1.1.13079",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -36893,6 +36893,29 @@ function ChartMultiSVGIconV2()
36893
36893
  }
36894
36894
  }
36895
36895
 
36896
+ this.ClipClient=function(isHScreen) //裁剪客户端
36897
+ {
36898
+ if (isHScreen==true)
36899
+ {
36900
+ var left=this.ChartBorder.GetLeft();
36901
+ var right=this.ChartBorder.GetRight();
36902
+ var top=this.ChartBorder.GetTop();
36903
+ var bottom=this.ChartBorder.GetBottom();
36904
+ }
36905
+ else
36906
+ {
36907
+ var left=this.ChartBorder.GetLeft();
36908
+ var right=this.ChartBorder.GetRight();
36909
+ var top=this.ChartBorder.GetTop();
36910
+ var bottom=this.ChartBorder.GetBottom();
36911
+ }
36912
+
36913
+ this.Canvas.beginPath();
36914
+ this.Canvas.rect(left,top,(right-left),(bottom-top));
36915
+ //this.Canvas.stroke(); //调试用
36916
+ this.Canvas.clip();
36917
+ }
36918
+
36896
36919
  this.Draw=function()
36897
36920
  {
36898
36921
  this.IconRect=[];
@@ -40785,6 +40785,29 @@ function ChartMultiSVGIconV2()
40785
40785
  }
40786
40786
  }
40787
40787
 
40788
+ this.ClipClient=function(isHScreen) //裁剪客户端
40789
+ {
40790
+ if (isHScreen==true)
40791
+ {
40792
+ var left=this.ChartBorder.GetLeft();
40793
+ var right=this.ChartBorder.GetRight();
40794
+ var top=this.ChartBorder.GetTop();
40795
+ var bottom=this.ChartBorder.GetBottom();
40796
+ }
40797
+ else
40798
+ {
40799
+ var left=this.ChartBorder.GetLeft();
40800
+ var right=this.ChartBorder.GetRight();
40801
+ var top=this.ChartBorder.GetTop();
40802
+ var bottom=this.ChartBorder.GetBottom();
40803
+ }
40804
+
40805
+ this.Canvas.beginPath();
40806
+ this.Canvas.rect(left,top,(right-left),(bottom-top));
40807
+ //this.Canvas.stroke(); //调试用
40808
+ this.Canvas.clip();
40809
+ }
40810
+
40788
40811
  this.Draw=function()
40789
40812
  {
40790
40813
  this.IconRect=[];
@@ -130727,7 +130750,7 @@ function ScrollBarBGChart()
130727
130750
 
130728
130751
 
130729
130752
 
130730
- var HQCHART_VERSION="1.1.13076";
130753
+ var HQCHART_VERSION="1.1.13078";
130731
130754
 
130732
130755
  function PrintHQChartVersion()
130733
130756
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13076";
8
+ var HQCHART_VERSION="1.1.13078";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -40829,6 +40829,29 @@ function ChartMultiSVGIconV2()
40829
40829
  }
40830
40830
  }
40831
40831
 
40832
+ this.ClipClient=function(isHScreen) //裁剪客户端
40833
+ {
40834
+ if (isHScreen==true)
40835
+ {
40836
+ var left=this.ChartBorder.GetLeft();
40837
+ var right=this.ChartBorder.GetRight();
40838
+ var top=this.ChartBorder.GetTop();
40839
+ var bottom=this.ChartBorder.GetBottom();
40840
+ }
40841
+ else
40842
+ {
40843
+ var left=this.ChartBorder.GetLeft();
40844
+ var right=this.ChartBorder.GetRight();
40845
+ var top=this.ChartBorder.GetTop();
40846
+ var bottom=this.ChartBorder.GetBottom();
40847
+ }
40848
+
40849
+ this.Canvas.beginPath();
40850
+ this.Canvas.rect(left,top,(right-left),(bottom-top));
40851
+ //this.Canvas.stroke(); //调试用
40852
+ this.Canvas.clip();
40853
+ }
40854
+
40832
40855
  this.Draw=function()
40833
40856
  {
40834
40857
  this.IconRect=[];
@@ -130885,7 +130908,7 @@ function HQChartScriptWorker()
130885
130908
 
130886
130909
 
130887
130910
 
130888
- var HQCHART_VERSION="1.1.13076";
130911
+ var HQCHART_VERSION="1.1.13078";
130889
130912
 
130890
130913
  function PrintHQChartVersion()
130891
130914
  {