hqchart 1.1.13994 → 1.1.14001

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.
@@ -2397,20 +2397,22 @@ this.GetYData=function(y,isLimit){if(this.Logarithmic&&this.GetYLogarithmicFromD
2397
2397
  {if(isLimit==false){return(y-this.ChartBorder.GetTopEx())/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}else{if(y<this.ChartBorder.GetTopEx())return this.HorizontalMin;if(y>this.ChartBorder.GetBottomEx())return this.HorizontalMax;return(y-this.ChartBorder.GetTopEx())/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}}else{if(isLimit==false){return(this.ChartBorder.GetBottomEx()-y)/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}else{if(y<this.ChartBorder.GetTopEx())return this.HorizontalMax;if(y>this.ChartBorder.GetBottomEx())return this.HorizontalMin;return(this.ChartBorder.GetBottomEx()-y)/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}}};//X坐标转x轴数值
2398
2398
  this.GetXData=function(x){if(x<=this.ChartBorder.GetLeft())return 0;if(x>=this.ChartBorder.GetRight())return this.XPointCount;return(x-this.ChartBorder.GetLeft())*(this.XPointCount*1.0/this.ChartBorder.GetWidth());};//选中的画图工具X,Y轴坐标信息
2399
2399
  this.DrawPictureXCoordinate=function(drawPicture,range,option){if(this.IsHScreen)return;if(!range)return;if(!IFrameSplitOperator.IsNonEmptyArray(range.Points))return;var border=this.GetBorder();var left=border.Left;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";if(range.X){var xRange=range.X;var xLeft=xRange.Min.X;var xRight=xRange.Max.X;if(xLeft<left)xLeft=left;if(xRight>right)xRight=right;this.Canvas.fillStyle=this.DrawPicture.BGColor;this.Canvas.fillRect(xLeft,border.Bottom,xRight-xLeft,fontHeight);}for(var i=0;i<range.Points.length;++i){var item=range.Points[i];if(item.X<left||item.X>right)continue;var index=this.GetXData(item.X,false);var index=Math.round(index);var kItem=this.GetKItem(index);if(kItem){var text=IFrameSplitOperator.FormatDateString(kItem.Date,null);if(ChartData.IsMinutePeriod(option.Period))text+=" "+IFrameSplitOperator.FormatTimeString(kItem.Time,"HH:MM");else if(ChartData.IsMilliSecondPeriod(option.Period))text+=" "+IFrameSplitOperator.FormatTimeString(kItem.Time,"HH:MM:SS.fff");var textWidth=this.Canvas.measureText(text).width+2;var textLeft=item.X-textWidth/2;if(textLeft<left)textLeft=left;this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(textLeft,border.Bottom,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yCenter=border.Bottom+fontHeight;this.Canvas.fillText(text,textLeft+1,yCenter);}}};this.GetKItem=function(currentIndex){if(!this.Data)return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return null;var index=this.Data.DataOffset+currentIndex;return this.Data.Data[index];};this.DrawPictureYCoordinate=function(drawPicture,range,option){if(this.IsHScreen)return;if(!range)return;if(!IFrameSplitOperator.IsNonEmptyArray(range.Points))return;var border=this.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var defaultfloatPrecision=2;if(option&&option.Symbol)defaultfloatPrecision=GetfloatPrecision(option.Symbol);var textWidth=0;for(var i=0;i<range.Points.length;++i){var item=range.Points[i];var Value=this.GetYData(item.Y);var text=Value.toFixed(defaultfloatPrecision);var value=this.Canvas.measureText(text).width;if(textWidth<value)textWidth=value;range.Points[i].Text=text;}textWidth+=this.YTextPadding[1]+2;if(range.Y){var yRange=range.Y;var yTop=yRange.Min.Y;var yBottom=yRange.Max.Y;if(yRange.Min.Y<top)yTop=top;if(yRange.Max.Y>bottom)yBottom=bottom;this.Canvas.fillStyle=this.DrawPicture.BGColor;this.Canvas.fillRect(right,yTop,textWidth+5,yBottom-yTop);}for(var i=0;i<range.Points.length;++i){var item=range.Points[i];if(item.Y<top||item.Y>bottom)continue;this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(right,item.Y-fontHeight/2,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yText=item.Y+fontHeight/2;this.Canvas.fillText(item.Text,right+this.YTextPadding[1],yText);}};this.DrawPicturePointYCoordinate=function(drawPicture,option){if(this.IsHScreen)return;if(!drawPicture.GetYCoordinatePoint)return;var aryPoint=drawPicture.GetYCoordinatePoint();if(!IFrameSplitOperator.IsNonEmptyArray(aryPoint))return;var border=this.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var defaultfloatPrecision=2;if(option&&option.Symbol)defaultfloatPrecision=GetfloatPrecision(option.Symbol);for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];if(!item)continue;if(item.Y<top||item.Y>bottom)continue;var text=item.YValue.toFixed(defaultfloatPrecision);var textWidth=this.Canvas.measureText(text).width+2;textWidth+=this.YTextPadding[1];this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(right,item.Y-fontHeight/2,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yText=item.Y+fontHeight/2;this.Canvas.fillText(text,right+this.YTextPadding[1],yText);}};//字体外部设置好
2400
- this.GetCustomItemTextInfo=function(item,bLeft,pixelTatio){var text=bLeft?item.Message[0]:item.Message[1];var aryText=[];var width=0;if(Array.isArray(text)){for(var i=0;i<text.length;++i){var item=text[i];if(item.Type===1){aryText.push({Type:item.Type});}else{var value=this.Canvas.measureText(text[i].Text).width;if(value>width)width=value;var outItem={Text:text[i].Text,Width:value+2*pixelTatio};if(item.TextColor)outItem.TextColor=item.TextColor;aryText.push(outItem);}}if(width>0)width+=2*pixelTatio;}else{width=this.Canvas.measureText(text).width+2*pixelTatio;aryText.push({Text:text,Width:width});}return{MaxWidth:width,Text:aryText};};this.DrawOutRangeCustomItem=function(item,mapTextRect){if(this.IsHScreen===true)return;if(!this.IsShow&&!this.IsYDrawMainFrame)return;if(!item.Message[1]&&!item.Message[0])return;if(!item.OutRange)return;var position=0;//1=top 2=bottom
2400
+ this.GetCustomItemTextInfo=function(item,bLeft,pixelTatio){var text=bLeft?item.Message[0]:item.Message[1];var aryText=[];var width=0;if(Array.isArray(text)){for(var i=0;i<text.length;++i){var item=text[i];if(item.Type===1){aryText.push({Type:item.Type});}else{var value=this.Canvas.measureText(text[i].Text).width;if(value>width)width=value;var outItem={Text:text[i].Text,Width:value+2*pixelTatio};if(item.TextColor)outItem.TextColor=item.TextColor;if(item.BGColor)outItem.BGColor=item.BGColor;if(IFrameSplitOperator.IsBool(item.EnableBGColor))outItem.EnableBGColor=item.EnableBGColor;//是否启用背景色
2401
+ aryText.push(outItem);}}if(width>0)width+=2*pixelTatio;}else{width=this.Canvas.measureText(text).width+2*pixelTatio;aryText.push({Text:text,Width:width});}return{MaxWidth:width,Text:aryText};};this.DrawOutRangeCustomItem=function(item,mapTextRect){if(this.IsHScreen===true)return;if(!this.IsShow&&!this.IsYDrawMainFrame)return;if(!item.Message[1]&&!item.Message[0])return;if(!item.OutRange)return;var position=0;//1=top 2=bottom
2401
2402
  if(item.Value>this.HorizontalMax)position=1;else if(item.Value<this.HorizontalMin)position=2;else return;this.Canvas.save();var outRange=item.OutRange;var border=this.GetBorder();var left=border.Left;var right=border.Right;var bottom=border.Bottom;var top=border.Top;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var titleHeight=this.ChartBorder.TitleHeight;if(this.IsHScreen){borderLeft=this.ChartBorder.Top;borderRight=this.ChartBorder.Bottom;top=border.Top;bottom=border.Bottom;}var pixelTatio=GetDevicePixelRatio();var defaultTextHeight=18*pixelTatio;var textHeight=defaultTextHeight;if(item.Message[0]&&borderLeft>=10){if(item.Font!=null)this.Canvas.font=item.Font;var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var itemLeft=left-textWidth;var fontHeight=this.GetFontHeight();var textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";var yText=null;if(position==1){yText=border.TopEx;if(IFrameSplitOperator.IsNumber(outRange.TopYOffset))yText+=outRange.TopYOffset;}else if(position==2){yText=border.BottomEx+textHeight;if(IFrameSplitOperator.IsNumber(outRange.BottomYOffset))yText+=outRange.BottomYOffset;}for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];var rtBG={Left:itemLeft,Width:itemText.Width,Bottom:yText,Height:textHeight};rtBG.Top=rtBG.Bottom-rtBG.Height;rtBG.Right=rtBG.Left+rtBG.Width;if(item.ExtendLine&&item.ExtendLine[0])//右侧延长线
2402
2403
  {var exLine=item.ExtendLine[0];if(IFrameSplitOperator.IsNumber(exLine.Width)){var yLine=rtBG.Bottom;if(position==2)yLine=rtBG.Top;var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(outRange.ExtendLine.Type))lineType=outRange.ExtendLine.Type;if(i==0)this.DrawLine(left,left-exLine.Width,yLine,item.LineColor,lineType,item);rtBG.Left-=exLine.Width;rtBG.Right-=exLine.Width;}}this.Canvas.fillStyle=outRange.BGColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);if(outRange.Border&&outRange.Border.Color){if(IFrameSplitOperator.IsNonEmptyArray(outRange.Border.LineDash))this.Canvas.setLineDash(outRange.Border.LineDash);//虚线
2403
2404
  this.Canvas.strokeStyle=outRange.Border.Color;this.Canvas.strokeRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));}this.Canvas.fillStyle=outRange.TextColor;this.Canvas.fillText(itemText.Text,rtBG.Right-1*pixelTatio,rtBG.Top+rtBG.Height/2+1*pixelTatio);yText+=textHeight+1;}}else if(item.Message[1]&&borderRight>=10){if(item.Font!=null)this.Canvas.font=item.Font;var textInfo=this.GetCustomItemTextInfo(item,false,pixelTatio);var textWidth=textInfo.MaxWidth;var itemRight=right+textWidth;var fontHeight=this.GetFontHeight();var textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var yText=null;if(position==1){yText=border.TopEx;if(IFrameSplitOperator.IsNumber(outRange.TopYOffset))yText+=outRange.TopYOffset;}else if(position==2){yText=border.BottomEx+textHeight;if(IFrameSplitOperator.IsNumber(outRange.BottomYOffset))yText+=outRange.BottomYOffset;}for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];var rtBG={Right:itemRight,Width:itemText.Width,Bottom:yText,Height:textHeight};rtBG.Top=rtBG.Bottom-rtBG.Height;rtBG.Left=rtBG.Right-rtBG.Width;if(item.ExtendLine&&item.ExtendLine[1])//右侧延长线
