hqchart 1.1.12513 → 1.1.12516

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轴坐标信息
@@ -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
@@ -7504,7 +7526,8 @@ var MoveStatus={X:x,Y:y,IsInClient:this.IsMouseOnClient(x,y)};this.LastMouseStat
7504
7526
  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
7527
  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
7528
  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();//区间起始位置 结束位子
7529
+ {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";
7530
+ 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
7531
  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
7532
  if(event&&event.Callback){var data={X:drag.LastMove.X-uielement.getBoundingClientRect().left,Y:drag.LastMove.Y-uielement.getBoundingClientRect().top,SelectData:selectData,//区间选择的数据
7510
7533
  RectSelectPaint:paint,//区间选择背景
@@ -8850,7 +8873,7 @@ if(MARKET_SUFFIX_NAME.IsHSX(upperSymbol))return this.GetHSX(upperSymbol);if(MARK
8850
8873
  {var splitData=g_IPETimeData.GetSplitData(upperSymbol);if(!splitData)return null;return this.GetFutures(splitData);}};}//走势图刻度分钟线
8851
8874
  function MinuteCoordinateData(){//沪深走势图时间刻度
8852
8875
  var SHZE_MINUTE_X_COORDINATE={Full://完整模式
8853
- [[0,0,"rgb(200,200,200)","09:30"],//[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色
8876
+ [[0,0,"rgb(200,200,200)","09:30"],//[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色 [5]=背景色
8854
8877
  [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
8878
  [[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
8879
  [[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 +12612,7 @@ function HQChartScriptWorker(){this.Create=function(){var _this60=this;addEventL
12589
12612
  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
12613
  * 版本信息输出
12591
12614
  *
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();//把给外界调用的方法暴露出来
12615
+ */var HQCHART_VERSION="1.1.12515";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
12616
  exports.default=(_jsChartInit$jsChartS={jsChartInit:JSChart.Init,jsChartStyle:JSChart.SetStyle,// IsIndexSymbol:IsIndexSymbol,
12594
12617
  // BaseIndex:BaseIndex,
12595
12618
  // 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.12516",
6
6
  "main": "lib/main.js",
7
7
  "private": false,
8
8
  "license": "Apache License 2.0",
@@ -1588,6 +1588,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
1588
1588
 
1589
1589
  this.JSChartContainer=chart;
1590
1590
 
1591
+ if (option.DefaultCursor) chart.DefaultCursor=option.DefaultCursor;
1591
1592
  if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
1592
1593
 
1593
1594
  //是否自动更新
@@ -2693,6 +2694,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
2693
2694
  this.IsClickShowCorssCursor=false; //手势点击显示十字光标
2694
2695
  this.ChartSplashPaint=null; //等待提示
2695
2696
  this.LoadDataSplashTitle="数据加载中"; //下载数据提示信息
2697
+ this.DefaultCursor="default"; //crosshair , default 默认手型
2696
2698
 
2697
2699
  //绘图缓存
2698
2700
  this.CacheCanvas=null;
@@ -3172,7 +3174,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3172
3174
  event.Callback(event, sendData, this);
3173
3175
  this.CustomChartDrag=sendData.ChartDrag;
3174
3176
 
3175
- if (sendData.Cusrsor) this.UIElement.style.cursor=sendData.Cusrsor;
3177
+ this.SetCursor(sendData);
3176
3178
  }
3177
3179
 
3178
3180
  this.TryDragMove_CustomChartDrag=function(sendData)
@@ -3251,7 +3253,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3251
3253
  {
3252
3254
  if (item.Type==4)
3253
3255
  {
3254
- this.UIElement.style.cursor="pointer";
3256
+ //this.UIElement.style.cursor="pointer";
3257
+ this.SetCursor({Cursor:"pointer"});
3255
3258
  var obj={ X:e.clientX };
3256
3259
  if (this.GetXDataIndex(obj))
3257
3260
  {
@@ -3261,7 +3264,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3261
3264
  }
3262
3265
  else
3263
3266
  {
3264
- this.UIElement.style.cursor="ew-resize";
3267
+ //this.UIElement.style.cursor="ew-resize";
3268
+ this.SetCursor({Cursor:"ew-resize"});
3265
3269
  this.RectSelectDrag={ Index:item.PointIndex, Type:item.Type };
3266
3270
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag rect select ",item);
3267
3271
  }
@@ -3275,7 +3279,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3275
3279
  var dragBorder=this.Frame.PtInFrameBorder(x,y);
3276
3280
  if (dragBorder && dragBorder.Index>=0)
3277
3281
  {
3278
- this.UIElement.style.cursor="n-resize";
3282
+ //this.UIElement.style.cursor="n-resize";
3283
+ this.SetCursor({Cursor:"n-resize"});
3279
3284
  this.BorderDrag={ Index:dragBorder.Index };
3280
3285
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] DragBorder ",dragBorder);
3281
3286
  }
@@ -3287,7 +3292,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3287
3292
  var dragY=this.TryYDrag(x,y);
3288
3293
  if (dragY)
3289
3294
  {
3290
- this.UIElement.style.cursor=dragY.Position==0 ? "n-resize":"row-resize";
3295
+ //this.UIElement.style.cursor=dragY.Position==0 ? "n-resize":"row-resize";
3296
+ var cursor=dragY.Position==0 ? "n-resize":"row-resize";
3297
+ this.SetCursor({Cursor:cursor});
3291
3298
  this.YDrag=dragY;
3292
3299
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragY ",dragY);
3293
3300
  }
@@ -3296,7 +3303,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3296
3303
  var dragUpDown=this.TryUpDownDrag(x,y);
3297
3304
  if (dragUpDown)
3298
3305
  {
3299
- this.UIElement.style.cursor="pointer";
3306
+ //this.UIElement.style.cursor="pointer";
3307
+ this.SetCursor({Cursor:"pointer"});
3300
3308
  this.UpDownDrag=dragUpDown;
3301
3309
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragUpDown ",dragUpDown);
3302
3310
  }
@@ -3619,8 +3627,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3619
3627
 
3620
3628
  if (moveSetp<5 && yMoveSetp<5) return;
3621
3629
 
3622
- this.UIElement.style.cursor="default";
3623
-
3630
+ //this.UIElement.style.cursor="default";
3631
+ this.SetCursor({Cursor:"default"});
3624
3632
  var x=drag.Click.X-uielement.getBoundingClientRect().left;
3625
3633
  var y=drag.Click.Y-uielement.getBoundingClientRect().top;
3626
3634
  var x2=e.clientX-uielement.getBoundingClientRect().left;
@@ -3649,7 +3657,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3649
3657
  {
3650
3658
  var yMove=e.clientY-drag.LastMove.Y;
3651
3659
  JSConsole.Chart.Log("[JSChartContainer::OnDragMode_One] UpDownDrag ",this.UpDownDrag,yMove);
3652
- this.UIElement.style.cursor="pointer";
3660
+ //this.UIElement.style.cursor="pointer";
3661
+ this.SetCursor({Cursor:"pointer"});
3653
3662
  if (this.OnUpDonwFrameY(this.UpDownDrag, yMove))
3654
3663
  {
3655
3664
  bNeedDraw=true;
@@ -3696,7 +3705,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3696
3705
  var oneStepWidth=this.GetMoveOneStepWidth();
3697
3706
  if (moveSetp<oneStepWidth)
3698
3707
  {
3699
- this.UIElement.style.cursor=cursorStatus;
3708
+ //this.UIElement.style.cursor=cursorStatus;
3709
+ this.SetCursor({Cursor:cursorStatus});
3700
3710
  if (bNeedDraw) this.Draw();
3701
3711
  return;
3702
3712
  }
@@ -3726,7 +3736,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3726
3736
  if (this.DragDownloadData) this.DragDownloadData();
3727
3737
  }
3728
3738
  }
3729
- this.UIElement.style.cursor=cursorStatus;
3739
+ //this.UIElement.style.cursor=cursorStatus;
3740
+ this.SetCursor({Cursor:cursorStatus});
3730
3741
  }
3731
3742
  drag.LastMove.X=e.clientX;
3732
3743
  }
@@ -3794,7 +3805,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3794
3805
  var chartMove=this.GetExtendChartByClassName("DragMovePaint");
3795
3806
  if (chartMove && chartMove.Chart) chartMove.Chart.Clear();
3796
3807
  if (!this.OnDragChart(this.IndexChartDrag)) this.DrawDynamicInfo();
3797
- this.UIElement.style.cursor="default";
3808
+ //this.UIElement.style.cursor="default";
3809
+ this.SetCursor({Cursor:"default"});
3798
3810
  }
3799
3811
  else if (this.CustomChartDrag)
3800
3812
  {
@@ -3884,7 +3896,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
3884
3896
  //清空数据
3885
3897
  JSConsole.Chart.Log('[KLineChartContainer::document.onmouseup]',e);
3886
3898
  if (this.SelectChartDrawPicture) this.SelectChartDrawPicture.DragInfo=null;
3887
- this.UIElement.style.cursor="default";
3899
+ //this.UIElement.style.cursor="default";
3900
+ this.SetCursor({Cursor:"default"});
3888
3901
  this.MouseDrag=null;
3889
3902
  this.ClickDownPoint=null;
3890
3903
  this.IsOnTouch=false;
@@ -5719,7 +5732,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5719
5732
  var frameID=this.Frame.PtInFrame(x,y);
5720
5733
  if (IFrameSplitOperator.IsNumber(frameID) && frameID>=0) //在K线内部移动,调整K线索引
5721
5734
  this.CursorIndex=this.Frame.GetXData(x);
5722
-
5723
5735
 
5724
5736
 
5725
5737
  if (this.EnableBorderDrag && this.Frame && !this.CurrentChartDrawPicture)
@@ -5842,13 +5854,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5842
5854
 
5843
5855
  if (drawPictrueData.PointIndex===100)
5844
5856
  {
5845
- if (drawPictrueData.Cursor) this.UIElement.style.cursor=drawPictrueData.Cursor;
5846
- else this.UIElement.style.cursor="move";
5857
+ if (drawPictrueData.Cursor) this.SetCursor(drawPictrueData); //this.UIElement.style.cursor=drawPictrueData.Cursor;
5858
+ else this.SetCursor({Cursor:"move"}); //this.UIElement.style.cursor="move";
5847
5859
  }
5848
5860
  else
5849
5861
  {
5850
- if (drawPictrueData.Cursor) this.UIElement.style.cursor=drawPictrueData.Cursor
5851
- else this.UIElement.style.cursor="pointer";
5862
+ if (drawPictrueData.Cursor) this.SetCursor(drawPictrueData); //this.UIElement.style.cursor=drawPictrueData.Cursor
5863
+ else this.SetCursor({Cursor:"pointer"}); //this.UIElement.style.cursor="pointer";
5852
5864
  }
5853
5865
 
5854
5866
  bDrawPicture=true;
@@ -5856,7 +5868,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5856
5868
  }
5857
5869
  else
5858
5870
  {
5859
- if (!this.MouseDrag) this.UIElement.style.cursor="default";
5871
+ if (!this.MouseDrag) this.SetCursor({Cursor:"default"}); //this.UIElement.style.cursor="default";
5860
5872
  }
5861
5873
  }
5862
5874
 
@@ -5879,7 +5891,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5879
5891
  this.DrawDynamicInfo(option);
5880
5892
  }
5881
5893
 
5882
- if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
5894
+ this.SetCursor(mouseStatus);
5883
5895
 
5884
5896
  if (this.IsShowTooltip && bDrawPicture==false)
5885
5897
  {
@@ -5907,6 +5919,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
5907
5919
  }
5908
5920
  }
5909
5921
 
5922
+ //设置鼠标形状 {Cursor:鼠标形状 }
5923
+ this.SetCursor=function(obj)
5924
+ {
5925
+ if (!obj || !obj.Cursor) return;
5926
+
5927
+ if (obj.Cursor=="default")
5928
+ this.UIElement.style.cursor=this.DefaultCursor;
5929
+ else
5930
+ this.UIElement.style.cursor=obj.Cursor;
5931
+ }
5932
+
5910
5933
  this.OnKeyDown=function(e)
5911
5934
  {
5912
5935
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
@@ -8660,6 +8683,7 @@ function CoordinateInfo()
8660
8683
  this.Value; //坐标数据
8661
8684
  this.Message=[]; //坐标输出文字信息 0=左 1=右 2=内左 3=内右
8662
8685
  this.TextColor=g_JSChartResource.FrameSplitTextColor //文字颜色
8686
+ this.TextBGColor; //文字背景色
8663
8687
  this.TextColor2; //右侧文字颜色,空使用TextColor
8664
8688
  this.Font=g_JSChartResource.FrameSplitTextFont; //字体
8665
8689
  this.LineColor=g_JSChartResource.FrameSplitPen; //线段颜色
@@ -10172,9 +10196,10 @@ function AverageWidthFrame()
10172
10196
  this.Canvas.font=this.VerticalInfo[i].Font;
10173
10197
 
10174
10198
  var textLeft=0;
10175
- this.Canvas.fillStyle=item.TextColor;
10199
+
10176
10200
  this.Canvas.strokeStyle=item.TextColor;
10177
10201
  var testWidth=this.Canvas.measureText(this.VerticalInfo[i].Message[0]).width;
10202
+ var textHeight=this.Canvas.measureText("擎").width;
10178
10203
  if (x<testWidth/2)
10179
10204
  {
10180
10205
  this.Canvas.textAlign="left";
@@ -10208,6 +10233,15 @@ function AverageWidthFrame()
10208
10233
  yText+=lineLength+2*pixelRatio;
10209
10234
  }
10210
10235
 
10236
+ //item.TextBGColor="rgb(0,255,0)";
10237
+ if (item.TextBGColor) //文字背景色
10238
+ {
10239
+ var rtText={ Left:textLeft, Top:yText+this.XBottomOffset, Width:testWidth, Height:textHeight };
10240
+ this.Canvas.fillStyle=item.TextBGColor;
10241
+ this.Canvas.fillRect(rtText.Left-1, rtText.Top, rtText.Width+2, rtText.Height);
10242
+ }
10243
+
10244
+ this.Canvas.fillStyle=item.TextColor;
10211
10245
  this.Canvas.fillText(this.VerticalInfo[i].Message[0],x,yText+this.XBottomOffset);
10212
10246
  textRightPrev=textLeft+testWidth;
10213
10247
  }
@@ -44722,6 +44756,7 @@ function FrameSplitMinuteX()
44722
44756
  info.Value=item[0];
44723
44757
  if (this.ShowText) info.Message[0]=item[3];
44724
44758
  if (item[4]) info.LineColor=item[4]; //线段颜色
44759
+ if (item[5]) info.TextBGColor=item[5]; //文字背景色
44725
44760
  this.Frame.VerticalInfo[i]=info;
44726
44761
  }
44727
44762
  }
@@ -70798,7 +70833,8 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
70798
70833
  if (moveSetp<5 && yMoveSetp<5) return;
70799
70834
  if (!this.EnableSelectRect) return;
70800
70835
 
70801
- this.UIElement.style.cursor="default";
70836
+ //this.UIElement.style.cursor="default";
70837
+ this.SetCursor({Cursor:"default"});
70802
70838
  var x=drag.Click.X-uielement.getBoundingClientRect().left;
70803
70839
  var y=drag.Click.Y-uielement.getBoundingClientRect().top;
70804
70840
  var x2=e.clientX-uielement.getBoundingClientRect().left;
@@ -85740,7 +85776,7 @@ function MinuteCoordinateData()
85740
85776
  {
85741
85777
  Full: //完整模式
85742
85778
  [
85743
- [0, 0, "rgb(200,200,200)", "09:30"], //[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色
85779
+ [0, 0, "rgb(200,200,200)", "09:30"], //[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色 [5]=背景色
85744
85780
  [31, 0, "RGB(200,200,200)", "10:00"],
85745
85781
  [61, 0, "RGB(200,200,200)", "10:30"],
85746
85782
  [91, 0, "RGB(200,200,200)", "11:00"],
@@ -5668,6 +5668,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5668
5668
 
5669
5669
  this.JSChartContainer=chart;
5670
5670
 
5671
+ if (option.DefaultCursor) chart.DefaultCursor=option.DefaultCursor;
5671
5672
  if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
5672
5673
 
5673
5674
  //是否自动更新
@@ -6773,6 +6774,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6773
6774
  this.IsClickShowCorssCursor=false; //手势点击显示十字光标
6774
6775
  this.ChartSplashPaint=null; //等待提示
6775
6776
  this.LoadDataSplashTitle="数据加载中"; //下载数据提示信息
6777
+ this.DefaultCursor="default"; //crosshair , default 默认手型
6776
6778
 
6777
6779
  //绘图缓存
6778
6780
  this.CacheCanvas=null;
@@ -7252,7 +7254,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7252
7254
  event.Callback(event, sendData, this);
7253
7255
  this.CustomChartDrag=sendData.ChartDrag;
7254
7256
 
7255
- if (sendData.Cusrsor) this.UIElement.style.cursor=sendData.Cusrsor;
7257
+ this.SetCursor(sendData);
7256
7258
  }
7257
7259
 
7258
7260
  this.TryDragMove_CustomChartDrag=function(sendData)
@@ -7331,7 +7333,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7331
7333
  {
7332
7334
  if (item.Type==4)
7333
7335
  {
7334
- this.UIElement.style.cursor="pointer";
7336
+ //this.UIElement.style.cursor="pointer";
7337
+ this.SetCursor({Cursor:"pointer"});
7335
7338
  var obj={ X:e.clientX };
7336
7339
  if (this.GetXDataIndex(obj))
7337
7340
  {
@@ -7341,7 +7344,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7341
7344
  }
7342
7345
  else
7343
7346
  {
7344
- this.UIElement.style.cursor="ew-resize";
7347
+ //this.UIElement.style.cursor="ew-resize";
7348
+ this.SetCursor({Cursor:"ew-resize"});
7345
7349
  this.RectSelectDrag={ Index:item.PointIndex, Type:item.Type };
7346
7350
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag rect select ",item);
7347
7351
  }
@@ -7355,7 +7359,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7355
7359
  var dragBorder=this.Frame.PtInFrameBorder(x,y);
7356
7360
  if (dragBorder && dragBorder.Index>=0)
7357
7361
  {
7358
- this.UIElement.style.cursor="n-resize";
7362
+ //this.UIElement.style.cursor="n-resize";
7363
+ this.SetCursor({Cursor:"n-resize"});
7359
7364
  this.BorderDrag={ Index:dragBorder.Index };
7360
7365
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] DragBorder ",dragBorder);
7361
7366
  }
@@ -7367,7 +7372,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7367
7372
  var dragY=this.TryYDrag(x,y);
7368
7373
  if (dragY)
7369
7374
  {
7370
- this.UIElement.style.cursor=dragY.Position==0 ? "n-resize":"row-resize";
7375
+ //this.UIElement.style.cursor=dragY.Position==0 ? "n-resize":"row-resize";
7376
+ var cursor=dragY.Position==0 ? "n-resize":"row-resize";
7377
+ this.SetCursor({Cursor:cursor});
7371
7378
  this.YDrag=dragY;
7372
7379
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragY ",dragY);
7373
7380
  }
@@ -7376,7 +7383,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7376
7383
  var dragUpDown=this.TryUpDownDrag(x,y);
7377
7384
  if (dragUpDown)
7378
7385
  {
7379
- this.UIElement.style.cursor="pointer";
7386
+ //this.UIElement.style.cursor="pointer";
7387
+ this.SetCursor({Cursor:"pointer"});
7380
7388
  this.UpDownDrag=dragUpDown;
7381
7389
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragUpDown ",dragUpDown);
7382
7390
  }
@@ -7699,8 +7707,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7699
7707
 
7700
7708
  if (moveSetp<5 && yMoveSetp<5) return;
7701
7709
 
7702
- this.UIElement.style.cursor="default";
7703
-
7710
+ //this.UIElement.style.cursor="default";
7711
+ this.SetCursor({Cursor:"default"});
7704
7712
  var x=drag.Click.X-uielement.getBoundingClientRect().left;
7705
7713
  var y=drag.Click.Y-uielement.getBoundingClientRect().top;
7706
7714
  var x2=e.clientX-uielement.getBoundingClientRect().left;
@@ -7729,7 +7737,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7729
7737
  {
7730
7738
  var yMove=e.clientY-drag.LastMove.Y;
7731
7739
  JSConsole.Chart.Log("[JSChartContainer::OnDragMode_One] UpDownDrag ",this.UpDownDrag,yMove);
7732
- this.UIElement.style.cursor="pointer";
7740
+ //this.UIElement.style.cursor="pointer";
7741
+ this.SetCursor({Cursor:"pointer"});
7733
7742
  if (this.OnUpDonwFrameY(this.UpDownDrag, yMove))
7734
7743
  {
7735
7744
  bNeedDraw=true;
@@ -7776,7 +7785,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7776
7785
  var oneStepWidth=this.GetMoveOneStepWidth();
7777
7786
  if (moveSetp<oneStepWidth)
7778
7787
  {
7779
- this.UIElement.style.cursor=cursorStatus;
7788
+ //this.UIElement.style.cursor=cursorStatus;
7789
+ this.SetCursor({Cursor:cursorStatus});
7780
7790
  if (bNeedDraw) this.Draw();
7781
7791
  return;
7782
7792
  }
@@ -7806,7 +7816,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7806
7816
  if (this.DragDownloadData) this.DragDownloadData();
7807
7817
  }
7808
7818
  }
7809
- this.UIElement.style.cursor=cursorStatus;
7819
+ //this.UIElement.style.cursor=cursorStatus;
7820
+ this.SetCursor({Cursor:cursorStatus});
7810
7821
  }
7811
7822
  drag.LastMove.X=e.clientX;
7812
7823
  }
@@ -7874,7 +7885,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7874
7885
  var chartMove=this.GetExtendChartByClassName("DragMovePaint");
7875
7886
  if (chartMove && chartMove.Chart) chartMove.Chart.Clear();
7876
7887
  if (!this.OnDragChart(this.IndexChartDrag)) this.DrawDynamicInfo();
7877
- this.UIElement.style.cursor="default";
7888
+ //this.UIElement.style.cursor="default";
7889
+ this.SetCursor({Cursor:"default"});
7878
7890
  }
7879
7891
  else if (this.CustomChartDrag)
7880
7892
  {
@@ -7964,7 +7976,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7964
7976
  //清空数据
7965
7977
  JSConsole.Chart.Log('[KLineChartContainer::document.onmouseup]',e);
7966
7978
  if (this.SelectChartDrawPicture) this.SelectChartDrawPicture.DragInfo=null;
7967
- this.UIElement.style.cursor="default";
7979
+ //this.UIElement.style.cursor="default";
7980
+ this.SetCursor({Cursor:"default"});
7968
7981
  this.MouseDrag=null;
7969
7982
  this.ClickDownPoint=null;
7970
7983
  this.IsOnTouch=false;
@@ -9799,7 +9812,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9799
9812
  var frameID=this.Frame.PtInFrame(x,y);
9800
9813
  if (IFrameSplitOperator.IsNumber(frameID) && frameID>=0) //在K线内部移动,调整K线索引
9801
9814
  this.CursorIndex=this.Frame.GetXData(x);
9802
-
9803
9815
 
9804
9816
 
9805
9817
  if (this.EnableBorderDrag && this.Frame && !this.CurrentChartDrawPicture)
@@ -9922,13 +9934,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9922
9934
 
9923
9935
  if (drawPictrueData.PointIndex===100)
9924
9936
  {
9925
- if (drawPictrueData.Cursor) this.UIElement.style.cursor=drawPictrueData.Cursor;
9926
- else this.UIElement.style.cursor="move";
9937
+ if (drawPictrueData.Cursor) this.SetCursor(drawPictrueData); //this.UIElement.style.cursor=drawPictrueData.Cursor;
9938
+ else this.SetCursor({Cursor:"move"}); //this.UIElement.style.cursor="move";
9927
9939
  }
9928
9940
  else
9929
9941
  {
9930
- if (drawPictrueData.Cursor) this.UIElement.style.cursor=drawPictrueData.Cursor
9931
- else this.UIElement.style.cursor="pointer";
9942
+ if (drawPictrueData.Cursor) this.SetCursor(drawPictrueData); //this.UIElement.style.cursor=drawPictrueData.Cursor
9943
+ else this.SetCursor({Cursor:"pointer"}); //this.UIElement.style.cursor="pointer";
9932
9944
  }
9933
9945
 
9934
9946
  bDrawPicture=true;
@@ -9936,7 +9948,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9936
9948
  }
9937
9949
  else
9938
9950
  {
9939
- if (!this.MouseDrag) this.UIElement.style.cursor="default";
9951
+ if (!this.MouseDrag) this.SetCursor({Cursor:"default"}); //this.UIElement.style.cursor="default";
9940
9952
  }
9941
9953
  }
9942
9954
 
@@ -9959,7 +9971,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9959
9971
  this.DrawDynamicInfo(option);
9960
9972
  }
9961
9973
 
9962
- if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
9974
+ this.SetCursor(mouseStatus);
9963
9975
 
9964
9976
  if (this.IsShowTooltip && bDrawPicture==false)
9965
9977
  {
@@ -9987,6 +9999,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9987
9999
  }
9988
10000
  }
9989
10001
 
10002
+ //设置鼠标形状 {Cursor:鼠标形状 }
10003
+ this.SetCursor=function(obj)
10004
+ {
10005
+ if (!obj || !obj.Cursor) return;
10006
+
10007
+ if (obj.Cursor=="default")
10008
+ this.UIElement.style.cursor=this.DefaultCursor;
10009
+ else
10010
+ this.UIElement.style.cursor=obj.Cursor;
10011
+ }
10012
+
9990
10013
  this.OnKeyDown=function(e)
9991
10014
  {
9992
10015
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
@@ -12740,6 +12763,7 @@ function CoordinateInfo()
12740
12763
  this.Value; //坐标数据
12741
12764
  this.Message=[]; //坐标输出文字信息 0=左 1=右 2=内左 3=内右
12742
12765
  this.TextColor=g_JSChartResource.FrameSplitTextColor //文字颜色
12766
+ this.TextBGColor; //文字背景色
12743
12767
  this.TextColor2; //右侧文字颜色,空使用TextColor
12744
12768
  this.Font=g_JSChartResource.FrameSplitTextFont; //字体
12745
12769
  this.LineColor=g_JSChartResource.FrameSplitPen; //线段颜色
@@ -14252,9 +14276,10 @@ function AverageWidthFrame()
14252
14276
  this.Canvas.font=this.VerticalInfo[i].Font;
14253
14277
 
14254
14278
  var textLeft=0;
14255
- this.Canvas.fillStyle=item.TextColor;
14279
+
14256
14280
  this.Canvas.strokeStyle=item.TextColor;
14257
14281
  var testWidth=this.Canvas.measureText(this.VerticalInfo[i].Message[0]).width;
14282
+ var textHeight=this.Canvas.measureText("擎").width;
14258
14283
  if (x<testWidth/2)
14259
14284
  {
14260
14285
  this.Canvas.textAlign="left";
@@ -14288,6 +14313,15 @@ function AverageWidthFrame()
14288
14313
  yText+=lineLength+2*pixelRatio;
14289
14314
  }
14290
14315
 
14316
+ //item.TextBGColor="rgb(0,255,0)";
14317
+ if (item.TextBGColor) //文字背景色
14318
+ {
14319
+ var rtText={ Left:textLeft, Top:yText+this.XBottomOffset, Width:testWidth, Height:textHeight };
14320
+ this.Canvas.fillStyle=item.TextBGColor;
14321
+ this.Canvas.fillRect(rtText.Left-1, rtText.Top, rtText.Width+2, rtText.Height);
14322
+ }
14323
+
14324
+ this.Canvas.fillStyle=item.TextColor;
14291
14325
  this.Canvas.fillText(this.VerticalInfo[i].Message[0],x,yText+this.XBottomOffset);
14292
14326
  textRightPrev=textLeft+testWidth;
14293
14327
  }
@@ -48802,6 +48836,7 @@ function FrameSplitMinuteX()
48802
48836
  info.Value=item[0];
48803
48837
  if (this.ShowText) info.Message[0]=item[3];
48804
48838
  if (item[4]) info.LineColor=item[4]; //线段颜色
48839
+ if (item[5]) info.TextBGColor=item[5]; //文字背景色
48805
48840
  this.Frame.VerticalInfo[i]=info;
48806
48841
  }
48807
48842
  }
@@ -74878,7 +74913,8 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
74878
74913
  if (moveSetp<5 && yMoveSetp<5) return;
74879
74914
  if (!this.EnableSelectRect) return;
74880
74915
 
74881
- this.UIElement.style.cursor="default";
74916
+ //this.UIElement.style.cursor="default";
74917
+ this.SetCursor({Cursor:"default"});
74882
74918
  var x=drag.Click.X-uielement.getBoundingClientRect().left;
74883
74919
  var y=drag.Click.Y-uielement.getBoundingClientRect().top;
74884
74920
  var x2=e.clientX-uielement.getBoundingClientRect().left;
@@ -89820,7 +89856,7 @@ function MinuteCoordinateData()
89820
89856
  {
89821
89857
  Full: //完整模式
89822
89858
  [
89823
- [0, 0, "rgb(200,200,200)", "09:30"], //[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色
89859
+ [0, 0, "rgb(200,200,200)", "09:30"], //[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色 [5]=背景色
89824
89860
  [31, 0, "RGB(200,200,200)", "10:00"],
89825
89861
  [61, 0, "RGB(200,200,200)", "10:30"],
89826
89862
  [91, 0, "RGB(200,200,200)", "11:00"],
@@ -128427,7 +128463,7 @@ function ScrollBarBGChart()
128427
128463
 
128428
128464
 
128429
128465
 
128430
- var HQCHART_VERSION="1.1.12512";
128466
+ var HQCHART_VERSION="1.1.12515";
128431
128467
 
128432
128468
  function PrintHQChartVersion()
128433
128469
  {
@@ -5,7 +5,7 @@
5
5
 
6
6
 
7
7
 
8
- var HQCHART_VERSION="1.1.12512";
8
+ var HQCHART_VERSION="1.1.12515";
9
9
 
10
10
  function PrintHQChartVersion()
11
11
  {
@@ -5712,6 +5712,7 @@ function JSChart(divElement, bOffscreen, bCacheCanvas)
5712
5712
 
5713
5713
  this.JSChartContainer=chart;
5714
5714
 
5715
+ if (option.DefaultCursor) chart.DefaultCursor=option.DefaultCursor;
5715
5716
  if (option.OnCreatedCallback) option.OnCreatedCallback(chart);
5716
5717
 
5717
5718
  //是否自动更新
@@ -6817,6 +6818,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
6817
6818
  this.IsClickShowCorssCursor=false; //手势点击显示十字光标
6818
6819
  this.ChartSplashPaint=null; //等待提示
6819
6820
  this.LoadDataSplashTitle="数据加载中"; //下载数据提示信息
6821
+ this.DefaultCursor="default"; //crosshair , default 默认手型
6820
6822
 
6821
6823
  //绘图缓存
6822
6824
  this.CacheCanvas=null;
@@ -7296,7 +7298,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7296
7298
  event.Callback(event, sendData, this);
7297
7299
  this.CustomChartDrag=sendData.ChartDrag;
7298
7300
 
7299
- if (sendData.Cusrsor) this.UIElement.style.cursor=sendData.Cusrsor;
7301
+ this.SetCursor(sendData);
7300
7302
  }
7301
7303
 
7302
7304
  this.TryDragMove_CustomChartDrag=function(sendData)
@@ -7375,7 +7377,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7375
7377
  {
7376
7378
  if (item.Type==4)
7377
7379
  {
7378
- this.UIElement.style.cursor="pointer";
7380
+ //this.UIElement.style.cursor="pointer";
7381
+ this.SetCursor({Cursor:"pointer"});
7379
7382
  var obj={ X:e.clientX };
7380
7383
  if (this.GetXDataIndex(obj))
7381
7384
  {
@@ -7385,7 +7388,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7385
7388
  }
7386
7389
  else
7387
7390
  {
7388
- this.UIElement.style.cursor="ew-resize";
7391
+ //this.UIElement.style.cursor="ew-resize";
7392
+ this.SetCursor({Cursor:"ew-resize"});
7389
7393
  this.RectSelectDrag={ Index:item.PointIndex, Type:item.Type };
7390
7394
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] drag rect select ",item);
7391
7395
  }
@@ -7399,7 +7403,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7399
7403
  var dragBorder=this.Frame.PtInFrameBorder(x,y);
7400
7404
  if (dragBorder && dragBorder.Index>=0)
7401
7405
  {
7402
- this.UIElement.style.cursor="n-resize";
7406
+ //this.UIElement.style.cursor="n-resize";
7407
+ this.SetCursor({Cursor:"n-resize"});
7403
7408
  this.BorderDrag={ Index:dragBorder.Index };
7404
7409
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] DragBorder ",dragBorder);
7405
7410
  }
@@ -7411,7 +7416,9 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7411
7416
  var dragY=this.TryYDrag(x,y);
7412
7417
  if (dragY)
7413
7418
  {
7414
- this.UIElement.style.cursor=dragY.Position==0 ? "n-resize":"row-resize";
7419
+ //this.UIElement.style.cursor=dragY.Position==0 ? "n-resize":"row-resize";
7420
+ var cursor=dragY.Position==0 ? "n-resize":"row-resize";
7421
+ this.SetCursor({Cursor:cursor});
7415
7422
  this.YDrag=dragY;
7416
7423
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragY ",dragY);
7417
7424
  }
@@ -7420,7 +7427,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7420
7427
  var dragUpDown=this.TryUpDownDrag(x,y);
7421
7428
  if (dragUpDown)
7422
7429
  {
7423
- this.UIElement.style.cursor="pointer";
7430
+ //this.UIElement.style.cursor="pointer";
7431
+ this.SetCursor({Cursor:"pointer"});
7424
7432
  this.UpDownDrag=dragUpDown;
7425
7433
  JSConsole.Chart.Log("[JSChartContainer::UIOnMouseDown] dragUpDown ",dragUpDown);
7426
7434
  }
@@ -7743,8 +7751,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7743
7751
 
7744
7752
  if (moveSetp<5 && yMoveSetp<5) return;
7745
7753
 
7746
- this.UIElement.style.cursor="default";
7747
-
7754
+ //this.UIElement.style.cursor="default";
7755
+ this.SetCursor({Cursor:"default"});
7748
7756
  var x=drag.Click.X-uielement.getBoundingClientRect().left;
7749
7757
  var y=drag.Click.Y-uielement.getBoundingClientRect().top;
7750
7758
  var x2=e.clientX-uielement.getBoundingClientRect().left;
@@ -7773,7 +7781,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7773
7781
  {
7774
7782
  var yMove=e.clientY-drag.LastMove.Y;
7775
7783
  JSConsole.Chart.Log("[JSChartContainer::OnDragMode_One] UpDownDrag ",this.UpDownDrag,yMove);
7776
- this.UIElement.style.cursor="pointer";
7784
+ //this.UIElement.style.cursor="pointer";
7785
+ this.SetCursor({Cursor:"pointer"});
7777
7786
  if (this.OnUpDonwFrameY(this.UpDownDrag, yMove))
7778
7787
  {
7779
7788
  bNeedDraw=true;
@@ -7820,7 +7829,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7820
7829
  var oneStepWidth=this.GetMoveOneStepWidth();
7821
7830
  if (moveSetp<oneStepWidth)
7822
7831
  {
7823
- this.UIElement.style.cursor=cursorStatus;
7832
+ //this.UIElement.style.cursor=cursorStatus;
7833
+ this.SetCursor({Cursor:cursorStatus});
7824
7834
  if (bNeedDraw) this.Draw();
7825
7835
  return;
7826
7836
  }
@@ -7850,7 +7860,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7850
7860
  if (this.DragDownloadData) this.DragDownloadData();
7851
7861
  }
7852
7862
  }
7853
- this.UIElement.style.cursor=cursorStatus;
7863
+ //this.UIElement.style.cursor=cursorStatus;
7864
+ this.SetCursor({Cursor:cursorStatus});
7854
7865
  }
7855
7866
  drag.LastMove.X=e.clientX;
7856
7867
  }
@@ -7918,7 +7929,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
7918
7929
  var chartMove=this.GetExtendChartByClassName("DragMovePaint");
7919
7930
  if (chartMove && chartMove.Chart) chartMove.Chart.Clear();
7920
7931
  if (!this.OnDragChart(this.IndexChartDrag)) this.DrawDynamicInfo();
7921
- this.UIElement.style.cursor="default";
7932
+ //this.UIElement.style.cursor="default";
7933
+ this.SetCursor({Cursor:"default"});
7922
7934
  }
7923
7935
  else if (this.CustomChartDrag)
7924
7936
  {
@@ -8008,7 +8020,8 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
8008
8020
  //清空数据
8009
8021
  JSConsole.Chart.Log('[KLineChartContainer::document.onmouseup]',e);
8010
8022
  if (this.SelectChartDrawPicture) this.SelectChartDrawPicture.DragInfo=null;
8011
- this.UIElement.style.cursor="default";
8023
+ //this.UIElement.style.cursor="default";
8024
+ this.SetCursor({Cursor:"default"});
8012
8025
  this.MouseDrag=null;
8013
8026
  this.ClickDownPoint=null;
8014
8027
  this.IsOnTouch=false;
@@ -9843,7 +9856,6 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9843
9856
  var frameID=this.Frame.PtInFrame(x,y);
9844
9857
  if (IFrameSplitOperator.IsNumber(frameID) && frameID>=0) //在K线内部移动,调整K线索引
9845
9858
  this.CursorIndex=this.Frame.GetXData(x);
9846
-
9847
9859
 
9848
9860
 
9849
9861
  if (this.EnableBorderDrag && this.Frame && !this.CurrentChartDrawPicture)
@@ -9966,13 +9978,13 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9966
9978
 
9967
9979
  if (drawPictrueData.PointIndex===100)
9968
9980
  {
9969
- if (drawPictrueData.Cursor) this.UIElement.style.cursor=drawPictrueData.Cursor;
9970
- else this.UIElement.style.cursor="move";
9981
+ if (drawPictrueData.Cursor) this.SetCursor(drawPictrueData); //this.UIElement.style.cursor=drawPictrueData.Cursor;
9982
+ else this.SetCursor({Cursor:"move"}); //this.UIElement.style.cursor="move";
9971
9983
  }
9972
9984
  else
9973
9985
  {
9974
- if (drawPictrueData.Cursor) this.UIElement.style.cursor=drawPictrueData.Cursor
9975
- else this.UIElement.style.cursor="pointer";
9986
+ if (drawPictrueData.Cursor) this.SetCursor(drawPictrueData); //this.UIElement.style.cursor=drawPictrueData.Cursor
9987
+ else this.SetCursor({Cursor:"pointer"}); //this.UIElement.style.cursor="pointer";
9976
9988
  }
9977
9989
 
9978
9990
  bDrawPicture=true;
@@ -9980,7 +9992,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
9980
9992
  }
9981
9993
  else
9982
9994
  {
9983
- if (!this.MouseDrag) this.UIElement.style.cursor="default";
9995
+ if (!this.MouseDrag) this.SetCursor({Cursor:"default"}); //this.UIElement.style.cursor="default";
9984
9996
  }
9985
9997
  }
