• Echarts折线图,适配可移动


    可见:https://gallery.echartsjs.com/editor.html?c=xSaQ9DuB9T&v=1

    <div id="main" style=" 100%;height:650px;margin: 0 auto;"></div>
    <script>
    var myChart = this.$echarts.init(document.getElementById('main'));
    var option = {
        title: {
            text: '运营商、代理商、企业会员增长趋势图(以30天为1个周期)',
            left: 0,
            top: 4,
            textStyle: {
                fontFamily: 'MicrosoftYaHei',
                fontSize: 17,
                color: '#2b3b60',
                fontWeight: 500,
            },
        },
        backgroundColor: '#fff',
        tooltip: {
            trigger: 'axis',
            axisPointer: { // 坐标轴指示器,坐标轴触发有效
                type: 'line' // 默认为直线,可选为:'line' | 'shadow'
            }
        },
        grid: {
            left: '2%',
            right: '4%',
            bottom: '14%',
            top: '16%',
            containLabel: true
        },
        legend: {
            data: ['企业会员总数', '代理商总数', '运营商总数'],
            right: 10,
            top: 12,
            textStyle: {
                color: "#2b3b60"
            },
            itemWidth: 12,
            itemHeight: 10,
            // itemGap: 35
        },
        xAxis: {
            type: 'category',
            data: ['2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019'],
            axisLine: {
                lineStyle: {
                    color: '#d2d9e4'
                }
            },
            axisLabel: {
                textStyle: {
                    fontFamily: 'Microsoft YaHei',
                    color: '#6175a2'
                }
            },
        },
        yAxis: {
            type: 'value',
            max: '1200',
            axisLine: {
                show: false,
                lineStyle: {
                    color: '#6175a2'
                }
            },
            splitLine: {
                show: true,
                lineStyle: {
                    type: 'dashed',
                    color: '#d2d9e4'
                }
            },
            axisLabel: {}
        },
        "dataZoom": [{
            "show": true,
            "height": 15,
            "xAxisIndex": [
                0
            ],
            bottom: '8%',
            "start": 10,
            "end": 90,
            handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
            handleSize: '110%',
            handleStyle: {
                color: "#d3dee5",
            },
            textStyle: {
                color: "#6175a2"
            },
            borderColor: "rgba(144,151,156, 0.3)"
        }, {
            "type": "inside",
            "show": true,
            "height": 15,
            "start": 1,
            "end": 35
        }],
        series: [{
                name: '企业会员总数',
                type: 'line',
                barWidth: '15%',
                showAllSymbol: true,
                symbol: 'emptyCircle',
                symbolSize: 10, //圆圈圈的大小
                itemStyle: {
                    normal: {
                         5,
                        color: '#498cfc',
                        barBorderRadius: 11,
                    },
                },
                // symbol:'none',//去掉点的
                smooth: true, //曲线变平滑的
                lineStyle: {
                    normal: {
                         3, //折线的borderWidth 宽
                        shadowColor: 'rgba(73,140,252, 0.5)',
                        shadowBlur: 10,
                        shadowOffsetY: 7
                    },
                },
                data: [600, 1000, 600, 1000, 600, 1000, 600, 1000, 600]
            },
            {
                name: '代理商总数',
                type: 'line',
                barWidth: '15%',
                showAllSymbol: true,
                symbol: 'emptyCircle',
                symbolSize: 10, //圆圈圈的大小
                itemStyle: {
                    normal: {
                         5,
                        color: '#f9b555',
                        barBorderRadius: 11,
                        // borderWidth: 1,//折点圆圈大小
                    }
                },
                smooth: true, //曲线变平滑的
                lineStyle: {
                    normal: {
                         3,
                        shadowColor: 'rgba(249,181,85, 0.5)',
                        shadowBlur: 10,
                        shadowOffsetY: 7
                    },
                },
                data: [400, 600, 400, 600, 400, 600, 400, 600, 400]
            },
            {
                name: '运营商总数',
                type: 'line',
                barWidth: '15%',
                showAllSymbol: true,
                symbol: 'emptyCircle',
                symbolSize: 10, //圆圈圈的大小
                itemStyle: {
                    normal: {
                        show: true,
                        color: '#55cf96',
                        barBorderRadius: 11,
                    }
                },
                smooth: true, //曲线变平滑的
                lineStyle: {
                    normal: {
                         3,
                        shadowColor: 'rgba(85,207,150, 0.5)',
                        shadowBlur: 10,
                        shadowOffsetY: 7
                    },
                },
                data: [1000, 1200, 1000, 1200, 1000, 1200, 1000, 1200, 1000]
            }
        ]
    };
    myChart.setOption(option);
    setTimeout(function (){
      window.onresize = function () {
        myChart.resize();
        myChartDevice.resize();
      }
    },200)
    </script>    
  • 相关阅读:
    MSN、易趣、大旗被挂马 用户浏览后感染机器狗病毒 狼人:
    世界最大漏洞数据库发布最新研究报告 狼人:
    五角大楼最昂贵武器发展项目遭到黑客攻击 狼人:
    RSA呼吁厂商“创造性协作” 共同反击网络威胁 狼人:
    RSA2009:云计算服务如何保证安全? 狼人:
    黑客工具可将恶意软件隐藏于.Net框架 狼人:
    RSA安全大会将亮相25款热门安全产品 狼人:
    目录访问共享C#怎么访问共享目录
    代码下行Jquery结合Ajax和Web服务使用三层架构实现无刷新分页
    输出次数HDU2192:MagicBuilding
  • 原文地址:https://www.cnblogs.com/alizhi/p/11179694.html
Copyright © 2020-2023  润新知