hqchart 1.1.13259 → 1.1.13265

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.
@@ -2071,6 +2071,7 @@ this.XYSplit=true;//XY轴坐标信息改变
2071
2071
  this.XSplit=true;//X轴变化
2072
2072
  this.HorizontalMax;//Y轴最大值
2073
2073
  this.HorizontalMin;//Y轴最小值
2074
+ this.HorizontalReserved=null;//Y轴预留高度 { Top:上, Bottom:下 }
2074
2075
  this.XPointCount=10;//X轴数据个数
2075
2076
  this.ClientBGColor;//客户区背景色
2076
2077
  //Y轴原始的最大值 最小值
@@ -4176,7 +4177,7 @@ this.Price;this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize)retur
4176
4177
  }var x=left+textWidth;this.Canvas.strokeStyle=this.Line.Color;this.Canvas.beginPath();this.Canvas.moveTo(x,ToFixedPoint(y));this.Canvas.lineTo(right,ToFixedPoint(y));this.Canvas.stroke();if(this.Line.Type==2){this.Canvas.restore();}}};this.GetMaxMin=function(){var range={Min:null,Max:null};if(IFrameSplitOperator.IsNumber(this.Price)){range.Min=this.Price;range.Max=this.Price;}return range;};}// 柱子集合 支持横屏
4177
4178
  function ChartMultiBar(){this.newMethod=IChartPainting;//派生
4178
4179
  this.newMethod();delete this.newMethod;this.ClassName="ChartMultiBar";this.Bars=[];// [ {Point:[ {Index, Value, Value2 }, ], Color:, Width: , Type: 0 实心 1 空心 }, ]
4179
- this.IsHScreen=false;this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize)return;if(!this.Data||this.Data.length<=0)return;this.IsHScreen=this.ChartFrame.IsHScreen===true;var xPointCount=this.ChartFrame.XPointCount;var offset=this.Data.DataOffset;var dataWidth=this.ChartFrame.DataWidth;var pixelRatio=GetDevicePixelRatio();var drawBars=[];for(var i in this.Bars){var item=this.Bars[i];var drawPoints={Point:[],Color:item.Color,Width:dataWidth,Type:0};if(item.Type>0)drawPoints.Type=item.Type;if(item.Width>0){drawPoints.Width=item.Width*pixelRatio;if(drawPoints.Width>dataWidth)drawPoints.Width=dataWidth;}else{if(drawPoints.Width<4)drawPoints.Width=1*pixelRatio;}for(var j in item.Point){var point=item.Point[j];if(!IFrameSplitOperator.IsNumber(point.Index))continue;var index=point.Index-offset;if(index>=0&&index<xPointCount){var x=this.ChartFrame.GetXFromIndex(index);var y=this.ChartFrame.GetYFromData(point.Value);var y2=this.ChartFrame.GetYFromData(point.Value2);drawPoints.Point.push({X:x,Y:y,Y2:y2});}}if(drawPoints.Point.length>0)drawBars.push(drawPoints);}for(var i in drawBars){var item=drawBars[i];if(item.Width>=4){if(item.Type==1)this.DrawHollowBar(item);else this.DrawFillBar(item);}else{this.DrawLineBar(item);}}};this.DrawLineBar=function(bar){this.Canvas.strokeStyle=bar.Color;var backupLineWidth=this.Canvas.lineWidth;this.Canvas.lineWidth=bar.Width;for(var i in bar.Point){var item=bar.Point[i];this.Canvas.beginPath();if(this.IsHScreen){this.Canvas.moveTo(ToFixedPoint(item.Y),ToFixedPoint(item.X));this.Canvas.lineTo(ToFixedPoint(item.Y2),ToFixedPoint(item.X));}else{this.Canvas.moveTo(ToFixedPoint(item.X),ToFixedPoint(item.Y));this.Canvas.lineTo(ToFixedPoint(item.X),ToFixedPoint(item.Y2));}this.Canvas.stroke();}this.Canvas.lineWidth=backupLineWidth;};this.DrawFillBar=function(bar){this.Canvas.fillStyle=bar.Color;for(var i in bar.Point){var item=bar.Point[i];var x=item.X-bar.Width/2;var y=Math.min(item.Y,item.Y2);var barWidth=bar.Width;var barHeight=Math.abs(item.Y-item.Y2);if(this.IsHScreen)this.Canvas.fillRect(ToFixedRect(y),ToFixedRect(x),ToFixedRect(barHeight),ToFixedRect(barWidth));else this.Canvas.fillRect(ToFixedRect(x),ToFixedRect(y),ToFixedRect(barWidth),ToFixedRect(barHeight));}};this.DrawHollowBar=function(bar)//空心柱子
4180
+ this.IsHScreen=false;this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize||!this.IsVisible)return;if(this.IsShowIndexTitleOnly())return;if(this.IsHideScriptIndex())return;if(!this.Data||this.Data.length<=0)return;this.IsHScreen=this.ChartFrame.IsHScreen===true;var xPointCount=this.ChartFrame.XPointCount;var offset=this.Data.DataOffset;var dataWidth=this.ChartFrame.DataWidth;var pixelRatio=GetDevicePixelRatio();var drawBars=[];for(var i in this.Bars){var item=this.Bars[i];var drawPoints={Point:[],Color:item.Color,Width:dataWidth,Type:0};if(item.Type>0)drawPoints.Type=item.Type;if(item.Width>0){drawPoints.Width=item.Width*pixelRatio;if(drawPoints.Width>dataWidth)drawPoints.Width=dataWidth;}else{if(drawPoints.Width<4)drawPoints.Width=1*pixelRatio;}for(var j in item.Point){var point=item.Point[j];if(!IFrameSplitOperator.IsNumber(point.Index))continue;var index=point.Index-offset;if(index>=0&&index<xPointCount){var x=this.ChartFrame.GetXFromIndex(index);var y=this.ChartFrame.GetYFromData(point.Value);var y2=this.ChartFrame.GetYFromData(point.Value2);drawPoints.Point.push({X:x,Y:y,Y2:y2});}}if(drawPoints.Point.length>0)drawBars.push(drawPoints);}for(var i in drawBars){var item=drawBars[i];if(item.Width>=4){if(item.Type==1)this.DrawHollowBar(item);else this.DrawFillBar(item);}else{this.DrawLineBar(item);}}};this.DrawLineBar=function(bar){this.Canvas.strokeStyle=bar.Color;var backupLineWidth=this.Canvas.lineWidth;this.Canvas.lineWidth=bar.Width;for(var i in bar.Point){var item=bar.Point[i];this.Canvas.beginPath();if(this.IsHScreen){this.Canvas.moveTo(ToFixedPoint(item.Y),ToFixedPoint(item.X));this.Canvas.lineTo(ToFixedPoint(item.Y2),ToFixedPoint(item.X));}else{this.Canvas.moveTo(ToFixedPoint(item.X),ToFixedPoint(item.Y));this.Canvas.lineTo(ToFixedPoint(item.X),ToFixedPoint(item.Y2));}this.Canvas.stroke();}this.Canvas.lineWidth=backupLineWidth;};this.DrawFillBar=function(bar){this.Canvas.fillStyle=bar.Color;for(var i in bar.Point){var item=bar.Point[i];var x=item.X-bar.Width/2;var y=Math.min(item.Y,item.Y2);var barWidth=bar.Width;var barHeight=Math.abs(item.Y-item.Y2);if(this.IsHScreen)this.Canvas.fillRect(ToFixedRect(y),ToFixedRect(x),ToFixedRect(barHeight),ToFixedRect(barWidth));else this.Canvas.fillRect(ToFixedRect(x),ToFixedRect(y),ToFixedRect(barWidth),ToFixedRect(barHeight));}};this.DrawHollowBar=function(bar)//空心柱子
4180
4181
  {this.Canvas.strokeStyle=bar.Color;var backupLineWidth=1;for(var i in bar.Point){var item=bar.Point[i];var x=item.X-bar.Width/2;var y=Math.min(item.Y,item.Y2);var barWidth=bar.Width;var barHeight=Math.abs(item.Y-item.Y2);this.Canvas.beginPath();if(this.IsHScreen)this.Canvas.rect(ToFixedPoint(y),ToFixedPoint(x),ToFixedRect(barHeight),ToFixedRect(barWidth));else this.Canvas.rect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(barWidth),ToFixedRect(barHeight));this.Canvas.stroke();}this.Canvas.lineWidth=backupLineWidth;};this.GetMaxMin=function(){var range={Min:null,Max:null};var xPointCount=this.ChartFrame.XPointCount;var start=this.Data.DataOffset;var end=start+xPointCount;for(var i in this.Bars){var item=this.Bars[i];for(var j in item.Point){var point=item.Point[j];if(point.Index>=start&&point.Index<end){var minValue=Math.min(point.Value,point.Value2);var maxValue=Math.max(point.Value,point.Value2);if(range.Max==null)range.Max=maxValue;else if(range.Max<maxValue)range.Max=maxValue;if(range.Min==null)range.Min=minValue;else if(range.Min>minValue)range.Min=minValue;}}}return range;};}// 线段集合 支持横屏
4181
4182
  function ChartMultiLine(){this.newMethod=IChartPainting;//派生
4182
4183
  this.newMethod();delete this.newMethod;this.ClassName="ChartMultiLine";this.Lines=[];// [ {Point:[ {Index, Value }, ], Color: }, ]
@@ -5157,7 +5158,10 @@ coordinate.Message[1]=IFrameSplitOperator.FormatValueString(value,floatPrecision
5157
5158
  //this.Frame.HorizontalInfo[i].TextColor="rgb(100,0,200)";
5158
5159
  //this.Frame.HorizontalInfo[i].LineColor="rgb(220,220,220)";
5159
5160
  }}this.FilterIgnoreYValue();this.CustomCoordinate();if(this.SplitType!=1)this.Frame.HorizontalInfo=this.Filter(this.Frame.HorizontalInfo,splitData.Max>0&&splitData.Min<0);this.RightFrameSplitY();this.MainOverlayFrameSplitY();//主图Y轴绑定叠加Y轴坐标
