ECharts数据可视化(绘制环形图)

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./echarts.js"></script>
</head>

<body>
    <div id="main" style="width: 600px; height: 400px;background-color: aquamarine;"></div>
    <script type="text/javascript">
        var myChart = echarts.init(document.getElementById("main"))
        var option = {
            title: {
                text: '影响健康、寿命的各类因素',
                subtext: 'WHO统计调查报告',
                left: 'center'
            },
            tooltip: {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            legend: {
                orient:'vertical',
                left:62,
                top:22,
                data: ['生活方式','遗传因素','社会因素','医疗条件','气候环境']
            },
            toolbox:{
                show:true,
                left:444,
                top:22,
                feature:{
                    mark:{show:true},
                    dataView:{show:true,readOnly:false},
                    magicType:{
                        show:true,
                        type:['pie','funnel'],
                        option:{
                            funnel:{
                                x:'25%',
                                width:'50%',
                                funnelAlign:'left',
                                max:1548
                            }
                        }
                    },
                    restore:{show:true},
                    saveAsImage:{show:true}
                }
            },
            calculable:true,
            series: [
                {
                name: '访问来源',
                type: 'pie',
                radius:['45%','75%'],
                center:['58%','55%'],
                data: [
                    {value:60,name:'生活方式'},
                    {value:15,name:'遗传因素'},
                    {value:10,name:'社会因素'},
                    {value:8,name:'医疗条件'},
                    {value:7,name:'气候环境'},
                ]
            }
        ]
        };
        myChart.setOption(option);
    </script>
</body>

</html>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./echarts.js"></script>
</head>

<body>
    <div id="main" style="width: 600px; height: 400px;background-color: aquamarine;"></div>
    <script type="text/javascript">
        var myChart = echarts.init(document.getElementById("main"))
        var option = {
            series: [
                {
                name: '专业名称',
                type: 'pie',
                radius:['10%','30%'],
                selectedMode:'single',
                label:{
                    posttion:'inner'
                },
                labelLine:{
                    show:false
                },
                data: [
                    {value:1200,name:'计算机学院'},
                    {value:900,name:'大数据学院'},
                    {value:600,name:'财经学院',selected:true}, 
                ]
            },
            {
                name: '专业名称',
                type: 'pie',
                radius:['40%','55%'],
                selectedMode:'single',
                data: [
                    {value:800,name:'生活方式'},
                    {value:400,name:'遗传因素'},
                    {value:500,name:'社会因素'},
                    {value:200,name:'医疗条件'},
                    {value:200,name:'气候环境'},
                    {value:400,name:'气候环境'},
                    {value:200,name:'气候环境'},
                ]
            }
        ]
        };
        myChart.setOption(option);
    </script>
</body>

</html>

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

殊迟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值