hqchart 1.1.13105 → 1.1.13110

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.
@@ -1634,17 +1634,19 @@ this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID&&this.TouchStatus.CorssCursor
1634
1634
  {if(e.cancelable)e.preventDefault();}if(this.IsPhoneDragging(e)){var touches=this.GetToucheData(e,this.IsForceLandscape);var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);if(this.TryClickLock||this.TryClickIndexTitle)//指标枷锁区域 , 指标标题点击
1635
1635
  {var x=pt.X;var y=pt.Y;if(this.TryClickLock&&this.TryClickLock(x,y))return;if(this.TryClickIndexTitle&&this.TryClickIndexTitle(x,y))return;}if(this.ClickFrameButton){var button=this.Frame.PtInButtons(pt.X,pt.Y);if(button){this.ClickFrameButton(button,e);return;}}if(this.EnableVerticalDrag){this.VerticalDrag={IsDrag:false};if(this.Frame.PtInFrameVertical(pt.X,pt.Y))this.VerticalDrag.IsDrag=true;}var bStartTimer=true;if(this.ChartDrawOption.IsLockScreen){bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID){if(this.TouchStatus.CorssCursorShow==true)bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.DISABLE_DRAG_ID){bStartTimer=false;}else{if(!isSingleTouch)bStartTimer=false;}if(this.VerticalDrag)bStartTimer=false;if(this.EnableClickModel&&this.ClickModel.IsShowCorssCursor==true)bStartTimer=false;var drag={"Click":{},"LastMove":{}//最后移动的位置
1636
1636
  };//var touches=this.GetToucheData(e,this.IsForceLandscape);
1637
- drag.Click.X=touches[0].clientX;drag.Click.Y=touches[0].clientY;drag.LastMove.X=touches[0].clientX;drag.LastMove.Y=touches[0].clientY;this.MouseDrag=drag;this.PhoneTouchInfo={Start:{X:touches[0].clientX,Y:touches[0].clientY},End:{X:touches[0].clientX,Y:touches[0].clientY}};if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.IsSelected=false;this.SelectChartDrawPicture=null;var isDrawPictrue=false;if(this.CurrentChartDrawPicture)//画图工具模式
1637
+ drag.Click.X=touches[0].clientX;drag.Click.Y=touches[0].clientY;drag.LastMove.X=touches[0].clientX;drag.LastMove.Y=touches[0].clientY;this.MouseDrag=drag;var drawPictureActive=this.GetActiveDrawPicture();//上一次选中的
1638
+ var selectedChart={Chart:this.SelectedChart.Selected.Chart,Identify:this.SelectedChart.Selected.Identify};//上一次选中的图形
1639
+ this.PhoneTouchInfo={Start:{X:touches[0].clientX,Y:touches[0].clientY},End:{X:touches[0].clientX,Y:touches[0].clientY}};if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.IsSelected=false;this.SelectChartDrawPicture=null;var isDrawPictrue=false;if(this.CurrentChartDrawPicture)//画图工具模式
1638
1640
  {var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==2)this.SetChartDrawPictureThirdPoint(drag.Click.X,drag.Click.Y,true);else{this.SetChartDrawPictureFirstPoint(drag.Click.X,drag.Click.Y,true);//只有1个点 直接完成
1639
- if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo({Corss:false,Tooltip:false});}if(e.cancelable)e.preventDefault();return;}else{var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);var drawPictrueData={X:pt.X,Y:pt.Y};var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
1641
+ if(this.FinishChartDrawPicturePoint()){if(drawPicture.IsDrawMain)this.Draw();else this.DrawDynamicInfo({Corss:false,Tooltip:false});}}if(e.cancelable)e.preventDefault();return;}else{var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);var drawPictrueData={X:pt.X,Y:pt.Y};var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
1640
1642
  if(this.GetChartDrawPictureByPoint(drawPictrueData)){drawPictrueData.ChartDrawPicture.Status=20;drawPictrueData.ChartDrawPicture.ValueToPoint();drawPictrueData.ChartDrawPicture.MovePointIndex=drawPictrueData.PointIndex;drawPictrueData.ChartDrawPicture.IsSelected=true;this.CurrentChartDrawPicture=drawPictrueData.ChartDrawPicture;this.SelectChartDrawPicture=drawPictrueData.ChartDrawPicture;var _event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_DRAWPICTURE);//选中画图工具事件
1641
- if(_event&&_event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};_event.Callback(_event,sendData,this);}if(e.cancelable)e.preventDefault();return;}}if(bStartTimer){//长按2秒,十字光标
1643
+ if(_event&&_event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};_event.Callback(_event,sendData,this);}var drawType=0;if(drawPictrueData.ChartDrawPicture.IsDrawMain)drawType=1;else if(drawPictureActive.Select.Guid&&drawPictureActive.Select.Chart&&drawPictureActive.Select.Chart.IsDrawMain)drawType=1;if(drawType==1)this.Draw();if(e.cancelable)e.preventDefault();return;}}if(bStartTimer){//长按2秒,十字光标
1642
1644
  var self=this;this.DragTimer=setTimeout(function(){if(drag.Click.X==drag.LastMove.X&&drag.Click.Y==drag.LastMove.Y)//手指没有移动,出现十字光标
1643
1645
  {var mouseDrag=self.MouseDrag;self.MouseDrag=null;if(self.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID)self.TouchStatus.CorssCursorShow=true;//十字显示
1644
1646
  if(self.EnableClickModel===true)self.ClickModel.IsShowCorssCursor=true;self.MoveCorssCursor(drag.Click,e);//移动十字光标
1645
1647
  }},self.PressTime);}if(this.EnableZoomIndexWindow){this.PhoneDBClick.AddTouchStart(touches[0].clientX,touches[0].clientY,Date.now());JSConsole.Chart.Log("[JSChartContainer::OnTouchStart] PhoneDBClick ",this.PhoneDBClick);}if(this.ChartDrawOption.IsLockScreen){this.MouseDrag=null;}else if(this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID){}else if(this.DragMode==JSCHART_DRAG_ID.DISABLE_DRAG_ID){this.MouseDrag=null;this.MoveCorssCursor(drag.Click,e);}else if(this.EnableClickModel){//if (this.ClickModel.IsShowCorssCursor===true) this.MoveCorssCursor(drag.Click,e)
1646
1648
  }else if(this.VerticalDrag){if(!this.VerticalDrag.IsDrag)this.MoveCorssCursor(drag.Click,e);//没有点击X轴, 就显示十字光标
1647
- }else if(this.IsClickShowCorssCursor){this.MoveCorssCursor(drag.Click,e);}this.TouchEvent({EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH,FunctionName:"OnTouchStart"},e);}else if(this.IsPhonePinching(e)){var phonePinch={"Start":{},"Last":{}};var touches=this.GetToucheData(e,this.IsForceLandscape);phonePinch.Start={X:touches[0].pageX,Y:touches[0].pageY,X2:touches[1].pageX,Y2:touches[1].pageY};phonePinch.Last={X:touches[0].pageX,Y:touches[0].pageY,X2:touches[1].pageX,Y2:touches[1].pageY};this.PhonePinch=phonePinch;this.SelectChartDrawPicture=null;}};this.OnTouchMove=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var touches=this.GetToucheData(e,this.IsForceLandscape);if(this.IsPhoneDragging(e)){var drag=this.MouseDrag;if(drag==null){if(this.IsForceLandscape)y=uielement.getBoundingClientRect().width-touches[0].clientY;//强制横屏Y计算
1649
+ }else if(this.IsClickShowCorssCursor){this.MoveCorssCursor(drag.Click,e);}this.TouchEvent({EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH,FunctionName:"OnTouchStart"},e);var drawType=0;if(drawPictureActive.Select.Guid!=null){if(drawPictureActive.Select.Guid&&drawPictureActive.Select.Chart)drawType=1;}if(drawType==1)this.Draw();}else if(this.IsPhonePinching(e)){var phonePinch={"Start":{},"Last":{}};var touches=this.GetToucheData(e,this.IsForceLandscape);phonePinch.Start={X:touches[0].pageX,Y:touches[0].pageY,X2:touches[1].pageX,Y2:touches[1].pageY};phonePinch.Last={X:touches[0].pageX,Y:touches[0].pageY,X2:touches[1].pageX,Y2:touches[1].pageY};this.PhonePinch=phonePinch;this.SelectChartDrawPicture=null;}};this.OnTouchMove=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var touches=this.GetToucheData(e,this.IsForceLandscape);if(this.IsPhoneDragging(e)){var drag=this.MouseDrag;if(drag==null){if(this.IsForceLandscape)y=uielement.getBoundingClientRect().width-touches[0].clientY;//强制横屏Y计算
1648
1650
  if(!this.ChartDrawOption.IsLockScreen)this.MoveCorssCursor({X:touches[0].clientX,Y:touches[0].clientY},e);}else{var moveAngle=this.GetMoveAngle(drag.LastMove,{X:touches[0].clientX,Y:touches[0].clientY});var moveSetp=Math.abs(drag.LastMove.X-touches[0].clientX);var moveUpDown=Math.abs(drag.LastMove.Y-touches[0].clientY);moveSetp=parseInt(moveSetp);var isMoveCorssCursor=this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID&&this.TouchStatus.CorssCursorShow==true;//是否移动十字光标
1649
1651
  if(this.VerticalDrag){if(this.VerticalDrag.IsDrag===true)isMoveCorssCursor=false;else isMoveCorssCursor=true;}if(this.EnableClickModel){if(this.ClickModel.IsShowCorssCursor===true)isMoveCorssCursor=true;else isMoveCorssCursor=false;}//JSConsole.Chart.Log(`[JSChartContainer::OnTouchMove] moveAngle=${moveAngle} , moveUpDown=${moveUpDown}, moveSetp=${moveSetp}`);
1650
1652
  if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==1||drawPicture.Status==2){if(moveSetp<5&&moveUpDown<5)return;if(this.SetChartDrawPictureSecondPoint(touches[0].clientX,touches[0].clientY,true)){this.DrawDynamicInfo();}}else if(drawPicture.Status==3){if(this.SetChartDrawPictureThirdPoint(touches[0].clientX,touches[0].clientY,true)){this.DrawDynamicInfo();}}else if(drawPicture.Status==20)//画图工具移动
@@ -5885,8 +5887,9 @@ this.ValueTextColor='rgb(250,250,250)';this.IsShowCorssCursor=true;//画的时
5885
5887
  this.GetLabelCallback;//绘制标题回调函数
5886
5888
  this.PointCount=1;this.ClassName='ChartDrawHLine';this.Font=14*GetDevicePixelRatio()+"px 微软雅黑";this.TextFont=12*GetDevicePixelRatio()+"px 微软雅黑";this.RightSpaceWidth=50;this.ButtonPosition=0;//按钮位置, 0=价格后面, 1=价格上面
5887
5889
  this.ButtonBGColor='rgb(190,190,190)';this.ButtonSpace=3;this.Button={CloseIcon:{Text:'\uE62B',Color:'rgb(255,255,255)',Family:"iconfont",Size:16},SettingIcon:{Text:'\uE623',Color:'rgb(255,255,255)',Family:"iconfont",Size:16}};this.AryButton=[];this.ExtendData;//扩展数据
5888
- //内部变量
5889
- 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(IFrameSplitOperator.IsNumber(option.Precision))this.Precision=option.Precision;if(option.Font)this.Font=option.Font;if(option.ValueTextColor)this.ValueTextColor=option.ValueTextColor;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(item.SettingIcon)this.Button.SettingIcon=CloneData(item.SettingIcon);}if(option.ExtendData)this.ExtendData=option.ExtendData;}};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;/*
5890
+ this.ShowPriceTextConfig={IsShow:[false,false,true],//[0]=left内 [1]=right内 [2]=right外
5891
+ Font:[12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1',12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1']};//内部变量
5892
+ 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(IFrameSplitOperator.IsNumber(option.Precision))this.Precision=option.Precision;if(option.Font)this.Font=option.Font;if(option.ValueTextColor)this.ValueTextColor=option.ValueTextColor;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(item.SettingIcon)this.Button.SettingIcon=CloneData(item.SettingIcon);}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;}}}};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;/*
5890
5893
  this.GetXYCoordinate=function()
5891
5894
  {
5892
5895
  if (this.IsFrameMinSize()) return null;
@@ -5896,13 +5899,14 @@ this.ColseButtonSize=0;this.SettingButtonSize=0;this.ButtonBGWidth=0;this.SetOpt
5896
5899
  }
5897
5900
  */this.IsDrawMain=function()//选中绘制在动态绘图上, 没有选中绘制在背景上
