How to use echarts to add units to the y-axis and x-axis

How to use echarts to add units to the y-axis and x-axis

y-axis each unit scale plus unit usage

 yAxis: [
                {
    
                       
                    type: 'value',
                    axisLabel: {
    
    formatter: '{value} 单'},
                }
            ],

Insert picture description here

Set the unit at the top of the y-axis

Use title to illustrate the meaning of the y-axis data:

option = {
    
    
            title: {
    
    
                text: 订单来源分析+ '(单位为:单)',
                x: 'center'
            },

Insert picture description here

The other is

  yAxis: [
                {
    
    
                    //单位
                    name: '单',
                    type: 'value',
                }
            ],

Insert picture description here

x axis add unit

  xAxis: [
                {
    
    
                    name: '辆',     //关键代码
                    nameTextStyle: {
    
             //关键代码 
                        padding: [30, 0, 0, -30],
                    },
                    type: 'category',
                    data: ['优酷','公共','小程序'],
                    axisLabel: {
    
    
                        interval: 0,
                        rotate: 28,//倾斜度
                    },
                    axisTick: {
    
    
                        alignWithLabel: true
                    }
                }
            ],

Insert picture description here

Guess you like

Origin blog.csdn.net/guo_qiangqiang/article/details/114099413