2404
2405
  {var exLine=item.ExtendLine[1];if(IFrameSplitOperator.IsNumber(exLine.Width)){var yLine=rtBG.Bottom;if(position==2)yLine=rtBG.Top;var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(outRange.ExtendLine.Type))lineType=outRange.ExtendLine.Type;if(i==0)this.DrawLine(right,right+exLine.Width,yLine,item.LineColor,lineType,item);rtBG.Left+=exLine.Width;rtBG.Right+=exLine.Width;}}this.Canvas.fillStyle=outRange.BGColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);if(outRange.Border&&outRange.Border.Color){if(IFrameSplitOperator.IsNonEmptyArray(outRange.Border.LineDash))this.Canvas.setLineDash(outRange.Border.LineDash);//虚线
2405
2406
  this.Canvas.strokeStyle=outRange.Border.Color;this.Canvas.strokeRect(ToFixedPoint(rtBG.Left),ToFixedPoint(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));}this.Canvas.fillStyle=outRange.TextColor;this.Canvas.fillText(itemText.Text,rtBG.Left+1*pixelTatio,rtBG.Top+rtBG.Height/2+1*pixelTatio);yText+=textHeight+1;}}this.Canvas.restore();};this.DrawCustomItem=function(item,mapTextRect)//显示自定义Y刻度
2406
- {if(!item.Message[1]&&!item.Message[0])return;if(item.Value>this.HorizontalMax||item.Value<this.HorizontalMin){this.DrawOutRangeCustomItem(item,mapTextRect);this.SendDrawCountDownEvent({IsShow:false});return;}var border=this.GetBorder();var left=border.Left;var right=border.Right;var bottom=border.Bottom;var top=border.Top;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var titleHeight=this.ChartBorder.TitleHeight;if(this.IsHScreen){borderLeft=this.ChartBorder.Top;borderRight=this.ChartBorder.Bottom;top=border.Top;bottom=border.Bottom;}var pixelTatio=GetDevicePixelRatio();var defaultTextHeight=18*pixelTatio;var textHeight=defaultTextHeight;var y;if(item.Value=="TopEx")y=border.TopEx;else if(item.Value=="TopTitle")y=border.TopTitle;else if(item.Value=="Top")y=border.Top;else if(item.Value=="BottomEx")y=border.BottomEx;else if(item.Value=="Bottom")y=border.Bottom;else y=this.GetYFromData(item.Value);if(IFrameSplitOperator.IsNumber(item.YOffset))y+=item.YOffset;var position=0;var emptyBGColor;if(item.ExtendData&&item.ExtendData.Custom){var customItem=item.ExtendData.Custom;if(IFrameSplitOperator.IsNumber(customItem.Position))position=customItem.Position;if(customItem.EmptyBGColor)emptyBGColor=customItem.EmptyBGColor;}if(item.Message[0])// 左 position=2 集合竞价右侧
2407
+ {if(!item.Message[1]&&!item.Message[0])return;if(item.Value>this.HorizontalMax||item.Value<this.HorizontalMin){this.DrawOutRangeCustomItem(item,mapTextRect);this.SendDrawCountDownEvent({IsShow:false});return;}var border=this.GetBorder();var left=border.Left;var right=border.Right;var bottom=border.Bottom;var top=border.Top;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var titleHeight=this.ChartBorder.TitleHeight;if(this.IsHScreen){borderLeft=this.ChartBorder.Top;borderRight=this.ChartBorder.Bottom;top=border.Top;bottom=border.Bottom;}var pixelTatio=GetDevicePixelRatio();var defaultTextHeight=5*pixelTatio;var textHeight=defaultTextHeight;var y;if(item.Value=="TopEx")y=border.TopEx;else if(item.Value=="TopTitle")y=border.TopTitle;else if(item.Value=="Top")y=border.Top;else if(item.Value=="BottomEx")y=border.BottomEx;else if(item.Value=="Bottom")y=border.Bottom;else y=this.GetYFromData(item.Value);if(IFrameSplitOperator.IsNumber(item.YOffset))y+=item.YOffset;var position=0;var emptyBGColor;if(item.ExtendData&&item.ExtendData.Custom){var customItem=item.ExtendData.Custom;if(IFrameSplitOperator.IsNumber(customItem.Position))position=customItem.Position;if(customItem.EmptyBGColor)emptyBGColor=customItem.EmptyBGColor;}if(item.Message[0])// 左 position=2 集合竞价右侧
2407
2408
  {if(borderLeft<10||position==1||position==2){if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,true,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+')';//内部刻度 背景增加透明度
2408
2409
  if(item.BGColor)bgColor=item.BGColor;var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){var bgTop=top;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(bgTop+itemText.Width,bottom,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{if(itemText.Type===1){}else{if(position==2)left=border.LeftEx-textInfo.MaxWidth;var bgTop=yText-textHeight/2-1*pixelTatio;var textLeft=left+1*pixelTatio;if(item.ExtendLine&&item.ExtendLine[0]&&position==2)//左侧延长线
2409
2410
  {var exLine=item.ExtendLine[0];if(IFrameSplitOperator.IsNumber(exLine.Width)){var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(exLine.Type))lineType=exLine.Type;//外部设置延长线样式
2410
2411
  if(i==0){var yLine=border.LeftEx-exLine.Width;this.DrawLine(yLine,yLine+exLine.Width,y,item.LineColor,lineType,item);}textLeft-=exLine.Width;//rectLeft-=exLine.Width
2411
2412
  }}this.Canvas.fillStyle=bgColor;this.Canvas.fillRect(textLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft+1*pixelTatio,yText);if(i==0){if(position==2)this.DrawLine(border.LeftEx,right,yText,item.LineColor,item.LineType,item);else this.DrawLine(textLeft+itemText.Width,right,yText,item.LineColor,item.LineType,item);}if(item.ClickData)this.AddHorizontalLabel(textLeft,bgTop,itemText.Width,textHeight,item,i);yText+=textHeight+1*pixelTatio;}}}}else{if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var yText=y;for(var i=0;i<textInfo.Text.length;++i){var itemText=textInfo.Text[i];if(this.IsHScreen){if(i==0)var bgTop=top-itemText.Width;else var bgTop=top-textWidth;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(bgTop+itemText.Width,bottom,yText,item.LineColor,item.LineType,item);yText-=textHeight+1*pixelTatio;}else{var bgTop=yText-textHeight/2-1*pixelTatio;if(i==0){var rectLeft=left-itemText.Width;var textLeft=left;}else{var rectLeft=left-textWidth;var textLeft=left-(textWidth-itemText.Width);}if(item.ExtendLine&&item.ExtendLine[0])//右侧延长线
2412
2413
  {var exLine=item.ExtendLine[0];if(IFrameSplitOperator.IsNumber(exLine.Width)){var lineType=item.LineType;if(IFrameSplitOperator.IsNumber(exLine.Type))lineType=exLine.Type;//外部设置延长线样式
2413
- if(i==0)this.DrawLine(left,left-exLine.Width,y,item.LineColor,lineType,item);textLeft-=exLine.Width;rectLeft-=exLine.Width;}}if(emptyBGColor){this.Canvas.fillStyle=emptyBGColor;this.Canvas.fillRect(rectLeft-1,bgTop,itemText.Width+1,textHeight);this.Canvas.strokeStyle=item.LineColor;this.Canvas.strokeRect(ToFixedPoint(rectLeft-1),ToFixedPoint(bgTop),ToFixedPoint(itemText.Width+1),ToFixedPoint(textHeight));this.Canvas.fillStyle=item.LineColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}else{this.Canvas.fillStyle=item.LineColor;this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}if(i==0)this.DrawLine(left,right,yText,item.LineColor,item.LineType,item);if(item.ClickData)//点击事件
2414
+ var exLineColor=item.LineColor;if(exLine.LineColor)exLineColor=exLine.LineColor;//设置线段颜色
2415
+ if(i==0)this.DrawLine(left,left-exLine.Width,y,exLineColor,lineType,item);textLeft-=exLine.Width;rectLeft-=exLine.Width;}}if(emptyBGColor){this.Canvas.fillStyle=emptyBGColor;this.Canvas.fillRect(rectLeft-1,bgTop,itemText.Width+1,textHeight);this.Canvas.strokeStyle=item.LineColor;this.Canvas.strokeRect(ToFixedPoint(rectLeft-1),ToFixedPoint(bgTop),ToFixedPoint(itemText.Width+1),ToFixedPoint(textHeight));this.Canvas.fillStyle=item.LineColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}else{if(!(itemText.EnableBGColor===false)){var textBGColor=item.LineColor;if(itemText.BGColor)textBGColor=itemText.BGColor;this.Canvas.fillStyle=textBGColor;this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);}this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(itemText.Text,textLeft-1*pixelTatio,yText);}if(i==0)this.DrawLine(left,right,yText,item.LineColor,item.LineType,item);if(item.ClickData)//点击事件
2414
2416
  this.AddHorizontalLabel(textLeft,bgTop,itemText.Width,textHeight,item,i);yText+=textHeight+1*pixelTatio;}}}}else if(item.Message[1])//右
