ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

echarts,柱状图-圆柱

2021-10-09 10:33:17  阅读:165  来源: 互联网

标签:圆柱 color WidthAdaptive 柱状图 fontSize rgba type echarts 255


效果图:

 

 

 <div style="width: 462px; height: 230px" id="teachingRightTop"></div>

 

// 自适应字体大小
    WidthAdaptive(res) {
      var windth = window.innerWidth;
      let fontSize = windth / 1920;
      return fontSize * res;
    },
    drawLine() {
      // 基于准备好的dom,初始化echarts实例
      let myChart = this.$echarts.init(
        document.getElementById("teachingRightTop")
      );

      let option = {
        backgroundColor: "transparent",
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "shadow",
          },
        },
        grid: {
          top: "18%",
          right: "2%",
          left: "10%",
          bottom: "15%",
        },
        xAxis: [
          {
            type: "category",
            data: [
              "服装学院",
              "艺术与设计" + "\n" + "学院",
              "国际教育学院",
              "法政学院",
              "史量才新闻与" + "\n" + "传播学院",
            ],
            axisLine: {
              lineStyle: {
                color: "rgba(255,255,255,0.12)",
              },
            },
            axisLabel: {
              margin: 10,
              color: " rgba(255, 255, 255, 0.6)",
              textStyle: {
                fontSize: this.WidthAdaptive(10),
              },
            },
          },
        ],
        yAxis: [
          {
            name: "单位:%",
            max: 100,
            min: 0,
            nameTextStyle: {
              color: " rgba(255, 255, 255, 0.6)",
              fontSize: this.WidthAdaptive(12),
              padding: 12,
            },
            axisLabel: {
              formatter: "{value}",
              color: " rgba(255, 255, 255, 0.6)",
            },
            axisLine: {
              show: false,
            },
            splitLine: {
              lineStyle: {
                type: "dashed",
                color: "rgba(112,112,112,0.5)",
              },
            },
          },
        ],
        series: [
          {
            data: [80, 70, 90, 71, 85, 92],
            type: "bar",
            barWidth: this.WidthAdaptive(14),
            itemStyle: {
              color: {
                type: "linear",
                x: 0,
                y: 0,
                x2: 1,
                y2: 1,
                colorStops: [
                  {
                    offset: 0,
                    color: "rgba(64, 200, 169, 0.8)", // 0% 处的颜色
                  },
                  {
                    offset: 1,
                    color: "rgba(64, 200, 169, 0)", // 100% 处的颜色
                  },
                ],
              },
              borderColor: "#40C8A9",
              borderType: "solid",
              barBorderRadius: [15, 15, 0, 0],
            },
          },
        ],
      };
      window.onresize = function () {
        myChart.resize();
      };
      myChart.setOption(option);
    },

 

标签:圆柱,color,WidthAdaptive,柱状图,fontSize,rgba,type,echarts,255
来源: https://www.cnblogs.com/a973692898/p/15384433.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有