Totara Learn Open Discussions

TL-39162 - Developer Documentation doesn't cover this

 
BondDaniel
TL-39162 - Developer Documentation doesn't cover this
BondDaniel 发表于 2024年12月4日 Wednesday 06:09
小组 Helpful contributor 2024小组 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
Eves (Totara Support)Craig 发表于 2024年12月15日 Sunday 14:38
小组 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


BondDaniel
Re: TL-39162 - Developer Documentation doesn't cover this
BondDaniel 发表于 2024年12月16日 Monday 05:36
小组 Helpful contributor 2024小组 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).