页面路由跳转返回后数据回显,记住原先的状态
This commit is contained in:
@@ -69,34 +69,34 @@ export default {
|
||||
this.myChart = echarts.init(chartDom);
|
||||
|
||||
// 绑定点击事件(只绑定一次,永久生效)
|
||||
this.myChart.getZr().on('click', (params) => {
|
||||
console.log('params', params);
|
||||
// this.myChart.getZr().on('click', (params) => {
|
||||
// console.log('params', params);
|
||||
|
||||
// 提取点击的基地名称
|
||||
// const itemName = params.name;
|
||||
let itemName = undefined
|
||||
// 根据映射表获取对应的序号(未匹配到则返回0或其他默认值)
|
||||
let pointInPixel = [params.offsetX, params.offsetY];
|
||||
if (this.myChart.containPixel('grid', pointInPixel)) {
|
||||
let pointInGrid = this.myChart.convertFromPixel({
|
||||
seriesIndex: 0
|
||||
}, pointInPixel);
|
||||
let xIndex = pointInGrid[0]; //索引
|
||||
let handleIndex = Number(xIndex);
|
||||
let seriesObj = this.myChart.getOption(); //图表object对象
|
||||
var op = this.myChart.getOption();
|
||||
//获得图表中点击的列
|
||||
itemName = op.xAxis[0].data[handleIndex]; //获取点击的列名
|
||||
console.log(itemName, 'monthmonthmonth');
|
||||
console.log(handleIndex, seriesObj);
|
||||
};
|
||||
const baseIndex = this.baseNameToIndexMap[itemName] || 0;
|
||||
// // 提取点击的基地名称
|
||||
// // const itemName = params.name;
|
||||
// let itemName = undefined
|
||||
// // 根据映射表获取对应的序号(未匹配到则返回0或其他默认值)
|
||||
// let pointInPixel = [params.offsetX, params.offsetY];
|
||||
// if (this.myChart.containPixel('grid', pointInPixel)) {
|
||||
// let pointInGrid = this.myChart.convertFromPixel({
|
||||
// seriesIndex: 0
|
||||
// }, pointInPixel);
|
||||
// let xIndex = pointInGrid[0]; //索引
|
||||
// let handleIndex = Number(xIndex);
|
||||
// let seriesObj = this.myChart.getOption(); //图表object对象
|
||||
// var op = this.myChart.getOption();
|
||||
// //获得图表中点击的列
|
||||
// itemName = op.xAxis[0].data[handleIndex]; //获取点击的列名
|
||||
// console.log(itemName, 'monthmonthmonth');
|
||||
// console.log(handleIndex, seriesObj);
|
||||
// };
|
||||
// const baseIndex = this.baseNameToIndexMap[itemName] || 0;
|
||||
|
||||
console.log(`你点击了【${itemName}】(序号:${baseIndex})`);
|
||||
if (itemName === undefined) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
// console.log(`你点击了【${itemName}】(序号:${baseIndex})`);
|
||||
// if (itemName === undefined) {
|
||||
// return;
|
||||
// }
|
||||
// });
|
||||
|
||||
// 定义resize处理函数(命名函数,方便移除)
|
||||
this.resizeHandler = () => {
|
||||
|
||||
Reference in New Issue
Block a user