echartsConfig.js 9.93 KB
var warehouseHealthOption = {
    color: ['#04efcd', '#fdb300', '#f43d33'],
    tooltip: {
        trigger: 'axis',
        // 鼠标放上去显示百分比
        // formatter: '{c}%',
        formatter: function (params) {
            var result = params[0].name + '<br>';
            params.forEach(function (item) {
                if (item.value) {
                    result += item.marker + '  ' + item.value + '%</br>';
                } else {
                    result += item.marker + '   - </br>';
                }
            });
            return result;
        },
        axisPointer: {
            // Use axis to trigger tooltip
            type: 'shadow', // 'shadow' as default; can also be 'line' or 'shadow'
        },
    },
    legend: {},
    grid: {
        top: '18%',
        left: '1%',
        right: '3%',
        bottom: '0%',
        containLabel: true,
    },
    xAxis: {
        type: 'category',
        axisLabel: {
            // rotate: -15, // 角度值:Number
            // fontSize: 11, // 顺便调小一点字体大小
            textStyle: {
                color: '#fff',
            },
        },
        axisLine: {
            lineStyle: {
                color: '#afa3a3', // X轴线的颜色
                width: 1, // x轴线的宽度
            },
        },
        data: [],
    },

    yAxis: {
        type: 'value',
        min: 0, //最小百分比
        max: 100, //最大百分比
        splitLine: true,
        axisTick: {
            show: true,
            alignWithLabel: true,
        },
        axisLabel: {
            show: true,
            interval: 'auto',
            formatter: '{value}%', //y轴数值,带百分号
            textStyle: {
                color: '#fff',
            },
        },

        axisLine: {
            lineStyle: {
                color: '#afa3a3', // y轴线的颜色
                width: 1, // y轴线的宽度
            },
        },
    },

    series: [
        {
            type: 'bar',
            barWidth: '23%',
            stack: 'Ad',
            emphasis: {
                focus: 'series',
            },
            itemStyle: {
                normal: {
                    label: {
                        show: false, //开启显示数值
                        formatter: function (params) {
                            //标签内容
                            return params.value + '%';
                        },
                        position: 'bottom', //数值在上方显示
                        textStyle: {
                            //数值样式
                            color: '#fff', //字体颜色
                            fontSize: 19, //字体大小
                        },
                    },
                },
            },
            data: [],
        },
        {
            type: 'bar',
            stack: 'Ad',
            emphasis: {
                focus: 'series',
            },
            itemStyle: {
                normal: {
                    label: {
                        show: false, //开启显示数值
                        formatter: function (params) {
                            //标签内容
                            return params.value + '%';
                        },
                        position: 'bottom', //数值在上方显示
                        textStyle: {
                            //数值样式
                            color: '#000000', //字体颜色
                            fontSize: 10, //字体大小
                        },
                    },
                },
            },
            data: [],
        },
        {
            type: 'bar',
            stack: 'Ad',
            emphasis: {
                focus: 'series',
            },
            itemStyle: {
                normal: {
                    label: {
                        show: true, //开启显示数值
                        formatter: function (params) {
                            //标签内容
                            return params.value + '%';
                        },
                        position: 'top', //数值在上方显示
                        textStyle: {
                            //数值样式
                            color: '#ffff', //字体颜色
                            // fontSize: 10, //字体大小
                        },
                    },
                },
            },
            data: [],
        },
    ],
};
var OrderTrendsEcharts = {
    title: {
        left: 20,
        top: 7,
        text: '堆垛机任务',
        //textStyle 设置标题文字的样式
        textStyle: {
            color: '#ffff',
            fontSize: 14,
        },
    },
    tooltip: {
        trigger: 'axis',
    },
    legend: {
        show: true,
        right: 15, //控制图例位置
        top: 8,
        itemHeight: 8,
        itemWidth: 12,
        itemGap: 8, //图例之间的间距
        textStyle: {
            //图例文字设置
            fontSize: 12,
            fontWeight: 'bolder',
            color: '#ffffff',
        },
    },
    grid: {
        left: '2%',
        right: '8%',
        bottom: '3%',
        //  // 是否显示刻度标签
        containLabel: true,
    },
    xAxis: {
        type: 'category',
        axisLabel: {
            textStyle: {
                // 设置文字样式
                color: '#ffffff',
            },
        },
        // 线的样式
        axisLine: {
            lineStyle: {
                color: 'rgb(79, 81, 87)', // X轴线的颜色
                width: 1, // x轴线的宽度
            },
        },
        // 设置线的刻度
        axisTick: {
            show: false, //是否展示刻度线
            inside: true, //刻度线朝内还是朝外
            // 坐标轴的刻度
            length: 8, // 长度
        },
        // prettier-ignore
        data: [],
    },

    yAxis: {
        //y轴大小值
        // min: 0,

        // max: 1000,
        type: 'value',

        splitLine: {
            //网格线 默认不显示
            show: false,
        },
        //name: 'y轴单位',//可写可不写

        // 轴标签的对应的文字样式
        axisLabel: {
            // 此处是给y轴加上% 显示百分比,根据需求来选择受否要%
            formatter: '{value} ',
            textStyle: {
                // 设置文字样式
                color: '#ffffff',
            },
        },
        // 线的样式
        axisLine: {
            show: true,
            lineStyle: {
                color: 'rgb(79, 81, 87)', // X轴线的颜色
                width: 1, // x轴线的宽度
            },
        },

        axisTick: {
            // 坐标轴的刻度
            show: false, // 是否显示
            inside: true, // 是否朝内
            length: 6, // 长度
            lineStyle: {
                color: 'rgb(79, 81, 87)', // 默认取轴线的颜色
                width: 1,
                type: 'solid',
            },
        },
    },
    series: [
        {
            name: '出库',
            type: 'bar',
            //showBackground: true,
            itemStyle: {
                normal: {
                    color: 'rgb(37, 165, 202)',
                    label: {
                        show: true, //开启显示
                        position: 'top', //在上方显示
                        formatter: function (val) {
                            if (val.value == 0) {
                                return ""
                            }
                        },
                        textStyle: { //数值样式
                            color: '#FFF',
                            fontSize: 7
                        }
                    }
                },
            },
            data: [],
        },
        {
            name: '入库',
            type: 'bar',

            itemStyle: {
                normal: {
                    color: 'rgb(118, 88, 200)',
                    label: {
                        show: true, //开启显示
                        position: 'top', //在上方显示
                        formatter: function (val) {
                            if (val.value == 0) {
                                return ""
                            }
                        },
                        textStyle: { //数值样式
                            color: '#FFF',
                            fontSize: 7
                        }
                    }
                },
            },
            data: [],
        },
        {
            name: '移库',
            type: 'bar',

            itemStyle: {
                normal: {
                    color: '#fdb300',
                    label: {
                        show: true, //开启显示
                        position: 'top', //在上方显示
                        formatter: function (val) {
                            if (val.value == 0) {
                                return ""
                            }
                        },
                        textStyle: { //数值样式
                            color: '#FFF',
                            fontSize: 7
                        }
                    }
                },
            },
            data: [],
        },
        {
            name: '分拣',
            type: 'bar',

            itemStyle: {
                normal: {
                    color: 'blue',
                    label: {
                        show: true, //开启显示
                        position: 'top', //在上方显示
                        formatter: function (val) {
                            if (val.value == 0) {
                                return ""
                            }
                        },
                        textStyle: { //数值样式
                            color: '#FFF',
                            fontSize: 7
                        }
                    }
                },
            },
            data: [],
        },
    ],
};