Modifying a chart

Once a chart has been created, you can further modify it by accessing its shortcut menu wizard which is composed by a set of screens that are similar to the wizard screens used to create the chart. For example, you can change the data or even the dataset used by the chart, change the chart type, and so on.

To modify a chart after it has been created:

  1. Right-click the chart and select Chart Wizard from the shortcut menu to display the Chart Wizard.
  2. In the Data screen, specify a new dataset for the chart if required. However, due to the specialty of hierarchical data sources, you are not allowed to specify an HDS as the new dataset of the chart.
  3. In the Type screen, specify the type of the chart.

    If you want to change the chart type, you may need to first remove all chart data. Specially, if you change a combo type to a single type or vice versa, JReport will prompt you to make sure because all chart data will be removed automatically.

    Note: While changing a type of 2-D chart to another type of 2-D chart, or a type of 3-D chart to another type of 3-D chart, all the previous properties will be kept. Nevertheless, when changing a 2-D chart to a 3-D chart, the properties of the Z axis, the Y-Z wall, and the floor of the 3-D chart will be set to default values (since a 2-D chart does not have the Z axis, the Y-Z wall, or the floor), and all other properties will be taken from the 2-D chart. When changing a 3-D chart to a 2-D chart, the properties of the Y2 axis of the 2-D chart will be set to default values (since a 3-D chart does not have the Y2 axis).

  4. In the Display screen, specify the fields you want to display in the chart, and define the sort order , special function and Select N condition of the fields if required.

    Notes:

    • If there are existing fields in the chart that cannot match the new dataset, they will be marked with a red cross icon. You can use the Replace button to select fields from the new dataset to replace them. Then when you finish the modification, the new dataset and fields you specify will be displayed in the chart and those remaining fields that cannot be matched to fields in the new dataset will be removed from the chart automatically.
    • When both special functions and Select N conditions are defined in a chart, the former takes higher priority. That is to say, grouping data by intervals takes effect before Top/Bottom N.
  5. In the Layout screen, specify the settings for the chart elements as required.
  6. In the Style screen, select a style for the chart.
  7. When done, click Finish to accept the changes.

After finishing the modification, you can also apply some filter conditions to narrow down the records displayed in the chart the same as you do for a table (for details, see Filtering the data). However, if the chart is created on an HDS, the conditions you define in the Format Filter dialog will not be applied when the chart runs due to the speciality of HDS. Therefore, if you want to filter the data displayed in such kind of chart, you need to make use of the dataset filter.

See also Chart Wizard for details about options in the wizard.

Specifying the sort order of field values in a chart

You can specify the sort order of field values on the category and series axes of a chart according to your requirements.

To apply a sort order to field values on certain axis:

  1. In the Display screen of the Chart Wizard, click the Sort Order button below the Category/Series box.
  2. In the Sort Order dialog, specify the sorting manner as required.
  3. Click OK to accept the settings.
  4. When done, click Finish in the Chart Wizard to apply the changes.

Grouping data on the category/series axis of a chart by intervals

If the data type of the field displayed on the category/series axis of a chart is of Numeric/String/Date/Time type, you can specify some special function to the field so as to group data on the axis by intervals according to your requirements.

To group data on the category/series axis of a chart by intervals:

  1. In the Display screen of the Chart Wizard, click the Special Function button below the Category/Series box.
  2. In the Special Function dialog, select the special function for the category/series field from the Function drop-down list (for details about the special functions, refer to Specifying special function for group by field), then click OK.
  3. Click Finish in the Chart Wizard to apply the selected special function to the field.
Notes:

Defining the Select N condition in a chart

Sometimes, you may want to show data of certain category/series values in a chart. To achieve this, you can use the Select N feature. By specifying a Select N condition, you can decide how many category/series field values will be displayed in the chart. You can also use an Integer-typed parameter to control the value of Select N.

To define a Select N condition in a chart:

  1. In the Display screen of the Chart Wizard, click the Select N button below the Category/Series box to display the Select N dialog. See the dialog.

  2. Specify the Select N condition to All, Top or Bottom.
  3. If the Based on checkbox is unchecked, the order for the top or bottom N values will be based on what you specify in the Sort Order dialog; if you check it, the order will be based on the values of the summary field and the sort direction you specify in the drop-down list next to the Based on checkbox.
  4. If you have selected Top or Bottom from the Select N drop-down list, then you can check the Other checkbox and the type a character string in the next text box, so that the those category/series values beyond the first or last N range will be merged into the group with the name as that character string.
  5. Click OK to accept the Select N settings.
  6. Click Finish in the Chart Wizard to apply the changes.

The following example shows how to apply a Select N condition to a chart.

  1. Open AnnualSalesbyRegion.cls in the TutorialReports.cat catalog. See the report.
  2. Right-click the chart in the report and select Chart Wizard from the shortcut menu to open the Chart Wizard.
  3. In the Display screen, click the Select N button for the category axis.
  4. In the Select N dialog, set the Select N condition to Top 2, based on Sum_AnnualSalesbyRegion_AbbreviationName ascending, and put the categories that do not meet the condition into the Other group. Then click OK. See illustration.
  5. Click Finish in the Chart Wizard.
  6. View the report again. See the result.