5898
5901
  {if(!this.GetActiveDrawPicture)return true;var active=this.GetActiveDrawPicture();if(active.Select.Guid==this.Guid)return false;return true;};this.MainDraw=function(){this.Draw();};this.Draw=function(moveonPoint,mouseStatus){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();//画线段
5899
- 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();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 labInfo;if(this.GetLabelCallback)labInfo=this.GetLabelCallback(this);//描述信息
5902
+ 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();//画水平线段
5903
+ 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);//描述信息
5900
5904
  if(labInfo)this.DrawLab(labInfo,drawPoint[0].Y);//画中心点
5901
- var xCenter=left+(right-left)/2;var point={X:xCenter,Y:drawPoint[0].Y};this.DrawPoint([point]);this.Canvas.restore();var rtDraw={};//显示价格
5902
- this.CalculateButtonSize();this.DrawValueText(drawPoint[0].Y,rtDraw,labInfo);if(labInfo)this.DrawRightLab(labInfo,rtDraw);//鼠标是否在按钮上
5905
+ var xCenter=left+(right-left)/2;var point={X:xCenter,Y:drawPoint[0].Y};this.DrawPoint([point]);this.Canvas.restore();//外部右侧显示价格
5906
+ if(this.ShowPriceTextConfig.IsShow[2]){var rtDraw={};this.CalculateButtonSize();this.DrawValueText(drawPoint[0].Y,rtDraw,labInfo);if(labInfo)this.DrawRightLab(labInfo,rtDraw);}//鼠标是否在按钮上
5903
5907
  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;//背景色
5904
5908
  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;var drawTop=rtLeftDraw.Bottom;var lineSpace=0;if(IFrameSplitOperator.IsNumber(labInfo.LineSpace))lineSpace=labInfo.LineSpace;//背景色
5905
- 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,rtLeftDraw.Right-1,yText+1);}yText+=labSize.LineHeight+lineSpace;}};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;rtBG.Bottom=rtBG.Top+rtBG.Height;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,rtBG.Left+2,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.CalculateButtonSize=function(){var pixelRatio=GetDevicePixelRatio();if(this.Button.SettingIcon){var icon=this.Button.SettingIcon;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;var width=this.Canvas.measureText(icon.Text).width;this.SettingButtonSize=width;}if(this.Button.CloseIcon){var icon=this.Button.CloseIcon;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;var width=this.Canvas.measureText(icon.Text).width;this.ColseButtonSize=width;}if(this.ColseButtonSize<=0&&this.SettingButtonSize<=0)return;var buttonWidth=0;if(this.SettingButtonSize>0)buttonWidth+=this.SettingButtonSize;if(this.ColseButtonSize>0){if(buttonWidth>0)buttonWidth+=this.ButtonSpace;buttonWidth+=this.ColseButtonSize;}buttonWidth+=4;this.ButtonBGWidth=buttonWidth;};this.DrawButton=function(drawTop,drawLeft,drawHeight,rtDraw){if(this.ColseButtonSize<=0&&this.SettingButtonSize<=0)return;if(this.ButtonPosition==1)drawTop-=drawHeight;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));left+=1;var pixelRatio=GetDevicePixelRatio();if(this.Button.SettingIcon){var rtButton={Left:left,Top:drawTop,Width:this.SettingButtonSize,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 icon=this.Button.SettingIcon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(this.Button.SettingIcon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING});/*
5909
+ 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,rtLeftDraw.Right-1,yText+1);}yText+=labSize.LineHeight+lineSpace;}};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;rtBG.Bottom=rtBG.Top+rtBG.Height;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,rtBG.Left+2,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(this.Button.SettingIcon){var icon=this.Button.SettingIcon;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;var width=this.Canvas.measureText(icon.Text).width;this.SettingButtonSize=width;}if(this.Button.CloseIcon){var icon=this.Button.CloseIcon;var font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.font=font;var width=this.Canvas.measureText(icon.Text).width;this.ColseButtonSize=width;}if(this.ColseButtonSize<=0&&this.SettingButtonSize<=0)return;var buttonWidth=0;if(this.SettingButtonSize>0)buttonWidth+=this.SettingButtonSize;if(this.ColseButtonSize>0){if(buttonWidth>0)buttonWidth+=this.ButtonSpace;buttonWidth+=this.ColseButtonSize;}buttonWidth+=4;this.ButtonBGWidth=buttonWidth;};this.DrawButton=function(drawTop,drawLeft,drawHeight,rtDraw){if(this.ColseButtonSize<=0&&this.SettingButtonSize<=0)return;if(this.ButtonPosition==1)drawTop-=drawHeight;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));left+=1;var pixelRatio=GetDevicePixelRatio();if(this.Button.SettingIcon&&this.Button.SettingIcon.Text){var rtButton={Left:left,Top:drawTop,Width:this.SettingButtonSize,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 icon=this.Button.SettingIcon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(this.Button.SettingIcon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_SETTING});/*
5906
5910
  if (this.ColseButtonSize>0)
5907
5911
  {
5908
5912
  var xLine=rtButton.Right+this.ButtonSpace/2;
@@ -5913,7 +5917,7 @@ if(labInfo.BGColor){this.Canvas.fillStyle=labInfo.BGColor;var rtTop=drawTop;this
5913
5917
  this.Canvas.lineTo(xLine,rtButton.Bottom);
5914
5918
  this.Canvas.stroke();
5915
5919
  }
5916
- */left=rtButton.Right+this.ButtonSpace;}if(this.Button.CloseIcon){var rtButton={Left:left,Top:drawTop,Width:this.ColseButtonSize,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 icon=this.Button.CloseIcon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(this.Button.CloseIcon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE});left=rtButton.Right;}rtDraw.Right=rtBG.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};}}return null;};}//趋势线
5920
+ */left=rtButton.Right+this.ButtonSpace;}if(this.Button.CloseIcon&&this.Button.CloseIcon.Text){var rtButton={Left:left,Top:drawTop,Width:this.ColseButtonSize,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 icon=this.Button.CloseIcon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText(this.Button.CloseIcon.Text,xCenter,yCenter);this.AryButton.push({Rect:rtButton,ID:JSCHART_BUTTON_ID.DRAW_PICTURE_DELETE});left=rtButton.Right;}rtDraw.Right=rtBG.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};}}return null;};}//趋势线
5917
5921
  function ChartDrawPictureTrendLine(){this.newMethod=IChartDrawPicture;//派生
5918
5922
  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);//画点
5919
5923
  this.Canvas.restore();};}//画图工具-矩形
@@ -6108,14 +6112,17 @@ this.Canvas.textBaseline='bottom';this.Canvas.textAlign='left';this.Canvas.font=
6108
6112
  {var index=startPoint.XValue-1;if(index>=0&&index<data.length)yClose=data[index].Close;}var result={YClose:yClose,Open:open,High:high,Low:low,Close:close,Count:count};if(IFrameSplitOperator.IsPlusNumber(yClose)){result.Increase=(close-yClose)/yClose*100;result.Risefall=close-yClose;}return result;};}//画图工具-标价线 支持横屏
