欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Vue?Echarts實現(xiàn)帶滾動效果的柱形圖

 更新時間:2022年04月02日 18:08:35   作者:今天代碼敲了嗎  
這篇文章主要為大家詳細(xì)介紹了Vue?Echarts實現(xiàn)帶滾動效果的柱形圖,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了Vue Echarts實現(xiàn)帶滾動效果柱形圖的具體代碼,供大家參考,具體內(nèi)容如下

代碼

<template>
? <div class="timeLineview">
? ? <div v-bind:style="{ height: heightData + 'px' }" ref="categoryChart"></div>
? ? <div v-bind:style="{ height: noHeight + 'px' }" class="nomore">
? ? ? {{ noData }}
? ? </div>
? </div>
</template>

<script>
import echarts from "echarts";
export default {
? components: {},
? name: "timeLine",
? props: {
? ? question: {}
? },
? data() {
? ? return {
? ? ? datainfo: [],
? ? ? datatitle: [],
? ? ? chart: null,
? ? ? heightData: 300,
? ? ? noHeight: 0,
? ? ? noData: ""
? ? };
? },
? methods: {
? ? resize() {
? ? ? this.chart.resize();
? ? },
? ? find() {
? ? //獲取數(shù)據(jù)
? ? ? if (this.question) {
? ? ? ? for (let index = 0; index < this.question.length; index++) {
? ? ? ? ? if (this.question[index].statValue > 0) {
? ? ? ? ? //y軸
? ? ? ? ? ? this.datainfo.push(this.question[index].statValue);
? ? ? ? ? ? //X軸
? ? ? ? ? ? this.datatitle.push(this.question[index].statLabel);
? ? ? ? ? }
? ? ? ? }
? ? ? }

? ? ? this.chart = echarts.init(this.$refs.categoryChart);
? ? ? const option = {
? ? ? ? tooltip: {
? ? ? ? ? trigger: "axis",
? ? ? ? ? axisPointer: {
? ? ? ? ? ? type: "shadow"
? ? ? ? ? }
? ? ? ? },
? ? ? ? title: {},
? ? ? ? legend: {},
? ? ? ? dataZoom: [
? ? ? ? ? {
? ? ? ? ? ? type: "slider",
? ? ? ? ? ? start: 0,
? ? ? ? ? ? end: (100 / this.datainfo.length) * 5 ? //顯示五個
? ? ? ? ? },
? ? ? ? ? {
? ? ? ? ? ? type: "inside",
? ? ? ? ? ? start: 0,
? ? ? ? ? ? end: (100 / this.datainfo.length) * 5//顯示五個
? ? ? ? ? }
? ? ? ? ],
? ? ? ? xAxis: {
? ? ? ? ? data: this.datatitle
? ? ? ? },
? ? ? ? yAxis: { minInterval: 1 }, ? //顯示為整數(shù) 最小間距1
? ? ? ? series: [
? ? ? ? ? {
? ? ? ? ? ? type: "bar",
? ? ? ? ? ? name: "數(shù)量",
? ? ? ? ? ? data: this.datainfo,

? ? ? ? ? ? itemStyle: {
? ? ? ? ? ? ? color: "#77bef7"
? ? ? ? ? ? }
? ? ? ? ? }
? ? ? ? ]
? ? ? };
? ? ? this.chart.setOption(option);
? ? ? if (this.datainfo.length > 0) {
? ? ? ? this.heightData = 300;
? ? ? } else {
? ? ? ? this.heightData = 0;
? ? ? ? this.noHeight = 300;
? ? ? ? this.noData = "暫無數(shù)據(jù)";
? ? ? }
? ? }
? },
? mounted() {
? ? this.find();
? },
? created() {}
};
</script>

<style ?lang="less" scoped>
.nomore {
? display: flex;
? justify-content: center;
? align-items: center;
? font-size: 18px;
}
</style>

效果圖

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

相關(guān)文章

  • vue定義私有過濾器和基本使用

    vue定義私有過濾器和基本使用

    這篇文章主要介紹的是 vue定義私有過濾器和基本使用,下面文章圍繞vue定義私有過濾器的相關(guān)資料展開內(nèi)容,需要的朋友可以參考一下,希望對大家有所幫助
    2021-11-11
  • Vue3使用Swiper實現(xiàn)輪播圖示例詳解

    Vue3使用Swiper實現(xiàn)輪播圖示例詳解

    這篇文章主要為大家介紹了Vue3使用Swiper實現(xiàn)輪播圖示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-02-02
  • vue如何使用模擬的json數(shù)據(jù)查看效果

    vue如何使用模擬的json數(shù)據(jù)查看效果

    這篇文章主要介紹了vue如何使用模擬的json數(shù)據(jù)查看效果,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-03-03
  • vue中$emit的用法詳解

    vue中$emit的用法詳解

    這篇文章主要介紹了vue中$emit的用法詳解,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-08-08
  • vue項目中定義全局變量、函數(shù)的幾種方法

    vue項目中定義全局變量、函數(shù)的幾種方法

    這篇文章主要介紹了vue項目中定義全局變量、函數(shù)的幾種方法,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-11-11
  • vue實現(xiàn)全選組件封裝實例詳解

    vue實現(xiàn)全選組件封裝實例詳解

    這篇文章主要介紹了vue?全選組件封裝,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2022-02-02
  • Element?plus中el-input框回車觸發(fā)頁面刷新問題以及解決辦法

    Element?plus中el-input框回車觸發(fā)頁面刷新問題以及解決辦法

    在el-form表單組件中el-input組件輸入內(nèi)容后按下Enter鍵刷新了整個頁面,下面這篇文章主要給大家介紹了關(guān)于Element?plus中el-input框回車觸發(fā)頁面刷新問題以及解決辦法,需要的朋友可以參考下
    2024-03-03
  • Vue實現(xiàn)返回頂部按鈕實例代碼

    Vue實現(xiàn)返回頂部按鈕實例代碼

    這篇文章主要給大家介紹了關(guān)于Vue實現(xiàn)返回頂部按鈕的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-10-10
  • Vue之插件詳解

    Vue之插件詳解

    這篇文章主要為大家介紹了Vue之插件,具有一定的參考價值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助,希望能夠給你帶來幫助
    2021-11-11
  • 前端面試之vue2和vue3的區(qū)別有哪些

    前端面試之vue2和vue3的區(qū)別有哪些

    這篇文章主要為大家介紹了前端面試之vue2和vue3的區(qū)別有哪些,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-05-05

最新評論