背景不在chart.js工作

时间:2016-09-01 19:52:00

标签: angularjs charts angular-chart

我想请求以下帮助,代码工作正常,但什么不起作用的是图形条的背景,基本上谢谢

$scope.labels = ['JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC'],

$scope.type = 'StackedBar';
$scope.series = ['2015', '2016'];
$scope.borderWidth=0;

$scope.data = [
    [19, 38, 29, 34, 26, 49, 11, 46, 3, 36, 12, 24],    
    [52, 59, 65, 30, 27, 27, 77, 33, 63, 44, 45, 45],
    [29, 3, 6, 36, 47, 24, 12, 21, 34, 20, 43, 31],
];
$scope.datasetOverride=[{yAxisID:'y-axis-1'},{ yAxisID: 'y-axis-2' }, {
    borderWidth:1,
    type:'line',
    borderColor: 'rgba(34,34,34,0.3)',
    backgroundColor: 'rgba(34,34,34,0.2)',
},
{  
    borderWidth:0,
    type:'bar',
    backgroundColor: '#000000',
    borderWidth:'5px'                
},
{
    backgroundColor: '#000000',                
    borderWidth:0,
    type:'bar',

}];
$scope.options = {
  scales: {
    xAxes: [{
      stacked: true,
    }],
    yAxes: [ 
        {
            stacked: true,
            display: false,
         },
        {
            id: 'y-axis-1',
            type:'linear',
             position: 'left',
              backgroundColor: '#000000',  
        },
        {
            id: 'y-axis-2',
            type:'linear',
            position: 'right',
             backgroundColor: '#000000',  
        },
    ]
  }
};

这里是de codepen:http://codepen.io/fernandooj/pen/LRYxJJ?editors=1010

1 个答案:

答案 0 :(得分:0)

您可以更改在HTML .panel-body类上应用背景颜色:

Jbuilder.new do |json| 
  json.array! locations.map do |l|
    l.to_builder.attributes!
  end
end.target!

如果你创建一个CSS样式来应用背景颜色和其他样式属性会更好