Using Shape Maps
A shape map is a special kind of image in Logi Report that contains a picture and certain areas that are bound with groups in a banded object. This topic introduces how you can create shape maps in a report, and bind data and add conditional formatting to shape maps.
The Shape Map feature is supported only in page reports that use query resources and works when the page reports run in HTML or in Page Report Studio.
This topic contains the following sections:
- Creating Shape Maps in a Page Report
- Binding Data to Shape Maps
- Adding Conditional Formatting to Shape Map Areas
See an example: The SampleComponents catalog, included with Designer, contains reports that have examples of how you could use each component type 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:
- From the Components panel, drag the Shape Map icon in the Visual category to the destination.
- Select Insert > Map > Shape Map.
- Select Home > Insert > Map > Shape Map.
Designer displays the Shape Map Editor dialog box.
- To use an image as background of the map, select Menu > Insert > Background Image. In the Shape Map Background Image dialog box, select the ellipsis 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 contains 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 box, specify the ".xml" 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, Designer displays the Select Area Name dialog box, 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 tool tip. The tool tip displays when you hover the mouse over the areas when the report runs in HTML or in Page Report Studio.
To define the tool tip of the map areas:
- Select a field from the field box the values of which you want to display in the tool tip and select Add . Repeat this to add more fields.
To delete a field from the tool tip, select it in the Tips box and select Remove .
- Adjust the order of the fields in the Tips box by selecting a field and selecting Move Up or Move Down . The order of the fields determines the display sequence of their values in the tool tip.
- 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. Designer connects the points automatically. When you move the mouse pointer to the start point, a square appears indicating that the area is closed. Select the left mouse button to finish drawing the area. If you want to undo your last line, select the right mouse button.
The area tool tip can display only when you set the Alternate Content Type property on the map object to "customized".
- To import the predefined map areas, select Menu > File > Open, then in the Import Shape Map Area dialog box, specify the ".xml" 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, Designer deletes the middle point 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.
If you have specified a background image for the map, and its size is not the same as that of the map object, you can select Menu > Insert > Match Background Image in the Shape Map Editor dialog box 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 formatting to the map areas.
- Link the map areas to different targets (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. For labels and summaries, you can also edit their background color, foreground color, and font properties by using the corresponding buttons on the toolbar of the Shape Map Editor dialog box.
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 subnode 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 to apply the global settings to all the areas, labels, or summary fields at a time, select Menu > Edit > Reset All, then in the Reset All dialog box, specify the properties according to your requirements.
- To save the area information you have defined into a file for future use, select Menu > File > Save As in the Shape Map Editor dialog box. In the Save Map Area dialog box, 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 dialog box.
- Select in the tabular cell or banded panel to insert the map.
Designer inserts the shape map in the specified destination. You can further edit it using the Shape Map Editor dialog box (to display the dialog box 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 bind it with a data resource such as a query or an imported SQL, in order to show values on the areas.
- In the Shape Map Editor dialog box, select Bind Data on the toolbar, or select Menu > Insert > Bind Data. Designer displays the Shape Map Data Binding Wizard dialog box.
- In the Data screen, select the data resource in the current catalog that 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 in the current catalog to use. When you select a query, you can select Edit to modify the query. Designer then automatically creates a dataset based on the selected data resource in the page report.
If you want to use an existing dataset in the current page report for the shape map, select More Options and then:
- Select Existing Dataset and select a dataset. You can select Edit to modify the specified dataset in the Dataset Editor dialog box, or select <New Dataset...> to create a 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 Report Engine still runs the query separately for each dataset.
- Select Current Dataset if you want the shape map to 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. You can specify the sort manner, special function, Select N condition, and filter condition on the group respectively. For more information 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 Add , then from the Aggregate Function drop-down list, select the function you need. Designer then calculates data in each group based on the added field using the specified function, and displays the summary result accordingly on map areas the names of which match with values of the group-by field. If you select DistinctSum, you should select the ellipsis in the Distinct On text box to specify one or more fields according to whose unique values to calculate DistinctSum using the Select Fields dialog box.
Designer adds the summaries created from the Summary screen 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 to display on the map areas. For how to define a filter, select here.
- Select Finish to apply the settings and leave the dialog box.
Adding Conditional Formatting to Shape Map Areas
When a shape map is bound with data, you can add conditional formatting to the map areas, then in the report result, the areas that meet a specified condition automatically apply the formatting you define for the condition. This is very useful to highlight the values that users may need to act on at runtime.
To apply conditional formatting to the areas in a shape map:
- In the Shape Map Editor dialog box, select Conditional Formatting on the toolbar, or select Menu > Format > Conditional Formatting. Designer displays the Shape Map Area Conditional Formatting dialog box.
- Select Add. Designer displays the Edit Conditions dialog box.
- Select Add Condition to add a condition line.
- From the field drop-down list, select the field on which the condition is based.
- Choose the operator with which to compose the condition expression from the operator drop-down list.
- Select the ellipsis next to the value box to specify the value of how to build the condition. You can apply an empty string as the value for a field of String type, by simply leaving the text box blank (value length=0). You can also type in the value manually.
- Repeat steps 3 to 6 to add more condition lines and define the logic relationship between the condition lines: "And", "Or", "And Not", or "Or Not".
To group some condition lines, select them and select Group, Designer then adds the selected condition lines in one group and applies them as one line of filter expression (you can also group conditions and groups together); to take out any condition or group from a group, select it and select Ungroup; to adjust the priority of the condition lines, select it and select Up or Down; to delete a condition line, select it and select Delete.
- Select OK to save the condition and close the dialog box.
Designer displays the newly added condition in the Map Area Condition box in the Map Area Conditional Formatting dialog box.
- In the Format box, specify the formatting you want to apply to the map areas that meet the condition, including the fill color, border color, border style, and border width.
- Repeat the above steps to add more conditions and define the area formatting for each condition.
To edit a condition, select the condition from the Map Area Condition box, select Edit, then edit the condition in the Edit Conditions dialog box.
To adjust the priority of the conditions, select a condition and select High or Low.
To remove a condition and the corresponding formatting, select the condition from the Map Area Condition box and then select Remove.
- Select OK to save and apply the settings.
The conditional formatting you specify to the shape map areas corresponds with some formulas. After you save the map and the corresponding catalog, and then load the catalog again, you can see that Designer creates some formulas in the catalog. You can edit the formulas; however, Designer does not reflect the changes you make to the formulas in the Shape Map Area Conditional Formatting dialog box.