echartsConfig.js 2.97 KB
var warehouseHealthOption = {
    color: ['#04efcd', '#fdb300', '#f43d33'],
    tooltip: {
        trigger: 'axis',
        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: {
            type: 'shadow',
        },
    },
    legend: {},
    grid: {
        top: '13%',
        left: '0.5%',
        right: '3%',
        bottom: '2%',
        containLabel: true,
    },
    xAxis: {
        type: 'category',
        axisLabel: {
            rotate: 0,
            interval: -1,
            textStyle: {
                color: '#fff',
            },
        },
        axisLine: {
            lineStyle: {
                color: '#afa3a3',
                width: 1,
            },
        },
        data: [],
    },

    yAxis: {
        type: 'value',
        min: 0,
        max: 100,
        splitLine: true,
        axisTick: {
            show: true,
            alignWithLabel: true,
        },
        axisLabel: {
            show: true,
            interval: 'auto',
            formatter: '{value}' + '%',
            textStyle: {
                color: '#fff',
            },
        },
        axisLine: {
            lineStyle: {
                color: '#afa3a3',
                width: 1,
            },
        },
    },

    series: [
        // 第一根柱子
        {
            type: 'bar',
            barMaxWidth: '40',
            barWidth: '25%',
            emphasis: {
                focus: 'series',
            },
            itemStyle: {
                normal: {
                    label: {
                        show: true,
                        formatter: function (params) {
                            return params.value + '';
                        },
                        position: 'top',
                        textStyle: {
                            color: '#ffff',
                            fontSize: 10,
                        },
                    },
                },
            },
            data: [],
        },
        {
            type: 'bar',
            barMaxWidth: '40',
            barWidth: '25%',
            emphasis: {
                focus: 'series',
            },
            itemStyle: {
                normal: {
                    label: {
                        show: true,
                        formatter: function (params) {
                            return params.value + '';
                        },
                        position: 'top',
                        textStyle: {
                            color: '#ffff',
                            fontSize: 10,
                        },
                    },
                },
            },
            data: [],
        }
    ],
}