echarts获取x轴数据
时间: 2024-05-18 21:16:26 浏览: 133
要获取echarts的x轴数据,可以使用以下代码:
在点击事件中获取x轴数据的代码:
```
let time = ""
myChart.getZr().on('click', params => {
const pointInPixel = [params.offsetX, params.offsetY]
if (myChart.containPixel('grid', pointInPixel)) {
const xIndex = myChart.convertFromPixel({ seriesIndex: 0 }, [params.offsetX, params.offsetY])[0]
time = option.xAxis<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [Echarts点击x轴获取x轴数据](https://blog.csdn.net/qq_34241004/article/details/118670385)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [echarts 获取x轴y轴范围并且设置双折线轴等间隔问题](https://blog.csdn.net/qq_42103673/article/details/116235018)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文