hqchart 1.1.11285 → 1.1.11287

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.
@@ -1755,7 +1755,8 @@ if(option&&option.ParentFunction=='OnMouseMove'&&option.Point){ptPosition=this.F
1755
1755
  var barrageData=null;for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.ClassName==='BarragePaint'){bCreated=true;barrageData=item.BarrageList;break;}}if(!bCreated){var chart=new BarragePaint();chart.Canvas=this.Canvas;chart.ChartBorder=this.Frame.ChartBorder;chart.ChartFrame=this.Frame;chart.HQChart=this;chart.SetOption(option);this.ExtendChartPaint.push(chart);barrageData=chart.BarrageList;}this.EnableAnimation=true;var self=this;window.requestAnimationFrame(function(){self.DrawAnimation();});return barrageData;};this.StopAnimation=function(){this.EnableAnimation=false;this.DrawDynamicInfo();};this.GetChartTooltipData=function(x,y,option){var toolTip=new TooltipData();if(this.ChartInfoPaint){if(this.ChartInfoPaint.GetTooltipData(x,y,toolTip))return toolTip;}if(this.PtInChartPaintTooltip(x,y,toolTip))return toolTip;if(IFrameSplitOperator.IsNonEmptyArray(this.Frame.SubFrame)){for(var i=0;i<this.Frame.SubFrame.length;++i){var subFrame=this.Frame.SubFrame[i];for(var j=0;j<subFrame.OverlayIndex.length;++j){var overlayItem=subFrame.OverlayIndex[j];for(var k=0;k<overlayItem.ChartPaint.length;++k){var item=overlayItem.ChartPaint[k];if(item.GetTooltipData(x,y,toolTip))return toolTip;}}}}if(this.PtInOverlayChartPaintTooltip(x,y,toolTip))return toolTip;return null;};this.PtInExtendChartButtons=function(x,y){for(var i=0;i<this.ExtendChartPaint.length;++i){var item=this.ExtendChartPaint[i];if(item.PtInButtons){var button=item.PtInButtons(x,y);if(button){button.Chart=item;return button;}}}return null;};this.OnMouseMove=function(x,y,e,isPhone){this.LastPoint.X=x;this.LastPoint.Y=y;var mouseStatus=null;//鼠标状态
1756
1756
  var frameID=this.Frame.PtInFrame(x,y);if(IFrameSplitOperator.IsNumber(frameID)&&frameID>=0)//在K线内部移动,调整K线索引
1757
1757
  this.CursorIndex=this.Frame.GetXData(x);var paint=this.GetRectSelectPaint();if(paint&&paint.GetPointCount()>0){var item=paint.PtInPaint(x,y);if(item){mouseStatus={Cursor:"ew-resize",Name:"DragRectSelect"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag rect select ",item);}}if(this.EnableBorderDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragBorder=this.Frame.PtInFrameBorder(x,y);if(dragBorder&&dragBorder.Index>=0){mouseStatus={Cursor:"n-resize",Name:"DragBorder"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag border ",dragBorder);}}if(this.EnableYDrag&&this.Frame&&!this.CurrentChartDrawPicture){var dragY=this.TryYDrag(x,y);if(dragY){mouseStatus={Cursor:dragY.Position==0?"n-resize":"row-resize",Name:"DragY"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] drag y ",dragY);}}if(!this.CurrentChartDrawPicture){var button=this.Frame.PtInButtons(x,y);if(button){mouseStatus={Cursor:"pointer",Name:"FrameButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame button ",button);}else{button=this.PtInExtendChartButtons(x,y);if(button){mouseStatus={Cursor:"pointer",Name:"ExtendChartButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] extend chart button ",button);}}}if(this.ChartCorssCursor){var crossButton=this.ChartCorssCursor.PtInButton(x,y);if(crossButton){mouseStatus={Cursor:"pointer",Name:"CorssCursorButton"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] cross cursor button ",crossButton);}}if(this.ClassName=="KLineChartContainer"&&this.Frame.PtInFrameBottom(x,y)){mouseStatus={Cursor:"ew-resize",Name:"FrameButtom"};JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] frame bottom ");}if(this.SelectedChart.EnableMoveOn&&this.PtInChart&&!this.CurrentChartDrawPicture){var chartInfo=this.PtInChart(x,y);if(chartInfo&&chartInfo.Identify){mouseStatus={Cursor:"pointer",Name:"PtInChart"};this.SelectedChart.MoveOn.Identify=chartInfo.Identify;this.SelectedChart.MoveOn.Identify=null;JSConsole.Chart.Log("[JSChartContainer::OnMouseMove] Point in chart ",chartInfo);}else{this.SelectedChart.MoveOn.Identify=null;}}else{this.SelectedChart.MoveOn.Identify=null;}var bDrawPicture=false;//是否正在画图
