rotating x-axis labels

3 posts, 0 answers
  1. Bernard
    Bernard avatar
    6 posts
    Member since:
    Dec 2014

    Posted 07 May 2015 Link to this post

    I want to rotate the text of the X axis labels by 90 degrees

     In the docs I've found :

    $labels = new \Kendo\Dataviz\UI\ChartXAxisItemLabels();
    $labels->rotation(90);

     

    Which I added before

    $chart = new \Kendo\Dataviz\UI\Chart('chart');
    $chart->title(array('text' => 'Bar chart'))
          ->legend(array('position' => 'top'))
          ->addSeriesItem($arr[0],$arr[1],$arr[2],$arr[3],$arr[4])
          ->addValueAxisItem($valueAxis)
          ->addCategoryAxisItem($cateogrySeriesAxis)
          ->addCategoryAxisItem($categoryLabelsAxis)
          ->tooltip($tooltip)
          ->chartArea(array('background' => 'transparent'))
          ->seriesDefaults(array('type' => 'column'));
    echo $chart->render();

     

     However, the changes are not applied.
    I first thought I had to assign it to $chart (such as tooltip is done) but this leads to a blank page so I have no idea what I have to do with to make it work

  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 11 May 2015 Link to this post

    Hi Bernard,

    You should set the rotation as cateogryAxis labels option:

    $categoryLabelsAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
    $categoryLabelsAxis->name("series-labels")
      /* ... */
      ->labels(array('rotation' => '90'));

    Regards,
    Iliana Nikolova
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. UI for ASP.NET AJAX banner
  4. Bernard
    Bernard avatar
    6 posts
    Member since:
    Dec 2014

    Posted 11 May 2015 in reply to Iliana Nikolova Link to this post

    Excellent !! Thanks for the support :-D

Back to Top