5160
- this.CallAcutionSplitY(this.SplitCount,splitData);if(this.EnableRemoveZero)this.RemoveZero(this.Frame.HorizontalInfo);this.DynamicMessageText();this.Frame.HorizontalMax=splitData.Max;this.Frame.HorizontalMin=splitData.Min;if(this.EnableZoomUpDown==true&&!this.FixedYMaxMin)this.FixedYMaxMin={Max:splitData.Max,Min:splitData.Min};if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);if(event&&event.Callback){var data={ID:this.Frame.Identify,Frame:this.Frame};if(this.OverlayIdentify)data.OverlayIdentify=this.OverlayIdentify;event.Callback(event,data,this);}}};this.FormatValueString=function(value){var text;if(this.StringFormat==1)//手机端格式 如果有万,亿单位了 去掉小数
5161
+ this.CallAcutionSplitY(this.SplitCount,splitData);if(this.EnableRemoveZero)this.RemoveZero(this.Frame.HorizontalInfo);this.DynamicMessageText();this.Frame.HorizontalMax=splitData.Max;this.Frame.HorizontalMin=splitData.Min;if(this.EnableZoomUpDown==true&&!this.FixedYMaxMin)this.FixedYMaxMin={Max:splitData.Max,Min:splitData.Min};this.ReservedHeight(splitData);//预留高度
5162
+ if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);if(event&&event.Callback){var data={ID:this.Frame.Identify,Frame:this.Frame};if(this.OverlayIdentify)data.OverlayIdentify=this.OverlayIdentify;event.Callback(event,data,this);}}};this.ReservedHeight=function(splitData){if(this.Frame.IsHScreen)return;//横屏以后再搞
5163
+ var yReserved=this.Frame.HorizontalReserved;if(!yReserved)return;var reservedHeight=0;if(IFrameSplitOperator.IsPlusNumber(yReserved.Top))reservedHeight+=yReserved.Top;if(IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))reservedHeight+=yReserved.Bottom;if(reservedHeight<=0)return;var border=this.Frame.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var srcHeight=bottom-top;if(srcHeight<reservedHeight)return;var max=splitData.Max;var min=splitData.Min;if(IFrameSplitOperator.IsPlusNumber(yReserved.Top))top-=yReserved.Top;if(IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))bottom+=yReserved.Bottom;var value=(max-min)/(bottom-top);//1个像素点对应的数值
5164
+ if(IFrameSplitOperator.IsPlusNumber(yReserved.Top)){var topValue=value*yReserved.Top;max+=topValue;}if(IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)){var bottomValue=value*yReserved.Bottom;min-=bottomValue;}splitData.Max=max;splitData.Min=min;this.Frame.HorizontalMax=splitData.Max;this.Frame.HorizontalMin=splitData.Min;};this.FormatValueString=function(value){var text;if(this.StringFormat==1)//手机端格式 如果有万,亿单位了 去掉小数
5161
5165
  {var floatPrecision=this.FloatPrecision;if(IFrameSplitOperator.IsNumber(value)&&Math.abs(value)>1000)floatPrecision=0;text=IFrameSplitOperator.FormatValueString(value,floatPrecision,this.LanguageID);}else if(this.StringFormat==2)//原始数据输出
5162
5166
  {text=''+value.toFixed(this.FloatPrecision);}else{var absValue=Math.abs(value);if(absValue<0.0000000001){text=0;}else if(absValue<this.FLOATPRECISION_RANGE[this.FLOATPRECISION_RANGE.length-1]){text=value.toExponential(2).toString();}else{var floatPrecision=this.GetFloatPrecision(absValue,this.FloatPrecision);//数据比小数位数还小, 调整小数位数
5163
5167
  text=IFrameSplitOperator.FormatValueString(value,floatPrecision,this.LanguageID);}}return text;};this.FilterIgnoreYValue=function(){if(!this.IgnoreYValue||this.IgnoreYValue.length<=0)return;var setValue=new _set2.default(this.IgnoreYValue);this.Frame.HorizontalInfo=this.Frame.HorizontalInfo.filter(function(item){return!setValue.has(item.Value);});};this.DynamicMessageText=function(){if(this.SplitType==2){for(var i=0;i<this.Frame.HorizontalInfo.length;++i){var item=this.Frame.HorizontalInfo[i];if(item.Message[0])item.Message[0]+='%';if(item.Message[1])item.Message[1]+='%';}}};this.CallAcutionSplitY=function(count,splitData){if(this.Frame.Identify!=1)return null;var aryCallAcution=this.GetCallAcutionSplitY(count,splitData);if(!aryCallAcution)return;for(var i=0;i<this.Frame.HorizontalInfo.length;++i)//把显示的数据迁移到 Message[2] Message[3]
@@ -6013,14 +6017,15 @@ this.Super_ExportStorageData=this.ExportStorageData;//this.Label; //{Tex
6013
6017
  this.LineWidth=1;this.Precision=2;//小数位数
6014
6018
  this.ValueTextColor='rgb(250,250,250)';this.IsShowCorssCursor=true;//画的时候是否显示十字光标
6015
6019
  this.GetLabelCallback;//绘制标题回调函数
6016
- this.PointCount=1;this.ClassName='ChartDrawHLine';this.Font=14*GetDevicePixelRatio()+"px 微软雅黑";this.TextFont=12*GetDevicePixelRatio()+"px 微软雅黑";this.RightSpaceWidth=50;this.ButtonPosition=0;//按钮位置, 0=价格后面, 1=价格上面 2=价格上面 左对齐
6020
+ this.PointCount=1;this.ClassName='ChartDrawHLine';this.Font=14*GetDevicePixelRatio()+"px 微软雅黑";this.TextFont=12*GetDevicePixelRatio()+"px 微软雅黑";this.RightSpaceWidth=50;this.ButtonPosition=0;//按钮位置, 0=价格后面, 1=价格上面 2=价格上面 左对齐 3=垂直排列
6017
6021
  this.ButtonBGColor='rgb(190,190,190)';this.ButtonSpace=3;this.TextMargin={Left:0,Right:0};this.Button={CloseIcon:{Text:'\uE62B',Color:'rgb(255,255,255)',Family:"iconfont",Size:16,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE,TooltipText:null,Margin:{Left:2,Right:2}},SettingIcon:{Text:'\uE623',Color:'rgb(255,255,255)',Family:"iconfont",Size:16,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING,TooltipText:null,Margin:{Left:2,Right:2}//修改ID, Text , TooltipText 可以外部定制按钮
6018
6022
  }};this.CustomButton=[];//自定义的按钮 { Text:'\ue62b', Color:'rgb(255,255,255)', Family:"iconfont", Size:16, ID:JSCHART_BUTTON_ID.DRAW_PICTURE_BUTTON_1, TooltipText:null, Data:null }
6019
6023
  this.AryShowButton=[];//需要显示的按钮 { Data:, Width }
6020
6024
  this.AryButton=[];this.ExtendData;//扩展数据
6021
6025
  this.ShowPriceTextConfig={IsShow:[false,false,true],//[0]=left内 [1]=right内 [2]=right外
6022
6026
  Font:[12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1',12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1']};//内部变量
6023
- this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;this.SetOption=function(option){if(this.Super_SetOption)this.Super_SetOption(option);if(option){if(option.GetLabelCallback){this.GetLabelCallback=option.GetLabelCallback;}if(IFrameSplitOperator.IsNumber(option.Precision))this.Precision=option.Precision;if(option.Font)this.Font=option.Font;if(option.ValueTextColor)this.ValueTextColor=option.ValueTextColor;if(option.ButtonBGColor)this.ButtonBGColor=option.ButtonBGColor;if(IFrameSplitOperator.IsNumber(option.ButtonPosition))this.ButtonPosition=option.ButtonPosition;if(IFrameSplitOperator.IsNumber(option.RightSpaceWidth))this.RightSpaceWidth=option.RightSpaceWidth;if(option.Button){var item=option.Button;if(item.CloseIcon){this.Button.CloseIcon=CloneData(item.CloseIcon);if(!this.Button.CloseIcon.ID)this.Button.CloseIcon.ID=JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE;}else if(item.CloseIcon===null){this.Button.CloseIcon=null;}if(item.SettingIcon){this.Button.SettingIcon=CloneData(item.SettingIcon);if(!this.Button.SettingIcon.ID)this.Button.SettingIcon.ID=JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING;}else if(item.SettingIcon===null){this.Button.SettingIcon=null;}}if(option.ExtendData)this.ExtendData=option.ExtendData;if(IFrameSplitOperator.IsNonEmptyArray(option.IsShowPriceText)){for(var i=0;i<option.IsShowPriceText.length&&i<3;++i){var value=option.IsShowPriceText[i];if(IFrameSplitOperator.IsBool(value))this.ShowPriceTextConfig.IsShow[i]=value;}}if(option.TextMargin){var item=option.TextMargin;if(IFrameSplitOperator.IsNumber(item.Left))this.TextMargin.Left=item.Left;if(IFrameSplitOperator.IsNumber(item.Right))this.TextMargin.Right=item.Right;}}};this.ExportStorageData=function(){var storageData;if(this.Super_ExportStorageData){storageData=this.Super_ExportStorageData();if(this.Label)storageData.Label=this.Label;}return storageData;};this.IsPointIn=this.IsPointIn_XYValue_Line;/*
6027
+ this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;this.VerticalButtonInfo={Width:0,Height:0};//垂直按钮信息
6028
+ this.SetOption=function(option){if(this.Super_SetOption)this.Super_SetOption(option);if(option){if(option.GetLabelCallback){this.GetLabelCallback=option.GetLabelCallback;}if(IFrameSplitOperator.IsNumber(option.Precision))this.Precision=option.Precision;if(option.Font)this.Font=option.Font;if(option.ValueTextColor)this.ValueTextColor=option.ValueTextColor;if(option.ButtonBGColor)this.ButtonBGColor=option.ButtonBGColor;if(IFrameSplitOperator.IsNumber(option.ButtonPosition))this.ButtonPosition=option.ButtonPosition;if(IFrameSplitOperator.IsNumber(option.RightSpaceWidth))this.RightSpaceWidth=option.RightSpaceWidth;if(option.Button){var item=option.Button;if(item.CloseIcon){this.Button.CloseIcon=CloneData(item.CloseIcon);if(!this.Button.CloseIcon.ID)this.Button.CloseIcon.ID=JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE;}else if(item.CloseIcon===null){this.Button.CloseIcon=null;}if(item.SettingIcon){this.Button.SettingIcon=CloneData(item.SettingIcon);if(!this.Button.SettingIcon.ID)this.Button.SettingIcon.ID=JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING;}else if(item.SettingIcon===null){this.Button.SettingIcon=null;}}if(option.ExtendData)this.ExtendData=option.ExtendData;if(IFrameSplitOperator.IsNonEmptyArray(option.IsShowPriceText)){for(var i=0;i<option.IsShowPriceText.length&&i<3;++i){var value=option.IsShowPriceText[i];if(IFrameSplitOperator.IsBool(value))this.ShowPriceTextConfig.IsShow[i]=value;}}if(option.TextMargin){var item=option.TextMargin;if(IFrameSplitOperator.IsNumber(item.Left))this.TextMargin.Left=item.Left;if(IFrameSplitOperator.IsNumber(item.Right))this.TextMargin.Right=item.Right;}}};this.ExportStorageData=function(){var storageData;if(this.Super_ExportStorageData){storageData=this.Super_ExportStorageData();if(this.Label)storageData.Label=this.Label;}return storageData;};this.IsPointIn=this.IsPointIn_XYValue_Line;/*
6024
6029
  this.GetXYCoordinate=function()
6025
6030
  {
6026
6031
  if (this.IsFrameMinSize()) return null;
@@ -6030,7 +6035,7 @@ this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;this.SetOpt
6030
6035
  }
6031
6036
  */this.IsDrawMain=function()//选中绘制在动态绘图上, 没有选中绘制在背景上
6032
6037
  {if(!this.GetActiveDrawPicture)return true;var active=this.GetActiveDrawPicture();if(active.Select.Guid==this.Guid)return false;return true;};this.MainDraw=function(){this.Draw();};//获取需要显示的按钮 系统按钮+自定义按钮
6033
- this.GetShowButton=function(){var aryButton=[];var item=this.Button.SettingIcon;if(item&&item.Text)aryButton.push({Data:item,Width:null});item=this.Button.CloseIcon;if(item&&item.Text)aryButton.push({Data:item,Width:null});if(IFrameSplitOperator.IsNonEmptyArray(this.CustomButton)){for(var i=0;i<this.CustomButton.length;++i){item=this.CustomButton[i];if(item&&item.Text)aryButton.push({Data:item,Width:null});}}return aryButton;};this.Draw=function(moveonPoint,mouseStatus){this.AryShowButton=[];this.LinePoint=[];this.AryButton=[];this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint();if(!drawPoint||drawPoint.length!=1)return;if(!this.Frame)return;if(this.Value.length!=1)return;if(!this.IsYValueInFrame(this.Value[0].YValue))return null;var isHScreen=this.Frame.IsHScreen;var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();if(isHScreen){left=this.Frame.ChartBorder.GetTop();right=this.Frame.ChartBorder.GetBottom();}this.ClipFrame();//画线段
6038
+ this.GetShowButton=function(){var aryButton=[];var item=this.Button.SettingIcon;if(item&&item.Text)aryButton.push({Data:item,Width:null});item=this.Button.CloseIcon;if(item&&item.Text)aryButton.push({Data:item,Width:null});if(IFrameSplitOperator.IsNonEmptyArray(this.CustomButton)){for(var i=0;i<this.CustomButton.length;++i){item=this.CustomButton[i];if(item&&item.Text)aryButton.push({Data:item,Width:null});}}return aryButton;};this.Draw=function(moveonPoint,mouseStatus){this.AryShowButton=[];this.LinePoint=[];this.AryButton=[];this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;this.VerticalButtonInfo.Width=0;this.VerticalButtonInfo.Height=0;if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint();if(!drawPoint||drawPoint.length!=1)return;if(!this.Frame)return;if(this.Value.length!=1)return;if(!this.IsYValueInFrame(this.Value[0].YValue))return null;var isHScreen=this.Frame.IsHScreen;var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();if(isHScreen){left=this.Frame.ChartBorder.GetTop();right=this.Frame.ChartBorder.GetBottom();}this.ClipFrame();//画线段
6034
6039
  this.Canvas.strokeStyle=this.LineColor;this.SetLineWidth();this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(drawPoint[0].X,left);this.Canvas.lineTo(drawPoint[0].X,right);}else{this.Canvas.moveTo(left,ToFixedPoint(drawPoint[0].Y));this.Canvas.lineTo(right,ToFixedPoint(drawPoint[0].Y));}this.Canvas.stroke();this.RestoreLineWidth();//画水平线段
6035
6040
  var line={Start:new Point(),End:new Point()};if(isHScreen){line.Start.X=drawPoint[0].X;line.Start.Y=left;line.End.X=drawPoint[0].X;line.End.Y=right;}else{line.Start.X=left;line.Start.Y=drawPoint[0].Y;line.End.X=right;line.End.Y=drawPoint[0].Y;}this.LinePoint.push(line);var yValue=this.Frame.GetYData(drawPoint[0].Y);var strPrice=yValue.toFixed(this.Precision);if(this.ShowPriceTextConfig.IsShow[0]){this.DrawPriceText(strPrice,line.Start,line.End,0);}if(this.ShowPriceTextConfig.IsShow[1]){this.DrawPriceText(strPrice,line.Start,line.End,1);}var labInfo;if(this.GetLabelCallback)labInfo=this.GetLabelCallback(this);this.AryShowButton=this.GetShowButton();//获取按钮
6036
6041
  //描述信息
@@ -6039,11 +6044,13 @@ var xCenter=left+(right-left)/2;var point={X:xCenter,Y:drawPoint[0].Y};this.Draw
6039
6044
  if(this.ShowPriceTextConfig.IsShow[2]){var rtDraw={};this.CalculateButtonSize();this.DrawValueText(drawPoint[0].Y,rtDraw,labInfo);if(labInfo)this.DrawRightLab(labInfo,rtDraw);if(labInfo)this.DrawCustomHLine(labInfo,drawPoint[0].Y);}//鼠标是否在按钮上
6040
6045
  if(moveonPoint&&mouseStatus){for(var i=0;i<this.AryButton.length;++i){var item=this.AryButton[i];var rtButton=item.Rect;if(moveonPoint.X>=rtButton.Left&&moveonPoint.X<rtButton.Right&&moveonPoint.Y>=rtButton.Top&&moveonPoint.Y<=rtButton.Bottom){mouseStatus.MouseOnToolbar={Rect:rtButton,Item:item,Frame:this.Frame,Point:{X:moveonPoint.X,Y:moveonPoint.Y}};break;}}}};this.CalculateLabSize=function(labInfo){this.Canvas.textAlign="left";this.Canvas.textBaseline="top";this.Canvas.font=this.TextFont;var lineHeight=this.Canvas.measureText("擎").width+2;var maxNameWidth=0,maxTextWidth=0;var lineCount=0;var lineSpace=0;if(IFrameSplitOperator.IsNumber(labInfo.LineSpace))lineSpace=labInfo.LineSpace;var maxNameWidth=0,maxTextWidth=0;var lineCount=0;var maxWidth=0;for(var i=0;i<labInfo.AryText.length;++i){var item=labInfo.AryText[i];item.NameWidth=0;item.TextWidth=0;if(item.Name)item.NameWidth=this.Canvas.measureText(item.Name).width+2;if(item.Text)item.TextWidth=this.Canvas.measureText(item.Text).width+2;if(maxNameWidth<item.NameWidth)maxNameWidth=item.NameWidth;if(maxTextWidth<item.TextWidth)maxTextWidth=item.TextWidth;var itemWidth=item.NameWidth+item.TextWidth;if(maxWidth<itemWidth)maxWidth=itemWidth;++lineCount;}var size={Width:maxWidth,Height:lineCount*(lineHeight+lineSpace)+lineSpace,NameWidth:maxNameWidth,TextWidth:maxTextWidth,LineHeight:lineHeight};return size;};this.DrawLab=function(labInfo,y){if(!labInfo)return;if(!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText))return;if(labInfo.Position===2)return;var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();var labSize=this.CalculateLabSize(labInfo);var drawLeft=right-labSize.Width;var drawTop=y-labSize.Height-1;//背景色
6041
6046
  if(labInfo.BGColor){this.Canvas.fillStyle=labInfo.BGColor;var rtTop=y-labSize.Height-4;this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(right+drawLeft),ToFixedRect(y-rtTop));}var yText=drawTop;for(var i=0;i<labInfo.AryText.length;++i){var item=labInfo.AryText[i];if(item.Name){this.Canvas.fillStyle=item.NameColor;this.Canvas.fillText(item.Name,drawLeft+1,yText+1);}if(item.Text){this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Text,drawLeft+labSize.NameWidth+1,yText+1);}yText+=labSize.LineHeight;}};this.DrawRightLab=function(labInfo,rtLeftDraw){if(!labInfo)return;if(!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryText))return;if(labInfo.Position!=2)return;var labSize=this.CalculateLabSize(labInfo);var drawLeft=rtLeftDraw.Right-labSize.Width;if(drawLeft<rtLeftDraw.Left)drawLeft=rtLeftDraw.Left;var drawRight=drawLeft+labSize.Width;var drawTop=rtLeftDraw.Bottom;var lineSpace=0;if(IFrameSplitOperator.IsNumber(labInfo.LineSpace))lineSpace=labInfo.LineSpace;//背景色
