score:2
Accepted answer
The solution is to use chart-dataset-override. These examples helped me a lot: https://github.com/jtblin/angular-chart.js/blob/master/examples/dataset-override.html https://github.com/jtblin/angular-chart.js/blob/master/examples/dataset-override.js
<canvas class="chart chart-doughnut" chart-data="ringChartData.data" chart-labels="ringChartData.labels" chart-options="ringChartData.options" chart-dataset-override="datasetOverride" height="100">
</canvas>
$scope.ringChartData = {
labels: [],
data: [],
options: {
elements: {
arc: {
borderWidth: 0.7
}
},
legend: {
display: true,
position: 'bottom',
labels: {
boxWidth: 12
}
},
tooltips: {
enabled: true,
callbacks: {
label: function(tooltipItem, data) {
return data.labels[tooltipItem.index] + ': ' + data.datasets[0].data[tooltipItem.index] + ' ' + tooltipSuffix;
}
}
}
}
};
$scope.datasetOverride = {
backgroundColor: ['#383a4e', '#A04d4d', '#ff8c00', '#413041', '#7b6888', '#6b486b', '#d68c5b', '#d0743c'],
hoverBackgroundColor: ['#22243a', '#822e2e', '#c66d00', '#2d1a2d', '#634d72', '#533253', '#B66734', '#AF561E'],
hoverBorderColor: ['#22243a', '#822e2e', '#c66d00', '#2d1a2d', '#634d72', '#533253', '#B66734', '#AF561E']
};
Source: stackoverflow.com
Related Query
- How to set single color on each bar in angular chart js
- How to specify hover color angular-chart.js
- How to customize tooltip on mouse hover of a polar area chart of Angular Charts
- How to change label color of ng2 chart in angular
- How to display data on hover inside doughnut chart in Angular Chart?
- How to clear a chart from a canvas so that hover events cannot be triggered?
- How set color family to pie chart in chart.js
- Ng2-charts / chart.js - how to refresh/update chart - angular 4
- how to set chart.js grid color for line chart
- How can I trigger the hover mode from outside the chart with charts.js 2?
- How to update data Chart in async way in Angular Chart.js?
- Angular 8 & ChartJs change color in pie chart
- Angular chart how to show the legend data value by default along with legend name
- How to show percentage (%) using chartjs-plugin-labels ( Pie chart ) in angular 2/8
- How to add title inside doughnut chart in Angular Chart?
- How to add area with break on line chart with fill color
- How to use segment property to color line / border color based on value in chart js?
- how can i modify scale labels in angular chart js?
- How to change color of column in chart js
- How to use set the color for each bar in a bar chart using chartjs?
- How to draw multiple color bar in a bar chart using chart.js
- How to generate color code dynamically by swapping 2 characters within a string using PHP
- How to remove or color line/grid in polar chart area using Chart.js?
- How to change background color of labels in line chart from chart.js?
- How to rotate the Label text in doughnut chart slice vertically in chart.js canvas, Angular 12?
- How to filter hover on a chart in ChartJS?
- How to change color by clicking on the chart bar?
- How can I change the cursor on pie chart segment hover in ChartJS 3?
- How to send data to chart js using angular
- how to increase space between legend and chart in chartjs (ng2charts ) using angular
More Query from same tag
- Chart.js add padding to scales
- ChartJS Custom text on certain xAxis and yAxis linesS
- Chart.js animations ignoring global default configuration
- Bootstrap modal showing when clicking individual points in Linechart but not in individual bars in Barchart
- How can I use npm-plugins with react-chartjs-2?
- Chart.js creating a line graph using dates
- Chart js :Adding onclick event on slice of doughnut chart is not working in react-chartjs-2
- hh:mm in chart.js on X-axis and text labels on the Y-axis
- add value to Line chart.js
- Error: Cannot read property 'props' of undefined, Calling parent Method in Child
- ng-repeat in ChartJS AngularJS
- Hide chart labels
- Using Different Colors In a Chart
- Chart.js: Line chart with partial dashed line
- Return 0 when some information DOESN'T EXIST (not when exists and return null)
- PHP restructure array of data
- Changing the background of a ChartJS on node js
- ChartJs not working with this JSON Object
- Linear x axis for bar chart chartjs
- Trouble using utcoffset with Chart.js
- Embed <canvas> tag in Laravel Markdown?
- How can I display fixed labels on X-axis while having data on that axis?
- How to make a line dashed or dotted in chartJS?
- Can't Customize Chart.js
- How to create a stacked donut chart in Angular 5
- Adding additional data to chart
- In bar chartjs report zero values are skipped so bars are invalid
- Show labels on each sector to polar chart using angular js chart
- Chart.js point format data for a scatter plot
- Full width bars in Chart.js version 2.7.2