Vue+echarts realizes progress bar histogram

Vue+echarts realizes progress bar histogram

This article shares the specific code of vue+echarts to realize the progress bar histogram for your reference. The specific content is as follows

The effect diagram is as follows

Code:

<template>
  <div class="content-page">
    <div class="tab-content">
      <div id="myChart1"></div>
    </div>
  </div>
</template>

<script>
import * as echarts from 'echarts';
export default {
    data() {
      return {
        option: {
          color: ["#157ef5"], // Set the color of the bar chart textStyle: {
            color: "#828282"
          },
          tooltip: {
            trigger: "axis",
            axisPointer:
              type: "line"
            }
          },
          grid: {
            left: "3%",
            right: "4%",
            bottom: "3%",
            containLabel: true
          },
          xAxis:
            type: "value",
            // Set the x-axis to display several segments min: 0,
            max: 100,
            interval: 50,
            axisTick: { show: false },
            axisLine: {
              lineStyle:
                color: "transparent"
              }
            }
          },
          yAxis: {
            type: "category",
            data: ["Financial Revenue", "Headquarters Economy"],
            axisTick: { show: false },
            axisLine: {
              lineStyle:
                color: "#e0e0e0"
              }
            },
            inside: true,
            textStyle: {
              color: "#000"
            }
          },
          series: [
            {
              type: "bar",
              itemStyle: {
                  color: "#f1f1f1", // Define the background color of the column borderRadius: [0, 10, 10, 0] // Define the rounded corners of the background column},
              barGap: "-100%", //Important steps to set column overlap data: [100, 100],
              animation: false, // Turn off animation effect barWidth: "22px", // Set the column width},
            {
              type: "bar",
              data: [65, 75],
              barWidth: "22px",
              barGap: "-100%", //Important steps to set column overlap itemStyle: {
                  borderRadius:[0, 10, 10, 0], // Define the rounded corners of the column color: function(params) {
                      var colorList = ['#3C90EB', '#B573F4', '#F9B341', '#F9B341', '#91c7ae'];
                      return colorList[params.dataIndex]
                  }
              },
            }
          ]
        }
      }
    },
    mounted() {
      this.getChartData();
    },
    methods: {
      getChartData() {
        let myChart1 = echarts.init(document.querySelector("#myChart1"));
        myChart1.setOption(this.option); // Set the chart initialization data setTimeout(function() {
          window.onresize = function() {
            myChart1.resize(); // The chart adapts to the window size};
        }, 200);
      }
    }
}
</script>

<style lang="less" scoped>
#myChart1 {
  width: 600px;
  height: 400px;
}
</style>

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Vue+Echart realizes three-dimensional column chart
  • Vue uses Echart icon plug-in bar chart
  • Detailed explanation of vue using Echarts to draw a bar chart
  • Vue+Echart bar chart realizes epidemic data statistics
  • Vue echarts realizes horizontal bar chart
  • Vue+echart realizes double column chart
  • Vue implements horizontal beveled bar chart
  • Vue+echarts realizes stacked bar chart
  • Vue uses Echarts to implement a three-dimensional bar chart
  • Vue+ Antv F2 realizes stacked bar chart

<<:  How to deploy Tencent Cloud Server from scratch

>>:  Alibaba Cloud domain name and IP binding steps and methods

Recommend

Detailed explanation of MySQL alter ignore syntax

When I was at work today, the business side asked...

Detailed analysis of Vue child components and parent components

Table of contents 1. Parent components and child ...

Teach you how to build a Hadoop 3.x pseudo cluster on Tencent Cloud

1. Environmental Preparation CentOS Linux release...

Three ways to achieve background blur in CSS3 (summary)

1. Normal background blur Code: <Style> htm...

10 Tips to Improve Website Usability

Whether it is a corporate website, a personal blo...

How to run JavaScript in Jupyter Notebook

Later, I also added how to use Jupyter Notebook i...

How to hide the version number in Nginx

Nginx hides version number In a production enviro...

javascript to switch by clicking on the picture

Clicking to switch pictures is very common in lif...

Detailed tutorial on how to monitor Nginx/Tomcat/MySQL using Zabbix

Table of contents Zabbix monitors Nginx Zabbix mo...

Docker removes abnormal container operations

This rookie encountered such a problem when he ju...

Solution to Chinese garbled characters when operating MySQL database in CMD

I searched on Baidu. . Some people say to use the...

Examples of using provide and inject in Vue2.0/3.0

Table of contents 1. What is the use of provide/i...