1758
- if(this.CurrentChartDrawPicture){if(this.CurrentChartDrawPicture.Status!=20)mouseStatus={Cursor:"crosshair",Name:"CurrentChartDrawPicture"};if(this.CurrentChartDrawPicture.SetLastPoint)this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});bDrawPicture=true;}else{var drawPictrueData={};drawPictrueData.X=x;drawPictrueData.Y=y;if(this.GetChartDrawPictureByPoint(drawPictrueData)&&drawPictrueData.ChartDrawPicture&&drawPictrueData.ChartDrawPicture.EnableMove==true){if(drawPictrueData.PointIndex===100)this.UIElement.style.cursor="move";else this.UIElement.style.cursor="pointer";bDrawPicture=true;this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.UIElement.style.cursor="default";}}var clientPos=this.PtInClient(x,y);var option={ParentFunction:'OnMouseMove',Point:{X:x,Y:y},IsPhone:isPhone===true,ClientPos:clientPos};if(e&&(e.type=="mouseout"||e.type=="mouseleave")||button)option.Corss=false;//鼠标移开,在按钮上,不显示十字光标
1758
+ if(this.CurrentChartDrawPicture){var index=this.Frame.PtInChartFrame(x,y);if(this.CurrentChartDrawPicture.Status!=20){if(index>=0)mouseStatus={Cursor:"crosshair",Name:"CurrentChartDrawPicture"};else mouseStatus={Cursor:"not-allowed",Name:"CurrentChartDrawPicture"};//不在画图区域
1759
+ }if(this.CurrentChartDrawPicture.SetLastPoint)this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});bDrawPicture=true;}else{var drawPictrueData={};drawPictrueData.X=x;drawPictrueData.Y=y;if(this.GetChartDrawPictureByPoint(drawPictrueData)&&drawPictrueData.ChartDrawPicture&&drawPictrueData.ChartDrawPicture.EnableMove==true){if(drawPictrueData.PointIndex===100)this.UIElement.style.cursor="move";else this.UIElement.style.cursor="pointer";bDrawPicture=true;this.MoveOnChartDrawPicture=drawPictrueData.ChartDrawPicture;}else{if(!this.MouseDrag)this.UIElement.style.cursor="default";}}var clientPos=this.PtInClient(x,y);var option={ParentFunction:'OnMouseMove',Point:{X:x,Y:y},IsPhone:isPhone===true,ClientPos:clientPos};if(e&&(e.type=="mouseout"||e.type=="mouseleave")||button)option.Corss=false;//鼠标移开,在按钮上,不显示十字光标
1759
1760
  if(this.SetCorssCursorIndex)this.SetCorssCursorIndex(option);this.DrawDynamicInfo(option);if(mouseStatus)this.UIElement.style.cursor=mouseStatus.Cursor;if(this.IsShowTooltip&&bDrawPicture==false){var toolTip=this.GetChartTooltipData(x,y);if(toolTip&&toolTip.Data){if(isPhone===true){var touche=e.touches[0];var xTooltip=touche.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=touche.clientY-this.UIElement.getBoundingClientRect().top;}else{var xTooltip=e.clientX-this.UIElement.getBoundingClientRect().left;var yTooltip=e.clientY-this.UIElement.getBoundingClientRect().top;}this.ShowTooltip(xTooltip,yTooltip,toolTip);}else{this.HideTooltip();}}};this.OnKeyDown=function(e){if(this.ChartSplashPaint&&this.ChartSplashPaint.IsEnableSplash==true)return;var keyID=e.keyCode?e.keyCode:e.which;switch(keyID){case 37://left
1760
1761
  if(e.ctrlKey&&this.OnCustomKeyDown){if(this.OnCustomKeyDown(keyID,e))break;}if(this.CursorIndex<=0.99999){if(!this.DataMoveLeft()){//左移数据到头了 触发下载新数据
1761
1762
  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
@@ -2567,7 +2568,9 @@ var yValue=frame.GetYData(y);if(frame.YSplitOperator.CoordinateType==1)//百分
2567
2568
  {var firstOpenPrice=frame.YSplitOperator.GetFirstOpenPrice();outObject.RightYValue=((yValue-firstOpenPrice)/firstOpenPrice*100).toFixed(2)+'%';}return yValue;}};this.PtInFrame=function(x,y)//鼠标哪个指标窗口
2568
2569
  {for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];var left=item.Frame.ChartBorder.GetLeft();var top=item.Frame.ChartBorder.GetTop();var width=item.Frame.ChartBorder.GetWidth();var height=item.Frame.ChartBorder.GetHeight();item.Frame.Canvas.beginPath();item.Frame.Canvas.rect(left,top,width,height);if(item.Frame.Canvas.isPointInPath(x,y)){return i;//转成整形
2569
2570
  }}var bottom=this.ChartBorder.GetBottom();var chartHeight=this.ChartBorder.GetChartHeight();var left=this.ChartBorder.GetLeft();var right=this.ChartBorder.GetRight();//底部
2570
- if(x>=left&&x<=right&&y>bottom&&y<chartHeight)return-3;return-1;};this.PtInButtons=function(x,y){for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];var button=item.Frame.PtInButtons(x,y);if(button){button.Frame=item.Frame;return button;}for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];var overlayFrame=overlayItem.Frame;if(!overlayFrame||!overlayFrame.PtInButtons)continue;var button=overlayFrame.PtInButtons(x,y);if(button){button.IndexID=overlayItem.Identify;button.FrameID=i;button.OverlayFrame=overlayFrame;button.Frame=item.Frame;return button;}}}return null;};//是否在X轴坐标上
2571
+ if(x>=left&&x<=right&&y>bottom&&y<chartHeight)return-3;return-1;};this.PtInChartFrame=function(x,y)//鼠标在图形区域, 取出上下空白
2572
+ {for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];var left=item.Frame.ChartBorder.GetLeft();var top=item.Frame.ChartBorder.GetTopEx();var width=item.Frame.ChartBorder.GetWidth();var height=item.Frame.ChartBorder.GetHeightEx();item.Frame.Canvas.beginPath();item.Frame.Canvas.rect(left,top,width,height);if(item.Frame.Canvas.isPointInPath(x,y)){return i;//转成整形
2573
+ }}return-1;};this.PtInButtons=function(x,y){for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];var button=item.Frame.PtInButtons(x,y);if(button){button.Frame=item.Frame;return button;}for(var j=0;j<item.OverlayIndex.length;++j){var overlayItem=item.OverlayIndex[j];var overlayFrame=overlayItem.Frame;if(!overlayFrame||!overlayFrame.PtInButtons)continue;var button=overlayFrame.PtInButtons(x,y);if(button){button.IndexID=overlayItem.Identify;button.FrameID=i;button.OverlayFrame=overlayFrame;button.Frame=item.Frame;return button;}}}return null;};//是否在X轴坐标上
2571
2574
  this.PtInFrameBottom=function(x,y){var left=this.ChartBorder.GetLeft();var top=this.ChartBorder.GetBottom();var width=this.ChartBorder.GetWidth();var height=this.ChartBorder.Bottom;this.Canvas.beginPath();this.Canvas.rect(left,top,width,height);if(this.Canvas.isPointInPath(x,y))return true;return false;};this.GetXFromIndex=function(index){return this.SubFrame[0].Frame.GetXFromIndex(index);};this.GetYFromData=function(value){return this.SubFrame[0].Frame.GetYFromData(value);};this.ZoomUp=function(cursorIndex){var result=this.SubFrame[0].Frame.ZoomUp(cursorIndex);this.UpdateAllFrame();return result;};this.ZoomDown=function(cursorIndex){var result=this.SubFrame[0].Frame.ZoomDown(cursorIndex);this.UpdateAllFrame();return result;};this.XCoordinateZoom=function(step,isMoveLeft){var result=this.SubFrame[0].Frame.XCoordinateZoom(step,isMoveLeft);this.UpdateAllFrame();return result;};//设置重新计算刻度坐标
