score:4
Accepted answer
Use
chart-dataset-override="colors"
DEMO
angular.module("app", ["chart.js"]).controller("DoughnutCtrl", function ($scope) {
$scope.results = {'1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0};
$scope.labels = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'];
$scope.data = [
[1, 3, 5, 8, 9, 10, 11, 12, 33, 5]
];
$scope.colors = [{
fillColor: 'rgba(59, 89, 152,0.2)',
strokeColor: 'rgba(59, 89, 152,1)',
pointColor: 'rgba(59, 89, 152,1)',
pointStrokeColor: '#fff',
pointHighlightFill: '#fff',
pointHighlightStroke: 'rgba(59, 89, 152,0.8)'
}];
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Multi Slot Transclude</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.0-rc.0/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.3.0/Chart.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-chart.js/1.0.3/angular-chart.min.js"></script>
</head>
<body ng-app="app" ng-controller="DoughnutCtrl">
<canvas
class="chart chart-bar"
chart-data="data"
chart-labels="labels"
chart-dataset-override="colors">
</canvas>
</body>
</html>
score:1
I have solved this issue in the following way:
$scope.datasetOverride =
{
backgroundColor: "#4E4EFF",
borderColor: "#2E2E99"
};
<canvas id="bar" class="chart chart-bar"
chart-data="expenseData" chart-labels="labels" chart-series="series" chart-options="chartOptions" chart-dataset-override="datasetOverride">
</canvas>
Source: stackoverflow.com
Related Query
- How to set single color on each bar in angular chart js
- How to use set the color for each bar in a bar chart using chartjs?
- How to set a full length background color for each bar in chartjs bar
- How to set X coordinate for each bar with react chart js 2?
- angular chart js set fill color of bar chart
- How to set different colors in each stacked bar chart cell?
- How to set percentage value by default on each bars in horizontal bar chart js
- how to create bar chart with group and sam color for each group using chart.js?
- chart js 2 how to set bar width
- How set color family to pie chart in chart.js
- chartjs : how to set custom scale in bar chart
- Different color for each column in angular-chartjs bar chart
- how to set chart.js grid color for line chart
- how to set color for each item in tooltip with ChartJS
- How do I set a bar chart to default to a suggested maximum in chart.js v1.01?
- angular-chart.js : how to show numbers in each bar of stacked bar chart
- How to draw multiple color bar in a bar chart using chart.js
- How to highlight single bar in bar chart using Chartjs
- How to set custom Y Axis Values (Chart.js v2.8.0) in Chart Bar JS
- how to set color for each datapoint in chartjs-chart-treemap
- Set fixed label size for grouped bar chart in angular Chartjs
- Chart Js - Globally set bar chart color based on value
- How to change the color of the bar in barchart if the data is negative - Angular Charts
- How do I get a different label for each bar in a bar chart in ChartJS?
- How can I get my Chart.JS bar chart to stack two data values together on each bar, and print a calculated value on each bar?
- How can I set different colours for each bar in angular-chart.js v1.0.0?
- How to draw multiple color bars in a bar chart along a Horizontal Line using chart.js
- how to write labels along with data on top and bottom of each stack in bar chart
- How to show symbols after the label and before the numeric value using chart.js Bar chart in Angular
- How to set Solid label in bar chart using Chart JS
More Query from same tag
- Iterating over an IEnumerable in Javascript for Chartjs
- Chart.js tooltip at any point on the chart
- Chart.js - Bar chart: Add text after numbers when h:over a Bar
- Chart.js xAxis linear scale : strange behavior
- Chart.js 2.0 - How to change default appearance of canvas/chart elements
- How to display multiple graphs in real time with chartjs
- Get Array with json without _chartjs: {…}, push: ƒ, pop: ƒ, shift: ƒ, splice: ƒ, …]
- chart.js renders outside div and canvas
- Horizontal overlapping of bars, not whole graph
- Chart.js 2.1.2 Bar Chart Animation Issue
- Chartjs custom colors not displaying when dataset is changed
- Is there any method to map or represent API data to Chart in ReactJS?
- Django integration with Charts.js, I'm unable to find the syntax for passing the data to the template
- Chart.js multiTooltip labels
- How to improve PDF rasterization quality in PhantomJS?
- Html5 web page with chartjs: loading an external json file and create a line chart
- ChartJs - Double tooltip Top and Bottom on hover
- How to filter hover on a chart in ChartJS?
- How to add label square to Bar Chart using Chart.js
- charts.js stacked y-Axis
- Using Chart.js with Dates as x-Axis labels
- Loop datasets into chart.js?
- How to set ChartJS x-axis title
- How to add custom text inside the bar and how to reduce the step size in y axis in chart js( Bar chart )
- Chart.js displays the label in a weird font in IE8
- Display API data in line charts dynamically
- How to create a line chart indicating which month a user wrote more or less blogs?
- Destroying Chart js within useEffect - React
- ChartJs events in Angular
- Mark X value on Chart Js graph