jQuery在顶部增加了更多空间 [英] jQuery flot more space at the top
问题描述
如何在图表顶部创建更多空间?
How can i create more space at the top of the charts?
现在我明白了:
但是我想要这个:
这是我的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
}
});
});
推荐答案
调整y轴的autoscaleMargin
属性.通过API:
Adjust the autoscaleMargin
property of the y axis. From the API:
"autoscaleMargin"有点深奥:这是保证金的一部分 缩放算法将添加的内容,以避免最外面的点 最终在网格边界上.请注意,仅在以下情况下应用此边距 没有明确设置最小值或最大值.如果指定了边距, 该图还将进一步将轴的端点扩展到最近的位置 整个滴答声. x轴的默认值为"null",y的默认值为0.02 轴似乎适合大多数情况.
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.
听起来像从默认0.02增大声音一样会满足您的要求.
Sounds like bumping it up from the default 0.02 will do what you want.
这篇关于jQuery在顶部增加了更多空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!