如何在图表顶部创造更多空间?
现在我明白了:
但我想要这个:
这是我的 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:
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 提高它就可以达到你想要的效果。
关于jQuery 在顶部留出更多空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9095387/