Tip: How to change the text of Legends in Crystal Reports?


More and more I use Crystal Reports, my Sucker Level of the product (Crystal Reports, da...) is rising exponentially.

If you generate a report from a database command, XML document, or XML schema, and add a chart to the report, CR generates chart and legends automatically. In legends, it adds the table column names, which you select to get the data from.

If you use ADO.NET DataSet document (XML or .xsd files), the legend names would look like DataTableName.ColumnName for all columns you are using in the chart. Now if you want to change this default legend's text, you are out of luck. At least I wasn't able to figure it out.

After spending half a day, I gave up and came up with couple of workarounds. One was, being a GDI+ expert, I could create my own graphics which looks like legends. Alternatively, the easy approach was, create a box and color is what color your chart bars are and put a text box side by side with the name of the column. For example, if your database column names are Column1, Column2 and Column3 but you want your data legend names Fall, Summer, and Winter, you create three boxes with the color of chart bars and put TextBox with text Fall, Summer, and Winter.

This approach worked for me. If you find a better way, don't forget to share with us.