UPDATE 02-JUNE-2017:我们解决了这个问题,但不是从这里的答案中解决。如果我找到它,我会尝试添加我们的解决方案。我们也切换到angular-nvd3
,它使用d3
。带有100%不透明颜色的angular-chart.js条形图
编辑1:在选项中增加了backgroundColor
,仍然不起作用。不知道我是否把它放在正确的地方。
使用样本here。如何使颜色填充100%?
JS:
$scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
$scope.type = 'StackedBar';
$scope.series = ['2015', '2016'];
//$scope.colors = ['#AA1921', '#18AF5C'];
$scope.options = {
scales: {
xAxes: [{
stacked: true,
}],
yAxes: [{
stacked: true
}]
},
title: {
display: true,
text: 'My First Bar Chart'
},
// added as suggested
backgroundColor: ['rgba(170, 25, 33, 1)', 'rgba(170, 25, 33, 1)']
};
$scope.data = [
[65, 59, 90, 81, 56, 55, 40],
[28, 48, 40, 19, 96, 27, 100]
];
HTML
<canvas class="chart chart-bar"
chart-data="data"
chart-labels="labels"
chart-options="options"
chart-series="series"
chart-colors="colors"></canvas>
<!-- chart-colors is removed when using the backgroundColor -->
我真的想用这种实现的,但大多数问题我发现使用的是不同的实现。
所以我选择看现在这个样子:'$ scope.options = {秤: {xAxes:[{stacked:!0}],yAxes:[{stacked:!0}]},title:{display:!0,text:“My First Bar Chart”},backgroundColor:[“rgba(170, 25,33,1)“,”rgba(170,25,33,1)“]};'但是仍然没有100%填满。 – iamdevlinph