## Manipulating data components

You can manipulate data components, which refer to crosstabs, tables, charts, and geographic maps, in dashboards as shown below.

Applying a style to a data component

Right-click in the component, then on the shortcut menu, select a style from the Apply Style submenu.

Going through the data of tables, crosstabs and charts

Going actions enable you to switch among data groups freely for viewing different records without having to create a new data component. They can be performed on table groups, crosstab column/row headers, and data labels on the chart category/series axis as well as the legend entry labels.

Choose the proper one to meet your needs from the following:

- Go To
  Jumps to a different group by replacing the current.
- Go to by Value
  Jumps to another group while applying the current value being clicked on as a filter condition.
- Go Down
  Goes from a group which is non-bottom level in a predefined hierarchy to the one-level-lower group while applying the current selected value as a filter condition.
- Go Up
  Jumps from a group which is non-top level in a predefined hierarchy to the one-level-higher group.

Note: You can also directly click group objects to perform the go-down action, however, if the group objects are also defined with some links, you can go down to the next level with a single click only when the click priority of the go-down action is specified to be the highest at design time. Otherwise, you have to use the Go Down command on the objects' shortcut menu to perform the action.

For example demonstration of them, refer to Going through the report data.

The go-to-by-value or go-down actions always happen along with the generation of a filter condition. The filters are displayed as "FieldName:Value" at the bottom of the library components, in a row one by one from left to right according to the time they are generated. When the row cannot hold all of the filters, two buttons are displayed at the two ends of the row for scrolling through the filters to the left and right. Each click on the button will show one hidden filter. To remove a filter condition, click X right to it.

Customizing the data format of values in tables, crosstabs and charts

To customize the data format of the values of a field in a table or crosstab, right-click on any value of the field, then select a format from the Format submenu, or input a format in the text box at the bottom of the submenu and click Enter on the keyboard.

You can also customize the data format of the legend entry labels and data labels on the category and series axes if they are of Number or Date/Time type. To do this, right-click on the labels and select the required format from the Format submenu, or input a format in the text box at the bottom of the submenu and click Enter on the keyboard.

Removing component level filters from a data component

On the shortcut menu of data components, there is an option Remove Filters which is used to remove filter conditions generated via the configuration panel and via message delivery from the data components. These two kinds of filters are referred to as component-level filters.

In dashboards you can also use sliders and filter controls to do filtering, however filters created by sliders or filter controls are not under the control of the removing component level filter action, because they are regarded as dashboard-level filters.

Manipulating a table

- Sorting data in a table
  - Using shortcut menu
    You can sort the values of a field in a table with the shortcut menu. To do this, right-click on any value of the field, then on the shortcut menu, select Ascend or Descend from the Sort submenu. If a detail field value is clicked on, the sorting will affect the order of detail records in the table; if it is a group field value, the order of groups in the group level represented by the group field will be rearranged. To remove the sort condition, select No Sort.

  - Using labels
    You can use labels to control the sorting order for certain fields in tables. This feature needs to be enabled at report design time.

    1. In JReport Designer, select a label in a table in a library component, and then set the Sortable property of the label to true.
    2. Set the field by which you want to sort records as the value of the label's Bind Column property.
    3. Save the library component and publish it to JReport Server.
    4. Create a dashboard and insert the table in it. You can see a sort button displayed beside the label.
    5. To sort the table based on the specified column values ascendingly, click the upward triangle; to sort the values descendingly, click the downward triangle.

       After applying a sort order, the corresponding triangle will be highlighted. To remove the sort order, click the highlighted triangle.

  - Using server profile setting
    You can also configure the server profile to enable sorting records in tables by clicking the sort button on table column headers.

    1. Open the Profile > Customize Profile > Common tab.
    2. Check the option Sort on Column Headers to enable clicking the sort button on column headers to sort table records (by default, this option is checked).
    3. Check Show Sort/Filter Status on Column Headers if you want the the sort button to be always displayed on the table column headers with the current sort status. If this option is unchecked, each time you want to get the sort button for a column, you need to put the mouse pointer on its header to make the button shown.
    4. Run a dashboard containing a table and you can click on the table column headers to sort data.

       To sort the table based on any column values ascendingly, click the upward triangle on the column; to sort the values descendingly, click the downward triangle. When a sort order is applied, the corresponding triangle will be highlighted. To remove the sort order, click the highlighted triangle.

