宇筱博客

  • 解决办法
  • 学无止境
  • 记录时光
  • 百宝箱
宇筱博客
点滴记忆,汇聚成海。
  1. 首页
  2. 解决办法
  3. 正文

Echarts-柱状图柱图宽度设置

2018年1月9日 938点热度 0人点赞 0条评论

只需要设置series中的坐标系属性barWidth就可以

见代码:

/**
 * 堆积柱状图
 * @param xaxisdata x轴:标签(数组)
 * @param serieszs 柱状图图数据(数组)
 * @param seriesyx 柱状图图数据(数组)
 */
function drawDJZZT(xaxisdata,serieszs,seriesyx){
    var myChart = echarts.init(document.getElementById('main1'));
    myChart.setOption({
        title : {
            text : ""
        },
        tooltip : {
            trigger : 'axis',
            showDelay : 0, // 显示延迟,添加显示延迟可以避免频繁切换,单位ms
            axisPointer : {            // 坐标轴指示器,坐标轴触发有效
                type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
            }
        },
        legend: {
            data:['做市', '协议']
        },
        xAxis : [{
                type : 'category',
                data : xaxisdata,
                axisLabel:{
                     textStyle:{
                         color:"#222"
                     }
                 }
        }],
        yAxis : [{
            type : 'value'
        }],
        series : [
             {
                 name:'做市',
                 type:'bar',
                 stack: '总量',
                 /*itemStyle : { normal: {label : {show: true, position: 'insideTop',textStyle:{color:'#000'}}}},*/
                 data:serieszs
             },
             {
                 name:'协议',
                 type:'bar',
                 stack: '总量',
                 barWidth : 30,//柱图宽度
                 /*itemStyle : { normal: {label : {show: true, position: 'insideTop',textStyle:{color:'#000'}}}},*/
                 data:seriesyx
             }
         ]
    });
}

原文链接:https://www.cnblogs.com/hwaggLee/p/4762410.html

标签: 暂无
最后更新:2022年3月23日

小渔民

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

COPYRIGHT © 2025 宇筱博客. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

豫ICP备15017825号-2