hqchart 1.1.12997 → 1.1.13003

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.
@@ -1953,6 +1953,7 @@ this.LineColor=g_JSChartResource.FrameSplitPen;//线段颜色
1953
1953
  this.LineDash=null;//当线段类型==2时 可以设置虚线样式
1954
1954
  this.LineType=1;//线段类型 -1=不画线段 2=虚线, 8,9=集合竞价坐标
1955
1955
  this.LineWidth;//线段宽度
1956
+ this.ExtendLine;//延长线长度[ ] { Width:长度 } [0]=左 [1]=右 实例: [null, { Width: 50}];
1956
1957
  this.ExtendData;//扩展属性
1957
1958
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
1958
1959
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
@@ -2151,7 +2152,8 @@ var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i
2151
2152
  {if(borderRight<10||position==1){if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
2152
2153
  var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){var bgTop=bottom-itemText.Width;var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,itemText.Width);this.DrawHScreenText({X:yText,Y:bgTop},{Text:itemText.Text,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});if(i==0)this.DrawLine(top,bgTop,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{if(itemText.Type===1){if(this.GetEventCallback){var bgTop=yText-textHeight/2-1*pixelTatio;var sendData={Top:bgTop,Right:right,Height:null,IsShow:true,BGColor:item.LineColor,TextColor:item.TextColor,PixelTatio:pixelTatio,Position:"Right",IsInside:true};if(this.SendDrawCountDownEvent(sendData)){if(IFrameSplitOperator.IsPlusNumber(sendData.Height))yText+=textHeight+1*pixelTatio;}}}else{var bgTop=yText-textHeight/2-1*pixelTatio;var textLeft=right-itemText.Width;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);//文本背景区域
2153
2154
  if(itemText.TextColor)this.Canvas.fillStyle=itemText.TextColor;else this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);if(i==0)this.DrawLine(left,textLeft,yText,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;}}}if(item.Type==3||item.Type==4){if(item.Title){var width=this.Canvas.measureText(item.Title).width+2*pixelTatio;if(this.IsHScreen){var bgTop=bottom-itemText.Width-width;var textLeft=y-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,width);this.DrawHScreenText({X:y,Y:bgTop},{Text:item.Title,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});}else{var bgTop=y-textHeight/2-1*pixelTatio;var textLeft=right-textWidth-width-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Title,textLeft+1*pixelTatio,y);}}}}else{if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var preTextRect=null;if(mapTextRect&&mapTextRect.has(3))preTextRect=mapTextRect.get(3);var yText=y;var rtText={};for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){var bgTop=bottom;//bgTop+=(textWidth-itemText.Width);
2154
- var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,itemText.Width);this.DrawHScreenText({X:yText,Y:bgTop},{Text:itemText.Text,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});if(i==0)this.DrawLine(top,bgTop,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{if(itemText.Type===1){if(this.GetEventCallback){var bgTop=yText-textHeight/2-1*pixelTatio;var sendData={Top:bgTop,Left:right,Right:this.ChartBorder.GetChartWidth(),Height:null,IsShow:true,BGColor:item.LineColor,TextColor:item.TextColor,PixelTatio:pixelTatio,Position:"Right",IsInside:false};if(this.SendDrawCountDownEvent(sendData)){if(IFrameSplitOperator.IsPlusNumber(sendData.Height))yText+=textHeight+1*pixelTatio;}}}else{var bgTop=yText-textHeight/2-1*pixelTatio;if(i==0){var textLeft=right;rtText.Left=textLeft;if(preTextRect&&bgTop<preTextRect.Rect.Bottom){yText=preTextRect.Rect.Bottom;bgTop=yText-textHeight/2-1*pixelTatio;}}else{var textLeft=right+textWidth-itemText.Width;}if(emptyBGColor){this.Canvas.fillStyle=emptyBGColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width+1,textHeight);this.Canvas.strokeStyle=item.LineColor;this.Canvas.strokeRect(ToFixedPoint(textLeft),ToFixedPoint(bgTop),ToFixedRect(itemText.Width+1),ToFixedRect(textHeight));this.Canvas.fillStyle=item.LineColor;this.Canvas.fillText(itemText.Text,textLeft+2*pixelTatio,yText);}else{this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);if(itemText.TextColor)this.Canvas.fillStyle=itemText.TextColor;else this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);}if(i==0)this.DrawLine(left,right,y,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;rtText.Bottom=yText;}}}if(mapTextRect&&IFrameSplitOperator.IsNumber(rtText.Left)&&IFrameSplitOperator.IsNumber(rtText.Bottom)){mapTextRect.set(3,{Rect:rtText,Item:item});}if(item.Type==3||item.Type==4){if(item.Title){var bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
2155
+ var textLeft=yText-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,itemText.Width);this.DrawHScreenText({X:yText,Y:bgTop},{Text:itemText.Text,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});if(i==0)this.DrawLine(top,bgTop,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{if(itemText.Type===1){if(this.GetEventCallback){var bgTop=yText-textHeight/2-1*pixelTatio;var sendData={Top:bgTop,Left:right,Right:this.ChartBorder.GetChartWidth(),Height:null,IsShow:true,BGColor:item.LineColor,TextColor:item.TextColor,PixelTatio:pixelTatio,Position:"Right",IsInside:false};if(this.SendDrawCountDownEvent(sendData)){if(IFrameSplitOperator.IsPlusNumber(sendData.Height))yText+=textHeight+1*pixelTatio;}}}else{var bgTop=yText-textHeight/2-1*pixelTatio;if(i==0){var textLeft=right;rtText.Left=textLeft;if(preTextRect&&bgTop<preTextRect.Rect.Bottom){yText=preTextRect.Rect.Bottom;bgTop=yText-textHeight/2-1*pixelTatio;}}else{var textLeft=right+textWidth-itemText.Width;}if(item.ExtendLine&&item.ExtendLine[1])//右侧延长线
2156
+ {var exLine=item.ExtendLine[1];if(IFrameSplitOperator.IsNumber(exLine.Width)){if(i==0)this.DrawLine(right,right+exLine.Width,y,item.LineColor,item.LineType,item);textLeft+=exLine.Width;}}if(emptyBGColor){this.Canvas.fillStyle=emptyBGColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width+1,textHeight);this.Canvas.strokeStyle=item.LineColor;this.Canvas.strokeRect(ToFixedPoint(textLeft),ToFixedPoint(bgTop),ToFixedRect(itemText.Width+1),ToFixedRect(textHeight));this.Canvas.fillStyle=item.LineColor;this.Canvas.fillText(itemText.Text,textLeft+2*pixelTatio,yText);}else{this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);if(itemText.TextColor)this.Canvas.fillStyle=itemText.TextColor;else this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);}if(i==0)this.DrawLine(left,right,y,item.LineColor,item.LineType,item);yText+=textHeight+1*pixelTatio;rtText.Bottom=yText;}}}if(mapTextRect&&IFrameSplitOperator.IsNumber(rtText.Left)&&IFrameSplitOperator.IsNumber(rtText.Bottom)){mapTextRect.set(3,{Rect:rtText,Item:item});}if(item.Type==3||item.Type==4){if(item.Title){var bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
2155
2157
  var width=this.Canvas.measureText(item.Title).width+2*pixelTatio;if(this.IsHScreen){var bgTop=bottom-width;var textLeft=y-textHeight/2-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,textHeight,width);this.DrawHScreenText({X:y,Y:bgTop},{Text:item.Title,Color:item.TextColor,XOffset:1*pixelTatio,YOffset:2*pixelTatio});}else{var bgTop=y-textHeight/2-1*pixelTatio;var textLeft=right-width-1*pixelTatio;this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Title,textLeft+1*pixelTatio,y);}}}}}};this.SendDrawCountDownEvent=function(sendData){if(!this.GetEventCallback)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_DRAW_COUNTDOWN);if(!event||!event.Callback)return false;event.Callback(event,sendData,this);return true;};this.DrawDotLine=function(left,right,y,color,option){var pixelTatio=GetDevicePixelRatio();this.Canvas.save();this.Canvas.strokeStyle=color;if(option&&IFrameSplitOperator.IsPlusNumber(option.LineWidth))this.Canvas.lineWidth=option.LineWidth*pixelTatio;if(option.LineDash)this.Canvas.setLineDash(option.LineDash);else this.Canvas.setLineDash([5*pixelTatio,5*pixelTatio]);//虚线
2156
2158
  this.Canvas.beginPath();if(this.IsHScreen){this.Canvas.moveTo(ToFixedPoint(y),left);this.Canvas.lineTo(ToFixedPoint(y),right);}else{this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));}this.Canvas.stroke();this.Canvas.restore();};this.DrawLine=function(left,right,y,color,lineType,option){if(lineType==-1)return;if(lineType==0){var pixelRatio=GetDevicePixelRatio();this.Canvas.strokeStyle=color;var bChangeLineWidth=false;if(option&&IFrameSplitOperator.IsPlusNumber(option.LineWidth)){this.Canvas.lineWidth=option.LineWidth*pixelRatio;bChangeLineWidth=true;}this.Canvas.beginPath();if(this.IsHScreen){this.Canvas.moveTo(ToFixedPoint(y),left);this.Canvas.lineTo(ToFixedPoint(y),right);}else{this.Canvas.moveTo(left,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));}this.Canvas.stroke();if(bChangeLineWidth){this.Canvas.lineWidth=pixelRatio;}}else{this.DrawDotLine(left,right,y,color,option);}};this.DrawHScreenText=function(center,data){this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=data.Color;this.Canvas.save();this.Canvas.translate(center.X,center.Y);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillText(data.Text,data.XOffset,data.YOffset);this.Canvas.restore();};this.RGBToStruct=function(rgb){if(/^(rgb|RGB)/.test(rgb)){var aColor=rgb.replace(/(?:\(|\)|rgb|RGB)*/g,"").split(",");var result={};if(aColor.length!=3)return null;result.R=Number(aColor[0]);result.G=Number(aColor[1]);result.B=Number(aColor[2]);return result;}return null;};this.GetMulitTextMaxWidth=function(aryData){var width=null;for(var i=0;i<aryData.length;++i){var item=aryData[i];var text=item.Text;if(!text)continue;var value=this.Canvas.measureText(text).width;if(width==null)width=value;else if(width<value)width=value;}return width;};this.GetScaleTextWidth=function(){var border=this.ChartBorder.GetBorder();var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
2157
2159
  if(this.IsHScreen){var borderTop=this.ChartBorder.Top;var borderBottom=this.ChartBorder.Bottom;var isDrawLeft=borderTop>10*pixelTatio&&this.IsShowYText[0]===true&&this.YTextPosition[0]!=2;var isDrawRight=borderBottom>10*pixelTatio&&this.IsShowYText[1]===true&&this.YTextPosition[1]!=2;}else{var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var isDrawLeft=borderLeft>10&&this.IsShowYText[0]===true&&this.YTextPosition[0]!=2;var isDrawRight=borderRight>10&&this.IsShowYText[1]===true&&this.YTextPosition[1]!=2;}if(!isDrawRight&&!isDrawLeft)return null;var width={Left:null,Right:null};var rightExtendWidth=0;var isYPercentage=false;//是否是百分比坐标
@@ -3137,7 +3139,7 @@ if(this.GetEventCallback){eventUnchangeKLine=this.GetEventCallback(JSCHART_EVENT
3137
3139
  {if(i<this.ColorData.length)upColor=downColor=unchagneColor=this.ColorData[i]>0?this.UpColor:this.DownColor;else upColor=downColor=unchagneColor=this.DownColor;}if(this.IsThinAKBar==false&&dataWidth>=9){var coordinateInfo={YLow:yLow,YHigh:yHigh,YOpen:yOpen,YClose:yClose,X:x,Left:left,Right:right};var colorInfo={UpColor:upColor,DownColor:downColor,UnchangeColor:unchagneColor};this.DrawAKBar(data,dataWidth,isHScreen,coordinateInfo,colorInfo);}else{this.Canvas.beginPath();//最高-最低
3138
3140
  if(isHScreen){if(data.High==data.Low&&dataWidth<4){this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow-1,ToFixedPoint(x));}else{this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow,ToFixedPoint(x));}}else{if(data.High==data.Low&&dataWidth<4){this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow+1);}else{this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow);}}this.Canvas.stroke();if(dataWidth>=4){this.Canvas.beginPath();//开盘
3139
3141
  if(isHScreen){this.Canvas.moveTo(ToFixedPoint(yOpen),left);this.Canvas.lineTo(ToFixedPoint(yOpen),x);}else{this.Canvas.moveTo(left,ToFixedPoint(yOpen));this.Canvas.lineTo(x,ToFixedPoint(yOpen));}this.Canvas.stroke();this.Canvas.beginPath();//收盘
3140
- if(isHScreen){this.Canvas.moveTo(ToFixedPoint(yClose),right);this.Canvas.lineTo(ToFixedPoint(yClose),x);}else{this.Canvas.moveTo(right,ToFixedPoint(yClose));this.Canvas.lineTo(x,ToFixedPoint(yClose));}this.Canvas.stroke();}}if(this.Data.DataType==0){var infoItem={Xleft:left,XRight:right,YMax:yHigh,XCenter:x,YMin:yLow,DayData:data,Index:j};this.DrawInfo(infoItem);}if(this.PriceGap.Enable&&preKItemInfo){this.CheckPriceGrap(kItemInfo);var value=this.IsPriceGrap(kItemInfo,preKItemInfo);if(value>0)this.AryPriceGapCache.push({Data:[preKItemInfo,kItemInfo],Type:value});}preKItemInfo=kItemInfo;}this.PtMax=ptMax;this.PtMin=ptMin;};this.DrawAKBar=function(data,dataWidth,isHScreen,coordinateInfo,colorInfo){var barWidth=dataWidth/3;var left=ToFixedRect(coordinateInfo.Left);var aryX=[left,ToFixedRect(left+barWidth),ToFixedRect(left+barWidth*2),ToFixedRect(left+barWidth*3)];var yHigh=coordinateInfo.YHigh,yLow=coordinateInfo.YLow,yOpen=coordinateInfo.YOpen,yClose=coordinateInfo.YClose;if(data.Open<data.Close){this.Canvas.strokeStyle=colorInfo.UpColor;//阳线
3142
+ if(isHScreen){this.Canvas.moveTo(ToFixedPoint(yClose),right);this.Canvas.lineTo(ToFixedPoint(yClose),x);}else{this.Canvas.moveTo(right,ToFixedPoint(yClose));this.Canvas.lineTo(x,ToFixedPoint(yClose));}this.Canvas.stroke();}}if(this.Data.DataType==0){var infoItem={Xleft:left,XRight:right,YMax:yHigh,XCenter:x,YMin:yLow,DayData:data,Index:j};this.DrawInfo(infoItem);}if(this.PriceGap.Enable&&preKItemInfo){this.CheckPriceGap(kItemInfo);var value=this.IsPriceGap(kItemInfo,preKItemInfo);if(value>0)this.AryPriceGapCache.push({Data:[preKItemInfo,kItemInfo],Type:value});}preKItemInfo=kItemInfo;}this.PtMax=ptMax;this.PtMin=ptMin;};this.DrawAKBar=function(data,dataWidth,isHScreen,coordinateInfo,colorInfo){var barWidth=dataWidth/3;var left=ToFixedRect(coordinateInfo.Left);var aryX=[left,ToFixedRect(left+barWidth),ToFixedRect(left+barWidth*2),ToFixedRect(left+barWidth*3)];var yHigh=coordinateInfo.YHigh,yLow=coordinateInfo.YLow,yOpen=coordinateInfo.YOpen,yClose=coordinateInfo.YClose;if(data.Open<data.Close){this.Canvas.strokeStyle=colorInfo.UpColor;//阳线
3141
3143
  this.Canvas.fillStyle=colorInfo.UpColor;}else if(data.Open>data.Close){this.Canvas.strokeStyle=colorInfo.DownColor;//阳线
3142
3144
  this.Canvas.fillStyle=colorInfo.DownColor;}else{this.Canvas.strokeStyle=colorInfo.UnchangeColor;//平线
3143
3145
  this.Canvas.fillStyle=colorInfo.UnchangeColor;}//最高-最低
@@ -3145,9 +3147,9 @@ if(isHScreen){if(data.High==data.Low){var yTop=yHigh-barWidth/2;this.Canvas.fill
3145
3147
  var yTop=yOpen-barWidth/2;if(isHScreen){this.Canvas.fillRect(yTop,aryX[0],barWidth,aryX[1]-aryX[0]);}else{this.Canvas.fillRect(aryX[0],yTop,aryX[1]-aryX[0],barWidth);}//收盘
3146
3148
  var yTop=yClose-barWidth/2;if(isHScreen){this.Canvas.fillRect(yTop,aryX[2],barWidth,aryX[3]-aryX[2]);}else{this.Canvas.fillRect(aryX[2],yTop,aryX[3]-aryX[2],barWidth);}};this.DrawCloseArea=function()//收盘价面积图
3147
3149
  {var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var xPointCount=this.ChartFrame.XPointCount;if(isHScreen){var border=this.ChartBorder.GetHScreenBorder();var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.BottomEx;var borderLeft=border.TopEx;}else{var border=this.ChartBorder.GetBorder();var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;var borderLeft=border.LeftEx;}var bFirstPoint=true;var firstPoint=null;this.Canvas.beginPath();this.Canvas.strokeStyle=this.CloseLineColor;if(IFrameSplitOperator.IsNumber(this.CloseLineWidth))this.Canvas.lineWidth=this.CloseLineWidth;var ptLast=null;if(this.Data.DataOffset>0)//把最左边的一个点连上
3148
- {var data=this.Data.Data[this.Data.DataOffset-1];if(data&&IFrameSplitOperator.IsNumber(data.Close)){var x=borderLeft;var yClose=this.GetYFromData(data.Close,false);if(isHScreen){this.Canvas.moveTo(yClose,x);firstPoint={X:yClose,Y:x};}else{this.Canvas.moveTo(x,yClose);firstPoint={X:x,Y:yClose};}bFirstPoint=false;}}this.ShowRange.Start=this.Data.DataOffset;this.ShowRange.End=this.ShowRange.Start;this.ShowRange.DataCount=0;this.ShowRange.ShowCount=xPointCount;this.DrawKRange.Start=this.Data.DataOffset;var preKItemInfo=null;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth,++this.ShowRange.DataCount){var data=this.Data.Data[i];this.ShowRange.End=i;if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;var yClose=this.GetYFromData(data.Close,false);this.DrawKRange.End=i;if(bFirstPoint){if(isHScreen){this.Canvas.moveTo(yClose,x);firstPoint={X:yClose,Y:x};}else{this.Canvas.moveTo(x,yClose);firstPoint={X:x,Y:yClose};}bFirstPoint=false;}else{if(isHScreen)this.Canvas.lineTo(yClose,x);else this.Canvas.lineTo(x,yClose);}if(i==this.Data.Data.length-1){ptLast={X:x,Y:yClose,XLeft:left,XRight:right,KItem:data,ChartRight:chartright};}if(this.PriceGap.Enable){var yLow=this.GetYFromData(data.Low,false);var yHigh=this.GetYFromData(data.High,false);var yOpen=this.GetYFromData(data.Open,false);var kItemInfo={Data:data,Coordinate:{X:x,Low:yLow,High:yHigh,Close:yClose,Open:yOpen,Left:left,Right:right}};if(preKItemInfo){this.CheckPriceGrap(kItemInfo);var value=this.IsPriceGrap(kItemInfo,preKItemInfo);if(value>0)this.AryPriceGapCache.push({Data:[preKItemInfo,kItemInfo],Type:value});}preKItemInfo=kItemInfo;}}this.DrawLastPointEvent(ptLast);//通知外部绘制最后一个点
3150
+ {var data=this.Data.Data[this.Data.DataOffset-1];if(data&&IFrameSplitOperator.IsNumber(data.Close)){var x=borderLeft;var yClose=this.GetYFromData(data.Close,false);if(isHScreen){this.Canvas.moveTo(yClose,x);firstPoint={X:yClose,Y:x};}else{this.Canvas.moveTo(x,yClose);firstPoint={X:x,Y:yClose};}bFirstPoint=false;}}this.ShowRange.Start=this.Data.DataOffset;this.ShowRange.End=this.ShowRange.Start;this.ShowRange.DataCount=0;this.ShowRange.ShowCount=xPointCount;this.DrawKRange.Start=this.Data.DataOffset;var preKItemInfo=null;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth,++this.ShowRange.DataCount){var data=this.Data.Data[i];this.ShowRange.End=i;if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;var yClose=this.GetYFromData(data.Close,false);this.DrawKRange.End=i;if(bFirstPoint){if(isHScreen){this.Canvas.moveTo(yClose,x);firstPoint={X:yClose,Y:x};}else{this.Canvas.moveTo(x,yClose);firstPoint={X:x,Y:yClose};}bFirstPoint=false;}else{if(isHScreen)this.Canvas.lineTo(yClose,x);else this.Canvas.lineTo(x,yClose);}if(i==this.Data.Data.length-1){ptLast={X:x,Y:yClose,XLeft:left,XRight:right,KItem:data,ChartRight:chartright};}if(this.PriceGap.Enable){var yLow=this.GetYFromData(data.Low,false);var yHigh=this.GetYFromData(data.High,false);var yOpen=this.GetYFromData(data.Open,false);var kItemInfo={Data:data,Coordinate:{X:x,Low:yLow,High:yHigh,Close:yClose,Open:yOpen,Left:left,Right:right}};if(preKItemInfo){this.CheckPriceGap(kItemInfo);var value=this.IsPriceGap(kItemInfo,preKItemInfo);if(value>0)this.AryPriceGapCache.push({Data:[preKItemInfo,kItemInfo],Type:value});}preKItemInfo=kItemInfo;}}this.DrawLastPointEvent(ptLast);//通知外部绘制最后一个点
3149
3151
  if(bFirstPoint)return;this.Canvas.stroke();if(isHScreen){this.Canvas.lineTo(border.Left,x);this.Canvas.lineTo(border.Left,firstPoint.Y);}else{this.Canvas.lineTo(x,border.Bottom);this.Canvas.lineTo(firstPoint.X,border.Bottom);}this.Canvas.closePath();if(Array.isArray(this.CloseLineAreaColor)){if(isHScreen){var gradient=this.Canvas.createLinearGradient(this.ChartBorder.GetRightEx(),this.ChartBorder.GetTop(),this.ChartBorder.GetLeft(),this.ChartBorder.GetTop());gradient.addColorStop(0,this.CloseLineAreaColor[0]);gradient.addColorStop(1,this.CloseLineAreaColor[1]);this.Canvas.fillStyle=gradient;}else{var _gradient=this.Canvas.createLinearGradient(firstPoint.X,this.ChartBorder.GetTopEx(),firstPoint.X,this.ChartBorder.GetBottom());_gradient.addColorStop(0,this.CloseLineAreaColor[0]);_gradient.addColorStop(1,this.CloseLineAreaColor[1]);this.Canvas.fillStyle=_gradient;}}else{this.Canvas.fillStyle=this.CloseLineAreaColor;}this.Canvas.fill();};this.DrawCloseLine=function()//收盘价线
