Search code examples
telerik-reporting

How to set fixed colors for series legend?


I am using Telerik Reporting and creating reports with Report Designer. What I want to do is set fixed colors for specific series elements. For instance, in a monthly financial bar chart, if the series is Company, I want to set ElectricityCost as red and WaterCost as Blue all the time. The problem is that not every bar has all types of the cost, and for a specified time range, not all types will be included, which causes that the color legend varies. I've tried some approaches but failed. Is there anyone who knows how can I achieve this goal?


Solution

  • Finally I find how to set the color for specific series.

    The data points' color can be set by using the Graph.Series.BarSeries.DataPointConditionalFormatting property. The legend markers' color can be set by using the Graph.Series.BarSeries.LegendItem.MarkConditionalFormatting property.

    Besides the color, other styles can also be set so that for a certain series, the style will not change even no data is displayed after the filtering.