6042
- if(labInfo.BGColor){this.Canvas.fillStyle=labInfo.BGColor;var rtTop=drawTop;this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(labSize.Width),ToFixedRect(labSize.Height));}var yText=drawTop+1+lineSpace;this.Canvas.textBaseline="top";for(var i=0;i<labInfo.AryText.length;++i){var item=labInfo.AryText[i];if(item.Name){this.Canvas.textAlign="left";this.Canvas.fillStyle=item.NameColor;this.Canvas.fillText(item.Name,drawLeft+1,yText+1);}if(item.Text){this.Canvas.textAlign="right";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Text,drawRight-1,yText+1);}yText+=labSize.LineHeight+lineSpace;}};this.DrawCustomHLine=function(labInfo,yLine){if(!labInfo)return;if(!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryLine))return;var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();var pixelRatio=GetDevicePixelRatio();var yMax=yLine,yMin=yLine;for(var i=0;i<labInfo.AryLine.length;++i){var item=labInfo.AryLine[i];if(!IFrameSplitOperator.IsNumber(item.Value))continue;if(item.Width<0)continue;var y=this.Frame.GetYFromData(item.Value);var yFixed=ToFixedPoint(y);var xRight=right;if(IFrameSplitOperator.IsPlusNumber(item.Width)){if(item.Width<1)xRight=left+item.Width*(right-left);//0.3 百分比
6047
+ var rtLab={Left:drawLeft,Top:drawTop,Width:labSize.Width,Height:labSize.Height};rtLab.Right=rtLab.Left+rtLab.Width;rtLab.Bottom=rtLab.Top+rtLab.Height;if(labInfo.BGColor){this.Canvas.fillStyle=labInfo.BGColor;this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.Height));}var yText=drawTop+1+lineSpace;this.Canvas.textBaseline="top";for(var i=0;i<labInfo.AryText.length;++i){var item=labInfo.AryText[i];if(item.Name){this.Canvas.textAlign="left";this.Canvas.fillStyle=item.NameColor;this.Canvas.fillText(item.Name,drawLeft+1,yText+1);}if(item.Text){this.Canvas.textAlign="right";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(item.Text,drawRight-1,yText+1);}yText+=labSize.LineHeight+lineSpace;}this.DrawVerticalButton(rtLab);};this.DrawCustomHLine=function(labInfo,yLine){if(!labInfo)return;if(!IFrameSplitOperator.IsNonEmptyArray(labInfo.AryLine))return;var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();var pixelRatio=GetDevicePixelRatio();var yMax=yLine,yMin=yLine;for(var i=0;i<labInfo.AryLine.length;++i){var item=labInfo.AryLine[i];if(!IFrameSplitOperator.IsNumber(item.Value))continue;if(item.Width<0)continue;var y=this.Frame.GetYFromData(item.Value);var yFixed=ToFixedPoint(y);var xRight=right;if(IFrameSplitOperator.IsPlusNumber(item.Width)){if(item.Width<1)xRight=left+item.Width*(right-left);//0.3 百分比
6043
6048
  else xRight=left+item.Width*pixelRatio;//>1 实际数值就是长度
6044
6049
  }if(item.Color)this.Canvas.strokeStyle=item.Color;else this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(left,yFixed);this.Canvas.lineTo(xRight,yFixed);this.Canvas.stroke();if(yMax<yFixed)yMax=yFixed;if(yMin>yFixed)yMin=yFixed;}if(yMax!=yMin&&labInfo.VLine){var item=labInfo.VLine;var x=left+20*pixelRatio;if(IFrameSplitOperator.IsNumber(item.XOffset))x=left+item.XOffset*pixelRatio;x=ToFixedPoint(x);if(item.Color)this.Canvas.strokeStyle=item.Color;else this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,yMax);this.Canvas.lineTo(x,yMin);this.Canvas.stroke();}};this.DrawValueText=function(y,rtDraw,labInfo){var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();if(this.RightSpaceWidth>0){this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(right,ToFixedPoint(y));this.Canvas.lineTo(right+this.RightSpaceWidth,ToFixedPoint(y));this.Canvas.stroke();}var yValue=this.Frame.GetYData(y);var strValue=yValue.toFixed(this.Precision);if(labInfo&&labInfo.PriceSuffixText)strValue+=labInfo.PriceSuffixText;this.Canvas.fillStyle=this.LineColor;this.Canvas.font=this.Font;var textWidth=this.Canvas.measureText(strValue).width;var lineHeight=this.GetFontHeight();var rtBG={Left:right+this.RightSpaceWidth,Top:y-lineHeight/2,Width:textWidth+4,Height:lineHeight};//rtBG.Right=rtBG.Left+rtBG.Width;
6045
- rtBG.Bottom=rtBG.Top+rtBG.Height;rtBG.Width+=this.TextMargin.Left+this.TextMargin.Right;rtBG.Right=rtBG.Left+rtBG.Width;var xText=rtBG.Left+this.TextMargin.Left+2;if(this.ButtonPosition==1){this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));}else{this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));}this.Canvas.fillStyle=this.ValueTextColor;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(strValue,xText,y);rtDraw.Left=rtBG.Left;rtDraw.Top=rtBG.Top;rtDraw.Bottom=rtBG.Bottom;rtDraw.Right=rtBG.Right;this.DrawButton(rtBG.Top,rtBG.Right,lineHeight,rtDraw);};this.DrawPriceText=function(text,ptStart,ptEnd,position){if(position!=1&&position!=0)return;var font=this.ShowPriceTextConfig.Font[position];this.Canvas.fillStyle=this.LineColor;this.Canvas.font=font;var textWidth=this.Canvas.measureText(text).width;var lineHeight=this.GetFontHeight();var rtBG=null;if(position==1){var rtBG={Left:ptStart.X,Top:ptStart.Y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;}else if(position==0){var rtBG={Right:ptEnd.X,Top:ptEnd.Y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Left=rtBG.Right-rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;}this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));this.Canvas.fillStyle=this.ValueTextColor;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(text,rtBG.Left+2,ptStart.Y);};this.CalculateButtonSize=function(){var pixelRatio=GetDevicePixelRatio();if(!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton))return;var totalWidth=0;for(var i=0;i<this.AryShowButton.length;++i){var item=this.AryShowButton[i];var icon=item.Data;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;item.Width=this.Canvas.measureText(icon.Text).width+2;if(icon.Margin){var margin=icon.Margin;if(IFrameSplitOperator.IsNumber(margin.Left))item.Width+=margin.Left;if(IFrameSplitOperator.IsNumber(margin.Right))item.Width+=margin.Right;}totalWidth+=item.Width;}this.ButtonBGWidth=totalWidth;};this.DrawButton=function(drawTop,drawLeft,drawHeight,rtDraw){if(!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton))return;if(this.ButtonPosition==1){drawTop-=drawHeight;var chartWidth=this.Frame.ChartBorder.GetChartWidth();var chartLeft=this.Frame.ChartBorder.GetRight()+this.RightSpaceWidth;if(drawLeft+this.ButtonBGWidth>chartWidth)//右边不够了 往左移动
6046
- {drawLeft=chartWidth-this.ButtonBGWidth;}if(chartLeft>drawLeft)drawLeft=chartLeft;}else if(this.ButtonPosition==2){drawTop-=drawHeight;drawLeft=rtDraw.Left;}this.Canvas.fillStyle=this.LineColor;var left=drawLeft;var rtBG={Left:drawLeft,Top:drawTop,Width:this.ButtonBGWidth,Height:drawHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;this.Canvas.fillStyle=this.ButtonBGColor;this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));var pixelRatio=GetDevicePixelRatio();for(var i=0;i<this.AryShowButton.length;++i){var item=this.AryShowButton[i];var icon=item.Data;var rtButton={Left:left,Top:drawTop,Width:item.Width,Height:drawHeight};rtButton.Right=rtButton.Left+rtButton.Width;rtButton.Bottom=rtButton.Top+rtButton.Height;var yCenter=rtButton.Top+rtButton.Height/2;var xCenter=rtButton.Left+rtButton.Width/2;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(icon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:icon.ID,TooltipText:icon.TooltipText,Data:icon.Data});left=rtButton.Right;}};this.PtInButtons=function(x,y){for(var i=0;i<this.AryButton.length;++i){var item=this.AryButton[i];if(!item.Rect)continue;var rect=item.Rect;this.Canvas.beginPath();this.Canvas.rect(rect.Left,rect.Top,rect.Width,rect.Height);if(this.Canvas.isPointInPath(x,y)){return{ID:item.ID,Rect:rect,Data:item.Data};}}return null;};}//趋势线
6050
+ rtBG.Bottom=rtBG.Top+rtBG.Height;rtBG.Width+=this.TextMargin.Left+this.TextMargin.Right;rtBG.Right=rtBG.Left+rtBG.Width;var xText=rtBG.Left+this.TextMargin.Left+2;if(this.ButtonPosition==1){this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));}else{this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));}this.Canvas.fillStyle=this.ValueTextColor;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(strValue,xText,y);rtDraw.Left=rtBG.Left;rtDraw.Top=rtBG.Top;rtDraw.Bottom=rtBG.Bottom;rtDraw.Right=rtBG.Right;this.DrawButton(rtBG.Top,rtBG.Right,lineHeight,rtDraw);};this.DrawPriceText=function(text,ptStart,ptEnd,position){if(position!=1&&position!=0)return;var font=this.ShowPriceTextConfig.Font[position];this.Canvas.fillStyle=this.LineColor;this.Canvas.font=font;var textWidth=this.Canvas.measureText(text).width;var lineHeight=this.GetFontHeight();var rtBG=null;if(position==1){var rtBG={Left:ptStart.X,Top:ptStart.Y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;}else if(position==0){var rtBG={Right:ptEnd.X,Top:ptEnd.Y-lineHeight/2,Width:textWidth+4,Height:lineHeight};rtBG.Left=rtBG.Right-rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;}this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));this.Canvas.fillStyle=this.ValueTextColor;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillText(text,rtBG.Left+2,ptStart.Y);};this.CalculateButtonSize=function(){var pixelRatio=GetDevicePixelRatio();if(!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton))return;var totalWidth=0;for(var i=0;i<this.AryShowButton.length;++i){var item=this.AryShowButton[i];var icon=item.Data;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;item.Width=this.Canvas.measureText(icon.Text).width+2;item.Height=item.Width;if(icon.Margin){var margin=icon.Margin;if(IFrameSplitOperator.IsNumber(margin.Left))item.Width+=margin.Left;if(IFrameSplitOperator.IsNumber(margin.Right))item.Width+=margin.Right;if(IFrameSplitOperator.IsNumber(margin.Top))item.Height+=margin.Top;if(IFrameSplitOperator.IsNumber(margin.Bottom))item.Height+=margin.Bottom;}if(this.VerticalButtonInfo.Width<item.Width)this.VerticalButtonInfo.Width=item.Width;this.VerticalButtonInfo.Height+=item.Height;totalWidth+=item.Width;}this.ButtonBGWidth=totalWidth;};//垂直排列按钮
6051
+ this.DrawVerticalButton=function(rtLab){if(this.ButtonPosition!=3)return;if(!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton))return;if(this.VerticalButtonInfo.Height<=0)return;var rtBG={Left:rtLab.Right,Top:rtLab.Top,Width:this.VerticalButtonInfo.Width,Height:this.VerticalButtonInfo.Height};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;this.Canvas.fillStyle=this.ButtonBGColor;this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));var pixelRatio=GetDevicePixelRatio();var yTop=rtLab.Top;for(var i=0;i<this.AryShowButton.length;++i){var item=this.AryShowButton[i];var icon=item.Data;var rtButton={Left:rtBG.Left,Top:yTop,Width:this.VerticalButtonInfo.Width,Height:item.Height};rtButton.Right=rtButton.Left+rtButton.Width;rtButton.Bottom=rtButton.Top+rtButton.Height;var yCenter=rtButton.Top+rtButton.Height/2;var xCenter=rtButton.Left+rtButton.Width/2;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(icon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:icon.ID,TooltipText:icon.TooltipText,Data:icon.Data});yTop=rtButton.Bottom;}};this.DrawButton=function(drawTop,drawLeft,drawHeight,rtDraw){if(!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton))return;if(this.ButtonPosition==3)return;//垂直按钮在DrawVerticalButton()调用
6052
+ if(this.ButtonPosition==1){drawTop-=drawHeight;var chartWidth=this.Frame.ChartBorder.GetChartWidth();var chartLeft=this.Frame.ChartBorder.GetRight()+this.RightSpaceWidth;if(drawLeft+this.ButtonBGWidth>chartWidth)//右边不够了 往左移动
6053
+ {drawLeft=chartWidth-this.ButtonBGWidth;}if(rtDraw.Left>drawLeft)drawLeft=rtDraw.Left;}else if(this.ButtonPosition==2){drawTop-=drawHeight;drawLeft=rtDraw.Left;}this.Canvas.fillStyle=this.LineColor;var left=drawLeft;var rtBG={Left:drawLeft,Top:drawTop,Width:this.ButtonBGWidth,Height:drawHeight};rtBG.Right=rtBG.Left+rtBG.Width;rtBG.Bottom=rtBG.Top+rtBG.Height;this.Canvas.fillStyle=this.ButtonBGColor;this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top),ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));var pixelRatio=GetDevicePixelRatio();for(var i=0;i<this.AryShowButton.length;++i){var item=this.AryShowButton[i];var icon=item.Data;var rtButton={Left:left,Top:drawTop,Width:item.Width,Height:drawHeight};rtButton.Right=rtButton.Left+rtButton.Width;rtButton.Bottom=rtButton.Top+rtButton.Height;var yCenter=rtButton.Top+rtButton.Height/2;var xCenter=rtButton.Left+rtButton.Width/2;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(icon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:icon.ID,TooltipText:icon.TooltipText,Data:icon.Data});left=rtButton.Right;}};this.PtInButtons=function(x,y){for(var i=0;i<this.AryButton.length;++i){var item=this.AryButton[i];if(!item.Rect)continue;var rect=item.Rect;this.Canvas.beginPath();this.Canvas.rect(rect.Left,rect.Top,rect.Width,rect.Height);if(this.Canvas.isPointInPath(x,y)){return{ID:item.ID,Rect:rect,Data:item.Data};}}return null;};}//趋势线
6047
6054
  function ChartDrawPictureTrendLine(){this.newMethod=IChartDrawPicture;//派生
6048
6055
  this.newMethod();delete this.newMethod;this.ClassName='ChartDrawPictureTrendLine';this.IsPointIn=this.IsPointIn_XYValue_Line;this.GetXYCoordinate=this.GetXYCoordinate_default;this.OnlyMoveXIndex=true;this.IsSupportMagnet=true;this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint({IsCheckX:false,IsCheckY:false});if(!drawPoint||drawPoint.length!=2)return;var ptStart=drawPoint[0];var ptEnd=drawPoint[1];var extendLine=this.CalculateExtendLinePoint(ptStart,ptEnd);this.ClipFrame();this.Canvas.strokeStyle=this.LineColor;this.SetLineWidth();this.Canvas.beginPath();this.Canvas.moveTo(extendLine.Start.X,extendLine.Start.Y);this.Canvas.lineTo(extendLine.End.X,extendLine.End.Y);this.Canvas.stroke();this.RestoreLineWidth();var line={Start:ptStart,End:ptEnd};this.LinePoint.push(line);this.DrawPoint(drawPoint);//画点
6049
6056
  this.Canvas.restore();};}//画图工具-矩形