6109
6113
  function ChartDrawPriceLine(){this.newMethod=IChartDrawPicture;//派生
6110
6114
  this.newMethod();delete this.newMethod;this.ClassName='ChartDrawPriceLine';this.Font=16*GetDevicePixelRatio()+"px 微软雅黑";this.PointCount=1;this.IsPointIn=this.IsPointIn_XYValue_Line;this.IsHScreen=false;this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint({IsCheckX:false,IsCheckY:true});if(!drawPoint)return;if(drawPoint.length!=1)return;this.IsHScreen=this.Frame.IsHScreen;var ptStart=drawPoint[0];var chartBorder=this.Frame.ChartBorder;if(this.IsHScreen){var left=chartBorder.GetLeftEx();var right=chartBorder.GetRightEx();if(ptStart.X<left||ptStart.X>right)return;var bottom=chartBorder.GetBottom();var ptEnd={X:ptStart.X,Y:bottom};var price=this.Frame.GetYData(ptStart.X,false);}else{var bottom=chartBorder.GetBottomEx();var top=chartBorder.GetTopEx();if(ptStart.Y<top||ptStart.Y>bottom)return;var right=chartBorder.GetRight();var ptEnd={X:right,Y:ptStart.Y};var price=this.Frame.GetYData(ptStart.Y,false);}this.ClipFrame();this.SetLineWidth();this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(ptStart.X,ptStart.Y);this.Canvas.lineTo(ptEnd.X,ptEnd.Y);this.Canvas.stroke();this.RestoreLineWidth();var line={Start:ptStart,End:ptEnd};this.LinePoint.push(line);this.DrawPoint(drawPoint);//画点
6111
- this.Canvas.textBaseline='bottom';this.Canvas.textAlign='left';this.Canvas.fillStyle=this.LineColor;this.Canvas.font=this.Font;var offset=2*GetDevicePixelRatio();var xText=ptStart.X;var yText=ptStart.Y;if(this.IsHScreen){this.Canvas.translate(xText+offset,yText+offset);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillText(price.toFixed(2),0,0);}else{this.Canvas.fillText(price.toFixed(2),xText+offset,yText-offset);}this.Canvas.restore();};}//画图工具-标价线2 支持横屏
6115
+ this.Canvas.textBaseline='bottom';this.Canvas.textAlign='left';this.Canvas.fillStyle=this.LineColor;this.Canvas.font=this.Font;var offset=2*GetDevicePixelRatio();var xText=ptStart.X;var yText=ptStart.Y;if(this.IsHScreen){this.Canvas.translate(xText+offset,yText+offset);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillText(price.toFixed(2),0,0);}else{this.Canvas.fillText(price.toFixed(2),xText+offset,yText-offset);}this.Canvas.restore();};}//画图工具-标价线2 支持横屏 支持价格文字在坐标内部显示
6112
6116
  function ChartDrawPriceLineV2(){this.newMethod=IChartDrawPicture;//派生
6113
6117
  this.newMethod();delete this.newMethod;this.ClassName='ChartDrawPriceLineV2';this.Font=12*GetDevicePixelRatio()+"px 微软雅黑";this.PointCount=1;this.IsPointIn=this.IsPointIn_XYValue_Line;this.IsHScreen=false;this.LineWidth=1;this.IsDrawFirst=true;this.TextColor="rgb(255,255,255)";this.Title;//标题
6118
+ this.TextPosition=[null,0];//[0]=左侧(没有做) [1]=右侧 0=自动 1=内部 2=外部
6114
6119
  this.Super_SetOption=this.SetOption;//父类函数
6115
- this.SetOption=function(option){if(this.Super_SetOption)this.Super_SetOption(option);if(option){if(option.TextColor)this.TextColor=option.TextColor;if(option.Title)this.Title=option.Title;}};this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint({IsCheckX:false,IsCheckY:true});if(!drawPoint)return;if(drawPoint.length!=1)return;if(!this.IsYValueInFrame(this.Value[0].YValue))return;this.IsHScreen=this.Frame.IsHScreen;var chartBorder=this.Frame.ChartBorder;var border=this.Frame.GetBorder();if(this.IsHScreen){var left=border.LeftEx;var right=border.RightEx;var bottom=border.Bottom;var top=border.Top;var ptStart={X:drawPoint[0].X,Y:top};if(ptStart.X<left||ptStart.X>right)return;var ptEnd={X:drawPoint[0].X,Y:bottom};var price=this.Frame.GetYData(ptStart.X,false);}else{var bottom=border.BottomEx;var top=border.TopTitle;var left=border.Left;var right=border.Right;var ptStart={X:left,Y:drawPoint[0].Y};if(ptStart.Y<top||ptStart.Y>bottom)return;var ptEnd={X:right,Y:drawPoint[0].Y};var price=this.Frame.GetYData(ptStart.Y,false);}//this.ClipFrame();
6116
- this.SetLineWidth();this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(ToFixedPoint(ptStart.X),ToFixedPoint(ptStart.Y));this.Canvas.lineTo(ToFixedPoint(ptEnd.X),ToFixedPoint(ptEnd.Y));this.Canvas.stroke();this.RestoreLineWidth();var line={Start:ptStart,End:ptEnd};this.LinePoint.push(line);var pixelTatio=GetDevicePixelRatio();this.Canvas.font=this.Font;var offset=2*pixelTatio;var xText=ptEnd.X;var yText=ptEnd.Y;this.Canvas.textBaseline='middle';this.Canvas.textAlign='left';var textHeight=this.GetFontHeight();var text=price.toFixed(2);var textWidth=this.Canvas.measureText(text).width+2*offset;if(this.IsHScreen){if(chartBorder.Bottom>10){var rtBG={Left:xText-textHeight/2,Top:yText,Width:textHeight,Height:textWidth};}else//框架内部显示
6117
- {yText=yText-textWidth;var rtBG={Left:xText-textHeight/2,Top:yText,Width:textHeight,Height:textWidth};}this.Canvas.fillStyle=this.LineColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.save();this.Canvas.translate(xText,yText+1*pixelTatio);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,0,0);this.Canvas.restore();if(this.Title){var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;if(chartBorder.Bottom>10){var rtTitle={Left:rtBG.Left,Top:bottom-textWidth-1*pixelTatio,Width:textHeight,Height:textWidth};}else{var rtTitle={Left:rtBG.Left,Top:rtBG.Top-textWidth-1*pixelTatio,Width:textHeight,Height:textWidth};}this.Canvas.fillStyle=this.LineColor;this.Canvas.fillRect(rtTitle.Left,rtTitle.Top,rtTitle.Width,rtTitle.Height);this.Canvas.save();this.Canvas.translate(xText,rtTitle.Top+1*pixelTatio);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(this.Title,0,0);this.Canvas.restore();}}else{if(chartBorder.Right>10){var rtBG={Left:xText,Top:yText-textHeight/2-1*pixelTatio,Width:textWidth,Height:textHeight};if(rtBG.Left+rtBG.Width>border.ChartWidth)rtBG.Left=border.ChartWidth-rtBG.Width-2*pixelTatio;}else//框架内部显示
6118
- {var rtBG={Left:xText-textWidth,Top:yText-textHeight/2-1*pixelTatio,Width:textWidth,Height:textHeight};}this.Canvas.fillStyle=this.LineColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+offset,yText);if(this.Title){var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;if(chartBorder.Right>10){var rtTitle={Left:right-textWidth-1*pixelTatio,Top:rtBG.Top,Width:textWidth,Height:textHeight};if(rtBG.Left!=right)rtTitle.Left=rtBG.Left-textWidth-1*pixelTatio;}else{var rtTitle={Left:rtBG.Left-textWidth,Top:rtBG.Top,Width:textWidth,Height:textHeight};}this.Canvas.fillStyle=this.LineColor;this.Canvas.fillRect(rtTitle.Left,rtTitle.Top,rtTitle.Width,rtTitle.Height);this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(this.Title,rtTitle.Left+1*pixelTatio,yText);}}};this.DrawPrice=function(){};}//画图工具-竖线 支持横屏
6120
+ this.SetOption=function(option){if(this.Super_SetOption)this.Super_SetOption(option);if(option){if(option.TextColor)this.TextColor=option.TextColor;if(option.Title)this.Title=option.Title;if(IFrameSplitOperator.IsNonEmptyArray(option.TextPosition))this.TextPosition=option.TextPosition.slice();}};this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;if(!this.IsShow)return;var drawPoint=this.CalculateDrawPoint({IsCheckX:false,IsCheckY:true});if(!drawPoint)return;if(drawPoint.length!=1)return;if(!this.IsYValueInFrame(this.Value[0].YValue))return;this.IsHScreen=this.Frame.IsHScreen;var chartBorder=this.Frame.ChartBorder;var border=this.Frame.GetBorder();if(this.IsHScreen){var left=border.LeftEx;var right=border.RightEx;var bottom=border.Bottom;var top=border.Top;var ptStart={X:drawPoint[0].X,Y:top};if(ptStart.X<left||ptStart.X>right)return;var ptEnd={X:drawPoint[0].X,Y:bottom};var price=this.Frame.GetYData(ptStart.X,false);}else{var bottom=border.BottomEx;var top=border.TopTitle;var left=border.Left;var right=border.Right;var ptStart={X:left,Y:drawPoint[0].Y};if(ptStart.Y<top||ptStart.Y>bottom)return;var ptEnd={X:right,Y:drawPoint[0].Y};var price=this.Frame.GetYData(ptStart.Y,false);}//this.ClipFrame();
6121
+ this.SetLineWidth();this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(ToFixedPoint(ptStart.X),ToFixedPoint(ptStart.Y));this.Canvas.lineTo(ToFixedPoint(ptEnd.X),ToFixedPoint(ptEnd.Y));this.Canvas.stroke();this.RestoreLineWidth();var line={Start:ptStart,End:ptEnd};this.LinePoint.push(line);var pixelTatio=GetDevicePixelRatio();this.Canvas.font=this.Font;var offset=2*pixelTatio;var xText=ptEnd.X;var yText=ptEnd.Y;this.Canvas.textBaseline='middle';this.Canvas.textAlign='left';var textHeight=this.GetFontHeight();var text=price.toFixed(2);var textWidth=this.Canvas.measureText(text).width+2*offset;if(this.IsHScreen){var position=this.TextPosition[1];var bDrawInside=false;//在内部绘制
6122
+ if(position==0)bDrawInside=chartBorder.Bottom<=10;else if(position==1)bDrawInside=true;else if(position==2)bDrawInside=false;if(bDrawInside){yText=yText-textWidth;var rtBG={Left:xText-textHeight/2,Top:yText,Width:textHeight,Height:textWidth};}else//框架内部显示
6123
+ {var rtBG={Left:xText-textHeight/2,Top:yText,Width:textHeight,Height:textWidth};}this.Canvas.fillStyle=this.LineColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.save();this.Canvas.translate(xText,yText+1*pixelTatio);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,0,0);this.Canvas.restore();if(this.Title){var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;if(bDrawInside){var rtTitle={Left:rtBG.Left,Top:rtBG.Top-textWidth-1*pixelTatio,Width:textHeight,Height:textWidth};}else{var rtTitle={Left:rtBG.Left,Top:bottom-textWidth-1*pixelTatio,Width:textHeight,Height:textWidth};}this.Canvas.fillStyle=this.LineColor;this.Canvas.fillRect(rtTitle.Left,rtTitle.Top,rtTitle.Width,rtTitle.Height);this.Canvas.save();this.Canvas.translate(xText,rtTitle.Top+1*pixelTatio);this.Canvas.rotate(90*Math.PI/180);this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(this.Title,0,0);this.Canvas.restore();}}else{var position=this.TextPosition[1];var bDrawInside=false;//在内部绘制
6124
+ if(position==0)bDrawInside=chartBorder.Right<=10;else if(position==1)bDrawInside=true;else if(position==2)bDrawInside=false;if(bDrawInside){var rtBG={Left:xText-textWidth,Top:yText-textHeight/2-1*pixelTatio,Width:textWidth,Height:textHeight};}else//框架内部显示
6125
+ {var rtBG={Left:xText,Top:yText-textHeight/2-1*pixelTatio,Width:textWidth,Height:textHeight};if(rtBG.Left+rtBG.Width>border.ChartWidth)rtBG.Left=border.ChartWidth-rtBG.Width-2*pixelTatio;}this.Canvas.fillStyle=this.LineColor;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,rtBG.Left+offset,yText);if(this.Title){var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;if(bDrawInside){var rtTitle={Left:rtBG.Left-textWidth,Top:rtBG.Top,Width:textWidth,Height:textHeight};}else{var rtTitle={Left:right-textWidth-1*pixelTatio,Top:rtBG.Top,Width:textWidth,Height:textHeight};if(rtBG.Left!=right)rtTitle.Left=rtBG.Left-textWidth-1*pixelTatio;}this.Canvas.fillStyle=this.LineColor;this.Canvas.fillRect(rtTitle.Left,rtTitle.Top,rtTitle.Width,rtTitle.Height);this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(this.Title,rtTitle.Left+1*pixelTatio,yText);}}};this.DrawPrice=function(){};}//画图工具-竖线 支持横屏
6119
6126
  function ChartDrawVerticalLine(){this.newMethod=IChartDrawPicture;//派生
6120
6127
  this.newMethod();delete this.newMethod;this.ClassName='ChartDrawVerticalLine';this.PointCount=1;this.IsPointIn=this.IsPointIn_XYValue_Line;this.IsHScreen=false;this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;if(!this.IsShow)return;if(!this.Frame||!this.Frame.Data)return;var data=this.Frame.Data;var drawPoint=this.CalculateDrawPoint({IsCheckX:true,IsCheckY:true});if(!drawPoint)return;if(drawPoint.length!=1)return;this.IsHScreen=this.Frame.IsHScreen;var pt=drawPoint[0];var chartBorder=this.Frame.ChartBorder;if(this.IsHScreen){var xValue=Math.round(this.Frame.GetXData(pt.Y,false))+data.DataOffset;if(xValue<0)xValue=0;else if(xValue>=data.Data.length)xValue=data.Data.length-1;var yLine=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);yLine=ToFixedPoint2(this.LineWidth,yLine);var left=chartBorder.GetLeftEx();var right=chartBorder.GetRightEx();var ptStart={X:left,Y:yLine};var ptEnd={X:right,Y:yLine};}else{var xValue=Math.round(this.Frame.GetXData(pt.X,false))+data.DataOffset;if(xValue<0)xValue=0;else if(xValue>=data.Data.length)xValue=data.Data.length-1;var xLine=this.Frame.GetXFromIndex(xValue-data.DataOffset,false);xLine=ToFixedPoint2(this.LineWidth,xLine);var top=chartBorder.GetTopEx();var bottom=chartBorder.GetBottomEx();var ptStart={X:xLine,Y:top};var ptEnd={X:xLine,Y:bottom};}this.ClipFrame();this.SetLineWidth();this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(ptStart.X,ptStart.Y);this.Canvas.lineTo(ptEnd.X,ptEnd.Y);this.Canvas.stroke();this.RestoreLineWidth();var line={Start:ptStart,End:ptEnd};this.LinePoint.push(line);if(this.Status==10)this.DrawPoint(drawPoint);//画点
