62
Views
13
Comments
Solved
Not getting expected colors for chart legends
Application Type
Reactive

Hi everyone,

I have a dashboard that displays charts using data from a database. The charts represent different entities, and I filter the data to create stacks in bar charts based on these entities. I have also added an entity attribute called attribute_color, for example, language and lang_color. 

I have encountered an issue where the bar stacks display the correct colors, but the legend at the bottom of the chart appears in grey and does not reflect the assigned colors.

Please provide your guidance.
Thank you.




Screenshot 2025-01-15 104049.png
Screenshot 2025-01-15 105641.png
Screenshot 2025-01-15 104541.png
UserImage.jpg
Zinee Gulhane
Solution

Hello folks,
I understood what part I was doing wrong.
In the outsystems chart reference, I was using Charts_Version_1 instead of Charts and Addons.
It is working fine now.
Thankyou for all your responses.

2024-12-02 13-16-47
Vipin Yadav

Hi @Zinee Gulhane ,

If possible, could you please share your OML file? I will review it and get back to you with my findings. 

Thanks,

Vipin Yadav

UserImage.jpg
Zinee Gulhane

Unfortunately, I can't share the OML file but will try to provide a sample soon. Thanks!

UserImage.jpg
Zinee Gulhane

Hi @Vipin Yadav  I am attaching a demo OML below.
Please help me with regard to this.
Thank you! 

TestLegendColor.oml
2024-12-02 13-16-47
Vipin Yadav

Hi @Zinee Gulhane ,

I have checked your OML file, and it is working fine. 

Demo URL - https://vyadav.outsystemscloud.com/Demo/SampleLegendColor

However, in your case, the issue might be related to the data. It’s possible that the Language Id is not present in the CompleteData2 table, which is why the color is not showing. Please check the data and let me know if anything is unclear. 


Thanks,

Vipin Yadav

TestLegendColor.oml
2022-01-05 09-37-24
Faiz Khan

Hi @Zinee Gulhane 

Try to pass the name of colors in the color attribute
Regards,

Faiz

UserImage.jpg
Zinee Gulhane

As in my example, for Language entity, I have 3 languages with specific color for each. This is why I have assigned the color via entity attribute. If I write the color directly, it might not differ across 3 languages, right?
Do you have any input on this?
Thanks!

UserImage.jpg
Zinee Gulhane

Unfortunately, I can't share the OML file but will try to provide a sample soon. 
Will check above links.
Thanks!

UserImage.jpg
Zinee Gulhane

Hi @Rajat Agrawal I am attaching a demo OML below.
Please help me with regard to this.
Thank you!

TestLegendColor.oml
UserImage.jpg
Eliaam Crook

Set colors explicitly in the chart config to sync the legend.

UserImage.jpg
Zinee Gulhane

As in my example, for Language entity, I have 3 languages with specific color for each. This is why I have assigned the color via entity attribute. If I write the color directly, it might not differ across 3 languages, right?
Do you have any input on this?
Thanks! 

2026-01-28 16-57-48
Mihai Melencu
Champion

Hello @Zinee Gulhane ,

You have assigned colors to individual data points but not to the series as a whole. As a result, the chart is automatically generating colors for each series. In OutSystems, using the version of the chart component you implemented, colors are typically defined within the data arrays by default. To specify the color attribute outside the data arrays, customization is required using a JSON configuration.

Here are some helpful links:


UserImage.jpg
Zinee Gulhane
Solution

Hello folks,
I understood what part I was doing wrong.
In the outsystems chart reference, I was using Charts_Version_1 instead of Charts and Addons.
It is working fine now.
Thankyou for all your responses.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.