@@ -6928,8 +6935,10 @@ this.UpdateFrameMaxMin();//调整坐标最大 最小值
6928
6935
  this.ResetFrameXSplit();this.Frame.SetSizeChage(true);this.Draw();this.UpdatePointByCursorIndex();//更新十字光标位子
6929
6936
  };this.OnWheel=function(e){var _this16=this;JSConsole.Chart.Log('[KLineChartContainer::OnWheel]',e);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;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);var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var enableZoomUpDown=true;//是否允许缩放
6930
6937
  if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Wheel===false)enableZoomUpDown=false;if(this.SourceData&&this.SourceData.Data){if(isInClient&&wheelValue<0&&enableZoomUpDown)//缩小
6931
- {var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){_this16.ZoomDownloadData(requestData);}})){this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.ResetFrameXSplit();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true){}else{this.Draw();}this.OnKLinePageChange("wheel");}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
6932
- {var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(this.Frame.ZoomUp(cursorIndex)){JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex);this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.ResetFrameXSplit();this.Draw();this.OnKLinePageChange("wheel");}}}if(!isInClient){if(!this.OnWheel_ZoomUpDownFrameY(e,x,y))return;}if(e.preventDefault)e.preventDefault();else e.returnValue=false;};//通过滚轴缩放Y轴
6938
+ {var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(e.ctrlKey)cursorIndex.ZoomType=1;//ctrl+滚轴 十字中心缩放
6939
+ if(this.Frame.ZoomDown(cursorIndex,{ZoomDownloadDataCallback:function ZoomDownloadDataCallback(requestData){_this16.ZoomDownloadData(requestData);}})){this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.ResetFrameXSplit();if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true){}else{this.Draw();}this.OnKLinePageChange("wheel");}}else if(isInClient&&wheelValue>0&&enableZoomUpDown)//放大
6940
+ {var cursorIndex={ZoomType:this.ZoomType,IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(e.ctrlKey)cursorIndex.ZoomType=1;//ctrl+滚轴 十字中心缩放
6941
+ if(this.Frame.ZoomUp(cursorIndex)){JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex);this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.ResetFrameXSplit();this.Draw();this.OnKLinePageChange("wheel");}}}if(!isInClient){if(!this.OnWheel_ZoomUpDownFrameY(e,x,y))return;}if(e.preventDefault)e.preventDefault();else e.returnValue=false;};//通过滚轴缩放Y轴
6933
6942
  this.OnWheel_ZoomUpDownFrameY=function(e,x,y){if(!this.EnableYDrag.Wheel)return false;var dragY=this.TryYDrag(x,y);if(!dragY)return false;if(dragY.Left&&!dragY.IsOverlay||dragY.Right){}else{return false;}var wheelValue=e.wheelDelta;if(!IFrameSplitOperator.IsObjectExist(e.wheelDelta))wheelValue=e.deltaY*-0.01;var yMove=this.EnableYDrag.WheelYMove;if(wheelValue>0)yMove*=-1;dragY.Position=0;//只能两边缩放
6934
6943
  if(!this.Frame.OnZoomUpDownFrameY(dragY,yMove))return false;this.Frame.SetSizeChage(true);this.Draw();return true;};//创建
