试图在Kendo-ui-angular2中构建一个饼图。显示饼图但不显示标签

时间:2017-02-17 21:20:28

标签: kendo-ui-angular2

组件代码如下和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>

1 个答案:

答案 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");
}