- Filtering data in a table
  - Using shortcut menu
    You can use filter-related commands on the shortcut menu to filter data in a table. To do this, right-click on any value of a detail field by which you want to filter data, then you can see the Filter item which provides a submenu containing the following commands:
    - Remove Filter
      This command is enabled after you have applied filtering on the field. Clicking this item will remove all filters on this field.
    - First N
      Shows the First N item with which you can filter data to display records that meet the First N condition. You can select a number from the submenu or enter a positive integer into the text box on the submenu to specify the First N condition.

      For example, if you select 5 from the First N submenu for a certain field, then only the records with the field value equal to one of the first five field values will be displayed.

    - Last N
      Shows the Last N item with which you can filter data to display records that meet the Last N condition. You can select a number from the submenu or enter a positive integer into the text box on the submenu to specify the Last N condition.

      For example, if you select 5 from the Last N submenu for a certain field, then only the records with the field value equal to one of the last five field values will be displayed.

    - Field values
      "Field values" is not the name for a command on the Filter submenu, but represents some items which are the values of the field you right-click on. Selecting any field value listed here will make the table only display records with the field value equal to the selected one.
    - More
      This command is enabled if the Filter submenu cannot list all field values. When it is enabled, clicking it will show the Select Values dialog, with which you can search for and select values conveniently with the help of the quick search toolbar.
  - Using labels
    You can use a label to control the filter conditions in tables. This feature needs to be enabled at report design time.
    1. In JReport Designer, select a label in a table in a library, and then set its Filterable property to true.
    2. Set the field by which you want to filter records as the value of the label's Bind Column property.
    3. Save the library component and publish it to JReport Server.
    4. Create a dashboard and insert the table in it, and you can find that a filter button displayed beside the label. Click it to show the Filter list, which contains the same items as the Filter submenu. Click the corresponding item to filter the records.

       After a filter is applied on the field specified by the Bind Column property, the button will be highlighted. You can still click it to show the Filter list to change the filter condition or select the All item to remove the filter on the field.

  - Using server profile setting
    You can also configure the server profile to enable filter records in tables by clicking the filter button on table column headers.

    1. Open the Profile > Customize Profile > Common tab.
    2. Check the option Filter on Column Headers to enable clicking the filter button on column headers to filter table records.
    3. Check Show Sort/Filter Status on Column Headers if you want the the filter button to be always displayed on the table column headers with the current filter status. If this option is unchecked, each time you want to get the filter button for a column, you need to put the mouse pointer on its header to make the button shown.
    4. Run a dashboard containing a table and you can click on the table column headers to filter data.

       To filter the table based on any column field, click on its column header to show the Filter list, which contains the same items as the Filter submenu. Click the corresponding item to filter the records.

       After a filter is applied on a field, the button on its column header will be highlighted. You can still click it to show the Filter list to change the filter condition or select the All item to remove the filter on the field.

Notes:

- When sorting the data in a table by a field and then by another field, the later sort condition is the major order, and the former condition the minor order, that is to say, the records in the table will be sorted by the later sort condition first, then by the former sort condition.
- The Sort on Column Headers and Filter on Column Headers features do not work on summary columns that contain multiple summary fields.
- When a table is designed with the Sort by Label/Filter by Label feature in JReport Designer, if the Sort on Column Headers/Filter on Column Headers option is also enabled on the server profile, the settings defined in JReport Designer have the higher priority for the specified columns.

Manipulating a crosstab

