Shape Maps
A shape map is a special kind of image in Logi JReport that 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.
Below is a list of the sections covered in this topic:
- Creating Shape Maps in a Page Report
- Binding Data to Shape Maps
- Adding Conditional Formats to Shape Map Areas
See an example: The SampleComponents catalog, included with Logi 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
- 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.
- Do any of the following:
- Drag the Insert Shape Map button from the Components panel to the destination.
- Select Insert > Map > Shape Map.
- Select Home > Insert > Map > Shape Map.
The Shape Map Editor appears.
- To use an image as background of the map, select Menu> Insert > BackgroundImage. In the Shape Map Background Image dialog, select to specify the image and select OK.
- 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.
- To import the predefined map areas, select Menu > File > Open, then in the Import Shape Map Area dialog, specify the .xml file or .shp file that contains the required area information and select Open to import the areas.
If you choose to import the map areas from a .shp file, the Select Area Name dialog appears, prompting you to further specify the field in the ESRI shape file using which to define the area names and the fields from which to get the area tooltip. The tooltip will be displayed when you hover the mouse over the areas when the report runs in HTML format or in Page Report Studio.
To define the tooltip of the map areas:
- Select a field from the field box the values of which you want to display in the tooltip and select . Repeat this to add more fields.
To remove a field from the tooltip, select it in the Tips box and select .
- Adjust the order of the added fields in the Tips box by selecting a field and making use of and . The order of the fields determines the display sequence of their values in the tooltip. (for more information, see Select Area Name dialog).
- To draw the areas manually, select Insert Mode on the toolbar, or Menu > Edit > Insert Mode to switch the Shape Map Editor to the mode.
To draw an area, select the left mouse button to pick the start point of the area. Move the mouse pointer and select the left mouse button to select the other points. The points will be connected automatically. When you move the mouse pointer to the start point, a square appears indicating that the area will be closed. Select the left mouse button to finish drawing the area. If you want to undo your last line, select the right mouse button.
Note: The area tooltip can be displayed only when Alternate Content Type on the map object is set to customized.
- To import the predefined map areas, select Menu > File > Open, then in the Import Shape Map Area dialog, specify the .xml file or .shp file that contains the required area information and select Open to import the areas.
- If you want to further change the shape or position of the areas, select 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 select 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.
- Bind data to the map areas so as to show values on the areas.
- Add conditional formats to the map areas.
- Make the map areas linked to different targets if required (to add a link to a map area, right-click it and select Link from the shortcut menu).
- In the Map Area Inspector panel, edit properties of any area, label, summary and line in the map if necessary. 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, select Menu > Edit > Reset All, then in the Reset All dialog, specify the properties according to your requirements.
- If you want to save the area information you have defined in a file for future use, select 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 select Save. Later when you create a report with a map, you can choose to import areas from the saved XML file.
- Select Save to save the changes to the map and close the Shape Map Editor.
- Select 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 select 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.
- In the Shape Map Editor, select Bind Data on the toolbar, or select Menu > Insert > Bind Data. The Shape Map Data Binding Wizard appears.
- In the Data screen, select the data resource in the current catalog you want to bind with the shape map.
If the predefined data resources are not what you want, you can select the first item in the corresponding resource node to create one. When a query is selected, select 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, select the More Options button and then:
- Check the Existing Dataset radio button and select a dataset. You can select the Edit button to modify the selected dataset in the Dataset Editor if necessary, or select the <New Dataset...> item to create a new dataset in the page report to use. It is always better to use an existing dataset rather than create a new one. Even when the two datasets are based on the same query, Logi JReport will still run the query separately for each dataset.
- Check the Current Dataset radio button to make the shape map inherit the dataset from its parent.
- 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.
- In the Summary screen, add summaries to calculate data based on the specified group. To add a summary, select a field in the Resources box and select , then 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. When DistinctSum is selected as the aggregate function, you should select in the Distinct On text box to specify one or more fields according to whose unique values to calculate DistinctSum in the Select Fields dialog.
The summaries created from the Summary screen will be added to the current catalog as static summaries.
- 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, Select here.
- Select 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.
- In the Shape Map Editor, select the Conditional Formatting button on the toolbar, or select Menu > Format > Conditional Formatting. The Shape Map Area Conditional Formatting dialog appears.
- Select the Add button below the Map Area Condition box. The Edit Conditions dialog appears.
- Select the Add Condition button to add a condition line.
- From the field drop-down list, select the field on which the condition will be based.
- Choose the operator with which to compose the condition expression from the operator drop-down list.
- Select next to the value box to specify the value of how to build the condition. You can also type in the value manually.
- Select Add Condition to add more condition lines and define the logic between the condition lines.
To make some condition lines grouped, select them and select 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 select Ungroup.
To adjust the priority of the condition lines, select it and select the Up or Down button.
To delete a condition line, select it and select the Delete button.
- Select 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.
- 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.
- 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, select the Edit button, then edit the condition in the Edit Conditions dialog.
To adjust the priority of the conditions, select a condition and select the High or Low button.
To remove a condition and the corresponding format, select the condition from the Map Area Condition box and then select the Remove button.
- Select OK to save and apply the settings.