ng2-charts甜甜圈图如何使标签每次都可见,以及相应的计数,而不仅仅是在工具提示中显示

时间:2017-12-13 10:10:27

标签: javascript angular charts ng2-charts

在ng2-chart(http://www.chartjs.org/docs/latest/) - 圆环图中是否有任何选项可以在图表中每次都显示标签,而不仅仅是在工具提示中显示标签?

组件:

public mobileChartOptions: any = {
        responsive: true,
        legend: {
            display: true,
            position: 'bottom',
            labels: {
                padding: 10
            }
        }
    };

public mobileOptions = Object.assign({
                                elements: {
                                    arc: {
                                        borderWidth: 0
                                    }
                                }
                            }, this.mobileChartOptions);
public mobileUsersData: {
                        colors: [{
                                    backgroundColor: ["#3FB7D0", "#6C71CC", "#ffeb3b", "#4caf50", "#2196f"]
                                }],
                        options: this.mobileOptions,
                        chartType: 'doughnut',
                        labels: [],
                        data: [],
                        loaded: false,
                        dataAvailable: false
                    };

HTML:

<canvas height=" " baseChart class="chart" 
                        [data]="mobileUsersData.data"
                        [labels]="mobileUsersData.labels"
                        [options]="mobileOptions"
                        [colors]="mobileUsersData.colors"
                        [chartType]="mobileUsersData.chartType"
                        (chartHover)="chartHovered($event)">
                </canvas>

0 个答案:

没有答案