Using Shape Maps
A shape map is a special kind of image in Report that contains a picture and certain areas 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.
Report supports the Shape Map feature only in query-based page reports and it 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 one of the following:
- From the Components panel, drag the Shape Map icon in the Visual category to the destination.
- Navigate to Insert > Map > Shape Map.
- Navigate to Home > Insert > Map > Shape Map.
Designer displays the Shape Map Editor dialog box.
- To use an image as background of the map, navigate to 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 predefined map areas, or by drawing the areas manually, or using a combination of these two.
- To import map areas from an previously saved XML file or an ESRI file that contains area information, navigate to 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 the preceding step to add more fields.
- 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 delete a field from the tool tip, select it in the Tips box and select Remove .
- To draw the areas manually, select Insert Mode on the toolbar, or navigate to Menu > Edit and select Insert Mode to switch the Shape Map Editor to the mode. Then, 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 map areas from an previously saved XML file or an ESRI file that contains area information, navigate to 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.
- 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 navigate to Menu > Insert > Match Background Image in the Shape Map Editor dialog box to resize the map object 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.
- To apply the global settings to all the areas, labels, or summary fields at a time, navigate to 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, navigate to 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 dataset so you can show values on the map areas.
- In the Shape Map Editor dialog box, select Bind Data on the toolbar, or navigate to Menu > Insert > Bind Data. Designer displays the Shape Map Data Binding Wizard dialog box. You can use the Back and Next buttons or select the screen name on the screen navigation bar to switch between the screens.
- In the Data screen, specify the dataset you want to bind to the shape map.
- 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, see related sections in Grouping 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, filter the data to display on the map areas by adding conditions based on the group-by field and the summaries. Select here for how to define a filter.
- Select Finish to apply the settings and close the dialog box.
Adding Conditional Formatting to Shape Map Areas
When a shape map is bound with a dataset, you can add conditional formatting to the map areas, so the areas that meet a specified condition can 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.
- In the Shape Map Editor dialog box, select Conditional Formatting on the toolbar, or navigate to 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 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 also type the value manually. When the condition is based on a String field, you can apply an empty string as the value, by simply leaving the text box blank (value length=0).
- Repeat the preceding steps to define more condition lines and specify 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 and selects it 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 preceding steps to add more conditions and define the area formatting for each condition.
- You can further modify the conditions.
- 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 find that Designer creates some formulas in the catalog. You can edit the formulas, but Designer does not reflect the changes you make to the formulas in the Shape Map Area Conditional Formatting dialog box.