Totara Learn Open Discussions

How to change the color of a graph

 
Billy Hendry
How to change the color of a graph
by Billy Hendry - Monday, 14 September 2020, 9:21 PM
 
Is there a way to change the color of a graph in a report? 


It looks like this should be done with the Custom settings option under Advanced, but I can not get this to take anything without it saying "Syntax error"

Craig Eves
Re: How to change the color of a graph
by Craig Eves (Totara Support) - Tuesday, 15 September 2020, 2:11 PM
Group Totara

Hi Billy

That is right the custom settings option should be used - the format of this should be for example colours=#ff0000 - the hexadecimal value for red

There are also other graph settings that can be changed in SVG graph (which is what Totara uses to create the graphs) as described here

Regards


Billy Hendry
Re: How to change the color of a graph
by Billy Hendry - Tuesday, 15 September 2020, 3:27 PM
 

Hi Craig,

Thank you for your reply.

That worked in T12 but I believe that the code has changed in T13?

Trying colours=#ff0000 in T13 gives me "Syntax error"

~Billy

Craig Eves
Re: How to change the color of a graph
by Craig Eves (Totara Support) - Tuesday, 15 September 2020, 4:15 PM
Group Totara

Hi Billy

It looks like this has changed in version 13 and requires JSON format as Chart JS is also being used .

The new format is explained in the public dev docs so something like "color": "#ff0000", is required 

Regards

Billy Hendry
Re: How to change the color of a graph
by Billy Hendry - Thursday, 17 September 2020, 4:38 PM
 

Hi Craig,

Unfortunately the code from the public dev docs "color": "#ff0000", is also giving me "Syntax error"

Any other ideas or suggestions Craig?

~Billy


Craig Eves
Re: How to change the color of a graph
by Craig Eves (Totara Support) - Thursday, 17 September 2020, 5:47 PM
Group Totara
Hi Billy 


Did you also include the element that you wanted the color such as "title":{color:#ff0000}

Can you try the RGB value to see if this helps

regards