title: PHP mtChart (new pChart): how do i control the angle of x-axis labels?
body: <p>I am trying to graph the results of a survey, where the question is multiple choice.</p>
  
  <p>eg. How would you describe this website?
  format:</p>
  
  <pre><code>option | number of times selected | percentage of users who selected that option
  
  Informative     1   50%
  All of the above    1   50%
  Interesting     0   0%
  Intelligent     0   0%
  Cool    0   0%
  Incredible  0   0%
  Sleek   0   0%
  Amazing
  </code></pre>
  
  <p>The graph is a bar graph, where each bar represents one of those options, and the height of the bar depends on the number of times selected.</p>
  
  <p>However, the labels are slanted at a 45 degree angle and are barely readable! here is my code:</p>
  
  <pre><code>&lt;?php
  require_once ("includes/common.php");
  require_once ("graph/mtChart.min.php");
  
  // type must be specified
  $type = $_GET['type'];
  
  if($type == "surveys_report_MC_or_CB") {
      // PARAMS
      $surveyID   = $_GET['surveyID'];
      $questionID = $_GET['questionID'];
      // END PARAMS
  
      $question   = SurveyQuestions::getSingle($questionID);
      $answers    = SurveyAnswers::getAll($questionID);
  
      $options        = SurveyQuestionOptions::getAll($question[SurveyQuestions::surveyQuestionID]);
      $others         = SurveyAnswers::setOptionCounts($options, $answers);
      $printedOthers  = false;
  
      // set graph
      $values = array();
      $axisLabels = array();
      foreach($options as $option) {
          $values[$option[SurveyQuestionOptions::optionText]] = $option['count'];
          $axisLabels[] = $option[SurveyQuestionOptions::optionText];
      }
  
      $graphs = array();
      $graphs[0] = $values;
  
      $xName = "Option";
      $yName = "Number of Times Selected";
      $graphTitle = $question[SurveyQuestions::question];
      $series = array("Total");
      $showLegend = false;
      $tall = false;
  }                   
  
  drawGraph($graphs, $axisLabels, $xName, $yName, $graphTitle, $series, $showLegend, $tall);
  
  
  
  
  function drawGraph($graphs, $axisLabels, $xName, $yName, $graphTitle, $series, $showLegend, $tall) {
          $Graph = ($tall) ? new mtChart(575,375) : new mtChart(575,275);
  
          // Dataset definition
          $avg = 0;
          $i = 0;
          foreach ($graphs as $key =&gt; $value) {
              $Graph-&gt;AddPoint($value,"series" . $key);
              $Graph-&gt;SetSerieName($series[$key],"series" . $key);
  
              // Get average
              $avg += array_sum($value);
              $size = sizeof($value);
              $i += $size;
  
              // Calculate x-axis tick interval
              $step = ceil($size / 25);
          }
  
          $Graph-&gt;AddPoint($axisLabels,"XLabel");
          $Graph-&gt;AddAllSeries();
          $Graph-&gt;RemoveSerie("XLabel");
          $Graph-&gt;SetAbsciseLabelSerie("XLabel");
          $Graph-&gt;SetXAxisName($xName);
          $Graph-&gt;SetYAxisName($yName);
  
          // Get from cache if it exists
          $Graph-&gt;enableCaching(NULL, 'graph/cache/');
          $Graph-&gt;GetFromCache();
  
          // Initialize the graph
          $Graph-&gt;setInterval($step);
          $Graph-&gt;setFontProperties("graph/tahoma.ttf",8);
          ($showLegend) ? $Graph-&gt;setGraphArea(45,30,475,200) : $Graph-&gt;setGraphArea(75,30,505,200);
          $Graph-&gt;drawGraphArea(255,255,255,TRUE);
          $Graph-&gt;drawScale(SCALE_START0,100,100,100,TRUE,55,1,TRUE);
          $Graph-&gt;drawGrid(4,TRUE,230,230,230,50);
  
          // Draw the 0 line
          $Graph-&gt;setFontProperties("graph/tahoma.ttf",6);
          $Graph-&gt;drawTreshold(0,143,55,72,TRUE,TRUE);
  
          // Draw the bar graph
          $Graph-&gt;drawBarGraph();
  
          // Draw average line
          $Graph-&gt;drawTreshold($avg/$i, 0, 0, 0, FALSE, FALSE, 5);     
  
          // Finish the graph
          $Graph-&gt;setFontProperties("graph/tahoma.ttf",8);
          if ($showLegend) {
              $Graph-&gt;drawLegend(482,30,255,255,255,255,255,255,100,100,100);
          }
          $Graph-&gt;setFontProperties("graph/tahoma.ttf",10);
          $Graph-&gt;drawTitle(0,22,$graphTitle,100,100,100,555);
  
          // Draw Graph
          $Graph-&gt;Stroke();
      }
  </code></pre>
  
  <p>and here is where i use it on the page:</p>
  
  <pre><code>&lt;div class="graph_container"&gt;
                              &lt;img src="drawGraph.php?type=surveys_report_MC_or_CB&amp;surveyID=&lt;?php
                                  echo $survey[Surveys::surveyID] ?&gt;&amp;questionID=&lt;?php
                                  echo $question[SurveyQuestions::surveyQuestionID] ?&gt;" /&gt;
  </code></pre>
  
  <p>Is there a setting i can apply to the graph which will make the text look nicer, or at least let me set the angle to 90 degrees so people can read it if they cock their head to the left?</p>
  
  <p>btw, <code>mtchart</code> is located here: <a href="http://code.google.com/p/mtchart/" rel="nofollow noreferrer">http://code.google.com/p/mtchart/</a>
  and pchart (the original, which has mainly the same code) is here: <a href="http://pchart.sourceforge.net/documentation.php" rel="nofollow noreferrer">http://pchart.sourceforge.net/documentation.php</a>
                              </p>