Change chart legend color


Topic: Change chart legend color

Alexandroni asked 3 years ago

Expected behavior change color of labels. Since the background is dark its necessary change the colors os all text, legends and labels to white

Actual behavior not change the colors

Resources (screenshots, code snippets etc.) https://mdbootstrap.com/snippets/standard/alexandroni/3084818


Michał Duszak staff answered 3 years ago

Thank you for your feedback. We will take adding this feature under consideration.

Keep Coding,

Michal


Michał Duszak staff answered 3 years ago

Hello,you can change color with options as a second argument.

const options =  { 
options: {
  legend: {
    position: 'top',
        labels: {
        fontColor: 'green'
  }
}, 
}}
new mdb.Chart(document.getElementById("chart-line"), dataLine, options);

I refactored your snippet: https://mdbootstrap.com/snippets/standard/m-duszak/3102516


salas ljs pro premium priority answered 2 years ago

But the code do not valid in mdb Version: PRO 6.1.0. Hope fixed the problem.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 3.5.1
  • Device: pc
  • Browser: firefox
  • OS: windows
  • Provided sample code: No
  • Provided link: Yes
Tags