1530
Views
3
Comments
[How to use OutSystems Charts Web] How to change color of the items in the Legend?
Question
how-to-use-charts
Web icon
Forge asset by OutSystems Lab
Hi!
First of all, nice work!
I'm using a stacked chart. I'm able to define the colors in the data points for the columns, green for "Respondidos" and red for "Não respondidos".
But the Legend gets it's own automatica colors not corresponding to the values in the columns.
I've searched HighCharts API Reference and the examples in "Charts_HowTo" on how to customize the Legend in an advanced way but could not find anything. (The example that you give of using a stacked charts uses automatic colors).
Can you help?
Thanks!

2021-05-05 07-35-47
Vera Tiago
Staff
Hi Tiago

You just need to add  colors: ['#008000', '#A52A2A'], on the same order as series, on json (AdvancedFormat).
Check this example and try to change the colors: https://jsfiddle.net/ruus/aaLejbc7/
Let me know if any trouble doing this - I can help you.

Cheers,
Vera

2023-10-06 09-22-20
Tiago Bernardo
Champion
Thank you for the reply.
I already had figure it out, in a different form from your solution. I wasn't fast enough to reply here.
I had to build a list of the structure "AdvancedDataSeriesFormat", with 2 elements, one for each series, with the attribute "DataSeriesJSON" like for example " color: '#008000' ".
Then pass that list to the action AdvancedFormat_Init() in the "DataSeriesFormats" parameter.

I was incorrectly trying to do the formating of the colors of the elements in the legend using the parameter "HighchartsJSON" of the action AdvancedFormat_Init().

UserImage.jpg
Conwell Nkuna
Can't you add a colour by point functionality like we do on HighCharts?

This can help caters for more columns display....
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.