2415
2417
  {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+')';//内部刻度 背景增加透明度
2416
2418
  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);//文本背景区域
@@ -13111,7 +13113,7 @@ this.CanvasElement=document.createElement("canvas");this.CanvasElement.className
13111
13113
  var height=this.DivElement.offsetHeight;var width=this.DivElement.offsetWidth;if(this.DivElement.style.height&&this.DivElement.style.width){if(this.DivElement.style.height.includes("px"))height=parseInt(this.DivElement.style.height.replace("px",""));if(this.DivElement.style.width.includes("px"))width=parseInt(this.DivElement.style.width.replace("px",""));}this.CanvasElement.height=height;this.CanvasElement.width=width;this.CanvasElement.style.width=this.CanvasElement.width+'px';this.CanvasElement.style.height=this.CanvasElement.height+'px';var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
13112
13114
  this.CanvasElement.height*=pixelTatio;this.CanvasElement.width*=pixelTatio;JSConsole.Chart.Log('[JSTReportChart::OnSize] devicePixelRatio='+window.devicePixelRatio+', height='+this.CanvasElement.height+', width='+this.CanvasElement.width);if(this.JSChartContainer&&this.JSChartContainer.OnSize){this.JSChartContainer.OnSize();}};this.SetOption=function(option){var chart=this.CreateJSTReportChartContainer(option);if(!chart)return false;if(option.OnCreatedCallback)option.OnCreatedCallback(chart);this.JSChartContainer=chart;this.DivElement.JSChart=this;//div中保存一份
13113
13115
  if(option.EnableResize==true)this.CreateResizeListener();if(option.Symbol){chart.Draw();var name=option.Symbol;if(option.Name)name=option.Name;chart.ChangeSymbol(option.Symbol,{Name:name});//下载列表码表
13114
- }};this.CreateJSTReportChartContainer=function(option){var chart=new JSTReportChartContainer(this.CanvasElement);chart.Create(option);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;if(IFrameSplitOperator.IsNonEmptyArray(option.Column))chart.SetColumn(option.Column);if(IFrameSplitOperator.IsNonEmptyArray(option.Tab))chart.SetTab(option.Tab);if(IFrameSplitOperator.IsNumber(option.TabSelected))chart.SetSelectedTab(option.TabSelected);if(IFrameSplitOperator.IsBool(option.EnableDragRow))chart.EnableDragRow=option.EnableDragRow;if(IFrameSplitOperator.IsNumber(option.DragRowType))chart.DragRowType=option.DragRowType;if(IFrameSplitOperator.IsBool(option.EnableDragHeader))chart.EnableDragHeader=option.EnableDragHeader;if(option.SortInfo){var item=option.SortInfo;if(IFrameSplitOperator.IsNumber(item.Field))chart.SortInfo.Field=item.Field;if(IFrameSplitOperator.IsNumber(item.Sort))chart.SortInfo.Sort=item.Sort;}this.SetChartBorder(chart,option);//是否自动更新
13116
+ }};this.CreateJSTReportChartContainer=function(option){var chart=new JSTReportChartContainer(this.CanvasElement);chart.Create(option);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;if(IFrameSplitOperator.IsNonEmptyArray(option.Column))chart.SetColumn(option.Column);if(IFrameSplitOperator.IsNonEmptyArray(option.Tab))chart.SetTab(option.Tab);if(IFrameSplitOperator.IsNumber(option.TabSelected))chart.SetSelectedTab(option.TabSelected);if(IFrameSplitOperator.IsBool(option.EnableDragRow))chart.EnableDragRow=option.EnableDragRow;if(IFrameSplitOperator.IsNumber(option.DragRowType))chart.DragRowType=option.DragRowType;if(IFrameSplitOperator.IsBool(option.EnableDragHeader))chart.EnableDragHeader=option.EnableDragHeader;if(IFrameSplitOperator.IsBool(option.EnablePageCycle))chart.EnablePageCycle=option.EnablePageCycle;if(option.SortInfo){var item=option.SortInfo;if(IFrameSplitOperator.IsNumber(item.Field))chart.SortInfo.Field=item.Field;if(IFrameSplitOperator.IsNumber(item.Sort))chart.SortInfo.Sort=item.Sort;}this.SetChartBorder(chart,option);//是否自动更新
13115
13117
  if(option.IsAutoUpdate!=null)chart.IsAutoUpdate=option.IsAutoUpdate;if(option.AutoUpdateFrequency>0)chart.AutoUpdateFrequency=option.AutoUpdateFrequency;if(IFrameSplitOperator.IsBool(option.EnableFilter))chart.EnableFilter=option.EnableFilter;//注册事件
13116
13118
  if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}return chart;};this.SetChartBorder=function(chart,option){if(!option.Border)return;var item=option.Border;if(IFrameSplitOperator.IsNumber(option.Border.Left))chart.Frame.ChartBorder.Left=option.Border.Left;if(IFrameSplitOperator.IsNumber(option.Border.Right))chart.Frame.ChartBorder.Right=option.Border.Right;if(IFrameSplitOperator.IsNumber(option.Border.Top))chart.Frame.ChartBorder.Top=option.Border.Top;if(IFrameSplitOperator.IsNumber(option.Border.Bottom))chart.Frame.ChartBorder.Bottom=option.Border.Bottom;var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
13117
13119
  chart.Frame.ChartBorder.Left*=pixelTatio;chart.Frame.ChartBorder.Right*=pixelTatio;chart.Frame.ChartBorder.Top*=pixelTatio;chart.Frame.ChartBorder.Bottom*=pixelTatio;};this.CreateResizeListener=function(){var _this62=this;this.ResizeListener=new ResizeObserver(function(entries){_this62.OnDivResize(entries);});this.ResizeListener.observe(this.DivElement);};this.OnDivResize=function(entries){JSConsole.Chart.Log("[JSTReportChart::OnDivResize] entries=",entries);this.OnSize();};/////////////////////////////////////////////////////////////////////////////
@@ -13155,6 +13157,7 @@ this.UIElement=uielement;this.LastPoint=new Point();//鼠标位置
13155
13157
  this.IsOnTouch=false;this.TouchDrag;this.TouchMoveMinAngle=70;//左右移动最小角度
13156
13158
  this.YStepPixel=5*GetDevicePixelRatio();this.XStepPixel=10*GetDevicePixelRatio();//拖拽滚动条
13157
13159
  this.DragXScroll=null;//{Start:{x,y}, End:{x, y}}
13160
+ this.EnablePageCycle=false;//是否循环翻页
13158
13161
  this.IsDestroy=false;//是否已经销毁了
13159
13162
  this.ChartDestory=function()//销毁
13160
13163
  {this.IsDestroy=true;this.StopAutoUpdate();};//创建
@@ -13236,8 +13239,8 @@ case TREPORT_COLUMN_ID.POSITION_ID://持仓量
13236
13239
  case TREPORT_COLUMN_ID.AMPLITUDE_ID:case TREPORT_COLUMN_ID.INCREASE_ID:return this.LocalNumberSort(left,right,column,sortType,cellType);default:return 0;}};this.LocalNumberSort=function(left,right,column,sortType,cellType){var leftStock=this.GetExePriceData(left);var rightStock=this.GetExePriceData(right);var leftValue=-99999999999999,rightValue=-99999999999999;if(sortType==2)leftValue=rightValue=99999999999999;var filedName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);if(cellType==0)//行权价格
13237
13240
  {if(leftStock&&IFrameSplitOperator.IsNumber(leftStock.ExePrice))leftValue=leftStock.ExePrice;if(rightStock&&IFrameSplitOperator.IsNumber(rightStock.ExePrice))rightValue=rightStock.ExePrice;}else if(cellType==1){if(leftStock&&leftStock.LeftData){var value=leftStock.LeftData[filedName];if(IFrameSplitOperator.IsNumber(value))leftValue=value;}if(rightStock&&rightStock.LeftData){var value=rightStock.LeftData[filedName];if(IFrameSplitOperator.IsNumber(value))rightValue=value;}}else if(cellType==2){if(leftStock&&leftStock.RightData){var value=leftStock.RightData[filedName];if(IFrameSplitOperator.IsNumber(value))leftValue=value;}if(rightStock&&rightStock.RightData){var value=rightStock.RightData[filedName];if(IFrameSplitOperator.IsNumber(value))rightValue=value;}}if(sortType==1){if(rightValue<leftValue)return-1;else if(rightValue<leftValue)return 1;else return 0;}else{if(leftValue<rightValue)return-1;else if(leftValue>rightValue)return 1;else return 0;}};this.GetTReportChart=function(){var chart=this.ChartPaint[0];return chart;};this.OnWheel=function(e)//滚轴
13238
13241
  {JSConsole.Chart.Log('[JSTReportChartContainer::OnWheel]',e);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;var x=e.clientX-this.UIElement.getBoundingClientRect().left;var y=e.clientY-this.UIElement.getBoundingClientRect().top;var isInClient=false;this.Canvas.beginPath();this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());isInClient=this.Canvas.isPointInPath(x,y);if(!isInClient)return;var chart=this.GetTReportChart();if(!chart)return;var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;if(wheelValue<0)//下