6935
6944
  //windowCount 窗口个数
@@ -13198,7 +13207,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
13198
13207
  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);};}/********************************************************************************
13199
13208
  * 版本信息输出
13200
13209
  *
13201
- */var HQCHART_VERSION="1.1.13258";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();//把给外界调用的方法暴露出来
13210
+ */var HQCHART_VERSION="1.1.13264";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();//把给外界调用的方法暴露出来
13202
13211
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
13203
13212
  // BaseIndex:BaseIndex,
13204
13213
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13259",
3
+ "version": "1.1.13265",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -9976,6 +9976,7 @@ function IChartFramePainting()
9976
9976
 
9977
9977
  this.HorizontalMax; //Y轴最大值
9978
9978
  this.HorizontalMin; //Y轴最小值
9979
+ this.HorizontalReserved=null; //Y轴预留高度 { Top:上, Bottom:下 }
9979
9980
  this.XPointCount=10; //X轴数据个数
9980
9981
 
9981
9982
  this.ClientBGColor; //客户区背景色
@@ -36811,7 +36812,9 @@ function ChartMultiBar()
36811
36812
 
36812
36813
  this.Draw=function()
36813
36814
  {
36814
- if (!this.IsShow || this.ChartFrame.IsMinSize) return;
36815
+ if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
36816
+ if (this.IsShowIndexTitleOnly()) return;
36817
+ if (this.IsHideScriptIndex()) return;
36815
36818
  if (!this.Data || this.Data.length<=0) return;
36816
36819
 
36817
36820
  this.IsHScreen=(this.ChartFrame.IsHScreen===true);
@@ -46688,12 +46691,15 @@ function FrameSplitY()
46688
46691
  if (this.EnableRemoveZero) this.RemoveZero(this.Frame.HorizontalInfo);
46689
46692
 
46690
46693
  this.DynamicMessageText();
46694
+
46691
46695
  this.Frame.HorizontalMax=splitData.Max;
46692
46696
  this.Frame.HorizontalMin=splitData.Min;
46693
46697
 
46694
46698
  if (this.EnableZoomUpDown==true && !this.FixedYMaxMin)
46695
46699
  this.FixedYMaxMin={ Max:splitData.Max, Min:splitData.Min };
46696
46700
 
46701
+ this.ReservedHeight(splitData); //预留高度
46702
+
46697
46703
  if (this.GetEventCallback)
46698
46704
  {
46699
46705
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);
@@ -46706,6 +46712,49 @@ function FrameSplitY()
46706
46712
  }
46707
46713
  }
46708
46714
 
46715
+ this.ReservedHeight=function(splitData)
46716
+ {
46717
+ if (this.Frame.IsHScreen) return; //横屏以后再搞
46718
+
46719
+ var yReserved=this.Frame.HorizontalReserved;
46720
+ if (!yReserved) return;
46721
+
46722
+ var reservedHeight=0;
46723
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) reservedHeight+=yReserved.Top;
46724
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) reservedHeight+=yReserved.Bottom;
46725
+ if (reservedHeight<=0) return;
46726
+
46727
+ var border=this.Frame.GetBorder();
46728
+ var top=border.TopEx;
46729
+ var bottom=border.BottomEx;
46730
+ var srcHeight=bottom-top;
46731
+ if (srcHeight<reservedHeight) return;
46732
+
46733
+ var max=splitData.Max;
46734
+ var min=splitData.Min;
46735
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) top-=yReserved.Top;
46736
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) bottom+=yReserved.Bottom;
46737
+
46738
+ var value=(max-min)/(bottom-top); //1个像素点对应的数值
46739
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top))
46740
+ {
46741
+ var topValue=value*yReserved.Top;
46742
+ max+=topValue;
46743
+ }
46744
+
46745
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))
46746
+ {
46747
+ var bottomValue=value*yReserved.Bottom;
46748
+ min-=bottomValue;
46749
+ }
46750
+
46751
+ splitData.Max=max;
46752
+ splitData.Min=min;
46753
+
46754
+ this.Frame.HorizontalMax=splitData.Max;
46755
+ this.Frame.HorizontalMin=splitData.Min;
46756
+ }
46757
+
46709
46758
 
46710
46759
  this.FormatValueString=function(value)
46711
46760
  {
@@ -56055,7 +56104,7 @@ function ChartDrawHLine()
56055
56104
  this.TextFont=12*GetDevicePixelRatio() +"px 微软雅黑";
56056
56105
  this.RightSpaceWidth=50;
56057
56106
 
56058
- this.ButtonPosition=0; //按钮位置, 0=价格后面, 1=价格上面 2=价格上面 左对齐
56107
+ this.ButtonPosition=0; //按钮位置, 0=价格后面, 1=价格上面 2=价格上面 左对齐 3=垂直排列
56059
56108
  this.ButtonBGColor='rgb(190,190,190)';
56060
56109
  this.ButtonSpace=3;
56061
56110
 
@@ -56087,6 +56136,8 @@ function ChartDrawHLine()
56087
56136
  this.ColseButtonSize=0;
56088
56137
  this.SettingButtonSize=0;
56089
56138
  this.ButtonBGWidth=0;
56139
+ this.VerticalButtonInfo={ Width:0, Height:0 }; //垂直按钮信息
56140
+
56090
56141
 
56091
56142
 
56092
56143
  this.SetOption=function(option)
@@ -56223,6 +56274,9 @@ function ChartDrawHLine()
56223
56274
  this.SettingButtonSize=0;
56224
56275
  this.ButtonBGWidth=0;
56225
56276
 
56277
+ this.VerticalButtonInfo.Width=0;
56278
+ this.VerticalButtonInfo.Height=0;
56279
+
56226
56280
  if (this.IsFrameMinSize()) return;
56227
56281
  if (!this.IsShow) return;
56228
56282
 
@@ -56424,15 +56478,16 @@ function ChartDrawHLine()
56424
56478
  if (IFrameSplitOperator.IsNumber(labInfo.LineSpace)) lineSpace=labInfo.LineSpace;
56425
56479
 
56426
56480
  //背景色
56481
+ var rtLab={ Left:drawLeft, Top:drawTop, Width:labSize.Width, Height:labSize.Height }
56482
+ rtLab.Right=rtLab.Left+rtLab.Width;
56483
+ rtLab.Bottom=rtLab.Top+rtLab.Height;
56427
56484
  if (labInfo.BGColor)
56428
56485
  {
56429
56486
  this.Canvas.fillStyle=labInfo.BGColor;
56430
- var rtTop=drawTop;
56431
- this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(labSize.Width),ToFixedRect(labSize.Height));
56487
+ this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.Height));
56432
56488
  }