2572
2575
  this.ResetXYSplit=function(){for(var _i in this.SubFrame){this.SubFrame[_i].Frame.XYSplit=true;}};this.SetLanguage=function(languageID){for(var _i2 in this.SubFrame){var item=this.SubFrame[_i2];if(item&&item.Frame){if(item.Frame.YSplitOperator)item.Frame.YSplitOperator.LanguageID=languageID;if(item.Frame.XSplitOperator)item.Frame.XSplitOperator.LanguageID=languageID;}}};this.GetCurrentPageSize=function()//获取当前页显示的数据个数
2573
2576
  {if(this.SubFrame.length<=0)return null;var item=this.SubFrame[0];if(!item||!item.Frame)return null;return item.Frame.XPointCount;};this.OnSize=function(){var obj={};this.SubFrame[0].Frame.OnSize(obj);this.UpdateAllFrame();return obj;};this.SetDataWidth=function(dataWidth){var obj=this.SubFrame[0].Frame.SetDataWidth(dataWidth);this.UpdateAllFrame();return obj;};this.UpdateAllFrame=function(){var mainFrame=this.SubFrame[0].Frame;for(var i=0;i<this.SubFrame.length;++i){var item=this.SubFrame[i];if(i>0)//第1个窗口主坐标已经算好了
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.11285",
5
+ "version": "1.1.11287",
6
6
  "main": "lib/main.js",
7
7
  "private": false,
8
8
  "license": "Apache License 2.0",
@@ -8841,7 +8841,15 @@ function JSChartContainer(uielement, OffscreenElement)
8841
8841
  var bDrawPicture=false; //是否正在画图
8842
8842
  if (this.CurrentChartDrawPicture)
8843
8843
  {
8844
- if (this.CurrentChartDrawPicture.Status!=20) mouseStatus={ Cursor:"crosshair", Name:"CurrentChartDrawPicture"};
8844
+ var index=this.Frame.PtInChartFrame(x,y);
8845
+ if (this.CurrentChartDrawPicture.Status!=20)
8846
+ {
8847
+ if (index>=0)
8848
+ mouseStatus={ Cursor:"crosshair", Name:"CurrentChartDrawPicture"};
8849
+ else
8850
+ mouseStatus={ Cursor:"not-allowed", Name:"CurrentChartDrawPicture"}; //不在画图区域
8851
+ }
8852
+
8845
8853
  if (this.CurrentChartDrawPicture.SetLastPoint) this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});
8846
8854
  bDrawPicture=true;
8847
8855
  }
