其他分享
首页 > 其他分享> > echarts饼图

echarts饼图

作者:互联网

 

饼图

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>饼图</title>
</head>
<body>
<!--第一步:引入echarts-->
<script src="js/echarts.js"></script>

<!--第二步:html DOM 中准备一个div,之后用于渲染echarts图表-->
<div id="main" style="width:600px;height:300px;"></div>

<script>
    /*echarts标签化引入*/
    var myChart = echarts.init(document.getElementById('main'));
    /*配置项*/
    var option = {
        title: {
            text: 'pie',
            subtext: '虚假数据',
            left: 'center'
        },
        tooltip: {
            trigger: 'item'
        },
        legend: {
            orient: 'vertical',
            left: 'left'
        },
        series: [
            {
                name: 'Access From',
                type: 'pie',
                radius: '50%',
                data: [
                    { value: 1048, name: 'Search Engine' },
                    { value: 735, name: 'Direct' },
                    { value: 580, name: 'Email' },
                    { value: 484, name: 'Union Ads' },
                    { value: 300, name: 'Video Ads' }
                ],
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    myChart.setOption(option);
</script>
</body>
</html>

 

 

标签:Ads,pie,value,name,echarts,left
来源: https://www.cnblogs.com/dzwj/p/15873286.html