6121
6128
  this.Canvas.restore();};}//画图工具-波浪尺
@@ -6356,7 +6363,7 @@ this.TitleFont=13*GetDevicePixelRatio()+'px 微软雅黑';//指标显示,tooltip
6356
6363
  this.IndexTitleBGColor='rgb(250,250,250)';//指标名字背景色
6357
6364
  this.IndexTitleBorderColor='rgb(180,180,180)';//指标名字边框颜色
6358
6365
  this.IndexTitleBorderMoveOnColor='rgb(0,0,0)';//指标名字边框颜色(鼠标在上面)
6359
- this.IndexTitleBorderStyle=1,//0=直角边框 1=圆角变量
6366
+ this.IndexTitleBorderStyle=1,//0=直角边框 1=圆角边框
6360
6367
  this.IndexTitleColor="rgb(43,54,69)";//指标名字颜色
6361
6368
  this.IndexTitleSelectedColor="rgb(65,105,225)";this.OverlayIndexTitleBGColor='rgba(255,255,255,0.7)';this.IndexTitleMerginLeft=1;//指标输出左边间距
6362
6369
  this.IndexTitle={UpDownArrow://数值涨跌箭头
@@ -13024,7 +13031,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
13024
13031
  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);};}/********************************************************************************
13025
13032
  * 版本信息输出
13026
13033
  *
13027
- */var HQCHART_VERSION="1.1.13104";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();//把给外界调用的方法暴露出来
13034
+ */var HQCHART_VERSION="1.1.13109";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();//把给外界调用的方法暴露出来
13028
13035
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
13029
13036
  // BaseIndex:BaseIndex,
13030
13037
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hqchart",
3
- "version": "1.1.13105",
3
+ "version": "1.1.13110",
4
4
  "description": "HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据对接",
5
5
  "main": "lib/main.js",
6
6
  "scripts": {
@@ -4398,6 +4398,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4398
4398
  drag.LastMove.Y=touches[0].clientY;
4399
4399
 
4400
4400
  this.MouseDrag=drag;
4401
+ var drawPictureActive=this.GetActiveDrawPicture(); //上一次选中的
4402
+ var selectedChart={ Chart:this.SelectedChart.Selected.Chart, Identify:this.SelectedChart.Selected.Identify }; //上一次选中的图形
4401
4403
  this.PhoneTouchInfo={ Start:{X:touches[0].clientX, Y:touches[0].clientY }, End:{ X:touches[0].clientX, Y:touches[0].clientY } };
4402
4404
  if (this.SelectChartDrawPicture) this.SelectChartDrawPicture.IsSelected=false;
4403
4405
  this.SelectChartDrawPicture=null;
@@ -4411,7 +4413,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4411
4413
  {
4412
4414
  this.SetChartDrawPictureFirstPoint(drag.Click.X,drag.Click.Y,true);
4413
4415
  //只有1个点 直接完成
4414
- if (this.FinishChartDrawPicturePoint()) this.DrawDynamicInfo({Corss:false, Tooltip:false});
4416
+ if (this.FinishChartDrawPicturePoint())
4417
+ {
4418
+ if (drawPicture.IsDrawMain) this.Draw();
4419
+ else this.DrawDynamicInfo( {Corss:false, Tooltip:false} );
4420
+ }
4415
4421
  }
4416
4422
 
4417
4423
  if (e.cancelable) e.preventDefault();
@@ -4437,6 +4443,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4437
4443
  event.Callback(event,sendData,this);
4438
4444
  }
4439
4445
 
4446
+ var drawType=0;
4447
+ if (drawPictrueData.ChartDrawPicture.IsDrawMain) drawType=1;
4448
+ else if (drawPictureActive.Select.Guid && drawPictureActive.Select.Chart && drawPictureActive.Select.Chart.IsDrawMain) drawType=1;
4449
+
4450
+ if (drawType==1) this.Draw();
4451
+
4440
4452
  if (e.cancelable) e.preventDefault();
4441
4453
  return;
4442
4454
  }
@@ -4493,6 +4505,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
4493
4505
  }
4494
4506
 
4495
4507
  this.TouchEvent({ EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH, FunctionName:"OnTouchStart"}, e);
4508
+
4509
+ var drawType=0;
4510
+ if (drawPictureActive.Select.Guid!=null)
4511
+ {
4512
+ if (drawPictureActive.Select.Guid && drawPictureActive.Select.Chart) drawType=1;
4513
+ }
4514
+
4515
+ if (drawType==1) this.Draw();
4496
4516
  }
4497
4517
  else if (this.IsPhonePinching(e))
4498
4518
  {
@@ -54997,6 +55017,15 @@ function ChartDrawHLine()
54997
55017
 
54998
55018
  this.AryButton=[];
54999
55019
  this.ExtendData; //扩展数据
55020
+ this.ShowPriceTextConfig=
55021
+ {
55022
+ IsShow:[false, false, true], //[0]=left内 [1]=right内 [2]=right外
55023
+ Font:
55024
+ [
55025
+ `${12*GetDevicePixelRatio()}px 微软雅黑`,
55026
+ `${12*GetDevicePixelRatio()}px 微软雅黑`,
55027
+ ],
55028
+ };
55000
55029
 
55001
55030
  //内部变量
55002
55031
  this.ColseButtonSize=0;
@@ -55028,6 +55057,15 @@ function ChartDrawHLine()
55028
55057
  if (item.SettingIcon) this.Button.SettingIcon=CloneData(item.SettingIcon);
55029
55058
  }
55030
55059
  if (option.ExtendData) this.ExtendData=option.ExtendData;
55060
+
55061
+ if (IFrameSplitOperator.IsNonEmptyArray(option.IsShowPriceText))
55062
+ {
55063
+ for(var i=0;i<option.IsShowPriceText.length && i<3;++i)
55064
+ {
55065
+ var value=option.IsShowPriceText[i]
55066
+ if (IFrameSplitOperator.IsBool(value)) this.ShowPriceTextConfig.IsShow[i]=value;
55067
+ }
55068
+ }
55031
55069
  }
55032
55070
  }
55033
55071
 
@@ -55116,6 +55154,7 @@ function ChartDrawHLine()
55116
55154
  this.Canvas.stroke();
55117
55155
  this.RestoreLineWidth();
55118
55156
 
55157
+ //画水平线段
55119
55158
  var line={Start:new Point(), End:new Point()};
55120
55159
  if (isHScreen)
55121
55160
  {
@@ -55133,6 +55172,18 @@ function ChartDrawHLine()
55133
55172
  }
55134
55173
  this.LinePoint.push(line);
55135
55174
 
55175
+ var yValue=this.Frame.GetYData(drawPoint[0].Y);
55176
+ var strPrice=yValue.toFixed(this.Precision);
55177
+ if (this.ShowPriceTextConfig.IsShow[0])
55178
+ {
55179
+ this.DrawPriceText(strPrice, line.Start, line.End, 0);
55180
+ }
55181
+
55182
+ if (this.ShowPriceTextConfig.IsShow[1])
55183
+ {
55184
+ this.DrawPriceText(strPrice, line.Start, line.End, 1);
55185
+ }
55186
+
55136
55187
  var labInfo;
55137
55188
  if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
55138
55189
 
@@ -55147,14 +55198,17 @@ function ChartDrawHLine()
55147
55198
 
55148
55199
  this.Canvas.restore();
55149
55200
 
55150
- var rtDraw={ };
55151
55201
 
55152
- //显示价格
55153
- this.CalculateButtonSize();
55154
- this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
55155
- if (labInfo)
55156
- this.DrawRightLab(labInfo, rtDraw);
55202
+ //外部右侧显示价格
55203
+ if (this.ShowPriceTextConfig.IsShow[2])
55204
+ {
55205
+ var rtDraw={ };
55206
+ this.CalculateButtonSize();
55207
+ this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
55208
+ if (labInfo) this.DrawRightLab(labInfo, rtDraw);
55209
+ }
55157
55210
 
55211
+
55158
55212
  //鼠标是否在按钮上
55159
55213
  if (moveonPoint && mouseStatus)
55160
55214
  {
@@ -55334,6 +55388,39 @@ function ChartDrawHLine()
55334
55388
  this.DrawButton(rtBG.Top, rtBG.Right, lineHeight, rtDraw);
55335
55389
  }
55336
55390
 
