zoukankan      html  css  js  c++  java
  • 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)
                }
            }
        }]
    };
  • 相关阅读:
    【Kubernetes】kubeadm 安装集群(二)
    【Kubernetes】kubeadm 安装集群(一)
    StringBuffer的delete方法与deleteCharAt的区别
    LinkedHashMap和hashMap和TreeMap的区别
    HashMap源码解读(JDK1.7版)
    JPA中save和saveAndFlush的区别
    python 描述符专项
    python的协程(Coroutine)思想【生成器】
    python元编程3【type类继承和__new__,__init__参数传递】
    python元编程2【type类创建对象2种方法】
  • 原文地址:https://www.cnblogs.com/erdanyang/p/11605435.html
Copyright © 2011-2022 走看看