2017-04-24 87 views
0

我正在使用ng2-charts来显示非常基本的图表。我正在使用水平条形图,我需要在条形的末尾显示值。我无法弄清楚如何做到这一点? See imageng2-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 ]; 
+0

我发现了一个解决方案在这里:https://github.com/valor-software/ng2-charts /问题/ 662 – archi

回答