hqchart 1.1.13327 → 1.1.13335
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.
- package/lib/umychart.vue.js +10 -8
- package/package.json +1 -1
- package/src/jscommon/umychart.DialogDrawTool.js +31 -5
- package/src/jscommon/umychart.js +23 -2
- package/src/jscommon/umychart.scrollbar.js +1 -1
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +25 -4
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +56 -9
package/lib/umychart.vue.js
CHANGED
|
@@ -2240,7 +2240,7 @@ if(item.TextBGColor)//文字背景色
|
|
|
2240
2240
|
this.GetYData=function(y,isLimit){if(this.Logarithmic&&this.GetYLogarithmicFromData){return this.GetYLogarithmicData(y);}if(this.CoordinateType==1)//反转坐标
|
|
2241
2241
|
{if(isLimit==false){return(y-this.ChartBorder.GetTopEx())/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}else{if(y<this.ChartBorder.GetTopEx())return this.HorizontalMin;if(y>this.ChartBorder.GetBottomEx())return this.HorizontalMax;return(y-this.ChartBorder.GetTopEx())/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}}else{if(isLimit==false){return(this.ChartBorder.GetBottomEx()-y)/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}else{if(y<this.ChartBorder.GetTopEx())return this.HorizontalMax;if(y>this.ChartBorder.GetBottomEx())return this.HorizontalMin;return(this.ChartBorder.GetBottomEx()-y)/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}}};//X坐标转x轴数值
|
|
2242
2242
|
this.GetXData=function(x){if(x<=this.ChartBorder.GetLeft())return 0;if(x>=this.ChartBorder.GetRight())return this.XPointCount;return(x-this.ChartBorder.GetLeft())*(this.XPointCount*1.0/this.ChartBorder.GetWidth());};//选中的画图工具X,Y轴坐标信息
|
|
2243
|
-
this.DrawPictureXCoordinate=function(drawPicture,range,option){if(this.IsHScreen)return;if(!range)return;if(!IFrameSplitOperator.IsNonEmptyArray(range.Points))return;var border=this.GetBorder();var left=border.Left;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();if(range.X){var xRange=range.X;var xLeft=xRange.Min.X;var xRight=xRange.Max.X;if(xLeft<left)xLeft=left;if(xRight>right)xRight=right;this.Canvas.fillStyle=this.DrawPicture.BGColor;this.Canvas.fillRect(xLeft,border.Bottom,xRight-xLeft,fontHeight);}for(var i=0;i<range.Points.length;++i){var item=range.Points[i];if(item.X<left||item.X>right)continue;var index=this.GetXData(item.X,false);var index=Math.round(index);var kItem=this.GetKItem(index);if(kItem){var text=IFrameSplitOperator.FormatDateString(kItem.Date,null);if(ChartData.IsMinutePeriod(option.Period))text+=" "+IFrameSplitOperator.FormatTimeString(kItem.Time,"HH:MM");var textWidth=this.Canvas.measureText(text).width+2;var textLeft=item.X-textWidth/2;if(textLeft<left)textLeft=left;this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(textLeft,border.Bottom,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yCenter=border.Bottom+fontHeight;this.Canvas.fillText(text,textLeft+1,yCenter);}}};this.GetKItem=function(currentIndex){if(!this.Data)return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return null;var index=this.Data.DataOffset+currentIndex;return this.Data.Data[index];};this.DrawPictureYCoordinate=function(drawPicture,range,option){if(this.IsHScreen)return;if(!range)return;if(!IFrameSplitOperator.IsNonEmptyArray(range.Points))return;var border=this.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var defaultfloatPrecision=2;if(option&&option.Symbol)defaultfloatPrecision=GetfloatPrecision(option.Symbol);var textWidth=0;for(var i=0;i<range.Points.length;++i){var item=range.Points[i];var Value=this.GetYData(item.Y);var text=Value.toFixed(defaultfloatPrecision);var value=this.Canvas.measureText(text).width;if(textWidth<value)textWidth=value;range.Points[i].Text=text;}textWidth+=this.YTextPadding[1]+2;if(range.Y){var yRange=range.Y;var yTop=yRange.Min.Y;var yBottom=yRange.Max.Y;if(yRange.Min.Y<top)yTop=top;if(yRange.Max.Y>bottom)yBottom=bottom;this.Canvas.fillStyle=this.DrawPicture.BGColor;this.Canvas.fillRect(right,yTop,textWidth+5,yBottom-yTop);}for(var i=0;i<range.Points.length;++i){var item=range.Points[i];if(item.Y<top||item.Y>bottom)continue;this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(right,item.Y-fontHeight/2,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yText=item.Y+fontHeight/2;this.Canvas.fillText(item.Text,right+this.YTextPadding[1],yText);}};this.DrawPicturePointYCoordinate=function(drawPicture,option){if(this.IsHScreen)return;if(!drawPicture.GetYCoordinatePoint)return;var aryPoint=drawPicture.GetYCoordinatePoint();if(!IFrameSplitOperator.IsNonEmptyArray(aryPoint))return;var border=this.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var defaultfloatPrecision=2;if(option&&option.Symbol)defaultfloatPrecision=GetfloatPrecision(option.Symbol);for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];if(!item)continue;if(item.Y<top||item.Y>bottom)continue;var text=item.YValue.toFixed(defaultfloatPrecision);var textWidth=this.Canvas.measureText(text).width+2;textWidth+=this.YTextPadding[1];this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(right,item.Y-fontHeight/2,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yText=item.Y+fontHeight/2;this.Canvas.fillText(text,right+this.YTextPadding[1],yText);}};//字体外部设置好
|
|
2243
|
+
this.DrawPictureXCoordinate=function(drawPicture,range,option){if(this.IsHScreen)return;if(!range)return;if(!IFrameSplitOperator.IsNonEmptyArray(range.Points))return;var border=this.GetBorder();var left=border.Left;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();if(range.X){var xRange=range.X;var xLeft=xRange.Min.X;var xRight=xRange.Max.X;if(xLeft<left)xLeft=left;if(xRight>right)xRight=right;this.Canvas.fillStyle=this.DrawPicture.BGColor;this.Canvas.fillRect(xLeft,border.Bottom,xRight-xLeft,fontHeight);}for(var i=0;i<range.Points.length;++i){var item=range.Points[i];if(item.X<left||item.X>right)continue;var index=this.GetXData(item.X,false);var index=Math.round(index);var kItem=this.GetKItem(index);if(kItem){var text=IFrameSplitOperator.FormatDateString(kItem.Date,null);if(ChartData.IsMinutePeriod(option.Period))text+=" "+IFrameSplitOperator.FormatTimeString(kItem.Time,"HH:MM");else if(ChartData.IsMilliSecondPeriod(option.Period))text+=" "+IFrameSplitOperator.FormatTimeString(kItem.Time,"HH:MM:SS.fff");var textWidth=this.Canvas.measureText(text).width+2;var textLeft=item.X-textWidth/2;if(textLeft<left)textLeft=left;this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(textLeft,border.Bottom,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yCenter=border.Bottom+fontHeight;this.Canvas.fillText(text,textLeft+1,yCenter);}}};this.GetKItem=function(currentIndex){if(!this.Data)return null;if(!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return null;var index=this.Data.DataOffset+currentIndex;return this.Data.Data[index];};this.DrawPictureYCoordinate=function(drawPicture,range,option){if(this.IsHScreen)return;if(!range)return;if(!IFrameSplitOperator.IsNonEmptyArray(range.Points))return;var border=this.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var defaultfloatPrecision=2;if(option&&option.Symbol)defaultfloatPrecision=GetfloatPrecision(option.Symbol);var textWidth=0;for(var i=0;i<range.Points.length;++i){var item=range.Points[i];var Value=this.GetYData(item.Y);var text=Value.toFixed(defaultfloatPrecision);var value=this.Canvas.measureText(text).width;if(textWidth<value)textWidth=value;range.Points[i].Text=text;}textWidth+=this.YTextPadding[1]+2;if(range.Y){var yRange=range.Y;var yTop=yRange.Min.Y;var yBottom=yRange.Max.Y;if(yRange.Min.Y<top)yTop=top;if(yRange.Max.Y>bottom)yBottom=bottom;this.Canvas.fillStyle=this.DrawPicture.BGColor;this.Canvas.fillRect(right,yTop,textWidth+5,yBottom-yTop);}for(var i=0;i<range.Points.length;++i){var item=range.Points[i];if(item.Y<top||item.Y>bottom)continue;this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(right,item.Y-fontHeight/2,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yText=item.Y+fontHeight/2;this.Canvas.fillText(item.Text,right+this.YTextPadding[1],yText);}};this.DrawPicturePointYCoordinate=function(drawPicture,option){if(this.IsHScreen)return;if(!drawPicture.GetYCoordinatePoint)return;var aryPoint=drawPicture.GetYCoordinatePoint();if(!IFrameSplitOperator.IsNonEmptyArray(aryPoint))return;var border=this.GetBorder();var top=border.TopEx;var bottom=border.BottomEx;var right=border.Right;this.Canvas.font=this.DrawPicture.Font;var fontHeight=this.GetFontHeight();this.Canvas.textAlign="left";this.Canvas.textBaseline="bottom";var defaultfloatPrecision=2;if(option&&option.Symbol)defaultfloatPrecision=GetfloatPrecision(option.Symbol);for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];if(!item)continue;if(item.Y<top||item.Y>bottom)continue;var text=item.YValue.toFixed(defaultfloatPrecision);var textWidth=this.Canvas.measureText(text).width+2;textWidth+=this.YTextPadding[1];this.Canvas.fillStyle=this.DrawPicture.TextBGColor;this.Canvas.fillRect(right,item.Y-fontHeight/2,textWidth,fontHeight);this.Canvas.fillStyle=this.DrawPicture.TextColor;var yText=item.Y+fontHeight/2;this.Canvas.fillText(text,right+this.YTextPadding[1],yText);}};//字体外部设置好
|
|
2244
2244
|
this.GetCustomItemTextInfo=function(item,bLeft,pixelTatio){var text=bLeft?item.Message[0]:item.Message[1];var aryText=[];var width=0;if(Array.isArray(text)){for(var i=0;i<text.length;++i){var item=text[i];if(item.Type===1){aryText.push({Type:item.Type});}else{var value=this.Canvas.measureText(text[i].Text).width;if(value>width)width=value;var outItem={Text:text[i].Text,Width:value+2*pixelTatio};if(item.TextColor)outItem.TextColor=item.TextColor;aryText.push(outItem);}}if(width>0)width+=2*pixelTatio;}else{width=this.Canvas.measureText(text).width+2*pixelTatio;aryText.push({Text:text,Width:width});}return{MaxWidth:width,Text:aryText};};this.DrawCustomItem=function(item,mapTextRect)//显示自定义Y刻度
|
|
2245
2245
|
{if(!item.Message[1]&&!item.Message[0])return;if(item.Value>this.HorizontalMax||item.Value<this.HorizontalMin){this.SendDrawCountDownEvent({IsShow:false});return;}var border=this.GetBorder();var left=border.Left;var right=border.Right;var bottom=border.Bottom;var top=border.Top;var borderRight=this.ChartBorder.Right;var borderLeft=this.ChartBorder.Left;var titleHeight=this.ChartBorder.TitleHeight;if(this.IsHScreen){borderLeft=this.ChartBorder.Top;borderRight=this.ChartBorder.Bottom;top=border.Top;bottom=border.Bottom;}var pixelTatio=GetDevicePixelRatio();var defaultTextHeight=18*pixelTatio;var textHeight=defaultTextHeight;var y=this.GetYFromData(item.Value);var position=0;var emptyBGColor;if(item.ExtendData&&item.ExtendData.Custom){var customItem=item.ExtendData.Custom;if(IFrameSplitOperator.IsNumber(customItem.Position))position=customItem.Position;if(customItem.EmptyBGColor)emptyBGColor=customItem.EmptyBGColor;}if(item.Message[0])// 左
|
|
2246
2246
|
{if(borderLeft<10||position==1){if(item.Font!=null)this.Canvas.font=item.Font;this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";var textInfo=this.GetCustomItemTextInfo(item,true,pixelTatio);var textWidth=textInfo.MaxWidth;var fontHeight=this.GetFontHeight();textHeight=fontHeight>defaultTextHeight?fontHeight:defaultTextHeight;var bgColor=item.LineColor;var rgb=this.RGBToStruct(item.LineColor);if(rgb)bgColor='rgba('+rgb.R+', '+rgb.G+', '+rgb.B+', '+g_JSChartResource.FrameLatestPrice.BGAlpha+')';//内部刻度 背景增加透明度
|
|
@@ -5872,7 +5872,7 @@ this.SetLastPoint=null;//this.SetLastPoint=function(obj) obj={X:,Y:}
|
|
|
5872
5872
|
this.Update=null;//更新数据回调
|
|
5873
5873
|
this.GetActiveDrawPicture=null;this.GetYCoordinatePoint=null;this.Draw=function(){};this.SetOption=function(option){if(!option)return;if(option.LineColor)this.LineColor=option.LineColor;if(option.LineWidth>0)this.LineWidth=option.LineWidth;if(option.AreaColor)this.AreaColor=option.AreaColor;if(option.PointColor)this.PointColor=option.PointColor;if(option.MoveOnPointColor)this.MoveOnPointColor=option.MoveOnPointColor;if(option.PointRadius)this.PointRadius=option.PointRadius;if(IFrameSplitOperator.IsNumber(option.SquareSize))this.SquareSize=option.SquareSize;if(IFrameSplitOperator.IsBool(option.IsShowPoint))this.IsShowPoint=option.IsShowPoint;if(IFrameSplitOperator.IsNumber(option.LimitFrameID))this.LimitFrameID=option.LimitFrameID;if(IFrameSplitOperator.IsBool(option.EnableCtrlMove))this.EnableCtrlMove=option.EnableCtrlMove;if(IFrameSplitOperator.IsBool(option.IsShowYCoordinate))this.IsShowYCoordinate=option.IsShowYCoordinate;};this.ReloadResource=function(resource){if(!resource){this.PointColor=g_JSChartResource.DrawPicture.PointColor[0];this.MoveOnPointColor=g_JSChartResource.DrawPicture.PointColor[1];this.PointBGColor=g_JSChartResource.DrawPicture.PointColor[2];}};this.SetLineWidth=function(){this.BackupLineWidth=null;if(this.LineWidth>0){this.BackupLineWidth=this.Canvas.lineWidth;this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();}};this.GetFontHeight=function(font){return GetFontHeight(this.Canvas,font,"擎");};this.RestoreLineWidth=function(){if(this.BackupLineWidth!=null){this.Canvas.lineWidth=this.BackupLineWidth;}};//磁吸K线
|
|
5874
5874
|
this.PointMagnetKLine=function(){if(!this.IsSupportMagnet)return false;if(!this.Frame)return false;if(this.Frame.ClassName=="MinuteFrame"||this.Frame.Class=="MinuteHScreenFrame")return false;if(this.Frame.Identify!=0)return false;var pointIndex=-1;if(this.Status==2)pointIndex=1;else if(this.Status==1)pointIndex=0;else if(IFrameSplitOperator.IsNumber(this.MovePointIndex))pointIndex=this.MovePointIndex;if(pointIndex<0)return false;if(this.Option&&this.Option.Magnet&&this.Option.Magnet.Enable){var option={IsFixedX:false,Magnet:{Enable:true,PointIndex:pointIndex,Distance:this.Option.Magnet.Distance,Type:this.Option.Magnet.Type}};return this.AdjustPoint(this.Point,option);}return false;};//Point => Value
|
|
5875
|
-
this.PointToValue=function(){if(!this.Frame)return false;if(this.Frame.ClassName=="MinuteFrame"||this.Frame.Class=="MinuteHScreenFrame"){return this.PointToValue_Minute();}else{return this.PointToValue_KLine();}};this.PointToKLine=function(aryPoint){if(!this.Frame)return null;var data=this.Frame.Data;if(!data)return null;var kLine=[];var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i in aryPoint){var item=aryPoint[i];var xValue=parseInt(this.Frame.GetXData(item.Y))+data.DataOffset;var yValue=this.Frame.GetYData(item.X);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;kLine[i]=valueItem;}}else{for(var i in aryPoint){var item=aryPoint[i];var index=parseInt(this.Frame.GetXData(item.X,false));var xValue=index+data.DataOffset;if(xValue<0)xValue=0;else if(xValue>=data.Data.length){xValue=data.Data.length-1;index=xValue-data.DataOffset;}var yValue=this.Frame.GetYData(item.Y,false);var valueItem={XValue:xValue,YValue:yValue,XIndex:index};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;kLine[i]=valueItem;}}return kLine;};this.PointToValue_KLine=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i
|
|
5875
|
+
this.PointToValue=function(){if(!this.Frame)return false;if(this.Frame.ClassName=="MinuteFrame"||this.Frame.Class=="MinuteHScreenFrame"){return this.PointToValue_Minute();}else{return this.PointToValue_KLine();}};this.PointToKLine=function(aryPoint){if(!this.Frame)return null;var data=this.Frame.Data;if(!data)return null;var kLine=[];var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i in aryPoint){var item=aryPoint[i];var xValue=parseInt(this.Frame.GetXData(item.Y))+data.DataOffset;var yValue=this.Frame.GetYData(item.X);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;kLine[i]=valueItem;}}else{for(var i in aryPoint){var item=aryPoint[i];var index=parseInt(this.Frame.GetXData(item.X,false));var xValue=index+data.DataOffset;if(xValue<0)xValue=0;else if(xValue>=data.Data.length){xValue=data.Data.length-1;index=xValue-data.DataOffset;}var yValue=this.Frame.GetYData(item.Y,false);var valueItem={XValue:xValue,YValue:yValue,XIndex:index};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;kLine[i]=valueItem;}}return kLine;};this.PointToValue_KLine=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i=0;i<this.Point.length;++i){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.Y,false))+data.DataOffset;var yValue=this.Frame.GetYData(item.X,false);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;this.Value[i]=valueItem;}}else{for(var i=0;i<this.Point.length;++i){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.X,false))+data.DataOffset;if(xValue<0)xValue=0;else if(xValue>=data.Data.length)xValue=data.Data.length-1;var yValue=this.Frame.GetYData(item.Y,false);var valueItem={XValue:xValue,YValue:yValue};var kline=data.Data[xValue];valueItem.DateTime={Date:kline.Date};if(IFrameSplitOperator.IsNumber(kline.Time))valueItem.DateTime.Time=kline.Time;this.Value[i]=valueItem;}}return true;};this.PointToValue_Minute=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i=0;i<this.Point.length;++i){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.Y,false));var yValue=this.Frame.GetYData(item.X,false);var valueItem={XValue:xValue,YValue:yValue};var minuteItem=data.Data[xValue];valueItem.DateTime={Date:minuteItem.Date,Time:minuteItem.Time};this.Value[i]=valueItem;}}else{var xDatetime=g_MinuteTimeStringData.GetTimeData(this.Symbol);for(var i=0;i<this.Point.length;++i){var item=this.Point[i];var xValue=parseInt(this.Frame.GetXData(item.X,false));var yValue=this.Frame.GetYData(item.Y,false);if(xValue>=data.Data.length)//超过当前数据,直接读固定时间
|
|
5876
5876
|
{var index=xValue%xDatetime.length;var dataIndex=data.Data.length-1;var valueItem={XValue:xValue,YValue:yValue};var minuteItem=data.Data[dataIndex];var timeItem=xDatetime[index];valueItem.DateTime={Date:minuteItem.Date,Time:timeItem};this.Value[i]=valueItem;}else{var valueItem={XValue:xValue,YValue:yValue};var minuteItem=data.Data[xValue];valueItem.DateTime={Date:minuteItem.Date,Time:minuteItem.Time};this.Value[i]=valueItem;}}}return true;};this.IsPointIn=function(x,y,option){return false;};//Value => Point
|
|
5877
5877
|
this.ValueToPoint=function(){if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;//this.UpdateXValue();
|
|
5878
5878
|
var isHScreen=this.Frame.IsHScreen;this.Point=[];for(var i=0;i<this.Value.length;++i){var item=this.Value[i];var pt=new Point();if(isHScreen){pt.Y=this.Frame.GetXFromIndex(item.XValue-data.DataOffset,false);pt.X=this.Frame.GetYFromData(item.YValue,false);}else{pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset,false);pt.Y=this.Frame.GetYFromData(item.YValue,false);}this.Point[i]=pt;}};this.UpdateXValue=function()//通过datetime更新x的索引
|
|
@@ -6288,7 +6288,8 @@ function ChartDrawCrosshair(){this.newMethod=IChartDrawPicture;//派生
|
|
|
6288
6288
|
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawCrosshair';this.PointCount=1;this.IsPointIn=this.IsPointIn_XYValue_Line;this.IsHScreen=false;this.GetXYCoordinate=this.GetXYCoordinate_default;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:false,IsCheckY:false});if(!drawPoint)return;if(drawPoint.length!=1)return;this.IsHScreen=this.Frame.IsHScreen;var pt=drawPoint[0];var chartBorder=this.Frame.ChartBorder;var border=this.Frame.GetBorder();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 xLine=ToFixedPoint2(this.LineWidth,pt.X);var left=border.LeftEx;var right=border.RightEx;var top=border.Top;var bottom=border.Bottom;var ptStart={X:left,Y:yLine};var ptEnd={X:right,Y:yLine};var ptStart2={X:xLine,Y:top};var ptEnd2={X:xLine,Y:bottom};}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 yLine=ToFixedPoint2(this.LineWidth,pt.Y);var top=border.TopEx;var bottom=border.BottomEx;var left=border.Left;var right=border.Right;var ptStart={X:xLine,Y:top};var ptEnd={X:xLine,Y:bottom};var ptStart2={X:left,Y:yLine};var ptEnd2={X:right,Y:yLine};}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.moveTo(ptStart2.X,ptStart2.Y);this.Canvas.lineTo(ptEnd2.X,ptEnd2.Y);this.Canvas.stroke();this.RestoreLineWidth();var line={Start:ptStart,End:ptEnd};var line2={Start:ptStart2,End:ptEnd2};this.LinePoint.push(line);this.LinePoint.push(line2);if(this.Status==10)this.DrawPoint(drawPoint);//画点
|
|
6289
6289
|
this.Canvas.restore();};}//画图工具-监测线
|
|
6290
6290
|
function ChartDrawMonitorLine(){this.newMethod=IChartDrawPicture;//派生
|
|
6291
|
-
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawMonitorLine';this.PointCount=1;this.IsPointIn=this.IsPointIn_XYValue_Line;this.IsHScreen=false;this.GetXYCoordinate=this.GetXYCoordinate_default;this.FormatLabelTextCallback=null;this.LineColor='rgb(255,215,0)';this.LabelConfig={Font:12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1',BGColor:"rgb(30,144,255)",YTextOffset:4,LineColor:"rgba(255,215,0,0.8)",LineDash:[3,5]};this.
|
|
6291
|
+
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawMonitorLine';this.PointCount=1;this.IsPointIn=this.IsPointIn_XYValue_Line;this.IsHScreen=false;this.GetXYCoordinate=this.GetXYCoordinate_default;this.FormatLabelTextCallback=null;this.LineColor='rgb(255,215,0)';this.LabelConfig={Font:12*GetDevicePixelRatio()+'px \u5FAE\u8F6F\u96C5\u9ED1',BGColor:"rgb(30,144,255)",YTextOffset:4,LineColor:"rgba(255,215,0,0.8)",LineDash:[3,5]};this.PointToValue_Backup=this.PointToValue;this.PointToValue=function(){if(!this.PointToValue_Backup())return false;if(this.Frame.IsKLineFrame(false)){if(this.Frame.Identify===0){var dataIndex=this.Value[0].XValue;var data=this.Frame.Data;var kItem=data.Data[dataIndex];this.Value[0].YValue=kItem.Close;//使用收盘价
|
|
6292
|
+
}}return true;};this.SetOption=function(option){if(option.LineColor)this.LineColor=option.LineColor;if(option.Label){var item=option.Label;var dest=this.LabelConfig;if(item.Font)dest.Font=item.Font;if(item.BGColor)dest.BGColor=item.BGColor;if(item.LineColor)dest.LineColor=item.LineColor;if(item.LineDash)dest.LineDash=item.LineDash;if(IFrameSplitOperator.IsNumber(item.YTextOffset))dest.YTextOffset=item.YTextOffset;}if(option.FormatLabelTextCallback)this.FormatLabelTextCallback=option.FormatLabelTextCallback;};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;if(!IFrameSplitOperator.IsNonEmptyArray(data.Data))return;if(this.Point.length!=1)return;if(this.Value.length!=1)return;this.IsHScreen=this.Frame.IsHScreen;if(this.IsHScreen)return;if(this.Status==20)this.DrawMoveLine();else if(this.Status==10)this.DrawMonitorLine(data);};this.DrawMoveLine=function(){var border=this.Frame.ChartBorder.GetBorder();var pt=this.Point[0];var x=ToFixedPoint(pt.X);this.ClipFrame();this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,border.TopEx);this.Canvas.lineTo(x,border.BottomEx);this.Canvas.stroke();this.Canvas.restore();};this.DrawMonitorLine=function(data){var isMinute=this.Frame.IsMinuteFrame();var dataWidth=this.Frame.DataWidth;var distanceWidth=this.Frame.DistanceWidth;var xPointCount=this.Frame.XPointCount;if(this.IsHScreen){//var border=this.Frame.ChartBorder.GetHScreenBorder();
|
|
6292
6293
|
//var chartright=border.BottomEx;
|
|
6293
6294
|
//var xOffset=border.TopEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;
|
|
6294
6295
|
}else{var border=this.Frame.ChartBorder.GetBorder();var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;}var ptData=this.Value[0];this.ClipFrame();var labelInfo=null;for(var i=data.DataOffset,j=0;i<data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth){var item=data.Data[i];if(isMinute){var x=this.Frame.GetXFromIndex(j);}else{var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;}if(i==ptData.XValue)//起始
|
|
@@ -13145,7 +13146,8 @@ var item=this.SliderChart.PtInChart(x,y);if(item){switch(item.Data.Type){case 0:
|
|
|
13145
13146
|
{if(xStart<=left){xStart=pageRange.First.XStart;}else if(xStart>=right){xStart=pageRange.Last.XEnd;}this.SliderChart.XStart=xStart;}else if(type==2){if(xEnd>=right){xEnd=pageRange.Last.XEnd;}else if(xEnd<=left){xEnd=pageRange.First.XStart;}this.SliderChart.XEnd=xEnd;}drag.UpdateData={XStart:xStart,XEnd:xEnd,Type:type};drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;if(drag.DrawCount==0){this.DragUpdate(drag);}else{this.DragTimer=setTimeout(function(){_this66.DragUpdate(_this66.DragSlider);},this.DelayDragFrequency);}}};this.DocOnMouseUp=function(e){//清空事件
|
|
13146
13147
|
document.onmousemove=null;document.onmouseup=null;this.CancelDragTimer();var dragSlider=this.DragSlider;this.DragMove=null;this.DragSlider=null;this.SliderChart.DragMode=false;this.DragUpdate(dragSlider);};this.DragUpdate=function(dragData){if(!dragData||!dragData.UpdateData)return;this.UpdateXDataOffset(dragData.UpdateData);this.Draw();++dragData.DrawCount;};this.Reset=function(option){this.SourceData=null;this.XOffsetData.Start=-1;this.XOffsetData.End=-1;this.XOffsetData.Count=0;this.Frame.Data=null;for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];item.Data=null;}if(this.ChartSplashPaint)this.ChartSplashPaint.IsEnableSplash=true;if(option.Draw)this.Draw();};//外部更新滑块 obj={ Start: , End: }
|
|
13147
13148
|
this.UpdateSlider=function(obj){if(this.SliderChart.DragMode)return;var bSizeChange=false;if((this.AutoMargin.Left||this.AutoMargin.Right)&&obj.Border){if(this.AutoMargin.Left){if(this.Frame.ChartBorder.Left!=obj.Border.Left)bSizeChange=true;}if(this.AutoMargin.Right){if(this.Frame.ChartBorder.Right!=obj.Border.Right)bSizeChange=true;}}var data=obj.Data;if(this.XOffsetData.Start==obj.Start&&this.XOffsetData.End==obj.End&&this.SourceData==data&&!bSizeChange)return;this.SourceData=data;var count=data.Data.length;if(IFrameSplitOperator.IsNumber(obj.RightSpaceCount))count+=obj.RightSpaceCount;this.Frame.XPointCount=count;this.Frame.Data=data;this.XOffsetData.Count=count;this.XOffsetData.Start=obj.Start;this.XOffsetData.End=obj.End;for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];item.Data=data;}if(this.AutoMargin.Left&&obj.Border){if(IFrameSplitOperator.IsNumber(obj.Border.Left))this.Frame.ChartBorder.Left=obj.Border.Left;}if(this.AutoMargin.Right&&obj.Border){if(IFrameSplitOperator.IsNumber(obj.Border.Right))this.Frame.ChartBorder.Right=obj.Border.Right;}this.UpdateFrameMaxMin();if(this.ChartSplashPaint)this.ChartSplashPaint.IsEnableSplash=false;if(obj.Draw)this.Draw();};//移动滑块
|
|
13148
|
-
this.UpdateXDataOffset=function(obj){if(obj.Type==0){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start
|
|
13149
|
+
this.UpdateXDataOffset=function(obj){if(obj.Type==0){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start+0.5);//四舍五入
|
|
13150
|
+
var moveSetp=start-this.XOffsetData.Start;this.XOffsetData.Start=start;this.XOffsetData.End+=moveSetp;}else if(obj.Type==1){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start);this.XOffsetData.Start=start;}else if(obj.Type==2){var end=this.Frame.GetXData(obj.XEnd);end=parseInt(end);this.XOffsetData.End=end;}var endItem=this.SourceData.Data[this.XOffsetData.End];var startItem=this.SourceData.Data[this.XOffsetData.Start];var sendData={Type:obj.Type,Count:this.XOffsetData.Count};if(this.XOffsetData.End>this.XOffsetData.Start){sendData.Start={Index:this.XOffsetData.Start,Item:startItem};sendData.End={Index:this.XOffsetData.End,Item:endItem};}else{sendData.Start={Index:this.XOffsetData.End,Item:endItem};sendData.End={Index:this.XOffsetData.Start,Item:startItem};}if(this.HQChart&&this.HQChart.JSChartContainer){var internalChart=this.HQChart.JSChartContainer;if(internalChart.ChartOperator){var obj={ID:JSCHART_OPERATOR_ID.OP_SCROOLBAR_SLIDER_CHANGED,Start:sendData.Start,End:sendData.End,Type:sendData.Type};internalChart.ChartOperator(obj);}}var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SCROLLBAR_SLIDER_CHANGED);if(event){event.Callback(event,sendData,this);}};this.ReloadResource=function(option){this.Frame.ReloadResource(option);for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.ReloadResource)item.ReloadResource(option);}if(option&&option.Redraw){this.SetSizeChange(true);this.Draw();}};this.GetPageRange=function(){var result={};var showCount=Math.abs(this.XOffsetData.Start-this.XOffsetData.End);result.ShowCount=showCount;//第1页
|
|
13149
13151
|
var xStart=this.Frame.GetXFromIndex(0);var xEnd=this.Frame.GetXFromIndex(showCount);result.First={XStart:xStart,XEnd:xEnd};//最后一页
|
|
13150
13152
|
var end=this.Frame.XPointCount-1;var xEnd=this.Frame.GetXFromIndex(end);var xStart=this.Frame.GetXFromIndex(end-showCount);result.Last={XStart:xStart,XEnd:xEnd};return result;};this.ReloadResource=function(option){this.Frame.ReloadResource(option);for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.ReloadResource)item.ReloadResource(option);}if(option.Draw==true)this.Draw();//是否立即重绘
|
|
13151
13153
|
};}/////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -13274,9 +13276,9 @@ this.RandomBGColor=["rgba(210,251,209,0.8)","rgb(217,217,253)","rgb(255,208,20
|
|
|
13274
13276
|
this.RandomFontColor=["rgb(0,0,0)","rgb(255, 0, 0)","rgb(20, 255, 0)","rgb(255, 0, 255)"];//文字颜色
|
|
13275
13277
|
this.AryButton=[{Title:"点击线段颜色",ClassName:'hqchart_drawtool icon-huabi',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID}},{Title:"点击字体颜色",ClassName:'hqchart_drawtool icon-zitiyanse',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID}},{Title:"点击背景色",ClassName:'hqchart_drawtool icon-zitibeijingse',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID}},{Title:"删除",ClassName:'hqchart_drawtool icon-recycle_bin',Type:2,Data:{ID:JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID}}];this.Inital=function(hqchart){this.HQChart=hqchart;};this.Destroy=function(){this.ChartPicture=null;this.ColorButton=null;if(this.DivDialog){document.body.remove(this.DivDialog);this.DivDialog=null;}};this.Create=function(){var _this74=this;var divDom=document.createElement("div");divDom.className='UMyChart_Draw_Modify_Dialog_Div';var drgDiv=document.createElement("div");drgDiv.className="UMyChart_Draw_Modify_Dialog_Drag_Div";drgDiv.onmousedown=function(e){_this74.OnMouseDownTitle(e);};divDom.appendChild(drgDiv);var spanDom=document.createElement("span");spanDom.className="hqchart_drawtool icon-tuodong";spanDom.classList.add("UMyChart_DrawTool_Span");drgDiv.appendChild(spanDom);for(var i=0;i<this.AryButton.length;++i){var item=this.AryButton[i];this.CreateButtonItem(item,divDom);}this.DivDialog=divDom;document.body.appendChild(divDom);};this.CreateButtonItem=function(item,parentDivDom){var _this75=this;var divItem=document.createElement("div");divItem.className="UMyChart_Draw_Modify_Dialog_Button_Div";var spanDom=document.createElement("span");spanDom.className=item.ClassName;spanDom.classList.add("UMyChart_DrawTool_Span");divItem.appendChild(spanDom);var data={Div:divItem,Span:spanDom,Parent:parentDivDom,Item:item};divItem.onmousedown=function(e){_this75.OnClickButton(e,data);};//点击
|
|
13276
13278
|
switch(item.Data.ID){case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID:this.ColorButton=data;break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID:this.BGColorButton=data;divItem.style.display="none";break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID:this.FontColorButton=data;divItem.style.display="none";break;}parentDivDom.appendChild(divItem);};this.OnClickButton=function(e,data){console.log('[JSDialogModifyDraw::OnClickButton] ',data);if(!data.Item||!data.Item.Data)return;var id=data.Item.Data.ID;switch(id){case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_LINE_COLOR_ID:this.ModifyLineColor();break;case JS_DRAWTOOL_MENU_ID.CMD_DELETE_DRAW_CHART_ID:this.DeleteDrawPicture();break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_BG_COLOR_ID:this.ModifyBGColor();break;case JS_DRAWTOOL_MENU_ID.CMD_CHANGE_FONT_COLOR_ID:this.ModifyFontColor();break;}};this.Close=function(e){if(!this.DivDialog)return;this.ChartPicture=null;this.DivDialog.style.visibility='hidden';};this.IsShow=function(){if(!this.DivDialog)return false;return this.DivDialog.style.visibility==='visible';};this.DeleteDrawPicture=function(){if(this.ChartPicture&&this.HQChart){this.HQChart.ClearChartDrawPicture(this.ChartPicture);}this.Close();};this.ShowButton=function(dom,diaplay){if(dom.style.display==diaplay)return;dom.style.display=diaplay;};this.GetRandomColor=function(currentColor,randomLineColor){var colorIndex=0;for(var i=0;i<randomLineColor.length;++i){if(currentColor==randomLineColor[i]){colorIndex=i+1;break;}}colorIndex=colorIndex%randomLineColor.length;var color=randomLineColor[colorIndex];return color;};this.ModifyLineColor=function(){if(!this.ChartPicture||!this.HQChart)return;var color=this.GetRandomColor(this.ChartPicture.LineColor,this.RandomLineColor);this.ChartPicture.LineColor=color;this.ChartPicture.PointColor=color;if(this.ColorButton)this.ColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13277
|
-
this.HQChart.Draw();};this.ModifyFontColor=function(){if(!this.ChartPicture||!this.HQChart)return;var color=this.GetRandomColor(this.ChartPicture.TextColor,this.RandomFontColor);this.ChartPicture.TextColor=color;if(this.FontColorButton)this.FontColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13278
|
-
this.HQChart.Draw();};this.ModifyBGColor=function(){if(!this.ChartPicture||!this.HQChart)return;var color=this.GetRandomColor(this.ChartPicture.BGColor,this.RandomBGColor);this.ChartPicture.BGColor=color;if(this.BGColorButton)this.BGColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13279
|
-
this.HQChart.Draw();};this.Show=function(x,y){if(!this.DivDialog)this.Create();this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.SetChartPicture=function(chart){this.ChartPicture=chart;var bShowLineColor=true,bShowBGColor=false,bShowFontColor=false;var bgColor=null,fontColor=null;var ARRAY_TEXT_CHART=['ChartDrawPriceLabel',"ChartDrawAnchoredText","ChartDrawPriceNote"
|
|
13279
|
+
this.HQChart.Draw();};this.ModifyFontColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteTextColor,this.RandomFontColor);this.ChartPicture.NoteTextColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.TextColor,this.RandomFontColor);this.ChartPicture.TextColor=color;}if(this.FontColorButton)this.FontColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13280
|
+
this.HQChart.Draw();};this.ModifyBGColor=function(){if(!this.ChartPicture||!this.HQChart)return;if(this.ChartPicture.ClassName=="ChartDrawNote"){var color=this.GetRandomColor(this.ChartPicture.NoteBGColor,this.RandomBGColor);this.ChartPicture.NoteBGColor=color;}else{var color=this.GetRandomColor(this.ChartPicture.BGColor,this.RandomBGColor);this.ChartPicture.BGColor=color;}if(this.BGColorButton)this.BGColorButton.Span.style['color']=color;if(this.HQChart.ChartDrawStorage)this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture);//保存下
|
|
13281
|
+
this.HQChart.Draw();};this.Show=function(x,y){if(!this.DivDialog)this.Create();this.DivDialog.style.visibility='visible';this.DivDialog.style.top=y+"px";this.DivDialog.style.left=x+"px";};this.SetChartPicture=function(chart){this.ChartPicture=chart;var bShowLineColor=true,bShowBGColor=false,bShowFontColor=false;var bgColor=null,fontColor=null;var ARRAY_TEXT_CHART=['ChartDrawPriceLabel',"ChartDrawAnchoredText","ChartDrawPriceNote"];if(ARRAY_TEXT_CHART.includes(chart.ClassName)){bShowBGColor=true;bShowFontColor=true;bgColor=chart.BGColor;fontColor=chart.TextColor;}else if(chart.ClassName=="ChartDrawNote"){bShowBGColor=true;bShowFontColor=true;bgColor=chart.NoteBGColor;fontColor=chart.NoteTextColor;}if(this.ColorButton){var item=this.ColorButton;this.ShowButton(item.Div,bShowLineColor?"block":"none");if(bShowLineColor){item.Span.style['color']=chart.LineColor;}}if(this.BGColorButton){var item=this.BGColorButton;this.ShowButton(item.Div,bShowBGColor?"block":"none");if(bShowBGColor){item.Span.style['color']=bgColor;}}if(this.FontColorButton){var item=this.FontColorButton;this.ShowButton(item.Div,bShowFontColor?"block":"none");if(bShowFontColor){item.Span.style['color']=fontColor;}}};this.OnMouseDownTitle=function(e){var _this76=this;if(!this.DivDialog)return;var dragData={X:e.clientX,Y:e.clientY};dragData.YOffset=e.clientX-this.DivDialog.offsetLeft;dragData.XOffset=e.clientY-this.DivDialog.offsetTop;this.DragTitle=dragData;document.onmousemove=function(e){_this76.DocOnMouseMoveTitle(e);};document.onmouseup=function(e){_this76.DocOnMouseUpTitle(e);};};this.DocOnMouseMoveTitle=function(e){if(!this.DragTitle)return;var left=e.clientX-this.DragTitle.YOffset;var top=e.clientY-this.DragTitle.XOffset;var right=left+this.DivDialog.offsetWidth;var bottom=top+this.DivDialog.offsetHeight;if(right+5>=window.innerWidth)left=window.innerWidth-this.DivDialog.offsetWidth-5;if(bottom+5>=window.innerHeight)top=window.innerHeight-this.DivDialog.offsetHeight-5;this.DivDialog.style.left=left+'px';this.DivDialog.style.top=top+'px';if(e.preventDefault)e.preventDefault();};this.DocOnMouseUpTitle=function(e){this.DragTitle=null;this.onmousemove=null;this.onmouseup=null;};}///////////////////////////////////////////////////////////////////////////////////
|
|
13280
13282
|
// 工作线程计算指标示例
|
|
13281
13283
|
//
|
|
13282
13284
|
//
|
|
@@ -13288,7 +13290,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
13288
13290
|
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);};}/********************************************************************************
|
|
13289
13291
|
* 版本信息输出
|
|
13290
13292
|
*
|
|
13291
|
-
*/var HQCHART_VERSION="1.1.
|
|
13293
|
+
*/var HQCHART_VERSION="1.1.13334";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();//把给外界调用的方法暴露出来
|
|
13292
13294
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
13293
13295
|
// BaseIndex:BaseIndex,
|
|
13294
13296
|
// ChartLine:ChartLine,
|
package/package.json
CHANGED
|
@@ -727,8 +727,18 @@ function JSDialogModifyDraw()
|
|
|
727
727
|
{
|
|
728
728
|
if (!this.ChartPicture || !this.HQChart) return;
|
|
729
729
|
|
|
730
|
-
|
|
731
|
-
this.ChartPicture.
|
|
730
|
+
|
|
731
|
+
if (this.ChartPicture.ClassName=="ChartDrawNote")
|
|
732
|
+
{
|
|
733
|
+
var color=this.GetRandomColor(this.ChartPicture.NoteTextColor, this.RandomFontColor);
|
|
734
|
+
this.ChartPicture.NoteTextColor=color;
|
|
735
|
+
}
|
|
736
|
+
else
|
|
737
|
+
{
|
|
738
|
+
var color=this.GetRandomColor(this.ChartPicture.TextColor, this.RandomFontColor);
|
|
739
|
+
this.ChartPicture.TextColor=color;
|
|
740
|
+
}
|
|
741
|
+
|
|
732
742
|
|
|
733
743
|
if (this.FontColorButton) this.FontColorButton.Span.style['color']=color;
|
|
734
744
|
|
|
@@ -740,9 +750,18 @@ function JSDialogModifyDraw()
|
|
|
740
750
|
this.ModifyBGColor=function()
|
|
741
751
|
{
|
|
742
752
|
if (!this.ChartPicture || !this.HQChart) return;
|
|
743
|
-
var color=this.GetRandomColor(this.ChartPicture.BGColor, this.RandomBGColor);
|
|
744
753
|
|
|
745
|
-
this.ChartPicture.
|
|
754
|
+
if (this.ChartPicture.ClassName=="ChartDrawNote")
|
|
755
|
+
{
|
|
756
|
+
var color=this.GetRandomColor(this.ChartPicture.NoteBGColor, this.RandomBGColor);
|
|
757
|
+
this.ChartPicture.NoteBGColor=color;
|
|
758
|
+
}
|
|
759
|
+
else
|
|
760
|
+
{
|
|
761
|
+
var color=this.GetRandomColor(this.ChartPicture.BGColor, this.RandomBGColor);
|
|
762
|
+
this.ChartPicture.BGColor=color;
|
|
763
|
+
}
|
|
764
|
+
|
|
746
765
|
if (this.BGColorButton) this.BGColorButton.Span.style['color']=color;
|
|
747
766
|
if (this.HQChart.ChartDrawStorage) this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture); //保存下
|
|
748
767
|
|
|
@@ -764,7 +783,7 @@ function JSDialogModifyDraw()
|
|
|
764
783
|
|
|
765
784
|
var bShowLineColor=true, bShowBGColor=false, bShowFontColor=false;
|
|
766
785
|
var bgColor=null, fontColor=null;
|
|
767
|
-
var ARRAY_TEXT_CHART=['ChartDrawPriceLabel', "ChartDrawAnchoredText","ChartDrawPriceNote"
|
|
786
|
+
var ARRAY_TEXT_CHART=['ChartDrawPriceLabel', "ChartDrawAnchoredText","ChartDrawPriceNote"];
|
|
768
787
|
if (ARRAY_TEXT_CHART.includes(chart.ClassName))
|
|
769
788
|
{
|
|
770
789
|
bShowBGColor=true;
|
|
@@ -772,6 +791,13 @@ function JSDialogModifyDraw()
|
|
|
772
791
|
bgColor=chart.BGColor;
|
|
773
792
|
fontColor=chart.TextColor;
|
|
774
793
|
}
|
|
794
|
+
else if (chart.ClassName=="ChartDrawNote")
|
|
795
|
+
{
|
|
796
|
+
bShowBGColor=true;
|
|
797
|
+
bShowFontColor=true;
|
|
798
|
+
bgColor=chart.NoteBGColor;
|
|
799
|
+
fontColor=chart.NoteTextColor;
|
|
800
|
+
}
|
|
775
801
|
|
|
776
802
|
if (this.ColorButton)
|
|
777
803
|
{
|
package/src/jscommon/umychart.js
CHANGED
|
@@ -11785,6 +11785,7 @@ function AverageWidthFrame()
|
|
|
11785
11785
|
{
|
|
11786
11786
|
var text=IFrameSplitOperator.FormatDateString(kItem.Date,null);
|
|
11787
11787
|
if (ChartData.IsMinutePeriod(option.Period)) text+=" " + IFrameSplitOperator.FormatTimeString(kItem.Time, "HH:MM");
|
|
11788
|
+
else if (ChartData.IsMilliSecondPeriod(option.Period)) text+=" " + IFrameSplitOperator.FormatTimeString(kItem.Time, "HH:MM:SS.fff");
|
|
11788
11789
|
var textWidth=this.Canvas.measureText(text).width+2;
|
|
11789
11790
|
|
|
11790
11791
|
var textLeft=item.X-textWidth/2;
|
|
@@ -54402,7 +54403,7 @@ function IChartDrawPicture()
|
|
|
54402
54403
|
var isHScreen=this.Frame.IsHScreen;
|
|
54403
54404
|
if (isHScreen)
|
|
54404
54405
|
{
|
|
54405
|
-
for(var i
|
|
54406
|
+
for(var i=0; i<this.Point.length; ++i)
|
|
54406
54407
|
{
|
|
54407
54408
|
var item=this.Point[i];
|
|
54408
54409
|
var xValue=parseInt(this.Frame.GetXData(item.Y,false))+data.DataOffset;
|
|
@@ -54418,7 +54419,7 @@ function IChartDrawPicture()
|
|
|
54418
54419
|
}
|
|
54419
54420
|
else
|
|
54420
54421
|
{
|
|
54421
|
-
for(var i
|
|
54422
|
+
for(var i=0; i<this.Point.length; ++i)
|
|
54422
54423
|
{
|
|
54423
54424
|
var item=this.Point[i];
|
|
54424
54425
|
var xValue=parseInt(this.Frame.GetXData(item.X,false))+data.DataOffset;
|
|
@@ -60519,6 +60520,26 @@ function ChartDrawMonitorLine()
|
|
|
60519
60520
|
LineDash:[3,5],
|
|
60520
60521
|
}
|
|
60521
60522
|
|
|
60523
|
+
this.PointToValue_Backup=this.PointToValue;
|
|
60524
|
+
|
|
60525
|
+
this.PointToValue=function()
|
|
60526
|
+
{
|
|
60527
|
+
if (!this.PointToValue_Backup()) return false;
|
|
60528
|
+
|
|
60529
|
+
if (this.Frame.IsKLineFrame(false))
|
|
60530
|
+
{
|
|
60531
|
+
if (this.Frame.Identify===0)
|
|
60532
|
+
{
|
|
60533
|
+
var dataIndex=this.Value[0].XValue;
|
|
60534
|
+
var data=this.Frame.Data;
|
|
60535
|
+
var kItem=data.Data[dataIndex];
|
|
60536
|
+
this.Value[0].YValue=kItem.Close; //使用收盘价
|
|
60537
|
+
}
|
|
60538
|
+
}
|
|
60539
|
+
|
|
60540
|
+
return true;
|
|
60541
|
+
}
|
|
60542
|
+
|
|
60522
60543
|
this.SetOption=function(option)
|
|
60523
60544
|
{
|
|
60524
60545
|
if (option.LineColor) this.LineColor=option.LineColor;
|
|
@@ -682,7 +682,7 @@ function JSScrollBarChartContainer(uielement)
|
|
|
682
682
|
if (obj.Type==0)
|
|
683
683
|
{
|
|
684
684
|
var start=this.Frame.GetXData(obj.XStart);
|
|
685
|
-
start=parseInt(start);
|
|
685
|
+
start=parseInt(start+0.5); //四舍五入
|
|
686
686
|
var moveSetp=start-this.XOffsetData.Start;
|
|
687
687
|
|
|
688
688
|
this.XOffsetData.Start=start;
|
|
@@ -15677,6 +15677,7 @@ function AverageWidthFrame()
|
|
|
15677
15677
|
{
|
|
15678
15678
|
var text=IFrameSplitOperator.FormatDateString(kItem.Date,null);
|
|
15679
15679
|
if (ChartData.IsMinutePeriod(option.Period)) text+=" " + IFrameSplitOperator.FormatTimeString(kItem.Time, "HH:MM");
|
|
15680
|
+
else if (ChartData.IsMilliSecondPeriod(option.Period)) text+=" " + IFrameSplitOperator.FormatTimeString(kItem.Time, "HH:MM:SS.fff");
|
|
15680
15681
|
var textWidth=this.Canvas.measureText(text).width+2;
|
|
15681
15682
|
|
|
15682
15683
|
var textLeft=item.X-textWidth/2;
|
|
@@ -58294,7 +58295,7 @@ function IChartDrawPicture()
|
|
|
58294
58295
|
var isHScreen=this.Frame.IsHScreen;
|
|
58295
58296
|
if (isHScreen)
|
|
58296
58297
|
{
|
|
58297
|
-
for(var i
|
|
58298
|
+
for(var i=0; i<this.Point.length; ++i)
|
|
58298
58299
|
{
|
|
58299
58300
|
var item=this.Point[i];
|
|
58300
58301
|
var xValue=parseInt(this.Frame.GetXData(item.Y,false))+data.DataOffset;
|
|
@@ -58310,7 +58311,7 @@ function IChartDrawPicture()
|
|
|
58310
58311
|
}
|
|
58311
58312
|
else
|
|
58312
58313
|
{
|
|
58313
|
-
for(var i
|
|
58314
|
+
for(var i=0; i<this.Point.length; ++i)
|
|
58314
58315
|
{
|
|
58315
58316
|
var item=this.Point[i];
|
|
58316
58317
|
var xValue=parseInt(this.Frame.GetXData(item.X,false))+data.DataOffset;
|
|
@@ -64411,6 +64412,26 @@ function ChartDrawMonitorLine()
|
|
|
64411
64412
|
LineDash:[3,5],
|
|
64412
64413
|
}
|
|
64413
64414
|
|
|
64415
|
+
this.PointToValue_Backup=this.PointToValue;
|
|
64416
|
+
|
|
64417
|
+
this.PointToValue=function()
|
|
64418
|
+
{
|
|
64419
|
+
if (!this.PointToValue_Backup()) return false;
|
|
64420
|
+
|
|
64421
|
+
if (this.Frame.IsKLineFrame(false))
|
|
64422
|
+
{
|
|
64423
|
+
if (this.Frame.Identify===0)
|
|
64424
|
+
{
|
|
64425
|
+
var dataIndex=this.Value[0].XValue;
|
|
64426
|
+
var data=this.Frame.Data;
|
|
64427
|
+
var kItem=data.Data[dataIndex];
|
|
64428
|
+
this.Value[0].YValue=kItem.Close; //使用收盘价
|
|
64429
|
+
}
|
|
64430
|
+
}
|
|
64431
|
+
|
|
64432
|
+
return true;
|
|
64433
|
+
}
|
|
64434
|
+
|
|
64414
64435
|
this.SetOption=function(option)
|
|
64415
64436
|
{
|
|
64416
64437
|
if (option.LineColor) this.LineColor=option.LineColor;
|
|
@@ -132195,7 +132216,7 @@ function JSScrollBarChartContainer(uielement)
|
|
|
132195
132216
|
if (obj.Type==0)
|
|
132196
132217
|
{
|
|
132197
132218
|
var start=this.Frame.GetXData(obj.XStart);
|
|
132198
|
-
start=parseInt(start);
|
|
132219
|
+
start=parseInt(start+0.5); //四舍五入
|
|
132199
132220
|
var moveSetp=start-this.XOffsetData.Start;
|
|
132200
132221
|
|
|
132201
132222
|
this.XOffsetData.Start=start;
|
|
@@ -132885,7 +132906,7 @@ function ScrollBarBGChart()
|
|
|
132885
132906
|
|
|
132886
132907
|
|
|
132887
132908
|
|
|
132888
|
-
var HQCHART_VERSION="1.1.
|
|
132909
|
+
var HQCHART_VERSION="1.1.13334";
|
|
132889
132910
|
|
|
132890
132911
|
function PrintHQChartVersion()
|
|
132891
132912
|
{
|
|
@@ -15721,6 +15721,7 @@ function AverageWidthFrame()
|
|
|
15721
15721
|
{
|
|
15722
15722
|
var text=IFrameSplitOperator.FormatDateString(kItem.Date,null);
|
|
15723
15723
|
if (ChartData.IsMinutePeriod(option.Period)) text+=" " + IFrameSplitOperator.FormatTimeString(kItem.Time, "HH:MM");
|
|
15724
|
+
else if (ChartData.IsMilliSecondPeriod(option.Period)) text+=" " + IFrameSplitOperator.FormatTimeString(kItem.Time, "HH:MM:SS.fff");
|
|
15724
15725
|
var textWidth=this.Canvas.measureText(text).width+2;
|
|
15725
15726
|
|
|
15726
15727
|
var textLeft=item.X-textWidth/2;
|
|
@@ -58338,7 +58339,7 @@ function IChartDrawPicture()
|
|
|
58338
58339
|
var isHScreen=this.Frame.IsHScreen;
|
|
58339
58340
|
if (isHScreen)
|
|
58340
58341
|
{
|
|
58341
|
-
for(var i
|
|
58342
|
+
for(var i=0; i<this.Point.length; ++i)
|
|
58342
58343
|
{
|
|
58343
58344
|
var item=this.Point[i];
|
|
58344
58345
|
var xValue=parseInt(this.Frame.GetXData(item.Y,false))+data.DataOffset;
|
|
@@ -58354,7 +58355,7 @@ function IChartDrawPicture()
|
|
|
58354
58355
|
}
|
|
58355
58356
|
else
|
|
58356
58357
|
{
|
|
58357
|
-
for(var i
|
|
58358
|
+
for(var i=0; i<this.Point.length; ++i)
|
|
58358
58359
|
{
|
|
58359
58360
|
var item=this.Point[i];
|
|
58360
58361
|
var xValue=parseInt(this.Frame.GetXData(item.X,false))+data.DataOffset;
|
|
@@ -64455,6 +64456,26 @@ function ChartDrawMonitorLine()
|
|
|
64455
64456
|
LineDash:[3,5],
|
|
64456
64457
|
}
|
|
64457
64458
|
|
|
64459
|
+
this.PointToValue_Backup=this.PointToValue;
|
|
64460
|
+
|
|
64461
|
+
this.PointToValue=function()
|
|
64462
|
+
{
|
|
64463
|
+
if (!this.PointToValue_Backup()) return false;
|
|
64464
|
+
|
|
64465
|
+
if (this.Frame.IsKLineFrame(false))
|
|
64466
|
+
{
|
|
64467
|
+
if (this.Frame.Identify===0)
|
|
64468
|
+
{
|
|
64469
|
+
var dataIndex=this.Value[0].XValue;
|
|
64470
|
+
var data=this.Frame.Data;
|
|
64471
|
+
var kItem=data.Data[dataIndex];
|
|
64472
|
+
this.Value[0].YValue=kItem.Close; //使用收盘价
|
|
64473
|
+
}
|
|
64474
|
+
}
|
|
64475
|
+
|
|
64476
|
+
return true;
|
|
64477
|
+
}
|
|
64478
|
+
|
|
64458
64479
|
this.SetOption=function(option)
|
|
64459
64480
|
{
|
|
64460
64481
|
if (option.LineColor) this.LineColor=option.LineColor;
|
|
@@ -134645,7 +134666,7 @@ function JSScrollBarChartContainer(uielement)
|
|
|
134645
134666
|
if (obj.Type==0)
|
|
134646
134667
|
{
|
|
134647
134668
|
var start=this.Frame.GetXData(obj.XStart);
|
|
134648
|
-
start=parseInt(start);
|
|
134669
|
+
start=parseInt(start+0.5); //四舍五入
|
|
134649
134670
|
var moveSetp=start-this.XOffsetData.Start;
|
|
134650
134671
|
|
|
134651
134672
|
this.XOffsetData.Start=start;
|
|
@@ -136425,8 +136446,18 @@ function JSDialogModifyDraw()
|
|
|
136425
136446
|
{
|
|
136426
136447
|
if (!this.ChartPicture || !this.HQChart) return;
|
|
136427
136448
|
|
|
136428
|
-
|
|
136429
|
-
this.ChartPicture.
|
|
136449
|
+
|
|
136450
|
+
if (this.ChartPicture.ClassName=="ChartDrawNote")
|
|
136451
|
+
{
|
|
136452
|
+
var color=this.GetRandomColor(this.ChartPicture.NoteTextColor, this.RandomFontColor);
|
|
136453
|
+
this.ChartPicture.NoteTextColor=color;
|
|
136454
|
+
}
|
|
136455
|
+
else
|
|
136456
|
+
{
|
|
136457
|
+
var color=this.GetRandomColor(this.ChartPicture.TextColor, this.RandomFontColor);
|
|
136458
|
+
this.ChartPicture.TextColor=color;
|
|
136459
|
+
}
|
|
136460
|
+
|
|
136430
136461
|
|
|
136431
136462
|
if (this.FontColorButton) this.FontColorButton.Span.style['color']=color;
|
|
136432
136463
|
|
|
@@ -136438,9 +136469,18 @@ function JSDialogModifyDraw()
|
|
|
136438
136469
|
this.ModifyBGColor=function()
|
|
136439
136470
|
{
|
|
136440
136471
|
if (!this.ChartPicture || !this.HQChart) return;
|
|
136441
|
-
var color=this.GetRandomColor(this.ChartPicture.BGColor, this.RandomBGColor);
|
|
136442
136472
|
|
|
136443
|
-
this.ChartPicture.
|
|
136473
|
+
if (this.ChartPicture.ClassName=="ChartDrawNote")
|
|
136474
|
+
{
|
|
136475
|
+
var color=this.GetRandomColor(this.ChartPicture.NoteBGColor, this.RandomBGColor);
|
|
136476
|
+
this.ChartPicture.NoteBGColor=color;
|
|
136477
|
+
}
|
|
136478
|
+
else
|
|
136479
|
+
{
|
|
136480
|
+
var color=this.GetRandomColor(this.ChartPicture.BGColor, this.RandomBGColor);
|
|
136481
|
+
this.ChartPicture.BGColor=color;
|
|
136482
|
+
}
|
|
136483
|
+
|
|
136444
136484
|
if (this.BGColorButton) this.BGColorButton.Span.style['color']=color;
|
|
136445
136485
|
if (this.HQChart.ChartDrawStorage) this.HQChart.ChartDrawStorage.SaveDrawData(this.ChartPicture); //保存下
|
|
136446
136486
|
|
|
@@ -136462,7 +136502,7 @@ function JSDialogModifyDraw()
|
|
|
136462
136502
|
|
|
136463
136503
|
var bShowLineColor=true, bShowBGColor=false, bShowFontColor=false;
|
|
136464
136504
|
var bgColor=null, fontColor=null;
|
|
136465
|
-
var ARRAY_TEXT_CHART=['ChartDrawPriceLabel', "ChartDrawAnchoredText","ChartDrawPriceNote"
|
|
136505
|
+
var ARRAY_TEXT_CHART=['ChartDrawPriceLabel', "ChartDrawAnchoredText","ChartDrawPriceNote"];
|
|
136466
136506
|
if (ARRAY_TEXT_CHART.includes(chart.ClassName))
|
|
136467
136507
|
{
|
|
136468
136508
|
bShowBGColor=true;
|
|
@@ -136470,6 +136510,13 @@ function JSDialogModifyDraw()
|
|
|
136470
136510
|
bgColor=chart.BGColor;
|
|
136471
136511
|
fontColor=chart.TextColor;
|
|
136472
136512
|
}
|
|
136513
|
+
else if (chart.ClassName=="ChartDrawNote")
|
|
136514
|
+
{
|
|
136515
|
+
bShowBGColor=true;
|
|
136516
|
+
bShowFontColor=true;
|
|
136517
|
+
bgColor=chart.NoteBGColor;
|
|
136518
|
+
fontColor=chart.NoteTextColor;
|
|
136519
|
+
}
|
|
136473
136520
|
|
|
136474
136521
|
if (this.ColorButton)
|
|
136475
136522
|
{
|
|
@@ -136668,7 +136715,7 @@ function HQChartScriptWorker()
|
|
|
136668
136715
|
|
|
136669
136716
|
|
|
136670
136717
|
|
|
136671
|
-
var HQCHART_VERSION="1.1.
|
|
136718
|
+
var HQCHART_VERSION="1.1.13334";
|
|
136672
136719
|
|
|
136673
136720
|
function PrintHQChartVersion()
|
|
136674
136721
|
{
|