1

I am trying to make the labels on the x-axis two lined but its cut off. Here is my code

<!DOCTYPE html >
<html>
    <head>
        <script src="RGraph.common.core.js" ></script>
        <script src="RGraph.line.js" ></script>
   </head>
    <body>
        <canvas id="cvs" width="320" height="320">[No canvas support]</canvas>
        <script>
        window.onload = function ()
        {  
            var line = new RGraph.Line('cvs', [0,52,90,86,86,75,75,75,75,75,60,60,60,60,60,60,100,95,53,53]);
            line.Set('chart.labels',['10/05\n21:00','11/05\n08:00','11/05\n20:00','12/05\n08:00','12/05\n20:00']);
            line.Draw();
        }
        </script>
    </body>
</html>

This is how it looks like

enter image description here

I already played around with the canvas height but it does not change it.

hol
  • 8,255
  • 5
  • 33
  • 59

1 Answers1

2

Increase the chart.gutter.bottom setting. It defaults to 25 - so set it to 35 or 40.

Richard
  • 4,809
  • 3
  • 27
  • 46
  • Thank you very much. Added `line.Set('chart.gutter.bottom',35);` before `Line.Draw();` and it worked. Want to impress that I feel very honoured to get the answer right from the author of RGraph. Which is by the way a very easy to use tool. I use it inside my iPhone App with an embedded browser after I got frustrated for a while with existing native libraries. – hol May 13 '13 at 19:23
  • Could you make labels on X axis two lined using CanvasJS Charts ? – weelDaw Sep 19 '14 at 02:28