55391
+ this.DrawPriceText=function(text, ptStart, ptEnd, position)
55392
+ {
55393
+ if (position!=1 && position!=0) return;
55394
+
55395
+ var font=this.ShowPriceTextConfig.Font[position];
55396
+ this.Canvas.fillStyle=this.LineColor;
55397
+ this.Canvas.font=font;
55398
+ var textWidth=this.Canvas.measureText(text).width;
55399
+ var lineHeight=this.GetFontHeight();
55400
+
55401
+ var rtBG=null;
55402
+ if (position==1)
55403
+ {
55404
+ var rtBG={ Left:ptStart.X, Top:ptStart.Y-lineHeight/2, Width:textWidth+4, Height:lineHeight };
55405
+ rtBG.Right=rtBG.Left+rtBG.Width;
55406
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
55407
+ }
55408
+ else if (position==0)
55409
+ {
55410
+ var rtBG={ Right:ptEnd.X, Top:ptEnd.Y-lineHeight/2, Width:textWidth+4, Height:lineHeight };
55411
+ rtBG.Left=rtBG.Right-rtBG.Width;
55412
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
55413
+ }
55414
+
55415
+ this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top), ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));
55416
+
55417
+ this.Canvas.fillStyle=this.ValueTextColor
55418
+ this.Canvas.textAlign="left";
55419
+ this.Canvas.textBaseline="middle";
55420
+ this.Canvas.fillText(text,rtBG.Left+2,ptStart.Y);
55421
+
55422
+ }
55423
+
55337
55424
  this.CalculateButtonSize=function()
55338
55425
  {
55339
55426
  var pixelRatio=GetDevicePixelRatio();
@@ -55387,7 +55474,7 @@ function ChartDrawHLine()
55387
55474
 
55388
55475
  left+=1;
55389
55476
  var pixelRatio=GetDevicePixelRatio();
55390
- if (this.Button.SettingIcon)
55477
+ if (this.Button.SettingIcon && this.Button.SettingIcon.Text)
55391
55478
  {
55392
55479
  var rtButton={Left:left, Top:drawTop, Width:this.SettingButtonSize, Height:drawHeight };
55393
55480
  rtButton.Right=rtButton.Left+rtButton.Width;
@@ -55420,7 +55507,7 @@ function ChartDrawHLine()
55420
55507
  left=rtButton.Right+this.ButtonSpace;
55421
55508
  }
55422
55509
 
55423
- if (this.Button.CloseIcon)
55510
+ if (this.Button.CloseIcon && this.Button.CloseIcon.Text)
55424
55511
  {
55425
55512
  var rtButton={Left:left, Top:drawTop, Width:this.ColseButtonSize, Height:drawHeight };
55426
55513
  rtButton.Right=rtButton.Left+rtButton.Width;
@@ -58519,7 +58606,7 @@ function ChartDrawPriceLine()
58519
58606
  }
58520
58607
  }
58521
58608
 
58522
- //画图工具-标价线2 支持横屏
58609
+ //画图工具-标价线2 支持横屏 支持价格文字在坐标内部显示
58523
58610
  function ChartDrawPriceLineV2()
58524
58611
  {
58525
58612
  this.newMethod=IChartDrawPicture; //派生
@@ -58535,6 +58622,7 @@ function ChartDrawPriceLineV2()
58535
58622
  this.IsDrawFirst=true;
58536
58623
  this.TextColor="rgb(255,255,255)";
58537
58624
  this.Title; //标题
58625
+ this.TextPosition=[null, 0]; //[0]=左侧(没有做) [1]=右侧 0=自动 1=内部 2=外部
58538
58626
 
58539
58627
  this.Super_SetOption=this.SetOption; //父类函数
58540
58628
  this.SetOption=function(option)
@@ -58544,6 +58632,7 @@ function ChartDrawPriceLineV2()
58544
58632
  {
58545
58633
  if (option.TextColor) this.TextColor=option.TextColor;
58546
58634
  if (option.Title) this.Title=option.Title;
58635
+ if (IFrameSplitOperator.IsNonEmptyArray(option.TextPosition)) this.TextPosition=option.TextPosition.slice();
58547
58636
  }
58548
58637
  }
58549
58638
 
@@ -58615,14 +58704,20 @@ function ChartDrawPriceLineV2()
58615
58704
 
58616
58705
  if (this.IsHScreen)
