This is a migrated thread and some comments may be shown as answers.

rotating x-axis labels

2 Answers 162 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Bernard
Top achievements
Rank 1
Bernard asked on 07 May 2015, 10:53 AM

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 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 11 May 2015, 07:32 AM

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!
 
0
Bernard
Top achievements
Rank 1
answered on 11 May 2015, 07:41 AM

Excellent !! Thanks for the support :-D

Tags
Chart
Asked by
Bernard
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Bernard
Top achievements
Rank 1
Share this question
or