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>

 

echarts饼图

 

上一篇:有关Session和servletContext长期占用服务器内存的解决方案


下一篇:[ECS7天实践训练营 进阶路线] 成功案例 - 钉钉