58617
58706
  {
58618
- if (chartBorder.Bottom>10)
58707
+ var position=this.TextPosition[1];
58708
+ var bDrawInside=false; //在内部绘制
58709
+ if (position==0) bDrawInside=chartBorder.Bottom<=10;
58710
+ else if (position==1) bDrawInside=true;
58711
+ else if (position==2) bDrawInside=false;
58712
+
58713
+ if (bDrawInside)
58619
58714
  {
58620
- var rtBG={ Left:(xText-textHeight/2), Top:yText , Width: textHeight, Height:textWidth };
58715
+ yText=yText-textWidth;
58716
+ var rtBG={ Left:(xText-textHeight/2), Top:yText , Width:textHeight, Height: textWidth};
58621
58717
  }
58622
58718
  else //框架内部显示
58623
58719
  {
58624
- yText=yText-textWidth;
58625
- var rtBG={ Left:(xText-textHeight/2), Top:yText , Width:textHeight, Height: textWidth};
58720
+ var rtBG={ Left:(xText-textHeight/2), Top:yText , Width: textHeight, Height:textWidth };
58626
58721
  }
58627
58722
 
58628
58723
  this.Canvas.fillStyle=this.LineColor;
@@ -58638,13 +58733,13 @@ function ChartDrawPriceLineV2()
58638
58733
  if (this.Title)
58639
58734
  {
58640
58735
  var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;
58641
- if (chartBorder.Bottom>10)
58736
+ if (bDrawInside)
58642
58737
  {
58643
- var rtTitle={ Left:rtBG.Left, Top:bottom-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth };
58738
+ var rtTitle={Left:rtBG.Left, Top:rtBG.Top-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth};
58644
58739
  }
58645
58740
  else
58646
58741
  {
58647
- var rtTitle={Left:rtBG.Left, Top:rtBG.Top-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth}
58742
+ var rtTitle={ Left:rtBG.Left, Top:bottom-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth };
58648
58743
  }
58649
58744
 
58650
58745
  this.Canvas.fillStyle=this.LineColor;
@@ -58660,14 +58755,20 @@ function ChartDrawPriceLineV2()
58660
58755
  }
58661
58756
  else
58662
58757
  {
58663
- if (chartBorder.Right>10)
58758
+ var position=this.TextPosition[1];
58759
+ var bDrawInside=false; //在内部绘制
58760
+ if (position==0) bDrawInside=chartBorder.Right<=10;
58761
+ else if (position==1) bDrawInside=true;
58762
+ else if (position==2) bDrawInside=false;
58763
+
58764
+ if (bDrawInside)
58664
58765
  {
58665
- var rtBG={ Left:xText, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
58666
- if (rtBG.Left+rtBG.Width>border.ChartWidth) rtBG.Left=border.ChartWidth-rtBG.Width-2*pixelTatio;
58766
+ var rtBG={ Left:xText-textWidth, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
58667
58767
  }
58668
58768
  else //框架内部显示
58669
58769
  {
58670
- var rtBG={ Left:xText-textWidth, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
58770
+ var rtBG={ Left:xText, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
58771
+ if (rtBG.Left+rtBG.Width>border.ChartWidth) rtBG.Left=border.ChartWidth-rtBG.Width-2*pixelTatio;
58671
58772
  }
58672
58773
 
58673
58774
  this.Canvas.fillStyle=this.LineColor;
@@ -58679,14 +58780,14 @@ function ChartDrawPriceLineV2()
58679
58780
  if (this.Title)
58680
58781
  {
58681
58782
  var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;
58682
- if (chartBorder.Right>10)
58783
+ if (bDrawInside)
58683
58784
  {
58684
- var rtTitle={ Left:right-textWidth-1*pixelTatio, Top:rtBG.Top, Width:textWidth, Height:textHeight };
58685
- if (rtBG.Left!=right) rtTitle.Left=rtBG.Left-textWidth-1*pixelTatio;
58785
+ var rtTitle={Left:rtBG.Left-textWidth, Top:rtBG.Top, Width:textWidth, Height:textHeight}
58686
58786
  }
58687
58787
  else
58688
58788
  {
58689
- var rtTitle={Left:rtBG.Left-textWidth, Top:rtBG.Top, Width:textWidth, Height:textHeight}
58789
+ var rtTitle={ Left:right-textWidth-1*pixelTatio, Top:rtBG.Top, Width:textWidth, Height:textHeight };
58790
+ if (rtBG.Left!=right) rtTitle.Left=rtBG.Left-textWidth-1*pixelTatio;
58690
58791
  }
58691
58792
 
58692
58793
  this.Canvas.fillStyle=this.LineColor;
@@ -63025,7 +63126,7 @@ function JSChartResource()
63025
63126
  this.IndexTitleBGColor='rgb(250,250,250)'; //指标名字背景色
63026
63127
  this.IndexTitleBorderColor='rgb(180,180,180)'; //指标名字边框颜色
63027
63128
  this.IndexTitleBorderMoveOnColor='rgb(0,0,0)'; //指标名字边框颜色(鼠标在上面)
63028
- this.IndexTitleBorderStyle=1, //0=直角边框 1=圆角变量
63129
+ this.IndexTitleBorderStyle=1, //0=直角边框 1=圆角边框
63029
63130
  this.IndexTitleColor="rgb(43,54,69)"; //指标名字颜色
63030
63131
  this.IndexTitleSelectedColor="rgb(65,105,225)";
63031
63132
  this.OverlayIndexTitleBGColor='rgba(255,255,255,0.7)';
@@ -8290,6 +8290,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8290
8290
  drag.LastMove.Y=touches[0].clientY;
8291
8291
 
8292
8292
  this.MouseDrag=drag;
8293
+ var drawPictureActive=this.GetActiveDrawPicture(); //上一次选中的
8294
+ var selectedChart={ Chart:this.SelectedChart.Selected.Chart, Identify:this.SelectedChart.Selected.Identify }; //上一次选中的图形
8293
8295
  this.PhoneTouchInfo={ Start:{X:touches[0].clientX, Y:touches[0].clientY }, End:{ X:touches[0].clientX, Y:touches[0].clientY } };
8294
8296
  if (this.SelectChartDrawPicture) this.SelectChartDrawPicture.IsSelected=false;
8295
8297
  this.SelectChartDrawPicture=null;
@@ -8303,7 +8305,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8303
8305
  {
8304
8306
  this.SetChartDrawPictureFirstPoint(drag.Click.X,drag.Click.Y,true);
8305
8307
  //只有1个点 直接完成
8306
- if (this.FinishChartDrawPicturePoint()) this.DrawDynamicInfo({Corss:false, Tooltip:false});
8308
+ if (this.FinishChartDrawPicturePoint())
8309
+ {
8310
+ if (drawPicture.IsDrawMain) this.Draw();
8311
+ else this.DrawDynamicInfo( {Corss:false, Tooltip:false} );
8312
+ }
8307
8313
  }
8308
8314
 
8309
8315
  if (e.cancelable) e.preventDefault();
@@ -8329,6 +8335,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8329
8335
  event.Callback(event,sendData,this);
8330
8336
  }
8331
8337
 
8338
+ var drawType=0;
8339
+ if (drawPictrueData.ChartDrawPicture.IsDrawMain) drawType=1;
8340
+ else if (drawPictureActive.Select.Guid && drawPictureActive.Select.Chart && drawPictureActive.Select.Chart.IsDrawMain) drawType=1;
8341
+
8342
+ if (drawType==1) this.Draw();
8343
+
8332
8344
  if (e.cancelable) e.preventDefault();
8333
8345
  return;
8334
8346
  }
@@ -8385,6 +8397,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8385
8397
  }
8386
8398
 
8387
8399
  this.TouchEvent({ EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH, FunctionName:"OnTouchStart"}, e);
8400
+
8401
+ var drawType=0;
8402
+ if (drawPictureActive.Select.Guid!=null)
8403
+ {
8404
+ if (drawPictureActive.Select.Guid && drawPictureActive.Select.Chart) drawType=1;
8405
+ }
8406
+
8407
+ if (drawType==1) this.Draw();
8388
8408
  }
8389
8409
  else if (this.IsPhonePinching(e))
8390
8410
  {
@@ -58889,6 +58909,15 @@ function ChartDrawHLine()
58889
58909
 
58890
58910
  this.AryButton=[];
58891
58911
  this.ExtendData; //扩展数据
58912
+ this.ShowPriceTextConfig=
58913
+ {
58914
+ IsShow:[false, false, true], //[0]=left内 [1]=right内 [2]=right外
58915
+ Font:
58916
+ [
58917
+ `${12*GetDevicePixelRatio()}px 微软雅黑`,
58918
+ `${12*GetDevicePixelRatio()}px 微软雅黑`,
58919
+ ],
58920
+ };
58892
58921
 
58893
58922
  //内部变量
58894
58923
  this.ColseButtonSize=0;
@@ -58920,6 +58949,15 @@ function ChartDrawHLine()
58920
58949
  if (item.SettingIcon) this.Button.SettingIcon=CloneData(item.SettingIcon);
58921
58950
  }
58922
58951
  if (option.ExtendData) this.ExtendData=option.ExtendData;
58952
+
58953
+ if (IFrameSplitOperator.IsNonEmptyArray(option.IsShowPriceText))
58954
+ {
58955
+ for(var i=0;i<option.IsShowPriceText.length && i<3;++i)
58956
+ {
58957
+ var value=option.IsShowPriceText[i]
58958
+ if (IFrameSplitOperator.IsBool(value)) this.ShowPriceTextConfig.IsShow[i]=value;
58959
+ }
58960
+ }
58923
58961
  }
58924
58962
  }
58925
58963
 
@@ -59008,6 +59046,7 @@ function ChartDrawHLine()
59008
59046
  this.Canvas.stroke();
59009
59047
  this.RestoreLineWidth();
59010
59048
 
59049
+ //画水平线段
59011
59050
  var line={Start:new Point(), End:new Point()};
59012
59051
  if (isHScreen)
59013
59052
  {
@@ -59025,6 +59064,18 @@ function ChartDrawHLine()
59025
59064
  }
59026
59065
  this.LinePoint.push(line);
59027
59066
 
59067
+ var yValue=this.Frame.GetYData(drawPoint[0].Y);
59068
+ var strPrice=yValue.toFixed(this.Precision);
59069
+ if (this.ShowPriceTextConfig.IsShow[0])
59070
+ {
59071
+ this.DrawPriceText(strPrice, line.Start, line.End, 0);
59072
+ }
59073
+
59074
+ if (this.ShowPriceTextConfig.IsShow[1])
59075
+ {
59076
+ this.DrawPriceText(strPrice, line.Start, line.End, 1);
59077
+ }
59078
+
59028
59079
  var labInfo;
59029
59080
  if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
59030
59081
 
@@ -59039,14 +59090,17 @@ function ChartDrawHLine()
59039
59090
 
59040
59091
  this.Canvas.restore();
59041
59092
 
59042
- var rtDraw={ };
59043
59093
 
59044
- //显示价格
59045
- this.CalculateButtonSize();
59046
- this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
59047
- if (labInfo)
59048
- this.DrawRightLab(labInfo, rtDraw);
59094
+ //外部右侧显示价格
59095
+ if (this.ShowPriceTextConfig.IsShow[2])
59096
+ {
59097
+ var rtDraw={ };
59098
+ this.CalculateButtonSize();
59099
+ this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
59100
+ if (labInfo) this.DrawRightLab(labInfo, rtDraw);
59101
+ }
59049
59102
 
59103
+
59050
59104
  //鼠标是否在按钮上
59051
59105
  if (moveonPoint && mouseStatus)
59052
59106
  {
@@ -59226,6 +59280,39 @@ function ChartDrawHLine()
59226
59280
  this.DrawButton(rtBG.Top, rtBG.Right, lineHeight, rtDraw);
59227
59281
  }
59228
59282
 
59283
+ this.DrawPriceText=function(text, ptStart, ptEnd, position)
59284
+ {
59285
+ if (position!=1 && position!=0) return;
59286
+
59287
+ var font=this.ShowPriceTextConfig.Font[position];
59288
+ this.Canvas.fillStyle=this.LineColor;
59289
+ this.Canvas.font=font;
59290
+ var textWidth=this.Canvas.measureText(text).width;
59291
+ var lineHeight=this.GetFontHeight();
59292
+
59293
+ var rtBG=null;
59294
+ if (position==1)
59295
+ {
59296
+ var rtBG={ Left:ptStart.X, Top:ptStart.Y-lineHeight/2, Width:textWidth+4, Height:lineHeight };
59297
+ rtBG.Right=rtBG.Left+rtBG.Width;
59298
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59299
+ }
59300
+ else if (position==0)
59301
+ {
59302
+ var rtBG={ Right:ptEnd.X, Top:ptEnd.Y-lineHeight/2, Width:textWidth+4, Height:lineHeight };
59303
+ rtBG.Left=rtBG.Right-rtBG.Width;
59304
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59305
+ }
59306
+
59307
+ this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top), ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));
59308
+
59309
+ this.Canvas.fillStyle=this.ValueTextColor
59310
+ this.Canvas.textAlign="left";
59311
+ this.Canvas.textBaseline="middle";
59312
+ this.Canvas.fillText(text,rtBG.Left+2,ptStart.Y);
59313
+
59314
+ }
59315
+
59229
59316
  this.CalculateButtonSize=function()
59230
59317
  {
59231
59318
  var pixelRatio=GetDevicePixelRatio();
@@ -59279,7 +59366,7 @@ function ChartDrawHLine()
59279
59366
 
59280
59367
  left+=1;
59281
59368
  var pixelRatio=GetDevicePixelRatio();
59282
- if (this.Button.SettingIcon)
59369
+ if (this.Button.SettingIcon && this.Button.SettingIcon.Text)
59283
59370
  {
59284
59371
  var rtButton={Left:left, Top:drawTop, Width:this.SettingButtonSize, Height:drawHeight };
59285
59372
  rtButton.Right=rtButton.Left+rtButton.Width;
@@ -59312,7 +59399,7 @@ function ChartDrawHLine()
59312
59399
  left=rtButton.Right+this.ButtonSpace;
59313
59400
  }
59314
59401
 
59315
- if (this.Button.CloseIcon)
59402
+ if (this.Button.CloseIcon && this.Button.CloseIcon.Text)
59316
59403
  {
59317
59404
  var rtButton={Left:left, Top:drawTop, Width:this.ColseButtonSize, Height:drawHeight };
59318
59405
  rtButton.Right=rtButton.Left+rtButton.Width;
@@ -62411,7 +62498,7 @@ function ChartDrawPriceLine()
62411
62498
  }
62412
62499
  }
62413
62500
 
62414
- //画图工具-标价线2 支持横屏
62501
+ //画图工具-标价线2 支持横屏 支持价格文字在坐标内部显示
62415
62502
  function ChartDrawPriceLineV2()
62416
62503
  {
62417
62504
  this.newMethod=IChartDrawPicture; //派生
@@ -62427,6 +62514,7 @@ function ChartDrawPriceLineV2()
62427
62514
  this.IsDrawFirst=true;
62428
62515
  this.TextColor="rgb(255,255,255)";
62429
62516
  this.Title; //标题
62517
+ this.TextPosition=[null, 0]; //[0]=左侧(没有做) [1]=右侧 0=自动 1=内部 2=外部
62430
62518
 
62431
62519
  this.Super_SetOption=this.SetOption; //父类函数
62432
62520
  this.SetOption=function(option)
@@ -62436,6 +62524,7 @@ function ChartDrawPriceLineV2()
62436
62524
  {
62437
62525
  if (option.TextColor) this.TextColor=option.TextColor;
62438
62526
  if (option.Title) this.Title=option.Title;
62527
+ if (IFrameSplitOperator.IsNonEmptyArray(option.TextPosition)) this.TextPosition=option.TextPosition.slice();
62439
62528
  }
62440
62529
  }
62441
62530
 
@@ -62507,14 +62596,20 @@ function ChartDrawPriceLineV2()
62507
62596
 
62508
62597
  if (this.IsHScreen)
