2

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

Now i get this: enter image description here

But i want this:

enter image description here

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
        }
    });
});
Maanstraat
  • 1,241
  • 7
  • 34
  • 63
  • You can increase max of y-axis, see http://stackoverflow.com/questions/4690413/flot-library-setting-up-y-axis-to-min-0-and-max-24 – pritaeas Feb 01 '12 at 12:02
  • Is it not possible that alwasy 20px or someting comes with the height? Because with the max you can say 400 but what if someting haves a value of 700... – Maanstraat Feb 01 '12 at 12:06

2 Answers2

10

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.

Mark
  • 106,305
  • 20
  • 172
  • 230
  • 1
    Thnaks for the hint. I also found out that you are not allowed to specify min/max values in this case as this will override the margin setting. – AntonSack Sep 26 '13 at 09:59
0

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
}
Maanstraat
  • 1,241
  • 7
  • 34
  • 63