Formatting Charts
You can control some aspects of how data points, field names and labels are displayed on your chart, including:
| • | Whether data points are displayed. |
| • | Showing a measure name on charts including only a single measure. |
| • | Restricting the number of labels displayed. |
| • | Rotating the direction of label text. |
JasperReports Server also allows you to edit many of the chart's properties for cases when you want more control over the appearance of a chart.
Displaying Data Points
You can choose whether to display data points in your line, time series, or area chart. Data points can help users visualize chart data more accurately.
To show data points on a chart:
| 1. | In the Ad Hoc View panel, click the |
| 2. | Select Chart Format... from the menu. The Chart Format window is displayed. |
| 3. | Click the Appearance tab and select Show data points on line charts. |
| 4. | Click Apply, then OK. The name appears along the value axis. |
| 5. | To remove data points from the chart, open the Appearance tab and deselect Show data points on line charts. |
The Advanced tab on the Chart Format window gives you more control over the appearance of an Ad Hoc chart by allowing you to edit certain chart properties. For example, you can specify a list of colors for the chart, change the position of the legend, choose whether to display data values in the chart, and much more. You can find a full list of supported commands by clicking the More Information link on the Advanced tab or browsing to the Advanced Chart Formatting page Chart Format Window |
|
Displaying the Measure Name on the Value Axis
By default, in charts that include only a single measure, that measure's name is not displayed. For instance, if your measure displays the number of employees for each store in the region, that measure's label appears along the Y- (or value) axis, but the name of the measure ("Number of Employees" or similar) does not. You can, however, choose to display that measure name to clarify the information on your chart.
To show a measure name on the value axis:
| 1. | In the Ad Hoc View panel, click the |
| 2. | Select Chart Format... from the menu. The Chart Format window is displayed. |
| 4. | Select Show measure name on value axis. |
| 5. | Click Apply, then OK. The name appears along the value axis. |
| 6. | To remove a measure name, open the Labels tab and deselect Show measure name on value axis. |
Restricting Label Display
By default, every field included in your chart has a label displayed along either axis. Measures will show up as numeric values, often along the Y axis, and fields being measured will show up as text along the X axis. On some charts - especially those with many included fields - these labels may overlap, crowd together, or become difficult to read. You can alleviate this problem by "stepping," or reducing, the number of labels displayed on your chart.
To reduce the number of labels on your chart:
| 1. | In the Ad Hoc View panel, click the |
| 2. | Select Chart Format... from the menu. The Chart Format window is displayed. |
| 4. | In the Interval between X-axis labels numeric entry box, specify how often you want the axis label to appear. For instance: |
| • | To display every second label, enter 2. |
| • | To display every third label, enter 3, and so on. |
| 5. | Repeat this process in the Interval between Y-axis labels numeric entry box. |
| 6. | Click Apply, then OK. The labels appear as entered. |
| 7. | To display every label, open the Axis tab and enter 1 in the numeric entry boxes. |
Rotating Label Text
By default, labels on your chart are displayed horizontally. Multiple labels, or very long ones, can be difficult to read. You can change the direction of these labels, on both the X and Y axes, to improve chart readability.
To rotate label text:
| 1. | In the Ad Hoc View panel, click the |
| 2. | Select Chart Format... from the menu. The Chart Format window is displayed. |
| 4. | In the Rotation of X-axis labels specify the degree of rotation to apply to labels. For instance: |
| • | To rotate labels clockwise 90 degrees, enter 90. |
| • | To rotate labels counter-clockwise 90 degrees, enter -90. |
| • | To rotate labels clockwise 45 degrees, enter 45, and so on. |
| 5. | Repeat this process in the Rotation of Y-axis labels entry box for measures along the Y axis. |
| 6. | Click Apply, then Close. The labels are rotated. |
| 7. | To return the labels to their original, horizontal position, open the Axis tab and enter 0 in the numeric entry boxes. |
Changing the Chart's Appearance Using Advanced Formatting
on the Jaspersoft Community Site.
To edit the chart's properties:
| 1. | In the Ad Hoc View panel, click the |
| 2. | Select Chart Format... from the menu. The Chart Format window is displayed. |
| 3. | Click the Advanced tab. |
| 4. | Click Add New Property. |
| 5. | In the Property field, enter the chart property you want to format and then enter the value(s) for the property. For instance: |
| • | To format the chart's colors, enter colors for the property and a comma-separated list of colors in brackets for the values, such as ["red", "blue", "green", "magenta", "purple", "black", "yellow"]. |
| • | To change the vertical alignment of the legend, enter legend.verticalAlign for the property and "top" or "bottom" or "center" for the value. |
| • | To display data values on the chart, enter plotOptions.series.dataLabels.enabled for the property and true for the value. |
Click the More Information link to see a list of the properties you can edit.
| The Ad Hoc Designer does not validate the property name or values. The chart will ignore any invalid property you enter. |
| 6. | Click |
| 7. | Click Apply, then Close. The chart is updated with the new formatting. |
| 8. | To remove the formatting, open the Advanced tab and click |
Recommended Comments
There are no comments to display.