62509
62598
  {
62510
- if (chartBorder.Bottom>10)
62599
+ var position=this.TextPosition[1];
62600
+ var bDrawInside=false; //在内部绘制
62601
+ if (position==0) bDrawInside=chartBorder.Bottom<=10;
62602
+ else if (position==1) bDrawInside=true;
62603
+ else if (position==2) bDrawInside=false;
62604
+
62605
+ if (bDrawInside)
62511
62606
  {
62512
- var rtBG={ Left:(xText-textHeight/2), Top:yText , Width: textHeight, Height:textWidth };
62607
+ yText=yText-textWidth;
62608
+ var rtBG={ Left:(xText-textHeight/2), Top:yText , Width:textHeight, Height: textWidth};
62513
62609
  }
62514
62610
  else //框架内部显示
62515
62611
  {
62516
- yText=yText-textWidth;
62517
- var rtBG={ Left:(xText-textHeight/2), Top:yText , Width:textHeight, Height: textWidth};
62612
+ var rtBG={ Left:(xText-textHeight/2), Top:yText , Width: textHeight, Height:textWidth };
62518
62613
  }
62519
62614
 
62520
62615
  this.Canvas.fillStyle=this.LineColor;
@@ -62530,13 +62625,13 @@ function ChartDrawPriceLineV2()
62530
62625
  if (this.Title)
62531
62626
  {
62532
62627
  var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;
62533
- if (chartBorder.Bottom>10)
62628
+ if (bDrawInside)
62534
62629
  {
62535
- var rtTitle={ Left:rtBG.Left, Top:bottom-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth };
62630
+ var rtTitle={Left:rtBG.Left, Top:rtBG.Top-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth};
62536
62631
  }
62537
62632
  else
62538
62633
  {
62539
- var rtTitle={Left:rtBG.Left, Top:rtBG.Top-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth}
62634
+ var rtTitle={ Left:rtBG.Left, Top:bottom-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth };
62540
62635
  }
62541
62636
 
62542
62637
  this.Canvas.fillStyle=this.LineColor;
@@ -62552,14 +62647,20 @@ function ChartDrawPriceLineV2()
62552
62647
  }
62553
62648
  else
62554
62649
  {
62555
- if (chartBorder.Right>10)
62650
+ var position=this.TextPosition[1];
62651
+ var bDrawInside=false; //在内部绘制
62652
+ if (position==0) bDrawInside=chartBorder.Right<=10;
62653
+ else if (position==1) bDrawInside=true;
62654
+ else if (position==2) bDrawInside=false;
62655
+
62656
+ if (bDrawInside)
62556
62657
  {
62557
- var rtBG={ Left:xText, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
62558
- if (rtBG.Left+rtBG.Width>border.ChartWidth) rtBG.Left=border.ChartWidth-rtBG.Width-2*pixelTatio;
62658
+ var rtBG={ Left:xText-textWidth, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
62559
62659
  }
62560
62660
  else //框架内部显示
62561
62661
  {
62562
- var rtBG={ Left:xText-textWidth, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
62662
+ var rtBG={ Left:xText, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
62663
+ if (rtBG.Left+rtBG.Width>border.ChartWidth) rtBG.Left=border.ChartWidth-rtBG.Width-2*pixelTatio;
62563
62664
  }
62564
62665
 
62565
62666
  this.Canvas.fillStyle=this.LineColor;
@@ -62571,14 +62672,14 @@ function ChartDrawPriceLineV2()
62571
62672
  if (this.Title)
62572
62673
  {
62573
62674
  var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;
62574
- if (chartBorder.Right>10)
62675
+ if (bDrawInside)
62575
62676
  {
62576
- var rtTitle={ Left:right-textWidth-1*pixelTatio, Top:rtBG.Top, Width:textWidth, Height:textHeight };
62577
- if (rtBG.Left!=right) rtTitle.Left=rtBG.Left-textWidth-1*pixelTatio;
62677
+ var rtTitle={Left:rtBG.Left-textWidth, Top:rtBG.Top, Width:textWidth, Height:textHeight}
62578
62678
  }
62579
62679
  else
62580
62680
  {
62581
- var rtTitle={Left:rtBG.Left-textWidth, Top:rtBG.Top, Width:textWidth, Height:textHeight}
62681
+ var rtTitle={ Left:right-textWidth-1*pixelTatio, Top:rtBG.Top, Width:textWidth, Height:textHeight };
62682
+ if (rtBG.Left!=right) rtTitle.Left=rtBG.Left-textWidth-1*pixelTatio;
62582
62683
  }
62583
62684
 
62584
62685
  this.Canvas.fillStyle=this.LineColor;
@@ -66917,7 +67018,7 @@ function JSChartResource()
66917
67018
  this.IndexTitleBGColor='rgb(250,250,250)'; //指标名字背景色
66918
67019
  this.IndexTitleBorderColor='rgb(180,180,180)'; //指标名字边框颜色
66919
67020
  this.IndexTitleBorderMoveOnColor='rgb(0,0,0)'; //指标名字边框颜色(鼠标在上面)
66920
- this.IndexTitleBorderStyle=1, //0=直角边框 1=圆角变量
67021
+ this.IndexTitleBorderStyle=1, //0=直角边框 1=圆角边框
66921
67022
  this.IndexTitleColor="rgb(43,54,69)"; //指标名字颜色
66922
67023
  this.IndexTitleSelectedColor="rgb(65,105,225)";
66923
67024
  this.OverlayIndexTitleBGColor='rgba(255,255,255,0.7)';
@@ -131352,7 +131453,7 @@ function ScrollBarBGChart()
131352
131453
 
131353
131454
 
131354
131455
 
131355
- var HQCHART_VERSION="1.1.13104";
131456
+ var HQCHART_VERSION="1.1.13109";
131356
131457
 
131357
131458
  function PrintHQChartVersion()
131358
131459
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.13104";
8
+ var HQCHART_VERSION="1.1.13109";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -8334,6 +8334,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8334
8334
  drag.LastMove.Y=touches[0].clientY;
8335
8335
 
8336
8336
  this.MouseDrag=drag;
8337
+ var drawPictureActive=this.GetActiveDrawPicture(); //上一次选中的
8338
+ var selectedChart={ Chart:this.SelectedChart.Selected.Chart, Identify:this.SelectedChart.Selected.Identify }; //上一次选中的图形
8337
8339
  this.PhoneTouchInfo={ Start:{X:touches[0].clientX, Y:touches[0].clientY }, End:{ X:touches[0].clientX, Y:touches[0].clientY } };
8338
8340
  if (this.SelectChartDrawPicture) this.SelectChartDrawPicture.IsSelected=false;
8339
8341
  this.SelectChartDrawPicture=null;
@@ -8347,7 +8349,11 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8347
8349
  {
8348
8350
  this.SetChartDrawPictureFirstPoint(drag.Click.X,drag.Click.Y,true);
8349
8351
  //只有1个点 直接完成
8350
- if (this.FinishChartDrawPicturePoint()) this.DrawDynamicInfo({Corss:false, Tooltip:false});
8352
+ if (this.FinishChartDrawPicturePoint())
8353
+ {
8354
+ if (drawPicture.IsDrawMain) this.Draw();
8355
+ else this.DrawDynamicInfo( {Corss:false, Tooltip:false} );
8356
+ }
8351
8357
  }
8352
8358
 
8353
8359
  if (e.cancelable) e.preventDefault();
@@ -8373,6 +8379,12 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8373
8379
  event.Callback(event,sendData,this);
8374
8380
  }
8375
8381
 
8382
+ var drawType=0;
8383
+ if (drawPictrueData.ChartDrawPicture.IsDrawMain) drawType=1;
8384
+ else if (drawPictureActive.Select.Guid && drawPictureActive.Select.Chart && drawPictureActive.Select.Chart.IsDrawMain) drawType=1;
8385
+
8386
+ if (drawType==1) this.Draw();
8387
+
8376
8388
  if (e.cancelable) e.preventDefault();
8377
8389
  return;
8378
8390
  }
@@ -8429,6 +8441,14 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8429
8441
  }
8430
8442
 
8431
8443
  this.TouchEvent({ EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH, FunctionName:"OnTouchStart"}, e);
8444
+
8445
+ var drawType=0;
8446
+ if (drawPictureActive.Select.Guid!=null)
8447
+ {
8448
+ if (drawPictureActive.Select.Guid && drawPictureActive.Select.Chart) drawType=1;
8449
+ }
8450
+
8451
+ if (drawType==1) this.Draw();
8432
8452
  }
8433
8453
  else if (this.IsPhonePinching(e))
8434
8454
  {
@@ -58933,6 +58953,15 @@ function ChartDrawHLine()
58933
58953
 
58934
58954
  this.AryButton=[];
58935
58955
  this.ExtendData; //扩展数据
58956
+ this.ShowPriceTextConfig=
58957
+ {
58958
+ IsShow:[false, false, true], //[0]=left内 [1]=right内 [2]=right外
58959
+ Font:
58960
+ [
58961
+ `${12*GetDevicePixelRatio()}px 微软雅黑`,
58962
+ `${12*GetDevicePixelRatio()}px 微软雅黑`,
58963
+ ],
58964
+ };
58936
58965
 
58937
58966
  //内部变量
58938
58967
  this.ColseButtonSize=0;
@@ -58964,6 +58993,15 @@ function ChartDrawHLine()
58964
58993
  if (item.SettingIcon) this.Button.SettingIcon=CloneData(item.SettingIcon);
58965
58994
  }
58966
58995
  if (option.ExtendData) this.ExtendData=option.ExtendData;
58996
+
58997
+ if (IFrameSplitOperator.IsNonEmptyArray(option.IsShowPriceText))
58998
+ {
58999
+ for(var i=0;i<option.IsShowPriceText.length && i<3;++i)
59000
+ {
59001
+ var value=option.IsShowPriceText[i]
59002
+ if (IFrameSplitOperator.IsBool(value)) this.ShowPriceTextConfig.IsShow[i]=value;
59003
+ }
59004
+ }
58967
59005
  }
58968
59006
  }
58969
59007
 
@@ -59052,6 +59090,7 @@ function ChartDrawHLine()
59052
59090
  this.Canvas.stroke();
59053
59091
  this.RestoreLineWidth();
59054
59092
 
59093
+ //画水平线段
59055
59094
  var line={Start:new Point(), End:new Point()};
59056
59095
  if (isHScreen)
59057
59096
  {
@@ -59069,6 +59108,18 @@ function ChartDrawHLine()
59069
59108
  }
59070
59109
  this.LinePoint.push(line);
59071
59110
 
59111
+ var yValue=this.Frame.GetYData(drawPoint[0].Y);
59112
+ var strPrice=yValue.toFixed(this.Precision);
59113
+ if (this.ShowPriceTextConfig.IsShow[0])
59114
+ {
59115
+ this.DrawPriceText(strPrice, line.Start, line.End, 0);
59116
+ }
59117
+
59118
+ if (this.ShowPriceTextConfig.IsShow[1])
59119
+ {
59120
+ this.DrawPriceText(strPrice, line.Start, line.End, 1);
59121
+ }
59122
+
59072
59123
  var labInfo;
59073
59124
  if (this.GetLabelCallback) labInfo=this.GetLabelCallback(this);
59074
59125
 
@@ -59083,14 +59134,17 @@ function ChartDrawHLine()
59083
59134
 
59084
59135
  this.Canvas.restore();
59085
59136
 
59086
- var rtDraw={ };
59087
59137
 
59088
- //显示价格
59089
- this.CalculateButtonSize();
59090
- this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
59091
- if (labInfo)
59092
- this.DrawRightLab(labInfo, rtDraw);
59138
+ //外部右侧显示价格
59139
+ if (this.ShowPriceTextConfig.IsShow[2])
59140
+ {
59141
+ var rtDraw={ };
59142
+ this.CalculateButtonSize();
59143
+ this.DrawValueText(drawPoint[0].Y, rtDraw, labInfo);
59144
+ if (labInfo) this.DrawRightLab(labInfo, rtDraw);
59145
+ }
59093
59146
 
59147
+
59094
59148
  //鼠标是否在按钮上
59095
59149
  if (moveonPoint && mouseStatus)
59096
59150
  {
@@ -59270,6 +59324,39 @@ function ChartDrawHLine()
59270
59324
  this.DrawButton(rtBG.Top, rtBG.Right, lineHeight, rtDraw);
59271
59325
  }
59272
59326
 
59327
+ this.DrawPriceText=function(text, ptStart, ptEnd, position)
59328
+ {
59329
+ if (position!=1 && position!=0) return;
59330
+
59331
+ var font=this.ShowPriceTextConfig.Font[position];
59332
+ this.Canvas.fillStyle=this.LineColor;
59333
+ this.Canvas.font=font;
59334
+ var textWidth=this.Canvas.measureText(text).width;
59335
+ var lineHeight=this.GetFontHeight();
59336
+
59337
+ var rtBG=null;
59338
+ if (position==1)
59339
+ {
59340
+ var rtBG={ Left:ptStart.X, Top:ptStart.Y-lineHeight/2, Width:textWidth+4, Height:lineHeight };
59341
+ rtBG.Right=rtBG.Left+rtBG.Width;
59342
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59343
+ }
59344
+ else if (position==0)
59345
+ {
59346
+ var rtBG={ Right:ptEnd.X, Top:ptEnd.Y-lineHeight/2, Width:textWidth+4, Height:lineHeight };
59347
+ rtBG.Left=rtBG.Right-rtBG.Width;
59348
+ rtBG.Bottom=rtBG.Top+rtBG.Height;
59349
+ }
59350
+
59351
+ this.Canvas.fillRect(ToFixedRect(rtBG.Left),ToFixedRect(rtBG.Top), ToFixedRect(rtBG.Width+this.ButtonBGWidth),ToFixedRect(rtBG.Height));
59352
+
59353
+ this.Canvas.fillStyle=this.ValueTextColor
59354
+ this.Canvas.textAlign="left";
59355
+ this.Canvas.textBaseline="middle";
59356
+ this.Canvas.fillText(text,rtBG.Left+2,ptStart.Y);
59357
+
59358
+ }
59359
+
59273
59360
  this.CalculateButtonSize=function()
59274
59361
  {
59275
59362
  var pixelRatio=GetDevicePixelRatio();
@@ -59323,7 +59410,7 @@ function ChartDrawHLine()
59323
59410
 
59324
59411
  left+=1;
59325
59412
  var pixelRatio=GetDevicePixelRatio();
59326
- if (this.Button.SettingIcon)
59413
+ if (this.Button.SettingIcon && this.Button.SettingIcon.Text)
59327
59414
  {
59328
59415
  var rtButton={Left:left, Top:drawTop, Width:this.SettingButtonSize, Height:drawHeight };
59329
59416
  rtButton.Right=rtButton.Left+rtButton.Width;
@@ -59356,7 +59443,7 @@ function ChartDrawHLine()
59356
59443
  left=rtButton.Right+this.ButtonSpace;
59357
59444
  }
59358
59445
 
59359
- if (this.Button.CloseIcon)
59446
+ if (this.Button.CloseIcon && this.Button.CloseIcon.Text)
59360
59447
  {
59361
59448
  var rtButton={Left:left, Top:drawTop, Width:this.ColseButtonSize, Height:drawHeight };
59362
59449
  rtButton.Right=rtButton.Left+rtButton.Width;
@@ -62455,7 +62542,7 @@ function ChartDrawPriceLine()
62455
62542
  }
62456
62543
  }
62457
62544
 
62458
- //画图工具-标价线2 支持横屏
62545
+ //画图工具-标价线2 支持横屏 支持价格文字在坐标内部显示
62459
62546
  function ChartDrawPriceLineV2()
62460
62547
  {
62461
62548
  this.newMethod=IChartDrawPicture; //派生
@@ -62471,6 +62558,7 @@ function ChartDrawPriceLineV2()
62471
62558
  this.IsDrawFirst=true;
62472
62559
  this.TextColor="rgb(255,255,255)";
62473
62560
  this.Title; //标题
62561
+ this.TextPosition=[null, 0]; //[0]=左侧(没有做) [1]=右侧 0=自动 1=内部 2=外部
62474
62562
 
62475
62563
  this.Super_SetOption=this.SetOption; //父类函数
62476
62564
  this.SetOption=function(option)
@@ -62480,6 +62568,7 @@ function ChartDrawPriceLineV2()
62480
62568
  {
62481
62569
  if (option.TextColor) this.TextColor=option.TextColor;
62482
62570
  if (option.Title) this.Title=option.Title;
62571
+ if (IFrameSplitOperator.IsNonEmptyArray(option.TextPosition)) this.TextPosition=option.TextPosition.slice();
62483
62572
  }
62484
62573
  }
62485
62574
 
@@ -62551,14 +62640,20 @@ function ChartDrawPriceLineV2()
62551
62640
 
62552
62641
  if (this.IsHScreen)
62553
62642
  {
62554
- if (chartBorder.Bottom>10)
62643
+ var position=this.TextPosition[1];
62644
+ var bDrawInside=false; //在内部绘制
62645
+ if (position==0) bDrawInside=chartBorder.Bottom<=10;
62646
+ else if (position==1) bDrawInside=true;
62647
+ else if (position==2) bDrawInside=false;
62648
+
62649
+ if (bDrawInside)
62555
62650
  {
62556
- var rtBG={ Left:(xText-textHeight/2), Top:yText , Width: textHeight, Height:textWidth };
62651
+ yText=yText-textWidth;
62652
+ var rtBG={ Left:(xText-textHeight/2), Top:yText , Width:textHeight, Height: textWidth};
62557
62653
  }
62558
62654
  else //框架内部显示
62559
62655
  {
62560
- yText=yText-textWidth;
62561
- var rtBG={ Left:(xText-textHeight/2), Top:yText , Width:textHeight, Height: textWidth};
62656
+ var rtBG={ Left:(xText-textHeight/2), Top:yText , Width: textHeight, Height:textWidth };
62562
62657
  }
62563
62658
 
62564
62659
  this.Canvas.fillStyle=this.LineColor;
@@ -62574,13 +62669,13 @@ function ChartDrawPriceLineV2()
62574
62669
  if (this.Title)
62575
62670
  {
62576
62671
  var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;
62577
- if (chartBorder.Bottom>10)
62672
+ if (bDrawInside)
62578
62673
  {
62579
- var rtTitle={ Left:rtBG.Left, Top:bottom-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth };
62674
+ var rtTitle={Left:rtBG.Left, Top:rtBG.Top-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth};
62580
62675
  }
62581
62676
  else
62582
62677
  {
62583
- var rtTitle={Left:rtBG.Left, Top:rtBG.Top-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth}
62678
+ var rtTitle={ Left:rtBG.Left, Top:bottom-textWidth-1*pixelTatio, Width:textHeight, Height:textWidth };
62584
62679
  }
62585
62680
 
62586
62681
  this.Canvas.fillStyle=this.LineColor;
@@ -62596,14 +62691,20 @@ function ChartDrawPriceLineV2()
62596
62691
  }
62597
62692
  else
62598
62693
  {
62599
- if (chartBorder.Right>10)
62694
+ var position=this.TextPosition[1];
62695
+ var bDrawInside=false; //在内部绘制
62696
+ if (position==0) bDrawInside=chartBorder.Right<=10;
62697
+ else if (position==1) bDrawInside=true;
62698
+ else if (position==2) bDrawInside=false;
62699
+
62700
+ if (bDrawInside)
62600
62701
  {
62601
- var rtBG={ Left:xText, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
62602
- if (rtBG.Left+rtBG.Width>border.ChartWidth) rtBG.Left=border.ChartWidth-rtBG.Width-2*pixelTatio;
62702
+ var rtBG={ Left:xText-textWidth, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
62603
62703
  }
62604
62704
  else //框架内部显示
62605
62705
  {
62606
- var rtBG={ Left:xText-textWidth, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
62706
+ var rtBG={ Left:xText, Top:(yText-textHeight/2-1*pixelTatio) , Width:textWidth, Height: textHeight};
62707
+ if (rtBG.Left+rtBG.Width>border.ChartWidth) rtBG.Left=border.ChartWidth-rtBG.Width-2*pixelTatio;
62607
62708
  }
62608
62709
 
62609
62710
  this.Canvas.fillStyle=this.LineColor;
@@ -62615,14 +62716,14 @@ function ChartDrawPriceLineV2()
62615
62716
  if (this.Title)
62616
62717
  {
62617
62718
  var textWidth=this.Canvas.measureText(this.Title).width+2*pixelTatio;
62618
- if (chartBorder.Right>10)
62719
+ if (bDrawInside)
62619
62720
  {
62620
- var rtTitle={ Left:right-textWidth-1*pixelTatio, Top:rtBG.Top, Width:textWidth, Height:textHeight };
62621
- if (rtBG.Left!=right) rtTitle.Left=rtBG.Left-textWidth-1*pixelTatio;
62721
+ var rtTitle={Left:rtBG.Left-textWidth, Top:rtBG.Top, Width:textWidth, Height:textHeight}
62622
62722
  }
62623
62723
  else
62624
62724
  {
62625
- var rtTitle={Left:rtBG.Left-textWidth, Top:rtBG.Top, Width:textWidth, Height:textHeight}
62725
+ var rtTitle={ Left:right-textWidth-1*pixelTatio, Top:rtBG.Top, Width:textWidth, Height:textHeight };
62726
+ if (rtBG.Left!=right) rtTitle.Left=rtBG.Left-textWidth-1*pixelTatio;
62626
62727
  }
62627
62728
 
62628
62729
  this.Canvas.fillStyle=this.LineColor;
@@ -66961,7 +67062,7 @@ function JSChartResource()
66961
67062
  this.IndexTitleBGColor='rgb(250,250,250)'; //指标名字背景色
66962
67063
  this.IndexTitleBorderColor='rgb(180,180,180)'; //指标名字边框颜色
66963
67064
  this.IndexTitleBorderMoveOnColor='rgb(0,0,0)'; //指标名字边框颜色(鼠标在上面)
66964
- this.IndexTitleBorderStyle=1, //0=直角边框 1=圆角变量
67065
+ this.IndexTitleBorderStyle=1, //0=直角边框 1=圆角边框
66965
67066
  this.IndexTitleColor="rgb(43,54,69)"; //指标名字颜色
66966
67067
  this.IndexTitleSelectedColor="rgb(65,105,225)";
66967
67068
  this.OverlayIndexTitleBGColor='rgba(255,255,255,0.7)';
@@ -133916,7 +134017,7 @@ function HQChartScriptWorker()
133916
134017
 
133917
134018
 
133918
134019
 
133919
- var HQCHART_VERSION="1.1.13104";
134020
+ var HQCHART_VERSION="1.1.13109";
133920
134021
 
133921
134022
  function PrintHQChartVersion()
133922
134023
  {