首页 > 其他 > 详细

echarts图表折线图

时间:2020-01-15 21:21:34      阅读:87      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <!-- <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script> -->
    <script src="echarts.min.js"></script>
    <title></title>
    <style>
    </style>
</head>

<body>
    <div class="chart" id="main" style="width: 600px; height: 400px;"></div>
    <script>
        // 基于准备好的dom,初始化echarts实例
        var myChart = echarts.init(document.getElementById(‘main‘));
        // 指定图表的配置项和数据
        var option = {
            animation: false,
            tooltip: {
                trigger: ‘axis‘ 
            },
            grid: { top: 5, bottom: 5, left: 5, right: 5 },
            xAxis: {
                type: ‘category‘,
                show: false, // 不显示横坐标
                splitLine: { show: false },
                data: [‘20191013‘, ‘20191014‘, ‘20191015‘, ‘20191016‘, ‘20191017‘, ‘20191018‘, ‘20191019‘]
            },
            yAxis: {
                type: ‘value‘,
                show: false,
                axisLine: { show: false },
                axisTick: { show: false },
                splitLine: { show: false },
                scale: true
            },
            series: [{
                // 系列: 一组数值以及他们映射成的图
                type: ‘line‘,
                name: ‘销量‘,
                symbol: ‘none‘,
                smooth: true,
                color: [‘#6FA9FA‘],
                areaStyle: {
                    normal: {
                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                            { offset: 0, color: ‘#6FA9FA‘ },
                            { offset: 1, color: ‘#fff‘ }
                        ])
                    }
                },
                data: [‘0‘, ‘0‘, ‘1‘, ‘0‘, ‘2‘, ‘0‘, ‘0‘]
            }],
        };
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>

</html>

echarts图表折线图

原文:https://www.cnblogs.com/gengxinnihaoma/p/12198469.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!