text color to white const ctx = document.getElementById("canvas").getContext("2d"); //…
- User
text color to white const ctx = document.getElementById("canvas").getContext("2d"); // Get the 2D context this.myChart = new Chart(ctx, { type: type, // Use the passed type parameter data: { labels: this.Statement.balance_list_lable || [], // Ensure labels are defined datasets: [{
label: "Balance",
data: this.Statement.balance_list || [], // Ensure data is defined borderColor: 'rgba(255, 255, 255, 1)',
backgroundColor: 'rgba(255, 255, 255, 1)', borderWidth: 1 }]
}, options: { responsive: true, plugins: { legend: { display: true, labels: { color: 'white' // Change legend text color to white } }, }, }, }); - Assistant
To change the text color of all text elements in a Chart.js chart to white, you need to adjust your chart configuration. You've already covered changing the legend text color to white. You'll also want to change the scales (for axis labels and tick marks) to white. Here's how you can do it:
javascript