3150
- {var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var xPointCount=this.ChartFrame.XPointCount;if(isHScreen){var border=this.ChartBorder.GetHScreenBorder();var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.BottomEx;}else{var border=this.ChartBorder.GetBorder();var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;}var bFirstPoint=true;this.Canvas.beginPath();this.Canvas.strokeStyle=this.CloseLineColor;if(IFrameSplitOperator.IsNumber(this.CloseLineWidth))this.Canvas.lineWidth=this.CloseLineWidth;this.ShowRange.Start=this.Data.DataOffset;this.ShowRange.End=this.ShowRange.Start;this.ShowRange.DataCount=0;this.ShowRange.ShowCount=xPointCount;this.DrawKRange.Start=this.Data.DataOffset;var preKItemInfo=null;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth,++this.ShowRange.DataCount){var data=this.Data.Data[i];this.ShowRange.End=i;if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;var yClose=this.GetYFromData(data.Close,false);this.DrawKRange.End=i;if(bFirstPoint){if(isHScreen)this.Canvas.moveTo(yClose,x);else this.Canvas.moveTo(x,yClose);bFirstPoint=false;}else{if(isHScreen)this.Canvas.lineTo(yClose,x);else this.Canvas.lineTo(x,yClose);}if(this.PriceGap.Enable){var yLow=this.GetYFromData(data.Low,false);var yHigh=this.GetYFromData(data.High,false);var yOpen=this.GetYFromData(data.Open,false);var kItemInfo={Data:data,Coordinate:{X:x,Low:yLow,High:yHigh,Close:yClose,Open:yOpen,Left:left,Right:right}};if(preKItemInfo){this.CheckPriceGrap(kItemInfo);var value=this.IsPriceGrap(kItemInfo,preKItemInfo);if(value>0)this.AryPriceGapCache.push({Data:[preKItemInfo,kItemInfo],Type:value});}preKItemInfo=kItemInfo;}}if(bFirstPoint==false)this.Canvas.stroke();};this.DrawKBar=function()//蜡烛头
3152
+ {var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var xPointCount=this.ChartFrame.XPointCount;if(isHScreen){var border=this.ChartBorder.GetHScreenBorder();var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.BottomEx;}else{var border=this.ChartBorder.GetBorder();var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;}var bFirstPoint=true;this.Canvas.beginPath();this.Canvas.strokeStyle=this.CloseLineColor;if(IFrameSplitOperator.IsNumber(this.CloseLineWidth))this.Canvas.lineWidth=this.CloseLineWidth;this.ShowRange.Start=this.Data.DataOffset;this.ShowRange.End=this.ShowRange.Start;this.ShowRange.DataCount=0;this.ShowRange.ShowCount=xPointCount;this.DrawKRange.Start=this.Data.DataOffset;var preKItemInfo=null;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth,++this.ShowRange.DataCount){var data=this.Data.Data[i];this.ShowRange.End=i;if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;var yClose=this.GetYFromData(data.Close,false);this.DrawKRange.End=i;if(bFirstPoint){if(isHScreen)this.Canvas.moveTo(yClose,x);else this.Canvas.moveTo(x,yClose);bFirstPoint=false;}else{if(isHScreen)this.Canvas.lineTo(yClose,x);else this.Canvas.lineTo(x,yClose);}if(this.PriceGap.Enable){var yLow=this.GetYFromData(data.Low,false);var yHigh=this.GetYFromData(data.High,false);var yOpen=this.GetYFromData(data.Open,false);var kItemInfo={Data:data,Coordinate:{X:x,Low:yLow,High:yHigh,Close:yClose,Open:yOpen,Left:left,Right:right}};if(preKItemInfo){this.CheckPriceGap(kItemInfo);var value=this.IsPriceGap(kItemInfo,preKItemInfo);if(value>0)this.AryPriceGapCache.push({Data:[preKItemInfo,kItemInfo],Type:value});}preKItemInfo=kItemInfo;}}if(bFirstPoint==false)this.Canvas.stroke();};this.DrawKBar=function()//蜡烛头
3151
3153
  {var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var border=this.ChartBorder.GetBorder();var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;var xPointCount=this.ChartFrame.XPointCount;if(isHScreen){var border=this.ChartBorder.GetHScreenBorder();xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;chartright=border.BottomEx;}var ptMax={X:null,Y:null,Value:null,Align:'left'};var ptMin={X:null,Y:null,Value:null,Align:'left'};var upColor=this.UpColor;var downColor=this.DownColor;var unchagneColor=this.UnchagneColor;this.ShowRange.Start=this.Data.DataOffset;this.ShowRange.End=this.ShowRange.Start;this.ShowRange.DataCount=0;this.ShowRange.ShowCount=xPointCount;var ptLast=null;this.DrawKRange.Start=this.Data.DataOffset;var eventUnchangeKLine=null;//定制平盘K线颜色事件
3152
3154
  if(this.GetEventCallback){eventUnchangeKLine=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_UNCHANGE_KLINE_COLOR);}var preKItemInfo=null;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth,++this.ShowRange.DataCount){var data=this.Data.Data[i];this.ShowRange.End=i;if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;var yLow=this.GetYFromData(data.Low,false);var yHigh=this.GetYFromData(data.High,false);var yOpen=this.GetYFromData(data.Open,false);var yClose=this.GetYFromData(data.Close,false);var y=yHigh;var kItemInfo={Data:data,Coordinate:{X:x,Low:yLow,High:yHigh,Close:yClose,Open:yOpen,Left:left,Right:right}};this.DrawKRange.End=i;if(ptMax.Value==null||ptMax.Value<data.High)//求最大值
3153
3155
  {ptMax.X=x;ptMax.Y=yHigh;ptMax.Value=data.High;ptMax.Align=j<xPointCount/2?'left':'right';}if(ptMin.Value==null||ptMin.Value>data.Low)//求最小值
@@ -3161,7 +3163,7 @@ if(this.GetEventCallback){eventUnchangeKLine=this.GetEventCallback(JSCHART_EVENT
3161
3163
  {yTop=Math.min(yHigh,yTop-5);yBottom=Math.max(yLow,yBottom+5);}if(data.IsNonTrade){yTop=yHigh;yBottom=yLow;}var rect=new Rect(left,yTop,dataWidth,yBottom-yTop);//this.Canvas.fillStyle="rgb(0,0,100)";
3162
3164
  //this.Canvas.fillRect(rect.X,rect.Y,rect.Width,rect.Height);
3163
3165
  this.TooltipRect.push([i,rect]);//[0]数据索引 [1]数据区域
3164
- }if(this.Data.DataType==0||this.Data.DataType==1){var infoItem={Xleft:left,XRight:right,XCenter:x,YMax:yHigh,YMin:yLow,DayData:data,Index:j};this.DrawInfo(infoItem);}if(i==this.Data.Data.length-1){ptLast={X:x,Y:yClose,XLeft:left,XRight:right,KItem:data,ChartRight:chartright};}if(this.PriceGap.Enable&&preKItemInfo){this.CheckPriceGrap(kItemInfo);var value=this.IsPriceGrap(kItemInfo,preKItemInfo);if(value>0)this.AryPriceGapCache.push({Data:[preKItemInfo,kItemInfo],Type:value});}preKItemInfo=kItemInfo;}this.DrawLastPointEvent(ptLast);//通知外部绘制最后一个点
3166
+ }if(this.Data.DataType==0||this.Data.DataType==1){var infoItem={Xleft:left,XRight:right,XCenter:x,YMax:yHigh,YMin:yLow,DayData:data,Index:j};this.DrawInfo(infoItem);}if(i==this.Data.Data.length-1){ptLast={X:x,Y:yClose,XLeft:left,XRight:right,KItem:data,ChartRight:chartright};}if(this.PriceGap.Enable&&preKItemInfo){this.CheckPriceGap(kItemInfo);var value=this.IsPriceGap(kItemInfo,preKItemInfo);if(value>0)this.AryPriceGapCache.push({Data:[preKItemInfo,kItemInfo],Type:value});}preKItemInfo=kItemInfo;}this.DrawLastPointEvent(ptLast);//通知外部绘制最后一个点
3165
3167
  this.PtMax=ptMax;this.PtMin=ptMin;};this.DrawKBar_Up=function(data,dataWidth,upColor,drawType,x,y,left,right,yLow,yHigh,yOpen,yClose,isHScreen)//阳线
