
Hi!
How to change colors in the chart? For some reason in my chart only 6 different colors(but 8 sectors, that is, two colors are repeated).
How to fix it? How to change colors in the chart?
Thank you!
6 Answers, 1 is accepted
The Graph item comes with built-in palettes, and you can define additional custom palette. These palette colors also appear in the legend. When multiple series are added to the chart, the chart assigns the series a color in the order that the colors have been defined in the palette.
If there are a greater number of series than there are colors in the palette, the chart will begin reusing colors, and two series may have the same color. To avoid confusion, define a custom palette with at least the same number of colors as you have series on your chart.
For more information on how to define a custom color palette, please refer to Formatting Series Colors.
Regards,
Nasko
Progress Telerik

Hi,
May I please know if we can assign custom colour to each series in Pie-Chart. Sometimes if there are 4 series expected such as Satisfied/Extremely satisfied/Dissatisfied/Extremely dissatisfied but the records returned are only 2 rows one for each series, then if I use colour pallete the first series gets mapped to the first colour in colour pallete.
Instead is there a way where we can assign a colour from the database itself?
Thanks
Vas
Hello Vas,
You may use Conditional Formatting. The property you need is 'DataPointConditionalFormatting' for the corresponding Series - check the attached screenshot 'SeriesDataPointConditionalFormatting.png'. The color, in this case, is independent of the Color Palette.
For manipulating the label, e.g. to assign it a custom color conditionally, you may use ''DataPointLabelConditionalFormatting' property of the series.
The conditional formatting does not allow to set the color with Expression. It is necessary to select it from the hard-coded colors. You may want to vote for the Ability to dynamically specify the graph series color via binding feature request.
Alternatively, you may set the ColorPalette with Bindings:
Property Path | Expression ColorPalette | = MyUserFunctionName(MyColor1, MyColor2, ...)
The User Function should return the proper palette based on its arguments - type Telerik.Reporting.Drawing.IColorPalette. Here is a sample function that returns palette based on a list of Hex colors:
public static IColorPalette UserColorPalette(params string[] hexColors)
{
string[] colors = hexColors;
if (null == colors || colors.Length <= 0)
{
return null;
}
if (colors.Length == 1)
{
colors = colors[0]
.Split('#')
.Where(c => !string.IsNullOrWhiteSpace(c))
.Select(c => $"#{c.Trim()}")
.ToArray();
}
ColorPalette colorPalette = new ColorPalette(colors);
return colorPalette;
}
The list of color arguments may be easily substituted with other values, for example, fields from the database.
Regards,
Todor
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.

Sorry if this is only loosely related to the previous questions...
In several of my reports, I have the same data in both a table and a pie chart, side by side.
Is there any way that the colors of the pie chart palette (standard or custom, nvm) can be used to color a shape in the table, so that the legend becomes redundant?
A bit left-field, I admit, but any help appreciated. :-)
Erik

Hello Todor,
I have the exact requirement similar to Vas. I would like to bind the color from the database.
As you suggest as an alternate way of ColorPalette Bindings, can you please help me with a working example ? because i do not know where to write the User Function (c# code or js code). I could not able to bind ColorPalette property as well
Thanks for your support
Ramesh R
Hi Ramesh,
The User Function should be in a C# or VB ClassLibrary project. Then you need to copy the assembly with the function in the Standalone Designer folder or reference it in the project that hosts the Reporting engine. You also have to register the assembly in the configuration file of the designer, or the project with the Reporting engine.
Check also the following resources:
- Provide Graph ColorPalette Dynamically
- Extending Report Designer
- Extending Reporting Engine with User Functions
- assemblyReferences Element
Regards,
Todor
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.