diff --git a/umychart_uniapp_h5/umychart.uniapp.h5.js b/umychart_uniapp_h5/umychart.uniapp.h5.js index 69ee6c84..9ba5d999 100644 --- a/umychart_uniapp_h5/umychart.uniapp.h5.js +++ b/umychart_uniapp_h5/umychart.uniapp.h5.js @@ -4660,10 +4660,10 @@ function JSChart(divElement, bOffscreen, bCacheCanvas) } var frame=chart.Frame.SubFrame[i].Frame; - if (item.Modify!=null) frame.ModifyIndex=item.Modify; - if (item.Change!=null) frame.ChangeIndex=item.Change; - if (item.Close!=null) frame.CloseIndex=item.Close; - if (item.Overlay!=null) frame.OverlayIndex=item.Overlay; + if (IFrameSplitOperator.IsBool(item.Modify)) frame.ModifyIndex=item.Modify; + if (IFrameSplitOperator.IsBool(item.Change)) frame.ChangeIndex=item.Change; + if (IFrameSplitOperator.IsBool(item.Close)) frame.CloseIndex=item.Close; + if (IFrameSplitOperator.IsBool(item.Overlay)) frame.OverlayIndex=item.Overlay; if (IFrameSplitOperator.IsBool(item.Export)) frame.ExportData=item.Export; if (IFrameSplitOperator.IsBool(item.MaxMin)) chart.Frame.SubFrame[i].Frame.MaxMinWindow=item.MaxMin; if (IFrameSplitOperator.IsBool(item.TitleWindow)) chart.Frame.SubFrame[i].Frame.TitleWindow=item.TitleWindow; @@ -5089,10 +5089,10 @@ function JSChart(divElement, bOffscreen, bCacheCanvas) } var frame=chart.Frame.SubFrame[index].Frame; - if (item.Modify!=null) frame.ModifyIndex=item.Modify; - if (item.Change!=null) frame.ChangeIndex=item.Change; - if (item.Close!=null) frame.CloseIndex=item.Close; - if (item.Overlay!=null) frame.OverlayIndex=item.Overlay; + if (IFrameSplitOperator.IsBool(item.Modify)) frame.ModifyIndex=item.Modify; + if (IFrameSplitOperator.IsBool(item.Change)) frame.ChangeIndex=item.Change; + if (IFrameSplitOperator.IsBool(item.Close)) frame.CloseIndex=item.Close; + if (IFrameSplitOperator.IsBool(item.Overlay)) frame.OverlayIndex=item.Overlay; if (IFrameSplitOperator.IsBool(item.Export)) frame.ExportData=item.Export; if (IFrameSplitOperator.IsBool(item.MaxMin)) frame.MaxMinWindow=item.MaxMin; if (IFrameSplitOperator.IsBool(item.TitleWindow)) frame.TitleWindow=item.TitleWindow; @@ -6526,6 +6526,8 @@ var JSCHART_EVENT_ID= ON_CREATE_FRAME:105, ON_DELETE_FRAME:106, ON_SIZE_FRAME:107, + + ON_TOUCH_SCROLL_UP_DOWN:108, //页面上下滚动 手机端 } var JSCHART_OPERATOR_ID= @@ -14917,12 +14919,13 @@ function MinuteFrame() this.ReDrawToolbar=false; this.DayCount=1; //显示天数 - this.ModifyIndex=true; //是否显示'改参数'菜单 - this.ChangeIndex=true; //是否显示'换指标'菜单 - this.CloseIndex=true; //是否显示'关闭指标窗口'菜单 - this.MaxMinWindow=true; - this.TitleWindow=true; - this.ExportData=false; //是否显示'导出数据'菜单 + this.ModifyIndex=g_JSChartResource.MinuteToolbar.ModifyIndex; //是否显示'改参数'菜单 + this.ChangeIndex=g_JSChartResource.MinuteToolbar.ChangeIndex; //是否显示'换指标'菜单 + this.CloseIndex=g_JSChartResource.MinuteToolbar.CloseIndex; //是否显示'关闭指标窗口'菜单 + this.MaxMinWindow=g_JSChartResource.MinuteToolbar.MaxMinWindow; + this.TitleWindow=g_JSChartResource.MinuteToolbar.TitleWindow; + this.ExportData=g_JSChartResource.MinuteToolbar.ExportData; //是否显示'导出数据'菜单 + this.OverlayIndex=g_JSChartResource.MinuteToolbar.OverlayIndex; //是否显示叠加指标 this.ModifyIndexEvent; //改参数 点击事件 this.ChangeIndexEvent; //换指标 点击事件 @@ -17012,13 +17015,13 @@ function KLineFrame() this.ClassName='KLineFrame'; this.ToolbarID=Guid(); //工具条Div id - this.ModifyIndex=true; //是否显示'改参数'菜单 - this.ChangeIndex=true; //是否显示'换指标'菜单 - this.CloseIndex=true; //是否显示'关闭指标窗口'菜单 - this.OverlayIndex=false; //是否显示叠加指标 - this.MaxMinWindow=true; - this.TitleWindow=true; - this.ExportData=false; //是否显示'导出数据'菜单 + this.ModifyIndex=g_JSChartResource.KLineToolbar.ModifyIndex; //是否显示'改参数'菜单 + this.ChangeIndex=g_JSChartResource.KLineToolbar.ChangeIndex; //是否显示'换指标'菜单 + this.CloseIndex=g_JSChartResource.KLineToolbar.CloseIndex; //是否显示'关闭指标窗口'菜单 + this.OverlayIndex=g_JSChartResource.KLineToolbar.OverlayIndex; //是否显示叠加指标 + this.MaxMinWindow=g_JSChartResource.KLineToolbar.MaxMinWindow; + this.TitleWindow=g_JSChartResource.KLineToolbar.TitleWindow; + this.ExportData=g_JSChartResource.KLineToolbar.ExportData; //是否显示'导出数据'菜单 this.ModifyIndexEvent; //改参数 点击事件 this.ChangeIndexEvent; //换指标 点击事件 @@ -18193,8 +18196,8 @@ function OverlayKLineFrame() this.IsCalculateYMaxMin=true; //是否计算Y最大最小值 this.RightOffset=50; this.PenBorder=g_JSChartResource.OverlayFrame.BolderPen; //'rgb(0,0,0)' - this.IsShow=true; //坐标是否显示 - this.IsShowToolbar=true; //是否显示工具条 + this.IsShow=g_JSChartResource.KLineToolbar.IsShowOverlayFrame; //坐标是否显示 + this.IsShowToolbar=g_JSChartResource.KLineToolbar.IsShowOverlayToolbar; //是否显示工具条 this.Title=null; this.TitleColor=g_JSChartResource.OverlayFrame.TitleColor; this.TitleFont=g_JSChartResource.OverlayFrame.TitleFont; @@ -32726,7 +32729,7 @@ function ChartVolStick() var barColor=this.GetBarColor(kItem); this.Canvas.strokeStyle=barColor.Color; - var x=this.ChartFrame.GetXFromIndex(j); + //var x=this.ChartFrame.GetXFromIndex(j); this.Canvas.beginPath(); this.Canvas.moveTo(ToFixedPoint(x),y); this.Canvas.lineTo(ToFixedPoint(x),yBottom); @@ -32796,7 +32799,7 @@ function ChartVolStick() var bUp=barColor.IsUp; this.Canvas.strokeStyle=barColor.Color; - var x=this.ChartFrame.GetXFromIndex(j); + //var x=this.ChartFrame.GetXFromIndex(j); this.Canvas.beginPath(); this.Canvas.moveTo(y,ToFixedPoint(x)); this.Canvas.lineTo(yBottom,ToFixedPoint(x)); @@ -44570,6 +44573,8 @@ function BackgroundPaint() { if (isMinutePeriod) { + if (item.End.Date=kLineMap.End.Time) ) { xRight=kLineMap.End.Right; @@ -44591,6 +44596,8 @@ function BackgroundPaint() } else { + if (item.End.Date=kLineMap.End.Time) ) { xRight=kLineMap.End.Right; @@ -40516,6 +40521,8 @@ function BackgroundPaint() } else { + if (item.End.Date=kLineMap.End.Time) ) { xRight=kLineMap.End.Right; @@ -44635,6 +44640,8 @@ function BackgroundPaint() } else { + if (item.End.Date=kLineMap.End.Time) ) { xRight=kLineMap.End.Right; @@ -40516,6 +40521,8 @@ function BackgroundPaint() } else { + if (item.End.Date=kLineMap.End.Time) ) { xRight=kLineMap.End.Right; @@ -40516,6 +40521,8 @@ function BackgroundPaint() } else { + if (item.End.Date0) chart.ZoomStepPixel=option.ZoomStepPixel; if (IFrameSplitOperator.IsNumber(option.DrawMoveWaitTime)) chart.DrawMoveWaitTime=option.DrawMoveWaitTime; if (IFrameSplitOperator.IsNumber(option.PressTime)) chart.PressTime=option.PressTime; @@ -596,7 +598,8 @@ function JSChart(element) var windowsCount = 2; if (option.Windows && option.Windows.length > 0) windowsCount += option.Windows.length; //指标窗口从第3个窗口开始 - if (option.EnableScrollUpDown==true) chart.EnableScrollUpDown=option.EnableScrollUpDown; + if (option.TouchMoveMinAngle) chart.TouchMoveMinAngle=option.TouchMoveMinAngle; + if (IFrameSplitOperator.IsBool(option.EnableScrollUpDown)) chart.EnableScrollUpDown=option.EnableScrollUpDown; if (option.Info && option.Info.length > 0) chart.SetMinuteInfo(option.Info, false); if (IFrameSplitOperator.IsString(option.SplashTitle)) chart.LoadDataSplashTitle = option.SplashTitle; //设置提示信息内容 @@ -1481,6 +1484,7 @@ function JSChartContainer(uielement) this.LastPoint = new Point(); //鼠标位置 this.IsForceLandscape = false; //是否强制横屏 this.CorssCursorTouchEnd = false; //手离开屏幕自动隐藏十字光标 + this.TouchMoveMinAngle=70; //左右移动最小角度 this.EnableAnimation = false; //是否开启动画 //坐标轴风格方法 double-更加数值型分割 price-更加股票价格分割 @@ -1633,6 +1637,14 @@ function JSChartContainer(uielement) return touchCount==1; } + this.GetMoveAngle=function(pt,pt2) //计算角度 + { + var xMove=Math.abs(pt.X-pt2.X); + var yMove=Math.abs(pt.Y-pt2.Y); + var angle=Math.atan(xMove/yMove)*180/Math.PI; + return angle; + } + this.GetToucheData = function (e, isForceLandscape) { var touches = new Array(); @@ -1813,6 +1825,27 @@ function JSChartContainer(uielement) } else if (jsChart.DragMode == 1) //数据左右拖拽 { + var moveAngle=this.GetMoveAngle(drag.LastMove,{X:touches[0].clientX, Y:touches[0].clientY}); + var moveUpDown=Math.abs(drag.LastMove.Y-touches[0].clientY); + + if ( ((moveUpDown>0 && moveSetp<=3) || moveAngle<=this.TouchMoveMinAngle) && this.EnableScrollUpDown==true ) + { + var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_TOUCH_SCROLL_UP_DOWN); + var isEnd=true; //是否退出 + if (event && event.Callback) + { + var sendData={ DragData:drag, PreventDefault:false }; + event.Callback(event, sendData, this); + isEnd=(sendData.PreventDefault===false); + } + + if (isEnd) + { + this.ClearTouchTimer(); + return; + } + } + if (moveSetp < 5) return; var isLeft = true; if (drag.LastMove.X < touches[0].clientX) isLeft = false;//右移数据 @@ -8064,7 +8097,7 @@ function MinuteChartContainer(uielement) var jsChart = this; var drag = jsChart.MouseDrag; var touches = this.GetToucheData(e, jsChart.IsForceLandscape); - if (this.ChartCorssCursor.IsShow === true && this.IsPhoneDragging(e)) + if (this.IsPhoneDragging(e)) { if (drag == null) { @@ -8080,6 +8113,32 @@ function MinuteChartContainer(uielement) this.DrawMoveTimer=null; }, this.DrawMoveWaitTime); } + 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); + + //上下滚动 + if ( ((moveUpDown>0 && moveSetp<=3) || moveAngle<=this.TouchMoveMinAngle) && this.EnableScrollUpDown==true ) + { + var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_TOUCH_SCROLL_UP_DOWN); + var isEnd=true; //是否退出 + if (event && event.Callback) + { + var sendData={ DragData:drag, PreventDefault:false }; + event.Callback(event, sendData, this); + isEnd=(sendData.PreventDefault===false); + } + + if (isEnd) + { + this.ClearTouchTimer(); + return; + } + } + } } else if (this.IsPhonePinching(e)) { @@ -8118,7 +8177,6 @@ function MinuteChartContainer(uielement) if (drag!=null) { - //TODO:上下滚动 this.ClearTouchTimer(); this.MouseDrag=null;