13239
- {var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}}else if(wheelValue>0)//上
13240
- {var result=this.MoveSelectedRow(-1);if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}}if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.OnKeyDown=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var reportChart=this.GetTReportChart();if(!reportChart)return;var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){/*
13242
+ {var result=this.MoveSelectedRow(1,{EnablePageCycle:this.EnablePageCycle});if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}}else if(wheelValue>0)//上
13243
+ {var result=this.MoveSelectedRow(-1,{EnablePageCycle:this.EnablePageCycle});if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}}if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.OnKeyDown=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var reportChart=this.GetTReportChart();if(!reportChart)return;var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){/*
13241
13244
  case 33: //page up
13242
13245
  if (this.GotoPreviousPage(this.PageUpDownCycle))
13243
13246
  {
@@ -13253,10 +13256,13 @@ case TREPORT_COLUMN_ID.AMPLITUDE_ID:case TREPORT_COLUMN_ID.INCREASE_ID:return th
13253
13256
  }
13254
13257
  break;
13255
13258
  */case 38://up
13256
- var result=this.MoveSelectedRow(-1);if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}break;case 40://down
13257
- var result=this.MoveSelectedRow(1);if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}break;}//不让滚动条滚动
13258
- if(e.preventDefault)e.preventDefault();else e.returnValue=false;};this.MoveSelectedRow=function(step){var chart=this.ChartPaint[0];if(!chart)return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return null;var result={Redraw:false,Update:false};//Redraw=重绘, Update=更新数据
13259
- var pageStatus=chart.GetCurrentPageStatus();var pageSize=pageStatus.PageSize;var selectedIndex=pageStatus.Start;var cellType=1;if(pageStatus.SelectedRow){cellType=pageStatus.SelectedRow.CellType;for(var i=0;i<this.Data.Data.length;++i){if(pageStatus.SelectedRow.ExePrice==this.Data.Data[i]){selectedIndex=i;break;}}}if(step>0){if(selectedIndex<0||selectedIndex<pageStatus.Start||selectedIndex>pageStatus.End){chart.SelectedRow={ExePrice:this.Data.Data[pageStatus.Start],CellType:cellType};result.Redraw=true;return result;}var offset=this.Data.YOffset;for(var i=0;i<step;++i){++selectedIndex;if(selectedIndex>pageStatus.End)++offset;if(selectedIndex>=this.Data.Data.length){selectedIndex=0;offset=0;}}result.Redraw=true;result.Update=offset!=this.Data.YOffset;chart.SelectedRow={ExePrice:this.Data.Data[selectedIndex],CellType:cellType};this.Data.YOffset=offset;return result;}else if(step<0){if(selectedIndex<0||selectedIndex<pageStatus.Start||selectedIndex>pageStatus.End){chart.SelectedRow={ExePrice:this.Data.Data[pageStatus.End],CellType:cellType};result.Redraw=true;return result;}step=Math.abs(step);var offset=this.Data.YOffset;for(var i=0;i<step;++i){--selectedIndex;if(selectedIndex<pageStatus.Start)--offset;if(selectedIndex<0){selectedIndex=this.Data.Data.length-1;offset=this.Data.Data.length-pageSize;if(offset<0)offset=0;}}result.Redraw=true;result.Update=offset!=this.Data.YOffset;chart.SelectedRow={ExePrice:this.Data.Data[selectedIndex],CellType:cellType};this.Data.YOffset=offset;return result;}return null;};//obj={ ID:, Color: , Time:, Count: }
13259
+ var result=this.MoveSelectedRow(-1,{EnablePageCycle:this.EnablePageCycle});if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}break;case 40://down
13260
+ var result=this.MoveSelectedRow(1,{EnablePageCycle:this.EnablePageCycle});if(result){if(result.Redraw)this.Draw();if(result.Update)this.DelayUpdateStockData();}break;}//不让滚动条滚动
13261
+ if(e.preventDefault)e.preventDefault();else e.returnValue=false;};//是否循环翻页 { EnablePageCycle: true/false }
13262
+ this.MoveSelectedRow=function(step,option){var chart=this.ChartPaint[0];if(!chart)return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return null;var bPageCycle=false;if(option){if(IFrameSplitOperator.IsBool(option.EnablePageCycle))bPageCycle=option.EnablePageCycle;}var result={Redraw:false,Update:false};//Redraw=重绘, Update=更新数据
13263
+ var pageStatus=chart.GetCurrentPageStatus();var pageSize=pageStatus.PageSize;var selectedIndex=pageStatus.Start;var cellType=1;if(pageStatus.SelectedRow){cellType=pageStatus.SelectedRow.CellType;for(var i=0;i<this.Data.Data.length;++i){if(pageStatus.SelectedRow.ExePrice==this.Data.Data[i]){selectedIndex=i;break;}}}if(step>0){if(selectedIndex<0||selectedIndex<pageStatus.Start||selectedIndex>pageStatus.End){chart.SelectedRow={ExePrice:this.Data.Data[pageStatus.Start],CellType:cellType};result.Redraw=true;return result;}var offset=this.Data.YOffset;for(var i=0;i<step;++i){if(selectedIndex+1>=this.Data.Data.length&&!bPageCycle)break;++selectedIndex;if(selectedIndex>pageStatus.End)++offset;if(selectedIndex>=this.Data.Data.length){selectedIndex=0;offset=0;}}result.Redraw=true;result.Update=offset!=this.Data.YOffset;chart.SelectedRow={ExePrice:this.Data.Data[selectedIndex],CellType:cellType};this.Data.YOffset=offset;return result;}else if(step<0){if(selectedIndex<0||selectedIndex<pageStatus.Start||selectedIndex>pageStatus.End){chart.SelectedRow={ExePrice:this.Data.Data[pageStatus.End],CellType:cellType};result.Redraw=true;return result;}step=Math.abs(step);var offset=this.Data.YOffset;for(var i=0;i<step;++i){if(selectedIndex<=0&&!bPageCycle)//不能循环翻页
13264
+ break;--selectedIndex;if(selectedIndex<pageStatus.Start)--offset;if(selectedIndex<0)//自动翻到最后一页
13265
+ {selectedIndex=this.Data.Data.length-1;offset=this.Data.Data.length-pageSize;if(offset<0)offset=0;}}result.Redraw=true;result.Update=offset!=this.Data.YOffset;chart.SelectedRow={ExePrice:this.Data.Data[selectedIndex],CellType:cellType};this.Data.YOffset=offset;return result;}return null;};//obj={ ID:, Color: , Time:, Count: }
13260
13266
  this.SetFlashBGItem=function(symbol,obj){var item={ID:obj.ID,Color:obj.Color,Count:1};if(IFrameSplitOperator.IsNumber(obj.Count))item.Count=obj.Count;if(IFrameSplitOperator.IsNumber(obj.Time))item.Time=obj.Time;else item.Time=Date.now();if(this.FlashBG.has(symbol)){var stockItem=this.FlashBG.get(symbol);stockItem.LastTime=item.Time;stockItem.Data.set(item.ID,item);}else{var stockItem={LastTime:item.Time,Data:new _map2.default([[item.ID,item]])};this.FlashBG.set(symbol,stockItem);}};this.GetFlashBGData=function(symbol,time){if(!this.FlashBG)return null;if(!this.FlashBG.has(symbol))return null;var timeDiff=3*1000;var stockItem=this.FlashBG.get(symbol);if(time-stockItem.LastTime>=timeDiff)//超时的删除
13261
13267
  {this.FlashBG.delete(symbol);return null;}if(!stockItem.Data||stockItem.Data.size<=0){this.FlashBG.delete(symbol);return null;}var aryDelID=[];//超时需要参数的
13262
13268
  var _iteratorNormalCompletion26=true;var _didIteratorError26=false;var _iteratorError26=undefined;try{for(var _iterator26=(0,_getIterator3.default)(stockItem.Data),_step26;!(_iteratorNormalCompletion26=(_step26=_iterator26.next()).done);_iteratorNormalCompletion26=true){var mapItem=_step26.value;var item=mapItem[1];if(time-item.Time>=timeDiff||item.Count<=0)aryDelID.push(item.ID);}}catch(err){_didIteratorError26=true;_iteratorError26=err;}finally{try{if(!_iteratorNormalCompletion26&&_iterator26.return){_iterator26.return();}}finally{if(_didIteratorError26){throw _iteratorError26;}}}if(IFrameSplitOperator.IsNonEmptyArray(aryDelID)){for(var i=0;i<aryDelID.length;++i){stockItem.Data.delete(aryDelID[i]);}if(stockItem.Data.size<=0){this.FlashBG.delete(symbol);return null;}}return stockItem;};}function JSTReportFrame(){this.ChartBorder;this.Canvas;//画布
@@ -13330,7 +13336,8 @@ this.Column=//{ Type:列id, Title:标题, TextAlign:文字对齐方式, MaxText:
13330
13336
  //{ Type:TREPORT_COLUMN_ID.SELL_VOL_ID, Title:"卖量", TextAlign:"right", Width:null, MaxText:"88888", TextColor:g_JSChartResource.TReport.FieldColor.Vol },
13331
13337
  //{ Type:TREPORT_COLUMN_ID.POSITION_ID, Title:"持仓量", TextAlign:"right", Width:null, MaxText:"88888", TextColor:g_JSChartResource.TReport.FieldColor.Position },
13332
13338
  {Type:TREPORT_COLUMN_ID.NAME_ID,Title:"合约代码",TextAlign:"right",Width:null,TextColor:g_JSChartResource.TReport.FieldColor.Name,MaxText:"AAAAAA-A-AAAA"}];this.CenterColumn={Type:TREPORT_COLUMN_ID.EXE_PRICE_ID,Title:"购<行权价>沽",TextAlign:"center",Width:null,MaxText:"99999.99",Sort:1,SortType:[1,2]};this.RectClient={};this.TooltipRect=[];this.ReloadResource=function(resource){};this.SetColumn=function(aryColumn){if(!IFrameSplitOperator.IsNonEmptyArray(aryColumn))return;this.Column=[];for(var i=0;i<aryColumn.length;++i){var item=aryColumn[i];var colItem=this.GetDefaultColunm(item.Type);if(!colItem)continue;if(item.Title)colItem.Title=item.Title;if(item.TextAlign)colItem.TextAlign=item.TextAlign;if(item.TextColor)colItem.TextColor=item.TextColor;if(item.MaxText)colItem.MaxText=item.MaxText;if(item.ID)colItem.ID=item.ID;if(IFrameSplitOperator.IsNumber(item.Sort))colItem.Sort=item.Sort;if(IFrameSplitOperator.IsBool(item.EnableTooltip))colItem.EnableTooltip=item.EnableTooltip;if(IFrameSplitOperator.IsNumber(item.FixedWidth))colItem.FixedWidth=item.FixedWidth;if(IFrameSplitOperator.IsNumber(item.FloatPrecision))colItem.FloatPrecision=item.FloatPrecision;//小数位数
13333
- if(item.Sort==1)//1本地排序 2=远程排序
13339
+ if(IFrameSplitOperator.IsNumber(item.ColorType))colItem.ColorType=item.ColorType;//0=默认 1=(>0, =0, <0) 2=(>=0, <0)
13340
+ if(item.DefaultText)colItem.DefaultText=item.DefaultText;if(item.Sort==1)//1本地排序 2=远程排序
13334
13341
  {colItem.SortType=[1,2];//默认 降序 ,升序
13335
13342
  if(IFrameSplitOperator.IsNonEmptyArray(item.SortType))colItem.SortType=item.SortType.slice();}this.Column.push(colItem);}};this.GetDefaultColunm=function(id){var DEFAULT_COLUMN=[{Type:TREPORT_COLUMN_ID.INDEX_ID,Title:"序号",TextAlign:"center",Width:null,TextColor:g_JSChartResource.TReport.FieldColor.Index,MaxText:"8888"},{Type:TREPORT_COLUMN_ID.SYMBOL_ID,Title:"代码",TextAlign:"right",Width:null,TextColor:g_JSChartResource.TReport.FieldColor.Symbol,MaxText:"888888"},{Type:TREPORT_COLUMN_ID.NAME_ID,Title:"合约名称",TextAlign:"right",Width:null,TextColor:g_JSChartResource.TReport.FieldColor.Name,MaxText:"AAAAAA-A-AAAA"},{Type:TREPORT_COLUMN_ID.INCREASE_ID,Title:"涨幅%",TextAlign:"right",Width:null,MaxText:"-888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.PRICE_ID,Title:"现价",TextAlign:"right",Width:null,MaxText:"88888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.UPDOWN_ID,Title:"涨跌",TextAlign:"right",Width:null,MaxText:"-888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.AMPLITUDE_ID,Title:"振幅%",TextAlign:"right",Width:null,MaxText:"888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.BUY_PRICE_ID,Title:"买价",TextAlign:"right",Width:null,MaxText:"88888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.SELL_PRICE_ID,Title:"卖价",TextAlign:"right",Width:null,MaxText:"88888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.AVERAGE_PRICE_ID,Title:"均价",TextAlign:"right",Width:null,MaxText:"88888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.OPEN_ID,Title:"今开",TextAlign:"right",Width:null,MaxText:"88888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.HIGH_ID,Title:"最高",TextAlign:"right",Width:null,MaxText:"88888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.LOW_ID,Title:"最低",TextAlign:"right",Width:null,MaxText:"88888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.YCLOSE_ID,Title:"昨收",TextAlign:"right",Width:null,MaxText:"88888.88",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.POSITION_ID,Title:"持仓量",TextAlign:"right",Width:null,MaxText:"88888",Sort:1,SortType:[1,2,0],TextColor:g_JSChartResource.TReport.FieldColor.Position},{Type:TREPORT_COLUMN_ID.VOL_ID,Title:"总量",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Vol,Width:null,MaxText:"88888",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.AMOUNT_ID,Title:"总金额",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Amount,Width:null,MaxText:"8888.8擎",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.BUY_VOL_ID,Title:"买量",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Vol,Width:null,MaxText:"88888",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.SELL_VOL_ID,Title:"卖量",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Vol,Width:null,MaxText:"88888",Sort:1,SortType:[1,2,0]},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER1_ID,Title:"数值1",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER2_ID,Title:"数值2",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER3_ID,Title:"数值3",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER4_ID,Title:"数值4",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER5_ID,Title:"数值5",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER6_ID,Title:"数值6",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER7_ID,Title:"数值7",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER8_ID,Title:"数值8",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER9_ID,Title:"数值9",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2},{Type:TREPORT_COLUMN_ID.RESERVE_NUMBER10_ID,Title:"数值10",TextAlign:"right",TextColor:g_JSChartResource.TReport.FieldColor.Text,MaxText:"9999.99",FloatPrecision:2}];for(var i=0;i<DEFAULT_COLUMN.length;++i){var item=DEFAULT_COLUMN[i];if(item.Type==id)return item;}return null;};this.Draw=function(){this.ShowSymbol=[];this.TooltipRect=[];this.RectSelectedRow=null;if(this.GlobalOption)this.GlobalOption.FlashBGCount=0;if(this.SizeChange)this.CalculateSize();else this.UpdateCacheData();this.Canvas.save();this.Canvas.beginPath();this.Canvas.rect(this.RectClient.Left,this.RectClient.Top,this.RectClient.Right-this.RectClient.Left,this.RectClient.Bottom-this.RectClient.Top);//this.Canvas.stroke(); //调试用
13336
13343
  this.Canvas.clip();this.DrawHeader();this.DrawBody();this.Canvas.restore();//this.DrawBorder();
@@ -13354,9 +13361,11 @@ case TREPORT_COLUMN_ID.SELL_PRICE_ID://卖价
13354
13361
  var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);if(fieldName)this.GetPriceDrawInfo(data[fieldName],data,exePriceData,drawInfo);break;case TREPORT_COLUMN_ID.SELL_VOL_ID://卖量
