[英]Kendo UI for Angular - Bar Chart Fixed Bar Size
We are currently using Kendo UI for Angular in our project and have implemented the Kendo bar chart. 我们目前在我们的项目中使用Kendo UI for Angular,并且已经实现了Kendo条形图。 Currently the bar size is responsive based on the chart height. 当前,条形大小基于图表高度而作出响应。 We need to set that bar to a fixed size as per the jQuery example below. 我们需要按照下面的jQuery示例将该栏设置为固定大小。
Anyone have any thoughts on doing this in Angular? 有人对在Angular中执行此操作有任何想法吗?
https://docs.telerik.com/kendo-ui/controls/charts/how-to/appearance/fixed-bar-size https://docs.telerik.com/kendo-ui/controls/charts/how-to/appearance/fixed-bar-size
It is possible to use the same approach for the angular chart: 可以对角度图使用相同的方法:
<kendo-chart>
<kendo-chart-series>
<kendo-chart-series-item type="bar"[data]="[1, 2]" [visual]="barVisual">
</kendo-chart-series-item>
</kendo-chart-series>
</kendo-chart>
// component
public barVisual(e: any): void {
//create the default visual
const visual = e.createVisual();
//scale it so that it has the predefined size
visual.transform(geometry.transform().scale(1, BAR_SIZE / e.rect.size.height, e.rect.center() ));
return visual;
}
https://plnkr.co/edit/RVRHuCiq4ZD2a6da56D3?p=preview https://plnkr.co/edit/RVRHuCiq4ZD2a6da56D3?p=preview
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.