简体   繁体   English

Kendo UI angular - 在条形图中旋转 x 轴的标签

[英]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.如果您想旋转所有标签( xy轴),请使用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.

相关问题 在 Ng Apex Chart(Angular) 中格式化 x 轴标签时,x 轴标签会重复 - When formatting x-axis labels in Ng Apex Chart(Angular), x-axis labels are duplicated 在 d3 angular 中包装条形图的重叠 x 轴 - wrap overlapping x-axis of bar chart in d3 angular 在顶部而不是底部显示范围条形图的 x 轴 - Display the x-axis of the range bar chart at the top instead of bottom Google图表:增加x轴标签和x轴之间的边距 - Google chart: increase margin between x axis labels and x-axis 没有固定x轴值的Angular 4简单折线图 - Angular 4 Simple Line Chart without fixed x-axis values Kendo UI for Angular-条形图固定条形尺寸 - Kendo UI for Angular - Bar Chart Fixed Bar Size 如何在剑道图表的顶部而不是底部显示 x 轴值 - how to show x-axis values at top instead of bottom in kendo chart 如何自定义 y 轴标签并从 Chart js 中 x 轴的数据范围中随机选取值 - How do I customize y-axis labels and randomly pick the value from the data range for x-axis in Chart js 如何固定瀑布图中的条形宽度以及一组的x轴宽度? - How to fix the width of bar in waterfall chart as well as its x-axis width of one group.? 使用 Angular 中的 ng2-google-charts 自定义 x 轴上标签之间的间距 - Customizing spacing between labels on x-axis using ng2-google-charts in Angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM