亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

vue echarts實(shí)現(xiàn)橫向柱狀圖

 更新時(shí)間:2021年09月08日 10:38:53   作者:tendernessxy  
這篇文章主要為大家詳細(xì)介紹了vue echarts實(shí)現(xiàn)橫向柱狀圖,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了vue echarts實(shí)現(xiàn)橫向柱狀圖的具體代碼,供大家參考,具體內(nèi)容如下

實(shí)現(xiàn)效果:

代碼:

<template>
  <div class="OverYearsPompany">
    <div id="OverYearsPompanyChart" style="flex: 1; height: 368px; margin-top: -42px"></div>
  </div>
</template>
<script>
import { getProposedInvestments } from '@/api/government';
const colors = [
  ['rgba(240, 7, 100, 1)', 'rgba(0, 215, 229, 1)'],
  ['rgba(240, 7, 100, 1)', 'rgba(0, 215, 229, 1)'],
  ['rgba(240, 7, 100, 1)', 'rgba(0, 215, 229, 1)'],
  ['rgba(240, 7, 100, 1)', 'rgba(0, 215, 229, 1)'],
];
export default {
  data() {
    return {
      investmentsWayData: [],
      investmentsWayDataCount: [],
      investmentsWayDataCounts: [],
    };
  },
  mounted() {
    this.getProposedInvestments();
  },
  methods: {
    initMap() {
      var myChart = this.$echarts.init(document.getElementById('OverYearsPompanyChart'));
      const option = {
        tooltip: {
          show: true,
          trigger: 'axis',
          axisPointer: {
            type: 'shadow',
          },
        },
        xAxis: {
          type: 'value',
          axisLabel: {
            show: true,
            color: '#02CFFCFF',
            fontFamily: 'TencentSans',
          },
          axisLine: {
            show: true,
            lineStyle: {
              color: '#02CFFCFF',
            },
          },
          splitLine: {
            show: true,
            lineStyle: {
              color: 'rgba(71, 126, 171, 1)',
            },
          },
        },
        yAxis: [
          {
            type: 'category',
            inverse: true, //倒敘
            axisLabel: {
              color: '#02CFFCFF',
              fontFamily: 'TencentSans',
            },
            axisTick: {
              show: false,
            },
            axisLine: {
              show: true,
              lineStyle: {
                color: '#02CFFCFF',
              },
            },
            splitLine: {
              show: true,
              lineStyle: {
                type: 'dotted',
                color: 'rgba(71, 126, 171, 1)',
              },
            },
            data: this.investmentsWayData,
          },
        ],
        series: [
          {
            type: 'bar',
            barWidth: 15,
            label: {
              position: ['98%', -20],
              show: true,
              color: '#fff',
              fontFamily: 'TencentSans',
            },
            data: this.investmentsWayDataCount,
            itemStyle: {
              color(params) {
                const { dataIndex } = params;
                let color = {
                  type: 'linear',
                  x: 1,
                  y: 0,
                  x2: 0,
                  y2: 0,
                  colorStops: [
                    {
                      offset: 0,
                      color: colors[dataIndex] ? colors[dataIndex][0] : 'red',
                    },
                    {
                      offset: 1,
                      color: colors[dataIndex] ? colors[dataIndex][1] : 'red',
                    },
                  ],
                };
                return color;
              },
            },
          },
        ],
      };
      myChart.setOption(option);
    },
    getProposedInvestments() {
      getProposedInvestments().then((res) => {
        const { status, data } = res;
        const { proposedInvestmentsWayDis } = JSON.parse(data);
        if (status === 200) {
          // this.investmentsWayData=[{0: "合資", 1: "合作", 2: "獨(dú)資", 3: "其他"}]
          this.investmentsWayData = proposedInvestmentsWayDis.map((item) => {
            return item.wayDis;
          });
          // this.investmentsWayDataCount=[{0: "496", 1: "372", 2: "248", 3: "124"}]
          this.investmentsWayDataCount = proposedInvestmentsWayDis.map((item) => {
            return item.count;
          });
          // this.investmentsWayDataCounts=[{itemStyle:
    // color:{
    // 0: "rgba(240, 7, 100, 1)"
    // 1: "rgba(0, 215, 229, 1)"}
    // value: "496"}]
          this.investmentsWayDataCounts = proposedInvestmentsWayDis.map((item, index) => {
            return {
              value: item.count,
              itemStyle: {
                color: colors[index],
              },
            };
          });
          this.initMap();
        }
      });
    },
  },
};
</script>

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue如何將后臺(tái)返回的數(shù)字轉(zhuǎn)換成對(duì)應(yīng)的文字

    vue如何將后臺(tái)返回的數(shù)字轉(zhuǎn)換成對(duì)應(yīng)的文字

    這篇文章主要介紹了vue如何將后臺(tái)返回的數(shù)字轉(zhuǎn)換成對(duì)應(yīng)的文字,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-10-10
  • vue中Vue.set()的使用以及對(duì)其進(jìn)行深入解析

    vue中Vue.set()的使用以及對(duì)其進(jìn)行深入解析

    vue不允許在已經(jīng)創(chuàng)建的實(shí)例上動(dòng)態(tài)添加新的根級(jí)響應(yīng)式屬性,不過可以使用Vue.set()方法將響應(yīng)式屬性添加到嵌套的對(duì)象上,下面這篇文章主要給大家介紹了關(guān)于vue中Vue.set()的使用以及對(duì)其進(jìn)行深入解析的相關(guān)資料,需要的朋友可以參考下
    2023-01-01
  • Vue-drag-resize 拖拽縮放插件的使用(簡單示例)

    Vue-drag-resize 拖拽縮放插件的使用(簡單示例)

    本文通過代碼給大家介紹了Vue-drag-resize 拖拽縮放插件使用簡單示例,代碼簡單易懂,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-12-12
  • vue-cli 腳手架基于Nightwatch的端到端測試環(huán)境的過程

    vue-cli 腳手架基于Nightwatch的端到端測試環(huán)境的過程

    這篇文章主要介紹了vue-cli 腳手架基于Nightwatch的端到端測試環(huán)境的過程,需要的朋友可以參考下
    2018-09-09
  • vue3.0+element表格獲取每行數(shù)據(jù)代碼示例

    vue3.0+element表格獲取每行數(shù)據(jù)代碼示例

    這篇文章主要給大家介紹了關(guān)于vue3.0+element表格獲取每行數(shù)據(jù)的相關(guān)資料,在element-ui中,你可以通過為表格的行綁定單擊事件來獲取表格中的一行數(shù)據(jù),需要的朋友可以參考下
    2023-09-09
  • Vue項(xiàng)目中實(shí)現(xiàn)AES加密解密的全過程

    Vue項(xiàng)目中實(shí)現(xiàn)AES加密解密的全過程

    AES算法是一種對(duì)稱加密算法,用于加密和解密數(shù)據(jù),下面這篇文章主要給大家介紹了關(guān)于Vue項(xiàng)目中實(shí)現(xiàn)AES加密解密的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2024-08-08
  • 關(guān)于Vue的 watch、computed和methods的區(qū)別匯總

    關(guān)于Vue的 watch、computed和methods的區(qū)別匯總

    這篇文章主要介紹關(guān)于Vue的 watch、computed和methods的區(qū)別,下面文章將圍繞Vue的 watch、computed和methods的續(xù)航管資料展開全文它們之間區(qū)別的內(nèi)容,需要的朋友可以參考一下,希望能幫助到大家
    2021-11-11
  • 更強(qiáng)大的vue ssr實(shí)現(xiàn)預(yù)取數(shù)據(jù)的方式

    更強(qiáng)大的vue ssr實(shí)現(xiàn)預(yù)取數(shù)據(jù)的方式

    這篇文章主要介紹了更強(qiáng)大的 vue ssr 預(yù)取數(shù)據(jù)的方式,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-07-07
  • Vue組件的通信方式詳解

    Vue組件的通信方式詳解

    這篇文章主要介紹的是Vue組件間的通信方式,本文將系統(tǒng)的介紹了幾種不使用Vuex,比較實(shí)用的組件間的通信方式,希望能幫助到大家
    2023-04-04
  • 解決vuex刷新數(shù)據(jù)消失問題

    解決vuex刷新數(shù)據(jù)消失問題

    這篇文章主要介紹了解決vuex刷新數(shù)據(jù)消失問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-11-11

最新評(píng)論