hqchart 1.1.13451 → 1.1.13460
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 +29 -18
- package/package.json +1 -1
- package/src/jscommon/umychart.js +73 -10
- package/src/jscommon/umychart.scrollbar.js +47 -2
- package/src/jscommon/umychart.uniapp.h5/umychart.uniapp.h5.js +121 -13
- package/src/jscommon/umychart.version.js +1 -1
- package/src/jscommon/umychart.vue/umychart.vue.js +121 -13
package/lib/umychart.vue.js
CHANGED
|
@@ -1440,7 +1440,8 @@ ON_CLICK_TREPORT_ROW:127,//左键点击点击T型报价列表
|
|
|
1440
1440
|
ON_CHANGE_INDEX:150,//切换指标
|
|
1441
1441
|
ON_MENU_COMMAND:151,//菜单事件回调
|
|
1442
1442
|
ON_CREATE_RIGHT_MENU:152,//创建右键菜单
|
|
1443
|
-
ON_FORMAT_CALL_AUCTION_INDEX_TITLE:153
|
|
1443
|
+
ON_FORMAT_CALL_AUCTION_INDEX_TITLE:153,//集合竞价指标窗口标题内容
|
|
1444
|
+
ON_FORMAT_KLINE_HIGH_LOW_TITLE:154//K线最高最低价格式化内容
|
|
1444
1445
|
};var JSCHART_OPERATOR_ID={OP_SCROLL_LEFT:1,//往左移动
|
|
1445
1446
|
OP_SCROLL_RIGHT:2,//往右移动
|
|
1446
1447
|
OP_ZOOM_OUT:3,//缩小
|
|
@@ -1569,7 +1570,8 @@ this.PhonePinch=null;//手机双指操作信息
|
|
|
1569
1570
|
this.IsOnTouch=false;//是否再操作数据
|
|
1570
1571
|
this.TouchDrawCount=0;//手势绘制次数
|
|
1571
1572
|
this.DisableMouse=false;//禁止鼠标事件
|
|
1572
|
-
this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;this.PressTime=500;this.
|
|
1573
|
+
this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;this.PressTime=500;this.IsPress=false;//是否长按
|
|
1574
|
+
this.NetworkFilter;//网络请求回调 function(data, callback);
|
|
1573
1575
|
this.LastMouseStatus={MouseOnToolbar:null};// MouseOnToolbar={ Rect:{}, Title: }
|
|
1574
1576
|
this.ClickDownPoint;//鼠标点击坐标 {X, Y}, 鼠标放开以后清空为null
|
|
1575
1577
|
this.IsDestroy=false;//是否已经销毁了
|
|
@@ -1687,9 +1689,9 @@ this.IsPhoneDragging=function(e){// JSConsole.Chart.Log(e);
|
|
|
1687
1689
|
var changed=e.changedTouches.length;var touching=e.touches.length;return changed==1&&touching==1;};//是否是2个手指操所
|
|
1688
1690
|
this.IsPhonePinching=function(e){var changed=e.changedTouches.length;var touching=e.touches.length;return(changed==1||changed==2)&&touching==2;};this.PreventTouchEvent=function(e){if(e.cancelable)e.preventDefault();e.stopPropagation();};this.GetToucheData=function(e,isForceLandscape){var touches=new Array();var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
1689
1691
|
for(var i=0;i<e.touches.length;++i){var item=e.touches[i];if(isForceLandscape){touches.push({clientX:item.clientY*pixelTatio,clientY:item.clientX*pixelTatio,pageX:item.pageY*pixelTatio,pageY:item.pageX*pixelTatio});}else{touches.push({clientX:item.clientX*pixelTatio,clientY:item.clientY*pixelTatio,pageX:item.pageX*pixelTatio,pageY:item.pageY*pixelTatio});}}return touches;};this.IsSingleTouch=function(e)//是否是单点触屏
|
|
1690
|
-
{var touchCount=e.touches.length;return touchCount==1;};this.StopDragTimer=function(){if(IFrameSplitOperator.IsNumber(this.DragTimer)){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.GetMoveAngle=function(pt,pt2)//计算角度
|
|
1692
|
+
{var touchCount=e.touches.length;return touchCount==1;};this.StopDragTimer=function(){if(IFrameSplitOperator.IsNumber(this.DragTimer)){clearTimeout(this.DragTimer);this.DragTimer=null;this.IsPress=false;}};this.GetMoveAngle=function(pt,pt2)//计算角度
|
|
1691
1693
|
{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;};//手机拖拽
|
|
1692
|
-
uielement.ontouchstart=function(e){_this5.OnTouchStart(e);};uielement.ontouchmove=function(e){_this5.OnTouchMove(e);};uielement.ontouchend=function(e){_this5.OnTouchEnd(e);};this.AddPhoneDBClickInfo=function(x,y,time){var item={X:x,Y:y,Time:time};this.PhoneDBClickInfo.Start.push(item);};this.ClearPhoneDBClickInfo=function(){this.PhoneDBClickInfo.Start=[];};this.IsShortPhoneClick=function(x,y,time){};this.OnTouchStart=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsOnTouch=true;this.TouchDrawCount=0;this.PhonePinch=null;this.StopDragTimer();var isSingleTouch=this.IsSingleTouch(e);if(this.EnableScrollUpDown==false||!isSingleTouch||//多点触屏
|
|
1694
|
+
uielement.ontouchstart=function(e){_this5.OnTouchStart(e);};uielement.ontouchmove=function(e){_this5.OnTouchMove(e);};uielement.ontouchend=function(e){_this5.OnTouchEnd(e);};this.AddPhoneDBClickInfo=function(x,y,time){var item={X:x,Y:y,Time:time};this.PhoneDBClickInfo.Start.push(item);};this.ClearPhoneDBClickInfo=function(){this.PhoneDBClickInfo.Start=[];};this.IsShortPhoneClick=function(x,y,time){};this.OnTouchStart=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsPress=false;this.IsOnTouch=true;this.TouchDrawCount=0;this.PhonePinch=null;this.StopDragTimer();var isSingleTouch=this.IsSingleTouch(e);if(this.EnableScrollUpDown==false||!isSingleTouch||//多点触屏
|
|
1693
1695
|
this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID&&this.TouchStatus.CorssCursorShow==true)//十字光标显示,不能滚动页面
|
|
1694
1696
|
{if(e.cancelable)e.preventDefault();}if(this.IsPhoneDragging(e)){var touches=this.GetToucheData(e,this.IsForceLandscape);var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);if(this.TryClickLock||this.TryClickIndexTitle)//指标枷锁区域 , 指标标题点击
|
|
1695
1697
|
{var x=pt.X;var y=pt.Y;if(this.TryClickLock&&this.TryClickLock(x,y))return;if(this.TryClickIndexTitle&&this.TryClickIndexTitle(x,y))return;}if(this.ClickFrameButton){var button=this.Frame.PtInButtons(pt.X,pt.Y);if(button){this.ClickFrameButton(button,e);return;}}if(this.EnableVerticalDrag){this.VerticalDrag={IsDrag:false};if(this.Frame.PtInFrameVertical(pt.X,pt.Y))this.VerticalDrag.IsDrag=true;}var bStartTimer=true;if(this.ChartDrawOption.IsLockScreen){bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID){if(this.TouchStatus.CorssCursorShow==true)bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.DISABLE_DRAG_ID){bStartTimer=false;}else{if(!isSingleTouch)bStartTimer=false;}if(this.VerticalDrag)bStartTimer=false;if(this.EnableClickModel&&this.ClickModel.IsShowCorssCursor==true)bStartTimer=false;var drag={"Click":{},"LastMove":{}//最后移动的位置
|
|
@@ -1701,7 +1703,7 @@ this.PhoneTouchInfo={Start:{X:touches[0].clientX,Y:touches[0].clientY},End:{X:to
|
|
|
1701
1703
|
if(this.FinishChartDrawPicturePoint()){if(drawPicture.IsDrawMain)this.Draw();else this.DrawDynamicInfo({Corss:false,Tooltip:false});}}if(e.cancelable)e.preventDefault();return;}else{var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);var drawPictrueData={X:pt.X,Y:pt.Y};var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
|
|
1702
1704
|
if(this.GetChartDrawPictureByPoint(drawPictrueData)){drawPictrueData.ChartDrawPicture.Status=20;drawPictrueData.ChartDrawPicture.ValueToPoint();drawPictrueData.ChartDrawPicture.MovePointIndex=drawPictrueData.PointIndex;drawPictrueData.ChartDrawPicture.IsSelected=true;this.CurrentChartDrawPicture=drawPictrueData.ChartDrawPicture;this.SelectChartDrawPicture=drawPictrueData.ChartDrawPicture;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_DRAWPICTURE);//选中画图工具事件
|
|
1703
1705
|
if(event&&event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};event.Callback(event,sendData,this);}var drawType=0;if(drawPictrueData.ChartDrawPicture.IsDrawMain)drawType=1;else if(drawPictureActive.Select.Guid&&drawPictureActive.Select.Chart&&drawPictureActive.Select.Chart.IsDrawMain)drawType=1;if(drawType==1)this.Draw();if(e.cancelable)e.preventDefault();return;}}if(bStartTimer){//长按2秒,十字光标
|
|
1704
|
-
var self=this;this.DragTimer=setTimeout(function(){if(drag.Click.X==drag.LastMove.X&&drag.Click.Y==drag.LastMove.Y)//手指没有移动,出现十字光标
|
|
1706
|
+
var self=this;this.DragTimer=setTimeout(function(){self.IsPress=true;if(drag.Click.X==drag.LastMove.X&&drag.Click.Y==drag.LastMove.Y)//手指没有移动,出现十字光标
|
|
1705
1707
|
{var mouseDrag=self.MouseDrag;self.MouseDrag=null;if(self.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID)self.TouchStatus.CorssCursorShow=true;//十字显示
|
|
1706
1708
|
if(self.EnableClickModel===true)self.ClickModel.IsShowCorssCursor=true;self.MoveCorssCursor(drag.Click,e);//移动十字光标
|
|
1707
1709
|
}},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)
|
|
@@ -3433,9 +3435,16 @@ this.DrawKRange={Start:null,End:null};this.AryPriceGapCache=[];this.ChartFrame.C
|
|
|
3433
3435
|
this.DrawHeatMap();if(!this.IsShow)return;if(this.ChartFrame.IsMinSize&&this.Name=="Self Kline")return;if(ChartData.IsTickPeriod(this.Period))//分笔图
|
|
3434
3436
|
{this.Canvas.save();if(this.DrawType==1){this.ClipClient(this.ChartFrame.IsHScreen);this.DrawCloseLine();}else if(this.DrawType==4){this.ClipClient(this.ChartFrame.IsHScreen);this.DrawCloseArea();}else{this.ClipTickClient(this.ChartFrame.IsHScreen);this.DrawTick();}this.Canvas.restore();return;}this.Canvas.save();this.ClipClient(this.ChartFrame.IsHScreen);if(this.DrawType==1){this.DrawCloseLine();this.Canvas.restore();if(this.PriceGap.Enable)this.DrawPriceGap();return;}else if(this.DrawType==2){this.DrawAKLine();}else if(this.DrawType==4){this.DrawCloseArea();}else if(this.DrawType==5){this.DrawOrderFlow();}else if(this.DrawType==7){this.DrawOrderFlow_Style2();}else if(this.DrawType==8){this.DrawOrderFlow_Style3();}else if(this.DrawType==9){this.DrawKBar();}else if(this.DrawType==10){this.DrawRenkoCandle();}else if(this.DrawType==12){this.DrawLineBreak();}else if(this.DrawType==13){this.DrawHighLow();}else if(this.DrawType==14){if(this.FFKChart&&this.FFKChart.Draw){this.FFKChart.Draw(this);}}else if(this.DrawType==15){this.DrawHLCArea();}else if(this.DrawType==16){this.DrawKagi();}else if(this.DrawType==17){this.DrawOrderFlow_Style4();}else if(this.DrawType==18){this.DrawOrderFlow_Style5();}else{this.DrawKBar();}if(this.TradeIcon)this.DrawTradeIcon();else this.DrawTrade();this.Canvas.restore();if(this.PriceGap.Enable)this.DrawPriceGap();if(this.IsShowMaxMinPrice)//标注最大值最小值
|
|
3435
3437
|
{if(this.ChartFrame.IsHScreen===true)this.HScreenDrawMaxMinPrice(this.PtMax,this.PtMin);else this.DrawMaxMinPrice(this.PtMax,this.PtMin);}if(this.DrawType==14)//自定义图形 标注最大最小值
|
|
3436
|
-
{if(this.FFKChart&&this.FFKChart.DrawMaxMinPrice){this.FFKChart.DrawMaxMinPrice();}}};this.
|
|
3437
|
-
|
|
3438
|
-
{if(ptMax.X==null||ptMax.Y==null||ptMax.Value==null)return;if(ptMin.X==null||ptMin.Y==null||ptMin.Value==null)return;var leftArrow=g_JSChartResource.KLine.MaxMin.LeftArrow;var rightArrow=g_JSChartResource.KLine.MaxMin.RightArrow;var highYOffset=g_JSChartResource.KLine.MaxMin.HighYOffset;var lowYOffset=g_JSChartResource.KLine.MaxMin.LowYOffset;var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
3438
|
+
{if(this.FFKChart&&this.FFKChart.DrawMaxMinPrice){this.FFKChart.DrawMaxMinPrice();}}};this.OnFormatHighLowTitle=function(ptMax,ptMin){if(!ptMax||!ptMin)return null;if(!IFrameSplitOperator.IsNumber(ptMax.Value)||!IFrameSplitOperator.IsNumber(ptMin.Value))return null;var defaultfloatPrecision=GetfloatPrecision(this.Symbol);//小数位数
|
|
3439
|
+
var title={High:ptMax.Value.toFixed(defaultfloatPrecision),Low:ptMin.Value.toFixed(defaultfloatPrecision)};if(!this.GetEventCallback)return title;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_KLINE_HIGH_LOW_TITLE);if(!event||!event.Callback)return title;var data={Max:ptMax,Min:ptMin,Symbol:this.Symbol,Title:{High:title.High,Low:title.Low},Decimal:defaultfloatPrecision,PreventDefault:false};event.Callback(event,data,this);if(data.PreventDefault)return data.Title;//使用外部回调的数值
|
|
3440
|
+
return title;};this.DrawMaxMinPrice=function(ptMax,ptMin){if(ptMax.X==null||ptMax.Y==null||ptMax.Value==null)return;if(ptMin.X==null||ptMin.Y==null||ptMin.Value==null)return;var title=this.OnFormatHighLowTitle(ptMax,ptMin);if(!title)return;var leftArrow=g_JSChartResource.KLine.MaxMin.LeftArrow;var rightArrow=g_JSChartResource.KLine.MaxMin.RightArrow;var highYOffset=g_JSChartResource.KLine.MaxMin.HighYOffset;var lowYOffset=g_JSChartResource.KLine.MaxMin.LowYOffset;var defaultfloatPrecision=GetfloatPrecision(this.Symbol);this.Canvas.font=this.TextFont;var top=this.ChartBorder.GetTopEx();var bottom=this.ChartBorder.GetBottomEx();var ptTop=ptMax;var text=title.High;var textColor=this.TextColor;if(this.ChartFrame.CoordinateType==1)//反转坐标
|
|
3441
|
+
{if(ptMax.Y<ptMin.Y)ptTop=ptMin;this.Canvas.textBaseline='top';var text=title.Low;if(title.LowColor)textColor=title.LowColor;}else{if(ptMax.Y>ptMin.Y)ptTop=ptMin;this.Canvas.textBaseline='bottom';if(title.HighColor)textColor=title.HighColor;}this.Canvas.fillStyle=textColor;this.Canvas.textAlign=ptTop.Align;var left=ptTop.Align=='left'?ptTop.X:ptTop.X;if(IFrameSplitOperator.IsNumber(highYOffset))ptTop.Y+=highYOffset;//var text=ptTop.Value.toFixed(defaultfloatPrecision);
|
|
3442
|
+
if(ptTop.Align=='left')text=leftArrow+text;else text=text+rightArrow;if(ptTop.Y>top-2){this.Canvas.fillText(text,left,ptTop.Y);this.ChartFrame.ChartKLine.Max={X:left,Y:ptTop.Y,Text:{BaseLine:'bottom'}};}var ptBottom=ptMin;var text=title.Low;var textColor=this.TextColor;if(this.ChartFrame.CoordinateType==1){if(ptMin.Y>ptMax.Y)ptBottom=ptMax;this.Canvas.textBaseline='bottom';var text=title.High;if(title.HighColor)textColor=title.HighColor;}else{if(ptMax.Y>ptMin.Y)ptTop=ptMin;this.Canvas.textBaseline='top';if(title.LowColor)textColor=title.LowColor;}this.Canvas.fillStyle=textColor;this.Canvas.textAlign=ptBottom.Align;var left=ptBottom.Align=='left'?ptBottom.X:ptBottom.X;if(IFrameSplitOperator.IsNumber(lowYOffset))ptBottom.Y+=lowYOffset;//var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
3443
|
+
if(ptBottom.Align=='left')text=leftArrow+text;else text=text+rightArrow;if(ptBottom.Y<bottom+1){this.Canvas.fillText(text,left,ptBottom.Y);this.ChartFrame.ChartKLine.Min={X:left,Y:ptBottom.Y,Text:{BaseLine:'top'}};}};this.HScreenDrawMaxMinPrice=function(ptMax,ptMin)//横屏模式下显示最大最小值
|
|
3444
|
+
{if(ptMax.X==null||ptMax.Y==null||ptMax.Value==null)return;if(ptMin.X==null||ptMin.Y==null||ptMin.Value==null)return;var title=this.OnFormatHighLowTitle(ptMax,ptMin);if(!title)return;var leftArrow=g_JSChartResource.KLine.MaxMin.LeftArrow;var rightArrow=g_JSChartResource.KLine.MaxMin.RightArrow;var highYOffset=g_JSChartResource.KLine.MaxMin.HighYOffset;var lowYOffset=g_JSChartResource.KLine.MaxMin.LowYOffset;//var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
3445
|
+
var xText=ptMax.Y;var yText=ptMax.X;if(IFrameSplitOperator.IsNumber(highYOffset))xText+=highYOffset;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);var text=title.High;this.Canvas.font=this.TextFont;if(title.HighColor)this.Canvas.fillStyle=title.HighColor;else this.Canvas.fillStyle=this.TextColor;this.Canvas.textAlign=ptMax.Align;this.Canvas.textBaseline='bottom';//var text=ptMax.Value.toFixed(defaultfloatPrecision);
|
|
3446
|
+
if(ptMax.Align=='left')text=leftArrow+text;else text=text+rightArrow;this.Canvas.fillText(text,0,0);this.Canvas.restore();var xText=ptMin.Y;var yText=ptMin.X;if(IFrameSplitOperator.IsNumber(lowYOffset))xText+=lowYOffset;this.Canvas.save();this.Canvas.translate(xText,yText);this.Canvas.rotate(90*Math.PI/180);var text=title.Low;this.Canvas.font=this.TextFont;if(title.LowColor)this.Canvas.fillStyle=title.LowColor;else this.Canvas.fillStyle=this.TextColor;this.Canvas.textAlign=ptMin.Align;this.Canvas.textBaseline='top';//var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
3447
|
+
if(ptMin.Align=='left')text=leftArrow+text;else text=text+rightArrow;this.Canvas.fillText(text,0,0);this.Canvas.restore();};//画某一天的信息地雷
|
|
3439
3448
|
this.DrawInfo=function(item){if(!this.InfoData||this.InfoData.size<=0)return;var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var bottom=this.ChartBorder.GetBottom();var top=this.ChartBorder.GetTop();var key=''+item.DayData.Date;if(this.Data.DataType==1)key=item.DayData.Date+'-'+item.DayData.Time;if(!this.InfoData.has(key))return;var infoData=this.InfoData.get(key);if(!infoData||infoData.Data.length<=0)return;this.Canvas.restore();this.Canvas.save();this.ClipWindow(isHScreen);var pixelTatio=GetDevicePixelRatio();//获取设备的分辨率
|
|
3440
3449
|
var iconSize=dataWidth+distanceWidth;var minIconSize=18*pixelTatio;var bShowNum=true;if(iconSize<=15)bShowNum=false;if(iconSize<minIconSize)iconSize=minIconSize;var text='',title='';var mapImage=new _map2.default();var iconTop=item.YMax+1*pixelTatio;var iconBottom=item.YMin+1*pixelTatio+iconSize;var drawTop=true;var yOffset=0;for(var i in infoData.Data){var infoItem=infoData.Data[i];var imageInfo=mapImage.get(infoItem.InfoType);if(!imageInfo){var icon=JSKLineInfoMap.GetIconFont(infoItem.InfoType);this.Canvas.fillStyle=icon.Color;this.Canvas.font=iconSize+'px '+icon.Family;if(isHScreen){this.Canvas.textBaseline="middle";this.Canvas.textAlign="left";this.Canvas.fillText(icon.HScreenText,iconTop,item.XCenter,iconSize);var iconRect=new Rect(item.XCenter-iconSize/2,iconTop-iconSize,iconSize,iconSize);var infoCache={Data:new Array(infoItem),Rect:iconRect,Type:infoItem.InfoType,TextRect:{X:iconTop,Y:item.XCenter}};mapImage.set(infoItem.InfoType,infoCache);iconTop+=iconSize;}else{this.Canvas.textBaseline="bottom";this.Canvas.textAlign="center";if(this.InfoPosition===1){var yBottom=bottom+yOffset;this.Canvas.fillText(icon.Text,item.XCenter,yBottom,iconSize);var iconRect=new Rect(item.XCenter-iconSize/2,yBottom-iconSize,iconSize,iconSize);var infoCache={Data:new Array(infoItem),Rect:iconRect,Type:infoItem.InfoType,TextRect:{X:item.XCenter,Y:yBottom}};mapImage.set(infoItem.InfoType,infoCache);yOffset-=iconSize;}else{if(drawTop){this.Canvas.fillText(icon.Text,item.XCenter,iconTop,iconSize);var iconRect=new Rect(item.XCenter-iconSize/2,iconTop-iconSize,iconSize,iconSize);var infoCache={Data:new Array(infoItem),Rect:iconRect,Type:infoItem.InfoType,TextRect:{X:item.XCenter,Y:iconTop}};mapImage.set(infoItem.InfoType,infoCache);iconTop-=iconSize;if(iconTop-iconSize<top)drawTop=false;}else//上面显示不下,就显示在下面
|
|
3441
3450
|
{this.Canvas.fillText(icon.Text,item.XCenter,iconBottom,iconSize);var iconRect=new Rect(item.XCenter-iconSize/2,iconBottom-iconSize,iconSize,iconSize);var infoCache={Data:new Array(infoItem),Rect:iconRect,Type:infoItem.InfoType,TextRect:{X:item.XCenter,Y:iconBottom}};mapImage.set(infoItem.InfoType,infoCache);iconBottom+=iconSize;}}}}else{imageInfo.Data.push(infoItem);}}var numText;if(g_JSChartResource.KLine.NumIcon){if(isHScreen)numText=g_JSChartResource.KLine.NumIcon.HScreenText;else numText=g_JSChartResource.KLine.NumIcon.Text;}var _iteratorNormalCompletion4=true;var _didIteratorError4=false;var _iteratorError4=undefined;try{for(var _iterator4=(0,_getIterator3.default)(mapImage),_step4;!(_iteratorNormalCompletion4=(_step4=_iterator4.next()).done);_iteratorNormalCompletion4=true){var item=_step4.value;var value=item[1];if(value.Data.length>=2&&numText&&bShowNum)//太小了 就不显示了
|
|
@@ -7755,7 +7764,7 @@ this.PtInClient_V2=function(x,y){this.Canvas.beginPath();if(this.Frame.IsHScreen
|
|
|
7755
7764
|
{for(var i=0;i<border.DayBorder.length;++i){var client=border.DayBorder[i];this.Canvas.beginPath();this.Canvas.rect(client.LeftEx,border.TopEx,client.RightEx-client.LeftEx,border.BottomEx-border.TopEx);if(this.Canvas.isPointInPath(x,y))return 100+i;//盘前
|
|
7756
7765
|
this.Canvas.beginPath();this.Canvas.rect(client.Left,border.TopEx,client.LeftEx-client.Left,border.BottomEx-border.TopEx);if(this.Canvas.isPointInPath(x,y))return 200+i;//盘后
|
|
7757
7766
|
this.Canvas.beginPath();this.Canvas.rect(client.RightEx,border.TopEx,client.Right-client.RightEx,border.BottomEx-border.TopEx);if(this.Canvas.isPointInPath(x,y))return 300+i;}return-2;}this.Canvas.rect(border.LeftEx,border.Top,border.RightEx-border.LeftEx,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 1;if(this.Frame.ChartBorder.LeftExtendWidth>10){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){this.Canvas.rect(border.Left,border.Top,border.Right-border.Left,border.TopEx-border.Top);}else{this.Canvas.rect(border.Left,border.Top,border.LeftEx-border.Left,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 2;}if(this.Frame.ChartBorder.RightExtendWidth>10){this.Canvas.beginPath();if(this.Frame.IsHScreen===true){this.Canvas.rect(border.Left,border.BottomEx,border.Right-border.Left,border.Bottom-border.BottomEx);}else{this.Canvas.rect(border.RightEx,border.Top,border.Right-border.RightEx,border.Bottom-border.Top);}if(this.Canvas.isPointInPath(x,y))return 3;}return-1;};//手势
|
|
7758
|
-
this.OnTouchStart=function(e){if(this.DragMode==0)return;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsOnTouch=true;this.TouchDrawCount=0;this.PhonePinch=null;this.StopDragTimer();if(this.EnableScrollUpDown==false)e.preventDefault();//上下拖动图形不能阻止事件
|
|
7767
|
+
this.OnTouchStart=function(e){if(this.DragMode==0)return;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsPress=false;this.IsOnTouch=true;this.TouchDrawCount=0;this.PhonePinch=null;this.StopDragTimer();if(this.EnableScrollUpDown==false)e.preventDefault();//上下拖动图形不能阻止事件
|
|
7759
7768
|
if(this.IsPhoneDragging(e)){var drag={Click:{},LastMove:{}};//LastMove=最后移动的位置
|
|
7760
7769
|
var touches=this.GetToucheData(e,this.IsForceLandscape);var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);if(this.TryClickLock||this.TryClickIndexTitle)//指标枷锁区域 , 指标标题点击
|
|
7761
7770
|
{var x=pt.X;var y=pt.Y;if(this.TryClickLock&&this.TryClickLock(x,y))return;if(this.TryClickIndexTitle&&this.TryClickIndexTitle(x,y))return;}if(this.ClickFrameButton){var button=this.Frame.PtInButtons(pt.X,pt.Y);if(button){this.ClickFrameButton(button,e);return;}}drag.Click.X=touches[0].clientX;drag.Click.Y=touches[0].clientY;drag.LastMove.X=touches[0].clientX;drag.LastMove.Y=touches[0].clientY;var self=this;var T_ShowCorssCursor=function T_ShowCorssCursor()//临时函数(Temp_) T_开头
|
|
@@ -7764,7 +7773,7 @@ var touches=this.GetToucheData(e,this.IsForceLandscape);var pt=this.PointAbsolut
|
|
|
7764
7773
|
{var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==2)this.SetChartDrawPictureThirdPoint(drag.Click.X,drag.Click.Y,true);else{this.SetChartDrawPictureFirstPoint(drag.Click.X,drag.Click.Y,true);//只有1个点 直接完成
|
|
7765
7774
|
if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo({Corss:false,Tooltip:false});}if(e.cancelable)e.preventDefault();return;}else{var drawPictrueData={};var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
|
|
7766
7775
|
drawPictrueData.X=touches[0].clientX-uielement.getBoundingClientRect().left;drawPictrueData.Y=touches[0].clientY-uielement.getBoundingClientRect().top;if(this.GetChartDrawPictureByPoint(drawPictrueData)){drawPictrueData.ChartDrawPicture.Status=20;drawPictrueData.ChartDrawPicture.ValueToPoint();drawPictrueData.ChartDrawPicture.MovePointIndex=drawPictrueData.PointIndex;drawPictrueData.ChartDrawPicture.IsSelected=true;this.CurrentChartDrawPicture=drawPictrueData.ChartDrawPicture;this.SelectChartDrawPicture=drawPictrueData.ChartDrawPicture;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_DRAWPICTURE);//选中画图工具事件
|
|
7767
|
-
if(event&&event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};event.Callback(event,sendData,this);}if(e.cancelable)e.preventDefault();return;}}}else{if(this.EnableScrollUpDown==true){this.DragTimer=setTimeout(function(){if(drag.Click.X==drag.LastMove.X&&drag.Click.Y==drag.LastMove.Y){var mouseDrag=self.MouseDrag;self.MouseDrag=null;T_ShowCorssCursor();self.PreventTouchEvent(e);}},800);}this.MouseDrag=drag;this.PhoneTouchInfo={Start:{X:touches[0].clientX,Y:touches[0].clientY},End:{X:touches[0].clientX,Y:touches[0].clientY}};this.SelectChartDrawPicture=null;if(this.EnableScrollUpDown==false)T_ShowCorssCursor();//移动十字光标
|
|
7776
|
+
if(event&&event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};event.Callback(event,sendData,this);}if(e.cancelable)e.preventDefault();return;}}}else{if(this.EnableScrollUpDown==true){this.DragTimer=setTimeout(function(){self.IsPress=true;if(drag.Click.X==drag.LastMove.X&&drag.Click.Y==drag.LastMove.Y){var mouseDrag=self.MouseDrag;self.MouseDrag=null;T_ShowCorssCursor();self.PreventTouchEvent(e);}},800);}this.MouseDrag=drag;this.PhoneTouchInfo={Start:{X:touches[0].clientX,Y:touches[0].clientY},End:{X:touches[0].clientX,Y:touches[0].clientY}};this.SelectChartDrawPicture=null;if(this.EnableScrollUpDown==false)T_ShowCorssCursor();//移动十字光标
|
|
7768
7777
|
else if(this.IsClickShowCorssCursor)T_ShowCorssCursor();}if(this.EnableZoomIndexWindow){this.PhoneDBClick.AddTouchStart(touches[0].clientX,touches[0].clientY,Date.now());JSConsole.Chart.Log("[MinuteChartContainer::OnTouchStart] PhoneDBClick ",this.PhoneDBClick);}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){var pixelTatio=GetDevicePixelRatio();var x=touches[0].clientX-uielement.getBoundingClientRect().left*pixelTatio;var y=touches[0].clientY-uielement.getBoundingClientRect().top*pixelTatio;this.OnMouseMove(x,y,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);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)//画图工具移动
|
|
7769
7778
|
{if(moveSetp<5&&moveUpDown<5)return;if(this.MoveChartDrawPicture(touches[0].clientX-drag.LastMove.X,touches[0].clientY-drag.LastMove.Y,true)){this.DrawDynamicInfo();}}drag.LastMove.X=touches[0].clientX;drag.LastMove.Y=touches[0].clientY;}else{//上下滚动
|
|
7770
7779
|
if((moveUpDown>0&&moveSetp<=3||moveAngle<=this.TouchMoveMinAngle)&&this.EnableScrollUpDown==true){this.StopDragTimer();return;}this.PreventTouchEvent(e);this.MouseDrag=null;var pixelTatio=GetDevicePixelRatio();var x=touches[0].clientX-uielement.getBoundingClientRect().left*pixelTatio;var y=touches[0].clientY-uielement.getBoundingClientRect().top*pixelTatio;this.OnMouseMove(x,y,e);}}if(this.PhoneTouchInfo){this.PhoneTouchInfo.End.X=touches[0].clientX;this.PhoneTouchInfo.End.Y=touches[0].clientY;}}else if(this.IsPhonePinching(e)){this.PreventTouchEvent(e);var phonePinch=this.PhonePinch;if(!phonePinch)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(xStep)>minStep){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MINUTE_TOUCH_ZOOM);if(event&&event.Callback){var data={XStep:xStep,YStep:yStep,PreventDefault:false};event.Callback(event,data,this);if(data.PreventDefault){this.PhonePinch=null;this.StopDragTimer();return;}}}phonePinch.Last={"X":touches[0].pageX,"Y":touches[0].pageY,"X2":touches[1].pageX,"Y2":touches[1].pageY};}if(this.EnableScrollUpDown==false){e.preventDefault();}else{if(drag==null){this.PreventTouchEvent(e);//十字光标出来了,阻止消息
|
|
@@ -7966,7 +7975,8 @@ if(this.IsBeforeData)this.BeforeOpenData=beforeOpenData;if(this.IsAfterData)this
|
|
|
7966
7975
|
this.DataStatus.LatestDate=data.stock[0].date;//保存下最后一天的日期
|
|
7967
7976
|
this.DataStatus.LatestDay=true;if(this.DayCount>1)//多日走势图
|
|
7968
7977
|
{this.UpdateCallCationData(beforeOpenData,afterCloseData);this.UpdateLineColorData(aryColorData,data.stock[0].date);this.UpdateLatestMinuteData(aryMinuteData,data.stock[0].date,data.stock[0]);this.UpdateHistoryMinuteUI(updateTime);this.RecvMinuteDataEvent({FunctionName:"RecvMinuteData"});this.RequestOverlayMinuteData();//请求叠加数据 (主数据下载完再下载)
|
|
7969
|
-
this.BindAllOverlayIndexData(this.SourceData);this.AutoUpdateEvent(true,"MinuteChartContainer::RecvMinuteData");this.AutoUpdate();return;}
|
|
7978
|
+
this.BindAllOverlayIndexData(this.SourceData);this.AutoUpdateEvent(true,"MinuteChartContainer::RecvMinuteData");this.AutoUpdate();return;}if(this.IsOnTouch==true)//正在操作中不更新数据
|
|
7979
|
+
{if(this.SourceData&&IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data)){this.AutoUpdate();return;}}//原始数据
|
|
7970
7980
|
var sourceData=new ChartData();sourceData.Data=aryMinuteData;sourceData.UpdateTime=updateTime;this.ColorLineData=aryColorData;this.TradeDate=data.stock[0].date;this.Frame.SetDayCount(1);//单日数据
|
|
7971
7981
|
this.SourceData=sourceData;this.Symbol=data.stock[0].symbol;this.Name=data.stock[0].name;this.SetCallCationDataBorder({Left:this.IsBeforeData,Right:this.IsAfterData,MultiDay:{Left:false,Right:false}});if(this.ShareAfterVol==2)//盘前, 盘后成交量公用坐标
|
|
7972
7982
|
{if(this.BeforeOpenData&&this.AfterCloseData){var max=Math.max(this.BeforeOpenData.VolMax,this.AfterCloseData.VolMax);var min=Math.min(this.BeforeOpenData.VolMin,this.AfterCloseData.VolMin);this.BeforeOpenData.VolMax=this.AfterCloseData.VolMax=max;this.BeforeOpenData.VolMin=this.AfterCloseData.VolMin=min;}}var yClose=data.stock[0].yclose;var upperSymbol=this.Symbol.toUpperCase();var isFutures=MARKET_SUFFIX_NAME.IsFutures(upperSymbol);if(data.stock[0].yclearing>0&&isFutures)yClose=data.stock[0].yclearing;//期货使用前结算价
|
|
@@ -8339,7 +8349,7 @@ if(this.JSChartContainer.ChartSplashPaint&&this.JSChartContainer.ChartSplashPain
|
|
|
8339
8349
|
if(this.JSChartContainer.DataMove(moveSetp,isLeft)){this.JSChartContainer.UpdataDataoffset();this.JSChartContainer.UpdatePointByCursorIndex();this.JSChartContainer.UpdateFrameMaxMin();this.JSChartContainer.ResetFrameXYSplit();this.JSChartContainer.Draw();}drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};document.onmouseup=function(e){//清空事件
|
|
8340
8350
|
document.onmousemove=null;document.onmouseup=null;//清空数据
|
|
8341
8351
|
this.JSChartContainer.MouseDrag=null;this.JSChartContainer.CurrentChartDrawPicture=null;this.JSChartContainer=null;};};//手机拖拽
|
|
8342
|
-
this.OnTouchStart=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.PhonePinch=null;this.IsOnTouch=true;this.TouchDrawCount=0;this.StopDragTimer();var isSingleTouch=this.IsSingleTouch(e);if(e.cancelable)e.preventDefault();if(this.IsPhoneDragging(e)){var touches=this.GetToucheData(e,false);var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);if(this.TryClickLock||this.TryClickIndexTitle)//指标枷锁区域, 指标标题点击
|
|
8352
|
+
this.OnTouchStart=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.IsPress=false;this.PhonePinch=null;this.IsOnTouch=true;this.TouchDrawCount=0;this.StopDragTimer();var isSingleTouch=this.IsSingleTouch(e);if(e.cancelable)e.preventDefault();if(this.IsPhoneDragging(e)){var touches=this.GetToucheData(e,false);var pt=this.PointAbsoluteToRelative(touches[0].clientX,touches[0].clientY,true);if(this.TryClickLock||this.TryClickIndexTitle)//指标枷锁区域, 指标标题点击
|
|
8343
8353
|
{var x=pt.X;var y=pt.Y;if(this.TryClickLock&&this.TryClickLock(x,y))return;if(this.TryClickIndexTitle&&this.TryClickIndexTitle(x,y))return;}if(this.ClickFrameButton){var button=this.Frame.PtInButtons(pt.X,pt.Y);if(button){this.ClickFrameButton(button,e);return;}}if(this.EnableVerticalDrag){this.VerticalDrag={IsDrag:false};if(this.Frame.PtInFrameVertical(pt.X,pt.Y))this.VerticalDrag.IsDrag=true;}var bStartTimer=true;if(this.ChartDrawOption.IsLockScreen){bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.CLICK_TOUCH_MODE_ID){if(this.TouchStatus.CorssCursorShow==true)bStartTimer=false;}else if(this.DragMode==JSCHART_DRAG_ID.DISABLE_DRAG_ID){bStartTimer=false;}else{if(!isSingleTouch)bStartTimer=false;}if(this.VerticalDrag)bStartTimer=false;var drag={Click:{},LastMove:{}};//LastMove=最后移动的位置
|
|
8344
8354
|
//var touches=this.GetToucheData(e,false);
|
|
8345
8355
|
drag.Click.X=touches[0].clientX;drag.Click.Y=touches[0].clientY;drag.LastMove.X=touches[0].clientX;drag.LastMove.Y=touches[0].clientY;this.MouseDrag=drag;this.PhoneTouchInfo={Start:{X:touches[0].clientX,Y:touches[0].clientY},End:{X:touches[0].clientX,Y:touches[0].clientY}};if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.IsSelected=false;this.SelectChartDrawPicture=null;if(this.CurrentChartDrawPicture)//画图工具模式
|
|
@@ -8347,7 +8357,7 @@ drag.Click.X=touches[0].clientX;drag.Click.Y=touches[0].clientY;drag.LastMove.X=
|
|
|
8347
8357
|
if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo({Corss:false,Tooltip:false});}if(e.cancelable)e.preventDefault();return;}else{var drawPictrueData={};var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
|
|
8348
8358
|
drawPictrueData.X=touches[0].clientX-uielement.getBoundingClientRect().left;drawPictrueData.Y=touches[0].clientY-uielement.getBoundingClientRect().top;if(this.GetChartDrawPictureByPoint(drawPictrueData)){drawPictrueData.ChartDrawPicture.Status=20;drawPictrueData.ChartDrawPicture.ValueToPoint();drawPictrueData.ChartDrawPicture.MovePointIndex=drawPictrueData.PointIndex;drawPictrueData.ChartDrawPicture.IsSelected=true;this.CurrentChartDrawPicture=drawPictrueData.ChartDrawPicture;this.SelectChartDrawPicture=drawPictrueData.ChartDrawPicture;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_DRAWPICTURE);//选中画图工具事件
|
|
8349
8359
|
if(event&&event.Callback){var sendData={DrawPicture:drawPictrueData.ChartDrawPicture};event.Callback(event,sendData,this);}if(e.cancelable)e.preventDefault();return;}}if(bStartTimer)//长按2秒,十字光标
|
|
8350
|
-
{var self=this;this.DragTimer=setTimeout(function(){if(drag.Click.X==drag.LastMove.X&&drag.Click.Y==drag.LastMove.Y)//手指没有移动,出现十字光标
|
|
8360
|
+
{var self=this;this.DragTimer=setTimeout(function(){self.IsPress=false;if(drag.Click.X==drag.LastMove.X&&drag.Click.Y==drag.LastMove.Y)//手指没有移动,出现十字光标
|
|
8351
8361
|
{var mouseDrag=self.MouseDrag;self.MouseDrag=null;self.MoveCorssCursor(drag.Click,e);//移动十字光标
|
|
8352
8362
|
}},self.PressTime);}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.VerticalDrag){if(!this.VerticalDrag.IsDrag)this.MoveCorssCursor(drag.Click,e);//没有点击X轴, 就显示十字光标
|
|
8353
8363
|
}else if(this.IsClickShowCorssCursor){this.MoveCorssCursor(drag.Click,e);}}else if(this.IsPhonePinching(e)){var phonePinch={"Start":{},"Last":{}};var touches=this.GetToucheData(e,false);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;//if (this.ChartDrawOption.IsLockScreen) this.PhonePinch=null; //锁屏禁止缩放
|
|
@@ -13032,7 +13042,8 @@ this.UIElement.onmousedown=function(e){_this64.UIOnMouseDown(e);};this.UIElement
|
|
|
13032
13042
|
this.Canvas.lineWidth=pixelTatio;//手机端需要根据分辨率比调整线段宽度
|
|
13033
13043
|
if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash){this.Frame.Draw({IsEnableSplash:this.ChartSplashPaint.IsEnableSplash});this.ChartSplashPaint.Draw();return;}this.Frame.Draw();this.Frame.DrawLogo();//框架内图形
|
|
13034
13044
|
for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(item.IsDrawFirst)item.Draw();}for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.IsDrawFirst)item.Draw();}};this.OnSize=function(){if(!this.Frame)return;this.SetSizeChange(true);this.Draw();};this.SetSizeChange=function(bChanged){for(var i=0;i<this.ChartPaint.length;++i){var chart=this.ChartPaint[i];if(chart)chart.SizeChange=bChanged;}};this.UpdateFrameMaxMin=function(){var max=null,min=null;for(var i=0;i<this.ChartPaint.length;++i){var item=this.ChartPaint[i];if(!item.GetMaxMin)continue;var range=item.GetMaxMin();if(range==null||range.Max==null||range.Min==null)continue;if(max==null||max<range.Max)max=range.Max;if(min==null||min>range.Min)min=range.Min;}if(IFrameSplitOperator.IsNumber(max)&&IFrameSplitOperator.IsNumber(min)){this.Frame.HorizontalMax=max;this.Frame.HorizontalMin=min;}};//未启动
|
|
13035
|
-
this.UIOnDblClick=function(e){};this.CancelDragTimer=function(){if(this.DragTimer){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.UIOnMouseDown=function(e){var _this65=this;this.CancelDragTimer();this.DragSlider=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.SliderChart){var clickData=this.SliderChart.PtInChart(x,y);if(!clickData)
|
|
13045
|
+
this.UIOnDblClick=function(e){};this.CancelDragTimer=function(){if(this.DragTimer){clearTimeout(this.DragTimer);this.DragTimer=null;}};this.UIOnMouseDown=function(e){var _this65=this;this.CancelDragTimer();this.DragSlider=null;this.DragMove={Click:{X:e.clientX,Y:e.clientY},Move:{X:e.clientX,Y:e.clientY},PreMove:{X:e.clientX,Y:e.clientY}};var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.SliderChart){var clickData=this.SliderChart.PtInChart(x,y);if(!clickData){if(!this.Frame.PtInClient(x,y))return;//滚动块直接移动到鼠标点击的位置
|
|
13046
|
+
var index=this.Frame.GetXData(x);index=Math.round(index);var pageRange=this.GetPageRange();var showCount=pageRange.ShowCount;var start=index-parseInt(showCount/2);if(start<0)start=0;var end=start+showCount;if(end>=this.Frame.XPointCount){end=this.Frame.XPointCount-1;start=end-showCount;}var drag={UpdateData:{StartIndex:start,EndIndex:end,Type:3}};this.DragUpdate(drag);return;}this.DragSlider={Click:{X:e.clientX,Y:e.clientY},LastMove:{X:e.clientX,Y:e.clientY},Data:clickData};this.DragSlider.DrawCount=0;//重绘次数
|
|
13036
13047
|
}document.onmousemove=function(e){_this65.DocOnMouseMove(e);};document.onmouseup=function(e){_this65.DocOnMouseUp(e);};};//去掉右键菜单
|
|
13037
13048
|
this.UIOnContextMenu=function(e){e.preventDefault();};this.UIOnMouseMove=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.DragSlider)return;var mouseStatus=mouseStatus={Cursor:"default"};;//鼠标状态
|
|
13038
13049
|
var item=this.SliderChart.PtInChart(x,y);if(item){switch(item.Data.Type){case 0:mouseStatus={Cursor:"grab",Name:"SliderChart"};break;case 1:case 2:mouseStatus={Cursor:"col-resize",Name:"SliderChart"};break;}}if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;};this.UIOnMounseOut=function(e){};this.UIOnMouseleave=function(e){};this.DocOnMouseMove=function(e){var _this66=this;this.DragMove.PreMove.X=this.DragMove.Move.X;this.DragMove.PreMove.Y=this.DragMove.Move.Y;this.DragMove.Move.X=e.clientX;this.DragMove.Move.Y=e.clientX;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;JSConsole.Chart.Log('[JSScrollBarChartContainer::DocOnMouseMove] x='+x+', y='+y);if(this.DragSlider){var drag=this.DragSlider;var moveSetp=(e.clientX-drag.LastMove.X)*pixelTatio;if(Math.abs(moveSetp)<1)return;var pageRange=this.GetPageRange();var left=this.Frame.ChartBorder.GetLeft();var right=this.Frame.ChartBorder.GetRight();this.SliderChart.DragMode=true;var type=drag.Data.Data.Type;var xStart=this.SliderChart.XStart+moveSetp;var xEnd=this.SliderChart.XEnd+moveSetp;if(type==0)//整体移动
|
|
@@ -13041,8 +13052,8 @@ var item=this.SliderChart.PtInChart(x,y);if(item){switch(item.Data.Type){case 0:
|
|
|
13041
13052
|
{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){//清空事件
|
|
13042
13053
|
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: }
|
|
13043
13054
|
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();};//移动滑块
|
|
13044
|
-
this.UpdateXDataOffset=function(obj){if(obj.Type==0){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start+0.5);//四舍五入
|
|
13045
|
-
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:
|
|
13055
|
+
this.UpdateXDataOffset=function(obj){if(!obj)return;var type=obj.Type;if(obj.Type==0){var start=this.Frame.GetXData(obj.XStart);start=parseInt(start+0.5);//四舍五入
|
|
13056
|
+
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;}else if(obj.Type==3){this.XOffsetData.End=obj.EndIndex;this.XOffsetData.Start=obj.StartIndex;type=0;}var endItem=this.SourceData.Data[this.XOffsetData.End];var startItem=this.SourceData.Data[this.XOffsetData.Start];var sendData={Type: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页
|
|
13046
13057
|
var xStart=this.Frame.GetXFromIndex(0);var xEnd=this.Frame.GetXFromIndex(showCount);result.First={XStart:xStart,XEnd:xEnd};//最后一页
|
|
13047
13058
|
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();//是否立即重绘
|
|
13048
13059
|
};}/////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -13063,7 +13074,7 @@ if(!IFrameSplitOperator.IsNumber(this.BorderLine)){this.Canvas.strokeStyle=this.
|
|
|
13063
13074
|
{this.Canvas.moveTo(left,bottom);this.Canvas.lineTo(right,bottom);}if((this.BorderLine&4)>0)//左
|
|
13064
13075
|
{this.Canvas.moveTo(left,top);this.Canvas.lineTo(left,bottom);}if((this.BorderLine&8)>0)//右
|
|
13065
13076
|
{this.Canvas.moveTo(right,top);this.Canvas.lineTo(right,bottom);}this.Canvas.stroke();}};this.GetXFromIndex=function(index){var count=this.XPointCount;if(count==1){if(index==0)return this.ChartBorder.GetLeft();else return this.ChartBorder.GetRight();}else if(count<=0){return this.ChartBorder.GetLeft();}else if(index>=count){return this.ChartBorder.GetRight();}else{var offset=this.ChartBorder.GetLeft()+this.ChartBorder.GetWidth()*index/count;return offset;}};this.GetYFromData=function(value){if(value<=this.HorizontalMin)return this.ChartBorder.GetBottomEx();if(value>=this.HorizontalMax)return this.ChartBorder.GetTopEx();var height=this.ChartBorder.GetHeightEx()*(value-this.HorizontalMin)/(this.HorizontalMax-this.HorizontalMin);return this.ChartBorder.GetBottomEx()-height;};//X坐标转x轴数值
|
|
13066
|
-
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());};this.GetPreSetpWidth=function(){return this.XPointCount*1.0/this.ChartBorder.GetWidth();};this.DrawVertical=function(){if(this.ChartBorder.Bottom<=5)return;if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;var item=this.Data.Data[0];var preYear=parseInt(item.Date/10000);var preDay=item.Date%10000;this.Canvas.font=this.XSplitTextFont;this.Canvas.fillStyle=this.XSplitTextColor;this.Canvas.textBaseline="top";var yText=this.ChartBorder.GetBottom()+2;var top=this.ChartBorder.GetTop();var bottom=this.ChartBorder.GetBottom();var preXText=0;if(ChartData.IsMilliSecondPeriod(this.Data.Period)){var preHour=null;for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var day=item.Date%10000;var time=parseInt(item.Time/1000);var hour=parseInt(time/10000);if(i==0){var text=IFrameSplitOperator.FormatDateString(item.Date,"MM-DD");var x=this.ChartBorder.GetLeft();this.Canvas.textAlign="left";this.Canvas.fillText(text,x,yText);var textWidth=this.Canvas.measureText(text).width+2;preXText=x+textWidth;preDay=day;preHour=hour;continue;}if(hour!=preHour){var text=IFrameSplitOperator.FormatTimeString(item.Time,"HH:MM:SS.fff");var x=this.GetXFromIndex(i);var textWidth=this.Canvas.measureText(text).width+2;if(x-textWidth/2>preXText){this.Canvas.textAlign="center";this.Canvas.fillText(text,x,yText);preXText=x+textWidth/2;}x=ToFixedPoint(x);this.Canvas.strokeStyle=this.XSplitLineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,top);this.Canvas.lineTo(x,bottom);this.Canvas.stroke();preHour=hour;}}}else if(ChartData.IsMinutePeriod(this.Data.Period,true)){for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var day=item.Date%10000;if(i==0){var text=IFrameSplitOperator.FormatDateString(item.Date,"MM-DD");var x=this.ChartBorder.GetLeft();this.Canvas.textAlign="left";this.Canvas.fillText(text,x,yText);var textWidth=this.Canvas.measureText(text).width+2;preXText=x+textWidth;preDay=day;continue;}if(day!=preDay){var text=IFrameSplitOperator.FormatDateString(item.Date,"MM-DD");var x=this.GetXFromIndex(i);var textWidth=this.Canvas.measureText(text).width+2;if(x-textWidth/2>preXText){this.Canvas.textAlign="center";this.Canvas.fillText(text,x,yText);preXText=x+textWidth/2;}x=ToFixedPoint(x);this.Canvas.strokeStyle=this.XSplitLineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,top);this.Canvas.lineTo(x,bottom);this.Canvas.stroke();preDay=day;}}}else{for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var year=parseInt(item.Date/10000);if(i==0){var text=''+year;var x=this.ChartBorder.GetLeft();var textWidth=this.Canvas.measureText(text).width+2;this.Canvas.textAlign="left";this.Canvas.fillText(text,x,yText);preXText=x+textWidth;preYear=year;continue;}if(year!=preYear){var text=''+year;var x=this.GetXFromIndex(i);var textWidth=this.Canvas.measureText(text).width+2;if(x-textWidth/2>preXText){this.Canvas.textAlign="center";this.Canvas.fillText(text,x,yText);preXText=x+textWidth/2;}x=ToFixedPoint(x);this.Canvas.strokeStyle=this.XSplitLineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,top);this.Canvas.lineTo(x,bottom);this.Canvas.stroke();preYear=year;}}}};}/////////////////////////////////////////////////////////////////////////////////////////////////
|
|
13077
|
+
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());};this.GetPreSetpWidth=function(){return this.XPointCount*1.0/this.ChartBorder.GetWidth();};this.DrawVertical=function(){if(this.ChartBorder.Bottom<=5)return;if(!this.Data||!IFrameSplitOperator.IsNonEmptyArray(this.Data.Data))return;var item=this.Data.Data[0];var preYear=parseInt(item.Date/10000);var preDay=item.Date%10000;this.Canvas.font=this.XSplitTextFont;this.Canvas.fillStyle=this.XSplitTextColor;this.Canvas.textBaseline="top";var yText=this.ChartBorder.GetBottom()+2;var top=this.ChartBorder.GetTop();var bottom=this.ChartBorder.GetBottom();var preXText=0;if(ChartData.IsMilliSecondPeriod(this.Data.Period)){var preHour=null;for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var day=item.Date%10000;var time=parseInt(item.Time/1000);var hour=parseInt(time/10000);if(i==0){var text=IFrameSplitOperator.FormatDateString(item.Date,"MM-DD");var x=this.ChartBorder.GetLeft();this.Canvas.textAlign="left";this.Canvas.fillText(text,x,yText);var textWidth=this.Canvas.measureText(text).width+2;preXText=x+textWidth;preDay=day;preHour=hour;continue;}if(hour!=preHour){var text=IFrameSplitOperator.FormatTimeString(item.Time,"HH:MM:SS.fff");var x=this.GetXFromIndex(i);var textWidth=this.Canvas.measureText(text).width+2;if(x-textWidth/2>preXText){this.Canvas.textAlign="center";this.Canvas.fillText(text,x,yText);preXText=x+textWidth/2;}x=ToFixedPoint(x);this.Canvas.strokeStyle=this.XSplitLineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,top);this.Canvas.lineTo(x,bottom);this.Canvas.stroke();preHour=hour;}}}else if(ChartData.IsMinutePeriod(this.Data.Period,true)){for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var day=item.Date%10000;if(i==0){var text=IFrameSplitOperator.FormatDateString(item.Date,"MM-DD");var x=this.ChartBorder.GetLeft();this.Canvas.textAlign="left";this.Canvas.fillText(text,x,yText);var textWidth=this.Canvas.measureText(text).width+2;preXText=x+textWidth;preDay=day;continue;}if(day!=preDay){var text=IFrameSplitOperator.FormatDateString(item.Date,"MM-DD");var x=this.GetXFromIndex(i);var textWidth=this.Canvas.measureText(text).width+2;if(x-textWidth/2>preXText){this.Canvas.textAlign="center";this.Canvas.fillText(text,x,yText);preXText=x+textWidth/2;}x=ToFixedPoint(x);this.Canvas.strokeStyle=this.XSplitLineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,top);this.Canvas.lineTo(x,bottom);this.Canvas.stroke();preDay=day;}}}else{for(var i=0;i<this.Data.Data.length;++i){var item=this.Data.Data[i];var year=parseInt(item.Date/10000);if(i==0){var text=''+year;var x=this.ChartBorder.GetLeft();var textWidth=this.Canvas.measureText(text).width+2;this.Canvas.textAlign="left";this.Canvas.fillText(text,x,yText);preXText=x+textWidth;preYear=year;continue;}if(year!=preYear){var text=''+year;var x=this.GetXFromIndex(i);var textWidth=this.Canvas.measureText(text).width+2;if(x-textWidth/2>preXText){this.Canvas.textAlign="center";this.Canvas.fillText(text,x,yText);preXText=x+textWidth/2;}x=ToFixedPoint(x);this.Canvas.strokeStyle=this.XSplitLineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,top);this.Canvas.lineTo(x,bottom);this.Canvas.stroke();preYear=year;}}}};this.PtInClient=function(x,y){var left=ToFixedPoint(this.ChartBorder.GetLeft());var top=ToFixedPoint(this.ChartBorder.GetTop());var right=ToFixedPoint(this.ChartBorder.GetRight());var bottom=ToFixedPoint(this.ChartBorder.GetBottom());if(x>=left&&x<=right&&y>=top&&y<=bottom)return true;return false;};}/////////////////////////////////////////////////////////////////////////////////////////////////
|
|
13067
13078
|
// 滑块
|
|
13068
13079
|
//
|
|
13069
13080
|
/////////////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -13191,7 +13202,7 @@ hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,St
|
|
|
13191
13202
|
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);};}/********************************************************************************
|
|
13192
13203
|
* 版本信息输出
|
|
13193
13204
|
*
|
|
13194
|
-
*/var HQCHART_VERSION="1.1.
|
|
13205
|
+
*/var HQCHART_VERSION="1.1.13459";function PrintHQChartVersion(){var logo='\n\n*************************************************************************************************************************************************************************** \n* \n* :%@@- \n* :@@@@- \n* =@@@@ :#@@@ .:+#@@@#=: :=*@@@@@@#+-. *@@@@. \n* :@@@@@ .@@@@@ .#@@@@@@@@@@@- +@@@@@@@@@@@@@+ @@@@@ -%@@* \n* +@@@@% #@@@@# *@@@@@@@@@@@@@@%. =@@@@@@@@@@@@@@@- @@@@@ -@@@@+ \n* %@@@@* @@@@@+ .%@@@@@@@@@@@@@@@@%: #@@@@@@@@@@@@@@@% @@@@# *@@@@= \n* @@@@@= @@@@@- .%@@@@@@@*++*%@@@@@@% .%@@@@@@@%*+==+**= -@@@@+ #@@@@- \n* @@@@@. @@@@@. #@@@@@%= =@@@@@@* %@@@@@@#: *@@@@- :::. .-+*###+: ::: .+##+: -%%@@@@@%%%% \n* .@@@@@ .@@@@@. +@@@@@% .@@@@@@ *@@@@@@: %@@@@: +@@@@@%. :%@@@@@@@@@@: *@@@ :@@@@@* @@@@@@@@@@@@ \n* :@@@@@ :@@@@@ @@@@@% :@@@@@+ @@@@@@: %@@@@-@@@@@@@@@. @@@@@@@@@@@@@. :@@@%-@@@@@@.:@@@@@@@@@@@# \n* -@@@@% -@@@@@ =@@@@@. %@@@@% %@@@@@- %@@@@@@@@@@@@@@* %@@@@@@@@@@@@+ -@@@@@@@@@@# -@@@@@@@@@@@. \n* +@@@@%=========#@@@@% @@@@@# :@@@@@ .@@@@@% @@@@@@@@%@@@@@@@ -%+:. .#@@@@* +@@@@@@@%%@. .::+@@@@#:: \n* #@@@@@@@@@@@@@@@@@@@# .@@@@@ .@@@@@ :@@@@@. @@@@@@#. #@@@@@. -@@@@* #@@@@@@: *@@@@+ \n* %@@@@@@@@@@@@@@@@@@@+ :@@@@@ .@@@@@ -@@@@@ @@@@@+ @@@@@. :@@@@* @@@@@% #@@@@- \n* @@@@@@@@@@@@@@@@@@@@: :@@@@% :@@@@@ +@@@@% -@@@@+ @@@@@ -@@@@+ @@@@@. @@@@@. \n* .@@@@@@@@@@@@@@@@@@@@ :@@@@% -@@@@% *@@@@% #@@@@. @@@@@ .=*#%%%@@@@@= :@@@@# @@@@@. \n* -@@@@@:::::::::=@@@@@ :@@@@@ @@@@@* +@@@@% @@@@@ @@@@% -#@@@@@@@@@@@@: -@@@@* @@@@@ \n* =@@@@% =@@@@% .@@@@@ :@@@@@. -@@@@% @@@@@ .@@@@* +@@@@@@@@@@@@@@. =@@@@+ .@@@@@ \n* +@@@@# +@@@@# @@@@@# %@@@@% :@@@@@ .@@@@% =@@@@= -@@@@@*-:..%@@@@ +@@@@= :@@@@# \n* *@@@@* *@@@@* +@@@@@: #@@@@@+ .@@@@@@ :@@@@% *@@@@- @@@@@. @@@@% #@@@@: =@@@@+ \n* %@@@@= %@@@@+ @@@@@@- .%@@@@@# #@@@@@# :@@@@% #@@@@: @@@@% @@@@* %@@@@. #@@@@- \n* @@@@@- @@@@@= =@@@@@@#=...-*@@@@@@@: @@@@@@%=. :+**. :@@@@* %@@@@. .@@@@* *@@@@= @@@@@ %@@@@+ \n* .@@@@@: .@@@@@: *@@@@@@@@@@@@@@@@@@@# =@@@@@@@@%%%@@@@@@ +@@@@- @@@@@ .@@@@@: :%@@@@@- .@@@@% %@@@@@*+- \n* :@@@@@ :@@@@@ +@@@@@@@@@@@@@@@@@@@# =@@@@@@@@@@@@@@@@% %@@@@ @@@@@ @@@@@@@@@@@@@@@: -@@@@* *@@@@@@@@- \n* =@@@@@ -@@@@@ :@@@@@@@@@@@@@@@@@@@# :@@@@@@@@@@@@@@@% @@@@@ %@@@% #@@@@@@@@@#@@@@. +@@@@- .@@@@@@@@# \n* *@@@@# =@@@@% :#@@@@@@@#: :@@@@@= =@@@@@@@@@@@+. @@@@@ :@@@+ *@@@@@@@- %@@@ *@@@= =@@@@@@@* \n* =++++- -++++= .:::. .=*+: :-=+++=:. ****= .=+. .-++=: :+++ -+=: .-=+=:. \n* \n* \n* HQChart \n* Ver: '+HQCHART_VERSION+' \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n************************************************************************************************************************************************************************** \n ';console.log(logo);}PrintHQChartVersion();//把给外界调用的方法暴露出来
|
|
13195
13206
|
exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
|
|
13196
13207
|
// BaseIndex:BaseIndex,
|
|
13197
13208
|
// ChartLine:ChartLine,
|
package/package.json
CHANGED
package/src/jscommon/umychart.js
CHANGED
|
@@ -2583,6 +2583,8 @@ var JSCHART_EVENT_ID=
|
|
|
2583
2583
|
ON_CREATE_RIGHT_MENU:152, //创建右键菜单
|
|
2584
2584
|
|
|
2585
2585
|
ON_FORMAT_CALL_AUCTION_INDEX_TITLE:153, //集合竞价指标窗口标题内容
|
|
2586
|
+
|
|
2587
|
+
ON_FORMAT_KLINE_HIGH_LOW_TITLE:154, //K线最高最低价格式化内容
|
|
2586
2588
|
}
|
|
2587
2589
|
|
|
2588
2590
|
var JSCHART_OPERATOR_ID=
|
|
@@ -2916,6 +2918,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
2916
2918
|
this.DisableMouse=false; //禁止鼠标事件
|
|
2917
2919
|
this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;
|
|
2918
2920
|
this.PressTime=500;
|
|
2921
|
+
this.IsPress=false; //是否长按
|
|
2919
2922
|
|
|
2920
2923
|
this.NetworkFilter; //网络请求回调 function(data, callback);
|
|
2921
2924
|
this.LastMouseStatus={ MouseOnToolbar:null }; // MouseOnToolbar={ Rect:{}, Title: }
|
|
@@ -4469,6 +4472,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4469
4472
|
{
|
|
4470
4473
|
clearTimeout(this.DragTimer);
|
|
4471
4474
|
this.DragTimer=null;
|
|
4475
|
+
this.IsPress=false;
|
|
4472
4476
|
}
|
|
4473
4477
|
}
|
|
4474
4478
|
|
|
@@ -4506,6 +4510,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4506
4510
|
{
|
|
4507
4511
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
4508
4512
|
|
|
4513
|
+
this.IsPress=false;
|
|
4509
4514
|
this.IsOnTouch=true;
|
|
4510
4515
|
this.TouchDrawCount=0;
|
|
4511
4516
|
this.PhonePinch=null;
|
|
@@ -4646,6 +4651,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
4646
4651
|
var self=this;
|
|
4647
4652
|
this.DragTimer=setTimeout(function()
|
|
4648
4653
|
{
|
|
4654
|
+
self.IsPress=true;
|
|
4649
4655
|
if (drag.Click.X==drag.LastMove.X && drag.Click.Y==drag.LastMove.Y) //手指没有移动,出现十字光标
|
|
4650
4656
|
{
|
|
4651
4657
|
var mouseDrag=self.MouseDrag;
|
|
@@ -26228,11 +26234,37 @@ function ChartKLine()
|
|
|
26228
26234
|
}
|
|
26229
26235
|
}
|
|
26230
26236
|
|
|
26237
|
+
this.OnFormatHighLowTitle=function(ptMax, ptMin)
|
|
26238
|
+
{
|
|
26239
|
+
if (!ptMax || !ptMin) return null;
|
|
26240
|
+
if (!IFrameSplitOperator.IsNumber(ptMax.Value) || !IFrameSplitOperator.IsNumber(ptMin.Value)) return null;
|
|
26241
|
+
|
|
26242
|
+
var defaultfloatPrecision=GetfloatPrecision(this.Symbol); //小数位数
|
|
26243
|
+
var title=
|
|
26244
|
+
{
|
|
26245
|
+
High:ptMax.Value.toFixed(defaultfloatPrecision),
|
|
26246
|
+
Low:ptMin.Value.toFixed(defaultfloatPrecision)
|
|
26247
|
+
};
|
|
26248
|
+
|
|
26249
|
+
if (!this.GetEventCallback) return title;
|
|
26250
|
+
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_KLINE_HIGH_LOW_TITLE);
|
|
26251
|
+
if (!event || !event.Callback) return title;
|
|
26252
|
+
|
|
26253
|
+
var data={ Max:ptMax, Min:ptMin, Symbol:this.Symbol, Title:{ High:title.High, Low:title.Low }, Decimal:defaultfloatPrecision, PreventDefault:false };
|
|
26254
|
+
event.Callback(event, data, this);
|
|
26255
|
+
if (data.PreventDefault) return data.Title; //使用外部回调的数值
|
|
26256
|
+
|
|
26257
|
+
return title;
|
|
26258
|
+
}
|
|
26259
|
+
|
|
26231
26260
|
this.DrawMaxMinPrice=function(ptMax,ptMin)
|
|
26232
26261
|
{
|
|
26233
26262
|
if (ptMax.X==null || ptMax.Y==null || ptMax.Value==null) return;
|
|
26234
26263
|
if (ptMin.X==null || ptMin.Y==null || ptMin.Value==null) return;
|
|
26235
26264
|
|
|
26265
|
+
var title=this.OnFormatHighLowTitle(ptMax,ptMin);
|
|
26266
|
+
if (!title) return;
|
|
26267
|
+
|
|
26236
26268
|
var leftArrow=g_JSChartResource.KLine.MaxMin.LeftArrow;
|
|
26237
26269
|
var rightArrow=g_JSChartResource.KLine.MaxMin.RightArrow;
|
|
26238
26270
|
var highYOffset=g_JSChartResource.KLine.MaxMin.HighYOffset;
|
|
@@ -26240,26 +26272,32 @@ function ChartKLine()
|
|
|
26240
26272
|
|
|
26241
26273
|
var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
26242
26274
|
this.Canvas.font=this.TextFont;
|
|
26243
|
-
|
|
26275
|
+
|
|
26244
26276
|
var top=this.ChartBorder.GetTopEx();
|
|
26245
26277
|
var bottom=this.ChartBorder.GetBottomEx();
|
|
26246
26278
|
|
|
26247
26279
|
var ptTop=ptMax;
|
|
26280
|
+
var text=title.High;
|
|
26281
|
+
var textColor=this.TextColor;
|
|
26248
26282
|
if (this.ChartFrame.CoordinateType==1) //反转坐标
|
|
26249
26283
|
{
|
|
26250
26284
|
if (ptMax.Y<ptMin.Y) ptTop=ptMin;
|
|
26251
26285
|
this.Canvas.textBaseline='top';
|
|
26286
|
+
var text=title.Low;
|
|
26287
|
+
if (title.LowColor) textColor=title.LowColor;
|
|
26252
26288
|
}
|
|
26253
26289
|
else
|
|
26254
26290
|
{
|
|
26255
26291
|
if (ptMax.Y>ptMin.Y) ptTop=ptMin;
|
|
26256
26292
|
this.Canvas.textBaseline='bottom';
|
|
26293
|
+
if (title.HighColor) textColor=title.HighColor;
|
|
26257
26294
|
}
|
|
26258
|
-
|
|
26295
|
+
|
|
26296
|
+
this.Canvas.fillStyle=textColor;
|
|
26259
26297
|
this.Canvas.textAlign=ptTop.Align;
|
|
26260
26298
|
var left=ptTop.Align=='left'?ptTop.X:ptTop.X;
|
|
26261
26299
|
if (IFrameSplitOperator.IsNumber(highYOffset)) ptTop.Y+=highYOffset;
|
|
26262
|
-
var text=ptTop.Value.toFixed(defaultfloatPrecision);
|
|
26300
|
+
//var text=ptTop.Value.toFixed(defaultfloatPrecision);
|
|
26263
26301
|
if (ptTop.Align=='left') text=leftArrow+text;
|
|
26264
26302
|
else text=text+rightArrow;
|
|
26265
26303
|
if (ptTop.Y>(top-2))
|
|
@@ -26269,21 +26307,27 @@ function ChartKLine()
|
|
|
26269
26307
|
}
|
|
26270
26308
|
|
|
26271
26309
|
var ptBottom=ptMin;
|
|
26310
|
+
var text=title.Low;
|
|
26311
|
+
var textColor=this.TextColor;
|
|
26272
26312
|
if (this.ChartFrame.CoordinateType==1)
|
|
26273
26313
|
{
|
|
26274
26314
|
if (ptMin.Y>ptMax.Y) ptBottom=ptMax;
|
|
26275
26315
|
this.Canvas.textBaseline='bottom';
|
|
26316
|
+
var text=title.High;
|
|
26317
|
+
if (title.HighColor) textColor=title.HighColor;
|
|
26276
26318
|
}
|
|
26277
26319
|
else
|
|
26278
26320
|
{
|
|
26279
26321
|
if (ptMax.Y>ptMin.Y) ptTop=ptMin;
|
|
26280
26322
|
this.Canvas.textBaseline='top';
|
|
26323
|
+
if (title.LowColor) textColor=title.LowColor;
|
|
26281
26324
|
}
|
|
26325
|
+
|
|
26326
|
+
this.Canvas.fillStyle=textColor;
|
|
26282
26327
|
this.Canvas.textAlign=ptBottom.Align;
|
|
26283
|
-
|
|
26284
26328
|
var left=ptBottom.Align=='left'?ptBottom.X:ptBottom.X;
|
|
26285
26329
|
if (IFrameSplitOperator.IsNumber(lowYOffset)) ptBottom.Y+=lowYOffset;
|
|
26286
|
-
var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
26330
|
+
//var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
26287
26331
|
if (ptBottom.Align=='left') text=leftArrow+text;
|
|
26288
26332
|
else text=text+rightArrow;
|
|
26289
26333
|
if (ptBottom.Y<(bottom+1))
|
|
@@ -26297,13 +26341,15 @@ function ChartKLine()
|
|
|
26297
26341
|
{
|
|
26298
26342
|
if (ptMax.X==null || ptMax.Y==null || ptMax.Value==null) return;
|
|
26299
26343
|
if (ptMin.X==null || ptMin.Y==null || ptMin.Value==null) return;
|
|
26344
|
+
var title=this.OnFormatHighLowTitle(ptMax,ptMin);
|
|
26345
|
+
if (!title) return;
|
|
26300
26346
|
|
|
26301
26347
|
var leftArrow=g_JSChartResource.KLine.MaxMin.LeftArrow;
|
|
26302
26348
|
var rightArrow=g_JSChartResource.KLine.MaxMin.RightArrow;
|
|
26303
26349
|
var highYOffset=g_JSChartResource.KLine.MaxMin.HighYOffset;
|
|
26304
26350
|
var lowYOffset=g_JSChartResource.KLine.MaxMin.LowYOffset;
|
|
26305
26351
|
|
|
26306
|
-
var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
26352
|
+
//var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
26307
26353
|
var xText=ptMax.Y;
|
|
26308
26354
|
var yText=ptMax.X;
|
|
26309
26355
|
if (IFrameSplitOperator.IsNumber(highYOffset)) xText+=highYOffset;
|
|
@@ -26311,11 +26357,13 @@ function ChartKLine()
|
|
|
26311
26357
|
this.Canvas.translate(xText, yText);
|
|
26312
26358
|
this.Canvas.rotate(90 * Math.PI / 180);
|
|
26313
26359
|
|
|
26360
|
+
var text=title.High;
|
|
26314
26361
|
this.Canvas.font=this.TextFont;
|
|
26315
|
-
this.Canvas.fillStyle=
|
|
26362
|
+
if (title.HighColor) this.Canvas.fillStyle=title.HighColor;
|
|
26363
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
26316
26364
|
this.Canvas.textAlign=ptMax.Align;
|
|
26317
26365
|
this.Canvas.textBaseline='bottom';
|
|
26318
|
-
var text=ptMax.Value.toFixed(defaultfloatPrecision);
|
|
26366
|
+
//var text=ptMax.Value.toFixed(defaultfloatPrecision);
|
|
26319
26367
|
if (ptMax.Align=='left') text=leftArrow+text;
|
|
26320
26368
|
else text=text+rightArrow;
|
|
26321
26369
|
this.Canvas.fillText(text,0,0);
|
|
@@ -26329,11 +26377,13 @@ function ChartKLine()
|
|
|
26329
26377
|
this.Canvas.translate(xText, yText);
|
|
26330
26378
|
this.Canvas.rotate(90 * Math.PI / 180);
|
|
26331
26379
|
|
|
26380
|
+
var text=title.Low;
|
|
26332
26381
|
this.Canvas.font=this.TextFont;
|
|
26333
|
-
this.Canvas.fillStyle=
|
|
26382
|
+
if (title.LowColor) this.Canvas.fillStyle=title.LowColor;
|
|
26383
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
26334
26384
|
this.Canvas.textAlign=ptMin.Align;
|
|
26335
26385
|
this.Canvas.textBaseline='top';
|
|
26336
|
-
var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
26386
|
+
//var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
26337
26387
|
if (ptMin.Align=='left') text=leftArrow+text;
|
|
26338
26388
|
else text=text+rightArrow;
|
|
26339
26389
|
this.Canvas.fillText(text,0,0);
|
|
@@ -77771,6 +77821,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
77771
77821
|
if(this.DragMode==0) return;
|
|
77772
77822
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
77773
77823
|
|
|
77824
|
+
this.IsPress=false;
|
|
77774
77825
|
this.IsOnTouch=true;
|
|
77775
77826
|
this.TouchDrawCount=0;
|
|
77776
77827
|
this.PhonePinch=null;
|
|
@@ -77872,6 +77923,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
77872
77923
|
{
|
|
77873
77924
|
this.DragTimer=setTimeout(function()
|
|
77874
77925
|
{
|
|
77926
|
+
self.IsPress=true;
|
|
77875
77927
|
if (drag.Click.X==drag.LastMove.X && drag.Click.Y==drag.LastMove.Y)
|
|
77876
77928
|
{
|
|
77877
77929
|
var mouseDrag=self.MouseDrag;
|
|
@@ -80533,6 +80585,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
80533
80585
|
return;
|
|
80534
80586
|
}
|
|
80535
80587
|
|
|
80588
|
+
if (this.IsOnTouch==true) //正在操作中不更新数据
|
|
80589
|
+
{
|
|
80590
|
+
if (this.SourceData && IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data))
|
|
80591
|
+
{
|
|
80592
|
+
this.AutoUpdate();
|
|
80593
|
+
return;
|
|
80594
|
+
}
|
|
80595
|
+
}
|
|
80596
|
+
|
|
80536
80597
|
//原始数据
|
|
80537
80598
|
var sourceData=new ChartData();
|
|
80538
80599
|
sourceData.Data=aryMinuteData;
|
|
@@ -83796,6 +83857,7 @@ function KLineChartHScreenContainer(uielement)
|
|
|
83796
83857
|
{
|
|
83797
83858
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
83798
83859
|
|
|
83860
|
+
this.IsPress=false;
|
|
83799
83861
|
this.PhonePinch=null;
|
|
83800
83862
|
this.IsOnTouch=true;
|
|
83801
83863
|
this.TouchDrawCount=0;
|
|
@@ -83915,6 +83977,7 @@ function KLineChartHScreenContainer(uielement)
|
|
|
83915
83977
|
var self=this;
|
|
83916
83978
|
this.DragTimer=setTimeout(function()
|
|
83917
83979
|
{
|
|
83980
|
+
self.IsPress=false;
|
|
83918
83981
|
if (drag.Click.X==drag.LastMove.X && drag.Click.Y==drag.LastMove.Y) //手指没有移动,出现十字光标
|
|
83919
83982
|
{
|
|
83920
83983
|
var mouseDrag=self.MouseDrag;
|
|
@@ -431,7 +431,28 @@ function JSScrollBarChartContainer(uielement)
|
|
|
431
431
|
if (this.SliderChart)
|
|
432
432
|
{
|
|
433
433
|
var clickData=this.SliderChart.PtInChart(x,y);
|
|
434
|
-
if (!clickData)
|
|
434
|
+
if (!clickData)
|
|
435
|
+
{
|
|
436
|
+
if (!this.Frame.PtInClient(x,y)) return;
|
|
437
|
+
|
|
438
|
+
//滚动块直接移动到鼠标点击的位置
|
|
439
|
+
var index=this.Frame.GetXData(x);
|
|
440
|
+
index=Math.round(index);
|
|
441
|
+
var pageRange=this.GetPageRange();
|
|
442
|
+
var showCount=pageRange.ShowCount;
|
|
443
|
+
var start=index-parseInt(showCount/2);
|
|
444
|
+
if (start<0) start=0;
|
|
445
|
+
var end=start+showCount;
|
|
446
|
+
if (end>=this.Frame.XPointCount)
|
|
447
|
+
{
|
|
448
|
+
end=this.Frame.XPointCount-1;
|
|
449
|
+
start=end-showCount;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
var drag={ UpdateData:{ StartIndex:start, EndIndex:end, Type:3 } };
|
|
453
|
+
this.DragUpdate(drag);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
435
456
|
|
|
436
457
|
this.DragSlider={ Click:{ X:e.clientX, Y:e.clientY }, LastMove:{X:e.clientX, Y:e.clientY}, Data:clickData };
|
|
437
458
|
this.DragSlider.DrawCount=0; //重绘次数
|
|
@@ -441,6 +462,7 @@ function JSScrollBarChartContainer(uielement)
|
|
|
441
462
|
document.onmouseup=(e)=> { this.DocOnMouseUp(e); }
|
|
442
463
|
}
|
|
443
464
|
|
|
465
|
+
|
|
444
466
|
//去掉右键菜单
|
|
445
467
|
this.UIOnContextMenu=function(e)
|
|
446
468
|
{
|
|
@@ -679,6 +701,9 @@ function JSScrollBarChartContainer(uielement)
|
|
|
679
701
|
//移动滑块
|
|
680
702
|
this.UpdateXDataOffset=function(obj)
|
|
681
703
|
{
|
|
704
|
+
if (!obj) return;
|
|
705
|
+
|
|
706
|
+
var type=obj.Type;
|
|
682
707
|
if (obj.Type==0)
|
|
683
708
|
{
|
|
684
709
|
var start=this.Frame.GetXData(obj.XStart);
|
|
@@ -700,11 +725,17 @@ function JSScrollBarChartContainer(uielement)
|
|
|
700
725
|
end=parseInt(end);
|
|
701
726
|
this.XOffsetData.End=end;
|
|
702
727
|
}
|
|
728
|
+
else if (obj.Type==3)
|
|
729
|
+
{
|
|
730
|
+
this.XOffsetData.End=obj.EndIndex;
|
|
731
|
+
this.XOffsetData.Start=obj.StartIndex;
|
|
732
|
+
type=0;
|
|
733
|
+
}
|
|
703
734
|
|
|
704
735
|
var endItem=this.SourceData.Data[this.XOffsetData.End];
|
|
705
736
|
var startItem=this.SourceData.Data[this.XOffsetData.Start];
|
|
706
737
|
|
|
707
|
-
var sendData={ Type:
|
|
738
|
+
var sendData={ Type:type, Count:this.XOffsetData.Count };
|
|
708
739
|
if (this.XOffsetData.End>this.XOffsetData.Start)
|
|
709
740
|
{
|
|
710
741
|
sendData.Start={ Index:this.XOffsetData.Start, Item:startItem};
|
|
@@ -1079,6 +1110,18 @@ function JSScrollBarFrame()
|
|
|
1079
1110
|
}
|
|
1080
1111
|
}
|
|
1081
1112
|
}
|
|
1113
|
+
|
|
1114
|
+
this.PtInClient=function(x,y)
|
|
1115
|
+
{
|
|
1116
|
+
var left=ToFixedPoint(this.ChartBorder.GetLeft());
|
|
1117
|
+
var top=ToFixedPoint(this.ChartBorder.GetTop());
|
|
1118
|
+
var right=ToFixedPoint(this.ChartBorder.GetRight());
|
|
1119
|
+
var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
|
|
1120
|
+
|
|
1121
|
+
if (x>=left && x<=right && y>=top && y<=bottom) return true;
|
|
1122
|
+
|
|
1123
|
+
return false;
|
|
1124
|
+
}
|
|
1082
1125
|
}
|
|
1083
1126
|
|
|
1084
1127
|
|
|
@@ -1263,6 +1306,8 @@ function SliderChart()
|
|
|
1263
1306
|
}
|
|
1264
1307
|
}
|
|
1265
1308
|
|
|
1309
|
+
|
|
1310
|
+
|
|
1266
1311
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
1267
1312
|
// 滚动条K线背景色
|
|
1268
1313
|
//
|
|
@@ -6508,6 +6508,8 @@ var JSCHART_EVENT_ID=
|
|
|
6508
6508
|
ON_CREATE_RIGHT_MENU:152, //创建右键菜单
|
|
6509
6509
|
|
|
6510
6510
|
ON_FORMAT_CALL_AUCTION_INDEX_TITLE:153, //集合竞价指标窗口标题内容
|
|
6511
|
+
|
|
6512
|
+
ON_FORMAT_KLINE_HIGH_LOW_TITLE:154, //K线最高最低价格式化内容
|
|
6511
6513
|
}
|
|
6512
6514
|
|
|
6513
6515
|
var JSCHART_OPERATOR_ID=
|
|
@@ -6841,6 +6843,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
6841
6843
|
this.DisableMouse=false; //禁止鼠标事件
|
|
6842
6844
|
this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;
|
|
6843
6845
|
this.PressTime=500;
|
|
6846
|
+
this.IsPress=false; //是否长按
|
|
6844
6847
|
|
|
6845
6848
|
this.NetworkFilter; //网络请求回调 function(data, callback);
|
|
6846
6849
|
this.LastMouseStatus={ MouseOnToolbar:null }; // MouseOnToolbar={ Rect:{}, Title: }
|
|
@@ -8394,6 +8397,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
8394
8397
|
{
|
|
8395
8398
|
clearTimeout(this.DragTimer);
|
|
8396
8399
|
this.DragTimer=null;
|
|
8400
|
+
this.IsPress=false;
|
|
8397
8401
|
}
|
|
8398
8402
|
}
|
|
8399
8403
|
|
|
@@ -8431,6 +8435,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
8431
8435
|
{
|
|
8432
8436
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
8433
8437
|
|
|
8438
|
+
this.IsPress=false;
|
|
8434
8439
|
this.IsOnTouch=true;
|
|
8435
8440
|
this.TouchDrawCount=0;
|
|
8436
8441
|
this.PhonePinch=null;
|
|
@@ -8571,6 +8576,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
8571
8576
|
var self=this;
|
|
8572
8577
|
this.DragTimer=setTimeout(function()
|
|
8573
8578
|
{
|
|
8579
|
+
self.IsPress=true;
|
|
8574
8580
|
if (drag.Click.X==drag.LastMove.X && drag.Click.Y==drag.LastMove.Y) //手指没有移动,出现十字光标
|
|
8575
8581
|
{
|
|
8576
8582
|
var mouseDrag=self.MouseDrag;
|
|
@@ -30153,11 +30159,37 @@ function ChartKLine()
|
|
|
30153
30159
|
}
|
|
30154
30160
|
}
|
|
30155
30161
|
|
|
30162
|
+
this.OnFormatHighLowTitle=function(ptMax, ptMin)
|
|
30163
|
+
{
|
|
30164
|
+
if (!ptMax || !ptMin) return null;
|
|
30165
|
+
if (!IFrameSplitOperator.IsNumber(ptMax.Value) || !IFrameSplitOperator.IsNumber(ptMin.Value)) return null;
|
|
30166
|
+
|
|
30167
|
+
var defaultfloatPrecision=GetfloatPrecision(this.Symbol); //小数位数
|
|
30168
|
+
var title=
|
|
30169
|
+
{
|
|
30170
|
+
High:ptMax.Value.toFixed(defaultfloatPrecision),
|
|
30171
|
+
Low:ptMin.Value.toFixed(defaultfloatPrecision)
|
|
30172
|
+
};
|
|
30173
|
+
|
|
30174
|
+
if (!this.GetEventCallback) return title;
|
|
30175
|
+
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_KLINE_HIGH_LOW_TITLE);
|
|
30176
|
+
if (!event || !event.Callback) return title;
|
|
30177
|
+
|
|
30178
|
+
var data={ Max:ptMax, Min:ptMin, Symbol:this.Symbol, Title:{ High:title.High, Low:title.Low }, Decimal:defaultfloatPrecision, PreventDefault:false };
|
|
30179
|
+
event.Callback(event, data, this);
|
|
30180
|
+
if (data.PreventDefault) return data.Title; //使用外部回调的数值
|
|
30181
|
+
|
|
30182
|
+
return title;
|
|
30183
|
+
}
|
|
30184
|
+
|
|
30156
30185
|
this.DrawMaxMinPrice=function(ptMax,ptMin)
|
|
30157
30186
|
{
|
|
30158
30187
|
if (ptMax.X==null || ptMax.Y==null || ptMax.Value==null) return;
|
|
30159
30188
|
if (ptMin.X==null || ptMin.Y==null || ptMin.Value==null) return;
|
|
30160
30189
|
|
|
30190
|
+
var title=this.OnFormatHighLowTitle(ptMax,ptMin);
|
|
30191
|
+
if (!title) return;
|
|
30192
|
+
|
|
30161
30193
|
var leftArrow=g_JSChartResource.KLine.MaxMin.LeftArrow;
|
|
30162
30194
|
var rightArrow=g_JSChartResource.KLine.MaxMin.RightArrow;
|
|
30163
30195
|
var highYOffset=g_JSChartResource.KLine.MaxMin.HighYOffset;
|
|
@@ -30165,26 +30197,32 @@ function ChartKLine()
|
|
|
30165
30197
|
|
|
30166
30198
|
var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
30167
30199
|
this.Canvas.font=this.TextFont;
|
|
30168
|
-
|
|
30200
|
+
|
|
30169
30201
|
var top=this.ChartBorder.GetTopEx();
|
|
30170
30202
|
var bottom=this.ChartBorder.GetBottomEx();
|
|
30171
30203
|
|
|
30172
30204
|
var ptTop=ptMax;
|
|
30205
|
+
var text=title.High;
|
|
30206
|
+
var textColor=this.TextColor;
|
|
30173
30207
|
if (this.ChartFrame.CoordinateType==1) //反转坐标
|
|
30174
30208
|
{
|
|
30175
30209
|
if (ptMax.Y<ptMin.Y) ptTop=ptMin;
|
|
30176
30210
|
this.Canvas.textBaseline='top';
|
|
30211
|
+
var text=title.Low;
|
|
30212
|
+
if (title.LowColor) textColor=title.LowColor;
|
|
30177
30213
|
}
|
|
30178
30214
|
else
|
|
30179
30215
|
{
|
|
30180
30216
|
if (ptMax.Y>ptMin.Y) ptTop=ptMin;
|
|
30181
30217
|
this.Canvas.textBaseline='bottom';
|
|
30218
|
+
if (title.HighColor) textColor=title.HighColor;
|
|
30182
30219
|
}
|
|
30183
|
-
|
|
30220
|
+
|
|
30221
|
+
this.Canvas.fillStyle=textColor;
|
|
30184
30222
|
this.Canvas.textAlign=ptTop.Align;
|
|
30185
30223
|
var left=ptTop.Align=='left'?ptTop.X:ptTop.X;
|
|
30186
30224
|
if (IFrameSplitOperator.IsNumber(highYOffset)) ptTop.Y+=highYOffset;
|
|
30187
|
-
var text=ptTop.Value.toFixed(defaultfloatPrecision);
|
|
30225
|
+
//var text=ptTop.Value.toFixed(defaultfloatPrecision);
|
|
30188
30226
|
if (ptTop.Align=='left') text=leftArrow+text;
|
|
30189
30227
|
else text=text+rightArrow;
|
|
30190
30228
|
if (ptTop.Y>(top-2))
|
|
@@ -30194,21 +30232,27 @@ function ChartKLine()
|
|
|
30194
30232
|
}
|
|
30195
30233
|
|
|
30196
30234
|
var ptBottom=ptMin;
|
|
30235
|
+
var text=title.Low;
|
|
30236
|
+
var textColor=this.TextColor;
|
|
30197
30237
|
if (this.ChartFrame.CoordinateType==1)
|
|
30198
30238
|
{
|
|
30199
30239
|
if (ptMin.Y>ptMax.Y) ptBottom=ptMax;
|
|
30200
30240
|
this.Canvas.textBaseline='bottom';
|
|
30241
|
+
var text=title.High;
|
|
30242
|
+
if (title.HighColor) textColor=title.HighColor;
|
|
30201
30243
|
}
|
|
30202
30244
|
else
|
|
30203
30245
|
{
|
|
30204
30246
|
if (ptMax.Y>ptMin.Y) ptTop=ptMin;
|
|
30205
30247
|
this.Canvas.textBaseline='top';
|
|
30248
|
+
if (title.LowColor) textColor=title.LowColor;
|
|
30206
30249
|
}
|
|
30250
|
+
|
|
30251
|
+
this.Canvas.fillStyle=textColor;
|
|
30207
30252
|
this.Canvas.textAlign=ptBottom.Align;
|
|
30208
|
-
|
|
30209
30253
|
var left=ptBottom.Align=='left'?ptBottom.X:ptBottom.X;
|
|
30210
30254
|
if (IFrameSplitOperator.IsNumber(lowYOffset)) ptBottom.Y+=lowYOffset;
|
|
30211
|
-
var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
30255
|
+
//var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
30212
30256
|
if (ptBottom.Align=='left') text=leftArrow+text;
|
|
30213
30257
|
else text=text+rightArrow;
|
|
30214
30258
|
if (ptBottom.Y<(bottom+1))
|
|
@@ -30222,13 +30266,15 @@ function ChartKLine()
|
|
|
30222
30266
|
{
|
|
30223
30267
|
if (ptMax.X==null || ptMax.Y==null || ptMax.Value==null) return;
|
|
30224
30268
|
if (ptMin.X==null || ptMin.Y==null || ptMin.Value==null) return;
|
|
30269
|
+
var title=this.OnFormatHighLowTitle(ptMax,ptMin);
|
|
30270
|
+
if (!title) return;
|
|
30225
30271
|
|
|
30226
30272
|
var leftArrow=g_JSChartResource.KLine.MaxMin.LeftArrow;
|
|
30227
30273
|
var rightArrow=g_JSChartResource.KLine.MaxMin.RightArrow;
|
|
30228
30274
|
var highYOffset=g_JSChartResource.KLine.MaxMin.HighYOffset;
|
|
30229
30275
|
var lowYOffset=g_JSChartResource.KLine.MaxMin.LowYOffset;
|
|
30230
30276
|
|
|
30231
|
-
var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
30277
|
+
//var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
30232
30278
|
var xText=ptMax.Y;
|
|
30233
30279
|
var yText=ptMax.X;
|
|
30234
30280
|
if (IFrameSplitOperator.IsNumber(highYOffset)) xText+=highYOffset;
|
|
@@ -30236,11 +30282,13 @@ function ChartKLine()
|
|
|
30236
30282
|
this.Canvas.translate(xText, yText);
|
|
30237
30283
|
this.Canvas.rotate(90 * Math.PI / 180);
|
|
30238
30284
|
|
|
30285
|
+
var text=title.High;
|
|
30239
30286
|
this.Canvas.font=this.TextFont;
|
|
30240
|
-
this.Canvas.fillStyle=
|
|
30287
|
+
if (title.HighColor) this.Canvas.fillStyle=title.HighColor;
|
|
30288
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
30241
30289
|
this.Canvas.textAlign=ptMax.Align;
|
|
30242
30290
|
this.Canvas.textBaseline='bottom';
|
|
30243
|
-
var text=ptMax.Value.toFixed(defaultfloatPrecision);
|
|
30291
|
+
//var text=ptMax.Value.toFixed(defaultfloatPrecision);
|
|
30244
30292
|
if (ptMax.Align=='left') text=leftArrow+text;
|
|
30245
30293
|
else text=text+rightArrow;
|
|
30246
30294
|
this.Canvas.fillText(text,0,0);
|
|
@@ -30254,11 +30302,13 @@ function ChartKLine()
|
|
|
30254
30302
|
this.Canvas.translate(xText, yText);
|
|
30255
30303
|
this.Canvas.rotate(90 * Math.PI / 180);
|
|
30256
30304
|
|
|
30305
|
+
var text=title.Low;
|
|
30257
30306
|
this.Canvas.font=this.TextFont;
|
|
30258
|
-
this.Canvas.fillStyle=
|
|
30307
|
+
if (title.LowColor) this.Canvas.fillStyle=title.LowColor;
|
|
30308
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
30259
30309
|
this.Canvas.textAlign=ptMin.Align;
|
|
30260
30310
|
this.Canvas.textBaseline='top';
|
|
30261
|
-
var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
30311
|
+
//var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
30262
30312
|
if (ptMin.Align=='left') text=leftArrow+text;
|
|
30263
30313
|
else text=text+rightArrow;
|
|
30264
30314
|
this.Canvas.fillText(text,0,0);
|
|
@@ -81696,6 +81746,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
81696
81746
|
if(this.DragMode==0) return;
|
|
81697
81747
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
81698
81748
|
|
|
81749
|
+
this.IsPress=false;
|
|
81699
81750
|
this.IsOnTouch=true;
|
|
81700
81751
|
this.TouchDrawCount=0;
|
|
81701
81752
|
this.PhonePinch=null;
|
|
@@ -81797,6 +81848,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
81797
81848
|
{
|
|
81798
81849
|
this.DragTimer=setTimeout(function()
|
|
81799
81850
|
{
|
|
81851
|
+
self.IsPress=true;
|
|
81800
81852
|
if (drag.Click.X==drag.LastMove.X && drag.Click.Y==drag.LastMove.Y)
|
|
81801
81853
|
{
|
|
81802
81854
|
var mouseDrag=self.MouseDrag;
|
|
@@ -84458,6 +84510,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
84458
84510
|
return;
|
|
84459
84511
|
}
|
|
84460
84512
|
|
|
84513
|
+
if (this.IsOnTouch==true) //正在操作中不更新数据
|
|
84514
|
+
{
|
|
84515
|
+
if (this.SourceData && IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data))
|
|
84516
|
+
{
|
|
84517
|
+
this.AutoUpdate();
|
|
84518
|
+
return;
|
|
84519
|
+
}
|
|
84520
|
+
}
|
|
84521
|
+
|
|
84461
84522
|
//原始数据
|
|
84462
84523
|
var sourceData=new ChartData();
|
|
84463
84524
|
sourceData.Data=aryMinuteData;
|
|
@@ -87721,6 +87782,7 @@ function KLineChartHScreenContainer(uielement)
|
|
|
87721
87782
|
{
|
|
87722
87783
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
87723
87784
|
|
|
87785
|
+
this.IsPress=false;
|
|
87724
87786
|
this.PhonePinch=null;
|
|
87725
87787
|
this.IsOnTouch=true;
|
|
87726
87788
|
this.TouchDrawCount=0;
|
|
@@ -87840,6 +87902,7 @@ function KLineChartHScreenContainer(uielement)
|
|
|
87840
87902
|
var self=this;
|
|
87841
87903
|
this.DragTimer=setTimeout(function()
|
|
87842
87904
|
{
|
|
87905
|
+
self.IsPress=false;
|
|
87843
87906
|
if (drag.Click.X==drag.LastMove.X && drag.Click.Y==drag.LastMove.Y) //手指没有移动,出现十字光标
|
|
87844
87907
|
{
|
|
87845
87908
|
var mouseDrag=self.MouseDrag;
|
|
@@ -133263,7 +133326,28 @@ function JSScrollBarChartContainer(uielement)
|
|
|
133263
133326
|
if (this.SliderChart)
|
|
133264
133327
|
{
|
|
133265
133328
|
var clickData=this.SliderChart.PtInChart(x,y);
|
|
133266
|
-
if (!clickData)
|
|
133329
|
+
if (!clickData)
|
|
133330
|
+
{
|
|
133331
|
+
if (!this.Frame.PtInClient(x,y)) return;
|
|
133332
|
+
|
|
133333
|
+
//滚动块直接移动到鼠标点击的位置
|
|
133334
|
+
var index=this.Frame.GetXData(x);
|
|
133335
|
+
index=Math.round(index);
|
|
133336
|
+
var pageRange=this.GetPageRange();
|
|
133337
|
+
var showCount=pageRange.ShowCount;
|
|
133338
|
+
var start=index-parseInt(showCount/2);
|
|
133339
|
+
if (start<0) start=0;
|
|
133340
|
+
var end=start+showCount;
|
|
133341
|
+
if (end>=this.Frame.XPointCount)
|
|
133342
|
+
{
|
|
133343
|
+
end=this.Frame.XPointCount-1;
|
|
133344
|
+
start=end-showCount;
|
|
133345
|
+
}
|
|
133346
|
+
|
|
133347
|
+
var drag={ UpdateData:{ StartIndex:start, EndIndex:end, Type:3 } };
|
|
133348
|
+
this.DragUpdate(drag);
|
|
133349
|
+
return;
|
|
133350
|
+
}
|
|
133267
133351
|
|
|
133268
133352
|
this.DragSlider={ Click:{ X:e.clientX, Y:e.clientY }, LastMove:{X:e.clientX, Y:e.clientY}, Data:clickData };
|
|
133269
133353
|
this.DragSlider.DrawCount=0; //重绘次数
|
|
@@ -133273,6 +133357,7 @@ function JSScrollBarChartContainer(uielement)
|
|
|
133273
133357
|
document.onmouseup=(e)=> { this.DocOnMouseUp(e); }
|
|
133274
133358
|
}
|
|
133275
133359
|
|
|
133360
|
+
|
|
133276
133361
|
//去掉右键菜单
|
|
133277
133362
|
this.UIOnContextMenu=function(e)
|
|
133278
133363
|
{
|
|
@@ -133511,6 +133596,9 @@ function JSScrollBarChartContainer(uielement)
|
|
|
133511
133596
|
//移动滑块
|
|
133512
133597
|
this.UpdateXDataOffset=function(obj)
|
|
133513
133598
|
{
|
|
133599
|
+
if (!obj) return;
|
|
133600
|
+
|
|
133601
|
+
var type=obj.Type;
|
|
133514
133602
|
if (obj.Type==0)
|
|
133515
133603
|
{
|
|
133516
133604
|
var start=this.Frame.GetXData(obj.XStart);
|
|
@@ -133532,11 +133620,17 @@ function JSScrollBarChartContainer(uielement)
|
|
|
133532
133620
|
end=parseInt(end);
|
|
133533
133621
|
this.XOffsetData.End=end;
|
|
133534
133622
|
}
|
|
133623
|
+
else if (obj.Type==3)
|
|
133624
|
+
{
|
|
133625
|
+
this.XOffsetData.End=obj.EndIndex;
|
|
133626
|
+
this.XOffsetData.Start=obj.StartIndex;
|
|
133627
|
+
type=0;
|
|
133628
|
+
}
|
|
133535
133629
|
|
|
133536
133630
|
var endItem=this.SourceData.Data[this.XOffsetData.End];
|
|
133537
133631
|
var startItem=this.SourceData.Data[this.XOffsetData.Start];
|
|
133538
133632
|
|
|
133539
|
-
var sendData={ Type:
|
|
133633
|
+
var sendData={ Type:type, Count:this.XOffsetData.Count };
|
|
133540
133634
|
if (this.XOffsetData.End>this.XOffsetData.Start)
|
|
133541
133635
|
{
|
|
133542
133636
|
sendData.Start={ Index:this.XOffsetData.Start, Item:startItem};
|
|
@@ -133911,6 +134005,18 @@ function JSScrollBarFrame()
|
|
|
133911
134005
|
}
|
|
133912
134006
|
}
|
|
133913
134007
|
}
|
|
134008
|
+
|
|
134009
|
+
this.PtInClient=function(x,y)
|
|
134010
|
+
{
|
|
134011
|
+
var left=ToFixedPoint(this.ChartBorder.GetLeft());
|
|
134012
|
+
var top=ToFixedPoint(this.ChartBorder.GetTop());
|
|
134013
|
+
var right=ToFixedPoint(this.ChartBorder.GetRight());
|
|
134014
|
+
var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
|
|
134015
|
+
|
|
134016
|
+
if (x>=left && x<=right && y>=top && y<=bottom) return true;
|
|
134017
|
+
|
|
134018
|
+
return false;
|
|
134019
|
+
}
|
|
133914
134020
|
}
|
|
133915
134021
|
|
|
133916
134022
|
|
|
@@ -134095,6 +134201,8 @@ function SliderChart()
|
|
|
134095
134201
|
}
|
|
134096
134202
|
}
|
|
134097
134203
|
|
|
134204
|
+
|
|
134205
|
+
|
|
134098
134206
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
134099
134207
|
// 滚动条K线背景色
|
|
134100
134208
|
//
|
|
@@ -134204,7 +134312,7 @@ function ScrollBarBGChart()
|
|
|
134204
134312
|
|
|
134205
134313
|
|
|
134206
134314
|
|
|
134207
|
-
var HQCHART_VERSION="1.1.
|
|
134315
|
+
var HQCHART_VERSION="1.1.13459";
|
|
134208
134316
|
|
|
134209
134317
|
function PrintHQChartVersion()
|
|
134210
134318
|
{
|
|
@@ -6552,6 +6552,8 @@ var JSCHART_EVENT_ID=
|
|
|
6552
6552
|
ON_CREATE_RIGHT_MENU:152, //创建右键菜单
|
|
6553
6553
|
|
|
6554
6554
|
ON_FORMAT_CALL_AUCTION_INDEX_TITLE:153, //集合竞价指标窗口标题内容
|
|
6555
|
+
|
|
6556
|
+
ON_FORMAT_KLINE_HIGH_LOW_TITLE:154, //K线最高最低价格式化内容
|
|
6555
6557
|
}
|
|
6556
6558
|
|
|
6557
6559
|
var JSCHART_OPERATOR_ID=
|
|
@@ -6885,6 +6887,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
6885
6887
|
this.DisableMouse=false; //禁止鼠标事件
|
|
6886
6888
|
this.LanguageID=JSCHART_LANGUAGE_ID.LANGUAGE_CHINESE_ID;
|
|
6887
6889
|
this.PressTime=500;
|
|
6890
|
+
this.IsPress=false; //是否长按
|
|
6888
6891
|
|
|
6889
6892
|
this.NetworkFilter; //网络请求回调 function(data, callback);
|
|
6890
6893
|
this.LastMouseStatus={ MouseOnToolbar:null }; // MouseOnToolbar={ Rect:{}, Title: }
|
|
@@ -8438,6 +8441,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
8438
8441
|
{
|
|
8439
8442
|
clearTimeout(this.DragTimer);
|
|
8440
8443
|
this.DragTimer=null;
|
|
8444
|
+
this.IsPress=false;
|
|
8441
8445
|
}
|
|
8442
8446
|
}
|
|
8443
8447
|
|
|
@@ -8475,6 +8479,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
8475
8479
|
{
|
|
8476
8480
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
8477
8481
|
|
|
8482
|
+
this.IsPress=false;
|
|
8478
8483
|
this.IsOnTouch=true;
|
|
8479
8484
|
this.TouchDrawCount=0;
|
|
8480
8485
|
this.PhonePinch=null;
|
|
@@ -8615,6 +8620,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
|
|
|
8615
8620
|
var self=this;
|
|
8616
8621
|
this.DragTimer=setTimeout(function()
|
|
8617
8622
|
{
|
|
8623
|
+
self.IsPress=true;
|
|
8618
8624
|
if (drag.Click.X==drag.LastMove.X && drag.Click.Y==drag.LastMove.Y) //手指没有移动,出现十字光标
|
|
8619
8625
|
{
|
|
8620
8626
|
var mouseDrag=self.MouseDrag;
|
|
@@ -30197,11 +30203,37 @@ function ChartKLine()
|
|
|
30197
30203
|
}
|
|
30198
30204
|
}
|
|
30199
30205
|
|
|
30206
|
+
this.OnFormatHighLowTitle=function(ptMax, ptMin)
|
|
30207
|
+
{
|
|
30208
|
+
if (!ptMax || !ptMin) return null;
|
|
30209
|
+
if (!IFrameSplitOperator.IsNumber(ptMax.Value) || !IFrameSplitOperator.IsNumber(ptMin.Value)) return null;
|
|
30210
|
+
|
|
30211
|
+
var defaultfloatPrecision=GetfloatPrecision(this.Symbol); //小数位数
|
|
30212
|
+
var title=
|
|
30213
|
+
{
|
|
30214
|
+
High:ptMax.Value.toFixed(defaultfloatPrecision),
|
|
30215
|
+
Low:ptMin.Value.toFixed(defaultfloatPrecision)
|
|
30216
|
+
};
|
|
30217
|
+
|
|
30218
|
+
if (!this.GetEventCallback) return title;
|
|
30219
|
+
var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_FORMAT_KLINE_HIGH_LOW_TITLE);
|
|
30220
|
+
if (!event || !event.Callback) return title;
|
|
30221
|
+
|
|
30222
|
+
var data={ Max:ptMax, Min:ptMin, Symbol:this.Symbol, Title:{ High:title.High, Low:title.Low }, Decimal:defaultfloatPrecision, PreventDefault:false };
|
|
30223
|
+
event.Callback(event, data, this);
|
|
30224
|
+
if (data.PreventDefault) return data.Title; //使用外部回调的数值
|
|
30225
|
+
|
|
30226
|
+
return title;
|
|
30227
|
+
}
|
|
30228
|
+
|
|
30200
30229
|
this.DrawMaxMinPrice=function(ptMax,ptMin)
|
|
30201
30230
|
{
|
|
30202
30231
|
if (ptMax.X==null || ptMax.Y==null || ptMax.Value==null) return;
|
|
30203
30232
|
if (ptMin.X==null || ptMin.Y==null || ptMin.Value==null) return;
|
|
30204
30233
|
|
|
30234
|
+
var title=this.OnFormatHighLowTitle(ptMax,ptMin);
|
|
30235
|
+
if (!title) return;
|
|
30236
|
+
|
|
30205
30237
|
var leftArrow=g_JSChartResource.KLine.MaxMin.LeftArrow;
|
|
30206
30238
|
var rightArrow=g_JSChartResource.KLine.MaxMin.RightArrow;
|
|
30207
30239
|
var highYOffset=g_JSChartResource.KLine.MaxMin.HighYOffset;
|
|
@@ -30209,26 +30241,32 @@ function ChartKLine()
|
|
|
30209
30241
|
|
|
30210
30242
|
var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
30211
30243
|
this.Canvas.font=this.TextFont;
|
|
30212
|
-
|
|
30244
|
+
|
|
30213
30245
|
var top=this.ChartBorder.GetTopEx();
|
|
30214
30246
|
var bottom=this.ChartBorder.GetBottomEx();
|
|
30215
30247
|
|
|
30216
30248
|
var ptTop=ptMax;
|
|
30249
|
+
var text=title.High;
|
|
30250
|
+
var textColor=this.TextColor;
|
|
30217
30251
|
if (this.ChartFrame.CoordinateType==1) //反转坐标
|
|
30218
30252
|
{
|
|
30219
30253
|
if (ptMax.Y<ptMin.Y) ptTop=ptMin;
|
|
30220
30254
|
this.Canvas.textBaseline='top';
|
|
30255
|
+
var text=title.Low;
|
|
30256
|
+
if (title.LowColor) textColor=title.LowColor;
|
|
30221
30257
|
}
|
|
30222
30258
|
else
|
|
30223
30259
|
{
|
|
30224
30260
|
if (ptMax.Y>ptMin.Y) ptTop=ptMin;
|
|
30225
30261
|
this.Canvas.textBaseline='bottom';
|
|
30262
|
+
if (title.HighColor) textColor=title.HighColor;
|
|
30226
30263
|
}
|
|
30227
|
-
|
|
30264
|
+
|
|
30265
|
+
this.Canvas.fillStyle=textColor;
|
|
30228
30266
|
this.Canvas.textAlign=ptTop.Align;
|
|
30229
30267
|
var left=ptTop.Align=='left'?ptTop.X:ptTop.X;
|
|
30230
30268
|
if (IFrameSplitOperator.IsNumber(highYOffset)) ptTop.Y+=highYOffset;
|
|
30231
|
-
var text=ptTop.Value.toFixed(defaultfloatPrecision);
|
|
30269
|
+
//var text=ptTop.Value.toFixed(defaultfloatPrecision);
|
|
30232
30270
|
if (ptTop.Align=='left') text=leftArrow+text;
|
|
30233
30271
|
else text=text+rightArrow;
|
|
30234
30272
|
if (ptTop.Y>(top-2))
|
|
@@ -30238,21 +30276,27 @@ function ChartKLine()
|
|
|
30238
30276
|
}
|
|
30239
30277
|
|
|
30240
30278
|
var ptBottom=ptMin;
|
|
30279
|
+
var text=title.Low;
|
|
30280
|
+
var textColor=this.TextColor;
|
|
30241
30281
|
if (this.ChartFrame.CoordinateType==1)
|
|
30242
30282
|
{
|
|
30243
30283
|
if (ptMin.Y>ptMax.Y) ptBottom=ptMax;
|
|
30244
30284
|
this.Canvas.textBaseline='bottom';
|
|
30285
|
+
var text=title.High;
|
|
30286
|
+
if (title.HighColor) textColor=title.HighColor;
|
|
30245
30287
|
}
|
|
30246
30288
|
else
|
|
30247
30289
|
{
|
|
30248
30290
|
if (ptMax.Y>ptMin.Y) ptTop=ptMin;
|
|
30249
30291
|
this.Canvas.textBaseline='top';
|
|
30292
|
+
if (title.LowColor) textColor=title.LowColor;
|
|
30250
30293
|
}
|
|
30294
|
+
|
|
30295
|
+
this.Canvas.fillStyle=textColor;
|
|
30251
30296
|
this.Canvas.textAlign=ptBottom.Align;
|
|
30252
|
-
|
|
30253
30297
|
var left=ptBottom.Align=='left'?ptBottom.X:ptBottom.X;
|
|
30254
30298
|
if (IFrameSplitOperator.IsNumber(lowYOffset)) ptBottom.Y+=lowYOffset;
|
|
30255
|
-
var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
30299
|
+
//var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
30256
30300
|
if (ptBottom.Align=='left') text=leftArrow+text;
|
|
30257
30301
|
else text=text+rightArrow;
|
|
30258
30302
|
if (ptBottom.Y<(bottom+1))
|
|
@@ -30266,13 +30310,15 @@ function ChartKLine()
|
|
|
30266
30310
|
{
|
|
30267
30311
|
if (ptMax.X==null || ptMax.Y==null || ptMax.Value==null) return;
|
|
30268
30312
|
if (ptMin.X==null || ptMin.Y==null || ptMin.Value==null) return;
|
|
30313
|
+
var title=this.OnFormatHighLowTitle(ptMax,ptMin);
|
|
30314
|
+
if (!title) return;
|
|
30269
30315
|
|
|
30270
30316
|
var leftArrow=g_JSChartResource.KLine.MaxMin.LeftArrow;
|
|
30271
30317
|
var rightArrow=g_JSChartResource.KLine.MaxMin.RightArrow;
|
|
30272
30318
|
var highYOffset=g_JSChartResource.KLine.MaxMin.HighYOffset;
|
|
30273
30319
|
var lowYOffset=g_JSChartResource.KLine.MaxMin.LowYOffset;
|
|
30274
30320
|
|
|
30275
|
-
var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
30321
|
+
//var defaultfloatPrecision=GetfloatPrecision(this.Symbol);
|
|
30276
30322
|
var xText=ptMax.Y;
|
|
30277
30323
|
var yText=ptMax.X;
|
|
30278
30324
|
if (IFrameSplitOperator.IsNumber(highYOffset)) xText+=highYOffset;
|
|
@@ -30280,11 +30326,13 @@ function ChartKLine()
|
|
|
30280
30326
|
this.Canvas.translate(xText, yText);
|
|
30281
30327
|
this.Canvas.rotate(90 * Math.PI / 180);
|
|
30282
30328
|
|
|
30329
|
+
var text=title.High;
|
|
30283
30330
|
this.Canvas.font=this.TextFont;
|
|
30284
|
-
this.Canvas.fillStyle=
|
|
30331
|
+
if (title.HighColor) this.Canvas.fillStyle=title.HighColor;
|
|
30332
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
30285
30333
|
this.Canvas.textAlign=ptMax.Align;
|
|
30286
30334
|
this.Canvas.textBaseline='bottom';
|
|
30287
|
-
var text=ptMax.Value.toFixed(defaultfloatPrecision);
|
|
30335
|
+
//var text=ptMax.Value.toFixed(defaultfloatPrecision);
|
|
30288
30336
|
if (ptMax.Align=='left') text=leftArrow+text;
|
|
30289
30337
|
else text=text+rightArrow;
|
|
30290
30338
|
this.Canvas.fillText(text,0,0);
|
|
@@ -30298,11 +30346,13 @@ function ChartKLine()
|
|
|
30298
30346
|
this.Canvas.translate(xText, yText);
|
|
30299
30347
|
this.Canvas.rotate(90 * Math.PI / 180);
|
|
30300
30348
|
|
|
30349
|
+
var text=title.Low;
|
|
30301
30350
|
this.Canvas.font=this.TextFont;
|
|
30302
|
-
this.Canvas.fillStyle=
|
|
30351
|
+
if (title.LowColor) this.Canvas.fillStyle=title.LowColor;
|
|
30352
|
+
else this.Canvas.fillStyle=this.TextColor;
|
|
30303
30353
|
this.Canvas.textAlign=ptMin.Align;
|
|
30304
30354
|
this.Canvas.textBaseline='top';
|
|
30305
|
-
var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
30355
|
+
//var text=ptMin.Value.toFixed(defaultfloatPrecision);
|
|
30306
30356
|
if (ptMin.Align=='left') text=leftArrow+text;
|
|
30307
30357
|
else text=text+rightArrow;
|
|
30308
30358
|
this.Canvas.fillText(text,0,0);
|
|
@@ -81740,6 +81790,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
81740
81790
|
if(this.DragMode==0) return;
|
|
81741
81791
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
81742
81792
|
|
|
81793
|
+
this.IsPress=false;
|
|
81743
81794
|
this.IsOnTouch=true;
|
|
81744
81795
|
this.TouchDrawCount=0;
|
|
81745
81796
|
this.PhonePinch=null;
|
|
@@ -81841,6 +81892,7 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
81841
81892
|
{
|
|
81842
81893
|
this.DragTimer=setTimeout(function()
|
|
81843
81894
|
{
|
|
81895
|
+
self.IsPress=true;
|
|
81844
81896
|
if (drag.Click.X==drag.LastMove.X && drag.Click.Y==drag.LastMove.Y)
|
|
81845
81897
|
{
|
|
81846
81898
|
var mouseDrag=self.MouseDrag;
|
|
@@ -84502,6 +84554,15 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
|
|
|
84502
84554
|
return;
|
|
84503
84555
|
}
|
|
84504
84556
|
|
|
84557
|
+
if (this.IsOnTouch==true) //正在操作中不更新数据
|
|
84558
|
+
{
|
|
84559
|
+
if (this.SourceData && IFrameSplitOperator.IsNonEmptyArray(this.SourceData.Data))
|
|
84560
|
+
{
|
|
84561
|
+
this.AutoUpdate();
|
|
84562
|
+
return;
|
|
84563
|
+
}
|
|
84564
|
+
}
|
|
84565
|
+
|
|
84505
84566
|
//原始数据
|
|
84506
84567
|
var sourceData=new ChartData();
|
|
84507
84568
|
sourceData.Data=aryMinuteData;
|
|
@@ -87765,6 +87826,7 @@ function KLineChartHScreenContainer(uielement)
|
|
|
87765
87826
|
{
|
|
87766
87827
|
if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
|
|
87767
87828
|
|
|
87829
|
+
this.IsPress=false;
|
|
87768
87830
|
this.PhonePinch=null;
|
|
87769
87831
|
this.IsOnTouch=true;
|
|
87770
87832
|
this.TouchDrawCount=0;
|
|
@@ -87884,6 +87946,7 @@ function KLineChartHScreenContainer(uielement)
|
|
|
87884
87946
|
var self=this;
|
|
87885
87947
|
this.DragTimer=setTimeout(function()
|
|
87886
87948
|
{
|
|
87949
|
+
self.IsPress=false;
|
|
87887
87950
|
if (drag.Click.X==drag.LastMove.X && drag.Click.Y==drag.LastMove.Y) //手指没有移动,出现十字光标
|
|
87888
87951
|
{
|
|
87889
87952
|
var mouseDrag=self.MouseDrag;
|
|
@@ -135713,7 +135776,28 @@ function JSScrollBarChartContainer(uielement)
|
|
|
135713
135776
|
if (this.SliderChart)
|
|
135714
135777
|
{
|
|
135715
135778
|
var clickData=this.SliderChart.PtInChart(x,y);
|
|
135716
|
-
if (!clickData)
|
|
135779
|
+
if (!clickData)
|
|
135780
|
+
{
|
|
135781
|
+
if (!this.Frame.PtInClient(x,y)) return;
|
|
135782
|
+
|
|
135783
|
+
//滚动块直接移动到鼠标点击的位置
|
|
135784
|
+
var index=this.Frame.GetXData(x);
|
|
135785
|
+
index=Math.round(index);
|
|
135786
|
+
var pageRange=this.GetPageRange();
|
|
135787
|
+
var showCount=pageRange.ShowCount;
|
|
135788
|
+
var start=index-parseInt(showCount/2);
|
|
135789
|
+
if (start<0) start=0;
|
|
135790
|
+
var end=start+showCount;
|
|
135791
|
+
if (end>=this.Frame.XPointCount)
|
|
135792
|
+
{
|
|
135793
|
+
end=this.Frame.XPointCount-1;
|
|
135794
|
+
start=end-showCount;
|
|
135795
|
+
}
|
|
135796
|
+
|
|
135797
|
+
var drag={ UpdateData:{ StartIndex:start, EndIndex:end, Type:3 } };
|
|
135798
|
+
this.DragUpdate(drag);
|
|
135799
|
+
return;
|
|
135800
|
+
}
|
|
135717
135801
|
|
|
135718
135802
|
this.DragSlider={ Click:{ X:e.clientX, Y:e.clientY }, LastMove:{X:e.clientX, Y:e.clientY}, Data:clickData };
|
|
135719
135803
|
this.DragSlider.DrawCount=0; //重绘次数
|
|
@@ -135723,6 +135807,7 @@ function JSScrollBarChartContainer(uielement)
|
|
|
135723
135807
|
document.onmouseup=(e)=> { this.DocOnMouseUp(e); }
|
|
135724
135808
|
}
|
|
135725
135809
|
|
|
135810
|
+
|
|
135726
135811
|
//去掉右键菜单
|
|
135727
135812
|
this.UIOnContextMenu=function(e)
|
|
135728
135813
|
{
|
|
@@ -135961,6 +136046,9 @@ function JSScrollBarChartContainer(uielement)
|
|
|
135961
136046
|
//移动滑块
|
|
135962
136047
|
this.UpdateXDataOffset=function(obj)
|
|
135963
136048
|
{
|
|
136049
|
+
if (!obj) return;
|
|
136050
|
+
|
|
136051
|
+
var type=obj.Type;
|
|
135964
136052
|
if (obj.Type==0)
|
|
135965
136053
|
{
|
|
135966
136054
|
var start=this.Frame.GetXData(obj.XStart);
|
|
@@ -135982,11 +136070,17 @@ function JSScrollBarChartContainer(uielement)
|
|
|
135982
136070
|
end=parseInt(end);
|
|
135983
136071
|
this.XOffsetData.End=end;
|
|
135984
136072
|
}
|
|
136073
|
+
else if (obj.Type==3)
|
|
136074
|
+
{
|
|
136075
|
+
this.XOffsetData.End=obj.EndIndex;
|
|
136076
|
+
this.XOffsetData.Start=obj.StartIndex;
|
|
136077
|
+
type=0;
|
|
136078
|
+
}
|
|
135985
136079
|
|
|
135986
136080
|
var endItem=this.SourceData.Data[this.XOffsetData.End];
|
|
135987
136081
|
var startItem=this.SourceData.Data[this.XOffsetData.Start];
|
|
135988
136082
|
|
|
135989
|
-
var sendData={ Type:
|
|
136083
|
+
var sendData={ Type:type, Count:this.XOffsetData.Count };
|
|
135990
136084
|
if (this.XOffsetData.End>this.XOffsetData.Start)
|
|
135991
136085
|
{
|
|
135992
136086
|
sendData.Start={ Index:this.XOffsetData.Start, Item:startItem};
|
|
@@ -136361,6 +136455,18 @@ function JSScrollBarFrame()
|
|
|
136361
136455
|
}
|
|
136362
136456
|
}
|
|
136363
136457
|
}
|
|
136458
|
+
|
|
136459
|
+
this.PtInClient=function(x,y)
|
|
136460
|
+
{
|
|
136461
|
+
var left=ToFixedPoint(this.ChartBorder.GetLeft());
|
|
136462
|
+
var top=ToFixedPoint(this.ChartBorder.GetTop());
|
|
136463
|
+
var right=ToFixedPoint(this.ChartBorder.GetRight());
|
|
136464
|
+
var bottom=ToFixedPoint(this.ChartBorder.GetBottom());
|
|
136465
|
+
|
|
136466
|
+
if (x>=left && x<=right && y>=top && y<=bottom) return true;
|
|
136467
|
+
|
|
136468
|
+
return false;
|
|
136469
|
+
}
|
|
136364
136470
|
}
|
|
136365
136471
|
|
|
136366
136472
|
|
|
@@ -136545,6 +136651,8 @@ function SliderChart()
|
|
|
136545
136651
|
}
|
|
136546
136652
|
}
|
|
136547
136653
|
|
|
136654
|
+
|
|
136655
|
+
|
|
136548
136656
|
///////////////////////////////////////////////////////////////////////////////////////////////
|
|
136549
136657
|
// 滚动条K线背景色
|
|
136550
136658
|
//
|
|
@@ -138145,7 +138253,7 @@ function HQChartScriptWorker()
|
|
|
138145
138253
|
|
|
138146
138254
|
|
|
138147
138255
|
|
|
138148
|
-
var HQCHART_VERSION="1.1.
|
|
138256
|
+
var HQCHART_VERSION="1.1.13459";
|
|
138149
138257
|
|
|
138150
138258
|
function PrintHQChartVersion()
|
|
138151
138259
|
{
|