美文网首页
echarts柱状折线图(成功失败)

echarts柱状折线图(成功失败)

作者: de_self | 来源:发表于2019-03-11 14:36 被阅读0次

场景:
统计某服务端口调用次数同时直观的表现成功与失败次数

https://gallery.echartsjs.com/editor.html?c=x61BHUtioQ

图片.png
var xData = function() {
    var data = [];
    for (var i = 1; i < 13; i++) {
        data.push(i + "月");
    }
    return data;
}();

option = {
    backgroundColor: "#344b58",
    "title": {
        "text": "服务调用统计",
        "subtext": "BY Wang Dingding",
        x: "4%",

        textStyle: {
            color: '#fff',
            fontSize: '22'
        },
        subtextStyle: {
            color: '#90979c',
            fontSize: '16',

        },
    },
    "tooltip": {
        "trigger": "axis",
        "axisPointer": {
            "type": "shadow",
            textStyle: {
                color: "#fff"
            }

        },
    },
    "grid": {
        "borderWidth": 0,
        "top": 110,
        "bottom": 95,
        textStyle: {
            color: "#fff"
        }
    },
    "legend": {
        x: '4%',
        top: '11%',
        textStyle: {
            color: '#90979c',
        },
        "data": ['成功', '失败', '总数']
    },
     

    "calculable": true,
    "xAxis": [{
        "type": "category",
        "axisLine": {
            lineStyle: {
                color: '#90979c'
            }
        },
        "splitLine": {
            "show": false
        },
        "axisTick": {
            "show": false
        },
        "splitArea": {
            "show": false
        },
        "axisLabel": {
            "interval": 0,

        },
        "data": xData,
    }],
    "yAxis": [{
        "type": "value",
        "splitLine": {
            "show": false
        },
        "axisLine": {
            lineStyle: {
                color: '#90979c'
            }
        },
        "axisTick": {
            "show": false
        },
        "axisLabel": {
            "interval": 0,

        },
        "splitArea": {
            "show": false
        },

    }],
    "dataZoom": [{
        "show": true,
        "height": 30,
        "xAxisIndex": [
            0
        ],
        bottom: 30,
        "start": 10,
        "end": 80,
        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:"#fff"},
           borderColor:"#90979c"
        
        
    }, {
        "type": "inside",
        "show": true,
        "height": 15,
        "start": 1,
        "end": 35
    }],
    "series": [{
            "name": "成功",
            "type": "bar",
            "stack": "总量",
            "barMaxWidth": 35,
            "barGap": "10%",
            "itemStyle": {
                "normal": {
                    "color": "rgba(103,194,58,1)",
                    "label": {
                        "show": true,
                        "textStyle": {
                            "color": "#fff"
                        },
                        "position": "insideTop",
                        formatter: function(p) {
                            return p.value > 0 ? (p.value) : '';
                        }
                    }
                }
            },
            "data": [
                709,
                1917,
                2455,
                2610,
                1719,
                1433,
                1544,
                3285,
                5208,
                3372,
                2484,
                4078
            ],
        },

        {
            "name": "失败",
            "type": "bar",
            "stack": "总量",
            "itemStyle": {
                "normal": {
                    "color": "rgba(245,108,108,1)",
                    "barBorderRadius": 0,
                    "label": {
                        "show": true,
                        "position": "top",
                        formatter: function(p) {
                            return p.value > 0 ? (p.value) : '';
                        }
                    }
                }
            },
            "data": [
                327,
                1776,
                507,
                1200,
                800,
                482,
                204,
                1390,
                1001,
                951,
                381,
                220
            ]
        }, {
            "name": "总数",
            "type": "line",
            "stack": "总量",
            symbolSize:10,
            symbol:'circle',
            "itemStyle": {
                "normal": {
                    "color": "rgba(230,162,60,1)",
                    "barBorderRadius": 0,
                    "label": {
                        "show": true,
                        "position": "top",
                        formatter: function(p) {
                            return p.value > 0 ? (p.value) : '';
                        }
                    }
                }
            },
            "data": [
                1036,
                3693,
                2962,
                3810,
                2519,
                1915,
                1748,
                4675,
                6209,
                4323,
                2865,
                4298
            ]
        },
    ]
}

相关文章

  • 如何设置echarts随页面大小变化自适应

    echarts折线图随页面大小变化自适应 在项目中应用做echarts折线图,柱状图时会碰到需求是echarts会...

  • echarts柱状折线图(成功失败)

    场景:统计某服务端口调用次数同时直观的表现成功与失败次数 https://gallery.echartsjs.co...

  • React-Echarts-通用配置

    Echarts图标通用配置 实际截图: React 中使用Echarts图表 实际截图 折线图 柱状图:

  • Android项目中使用echarts

    之前都是在web网页端使用echarts,现在在android项目中使用echarts,实现柱状图、折线图、雷达图...

  • Echarts给Y轴、tooltip添加单位

    Echarts中给Y轴加单位 Echarts中给tooltip加单位 折线图相关配置 配置如下: 柱状图相关配置 ...

  • 2019-01-18 ECharts

    今天接触了ECharts,ECharts 提供了常规的折线图、柱状图、散点图、饼图、K线图,用于统计的盒形图,用于...

  • echart清空折线图数据

    如何在获取新的数据前清空echarts折线图、柱状图中所有的折线和柱子? 在echarts的操作实际运用中...

  • echarts的学习与实战大数据首页

    关于echarts项目用到挺多,柱状图,折线图,进度图,指针图和饼图echarts的配置项比较多,用起来比较繁琐和...

  • ECharts插件使用

    柱状图,折线图,饼图 初始化echarts实例 1.准备一个div容器,为Echarts准备一个具备大小(宽高)的...

  • 使用echarts画多维柱状图

    前言在此之前,已经跟大家分享了如何使用echarts画折线图、双折线图、柱状图,今天跟大家分享一下使用echart...

网友评论

      本文标题:echarts柱状折线图(成功失败)

      本文链接:https://www.haomeiwen.com/subject/nxfbpqtx.html