• ECharts—饼图案例


    ECharts—饼图案例

    帮助

    ECharts:ECharts

    img

    饼图样式

    option = {
            title: {
              text: '验光异常数', //主标题
              subtext: 123, //副标题
              textStyle: {
                //文本样式
                color: '#ff8484',
                fontSize: 12,
              },
              left: 'center',
              top: 'center', //文字位置
            },
            angleAxis: {
              max: 123,
              clockwise: true, // 逆时针
              // 隐藏刻度线
              axisLine: {
                show: false,
              },
              axisTick: {
                show: false,
              },
              axisLabel: {
                show: false,
              },
              splitLine: {
                show: false,
              },
            },
            radiusAxis: {
              type: 'category',
              clockwise: true, // 逆时针
              // 隐藏刻度线
              axisLine: {
                show: false,
              },
              axisTick: {
                show: false,
              },
              axisLabel: {
                show: false,
              },
              splitLine: {
                show: false,
              },
            },
            polar: {
              center: ['50%', '50%'], //图形位置
              radius: '100%', //图形大小
            },
            series: [
              {
                type: 'bar',
                data: [
                  {
                    value: 63, // 当前数量
                    itemStyle: {
                      normal: {
                        color: {
                          // 完成的圆环的颜色
                          colorStops: [
                            {
                              offset: 0,
                              color: '#ff8484', // 0% 处的颜色
                            },
                            {
                              offset: 1,
                              color: '#ff8484', // 100% 处的颜色
                            },
                          ],
                        },
                      },
                    },
                  },
                ],
                coordinateSystem: 'polar',
                roundCap: true,
                barWidth: 10,
                barGap: '-100%', // 两环重叠
                radius: ['49%', '52%'],
                z: 2,
              },
              {
                // 灰色环
                type: 'bar',
                data: [
                  {
                    value: 123, // 总体数量
                    itemStyle: {
                      color: 'rgba(255, 255, 255, 0.3)',
                    },
                  },
                ],
                coordinateSystem: 'polar',
                animation: false,
                roundCap: true,
                barWidth: 10,
                barGap: '-100%', // 两环重叠
                radius: ['48%', '53%'],
                z: 1,
              },
            ],
          }
    

    全部代码

    historyO() {
          let myChart = echarts.init(document.getElementById('historyO'))
          let option = {}//饼图样式
          myChart.setOption(option)
    
          window.addEventListener('resize', function () {
            myChart.resize()
          })
        },
    
  • 相关阅读:
    hbuilder中如何使用egit上传项目
    网络攻防第二周学习笔记
    sqlserver两表关联的更新
    ISAPI_rewrite中文手册
    Unity中C#单例模式使用总结
    Window Live Writer Test
    Spring Cloud 服务注册与发现(Eureka 找到了!找到了! 嘻嘻)
    Spring Cloud 服务消费与负载均衡(feign)
    Spring Cloud 服务消费与负载均衡(Rest + Ribbon )
    列表的响应式排版
  • 原文地址:https://www.cnblogs.com/xz233/p/14357863.html
Copyright © 2020-2023  润新知