echarts故障统计多维柱状图 堆叠柱状图 柱状图Demo2

黑底:echarts链接:http://gallery.echartsjs.com/editor.html?c=xnP8JPeu4R

option = {
    backgroundColor: 'black',
    color: ['#FFC90E', '#ED1C24'],
    title: {
        text: '故障统计',
        x: 'center',
        textStyle: {
            fontWeight: 'normal',
            color: 'white',
            fontSize: 18
        },
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: { // 坐标轴指示器,坐标轴触发有效
            type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
        }
    },
    legend: {
        x: 'center',
        y: 'bottom',
        textStyle: {
            color: 'white',
            fontSize: 14
        },
        data: ['预警', '报警']
    },
    grid: {
        left: '0%',
        right: '0%',
        bottom: '13%',
        top: '16.5%',
        containLabel: true,
    },
    toolbox: {
        show: true,
        //orient: 'vertical',//默认是横向,这个是纵向
        x: 'center',
        y: '65',
        feature: {
            dataView: { //数据视图
                show: true,
                readOnly: false
            },
            magicType: { //动态类型切换
                show: true,
                type: ['line', 'bar', 'stack', 'tiled']
                //      折线,  柱状,   堆叠,    平铺
            },
            restore: { //重置
                show: true
            },
            saveAsImage: { //保存图片
                show: true
            },
        },
        iconStyle: {
            normal: {
                color: 'white', //设置图标颜色
            },
            emphasis: { //字体颜色及位置
                color: 'white',
                textPosition: 'bottom'
            }
        }
    },
    xAxis: [{
        type: 'category',
        axisTick: {
            alignWithLabel: true
        },
        axisLine: {
            lineStyle: {
                color: 'white',
            }
        },
        axisLabel: {
            show: true,
            color: 'white',
            textStyle: {
                fontSize: 18
            }
        },
        data: ['a', 'b', 'c']
    }],
    yAxis: [{
        splitLine: {
            show: false
        },
        axisTick: {
            show: false
        },
        axisLine: {
            lineStyle: {
                color: 'white',
            }
        },
        axisLabel: {
            color: 'white',
            formatter: '{value}',
            textStyle: {
                fontSize: 18
            }
        },
        type: 'value'
    }],
    series: [{
            name: '预警',
            type: 'bar',
            barWidth: '15%',
            data: [50, 66, 57],
            itemStyle: {
                normal: {
                    label: {
                        show: true, //开启显示
                        position: 'top', //在上方显示
                        textStyle: { //数值样式
                            color: 'white',
                            fontSize: 16
                        }
                    }
                }
            }
        },
        {
            name: '报警',
            type: 'bar',
            barWidth: '15%',
            data: [23, 12, 26],
            itemStyle: {
                normal: {
                    label: {
                        show: true, //开启显示
                        position: 'top', //在上方显示
                        textStyle: { //数值样式
                            color: 'white',
                            fontSize: 16
                        }
                    }
                }
            }
        }
    ]
};

白底:echarts链接:http://gallery.echartsjs.com/editor.html?c=xNZkb_tsV1

option = {
    backgroundColor: 'white',
    color: ['#FFC90E', '#ED1C24'],
    title: {
        text: '故障统计',
        x: 'center',
        textStyle: {
            fontWeight: 'normal',
            color: 'white',
            fontSize: 18
        },
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: { // 坐标轴指示器,坐标轴触发有效
            type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
        }
    },
    legend: {
        x: 'center',
        y: 'bottom',
        textStyle: {
            color: 'black',
            fontSize: 14
        },
        data: ['预警', '报警']
    },
    grid: {
        left: '0%',
        right: '0%',
        bottom: '13%',
        top: '16.5%',
        containLabel: true,
    },
    toolbox: {
        show: true,
        //orient: 'vertical',//默认是横向,这个是纵向
        x: 'center',
        y: '65',
        feature: {
            dataView: { //数据视图
                show: true,
                readOnly: false
            },
            magicType: { //动态类型切换
                show: true,
                type: ['line', 'bar', 'stack', 'tiled']
                //      折线,  柱状,   堆叠,    平铺
            },
            restore: { //重置
                show: true
            },
            saveAsImage: { //保存图片
                show: true
            },
        },
        iconStyle: {
            normal: {
                color: 'white', //设置图标颜色
            },
            emphasis: { //字体颜色及位置
                color: 'black',
                textPosition: 'bottom'
            }
        }
    },
    xAxis: [{
        type: 'category',
        axisTick: {
            alignWithLabel: true
        },
        axisLine: {
            lineStyle: {
                color: 'black',
            }
        },
        axisLabel: {
            show: true,
            color: 'black',
            textStyle: {
                fontSize: 18
            }
        },
        data: ['a', 'b', 'c']
    }],
    yAxis: [{
        splitLine: {
            show: false
        },
        axisTick: {
            show: false
        },
        axisLine: {
            lineStyle: {
                color: 'black',
            }
        },
        axisLabel: {
            color: 'black',
            formatter: '{value}',
            textStyle: {
                fontSize: 18
            }
        },
        type: 'value'
    }],
    series: [{
            name: '预警',
            type: 'bar',
            barWidth: '15%',
            data: [50, 66, 57],
            itemStyle: {
                normal: {
                    label: {
                        show: true, //开启显示
                        position: 'top', //在上方显示
                        textStyle: { //数值样式
                            color: 'black',
                            fontSize: 16
                        }
                    }
                }
            }
        },
        {
            name: '报警',
            type: 'bar',
            barWidth: '15%',
            data: [23, 12, 26],
            itemStyle: {
                normal: {
                    label: {
                        show: true, //开启显示
                        position: 'top', //在上方显示
                        textStyle: { //数值样式
                            color: 'black',
                            fontSize: 16
                        }
                    }
                }
            }
        }
    ]
};

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值