56433
56489
 
56434
56490
  var yText=drawTop+1+lineSpace;
56435
-
56436
56491
  this.Canvas.textBaseline="top";
56437
56492
  for(var i=0;i<labInfo.AryText.length;++i)
56438
56493
  {
@@ -56453,6 +56508,8 @@ function ChartDrawHLine()
56453
56508
 
56454
56509
  yText+=labSize.LineHeight+lineSpace;
56455
56510
  }
56511
+
56512
+ this.DrawVerticalButton(rtLab);
56456
56513
  }
56457
56514
 
56458
56515
  this.DrawCustomHLine=function(labInfo, yLine)
@@ -56607,24 +56664,71 @@ function ChartDrawHLine()
56607
56664
  var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
56608
56665
  this.Canvas.font=font;
56609
56666
  item.Width=this.Canvas.measureText(icon.Text).width+2;
56667
+ item.Height=item.Width;
56610
56668
 
56611
56669
  if (icon.Margin)
56612
56670
  {
56613
56671
  var margin=icon.Margin;
56614
56672
  if (IFrameSplitOperator.IsNumber(margin.Left)) item.Width+=margin.Left;
56615
56673
  if (IFrameSplitOperator.IsNumber(margin.Right)) item.Width+=margin.Right;
56674
+
56675
+ if (IFrameSplitOperator.IsNumber(margin.Top)) item.Height+=margin.Top;
56676
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) item.Height+=margin.Bottom;
56616
56677
  }
56617
56678
 
56679
+ if (this.VerticalButtonInfo.Width<item.Width) this.VerticalButtonInfo.Width=item.Width;
56680
+ this.VerticalButtonInfo.Height+=item.Height;
56681
+
56618
56682
  totalWidth+=item.Width;
56619
56683
  }
56620
56684
 
56621
56685
  this.ButtonBGWidth=totalWidth;
56622
56686
  }
56623
56687
 
56624
- this.DrawButton=function(drawTop, drawLeft, drawHeight, rtDraw)
56688
+ //垂直排列按钮
56689
+ this.DrawVerticalButton=function(rtLab)
56625
56690
  {
56691
+ if (this.ButtonPosition!=3) return;
56626
56692
  if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
56693
+ if (this.VerticalButtonInfo.Height<=0) return;
56694
+
56695
+ var rtBG={ Left:rtLab.Right, Top:rtLab.Top, Width:this.VerticalButtonInfo.Width, Height:this.VerticalButtonInfo.Height };
56696
+ rtBG.Right=rtBG.Left+rtBG.Width;
56697
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
56698
+ this.Canvas.fillStyle=this.ButtonBGColor;
56699
+ this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top), ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
56700
+
56701
+ var pixelRatio=GetDevicePixelRatio();
56702
+ var yTop=rtLab.Top;
56703
+ for(var i=0;i<this.AryShowButton.length;++i)
56704
+ {
56705
+ var item=this.AryShowButton[i];
56706
+ var icon=item.Data;
56707
+
56708
+ var rtButton={Left:rtBG.Left, Top:yTop, Width:this.VerticalButtonInfo.Width, Height:item.Height };
56709
+ rtButton.Right=rtButton.Left+rtButton.Width;
56710
+ rtButton.Bottom=rtButton.Top+rtButton.Height;
56711
+ var yCenter=rtButton.Top+rtButton.Height/2;
56712
+ var xCenter=rtButton.Left+rtButton.Width/2;
56627
56713
 
56714
+ var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
56715
+ this.Canvas.font=font;
56716
+ this.Canvas.textAlign="center";
56717
+ this.Canvas.textBaseline="middle";
56718
+ this.Canvas.fillStyle=icon.Color;
56719
+ this.Canvas.fillText(icon.Text,xCenter,yCenter);
56720
+
56721
+ this.AryButton.push({Rect:rtButton,ID:icon.ID, TooltipText:icon.TooltipText, Data:icon.Data });
56722
+
56723
+ yTop=rtButton.Bottom;
56724
+ }
56725
+ }
56726
+
56727
+ this.DrawButton=function(drawTop, drawLeft, drawHeight, rtDraw)
56728
+ {
56729
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
56730
+ if (this.ButtonPosition==3) return; //垂直按钮在DrawVerticalButton()调用
56731
+
56628
56732
  if (this.ButtonPosition==1)
56629
56733
  {
56630
56734
  drawTop-=drawHeight;
@@ -56635,7 +56739,7 @@ function ChartDrawHLine()
56635
56739
  drawLeft=chartWidth-this.ButtonBGWidth;
56636
56740
  }
56637
56741
 
56638
- if (chartLeft>drawLeft) drawLeft=chartLeft;
56742
+ if (rtDraw.Left>drawLeft) drawLeft=rtDraw.Left;
56639
56743
 
56640
56744
  }
56641
56745
  else if (this.ButtonPosition==2)
@@ -68068,6 +68172,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68068
68172
  {
68069
68173
  var cursorIndex={ ZoomType:this.ZoomType, IsLockRight:this.IsZoomLockRight };
68070
68174
  cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));
68175
+ if (e.ctrlKey) cursorIndex.ZoomType=1; //ctrl+滚轴 十字中心缩放
68071
68176
  if (this.Frame.ZoomDown(cursorIndex, { ZoomDownloadDataCallback:(requestData)=>{ this.ZoomDownloadData(requestData) } } ))
68072
68177
  {
68073
68178
  this.CursorIndex=cursorIndex.Index;
@@ -68090,6 +68195,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
68090
68195
  {
68091
68196
  var cursorIndex={ ZoomType:this.ZoomType, IsLockRight:this.IsZoomLockRight };
68092
68197
  cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));
68198
+ if (e.ctrlKey) cursorIndex.ZoomType=1; //ctrl+滚轴 十字中心缩放
68093
68199
  if (this.Frame.ZoomUp(cursorIndex))
68094
68200
  {
68095
68201
  JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex)
@@ -13868,6 +13868,7 @@ function IChartFramePainting()
13868
13868
 
13869
13869
  this.HorizontalMax; //Y轴最大值
13870
13870
  this.HorizontalMin; //Y轴最小值
13871
+ this.HorizontalReserved=null; //Y轴预留高度 { Top:上, Bottom:下 }
13871
13872
  this.XPointCount=10; //X轴数据个数
13872
13873
 
13873
13874
  this.ClientBGColor; //客户区背景色
@@ -40703,7 +40704,9 @@ function ChartMultiBar()
40703
40704
 
40704
40705
  this.Draw=function()
40705
40706
  {
40706
- if (!this.IsShow || this.ChartFrame.IsMinSize) return;
40707
+ if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
40708
+ if (this.IsShowIndexTitleOnly()) return;
40709
+ if (this.IsHideScriptIndex()) return;
40707
40710
  if (!this.Data || this.Data.length<=0) return;
40708
40711
 
40709
40712
  this.IsHScreen=(this.ChartFrame.IsHScreen===true);
@@ -50580,12 +50583,15 @@ function FrameSplitY()
50580
50583
  if (this.EnableRemoveZero) this.RemoveZero(this.Frame.HorizontalInfo);
50581
50584
 
50582
50585
  this.DynamicMessageText();
50586
+
50583
50587
  this.Frame.HorizontalMax=splitData.Max;
50584
50588
  this.Frame.HorizontalMin=splitData.Min;
50585
50589
 
50586
50590
  if (this.EnableZoomUpDown==true && !this.FixedYMaxMin)
50587
50591
  this.FixedYMaxMin={ Max:splitData.Max, Min:splitData.Min };
50588
50592
 
50593
+ this.ReservedHeight(splitData); //预留高度
50594
+
50589
50595
  if (this.GetEventCallback)
50590
50596
  {
50591
50597
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);
@@ -50598,6 +50604,49 @@ function FrameSplitY()
50598
50604
  }
50599
50605
  }
50600
50606
 
50607
+ this.ReservedHeight=function(splitData)
50608
+ {
50609
+ if (this.Frame.IsHScreen) return; //横屏以后再搞
50610
+
50611
+ var yReserved=this.Frame.HorizontalReserved;
50612
+ if (!yReserved) return;
50613
+
50614
+ var reservedHeight=0;
50615
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) reservedHeight+=yReserved.Top;
50616
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) reservedHeight+=yReserved.Bottom;
50617
+ if (reservedHeight<=0) return;
50618
+
50619
+ var border=this.Frame.GetBorder();
50620
+ var top=border.TopEx;
50621
+ var bottom=border.BottomEx;
50622
+ var srcHeight=bottom-top;
50623
+ if (srcHeight<reservedHeight) return;
50624
+
50625
+ var max=splitData.Max;
50626
+ var min=splitData.Min;
50627
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) top-=yReserved.Top;
50628
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) bottom+=yReserved.Bottom;
50629
+
50630
+ var value=(max-min)/(bottom-top); //1个像素点对应的数值
50631
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top))
50632
+ {
50633
+ var topValue=value*yReserved.Top;
50634
+ max+=topValue;
50635
+ }
50636
+
50637
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))
50638
+ {
50639
+ var bottomValue=value*yReserved.Bottom;
50640
+ min-=bottomValue;
50641
+ }
50642
+
50643
+ splitData.Max=max;
50644
+ splitData.Min=min;
50645
+
50646
+ this.Frame.HorizontalMax=splitData.Max;
50647
+ this.Frame.HorizontalMin=splitData.Min;
50648
+ }
50649
+
50601
50650
 
50602
50651
  this.FormatValueString=function(value)
