If you have ever added a chart to a Crystal Report, adding a
map is a very similar concept. Crystal Reports provides a tool called the
"Map Expert" that will allow you to set the type of map, data and
other options to help you render the map on in the report. The chart expert can
be accessed from "Insert menu" by selecting the "Map"
option.
Specifying Map Data
The "Data" tab of the Map Expert allows you to
select which data you would like visualized in the map. This tab allows you to
perform summary options such as a "count" and "Sum" for the
values that are shown on the map. The summary options can be evaluated
(calculated) on change of field in the provided set of data.
Figure 1: Data tab of the map expert
Setting the Map Type
The map "type" tab in the chart expert allows you
to select which type of map will be rendered. By default, Crystal Reports
supports three types: Ranged, Dot Density and graduated. MapInfo, the company that created the existing
map functionary included in Crystal reports, provides other types of maps that
can be purchased and integrated into Crystal Reports.
Figure 2: The Map Expert Type tab
Navigating the map
Crystal Reports provides functionality to allow the user to
navigate the map through a few different interfaces. As with other types of
Crystal Reports summaries, maps also support "drill down" navigation.
Another very common navigation element of a Crystal Reports map is the ability
to zoom in and out on map details. When a user views a map on a Crystal Report,
they can click on the geographic region they would like to see more detail and
the cursor then turns into a magnifying glass (or a finger cursor when the
report is rendered on a web page) to allow the user to zoom in to see more detail.
The other navigation option
that is very helpful is the "Map Navigator." The Map Navigator is a
smaller representation of the map which allows the user to move the cursor to
find a geographical region quickly. The Map Navigator is great for providing a
navigation interface for large maps, such as world maps.
Figure 3: The Map Navigator
Data Mismatches
Sometimes data sets get passed to Crystal Reports with data
that has not been cleaned, meaning data exists that Crystal Reports cannot
process. For example, if a state name was misspelled or an uncommon
abbreviation was used, the "Data Mismatch" tool will help resolve
these issues. The Data Mismatch tool can be found by Right clicking on the map
and selecting "Resolve Mismatch."
Figure 4: Resolving data mismatches
Figure 5: Map created with Crystal Reports 2008
showing Customer Distribution
Beyond the Default Crystal Reports Map
Sometimes the mapping tools that are provided with Crystal
Reports and MapInfo will not satisfy a particular business requirement. The
maps included inside of Crystal Reports are functional and provide a very easy
interface to render geographical data, but their appearance can leave something
to be desired. Crystal Reports 2008 has responded and extends upon the existing
Crystal mapping functionality, but there are still gaps for some companies. Sometimes
having the ability to create maps that are aesthetically pleasing, like the
maps in Figures 6 and 7, outweighs the ease of use of the Crystal Reports
mapping functionality.
Figure 6: Map created with Dundas mapping control
Figure 7: Map created with .NET charting map
control
There are many third party controls that will allow you to
pass a set of data to the control, set a few options and the control will
render a map. Controls such as .net Charting and Dundas provide a very powerful
API to create maps that display complex data and are very stylish. Most of
these third party mapping controls have the ability to save the map as an image,
such as PDF, PNG or JPG. Since Crystal Reports XI, the Dynamic Image feature
has allowed us to set the path of an image dynamically and, therefore, allows
us to include charting images from 3rd party controls.
Using this pattern has some drawbacks with maps. Since the
map created with the 3rd party control is an image, you do not gain navigation
features such as zoom and pan, which you get by default when using the Crystal
Reports mapping control.
Adding a dynamic image to your report
• Add an image to your report.
• Right click on the image and selected "Format
Graphic."
• On the "Picture Tab," Click the formula button
(X+2 button).
• Create a formula to pull the chart image path from the
dataset.
Figure 8: Graphic location
Figure 9: Graphic location formula