9986
9998
 
@@ -10003,7 +10015,7 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10003
10015
  this.DrawDynamicInfo(option);
10004
10016
  }
10005
10017
 
10006
- if (mouseStatus) this.UIElement.style.cursor=mouseStatus.Cursor;
10018
+ this.SetCursor(mouseStatus);
10007
10019
 
10008
10020
  if (this.IsShowTooltip && bDrawPicture==false)
10009
10021
  {
@@ -10031,6 +10043,17 @@ function JSChartContainer(uielement, OffscreenElement, cacheElement)
10031
10043
  }
10032
10044
  }
10033
10045
 
10046
+ //设置鼠标形状 {Cursor:鼠标形状 }
10047
+ this.SetCursor=function(obj)
10048
+ {
10049
+ if (!obj || !obj.Cursor) return;
10050
+
10051
+ if (obj.Cursor=="default")
10052
+ this.UIElement.style.cursor=this.DefaultCursor;
10053
+ else
10054
+ this.UIElement.style.cursor=obj.Cursor;
10055
+ }
10056
+
10034
10057
  this.OnKeyDown=function(e)
10035
10058
  {
10036
10059
  if (this.ChartSplashPaint && this.ChartSplashPaint.IsEnableSplash == true) return;
@@ -12784,6 +12807,7 @@ function CoordinateInfo()
12784
12807
  this.Value; //坐标数据
12785
12808
  this.Message=[]; //坐标输出文字信息 0=左 1=右 2=内左 3=内右
12786
12809
  this.TextColor=g_JSChartResource.FrameSplitTextColor //文字颜色
12810
+ this.TextBGColor; //文字背景色
12787
12811
  this.TextColor2; //右侧文字颜色,空使用TextColor
12788
12812
  this.Font=g_JSChartResource.FrameSplitTextFont; //字体
12789
12813
  this.LineColor=g_JSChartResource.FrameSplitPen; //线段颜色
@@ -14296,9 +14320,10 @@ function AverageWidthFrame()
14296
14320
  this.Canvas.font=this.VerticalInfo[i].Font;
14297
14321
 
14298
14322
  var textLeft=0;
14299
- this.Canvas.fillStyle=item.TextColor;
14323
+
14300
14324
  this.Canvas.strokeStyle=item.TextColor;
14301
14325
  var testWidth=this.Canvas.measureText(this.VerticalInfo[i].Message[0]).width;
14326
+ var textHeight=this.Canvas.measureText("擎").width;
14302
14327
  if (x<testWidth/2)
14303
14328
  {
14304
14329
  this.Canvas.textAlign="left";
@@ -14332,6 +14357,15 @@ function AverageWidthFrame()
14332
14357
  yText+=lineLength+2*pixelRatio;
14333
14358
  }
14334
14359
 
14360
+ //item.TextBGColor="rgb(0,255,0)";
14361
+ if (item.TextBGColor) //文字背景色
14362
+ {
14363
+ var rtText={ Left:textLeft, Top:yText+this.XBottomOffset, Width:testWidth, Height:textHeight };
14364
+ this.Canvas.fillStyle=item.TextBGColor;
14365
+ this.Canvas.fillRect(rtText.Left-1, rtText.Top, rtText.Width+2, rtText.Height);
14366
+ }
14367
+
14368
+ this.Canvas.fillStyle=item.TextColor;
14335
14369
  this.Canvas.fillText(this.VerticalInfo[i].Message[0],x,yText+this.XBottomOffset);
14336
14370
  textRightPrev=textLeft+testWidth;
14337
14371
  }
