ng2-charts条形图显示条形结束时的值

时间:2017-04-24 17:09:26

标签: ng2-charts

我正在使用ng2-charts来显示非常基本的图表。我正在使用水平条形图,我需要在条形结束时显示值。我无法弄清楚如何做到这一点? See image

以下是我的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 ];

1 个答案:

答案 0 :(得分:1)

在GitHub上找到解决方案Here