问题
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