组件代码如下和html代码。我正在使用[data] = "item.data"
[name] = "item.name"
来绑定数据
private series: any[] = [{
name: ["India","Aus", "Fin"],
data: [3.907, 7.943, 7.848]
}];
<kendo-chart>
<kendo-chart-title text="Gross domestic product growth /GDP annual %/">
</kendo-chart-title>
<kendo-chart-legend position="top" orientation="horizontal">
</kendo-chart-legend>
<kendo-chart-tooltip format="{0}%">
</kendo-chart-tooltip>
<kendo-chart-series>
<kendo-chart-series-item *ngFor="let item of series" type="donut" [data]="item.data" [name]="item.name">
</kendo-chart-series-item>
</kendo-chart-series>
</kendo-chart>
答案 0 :(得分:2)
试试这个:
<kendo-chart-series-item-labels>
在<kendo-chart>
<kendo-chart-title text="Gross domestic product growth /GDP annual %/">
</kendo-chart-title>
<kendo-chart-legend position="top" orientation="horizontal">
</kendo-chart-legend>
<kendo-chart-tooltip format="{0}%">
</kendo-chart-tooltip>
<kendo-chart-series>
<kendo-chart-series-item type="donut" [data]="series" field="data" categoryField="name">
<kendo-chart-series-item-labels visible="true" content="categoryField">
</kendo-chart-series-item-labels>
</kendo-chart-series-item>
</kendo-chart-series>
</kendo-chart>
private series: any[] = [{
name: "India",
data: 3.907
}, {
name: "Aus",
data: 7.943
}, {
name: "Fin",
data: 7.848
}];
标记内,您可以使用以下属性:position,&#34;以上&#34; &#34;下面&#34; &#34;中心&#34; &#34; insideEnd&#34; &#34;左&#34; &#34; outsideEnd&#34; &#34;右&#34 ;; [距离],任何数字,但20通常是一个不错的数量; format,使用IntlService格式方法。
- 编辑 -
这不是你要求的,但是这样,你至少看不到每个片段的名称:
void print_endianness() {
union {
unsigned int i;
char c[4];
} un;
un.i = 0x12345678;
if (un.c[0] == 0x78 && un.c[3] == 0x12)
printf("little-endian\n");
else if (un.c[0] == 0x12 && un.c[3] == 0x78)
printf("big-endian\n");
else
printf("unknown\n");
}