【发布时间】:2017-04-27 23:55:13
【问题描述】:
我正在使用 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 ];
【问题讨论】:
-
我在这里找到了解决方案:github.com/valor-software/ng2-charts/issues/662
标签: ng2-charts