I use Angular-Chart.js (the AngularJS Chart.js version) to create a bar chart. The Chart is working with the options except for the colours.
Even if I set them it is indicated in the documentation, they stay grey.
<div class="graph-display" ng-controller="chartController">
<canvas class="chart chart-bar"
data="bilans.data"
labels="bilans.labels"
series="bilans.series"
options="{
scaleShowHorizontalLines: true,
scaleShowVerticalLines: false,
tooltipTemplate: '<%= value %> $',
responsive: true
}"
colours="{
fillColor: 'rgba(47, 132, 71, 0.8)',
strokeColor: 'rgba(47, 132, 71, 0.8)',
highlightFill: 'rgba(47, 132, 71, 0.8)',
highlightStroke: 'rgba(47, 132, 71, 0.8)'
}"
></canvas>
</div>
Actually, the options are working but the colours are not. Am I doing something wrong?
With the latest version $scope.colors does not seem to work. You need to use
chart-dataset-override="colors"
DEMO
You wanted to say: "colours"
Also we can see the other attributes That we can change , like : legend , series, hover . Next to each chart you can see an option called "settings ", that's all what you can change.
As at 2017 I got angular-charts to work with the following code.
that the names of the elements are changed. Taken from the angular-chart source code.
also that as soon as you run out of colours angular-chart will generate them for you. This includes an opacity of 0.2 for background colours.
If you specify #hex colours opacity will be added.
Colour specification via global.
In the source code the colour picking code is currently. Colours set via Chart.js options are reset here (I didn't get this to work).
Pick colours as per angular-chart.js source code:
Yes, if you don't specify an object, opacity is set for you. From angular-chart.js:
As @pankajparkar said. Just adding that you can also pass html colours and angular-chart.js will define the colour objects properly in rgba with the proper nuances e.g.
$scope.colors = ['#FD1F5E','#1EF9A1','#7FFD1F','#68F000'];
I was having the same difficulty. In the docs it says to use "colors" however once I updated my html to:
chart-colours
with an angular array of:
$scope.colours = ['#72C02C', '#3498DB', '#717984', '#F1C40F'];
It worked!
It seems that naming changed again. I'm using angular-chart.js 1.0.3 and color management for bar charts works like this :
In the canvas tag, the name of the attribute is chart-colors