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

Use iptables and firewalld tools to manage Linux firewall connection rules

Firewall A firewall is a set of rules. When a pac...

Douban website's method for making small changes to website content

<br />Reading is a very important part of th...

VS2019 connects to mysql8.0 database tutorial with pictures and text

1. First, prepare VS2019 and MySQL database. Both...

Writing methods that should be prohibited in native JS

Table of contents Block-level functions Directly ...

Summary of Git commit log modification methods

Case 1: Last submission and no push Execute the f...

Two ways to start Linux boot service

Table of contents rc.local method chkconfig metho...

JS ES new features template string

Table of contents 1. What is a template string? 2...

iframe adaptive size implementation code

Page domain relationship: The main page a.html bel...

MySQL optimization strategy (recommended)

In summary: 1. Consider performance when designin...

How to make JavaScript sleep or wait

Table of contents Overview Checking setTimeout() ...

MySQL transaction details

Table of contents Introduction Four characteristi...

Understand the initial use of redux in react in one article

Redux is a data state management plug-in. When us...

How to solve the problem of clicking tomcat9.exe crashing

A reader contacted me and asked why there were pr...

Oracle VM VirtualBox installation of CentOS7 operating system tutorial diagram

Table of contents Installation Steps Environment ...