hqchart 1.1.11222 → 1.1.11233
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
CHANGED
|
@@ -1380,7 +1380,17 @@ if(IFrameSplitOperator.IsNonEmptyArray(option.Windows)){var scriptData=new JSInd
|
|
|
1380
1380
|
{var apiItem=item.API;chart.WindowIndex[index]=new APIScriptIndex(apiItem.Name,apiItem.Script,apiItem.Args,item);}else{var indexItem=JSIndexMap.Get(item.Index);if(indexItem){chart.WindowIndex[index]=indexItem.Create();//创建子窗口的指标
|
|
1381
1381
|
chart.CreateWindowIndex(index);}else{var indexInfo=scriptData.Get(item.Index);if(!indexInfo)continue;indexInfo.ID=item.Index;var args=indexInfo.Args;if(item.Args)args=item.Args;if(item.IsShortTitle)indexInfo.IsShortTitle=item.IsShortTitle;if(item.TitleFont)indexInfo.TitleFont=item.TitleFont;chart.WindowIndex[index]=new ScriptIndex(indexInfo.Name,indexInfo.Script,args,indexInfo);//脚本执行
|
|
1382
1382
|
if(item.StringFormat>0)chart.WindowIndex[index].StringFormat=item.StringFormat;if(item.FloatPrecision>=0)chart.WindowIndex[index].FloatPrecision=item.FloatPrecision;}}if(item.Modify!=null)chart.Frame.SubFrame[index].Frame.ModifyIndex=item.Modify;if(item.Change!=null)chart.Frame.SubFrame[index].Frame.ChangeIndex=item.Change;if(item.Close!=null)chart.Frame.SubFrame[index].Frame.CloseIndex=item.Close;if(item.Overlay!=null)chart.Frame.SubFrame[index].Frame.OverlayIndex=item.Overlay;if(IFrameSplitOperator.IsNumber(item.YSplitType))chart.Frame.SubFrame[index].Frame.YSplitOperator.SplitType=item.YSplitType;if(!isNaN(item.TitleHeight))chart.Frame.SubFrame[index].Frame.ChartBorder.TitleHeight=item.TitleHeight;if(IFrameSplitOperator.IsBool(item.IsDrawTitleBG))chart.Frame.SubFrame[index].Frame.IsDrawTitleBG=item.IsDrawTitleBG;}}this.AdjustTitleHeight(chart);//叠加指标
|
|
1383
|
-
if(IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex)){for(var i=0;i<option.OverlayIndex.length;++i){var item=option.OverlayIndex[i];if(item.Windows>=chart.Frame.SubFrame.length)continue;var itemString=(0,_stringify2.default)(item);var obj=JSON.parse(itemString);if(item.Index)obj.IndexName=item.Index;if(item.Windows>=0)obj.WindowIndex=item.Windows;chart.CreateOverlayWindowsIndex(obj);}}return chart;}
|
|
1383
|
+
if(IFrameSplitOperator.IsNonEmptyArray(option.OverlayIndex)){for(var i=0;i<option.OverlayIndex.length;++i){var item=option.OverlayIndex[i];if(item.Windows>=chart.Frame.SubFrame.length)continue;var itemString=(0,_stringify2.default)(item);var obj=JSON.parse(itemString);if(item.Index)obj.IndexName=item.Index;if(item.Windows>=0)obj.WindowIndex=item.Windows;chart.CreateOverlayWindowsIndex(obj);}}return chart;};this.CreateMinMinuteChartContainer=function(option){var chart=null;if(option.Type==="迷你分钟走势图横屏")chart=new MinuteChartHScreenContainer(this.CanvasElement);else chart=new MinuteChartContainer(this.CanvasElement);if(option.NetworkFilter)chart.NetworkFilter=option.NetworkFilter;var windowsCount=2;if(option.BeforeOpen)//集合竞价
|
|
1384
|
+
{var item=option.BeforeOpen;if(IFrameSplitOperator.IsBool(item.IsShow))chart.IsShowBeforeData=item.IsShow;if(IFrameSplitOperator.IsNumber(item.Width))chart.ExtendWidth.Left=item.Width;if(IFrameSplitOperator.IsBool(item.IsShowMultiDay))chart.IsShowMultiDayBeforeData=item.IsShowMultiDay;if(IFrameSplitOperator.IsNumber(item.MulitiDayWidth))chart.MultiDayExtendWidth.Left=item.MulitiDayWidth;}if(option.AfterClose)//收盘集合竞价
|
|
1385
|
+
{var item=option.AfterClose;if(IFrameSplitOperator.IsBool(item.IsShow))chart.IsShowAfterData=item.IsShow;if(IFrameSplitOperator.IsNumber(item.ShareVol))chart.ShareAfterVol=item.ShareVol;if(IFrameSplitOperator.IsNumber(item.Width))chart.ExtendWidth.Right=item.Width;if(IFrameSplitOperator.IsBool(item.IsShowMultiDay))chart.IsShowMultiDayAfterData=item.IsShowMultiDay;if(IFrameSplitOperator.IsNumber(item.MulitiDayWidth))chart.MultiDayExtendWidth.Right=item.MulitiDayWidth;}if(!option.Listener)option.Listener={KeyDown:false,Wheel:false};chart.Create(windowsCount,option.Listener);//创建子窗口
|
|
1386
|
+
if(option.CorssCursorInfo){var item=option.CorssCursorInfo;if(IFrameSplitOperator.IsNumber(option.CorssCursorInfo.Left))chart.ChartCorssCursor.ShowTextMode.Left=option.CorssCursorInfo.Left;if(IFrameSplitOperator.IsNumber(option.CorssCursorInfo.Right))chart.ChartCorssCursor.ShowTextMode.Right=option.CorssCursorInfo.Right;if(IFrameSplitOperator.IsNumber(option.CorssCursorInfo.Bottom))chart.ChartCorssCursor.ShowTextMode.Bottom=option.CorssCursorInfo.Bottom;if(option.CorssCursorInfo.IsShowCorss===false)chart.ChartCorssCursor.IsShowCorss=option.CorssCursorInfo.IsShowCorss;if(option.CorssCursorInfo.RightTextFormat>0)chart.ChartCorssCursor.TextFormat.Right=option.CorssCursorInfo.RightTextFormat;if(option.CorssCursorInfo.IsOnlyDrawMinute==true)chart.ChartCorssCursor.IsOnlyDrawMinute=option.CorssCursorInfo.IsOnlyDrawMinute;//Y轴显示收盘价
|
|
1387
|
+
if(IFrameSplitOperator.IsBool(option.CorssCursorInfo.IsFixXLastTime))chart.ChartCorssCursor.IsFixXLastTime=option.CorssCursorInfo.IsFixXLastTime;if(item.RightButton){if(IFrameSplitOperator.IsBool(item.RightButton.Enable))chart.ChartCorssCursor.RightButton.Enable=item.RightButton.Enable;}if(IFrameSplitOperator.IsNumber(item.PriceFormatType))chart.ChartCorssCursor.StringFormatY.PriceFormatType=item.PriceFormatType;if(IFrameSplitOperator.IsNumber(item.DataFormatType))chart.ChartCorssCursor.StringFormatY.DataFormatType=item.DataFormatType;if(IFrameSplitOperator.IsNumber(option.CorssCursorInfo.HPenType))chart.ChartCorssCursor.HPenType=option.CorssCursorInfo.HPenType;if(IFrameSplitOperator.IsNumber(option.CorssCursorInfo.VPenType))chart.ChartCorssCursor.VPenType=option.CorssCursorInfo.VPenType;}if(IFrameSplitOperator.IsNumber(option.DayCount))chart.DayCount=option.DayCount;this.SetChartBorder(chart,option);if(option.SplashTitle)chart.ChartSplashPaint.SplashTitle=option.SplashTitle;chart.TitlePaint[0].IsShow=false;//主窗口 隐藏刻度
|
|
1388
|
+
var mainFrame=chart.Frame.SubFrame[0];mainFrame.Frame.IsShowYText[0]=false;mainFrame.Frame.IsShowYText[1]=false;mainFrame.Frame.IsShowXLine=false;mainFrame.Frame.IsShowYLine=false;mainFrame.Frame.BorderLine=0;chart.Frame.SubFrame[1].Height=0;//隐藏成交量
|
|
1389
|
+
chart.EnableBorderDrag=false;if(option.Frame){for(var i=0;i<option.Frame.length;++i){var item=option.Frame[i];if(!chart.Frame.SubFrame[i])continue;if(item.SplitCount)chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;if(item.StringFormat)chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;if(IFrameSplitOperator.IsNumber(item.SplitType)){chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitType=item.SplitType;chart.Frame.SubFrame[i].Frame.YSplitOperator.DefaultSplitType=item.SplitType;}if(item.IsShowLeftText==false){chart.Frame.SubFrame[i].Frame.IsShowYText[0]=item.IsShowLeftText;chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowLeftText=item.IsShowLeftText;//显示左边刻度
|
|
1390
|
+
}if(item.IsShowRightText==false){chart.Frame.SubFrame[i].Frame.IsShowYText[1]=item.IsShowRightText;chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowRightText=item.IsShowRightText;//显示右边刻度
|
|
1391
|
+
}if(item.Height>=0)chart.Frame.SubFrame[i].Height=item.Height;if(item.Custom)chart.Frame.SubFrame[i].Frame.YSplitOperator.Custom=item.Custom;if(item.RightTextFormat>0)chart.Frame.SubFrame[i].Frame.YSplitOperator.RightTextFormat=item.RightTextFormat;if(IFrameSplitOperator.IsNumber(item.TitleHeight))chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;if(IFrameSplitOperator.IsNumber(item.BorderLine))chart.Frame.SubFrame[i].Frame.BorderLine=item.BorderLine;if(IFrameSplitOperator.IsBool(item.EnableRemoveZero))chart.Frame.SubFrame[i].Frame.YSplitOperator.EnableRemoveZero=item.EnableRemoveZero;if(IFrameSplitOperator.IsNumber(item.FloatPrecision))chart.Frame.SubFrame[i].Frame.YSplitOperator.FloatPrecision=item.FloatPrecision;if(IFrameSplitOperator.IsBool(item.IsShowXLine))chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;if(IFrameSplitOperator.IsBool(item.IsShowYLine))chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;if(IFrameSplitOperator.IsNumber(item.YTextBaseline))chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;}}chart.UpdateXShowText();if(option.MinuteLine){if(option.MinuteLine.IsDrawAreaPrice==false)chart.ChartPaint[0].IsDrawArea=false;if(option.MinuteLine.IsShowLead==false)chart.IsShowLead=false;if(option.MinuteLine.IsShowAveragePrice==false){chart.ChartPaint[1].IsShow=false;chart.TitlePaint[0].IsShowAveragePrice=false;//标题栏均线也不显示
|
|
1392
|
+
for(var i=0;i<chart.ExtendChartPaint.length;++i){var item=chart.ExtendChartPaint[i];if(item.ClassName=="MinuteTooltipPaint")item.IsShowAveragePrice=false;}}if(option.MinuteLine.SplitType>0)chart.Frame.SubFrame[0].Frame.YSplitOperator.SplitType=option.MinuteLine.SplitType;}this.AdjustTitleHeight(chart);if(option.DisableMouseEvent===true){//取消鼠标事件
|
|
1393
|
+
this.CanvasElement.onmousemove=function(e){};this.CanvasElement.oncontextmenu=function(e){};this.CanvasElement.ondblclick=function(e){};this.CanvasElement.onmousedown=function(e){};this.CanvasElement.onmouseout=function(e){};this.CanvasElement.onmouseleave=function(e){};}return chart;};//历史分钟走势图
|
|
1384
1394
|
this.CreateHistoryMinuteChartContainer=function(option){var chart=new HistoryMinuteChartContainer(this.CanvasElement);var windowsCount=2;if(option.Windows&&option.Windows.length>0)windowsCount+=option.Windows.length;//指标窗口从第3个窗口开始
|
|
1385
1395
|
chart.Create(windowsCount);//创建子窗口
|
|
1386
1396
|
if(option.IsShowCorssCursorInfo==false)//取消显示十字光标刻度信息
|
|
@@ -1407,7 +1417,7 @@ this.CreateDepthChartContainer=function(option){var chart=null;chart=new DepthCh
|
|
|
1407
1417
|
}if(item.IsShowRightText===false||item.IsShowRightText===true){chart.Frame.IsShowYText[1]=item.IsShowRightText;chart.Frame.YSplitOperator.IsShowRightText=item.IsShowRightText;//显示右边刻度
|
|
1408
1418
|
}if(item.IsShowXLine==false)chart.Frame.IsShowXLine=item.IsShowXLine;if(item.IsShowYLine==false)chart.Frame.IsShowYLine=item.IsShowYLine;if(IFrameSplitOperator.IsNumber(item.XSplitCount))chart.Frame.XSplitOperator.SplitCount=item.XSplitCount;//X轴刻度个数 半边的
|
|
1409
1419
|
}return chart;};//根据option内容绘制图形
|
|
1410
|
-
this.SetOption=function(option){var chart=null;switch(option.Type){case"历史K线图":case'历史K线图横屏':chart=this.CreateKLineChartContainer(option);break;case"自定义指数历史K线图":chart=this.CreateCustomKLineChartContainer(option);break;case"分钟走势图":case"分钟走势图横屏":chart=this.CreateMinuteChartContainer(option);break;case"历史分钟走势图":chart=this.CreateHistoryMinuteChartContainer(option);break;case'K线训练':case'K线训练横屏':case"简单K线训练":case"简单K线训练横屏":chart=this.CreateKLineTrainChartContainer(option);break;case"深度图":chart=this.CreateDepthChartContainer(option);break;case"简单图形":return this.CreateSimpleChart(option);case"饼图":case'雷达图':return this.CreatePieChart(option);case'地图':return this.CreateMapChart(option);default:return false;}if(!chart)return false;if(option.OnCreatedCallback)option.OnCreatedCallback(chart);//是否自动更新
|
|
1420
|
+
this.SetOption=function(option){var chart=null;switch(option.Type){case"历史K线图":case'历史K线图横屏':chart=this.CreateKLineChartContainer(option);break;case"自定义指数历史K线图":chart=this.CreateCustomKLineChartContainer(option);break;case"分钟走势图":case"分钟走势图横屏":chart=this.CreateMinuteChartContainer(option);break;case"迷你分钟走势图":chart=this.CreateMinMinuteChartContainer(option);break;case"历史分钟走势图":chart=this.CreateHistoryMinuteChartContainer(option);break;case'K线训练':case'K线训练横屏':case"简单K线训练":case"简单K线训练横屏":chart=this.CreateKLineTrainChartContainer(option);break;case"深度图":chart=this.CreateDepthChartContainer(option);break;case"简单图形":return this.CreateSimpleChart(option);case"饼图":case'雷达图':return this.CreatePieChart(option);case'地图':return this.CreateMapChart(option);default:return false;}if(!chart)return false;if(option.OnCreatedCallback)option.OnCreatedCallback(chart);//是否自动更新
|
|
1411
1421
|
if(option.IsAutoUpdate!=null)chart.IsAutoUpdate=option.IsAutoUpdate;if(option.AutoUpdateFrequency>0)chart.AutoUpdateFrequency=option.AutoUpdateFrequency;//注册事件
|
|
1412
1422
|
if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}//设置股票代码
|
|
1413
1423
|
if(!option.Symbol){chart.DrawEmpty();this.JSChartContainer=chart;this.DivElement.JSChart=this;//div中保存一份
|
|
@@ -1623,7 +1633,14 @@ this.GetIndexEvent=function(){return this.GetEventCallback(JSCHART_EVENT_ID.RECV
|
|
|
1623
1633
|
uielement.onmousemove=function(e){_this3.UIOnMouseMove(e);};uielement.oncontextmenu=function(e){return _this3.UIOnContextMenu(e);};uielement.ondblclick=function(e){_this3.UIOnDblClick(e);};uielement.onmousedown=function(e){_this3.UIOnMouseDown(e);};uielement.onmouseout=function(e){_this3.UIOnMounseOut(e);};uielement.onmouseleave=function(e){_this3.UIOnMouseleave(e);};this.UIOnMouseMove=function(e){//JSConsole.Chart.Log('[JSChartContainer.UIOnMouseMove] e.clientX, e.clientY, left, top ',e.clientX, e.clientY, this.getBoundingClientRect().left,this.getBoundingClientRect().top);
|
|
1624
1634
|
var pixelTatio=GetDevicePixelRatio();//鼠标移动坐标是原始坐标 需要乘以放大倍速
|
|
1625
1635
|
var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;//加载数据中,禁用鼠标事件
|
|
1626
|
-
this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;if(this.DisableMouse==true)return;if(this.BorderDrag)return;if(this.YDrag)return;if(this.IndexChartDrag)return
|
|
1636
|
+
this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;if(this.DisableMouse==true)return;if(this.BorderDrag)return;if(this.YDrag)return;if(this.IndexChartDrag)return;/*
|
|
1637
|
+
if (this.CurrentChartDrawPicture)
|
|
1638
|
+
{
|
|
1639
|
+
var drawPicture=this.CurrentChartDrawPicture;
|
|
1640
|
+
if (drawPicture.PointCount<=2) return;
|
|
1641
|
+
JSConsole.Chart.Log("[JSChartContainer::UIOnMouseMove] Status", drawPicture.Status);
|
|
1642
|
+
}
|
|
1643
|
+
*///保存最后一次鼠标移动信息
|
|
1627
1644
|
var MoveStatus={X:x,Y:y,IsInClient:this.IsMouseOnClient(x,y)};this.LastMouseStatus.OnMouseMove=MoveStatus;this.LastMouseStatus.MoveOnPoint={X:x,Y:y};//鼠标移动的位置
|
|
1628
1645
|
//JSConsole.Chart.Log("[JSChartContainer::UIOnMouseMove] MoveStatus", MoveStatus);
|
|
1629
1646
|
this.MoveOnPoint={X:x,Y:y};this.OnMouseMove(x,y,e);this.LastMouseStatus.MoveOnPoint=null;};this.IsMouseOnClient=function(x,y){var isInClient=false;this.Canvas.beginPath();this.Canvas.rect(this.Frame.ChartBorder.GetLeft(),this.Frame.ChartBorder.GetTop(),this.Frame.ChartBorder.GetWidth(),this.Frame.ChartBorder.GetHeight());isInClient=this.Canvas.isPointInPath(x,y);return isInClient;};this.UIOnContextMenu=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var x=e.clientX-this.UIElement.getBoundingClientRect().left;var y=e.clientY-this.UIElement.getBoundingClientRect().top;if(typeof this.OnRightMenu=='function')this.OnRightMenu(x,y,e);//右键菜单事件
|
|
@@ -1730,8 +1747,8 @@ if(option&&option.ParentFunction=='OnMouseMove'&&option.Point){ptPosition=this.F
|
|
|
1730
1747
|
}this.DrawDynamicInfo();}var self=this;window.requestAnimationFrame(function(){self.DrawAnimation();});};this.StartAnimation=function(option){var bCreated=false;//是否已经创建了弹幕画法
|
|
1731
1748
|
var barrageData=null;for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.ClassName==='BarragePaint'){bCreated=true;barrageData=item.BarrageList;break;}}if(!bCreated){var chart=new BarragePaint();chart.Canvas=this.Canvas;chart.ChartBorder=this.Frame.ChartBorder;chart.ChartFrame=this.Frame;chart.HQChart=this;chart.SetOption(option);this.ExtendChartPaint.push(chart);barrageData=chart.BarrageList;}this.EnableAnimation=true;var self=this;window.requestAnimationFrame(function(){self.DrawAnimation();});return barrageData;};this.StopAnimation=function(){this.EnableAnimation=false;this.DrawDynamicInfo();};this.GetChartTooltipData=function(x,y,option){var toolTip=new TooltipData();if(this.ChartInfoPaint){if(this.ChartInfoPaint.GetTooltipData(x,y,toolTip))return toolTip;}if(this.PtInChartPaintTooltip(x,y,toolTip))return toolTip;if(IFrameSplitOperator.IsNonEmptyArray(this.Frame.SubFrame)){for(var i=0;i<this.Frame.SubFrame.length;++i){var subFrame=this.Frame.SubFrame[i];for(var j=0;j<subFrame.OverlayIndex.length;++j){var overlayItem=subFrame.OverlayIndex[j];for(var k=0;k<overlayItem.ChartPaint.length;++k){var item=overlayItem.ChartPaint[k];if(item.GetTooltipData(x,y,toolTip))return toolTip;}}}}if(this.PtInOverlayChartPaintTooltip(x,y,toolTip))return toolTip;return null;};this.PtInExtendChartButtons=function(x,y){for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.PtInButtons){var button=item.PtInButtons(x,y);if(button){button.Chart=item;return button;}}}return null;};this.OnMouseMove=function(x,y,e,isPhone){this.LastPoint.X=x;this.LastPoint.Y=y;var mouseStatus=null;//鼠标状态
|
|
1732
1749
|
var frameID=this.Frame.PtInFrame(x,y);if(IFrameSplitOperator.IsNumber(frameID)&&frameID>=0)//在K线内部移动,调整K线索引
|
|
1733
|
-
this.CursorIndex=this.Frame.GetXData(x);var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){mouseStatus={Cursor:"ew-resize",Name:"DragRectSelect"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag rect select ",item);}}if(this.EnableBorderDrag&&this.Frame){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){mouseStatus={Cursor:"n-resize",Name:"DragBorder"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag border ",dragBorder);}}if(this.EnableYDrag&&this.Frame&&!
|
|
1734
|
-
if(this.CurrentChartDrawPicture){if(this.CurrentChartDrawPicture.SetLastPoint)this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});bDrawPicture=true;}else{var drawPictrueData={};drawPictrueData.X=x;drawPictrueData.Y=y;if(this.GetChartDrawPictureByPoint(drawPictrueData)&&drawPictrueData.ChartDrawPicture&&drawPictrueData.ChartDrawPicture.EnableMove==true){if(drawPictrueData.PointIndex===100)this.UIElement.style.cursor="move";else this.UIElement.style.cursor="pointer";bDrawPicture=true;this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.UIElement.style.cursor="default";}}var clientPos=this.PtInClient(x,y);var option={ParentFunction:'OnMouseMove',Point:{X:x,Y:y},IsPhone:isPhone===true,ClientPos:clientPos};if(e&&(e.type=="mouseout"||e.type=="mouseleave")||button)option.Corss=false;//鼠标移开,在按钮上,不显示十字光标
|
|
1750
|
+
this.CursorIndex=this.Frame.GetXData(x);var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){mouseStatus={Cursor:"ew-resize",Name:"DragRectSelect"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag rect select ",item);}}if(this.EnableBorderDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){mouseStatus={Cursor:"n-resize",Name:"DragBorder"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag border ",dragBorder);}}if(this.EnableYDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragY=this.TryYDrag(x,y);if(dragY){mouseStatus={Cursor:dragY.Position==0?"n-resize":"row-resize",Name:"DragY"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag y ",dragY);}}if(!this.CurrentChartDrawPicture){var button=this.Frame.PtInButtons(x,y);if(button){mouseStatus={Cursor:"pointer",Name:"FrameButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ",button);}else{button=this.PtInExtendChartButtons(x,y);if(button){mouseStatus={Cursor:"pointer",Name:"ExtendChartButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] extend chart button ",button);}}}if(this.ChartCorssCursor){var crossButton=this.ChartCorssCursor.PtInButton(x,y);if(crossButton){mouseStatus={Cursor:"pointer",Name:"CorssCursorButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] cross cursor button ",crossButton);}}if(this.ClassName=="KLineChartContainer"&&this.Frame.PtInFrameBottom(x,y)){mouseStatus={Cursor:"ew-resize",Name:"FrameButtom"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");}if(this.SelectedChart.EnableMoveOn&&this.PtInChart&&!this.CurrentChartDrawPicture){var chartInfo=this.PtInChart(x,y);if(chartInfo&&chartInfo.Identify){mouseStatus={Cursor:"pointer",Name:"PtInChart"};this.SelectedChart.MoveOn.Identify=chartInfo.Identify;this.SelectedChart.MoveOn.Identify=null;JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] Point in chart ",chartInfo);}else{this.SelectedChart.MoveOn.Identify=null;}}else{this.SelectedChart.MoveOn.Identify=null;}var bDrawPicture=false;//是否正在画图
|
|
1751
|
+
if(this.CurrentChartDrawPicture){if(this.CurrentChartDrawPicture.Status!=20)mouseStatus={Cursor:"crosshair",Name:"CurrentChartDrawPicture"};if(this.CurrentChartDrawPicture.SetLastPoint)this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});bDrawPicture=true;}else{var drawPictrueData={};drawPictrueData.X=x;drawPictrueData.Y=y;if(this.GetChartDrawPictureByPoint(drawPictrueData)&&drawPictrueData.ChartDrawPicture&&drawPictrueData.ChartDrawPicture.EnableMove==true){if(drawPictrueData.PointIndex===100)this.UIElement.style.cursor="move";else this.UIElement.style.cursor="pointer";bDrawPicture=true;this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.UIElement.style.cursor="default";}}var clientPos=this.PtInClient(x,y);var option={ParentFunction:'OnMouseMove',Point:{X:x,Y:y},IsPhone:isPhone===true,ClientPos:clientPos};if(e&&(e.type=="mouseout"||e.type=="mouseleave")||button)option.Corss=false;//鼠标移开,在按钮上,不显示十字光标
|
|
1735
1752
|
if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);this.DrawDynamicInfo(option);if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;if(this.IsShowTooltip&&bDrawPicture==false){var toolTip=this.GetChartTooltipData(x,y);if(toolTip&&toolTip.Data){if(isPhone===true){var touche=e.touches[0];var xTooltip=touche.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=touche.clientY-this.UIElement.getBoundingClientRect().top;}else{var xTooltip=e.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=e.clientY-this.UIElement.getBoundingClientRect().top;}this.ShowTooltip(xTooltip,yTooltip,toolTip);}else{this.HideTooltip();}}};this.OnKeyDown=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){case 37://left
|
|
1736
1753
|
if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}if(this.CursorIndex<=0.99999){if(!this.DataMoveLeft()){//左移数据到头了 触发下载新数据
|
|
1737
1754
|
if(this.DragDownloadData)this.DragDownloadData();break;}this.UpdataDataoffset();this.UpdatePointByCursorIndex();this.UpdateFrameMaxMin();this.Draw();this.ShowTooltipByKeyDown();this.OnKLinePageChange("keydown");}else{--this.CursorIndex;this.UpdatePointByCursorIndex();this.DrawDynamicInfo();this.ShowTooltipByKeyDown();}break;case 39://right
|
|
@@ -2926,7 +2943,7 @@ else this.Canvas.fillRect(ToFixedRect(y),ToFixedRect(left),ToFixedRect(yClose-y)
|
|
|
2926
2943
|
{this.Canvas.beginPath();this.Canvas.rect(ToFixedPoint(left),ToFixedPoint(y),ToFixedRect(dataWidth),ToFixedRect(yOpen-y));this.Canvas.stroke();}else{this.Canvas.fillRect(ToFixedRect(left),ToFixedRect(Math.min(y,yOpen)),ToFixedRect(dataWidth),ToFixedRect(Math.abs(yOpen-y)));}}}if(data.Open>data.Low)//下影线
|
|
2927
2944
|
{this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(ToFixedPoint(drawType==3?Math.min(yClose,yOpen):y),ToFixedPoint(x));this.Canvas.lineTo(ToFixedPoint(yLow),ToFixedPoint(x));}else{this.Canvas.moveTo(ToFixedPoint(x),ToFixedPoint(drawType==3?Math.max(yClose,yOpen):y));this.Canvas.lineTo(ToFixedPoint(x),ToFixedPoint(yLow));}this.Canvas.stroke();}}else{this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(yHigh,ToFixedPoint(x));this.Canvas.lineTo(yLow,ToFixedPoint(x));}else{this.Canvas.moveTo(ToFixedPoint(x),yHigh);this.Canvas.lineTo(ToFixedPoint(x),yLow);}this.Canvas.strokeStyle=barColor;this.Canvas.stroke();}};this.DrawTrade=function()//交易系统
|
|
2928
2945
|
{if(!this.TradeData)return;var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+2.0;var chartright=this.ChartBorder.GetRight();var xPointCount=this.ChartFrame.XPointCount;if(isHScreen){xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+2.0;chartright=this.ChartBorder.GetBottom();}var sellData=this.TradeData.Sell;var buyData=this.TradeData.Buy;var arrowWidth=dataWidth;if(arrowWidth>10)arrowWidth=10;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth){var data=this.Data.Data[i];if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;var buy=false,sell=false;if(sellData&&i<sellData.length)sell=sellData[i]>0;if(buyData&&i<buyData.length)buy=buyData[i]>0;if(!sell&&!buy)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;var yLow=this.GetYFromData(data.Low,false);var yHigh=this.GetYFromData(data.High,false);var yOpen=this.GetYFromData(data.Open,false);var yClose=this.GetYFromData(data.Close,false);var y=yHigh;if(buy){this.Canvas.fillStyle=this.UpColor;this.Canvas.strokeStyle=this.UnchagneColor;this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(yLow-1,x);this.Canvas.lineTo(yLow-arrowWidth-1,x-arrowWidth/2);this.Canvas.lineTo(yLow-arrowWidth-1,x+arrowWidth/2);}else{this.Canvas.moveTo(x,yLow+1);this.Canvas.lineTo(x-arrowWidth/2,yLow+arrowWidth+1);this.Canvas.lineTo(x+arrowWidth/2,yLow+arrowWidth+1);}this.Canvas.closePath();this.Canvas.fill();this.Canvas.stroke();}if(sell){this.Canvas.fillStyle=this.DownColor;this.Canvas.strokeStyle=this.UnchagneColor;this.Canvas.beginPath();if(isHScreen){this.Canvas.moveTo(yHigh+1,x);this.Canvas.lineTo(yHigh+arrowWidth+1,x-arrowWidth/2);this.Canvas.lineTo(yHigh+arrowWidth+1,x+arrowWidth/2);}else{this.Canvas.moveTo(x,yHigh-1);this.Canvas.lineTo(x-arrowWidth/2,yHigh-arrowWidth-1);this.Canvas.lineTo(x+arrowWidth/2,yHigh-arrowWidth-1);}this.Canvas.closePath();this.Canvas.fill();this.Canvas.stroke();}}};this.DrawTick=function()//分笔图
|
|
2929
|
-
{var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+2.0;if(isHScreen)xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+2.0;var chartright=this.ChartBorder.GetRight();if(isHScreen)chartright=this.ChartBorder.GetBottom();var xPointCount=this.ChartFrame.XPointCount;var fontSize=parseInt(dataWidth);if(fontSize<=1)fontSize=2;else if(fontSize>=18)fontSize=18;var bFirstPoint=true;var pixelRatio=GetDevicePixelRatio();var textSize=fontSize*pixelRatio;this.Canvas.beginPath();this.Canvas.font=fontSize*pixelRatio+'px '+this.TickFontName;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth){var data=this.Data.Data[i];if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;var yClose=this.ChartFrame.GetYFromData(data.Close,false);if(data.Flag===0)this.Canvas.fillStyle=this.UpColor;else if(data.Flag==1)this.Canvas.fillStyle=this.DownColor;else this.Canvas.fillStyle=this.UnchagneColor;this.Canvas.textAlign='center';this.Canvas.textBaseline='middle';if(isHScreen)this.Canvas.fillText(this.TickSymbol,yClose,x);else this.Canvas.fillText(this.TickSymbol,x,yClose);if(this.IsShowKTooltip&&!isHScreen)//添加tooltip区域
|
|
2946
|
+
{var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var xOffset=this.ChartBorder.GetLeft()+distanceWidth/2.0+2.0;if(isHScreen)xOffset=this.ChartBorder.GetTop()+distanceWidth/2.0+2.0;var chartright=this.ChartBorder.GetRight();if(isHScreen)chartright=this.ChartBorder.GetBottom();var xPointCount=this.ChartFrame.XPointCount;var fontSize=parseInt(dataWidth);if(fontSize<=1)fontSize=2;else if(fontSize>=18)fontSize=18;var bFirstPoint=true;var pixelRatio=GetDevicePixelRatio();var textSize=fontSize*pixelRatio;this.Canvas.beginPath();this.Canvas.font=fontSize*pixelRatio+'px '+this.TickFontName;this.ShowRange.Start=this.Data.DataOffset;this.ShowRange.End=this.ShowRange.Start;this.ShowRange.DataCount=0;this.ShowRange.ShowCount=xPointCount;this.DrawKRange.Start=this.Data.DataOffset;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth){var data=this.Data.Data[i];this.ShowRange.End=i;if(data.Open==null||data.High==null||data.Low==null||data.Close==null)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var x=left+(right-left)/2;var yClose=this.ChartFrame.GetYFromData(data.Close,false);this.DrawKRange.End=i;if(data.Flag===0)this.Canvas.fillStyle=this.UpColor;else if(data.Flag==1)this.Canvas.fillStyle=this.DownColor;else this.Canvas.fillStyle=this.UnchagneColor;this.Canvas.textAlign='center';this.Canvas.textBaseline='middle';if(isHScreen)this.Canvas.fillText(this.TickSymbol,yClose,x);else this.Canvas.fillText(this.TickSymbol,x,yClose);if(this.IsShowKTooltip&&!isHScreen)//添加tooltip区域
|
|
2930
2947
|
{var rect=new Rect(x-textSize/2,yClose-textSize/2,textSize,textSize);//this.Canvas.fillStyle="rgb(0,0,100)";
|
|
2931
2948
|
//this.Canvas.fillRect(rect.X,rect.Y,rect.Width,rect.Height);
|
|
2932
2949
|
this.TooltipRect.push([i,rect]);//[0]数据索引 [1]数据区域
|
|
@@ -2936,7 +2953,7 @@ this.Canvas.clip();};this.Draw=function(){this.IsShowOrderText=false;this.Toolti
|
|
|
2936
2953
|
this.PtMin={X:null,Y:null,Value:null,Align:'left'};//清空最小
|
|
2937
2954
|
this.DrawKRange={Start:null,End:null};this.ChartFrame.ChartKLine={Max:null,Min:null};//保存K线上 显示最大最小值坐标
|
|
2938
2955
|
if(!this.IsShow)return;if(ChartData.IsTickPeriod(this.Period))//分笔图
|
|
2939
|
-
{this.Canvas.save();if(this.DrawType==1){this.ClipClient(this.ChartFrame.IsHScreen);this.DrawCloseLine();}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();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{this.DrawKBar();}if(this.TradeIcon)this.DrawTradeIcon();else this.DrawTrade();this.Canvas.restore();if(this.IsShowMaxMinPrice)//标注最大值最小值
|
|
2956
|
+
{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();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{this.DrawKBar();}if(this.TradeIcon)this.DrawTradeIcon();else this.DrawTrade();this.Canvas.restore();if(this.IsShowMaxMinPrice)//标注最大值最小值
|
|
2940
2957
|
{if(this.ChartFrame.IsHScreen===true)this.HScreenDrawMaxMinPrice(this.PtMax,this.PtMin);else this.DrawMaxMinPrice(this.PtMax,this.PtMin);}};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 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;this.Canvas.fillStyle=this.TextColor;var top=this.ChartBorder.GetTopEx();var bottom=this.ChartBorder.GetBottomEx();var ptTop=ptMax;if(this.ChartFrame.CoordinateType==1)//反转坐标
|
|
2941
2958
|
{if(ptMax.Y<ptMin.Y)ptTop=ptMin;this.Canvas.textBaseline='top';}else{if(ptMax.Y>ptMin.Y)ptTop=ptMin;this.Canvas.textBaseline='bottom';}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);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;if(this.ChartFrame.CoordinateType==1){if(ptMin.Y>ptMax.Y)ptBottom=ptMax;this.Canvas.textBaseline='bottom';}else{if(ptMax.Y>ptMin.Y)ptTop=ptMin;this.Canvas.textBaseline='top';}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);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)//横屏模式下显示最大最小值
|
|
2942
2959
|
{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);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);this.Canvas.font=this.TextFont;this.Canvas.fillStyle=this.TextColor;this.Canvas.textAlign=ptMax.Align;this.Canvas.textBaseline='bottom';var text=ptMax.Value.toFixed(defaultfloatPrecision);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);this.Canvas.font=this.TextFont;this.Canvas.fillStyle=this.TextColor;this.Canvas.textAlign=ptMin.Align;this.Canvas.textBaseline='top';var text=ptMin.Value.toFixed(defaultfloatPrecision);if(ptMin.Align=='left')text=leftArrow+text;else text=text+rightArrow;this.Canvas.fillText(text,0,0);this.Canvas.restore();};//画某一天的信息地雷
|
|
@@ -4048,10 +4065,10 @@ if(yValueExtend.FrameID>=0){var frame=this.Frame.SubFrame[yValueExtend.FrameID];
|
|
|
4048
4065
|
{var drawRight=right+overlayIndexInterval;if(drawRight>chartRight)drawRight=chartRight;this.DrawTextBGRect(drawRight-2-textWidth,y-this.TextHeight/2,textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,drawRight-4,y,textWidth);}else if(rightWidth<textWidth)//右边空白显示不下,
|
|
4049
4066
|
{this.DrawTextBGRect(chartRight-2-textWidth,y-this.TextHeight/2,textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,chartRight-4,y,textWidth);if(this.RightButton.Enable)this.DrawRightButton(y-this.TextHeight/2,chartRight-2-textWidth,this.TextHeight,this.TextHeight,buttonData);}else{this.DrawTextBGRect(right+2,y-this.TextHeight/2,textWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,right+4,y,textWidth);if(this.RightButton.Enable)this.DrawRightButton(y-this.TextHeight/2,right+2,this.TextHeight,this.TextHeight,buttonData);}if(this.StringFormatY.RExtendText&&this.StringFormatY.RExtendText.length>0){var yOffset=0;for(var i in this.StringFormatY.RExtendText){var item=this.StringFormatY.RExtendText[i];var rText='--.--';if(item.YText)rText=item.YText;else if(IFrameSplitOperator.IsNumber(item.Y))rText=item.Y.toFixed(0);var rTextWidth=this.Canvas.measureText(rText).width+4;//前后各空2个像素
|
|
4050
4067
|
if(rightWidth<rTextWidth){this.DrawTextBGRect(chartRight-2-rTextWidth,y+yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(rText,chartRight-4,y+yOffset+this.TextHeight,rTextWidth);}else{this.DrawTextBGRect(right+2,y+yOffset+this.TextHeight/2,rTextWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(rText,right+4,y+yOffset+this.TextHeight,rTextWidth);}yOffset+=this.TextHeight;}}}else if(this.ShowTextMode.Right==2){this.Canvas.fillStyle=this.TextBGColor;var showLeft=right-textWidth;this.DrawTextBGRect(showLeft,y-this.TextHeight/2,textWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,showLeft+2,y,textWidth);if(this.RightButton.Enable)this.DrawRightButton(y-this.TextHeight/2,showLeft,this.TextHeight,this.TextHeight,buttonData);}}//X轴
|
|
4051
|
-
if(this.ShowTextMode.Bottom==1&&this.StringFormatX.Operator()){var text=this.StringFormatX.Text;this.Canvas.font=this.Font;this.Canvas.fillStyle=this.TextBGColor;var textWidth=this.Canvas.measureText(text).width+4;//前后各空2个像素
|
|
4052
|
-
var yCenter=bottom+2+this.TextHeight/2
|
|
4068
|
+
if((this.ShowTextMode.Bottom==1||this.ShowTextMode.Bottom==2)&&this.StringFormatX.Operator()){var text=this.StringFormatX.Text;this.Canvas.font=this.Font;this.Canvas.fillStyle=this.TextBGColor;var textWidth=this.Canvas.measureText(text).width+4;//前后各空2个像素
|
|
4069
|
+
var yCenter=bottom+2+this.TextHeight/2;var yTop=bottom+2;if(this.ShowTextMode.Bottom==2){yCenter=bottom-this.TextHeight/2-2;yTop=bottom-this.TextHeight-2;}//JSConsole.Chart.Log('[ChartCorssCursor::Draw] ',yCenter);
|
|
4053
4070
|
if(x-textWidth/2<3)//左边位置不够了, 顶着左边画
|
|
4054
|
-
{this.DrawTextBGRect(x-1,
|
|
4071
|
+
{this.DrawTextBGRect(x-1,yTop,textWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,x+1,yCenter,textWidth);}else if(x+textWidth/2>=right){this.DrawTextBGRect(right-textWidth,yTop,textWidth,this.TextHeight);this.Canvas.textAlign="right";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,right-2,yCenter,textWidth);}else{this.DrawTextBGRect(x-textWidth/2,yTop,textWidth,this.TextHeight);this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,x,yCenter,textWidth);}}//子坐标Y轴
|
|
4055
4072
|
if(yValueExtend.FrameID>=0){var frame=this.Frame.SubFrame[yValueExtend.FrameID];var isAutoRightBorder=false;if(this.Frame.AutoRightBorder)isAutoRightBorder=true;var overlayLeft=right;if(isAutoRightBorder)overlayLeft=right+this.Frame.AuotRightWidth;this.Canvas.font=this.Font;for(var i in frame.OverlayIndex){var item=frame.OverlayIndex[i];if(item.Frame.IsShow===false)continue;if(!isAutoRightBorder)overlayLeft+=frame.Interval;if(overlayLeft+30>chartRight)break;var yValue=item.Frame.GetYData(y);for(var i=2;i>=0;--i){var text=IFrameSplitOperator.FormatValueString(yValue,i);var textWidth=this.Canvas.measureText(text).width+4;//前后各空2个像素
|
|
4056
4073
|
if(textWidth<frame.Interval)break;}this.Canvas.fillStyle=this.TextBGColor;this.Canvas.fillRect(overlayLeft+2,y-this.TextHeight/2,textWidth,this.TextHeight);this.Canvas.textAlign="left";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=this.TextColor;this.Canvas.fillText(text,overlayLeft+4,y,textWidth);if(isAutoRightBorder)overlayLeft+=item.RightWidth.Width;}}this.Status=1;};this.DrawRightButton=function(drawTop,drawRight,drawWidth,drawHeight,data){this.Canvas.fillStyle=this.RightButton.BGColor;var rtButtom={Left:drawRight-drawWidth,Top:drawTop,Width:drawWidth,Height:drawHeight};this.RightButton.Rect=rtButtom;this.RightButton.Data=data;this.Canvas.fillRect(ToFixedPoint(rtButtom.Left+1),ToFixedPoint(rtButtom.Top),ToFixedRect(rtButtom.Width),ToFixedRect(rtButtom.Height));var pixelRatio=GetDevicePixelRatio();var spaceWidth=3;var yCenter=rtButtom.Top+spaceWidth+(rtButtom.Height-spaceWidth*2)/2;var xCenter=rtButtom.Left+spaceWidth+(rtButtom.Width-spaceWidth*2)/2;if(this.RightButton.Icon){var icon=this.RightButton.Icon;this.Canvas.font=icon.Size*pixelRatio+'px '+icon.Family;this.Canvas.textAlign="center";this.Canvas.textBaseline="middle";this.Canvas.fillStyle=icon.Color;this.Canvas.fillText('\uE6A3',xCenter,yCenter);}else{//画加号
|
|
4057
4074
|
this.Canvas.strokeStyle=this.RightButton.PenColor;var x=rtButtom.Left+spaceWidth;var y=rtButtom.Top+spaceWidth;this.Canvas.save();this.Canvas.linewidth=1*pixelRatio;this.Canvas.beginPath();this.Canvas.moveTo(ToFixedPoint(x),ToFixedPoint(yCenter));this.Canvas.lineTo(ToFixedPoint(x+rtButtom.Width-spaceWidth*2),ToFixedPoint(yCenter));this.Canvas.moveTo(ToFixedPoint(xCenter),ToFixedPoint(y));this.Canvas.lineTo(ToFixedPoint(xCenter),ToFixedPoint(y+rtButtom.Height-spaceWidth*2));this.Canvas.stroke();this.Canvas.restore();}};this.PtInButton=function(x,y){if(!this.RightButton.Enable)return null;if(!this.RightButton.Rect)return null;var rect=this.RightButton.Rect;this.Canvas.beginPath();this.Canvas.rect(rect.Left,rect.Top,rect.Width,rect.Height);if(this.Canvas.isPointInPath(x,y)){return{Data:this.RightButton.Data,Rect:rect};}};this.DrawTextBGRect=function(x,y,height,width){this.Canvas.fillStyle=this.TextBGColor;this.Canvas.fillRect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(height),ToFixedRect(width));if(this.BorderColor){this.Canvas.strokeStyle=this.BorderColor;this.Canvas.strokeRect(ToFixedPoint(x),ToFixedPoint(y),ToFixedRect(height),ToFixedRect(width));}};this.HScreenDraw=function(){var x=this.LastPoint.X;var y=this.LastPoint.Y;if(this.IsOnlyDrawKLine)//手机端 十字只能画在K线上
|
|
@@ -4367,7 +4384,7 @@ return storageData;};this.IsFrameMinSize=function()//框架是否是最小化模
|
|
|
4367
4384
|
for(var i=0;i<colorArr.length;i++){var hex=Number(colorArr[i]).toString(16);if(hex==="0")hex+=hex;strHex+=hex;}color=strHex;}return"rgba("+parseInt("0x"+color.slice(1,3))+","+parseInt("0x"+color.slice(3,5))+","+parseInt("0x"+color.slice(5,7))+","+opacity+")";};IChartDrawPicture.RGBToHex=function(rgb){// Choose correct separator
|
|
4368
4385
|
var sep=rgb.indexOf(",")>-1?",":" ";// Turn "rgb(r,g,b)" into [r,g,b]
|
|
4369
4386
|
rgb=rgb.substr(4).split(")")[0].split(sep);var r=(+rgb[0]).toString(16),g=(+rgb[1]).toString(16),b=(+rgb[2]).toString(16);if(r.length==1)r="0"+r;if(g.length==1)g="0"+g;if(b.length==1)b="0"+b;return"#"+r+g+b;};IChartDrawPicture.ArrayDrawPricture=[{Name:"线段",ClassName:'ChartDrawPictureLine',Create:function Create(){return new ChartDrawPictureLine();}},{Name:"射线",ClassName:'ChartDrawPictureHaflLine',Create:function Create(){return new ChartDrawPictureHaflLine();}},{Name:"箭头",ClassName:"ChartDrawArrowLine",Create:function Create(){return new ChartDrawArrowLine();}},{Name:"水平线",ClassName:'ChartDrawPictureHorizontalLine',Create:function Create(){return new ChartDrawPictureHorizontalLine();}},{Name:"趋势线",ClassName:'ChartDrawPictureTrendLine',Create:function Create(){return new ChartDrawPictureTrendLine();}},{Name:"矩形",ClassName:'ChartDrawPictureRect',Create:function Create(){return new ChartDrawPictureRect();}},{Name:"圆弧线",ClassName:'ChartDrawPictureArc',Create:function Create(){return new ChartDrawPictureArc();}},{Name:"M头W底",ClassName:'ChartDrawPictureWaveMW',Create:function Create(){return new ChartDrawPictureWaveMW();}},{Name:"头肩型",ClassName:"ChartDrawHeadShouldersBT",Create:function Create(){return new ChartDrawHeadShouldersBT();}},{Name:"平行线",ClassName:'ChartDrawPictureParallelLines',Create:function Create(){return new ChartDrawPictureParallelLines();}},{Name:"平行通道",ClassName:'ChartDrawPictureParallelChannel',Create:function Create(){return new ChartDrawPictureParallelChannel();}},{Name:"价格通道线",ClassName:'ChartDrawPicturePriceChannel',Create:function Create(){return new ChartDrawPicturePriceChannel();}},{Name:"文本",ClassName:'ChartDrawPictureText',Create:function Create(){return new ChartDrawPictureText();}},{Name:"江恩角度线",ClassName:'ChartDrawPictureGannFan',Create:function Create(){return new ChartDrawPictureGannFan();}},{Name:"阻速线",ClassName:'ChartDrawPictureResistanceLine',Create:function Create(){return new ChartDrawPictureResistanceLine();}},{Name:"黄金分割",ClassName:'ChartDrawPictureGoldenSection',Create:function Create(){return new ChartDrawPictureGoldenSection();}},{Name:"百分比线",ClassName:'ChartDrawPicturePercentage',Create:function Create(){return new ChartDrawPicturePercentage();}},{Name:"波段线",ClassName:'ChartDrawPictureWaveBand',Create:function Create(){return new ChartDrawPictureWaveBand();}},{Name:"三角形",ClassName:'ChartDrawPictureTriangle',Create:function Create(){return new ChartDrawPictureTriangle();}},{Name:"对称角度",ClassName:'ChartDrawPictureSymmetryAngle',Create:function Create(){return new ChartDrawPictureSymmetryAngle();}},{Name:"圆",ClassName:'ChartDrawPictureCircle',Create:function Create(){return new ChartDrawPictureCircle();}},{Name:"平行四边形",ClassName:'ChartDrawPictureQuadrangle',Create:function Create(){return new ChartDrawPictureQuadrangle();}},{Name:"斐波那契周期线",ClassName:'ChartDrawPictureFibonacci',Create:function Create(){return new ChartDrawPictureFibonacci();}},{Name:"线形回归线",ClassName:"ChartDrawLinearRegression",Create:function Create(){return new ChartDrawLinearRegression();}},{Name:"线形回归带",ClassName:"ChartDrawLinearRegression",Create:function Create(){return new ChartDrawLinearRegression({IsShowMaxMinLine:true});}},{Name:"延长线形回归带",ClassName:"ChartDrawLinearRegression",Create:function Create(){return new ChartDrawLinearRegression({IsShowMaxMinLine:true,IsShowExtendLine:true});}},{Name:"尺子",ClassName:"ChartDrawRuler",Create:function Create(){return new ChartDrawRuler();}},{Name:"标价线",ClassName:"ChartDrawPriceLine",Create:function Create(){return new ChartDrawPriceLine();}},{Name:"标价线2",ClassName:"ChartDrawPriceLineV2",Create:function Create(){return new ChartDrawPriceLineV2();}},{Name:"垂直线",ClassName:"ChartDrawVerticalLine",Create:function Create(){return new ChartDrawVerticalLine();}},{Name:"波浪尺",ClassName:"ChartDrawWaveRuler",Create:function Create(){return new ChartDrawWaveRuler();}},{Name:"AB波浪尺",ClassName:"ChartDrawWaveRuler2Point",Create:function Create(){return new ChartDrawWaveRuler2Point();}},{Name:"箱型线",ClassName:"ChartDrawBox",Create:function Create(){return new ChartDrawBox();}},{Name:"2点画图例子",ClassName:"ChartDrawTwoPointDemo",Create:function Create(){return new ChartDrawTwoPointDemo();}},{Name:"3点画图例子",ClassName:"ChartDrawThreePointDemo",Create:function Create(){return new ChartDrawThreePointDemo();}},{Name:"水平线段",ClassName:"ChartDrawHLineSegment",Create:function Create(){return new ChartDrawHLineSegment();}},{Name:"平行射线",ClassName:"ChartDrawParallelRaysLines",Create:function Create(){return new ChartDrawParallelRaysLines();}},{ClassName:'ChartDrawPictureIconFont',Create:function Create(){return new ChartDrawPictureIconFont();}},//涂鸦 不绑定K线坐标
|
|
4370
|
-
{Name:"涂鸦线段",ClassName:'ChartDrawGraffitiLine',Create:function Create(){return new ChartDrawGraffitiLine();}},{Name:"固定范围成交量分布图",ClassName:"ChartDrawVolProfile",Create:function Create(){return new ChartDrawVolProfile();}}];IChartDrawPicture.MapIonFont=new _map2.default([["icon-arrow_up",{Text:'\uE683',Color:'#318757',Family:"iconfont"}],["icon-arrow_down",{Text:'\uE681',Color:'#db563e',Family:"iconfont"}],["icon-arrow_right",{Text:'\uE682',Color:'#318757',Family:"iconfont"}],["icon-arrow_left",{Text:'\uE680',Color:'#318757',Family:"iconfont"}]]);IChartDrawPicture.GetDrawPictureByName=function(value){for(var i in IChartDrawPicture.ArrayDrawPricture){var item=IChartDrawPicture.ArrayDrawPricture[i];if(item.Name==value)return item;}return null;};IChartDrawPicture.GetDrawPictureByClassName=function(value){for(var i in IChartDrawPicture.ArrayDrawPricture){var item=IChartDrawPicture.ArrayDrawPricture[i];if(item.ClassName==value)return item;}return null;};//注册一个新的画图工具 {Name:中文名字, ClassName:类名, Create:function()}
|
|
4387
|
+
{Name:"涂鸦线段",ClassName:'ChartDrawGraffitiLine',Create:function Create(){return new ChartDrawGraffitiLine();}},{Name:"固定范围成交量分布图",ClassName:"ChartDrawVolProfile",Create:function Create(){return new ChartDrawVolProfile();}},{Name:"DisjointChannel",ClassName:"ChartDrawDisjontChannel",Create:function Create(){return new ChartDrawDisjontChannel();}},{Name:"FlatTop",ClassName:"ChartDrawDisjontChannel",Create:function Create(){return new ChartDrawFlatTop();}}];IChartDrawPicture.MapIonFont=new _map2.default([["icon-arrow_up",{Text:'\uE683',Color:'#318757',Family:"iconfont"}],["icon-arrow_down",{Text:'\uE681',Color:'#db563e',Family:"iconfont"}],["icon-arrow_right",{Text:'\uE682',Color:'#318757',Family:"iconfont"}],["icon-arrow_left",{Text:'\uE680',Color:'#318757',Family:"iconfont"}]]);IChartDrawPicture.GetDrawPictureByName=function(value){for(var i in IChartDrawPicture.ArrayDrawPricture){var item=IChartDrawPicture.ArrayDrawPricture[i];if(item.Name==value)return item;}return null;};IChartDrawPicture.GetDrawPictureByClassName=function(value){for(var i in IChartDrawPicture.ArrayDrawPricture){var item=IChartDrawPicture.ArrayDrawPricture[i];if(item.ClassName==value)return item;}return null;};//注册一个新的画图工具 {Name:中文名字, ClassName:类名, Create:function()}
|
|
4371
4388
|
IChartDrawPicture.RegisterDrawPicture=function(obj){if(!obj.Name||!obj.ClassName||!obj.Create)return false;var item={Name:obj.Name,ClassName:obj.ClassName,Create:obj.Create};IChartDrawPicture.ArrayDrawPricture.push(item);JSConsole.Chart.Log('[IChartDrawPicture.RegisterDrawPicture] registered new draw picture class. item=',item);return true;};//注册一个新图标 {Name:, Text: , Color:, Family:}
|
|
4372
4389
|
IChartDrawPicture.RegisterIonFont=function(obj){if(!obj.Name||!obj.Text||!obj.Family)return false;var isOverwirte=IChartDrawPicture.MapIonFont.has(obj.Name);IChartDrawPicture.MapIonFont.set(obj.Name,obj);JSConsole.Chart.Log('[IChartDrawPicture.RegisterIonFont] registered new icon font, obj=, isOverwirte=',obj,isOverwirte);return true;};IChartDrawPicture.CreateChartDrawPicture=function(obj)//创建画图工具
|
|
4373
4390
|
{var item=IChartDrawPicture.GetDrawPictureByClassName(obj.ClassName);if(!item)return null;var chartDraw=item.Create();if(obj.Period>=0)chartDraw.Period=obj.Period;if(obj.Right>=0)chartDraw.Right=obj.Right;if(obj.Guid)chartDraw.Guid=obj.Guid;if(obj.Symbol)chartDraw.Symbol=obj.Symbol;if(obj.Value)chartDraw.Value=obj.Value;if(obj.Text)chartDraw.Text=obj.Text;if(obj.LineColor)chartDraw.LineColor=obj.LineColor;if(obj.AreaColor)chartDraw.AreaColor=obj.AreaColor;if(obj.FontOption)chartDraw.FontOption=obj.FontOption;if(obj.Label)chartDraw.Label=obj.Label;if(obj.LineWidth>0)chartDraw.LineWidth=obj.LineWidth;if(obj.EnableMove===false)chartDraw.EnableMove=obj.EnableMove;if(IFrameSplitOperator.IsBool(obj.EnableSave))chartDraw.EnableSave=obj.EnableSave;return chartDraw;};//画图工具-线段
|
|
@@ -4460,7 +4477,13 @@ this.newMethod();delete this.newMethod;this.ClassName='ChartDrawHeadShouldersBT'
|
|
|
4460
4477
|
function ChartDrawPictureParallelLines(){this.newMethod=IChartDrawPicture;//派生
|
|
4461
4478
|
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawPictureParallelLines';this.IsPointIn=this.IsPointIn_XYValue_Line;this.PointCount=3;this.LastPoint;this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;var drawPoint=this.CalculateDrawPoint({IsCheckX:true,IsCheckY:true});if(!drawPoint)return;this.AreaColor=IChartDrawPicture.ColorToRGBA(this.LineColor,0.3);var points=drawPoint.slice(0);this.CalculateLines(points);this.ClipFrame();for(var i in this.LinePoint){var item=this.LinePoint[i];this.DrawLine(item.Start,item.End);}this.DrawArea();this.DrawPoint(points);//画点
|
|
4462
4479
|
this.Canvas.restore();};this.SetLastPoint=function(obj){this.LastPoint={X:obj.X,Y:obj.Y};};this.DrawArea=function(){if(this.LinePoint.length!=2)return;this.Canvas.fillStyle=this.AreaColor;this.Canvas.beginPath();this.Canvas.moveTo(this.LinePoint[0].Start.X,this.LinePoint[0].Start.Y);this.Canvas.lineTo(this.LinePoint[0].End.X,this.LinePoint[0].End.Y);this.Canvas.lineTo(this.LinePoint[1].End.X,this.LinePoint[1].End.Y);this.Canvas.lineTo(this.LinePoint[1].Start.X,this.LinePoint[1].Start.Y);this.Canvas.closePath();this.Canvas.fill();};this.CalculateLines=function(points){if(this.PointStatus==2&&this.LastPoint){var pt=new Point();pt.X=this.LastPoint.X;pt.Y=this.LastPoint.Y;points[2]=pt;}if(points.length==2){var linePoint=this.CalculateExtendLinePoint(points[0],points[1]);this.LinePoint.push(linePoint);}else if(points.length==3){var linePoint=this.CalculateExtendLinePoint(points[0],points[1]);this.LinePoint.push(linePoint);//计算平行线
|
|
4463
|
-
var xMove=points[2].X-points[1].X;var yMove=points[2].Y-points[1].Y;var ptStart=new Point();var ptEnd=new Point();ptStart.X=points[0].X+xMove;ptStart.Y=points[0].Y+yMove;ptEnd.X=points[1].X+xMove;ptEnd.Y=points[1].Y+yMove;linePoint=this.CalculateExtendLinePoint(ptStart,ptEnd);this.LinePoint.push(linePoint);}};}
|
|
4480
|
+
var xMove=points[2].X-points[1].X;var yMove=points[2].Y-points[1].Y;var ptStart=new Point();var ptEnd=new Point();ptStart.X=points[0].X+xMove;ptStart.Y=points[0].Y+yMove;ptEnd.X=points[1].X+xMove;ptEnd.Y=points[1].Y+yMove;linePoint=this.CalculateExtendLinePoint(ptStart,ptEnd);this.LinePoint.push(linePoint);}};}//FlatTop/Bottom
|
|
4481
|
+
function ChartDrawFlatTop(){this.newMethod=IChartDrawPicture;//派生
|
|
4482
|
+
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawFlatTop';this.IsPointIn=this.IsPointIn_XYValue_Line;this.PointCount=3;this.LastPoint;this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;var drawPoint=this.CalculateDrawPoint({IsCheckX:true,IsCheckY:true});if(!drawPoint)return;this.AreaColor=IChartDrawPicture.ColorToRGBA(this.LineColor,0.3);var points=drawPoint.slice(0);this.CalculateLines(points);this.ClipFrame();for(var i=0;i<this.LinePoint.length;++i){var item=this.LinePoint[i];this.DrawLine(item.Start,item.End);}this.DrawArea();this.DrawPoint(points);//画点
|
|
4483
|
+
this.Canvas.restore();};this.SetLastPoint=function(obj){this.LastPoint={X:obj.X,Y:obj.Y};};this.DrawArea=function(){if(this.LinePoint.length!=2)return;this.Canvas.fillStyle=this.AreaColor;this.Canvas.beginPath();this.Canvas.moveTo(this.LinePoint[0].Start.X,this.LinePoint[0].Start.Y);this.Canvas.lineTo(this.LinePoint[0].End.X,this.LinePoint[0].End.Y);this.Canvas.lineTo(this.LinePoint[1].End.X,this.LinePoint[1].End.Y);this.Canvas.lineTo(this.LinePoint[1].Start.X,this.LinePoint[1].Start.Y);this.Canvas.closePath();this.Canvas.fill();};this.CalculateLines=function(points){if(this.PointStatus==2&&this.LastPoint){var ptSecond=points[1];var pt=new Point();pt.X=ptSecond.X;pt.Y=this.LastPoint.Y;points[2]=pt;}if(points.length==2){this.LinePoint.push({Start:points[0],End:points[1]});}else if(points.length==3){this.LinePoint.push({Start:points[0],End:points[1]});//计算水平线
|
|
4484
|
+
var ptThrid=points[2];ptThrid.X=points[1].X;var ptStart={X:points[0].X,Y:ptThrid.Y};var ptEnd={X:points[1].X,Y:ptThrid.Y};this.LinePoint.push({Start:ptStart,End:ptEnd});}};}//Disjont Channel
|
|
4485
|
+
function ChartDrawDisjontChannel(){this.newMethod=ChartDrawFlatTop;//派生
|
|
4486
|
+
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawDisjontChannel';this.IsPointIn=this.IsPointIn_XYValue_Line;this.PointCount=3;this.LastPoint;}//平行射线
|
|
4464
4487
|
function ChartDrawParallelRaysLines(){this.newMethod=ChartDrawPictureParallelLines;//派生
|
|
4465
4488
|
this.newMethod();delete this.newMethod;this.ClassName='ChartDrawParallelRaysLines';this.DrawArea=function(){};this.CalculateLines=function(points){if(this.PointStatus==2&&this.LastPoint){var pt=new Point();pt.X=this.LastPoint.X;pt.Y=this.LastPoint.Y;points[2]=pt;}if(points.length==2){var endPoint=this.CalculateExtendLineEndPoint([points[0],points[1]]);this.LinePoint.push({Start:points[0],End:endPoint});}else if(points.length==3){var endPoint=this.CalculateExtendLineEndPoint([points[0],points[1]]);this.LinePoint.push({Start:points[0],End:endPoint});//计算平行线
|
|
4466
4489
|
var xMove=points[2].X-points[1].X;var yMove=points[2].Y-points[1].Y;var ptStart=new Point();var ptEnd=new Point();ptStart.X=points[0].X+xMove;ptStart.Y=points[0].Y+yMove;ptEnd.X=points[1].X+xMove;ptEnd.Y=points[1].Y+yMove;endPoint=this.CalculateExtendLineEndPoint([ptStart,ptEnd]);this.LinePoint.push({Start:points[2],End:endPoint});}};}//价格通道线
|
package/package.json
CHANGED
|
@@ -4965,6 +4965,152 @@ function JSChart(divElement, bOffscreen)
|
|
|
4965
4965
|
return chart;
|
|
4966
4966
|
}
|
|
4967
4967
|
|
|
4968
|
+
this.CreateMinMinuteChartContainer=function(option)
|
|
4969
|
+
{
|
|
4970
|
+
var chart=null;
|
|
4971
|
+
if (option.Type==="迷你分钟走势图横屏") chart=new MinuteChartHScreenContainer(this.CanvasElement);
|
|
4972
|
+
else chart=new MinuteChartContainer(this.CanvasElement);
|
|
4973
|
+
|
|
4974
|
+
if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
|
|
4975
|
+
var windowsCount=2;
|
|
4976
|
+
|
|
4977
|
+
if (option.BeforeOpen) //集合竞价
|
|
4978
|
+
{
|
|
4979
|
+
var item=option.BeforeOpen;
|
|
4980
|
+
|
|
4981
|
+
if (IFrameSplitOperator.IsBool(item.IsShow)) chart.IsShowBeforeData=item.IsShow;
|
|
4982
|
+
if (IFrameSplitOperator.IsNumber(item.Width)) chart.ExtendWidth.Left=item.Width;
|
|
4983
|
+
if (IFrameSplitOperator.IsBool(item.IsShowMultiDay)) chart.IsShowMultiDayBeforeData=item.IsShowMultiDay;
|
|
4984
|
+
if (IFrameSplitOperator.IsNumber(item.MulitiDayWidth)) chart.MultiDayExtendWidth.Left=item.MulitiDayWidth;
|
|
4985
|
+
}
|
|
4986
|
+
|
|
4987
|
+
if (option.AfterClose) //收盘集合竞价
|
|
4988
|
+
{
|
|
4989
|
+
var item=option.AfterClose;
|
|
4990
|
+
if (IFrameSplitOperator.IsBool(item.IsShow)) chart.IsShowAfterData=item.IsShow;
|
|
4991
|
+
if (IFrameSplitOperator.IsNumber(item.ShareVol)) chart.ShareAfterVol=item.ShareVol;
|
|
4992
|
+
if (IFrameSplitOperator.IsNumber(item.Width)) chart.ExtendWidth.Right=item.Width;
|
|
4993
|
+
if (IFrameSplitOperator.IsBool(item.IsShowMultiDay)) chart.IsShowMultiDayAfterData=item.IsShowMultiDay;
|
|
4994
|
+
if (IFrameSplitOperator.IsNumber(item.MulitiDayWidth)) chart.MultiDayExtendWidth.Right=item.MulitiDayWidth;
|
|
4995
|
+
}
|
|
4996
|
+
|
|
4997
|
+
if (!option.Listener) option.Listener={ KeyDown:false, Wheel:false };
|
|
4998
|
+
chart.Create(windowsCount,option.Listener); //创建子窗口
|
|
4999
|
+
|
|
5000
|
+
if (option.CorssCursorInfo)
|
|
5001
|
+
{
|
|
5002
|
+
var item=option.CorssCursorInfo;
|
|
5003
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.Left)) chart.ChartCorssCursor.ShowTextMode.Left=option.CorssCursorInfo.Left;
|
|
5004
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.Right)) chart.ChartCorssCursor.ShowTextMode.Right=option.CorssCursorInfo.Right;
|
|
5005
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.Bottom)) chart.ChartCorssCursor.ShowTextMode.Bottom=option.CorssCursorInfo.Bottom;
|
|
5006
|
+
if (option.CorssCursorInfo.IsShowCorss===false) chart.ChartCorssCursor.IsShowCorss=option.CorssCursorInfo.IsShowCorss;
|
|
5007
|
+
if (option.CorssCursorInfo.RightTextFormat>0) chart.ChartCorssCursor.TextFormat.Right=option.CorssCursorInfo.RightTextFormat;
|
|
5008
|
+
if (option.CorssCursorInfo.IsOnlyDrawMinute == true) chart.ChartCorssCursor.IsOnlyDrawMinute = option.CorssCursorInfo.IsOnlyDrawMinute; //Y轴显示收盘价
|
|
5009
|
+
if (IFrameSplitOperator.IsBool(option.CorssCursorInfo.IsFixXLastTime)) chart.ChartCorssCursor.IsFixXLastTime=option.CorssCursorInfo.IsFixXLastTime;
|
|
5010
|
+
|
|
5011
|
+
if (item.RightButton)
|
|
5012
|
+
{
|
|
5013
|
+
if (IFrameSplitOperator.IsBool(item.RightButton.Enable)) chart.ChartCorssCursor.RightButton.Enable=item.RightButton.Enable;
|
|
5014
|
+
}
|
|
5015
|
+
|
|
5016
|
+
if (IFrameSplitOperator.IsNumber(item.PriceFormatType)) chart.ChartCorssCursor.StringFormatY.PriceFormatType=item.PriceFormatType;
|
|
5017
|
+
if (IFrameSplitOperator.IsNumber(item.DataFormatType)) chart.ChartCorssCursor.StringFormatY.DataFormatType=item.DataFormatType;
|
|
5018
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.HPenType)) chart.ChartCorssCursor.HPenType=option.CorssCursorInfo.HPenType;
|
|
5019
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.VPenType)) chart.ChartCorssCursor.VPenType=option.CorssCursorInfo.VPenType;
|
|
5020
|
+
}
|
|
5021
|
+
|
|
5022
|
+
if (IFrameSplitOperator.IsNumber(option.DayCount)) chart.DayCount=option.DayCount;
|
|
5023
|
+
this.SetChartBorder(chart, option);
|
|
5024
|
+
|
|
5025
|
+
if (option.SplashTitle) chart.ChartSplashPaint.SplashTitle=option.SplashTitle;
|
|
5026
|
+
|
|
5027
|
+
chart.TitlePaint[0].IsShow=false;
|
|
5028
|
+
|
|
5029
|
+
//主窗口 隐藏刻度
|
|
5030
|
+
var mainFrame=chart.Frame.SubFrame[0];
|
|
5031
|
+
mainFrame.Frame.IsShowYText[0]=false;
|
|
5032
|
+
mainFrame.Frame.IsShowYText[1]=false;
|
|
5033
|
+
mainFrame.Frame.IsShowXLine=false;
|
|
5034
|
+
mainFrame.Frame.IsShowYLine=false;
|
|
5035
|
+
mainFrame.Frame.BorderLine=0;
|
|
5036
|
+
|
|
5037
|
+
chart.Frame.SubFrame[1].Height=0; //隐藏成交量
|
|
5038
|
+
chart.EnableBorderDrag=false;
|
|
5039
|
+
|
|
5040
|
+
if (option.Frame)
|
|
5041
|
+
{
|
|
5042
|
+
for(var i=0;i<option.Frame.length;++i)
|
|
5043
|
+
{
|
|
5044
|
+
var item=option.Frame[i];
|
|
5045
|
+
if (!chart.Frame.SubFrame[i]) continue;
|
|
5046
|
+
if (item.SplitCount) chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;
|
|
5047
|
+
if (item.StringFormat) chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;
|
|
5048
|
+
if (IFrameSplitOperator.IsNumber(item.SplitType))
|
|
5049
|
+
{
|
|
5050
|
+
chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitType=item.SplitType;
|
|
5051
|
+
chart.Frame.SubFrame[i].Frame.YSplitOperator.DefaultSplitType=item.SplitType;
|
|
5052
|
+
}
|
|
5053
|
+
if (item.IsShowLeftText==false)
|
|
5054
|
+
{
|
|
5055
|
+
chart.Frame.SubFrame[i].Frame.IsShowYText[0]=item.IsShowLeftText;
|
|
5056
|
+
chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowLeftText=item.IsShowLeftText; //显示左边刻度
|
|
5057
|
+
}
|
|
5058
|
+
if (item.IsShowRightText==false)
|
|
5059
|
+
{
|
|
5060
|
+
chart.Frame.SubFrame[i].Frame.IsShowYText[1]=item.IsShowRightText;
|
|
5061
|
+
chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowRightText=item.IsShowRightText; //显示右边刻度
|
|
5062
|
+
}
|
|
5063
|
+
if (item.Height>=0) chart.Frame.SubFrame[i].Height = item.Height;
|
|
5064
|
+
if (item.Custom) chart.Frame.SubFrame[i].Frame.YSplitOperator.Custom=item.Custom;
|
|
5065
|
+
if (item.RightTextFormat>0) chart.Frame.SubFrame[i].Frame.YSplitOperator.RightTextFormat=item.RightTextFormat;
|
|
5066
|
+
if (IFrameSplitOperator.IsNumber(item.TitleHeight)) chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;
|
|
5067
|
+
if (IFrameSplitOperator.IsNumber(item.BorderLine)) chart.Frame.SubFrame[i].Frame.BorderLine=item.BorderLine;
|
|
5068
|
+
if (IFrameSplitOperator.IsBool(item.EnableRemoveZero)) chart.Frame.SubFrame[i].Frame.YSplitOperator.EnableRemoveZero=item.EnableRemoveZero;
|
|
5069
|
+
if (IFrameSplitOperator.IsNumber(item.FloatPrecision)) chart.Frame.SubFrame[i].Frame.YSplitOperator.FloatPrecision=item.FloatPrecision;
|
|
5070
|
+
if (IFrameSplitOperator.IsBool(item.IsShowXLine)) chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;
|
|
5071
|
+
if (IFrameSplitOperator.IsBool(item.IsShowYLine)) chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;
|
|
5072
|
+
if (IFrameSplitOperator.IsNumber(item.YTextBaseline)) chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;
|
|
5073
|
+
}
|
|
5074
|
+
}
|
|
5075
|
+
|
|
5076
|
+
chart.UpdateXShowText();
|
|
5077
|
+
|
|
5078
|
+
|
|
5079
|
+
if (option.MinuteLine)
|
|
5080
|
+
{
|
|
5081
|
+
if (option.MinuteLine.IsDrawAreaPrice==false) chart.ChartPaint[0].IsDrawArea=false;
|
|
5082
|
+
if (option.MinuteLine.IsShowLead==false) chart.IsShowLead=false;
|
|
5083
|
+
if (option.MinuteLine.IsShowAveragePrice==false)
|
|
5084
|
+
{
|
|
5085
|
+
chart.ChartPaint[1].IsShow=false;
|
|
5086
|
+
chart.TitlePaint[0].IsShowAveragePrice=false; //标题栏均线也不显示
|
|
5087
|
+
for(var i=0;i<chart.ExtendChartPaint.length;++i)
|
|
5088
|
+
{
|
|
5089
|
+
var item=chart.ExtendChartPaint[i];
|
|
5090
|
+
if (item.ClassName=="MinuteTooltipPaint")
|
|
5091
|
+
item.IsShowAveragePrice=false;
|
|
5092
|
+
}
|
|
5093
|
+
}
|
|
5094
|
+
if (option.MinuteLine.SplitType>0) chart.Frame.SubFrame[0].Frame.YSplitOperator.SplitType=option.MinuteLine.SplitType;
|
|
5095
|
+
}
|
|
5096
|
+
|
|
5097
|
+
this.AdjustTitleHeight(chart);
|
|
5098
|
+
|
|
5099
|
+
if (option.DisableMouseEvent===true)
|
|
5100
|
+
{
|
|
5101
|
+
//取消鼠标事件
|
|
5102
|
+
this.CanvasElement.onmousemove=(e)=>{ }
|
|
5103
|
+
this.CanvasElement.oncontextmenu=(e)=> { }
|
|
5104
|
+
this.CanvasElement.ondblclick=(e)=>{ }
|
|
5105
|
+
this.CanvasElement.onmousedown=(e)=> { }
|
|
5106
|
+
this.CanvasElement.onmouseout=(e)=>{ }
|
|
5107
|
+
this.CanvasElement.onmouseleave=(e)=>{ }
|
|
5108
|
+
}
|
|
5109
|
+
|
|
5110
|
+
return chart;
|
|
5111
|
+
|
|
5112
|
+
}
|
|
5113
|
+
|
|
4968
5114
|
//历史分钟走势图
|
|
4969
5115
|
this.CreateHistoryMinuteChartContainer=function(option)
|
|
4970
5116
|
{
|
|
@@ -5274,6 +5420,9 @@ function JSChart(divElement, bOffscreen)
|
|
|
5274
5420
|
case "分钟走势图横屏":
|
|
5275
5421
|
chart=this.CreateMinuteChartContainer(option);
|
|
5276
5422
|
break;
|
|
5423
|
+
case "迷你分钟走势图":
|
|
5424
|
+
chart=this.CreateMinMinuteChartContainer(option);
|
|
5425
|
+
break;
|
|
5277
5426
|
case "历史分钟走势图":
|
|
5278
5427
|
chart=this.CreateHistoryMinuteChartContainer(option);
|
|
5279
5428
|
break;
|
|
@@ -6388,7 +6537,15 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
6388
6537
|
if (this.BorderDrag) return;
|
|
6389
6538
|
if (this.YDrag) return;
|
|
6390
6539
|
if (this.IndexChartDrag) return;
|
|
6391
|
-
|
|
6540
|
+
|
|
6541
|
+
/*
|
|
6542
|
+
if (this.CurrentChartDrawPicture)
|
|
6543
|
+
{
|
|
6544
|
+
var drawPicture=this.CurrentChartDrawPicture;
|
|
6545
|
+
if (drawPicture.PointCount<=2) return;
|
|
6546
|
+
JSConsole.Chart.Log("[JSChartContainer::UIOnMouseMove] Status", drawPicture.Status);
|
|
6547
|
+
}
|
|
6548
|
+
*/
|
|
6392
6549
|
|
|
6393
6550
|
//保存最后一次鼠标移动信息
|
|
6394
6551
|
var MoveStatus={ X:x, Y:y, IsInClient: this.IsMouseOnClient(x,y) };
|
|
@@ -8573,7 +8730,7 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8573
8730
|
}
|
|
8574
8731
|
}
|
|
8575
8732
|
|
|
8576
|
-
if (this.EnableBorderDrag && this.Frame)
|
|
8733
|
+
if (this.EnableBorderDrag && this.Frame && !this.CurrentChartDrawPicture)
|
|
8577
8734
|
{
|
|
8578
8735
|
var dragBorder=this.Frame.PtInFrameBorder(x,y);
|
|
8579
8736
|
if (dragBorder && dragBorder.Index>=0)
|
|
@@ -8583,7 +8740,7 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8583
8740
|
}
|
|
8584
8741
|
}
|
|
8585
8742
|
|
|
8586
|
-
if (this.EnableYDrag && this.Frame && !
|
|
8743
|
+
if (this.EnableYDrag && this.Frame && !this.CurrentChartDrawPicture)
|
|
8587
8744
|
{
|
|
8588
8745
|
var dragY=this.TryYDrag(x,y);
|
|
8589
8746
|
if (dragY)
|
|
@@ -8593,19 +8750,22 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8593
8750
|
}
|
|
8594
8751
|
}
|
|
8595
8752
|
|
|
8596
|
-
|
|
8597
|
-
if (button)
|
|
8753
|
+
if (!this.CurrentChartDrawPicture)
|
|
8598
8754
|
{
|
|
8599
|
-
|
|
8600
|
-
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ", button);
|
|
8601
|
-
}
|
|
8602
|
-
else
|
|
8603
|
-
{
|
|
8604
|
-
button=this.PtInExtendChartButtons(x,y);
|
|
8755
|
+
var button=this.Frame.PtInButtons(x,y);
|
|
8605
8756
|
if (button)
|
|
8606
8757
|
{
|
|
8607
|
-
mouseStatus={ Cursor:"pointer", Name:"
|
|
8608
|
-
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove]
|
|
8758
|
+
mouseStatus={ Cursor:"pointer", Name:"FrameButton"};
|
|
8759
|
+
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ", button);
|
|
8760
|
+
}
|
|
8761
|
+
else
|
|
8762
|
+
{
|
|
8763
|
+
button=this.PtInExtendChartButtons(x,y);
|
|
8764
|
+
if (button)
|
|
8765
|
+
{
|
|
8766
|
+
mouseStatus={ Cursor:"pointer", Name:"ExtendChartButton"};
|
|
8767
|
+
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] extend chart button ", button);
|
|
8768
|
+
}
|
|
8609
8769
|
}
|
|
8610
8770
|
}
|
|
8611
8771
|
|
|
@@ -8625,7 +8785,7 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8625
8785
|
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");
|
|
8626
8786
|
}
|
|
8627
8787
|
|
|
8628
|
-
if (this.SelectedChart.EnableMoveOn && this.PtInChart)
|
|
8788
|
+
if (this.SelectedChart.EnableMoveOn && this.PtInChart && !this.CurrentChartDrawPicture)
|
|
8629
8789
|
{
|
|
8630
8790
|
var chartInfo=this.PtInChart(x,y);
|
|
8631
8791
|
if (chartInfo && chartInfo.Identify)
|
|
@@ -8648,6 +8808,7 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8648
8808
|
var bDrawPicture=false; //是否正在画图
|
|
8649
8809
|
if (this.CurrentChartDrawPicture)
|
|
8650
8810
|
{
|
|
8811
|
+
if (this.CurrentChartDrawPicture.Status!=20) mouseStatus={ Cursor:"crosshair", Name:"CurrentChartDrawPicture"};
|
|
8651
8812
|
if (this.CurrentChartDrawPicture.SetLastPoint) this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});
|
|
8652
8813
|
bDrawPicture=true;
|
|
8653
8814
|
}
|
|
@@ -23021,9 +23182,17 @@ function ChartKLine()
|
|
|
23021
23182
|
var textSize=fontSize*pixelRatio;
|
|
23022
23183
|
this.Canvas.beginPath();
|
|
23023
23184
|
this.Canvas.font=fontSize*pixelRatio+'px '+this.TickFontName;
|
|
23185
|
+
|
|
23186
|
+
this.ShowRange.Start=this.Data.DataOffset;
|
|
23187
|
+
this.ShowRange.End=this.ShowRange.Start;
|
|
23188
|
+
this.ShowRange.DataCount=0;
|
|
23189
|
+
this.ShowRange.ShowCount=xPointCount;
|
|
23190
|
+
this.DrawKRange.Start=this.Data.DataOffset;
|
|
23191
|
+
|
|
23024
23192
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
23025
23193
|
{
|
|
23026
23194
|
var data=this.Data.Data[i];
|
|
23195
|
+
this.ShowRange.End=i;
|
|
23027
23196
|
if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
23028
23197
|
|
|
23029
23198
|
var left=xOffset;
|
|
@@ -23031,6 +23200,7 @@ function ChartKLine()
|
|
|
23031
23200
|
if (right>chartright) break;
|
|
23032
23201
|
var x=left+(right-left)/2;
|
|
23033
23202
|
var yClose=this.ChartFrame.GetYFromData(data.Close,false);
|
|
23203
|
+
this.DrawKRange.End=i;
|
|
23034
23204
|
|
|
23035
23205
|
if (data.Flag===0) this.Canvas.fillStyle=this.UpColor;
|
|
23036
23206
|
else if (data.Flag==1) this.Canvas.fillStyle=this.DownColor;
|
|
@@ -23122,6 +23292,11 @@ function ChartKLine()
|
|
|
23122
23292
|
this.ClipClient(this.ChartFrame.IsHScreen);
|
|
23123
23293
|
this.DrawCloseLine();
|
|
23124
23294
|
}
|
|
23295
|
+
else if (this.DrawType==4)
|
|
23296
|
+
{
|
|
23297
|
+
this.ClipClient(this.ChartFrame.IsHScreen);
|
|
23298
|
+
this.DrawCloseArea();
|
|
23299
|
+
}
|
|
23125
23300
|
else
|
|
23126
23301
|
{
|
|
23127
23302
|
this.ClipTickClient(this.ChartFrame.IsHScreen);
|
|
@@ -40971,18 +41146,24 @@ function ChartCorssCursor()
|
|
|
40971
41146
|
}
|
|
40972
41147
|
|
|
40973
41148
|
//X轴
|
|
40974
|
-
if (this.ShowTextMode.Bottom==1 && this.StringFormatX.Operator())
|
|
41149
|
+
if ((this.ShowTextMode.Bottom==1 || this.ShowTextMode.Bottom==2) && this.StringFormatX.Operator())
|
|
40975
41150
|
{
|
|
40976
41151
|
var text=this.StringFormatX.Text;
|
|
40977
41152
|
this.Canvas.font=this.Font;
|
|
40978
|
-
|
|
40979
41153
|
this.Canvas.fillStyle=this.TextBGColor;
|
|
40980
41154
|
var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
|
|
41155
|
+
|
|
40981
41156
|
var yCenter=bottom+2+this.TextHeight/2;
|
|
41157
|
+
var yTop=bottom+2;
|
|
41158
|
+
if (this.ShowTextMode.Bottom==2)
|
|
41159
|
+
{
|
|
41160
|
+
yCenter=bottom-this.TextHeight/2-2;
|
|
41161
|
+
yTop=bottom-this.TextHeight-2;
|
|
41162
|
+
}
|
|
40982
41163
|
//JSConsole.Chart.Log('[ChartCorssCursor::Draw] ',yCenter);
|
|
40983
41164
|
if (x-textWidth/2<3) //左边位置不够了, 顶着左边画
|
|
40984
41165
|
{
|
|
40985
|
-
this.DrawTextBGRect(x-1,
|
|
41166
|
+
this.DrawTextBGRect(x-1,yTop,textWidth,this.TextHeight);
|
|
40986
41167
|
this.Canvas.textAlign="left";
|
|
40987
41168
|
this.Canvas.textBaseline="middle";
|
|
40988
41169
|
this.Canvas.fillStyle=this.TextColor;
|
|
@@ -40990,7 +41171,7 @@ function ChartCorssCursor()
|
|
|
40990
41171
|
}
|
|
40991
41172
|
else if (x+textWidth/2>=right)
|
|
40992
41173
|
{
|
|
40993
|
-
this.DrawTextBGRect(right-textWidth,
|
|
41174
|
+
this.DrawTextBGRect(right-textWidth,yTop,textWidth,this.TextHeight);
|
|
40994
41175
|
this.Canvas.textAlign="right";
|
|
40995
41176
|
this.Canvas.textBaseline="middle";
|
|
40996
41177
|
this.Canvas.fillStyle=this.TextColor;
|
|
@@ -40998,7 +41179,7 @@ function ChartCorssCursor()
|
|
|
40998
41179
|
}
|
|
40999
41180
|
else
|
|
41000
41181
|
{
|
|
41001
|
-
this.DrawTextBGRect(x-textWidth/2,
|
|
41182
|
+
this.DrawTextBGRect(x-textWidth/2,yTop,textWidth,this.TextHeight);
|
|
41002
41183
|
this.Canvas.textAlign="center";
|
|
41003
41184
|
this.Canvas.textBaseline="middle";
|
|
41004
41185
|
this.Canvas.fillStyle=this.TextColor;
|
|
@@ -45405,7 +45586,10 @@ IChartDrawPicture.ArrayDrawPricture=
|
|
|
45405
45586
|
//涂鸦 不绑定K线坐标
|
|
45406
45587
|
{ Name:"涂鸦线段", ClassName:'ChartDrawGraffitiLine', Create:function() { return new ChartDrawGraffitiLine(); } },
|
|
45407
45588
|
|
|
45408
|
-
{ Name:"固定范围成交量分布图", ClassName:"ChartDrawVolProfile", Create:function() { return new ChartDrawVolProfile(); }}
|
|
45589
|
+
{ Name:"固定范围成交量分布图", ClassName:"ChartDrawVolProfile", Create:function() { return new ChartDrawVolProfile(); }},
|
|
45590
|
+
|
|
45591
|
+
{ Name:"DisjointChannel", ClassName:"ChartDrawDisjontChannel", Create:function() { return new ChartDrawDisjontChannel();}},
|
|
45592
|
+
{ Name:"FlatTop", ClassName:"ChartDrawDisjontChannel", Create:function() { return new ChartDrawFlatTop();}},
|
|
45409
45593
|
|
|
45410
45594
|
];
|
|
45411
45595
|
|
|
@@ -46713,6 +46897,106 @@ function ChartDrawPictureParallelLines()
|
|
|
46713
46897
|
}
|
|
46714
46898
|
}
|
|
46715
46899
|
|
|
46900
|
+
|
|
46901
|
+
//FlatTop/Bottom
|
|
46902
|
+
function ChartDrawFlatTop()
|
|
46903
|
+
{
|
|
46904
|
+
this.newMethod=IChartDrawPicture; //派生
|
|
46905
|
+
this.newMethod();
|
|
46906
|
+
delete this.newMethod;
|
|
46907
|
+
|
|
46908
|
+
this.ClassName='ChartDrawFlatTop';
|
|
46909
|
+
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
46910
|
+
this.PointCount=3;
|
|
46911
|
+
this.LastPoint;
|
|
46912
|
+
|
|
46913
|
+
this.Draw=function()
|
|
46914
|
+
{
|
|
46915
|
+
this.LinePoint=[];
|
|
46916
|
+
if (this.IsFrameMinSize()) return;
|
|
46917
|
+
|
|
46918
|
+
var drawPoint=this.CalculateDrawPoint({IsCheckX:true, IsCheckY:true});
|
|
46919
|
+
if (!drawPoint) return;
|
|
46920
|
+
|
|
46921
|
+
this.AreaColor=IChartDrawPicture.ColorToRGBA(this.LineColor,0.3);
|
|
46922
|
+
var points=drawPoint.slice(0);
|
|
46923
|
+
this.CalculateLines(points);
|
|
46924
|
+
|
|
46925
|
+
this.ClipFrame();
|
|
46926
|
+
|
|
46927
|
+
for(var i=0;i<this.LinePoint.length; ++i)
|
|
46928
|
+
{
|
|
46929
|
+
var item=this.LinePoint[i];
|
|
46930
|
+
this.DrawLine(item.Start,item.End);
|
|
46931
|
+
}
|
|
46932
|
+
|
|
46933
|
+
this.DrawArea();
|
|
46934
|
+
this.DrawPoint(points); //画点
|
|
46935
|
+
this.Canvas.restore();
|
|
46936
|
+
}
|
|
46937
|
+
|
|
46938
|
+
this.SetLastPoint=function(obj)
|
|
46939
|
+
{
|
|
46940
|
+
this.LastPoint={X:obj.X,Y:obj.Y};
|
|
46941
|
+
}
|
|
46942
|
+
|
|
46943
|
+
this.DrawArea=function()
|
|
46944
|
+
{
|
|
46945
|
+
if (this.LinePoint.length!=2) return;
|
|
46946
|
+
|
|
46947
|
+
this.Canvas.fillStyle=this.AreaColor;
|
|
46948
|
+
this.Canvas.beginPath();
|
|
46949
|
+
this.Canvas.moveTo(this.LinePoint[0].Start.X,this.LinePoint[0].Start.Y);
|
|
46950
|
+
this.Canvas.lineTo(this.LinePoint[0].End.X,this.LinePoint[0].End.Y);
|
|
46951
|
+
this.Canvas.lineTo(this.LinePoint[1].End.X,this.LinePoint[1].End.Y);
|
|
46952
|
+
this.Canvas.lineTo(this.LinePoint[1].Start.X,this.LinePoint[1].Start.Y);
|
|
46953
|
+
this.Canvas.closePath();
|
|
46954
|
+
this.Canvas.fill();
|
|
46955
|
+
|
|
46956
|
+
}
|
|
46957
|
+
|
|
46958
|
+
this.CalculateLines=function(points)
|
|
46959
|
+
{
|
|
46960
|
+
if (this.PointStatus==2 && this.LastPoint)
|
|
46961
|
+
{
|
|
46962
|
+
var ptSecond=points[1];
|
|
46963
|
+
var pt=new Point();
|
|
46964
|
+
pt.X=ptSecond.X;
|
|
46965
|
+
pt.Y=this.LastPoint.Y;
|
|
46966
|
+
points[2]=pt;
|
|
46967
|
+
}
|
|
46968
|
+
|
|
46969
|
+
if (points.length==2)
|
|
46970
|
+
{
|
|
46971
|
+
this.LinePoint.push({ Start:points[0], End:points[1]});
|
|
46972
|
+
}
|
|
46973
|
+
else if (points.length==3)
|
|
46974
|
+
{
|
|
46975
|
+
this.LinePoint.push({ Start:points[0], End:points[1]});
|
|
46976
|
+
|
|
46977
|
+
//计算水平线
|
|
46978
|
+
var ptThrid=points[2];
|
|
46979
|
+
ptThrid.X=points[1].X;
|
|
46980
|
+
var ptStart={ X:points[0].X, Y:ptThrid.Y };
|
|
46981
|
+
var ptEnd={ X:points[1].X, Y:ptThrid.Y };
|
|
46982
|
+
this.LinePoint.push({ Start:ptStart, End:ptEnd});
|
|
46983
|
+
}
|
|
46984
|
+
}
|
|
46985
|
+
}
|
|
46986
|
+
|
|
46987
|
+
//Disjont Channel
|
|
46988
|
+
function ChartDrawDisjontChannel()
|
|
46989
|
+
{
|
|
46990
|
+
this.newMethod=ChartDrawFlatTop; //派生
|
|
46991
|
+
this.newMethod();
|
|
46992
|
+
delete this.newMethod;
|
|
46993
|
+
|
|
46994
|
+
this.ClassName='ChartDrawDisjontChannel';
|
|
46995
|
+
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
46996
|
+
this.PointCount=3;
|
|
46997
|
+
this.LastPoint;
|
|
46998
|
+
}
|
|
46999
|
+
|
|
46716
47000
|
//平行射线
|
|
46717
47001
|
function ChartDrawParallelRaysLines()
|
|
46718
47002
|
{
|
|
@@ -5009,6 +5009,152 @@ function JSChart(divElement, bOffscreen)
|
|
|
5009
5009
|
return chart;
|
|
5010
5010
|
}
|
|
5011
5011
|
|
|
5012
|
+
this.CreateMinMinuteChartContainer=function(option)
|
|
5013
|
+
{
|
|
5014
|
+
var chart=null;
|
|
5015
|
+
if (option.Type==="迷你分钟走势图横屏") chart=new MinuteChartHScreenContainer(this.CanvasElement);
|
|
5016
|
+
else chart=new MinuteChartContainer(this.CanvasElement);
|
|
5017
|
+
|
|
5018
|
+
if (option.NetworkFilter) chart.NetworkFilter=option.NetworkFilter;
|
|
5019
|
+
var windowsCount=2;
|
|
5020
|
+
|
|
5021
|
+
if (option.BeforeOpen) //集合竞价
|
|
5022
|
+
{
|
|
5023
|
+
var item=option.BeforeOpen;
|
|
5024
|
+
|
|
5025
|
+
if (IFrameSplitOperator.IsBool(item.IsShow)) chart.IsShowBeforeData=item.IsShow;
|
|
5026
|
+
if (IFrameSplitOperator.IsNumber(item.Width)) chart.ExtendWidth.Left=item.Width;
|
|
5027
|
+
if (IFrameSplitOperator.IsBool(item.IsShowMultiDay)) chart.IsShowMultiDayBeforeData=item.IsShowMultiDay;
|
|
5028
|
+
if (IFrameSplitOperator.IsNumber(item.MulitiDayWidth)) chart.MultiDayExtendWidth.Left=item.MulitiDayWidth;
|
|
5029
|
+
}
|
|
5030
|
+
|
|
5031
|
+
if (option.AfterClose) //收盘集合竞价
|
|
5032
|
+
{
|
|
5033
|
+
var item=option.AfterClose;
|
|
5034
|
+
if (IFrameSplitOperator.IsBool(item.IsShow)) chart.IsShowAfterData=item.IsShow;
|
|
5035
|
+
if (IFrameSplitOperator.IsNumber(item.ShareVol)) chart.ShareAfterVol=item.ShareVol;
|
|
5036
|
+
if (IFrameSplitOperator.IsNumber(item.Width)) chart.ExtendWidth.Right=item.Width;
|
|
5037
|
+
if (IFrameSplitOperator.IsBool(item.IsShowMultiDay)) chart.IsShowMultiDayAfterData=item.IsShowMultiDay;
|
|
5038
|
+
if (IFrameSplitOperator.IsNumber(item.MulitiDayWidth)) chart.MultiDayExtendWidth.Right=item.MulitiDayWidth;
|
|
5039
|
+
}
|
|
5040
|
+
|
|
5041
|
+
if (!option.Listener) option.Listener={ KeyDown:false, Wheel:false };
|
|
5042
|
+
chart.Create(windowsCount,option.Listener); //创建子窗口
|
|
5043
|
+
|
|
5044
|
+
if (option.CorssCursorInfo)
|
|
5045
|
+
{
|
|
5046
|
+
var item=option.CorssCursorInfo;
|
|
5047
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.Left)) chart.ChartCorssCursor.ShowTextMode.Left=option.CorssCursorInfo.Left;
|
|
5048
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.Right)) chart.ChartCorssCursor.ShowTextMode.Right=option.CorssCursorInfo.Right;
|
|
5049
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.Bottom)) chart.ChartCorssCursor.ShowTextMode.Bottom=option.CorssCursorInfo.Bottom;
|
|
5050
|
+
if (option.CorssCursorInfo.IsShowCorss===false) chart.ChartCorssCursor.IsShowCorss=option.CorssCursorInfo.IsShowCorss;
|
|
5051
|
+
if (option.CorssCursorInfo.RightTextFormat>0) chart.ChartCorssCursor.TextFormat.Right=option.CorssCursorInfo.RightTextFormat;
|
|
5052
|
+
if (option.CorssCursorInfo.IsOnlyDrawMinute == true) chart.ChartCorssCursor.IsOnlyDrawMinute = option.CorssCursorInfo.IsOnlyDrawMinute; //Y轴显示收盘价
|
|
5053
|
+
if (IFrameSplitOperator.IsBool(option.CorssCursorInfo.IsFixXLastTime)) chart.ChartCorssCursor.IsFixXLastTime=option.CorssCursorInfo.IsFixXLastTime;
|
|
5054
|
+
|
|
5055
|
+
if (item.RightButton)
|
|
5056
|
+
{
|
|
5057
|
+
if (IFrameSplitOperator.IsBool(item.RightButton.Enable)) chart.ChartCorssCursor.RightButton.Enable=item.RightButton.Enable;
|
|
5058
|
+
}
|
|
5059
|
+
|
|
5060
|
+
if (IFrameSplitOperator.IsNumber(item.PriceFormatType)) chart.ChartCorssCursor.StringFormatY.PriceFormatType=item.PriceFormatType;
|
|
5061
|
+
if (IFrameSplitOperator.IsNumber(item.DataFormatType)) chart.ChartCorssCursor.StringFormatY.DataFormatType=item.DataFormatType;
|
|
5062
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.HPenType)) chart.ChartCorssCursor.HPenType=option.CorssCursorInfo.HPenType;
|
|
5063
|
+
if (IFrameSplitOperator.IsNumber(option.CorssCursorInfo.VPenType)) chart.ChartCorssCursor.VPenType=option.CorssCursorInfo.VPenType;
|
|
5064
|
+
}
|
|
5065
|
+
|
|
5066
|
+
if (IFrameSplitOperator.IsNumber(option.DayCount)) chart.DayCount=option.DayCount;
|
|
5067
|
+
this.SetChartBorder(chart, option);
|
|
5068
|
+
|
|
5069
|
+
if (option.SplashTitle) chart.ChartSplashPaint.SplashTitle=option.SplashTitle;
|
|
5070
|
+
|
|
5071
|
+
chart.TitlePaint[0].IsShow=false;
|
|
5072
|
+
|
|
5073
|
+
//主窗口 隐藏刻度
|
|
5074
|
+
var mainFrame=chart.Frame.SubFrame[0];
|
|
5075
|
+
mainFrame.Frame.IsShowYText[0]=false;
|
|
5076
|
+
mainFrame.Frame.IsShowYText[1]=false;
|
|
5077
|
+
mainFrame.Frame.IsShowXLine=false;
|
|
5078
|
+
mainFrame.Frame.IsShowYLine=false;
|
|
5079
|
+
mainFrame.Frame.BorderLine=0;
|
|
5080
|
+
|
|
5081
|
+
chart.Frame.SubFrame[1].Height=0; //隐藏成交量
|
|
5082
|
+
chart.EnableBorderDrag=false;
|
|
5083
|
+
|
|
5084
|
+
if (option.Frame)
|
|
5085
|
+
{
|
|
5086
|
+
for(var i=0;i<option.Frame.length;++i)
|
|
5087
|
+
{
|
|
5088
|
+
var item=option.Frame[i];
|
|
5089
|
+
if (!chart.Frame.SubFrame[i]) continue;
|
|
5090
|
+
if (item.SplitCount) chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitCount=item.SplitCount;
|
|
5091
|
+
if (item.StringFormat) chart.Frame.SubFrame[i].Frame.YSplitOperator.StringFormat=item.StringFormat;
|
|
5092
|
+
if (IFrameSplitOperator.IsNumber(item.SplitType))
|
|
5093
|
+
{
|
|
5094
|
+
chart.Frame.SubFrame[i].Frame.YSplitOperator.SplitType=item.SplitType;
|
|
5095
|
+
chart.Frame.SubFrame[i].Frame.YSplitOperator.DefaultSplitType=item.SplitType;
|
|
5096
|
+
}
|
|
5097
|
+
if (item.IsShowLeftText==false)
|
|
5098
|
+
{
|
|
5099
|
+
chart.Frame.SubFrame[i].Frame.IsShowYText[0]=item.IsShowLeftText;
|
|
5100
|
+
chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowLeftText=item.IsShowLeftText; //显示左边刻度
|
|
5101
|
+
}
|
|
5102
|
+
if (item.IsShowRightText==false)
|
|
5103
|
+
{
|
|
5104
|
+
chart.Frame.SubFrame[i].Frame.IsShowYText[1]=item.IsShowRightText;
|
|
5105
|
+
chart.Frame.SubFrame[i].Frame.YSplitOperator.IsShowRightText=item.IsShowRightText; //显示右边刻度
|
|
5106
|
+
}
|
|
5107
|
+
if (item.Height>=0) chart.Frame.SubFrame[i].Height = item.Height;
|
|
5108
|
+
if (item.Custom) chart.Frame.SubFrame[i].Frame.YSplitOperator.Custom=item.Custom;
|
|
5109
|
+
if (item.RightTextFormat>0) chart.Frame.SubFrame[i].Frame.YSplitOperator.RightTextFormat=item.RightTextFormat;
|
|
5110
|
+
if (IFrameSplitOperator.IsNumber(item.TitleHeight)) chart.Frame.SubFrame[i].Frame.ChartBorder.TitleHeight=item.TitleHeight;
|
|
5111
|
+
if (IFrameSplitOperator.IsNumber(item.BorderLine)) chart.Frame.SubFrame[i].Frame.BorderLine=item.BorderLine;
|
|
5112
|
+
if (IFrameSplitOperator.IsBool(item.EnableRemoveZero)) chart.Frame.SubFrame[i].Frame.YSplitOperator.EnableRemoveZero=item.EnableRemoveZero;
|
|
5113
|
+
if (IFrameSplitOperator.IsNumber(item.FloatPrecision)) chart.Frame.SubFrame[i].Frame.YSplitOperator.FloatPrecision=item.FloatPrecision;
|
|
5114
|
+
if (IFrameSplitOperator.IsBool(item.IsShowXLine)) chart.Frame.SubFrame[i].Frame.IsShowXLine=item.IsShowXLine;
|
|
5115
|
+
if (IFrameSplitOperator.IsBool(item.IsShowYLine)) chart.Frame.SubFrame[i].Frame.IsShowYLine=item.IsShowYLine;
|
|
5116
|
+
if (IFrameSplitOperator.IsNumber(item.YTextBaseline)) chart.Frame.SubFrame[i].Frame.YTextBaseline=item.YTextBaseline;
|
|
5117
|
+
}
|
|
5118
|
+
}
|
|
5119
|
+
|
|
5120
|
+
chart.UpdateXShowText();
|
|
5121
|
+
|
|
5122
|
+
|
|
5123
|
+
if (option.MinuteLine)
|
|
5124
|
+
{
|
|
5125
|
+
if (option.MinuteLine.IsDrawAreaPrice==false) chart.ChartPaint[0].IsDrawArea=false;
|
|
5126
|
+
if (option.MinuteLine.IsShowLead==false) chart.IsShowLead=false;
|
|
5127
|
+
if (option.MinuteLine.IsShowAveragePrice==false)
|
|
5128
|
+
{
|
|
5129
|
+
chart.ChartPaint[1].IsShow=false;
|
|
5130
|
+
chart.TitlePaint[0].IsShowAveragePrice=false; //标题栏均线也不显示
|
|
5131
|
+
for(var i=0;i<chart.ExtendChartPaint.length;++i)
|
|
5132
|
+
{
|
|
5133
|
+
var item=chart.ExtendChartPaint[i];
|
|
5134
|
+
if (item.ClassName=="MinuteTooltipPaint")
|
|
5135
|
+
item.IsShowAveragePrice=false;
|
|
5136
|
+
}
|
|
5137
|
+
}
|
|
5138
|
+
if (option.MinuteLine.SplitType>0) chart.Frame.SubFrame[0].Frame.YSplitOperator.SplitType=option.MinuteLine.SplitType;
|
|
5139
|
+
}
|
|
5140
|
+
|
|
5141
|
+
this.AdjustTitleHeight(chart);
|
|
5142
|
+
|
|
5143
|
+
if (option.DisableMouseEvent===true)
|
|
5144
|
+
{
|
|
5145
|
+
//取消鼠标事件
|
|
5146
|
+
this.CanvasElement.onmousemove=(e)=>{ }
|
|
5147
|
+
this.CanvasElement.oncontextmenu=(e)=> { }
|
|
5148
|
+
this.CanvasElement.ondblclick=(e)=>{ }
|
|
5149
|
+
this.CanvasElement.onmousedown=(e)=> { }
|
|
5150
|
+
this.CanvasElement.onmouseout=(e)=>{ }
|
|
5151
|
+
this.CanvasElement.onmouseleave=(e)=>{ }
|
|
5152
|
+
}
|
|
5153
|
+
|
|
5154
|
+
return chart;
|
|
5155
|
+
|
|
5156
|
+
}
|
|
5157
|
+
|
|
5012
5158
|
//历史分钟走势图
|
|
5013
5159
|
this.CreateHistoryMinuteChartContainer=function(option)
|
|
5014
5160
|
{
|
|
@@ -5318,6 +5464,9 @@ function JSChart(divElement, bOffscreen)
|
|
|
5318
5464
|
case "分钟走势图横屏":
|
|
5319
5465
|
chart=this.CreateMinuteChartContainer(option);
|
|
5320
5466
|
break;
|
|
5467
|
+
case "迷你分钟走势图":
|
|
5468
|
+
chart=this.CreateMinMinuteChartContainer(option);
|
|
5469
|
+
break;
|
|
5321
5470
|
case "历史分钟走势图":
|
|
5322
5471
|
chart=this.CreateHistoryMinuteChartContainer(option);
|
|
5323
5472
|
break;
|
|
@@ -6432,7 +6581,15 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
6432
6581
|
if (this.BorderDrag) return;
|
|
6433
6582
|
if (this.YDrag) return;
|
|
6434
6583
|
if (this.IndexChartDrag) return;
|
|
6435
|
-
|
|
6584
|
+
|
|
6585
|
+
/*
|
|
6586
|
+
if (this.CurrentChartDrawPicture)
|
|
6587
|
+
{
|
|
6588
|
+
var drawPicture=this.CurrentChartDrawPicture;
|
|
6589
|
+
if (drawPicture.PointCount<=2) return;
|
|
6590
|
+
JSConsole.Chart.Log("[JSChartContainer::UIOnMouseMove] Status", drawPicture.Status);
|
|
6591
|
+
}
|
|
6592
|
+
*/
|
|
6436
6593
|
|
|
6437
6594
|
//保存最后一次鼠标移动信息
|
|
6438
6595
|
var MoveStatus={ X:x, Y:y, IsInClient: this.IsMouseOnClient(x,y) };
|
|
@@ -8617,7 +8774,7 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8617
8774
|
}
|
|
8618
8775
|
}
|
|
8619
8776
|
|
|
8620
|
-
if (this.EnableBorderDrag && this.Frame)
|
|
8777
|
+
if (this.EnableBorderDrag && this.Frame && !this.CurrentChartDrawPicture)
|
|
8621
8778
|
{
|
|
8622
8779
|
var dragBorder=this.Frame.PtInFrameBorder(x,y);
|
|
8623
8780
|
if (dragBorder && dragBorder.Index>=0)
|
|
@@ -8627,7 +8784,7 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8627
8784
|
}
|
|
8628
8785
|
}
|
|
8629
8786
|
|
|
8630
|
-
if (this.EnableYDrag && this.Frame && !
|
|
8787
|
+
if (this.EnableYDrag && this.Frame && !this.CurrentChartDrawPicture)
|
|
8631
8788
|
{
|
|
8632
8789
|
var dragY=this.TryYDrag(x,y);
|
|
8633
8790
|
if (dragY)
|
|
@@ -8637,19 +8794,22 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8637
8794
|
}
|
|
8638
8795
|
}
|
|
8639
8796
|
|
|
8640
|
-
|
|
8641
|
-
if (button)
|
|
8797
|
+
if (!this.CurrentChartDrawPicture)
|
|
8642
8798
|
{
|
|
8643
|
-
|
|
8644
|
-
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ", button);
|
|
8645
|
-
}
|
|
8646
|
-
else
|
|
8647
|
-
{
|
|
8648
|
-
button=this.PtInExtendChartButtons(x,y);
|
|
8799
|
+
var button=this.Frame.PtInButtons(x,y);
|
|
8649
8800
|
if (button)
|
|
8650
8801
|
{
|
|
8651
|
-
mouseStatus={ Cursor:"pointer", Name:"
|
|
8652
|
-
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove]
|
|
8802
|
+
mouseStatus={ Cursor:"pointer", Name:"FrameButton"};
|
|
8803
|
+
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ", button);
|
|
8804
|
+
}
|
|
8805
|
+
else
|
|
8806
|
+
{
|
|
8807
|
+
button=this.PtInExtendChartButtons(x,y);
|
|
8808
|
+
if (button)
|
|
8809
|
+
{
|
|
8810
|
+
mouseStatus={ Cursor:"pointer", Name:"ExtendChartButton"};
|
|
8811
|
+
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] extend chart button ", button);
|
|
8812
|
+
}
|
|
8653
8813
|
}
|
|
8654
8814
|
}
|
|
8655
8815
|
|
|
@@ -8669,7 +8829,7 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8669
8829
|
JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");
|
|
8670
8830
|
}
|
|
8671
8831
|
|
|
8672
|
-
if (this.SelectedChart.EnableMoveOn && this.PtInChart)
|
|
8832
|
+
if (this.SelectedChart.EnableMoveOn && this.PtInChart && !this.CurrentChartDrawPicture)
|
|
8673
8833
|
{
|
|
8674
8834
|
var chartInfo=this.PtInChart(x,y);
|
|
8675
8835
|
if (chartInfo && chartInfo.Identify)
|
|
@@ -8692,6 +8852,7 @@ function JSChartContainer(uielement, OffscreenElement)
|
|
|
8692
8852
|
var bDrawPicture=false; //是否正在画图
|
|
8693
8853
|
if (this.CurrentChartDrawPicture)
|
|
8694
8854
|
{
|
|
8855
|
+
if (this.CurrentChartDrawPicture.Status!=20) mouseStatus={ Cursor:"crosshair", Name:"CurrentChartDrawPicture"};
|
|
8695
8856
|
if (this.CurrentChartDrawPicture.SetLastPoint) this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});
|
|
8696
8857
|
bDrawPicture=true;
|
|
8697
8858
|
}
|
|
@@ -23065,9 +23226,17 @@ function ChartKLine()
|
|
|
23065
23226
|
var textSize=fontSize*pixelRatio;
|
|
23066
23227
|
this.Canvas.beginPath();
|
|
23067
23228
|
this.Canvas.font=fontSize*pixelRatio+'px '+this.TickFontName;
|
|
23229
|
+
|
|
23230
|
+
this.ShowRange.Start=this.Data.DataOffset;
|
|
23231
|
+
this.ShowRange.End=this.ShowRange.Start;
|
|
23232
|
+
this.ShowRange.DataCount=0;
|
|
23233
|
+
this.ShowRange.ShowCount=xPointCount;
|
|
23234
|
+
this.DrawKRange.Start=this.Data.DataOffset;
|
|
23235
|
+
|
|
23068
23236
|
for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length && j<xPointCount;++i,++j,xOffset+=(dataWidth+distanceWidth))
|
|
23069
23237
|
{
|
|
23070
23238
|
var data=this.Data.Data[i];
|
|
23239
|
+
this.ShowRange.End=i;
|
|
23071
23240
|
if (data.Open==null || data.High==null || data.Low==null || data.Close==null) continue;
|
|
23072
23241
|
|
|
23073
23242
|
var left=xOffset;
|
|
@@ -23075,6 +23244,7 @@ function ChartKLine()
|
|
|
23075
23244
|
if (right>chartright) break;
|
|
23076
23245
|
var x=left+(right-left)/2;
|
|
23077
23246
|
var yClose=this.ChartFrame.GetYFromData(data.Close,false);
|
|
23247
|
+
this.DrawKRange.End=i;
|
|
23078
23248
|
|
|
23079
23249
|
if (data.Flag===0) this.Canvas.fillStyle=this.UpColor;
|
|
23080
23250
|
else if (data.Flag==1) this.Canvas.fillStyle=this.DownColor;
|
|
@@ -23166,6 +23336,11 @@ function ChartKLine()
|
|
|
23166
23336
|
this.ClipClient(this.ChartFrame.IsHScreen);
|
|
23167
23337
|
this.DrawCloseLine();
|
|
23168
23338
|
}
|
|
23339
|
+
else if (this.DrawType==4)
|
|
23340
|
+
{
|
|
23341
|
+
this.ClipClient(this.ChartFrame.IsHScreen);
|
|
23342
|
+
this.DrawCloseArea();
|
|
23343
|
+
}
|
|
23169
23344
|
else
|
|
23170
23345
|
{
|
|
23171
23346
|
this.ClipTickClient(this.ChartFrame.IsHScreen);
|
|
@@ -41015,18 +41190,24 @@ function ChartCorssCursor()
|
|
|
41015
41190
|
}
|
|
41016
41191
|
|
|
41017
41192
|
//X轴
|
|
41018
|
-
if (this.ShowTextMode.Bottom==1 && this.StringFormatX.Operator())
|
|
41193
|
+
if ((this.ShowTextMode.Bottom==1 || this.ShowTextMode.Bottom==2) && this.StringFormatX.Operator())
|
|
41019
41194
|
{
|
|
41020
41195
|
var text=this.StringFormatX.Text;
|
|
41021
41196
|
this.Canvas.font=this.Font;
|
|
41022
|
-
|
|
41023
41197
|
this.Canvas.fillStyle=this.TextBGColor;
|
|
41024
41198
|
var textWidth=this.Canvas.measureText(text).width+4; //前后各空2个像素
|
|
41199
|
+
|
|
41025
41200
|
var yCenter=bottom+2+this.TextHeight/2;
|
|
41201
|
+
var yTop=bottom+2;
|
|
41202
|
+
if (this.ShowTextMode.Bottom==2)
|
|
41203
|
+
{
|
|
41204
|
+
yCenter=bottom-this.TextHeight/2-2;
|
|
41205
|
+
yTop=bottom-this.TextHeight-2;
|
|
41206
|
+
}
|
|
41026
41207
|
//JSConsole.Chart.Log('[ChartCorssCursor::Draw] ',yCenter);
|
|
41027
41208
|
if (x-textWidth/2<3) //左边位置不够了, 顶着左边画
|
|
41028
41209
|
{
|
|
41029
|
-
this.DrawTextBGRect(x-1,
|
|
41210
|
+
this.DrawTextBGRect(x-1,yTop,textWidth,this.TextHeight);
|
|
41030
41211
|
this.Canvas.textAlign="left";
|
|
41031
41212
|
this.Canvas.textBaseline="middle";
|
|
41032
41213
|
this.Canvas.fillStyle=this.TextColor;
|
|
@@ -41034,7 +41215,7 @@ function ChartCorssCursor()
|
|
|
41034
41215
|
}
|
|
41035
41216
|
else if (x+textWidth/2>=right)
|
|
41036
41217
|
{
|
|
41037
|
-
this.DrawTextBGRect(right-textWidth,
|
|
41218
|
+
this.DrawTextBGRect(right-textWidth,yTop,textWidth,this.TextHeight);
|
|
41038
41219
|
this.Canvas.textAlign="right";
|
|
41039
41220
|
this.Canvas.textBaseline="middle";
|
|
41040
41221
|
this.Canvas.fillStyle=this.TextColor;
|
|
@@ -41042,7 +41223,7 @@ function ChartCorssCursor()
|
|
|
41042
41223
|
}
|
|
41043
41224
|
else
|
|
41044
41225
|
{
|
|
41045
|
-
this.DrawTextBGRect(x-textWidth/2,
|
|
41226
|
+
this.DrawTextBGRect(x-textWidth/2,yTop,textWidth,this.TextHeight);
|
|
41046
41227
|
this.Canvas.textAlign="center";
|
|
41047
41228
|
this.Canvas.textBaseline="middle";
|
|
41048
41229
|
this.Canvas.fillStyle=this.TextColor;
|
|
@@ -45449,7 +45630,10 @@ IChartDrawPicture.ArrayDrawPricture=
|
|
|
45449
45630
|
//涂鸦 不绑定K线坐标
|
|
45450
45631
|
{ Name:"涂鸦线段", ClassName:'ChartDrawGraffitiLine', Create:function() { return new ChartDrawGraffitiLine(); } },
|
|
45451
45632
|
|
|
45452
|
-
{ Name:"固定范围成交量分布图", ClassName:"ChartDrawVolProfile", Create:function() { return new ChartDrawVolProfile(); }}
|
|
45633
|
+
{ Name:"固定范围成交量分布图", ClassName:"ChartDrawVolProfile", Create:function() { return new ChartDrawVolProfile(); }},
|
|
45634
|
+
|
|
45635
|
+
{ Name:"DisjointChannel", ClassName:"ChartDrawDisjontChannel", Create:function() { return new ChartDrawDisjontChannel();}},
|
|
45636
|
+
{ Name:"FlatTop", ClassName:"ChartDrawDisjontChannel", Create:function() { return new ChartDrawFlatTop();}},
|
|
45453
45637
|
|
|
45454
45638
|
];
|
|
45455
45639
|
|
|
@@ -46757,6 +46941,106 @@ function ChartDrawPictureParallelLines()
|
|
|
46757
46941
|
}
|
|
46758
46942
|
}
|
|
46759
46943
|
|
|
46944
|
+
|
|
46945
|
+
//FlatTop/Bottom
|
|
46946
|
+
function ChartDrawFlatTop()
|
|
46947
|
+
{
|
|
46948
|
+
this.newMethod=IChartDrawPicture; //派生
|
|
46949
|
+
this.newMethod();
|
|
46950
|
+
delete this.newMethod;
|
|
46951
|
+
|
|
46952
|
+
this.ClassName='ChartDrawFlatTop';
|
|
46953
|
+
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
46954
|
+
this.PointCount=3;
|
|
46955
|
+
this.LastPoint;
|
|
46956
|
+
|
|
46957
|
+
this.Draw=function()
|
|
46958
|
+
{
|
|
46959
|
+
this.LinePoint=[];
|
|
46960
|
+
if (this.IsFrameMinSize()) return;
|
|
46961
|
+
|
|
46962
|
+
var drawPoint=this.CalculateDrawPoint({IsCheckX:true, IsCheckY:true});
|
|
46963
|
+
if (!drawPoint) return;
|
|
46964
|
+
|
|
46965
|
+
this.AreaColor=IChartDrawPicture.ColorToRGBA(this.LineColor,0.3);
|
|
46966
|
+
var points=drawPoint.slice(0);
|
|
46967
|
+
this.CalculateLines(points);
|
|
46968
|
+
|
|
46969
|
+
this.ClipFrame();
|
|
46970
|
+
|
|
46971
|
+
for(var i=0;i<this.LinePoint.length; ++i)
|
|
46972
|
+
{
|
|
46973
|
+
var item=this.LinePoint[i];
|
|
46974
|
+
this.DrawLine(item.Start,item.End);
|
|
46975
|
+
}
|
|
46976
|
+
|
|
46977
|
+
this.DrawArea();
|
|
46978
|
+
this.DrawPoint(points); //画点
|
|
46979
|
+
this.Canvas.restore();
|
|
46980
|
+
}
|
|
46981
|
+
|
|
46982
|
+
this.SetLastPoint=function(obj)
|
|
46983
|
+
{
|
|
46984
|
+
this.LastPoint={X:obj.X,Y:obj.Y};
|
|
46985
|
+
}
|
|
46986
|
+
|
|
46987
|
+
this.DrawArea=function()
|
|
46988
|
+
{
|
|
46989
|
+
if (this.LinePoint.length!=2) return;
|
|
46990
|
+
|
|
46991
|
+
this.Canvas.fillStyle=this.AreaColor;
|
|
46992
|
+
this.Canvas.beginPath();
|
|
46993
|
+
this.Canvas.moveTo(this.LinePoint[0].Start.X,this.LinePoint[0].Start.Y);
|
|
46994
|
+
this.Canvas.lineTo(this.LinePoint[0].End.X,this.LinePoint[0].End.Y);
|
|
46995
|
+
this.Canvas.lineTo(this.LinePoint[1].End.X,this.LinePoint[1].End.Y);
|
|
46996
|
+
this.Canvas.lineTo(this.LinePoint[1].Start.X,this.LinePoint[1].Start.Y);
|
|
46997
|
+
this.Canvas.closePath();
|
|
46998
|
+
this.Canvas.fill();
|
|
46999
|
+
|
|
47000
|
+
}
|
|
47001
|
+
|
|
47002
|
+
this.CalculateLines=function(points)
|
|
47003
|
+
{
|
|
47004
|
+
if (this.PointStatus==2 && this.LastPoint)
|
|
47005
|
+
{
|
|
47006
|
+
var ptSecond=points[1];
|
|
47007
|
+
var pt=new Point();
|
|
47008
|
+
pt.X=ptSecond.X;
|
|
47009
|
+
pt.Y=this.LastPoint.Y;
|
|
47010
|
+
points[2]=pt;
|
|
47011
|
+
}
|
|
47012
|
+
|
|
47013
|
+
if (points.length==2)
|
|
47014
|
+
{
|
|
47015
|
+
this.LinePoint.push({ Start:points[0], End:points[1]});
|
|
47016
|
+
}
|
|
47017
|
+
else if (points.length==3)
|
|
47018
|
+
{
|
|
47019
|
+
this.LinePoint.push({ Start:points[0], End:points[1]});
|
|
47020
|
+
|
|
47021
|
+
//计算水平线
|
|
47022
|
+
var ptThrid=points[2];
|
|
47023
|
+
ptThrid.X=points[1].X;
|
|
47024
|
+
var ptStart={ X:points[0].X, Y:ptThrid.Y };
|
|
47025
|
+
var ptEnd={ X:points[1].X, Y:ptThrid.Y };
|
|
47026
|
+
this.LinePoint.push({ Start:ptStart, End:ptEnd});
|
|
47027
|
+
}
|
|
47028
|
+
}
|
|
47029
|
+
}
|
|
47030
|
+
|
|
47031
|
+
//Disjont Channel
|
|
47032
|
+
function ChartDrawDisjontChannel()
|
|
47033
|
+
{
|
|
47034
|
+
this.newMethod=ChartDrawFlatTop; //派生
|
|
47035
|
+
this.newMethod();
|
|
47036
|
+
delete this.newMethod;
|
|
47037
|
+
|
|
47038
|
+
this.ClassName='ChartDrawDisjontChannel';
|
|
47039
|
+
this.IsPointIn=this.IsPointIn_XYValue_Line;
|
|
47040
|
+
this.PointCount=3;
|
|
47041
|
+
this.LastPoint;
|
|
47042
|
+
}
|
|
47043
|
+
|
|
46760
47044
|
//平行射线
|
|
46761
47045
|
function ChartDrawParallelRaysLines()
|
|
46762
47046
|
{
|