堆积柱图中的非常宽的列

时间:2013-10-07 12:20:26

标签: highcharts

如果其中一个图形在XAxis上包含多个值(例如“data”:[[52,1],[100,1]]),它们之间的距离越大,列就越大。如何摆脱这个问题?

jsFiddle

$(function () {

    $('#container').highcharts({
        chart: {
            type: 'column',
        },
        xAxis: {
            title: {
                text: 'value'
            }
        },
        yAxis: {
            min: 0,
        },    
        legend: {
        },
        tooltip: {
        },
        plotOptions: {
            column: {
                 stacking: 'normal',          
            }
        },
        series: [{"name":"RunContractid = 316 name","stack":109,"data":[[52,1], [100,1]],"type":"column"},{"name":"RunContractid = 314 name","stack":109,"data":[[49,1]],"type":"column"},{"name":"RunContractid = 472 name","stack":109,"data":[[49,1]],"type":"column"},{"name":"RunContractid = 327 name","stack":109,"data":[[49,1]],"type":"column"},{"name":"RunContractid = 476 name","stack":109,"data":[[52,1]],"type":"column"},{"name":"RunContractid = 299 name","stack":109,"data":[[52,1]],"type":"column"},{"name":"RunContractid = 298 name","stack":109,"data":[[52,1]],"type":"column"},{"name":"RunContractid = 469 name","stack":109,"data":[[56,1]],"type":"column"},{"name":"RunContractid = 479 name","stack":109,"data":[[56,1]],"type":"column"},{"name":"RunContractid = 500 name","stack":109,"data":[[59,1]],"type":"column"},{"name":"RunContractid = 320 name","stack":109,"data":[[59,1]],"type":"column"},{"name":"RunContractid = 600 name","stack":109,"data":[[59,1]],"type":"column"},{"name":"RunContractid = 326 name","stack":109,"data":[[59,1]],"type":"column"},{"name":"RunContractid = 642 name","stack":109,"data":[[59,1]],"type":"column"},{"name":"RunContractid = 312 name","stack":109,"data":[[64,1]],"type":"column"},{"name":"RunContractid = 480 name","stack":109,"data":[[48,1]],"type":"column"}]
    });
});

找到解决方案 - 在空白处添加零。

1 个答案:

答案 0 :(得分:0)

您可以设置pointWidth参数

http://api.highcharts.com/highcharts#plotOptions.column.pointWidth

编辑: PointRange解决问题http://jsfiddle.net/UMpBL/4/

plotOptions: {
        column: {
            pointRange:1,
            stacking: 'normal',
        }
    },