50603
50652
  {
@@ -59947,7 +59996,7 @@ function ChartDrawHLine()
59947
59996
  this.TextFont=12*GetDevicePixelRatio() +"px 微软雅黑";
59948
59997
  this.RightSpaceWidth=50;
59949
59998
 
59950
- this.ButtonPosition=0; //按钮位置, 0=价格后面, 1=价格上面 2=价格上面 左对齐
59999
+ this.ButtonPosition=0; //按钮位置, 0=价格后面, 1=价格上面 2=价格上面 左对齐 3=垂直排列
59951
60000
  this.ButtonBGColor='rgb(190,190,190)';
59952
60001
  this.ButtonSpace=3;
59953
60002
 
@@ -59979,6 +60028,8 @@ function ChartDrawHLine()
59979
60028
  this.ColseButtonSize=0;
59980
60029
  this.SettingButtonSize=0;
59981
60030
  this.ButtonBGWidth=0;
60031
+ this.VerticalButtonInfo={ Width:0, Height:0 }; //垂直按钮信息
60032
+
59982
60033
 
59983
60034
 
59984
60035
  this.SetOption=function(option)
@@ -60115,6 +60166,9 @@ function ChartDrawHLine()
60115
60166
  this.SettingButtonSize=0;
60116
60167
  this.ButtonBGWidth=0;
60117
60168
 
60169
+ this.VerticalButtonInfo.Width=0;
60170
+ this.VerticalButtonInfo.Height=0;
60171
+
60118
60172
  if (this.IsFrameMinSize()) return;
60119
60173
  if (!this.IsShow) return;
60120
60174
 
@@ -60316,15 +60370,16 @@ function ChartDrawHLine()
60316
60370
  if (IFrameSplitOperator.IsNumber(labInfo.LineSpace)) lineSpace=labInfo.LineSpace;
60317
60371
 
60318
60372
  //背景色
60373
+ var rtLab={ Left:drawLeft, Top:drawTop, Width:labSize.Width, Height:labSize.Height }
60374
+ rtLab.Right=rtLab.Left+rtLab.Width;
60375
+ rtLab.Bottom=rtLab.Top+rtLab.Height;
60319
60376
  if (labInfo.BGColor)
60320
60377
  {
60321
60378
  this.Canvas.fillStyle=labInfo.BGColor;
60322
- var rtTop=drawTop;
60323
- this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(labSize.Width),ToFixedRect(labSize.Height));
60379
+ this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.Height));
60324
60380
  }
60325
60381
 
60326
60382
  var yText=drawTop+1+lineSpace;
60327
-
60328
60383
  this.Canvas.textBaseline="top";
60329
60384
  for(var i=0;i<labInfo.AryText.length;++i)
60330
60385
  {
@@ -60345,6 +60400,8 @@ function ChartDrawHLine()
60345
60400
 
60346
60401
  yText+=labSize.LineHeight+lineSpace;
60347
60402
  }
60403
+
60404
+ this.DrawVerticalButton(rtLab);
60348
60405
  }
60349
60406
 
60350
60407
  this.DrawCustomHLine=function(labInfo, yLine)
@@ -60499,24 +60556,71 @@ function ChartDrawHLine()
60499
60556
  var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60500
60557
  this.Canvas.font=font;
60501
60558
  item.Width=this.Canvas.measureText(icon.Text).width+2;
60559
+ item.Height=item.Width;
60502
60560
 
60503
60561
  if (icon.Margin)
60504
60562
  {
60505
60563
  var margin=icon.Margin;
60506
60564
  if (IFrameSplitOperator.IsNumber(margin.Left)) item.Width+=margin.Left;
60507
60565
  if (IFrameSplitOperator.IsNumber(margin.Right)) item.Width+=margin.Right;
60566
+
60567
+ if (IFrameSplitOperator.IsNumber(margin.Top)) item.Height+=margin.Top;
60568
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) item.Height+=margin.Bottom;
60508
60569
  }
60509
60570
 
60571
+ if (this.VerticalButtonInfo.Width<item.Width) this.VerticalButtonInfo.Width=item.Width;
60572
+ this.VerticalButtonInfo.Height+=item.Height;
60573
+
60510
60574
  totalWidth+=item.Width;
60511
60575
  }
60512
60576
 
60513
60577
  this.ButtonBGWidth=totalWidth;
60514
60578
  }
60515
60579
 
60516
- this.DrawButton=function(drawTop, drawLeft, drawHeight, rtDraw)
60580
+ //垂直排列按钮
60581
+ this.DrawVerticalButton=function(rtLab)
60517
60582
  {
60583
+ if (this.ButtonPosition!=3) return;
60518
60584
  if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
60585
+ if (this.VerticalButtonInfo.Height<=0) return;
60586
+
60587
+ var rtBG={ Left:rtLab.Right, Top:rtLab.Top, Width:this.VerticalButtonInfo.Width, Height:this.VerticalButtonInfo.Height };
60588
+ rtBG.Right=rtBG.Left+rtBG.Width;
60589
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60590
+ this.Canvas.fillStyle=this.ButtonBGColor;
60591
+ this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top), ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
60592
+
60593
+ var pixelRatio=GetDevicePixelRatio();
60594
+ var yTop=rtLab.Top;
60595
+ for(var i=0;i<this.AryShowButton.length;++i)
60596
+ {
60597
+ var item=this.AryShowButton[i];
60598
+ var icon=item.Data;
60599
+
60600
+ var rtButton={Left:rtBG.Left, Top:yTop, Width:this.VerticalButtonInfo.Width, Height:item.Height };
60601
+ rtButton.Right=rtButton.Left+rtButton.Width;
60602
+ rtButton.Bottom=rtButton.Top+rtButton.Height;
60603
+ var yCenter=rtButton.Top+rtButton.Height/2;
60604
+ var xCenter=rtButton.Left+rtButton.Width/2;
60519
60605
 
60606
+ var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60607
+ this.Canvas.font=font;
60608
+ this.Canvas.textAlign="center";
60609
+ this.Canvas.textBaseline="middle";
60610
+ this.Canvas.fillStyle=icon.Color;
60611
+ this.Canvas.fillText(icon.Text,xCenter,yCenter);
60612
+
60613
+ this.AryButton.push({Rect:rtButton,ID:icon.ID, TooltipText:icon.TooltipText, Data:icon.Data });
60614
+
60615
+ yTop=rtButton.Bottom;
60616
+ }
60617
+ }
60618
+
60619
+ this.DrawButton=function(drawTop, drawLeft, drawHeight, rtDraw)
60620
+ {
60621
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
60622
+ if (this.ButtonPosition==3) return; //垂直按钮在DrawVerticalButton()调用
60623
+
60520
60624
  if (this.ButtonPosition==1)
60521
60625
  {
60522
60626
  drawTop-=drawHeight;
@@ -60527,7 +60631,7 @@ function ChartDrawHLine()
60527
60631
  drawLeft=chartWidth-this.ButtonBGWidth;
60528
60632
  }
60529
60633
 
60530
- if (chartLeft>drawLeft) drawLeft=chartLeft;
60634
+ if (rtDraw.Left>drawLeft) drawLeft=rtDraw.Left;
60531
60635
 
60532
60636
  }
60533
60637
  else if (this.ButtonPosition==2)
@@ -71960,6 +72064,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
71960
72064
  {
71961
72065
  var cursorIndex={ ZoomType:this.ZoomType, IsLockRight:this.IsZoomLockRight };
71962
72066
  cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));
72067
+ if (e.ctrlKey) cursorIndex.ZoomType=1; //ctrl+滚轴 十字中心缩放
71963
72068
  if (this.Frame.ZoomDown(cursorIndex, { ZoomDownloadDataCallback:(requestData)=>{ this.ZoomDownloadData(requestData) } } ))
71964
72069
  {
71965
72070
  this.CursorIndex=cursorIndex.Index;
@@ -71982,6 +72087,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
71982
72087
  {
71983
72088
  var cursorIndex={ ZoomType:this.ZoomType, IsLockRight:this.IsZoomLockRight };
71984
72089
  cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));
72090
+ if (e.ctrlKey) cursorIndex.ZoomType=1; //ctrl+滚轴 十字中心缩放
71985
72091
  if (this.Frame.ZoomUp(cursorIndex))
71986
72092
  {
71987
72093
  JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex)
@@ -132008,7 +132114,7 @@ function ScrollBarBGChart()
132008
132114
 
132009
132115
 
132010
132116
 
132011
- var HQCHART_VERSION="1.1.13258";
132117
+ var HQCHART_VERSION="1.1.13264";
132012
132118
 
132013
132119
  function PrintHQChartVersion()
132014
132120
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13258";
8
+ var HQCHART_VERSION="1.1.13264";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -13912,6 +13912,7 @@ function IChartFramePainting()
13912
13912
 
13913
13913
  this.HorizontalMax; //Y轴最大值
13914
13914
  this.HorizontalMin; //Y轴最小值
13915
+ this.HorizontalReserved=null; //Y轴预留高度 { Top:上, Bottom:下 }
13915
13916
  this.XPointCount=10; //X轴数据个数
13916
13917
 
13917
13918
  this.ClientBGColor; //客户区背景色
@@ -40747,7 +40748,9 @@ function ChartMultiBar()
40747
40748
 
40748
40749
  this.Draw=function()
40749
40750
  {
40750
- if (!this.IsShow || this.ChartFrame.IsMinSize) return;
40751
+ if (!this.IsShow || this.ChartFrame.IsMinSize || !this.IsVisible) return;
40752
+ if (this.IsShowIndexTitleOnly()) return;
40753
+ if (this.IsHideScriptIndex()) return;
40751
40754
  if (!this.Data || this.Data.length<=0) return;
40752
40755
 
40753
40756
  this.IsHScreen=(this.ChartFrame.IsHScreen===true);
@@ -50624,12 +50627,15 @@ function FrameSplitY()
50624
50627
  if (this.EnableRemoveZero) this.RemoveZero(this.Frame.HorizontalInfo);
50625
50628
 
50626
50629
  this.DynamicMessageText();
50630
+
50627
50631
  this.Frame.HorizontalMax=splitData.Max;
50628
50632
  this.Frame.HorizontalMin=splitData.Min;
50629
50633
 
50630
50634
  if (this.EnableZoomUpDown==true && !this.FixedYMaxMin)
50631
50635
  this.FixedYMaxMin={ Max:splitData.Max, Min:splitData.Min };
50632
50636
 
50637
+ this.ReservedHeight(splitData); //预留高度
50638
+
50633
50639
  if (this.GetEventCallback)
50634
50640
  {
50635
50641
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_YCOORDINATE);
@@ -50642,6 +50648,49 @@ function FrameSplitY()
50642
50648
  }
50643
50649
  }
50644
50650
 