@@ -48846,6 +48880,7 @@ function FrameSplitMinuteX()
48846
48880
  info.Value=item[0];
48847
48881
  if (this.ShowText) info.Message[0]=item[3];
48848
48882
  if (item[4]) info.LineColor=item[4]; //线段颜色
48883
+ if (item[5]) info.TextBGColor=item[5]; //文字背景色
48849
48884
  this.Frame.VerticalInfo[i]=info;
48850
48885
  }
48851
48886
  }
@@ -74922,7 +74957,8 @@ function MinuteChartContainer(uielement,offscreenElement,cacheElement)
74922
74957
  if (moveSetp<5 && yMoveSetp<5) return;
74923
74958
  if (!this.EnableSelectRect) return;
74924
74959
 
74925
- this.UIElement.style.cursor="default";
74960
+ //this.UIElement.style.cursor="default";
74961
+ this.SetCursor({Cursor:"default"});
74926
74962
  var x=drag.Click.X-uielement.getBoundingClientRect().left;
74927
74963
  var y=drag.Click.Y-uielement.getBoundingClientRect().top;
74928
74964
  var x2=e.clientX-uielement.getBoundingClientRect().left;
@@ -89864,7 +89900,7 @@ function MinuteCoordinateData()
89864
89900
  {
89865
89901
  Full: //完整模式
89866
89902
  [
89867
- [0, 0, "rgb(200,200,200)", "09:30"], //[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色
89903
+ [0, 0, "rgb(200,200,200)", "09:30"], //[0]=索引 [1]=线段类型 [2]=文字颜色(弃用) [3]=刻度文字 [4]=线段颜色 [5]=背景色
89868
89904
  [31, 0, "RGB(200,200,200)", "10:00"],
89869
89905
  [61, 0, "RGB(200,200,200)", "10:30"],
89870
89906
  [91, 0, "RGB(200,200,200)", "11:00"],
@@ -128580,7 +128616,7 @@ function HQChartScriptWorker()
128580
128616
 
128581
128617
 
128582
128618
 
128583
- var HQCHART_VERSION="1.1.12512";
128619
+ var HQCHART_VERSION="1.1.12515";
128584
128620
 
128585
128621
  function PrintHQChartVersion()
128586
128622
  {