91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

vue echarts實現的柱狀圖動態效果代碼分享

發布時間:2021-09-06 11:26:31 來源:億速云 閱讀:335 作者:chen 欄目:開發技術

這篇文章主要介紹“vue echarts實現的柱狀圖動態效果代碼分享”,在日常操作中,相信很多人在vue echarts實現的柱狀圖動態效果代碼分享問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”vue echarts實現的柱狀圖動態效果代碼分享”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

本文實例為大家分享了vue echarts實現柱狀圖動態展示的具體代碼,供大家參考,具體內容如下

vue echarts實現的柱狀圖動態效果代碼分享

輪播圖形式展現

<template>
  <div class="dan">
    <div id="scalesize" :></div>
  </div>
</template>
<script>
import echarts from "echarts";
export default {
  data() {
    return {
      texts: 111
    };
  },
  mounted() {
    this.drawLine();
  },
  methods: {
    drawLine() {
      // 基于準備好的dom,初始化echarts實例
      let myChart = this.$echarts.init(document.getElementById("scalesize"));
      var fanfa = [
        {
          name: "育苗基地",
          type: "bar",
          barWidth: "15%",
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: "#fccb05"
                },
                {
                  offset: 1,
                  color: "#f5804d"
                }
              ]),
              barBorderRadius: 12
            }
          },
          data: [100, 120, 160, 180, 220, 400]
        },
        {
          name: "種植基地",
          type: "bar",
          barWidth: "15%",
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: "#8bd46e"
                },
                {
                  offset: 1,
                  color: "#09bcb7"
                }
              ]),
              barBorderRadius: 11
            }
          },
          data: [270, 320, 420, 650, 821,907]
        },
        {
          name: "托管面積",
          type: "bar",
          barWidth: "15%",
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: "#248ff7"
                },
                {
                  offset: 1,
                  color: "#6851f1"
                }
              ]),
              barBorderRadius: 11
            }
          },
          data: [140, 180, 215, 320, 396, 520]
        },
        {
          name: "聯建基地",
          type: "bar",
          barWidth: "15%",
          itemStyle: {
            normal: {
              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                {
                  offset: 0,
                  color: "#B88080"
                },
                {
                  offset: 1,
                  color: "#983A3A"
                }
              ]),
              barBorderRadius: 11
            }
          },
          data: [140, 180, 215, 320, 396, 420]
        }
      ];
      myChart.setOption({
        tooltip: {
          trigger: "axis",
          axisPointer: {
            // 坐標軸指示器,坐標軸觸發有效
            type: "shadow" // 默認為直線,可選為:'line' | 'shadow'
          }
        },
        grid: {
          left: "2%",
          right: "4%",
          bottom: "14%",
          top: "16%",
          containLabel: true
        },
        legend: {
          data: ["育苗基地", "種植基地", "托管面積", "聯建基地"],
          right: 10,
          top: 12,
          textStyle: {
            color: "#fff"
          },
          itemWidth: 12,
          itemHeight: 10
          // itemGap: 35
        },
        xAxis: {
          type: "category",
          data: [
            "2014",
            "2015",
            "2016",
            "2017",
            "2018",
            "2019"
          ],
          axisLine: {
            lineStyle: {
              color: "white"
            }
          },
          axisLabel: {
            // interval: 0,
            // rotate: 40,
            textStyle: {
              fontFamily: "Microsoft YaHei"
            }
          }
        },
        yAxis: {
          type: "value",
          axisLine: {
            show: false,
            lineStyle: {
              color: "white"
            }
          },
          splitLine: {
            show: true,
            lineStyle: {
              color: "rgba(255,255,255,0.3)"
            }
          },
          axisLabel: {}
        },
        dataZoom: [
          {
            show: true,
            height: 12,
            xAxisIndex: [0],
            bottom: "8%",
            handleIcon:
              "path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h69.8c2.2,0,4,1.8,4,4V413z",
            handleSize: "110%",
            handleStyle: {
              color: "#d3dee5"
            },
            textStyle: {
              color: "#fff"
            },
            borderColor: "#90979c"
          },
          {
            type: "inside",
            show: true,
            height: 15,
            start: 1,
            end: 35
          }
        ],
        series: fanfa
      });
      let app = {
        currentIndex: -1
      };
      setInterval(function() {
        let dataLen = fanfa[1].data.length;
        // 取消之前高亮的圖形
        myChart.dispatchAction({
          type: "downplay",
          seriesIndex: 0,
          dataIndex: app.currentIndex
        });
        app.currentIndex = (app.currentIndex + 1) % dataLen;
        //console.log(app.currentIndex);
        // 高亮當前圖形
        myChart.dispatchAction({
          type: "highlight",
          seriesIndex: 0,
          dataIndex: app.currentIndex
        });
        // 顯示 tooltip
        myChart.dispatchAction({
          type: "showTip",
          seriesIndex: 0,
          dataIndex: app.currentIndex
        });
      }, 1000);
      window.onresize = myChart.resize;
    }
  }
};
</script>
<style lang="less" scoped>
.dan {
  height: 90%;
}
</style>

到此,關于“vue echarts實現的柱狀圖動態效果代碼分享”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

湟中县| 工布江达县| 武冈市| 阳原县| 鸡东县| 景东| 新津县| 水城县| 余江县| 威信县| 亳州市| 确山县| 永德县| 南江县| 桐乡市| 长子县| 阿拉善右旗| 论坛| 龙胜| 深州市| 榕江县| 加查县| 阿勒泰市| 刚察县| 邵武市| 德格县| 盐亭县| 洛扎县| 武宣县| 万州区| 高密市| 临武县| 北宁市| 蒙阴县| 常山县| 平顺县| 万年县| 宜阳县| 屏东县| 中方县| 桑日县|