echarts之--柱状图-%显示

测试地址
https://www.echartsjs.com/examples/zh/editor.html?c=bar-tick-align
复制代码
 var option = {
            title: {
              text: "存储条件(基本单位数量)", //标题
              padding: [12, 4], //距离上下4px
              x: "center", //居中
              textStyle: {
                color: "#3398DB", //主标题的颜色
                fontSize: "18" //主标题的大小
              },
            
            },
              
        
            color: ['#3398DB'],
            
            tooltip : {
                trigger: 'axis',
                formatter:'{c}%',       //这是关键,以百分比的形式显示
                axisPointer : {            // 坐标轴指示器,坐标轴触发有效
                    type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
                }
            },
            
            
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis : [
                {
                    type : 'category',
                    data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                    axisTick: {
                        alignWithLabel: true
                    }
                }
            ],
            
            yAxis: [
                      {  
                                type: 'value',  
                                axisLabel: {  
                                    show: true,  
                                    interval: 'auto',  
                                    formatter: '{value} %'  
                                    },  
                                show: true  
                        }  
                    ],
            
            label: {
                                show: true,
                                position: 'top',
                                formatter: '{b}\n{c}%' //在柱状图的顶部显示出某个东西和这个东西的百分比值
                    },
                    
            series : [
                {
                    name:'直接访问',
                    type:'bar',
                    barWidth: '60%',
                    data:[10, 52, 20, 34, 39, 30, 20]
                }
            ]
        };

测试地址
https://www.echartsjs.com/examples/zh/editor.html?c=bar-tick-a
复制代码

 

 

posted @   南风晚来晚相识  阅读(2825)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
点击右上角即可分享
微信分享提示