The Map Expert

book list add book to my bookshelf create a bookmark purchase this book online

mastering crystal reports 9
Chapter 12 - Analyzing Data Visually
Mastering Crystal Reports 9
by Cate McCoy and Gord Maric
Sybex 2003

The Map Expert analyzes summarized geographic data by creating visual representations of the information using stored map files. To use it, your data must contain fields that reference geographic locations such as cities, states, countries, and regions. A third-party vendor, MapInfo Corp., provides mapping capability to Crystal Reports. Because of the tight integration, map-creation experts in Crystal utilize externally stored maps and combine them with summarized and grouped data to present visual data as a bitmap within a report. This approach to mapping was introduced in Crystal Reports 7.0 as an easy-to-use map-charting facility for all kinds of geographic data, and it continues to be a solid feature of the product.

When Crystal Reports is installed, the mapping program is also installed in its own subdirectory. Maps and layers that can be added on top of the maps are installed beneath this directory. Figure 12.19 lists the files that are used to create maps, while Figure 12.20 shows files that can be used to add layers to the maps once they are in Crystal. From the filenames, you can get a good idea of the kinds of maps that are included in the product.

click to expand
Figure 12.19. Map files

click to expand
Figure 12.20. Map layer files

Creating a Map

To begin the process of creating a map, the data must have geographic significance. The best data to map on is data that has an inherent geographic hierarchy to it, for instance, Country, then State, then City. Groups should be created in this order as well, with the largest geographic region acting as the container for all other regions. The region also should be fairly well-populated in order to provide the best statistical summaries. The sample report referred to earlier in Figures 12.1 and 12.2 contains geographic data, which makes it a good candidate for mapping. Figure 12.21 shows a map created to model the number of resorts contained in the Others category of the resort area report, which shows resorts located in areas outside North America.

Business Question: Create a report that shows where the resorts not in North America, the Caribbean, or Europe are actually located.

click to expand
Figure 12.21. Geographic map

Tip 

If the map appears in the report as an empty rectangle, the data in the report is unable to fulfill the map option settings chosen in the Map Expert.

The map tool can be used to visually show data points, such as where the resorts in North America are located. To open the Map Expert, choose Insert > Map. The dialog shown in Figure 12.22 displays the tabbed interface of the Map Expert.

Configuring Data Options

The first tab of the Map Expert is the Data tab, which is used to identify the data that will be mapped in the report; this dialog is shown in Figure 12.22. The screen is arranged into three areas: Placement, Layout, and Data. In the Layout area along the left side of the screen, four buttons roughly identify the four types of data that maps can be built upon:

  • Advanced (detail data)

  • Group

  • Cross-Tab

  • OLAP

    click to expand
    Figure 12.22. Map Expert

Figure 12.22 shows how to create a map based on group data. Group data is the easiest type of data to work with for summary purposes because the bulk of the formatting decisions are predetermined just by the data being in the group. If a button is grayed out and unavailable, it is a signal that your report does not contain that type of data; for instance, if no groups are contained in the report, the Group button is not available. Whenever a report contains groups that have summarized values, the Map Expert opens with the Groups option already highlighted; otherwise, the Advanced option is highlighted. Use the Advanced layout option, shown in Figure 12.23, to map data summaries based on specific field values.

click to expand
Figure 12.23. Advanced map layout

The summary information cells in a cross-tab grid or OLAP grid can also be used as mapping values for a map object. If the report contains this type of grid, geographic map information can be generated based on it. The summarized values in the cells of cross-tabs can be used as data points on a map. Figure 12.24 shows the Map Expert with the Cross-Tab option selected. The choices for the geographic mapping field, the subdivision field to be mapped, are taken directly from the rows, columns, and intersection cells defined in the cross-tab grid that exists in the report. For the example shown in Figure 12.24, the Region field is the column value in a grid, the Country field is the row value, and the cross-section where the two meet stores the distinct count of the FiveStarRating field.

click to expand
Figure 12.24. Maps based on cross-tab grids

Since maps work with summarized data, a map can be placed in the header and footer sections of a report. The drop-down list at the top of the Data tab in the Placement area lets you choose a section in which to place the report, and then radio buttons let you choose between the header or footer area. Each of the groups in a report will display as drop-down box choices. Referring back to Figure 12.22, for instance, Resorts.Country appears twice since there are two groups using this field: one in specified order and the other in ascending order.

In the Data area (the middle section of the dialog), you specify the field values to show and the frequency when it should change. The values available in the drop-down box are directly related to the placement location chosen for the map. This is reasonable; think of the Placement area as defining the outer group and the Data area as defining the inner group in a parent-child relationship.

Configuring Text Options

On the Text tab of the Map Expert you can define the following:

  • A title for the map

  • The type of map legend to be created (full, compact, or none)

  • The legend title and subtitle (automatically generated or typed by you)

Choosing a Map Type

The Type tab of the Map Expert, shown in Figure 12.25, is used to select the type of data arrangement and analysis strategy to integrate with a map. There are five types, and depending on the context of the data being mapped, one or more of the buttons for choosing the type will be available. Field-level data can be mapped with Ranged, Dot Density, and Graduated maps, while grouped data is well served by Pie Chart and Bar Chart maps.

click to expand
Figure 12.25. Map types

Ranged

