score:1
Accepted answer
your js:
$scope.colours = ["rgba(224, 108, 112, 1)",
"rgba(224, 108, 112, 1)",
"rgba(224, 108, 112, 1)"]
your directive markup:
<canvas id="pie" class="chart chart-pie" chart-colours="colours"></canvas>
the docs say you can override default colors by setting the array :
chart.defaults.global.colours
score:0
for version 1.x there are two ways either object instances or simple rgba values as string:
colors = ["rgba(159,204,0,0.5)","rgba(250,109,33,0.7)","rgba(154,154,154,0.5)"];
colors = [
{
backgroundcolor: "rgba(159,204,0, 0.2)",
pointbackgroundcolor: "rgba(159,204,0, 1)",
pointhoverbackgroundcolor: "rgba(159,204,0, 0.8)",
bordercolor: "rgba(159,204,0, 1)",
pointbordercolor: '#fff',
pointhoverbordercolor: "rgba(159,204,0, 1)"
},"rgba(250,109,33,0.5)","#9a9a9a","rgb(233,177,69)"
];
view:
<canvas id="doughnut"
class="chart chart-doughnut"
chart-data="$ctrl.pichartdata"
chart-labels="$ctrl.labels"
chart-options="$ctrl.options"
chart-colors="$ctrl.colors"
>
</canvas>
that's worked for me as mentioned in their docs.
docs link
Source: stackoverflow.com
Related Query
- How do you set pie chart colors in angular-chart.js
- How set color family to pie chart in chart.js
- How to set single color on each bar in angular chart js
- How to show percentage (%) using chartjs-plugin-labels ( Pie chart ) in angular 2/8
- How do you set x and y axis and Title for a line chart using charts.js?
- How do you set up a chart.js scatter line chart through angular-chart.js?
- How to put dynamic colors for pie chart - chart js
- How to display the values inside the pie chart of PrimeNG (chart) using JavaScript or Angular
- How to assign different background colors to chart.js pie chart data set?
- How to set up a simple pie chart using React in ChartJS on codesandbox
- How to assign specific colors to data items in a doughnut chart in Angular Chart?
- Chart.js 3.6.2, Angular 10: Logarithmic Line chart Y-Axis problems. How to set and keep Y-Axis properties, even when data changes?
- How to set the data of chart in angular which is taken from the backend nodejs api that is store in mongodb and showing on the html page
- How to set different colors in each stacked bar chart cell?
- Chart.js - How to set a line chart dataset as disabled on load
- chart js 2 how to set bar width
- Chartjs random colors for each part of pie chart with data dynamically from database
- How do you hide the title of a chart tooltip?
- chartjs : how to set custom scale in bar chart
- Chart.js ng2-charts colors in pie chart not showing
- How to display data labels outside in pie chart with lines in ionic
- How to hide section in a Chart.js Pie Chart
- How to create single value Doughnut or Pie chart using Chart.js?
- Chart.js Pie Chart: How to set background image for segment
- Ng2-charts / chart.js - how to refresh/update chart - angular 4
- how to set chart.js grid color for line chart
- How to update data Chart in async way in Angular Chart.js?
- How to dynamically set ChartJs line chart width based on dataset size?
- Angular 8 & ChartJs change color in pie chart
- ChartJs - Pie Chart - how to remove labels that are on the pie chart
More Query from same tag
- Are you able to offset a secondary y-axis in ChartJS, by a decimal value, whilst keeping the same scale for both y-axes?
- Chart JS: is possible mix Scatter and bar chart in Chart JS?
- how to show bar value on the top of each bar in chartjs
- React js and chart js pie chart type
- angular chart js set fill color of bar chart
- Angular Radar Chart :OnClick event of label or sector
- Maximum call stack error when attempting to update Chart in Vue js
- angular-chart.js not rendering any chart
- Chart.js - Line charts with different colors for each border lines
- How to use chart.js script to draw multiple pie Charts
- Chart js 2.8 - How to make bars grow at the same speed?
- Time series line chart is not displayed
- Loop through array of objects in Node
- Uncaught ReferenceError: Chart is not defined at test.html:11
- Using ticks 'major' with Chart.js is overlapping with an unknown text
- Displaying data from simple html form to display in chartjs
- How to trigger ChartJS legend onClick with out interrupting its normal working
- How to hide other section of chartjs on click of lengend
- Chart.js charts not rendering data until I inspect element, is it because of async?
- Uncaught SyntaxError in express application
- Construct a bar chart using chart.js
- Chart.js: Pie chart legend "onclick" gets overwritten by "options.onclick" if both are present
- ChartJS and Radar Chart animation
- Add line from point to x-axis and bold label of him
- Charts.js does not render chart until I open the console
- Chart.js not showing legends
- I am getting an issue my chart using chart.js is not appering until i tap 3 time on label button
- How to set ticks on axes dynamically with chart.js?
- Vue.js component for Chart.js - strange issue on AJAX reload
- Implement ng2-charts in an Angular-Seed