ecahet折线图 空点折线依旧

需要做折线图,但是中间有一个空值,希望折线图断开来,不是置0或者取平均值之类的

echaets版本echaets版本
代码 index.vue

<template>
  <!--为echarts准备一个具备大小的容器dom-->
  <div id="main" style="width: 600px;height: 400px;"></div>
</template>
<script>
  import echarts from 'echarts'
  export default {
      name: '',
      data() {
          return {
              charts: '',
          /*  opinion: ["1", "3", "3", "4", "5"],*/
              opinionData: ["3", "2", "1", "4", "5"]
          }
      },
      methods: {
          drawLine(id) {
              this.charts = echarts.init(document.getElementById(id))
              this.charts.setOption({
                  tooltip: {
                      trigger: 'axis'
                  },
                  legend: {
                      data: ['近七日收益']
                  },
                  grid: {
                      left: '3%',
                      right: '4%',
                      bottom: '3%',
                      containLabel: true
                  },

                  toolbox: {
                      feature: {
                          saveAsImage: {}
                      }
                  },
                  xAxis: {
                      type: 'category',
                      boundaryGap: false,
                  data: ["1","2","3","4","5"]
                  
                  },
                  yAxis: {
                      type: 'value'
                  },

                  series: [{
                      name: '近七日收益',
                      type: 'line',
                      stack: '总量',
                      data: this.opinionData
                  }]
              })
          }
      },
      //调用
      mounted() {
          this.$nextTick(function() {
              this.drawLine('main')
          })
      }
  }
</script>
<style scoped>
  * {
      margin: 0;
      padding: 0;
      list-style: none;
  }
</style>


运行结果
中间没有值
在这里插入图片描述
中间有值
在这里插入图片描述
我网上查寻到
解决方法:series的connectNulls属性支持连接空值

https://blog.csdn.net/qq_40701522/article/details/106856026
这个可以参考下
可能版本不一样

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值