hqchart 1.1.12572 → 1.1.12580
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 +12 -10
- package/package.json +1 -1
- package/src/jscommon/umychart.js +46 -14
- package/src/jscommon/umychart.style.js +1 -1
- package/src/jscommon/umychart.testdata/if2312.cf.msecond.js +295412 -0
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +48 -16
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +48 -16
- package/src/jscommon/umychart.wechat/umychart.version.wechat.js +1 -1
- package/src/jscommon/umychart.wechat/umychart.wechat.3.0.js +7 -3
package/lib/umychart.vue.js
CHANGED
|
@@ -1686,6 +1686,7 @@ uielement.parentNode.appendChild(this.SelectRect);//区间选择右键菜单
|
|
|
1686
1686
|
this.SelectRectRightMenu;//坐标轴风格方法 double-更加数值型分割 price-更加股票价格分割
|
|
1687
1687
|
this.FrameSplitData=new _map2.default();this.FrameSplitData.set("double",new SplitData());this.FrameSplitData.set("price",new PriceSplitData());//事件回调
|
|
1688
1688
|
this.mapEvent=new _map2.default();//通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
|
|
1689
|
+
this.PhonePinch=null;//手机双指操作信息
|
|
1689
1690
|
this.IsOnTouch=false;//是否再操作数据
|
|
1690
1691
|
this.TouchDrawCount=0;//手势绘制次数
|
|
1691
1692
|
this.DisableMouse=false;//禁止鼠标事件
|
|
@@ -1811,7 +1812,7 @@ var self=this;this.DragTimer=setTimeout(function(){if(drag.Click.X==drag.LastMov
|
|
|
1811
1812
|
if(self.EnableClickModel===true)self.ClickModel.IsShowCorssCursor=true;self.MoveCorssCursor(drag.Click,e);//移动十字光标
|
|
1812
1813
|
}},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)
|
|
1813
1814
|
}else if(this.VerticalDrag){if(!this.VerticalDrag.IsDrag)this.MoveCorssCursor(drag.Click,e);//没有点击X轴, 就显示十字光标
|
|
1814
|
-
}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={
|
|
1815
|
+
}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计算
|
|
1815
1816
|
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;//是否移动十字光标
|
|
1816
1817
|
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}`);
|
|
1817
1818
|
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)//画图工具移动
|
|
@@ -1819,9 +1820,9 @@ if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if
|
|
|
1819
1820
|
{var mouseDrag=this.MouseDrag;this.MouseDrag=null;this.MoveCorssCursor(drag.Click,e);//移动十字光标
|
|
1820
1821
|
}else if(this.DragMode==1||isMoveCorssCursor==false)//数据左右拖拽
|
|
1821
1822
|
{if((moveUpDown>0&&moveSetp<=3||moveAngle<=this.TouchMoveMinAngle)&&this.EnableScrollUpDown==true){this.StopDragTimer();return;}if(moveSetp<5||moveAngle<=this.TouchMoveMinAngle){this.PreventTouchEvent(e);return;}if(this.EnableVerticalDrag){if(!this.VerticalDrag)return;if(!this.VerticalDrag.IsDrag)return;}var isLeft=true;if(drag.LastMove.X<touches[0].clientX)isLeft=false;//右移数据
|
|
1822
|
-
var oneStepWidth=this.GetMoveOneStepWidth();if(moveSetp<oneStepWidth)return;if(this.DataMove(moveSetp,isLeft)){this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.ResetFrameXYSplit();this.Draw();this.OnKLinePageChange("OnTouchMove");}else{if(this.DragDownloadData)this.DragDownloadData();}drag.LastMove.X=touches[0].clientX;drag.LastMove.Y=touches[0].clientY;}}if(this.PhoneTouchInfo){this.PhoneTouchInfo.End.X=touches[0].clientX;this.PhoneTouchInfo.End.Y=touches[0].clientY;}}else if(this.IsPhonePinching(e)){if(this.DragMode==JSCHART_DRAG_ID.DISABLE_DRAG_ID)return;this.PreventTouchEvent(e);var phonePinch=this.PhonePinch;if(!phonePinch)return;if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Touch===false)return;var yHeight=Math.abs(touches[0].pageY-touches[1].pageY);var yLastHeight=Math.abs(phonePinch.Last.Y-phonePinch.Last.Y2);var yStep=yHeight-yLastHeight;var xHeight=Math.abs(touches[0].pageX-touches[1].pageX);var xLastHeight=Math.abs(phonePinch.Last.X-phonePinch.Last.X2);var xStep=xHeight-xLastHeight;var minStep=this.ZoomStepPixel;if(Math.abs(yStep)<minStep&&Math.abs(xStep)<minStep)return;var step=yStep;if(Math.abs(yStep)<minStep)step=xStep;if(step>0)//放大
|
|
1823
|
-
{var cursorIndex={IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(!this.Frame.ZoomUp(cursorIndex))return;this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.StopDragTimer();}else//缩小
|
|
1824
|
-
{var cursorIndex={IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(!this.Frame.ZoomDown(cursorIndex))return;this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.StopDragTimer();}phonePinch.Last={
|
|
1823
|
+
var oneStepWidth=this.GetMoveOneStepWidth();if(moveSetp<oneStepWidth)return;if(this.DataMove(moveSetp,isLeft)){this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.ResetFrameXYSplit();this.Draw();this.OnKLinePageChange("OnTouchMove");}else{if(this.DragDownloadData)this.DragDownloadData();}drag.LastMove.X=touches[0].clientX;drag.LastMove.Y=touches[0].clientY;}}if(this.PhoneTouchInfo){this.PhoneTouchInfo.End.X=touches[0].clientX;this.PhoneTouchInfo.End.Y=touches[0].clientY;}}else if(this.IsPhonePinching(e)){if(this.DragMode==JSCHART_DRAG_ID.DISABLE_DRAG_ID)return;this.PreventTouchEvent(e);var phonePinch=this.PhonePinch;if(!phonePinch)return;phonePinch.Operator=null;if(this.EnableZoomUpDown&&this.EnableZoomUpDown.Touch===false)return;var yHeight=Math.abs(touches[0].pageY-touches[1].pageY);var yLastHeight=Math.abs(phonePinch.Last.Y-phonePinch.Last.Y2);var yStep=yHeight-yLastHeight;var xHeight=Math.abs(touches[0].pageX-touches[1].pageX);var xLastHeight=Math.abs(phonePinch.Last.X-phonePinch.Last.X2);var xStep=xHeight-xLastHeight;var minStep=this.ZoomStepPixel;if(Math.abs(yStep)<minStep&&Math.abs(xStep)<minStep)return;var step=yStep;if(Math.abs(yStep)<minStep)step=xStep;if(step>0)//放大
|
|
1824
|
+
{var cursorIndex={IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(!this.Frame.ZoomUp(cursorIndex))return;phonePinch.Operator="ZoomUp";this.CursorIndex=cursorIndex.Index;this.UpdatePointByCursorIndex();this.UpdataDataoffset();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.StopDragTimer();}else//缩小
|
|
1825
|
+
{var cursorIndex={IsLockRight:this.IsZoomLockRight};cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));if(!this.Frame.ZoomDown(cursorIndex))return;phonePinch.Operator="ZoomDown";this.CursorIndex=cursorIndex.Index;this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.StopDragTimer();}phonePinch.Last={X:touches[0].pageX,Y:touches[0].pageY,X2:touches[1].pageX,Y2:touches[1].pageY};}this.PreventTouchEvent(e);};this.OnTouchEnd=function(e){JSConsole.Chart.Log('[KLineChartContainer:OnTouchEnd]',e);if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var bClearDrawPicture=true;if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==2||drawPicture.Status==1||drawPicture.Status==3){drawPicture.PointStatus=drawPicture.Status;if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo();else bClearDrawPicture=false;}else if(drawPicture.Status==20){if(this.FinishMoveChartDrawPicture())this.DrawDynamicInfo();}}if(this.EnableZoomIndexWindow){var time=Date.now();this.PhoneDBClick.AddTouchEnd(time);if(this.PhoneDBClick.IsVaildDBClick()){this.OnTouchDBClick(this.PhoneDBClick.Start);this.PhoneDBClick.Clear();}}this.IsOnTouch=false;this.VerticalDrag=null;if(bClearDrawPicture===true)this.CurrentChartDrawPicture=null;this.StopDragTimer();this.TouchEvent({EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH,FunctionName:"OnTouchEnd"},e);this.OnTouchFinished();this.TouchDrawCount=0;this.PhonePinch=null;};this.OnTouchDBClick=function(points){var pt=this.PointAbsoluteToRelative(points[0].X,points[0].Y,true);var x=pt.X,y=pt.Y;JSConsole.Chart.Log('[KLineChartContainer:OnTouchDBClick] Phone dbclick absolute ['+x+','+y+'], soruce ['+points[0].X+','+points[0].Y+']');var frameId=this.Frame.PtInFrame(x,y);JSConsole.Chart.Log("[KLineChartContainer::OnTouchDBClick] frameId",frameId);if(frameId>=this.Frame.ZoomStartWindowIndex){if(this.ZoomIndexWindow(frameId,{X:x,Y:y})){this.Frame.SetSizeChage(true);this.Draw();return true;}}};//手势事件
|
|
1825
1826
|
this.TouchEvent=function(obj,e){var eventID=obj.EventID;var event=this.GetEventCallback(eventID);if(!event||!event.Callback)return false;var drag=this.PhoneTouchInfo;if(!drag||!drag.Start||!drag.End)return false;var pixelTatio=GetDevicePixelRatio();var clientX=drag.End.X/pixelTatio;var clientY=drag.End.Y/pixelTatio;var x=drag.End.X-this.UIElement.getBoundingClientRect().left*pixelTatio;var y=drag.End.Y-this.UIElement.getBoundingClientRect().top*pixelTatio;var data={X:clientX,Y:clientY,FrameID:-1,FunctionName:obj.FunctionName,Drag:{Start:{X:drag.Start.X/pixelTatio,Y:drag.Start.Y/pixelTatio},End:{X:drag.End.X/pixelTatio,Y:drag.End.Y/pixelTatio}}};var isInClient=false;this.Canvas.beginPath();this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());isInClient=this.Canvas.isPointInPath(x,y);if(isInClient){if(this.Frame&&this.Frame.IsHScreen){var yValueExtend={};var yValue=this.Frame.GetYData(x,yValueExtend);if(IFrameSplitOperator.IsNumber(yValueExtend.FrameID)&&yValueExtend.FrameID>=0){var xValue=this.Frame.GetXData(y);data.FrameID=yValueExtend.FrameID;data.Data={X:xValue,Y:yValue};}}else{var yValueExtend={};var yValue=this.Frame.GetYData(y,yValueExtend);if(IFrameSplitOperator.IsNumber(yValueExtend.FrameID)&&yValueExtend.FrameID>=0){var xValue=this.Frame.GetXData(x);data.FrameID=yValueExtend.FrameID;data.Data={X:xValue,Y:yValue};}}}event.Callback(event,data,this);return true;};this.MoveCorssCursor=function(point,e){var pixelTatio=GetDevicePixelRatio();var x=point.X-this.UIElement.getBoundingClientRect().left*pixelTatio;var y=point.Y-this.UIElement.getBoundingClientRect().top*pixelTatio;if(this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID)this.TouchStatus.CorssCursorShow=true;//十字显示
|
|
1826
1827
|
this.OnMouseMove(x,y,e,true);};this.DrawEmpty=function(){if(this.UIElement.width<=0||this.UIElement.height<=0)return;this.Canvas.clearRect(0,0,this.UIElement.width,this.UIElement.height);if(this.Frame){this.Frame.ScreenImageData=null;this.Frame.Draw();}};this.PtInChart=function(x,y){var result=null;for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.PtInChart)continue;if(item.IsHideScriptIndex())continue;result=item.PtInChart(x,y);if(result)return result;}for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];if(!item.PtInChart)continue;result=item.PtInChart(x,y);if(result)return result;}if(this.Frame.PtInOveralyChart){result=this.Frame.PtInOveralyChart(x,y);if(result)return result;}return null;};//绘制选中图形的状态
|
|
1827
1828
|
this.DrawSelectedStatus=function(){if(!this.SelectedChart.MoveOn.Identify&&!this.SelectedChart.Selected.Identify)return;for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.Identify)continue;if(item.Identify!=this.SelectedChart.MoveOn.Identify&&item.Identify!=this.SelectedChart.Selected.Identify)continue;if(item.DrawSelectedStatus)item.DrawSelectedStatus();}for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];if(!item.Identify)continue;if(item.Identify!=this.SelectedChart.MoveOn.Identify&&item.Identify!=this.SelectedChart.Selected.Identify)continue;if(item.DrawSelectedStatus)item.DrawSelectedStatus();}for(var i=0;i<this.OverlayChartPaint.length;++i){var item=this.OverlayChartPaint[i];if(!item.Identify)continue;if(item.Identify!=this.SelectedChart.MoveOn.Identify&&item.Identify!=this.SelectedChart.Selected.Identify)continue;if(item.DrawSelectedStatus)item.DrawSelectedStatus();}if(this.Frame.DrawOveralySelectedStatus)this.Frame.DrawOveralySelectedStatus(this.SelectedChart);};this.SetCanvas=function(canvas){if(this.Frame){var subFrame=this.Frame.SubFrame;for(var i=0;i<subFrame.length;++i){var item=subFrame[i];item.Frame.Canvas=canvas;//框架
|
|
@@ -4342,7 +4343,7 @@ var aryText=[];var result={AryText:aryText};var text,title,color;text=IFrameSpli
|
|
|
4342
4343
|
{title=g_JSChartLocalization.GetText('Tooltip-High',this.LanguageID);color=this.KLineTitlePaint.GetColor(item.High,item.YClose);text=item.High.toFixed(defaultfloatPrecision);aryText.push({Title:title,TitleColor:this.TitleColor,Text:text,Color:color});}if(IFrameSplitOperator.IsNumber(item.Low))//低
|
|
4343
4344
|
{title=g_JSChartLocalization.GetText('Tooltip-Low',this.LanguageID);color=this.KLineTitlePaint.GetColor(item.Low,item.YClose);text=item.Low.toFixed(defaultfloatPrecision);aryText.push({Title:title,TitleColor:this.TitleColor,Text:text,Color:color});}if(IFrameSplitOperator.IsNumber(item.Close))//收
|
|
4344
4345
|
{title=g_JSChartLocalization.GetText('Tooltip-Close',this.LanguageID);color=this.KLineTitlePaint.GetColor(item.Close,item.YClose);text=item.Close.toFixed(defaultfloatPrecision);aryText.push({Title:title,TitleColor:this.TitleColor,Text:text,Color:color});}//涨幅
|
|
4345
|
-
title=g_JSChartLocalization.GetText('Tooltip-Increase',this.LanguageID);if(item.YFClose
|
|
4346
|
+
title=g_JSChartLocalization.GetText('Tooltip-Increase',this.LanguageID);if(IFrameSplitOperator.IsNumber(item.YFClose)&&MARKET_SUFFIX_NAME.IsChinaFutures(upperSymbol)){var value=(item.Close-item.YFClose)/item.YFClose*100;color=this.KLineTitlePaint.GetColor(value,0);text=value.toFixed(2)+'%';}else if(IFrameSplitOperator.IsNumber(item.YClose)){var value=(item.Close-item.YClose)/item.YClose*100;color=this.KLineTitlePaint.GetColor(value,0);text=value.toFixed(2)+'%';}else{text='--.--';color=this.KLineTitlePaint.GetColor(0,0);}aryText.push({Title:title,TitleColor:this.TitleColor,Text:text,Color:color});if(IFrameSplitOperator.IsNumber(item.Vol)){title=g_JSChartLocalization.GetText('Tooltip-Vol',this.LanguageID);var vol=item.Vol;if(upperSymbol&&MARKET_SUFFIX_NAME.IsSHSZ(upperSymbol))vol/=100;//A股统一转成手
|
|
4346
4347
|
text=IFrameSplitOperator.FromatIntegerString(vol,2,this.LanguageID);aryText.push({Title:title,TitleColor:this.TitleColor,Text:text,Color:this.VolColor});}if(IFrameSplitOperator.IsNumber(item.Amount)){title=g_JSChartLocalization.GetText('Tooltip-Amount',this.LanguageID);var text=IFrameSplitOperator.FormatValueString(item.Amount,2,this.LanguageID);aryText.push({Title:title,TitleColor:this.TitleColor,Text:text,Color:this.AmountColor});}//换手率
|
|
4347
4348
|
if(MARKET_SUFFIX_NAME.IsSHSZStockA(this.HQChart.Symbol)&&item.FlowCapital>0){title=g_JSChartLocalization.GetText('Tooltip-Exchange',this.LanguageID);var value=item.Vol/item.FlowCapital*100;var text=value.toFixed(2)+'%';aryText.push({Title:title,TitleColor:this.TitleColor,Text:text,Color:this.TitleColor});}//持仓量
|
|
4348
4349
|
if(MARKET_SUFFIX_NAME.IsFutures(upperSymbol)&&IFrameSplitOperator.IsNumber(item.Position)){title=g_JSChartLocalization.GetText('Tooltip-Position',this.LanguageID);var text=IFrameSplitOperator.FromatIntegerString(item.Position,2,this.LanguageID);aryText.push({Title:title,TitleColor:this.TitleColor,Text:text,Color:this.TitleColor});}return result;};this.DrawTooltipData=function(titleData){if(!titleData||!IFrameSplitOperator.IsNonEmptyArray(titleData.AryText))return;var pixelRatio=GetDevicePixelRatio();var left=this.GetLeft()+2*pixelRatio;var top=this.GetTop()+3*pixelRatio;if(this.IsHScreen){this.Canvas.save();var x=this.GetLeft()+this.Height,y=this.GetTop();this.Canvas.translate(x,y);this.Canvas.rotate(90*Math.PI/180);//x, y 作为原点
|
|
@@ -5363,9 +5364,10 @@ this.Operator=function(){var data=this.Value.Data;if(!data)return false;this.Wid
|
|
|
5363
5364
|
|
|
5364
5365
|
this.Height=this.LineCount*this.LineHeight;
|
|
5365
5366
|
return true;
|
|
5366
|
-
*/};this.GenerateTitleHtml=function(data){var lineCount=0;var strHtml="",text;if(data.Name){text='<span style=\'color:rgb(0,0,0);font:\u5FAE\u8F6F\u96C5\u9ED1;font-size:12px;text-align:center;display: block;\'>'+data.Name+'</span>';strHtml+=text;++lineCount;}if(data.Title){text='<span class=\'tooltip-title\'>'+data.Title+'</span>';strHtml+=text;++lineCount;}if(IFrameSplitOperator.IsNonEmptyArray(data.AryText)){for(var i=0;i<data.AryText.length;++i){var item=data.AryText[i];if(i>0)strHtml+='<br/>';var text='<span class=\'tooltip-con\'>'+item.Title+'</span><span class=\'tooltip-num\' style=\'color:'+item.Color+';\'>'+item.Text+'</span>';strHtml+=text;++lineCount;}}return{Html:strHtml,LineCount:lineCount};};this.GetFormatTitle=function(data){if(!data)return null;var upperSymbol=this.Symbol.toUpperCase();var defaultfloatPrecision=GetfloatPrecision(this.Symbol);//价格小数位数
|
|
5367
|
-
var date=new Date(parseInt(data.Date/10000),data.Date/100%100-1,data.Date%100);var strDate=IFrameSplitOperator.FormatDateString(data.Date);var
|
|
5368
|
-
{
|
|
5367
|
+
*/};this.GenerateTitleHtml=function(data){var lineCount=0;var strHtml="",text;if(data.Name){text='<span style=\'color:rgb(0,0,0);font:\u5FAE\u8F6F\u96C5\u9ED1;font-size:12px;text-align:center;display: block;\'>'+data.Name+'</span>';strHtml+=text;++lineCount;}if(data.Title){if(Array.isArray(data.Title)){for(var i=0;i<data.Title.length;++i){var item=data.Title[i];text='<span class=\'tooltip-title\'>'+item+'</span>';strHtml+=text;++lineCount;}}else{text='<span class=\'tooltip-title\'>'+data.Title+'</span>';strHtml+=text;++lineCount;}}if(IFrameSplitOperator.IsNonEmptyArray(data.AryText)){for(var i=0;i<data.AryText.length;++i){var item=data.AryText[i];if(i>0)strHtml+='<br/>';var text='<span class=\'tooltip-con\'>'+item.Title+'</span><span class=\'tooltip-num\' style=\'color:'+item.Color+';\'>'+item.Text+'</span>';strHtml+=text;++lineCount;}}return{Html:strHtml,LineCount:lineCount};};this.GetFormatTitle=function(data){if(!data)return null;var upperSymbol=this.Symbol.toUpperCase();var defaultfloatPrecision=GetfloatPrecision(this.Symbol);//价格小数位数
|
|
5368
|
+
var date=new Date(parseInt(data.Date/10000),data.Date/100%100-1,data.Date%100);var strDate=IFrameSplitOperator.FormatDateString(data.Date);var title=strDate,value;var isTickPeriod=ChartData.IsTickPeriod(this.Value.ChartPaint.Data.Period);if(ChartData.IsDayPeriod(this.Value.ChartPaint.Data.Period,true))//日线
|
|
5369
|
+
{value=g_JSChartLocalization.GetText(WEEK_NAME[date.getDay()],this.LanguageID);title=strDate+'  '+value;}else if(ChartData.IsMinutePeriod(this.Value.ChartPaint.Data.Period,true))// 分钟周期
|
|
5370
|
+
{value=IFrameSplitOperator.FormatTimeString(data.Time);title=strDate+'  '+value;}else if(ChartData.IsSecondPeriod(this.Value.ChartPaint.Data.Period)||isTickPeriod){value=IFrameSplitOperator.FormatTimeString(data.Time,'HH:MM:SS');title=strDate+'  '+value;}else if(ChartData.IsMilliSecondPeriod(this.Value.ChartPaint.Data.Period)){value=IFrameSplitOperator.FormatTimeString(data.Time,'HH:MM:SS.fff');title=[strDate+'  '+g_JSChartLocalization.GetText(WEEK_NAME[date.getDay()],this.LanguageID),value];}var result={AryText:null,Title:title,Name:null};if(isTickPeriod){var aryText=[{Title:g_JSChartLocalization.GetText('DivTooltip-Price',this.LanguageID),Text:IFrameSplitOperator.IsNumber(data.Open)?data.Open.toFixed(defaultfloatPrecision):'--',Color:this.GetColor(data.Open,data.YClose)}];if(IFrameSplitOperator.IsNumber(data.YClose)){var increase=(data.Close-data.YClose)/data.YClose*100;var item={Title:g_JSChartLocalization.GetText('DivTooltip-Increase',this.LanguageID),Text:increase.toFixed(2)+'%',Color:this.GetColor(increase,0)};aryText.push(item);}result.AryText=aryText;}else if(data.IsNonTrade){}else{var vol=data.Vol;if(upperSymbol&&MARKET_SUFFIX_NAME.IsSHSZ(upperSymbol))vol/=100;//A股统一转成手
|
|
5369
5371
|
var eventUnchangeKLine=null;//定制平盘K线颜色事件
|
|
5370
5372
|
if(this.GetEventCallback)eventUnchangeKLine=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_UNCHANGE_KLINE_TITLE_COLOR);var aryText=[{Title:g_JSChartLocalization.GetText('DivTooltip-Open',this.LanguageID),Text:IFrameSplitOperator.IsNumber(data.Open)?data.Open.toFixed(defaultfloatPrecision):'--',Color:this.GetPriceColor("DivTooltip-Open",data.Open,data.YClose,data,eventUnchangeKLine)},{Title:g_JSChartLocalization.GetText('DivTooltip-High',this.LanguageID),Text:IFrameSplitOperator.IsNumber(data.High)?data.High.toFixed(defaultfloatPrecision):'--',Color:this.GetPriceColor("DivTooltip-High",data.High,data.YClose,data,eventUnchangeKLine)},{Title:g_JSChartLocalization.GetText('DivTooltip-Low',this.LanguageID),Text:IFrameSplitOperator.IsNumber(data.Low)?data.Low.toFixed(defaultfloatPrecision):'--',Color:this.GetPriceColor('DivTooltip-Low',data.Low,data.YClose,data,eventUnchangeKLine)},{Title:g_JSChartLocalization.GetText('DivTooltip-Close',this.LanguageID),Text:IFrameSplitOperator.IsNumber(data.Close)?data.Close.toFixed(defaultfloatPrecision):'--',Color:this.GetPriceColor('DivTooltip-Close',data.Close,data.YClose,data,eventUnchangeKLine)},{Title:g_JSChartLocalization.GetText('DivTooltip-Vol',this.LanguageID),Text:IFrameSplitOperator.IsNumber(vol)?IFrameSplitOperator.FormatValueString(vol,2,this.LanguageID):'--',Color:this.VolColor},{Title:g_JSChartLocalization.GetText('DivTooltip-Amount',this.LanguageID),Text:IFrameSplitOperator.IsNumber(data.Amount)?IFrameSplitOperator.FormatValueString(data.Amount,2,this.LanguageID):'--',Color:this.AmountColor}];if(IFrameSplitOperator.IsNumber(data.YClose)){var increase=(data.Close-data.YClose)/data.YClose*100;var item={Title:g_JSChartLocalization.GetText('DivTooltip-Increase',this.LanguageID),Text:increase.toFixed(2)+'%',Color:this.GetColor(increase,0)};aryText.push(item);}if(MARKET_SUFFIX_NAME.IsSHSZStockA(this.Symbol)&&data.FlowCapital>0)//换手率
|
|
5371
5373
|
{var value=data.Vol/data.FlowCapital*100;var item={Title:g_JSChartLocalization.GetText('DivTooltip-Exchange',this.LanguageID),Text:value.toFixed(2)+'%',Color:this.TurnoverRateColor};aryText.push(item);}if(MARKET_SUFFIX_NAME.IsFutures(upperSymbol)&&IFrameSplitOperator.IsNumber(data.Position)){var item={Title:g_JSChartLocalization.GetText('DivTooltip-Position',this.LanguageID),Text:''+data.Position,Color:this.PositionColor};}//叠加股票
|
|
@@ -11724,7 +11726,7 @@ IndexTitleColor:"rgb(190, 190 ,190)",//指标名字颜色
|
|
|
11724
11726
|
IndexTitleBGColor:'rgb(0,0,0)',//指标名字背景色
|
|
11725
11727
|
IndexTitleBorderColor:'rgb(211, 211, 211)',//指标名字边框颜色
|
|
11726
11728
|
IndexTitleBorderMoveOnColor:'rgb(30,144,255)',//指标名字边框颜色(鼠标在上面)
|
|
11727
|
-
UpTextColor:"rgb(238,21,21)",DownTextColor:"rgb(25,158,0)",UnchagneTextColor:"rgb(190, 190 ,190)",CloseLineColor:'rgb(
|
|
11729
|
+
UpTextColor:"rgb(238,21,21)",DownTextColor:"rgb(25,158,0)",UnchagneTextColor:"rgb(190, 190 ,190)",CloseLineColor:'rgb(250,250,250)',Title:{TradeIndexColor:'rgb(105,105,105)',//交易指标颜色
|
|
11728
11730
|
ColorIndexColor:'rgb(112,128,144)',//五彩K线颜色
|
|
11729
11731
|
VolColor:"rgb(190, 190 ,190)",//标题成交量
|
|
11730
11732
|
AmountColor:"rgb(190, 190 ,190)",//成交金额
|
|
@@ -12657,7 +12659,7 @@ function HQChartScriptWorker(){this.Create=function(){var _this60=this;addEventL
|
|
|
12657
12659
|
hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,Stock:{Symbol:message.Symbol},Request:{MaxDataCount:500,MaxMinuteDayCount:5},Period:message.Period,Right:message.Right,Data:hisData};if(IFrameSplitOperator.IsNumber(message.HQDataType))stockObj.HQDataType=message.HQDataType;indexConsole.ExecuteScript(stockObj);};this.OnRecvMessage=function(message){var data=message.data;if(!data)return;if(data.ID==JSCHART_WORKER_MESSAGE_ID.EXECUTE_SCRIPT){if(!IFrameSplitOperator.IsNonEmptyArray(data.AryIndex))return;for(var i=0;i<data.AryIndex.length;++i){var item=data.AryIndex[i];this.ExecuteScript(item,data);}}};this.OnExecuteFinish=function(data,indexInfo,jsExectute){var message={Data:data,IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.FINISH_EXECUTE_SCRIPT};postMessage(message);};this.OnExecuteError=function(error,indexInfo){var message={IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.ERROR_EXECUTE_SCRIPT,Error:error};postMessage(message);};}/********************************************************************************
|
|
12658
12660
|
* 版本信息输出
|
|
12659
12661
|
*
|
|
12660
|
-
*/var HQCHART_VERSION="1.1.
|
|
12662
|
+
*/var HQCHART_VERSION="1.1.12579";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();//把给外界调用的方法暴露出来
|
|
12661
12663
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
12662
12664
|
// BaseIndex:BaseIndex,
|
|
12663
12665
|
// ChartLine:ChartLine,
|
package/package.json
CHANGED
package/src/jscommon/umychart.js
CHANGED
|
@@ -2793,6 +2793,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
2793
2793
|
//事件回调
|
|
2794
2794
|
this.mapEvent=new Map(); //通知外部调用 key:JSCHART_EVENT_ID value:{Callback:回调,}
|
|
2795
2795
|
|
|
2796
|
+
this.PhonePinch=null; //手机双指操作信息
|
|
2796
2797
|
this.IsOnTouch = false; //是否再操作数据
|
|
2797
2798
|
this.TouchDrawCount = 0; //手势绘制次数
|
|
2798
2799
|
this.DisableMouse=false; //禁止鼠标事件
|
|
@@ -4446,8 +4447,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4446
4447
|
|
|
4447
4448
|
var touches=this.GetToucheData(e,this.IsForceLandscape);
|
|
4448
4449
|
|
|
4449
|
-
phonePinch.Start={
|
|
4450
|
-
phonePinch.Last={
|
|
4450
|
+
phonePinch.Start={X:touches[0].pageX, Y:touches[0].pageY, X2:touches[1].pageX, Y2:touches[1].pageY};
|
|
4451
|
+
phonePinch.Last={X:touches[0].pageX, Y:touches[0].pageY, X2:touches[1].pageX, Y2:touches[1].pageY};
|
|
4451
4452
|
|
|
4452
4453
|
this.PhonePinch=phonePinch;
|
|
4453
4454
|
this.SelectChartDrawPicture=null;
|
|
@@ -4586,6 +4587,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4586
4587
|
var phonePinch=this.PhonePinch;
|
|
4587
4588
|
if (!phonePinch) return;
|
|
4588
4589
|
|
|
4590
|
+
phonePinch.Operator=null;
|
|
4589
4591
|
if (this.EnableZoomUpDown && this.EnableZoomUpDown.Touch===false) return;
|
|
4590
4592
|
|
|
4591
4593
|
var yHeight=Math.abs(touches[0].pageY-touches[1].pageY);
|
|
@@ -4605,6 +4607,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4605
4607
|
var cursorIndex={ IsLockRight:this.IsZoomLockRight };
|
|
4606
4608
|
cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));
|
|
4607
4609
|
if (!this.Frame.ZoomUp(cursorIndex)) return;
|
|
4610
|
+
phonePinch.Operator="ZoomUp";
|
|
4608
4611
|
this.CursorIndex=cursorIndex.Index;
|
|
4609
4612
|
this.UpdatePointByCursorIndex();
|
|
4610
4613
|
this.UpdataDataoffset();
|
|
@@ -4618,6 +4621,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4618
4621
|
var cursorIndex={ IsLockRight:this.IsZoomLockRight };
|
|
4619
4622
|
cursorIndex.Index=parseInt(Math.abs(this.CursorIndex-0.5).toFixed(0));
|
|
4620
4623
|
if (!this.Frame.ZoomDown(cursorIndex)) return;
|
|
4624
|
+
phonePinch.Operator="ZoomDown";
|
|
4621
4625
|
this.CursorIndex=cursorIndex.Index;
|
|
4622
4626
|
this.UpdataDataoffset();
|
|
4623
4627
|
this.UpdatePointByCursorIndex();
|
|
@@ -4627,7 +4631,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4627
4631
|
this.StopDragTimer();
|
|
4628
4632
|
}
|
|
4629
4633
|
|
|
4630
|
-
phonePinch.Last={
|
|
4634
|
+
phonePinch.Last={ X:touches[0].pageX, Y:touches[0].pageY, X2:touches[1].pageX, Y2:touches[1].pageY };
|
|
4631
4635
|
}
|
|
4632
4636
|
|
|
4633
4637
|
this.PreventTouchEvent(e);
|
|
@@ -4675,6 +4679,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4675
4679
|
this.TouchEvent({ EventID:JSCHART_EVENT_ID.ON_PHONE_TOUCH, FunctionName:"OnTouchEnd"}, e);
|
|
4676
4680
|
this.OnTouchFinished();
|
|
4677
4681
|
this.TouchDrawCount=0;
|
|
4682
|
+
this.PhonePinch=null;
|
|
4678
4683
|
}
|
|
4679
4684
|
|
|
4680
4685
|
this.OnTouchDBClick=function(points)
|
|
@@ -37839,13 +37844,13 @@ function KLineTooltipPaint()
|
|
|
37839
37844
|
|
|
37840
37845
|
//涨幅
|
|
37841
37846
|
title=g_JSChartLocalization.GetText('Tooltip-Increase',this.LanguageID);
|
|
37842
|
-
if (item.YFClose
|
|
37847
|
+
if (IFrameSplitOperator.IsNumber(item.YFClose) && MARKET_SUFFIX_NAME.IsChinaFutures(upperSymbol))
|
|
37843
37848
|
{
|
|
37844
37849
|
var value=(item.Close-item.YFClose)/item.YFClose*100;
|
|
37845
37850
|
color = this.KLineTitlePaint.GetColor(value, 0);
|
|
37846
37851
|
text = value.toFixed(2)+'%';
|
|
37847
37852
|
}
|
|
37848
|
-
else if (item.YClose
|
|
37853
|
+
else if (IFrameSplitOperator.IsNumber(item.YClose))
|
|
37849
37854
|
{
|
|
37850
37855
|
var value=(item.Close-item.YClose)/item.YClose*100;
|
|
37851
37856
|
color = this.KLineTitlePaint.GetColor(value, 0);
|
|
@@ -47424,9 +47429,22 @@ function HistoryDataStringFormat()
|
|
|
47424
47429
|
|
|
47425
47430
|
if (data.Title)
|
|
47426
47431
|
{
|
|
47427
|
-
|
|
47428
|
-
|
|
47429
|
-
|
|
47432
|
+
if (Array.isArray(data.Title))
|
|
47433
|
+
{
|
|
47434
|
+
for(var i=0;i<data.Title.length;++i)
|
|
47435
|
+
{
|
|
47436
|
+
var item=data.Title[i];
|
|
47437
|
+
text=`<span class='tooltip-title'>${item}</span>`;
|
|
47438
|
+
strHtml+=text;
|
|
47439
|
+
++lineCount;
|
|
47440
|
+
}
|
|
47441
|
+
}
|
|
47442
|
+
else
|
|
47443
|
+
{
|
|
47444
|
+
text=`<span class='tooltip-title'>${data.Title}</span>`;
|
|
47445
|
+
strHtml+=text;
|
|
47446
|
+
++lineCount;
|
|
47447
|
+
}
|
|
47430
47448
|
}
|
|
47431
47449
|
|
|
47432
47450
|
if (IFrameSplitOperator.IsNonEmptyArray(data.AryText))
|
|
@@ -47453,22 +47471,36 @@ function HistoryDataStringFormat()
|
|
|
47453
47471
|
var date=new Date(parseInt(data.Date/10000),(data.Date/100%100-1),data.Date%100);
|
|
47454
47472
|
var strDate=IFrameSplitOperator.FormatDateString(data.Date);
|
|
47455
47473
|
|
|
47456
|
-
var
|
|
47474
|
+
var title=strDate,value;
|
|
47457
47475
|
var isTickPeriod=ChartData.IsTickPeriod(this.Value.ChartPaint.Data.Period);
|
|
47458
|
-
if (ChartData.
|
|
47476
|
+
if (ChartData.IsDayPeriod(this.Value.ChartPaint.Data.Period,true)) //日线
|
|
47459
47477
|
{
|
|
47460
|
-
|
|
47478
|
+
value=g_JSChartLocalization.GetText(WEEK_NAME[date.getDay()],this.LanguageID);
|
|
47479
|
+
title=`${strDate}  ${value}`;
|
|
47480
|
+
}
|
|
47481
|
+
else if (ChartData.IsMinutePeriod(this.Value.ChartPaint.Data.Period,true)) // 分钟周期
|
|
47482
|
+
{
|
|
47483
|
+
value=IFrameSplitOperator.FormatTimeString(data.Time);
|
|
47484
|
+
title=`${strDate}  ${value}`;
|
|
47461
47485
|
}
|
|
47462
47486
|
else if (ChartData.IsSecondPeriod(this.Value.ChartPaint.Data.Period) || isTickPeriod)
|
|
47463
47487
|
{
|
|
47464
|
-
|
|
47488
|
+
value=IFrameSplitOperator.FormatTimeString(data.Time,'HH:MM:SS');
|
|
47489
|
+
title=`${strDate}  ${value}`;
|
|
47465
47490
|
}
|
|
47466
47491
|
else if (ChartData.IsMilliSecondPeriod(this.Value.ChartPaint.Data.Period))
|
|
47467
47492
|
{
|
|
47468
|
-
|
|
47493
|
+
value=IFrameSplitOperator.FormatTimeString(data.Time,'HH:MM:SS.fff');
|
|
47494
|
+
title=
|
|
47495
|
+
[
|
|
47496
|
+
`${strDate}  ${g_JSChartLocalization.GetText(WEEK_NAME[date.getDay()],this.LanguageID)}`,
|
|
47497
|
+
value
|
|
47498
|
+
];
|
|
47469
47499
|
}
|
|
47470
47500
|
|
|
47471
|
-
var result={ AryText:null, Title
|
|
47501
|
+
var result={ AryText:null, Title:title, Name:null };
|
|
47502
|
+
|
|
47503
|
+
|
|
47472
47504
|
if (isTickPeriod)
|
|
47473
47505
|
{
|
|
47474
47506
|
var aryText=
|