mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
Fix the missing apply for the color on the legend labels (#10855)
* Fix the missing apply for the color on the legend labels * apply review
This commit is contained in:
parent
b271b5098a
commit
5a90b71163
@ -92,7 +92,7 @@ export default class DoughnutController extends DatasetController {
|
||||
generateLabels(chart) {
|
||||
const data = chart.data;
|
||||
if (data.labels.length && data.datasets.length) {
|
||||
const {labels: {pointStyle}} = chart.legend.options;
|
||||
const {labels: {pointStyle, color}} = chart.legend.options;
|
||||
|
||||
return data.labels.map((label, i) => {
|
||||
const meta = chart.getDatasetMeta(0);
|
||||
@ -102,6 +102,7 @@ export default class DoughnutController extends DatasetController {
|
||||
text: label,
|
||||
fillStyle: style.backgroundColor,
|
||||
strokeStyle: style.borderColor,
|
||||
fontColor: color,
|
||||
lineWidth: style.borderWidth,
|
||||
pointStyle: pointStyle,
|
||||
hidden: !chart.getDataVisibility(i),
|
||||
|
@ -36,7 +36,7 @@ export default class PolarAreaController extends DatasetController {
|
||||
generateLabels(chart) {
|
||||
const data = chart.data;
|
||||
if (data.labels.length && data.datasets.length) {
|
||||
const {labels: {pointStyle}} = chart.legend.options;
|
||||
const {labels: {pointStyle, color}} = chart.legend.options;
|
||||
|
||||
return data.labels.map((label, i) => {
|
||||
const meta = chart.getDatasetMeta(0);
|
||||
@ -46,6 +46,7 @@ export default class PolarAreaController extends DatasetController {
|
||||
text: label,
|
||||
fillStyle: style.backgroundColor,
|
||||
strokeStyle: style.borderColor,
|
||||
fontColor: color,
|
||||
lineWidth: style.borderWidth,
|
||||
pointStyle: pointStyle,
|
||||
hidden: !chart.getDataVisibility(i),
|
||||
|
@ -17,6 +17,7 @@ describe('Default Configs', function() {
|
||||
var expected = [{
|
||||
text: 'label1',
|
||||
fillStyle: 'red',
|
||||
fontColor: '#666',
|
||||
hidden: false,
|
||||
index: 0,
|
||||
strokeStyle: '#000',
|
||||
@ -26,6 +27,7 @@ describe('Default Configs', function() {
|
||||
}, {
|
||||
text: 'label2',
|
||||
fillStyle: 'green',
|
||||
fontColor: '#666',
|
||||
hidden: false,
|
||||
index: 1,
|
||||
strokeStyle: '#000',
|
||||
@ -35,6 +37,7 @@ describe('Default Configs', function() {
|
||||
}, {
|
||||
text: 'label3',
|
||||
fillStyle: 'blue',
|
||||
fontColor: '#666',
|
||||
hidden: false,
|
||||
index: 2,
|
||||
strokeStyle: '#000',
|
||||
@ -90,6 +93,7 @@ describe('Default Configs', function() {
|
||||
var expected = [{
|
||||
text: 'label1',
|
||||
fillStyle: 'red',
|
||||
fontColor: '#666',
|
||||
hidden: false,
|
||||
index: 0,
|
||||
strokeStyle: '#000',
|
||||
@ -99,6 +103,7 @@ describe('Default Configs', function() {
|
||||
}, {
|
||||
text: 'label2',
|
||||
fillStyle: 'green',
|
||||
fontColor: '#666',
|
||||
hidden: false,
|
||||
index: 1,
|
||||
strokeStyle: '#000',
|
||||
@ -108,6 +113,7 @@ describe('Default Configs', function() {
|
||||
}, {
|
||||
text: 'label3',
|
||||
fillStyle: 'blue',
|
||||
fontColor: '#666',
|
||||
hidden: false,
|
||||
index: 2,
|
||||
strokeStyle: '#000',
|
||||
|
Loading…
Reference in New Issue
Block a user