[英]Kendo UI angular - Rotate labels of x-axis in bar chart
I am trying to rotate labels of x-axis in smaller screens to make sure that labels do not overlap each other.我试图在较小的屏幕中旋转 x 轴的标签,以确保标签不会相互重叠。
CODE代码
<kendo-chart *ngIf="!yearLoader" (seriesClick)="barClick($event)">
<kendo-chart-tooltip format="{0} events"></kendo-chart-tooltip>
<kendo-chart-category-axis>
<kendo-chart-category-axis-item [categories]="yearChartData.months">
</kendo-chart-category-axis-item>
</kendo-chart-category-axis>
<kendo-chart-series>
<kendo-chart-series-item [spacing]="1" [data]="yearChartData.count" type="column"></kendo-chart-series-item>
</kendo-chart-series>
</kendo-chart>
When i was going through the API Documentation I found rotation
property in kendo-chart-x-axis-item-labels
.当我浏览API 文档时,我在
kendo-chart-x-axis-item-labels
找到了rotation
属性。 I think that could be the solution to my problem.我认为这可能是我问题的解决方案。 But, I don't know how to use that in my code.
但是,我不知道如何在我的代码中使用它。 Can anybody help me out?
有人可以帮我吗?
Thanks in advance!提前致谢!
You can rotate labels of the x axis or (category-axis) by nesting a kendo-chart-category-axis-item-labels
component within the kendo-chart-category-axis-item
component.您可以通过嵌套旋转x轴或(类别轴)的一个标签
kendo-chart-category-axis-item-labels
的内组件kendo-chart-category-axis-item
分量。 ( Example ) (示例)
<kendo-chart *ngIf="!yearLoader" (seriesClick)="barClick($event)">
...
<kendo-chart-category-axis>
<kendo-chart-category-axis-item [categories]="yearChartData.months">
<kendo-chart-category-axis-item-labels [rotation]="45">
</kendo-chart-category-axis-item-labels>
</kendo-chart-category-axis-item>
</kendo-chart-category-axis>
...
</kendo-chart>
In case you want to rotate all labels ( x and y axis) use kendo-chart-axis-defaults-labels
component and nest it within the kendo-chart
component.如果您想旋转所有标签( x和y轴),请使用
kendo-chart-axis-defaults-labels
组件并将其嵌套在kendo-chart
组件中。
<kendo-chart *ngIf="!yearLoader" (seriesClick)="barClick($event)">
<kendo-chart-axis-defaults-labels [rotation]="45">
</kendo-chart-axis-defaults-labels>
...
</kendo-chart>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.