This is a migrated thread and some comments may be shown as answers.

Map individual colors to each legends in the Chart

1 Answer 11 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sijeesh
Top achievements
Rank 1
Veteran
Sijeesh asked on 09 Jun 2020, 07:42 PM

I have a line chart report with only one series and has 4 Legends(Legend A, Legend B, Legend C & Legend D) in it. And I have assigned 4 different color patterns to the chart.

The order is Green, Red, Blue, Yellow.

 

Now, when the Report loads the data for all the Legends, the Colors are mapped correctly. For Example, Legend A = Green, Legend B = Red, Legend C = Blue & Legend D = Yellow in the same order.

There is a scenario where in the report has the data only for 2 legends( Legend B and Legend D). In this case, the report automatically chooses Legend B to be Green and Legend D to be Red.

Is there a way to set or map individual colors to the legends? Like Legend A should always be Green, Legend B as Red, Legend C as Blue & Legend D as Yellow.

I know if we use 4 series in the chart then this is possible, but i do not want to use multiple series.

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 12 Jun 2020, 02:14 PM

Hi Sijeesh,

Generally, the color of the series/legends is controlled by the ColorPalette property. The first color in the palette is assigned to the first series and so on.

You may control the color also with Conditional Formatting. The property is under the Appearance group in the LineSeries properties. This way, the color of each series may be set individually. See the attached screenshot SeriesConditionalFormatting.png for clarity.

A more general solution can be found also in the Provide Graph ColorPalette Dynamically KB article.

Regards,
Todor
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
General Discussions
Asked by
Sijeesh
Top achievements
Rank 1
Veteran
Answers by
Todor
Telerik team
Share this question
or