13355
13362
  case TREPORT_COLUMN_ID.BUY_VOL_ID://买量
13356
13363
  case TREPORT_COLUMN_ID.POSITION_ID://持仓量
13357
- var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);if(fieldName)drawInfo.Text=this.FormatVolString(data[fieldName]);break;case TREPORT_COLUMN_ID.INCREASE_ID:case TREPORT_COLUMN_ID.UPDOWN_ID:case TREPORT_COLUMN_ID.AMPLITUDE_ID:var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);if(fieldName){var value=data[fieldName];if(IFrameSplitOperator.IsNumber(value)){drawInfo.Text=value.toFixed(2);drawInfo.TextColor=this.GetUpDownColor(value,0);}else{this.GetNullDrawInfo(drawInfo);}}break;case TREPORT_COLUMN_ID.RESERVE_NUMBER1_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER2_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER3_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER4_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER5_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER6_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER7_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER8_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER9_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER10_ID:this.FormatReserveNumber(column,data,drawInfo);break;default:drawInfo.Text='-----';}this.GetMarkBorderData(drawInfo,exePriceData.ExePrice,column.Type,cellType);this.GetFlashBGData(drawInfo,exePriceData,column.Type,cellType);}this.DrawCell(drawInfo,exePriceData,column.Type,cellType);};this.FormatReserveNumber=function(column,data,drawInfo){var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);if(!fieldName)return;var value=data[fieldName];if(!IFrameSplitOperator.IsNumber(value))return;//TODO: 不同类型的 格式化输出
13364
+ case TREPORT_COLUMN_ID.VOL_ID://成交量
13365
+ case TREPORT_COLUMN_ID.AMOUNT_ID://成交金额
13366
+ var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);if(fieldName)drawInfo.Text=this.FormatVolString(data[fieldName]);break;case TREPORT_COLUMN_ID.INCREASE_ID:case TREPORT_COLUMN_ID.UPDOWN_ID:case TREPORT_COLUMN_ID.AMPLITUDE_ID:var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);if(fieldName){var value=data[fieldName];if(IFrameSplitOperator.IsNumber(value)){drawInfo.Text=value.toFixed(2);drawInfo.TextColor=this.GetUpDownColor(value,0);}else{this.GetNullDrawInfo(drawInfo);}}break;case TREPORT_COLUMN_ID.RESERVE_NUMBER1_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER2_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER3_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER4_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER5_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER6_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER7_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER8_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER9_ID:case TREPORT_COLUMN_ID.RESERVE_NUMBER10_ID:this.FormatReserveNumber(column,data,drawInfo);break;default:drawInfo.Text='-----';}this.GetMarkBorderData(drawInfo,exePriceData.ExePrice,column.Type,cellType);this.GetFlashBGData(drawInfo,exePriceData,column.Type,cellType);}this.DrawCell(drawInfo,exePriceData,column.Type,cellType);};this.FormatReserveNumber=function(column,data,drawInfo){if(column.DefaultText)drawInfo.Text=column.DefaultText;var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);if(!fieldName)return;var value=data[fieldName];if(!IFrameSplitOperator.IsNumber(value))return;if(IFrameSplitOperator.IsNumber(column.ColorType)){if(column.ColorType==1){drawInfo.TextColor=this.GetUpDownColor(value,0);}else if(column.ColorType==2){drawInfo.TextColor=this.GetUpDownColorV2(value,0);}}//TODO: 不同类型的 格式化输出
13358
13367
  drawInfo.Text=value.toFixed(column.FloatPrecision);};this.GetFlashBGData=function(drawInfo,exePriceData,columnType,cellType){if(!exePriceData.TData)return;var data=null;if(cellType==1)data=exePriceData.TData.LeftFlashBG;else if(cellType==2)data=exePriceData.TData.RightFlashBG;if(!data||!data.Data)return;if(data.Data.has(columnType)){var item=data.Data.get(columnType);drawInfo.FlashBGColor=item.Color;--item.Count;if(this.GlobalOption)++this.GlobalOption.FlashBGCount;}};this.GetMarkBorderData=function(drawInfo,exePrice,columnType,cellType){if(!this.BorderData||!this.BorderData.MapData)return;if(!this.BorderData.MapData.has(columnType))return;var borderData=this.BorderData.MapData.get(columnType);if(!IFrameSplitOperator.IsNonEmptyArray(borderData.Data))return;if(cellType==1){var leftBorder=borderData.Data[1];if(!leftBorder)return;if(leftBorder.ExePrice==exePrice){drawInfo.BorderColor=this.MarkBorderConfig.MaxPositionColor;}}else if(cellType==2){var rightBorder=borderData.Data[2];if(!rightBorder)return;if(rightBorder.ExePrice==exePrice){drawInfo.BorderColor=this.MarkBorderConfig.MaxPositionColor;}}};this.GetNullDrawInfo=function(drawInfo){drawInfo.Text="--";drawInfo.TextColor=this.UnchangeColor;};this.GetPriceDrawInfo=function(price,stock,data,drawInfo){if(!IFrameSplitOperator.IsNumber(price)){this.GetNullDrawInfo(drawInfo);return;}drawInfo.Text=price.toFixed(data.Decimal);if(!IFrameSplitOperator.IsNumber(stock.YClose))drawInfo.TextColor=this.UnchangeColor;else drawInfo.TextColor=this.GetUpDownColor(price,stock.YClose);};//单独处理成交量显示