@@ -18055,6 +18063,27 @@ function HQTradeFrame()
18055
18063
  return -1;
18056
18064
  }
18057
18065
 
18066
+ this.PtInChartFrame=function(x,y) //鼠标在图形区域, 取出上下空白
18067
+ {
18068
+ for(var i=0; i<this.SubFrame.length; ++i)
18069
+ {
18070
+ var item=this.SubFrame[i];
18071
+ var left=item.Frame.ChartBorder.GetLeft();
18072
+ var top=item.Frame.ChartBorder.GetTopEx();
18073
+ var width=item.Frame.ChartBorder.GetWidth();
18074
+ var height=item.Frame.ChartBorder.GetHeightEx();
18075
+
18076
+ item.Frame.Canvas.beginPath();
18077
+ item.Frame.Canvas.rect(left,top,width,height);
18078
+ if (item.Frame.Canvas.isPointInPath(x,y))
18079
+ {
18080
+ return i; //转成整形
18081
+ }
18082
+ }
18083
+
18084
+ return -1;
18085
+ }
18086
+
18058
18087
  this.PtInButtons=function(x,y)
18059
18088
  {
18060
18089
  for(var i=0; i<this.SubFrame.length; ++i)
@@ -8885,7 +8885,15 @@ function JSChartContainer(uielement, OffscreenElement)
8885
8885
  var bDrawPicture=false; //是否正在画图
8886
8886
  if (this.CurrentChartDrawPicture)
8887
8887
  {
8888
- if (this.CurrentChartDrawPicture.Status!=20) mouseStatus={ Cursor:"crosshair", Name:"CurrentChartDrawPicture"};
8888
+ var index=this.Frame.PtInChartFrame(x,y);
8889
+ if (this.CurrentChartDrawPicture.Status!=20)
8890
+ {
8891
+ if (index>=0)
8892
+ mouseStatus={ Cursor:"crosshair", Name:"CurrentChartDrawPicture"};
8893
+ else
8894
+ mouseStatus={ Cursor:"not-allowed", Name:"CurrentChartDrawPicture"}; //不在画图区域
8895
+ }
8896
+
8889
8897
  if (this.CurrentChartDrawPicture.SetLastPoint) this.CurrentChartDrawPicture.SetLastPoint({X:x,Y:y});
8890
8898
  bDrawPicture=true;
8891
8899
  }
@@ -18099,6 +18107,27 @@ function HQTradeFrame()
18099
18107
  return -1;
18100
18108
  }
18101
18109
 
18110
+ this.PtInChartFrame=function(x,y) //鼠标在图形区域, 取出上下空白
18111
+ {
18112
+ for(var i=0; i<this.SubFrame.length; ++i)
18113
+ {
18114
+ var item=this.SubFrame[i];
18115
+ var left=item.Frame.ChartBorder.GetLeft();
18116
+ var top=item.Frame.ChartBorder.GetTopEx();
18117
+ var width=item.Frame.ChartBorder.GetWidth();
18118
+ var height=item.Frame.ChartBorder.GetHeightEx();
18119
+
18120
+ item.Frame.Canvas.beginPath();
18121
+ item.Frame.Canvas.rect(left,top,width,height);
18122
+ if (item.Frame.Canvas.isPointInPath(x,y))
18123
+ {
18124
+ return i; //转成整形
18125
+ }
18126
+ }
18127
+
18128
+ return -1;
18129
+ }
18130
+
18102
18131
  this.PtInButtons=function(x,y)
18103
18132
  {
18104
18133
  for(var i=0; i<this.SubFrame.length; ++i)