Echarts 时间轴监听事件

Echarts 时间轴监听事件

1. 背景

  • 需求:通过页面某个组件内时间轴的变化控制其他组件的echarts的数据变化;
系统功能

2. 解决方法

系统功能
  • vue监听代码
this.myChart_3.on("timelinechanged", function (params) {
  console.log(params);
  if (params.type === "timelinechanged") {
   console.log(params.currentIndex);
  }
 });
  • 网页监听:可监听到自动切换、点击事件;
系统功能
  • 时间轴配置项
timeline: {
  tooltip: {
   show: false, // 播放和前进后退去掉
  },
  data: years,
  axisType: "category",
  autoPlay: false, // 自动播放
  triggerEvent: true, // 事件捕捉
  playInterval: 5000,
  left: "10%",
  right: "10%",
  bottom: "2%",
  width: "80%",
  // height: null,
  label: {
   normal: {
    textStyle: {
     color: "#ddd",
    },
   },
   emphasis: {
    textStyle: {
     color: "#fff",
    },
   },
  },
  symbolSize: 10,
  lineStyle: {
   color: "#555",
  },
  checkpointStyle: {
   borderColor: "#777",
   borderWidth: 2,
  },
  controlStyle: {
   showNextBtn: true,
   showPrevBtn: true,
   normal: {
    color: "#666",
    borderColor: "#666",
   },
   emphasis: {
    color: "#aaa",
    borderColor: "#aaa",
   },
  },
 }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值