Echarts酒吧问题

时间:2017-05-22 15:51:33

标签: bar-chart echarts

我在ordert中使用Echarts来创建一些图表。 我的问题是,当我从toolbox更改图表类型时,新图表超出了绘图区域。我只对bar有这个问题。

enter image description here

每秒使用轮询器刷新图表。

toolbox:
{
    show: true,
    feature:
    {
        magicType:
        {
            show: true,
            title:
            {
                line: "Line",
                bar: "Bar",
                tiled: "Tiled"
            },
            type: ["line", "bar", "tiled"]
        },
        restore:
        {
            show: true                
        },
        saveAsImage:
        {
            show: true
        }
    }
},

1 个答案:

答案 0 :(得分:0)

这是因为条形图位于 x轴刻度线上,而不是位于之间。

这可能是由boundaryGap: false引起的。

Documentation on boundaryGap

尝试将x轴设置为:

xAxis: {
    boundaryGap : true,
}

如果您不希望标签位于x轴刻度之间,请使用:

xAxis: {
    boundaryGap : true,
    xAxisTicks  : {
        alignWithLabel  : true
    }
}

Documentation on alignWithLabel