jQuery在顶部浮动更多空间

时间:2012-02-01 11:59:07

标签: jquery height flot space

如何在图表顶部创建更多空间?

现在我明白了: enter image description here

但我想要这个:

enter image description here

这是我的JS代码:

$("table.chart").each(function() {
    var colors = [];
    $("table.chart thead th:not(:first)").each(function() {
        colors.push($(this).css("color"));
    });
    $(this).graphTable({
        series: 'columns',
        position: 'replace',
        width: '100%',
        height: '200px',
        colors: colors
    }, {
        xaxis: {
            tickSize: 1
        }
    });
});

2 个答案:

答案 0 :(得分:10)

调整y轴的autoscaleMargin属性。来自API:

  

“autoscaleMargin”有点深奥:它是保证金的一小部分   缩放算法将添加以避免最外面的点   最终在网格边界上。请注意,此保证金仅适用于   未明确设置最小值或最大值。如果指定保证金,   该图还将轴终点延伸到最近   整个刻度。 x轴的默认值为“null”,y的默认值为0.02   轴似乎适合大多数情况。

听起来像从默认值0.02上升它会做你想要的。

答案 1 :(得分:0)

我已将此添加到JS文件中,我现在可以从顶部获得一些空间......这不是mutch但是它很有用。 : - )

yaxis: {
    max: null
}