Symptom
- Chart Legend text misaligned with the value.
- When at least one item in a Chart Legend has text displaying on more than one line, each item are not aligned with it's value in the legend in Crystal Rpeorts for Enterprise.
- Note: Images and data in this SAP Knowledge Base Article, and sample report is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.
Environment
- SAP Crystal Reports for Enterprise 4.1
- SAP Crystal Reports for Enterprise 4.2
- SAP Crystal Reports for Enterprise 4.3
Reproducing the Issue
- In Crystal Reports for Enterprise, create a report based on any data source.
- Insert a Chart.
- When viewing the report, notice the text for each item in the Chart Legend is misasligned, if one of the text cannot be displayed on one line, and span over multiple lines.
Cause
- When at least one of the text of an item listed in the Chart Legend cannot fit on one line, it format all the item listed in the legend to be displayed on multiple lines. This is formatted this way to have a consitant Chart Legend formatting, but it gives the impression the values are misaligned with the text of each item in the Chart Legend, when in fact it is aligned to the last line of the text of each item in the legend.
Resolution
- There is no formatting option in the Chart Legend to align the value to the first line. It always align to the last line of the text of each item.
- The suggestions are:
- Truncate the text to display each of the the item of the Chart Legend on one line; or
- Resize the Chart and the Chart Legend so the longest text displayed for an item in the Legend displays on one line.
- To truncate the text to display each of the the item of the Chart Legend on one line:
-
Determine what is the estimated maximum number of characters that can fit on one line for one item in the Chart Legend.
( For example: 25 characters ) - Create a formula that truncates the text used for the serie on the chart based on the maximum number of characters that can fit in the Chart Legend on one line. The formula will look like:
Local StringVar myText := <INSERT YOUR DATABASE FIELD HERE>;
Local NumberVar Number_Of_Characters_Limit := 25; // Maximum Number of Characters to display on one line.
If Length(myText) > Number_Of_Characters_Limit Then
myText[1 to (Number_Of_Characters_Limit- 3)] + "..."
Else
myText - Edit the Chart, and replace the database field used for the series, by the formula that truncate the text.
- Save your report.
- For a sample report demonstrating the suggestions, see the report: Chart Legend Suggestions.rpt in the Attachments section below
Keywords
KBA , BI-RA-CRE , Crystal Reports for Enterprise , Problem
Product
SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020
Attachments
Chart Legend Suggestions.rpt |