(chart)
| 90 | legend: { |
| 91 | labels: { |
| 92 | generateLabels(chart) { |
| 93 | const data = chart.data; |
| 94 | const {labels: {pointStyle, textAlign, color, useBorderRadius, borderRadius}} = chart.legend.options; |
| 95 | if (data.labels.length && data.datasets.length) { |
| 96 | return data.labels.map((label, i) => { |
| 97 | const meta = chart.getDatasetMeta(0); |
| 98 | const style = meta.controller.getStyle(i); |
| 99 | |
| 100 | return { |
| 101 | text: label, |
| 102 | fillStyle: style.backgroundColor, |
| 103 | fontColor: color, |
| 104 | hidden: !chart.getDataVisibility(i), |
| 105 | lineDash: style.borderDash, |
| 106 | lineDashOffset: style.borderDashOffset, |
| 107 | lineJoin: style.borderJoinStyle, |
| 108 | lineWidth: style.borderWidth, |
| 109 | strokeStyle: style.borderColor, |
| 110 | textAlign: textAlign, |
| 111 | pointStyle: pointStyle, |
| 112 | borderRadius: useBorderRadius && (borderRadius || style.borderRadius), |
| 113 | // Extra data used for toggling the correct item |
| 114 | index: i |
| 115 | }; |
| 116 | }); |
| 117 | } |
| 118 | return []; |
| 119 | } |
| 120 | }, |
| 121 | |
| 122 | onClick(e, legendItem, legend) { |
no test coverage detected