- Sorting column/row header
  To sort a column/row header, right-click on the header, then on the shortcut menu, select Ascend or Descend from the Sort submenu. To remove the sort condition, select No Sort.
- Switching crosstab fields
  A convenient way to change the fields in a crosstab is by using the Switch command. To do this, right-click a row/column/summary and select Switch Row/Switch Column/Switch Summary from the shortcut menu. The fields available for the row/column/summary are listed in the submenu with the current used field checked. Select the field you want to use to replace the current one.
- Adjusting the width of crosstab fields according to the contents
  When the contents in the field of a crosstab need more space to completely display, you can adjust the width of the field according to its contents. To achieve it, right-click the field and select Autofit from the shortcut menu.

Manipulating a chart

- Swapping chart groups
  You can switch data between the category and series axes, or between the category and value axes of a chart if no field on the series axes. To do this, right-click in the chart, then on the shortcut menu, click Swap Chart Groups.
- Sorting category/series labels
  You can sort the labels on the category or series axes of a chart in either descending or ascending alphabetical order. To do this, right-click in the chart, then on the shortcut menu, select the required order from the Sort Category or Sort Series submenu.
- Changing the chart type
  Right-click in the chart, then on the shortcut menu, locate Chart Type. From the drop-down menu, select the desired chart type and its subtype.
- Zooming in chart values
  For a bar, bench, line, area or stock chart, you can select the values you are interested in to have them zoomed in. To do this, drag the mouse from the start value to the end value you want to select, then release the mouse. The selected values will be zoomed in. If you want to return to the initial status, just click the return button on the upper right corner of the chart paper.
- Showing/Hiding the chart legend or legend label
  Right-click the chart and select the corresponding show/hide option from the shortcut menu to show or hide the legend or legend label. However, the legend will always be displayed at the export and print result.
- Configuring real time chart settings
  For a real time chart, you can further configure it when inserted in a dashboard. To do this:
  1. Right-click the chart and select Real-time Settings from the shortcut menu. The Real-time Settings dialog appears. See the dialog.

  2. Specify the time interval at which the chart will get data and refresh itself automatically in the Refresh Interval text field.
  3. Specify the most recent N records to be kept for the real time data on the chart in the Show Most Recent text field.
  4. Click the Incremental Fetch button to add the fields you want to use as the unique key of the real time chart in the Unique Key dialog.

     Once a unique key is defined, each time when the real time chart automatically updates itself, duplicated data records will be filtered out based on the unique key. For instance, if you add the fields Country and Product ID as the unique key of a real time chart, when a record with the product ID 1 in USA has already been loaded into the chart, no more records of this product ID in USA will be added to the real time chart because they have the same unique key value.

  5. Check the Use Scrollable Bar checkbox if you want to use a scrollbar to control the visible value range on the X axis of the chart, then specify how many data items will be selected on the scrollbar and displayed on the axis by default, the percentage the scrollbar occupies the whole size of the chart, and whether to show the thumbnail chart in the scrollbar.
  6. Click OK to accept the settings and close the dialog.
- Stopping or resuming a real time chart from refreshing
  For a real time chart, you can stop or resume it from automatically refreshing by right-clicking it and selecting the Pause Refresh or Resume command from the shortcut menu.

#### Manipulating geographic map group markers/areas

- Going up/down on geographic map group markers/areas
  - For the group level that is higher than some other group levels in a geographic map component, point to its group marker/area, right-click it and select Go Down from the shortcut menu to jump one group level down.
  - For the group level that is lower than some other group levels in a geographic map component, point to its group marker/area, right-click it and select Go Up from the shortcut menu to jump one group level up.
- Showing/Hiding geographic map group markers/areas
  By default, all visible group markers/areas are shown. To hide them, right-click the geographic map (not the group markers/areas) and select Hide Markers/Areas from the shortcut menu. If you want to show them again, right-click the geographic map and select Show Markers/Areas from the shortcut menu.