• echarts


    1、实例一(曲线图)

    option = {
        title: {
            text: '堆叠区域图'
        },
        tooltip : {
            trigger: 'axis',
            axisPointer: {
                type: 'cross',
                label: {
                    backgroundColor: '#6a7985'
                }
            }
        },
        legend: {
            data:['邮件营销','联盟广告','视频广告','直接访问','搜索引擎']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type : 'category',
                boundaryGap : false,
                splitLine:{
                    show:true
                },
                show:false,
                data : ['周一','周二','周三','周四','周五','周六','周日']
            }
        ],
        yAxis : [
            {
                type : 'value',
                splitLine:{
                    show:true
                },
                axisLabel:{
                    show:false
                }
            }
        ],
        series : [
            {
                name:'邮件营销',
                type:'line',
                stack: '总量',
                areaStyle: {},
                lineStyle:{
                  normal:{
                      color:'yellow'
                  }  
                },
                data:[120, 132, 101, 134, 90, 230, 210]
            },
            {
                name:'联盟广告',
                type:'line',
                stack: '总量',
                areaStyle: {},
                lineStyle:{
                  normal:{
                      color:'red'
                  }  
                },
                data:[220, 182, 191, 234, 290, 330, 310]
            },
            {
                name:'视频广告',
                type:'line',
                stack: '总量',
                areaStyle: {},
                lineStyle:{
                  normal:{
                      color:'green'
                  }  
                },
                data:[150, 232, 201, 154, 190, 330, 410]
            },
            {
                name:'直接访问',
                type:'line',
                stack: '总量',
                areaStyle: {normal: {}},
                lineStyle:{
                  normal:{
                      color:'black'
                  }  
                },
                data:[320, 332, 301, 334, 390, 330, 320]
            },
            {
                name:'搜索引擎',
                type:'line',
                stack: '总量',
                label: {
                    normal: {
                        show: true,
                        position: 'top'
                    }
                },
                lineStyle:{
                  normal:{
                      color:'blue'
                  }  
                },
                areaStyle: {
                    normal: {
                        color:'orange'
                    }
                },
                data:[820, 932, 901, 934, 1290, 1330, 1320]
            }
        ]
    };

     2、实例二(柱状图)

    option = {
        xAxis: {
            name:'时间',
            nameTextStyle:{
                color:'lightgreen'
            },
            type: 'category',
            data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
            axisLabel:{
                show:false
            },
            axisTick:{
                show:false
            },
            axisLine:{
                lineStyle:{
                    color:'blue',
                    '10'
                }
            }
        },
        yAxis: {
            name:'数量',
            nameTextStyle:{
                color:'dark'
            },
            type: 'value',
            splitLine:{
                show:false
            },
            axisLabel:{
                show:false
            },
            axisTick:{
                show:false
            },
            axisLine:{
                lineStyle:{
                    color:'red',
                    '10'
                }
            },
            show:true
            
        },
        series: [{
            data: [{name:'Mon',value:120}, {name:'Tue',value:200}, {name:'Wed',value:150}, {name:'Thu',value:80}, {name:'Fri',value:70}, {name:'Sat',value:110}, {name:'Sun',value:130}],
            type: 'bar',
            color:function(params){
                var colorList = ['red','green','blue','yellow','white','black','gray'];
                return colorList[params.dataIndex];
            },
            label:{
                normal:{
                    formatter:function(params){
                        return params.name+' '+params.value;
                    },
                    show:true,
                    position:'top'
                }
            }
        }]
    };

    3、实例三饼状图

    4、实例四柱状图

    option = {
        title:{
            text:'柱状图',
            textStyle:{
                color:'red',
                fontSize:'40'
            }
        },
        xAxis: {
            name:'时间',
            nameTextStyle:{
                color:'lightgreen'
            },
            type: 'category',
            data: ['Mon', 'Tue'],
            axisLabel:{
                show:false
            },
            axisTick:{
                show:false
            },
            axisLine:{
                lineStyle:{
                    color:'blue',
                    '10'
                }
            }
        },
        yAxis: {
            name:'数量',
            nameTextStyle:{
                color:'dark'
            },
            type: 'value',
            splitLine:{
                show:false
            },
            axisLabel:{
                show:false
            },
            axisTick:{
                show:false
            },
            axisLine:{
                lineStyle:{
                    color:'red',
                    '10'
                }
            },
            show:true
            
        },
        series: [{
            data: [{name:'Mon',value:120}, {name:'Tue',value:200}],
            type: 'bar',
            silent:true,
            itemStyle:{
                borderWidth:'20',
                borderColor:'black',
                barBorderRadius:[5,5,5,5],
            },
            color:function(params){
                var colorList = ['yellow','yellow'];
                return colorList[params.dataIndex];
            },
            label:{
                normal:{
                    formatter:function(params){
                        return params.name+' '+params.value;
                    },
                    show:true,
                    position:'top'
                }
            }
        },{
            data: [{name:'Mon',value:60}, {name:'Tue',value:80}],
            type: 'bar',
            barGap:'-100%',
            color:function(params){
                var colorList = ['blue','yellow'];
                return colorList[params.dataIndex];
            },
            label:{
                normal:{
                    formatter:function(params){
                        return params.name+' '+params.value;
                    },
                    show:true,
                    position:'top'
                }
            },
            itemStyle:{
                normal:{
                    color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{
                                offset: 0,
                                color: "red" // 0% 处的颜色
                            }, {
                                offset: 0.6,
                                color: "blue" // 60% 处的颜色
                            }, {
                                offset: 1,
                                color: "yellow" // 100% 处的颜色
                            }], false)
                }
            }
        }]
    };
  • 相关阅读:
    ios 一个正则表达式测试(只可输入中文、字母和数字)
    IOS7 8中tableview分割线缺少15像素
    Java中使用OpenSSL生成的RSA公私钥进行数据加解密
    java与IOS之间的RSA加解密
    ios下使用rsa算法与php进行加解密通讯
    C# 32位md5
    [原]命令模式在MVC框架中的应用
    [原]【推荐】程序员必读的三十本经典巨作
    [原]容器学习(二):动手模拟AOP
    [原]容器学习(一):动手模拟spring的IoC
  • 原文地址:https://www.cnblogs.com/erdanyang/p/11605435.html
Copyright © 2020-2023  润新知