hqchart 1.1.12513 → 1.1.12522

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.
@@ -1425,7 +1425,7 @@ this.CreateDepthChartContainer=function(option){var chart=null;chart=new DepthCh
1425
1425
  }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轴刻度个数 半边的
1426
1426
  }return chart;};//根据option内容绘制图形
1427
1427
  this.SetOption=function(option){//toolbar按钮风格
1428
- if(IFrameSplitOperator.IsNumber(option.ToolbarButtonStyle))g_JSChartResource.ToolbarButtonStyle=option.ToolbarButtonStyle;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;this.JSChartContainer=chart;if(option.OnCreatedCallback)option.OnCreatedCallback(chart);//是否自动更新
1428
+ if(IFrameSplitOperator.IsNumber(option.ToolbarButtonStyle))g_JSChartResource.ToolbarButtonStyle=option.ToolbarButtonStyle;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;this.JSChartContainer=chart;if(option.DefaultCursor)chart.DefaultCursor=option.DefaultCursor;if(option.OnCreatedCallback)option.OnCreatedCallback(chart);//是否自动更新
1429
1429
  if(option.IsAutoUpdate!=null)chart.IsAutoUpdate=option.IsAutoUpdate;if(option.AutoUpdateFrequency>0)chart.AutoUpdateFrequency=option.AutoUpdateFrequency;//注册事件
1430
1430
  if(option.EventCallback){for(var i=0;i<option.EventCallback.length;++i){var item=option.EventCallback[i];chart.AddEventCallback(item);}}//设置股票代码
1431
1431
  if(!option.Symbol){chart.DrawEmpty();this.JSChartContainer=chart;this.DivElement.JSChart=this;//div中保存一份
@@ -1654,6 +1654,7 @@ this.ChartCorssCursor;//十字光标
1654
1654
  this.IsClickShowCorssCursor=false;//手势点击显示十字光标
1655
1655
  this.ChartSplashPaint=null;//等待提示
1656
1656
  this.LoadDataSplashTitle="数据加载中";//下载数据提示信息
1657
+ this.DefaultCursor="default";//crosshair , default 默认手型
1657
1658
  //绘图缓存
1658
1659
  this.CacheCanvas=null;this.CacheElement=null;if(cacheElement){this.CacheElement=cacheElement;this.CacheCanvas=cacheElement.getContext("2d");}if(OffscreenElement){this.Canvas=OffscreenElement.getContext("2d");this.OffscreenCanvasElement=OffscreenElement;this.ShowCanvas=uielement.getContext("2d");}else{if(JSChart.EnableCanvasWillReadFrequently===true){var contextAttr={willReadFrequently:true};this.Canvas=uielement.getContext("2d",contextAttr);//画布
1659
1660
  }else{this.Canvas=uielement.getContext("2d");//画布
@@ -1730,10 +1731,15 @@ var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MOUSE_MOVE);var titleChart=t
1730
1731
  if(titleChart)titleChart.OnMouseMoveEvent=null;this.StartStopDisplayLatest();};this.IsMouseOnClient=function(x,y){var rect={Left:this.Frame.ChartBorder.GetLeft(),Top:this.Frame.ChartBorder.GetTop(),Width:this.Frame.ChartBorder.GetWidth(),Height:this.Frame.ChartBorder.GetHeight()};rect.Right=rect.Left+rect.Width;rect.Bottom=rect.Top+rect.Height;if(x>=rect.Left&&x<=rect.Right&&y>=rect.Top&&y<=rect.Bottom)return true;return false;};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);//右键菜单事件
1731
1732
  return false;};this.UIOnDblClick=function(e){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;this.OnDoubleClick(x,y,e);};//是否在拖拽Y轴上
1732
1733
  this.TryYDrag=function(x,y){if(!this.EnableYDrag)return null;if(!this.EnableYDrag.Left&&!this.EnableYDrag.Right)return null;if(!this.Frame||!this.Frame.PtInFrameY)return null;var dragY=this.Frame.PtInFrameY(x,y);if(!dragY||dragY.Index<0||dragY.IsOverlay==true)return null;if(dragY.Left&&this.EnableYDrag.Left&&this.Frame.IsEnableDragY(dragY.Index)){return dragY;}if(dragY.Right&&this.EnableYDrag.Right&&this.Frame.IsEnableDragY(dragY.Index)){return dragY;}return null;};//是否可以上下拖拽
1733
- this.TryUpDownDrag=function(x,y){var windowIndex=this.Frame.PtInFrame(x,y);if(windowIndex<0)return null;var item=this.Frame.SubFrame[windowIndex];if(!item||!item.Frame)return null;var frame=item.Frame;if(!frame.YSplitOperator||!frame.YSplitOperator.FixedYMaxMin)return null;return{Index:windowIndex,X:x,Y:y};};this.TryRectSelectDrag=function(x,y){var paint=this.GetRectSelectPaint();if(!paint)return null;if(paint.GetPointCount()<=0)return null;var item=paint.PtInPaint(x,y);return{Item:item,X:x,Y:y};};this.TryClickCrossCursor=function(x,y,e){if(!this.ChartCorssCursor)return;var button=this.ChartCorssCursor.PtInButton(x,y);if(!button)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_CROSSCURSOR_RIGHT);if(event&&event.Callback){var sendData={Button:button,e:e};event.Callback(event,sendData,this);}return true;};this.TryClickButton=function(x,y,e){var button=this.Frame.PtInButtons(x,y);if(button&&this.ClickFrameButton){this.ClickFrameButton(button,e);return true;}button=this.PtInExtendChartButtons(x,y);if(button&&this.ClickExtendChartButton){this.ClickExtendChartButton(button,e);return true;}button=this.PtInDrawPictureButtons(x,y);if(button&&this.ClickDrawPictureButton){this.ClickDrawPictureButton(button,e);return true;}button=this.PtInTitleButtons(x,y);if(button&&this.ClickTitleButton){this.ClickTitleButton(button,e);return true;}return false;};this.TryMouseMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);if(!event||!event.Callback)return false;return event.Callback(event,sendData,this);};this.TryClick_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_DOWN);if(!event||!event.Callback)return false;sendData.ChartDrag=null;sendData.Cusrsor=null;event.Callback(event,sendData,this);this.CustomChartDrag=sendData.ChartDrag;if(sendData.Cusrsor)this.UIElement.style.cursor=sendData.Cusrsor;};this.TryDragMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_MOVE);if(!event||!event.Callback)return;var e=sendData.e;var drag=sendData.Drag;if(Math.abs(drag.LastMove.Y-e.clientY)<2&&Math.abs(drag.LastMove.X-e.clientX)<2)return;if(event.Callback(event,sendData,this)){drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.TryMouseUp_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_UP);if(!event||!event.Callback)return;event.Callback(event,sendData,this);};this.UIOnMouseDown=function(e){var _this7=this;this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.ClickDownPoint={X:e.clientX,Y:e.clientY};this.IsOnTouch=true;this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.TryClickButton(x,y,e)){return;}if(this.TryClickCrossCursor(x,y,e)){return;}if(this.TryClickChartTooltipData&&this.TryClickChartTooltipData(x,y,e))//预留给外部点击图标什么用的
1734
+ this.TryUpDownDrag=function(x,y){var windowIndex=this.Frame.PtInFrame(x,y);if(windowIndex<0)return null;var item=this.Frame.SubFrame[windowIndex];if(!item||!item.Frame)return null;var frame=item.Frame;if(!frame.YSplitOperator||!frame.YSplitOperator.FixedYMaxMin)return null;return{Index:windowIndex,X:x,Y:y};};this.TryRectSelectDrag=function(x,y){var paint=this.GetRectSelectPaint();if(!paint)return null;if(paint.GetPointCount()<=0)return null;var item=paint.PtInPaint(x,y);return{Item:item,X:x,Y:y};};this.TryClickCrossCursor=function(x,y,e){if(!this.ChartCorssCursor)return;var button=this.ChartCorssCursor.PtInButton(x,y);if(!button)return false;var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CLICK_CROSSCURSOR_RIGHT);if(event&&event.Callback){var sendData={Button:button,e:e};event.Callback(event,sendData,this);}return true;};this.TryClickButton=function(x,y,e){var button=this.Frame.PtInButtons(x,y);if(button&&this.ClickFrameButton){this.ClickFrameButton(button,e);return true;}button=this.PtInExtendChartButtons(x,y);if(button&&this.ClickExtendChartButton){this.ClickExtendChartButton(button,e);return true;}button=this.PtInDrawPictureButtons(x,y);if(button&&this.ClickDrawPictureButton){this.ClickDrawPictureButton(button,e);return true;}button=this.PtInTitleButtons(x,y);if(button&&this.ClickTitleButton){this.ClickTitleButton(button,e);return true;}return false;};this.TryMouseMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_MOVE);if(!event||!event.Callback)return false;return event.Callback(event,sendData,this);};this.TryClick_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_MOUSE_DOWN);if(!event||!event.Callback)return false;sendData.ChartDrag=null;sendData.Cusrsor=null;event.Callback(event,sendData,this);this.CustomChartDrag=sendData.ChartDrag;this.SetCursor(sendData);};this.TryDragMove_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_MOVE);if(!event||!event.Callback)return;var e=sendData.e;var drag=sendData.Drag;if(Math.abs(drag.LastMove.Y-e.clientY)<2&&Math.abs(drag.LastMove.X-e.clientX)<2)return;if(event.Callback(event,sendData,this)){drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.TryMouseUp_CustomChartDrag=function(sendData){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_CUSTOM_DRAG_DOC_MOUSE_UP);if(!event||!event.Callback)return;event.Callback(event,sendData,this);};this.UIOnMouseDown=function(e){var _this7=this;this.MoveOnChartDrawPicture=null;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;this.ClickDownPoint={X:e.clientX,Y:e.clientY};this.IsOnTouch=true;this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;if(this.TryClickButton(x,y,e)){return;}if(this.TryClickCrossCursor(x,y,e)){return;}if(this.TryClickChartTooltipData&&this.TryClickChartTooltipData(x,y,e))//预留给外部点击图标什么用的
1734
1735
  {return;}if(this.TryClickLock){//JSConsole.Chart.Log('[uielement.onmousedown] left, top ',e.clientX, e.clientY, this.getBoundingClientRect().left,this.getBoundingClientRect().top);
1735
- if(this.TryClickLock(x,y))return;}this.HideSelectRect();if(this.SelectRectRightMenu)this.SelectRectRightMenu.Hide();if(this.ChartPictureMenu)this.ChartPictureMenu.Hide();var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){if(item.Type==4){this.UIElement.style.cursor="pointer";var obj={X:e.clientX};if(this.GetXDataIndex(obj)){this.RectSelectDrag={DataIndex:obj.DataIndex,Type:item.Type,X:e.clientX};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag sub rect select ",obj);}}else{this.UIElement.style.cursor="ew-resize";this.RectSelectDrag={Index:item.PointIndex,Type:item.Type};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag rect select ",item);}}}if(!this.RectSelectDrag&&this.ClearRectSelect(false))this.Draw();if(this.EnableBorderDrag&&this.Frame){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){this.UIElement.style.cursor="n-resize";this.BorderDrag={Index:dragBorder.Index};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] DragBorder ",dragBorder);}}//拖拽Y轴缩放
1736
- if(!this.BorderDrag){var dragY=this.TryYDrag(x,y);if(dragY){this.UIElement.style.cursor=dragY.Position==0?"n-resize":"row-resize";this.YDrag=dragY;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragY ",dragY);}else{var dragUpDown=this.TryUpDownDrag(x,y);if(dragUpDown){this.UIElement.style.cursor="pointer";this.UpDownDrag=dragUpDown;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragUpDown ",dragUpDown);}}}var sendData={X:x,Y:y,e:e};if(this.TryClick_CustomChartDrag(sendData)){}if(this.DragMode==0)return;var drag={"Click":{},"LastMove":{},//最后移动的位置
1736
+ if(this.TryClickLock(x,y))return;}this.HideSelectRect();if(this.SelectRectRightMenu)this.SelectRectRightMenu.Hide();if(this.ChartPictureMenu)this.ChartPictureMenu.Hide();var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){if(item.Type==4){//this.UIElement.style.cursor="pointer";
1737
+ this.SetCursor({Cursor:"pointer"});var obj={X:e.clientX};if(this.GetXDataIndex(obj)){this.RectSelectDrag={DataIndex:obj.DataIndex,Type:item.Type,X:e.clientX};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag sub rect select ",obj);}}else{//this.UIElement.style.cursor="ew-resize";
1738
+ this.SetCursor({Cursor:"ew-resize"});this.RectSelectDrag={Index:item.PointIndex,Type:item.Type};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag rect select ",item);}}}if(!this.RectSelectDrag&&this.ClearRectSelect(false))this.Draw();if(this.EnableBorderDrag&&this.Frame){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){//this.UIElement.style.cursor="n-resize";
1739
+ this.SetCursor({Cursor:"n-resize"});this.BorderDrag={Index:dragBorder.Index};JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] DragBorder ",dragBorder);}}//拖拽Y轴缩放
1740
+ if(!this.BorderDrag){var dragY=this.TryYDrag(x,y);if(dragY){//this.UIElement.style.cursor=dragY.Position==0 ? "n-resize":"row-resize";
1741
+ var cursor=dragY.Position==0?"n-resize":"row-resize";this.SetCursor({Cursor:cursor});this.YDrag=dragY;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragY ",dragY);}else{var dragUpDown=this.TryUpDownDrag(x,y);if(dragUpDown){//this.UIElement.style.cursor="pointer";
1742
+ this.SetCursor({Cursor:"pointer"});this.UpDownDrag=dragUpDown;JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragUpDown ",dragUpDown);}}}var sendData={X:x,Y:y,e:e};if(this.TryClick_CustomChartDrag(sendData)){}if(this.DragMode==0)return;var drag={"Click":{},"LastMove":{},//最后移动的位置
1737
1743
  CurrentMove:{}//当前的移动
1738
1744
  };drag.Click.X=e.clientX;drag.Click.Y=e.clientY;drag.Click.IsInFrameBottom=this.Frame.PtInFrameBottom(x,y);//是否点击在X轴上
1739
1745
  drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;this.MouseDrag=drag;var drawPictureActive=this.GetActiveDrawPicture();//上一次选中的
@@ -1753,11 +1759,16 @@ if(this.ChartSplashPaint&&this.IsEnableSplash==true)return;var drag=this.MouseDr
1753
1759
  JSConsole.Chart.Log("[JSChartContainer::DocOnMouseMove] YDrag ",this.YDrag,yMove);this.OnZoomUpDownFrameY(this.YDrag,yMove);drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}else if(this.IndexChartDrag&&this.IndexChartDrag.SelectedChart){if(Math.abs(drag.LastMove.Y-e.clientY)<2&&Math.abs(drag.LastMove.X-e.clientX)<2)return;var chartMove=this.GetExtendChartByClassName("DragMovePaint");if(chartMove&&chartMove.Chart){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;chartMove.Chart.Point={X:x,Y:y};chartMove.Chart.IsShow=true;chartMove.Chart.Info=this.IndexChartDrag.Info;this.DrawDynamicInfo();}this.IndexChartDrag.LastMove.X=x;this.IndexChartDrag.LastMove.Y=y;drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}else if(this.CustomChartDrag){var pixelTatio=GetDevicePixelRatio();var x=(e.clientX-this.UIElement.getBoundingClientRect().left)*pixelTatio;var y=(e.clientY-this.UIElement.getBoundingClientRect().top)*pixelTatio;var sendData={X:x,Y:y,e:e,ChartDrag:this.CustomChartDrag,Drag:drag};this.TryDragMove_CustomChartDrag(sendData);}else if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==1||drawPicture.Status==2){if(Math.abs(drag.LastMove.X-e.clientX)<5&&Math.abs(drag.LastMove.Y-e.clientY)<5)return;if(this.SetChartDrawPictureSecondPoint(e.clientX,e.clientY)){this.DrawDynamicInfo();}}else if(drawPicture.Status==3){if(this.SetChartDrawPictureThirdPoint(e.clientX,e.clientY)){this.DrawDynamicInfo();}}else if(drawPicture.Status==20)//画图工具移动
1754
1760
  {if(Math.abs(drag.LastMove.X-e.clientX)<5&&Math.abs(drag.LastMove.Y-e.clientY)<1)return;if(this.SelectChartDrawPicture){if(this.SelectChartDrawPicture.EnableCtrlMove){if(!e.ctrlKey)return;}}if(this.SelectChartDrawPicture&&this.SelectChartDrawPicture.DragInfo)this.SelectChartDrawPicture.DragInfo.Move={X:e.clientX,Y:e.client};if(this.MoveChartDrawPicture(e.clientX-drag.LastMove.X,e.clientY-drag.LastMove.Y,false,drag)){this.DrawDynamicInfo();}}drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}else if(this.DragMode==1||isDragSelectRect||isDragSubSelectRect)//数据上下左右拖拽
