BackPrevious Page Next PageNext

Shape Maps

Creating shape maps in a page report

Binding data to shape maps

Adding conditional formats to shape map areas

A shape map is a special kind of image in JReport. It contains a picture and certain areas that are bound with groups in a banded object.

The Shape Map feature is supported only in page reports created using query resources and works when the page reports run in the HTML format or in Page Report Studio.

See an example: The SampleComponents catalog, included with JReport Designer, contains reports that have examples of how each component type could be used in a report. For the shape map component example, open <install_root>\Demo\Reports\SampleComponents\MapReport.cls.

Creating shape maps in a page report

  1. Select a tabular cell, or the banded header/footer, group header/footer, or banded page header/footer of a banded object in the page report.
  2. Do any of the following:

    The Shape Map Editor appears.

    Shape Map Editor window

  3. To use an image as background of the map, click Menu > Insert > Background Image. In the Shape Map Background Image dialog, click Choose button to specify the image and click OK.
  4. Next is to add areas to the map. You can do this either by importing from an previously saved XML file or an ESRI file which has been defined with some area information, or by drawing the areas manually, or using a combination of these two.
  5. If you want to further change the shape or position of the areas, click Insert Mode on the toolbar again to switch the Shape Map Editor to edit mode.

    To change the shape of an area, move the mouse pointer over the border or the points of the area. When it becomes a cross, choose a point on the line and drag it to create a new point. You can also choose a point of the area and drag it to a new position. If there are three points on one line, the middle point will be deleted automatically.

    To move an area, move the mouse pointer close its border. When it changes to a four-headed arrow, drag the area to a new position.

    Tip: If you have specified a background image for the map, and the size of it is not the same as that of the map object, you can click Menu > Insert > Match Background Image in the Shape Map Editor to resize the map object so as to make it match the size of the background image.

  6. Bind data to the map areas so as to show values on the areas.
  7. Add conditional formats to the map areas.
  8. Make the map areas link to different targets if required.

    To bind a link to a map area, right-click it and select Link from the shortcut menu, then define the link in the Insert Link dialog. For details about different link targets, see Binding a Link to a Label.

  9. In the Map Area Inspector panel, edit properties of any area, label, summary and line in the map if necessary. Click Search button to search for the required properties using the search bar if needed. For labels and summaries, you can also edit their background color, foreground color and font properties by using the corresponding buttons on the Shape Map Editor toolbar.

    For areas, labels and summary fields, you can specify the properties globally and apply the global settings to individual ones conveniently. To specify area, label or summary field properties globally, select the corresponding sub node under the Map Global Setting node in the Map Area Inspector tree, then edit the property values accordingly.

    To make a specific area, label or summary field adopt the global settings, select it in the inspector tree, then set its Use Global Setting property to true. If you want the global settings to be applied to all the areas, labels or summary fields at a time, click Menu > Edit > Reset All, then in the Reset All dialog, specify the properties according to your requirements.

  10. If you want to save the area information you have defined in a file for future use, click Menu > File > Save As in the Shape Map Editor. In the Save Map Area dialog, specify the directory where you want to save the file and a name for it, then click Save. Later when you create a report with a map, you can choose to import areas from the saved XML file.
  11. Click Save to save the changes to the map and close the Shape Map Editor.
  12. Click the mouse button in the tabular cell, or banded panel to insert the map.

The shape map is now inserted in the specified destination. You can further edit it using the Shape Map Editor if needed. To display the editor again, right-click the shape map and click Format Shape Map on the shortcut menu.

Binding data to shape maps

When you create a shape map, you can make it bound with a data resource such as a query, an imported SQL file so as to show values on the areas.

  1. In the Shape Map Editor, click Bind Data on the toolbar, or click Menu > Insert > Bind Data. The Shape Map Data Binding Wizard appears.
  2. In the Data screen, select the data resource in the current catalog you want to bind with the shape map.

    Shape Map Data Binding Wizard - Data

    If the predefined data resources are not what you want, you can click the first item in the corresponding resource node to create one. When a query is selected, click the Edit button to modify the query if required. Then a new dataset based on the selected data resource is created in the page report.

    If you want to use an existing dataset in the current page report for the shape map, click the More Options button and then:

  3. In the Group screen, add a field as the group-by field to group data of the specified dataset. You can add only one group for the dataset. Specify the sort manner, special function, Select N condition and filter condition on the group respectively if needed. For details about these group features, see the related topics in Grouping the Data in Tables.

    Shape Map Data Binding Wizard - Group

  4. In the Summary screen, add summaries to calculate data based on the specified group. To add a summary, select the group in the right box, then select a field in the Resources box and click Add button. From the Aggregate Function drop-down list, select the function as required. Data in each group will then be calculated based on the added field using the specified function, and the summary result will be displayed accordingly on map areas the names of which match with values of the group-by field.

    Shape Map Data Binding Wizard - Summary

    The summaries created from the Summary screen will be added to the current catalog as static summaries.

  5. In the Filter screen, add filter conditions on the group-by field and the summaries to reduce data displayed on the map areas. For how to define a filter, click here.

    Shape Map Data Binding Wizard - Filter

  6. Click Finish to apply the settings and leave the dialog.

Adding conditional formats to shape map areas

When a shape map is bound with data, you can add conditional formats to the map areas, then when a specified condition is fulfilled, the format defined on the condition will be applied to the map areas automatically. This is very useful to highlight values that might need to be acted on by the end user.

  1. In the Shape Map Editor, click the Conditional Formatting button Conditional Formatting button on the toolbar, or click Menu > Format > Conditional Formatting. The Shape Map Area Conditional Formatting dialog appears.

    Shape Map Area Conditional Formatting dialog

  2. Click the Add button below the Map Area Condition box. The Edit Conditions dialog appears.

    Edit Conditions dialog

  3. Click the Add Condition button to add a condition line.
  4. From the field drop-down list, select the field on which the condition will be based.
  5. Choose the operator with which to compose the condition expression from the operator drop-down list.
  6. Click Choose button next to the value box to specify the value of how to build the condition. You can also type in the value manually.
  7. Click Add Condition to add more condition lines and define the logic between the condition lines.

    To make some condition lines grouped, select them and click the Group button, then the selected condition lines will be added in one group and work as one line of filter expression. Conditions and groups together can be further grouped. To take any condition or group in a group out, select it and click Ungroup.

    To adjust the priority of the condition lines, select it and click the Up or Down button.

    To delete a condition line, select it and click the Delete button.

  8. Click OK to save the condition.

    The newly added condition is then displayed in the Map Area Condition box in the Map Area Conditional Formatting dialog.

  9. In the Format box of the Map Area Conditional Formatting dialog, set the format which will be applied to the specified map areas when the specified condition is fulfilled, including the fill color, border color, border style, and border width.
  10. Repeat the above steps to add more conditions and define the format for each condition.

    To edit a condition, select the condition from the Map Area Condition box, click the Edit button, then edit the condition in the Edit Conditions dialog.

    To adjust the priority of the conditions, select a condition and click the High or Low button.

    To remove a condition and the corresponding format, select the condition from the Map Area Condition box and then click the Remove button.

  11. Click OK to save and apply the settings.

BackPrevious Page Next PageNext