Echarts.js scale label to achieve rich text to achieve the effect of Chinese + picture, solve

problem description

echarts.js scale tag to achieve rich text to achieve the effect of Chinese + pictures, solve:

clipboard.png

echartsdemodemo

+:

clipboard.png

but if you want to achieve the effect of picture + Chinese, which in this case is picture + Monday, how to change the following code? Solve.

related codes

/ / this is my own example, the X-axis configuration item code

                xAxis: { //x
                    type: "category",
                    boundaryGap: false,
                    data: ["Mon", "Tue", "Wed","Thu","Fri","Sat","Sun"],
                    axisLine: {
                        show: false //
                    },
                    axisTick: {
                        show: false,  //
                        interval:0
                    },
                    axisLabel: {   //--
                        formatter: function (value) {
                            return "{" + value + "| }\n{value|" + value + "}";
                        },
                        interval:0, // 0 
                        margin: 20,
                        rich: {     //x--+
                            value: {
                                lineHeight: 20,
                                align: "center"
                            },
                            Mon: {         //data
                                height: 20,
                                align: "center",
                                backgroundColor: {
                                    image: str[0]
                                }
                            },
                            Tue: {
                                height: 20,
                                align: "center",
                                backgroundColor: {
                                    image: str[1]
                                }
                            },
                            Wed: {
                                height: 20,
                                align: "center",
                                backgroundColor: {
                                    image: str[2]
                                }
                            },
                            Thu: {
                                height: 20,
                                align: "center",
                                backgroundColor: {
                                    image: str[3]
                                }
                            },
                            Fri: {
                                height: 20,
                                align: "center",
                                backgroundColor: {
                                    image: str[4]
                                }
                            },
                            Sat: {
                                height: 20,
                                align: "center",
                                backgroundColor: {
                                    image: str[5]
                                }
                            },
                            Sun: {
                                height: 20,
                                align: "center",
                                backgroundColor: {
                                    image: str[6]
                                }
                            },
                        }
                    },
                },
May.26,2021

try rewriting axisLabel.formatter:

return '{' + value + '| }\n{value|' + getDay(value) + '}';
function getDay(name){
    switch(name){
        case 'Mon':
            return '';
        case 'Tue':
            return '';
        ...
    }
}
Menu