zoukankan      html  css  js  c++  java
  • 折线图

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <title>ECharts-基本线性图及其配置要求</title>
    <!-- ECharts单文件引入 -->
    <script type="text/javascript" src="jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="echarts.min.js"></script>
    </head>
    <body>
    <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
    <div id="box" style="height:400px; 800px;padding: 20px"></div>
    </div>
    <script>
    // 获取到这个DOM节点,然后初始化

    var myChart = echarts.init(document.getElementById("box"));
    var option = {
    // 标题
    title: {
    text: '地市使用量变化趋势',
    //subtext: '数据来源:华秉科技-dancer'
    },
    tooltip: {
    trigger: 'axis'
    },
    //图例名
    legend: {
    // data:['参加活动人数','分享人数','关注人数','注册人数','领取红包人数']
    },
    grid: {
    left: '3%', //图表距边框的距离
    right: '4%',
    bottom: '3%',
    containLabel: true
    },
    //工具框,可以选择
    toolbox: {
    orient:'horizontal',
    feature: {
    saveAsImage: {}
    }
    },
    //x轴信息样式
    xAxis: {
    type: 'category',
    boundaryGap: false,
    data: ['2015-09','2015-10','2015-11','2015-12','2016-01','2016-02','2016-03','2016-04','2016-05','2016-06','2016-07','2016-08'],
    //坐标轴颜色
    axisLine:{
    lineStyle:{
    color:'red'
    }
    },
    //x轴文字旋转

    },

    yAxis : [
    {
    type : 'value',
    axisLabel : {
    formatter: '{value} 人'
    }
    }
    ],
    series: [
    //虚线
    {
    name:'参加活动人数',
    type:'line',
    symbolSize:4, //拐点圆的大小
    color:['red'], //折线条的颜色
    data:[1000, 300, 500, 800, 300, 600,500,800, 300, 500, 800, 300, 600,500],
    smooth:false, //关键点,为true是不支持虚线的,实线就用true
    itemStyle:{
    normal:{
    lineStyle:{
    2,
    type:'dotted' //'dotted'虚线 'solid'实线
    }
    }
    }
    },
    //实线
    {
    name:'分享人数',
    type:'line',
    symbol:'circle',
    symbolSize:4,
    itemStyle:{
    normal:{
    color:'red',
    borderColor:'red' //拐点边框颜色
    }
    },
    data:[220, 182, 191, 234, 290, 330, 310,220, 182, 191, 234, 290, 330, 310]
    },
    {
    name:'关注人数',
    type:'line',
    // stack: '总量',
    symbolSize:4,
    color:['orange'],
    smooth:false, //关键点,为true是不支持虚线的,实线就用true
    itemStyle:{
    normal:{
    lineStyle:{
    2,
    type:'dotted' //'dotted'虚线 'solid'实线
    }
    }
    },
    data:[500, 232, 201, 154, 190, 330, 410,150, 232, 201, 154, 190, 330, 410]
    },
    {
    name:'注册人数',
    type:'line',
    symbolSize:4,
    color:['blue'],
    itemStyle:{
    normal:{
    lineStyle:{
    2,
    type:'dotted' //'dotted'虚线 'solid'实线
    }
    }
    },
    data:[300, 232, 201, 154, 190, 330, 410,150, 232, 201, 154, 190, 330, 410]
    },
    {
    name:'领取红包人数',
    type:'line',
    color:['green'],
    symbol:'circle',
    symbolSize:4,
    data:[310, 352, 280, 334, 373, 310, 340,300, 350, 280, 350, 340, 370, 310],
    itemStyle:{
    normal:{
    color:'green',
    borderColor:'green'
    }
    }
    }
    ]
    };

    myChart.setOption(option);
    </script>
    </body>
    </html>
  • 相关阅读:
    Java的静态块与实例块(转)
    Programming Ability Test学习 1031. Hello World for U (20)
    Programming Ability Test学习 1011. World Cup Betting (20)
    Programming Ability Test学习 1027. Colors in Mars (20)
    Programming Ability Test学习 1064. Complete Binary Search Tree (30)
    Programming Ability Test学习 1008. Elevator (20)
    【maven详解-生命周期】Maven的生命周期和插件
    【maven详解-插件】maven插件学习之源码插件Source Xref
    $(document).ready(){}、$(fucntion(){})、(function(){})(jQuery)onload()的区别
    你还没真的努力过,就轻易输给了懒惰
  • 原文地址:https://www.cnblogs.com/junmoli/p/8711467.html
Copyright © 2011-2022 走看看