13359
- this.FormatVolString=function(value,languageID){if(!IFrameSplitOperator.IsNumber(value))return null;return IFrameSplitOperator.FormatVolString(value,languageID);};this.GetUpDownColor=function(price,price2){if(price>price2)return this.UpColor;else if(price<price2)return this.DownColor;else return this.UnchangeColor;};this.DrawCell=function(drawInfo){var rtText=drawInfo.RectText;var yCenter=rtText.Top+rtText.Height/2;if(drawInfo.BGColor)//背景
13368
+ this.FormatVolString=function(value,languageID){if(!IFrameSplitOperator.IsNumber(value))return null;return IFrameSplitOperator.FormatVolString(value,languageID);};this.GetUpDownColor=function(price,price2){if(price>price2)return this.UpColor;else if(price<price2)return this.DownColor;else return this.UnchangeColor;};this.GetUpDownColorV2=function(price,price2){if(price>=price2)return this.UpColor;else return this.DownColor;};this.DrawCell=function(drawInfo){var rtText=drawInfo.RectText;var yCenter=rtText.Top+rtText.Height/2;if(drawInfo.BGColor)//背景
13360
13369
  {var rtItem=drawInfo.Rect;this.Canvas.fillStyle=drawInfo.BGColor;this.Canvas.fillRect(rtItem.Left,rtItem.Top,rtItem.Width,rtItem.Height);}if(drawInfo.FlashBGColor)//闪动背景
13361
13370
  {var rtItem=drawInfo.Rect;this.Canvas.fillStyle=drawInfo.FlashBGColor;this.Canvas.fillRect(rtItem.Left,rtItem.Top,rtItem.Width,rtItem.Height);}if(drawInfo.BorderColor)//边框
13362
13371
  {var rtItem=drawInfo.Rect;this.Canvas.strokeStyle=drawInfo.BorderColor;this.Canvas.strokeRect(ToFixedPoint(rtItem.Left),ToFixedPoint(rtItem.Top+1),ToFixedRect(rtItem.Width),ToFixedRect(rtItem.Height-3));}if(drawInfo.Text)//文字
@@ -13877,7 +13886,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
13877
13886
  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);};}/********************************************************************************
13878
13887
  * 版本信息输出
13879
13888
  *
13880
- */var HQCHART_VERSION="1.1.13993";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
13889
+ */var HQCHART_VERSION="1.1.14000";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
13881
13890
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
13882
13891
  // BaseIndex:BaseIndex,
13883
13892
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13994",
3
+ "version": "1.1.14001",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -96,6 +96,7 @@ function JSTReportChart(divElement)
96
96
  if (IFrameSplitOperator.IsBool(option.EnableDragRow)) chart.EnableDragRow=option.EnableDragRow;
97
97
  if (IFrameSplitOperator.IsNumber(option.DragRowType)) chart.DragRowType=option.DragRowType;
98
98
  if (IFrameSplitOperator.IsBool(option.EnableDragHeader)) chart.EnableDragHeader=option.EnableDragHeader;
99
+ if (IFrameSplitOperator.IsBool(option.EnablePageCycle)) chart.EnablePageCycle=option.EnablePageCycle;
99
100
  if (option.SortInfo)
