32
Views
5
Comments
Issue with Legend Colors in Chart
Application Type
Reactive

I created a fetchChartData action and set its output parameter (named out1) to the data type "Legacy_DataPoint List." In this action, I created an aggregate and assigned output parameters accordingly.

I then set the sourceDataPointList property to fetchChartData.out1.

I’m able to get the colors for the columns of the chart, but I’m not seeing the colors for the legends.

Can anyone help me figure out how to get the correct colors for the legends? Where could I have gone wrong?

Any guidance would be greatly appreciated!



2024-12-02 13-16-47
Vipin Yadav
2022-03-10 08-26-10
Cristian Angel Puma Villalva

Hi @Pavani Vislavath ,

You can change the legend colors using JavaScript to customize your chart. In OutSystems, default properties might not automatically apply colors to the legends when you customize the columns.

Here’s an approach you can try:

  1. Add a Custom JavaScript Block:Insert a JavaScript block in the same area where your chart is displayed.

  2. Set Legend Colors:Use the following example code to set the colors. Assuming you're using a Highcharts-based chart (commonly used in OutSystems):

var chart = $public.Charts.GetChart("chartId"); 
// Replace "chartId" with your chart's ID 
chart.update({    
   legend: {       
      itemStyle: {            
          color: '#333333', 
          // Change the legend text color            
      fontWeight: 'bold',        }    },   
      series: [        {            name: 'Series 1',  
          color: '#FF0000', // Color for Series 1        },  
          {  name: 'Series 2',
         color: '#00FF00',// Color for Series 2 
     }    ] }); 

  1. Ensure the Correct Chart ID:This code works if you correctly identify the chart's ID. You can inspect the chart element in your browser to find the ID.

Additionally, here are some resources with more examples:

  • Highcharts API Documentation https://api.highcharts.com/highcharts/
  • OutSystems Forge Components (search for "Custom Charts")

Thanks,

CRISTIAN PUMA 

2021-09-06 15-09-53
Dorine Boudry
 
MVP

For each series, add the series addon in the chart, that addon can get the color set.

Don't color individual datapoins if you want a whole series in the same color

UserImage.jpg
Nani

@Pavani Vislavath 

Better check the OutSystems Charts application is UpToDate if not make sure it is updated.

In Service Studio on right-top corner you can find a bell-Icon for update.

2023-11-22 10-51-50
Jozy Sohail

hi @Pavani Vislavath ,

check this post https://www.outsystems.com/forums/discussion/88309/legend-color-is-different-with-bar-chart/

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