zoukankan      html  css  js  c++  java
  • 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()
          })
        },
    
  • 相关阅读:
    Js中的正则表达式
    js内存泄露的几种情况
    JavaScript的setTimeout与setInterval执行时机
    IE模拟addDOMLoadEvent和jQuery的ready实现
    谈谈JavaScript的异步实现
    在iOS7中修改状态栏字体的颜色
    IOS 疯狂基础之 页面间跳转
    ATL2.1版的CString分析
    翻译: 如何改变MFC应用程序主窗口的类名
    VC5.0中的ATL的一个有趣的bug
  • 原文地址:https://www.cnblogs.com/xz233/p/14357863.html
Copyright © 2011-2022 走看看