100
101
  {
101
102
  var item=option.SortInfo;
@@ -318,6 +319,7 @@ function JSTReportChartContainer(uielement)
318
319
 
319
320
  //拖拽滚动条
320
321
  this.DragXScroll=null; //{Start:{x,y}, End:{x, y}}
322
+ this.EnablePageCycle=false; //是否循环翻页
321
323
 
322
324
  this.IsDestroy=false; //是否已经销毁了
323
325
 
@@ -1135,7 +1137,7 @@ function JSTReportChartContainer(uielement)
1135
1137
 
1136
1138
  if (wheelValue<0) //下
1137
1139
  {
1138
- var result=this.MoveSelectedRow(1)
1140
+ var result=this.MoveSelectedRow(1,{ EnablePageCycle:this.EnablePageCycle })
1139
1141
  if (result)
1140
1142
  {
1141
1143
  if (result.Redraw) this.Draw();
@@ -1144,7 +1146,7 @@ function JSTReportChartContainer(uielement)
1144
1146
  }
1145
1147
  else if (wheelValue>0) //上
1146
1148
  {
1147
- var result=this.MoveSelectedRow(-1);
1149
+ var result=this.MoveSelectedRow(-1,{ EnablePageCycle:this.EnablePageCycle} );
1148
1150
  if (result)
1149
1151
  {
1150
1152
  if (result.Redraw) this.Draw();
@@ -1182,7 +1184,7 @@ function JSTReportChartContainer(uielement)
1182
1184
  break;
1183
1185
  */
1184
1186
  case 38: //up
1185
- var result=this.MoveSelectedRow(-1);
1187
+ var result=this.MoveSelectedRow(-1,{EnablePageCycle:this.EnablePageCycle});
1186
1188
  if (result)
1187
1189
  {
1188
1190
  if (result.Redraw) this.Draw();
@@ -1190,7 +1192,7 @@ function JSTReportChartContainer(uielement)
1190
1192
  }
1191
1193
  break;
1192
1194
  case 40: //down
1193
- var result=this.MoveSelectedRow(1)
1195
+ var result=this.MoveSelectedRow(1, {EnablePageCycle:this.EnablePageCycle} )
1194
1196
  if (result)
1195
1197
  {
1196
1198
  if (result.Redraw) this.Draw();
@@ -1204,11 +1206,17 @@ function JSTReportChartContainer(uielement)
1204
1206
  else e.returnValue = false;
1205
1207
  }
1206
1208
 
1207
- this.MoveSelectedRow=function(step)
1209
+ //是否循环翻页 { EnablePageCycle: true/false }
1210
+ this.MoveSelectedRow=function(step, option)
1208
1211
  {
1209
1212
  var chart=this.ChartPaint[0];
1210
1213
  if (!chart) return null;
1211
1214
  if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return null;
1215
+ var bPageCycle=false;
1216
+ if (option)
1217
+ {
1218
+ if (IFrameSplitOperator.IsBool(option.EnablePageCycle)) bPageCycle=option.EnablePageCycle;
1219
+ }
1212
1220
 
1213
1221
  var result={ Redraw:false, Update:false }; //Redraw=重绘, Update=更新数据
1214
1222
 
@@ -1242,6 +1250,9 @@ function JSTReportChartContainer(uielement)
1242
1250
  var offset=this.Data.YOffset;
1243
1251
  for(var i=0;i<step;++i)
1244
1252
  {
1253
+ if (selectedIndex+1>=this.Data.Data.length && !bPageCycle)
1254
+ break;
1255
+
1245
1256
  ++selectedIndex;
1246
1257
  if (selectedIndex>pageStatus.End) ++offset;
1247
1258
 
@@ -1273,10 +1284,13 @@ function JSTReportChartContainer(uielement)
1273
1284
  var offset=this.Data.YOffset;
1274
1285
  for(var i=0;i<step;++i)
1275
1286
  {
1287
+ if (selectedIndex<=0 && !bPageCycle) //不能循环翻页
1288
+ break;
1289
+
1276
1290
  --selectedIndex;
1277
1291
  if (selectedIndex<pageStatus.Start) --offset;
1278
1292
 
1279
- if (selectedIndex<0)
1293
+ if (selectedIndex<0) //自动翻到最后一页
1280
1294
  {
1281
1295
  selectedIndex=this.Data.Data.length-1;
1282
1296
  offset=this.Data.Data.length-pageSize;
@@ -1662,6 +1676,8 @@ function ChartTReport()
1662
1676
  if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
1663
1677
  if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
1664
1678
  if (IFrameSplitOperator.IsNumber(item.FloatPrecision)) colItem.FloatPrecision=item.FloatPrecision; //小数位数
1679
+ if (IFrameSplitOperator.IsNumber(item.ColorType)) colItem.ColorType=item.ColorType; //0=默认 1=(>0, =0, <0) 2=(>=0, <0)
1680
+ if (item.DefaultText) colItem.DefaultText=item.DefaultText;
1665
1681
 
1666
1682
  if (item.Sort==1) //1本地排序 2=远程排序
1667
1683
  {
@@ -2132,6 +2148,8 @@ function ChartTReport()
2132
2148
  case TREPORT_COLUMN_ID.SELL_VOL_ID: //卖量
2133
2149
  case TREPORT_COLUMN_ID.BUY_VOL_ID: //买量
2134
2150
  case TREPORT_COLUMN_ID.POSITION_ID: //持仓量
2151
+ case TREPORT_COLUMN_ID.VOL_ID: //成交量
2152
+ case TREPORT_COLUMN_ID.AMOUNT_ID: //成交金额
2135
2153
  var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);
2136
2154
  if (fieldName) drawInfo.Text=this.FormatVolString(data[fieldName]);
2137
2155
  break;
@@ -2179,12 +2197,26 @@ function ChartTReport()
2179
2197
 
2180
2198
  this.FormatReserveNumber=function(column, data, drawInfo)
2181
2199
  {
2200
+ if (column.DefaultText) drawInfo.Text=column.DefaultText;
2201
+
2182
2202
  var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);
2183
2203
  if (!fieldName) return;
2184
2204
 
2185
2205
  var value=data[fieldName];
2186
2206
  if (!IFrameSplitOperator.IsNumber(value)) return;
2187
2207
 
2208
+ if (IFrameSplitOperator.IsNumber(column.ColorType))
2209
+ {
2210
+ if (column.ColorType==1)
2211
+ {
2212
+ drawInfo.TextColor=this.GetUpDownColor(value,0);
2213
+ }
2214
+ else if (column.ColorType==2)
2215
+ {
2216
+ drawInfo.TextColor=this.GetUpDownColorV2(value,0);
2217
+ }
2218
+ }
2219
+
2188
2220
  //TODO: 不同类型的 格式化输出
2189
2221
  drawInfo.Text=value.toFixed(column.FloatPrecision);
2190
2222
  }
@@ -2274,6 +2306,12 @@ function ChartTReport()
2274
2306
  else return this.UnchangeColor;
2275
2307
  }
2276
2308
 
2309
+ this.GetUpDownColorV2=function(price, price2)
2310
+ {
2311
+ if (price>=price2) return this.UpColor;
2312
+ else return this.DownColor;
2313
+ }
2314
+
2277
2315
  this.DrawCell=function(drawInfo)
2278
2316
  {
2279
2317
  var rtText=drawInfo.RectText;
@@ -12660,6 +12660,8 @@ function AverageWidthFrame()
12660
12660
  if (value>width) width=value;
12661
12661
  var outItem={ Text:text[i].Text, Width:value+2*pixelTatio };
12662
12662
  if (item.TextColor) outItem.TextColor=item.TextColor;
12663
+ if (item.BGColor) outItem.BGColor=item.BGColor;
12664
+ if (IFrameSplitOperator.IsBool(item.EnableBGColor)) outItem.EnableBGColor=item.EnableBGColor; //是否启用背景色
12663
12665
  aryText.push(outItem);
12664
12666
  }
12665
12667
  }
@@ -12868,7 +12870,7 @@ function AverageWidthFrame()
12868
12870
  }
12869
12871
 
12870
12872
  var pixelTatio = GetDevicePixelRatio();
12871
- var defaultTextHeight=18*pixelTatio;
12873
+ var defaultTextHeight=5*pixelTatio;
12872
12874
  var textHeight=defaultTextHeight;
12873
12875
  var y;
12874
12876
 
@@ -13018,9 +13020,11 @@ function AverageWidthFrame()
13018
13020
  {
13019
13021
  var lineType=item.LineType;
13020
13022
  if (IFrameSplitOperator.IsNumber(exLine.Type)) lineType=exLine.Type; //外部设置延长线样式
13021
- if (i==0) this.DrawLine(left,left-exLine.Width,y,item.LineColor,lineType,item);
13023
+ var exLineColor=item.LineColor;
13024
+ if (exLine.LineColor) exLineColor=exLine.LineColor; //设置线段颜色
13025
+ if (i==0) this.DrawLine(left,left-exLine.Width,y,exLineColor,lineType,item);
13022
13026
  textLeft-=exLine.Width;
13023
- rectLeft-=exLine.Width
13027
+ rectLeft-=exLine.Width;
13024
13028
  }
13025
13029
  }
13026
13030
 
@@ -13035,8 +13039,14 @@ function AverageWidthFrame()
13035
13039
  }
13036
13040
  else
13037
13041
  {
13038
- this.Canvas.fillStyle=item.LineColor;
13039
- this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);
13042
+ if (!(itemText.EnableBGColor===false))
13043
+ {
13044
+ var textBGColor=item.LineColor;
13045
+ if (itemText.BGColor) textBGColor=itemText.BGColor;
13046
+ this.Canvas.fillStyle=textBGColor;
13047
+ this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);
13048
+ }
13049
+
13040
13050
  this.Canvas.fillStyle = item.TextColor;
13041
13051
  this.Canvas.fillText(itemText.Text, textLeft - 1*pixelTatio, yText);
13042
13052
  }
@@ -16585,6 +16585,8 @@ function AverageWidthFrame()
16585
16585
  if (value>width) width=value;
16586
16586
  var outItem={ Text:text[i].Text, Width:value+2*pixelTatio };
16587
16587
  if (item.TextColor) outItem.TextColor=item.TextColor;
16588
+ if (item.BGColor) outItem.BGColor=item.BGColor;
16589
+ if (IFrameSplitOperator.IsBool(item.EnableBGColor)) outItem.EnableBGColor=item.EnableBGColor; //是否启用背景色
16588
16590
  aryText.push(outItem);
16589
16591
  }
16590
16592
  }
@@ -16793,7 +16795,7 @@ function AverageWidthFrame()
16793
16795
  }
16794
16796
 
16795
16797
  var pixelTatio = GetDevicePixelRatio();
16796
- var defaultTextHeight=18*pixelTatio;
16798
+ var defaultTextHeight=5*pixelTatio;
16797
16799
  var textHeight=defaultTextHeight;
16798
16800
  var y;
16799
16801
 
@@ -16943,9 +16945,11 @@ function AverageWidthFrame()
16943
16945
  {
16944
16946
  var lineType=item.LineType;
16945
16947
  if (IFrameSplitOperator.IsNumber(exLine.Type)) lineType=exLine.Type; //外部设置延长线样式
16946
- if (i==0) this.DrawLine(left,left-exLine.Width,y,item.LineColor,lineType,item);
16948
+ var exLineColor=item.LineColor;
16949
+ if (exLine.LineColor) exLineColor=exLine.LineColor; //设置线段颜色
16950
+ if (i==0) this.DrawLine(left,left-exLine.Width,y,exLineColor,lineType,item);
16947
16951
  textLeft-=exLine.Width;
16948
- rectLeft-=exLine.Width
16952
+ rectLeft-=exLine.Width;
16949
16953
  }
16950
16954
  }
16951
16955
 
@@ -16960,8 +16964,14 @@ function AverageWidthFrame()
16960
16964
  }
16961
16965
  else
16962
16966
  {
16963
- this.Canvas.fillStyle=item.LineColor;
16964
- this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);
16967
+ if (!(itemText.EnableBGColor===false))
16968
+ {
16969
+ var textBGColor=item.LineColor;
16970
+ if (itemText.BGColor) textBGColor=itemText.BGColor;
16971
+ this.Canvas.fillStyle=textBGColor;
16972
+ this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);
16973
+ }
16974
+
16965
16975
  this.Canvas.fillStyle = item.TextColor;
16966
16976
  this.Canvas.fillText(itemText.Text, textLeft - 1*pixelTatio, yText);
16967
16977
  }
@@ -138802,7 +138812,7 @@ function ScrollBarBGChart()
138802
138812
 
138803
138813
 
138804
138814
 
138805
- var HQCHART_VERSION="1.1.13993";
138815
+ var HQCHART_VERSION="1.1.14000";
138806
138816
 
138807
138817
  function PrintHQChartVersion()
138808
138818
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13993";
8
+ var HQCHART_VERSION="1.1.14000";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -16629,6 +16629,8 @@ function AverageWidthFrame()
16629
16629
  if (value>width) width=value;
16630
16630
  var outItem={ Text:text[i].Text, Width:value+2*pixelTatio };
16631
16631
  if (item.TextColor) outItem.TextColor=item.TextColor;
16632
+ if (item.BGColor) outItem.BGColor=item.BGColor;
16633
+ if (IFrameSplitOperator.IsBool(item.EnableBGColor)) outItem.EnableBGColor=item.EnableBGColor; //是否启用背景色
16632
16634
  aryText.push(outItem);
16633
16635
  }
16634
16636
  }
@@ -16837,7 +16839,7 @@ function AverageWidthFrame()
16837
16839
  }
16838
16840
 
16839
16841
  var pixelTatio = GetDevicePixelRatio();
16840
- var defaultTextHeight=18*pixelTatio;
16842
+ var defaultTextHeight=5*pixelTatio;
16841
16843
  var textHeight=defaultTextHeight;
16842
16844
  var y;
16843
16845
 
@@ -16987,9 +16989,11 @@ function AverageWidthFrame()
16987
16989
  {
16988
16990
  var lineType=item.LineType;
16989
16991
  if (IFrameSplitOperator.IsNumber(exLine.Type)) lineType=exLine.Type; //外部设置延长线样式
16990
- if (i==0) this.DrawLine(left,left-exLine.Width,y,item.LineColor,lineType,item);
16992
+ var exLineColor=item.LineColor;
16993
+ if (exLine.LineColor) exLineColor=exLine.LineColor; //设置线段颜色
16994
+ if (i==0) this.DrawLine(left,left-exLine.Width,y,exLineColor,lineType,item);
16991
16995
  textLeft-=exLine.Width;
16992
- rectLeft-=exLine.Width
16996
+ rectLeft-=exLine.Width;
16993
16997
  }
