This commit is contained in:
Joffrey JAFFEUX
2021-08-23 14:21:58 +02:00
committed by GitHub
parent d7c185bf3d
commit 6c0efd50bc

View File

@ -470,6 +470,7 @@ createWidget("discourse-poll-pie-canvas", {
}); });
const el = document.getElementById(`poll-results-chart-${attrs.id}`); const el = document.getElementById(`poll-results-chart-${attrs.id}`);
// eslint-disable-next-line no-undef
this._chart = new Chart(el.getContext("2d"), config); this._chart = new Chart(el.getContext("2d"), config);
}); });
}, },
@ -566,7 +567,7 @@ function pieChartConfig(data, labels, opts = {}) {
plugins: { plugins: {
legend: { legend: {
labels: { labels: {
generateLabels: function (chart) { generateLabels: function () {
return labels.map((text, index) => { return labels.map((text, index) => {
return { return {
fillStyle: getColors(data.length)[index], fillStyle: getColors(data.length)[index],