clear()方法

1.图表

<!-- 图表 -->
<div v-show="echartShow">
  <el-row :gutter="10">
    <el-col :span="12">
      <div>
        <div class="title">......</div>
        <line-chart
          :options="barChartOption"
          :style="echartStyle"
          id="myChart1"
        ></line-chart>
      </div>
    </el-col>
    <el-col :span="12">
      <div>
        <div class="title">......</div>
        <line-chart
          :options="lineChartOption"
          :style="echartStyle"
          id="myChart2"
        ></line-chart>
      </div>
    </el-col>
  </el-row>
</div>

2.引用
import lineChart from “。。。。。。/lineChart”;
import echarts from “echarts”;

3.清空画布

  //清除图表
  let myChart1 = echarts.init(document.getElementById("myChart1"));
  let myChart2 = echarts.init(document.getElementById("myChart2"));
  myChart1.clear();
  myChart2.clear();
  this.barChartOption = {}
  this.lineChartOption = {}
Logo

前往低代码交流专区

更多推荐