16994
16998
  }
16995
16999
 
@@ -17004,8 +17008,14 @@ function AverageWidthFrame()
17004
17008
  }
17005
17009
  else
17006
17010
  {
17007
- this.Canvas.fillStyle=item.LineColor;
17008
- this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);
17011
+ if (!(itemText.EnableBGColor===false))
17012
+ {
17013
+ var textBGColor=item.LineColor;
17014
+ if (itemText.BGColor) textBGColor=itemText.BGColor;
17015
+ this.Canvas.fillStyle=textBGColor;
17016
+ this.Canvas.fillRect(rectLeft,bgTop,itemText.Width,textHeight);
17017
+ }
17018
+
17009
17019
  this.Canvas.fillStyle = item.TextColor;
17010
17020
  this.Canvas.fillText(itemText.Text, textLeft - 1*pixelTatio, yText);
17011
17021
  }
@@ -135603,6 +135613,7 @@ function JSTReportChart(divElement)
135603
135613
  if (IFrameSplitOperator.IsBool(option.EnableDragRow)) chart.EnableDragRow=option.EnableDragRow;
135604
135614
  if (IFrameSplitOperator.IsNumber(option.DragRowType)) chart.DragRowType=option.DragRowType;
135605
135615
  if (IFrameSplitOperator.IsBool(option.EnableDragHeader)) chart.EnableDragHeader=option.EnableDragHeader;
135616
+ if (IFrameSplitOperator.IsBool(option.EnablePageCycle)) chart.EnablePageCycle=option.EnablePageCycle;
135606
135617
  if (option.SortInfo)
135607
135618
  {
135608
135619
  var item=option.SortInfo;
@@ -135825,6 +135836,7 @@ function JSTReportChartContainer(uielement)
135825
135836
 
135826
135837
  //拖拽滚动条
135827
135838
  this.DragXScroll=null; //{Start:{x,y}, End:{x, y}}
135839
+ this.EnablePageCycle=false; //是否循环翻页
135828
135840
 
135829
135841
  this.IsDestroy=false; //是否已经销毁了
135830
135842
 
@@ -136642,7 +136654,7 @@ function JSTReportChartContainer(uielement)
136642
136654
 
136643
136655
  if (wheelValue<0) //下
136644
136656
  {
136645
- var result=this.MoveSelectedRow(1)
136657
+ var result=this.MoveSelectedRow(1,{ EnablePageCycle:this.EnablePageCycle })
136646
136658
  if (result)
136647
136659
  {
136648
136660
  if (result.Redraw) this.Draw();
@@ -136651,7 +136663,7 @@ function JSTReportChartContainer(uielement)
136651
136663
  }
136652
136664
  else if (wheelValue>0) //上
136653
136665
  {
136654
- var result=this.MoveSelectedRow(-1);
136666
+ var result=this.MoveSelectedRow(-1,{ EnablePageCycle:this.EnablePageCycle} );
136655
136667
  if (result)
136656
136668
  {
136657
136669
  if (result.Redraw) this.Draw();
@@ -136689,7 +136701,7 @@ function JSTReportChartContainer(uielement)
136689
136701
  break;
136690
136702
  */
136691
136703
  case 38: //up
136692
- var result=this.MoveSelectedRow(-1);
136704
+ var result=this.MoveSelectedRow(-1,{EnablePageCycle:this.EnablePageCycle});
136693
136705
  if (result)
136694
136706
  {
136695
136707
  if (result.Redraw) this.Draw();
@@ -136697,7 +136709,7 @@ function JSTReportChartContainer(uielement)
136697
136709
  }
136698
136710
  break;
136699
136711
  case 40: //down
136700
- var result=this.MoveSelectedRow(1)
136712
+ var result=this.MoveSelectedRow(1, {EnablePageCycle:this.EnablePageCycle} )
136701
136713
  if (result)
136702
136714
  {
136703
136715
  if (result.Redraw) this.Draw();
@@ -136711,11 +136723,17 @@ function JSTReportChartContainer(uielement)
136711
136723
  else e.returnValue = false;
136712
136724
  }
136713
136725
 
136714
- this.MoveSelectedRow=function(step)
136726
+ //是否循环翻页 { EnablePageCycle: true/false }
136727
+ this.MoveSelectedRow=function(step, option)
136715
136728
  {
136716
136729
  var chart=this.ChartPaint[0];
136717
136730
  if (!chart) return null;
136718
136731
  if (!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)) return null;
136732
+ var bPageCycle=false;
136733
+ if (option)
136734
+ {
136735
+ if (IFrameSplitOperator.IsBool(option.EnablePageCycle)) bPageCycle=option.EnablePageCycle;
136736
+ }
136719
136737
 
136720
136738
  var result={ Redraw:false, Update:false }; //Redraw=重绘, Update=更新数据
136721
136739
 
@@ -136749,6 +136767,9 @@ function JSTReportChartContainer(uielement)
136749
136767
  var offset=this.Data.YOffset;
136750
136768
  for(var i=0;i<step;++i)
136751
136769
  {
136770
+ if (selectedIndex+1>=this.Data.Data.length && !bPageCycle)
136771
+ break;
136772
+
136752
136773
  ++selectedIndex;
136753
136774
  if (selectedIndex>pageStatus.End) ++offset;
136754
136775
 
@@ -136780,10 +136801,13 @@ function JSTReportChartContainer(uielement)
136780
136801
  var offset=this.Data.YOffset;
136781
136802
  for(var i=0;i<step;++i)
136782
136803
  {
136804
+ if (selectedIndex<=0 && !bPageCycle) //不能循环翻页
136805
+ break;
136806
+
136783
136807
  --selectedIndex;
136784
136808
  if (selectedIndex<pageStatus.Start) --offset;
136785
136809
 
136786
- if (selectedIndex<0)
136810
+ if (selectedIndex<0) //自动翻到最后一页
136787
136811
  {
136788
136812
  selectedIndex=this.Data.Data.length-1;
136789
136813
  offset=this.Data.Data.length-pageSize;
@@ -137169,6 +137193,8 @@ function ChartTReport()
137169
137193
  if (IFrameSplitOperator.IsBool(item.EnableTooltip)) colItem.EnableTooltip=item.EnableTooltip;
137170
137194
  if (IFrameSplitOperator.IsNumber(item.FixedWidth)) colItem.FixedWidth=item.FixedWidth;
137171
137195
  if (IFrameSplitOperator.IsNumber(item.FloatPrecision)) colItem.FloatPrecision=item.FloatPrecision; //小数位数
137196
+ if (IFrameSplitOperator.IsNumber(item.ColorType)) colItem.ColorType=item.ColorType; //0=默认 1=(>0, =0, <0) 2=(>=0, <0)
137197
+ if (item.DefaultText) colItem.DefaultText=item.DefaultText;
137172
137198
 
137173
137199
  if (item.Sort==1) //1本地排序 2=远程排序
137174
137200
  {
@@ -137639,6 +137665,8 @@ function ChartTReport()
137639
137665
  case TREPORT_COLUMN_ID.SELL_VOL_ID: //卖量
137640
137666
  case TREPORT_COLUMN_ID.BUY_VOL_ID: //买量
137641
137667
  case TREPORT_COLUMN_ID.POSITION_ID: //持仓量
137668
+ case TREPORT_COLUMN_ID.VOL_ID: //成交量
137669
+ case TREPORT_COLUMN_ID.AMOUNT_ID: //成交金额
137642
137670
  var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);
137643
137671
  if (fieldName) drawInfo.Text=this.FormatVolString(data[fieldName]);
137644
137672
  break;
@@ -137686,12 +137714,26 @@ function ChartTReport()
137686
137714
 
137687
137715
  this.FormatReserveNumber=function(column, data, drawInfo)
137688
137716
  {
137717
+ if (column.DefaultText) drawInfo.Text=column.DefaultText;
137718
+
137689
137719
  var fieldName=MAP_TREPORT_COLUMN_FIELD.get(column.Type);
137690
137720
  if (!fieldName) return;
137691
137721
 
137692
137722
  var value=data[fieldName];
137693
137723
  if (!IFrameSplitOperator.IsNumber(value)) return;
137694
137724
 
137725
+ if (IFrameSplitOperator.IsNumber(column.ColorType))
137726
+ {
137727
+ if (column.ColorType==1)
137728
+ {
137729
+ drawInfo.TextColor=this.GetUpDownColor(value,0);
137730
+ }
137731
+ else if (column.ColorType==2)
137732
+ {
137733
+ drawInfo.TextColor=this.GetUpDownColorV2(value,0);
137734
+ }
137735
+ }
137736
+
137695
137737
  //TODO: 不同类型的 格式化输出
137696
137738
  drawInfo.Text=value.toFixed(column.FloatPrecision);
137697
137739
  }
@@ -137781,6 +137823,12 @@ function ChartTReport()
137781
137823
  else return this.UnchangeColor;
137782
137824
  }
137783
137825
 
137826
+ this.GetUpDownColorV2=function(price, price2)
137827
+ {
137828
+ if (price>=price2) return this.UpColor;
137829
+ else return this.DownColor;
137830
+ }
137831
+
137784
137832
  this.DrawCell=function(drawInfo)
137785
137833
  {
137786
137834
  var rtText=drawInfo.RectText;
@@ -145184,7 +145232,7 @@ function HQChartScriptWorker()
145184
145232
 
145185
145233
 
145186
145234
 
145187
- var HQCHART_VERSION="1.1.13993";
145235
+ var HQCHART_VERSION="1.1.14000";
145188
145236
 
145189
145237
  function PrintHQChartVersion()
145190
145238
  {