3166
3168
  {var isEmptyBar=drawType==3||drawType==6;if(dataWidth>=4){if(isEmptyBar){if(dataWidth%2!=0)dataWidth-=1;}this.Canvas.strokeStyle=upColor;if(data.High>data.Close)//上影线
3167
3169
  {this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(ToFixedPoint(y),ToFixedPoint(x));this.Canvas.lineTo(ToFixedPoint(drawType==3?Math.max(yClose,yOpen):yClose),ToFixedPoint(x));}else{if(isEmptyBar){var xFixed=left+dataWidth/2;this.Canvas.moveTo(ToFixedPoint(xFixed),ToFixedPoint(y));this.Canvas.lineTo(ToFixedPoint(xFixed),ToFixedPoint(Math.min(yClose,yOpen)));}else{this.Canvas.moveTo(ToFixedPoint(x),ToFixedPoint(y));this.Canvas.lineTo(ToFixedPoint(x),ToFixedPoint(yClose));}}this.Canvas.stroke();y=yClose;}else{y=yClose;}this.Canvas.fillStyle=upColor;if(isHScreen){if(Math.abs(yOpen-y)<1){this.Canvas.fillRect(ToFixedRect(y),ToFixedRect(left),1,ToFixedRect(dataWidth));//高度小于1,统一使用高度1
@@ -3564,10 +3566,10 @@ this.DrawPriceGap=function(){if(!IFrameSplitOperator.IsNonEmptyArray(this.AryPri
3564
3566
  {if(isHScreen){rect={Left:start.Coordinate.Low,Right:end.Coordinate.High,Top:start.Coordinate.X,Bottom:border.Bottom};rect.Width=rect.Right-rect.Left;rect.Height=rect.Bottom-rect.Top;rtText={Left:start.Coordinate.Low+2,Top:start.Coordinate.Right+2,Height:textHeight};rtText.Bottom=rtText.Top+rtText.Height;}else{rect={Left:start.Coordinate.X,Right:border.Right,Top:start.Coordinate.Low,Bottom:end.Coordinate.High};rect.Width=rect.Right-rect.Left;rect.Height=rect.Bottom-rect.Top;rtText={Left:start.Coordinate.Right+2,Bottom:rect.Top,Right:rect.Right,Height:textHeight};rtText.Top=rtText.Bottom-rtText.Height;}text=start.Data.Low.toFixed(decNum)+'-'+end.Data.High.toFixed(decNum);}else{continue;}if(!rect)return;this.Canvas.fillStyle=this.PriceGapStyple.Line.Color;this.Canvas.fillRect(rect.Left,rect.Top,rect.Width,rect.Height);if(rtText){var textWidth=this.Canvas.measureText(text).width;rtText.Width=textWidth;rtText.Right=rtText.Left+rtText.Width;this.Canvas.fillStyle=this.PriceGapStyple.Text.Color;if(isHScreen){this.Canvas.save();this.Canvas.translate(rtText.Left,rtText.Top);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillText(text,0,0);this.Canvas.restore();}else{if(rtText.Right>rect.Right){rtText.Right=rect.Right;rtText.Left=rtText.Right-rtText.Width;}this.Canvas.fillStyle=this.PriceGapStyple.Text.Color;this.Canvas.fillText(text,rtText.Left,rtText.Bottom);}//this.Canvas.fillStyle="rgb(250,250,250)"
3565
3567
  //this.Canvas.fillRect(rtText.Left, rtText.Top, rtText.Width, rtText.Height);
3566
3568
  }}};//是否有缺口
3567
- this.IsPriceGrap=function(item,preItem){if(!preItem||!item)return 0;if(preItem.Data.Low>item.Data.High)return 2;//下缺口
3569
+ this.IsPriceGap=function(item,preItem){if(!preItem||!item)return 0;if(preItem.Data.Low>item.Data.High)return 2;//下缺口
3568
3570
  if(preItem.Data.High<item.Data.Low)return 1;//上缺口
3569
3571
  return-1;};//检测缺口是不回补了
3570
- this.CheckPriceGrap=function(kItemInfo){var kItem=kItemInfo.Data;for(var i=0;i<this.AryPriceGapCache.length;++i){var item=this.AryPriceGapCache[i];var start=item.Data[0];var end=item.Data[1];if(item.Type==1)//上缺口
3572
+ this.CheckPriceGap=function(kItemInfo){var kItem=kItemInfo.Data;for(var i=0;i<this.AryPriceGapCache.length;++i){var item=this.AryPriceGapCache[i];var start=item.Data[0];var end=item.Data[1];if(item.Type==1)//上缺口
3571
3573
  {if(kItem.Low<=start.Data.High){this.AryPriceGapCache.splice(i,1);--i;continue;}if(kItem.Low<end.Data.Low)item.Data[1]=kItemInfo;}else if(item.Type==2)//下缺口
3572
3574
  {if(kItem.High>=start.Data.Low){this.AryPriceGapCache.splice(i,1);--i;continue;}if(kItem.High>end.Data.High)item.Data[1]=kItemInfo;}}};}function ChartColorKline(){this.newMethod=IChartPainting;//派生
3573
3575
  this.newMethod();delete this.newMethod;this.ClassName='ChartColorKline';//类名
@@ -4959,9 +4961,9 @@ if(!isLast||option.PositionEx===1){var config={};if(!isLast)config.EmptyBGColor=
4959
4961
  info.ExtendData={Custom:config};}return info;};this.GetFirstOpenPrice=function()//获取显示第1个数据的开盘价
4960
4962
  {if(!this.Data)return null;var xPointCount=this.Frame.XPointCount;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j){var data=this.Data.Data[i];if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;if(ChartData.IsTickPeriod(this.Period))return data.YClose;else return data.Open;}return null;};this.GetLast2ndClose=function()//获取最后第2根K线收盘加
4961
4963
  {if(!this.Data)return null;if(this.Data.Data.length<=0)return null;var xPointCount=this.Frame.XPointCount;var endIndex=this.Data.DataOffset+xPointCount-1;if(endIndex>=this.Data.Data.length)endIndex=this.Data.Data.length-1;var price=null;for(var i=endIndex,count=0;i>=0&&i<this.Data.Data.length;--i){var data=this.Data.Data[i];if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;if(count==0)price=data.Open;else if(count==1)price=data.Close;++count;if(count>=2)break;}return price;};this.CustomFixedCoordinate=function(option)//固定坐标刻度
4962
- {var defaultfloatPrecision=GetfloatPrecision(this.Symbol);for(var i in option.Data){var item=option.Data[i];var info=new CoordinateInfo();info.Type=1;info.TextColor=item.TextColor;info.LineColor=item.Color;info.LineType=2;//虚线
4964
+ {var defaultfloatPrecision=GetfloatPrecision(this.Symbol);for(var i=0;i<option.Data.length;++i){var item=option.Data[i];var info=new CoordinateInfo();info.Type=1;info.TextColor=item.TextColor;info.LineColor=item.Color;info.LineType=2;//虚线
4963
4965
  if(IFrameSplitOperator.IsNumber(option.LineType))info.LineType=option.LineType;if(IFrameSplitOperator.IsPlusNumber(option.LineWidth))info.LineWidth=option.LineWidth;if(option.LineDash)info.LineDash=option.LineDash;if(option.IsShowLine==false)info.LineType=-1;info.Value=item.Value;var text;if(item.Text)text=item.Text;else text=info.Value.toFixed(defaultfloatPrecision);if(option.Position=='left')info.Message[0]=text;else info.Message[1]=text;if(option.PositionEx===1)info.ExtendData={Custom:{Position:1}};//强制画在内部
4964
- this.Frame.CustomHorizontalInfo.push(info);}};//////////////////////
4966
+ if(IFrameSplitOperator.IsNonEmptyArray(item.ExtendLine))info.ExtendLine=item.ExtendLine.slice();this.Frame.CustomHorizontalInfo.push(info);}};//////////////////////
4965
4967
  // data.Min data.Max data.Interval data.Count
4966
4968
  //
4967
4969
  this.IntegerCoordinateSplit2=function(data){var splitItem=this.FrameSplitData2.Find(data.Interval);if(!splitItem)return false;if(data.Interval==splitItem.FixInterval)return true;//调整到整数倍数,不能整除的 +1
@@ -12624,7 +12626,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
12624
12626
  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);};}/********************************************************************************
12625
12627
  * 版本信息输出
12626
12628
  *
12627
- */var HQCHART_VERSION="1.1.12996";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();//把给外界调用的方法暴露出来
12629
+ */var HQCHART_VERSION="1.1.13002";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();//把给外界调用的方法暴露出来
12628
12630
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
12629
12631
  // BaseIndex:BaseIndex,
12630
12632
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.12997",
3
+ "version": "1.1.13003",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -9100,6 +9100,7 @@ function CoordinateInfo()
9100
9100
  this.LineDash=null; //当线段类型==2时 可以设置虚线样式
9101
9101
  this.LineType=1; //线段类型 -1=不画线段 2=虚线, 8,9=集合竞价坐标
9102
9102
  this.LineWidth; //线段宽度
9103
+ this.ExtendLine; //延长线长度[ ] { Width:长度 } [0]=左 [1]=右 实例: [null, { Width: 50}];
9103
9104
  this.ExtendData; //扩展属性
9104
9105
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
9105
9106
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
@@ -11529,6 +11530,16 @@ function AverageWidthFrame()
11529
11530
  var textLeft=right+textWidth-itemText.Width;
11530
11531
  }
11531
11532
 
11533
+ if (item.ExtendLine && item.ExtendLine[1]) //右侧延长线
11534
+ {
11535
+ var exLine=item.ExtendLine[1];
11536
+ if (IFrameSplitOperator.IsNumber(exLine.Width))
11537
+ {
11538
+ if (i==0) this.DrawLine(right,right+exLine.Width,y,item.LineColor,item.LineType,item);
11539
+ textLeft+=exLine.Width;
11540
+ }
11541
+ }
11542
+
11532
11543
  if (emptyBGColor)
11533
11544
  {
11534
11545
  this.Canvas.fillStyle=emptyBGColor;
@@ -22814,9 +22825,9 @@ function ChartKLine()
22814
22825
 
22815
22826
  if (this.PriceGap.Enable && preKItemInfo)
22816
22827
  {
22817
- this.CheckPriceGrap(kItemInfo);
22828
+ this.CheckPriceGap(kItemInfo);
22818
22829
 
22819
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
22830
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
22820
22831
  if (value>0)
22821
22832
  this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
22822
22833
  }
@@ -23007,8 +23018,8 @@ function ChartKLine()
23007
23018
 
23008
23019
  if (preKItemInfo)
23009
23020
  {
23010
- this.CheckPriceGrap(kItemInfo);
23011
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
23021
+ this.CheckPriceGap(kItemInfo);
23022
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
23012
23023
  if (value>0) this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
23013
23024
  }
23014
23025
 
@@ -23123,8 +23134,8 @@ function ChartKLine()
23123
23134
 
23124
23135
  if (preKItemInfo)
23125
23136
  {
23126
- this.CheckPriceGrap(kItemInfo);
23127
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
23137
+ this.CheckPriceGap(kItemInfo);
23138
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
23128
23139
  if (value>0) this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
23129
23140
  }
23130
23141
 
@@ -23297,9 +23308,9 @@ function ChartKLine()
23297
23308
 
23298
23309
  if (this.PriceGap.Enable && preKItemInfo)
23299
23310
  {
23300
- this.CheckPriceGrap(kItemInfo);
23311
+ this.CheckPriceGap(kItemInfo);
23301
23312
 
23302
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
23313
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
23303
23314
  if (value>0)
23304
23315
  this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
23305
23316
  }
@@ -26931,7 +26942,7 @@ function ChartKLine()
26931
26942
  }
26932
26943
 
26933
26944
  //是否有缺口
26934
- this.IsPriceGrap=function(item, preItem)
26945
+ this.IsPriceGap=function(item, preItem)
26935
26946
  {
26936
26947
  if (!preItem || !item) return 0;
26937
26948
 
@@ -26943,7 +26954,7 @@ function ChartKLine()
26943
26954
  }
26944
26955
 
26945
26956
  //检测缺口是不回补了
26946
- this.CheckPriceGrap=function(kItemInfo)
26957
+ this.CheckPriceGap=function(kItemInfo)
26947
26958
  {
26948
26959
  var kItem=kItemInfo.Data;
26949
26960
  for(var i=0;i<this.AryPriceGapCache.length;++i)
@@ -44738,7 +44749,7 @@ function FrameSplitKLinePriceY()
44738
44749
  this.CustomFixedCoordinate=function(option) //固定坐标刻度
44739
44750
  {
44740
44751
  var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
44741
- for(var i in option.Data)
44752
+ for(var i=0; i<option.Data.length; ++i)
44742
44753
  {
44743
44754
  var item=option.Data[i];
44744
44755
  var info=new CoordinateInfo();
@@ -44759,6 +44770,7 @@ function FrameSplitKLinePriceY()
44759
44770
  else info.Message[1]=text;
44760
44771
 
44761
44772
  if (option.PositionEx===1) info.ExtendData={ Custom:{ Position:1 } }; //强制画在内部
44773
+ if (IFrameSplitOperator.IsNonEmptyArray(item.ExtendLine)) info.ExtendLine=item.ExtendLine.slice();
44762
44774
 
44763
44775
  this.Frame.CustomHorizontalInfo.push(info);
44764
44776
  }
@@ -12992,6 +12992,7 @@ function CoordinateInfo()
12992
12992
  this.LineDash=null; //当线段类型==2时 可以设置虚线样式
12993
12993
  this.LineType=1; //线段类型 -1=不画线段 2=虚线, 8,9=集合竞价坐标
12994
12994
  this.LineWidth; //线段宽度
12995
+ this.ExtendLine; //延长线长度[ ] { Width:长度 } [0]=左 [1]=右 实例: [null, { Width: 50}];
12995
12996
  this.ExtendData; //扩展属性
12996
12997
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
12997
12998
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
@@ -15421,6 +15422,16 @@ function AverageWidthFrame()
15421
15422
  var textLeft=right+textWidth-itemText.Width;
15422
15423
  }
15423
15424
 
15425
+ if (item.ExtendLine && item.ExtendLine[1]) //右侧延长线
15426
+ {
15427
+ var exLine=item.ExtendLine[1];
15428
+ if (IFrameSplitOperator.IsNumber(exLine.Width))
15429
+ {
15430
+ if (i==0) this.DrawLine(right,right+exLine.Width,y,item.LineColor,item.LineType,item);
15431
+ textLeft+=exLine.Width;
15432
+ }
15433
+ }
15434
+
15424
15435
  if (emptyBGColor)
15425
15436
  {
15426
15437
  this.Canvas.fillStyle=emptyBGColor;
@@ -26706,9 +26717,9 @@ function ChartKLine()
26706
26717
 
26707
26718
  if (this.PriceGap.Enable && preKItemInfo)
26708
26719
  {
26709
- this.CheckPriceGrap(kItemInfo);
26720
+ this.CheckPriceGap(kItemInfo);
26710
26721
 
26711
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
26722
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
26712
26723
  if (value>0)
26713
26724
  this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
26714
26725
  }
@@ -26899,8 +26910,8 @@ function ChartKLine()
26899
26910
 
26900
26911
  if (preKItemInfo)
26901
26912
  {
26902
- this.CheckPriceGrap(kItemInfo);
26903
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
26913
+ this.CheckPriceGap(kItemInfo);
26914
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
26904
26915
  if (value>0) this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
26905
26916
  }
26906
26917
 
@@ -27015,8 +27026,8 @@ function ChartKLine()
27015
27026
 
27016
27027
  if (preKItemInfo)
27017
27028
  {
27018
- this.CheckPriceGrap(kItemInfo);
27019
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
27029
+ this.CheckPriceGap(kItemInfo);
27030
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
27020
27031
  if (value>0) this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
27021
27032
  }
27022
27033
 
@@ -27189,9 +27200,9 @@ function ChartKLine()
27189
27200
 
27190
27201
  if (this.PriceGap.Enable && preKItemInfo)
27191
27202
  {
27192
- this.CheckPriceGrap(kItemInfo);
27203
+ this.CheckPriceGap(kItemInfo);
27193
27204
 
27194
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
27205
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
27195
27206
  if (value>0)
27196
27207
  this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
27197
27208
  }
@@ -30823,7 +30834,7 @@ function ChartKLine()
30823
30834
  }
30824
30835
 
30825
30836
  //是否有缺口
30826
- this.IsPriceGrap=function(item, preItem)
30837
+ this.IsPriceGap=function(item, preItem)
30827
30838
  {
30828
30839
  if (!preItem || !item) return 0;
30829
30840
 
@@ -30835,7 +30846,7 @@ function ChartKLine()
30835
30846
  }
30836
30847
 
30837
30848
  //检测缺口是不回补了
30838
- this.CheckPriceGrap=function(kItemInfo)
30849
+ this.CheckPriceGap=function(kItemInfo)
30839
30850
  {
30840
30851
  var kItem=kItemInfo.Data;
30841
30852
  for(var i=0;i<this.AryPriceGapCache.length;++i)
@@ -48630,7 +48641,7 @@ function FrameSplitKLinePriceY()
48630
48641
  this.CustomFixedCoordinate=function(option) //固定坐标刻度
48631
48642
  {
48632
48643
  var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
48633
- for(var i in option.Data)
48644
+ for(var i=0; i<option.Data.length; ++i)
48634
48645
  {
48635
48646
  var item=option.Data[i];
48636
48647
  var info=new CoordinateInfo();
@@ -48651,6 +48662,7 @@ function FrameSplitKLinePriceY()
48651
48662
  else info.Message[1]=text;
48652
48663
 
48653
48664
  if (option.PositionEx===1) info.ExtendData={ Custom:{ Position:1 } }; //强制画在内部
48665
+ if (IFrameSplitOperator.IsNonEmptyArray(item.ExtendLine)) info.ExtendLine=item.ExtendLine.slice();
48654
48666
 
48655
48667
  this.Frame.CustomHorizontalInfo.push(info);
48656
48668
  }
@@ -129545,7 +129557,7 @@ function ScrollBarBGChart()
129545
129557
 
129546
129558
 
129547
129559
 
129548
- var HQCHART_VERSION="1.1.12996";
129560
+ var HQCHART_VERSION="1.1.13002";
129549
129561
 
129550
129562
  function PrintHQChartVersion()
129551
129563
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12996";
8
+ var HQCHART_VERSION="1.1.13002";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -13036,6 +13036,7 @@ function CoordinateInfo()
13036
13036
  this.LineDash=null; //当线段类型==2时 可以设置虚线样式
13037
13037
  this.LineType=1; //线段类型 -1=不画线段 2=虚线, 8,9=集合竞价坐标
13038
13038
  this.LineWidth; //线段宽度
13039
+ this.ExtendLine; //延长线长度[ ] { Width:长度 } [0]=左 [1]=右 实例: [null, { Width: 50}];
13039
13040
  this.ExtendData; //扩展属性
13040
13041
  //百分比 { PriceColor:, PercentageColor:, SplitColor:, Font: }
13041
13042
  //自定义刻度 { Custom:{ Position: 1=强制内部 }}
@@ -15465,6 +15466,16 @@ function AverageWidthFrame()
15465
15466
  var textLeft=right+textWidth-itemText.Width;
15466
15467
  }
15467
15468
 
15469
+ if (item.ExtendLine && item.ExtendLine[1]) //右侧延长线
15470
+ {
15471
+ var exLine=item.ExtendLine[1];
15472
+ if (IFrameSplitOperator.IsNumber(exLine.Width))
15473
+ {
15474
+ if (i==0) this.DrawLine(right,right+exLine.Width,y,item.LineColor,item.LineType,item);
15475
+ textLeft+=exLine.Width;
15476
+ }
15477
+ }
15478
+
15468
15479
  if (emptyBGColor)
15469
15480
  {
15470
15481
  this.Canvas.fillStyle=emptyBGColor;
@@ -26750,9 +26761,9 @@ function ChartKLine()
26750
26761
 
26751
26762
  if (this.PriceGap.Enable && preKItemInfo)
26752
26763
  {
26753
- this.CheckPriceGrap(kItemInfo);
26764
+ this.CheckPriceGap(kItemInfo);
26754
26765
 
26755
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
26766
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
26756
26767
  if (value>0)
26757
26768
  this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
26758
26769
  }
@@ -26943,8 +26954,8 @@ function ChartKLine()
26943
26954
 
26944
26955
  if (preKItemInfo)
26945
26956
  {
26946
- this.CheckPriceGrap(kItemInfo);
26947
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
26957
+ this.CheckPriceGap(kItemInfo);
26958
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
26948
26959
  if (value>0) this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
26949
26960
  }
26950
26961
 
@@ -27059,8 +27070,8 @@ function ChartKLine()
27059
27070
 
27060
27071
  if (preKItemInfo)
27061
27072
  {
27062
- this.CheckPriceGrap(kItemInfo);
27063
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
27073
+ this.CheckPriceGap(kItemInfo);
27074
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
27064
27075
  if (value>0) this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
27065
27076
  }
27066
27077
 
@@ -27233,9 +27244,9 @@ function ChartKLine()
27233
27244
 
27234
27245
  if (this.PriceGap.Enable && preKItemInfo)
27235
27246
  {
27236
- this.CheckPriceGrap(kItemInfo);
27247
+ this.CheckPriceGap(kItemInfo);
27237
27248
 
27238
- var value=this.IsPriceGrap(kItemInfo,preKItemInfo);
27249
+ var value=this.IsPriceGap(kItemInfo,preKItemInfo);
27239
27250
  if (value>0)
27240
27251
  this.AryPriceGapCache.push({ Data:[preKItemInfo, kItemInfo], Type:value });
27241
27252
  }
@@ -30867,7 +30878,7 @@ function ChartKLine()
30867
30878
  }
30868
30879
 
30869
30880
  //是否有缺口
30870
- this.IsPriceGrap=function(item, preItem)
30881
+ this.IsPriceGap=function(item, preItem)
30871
30882
  {
30872
30883
  if (!preItem || !item) return 0;
30873
30884
 
@@ -30879,7 +30890,7 @@ function ChartKLine()
30879
30890
  }
30880
30891
 
30881
30892
  //检测缺口是不回补了
30882
- this.CheckPriceGrap=function(kItemInfo)
30893
+ this.CheckPriceGap=function(kItemInfo)
30883
30894
  {
30884
30895
  var kItem=kItemInfo.Data;
30885
30896
  for(var i=0;i<this.AryPriceGapCache.length;++i)
@@ -48674,7 +48685,7 @@ function FrameSplitKLinePriceY()
48674
48685
  this.CustomFixedCoordinate=function(option) //固定坐标刻度
48675
48686
  {
48676
48687
  var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
48677
- for(var i in option.Data)
48688
+ for(var i=0; i<option.Data.length; ++i)
48678
48689
  {
48679
48690
  var item=option.Data[i];
48680
48691
  var info=new CoordinateInfo();
@@ -48695,6 +48706,7 @@ function FrameSplitKLinePriceY()
48695
48706
  else info.Message[1]=text;
48696
48707
 
48697
48708
  if (option.PositionEx===1) info.ExtendData={ Custom:{ Position:1 } }; //强制画在内部
48709
+ if (IFrameSplitOperator.IsNonEmptyArray(item.ExtendLine)) info.ExtendLine=item.ExtendLine.slice();
48698
48710
 
48699
48711
  this.Frame.CustomHorizontalInfo.push(info);
48700
48712
  }
@@ -129703,7 +129715,7 @@ function HQChartScriptWorker()
129703
129715
 
129704
129716
 
129705
129717
 
129706
- var HQCHART_VERSION="1.1.12996";
129718
+ var HQCHART_VERSION="1.1.13002";
129707
129719
 
129708
129720
  function PrintHQChartVersion()
129709
129721
  {