Example: Using Geographic Map
This topic demonstrates how to add a geographic map in a library component and use it in JDashboard.
- Make sure SampleReports.cat is the currently open catalog file. If not select File > Open Catalog to open it from
<install_root>\Demo\Reports\SampleReports
. - Select Home > New > Library Component.
- In the Select Component for Library Component dialog, select Blank and select OK.
- Drag the Geographic Map button from the Components panel to the library component. The Create Geographic Map wizard appears.
- In the Data screen, select WorldWideSalesBV from Data Source 1. Then select Next.
- In the Display screen, add the fields Country and State in the Customers table as the group-by fields one by one to the Drill Path box.
- Select the Enable Area checkbox. The Enable Marker checkbox is selected by default.
Next, we will define the marker and area properties for the country group level.
- Select Country in the Drill Path box, select Country from the Customers table in the Resources box and select to add it to the Shape By text box, then select beside the text box.
- In the Edit Shapes dialog, select anywhere in the Data Items box and select Ctrl + A on the keyboard to select all countries, then select in the preview box below the pattern name to apply the shape to all countries. Select OK to apply the shape.
- Select the aggregation Total Sales from the Orders Detail table in the Resources box and select to add it to the Color By text box, then select beside the text box.
- In the Edit Gradient Color dialog, keep the default gradient color, select the Middle Value checkbox and set its value to 625816.73, specify the opacity to 80%, then select OK to apply the gradient color.
- Select the aggregation Total Cost from the Orders Detail table in the Resources box and select to add it to the Size By text box, then select beside the text box to specify the zoom percentage to 370%. Select outside of the size box to apply the zoom percentage.
- Select Country from the Customers table in the Resources box and select to add it to the Label By text box of the Marker Options.
- Select beside the Marker Tip text box, then select <New Formula...> from its drop-down list to create a formula to control the marker tip information.
- In the displayed dialog, type the name MarkerTipforCountry and select OK.
- In the Formula Editor, define the formula as follows.
"Country:" + " " + @"Customers.Country" + "\n" +
"Total Cost:" + " " + ToText(@"Orders Detail.Total Cost","$#,###.00") + "\n" +
"Total Sales:" + " " + ToText(@"Orders Detail.Total Sales","$#,###.00") - Save the formula and close the Formula Editor. MarkerTipforCountry is then displayed in the Marker Tip text box.
- Select the aggregation Total Sales from the Orders Detail table in the Resources box and select to add it to the Fill By text box, then select beside the text box.
- In the Edit Gradient Color dialog, select Green-White-Orange from the gradient color drop-down list, which is the last color at the second line in the list, specify the opacity to 80%, then select OK to apply the gradient color.
Next, we will specify the marker and area properties for the state group level.
- Select State in the Drill Path box, select State from the Customers table in the Resources box and select to add it to the Shape By text box, then select beside the text box.
- In the Edit Shapes dialog, select Pattern1 from the pattern drop-down list to apply the shapes in the pattern to all states, then select OK.
- Select beside the Size By text box to specify the zoom percentage to 230%. Select outside of the size box to apply the zoom percentage.
- Select the aggregation Total Sales from the Orders Detail table in the Resources box and select to add it to the Fill By text box, then select beside the text box.
- In the Edit Gradient Color dialog, select Green as the gradient color, which is the second color in the color list, specify the opacity to 80%, then select OK to apply the gradient color.
- Select State from the Customers table in the Resources box and select to add it to the Label By text box of the Area Options. Repeat this to add Total Sales from the Orders Detail table to the Label By text box.
- Repeat steps 14 to 17 to create another formula AreaTipforState to control the area tip information.
"Country:" + " " + @"Customers.Country" + "\n" +
"State:" + " " + @"Customers.State" + "\n" +
"Total Sales:" + " " + ToText(@"Orders Detail.Total Sales","$#,###.00") - Repeat steps 14 to 17 to create another formula LocationInfoforState for the Location Info option.
@"Customers.State" + "," + @"Customers.Country"
- Select Next to go to the Filter screen. Select the Add Condition button to add a condition line, and specify the filter condition as @Country != USA, then select Finish to create the map.
- Select the View tab to preview the geographic map. The map shows as a static map and you can see the formats defined in the Display screen of the map wizard are applied to the map markers and areas.
- Select Home/File > Save to save the library component as Sales Map by Country.lc.
- Publish the library component to the default location on Logi Report Server together with the resources used by it.
- Create a dashboard on Logi Report Server.
- In the Resources panel, browse to find the library component Sales Map by Country.lc in the Component Library node and drag it to the dashboard body. When you hover the mouse on a marker, its tip information will be displayed just as we defined in the map wizard.
- In this geographic map component, there are two group levels, first by Country and then by State, so for the higher group level, you can perform the go-down action, and for the lower group level the go-up action. Hover your mouse over the marker Country: Germany, select it, or right-click it and select Go Down from the shortcut menu. The geographic map will jump one group level down to show the information of states in Germany, and you can find the filter condition "Country: Germany" displayed at the bottom of the geographic map.
- You can scroll the mouse over the geographic map to make it zoom out or zoom in. By scrolling the mouse down, a wider area can be shown on the map.