@fusioncharts/charts
Version:
JavaScript Data Visualisation Library
1 lines • 1.37 kB
JavaScript
;exports.__esModule=true;exports._checkPointerOverColumn=_checkPointerOverColumn;var math=Math,mathRound=math.round;function _checkPointerOverColumn(pX,chartX,chartY){var dataset=this,chart=dataset.getFromEnv("chart"),chartConfig=chart.config,plotBorderThickness=chartConfig.plotborderthickness,showPlotBorder=chartConfig.showplotborder,dataStore=dataset.components.data,pointObj=dataStore[pX],pY,dx,dy,hovered,halfPlotBorderThickness,zDepth=10,xPos,yPos,width,height;if(!pointObj){return}pY=pointObj.config.setValue;plotBorderThickness=showPlotBorder?plotBorderThickness:0;halfPlotBorderThickness=plotBorderThickness/2;halfPlotBorderThickness=halfPlotBorderThickness%2===0?halfPlotBorderThickness+1:mathRound(halfPlotBorderThickness);if(pY!==null){xPos=pointObj._xPos-zDepth;width=pointObj._width+zDepth;yPos=pointObj._yPos;height=pointObj._height+zDepth;dx=chartX-xPos+halfPlotBorderThickness;dy=chartY-yPos+halfPlotBorderThickness;hovered=dx>=0&&dx<=width+plotBorderThickness&&dy>=0&&dy<=height+plotBorderThickness;if(pY>=0){hovered=hovered?chartX+chartY-(xPos+yPos)-zDepth>0:false;hovered=hovered?chartX+chartY-(xPos+yPos+width+height)+zDepth<0:false}else{hovered=hovered?chartX+chartY-(xPos+yPos)-zDepth>0:false;hovered=hovered?chartX+chartY-(xPos+yPos+width+height)+zDepth<0:false}if(hovered){return{pointIndex:pX,hovered:hovered,pointObj:dataStore[pX]}}}}