1755
1761
  {this.OnDragMode_One({X:moveSetp,Y:moveSetpY},e);}else if(this.DragMode==2)//区间选择
1756
- {var yMoveSetp=Math.abs(drag.LastMove.Y-e.clientY);if(moveSetp<5&&yMoveSetp<5)return;this.UIElement.style.cursor="default";var x=drag.Click.X-uielement.getBoundingClientRect().left;var y=drag.Click.Y-uielement.getBoundingClientRect().top;var x2=e.clientX-uielement.getBoundingClientRect().left;var y2=e.clientY-uielement.getBoundingClientRect().top;this.ShowSelectRect(x,y,x2,y2);drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.OnDragMode_One=function(moveData,e){var moveSetp=moveData.X;var moveSetpY=moveData.Y;var drag=this.MouseDrag;if(moveSetp<5&&moveSetpY<5)return;var bNeedDraw=false;var bUpDownY=false;if(moveSetpY>=5){if(this.UpDownDrag&&this.UpDownDrag.Index>=0){var yMove=e.clientY-drag.LastMove.Y;JSConsole.Chart.Log("[JSChartContainer::OnDragMode_One] UpDownDrag ",this.UpDownDrag,yMove);this.UIElement.style.cursor="pointer";if(this.OnUpDonwFrameY(this.UpDownDrag,yMove)){bNeedDraw=true;bUpDownY=true;}drag.LastMove.Y=e.clientY;}}if(moveSetp>=5){if(this.RectSelectDrag){if(this.RectSelectDrag.Index>=0){var obj={X:e.clientX,Y:e.clientY,PointIndex:this.RectSelectDrag.Index,Name:"MoveRectSelectLine"};if(this.MoveRectSelectPoint(obj))bNeedDraw=true;}else if(this.RectSelectDrag.Type===4){var obj={X:e.clientX};if(!this.GetXDataIndex(obj))return;if(obj.DataIndex==this.RectSelectDrag.DataIndex)return;var step=obj.DataIndex-this.RectSelectDrag.DataIndex;var isLeft=true;if(step>0)isLeft=false;if(!this.MoveSubRectSelect({Step:Math.abs(step),IsLeft:isLeft,X:e.clientX,Y:e.clientY}))return;this.RectSelectDrag.DataIndex=obj.DataIndex;this.RectSelectDrag.X=e.clientX;bNeedDraw=true;}}else{var isLeft=true;if(drag.LastMove.X<e.clientX)isLeft=false;//右移数据
1757
- var cursorStatus="pointer";if(drag.Click.IsInFrameBottom)cursorStatus="ew-resize";var oneStepWidth=this.GetMoveOneStepWidth();if(moveSetp<oneStepWidth){this.UIElement.style.cursor=cursorStatus;if(bNeedDraw)this.Draw();return;}else{if(drag.Click&&drag.Click.IsInFrameBottom){if(this.XCoordinateZoom(moveSetp,isLeft)){this.UpdataDataoffset();this.UpdateFrameMaxMin();this.ResetFrameXYSplit();bNeedDraw=true;}}else if(this.DataMove(moveSetp,isLeft)){this.UpdataDataoffset();//this.UpdatePointByCursorIndex(); //推拽数据的时候不需要把鼠标位置更新到K线上
1758
- this.UpdateFrameMaxMin();this.ResetFrameXYSplit();bNeedDraw=true;}else if(!bUpDownY){if(this.DragDownloadData)this.DragDownloadData();}}this.UIElement.style.cursor=cursorStatus;}drag.LastMove.X=e.clientX;}if(bNeedDraw){this.Draw();this.OnKLinePageChange("datamove");}};this.GetXDataIndex=function(obj){if(!this.ChartPaint[0]||!this.ChartPaint[0].Data)return false;var kData=this.ChartPaint[0].Data;if(!this.Frame.SubFrame[0])return false;var subFrame=this.Frame.SubFrame[0].Frame;if(!subFrame)false;var pixelTatio=GetDevicePixelRatio();var x=(obj.X-uielement.getBoundingClientRect().left)*pixelTatio;var index=subFrame.GetXData(x);index=parseInt(index.toFixed(0));var dataIndex=index+kData.DataOffset;if(dataIndex>=kData.Data.length)dataIndex=kData.Data.length-1;var item=kData.Data[dataIndex];obj.DataIndex=dataIndex;obj.Item=item;//JSConsole.Chart.Log("[JSChartContainer::GetXDataIndex] point, item", obj.PointIndex, item);
1762
+ {var yMoveSetp=Math.abs(drag.LastMove.Y-e.clientY);if(moveSetp<5&&yMoveSetp<5)return;//this.UIElement.style.cursor="default";
1763
+ this.SetCursor({Cursor:"default"});var x=drag.Click.X-uielement.getBoundingClientRect().left;var y=drag.Click.Y-uielement.getBoundingClientRect().top;var x2=e.clientX-uielement.getBoundingClientRect().left;var y2=e.clientY-uielement.getBoundingClientRect().top;this.ShowSelectRect(x,y,x2,y2);drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.OnDragMode_One=function(moveData,e){var moveSetp=moveData.X;var moveSetpY=moveData.Y;var drag=this.MouseDrag;if(moveSetp<5&&moveSetpY<5)return;var bNeedDraw=false;var bUpDownY=false;if(moveSetpY>=5){if(this.UpDownDrag&&this.UpDownDrag.Index>=0){var yMove=e.clientY-drag.LastMove.Y;JSConsole.Chart.Log("[JSChartContainer::OnDragMode_One] UpDownDrag ",this.UpDownDrag,yMove);//this.UIElement.style.cursor="pointer";
1764
+ this.SetCursor({Cursor:"pointer"});if(this.OnUpDonwFrameY(this.UpDownDrag,yMove)){bNeedDraw=true;bUpDownY=true;}drag.LastMove.Y=e.clientY;}}if(moveSetp>=5){if(this.RectSelectDrag){if(this.RectSelectDrag.Index>=0){var obj={X:e.clientX,Y:e.clientY,PointIndex:this.RectSelectDrag.Index,Name:"MoveRectSelectLine"};if(this.MoveRectSelectPoint(obj))bNeedDraw=true;}else if(this.RectSelectDrag.Type===4){var obj={X:e.clientX};if(!this.GetXDataIndex(obj))return;if(obj.DataIndex==this.RectSelectDrag.DataIndex)return;var step=obj.DataIndex-this.RectSelectDrag.DataIndex;var isLeft=true;if(step>0)isLeft=false;if(!this.MoveSubRectSelect({Step:Math.abs(step),IsLeft:isLeft,X:e.clientX,Y:e.clientY}))return;this.RectSelectDrag.DataIndex=obj.DataIndex;this.RectSelectDrag.X=e.clientX;bNeedDraw=true;}}else{var isLeft=true;if(drag.LastMove.X<e.clientX)isLeft=false;//右移数据
1765
+ var cursorStatus="pointer";if(drag.Click.IsInFrameBottom)cursorStatus="ew-resize";var oneStepWidth=this.GetMoveOneStepWidth();if(moveSetp<oneStepWidth){//this.UIElement.style.cursor=cursorStatus;
1766
+ this.SetCursor({Cursor:cursorStatus});if(bNeedDraw)this.Draw();return;}else{if(drag.Click&&drag.Click.IsInFrameBottom){if(this.XCoordinateZoom(moveSetp,isLeft)){this.UpdataDataoffset();this.UpdateFrameMaxMin();this.ResetFrameXYSplit();bNeedDraw=true;}}else if(this.DataMove(moveSetp,isLeft)){this.UpdataDataoffset();//this.UpdatePointByCursorIndex(); //推拽数据的时候不需要把鼠标位置更新到K线上
1767
+ this.UpdateFrameMaxMin();this.ResetFrameXYSplit();bNeedDraw=true;}else if(!bUpDownY){if(this.DragDownloadData)this.DragDownloadData();}}//this.UIElement.style.cursor=cursorStatus;
1768
+ this.SetCursor({Cursor:cursorStatus});}drag.LastMove.X=e.clientX;}if(bNeedDraw){this.Draw();this.OnKLinePageChange("datamove");}};this.GetXDataIndex=function(obj){if(!this.ChartPaint[0]||!this.ChartPaint[0].Data)return false;var kData=this.ChartPaint[0].Data;if(!this.Frame.SubFrame[0])return false;var subFrame=this.Frame.SubFrame[0].Frame;if(!subFrame)false;var pixelTatio=GetDevicePixelRatio();var x=(obj.X-uielement.getBoundingClientRect().left)*pixelTatio;var index=subFrame.GetXData(x);index=parseInt(index.toFixed(0));var dataIndex=index+kData.DataOffset;if(dataIndex>=kData.Data.length)dataIndex=kData.Data.length-1;var item=kData.Data[dataIndex];obj.DataIndex=dataIndex;obj.Item=item;//JSConsole.Chart.Log("[JSChartContainer::GetXDataIndex] point, item", obj.PointIndex, item);
1759
1769
  return true;};this.DocOnMouseUp=function(e){//清空事件
1760
- document.onmousemove=null;document.onmouseup=null;var IsMinuteChart=this.ClassName=="MinuteChartContainer"||this.ClassName=="MinuteChartHScreenContainer"?true:false;var isDragSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Index>=0;var isDragSubSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Type==4;var bClearDrawPicture=true;if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==2||drawPicture.Status==1||drawPicture.Status==3){drawPicture.PointStatus=drawPicture.Status;if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo();else bClearDrawPicture=false;}else if(drawPicture.Status==20){if(this.FinishMoveChartDrawPicture())this.DrawDynamicInfo();}}else if(this.IndexChartDrag&&this.IndexChartDrag.SelectedChart){var chartMove=this.GetExtendChartByClassName("DragMovePaint");if(chartMove&&chartMove.Chart)chartMove.Chart.Clear();if(!this.OnDragChart(this.IndexChartDrag))this.DrawDynamicInfo();this.UIElement.style.cursor="default";}else if(this.CustomChartDrag){var sendData={e:e,ChartDrag:this.CustomChartDrag,Drag:this.MouseDrag};this.TryMouseUp_CustomChartDrag(sendData);}else if(isDragSelectRect)//区间选择拖动范围
1770
+ document.onmousemove=null;document.onmouseup=null;var IsMinuteChart=this.ClassName=="MinuteChartContainer"||this.ClassName=="MinuteChartHScreenContainer"?true:false;var isDragSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Index>=0;var isDragSubSelectRect=this.RectSelectDrag&&this.RectSelectDrag.Type==4;var bClearDrawPicture=true;if(this.CurrentChartDrawPicture){var drawPicture=this.CurrentChartDrawPicture;if(drawPicture.Status==2||drawPicture.Status==1||drawPicture.Status==3){drawPicture.PointStatus=drawPicture.Status;if(this.FinishChartDrawPicturePoint())this.DrawDynamicInfo();else bClearDrawPicture=false;}else if(drawPicture.Status==20){if(this.FinishMoveChartDrawPicture())this.DrawDynamicInfo();}}else if(this.IndexChartDrag&&this.IndexChartDrag.SelectedChart){var chartMove=this.GetExtendChartByClassName("DragMovePaint");if(chartMove&&chartMove.Chart)chartMove.Chart.Clear();if(!this.OnDragChart(this.IndexChartDrag))this.DrawDynamicInfo();//this.UIElement.style.cursor="default";
1771
+ this.SetCursor({Cursor:"default"});}else if(this.CustomChartDrag){var sendData={e:e,ChartDrag:this.CustomChartDrag,Drag:this.MouseDrag};this.TryMouseUp_CustomChartDrag(sendData);}else if(isDragSelectRect)//区间选择拖动范围
1761
1772
  {if(this.OnDragSelectRectMouseUp)this.OnDragSelectRectMouseUp(e);}else if(isDragSubSelectRect){if(this.OnDragSubSelectRectMouseUp)this.OnDragSubSelectRectMouseUp(e);}else if(IsMinuteChart){if(this.OnMinuteSelectRectMouseUp)this.OnMinuteSelectRectMouseUp(e);}else if(this.DragMode==2)//区间选择
1762
1773
  {var drag=this.MouseDrag;drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;var selectData=new SelectRectData();var pixelTatio=GetDevicePixelRatio();//区间起始位置 结束位子
1763
1774
  selectData.XStart=(drag.Click.X-uielement.getBoundingClientRect().left)*pixelTatio;selectData.YStart=(drag.Click.Y-uielement.getBoundingClientRect().top)*pixelTatio;selectData.XEnd=(drag.LastMove.X-uielement.getBoundingClientRect().left)*pixelTatio;selectData.YEnd=(drag.LastMove.Y-uielement.getBoundingClientRect().top)*pixelTatio;selectData.JSChartContainer=this;selectData.Stock={Symbol:this.Symbol,Name:this.Name};if(!this.BorderDrag&&this.GetSelectRectData(selectData)){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);var paint=this.GetRectSelectPaint();var isShowMenu=true;if(event&&event.Callback){var data=(0,_defineProperty3.default)({X:drag.LastMove.X-uielement.getBoundingClientRect().left,Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,SelectData:selectData,//区间选择的数据
@@ -1766,7 +1777,8 @@ IsShowMenu:true,e:e},'e',e);event.Callback(event,data,this);isShowMenu=data.IsSh
1766
1777
  {this.HideSelectRect();this.UpdateSelectRect(selectData.Start,selectData.End);}else{if(isShowMenu&&this.SelectRectRightMenu){e.data={Chart:this,X:drag.LastMove.X-uielement.getBoundingClientRect().left,Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,SelectData:selectData,//区间选择的数据
1767
1778
  RectSelectPaint:paint//区间选择背景
1768
1779
  };this.SelectRectRightMenu.DoModal(e);}}}else{this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICKUP_CHART_PAINT,this.ClickDownPoint,e);}}else{this.TryClickPaintEvent(JSCHART_EVENT_ID.ON_CLICKUP_CHART_PAINT,this.ClickDownPoint,e);this.ClickEvent(e);}//清空数据
1769
- JSConsole.Chart.Log('[KLineChartContainer::document.onmouseup]',e);if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.DragInfo=null;this.UIElement.style.cursor="default";this.MouseDrag=null;this.ClickDownPoint=null;this.IsOnTouch=false;if(this.BorderDrag&&this.BorderDrag.Index>=0)this.Frame.SaveSubFrameHeightRate();//拖拽指标窗口高度以后保存
1780
+ JSConsole.Chart.Log('[KLineChartContainer::document.onmouseup]',e);if(this.SelectChartDrawPicture)this.SelectChartDrawPicture.DragInfo=null;//this.UIElement.style.cursor="default";
1781
+ this.SetCursor({Cursor:"default"});this.MouseDrag=null;this.ClickDownPoint=null;this.IsOnTouch=false;if(this.BorderDrag&&this.BorderDrag.Index>=0)this.Frame.SaveSubFrameHeightRate();//拖拽指标窗口高度以后保存
1770
1782
  this.BorderDrag=null;this.YDrag=null;this.UpDownDrag=null;this.RectSelectDrag=null;this.IndexChartDrag=null;this.CustomChartDrag=null;if(bClearDrawPicture===true)this.CurrentChartDrawPicture=null;};this.UIOnMounseOut=function(e){JSConsole.Chart.Log('[KLineChartContainer::UIOnMounseOut]',e);this.UIOnMouseMove(e);};this.UIOnMouseleave=function(e){JSConsole.Chart.Log('[KLineChartContainer::UIOnMouseleave]',e);//this.UIOnMouseMove(e);
1771
1783
  };this.OnDragChart=function(drag){if(!drag)return false;var info=drag.Info;var lastMove=drag.LastMove;var startFrameID=info.FrameID;var endFrameID=this.Frame.PtInFrame(lastMove.X,lastMove.Y);if(endFrameID<0){if(endFrameID==-3)//底部 移动到新的窗口
1772
1784
  return this.MoveIndexToNewWindow({WindowIndex:startFrameID,IndexID:info.IndexID},{Operator:0});return false;}if(startFrameID==endFrameID)return false;//移动指标
@@ -1872,8 +1884,14 @@ this.CursorIndex=this.Frame.GetXData(x);if(this.EnableBorderDrag&&this.Frame&&!t
1872
1884
  var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){if(item.Type==4)mouseStatus={Cursor:"pointer",Name:"DragRectSelect"};//子区域选中
1873
1885
  else mouseStatus={Cursor:"ew-resize",Name:"DragRectSelect"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag rect select ",item);}}var sendData={MouseStatus:null,X:x,Y:y,FrameID:frameID,e:e};if(this.TryMouseMove_CustomChartDrag(sendData)){if(sendData.MouseStatus)mouseStatus=sendData.MouseStatus;}var bDrawPicture=false;//是否正在画图
1874
1886
  if(this.CurrentChartDrawPicture){var index=this.Frame.PtInChartFrame(x,y);if(this.CurrentChartDrawPicture.Status!=20){var bDrawValid=false;//是否在有效绘图区域里面
1875
- if(IFrameSplitOperator.IsNumber(this.CurrentChartDrawPicture.LimitFrameID)){if(index>=0&&index==this.CurrentChartDrawPicture.LimitFrameID)bDrawValid=true;}else{if(index>=0)bDrawValid=true;}mouseStatus={Cursor:bDrawValid?"crosshair":"not-allowed",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){if(drawPictrueData.Cursor)this.UIElement.style.cursor=drawPictrueData.Cursor;else this.UIElement.style.cursor="move";}else{if(drawPictrueData.Cursor)this.UIElement.style.cursor=drawPictrueData.Cursor;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;//鼠标移开,在按钮上,不显示十字光标
1876
- if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);if(this.DrawDynamicInfoOption.Enable){this.DrawDynamicInfoOption.Timer=setTimeout(function(){_this9.DrawDynamicInfo(option);},this.DrawDynamicInfoOption.DelayTime);}else{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){var _this10=this;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;//回调事件
1887
+ if(IFrameSplitOperator.IsNumber(this.CurrentChartDrawPicture.LimitFrameID)){if(index>=0&&index==this.CurrentChartDrawPicture.LimitFrameID)bDrawValid=true;}else{if(index>=0)bDrawValid=true;}mouseStatus={Cursor:bDrawValid?"crosshair":"not-allowed",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){if(drawPictrueData.Cursor)this.SetCursor(drawPictrueData);//this.UIElement.style.cursor=drawPictrueData.Cursor;
1888
+ else this.SetCursor({Cursor:"move"});//this.UIElement.style.cursor="move";
1889
+ }else{if(drawPictrueData.Cursor)this.SetCursor(drawPictrueData);//this.UIElement.style.cursor=drawPictrueData.Cursor
1890
+ else this.SetCursor({Cursor:"pointer"});//this.UIElement.style.cursor="pointer";
1891
+ }bDrawPicture=true;this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.SetCursor({Cursor:"default"});//this.UIElement.style.cursor="default";
1892
+ }}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;//鼠标移开,在按钮上,不显示十字光标
1893
+ if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);if(this.DrawDynamicInfoOption.Enable){this.DrawDynamicInfoOption.Timer=setTimeout(function(){_this9.DrawDynamicInfo(option);},this.DrawDynamicInfoOption.DelayTime);}else{this.DrawDynamicInfo(option);}this.SetCursor(mouseStatus);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();}}};//设置鼠标形状 {Cursor:鼠标形状 }
1894
+ this.SetCursor=function(obj){if(!obj||!obj.Cursor)return;if(obj.Cursor=="default")this.UIElement.style.cursor=this.DefaultCursor;else this.UIElement.style.cursor=obj.Cursor;};this.OnKeyDown=function(e){var _this10=this;if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;//回调事件
1877
1895
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_KEYDOWN);if(event&&event.Callback){var sendData={e:e,PreventDefault:false};event.Callback(event,sendData,this);if(sendData.PreventDefault)return;}var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){case 37://left
1878
1896
  if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}if(this.CursorIndex<=0.99999){if(!this.DataMoveLeft()){//左移数据到头了 触发下载新数据
1879
1897
  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
@@ -2085,6 +2103,7 @@ this.YEnd;}//坐标信息
2085
2103
  function CoordinateInfo(){this.Value;//坐标数据
2086
2104
  this.Message=[];//坐标输出文字信息 0=左 1=右 2=内左 3=内右
2087
2105
  this.TextColor=g_JSChartResource.FrameSplitTextColor;//文字颜色
2106
+ this.TextBGColor;//文字背景色
2088
2107
  this.TextColor2;//右侧文字颜色,空使用TextColor
2089
2108
  this.Font=g_JSChartResource.FrameSplitTextFont;//字体
2090
2109
  this.LineColor=g_JSChartResource.FrameSplitPen;//线段颜色
@@ -2234,7 +2253,9 @@ var textRightPrev=null;//上一次刻度输出右边x坐标
2234
2253
  for(var i=0;i<this.VerticalInfo.length;++i){var x=this.GetXFromIndex(this.VerticalInfo[i].Value);if(x>right)break;if(xPrev!=null&&Math.abs(x-xPrev)<this.MinXDistance)continue;var item=this.VerticalInfo[i];var xFixed=ToFixedPoint(x);if(this.IsShowXLine){if(item.LineType==2)//虚线
2235
2254
  {this.Canvas.strokeStyle=this.VerticalInfo[i].LineColor;if(item.LineDash)this.Canvas.setLineDash(item.LineDash);else this.Canvas.setLineDash([5*pixelRatio,5*pixelRatio]);this.Canvas.beginPath();this.Canvas.moveTo(xFixed,top);this.Canvas.lineTo(xFixed,bottom);this.Canvas.stroke();this.Canvas.setLineDash([]);}else if(item.LineType==3){}else if(item.LineType>0)//实线
2236
2255
  {if(g_JSChartResource.FrameXLineDash){this.Canvas.strokeStyle=this.VerticalInfo[i].LineColor;this.Canvas.setLineDash(g_JSChartResource.FrameXLineDash);//虚线
2237
- this.Canvas.beginPath();this.Canvas.moveTo(xFixed,top);this.Canvas.lineTo(xFixed,bottom);this.Canvas.stroke();this.Canvas.setLineDash([]);}else{this.Canvas.strokeStyle=this.VerticalInfo[i].LineColor;this.Canvas.beginPath();this.Canvas.moveTo(xFixed,top);this.Canvas.lineTo(xFixed,bottom);this.Canvas.stroke();}}}if(item.BG&&item.BG.Color){var bgItem=item.BG;this.Canvas.fillStyle=bgItem.Color;var xStart=this.GetXFromIndex(bgItem.Index.Start);var xEnd=this.GetXFromIndex(bgItem.Index.End);var bgHeight=this.ChartBorder.Bottom;if(IFrameSplitOperator.IsNumber(bgItem.Height))bgHeight=bgItem.Height;var rtBG={Left:xStart,Width:xEnd-xStart,Top:border.Bottom,Height:bgHeight};this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);}if(this.VerticalInfo[i].Message[0]!=null){if(this.VerticalInfo[i].Font!=null)this.Canvas.font=this.VerticalInfo[i].Font;var textLeft=0;this.Canvas.fillStyle=item.TextColor;this.Canvas.strokeStyle=item.TextColor;var testWidth=this.Canvas.measureText(this.VerticalInfo[i].Message[0]).width;if(x<testWidth/2){this.Canvas.textAlign="left";this.Canvas.textBaseline="top";textLeft=x;}else if(x+testWidth/2>=this.ChartBorder.GetChartWidth()){this.Canvas.textAlign="right";this.Canvas.textBaseline="top";textLeft=x-testWidth;}else{this.Canvas.textAlign="center";this.Canvas.textBaseline="top";textLeft=x-testWidth/2;}if(textRightPrev==null||textLeft>textRightPrev){var yText=bottom;if(item.LineType==3){var lineLength=this.ShortXLineLength*pixelRatio;this.Canvas.beginPath();this.Canvas.moveTo(xFixed,yText);this.Canvas.lineTo(xFixed,yText+lineLength);this.Canvas.stroke();yText+=lineLength+2*pixelRatio;}this.Canvas.fillText(this.VerticalInfo[i].Message[0],x,yText+this.XBottomOffset);textRightPrev=textLeft+testWidth;}}xPrev=x;}};//Y坐标转y轴数值
2256
+ this.Canvas.beginPath();this.Canvas.moveTo(xFixed,top);this.Canvas.lineTo(xFixed,bottom);this.Canvas.stroke();this.Canvas.setLineDash([]);}else{this.Canvas.strokeStyle=this.VerticalInfo[i].LineColor;this.Canvas.beginPath();this.Canvas.moveTo(xFixed,top);this.Canvas.lineTo(xFixed,bottom);this.Canvas.stroke();}}}if(item.BG&&item.BG.Color){var bgItem=item.BG;this.Canvas.fillStyle=bgItem.Color;var xStart=this.GetXFromIndex(bgItem.Index.Start);var xEnd=this.GetXFromIndex(bgItem.Index.End);var bgHeight=this.ChartBorder.Bottom;if(IFrameSplitOperator.IsNumber(bgItem.Height))bgHeight=bgItem.Height;var rtBG={Left:xStart,Width:xEnd-xStart,Top:border.Bottom,Height:bgHeight};this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);}if(this.VerticalInfo[i].Message[0]!=null){if(this.VerticalInfo[i].Font!=null)this.Canvas.font=this.VerticalInfo[i].Font;var textLeft=0;this.Canvas.strokeStyle=item.TextColor;var testWidth=this.Canvas.measureText(this.VerticalInfo[i].Message[0]).width;var textHeight=this.Canvas.measureText("擎").width;if(x<testWidth/2){this.Canvas.textAlign="left";this.Canvas.textBaseline="top";textLeft=x;}else if(x+testWidth/2>=this.ChartBorder.GetChartWidth()){this.Canvas.textAlign="right";this.Canvas.textBaseline="top";textLeft=x-testWidth;}else{this.Canvas.textAlign="center";this.Canvas.textBaseline="top";textLeft=x-testWidth/2;}if(textRightPrev==null||textLeft>textRightPrev){var yText=bottom;if(item.LineType==3){var lineLength=this.ShortXLineLength*pixelRatio;this.Canvas.beginPath();this.Canvas.moveTo(xFixed,yText);this.Canvas.lineTo(xFixed,yText+lineLength);this.Canvas.stroke();yText+=lineLength+2*pixelRatio;}//item.TextBGColor="rgb(0,255,0)";
2257
+ if(item.TextBGColor)//文字背景色
2258
+ {var rtText={Left:textLeft,Top:yText+this.XBottomOffset,Width:testWidth,Height:textHeight};this.Canvas.fillStyle=item.TextBGColor;this.Canvas.fillRect(rtText.Left-1,rtText.Top,rtText.Width+2,rtText.Height);}this.Canvas.fillStyle=item.TextColor;this.Canvas.fillText(this.VerticalInfo[i].Message[0],x,yText+this.XBottomOffset);textRightPrev=textLeft+testWidth;}}xPrev=x;}};//Y坐标转y轴数值
2238
2259
  this.GetYData=function(y,isLimit){if(this.Logarithmic&&this.GetYLogarithmicFromData){return this.GetYLogarithmicData(y);}if(this.CoordinateType==1)//反转坐标
2239
2260
  {if(isLimit==false){return(y-this.ChartBorder.GetTopEx())/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}else{if(y<this.ChartBorder.GetTopEx())return this.HorizontalMin;if(y>this.ChartBorder.GetBottomEx())return this.HorizontalMax;return(y-this.ChartBorder.GetTopEx())/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}}else{if(isLimit==false){return(this.ChartBorder.GetBottomEx()-y)/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}else{if(y<this.ChartBorder.GetTopEx())return this.HorizontalMax;if(y>this.ChartBorder.GetBottomEx())return this.HorizontalMin;return(this.ChartBorder.GetBottomEx()-y)/this.ChartBorder.GetHeightEx()*(this.HorizontalMax-this.HorizontalMin)+this.HorizontalMin;}}};//X坐标转x轴数值
