angular-chart.js条形图,100%不透明度颜色

iam*_*nph 6 javascript angularjs chart.js angular-chart

更新时间2017年6月2日:我们解决了问题,但没有解决这里的答案.如果我发现它,我会尝试添加我们的解决方案.我们还切换到了angular-nvd3哪些用途d3.

编辑1:backgroundColor在选项中添加,仍然无法正常工作.不确定我是否把它放在正确的位置.

这里使用示例.如何使颜色填充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]
];
Run Code Online (Sandbox Code Playgroud)

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 -->
Run Code Online (Sandbox Code Playgroud)

我真的想使用这种实现,但我发现的大多数问题都使用不同的实现.

Iro*_*ces 0

Angular-chartJS 使用chart-optionsChartJS选项配置。在选项中设置背景颜色。

来源: https: //github.com/jtblin/angular-chart.js