jQuery flot more space at the top

谁说胖子不能爱 提交于 2019-12-08 02:53:06

问题


How can i create more space at the top of the charts?

Now i get this:

But i want this:

This is my JS code:

$("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
        }
    });
});

回答1:


Adjust the autoscaleMargin property of the y axis. From the API:

The "autoscaleMargin" is a bit esoteric: it's the fraction of margin that the scaling algorithm will add to avoid that the outermost points ends up on the grid border. Note that this margin is only applied when a min or max value is not explicitly set. If a margin is specified, the plot will furthermore extend the axis end-point to the nearest whole tick. The default value is "null" for the x axes and 0.02 for y axes which seems appropriate for most cases.

Sounds like bumping it up from the default 0.02 will do what you want.




回答2:


I have add this to the JS file and i get some space now from the top... It's not mutch but it is someting. :-)

yaxis: {
    max: null
}


来源:https://stackoverflow.com/questions/9095387/jquery-flot-more-space-at-the-top

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!