3

我正在使用 ng2-charts 来显示非常基本的图表。我正在使用水平条形图,我需要在条形末尾显示值。我不知道该怎么做? 看图片

以下是我的 html 和选项:

 <canvas height="500" width="1000" baseChart 
            [data]="barChartData"
            [labels]="statusNames"
            [options]="barChartOptions"
            [colors]="chartColors"
            [legend]=false
            [chartType]="barChartType"
            (chartHover)="chartHovered($event)"
            (chartClick)="chartClicked($event)">
</canvas>


    public barChartOptions: any = {
    title: {
        display: true, text: 'Current Subject Status',
        fontSize: 20,
        color: "black"
    },
    scales: {
        xAxes: [{ 
             gridLines: { 
                          borderDash: [5], 
                          lineWidth: 1.4
                         }, 
             ticks: { beginAtZero: true} 
             }],
        yAxes: [{ 
                  barThickness: 20, 
                  gridLines: { display: false }
                }]
    },
    maintainAspectRatio: true,
    responsive: false
    };

    public barChartType: string = 'horizontalBar';
    public chartColors: any = [{ backgroundColor: "#005CA9" }];
    public barChartData: number[] = [3, 97 ,15, 13,63 ];
4

1 回答 1

3

在GitHub上找到了解决方案

于 2017-04-27T15:55:13.423 回答