zoukankan      html  css  js  c++  java
  • 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
                            }
                        }
                    }
                }
            }
        ]
    };
  • 相关阅读:
    [转]oracle 12c 中的分页子句
    display:table; 也可以实现 div 始终和内包的图片大小相同
    mongodb与SQL常见语句对照
    js生成验证码
    javascript 判断空数组
    网络绘制插件
    mongodb中查询返回指定字段
    Mybatis获取插入记录的自增长ID
    mysql 创建索引和删除索引
    Java 中 HashMap 初始化时赋值
  • 原文地址:https://www.cnblogs.com/raitorei/p/9947716.html
Copyright © 2011-2022 走看看