2240
2261
  this.GetXData=function(x){if(x<=this.ChartBorder.GetLeft())return 0;if(x>=this.ChartBorder.GetRight())return this.XPointCount;return(x-this.ChartBorder.GetLeft())*(this.XPointCount*1.0/this.ChartBorder.GetWidth());};//选中的画图工具X,Y轴坐标信息
@@ -3832,9 +3853,9 @@ this.HistoryData;this.ExportData=this.ExportArrayData;this.Draw=function(){if(!t
3832
3853
  function ChartStick(){this.newMethod=IChartPainting;//派生
3833
3854
  this.newMethod();delete this.newMethod;this.Color="rgb(255,193,37)";//线段颜色
3834
3855
  this.LineWidth;//线段宽度
3835
- this.ClassName='ChartStick';this.ExportData=this.ExportArrayData;this.DrawLine=function(){if(!this.Data||!this.Data.Data)return;var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var chartright=this.ChartBorder.GetRight();if(isHScreen===true)chartright=this.ChartBorder.GetBottom();var xPointCount=this.ChartFrame.XPointCount;this.Canvas.save();if(this.LineWidth>0)this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();var bFirstPoint=true;var drawCount=0;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j){var value=this.Data.Data[i];if(value==null)continue;var x=this.ChartFrame.GetXFromIndex(j);var y=this.ChartFrame.GetYFromData(value);if(x>chartright)break;if(bFirstPoint){this.Canvas.strokeStyle=this.Color;this.Canvas.beginPath();if(isHScreen)this.Canvas.moveTo(y,x);else this.Canvas.moveTo(x,y);bFirstPoint=false;}else{if(isHScreen)this.Canvas.lineTo(y,x);else this.Canvas.lineTo(x,y);}++drawCount;}if(drawCount>0)this.Canvas.stroke();this.Canvas.restore();};this.DrawStick=function(){if(!this.Data||!this.Data.Data)return;var bHScreen=this.ChartFrame.IsHScreen===true;var chartright=this.ChartBorder.GetRight();if(bHScreen)chartright=this.ChartBorder.GetBottom();var xPointCount=this.ChartFrame.XPointCount;var yBottom=this.ChartBorder.GetBottom();var xLeft=this.ChartBorder.GetLeft();this.Canvas.save();this.Canvas.strokeStyle=this.Color;if(this.LineWidth)this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();var lineWidth=this.Canvas.lineWidth;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j){var value=this.Data.Data[i];if(value==null)continue;var x=this.ChartFrame.GetXFromIndex(j);var y=this.ChartFrame.GetYFromData(value);if(x>chartright)break;this.Canvas.beginPath();if(bHScreen){this.Canvas.moveTo(xLeft,x);this.Canvas.lineTo(y,x);this.Canvas.stroke();}else{var xFix=ToFixedPoint2(lineWidth,x);this.Canvas.moveTo(xFix,y);this.Canvas.lineTo(xFix,yBottom);}this.Canvas.stroke();}this.Canvas.restore();};this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize)return;if(this.NotSupportMessage){this.DrawNotSupportmessage();return;}if(!this.Data||!this.Data.Data)return;this.DrawStick();};}//通达信语法 LINESTICK 支持横屏
3856
+ this.ClassName='ChartStick';this.ExportData=this.ExportArrayData;this.DrawLine=function(){if(!this.Data||!this.Data.Data)return;var isHScreen=this.ChartFrame.IsHScreen===true;var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var chartright=this.ChartBorder.GetRight();if(isHScreen===true)chartright=this.ChartBorder.GetBottom();var xPointCount=this.ChartFrame.XPointCount;this.Canvas.save();if(this.LineWidth>0)this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();var bFirstPoint=true;var drawCount=0;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j){var value=this.Data.Data[i];if(value==null)continue;var x=this.ChartFrame.GetXFromIndex(j);var y=this.ChartFrame.GetYFromData(value);if(x>chartright)break;if(bFirstPoint){this.Canvas.strokeStyle=this.Color;this.Canvas.beginPath();if(isHScreen)this.Canvas.moveTo(y,x);else this.Canvas.moveTo(x,y);bFirstPoint=false;}else{if(isHScreen)this.Canvas.lineTo(y,x);else this.Canvas.lineTo(x,y);}++drawCount;}if(drawCount>0)this.Canvas.stroke();this.Canvas.restore();};this.DrawStick=function(){if(!this.Data||!this.Data.Data)return;var bHScreen=this.ChartFrame.IsHScreen===true;var chartright=this.ChartBorder.GetRight();if(bHScreen)chartright=this.ChartBorder.GetBottom();var xPointCount=this.ChartFrame.XPointCount;var yBottom=this.ChartBorder.GetBottom();var xLeft=this.ChartBorder.GetLeft();this.Canvas.save();this.Canvas.strokeStyle=this.Color;if(this.LineWidth)this.Canvas.lineWidth=this.LineWidth*GetDevicePixelRatio();var lineWidth=this.Canvas.lineWidth;for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j){var value=this.Data.Data[i];if(value==null)continue;var x=this.ChartFrame.GetXFromIndex(j);var y=this.ChartFrame.GetYFromData(value);if(x>chartright)break;this.Canvas.beginPath();if(bHScreen){this.Canvas.moveTo(xLeft,x);this.Canvas.lineTo(y,x);this.Canvas.stroke();}else{var xFix=ToFixedPoint2(lineWidth,x);this.Canvas.moveTo(xFix,y);this.Canvas.lineTo(xFix,yBottom);}this.Canvas.stroke();}this.Canvas.restore();};this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize)return;if(this.IsHideScriptIndex())return;if(this.NotSupportMessage){this.DrawNotSupportmessage();return;}if(!this.Data||!this.Data.Data)return;this.DrawStick();};}//通达信语法 LINESTICK 支持横屏
3836
3857
  function ChartLineStick(){this.newMethod=ChartStick;//派生
3837
- this.newMethod();delete this.newMethod;this.ClassName='ChartLineStick';this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize)return;if(this.NotSupportMessage){this.DrawNotSupportmessage();return;}this.DrawStick();this.DrawLine();};}//通达信语法 VOLSTICK 支持横屏
3858
+ this.newMethod();delete this.newMethod;this.ClassName='ChartLineStick';this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize)return;if(this.IsShowIndexTitleOnly())return;if(this.IsHideScriptIndex())return;if(this.NotSupportMessage){this.DrawNotSupportmessage();return;}this.DrawStick();this.DrawLine();};}//通达信语法 VOLSTICK 支持横屏
3838
3859
  function ChartVolStick(){this.newMethod=IChartPainting;//派生
3839
3860
  this.newMethod();delete this.newMethod;this.UpColor=g_JSChartResource.UpBarColor;this.DownColor=g_JSChartResource.DownBarColor;this.HistoryData;//历史数据
3840
3861
  this.KLineDrawType=0;this.ClassName='ChartVolStick';this.PtInChart=this.PtInBar;this.DrawSelectedStatus=this.DrawLinePoint;this.ExportData=this.ExportArrayData;this.Draw=function(){if(!this.IsShow||this.ChartFrame.IsMinSize||!this.IsVisible)return;if(this.IsShowIndexTitleOnly())return;if(this.IsHideScriptIndex())return;if(this.ChartFrame.IsHScreen===true){this.HScreenDraw();return;}var dataWidth=this.ChartFrame.DataWidth;var distanceWidth=this.ChartFrame.DistanceWidth;var border=this.ChartBorder.GetBorder();var xOffset=border.LeftEx+distanceWidth/2.0+g_JSChartResource.FrameLeftMargin;var chartright=border.RightEx;var xPointCount=this.ChartFrame.XPointCount;var lockRect=this.GetLockRect();if(lockRect)chartright=lockRect.Left;var isMinute=this.IsMinuteFrame();var yBottom=this.ChartFrame.GetYFromData(0);if(dataWidth>=4){yBottom=ToFixedRect(yBottom);for(var i=this.Data.DataOffset,j=0;i<this.Data.Data.length&&j<xPointCount;++i,++j,xOffset+=dataWidth+distanceWidth){var value=this.Data.Data[i];var kItem=this.HistoryData.Data[i];if(value==null||kItem==null)continue;if(value==0)continue;var left=xOffset;var right=xOffset+dataWidth;if(right>chartright)break;var y=this.ChartFrame.GetYFromData(value);var barColor=this.GetBarColor(kItem);var bUp=barColor.IsUp;this.Canvas.fillStyle=barColor.Color;var height=ToFixedRect(Math.abs(yBottom-y)>=1?yBottom-y:1);//高度调整为整数, 如果小于1, 统一使用1
@@ -4685,7 +4706,7 @@ this.Color="#696969";//input type="color"不支持rgb的颜色格式
4685
4706
  //this.Left=5;
4686
4707
  this.Top=5*GetDevicePixelRatio();this.Width=45*GetDevicePixelRatio();//宽度
4687
4708
  this.SetOption=function(option){var pixelRatio=GetDevicePixelRatio();if(!option)return;if(option.Width>10)this.Width=option.Width*pixelRatio;};this.Clear=function(){if(this.ToolsDiv)this.ChartBorder.UIElement.parentNode.removeChild(this.ToolsDiv);};this.Draw=function(){var _this15=this;if(this.SizeChange==false)return;//工具列表
4688
- var TOOL_LIST=[[{HTML:{Title:'线段',IClass:'iconfont icon-draw_line',ID:'icon-segment'},Name:'线段'},{HTML:{Title:'尺子',IClass:'iconfont icon-ruler',ID:'icon_ruler'},Name:'尺子'},{HTML:{Title:'射线',IClass:'iconfont icon-draw_rays',ID:'icon-beam'},Name:'射线'},{HTML:{Title:'标价线',IClass:'iconfont icon-price_line',ID:'icon-price-line'},Name:'标价线'},{HTML:{Title:'垂直线',IClass:'iconfont icon-vertical_line',ID:'icon-vertical-line'},Name:'垂直线'},{HTML:{Title:'箭头',IClass:'iconfont icon-draw_rays',ID:'icon-beam2'},Name:'箭头'},{HTML:{Title:'趋势线',IClass:'iconfont icon-draw_trendline',ID:'icon-trendline'},Name:'趋势线'},{HTML:{Title:'水平线',IClass:'iconfont icon-draw_hline',ID:'icon-hline'},Name:'水平线'},{HTML:{Title:'水平线段',IClass:'iconfont icon-draw_hlinesegment',ID:'icon-hlineseg'},Name:'水平线段'},{HTML:{Title:'平行射线',IClass:'iconfont icon-draw_p_rays_lines',ID:'icon-rayslineseg'},Name:'平行射线'},{HTML:{Title:'平行线',IClass:'iconfont icon-draw_parallel_lines',ID:'icon-parallellines'},Name:'平行线'},{HTML:{Title:'平行通道',IClass:'iconfont icon-draw_parallelchannel',ID:'icon-parallelchannel'},Name:'平行通道'},{HTML:{Title:'价格通道线',IClass:'iconfont icon-draw_pricechannel',ID:'icon-pricechannel'},Name:'价格通道线'},{HTML:{Title:'M头W底',IClass:'iconfont icon-draw_wavemw',ID:'icon-wavemw'},Name:'M头W底'},{HTML:{Title:'头肩型',IClass:'iconfont icon-draw_head_shoulders_bt',ID:'icon-Head-Shoulders'},Name:'头肩型'},{HTML:{Title:'波浪尺',IClass:'iconfont icon-waveruler',ID:'icon-wave-ruler'},Name:'波浪尺'},{HTML:{Title:'AB波浪尺',IClass:'iconfont icon-waveruler',ID:'icon-wave-ruler'},Name:'AB波浪尺'},{HTML:{Title:'箱型线',IClass:'iconfont icon-draw_box',ID:'icon-drawbox'},Name:'箱型线'},{HTML:{Title:'涂鸦线段',IClass:'iconfont icon-draw_line',ID:'icon-segment2'},Name:'涂鸦线段'}],[{HTML:{Title:'圆弧',IClass:'iconfont icon-draw_arc',ID:'icon-arc'},Name:'圆弧线'},{HTML:{Title:'矩形',IClass:'iconfont icon-rectangle',ID:'icon-rect'},Name:'矩形'},{HTML:{Title:'平行四边形',IClass:'iconfont icon-draw_quadrangle',ID:'icon-quad'},Name:'平行四边形'},{HTML:{Title:'三角形',IClass:'iconfont icon-draw_triangle',ID:'icon-triangle'},Name:'三角形'},{HTML:{Title:'圆',IClass:'iconfont icon-draw_circle',ID:'icon-circle'},Name:'圆'},{HTML:{Title:'对称角度',IClass:'iconfont icon-draw_symangle',ID:'icon-symangle'},Name:'对称角度'}],[{HTML:{Title:'文本',IClass:'iconfont icon-draw_text',ID:'icon-text'},Name:'文本'},{HTML:{Title:'向上箭头',IClass:'iconfont icon-arrow_up',ID:'icon-arrowup'},Name:'icon-arrow_up'},{HTML:{Title:'向下箭头',IClass:'iconfont icon-arrow_down',ID:'icon-arrowdown'},Name:'icon-arrow_down'},{HTML:{Title:'向左箭头',IClass:'iconfont icon-arrow_left',ID:'icon-arrowleft'},Name:'icon-arrow_left'},{HTML:{Title:'向右箭头',IClass:'iconfont icon-arrow_right',ID:'icon-arrowright'},Name:'icon-arrow_right'}],[{HTML:{Title:'江恩角度线',IClass:'iconfont icon-draw_gannfan',ID:'icon-gannfan'},Name:'江恩角度线'},{HTML:{Title:'斐波那契周期线',IClass:'iconfont icon-draw_fibonacci',ID:'icon-fibonacci'},Name:'斐波那契周期线'},{HTML:{Title:'阻速线',IClass:'iconfont icon-draw_resline',ID:'icon-resline'},Name:'阻速线'},{HTML:{Title:'黄金分割',IClass:'iconfont icon-draw_goldensection',ID:'icon-goldensection'},Name:'黄金分割'},{HTML:{Title:'百分比线',IClass:'iconfont icon-draw_percentage',ID:'icon-percentage'},Name:'百分比线'},{HTML:{Title:'波段线',IClass:'iconfont icon-draw_waveband',ID:'icon-waveband'},Name:'波段线'},{HTML:{Title:'线形回归线',IClass:'iconfont icon-linear_3',ID:'icon-waveband2'},Name:'线形回归线'},{HTML:{Title:'线形回归带',IClass:'iconfont icon-linear_1',ID:'icon-waveband3'},Name:'线形回归带'},{HTML:{Title:'延长线形回归带',IClass:'iconfont icon-linear_2',ID:'icon-waveband5'},Name:'延长线形回归带'}],[{HTML:{Title:'全部删除',IClass:'iconfont icon-recycle_bin',ID:'icon-delete'},Name:'全部删除'}]];var hqChart=this.HQChart;if(!this.ToolsDiv){var div=document.createElement("div");div.className='drawtools';div.id=this.ID;var spanList="";//一层菜单
4709
+ var TOOL_LIST=[[{HTML:{Title:'线段',IClass:'iconfont icon-draw_line',ID:'icon-segment'},Name:'线段'},{HTML:{Title:'尺子',IClass:'iconfont icon-ruler',ID:'icon_ruler'},Name:'尺子'},{HTML:{Title:'射线',IClass:'iconfont icon-draw_rays',ID:'icon-beam'},Name:'射线'},{HTML:{Title:'标价线',IClass:'iconfont icon-price_line',ID:'icon-price-line'},Name:'标价线'},{HTML:{Title:'垂直线',IClass:'iconfont icon-vertical_line',ID:'icon-vertical-line'},Name:'垂直线'},{HTML:{Title:'箭头',IClass:'iconfont icon-draw_rays',ID:'icon-beam2'},Name:'箭头'},{HTML:{Title:'趋势线',IClass:'iconfont icon-draw_trendline',ID:'icon-trendline'},Name:'趋势线'},{HTML:{Title:'水平线',IClass:'iconfont icon-draw_hline',ID:'icon-hline'},Name:'水平线'},{HTML:{Title:'水平线段',IClass:'iconfont icon-draw_hlinesegment',ID:'icon-hlineseg'},Name:'水平线段'},{HTML:{Title:'平行射线',IClass:'iconfont icon-draw_p_rays_lines',ID:'icon-rayslineseg'},Name:'平行射线'},{HTML:{Title:'平行线',IClass:'iconfont icon-draw_parallel_lines',ID:'icon-parallellines'},Name:'平行线'},{HTML:{Title:'平行通道',IClass:'iconfont icon-draw_parallelchannel',ID:'icon-parallelchannel'},Name:'平行通道'},{HTML:{Title:'价格通道线',IClass:'iconfont icon-draw_pricechannel',ID:'icon-pricechannel'},Name:'价格通道线'},{HTML:{Title:'M头W底',IClass:'iconfont icon-draw_wavemw',ID:'icon-wavemw'},Name:'M头W底'},{HTML:{Title:'头肩型',IClass:'iconfont icon-draw_head_shoulders_bt',ID:'icon-Head-Shoulders'},Name:'头肩型'},{HTML:{Title:'波浪尺',IClass:'iconfont icon-waveruler',ID:'icon-wave-ruler'},Name:'波浪尺'},{HTML:{Title:'AB波浪尺',IClass:'iconfont icon-waveruler',ID:'icon-wave-ruler2'},Name:'AB波浪尺'},{HTML:{Title:'箱型线',IClass:'iconfont icon-draw_box',ID:'icon-drawbox'},Name:'箱型线'},{HTML:{Title:'涂鸦线段',IClass:'iconfont icon-draw_line',ID:'icon-segment2'},Name:'涂鸦线段'}],[{HTML:{Title:'圆弧',IClass:'iconfont icon-draw_arc',ID:'icon-arc'},Name:'圆弧线'},{HTML:{Title:'矩形',IClass:'iconfont icon-rectangle',ID:'icon-rect'},Name:'矩形'},{HTML:{Title:'平行四边形',IClass:'iconfont icon-draw_quadrangle',ID:'icon-quad'},Name:'平行四边形'},{HTML:{Title:'三角形',IClass:'iconfont icon-draw_triangle',ID:'icon-triangle'},Name:'三角形'},{HTML:{Title:'圆',IClass:'iconfont icon-draw_circle',ID:'icon-circle'},Name:'圆'},{HTML:{Title:'对称角度',IClass:'iconfont icon-draw_symangle',ID:'icon-symangle'},Name:'对称角度'}],[{HTML:{Title:'文本',IClass:'iconfont icon-draw_text',ID:'icon-text'},Name:'文本'},{HTML:{Title:'向上箭头',IClass:'iconfont icon-arrow_up',ID:'icon-arrowup'},Name:'icon-arrow_up'},{HTML:{Title:'向下箭头',IClass:'iconfont icon-arrow_down',ID:'icon-arrowdown'},Name:'icon-arrow_down'},{HTML:{Title:'向左箭头',IClass:'iconfont icon-arrow_left',ID:'icon-arrowleft'},Name:'icon-arrow_left'},{HTML:{Title:'向右箭头',IClass:'iconfont icon-arrow_right',ID:'icon-arrowright'},Name:'icon-arrow_right'}],[{HTML:{Title:'江恩角度线',IClass:'iconfont icon-draw_gannfan',ID:'icon-gannfan'},Name:'江恩角度线'},{HTML:{Title:'斐波那契周期线',IClass:'iconfont icon-draw_fibonacci',ID:'icon-fibonacci'},Name:'斐波那契周期线'},{HTML:{Title:'阻速线',IClass:'iconfont icon-draw_resline',ID:'icon-resline'},Name:'阻速线'},{HTML:{Title:'黄金分割',IClass:'iconfont icon-draw_goldensection',ID:'icon-goldensection'},Name:'黄金分割'},{HTML:{Title:'百分比线',IClass:'iconfont icon-draw_percentage',ID:'icon-percentage'},Name:'百分比线'},{HTML:{Title:'波段线',IClass:'iconfont icon-draw_waveband',ID:'icon-waveband'},Name:'波段线'},{HTML:{Title:'线形回归线',IClass:'iconfont icon-linear_3',ID:'icon-waveband2'},Name:'线形回归线'},{HTML:{Title:'线形回归带',IClass:'iconfont icon-linear_1',ID:'icon-waveband3'},Name:'线形回归带'},{HTML:{Title:'延长线形回归带',IClass:'iconfont icon-linear_2',ID:'icon-waveband5'},Name:'延长线形回归带'}],[{HTML:{Title:'全部删除',IClass:'iconfont icon-recycle_bin',ID:'icon-delete'},Name:'全部删除'}]];var hqChart=this.HQChart;if(!this.ToolsDiv){var div=document.createElement("div");div.className='drawtools';div.id=this.ID;var spanList="";//一层菜单
4689
4710
  var menuTwoList="";//二层菜单
4690
4711
  var menuOne=new Array();TOOL_LIST.forEach(function(item,index){menuOne.push(item[0]);});for(var i=0;i<TOOL_LIST.length;i++){var itemOut=menuOne[i];var itemIn=TOOL_LIST[i];var menuTwoStr="";var contentArrow="";for(var j=0;j<itemIn.length;j++){var currentItem=itemIn[j];var menuTwoName=currentItem.Name;if(menuTwoName.indexOf('up')>-1){menuTwoName="向上箭头";}else if(menuTwoName.indexOf('down')>-1){menuTwoName="向下箭头";}else if(menuTwoName.indexOf('left')>-1){menuTwoName="向左箭头";}else if(menuTwoName.indexOf('right')>-1){menuTwoName="向右箭头";}menuTwoStr+='<p class="menuTwoItem '+currentItem.HTML.ID+'">'+menuTwoName+'<i class="'+currentItem.HTML.IClass+'" title="'+currentItem.HTML.Title+'"></i></p>';}if(i!==TOOL_LIST.length-1){//不是“全部删除”项
4691
4712
  menuTwoList='<div class="menuTwo">'+menuTwoStr+'</div>';contentArrow='<i class="contentArrow iconfont icon-menu_arraw_left"></i>';}else{menuTwoList="";contentArrow="";}var spanNode='<div class="icon-image '+'first-'+itemOut.HTML.ID+'"><i class="'+itemOut.HTML.IClass+'" title="'+itemOut.HTML.Title+'"></i>'+menuTwoList+contentArrow+'</div>';spanList+=spanNode;}this.ChartBorder.UIElement.parentNode.appendChild(div);div.innerHTML=spanList;this.ToolsDiv=div;for(var i in TOOL_LIST){var item=TOOL_LIST[i][0];(0,_jquery2.default)('#'+this.ID+" .first-"+item.HTML.ID).hover(function(){//箭头的旋转过渡
@@ -5080,6 +5101,7 @@ this.DayCount=1;this.DateFormat=0;//0=MM-DD 1=MM/DD 2=MM/DD/Week
5080
5101
  this.Operator=function(){this.Frame.VerticalInfo=[];var xPointCount=this.Frame.XPointCount;var width=this.Frame.ChartBorder.GetWidth();var isHScreen=this.Frame.IsHScreen===true;if(isHScreen)width=this.Frame.ChartBorder.GetHeight();width=width/GetDevicePixelRatio();var minuteCoordinate=g_MinuteCoordinateData;var xcoordinateData=minuteCoordinate.GetCoordinateData(this.Symbol,width);var minuteCount=xcoordinateData.Count;var minuteMiddleCount=xcoordinateData.MiddleCount>0?xcoordinateData.MiddleCount:parseInt(minuteCount/2);var xcoordinate=xcoordinateData.Data;this.Frame.XPointCount=minuteCount*this.DayCount;//计算一共显示的数据个数
5081
5102
  this.Frame.MinuteCount=minuteCount;this.Frame.VerticalInfo=[];if(this.Frame.GlobalOption){var item=this.Frame.GlobalOption;if(IFrameSplitOperator.IsNumber(item.XDateFormat))this.DateFormat=item.XDateFormat;}if(this.DayCount<=1){//设置成1日的数据
5082
5103
  this.DayOffset.DataOffset=0;this.DayOffset.ShowDataCount=minuteCount;this.DayOffset.PageInfo=null;for(var i=0;i<xcoordinate.length;++i){var info=new CoordinateInfo();var item=xcoordinate[i];if(g_JSChartResource.Minute.FrameSplitTextColor)info.TextColor=g_JSChartResource.Minute.FrameSplitTextColor;info.Value=item[0];if(this.ShowText)info.Message[0]=item[3];if(item[4])info.LineColor=item[4];//线段颜色
5104
+ if(item[5])info.TextBGColor=item[5];//文字背景色
5083
5105
  this.Frame.VerticalInfo[i]=info;}}else{var offset=0,showDayCount=this.DayData.length;if(this.DayOffset){if(IFrameSplitOperator.IsNumber(this.DayOffset.Offset))offset=this.DayOffset.Offset;if(IFrameSplitOperator.IsNumber(this.DayOffset.ShowDayCount))showDayCount=this.DayOffset.ShowDayCount;}this.DayOffset.DataOffset=offset*minuteCount;this.DayOffset.ShowDataCount=this.DayOffset.ShowDayCount*minuteCount;this.DayOffset.PageInfo={Day:[]};for(var i=this.DayData.length-1-offset,j=0;i>=0&&j<showDayCount;--i,++j){var info=new CoordinateInfo();info.Value=j*minuteCount+minuteMiddleCount;info.LineType=-1;//线段不画
5084
5106
  if(this.ShowText){info.Message[0]=this.FormatDate(this.DayData[i].Date);info.BG={Index:{Start:j*minuteCount+1,End:(j+1)*minuteCount-1},Date:this.DayData[i].Date};//背景设置
5085
5107
  }this.Frame.VerticalInfo.push(info);var info=new CoordinateInfo();info.Value=(j+1)*minuteCount;this.Frame.VerticalInfo.push(info);this.DayOffset.PageInfo.Day.push({Date:this.DayData[i].Date,Index:i});}}if(this.GetEventCallback){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SPLIT_XCOORDINATE);if(event&&event.Callback){var data={ID:this.Frame.Identify,Frame:this.Frame};event.Callback(event,data,this);}}};this.FormatDate=function(date){switch(this.DateFormat){case 1:return IFrameSplitOperator.FormatDateString(date,'MM/DD');case 2:return IFrameSplitOperator.FormatDateString(date,'MM/DD/W');default://MM-DD
@@ -5435,7 +5457,7 @@ this.CallAuctionShowTitle=new _set2.default(["MTitle-AC-Price","MTitle-AC-Vol","
5435
5457
  var emptyData={ClientPos:this.PointInfo.ClientPos,X:this.PointInfo.Point.X,Y:this.PointInfo.Point.Y};if(this.PointInfo.ClientPos==2){if(!this.BeforeOpenData)return emptyData;if(!this.CallAcutionXOperator)return emptyData;this.CallAcutionXOperator.Value=isHScreen?this.PointInfo.Point.Y:this.PointInfo.Point.X;this.CallAcutionXOperator.Point={X:this.PointInfo.Point.X,Y:this.PointInfo.Point.Y};this.CallAcutionXOperator.ClientPos=this.PointInfo.ClientPos;if(!this.CallAcutionXOperator.Operator())return emptyData;var callbackData={Explain:"BeforeOpen",Data:null,DataIndex:null,DataTotalCount:this.BeforeOpenData.TotalCount};callbackData.DataIndex=this.CallAcutionXOperator.DataIndex;callbackData.Data=this.CallAcutionXOperator.Item;callbackData.Ver=this.BeforeOpenData.Ver;return callbackData;}else if(this.PointInfo.ClientPos==3){if(!this.AfterCloseData)return emptyData;if(!this.CallAcutionXOperator)return emptyData;this.CallAcutionXOperator.Value=isHScreen?this.PointInfo.Point.Y:this.PointInfo.Point.X;this.CallAcutionXOperator.Point={X:this.PointInfo.Point.X,Y:this.PointInfo.Point.Y};this.CallAcutionXOperator.ClientPos=this.PointInfo.ClientPos;if(!this.CallAcutionXOperator.Operator())return emptyData;var callbackData={Explain:"AfterClose",Data:null,DataIndex:null,DataTotalCount:this.AfterCloseData.TotalCount};callbackData.DataIndex=this.CallAcutionXOperator.DataIndex;callbackData.Data=this.CallAcutionXOperator.Item;callbackData.Ver=this.AfterCloseData.Ver;return callbackData;}else if(this.PointInfo.ClientPos>=200&&this.PointInfo.ClientPos<=299){if(!this.MultiDayBeforeOpenData||!IFrameSplitOperator.IsNonEmptyArray(this.MultiDayBeforeOpenData))return emptyData;var x=this.Frame.IsHScreen==true?this.PointInfo.Point.Y:this.PointInfo.Point.X;this.CallAcutionXOperator.Value=x;this.CallAcutionXOperator.Point={X:this.PointInfo.Point.X,Y:this.PointInfo.Point.Y};this.CallAcutionXOperator.ClientPos=this.PointInfo.ClientPos;if(!this.CallAcutionXOperator.Operator())return emptyData;var dayItem=this.MultiDayBeforeOpenData[this.CallAcutionXOperator.DayIndex];var callbackData={Explain:"MultiDayBeforeOpen",Data:null,DataIndex:null};callbackData.DataIndex=this.CallAcutionXOperator.DataIndex;callbackData.DayIndex=this.CallAcutionXOperator.DayIndex;callbackData.Data=this.CallAcutionXOperator.Item;callbackData.Ver=dayItem.Ver;return callbackData;}else if(this.PointInfo.ClientPos>=300&&this.PointInfo.ClientPos<=399){if(!this.MultiDayAfterCloseData||!IFrameSplitOperator.IsNonEmptyArray(this.MultiDayAfterCloseData))return emptyData;var x=this.Frame.IsHScreen==true?this.PointInfo.Point.Y:this.PointInfo.Point.X;this.CallAcutionXOperator.Value=x;this.CallAcutionXOperator.Point={X:this.PointInfo.Point.X,Y:this.PointInfo.Point.Y};this.CallAcutionXOperator.ClientPos=this.PointInfo.ClientPos;if(!this.CallAcutionXOperator.Operator())return emptyData;var dayItem=this.MultiDayAfterCloseData[this.CallAcutionXOperator.DayIndex];var callbackData={Explain:"MultiDayAfterClose",Data:null,DataIndex:null};callbackData.DataIndex=this.CallAcutionXOperator.DataIndex;callbackData.DayIndex=this.CallAcutionXOperator.DayIndex;callbackData.Data=this.CallAcutionXOperator.Item;callbackData.Ver=dayItem.Ver;return callbackData;}return emptyData;};this.GetLatestKLineData=function(bCallAuction)//获取最新一个K线数据 bCallAuction=是否包含集合竞价数据
5436
5458
  {var beforeItem=null;var beforeDataVer=1;var beforeExplain;if(IFrameSplitOperator.IsNonEmptyArray(this.MultiDayBeforeOpenData)){var item=this.MultiDayBeforeOpenData[this.MultiDayBeforeOpenData.length-1];if(item&&IFrameSplitOperator.IsNonEmptyArray(item.Data)){beforeDataVer=item.Ver;beforeItem=item.Data[item.Data.length-1];beforeExplain="MultiDayBeforeOpen";}}else if(this.BeforeOpenData&&IFrameSplitOperator.IsNonEmptyArray(this.BeforeOpenData.Data)){beforeItem=this.BeforeOpenData.Data[this.BeforeOpenData.Data.length-1];beforeDataVer=this.BeforeOpenData.Ver;beforeExplain="BeforeOpen";}var afterItem=null;var afterDataVer=1;var afterExplain;if(IFrameSplitOperator.IsNonEmptyArray(this.MultiDayAfterCloseData)){var item=this.MultiDayAfterCloseData[this.MultiDayAfterCloseData.length-1];if(item&&IFrameSplitOperator.IsNonEmptyArray(item.Data)){afterDataVer=item.Ver;afterItem=item.Data[item.Data.length-1];afterExplain="MultiDayAfterClose";if(item.Data.length==item.TotalCount)afterItem=null;//收盘以后,显示最后的1分钟价格就可以
5437
5459
  }}else if(this.AfterOpenData&&IFrameSplitOperator.IsNonEmptyArray(this.AfterOpenData.Data)){afterItem=this.AfterOpenData.Data[this.AfterOpenData.Data.length-1];afterDataVer=this.AfterOpenData.Ver;afterExplain="AfterClose";}var dataItem=null;if(this.Data&&IFrameSplitOperator.IsNonEmptyArray(this.Data.Data)){var count=this.Data.Data.length;dataItem=this.Data.Data[count-1];}if(!beforeItem&&!afterItem&&!dataItem)return null;if(!bCallAuction)return{Type:0,Data:dataItem};if(!dataItem)return{Type:1,Data:beforeItem,Ver:beforeDataVer,Explain:beforeExplain};if(beforeItem&&dataItem)//盘前数据
5438
- {if(beforeItem.Date>dataItem.Date||beforeItem.Date==dataItem.Date&&beforeItem.Time>dataItem.Time&&afterDataVer==1.0)return{Type:2,Data:beforeItem,Ver:beforeDataVer,Explain:beforeExplain};}if(afterItem&&dataItem)//盘后数据
5460
+ {if(beforeItem.Date>dataItem.Date||beforeItem.Date==dataItem.Date&&beforeItem.Time>dataItem.Time&&beforeDataVer==1.0||beforeItem.Date==dataItem.Date&&parseInt(beforeItem.Time>dataItem.Time)&&beforeDataVer==2.0)return{Type:2,Data:beforeItem,Ver:beforeDataVer,Explain:beforeExplain};}if(afterItem&&dataItem)//盘后数据
5439
5461
  {if(afterItem.Date>=dataItem.Date)return{Type:1,Data:afterItem,Ver:afterDataVer,Explain:afterExplain};}return{Type:0,Data:dataItem};};this.GetFormatTitle=function(data)//{ Data:, IsLastOne: }
5440
5462
  {if(!data||!data.Data)return;var upperSymbol=this.Symbol.toUpperCase();var defaultfloatPrecision=GetfloatPrecision(this.Symbol);//价格小数位数
5441
5463
  var isFutures=MARKET_SUFFIX_NAME.IsFutures(upperSymbol);//国内期货, 纽约期货交易所
@@ -5736,7 +5758,9 @@ rgb=rgb.substr(4).split(")")[0].split(sep);var r=(+rgb[0]).toString(16),g=(+rgb[
5736
5758
  IChartDrawPicture.HexToRGB=function(color){color=color.toLowerCase();var reg=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;if(color&&reg.test(color)){if(color.length===4){var sColorNew="#";for(var i=1;i<4;i+=1){sColorNew+=color.slice(i,i+1).concat(color.slice(i,i+1));}color=sColorNew;}//处理六位的颜色值
5737
5759
  var sColorChange=[];for(var i=1;i<7;i+=2){sColorChange.push(parseInt("0x"+color.slice(i,i+2)));}return"rgb("+sColorChange.join(",")+")";}return null;};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线坐标
5738
5760
  {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();}},{Name:"水平线2",ClassName:"ChartDrawHLine",Create:function Create(){return new ChartDrawHLine();}},//trading view样式
5739
- {Name:"Note",ClassName:"ChartDrawNote",Create:function Create(){return new ChartDrawNote();}},{Name:"AnchoredText",ClassName:"ChartDrawAnchoredText",Create:function Create(){return new ChartDrawAnchoredText();}},{Name:"PriceLabel",ClassName:"ChartDrawPriceLabel",Create:function Create(){return new ChartDrawPriceLabel();}},{Name:"PriceNote",ClassName:"ChartDrawPriceNote",Create:function Create(){return new ChartDrawPriceNote();}},{Name:"FibWedge",ClassName:"ChartDrawFibWedge",Create:function Create(){return new ChartDrawFibWedge();}}];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()}
5761
+ {Name:"Note",ClassName:"ChartDrawNote",Create:function Create(){return new ChartDrawNote();}},{Name:"AnchoredText",ClassName:"ChartDrawAnchoredText",Create:function Create(){return new ChartDrawAnchoredText();}},{Name:"PriceLabel",ClassName:"ChartDrawPriceLabel",Create:function Create(){return new ChartDrawPriceLabel();}},{Name:"PriceNote",ClassName:"ChartDrawPriceNote",Create:function Create(){return new ChartDrawPriceNote();}},{Name:"FibWedge",ClassName:"ChartDrawFibWedge",Create:function Create(){return new ChartDrawFibWedge();}},{Name:"FibRetracement",ClassName:"ChartFibRetracement",Create:function Create(){return new ChartFibRetracement();}},//斐波那契回测
5762
+ {Name:"FibSpeedResistanceFan",ClassName:"ChartFibSpeedResistanceFan",Create:function Create(){return new ChartFibSpeedResistanceFan();}//斐波那契扇形
5763
+ }];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()}
5740
5764
  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:}
5741
5765
  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)//创建画图工具
5742
5766
  {var item=IChartDrawPicture.GetDrawPictureByClassName(obj.ClassName);if(!item)return null;var chartDraw=item.Create();//TODO:后面都放到每一个SetOptin里面
@@ -5887,7 +5911,7 @@ this.ExportStorageData=function(){var storageData=this.ExportBaseData();storageD
5887
5911
  for(var i=0;i<this.Value.length&&i<2;++i){var item=this.Value[i];storageData.Value.push({XValue:item.XValue,YValue:item.YValue,DateTime:item.DateTime});}if(this.CenterLine){storageData.CenterLine={IsShow:this.CenterLine.IsShow,LineDash:this.CenterLine.LineDash.slice(0)};}return storageData;};this.SetOption=function(option){if(this.Super_SetOption)this.Super_SetOption(option);if(option){if(IFrameSplitOperator.IsNumber(option.ChannelWidth))this.ChannelWidth=option.ChannelWidth;if(option.CenterLine){var item=option.CenterLine;if(IFrameSplitOperator.IsNonEmptyArray(item.LineDash))this.CenterLine.LineDash=item.LineDash.slice(0);if(IFrameSplitOperator.IsBool(item.IsShow))this.CenterLine.IsShow=item.IsShow;}}};//计算需要画的点的坐标
5888
5912
  this.CalculateDrawPoint=function(){if(this.Status<2)return null;if(!this.Point.length||!this.Frame)return null;var data=this.Frame.Data;if(!data)return null;var drawPoint=[];if(this.Status==10)//完成
5889
5913
  {for(var i=0;i<2;++i){var item=this.Value[i];var pt=new Point();pt.X=this.Frame.GetXFromIndex(item.XValue-data.DataOffset,false);pt.Y=this.Frame.GetYFromData(item.YValue,false);drawPoint.push(pt);}}else{for(var i=0;i<this.Point.length;++i){var item=this.Point[i];var pt=new Point();pt.X=item.X;pt.Y=item.Y;drawPoint.push(pt);}}if(drawPoint.length>=2){var linePoint={Start:new Point(),End:new Point()};linePoint.Start.X=drawPoint[0].X;linePoint.Start.Y=drawPoint[0].Y;linePoint.End.X=drawPoint[1].X;linePoint.End.Y=drawPoint[1].Y;this.LinePoint.push(linePoint);if(drawPoint.length==3||this.Status==10){var x=linePoint.End.X-linePoint.Start.X;var y=linePoint.End.Y-linePoint.Start.Y;var angle=Math.atan(Math.abs(x/y));var yMove=this.ChannelWidth/Math.sin(angle);//JSConsole.Chart.Log('[ChartDrawPictureParallelChannel::CalculateDrawPoint]',xMove);
5890
- linePoint={Start:new Point(),End:new Point()};linePoint.Start.X=drawPoint[0].X;linePoint.Start.Y=drawPoint[0].Y-yMove;linePoint.End.X=drawPoint[1].X;linePoint.End.Y=drawPoint[1].Y-yMove;this.LinePoint.push(linePoint);var ptCenter=new Point();ptCenter.X=linePoint.Start.X+(linePoint.End.X-linePoint.Start.X)/2;ptCenter.Y=linePoint.Start.Y+(linePoint.End.Y-linePoint.Start.Y)/2;drawPoint[3]=ptCenter;this.Point[2]=ptCenter;var xValue=parseInt(this.Frame.GetXData(ptCenter.X))+data.DataOffset;var yValue=this.Frame.GetYData(ptCenter.Y);this.Value[2]={XValue:xValue,YValue:yValue};this.PointCount=this.Point.length;//完成以后是3个点
5914
+ linePoint={Start:new Point(),End:new Point()};linePoint.Start.X=drawPoint[0].X;linePoint.Start.Y=drawPoint[0].Y-yMove;linePoint.End.X=drawPoint[1].X;linePoint.End.Y=drawPoint[1].Y-yMove;this.LinePoint.push(linePoint);var ptCenter=new Point();ptCenter.X=linePoint.Start.X+(linePoint.End.X-linePoint.Start.X)/2;ptCenter.Y=linePoint.Start.Y+(linePoint.End.Y-linePoint.Start.Y)/2;drawPoint[2]=ptCenter;this.Point[2]=ptCenter;var xValue=parseInt(this.Frame.GetXData(ptCenter.X))+data.DataOffset;var yValue=this.Frame.GetYData(ptCenter.Y);this.Value[2]={XValue:xValue,YValue:yValue};this.PointCount=this.Point.length;//完成以后是3个点
5891
5915
  linePoint={Start:new Point(),End:new Point()};linePoint.Start.X=drawPoint[0].X;linePoint.Start.Y=drawPoint[0].Y-yMove/2;linePoint.End.X=drawPoint[1].X;linePoint.End.Y=drawPoint[1].Y-yMove/2;this.CenterLine.Line=linePoint;}}return drawPoint;};this.DrawArea=function(pt,pt2,pt3,pt4){this.Canvas.fillStyle=this.AreaColor;this.Canvas.beginPath();this.Canvas.moveTo(pt.X,pt.Y);this.Canvas.lineTo(pt2.X,pt2.Y);this.Canvas.lineTo(pt3.X,pt3.Y);this.Canvas.lineTo(pt4.X,pt4.Y);this.Canvas.closePath();this.Canvas.fill();};this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;var drawPoint=this.CalculateDrawPoint();if(!drawPoint)return;this.AreaColor=IChartDrawPicture.ColorToRGBA(this.LineColor,0.3);this.ClipFrame();if(this.LinePoint.length==2){this.DrawArea(this.LinePoint[0].Start,this.LinePoint[0].End,this.LinePoint[1].End,this.LinePoint[1].Start);}for(var i=0;i<this.LinePoint.length;++i){var item=this.LinePoint[i];this.DrawLine(item.Start,item.End);}if(this.CenterLine.IsShow&&this.CenterLine.Line){var item=this.CenterLine.Line;this.Canvas.setLineDash(this.CenterLine.LineDash);this.DrawLine(item.Start,item.End);this.Canvas.setLineDash([]);}this.Canvas.restore();this.DrawPoint(drawPoint);//画点
5892
5916
  };//xStep,yStep 移动的偏移量
5893
5917
  this.Move=function(xStep,yStep){if(this.Status!=20)return fasle;if(!this.Frame)return false;var data=this.Frame.Data;if(!data)return false;if(this.MovePointIndex==100)//整体移动
@@ -6168,7 +6192,27 @@ var lineColor=item.Color;var text=''+item.Value;var y=Math.sin(radian)*value+ptC
6168
6192
  this.IsPointIn=function(x,y,option){if(this.Status!=10)return-1;var value=this.IsPointInXYValue(x,y,this.AryPoint,option);if(value>=0)return value;value=this.IsPointInLine(x,y,option);if(value>=0)return 100;return-1;};this.IsPointInDots=function(x,y,aryPoint,option){if(!IFrameSplitOperator.IsNonEmptyArray(aryPoint))return-1;if(!this.Frame)return-1;var data=this.Frame.Data;if(!data)return-1;if(!this.Value)return-1;var radius=5;if(option&&IFrameSplitOperator.IsNumber(option.Zoom))radius+=option.Zoom;else if(this.Option&&IFrameSplitOperator.IsNumber(this.Option.Zoom))radius+=this.Option.Zoom;var isHScreen=this.Frame.IsHScreen;radius*=GetDevicePixelRatio();for(var i=0;i<aryPoint.length;++i)//是否在点上
6169
6193
  {var pt=aryPoint[i];var path=new Path2D();path.arc(pt.X,pt.Y,radius,0,360);if(this.Canvas.isPointInPath(path,x,y))return i;}return-1;};this.GetCursorType=function(ptIndex){if(ptIndex==2)return"ns-resize";return null;};this.PointToValue=function(){if(!this.Frame)return false;var item=this.Point[2];var ptLast={X:item.X,Y:item.Y};if(!this.PointToValue_Default())return false;//计算第3个点的位置
6170
6194
  var aryValue=[this.Value[0],this.Value[1]];var aryPoint=this.ValueToPoint_V2(aryValue);var radius=this.CalculateHypotenuse(aryPoint[0],aryPoint[1]);//求半径
6171
- var a=aryPoint[0].X-ptLast.X;var b=aryPoint[0].Y-ptLast.Y;var c=Math.sqrt(a*a+b*b);var a2=a*radius/c;var b2=b*radius/c;this.Point[2].X=aryPoint[0].X-a2;this.Point[2].Y=aryPoint[0].Y-b2;var aryValue=this.PointToValue_V2([this.Point[2]],{Type:1});if(!aryValue)return false;this.Value[2]=aryValue[0];return true;};this.PointToValue_V2=function(aryPoint,option){if(!this.Frame)return null;if(this.Frame.ClassName=="MinuteFrame"||this.Frame.Class=="MinuteHScreenFrame"){return this.PointToValue_Minute_V2(aryPoint,option);}else{return this.PointToValue_KLine_V2(aryPoint,option);}};this.PointToValue_KLine_V2=function(aryPoint,option){if(!IFrameSplitOperator.IsNonEmptyArray(aryPoint))return null;if(!this.Frame)return null;var data=this.Frame.Data;if(!data)return null;var aryValue=[];var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];var xValue=this.Frame.GetXData(item.Y,false)+data.DataOffset;var yValue=this.Frame.GetYData(item.X,false);var valueItem={XValue:xValue,YValue:yValue,Type:1};aryValue[i]=valueItem;}}else{for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];var xValue=this.Frame.GetXData(item.X,false)+data.DataOffset;var yValue=this.Frame.GetYData(item.Y,false);var valueItem={XValue:xValue,YValue:yValue,Type:1};aryValue[i]=valueItem;}}return aryValue;};}function ChartDrawStorage(){this.DrawData=new _map2.default();//画图工具数据 key=symbol-Period, value=Map() Key:Guid, Value:{Guid, Symbol, Period, ClassName, Value}
6195
+ var a=aryPoint[0].X-ptLast.X;var b=aryPoint[0].Y-ptLast.Y;var c=Math.sqrt(a*a+b*b);var a2=a*radius/c;var b2=b*radius/c;this.Point[2].X=aryPoint[0].X-a2;this.Point[2].Y=aryPoint[0].Y-b2;var aryValue=this.PointToValue_V2([this.Point[2]],{Type:1});if(!aryValue)return false;this.Value[2]=aryValue[0];return true;};this.PointToValue_V2=function(aryPoint,option){if(!this.Frame)return null;if(this.Frame.ClassName=="MinuteFrame"||this.Frame.Class=="MinuteHScreenFrame"){return this.PointToValue_Minute_V2(aryPoint,option);}else{return this.PointToValue_KLine_V2(aryPoint,option);}};this.PointToValue_KLine_V2=function(aryPoint,option){if(!IFrameSplitOperator.IsNonEmptyArray(aryPoint))return null;if(!this.Frame)return null;var data=this.Frame.Data;if(!data)return null;var aryValue=[];var isHScreen=this.Frame.IsHScreen;if(isHScreen){for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];var xValue=this.Frame.GetXData(item.Y,false)+data.DataOffset;var yValue=this.Frame.GetYData(item.X,false);var valueItem={XValue:xValue,YValue:yValue,Type:1};aryValue[i]=valueItem;}}else{for(var i=0;i<aryPoint.length;++i){var item=aryPoint[i];var xValue=this.Frame.GetXData(item.X,false)+data.DataOffset;var yValue=this.Frame.GetYData(item.Y,false);var valueItem={XValue:xValue,YValue:yValue,Type:1};aryValue[i]=valueItem;}}return aryValue;};}//////////////////////////////////////////////////////////////////////////////
6196
+ // 斐波那契回测
6197
+ //
6198
+ function ChartFibRetracement(){this.newMethod=IChartDrawPicture;//派生
6199
+ this.newMethod();delete this.newMethod;this.ClassName='ChartFibRetracement';this.PointCount=2;this.Font=12*GetDevicePixelRatio()+"px 微软雅黑";this.IsPointIn=this.IsPointIn_XYValue_Line;this.GetXYCoordinate=this.GetXYCoordinate_default;this.PointToValue_Default=this.PointToValue;this.OnlyMoveXIndex=true;this.IsSupportMagnet=true;this.LineDash=[6,3];this.LineWidth=1;this.EnableBGColor=true;this.ExtendLine={Left:false,Right:false};//延长线
6200
+ this.AreaConfig={AryData:[{Value:0,Color:"rgb(128,128,128)",Enable:true},{Value:0.236,Color:"rgb(242,52,69)",Enable:true},{Value:0.382,Color:"rgb(255,152,0)",Enable:true},{Value:0.5,Color:"rgb(76,175,80)",Enable:true},{Value:0.618,Color:"rgb(8,153,129)",Enable:true},{Value:0.786,Color:"rgb(0,188,212)",Enable:true},{Value:1,Color:"rgb(120,123,134)",Enable:true},{Value:1.618,Color:"rgb(41,98,255)",Enable:true},{Value:2.618,Color:"rgb(242,54,69)",Enable:false}],Opacity:0.3};this.SetOption=function(option){if(!option)return;if(option.Font)this.Font=option.Font;if(option.LineWidth)this.LineWidth=option.LineWidth;if(option.LineDash)this.LineDash=option.LineDash;if(IFrameSplitOperator.IsBool(option.EnableBGColor))this.EnableBGColor=option.EnableBGColor;if(option.ExtendLine){var item=option.ExtendLine;if(IFrameSplitOperator.IsBool(item.Left))this.ExtendLine.Left=item.Left;if(IFrameSplitOperator.IsBool(item.Right))this.ExtendLine.Left=item.Right;}if(option.AreaConfig)this.AreaConfig=option.AreaConfig;};//导出成存储格式
6201
+ this.ExportStorageData=function(){var storageData=this.ExportBaseData();storageData.Value=[];for(var i=0;i<this.Value.length&&i<this.PointCount;++i){var item=this.Value[i];storageData.Value.push({XValue:item.XValue,YValue:item.YValue});}storageData.Font=this.Font;storageData.EnableBGColor=this.EnableBGColor;storageData.LineDash=this.LineDash;storageData.ExtendLine={Left:this.ExtendLine.Left,Right:this.ExtendLine.Right};storageData.AreaConfig=CloneData(this.AreaConfig);return storageData;};this.ImportStorageData=function(storageData){if(storageData.Font)this.Font=storageData.Font;if(storageData.LineDash)this.LineDash=storageData.LineDash;if(IFrameSplitOperator.IsBool(storageData.EnableBGColor))this.EnableBGColor=storageData.EnableBGColor;if(storageData.ExtendLine)this.ExtendLine=storageData.ExtendLine;if(storageData.AreaConfig)this.AreaConfig=storageData.AreaConfig;};this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;var bCheckXY=true;if(this.ExtendLine.Left||this.ExtendLine.Right)bCheckXY=false;var drawPoint=this.CalculateDrawPoint({IsCheckX:bCheckXY,IsCheckY:bCheckXY});if(!drawPoint)return;if(drawPoint.length!=2)return;this.ClipFrame();var ptStart=drawPoint[0];var ptEnd=drawPoint[1];this.SetLineWidth();this.Canvas.strokeStyle=this.LineColor;this.Canvas.setLineDash(this.LineDash);this.Canvas.beginPath();this.Canvas.moveTo(ptStart.X,ptStart.Y);this.Canvas.lineTo(ptEnd.X,ptEnd.Y);this.Canvas.stroke();this.Canvas.setLineDash([]);this.DrawBlock(ptStart,ptEnd);this.RestoreLineWidth();var line={Start:ptStart,End:ptEnd};this.LinePoint.push(line);this.DrawPoint(drawPoint);//画点
6202
+ this.Canvas.restore();};this.GetArrayAreaConfig=function(){var aryArea=[];for(var i=0;i<this.AreaConfig.AryData.length;++i){var item=this.AreaConfig.AryData[i];if(item.Enable)aryArea.push(item);}aryArea.sort(function(left,right){return right.Value-left.Value;});return aryArea;};this.DrawBlock=function(ptStart,ptEnd){var yTop=Math.min(ptStart.Y,ptEnd.Y);var yBottom=Math.max(ptStart.Y,ptEnd.Y);var xLeft=Math.min(ptStart.X,ptEnd.X);var xRight=Math.max(ptStart.X,ptEnd.X);var height=yBottom-yTop;//var baseValue=Math.min(this.Value[0].YValue, this.Value[1].YValue);
6203
+ //var diffValue=Math.abs(this.Value[0].YValue-this.Value[1].YValue); //差值
6204
+ if(this.ExtendLine.Right)xRight=this.Frame.ChartBorder.GetRight();if(this.ExtendLine.Left)xLeft=this.Frame.ChartBorder.GetLeft();var aryArea=this.GetArrayAreaConfig();var yPre=null;//上一个点
6205
+ var clrArea=null;this.Canvas.font=this.Font;if(this.ExtendLine.Left)this.Canvas.textAlign="left";else this.Canvas.textAlign="right";this.Canvas.textBaseline="bottom";for(var i=0;i<aryArea.length;++i){var item=aryArea[i];var y=yBottom-height*item.Value;//var yValue=baseValue+diffValue*item.Value;
6206
+ yValue=this.Frame.GetYData(y,false);y=ToFixedPoint(y);if(this.EnableBGColor&&IFrameSplitOperator.IsNumber(yPre)){var rtBG={Left:xLeft,Right:xRight,Top:yPre,Bottom:y};rtBG.Width=rtBG.Right-rtBG.Left;rtBG.Height=rtBG.Bottom-rtBG.Top;this.Canvas.fillStyle=clrArea;this.Canvas.fillRect(rtBG.Left,rtBG.Top,rtBG.Width,rtBG.Height);}this.Canvas.strokeStyle=item.Color;this.Canvas.beginPath();this.Canvas.moveTo(xLeft,y);this.Canvas.lineTo(xRight,y);this.Canvas.stroke();var line={Start:{X:xLeft,Y:y},End:{X:xRight,Y:y}};this.LinePoint.push(line);//文字
6207
+ var text=item.Value+' ('+yValue.toFixed(2)+')';this.Canvas.fillStyle=item.Color;if(this.ExtendLine.Left)this.Canvas.fillText(text,xLeft+2,y-2);else this.Canvas.fillText(text,xLeft-2,y-2);yPre=y;clrArea=IChartDrawPicture.ColorToRGBA(item.Color,this.AreaConfig.Opacity);}};}function ChartFibSpeedResistanceFan(){this.newMethod=IChartDrawPicture;//派生
6208
+ this.newMethod();delete this.newMethod;this.ClassName='ChartFibSpeedResistanceFan';this.PointCount=2;this.Font=12*GetDevicePixelRatio()+"px 微软雅黑";this.IsPointIn=this.IsPointIn_XYValue_Line;this.GetXYCoordinate=this.GetXYCoordinate_default;this.PointToValue_Default=this.PointToValue;this.OnlyMoveXIndex=true;this.IsSupportMagnet=true;this.LineWidth=1;this.EnableBGColor=true;this.AreaConfig={AryYData:[{Value:0,Color:"rgb(128,128,128)",Enable:true},{Value:0.25,Color:"rgb(242,52,69)",Enable:true},{Value:0.382,Color:"rgb(255,152,0)",Enable:true},{Value:0.5,Color:"rgb(76,175,80)",Enable:true},{Value:0.618,Color:"rgb(8,153,129)",Enable:true},{Value:0.75,Color:"rgb(0,188,212)",Enable:true},{Value:1,Color:"rgb(120,123,134)",Enable:true}],AryXData:[{Value:0,Color:"rgb(128,128,128)",Enable:true},{Value:0.25,Color:"rgb(242,52,69)",Enable:true},{Value:0.382,Color:"rgb(255,152,0)",Enable:true},{Value:0.5,Color:"rgb(76,175,80)",Enable:true},{Value:0.618,Color:"rgb(8,153,129)",Enable:true},{Value:0.75,Color:"rgb(0,188,212)",Enable:true},{Value:1,Color:"rgb(120,123,134)",Enable:true}],Opacity:0.3};this.Draw=function(){this.LinePoint=[];if(this.IsFrameMinSize())return;var bCheckXY=false;var drawPoint=this.CalculateDrawPoint({IsCheckX:bCheckXY,IsCheckY:bCheckXY});if(!drawPoint)return;if(drawPoint.length!=2)return;this.ClipFrame();var ptStart=drawPoint[0];var ptEnd=drawPoint[1];this.SetLineWidth();this.DrawBlock(ptEnd,ptStart);this.RestoreLineWidth();this.DrawPoint(drawPoint);//画点
6209
+ this.Canvas.restore();};//获取在第几象限
6210
+ this.GetQuadrant=function(ptStart,ptEnd){if(ptStart.X<ptEnd.X&&ptStart.Y>ptEnd.Y)return 1;else if(ptStart.X>ptEnd.X&&ptStart.Y>ptEnd.Y)return 2;else if(ptStart.X<ptEnd.X&&ptStart.Y<ptEnd.Y)return 4;else return 3;};this.DrawBlock=function(ptStart,ptEnd){var center=ptEnd;var xDiff=ptEnd.X-ptStart.X;var yDiff=ptEnd.Y-ptStart.Y;var quadrant=this.GetQuadrant(center,ptStart);//象限
6211
+ var aryYData=this.GetArrayAreaConfig(this.AreaConfig.AryYData);var ptPre=null;//上一个点
6212
+ var clrArea=null;this.Canvas.font=this.Font;var textOffset=4;if(quadrant==1||quadrant==4){this.Canvas.textAlign="right";textOffset=-4;}else{this.Canvas.textAlign="left";textOffset=4;}this.Canvas.textBaseline="middle";for(var i=0;i<aryYData.length;++i){var item=aryYData[i];var y=item.Value*yDiff+ptStart.Y;var pt=this.CalculateExtendLineEndPoint([center,{X:ptStart.X,Y:y}]);if(ptPre){this.Canvas.beginPath();this.Canvas.moveTo(center.X,center.Y);this.Canvas.lineTo(ptPre.X,ptPre.Y);this.Canvas.lineTo(pt.X,pt.Y);this.Canvas.closePath();this.Canvas.fillStyle=clrArea;this.Canvas.fill();}this.Canvas.strokeStyle=item.Color;this.Canvas.beginPath();this.Canvas.moveTo(center.X,center.Y);this.Canvas.lineTo(pt.X,pt.Y);this.Canvas.stroke();this.LinePoint.push({Start:center,End:pt});if(item.Value!=1){this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(center.X,y);this.Canvas.lineTo(ptStart.X,y);this.Canvas.stroke();}ptPre=pt;clrArea=IChartDrawPicture.ColorToRGBA(item.Color,this.AreaConfig.Opacity);//文字
6213
+ var text=''+item.Value;this.Canvas.fillStyle=item.Color;this.Canvas.fillText(text,center.X+textOffset,y);}var aryXData=this.GetArrayAreaConfig(this.AreaConfig.AryXData);var ptPre=null;this.Canvas.textAlign="center";if(quadrant==3||quadrant==4){this.Canvas.textBaseline="bottom";textOffset=-5;}else{this.Canvas.textBaseline="top";textOffset=5;}for(var i=0;i<aryXData.length;++i){var item=aryXData[i];var x=item.Value*xDiff+ptStart.X;var pt=this.CalculateExtendLineEndPoint([center,{X:x,Y:ptStart.Y}]);if(ptPre)//面积
6214
+ {this.Canvas.beginPath();this.Canvas.moveTo(center.X,center.Y);this.Canvas.lineTo(ptPre.X,ptPre.Y);this.Canvas.lineTo(pt.X,pt.Y);this.Canvas.closePath();this.Canvas.fillStyle=clrArea;this.Canvas.fill();}this.Canvas.strokeStyle=item.Color;this.Canvas.beginPath();this.Canvas.moveTo(center.X,center.Y);this.Canvas.lineTo(pt.X,pt.Y);this.Canvas.stroke();this.LinePoint.push({Start:center,End:pt});if(item.Value!=1){this.Canvas.strokeStyle=this.LineColor;this.Canvas.beginPath();this.Canvas.moveTo(x,center.Y);this.Canvas.lineTo(x,ptStart.Y);this.Canvas.stroke();}ptPre=pt;clrArea=IChartDrawPicture.ColorToRGBA(item.Color,this.AreaConfig.Opacity);//文字
6215
+ var text=''+item.Value;this.Canvas.fillStyle=item.Color;this.Canvas.fillText(text,x,center.Y+textOffset);}};this.GetArrayAreaConfig=function(aryData){var aryArea=[];for(var i=0;i<aryData.length;++i){var item=aryData[i];if(item.Enable)aryArea.push(item);}aryArea.sort(function(left,right){return right.Value-left.Value;});return aryArea;};}function ChartDrawStorage(){this.DrawData=new _map2.default();//画图工具数据 key=symbol-Period, value=Map() Key:Guid, Value:{Guid, Symbol, Period, ClassName, Value}
6172
6216
  this.StorageKey;this.GetEventCallback;//事件回调
6173
6217
  this.Load=function(key)//从本地读取画图工具
6174
6218
  {if(!key)return;this.StorageKey=key;var cacheValue=localStorage[this.StorageKey];JSConsole.Chart.Log('[ChartDrawStorage::Load] Load to localStorage, key='+this.StorageKey+', cache='+cacheValue);if(!cacheValue)return;if(typeof cacheValue!="string")return;var saveData=JSON.parse(cacheValue);for(var i in saveData){var item=saveData[i];var drawMap=new _map2.default();for(var j in item.Value){var drawItem=item.Value[j];drawMap.set(drawItem.Key,drawItem.Value);}this.DrawData.set(item.Key,drawMap);}};this.Save=function()//把数据保存到本地
@@ -7504,7 +7548,8 @@ var MoveStatus={X:x,Y:y,IsInClient:this.IsMouseOnClient(x,y)};this.LastMouseStat
7504
7548
  var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MOUSE_MOVE);var titleChart=this.TitlePaint[0];if(event&&titleChart)titleChart.OnMouseMoveEvent=event;this.MoveOnPoint={X:x,Y:y};this.OnMouseMove(x,y,{});this.LastMouseStatus.MoveOnPoint=null;if(titleChart)titleChart.OnMouseMoveEvent=null;}};this.SendPageChangedEvent=function(){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_MINUTE_PAGE_CHANGED);//选中画图工具事件
