Echarts图表之变形圆环图(二)

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>Echarts图表</title>
        <!-- 引入echarts.min.js -->
        <script src="https://cdn.staticfile.org/echarts/4.3.0/echarts.min.js"></script>
    </head>
    <body>
        <div id="main" style="width: 600px;height:400px;"></div>
        <script type="text/javascript">
            var myChart = echarts.init(document.getElementById('main'));
            var option = {
                backgroundColor: 'rgba(1,202,217,.2)',
                // 图例
                legend: {
                    data: ['公路营运载客', '公路营运载货']
                },
                // 图表标题
                title: {
                    left: '30%',
                    top: '60%',
                    text: '2018年公路运营拥有量(145.18万辆)',
                    textStyle: {
                        color: '#fff',
                        fontSize: 14,
                        //文字描边
                        textBorderColor: 'red'
                    }
                },
                series: [{
                        name: '公路',
                        type: 'pie',
                        // 选中模式,表示是否支持多个选中,默认关闭,支持布尔值和字符串,字符串取值可选‘single’,‘multiple’,分别表示单选还是多选。
                        selectedMode: 'single',
                        radius: [0, '32%'],
                        // 标签不显示
                        label: {
                            normal: {
                                show: false
                            }
                        },
                        // 标签线不显示
                        labelLine: {
                            normal: {
                                show: false
                            }
                        },
                        data: [{
                            value: 40,
                            name: '客运',
                            itemStyle: {
                                normal: {
                                    color: '#ff4948'
                                }
                            }
                        }]
                    },
                    {
                        name: '营运',
                        type: 'pie',
                        radius: ['42%', '55%'],
                        label: {
                            normal: {
                                show: true
                            }
                        },
                        labelLine: {
                            normal: {
                                show: true
                            }
                        },
                        data: [{
                                value: 98.26,
                                name: '公路营运载客',
                                itemStyle: {
                                    normal: {
                                        color: '#ffa74d'
                                    }
                                }
                            },
                            {
                                value: 1.74,
                                name: '公路营运载货',
                                itemStyle: {
                                    normal: {
                                        color: '#4af0fe'
                                    }
                                }
                            }
                        ]
                    }
                ]
            }
            myChart.setOption(option);
        </script>
    </body>
</html> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值