echarts表格和element-plus时间选择联动,选择几号时间,,就显示几号的数据

 

 const echartInit6 = () => {
        var chart_6 = echarts.init(document.getElementById('chart_6'));
        var option = {
          title: {
            text: '日均',
            x: '40%',
            y: '10%',
            textStyle: {
              color: "#fff"
            }
          },
          tooltip: {},
          toolbox: {
            x: '75%',                // 水平安放位置,默认为全图右对齐,可选为:
            y: '20',
            feature: {
              saveAsImage: {},

            }
          },
          radar: {
            shape: 'circle',
            nameGap: 1, // 图中工艺等字距离图的距离
            name: {
              textStyle: {
                color: '#fff',
                backgroundColor: '#999',
                borderRadius: 3,
                padding: [3, 5]
              }
            },
            center: ['50%', '50%'],
            radius: 90,
            indicator: [
              {name: '排放区域1', max: 100},
              {name: '排放\n区域2', max: 100},
              {name: '排放区域3', max: 100},
              {name: '排放\n区域4', max: 100}
            ]
          },
          series: [{
            type: 'radar',
            areaStyle: {normal: {}},
            emphasis: {
              lineStyle: {
                width: 5
              }
            },
            data: [
              {
                symbol: 'rect',
                symbolSize: 9,
                value: [65, 55, 76, 85],
                name: '日均影响'
              },

            ]
          }]
        };
        // chart_6.setOption(option);
        axios({
          url: "/getarearadar/",
          data: {}
        }).then(back => {
          // console.log(back.data);
          // 对back.data 进行处理变成[value1,value2,...]的格式
          let arr = [];
          back.data.day_a.forEach(i => {
            arr.push(i);
            // console.log(i)
          })
          // console.log(arr)
          option.series[0].data = arr
          // 赋值后重新绘制图表
          chart_6.setOption(option);
        }).catch(error => console.log(error, "加载失败"));

       //时间选择框之后的逻辑
        
       //如何让这个两个之间联动起来

      };

 

 

将series里面的data写成动态的就好了,你选择完时间后将数据动态的拼到data里

你监听时间选择器,把获取到的时间拿去请求后台

实际上就是数据的切换