In this type of map, you segment the data into ranges and associate a color to each range. You then create a legend associating the range to a color and set the geographic area on the map to the color. In the VistaNations data, you could create a map to display the resort sale prices last year by region, where region is a geographic boundary. Numerical values for sales range from zero to the highest price, and you can break these ranges into smaller chunks of dollar intervals by choosing a number of intervals that will then create ranges of 0–$50,000, $50,001–$100,000, and so on. Intervals such as prices less than $100,000 and prices more than $500,000 can also be useful for either end of the range. By associating a color code with the price interval, you can use the map to depict where (geographically) sale prices were the highest. You set the color using drop-down boxes to assign colors to the highest interval and the lowest interval. Within a ranged map, there are four options for assigning distribution methods to data: Equal Count, Equal Ranges, Natural Break, and Standard Deviation.

Equal Count The number (count) of values in a range within an interval is relatively constant across all intervals.

Equal Ranges The value of each summarized data point in a range interval is relatively uniform within the range.

Natural Break A statistical algorithm is used to distribute values such that the difference between the summary values and the average of all the values is as small as possible.

Standard Deviation The range interval centers data on the mean value and includes data that is one standard deviation on either side of the mean.

Dot Density

With dots representing the data summary value, a Dot Density map shows the distribution of data geographically. For example, you could show one dot for each resort in North America. This option is best used with the Group type of layout on the change of a value within a group.

Graduated

Graduated maps are similar to ranged maps in that they show a colored circle for each instance of a value. The size of the symbol represents the relative size of the data value being mapped; for instance, a circle representing $50,000 would be smaller than a circle representing $100,000. The circle can be changed to another symbol by using a drop-down list that includes such symbols as arrows, diamonds, and boxes.

Pie Chart

Given a geographic area, a Pie Chart map is constructed to represent the area as a whole, with different slices colored to represent different proportions of values in geographic areas. This type of map lends itself well to comparing the distribution of values in a geographic area. A pie chart inherently represents 100 percent of the geography.

Bar Chart

Like a pie chart, a Bar Chart map can be used to represent a geographic area, where the segments in the bar chart represent areas in the geographic entity, and each segment itself can relay information about a part of that geographic entity. A bar chart can be used to represent 100 percent of a geographic area or parts of a geographic area that do not equal 100 percent of the geographic region.

Customizing a Map

Once you’ve created a map and placed it in a report, you can modify its original settings or you can insert additional formatting. When you select a map, the Map option appears on the main menu, or you can right-click the map to open the submenu specific to maps. You can reopen the Map Expert at any time to display the dialog originally used to create the chart. You can then change all or any of the original settings.

Using Map Tools

Maps created in Crystal Reports and displayed in Preview or User mode are active maps. You can add a title, zoom in, zoom out, pan, or center the map in the area provided. When a map is selected, the Map menu shown in Figure 12.26 lists the options at your disposal. Two very powerful features are adding layers to a map and resolving field name mismatches.


Figure 12.26. Map menu

Adding Map Layers

Using the menu shown in Figure 12.26, the person viewing the map can add layers to it. A layer is placed on top of a map element to represent features like cities, oceans, rivers, highways, and other geographic details. Figure 12.27 shows a layer control that has been opened from the Map menu. The geographic elements available in the layer control vary based on the map being displayed. For instance, adding a highway layer would not be an option when the continents of the world is the underlying map currently being displayed because the level of detail does not match (granular to global).


Figure 12.27. Layer Control

Resolving a Mismatch

The maps built into Crystal have names associated with the countries, cities, and so on. The geographic names for data in your database may not match the geographic names used for the standard built-in maps. For instance, the built-in map of the world refers to the United States and Canada as “USA” and “Canada,” respectively. The field data in the tables for your report may have stored the values as “US” and “CN.” Unless the mapping tool recognizes the data names, the map will not display properly. In anticipation of this data problem, the mapping tool contains a utility to resolve mismatches of field names; it allows you to associate the names of fields in your tables with the names of fields in the built-in map facility.

Click the Resolve Mismatch menu item to open the utility. The first step in resolving the mismatch is to pick the map to associate names with. All maps are listed as choices, and the one you choose will depend on the granularity of your answer. For instance, choose the World map to resolve country name field problems or a country map to resolve city name field problems. After choosing the correct map, choose the Resolve Mismatch tab shown in Figure 12.28. The fields from your data appear in the Assign This Field Name list, while the fields from the map appear in the To This Map Name list. Select a field on the left, choose its matching field on the right, and click the Match button to add it to the Matched Results list in the bottom of the screen. In this figure, the field name US has been matched with USA, and the field CN is about to be matched with the value Canada.

click to expand
Figure 12.28. Resolving a mapping mismatch

Formatting a Map

Basic options like closing borders on page break and locking position and size come under the purview of the Format Editor. This editor is used to set popular options for the currently selected object, and in this case, it is a map. To open the Format Editor for a chart, select the map on the page and then choose Format > Format Map, or right-click the selected map to directly choose Format Map from the submenu. The Format Editor contains tabs that allow you to format the current object of focus (the map) for page and layout issues. As with other objects in Crystal, the universal Format Editor can be used to format the map with options such as conditionally suppressing based on a formula, drawing a border around the map, and adding a hyperlink to another destination. Every object in Crystal is also given a unique object name, like Map6, so that it can be manipulated programmatically through languages such as Java and the languages used with the .NET platform; the programmatic name for the object is set using the Format Editor.

Use of content on this site is expressly subject to the restrictions set forth in the Membership Agreement
 
Conello © 2000-2003     Feedback


Mastering Crystal Reports 9
Mastering Crystal Reports 9
ISBN: 0782141730
EAN: 2147483647
Year: 2005
Pages: 217

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net