Totara Learn Open Discussions

TL-39162 - Developer Documentation doesn't cover this

 
Daniel Bond
TL-39162 - Developer Documentation doesn't cover this
par Daniel Bond, Wednesday 4 December 2024, 06:09
Groupe Helpful contributor 2024Groupe Most helpful contributor 2023

As far as I can see, the Developer Documentation (https://totara.atlassian.net/wiki/spaces/DEV/pages/121184255/Advanced+settings) doesn't actually explain (as far as I can see) how a specific colour can be linked to a specific item of data. Where the set of categories is dynamic (because you are filtering), it would definitely be useful to know how to specify a given colour for a given item of data (wherever it appears in the list).

Craig Eves
Re: TL-39162 - Developer Documentation doesn't cover this
par Craig Eves (Totara Support), Sunday 15 December 2024, 14:38
Groupe Totara

Hi Daniel

Apologies for missing this question. The documentation for this has been moved from the developer docs to the public help as below

As of Totara 17.28 it is possible to specify colours to be associated with specific datasets using both ChartJS and SVGGraph.

Setting Description

categoryColors

Colours used for a specific named series or categories in the graph. These will persist while different filters are applied to the report.

For pie charts, the colours are applied per segment. For other charts, the colours are applied by data series.

You can outline as many named categories as you require this way. If any dataset does not match a named category, the regular colours above will be used instead.

If your chart supports multi-lang, you will need to define a colour for each translation.

Regards


Daniel Bond
Re: TL-39162 - Developer Documentation doesn't cover this
par Daniel Bond, Monday 16 December 2024, 05:36
Groupe Helpful contributor 2024Groupe Most helpful contributor 2023

That's really useful, thanks for highlighting. Out of interest, how do I name categories in the Totara report setup so I can then attach specific colours to them? I've tried using the name of the category (as shown in the graph), but that doesn't appear to work (because it's still using the default colour set).