50651
+ this.ReservedHeight=function(splitData)
50652
+ {
50653
+ if (this.Frame.IsHScreen) return; //横屏以后再搞
50654
+
50655
+ var yReserved=this.Frame.HorizontalReserved;
50656
+ if (!yReserved) return;
50657
+
50658
+ var reservedHeight=0;
50659
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) reservedHeight+=yReserved.Top;
50660
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) reservedHeight+=yReserved.Bottom;
50661
+ if (reservedHeight<=0) return;
50662
+
50663
+ var border=this.Frame.GetBorder();
50664
+ var top=border.TopEx;
50665
+ var bottom=border.BottomEx;
50666
+ var srcHeight=bottom-top;
50667
+ if (srcHeight<reservedHeight) return;
50668
+
50669
+ var max=splitData.Max;
50670
+ var min=splitData.Min;
50671
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top)) top-=yReserved.Top;
50672
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom)) bottom+=yReserved.Bottom;
50673
+
50674
+ var value=(max-min)/(bottom-top); //1个像素点对应的数值
50675
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Top))
50676
+ {
50677
+ var topValue=value*yReserved.Top;
50678
+ max+=topValue;
50679
+ }
50680
+
50681
+ if (IFrameSplitOperator.IsPlusNumber(yReserved.Bottom))
50682
+ {
50683
+ var bottomValue=value*yReserved.Bottom;
50684
+ min-=bottomValue;
50685
+ }
50686
+
50687
+ splitData.Max=max;
50688
+ splitData.Min=min;
50689
+
50690
+ this.Frame.HorizontalMax=splitData.Max;
50691
+ this.Frame.HorizontalMin=splitData.Min;
50692
+ }
50693
+
50645
50694
 
50646
50695
  this.FormatValueString=function(value)
50647
50696
  {
@@ -59991,7 +60040,7 @@ function ChartDrawHLine()
59991
60040
  this.TextFont=12*GetDevicePixelRatio() +"px 微软雅黑";
59992
60041
  this.RightSpaceWidth=50;
59993
60042
 
59994
- this.ButtonPosition=0; //按钮位置, 0=价格后面, 1=价格上面 2=价格上面 左对齐
60043
+ this.ButtonPosition=0; //按钮位置, 0=价格后面, 1=价格上面 2=价格上面 左对齐 3=垂直排列
59995
60044
  this.ButtonBGColor='rgb(190,190,190)';
59996
60045
  this.ButtonSpace=3;
59997
60046
 
@@ -60023,6 +60072,8 @@ function ChartDrawHLine()
60023
60072
  this.ColseButtonSize=0;
60024
60073
  this.SettingButtonSize=0;
60025
60074
  this.ButtonBGWidth=0;
60075
+ this.VerticalButtonInfo={ Width:0, Height:0 }; //垂直按钮信息
60076
+
60026
60077
 
60027
60078
 
60028
60079
  this.SetOption=function(option)
@@ -60159,6 +60210,9 @@ function ChartDrawHLine()
60159
60210
  this.SettingButtonSize=0;
60160
60211
  this.ButtonBGWidth=0;
60161
60212
 
60213
+ this.VerticalButtonInfo.Width=0;
60214
+ this.VerticalButtonInfo.Height=0;
60215
+
60162
60216
  if (this.IsFrameMinSize()) return;
60163
60217
  if (!this.IsShow) return;
60164
60218
 
@@ -60360,15 +60414,16 @@ function ChartDrawHLine()
60360
60414
  if (IFrameSplitOperator.IsNumber(labInfo.LineSpace)) lineSpace=labInfo.LineSpace;
60361
60415
 
60362
60416
  //背景色
60417
+ var rtLab={ Left:drawLeft, Top:drawTop, Width:labSize.Width, Height:labSize.Height }
60418
+ rtLab.Right=rtLab.Left+rtLab.Width;
60419
+ rtLab.Bottom=rtLab.Top+rtLab.Height;
60363
60420
  if (labInfo.BGColor)
60364
60421
  {
60365
60422
  this.Canvas.fillStyle=labInfo.BGColor;
60366
- var rtTop=drawTop;
60367
- this.Canvas.fillRect(ToFixedRect(drawLeft),ToFixedRect(rtTop),ToFixedRect(labSize.Width),ToFixedRect(labSize.Height));
60423
+ this.Canvas.fillRect(ToFixedRect(rtLab.Left),ToFixedRect(rtLab.Top),ToFixedRect(rtLab.Width),ToFixedRect(rtLab.Height));
60368
60424
  }
60369
60425
 
60370
60426
  var yText=drawTop+1+lineSpace;
60371
-
60372
60427
  this.Canvas.textBaseline="top";
60373
60428
  for(var i=0;i<labInfo.AryText.length;++i)
60374
60429
  {
@@ -60389,6 +60444,8 @@ function ChartDrawHLine()
60389
60444
 
60390
60445
  yText+=labSize.LineHeight+lineSpace;
60391
60446
  }
60447
+
60448
+ this.DrawVerticalButton(rtLab);
60392
60449
  }
60393
60450
 
60394
60451
  this.DrawCustomHLine=function(labInfo, yLine)
@@ -60543,24 +60600,71 @@ function ChartDrawHLine()
60543
60600
  var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60544
60601
  this.Canvas.font=font;
60545
60602
  item.Width=this.Canvas.measureText(icon.Text).width+2;
60603
+ item.Height=item.Width;
60546
60604
 
60547
60605
  if (icon.Margin)
60548
60606
  {
60549
60607
  var margin=icon.Margin;
60550
60608
  if (IFrameSplitOperator.IsNumber(margin.Left)) item.Width+=margin.Left;
60551
60609
  if (IFrameSplitOperator.IsNumber(margin.Right)) item.Width+=margin.Right;
60610
+
60611
+ if (IFrameSplitOperator.IsNumber(margin.Top)) item.Height+=margin.Top;
60612
+ if (IFrameSplitOperator.IsNumber(margin.Bottom)) item.Height+=margin.Bottom;
60552
60613
  }
60553
60614
 
60615
+ if (this.VerticalButtonInfo.Width<item.Width) this.VerticalButtonInfo.Width=item.Width;
60616
+ this.VerticalButtonInfo.Height+=item.Height;
60617
+
60554
60618
  totalWidth+=item.Width;
60555
60619
  }
60556
60620
 
60557
60621
  this.ButtonBGWidth=totalWidth;
60558
60622
  }
60559
60623
 
60560
- this.DrawButton=function(drawTop, drawLeft, drawHeight, rtDraw)
60624
+ //垂直排列按钮
60625
+ this.DrawVerticalButton=function(rtLab)
60561
60626
  {
60627
+ if (this.ButtonPosition!=3) return;
60562
60628
  if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
60629
+ if (this.VerticalButtonInfo.Height<=0) return;
60630
+
60631
+ var rtBG={ Left:rtLab.Right, Top:rtLab.Top, Width:this.VerticalButtonInfo.Width, Height:this.VerticalButtonInfo.Height };
60632
+ rtBG.Right=rtBG.Left+rtBG.Width;
60633
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
60634
+ this.Canvas.fillStyle=this.ButtonBGColor;
60635
+ this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top), ToFixedRect(rtBG.Width),ToFixedRect(rtBG.Height));
60636
+
60637
+ var pixelRatio=GetDevicePixelRatio();
60638
+ var yTop=rtLab.Top;
60639
+ for(var i=0;i<this.AryShowButton.length;++i)
60640
+ {
60641
+ var item=this.AryShowButton[i];
60642
+ var icon=item.Data;
60643
+
60644
+ var rtButton={Left:rtBG.Left, Top:yTop, Width:this.VerticalButtonInfo.Width, Height:item.Height };
60645
+ rtButton.Right=rtButton.Left+rtButton.Width;
60646
+ rtButton.Bottom=rtButton.Top+rtButton.Height;
60647
+ var yCenter=rtButton.Top+rtButton.Height/2;
60648
+ var xCenter=rtButton.Left+rtButton.Width/2;
60563
60649
 
60650
+ var font=`${icon.Size*pixelRatio}px ${icon.Family}`;
60651
+ this.Canvas.font=font;
60652
+ this.Canvas.textAlign="center";
60653
+ this.Canvas.textBaseline="middle";
60654
+ this.Canvas.fillStyle=icon.Color;
60655
+ this.Canvas.fillText(icon.Text,xCenter,yCenter);
60656
+
60657
+ this.AryButton.push({Rect:rtButton,ID:icon.ID, TooltipText:icon.TooltipText, Data:icon.Data });
60658
+
60659
+ yTop=rtButton.Bottom;
60660
+ }
60661
+ }
60662
+
60663
+ this.DrawButton=function(drawTop, drawLeft, drawHeight, rtDraw)
60664
+ {
60665
+ if (!IFrameSplitOperator.IsNonEmptyArray(this.AryShowButton)) return;
60666
+ if (this.ButtonPosition==3) return; //垂直按钮在DrawVerticalButton()调用
60667
+
60564
60668
  if (this.ButtonPosition==1)
60565
60669
  {
60566
60670
  drawTop-=drawHeight;
@@ -60571,7 +60675,7 @@ function ChartDrawHLine()
60571
60675
  drawLeft=chartWidth-this.ButtonBGWidth;
60572
60676
  }
60573
60677
 
60574
- if (chartLeft>drawLeft) drawLeft=chartLeft;
60678
+ if (rtDraw.Left>drawLeft) drawLeft=rtDraw.Left;
60575
60679
 
60576
60680
  }
60577
60681
  else if (this.ButtonPosition==2)
@@ -72004,6 +72108,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72004
72108
  {
72005
72109
  var cursorIndex={ ZoomType:this.ZoomType, IsLockRight:this.IsZoomLockRight };
72006
72110
  cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));
72111
+ if (e.ctrlKey) cursorIndex.ZoomType=1; //ctrl+滚轴 十字中心缩放
72007
72112
  if (this.Frame.ZoomDown(cursorIndex, { ZoomDownloadDataCallback:(requestData)=>{ this.ZoomDownloadData(requestData) } } ))
72008
72113
  {
72009
72114
  this.CursorIndex=cursorIndex.Index;
@@ -72026,6 +72131,7 @@ function KLineChartContainer(uielement,OffscreenElement, cacheElement)
72026
72131
  {
72027
72132
  var cursorIndex={ ZoomType:this.ZoomType, IsLockRight:this.IsZoomLockRight };
72028
72133
  cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));
72134
+ if (e.ctrlKey) cursorIndex.ZoomType=1; //ctrl+滚轴 十字中心缩放
72029
72135
  if (this.Frame.ZoomUp(cursorIndex))
72030
72136
  {
72031
72137
  JSConsole.Chart.Log("[KLineChartContainer::OnWheel] cursorIndex ",cursorIndex)
@@ -135417,7 +135523,7 @@ function HQChartScriptWorker()
135417
135523
 
135418
135524
 
135419
135525
 
135420
- var HQCHART_VERSION="1.1.13258";
135526
+ var HQCHART_VERSION="1.1.13264";
135421
135527
 
135422
135528
  function PrintHQChartVersion()
135423
135529
  {