当前位置: 代码迷 >> 综合 >> VUE eChart 清空画布
  详细解决方案

VUE eChart 清空画布

热度:54   发布时间:2023-12-15 19:36:58.0
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 = {
    }