7505
7549
  if(!event||!event.Callback)return;var sendData={DayOffset:this.DayOffset,DayData:this.DayData};event.Callback(event,sendData,this);};this.IsMouseOnClient=function(x,y){var border=this.Frame.IsHScreen?this.Frame.ChartBorder.GetHScreenBorder():this.Frame.ChartBorder.GetBorder();var rect={Left:border.Left,Top:border.Top,Right:border.Right,Bottom:border.Bottom};if(x>=rect.Left&&x<=rect.Right&&y>=rect.Top&&y<=rect.Bottom)return true;return false;};//左右拖拽
7506
7550
  this.OnDragMode_One=function(moveData,e){var drag=this.MouseDrag;var moveSetp=moveData.X;var yMoveSetp=moveData.Y;if(this.RectSelectDrag&&this.RectSelectDrag.Index>=0)//区间选择
7507
- {if(moveSetp<5)return;var obj={X:e.clientX,Y:e.clientY,PointIndex:this.RectSelectDrag.Index,Name:"MoveRectSelectLine"};if(this.MoveRectSelectPoint(obj)){drag.LastMove.X=e.clientX;this.Draw();}}else{if(moveSetp<5&&yMoveSetp<5)return;if(!this.EnableSelectRect)return;this.UIElement.style.cursor="default";var x=drag.Click.X-uielement.getBoundingClientRect().left;var y=drag.Click.Y-uielement.getBoundingClientRect().top;var x2=e.clientX-uielement.getBoundingClientRect().left;var y2=e.clientY-uielement.getBoundingClientRect().top;this.ShowSelectRect(x,y,x2,y2);drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.OnMinuteSelectRectMouseUp=function(e){var drag=this.MouseDrag;drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;var selectData=new SelectRectData();var pixelTatio=GetDevicePixelRatio();//区间起始位置 结束位子
7551
+ {if(moveSetp<5)return;var obj={X:e.clientX,Y:e.clientY,PointIndex:this.RectSelectDrag.Index,Name:"MoveRectSelectLine"};if(this.MoveRectSelectPoint(obj)){drag.LastMove.X=e.clientX;this.Draw();}}else{if(moveSetp<5&&yMoveSetp<5)return;if(!this.EnableSelectRect)return;//this.UIElement.style.cursor="default";
7552
+ this.SetCursor({Cursor:"default"});var x=drag.Click.X-uielement.getBoundingClientRect().left;var y=drag.Click.Y-uielement.getBoundingClientRect().top;var x2=e.clientX-uielement.getBoundingClientRect().left;var y2=e.clientY-uielement.getBoundingClientRect().top;this.ShowSelectRect(x,y,x2,y2);drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;}};this.OnMinuteSelectRectMouseUp=function(e){var drag=this.MouseDrag;drag.LastMove.X=e.clientX;drag.LastMove.Y=e.clientY;var selectData=new SelectRectData();var pixelTatio=GetDevicePixelRatio();//区间起始位置 结束位子
7508
7553
  selectData.XStart=(drag.Click.X-uielement.getBoundingClientRect().left)*pixelTatio;selectData.YStart=(drag.Click.Y-uielement.getBoundingClientRect().top)*pixelTatio;selectData.XEnd=(drag.LastMove.X-uielement.getBoundingClientRect().left)*pixelTatio;selectData.YEnd=(drag.LastMove.Y-uielement.getBoundingClientRect().top)*pixelTatio;selectData.JSChartContainer=this;selectData.Stock={Symbol:this.Symbol,Name:this.Name};if(this.EnableSelectRect&&!this.BorderDrag&&this.GetSelectRectData(selectData)){var event=this.GetEventCallback(JSCHART_EVENT_ID.ON_SELECT_RECT);var paint=this.GetRectSelectPaint();var isShowDialog=true;//是否显示内置区间选择框
7509
7554
  if(event&&event.Callback){var data={X:drag.LastMove.X-uielement.getBoundingClientRect().left,Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,SelectData:selectData,//区间选择的数据
7510
7555
  RectSelectPaint:paint,//区间选择背景
@@ -8850,7 +8895,7 @@ if(MARKET_SUFFIX_NAME.IsHSX(upperSymbol))return this.GetHSX(upperSymbol);if(MARK
8850
8895
  {var splitData=g_IPETimeData.GetSplitData(upperSymbol);if(!splitData)return null;return this.GetFutures(splitData);}};}//走势图刻度分钟线
8851
8896
  function MinuteCoordinateData(){//沪深走势图时间刻度
8852
8897
  var SHZE_MINUTE_X_COORDINATE={Full://完整模式
8853
- [[0,0,"rgb(200,200,200)","09:30"],//[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色
8898
+ [[0,0,"rgb(200,200,200)","09:30"],//[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色 [5]=背景色
8854
8899
  [31,0,"RGB(200,200,200)","10:00"],[61,0,"RGB(200,200,200)","10:30"],[91,0,"RGB(200,200,200)","11:00"],[122,1,"RGB(200,200,200)","13:00"],[152,0,"RGB(200,200,200)","13:30"],[182,0,"RGB(200,200,200)","14:00"],[212,0,"RGB(200,200,200)","14:30"],[242,1,"RGB(200,200,200)","15:00"]],Simple://简洁模式
8855
8900
  [[0,0,"rgb(200,200,200)","09:30"],[61,0,"RGB(200,200,200)","10:30"],[122,1,"RGB(200,200,200)","13:00"],[182,0,"RGB(200,200,200)","14:00"],[242,1,"RGB(200,200,200)","15:00"]],Min://最小模式
8856
8901
  [[0,0,"rgb(200,200,200)","09:30"],[122,1,"RGB(200,200,200)","13:00"],[242,1,"RGB(200,200,200)","15:00"]],Count:243,MiddleCount:122,GetData:function GetData(width){if(width<200)return this.Min;else if(width<400)return this.Simple;return this.Full;}};//上海股票期权时间刻度
@@ -12589,7 +12634,7 @@ function HQChartScriptWorker(){this.Create=function(){var _this60=this;addEventL
12589
12634
  hisData.Symbol=message.symbol;}var stockObj={HQDataType:HQ_DATA_TYPE.KLINE_ID,Stock:{Symbol:message.Symbol},Request:{MaxDataCount:500,MaxMinuteDayCount:5},Period:message.Period,Right:message.Right,Data:hisData};if(IFrameSplitOperator.IsNumber(message.HQDataType))stockObj.HQDataType=message.HQDataType;indexConsole.ExecuteScript(stockObj);};this.OnRecvMessage=function(message){var data=message.data;if(!data)return;if(data.ID==JSCHART_WORKER_MESSAGE_ID.EXECUTE_SCRIPT){if(!IFrameSplitOperator.IsNonEmptyArray(data.AryIndex))return;for(var i=0;i<data.AryIndex.length;++i){var item=data.AryIndex[i];this.ExecuteScript(item,data);}}};this.OnExecuteFinish=function(data,indexInfo,jsExectute){var message={Data:data,IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.FINISH_EXECUTE_SCRIPT};postMessage(message);};this.OnExecuteError=function(error,indexInfo){var message={IndexInfo:indexInfo,ID:JSCHART_WORKER_MESSAGE_ID.ERROR_EXECUTE_SCRIPT,Error:error};postMessage(message);};}/********************************************************************************
12590
12635
  * 版本信息输出
12591
12636
  *
12592
- */var HQCHART_VERSION="1.1.12512";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
12637
+ */var HQCHART_VERSION="1.1.12521";function PrintHQChartVersion(){var log='*************************************************************************************************************\n*\n* HQChart Ver: '+HQCHART_VERSION+' \n* \n* License: Apache License 2.0 \n* Source: https://github.com/jones2000/HQChart\n*\n*************************************************************************************************************\n';console.log(log);}PrintHQChartVersion();//把给外界调用的方法暴露出来
12593
12638
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
12594
12639
  // BaseIndex:BaseIndex,
12595
12640
  // ChartLine:ChartLine,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "hqchart",
3
3
  "description": "stock chart",
4
4
  "author": "jones2000",
5
- "version": "1.1.12513",
5
+ "version": "1.1.12522",
6
6
  "main": "lib/main.js",
7
7
  "private": false,
8
8
  "license": "Apache License 2.0",