/** * 根据位置获取这个点在图表的哪个轴线上 * @param offsetX * @param offsetY */ export function getXAxisAndYAxisByPosition(chart, offsetX, offsetY, seriesIndex = 0) { const pointInPixel = [offsetX, offsetY] if ( chart.containPixel( { seriesIndex: 0 }, pointInPixel ) ) { const [xAxis, yAxis] = chart.convertFromPixel({ seriesIndex }, pointInPixel) return [xAxis, yAxis] } return null }