416.467.9100 | Dundas Data Visualization | Login
Welcome Guest
This is the support page for the legacy Dundas Dashboard application. For assistance with the current Dundas BI application please click here.
Dashboard v5.0

This site makes extensive use of JavaScript.

Please enable JavaScript in your web browser and reload the page before proceeding.

Drill Down on a Map Shape, Path or Symbol

Hide navigation
Modified on Fri, 31 Aug 2012 04:49 PM Categorized as Maps, Script Library
Click to return to: Documentation | Designing Dashboards | DV Controls | Map


The following article explains how to:

  1. Drill-down on a map element, passing along the name of the clicked shape, path or symbol.
  2. Load a map corresponding to the clicked element.

Drill-down on a map element

If you want to click on a shape, path or symbol and pass the clicked element to another dashboard, you will need to add a click interaction to the map. In the designer, select the map you want users to click on, and add a Click interaction. Add a script, and paste the following code:

ParameterInfoCollection params = new ParameterInfoCollection(); ParameterInfo param;

param = new ParameterInfo(); param.ParameterName = "ClickedMapParameter"; param.GrainLevel = e.GrainLevel; DashboardFilterValueData filterData = new DashboardFilterValueData();

if (e.DataPoint == null) { filterData.SingleValue = e.VisualElementArgs.BindingName; } else { filterData.SingleValue = e.GetDataPointAxisValue(); }



// --> REPLACE WITH YOUR DASHBOARD'S GUID <-- services.NavigateToDashboard("0f2d232d-e530-49af-a11b-e9b7ed6fb2bb", params);

Note: Don't forget to replace "0f2d232d-e530-49af-a11b-e9b7ed6fb2bb" with the ID of the target dashboard.

Note: The above script passes the BindingName of the clicked map element to a parameter on the target dashboard called ClickedMapParameter. Make sure the target dashboard has a parameter called ClickedMapParameter or the value will not be passed.

To access the name of the clicked shape (ClickedMapParameter) on the target dashboard, simply access the parameter:

// Get the name of the clicked map element, e.g. "Texas" string mapName = ClickedMapParameter.SingleValue.ToString();

Knowing the name of the clicked element allows you to load the corresponding map. See Loading a map from a parameter value.

Load a map from a parameter value

If you want to load a map in response to user input (clicking on a top-level map, changing a parameter value, etc), you will need to follow these steps:

  • Open the target dashboard. If you are drilling down to another dashboard, you will want to open that dashboard in the designer. If you want to load a map in response to a parameter selection on the current dashboard, then you can skip this step.

  • If you plan on loading the target map in a new map control, (e.g. if you are targetting another dashboard), drop a blank map from the toolbox. This map will be used to dynamically load your shape file. When you drop the map, you will see a "Select Map" wizard pop up - cancel out of both screens. You should see an empty map with grid lines.

Empty map control.

Empty map control.

  • The next step is to create a parameter which will hold the clicked state name. You can skip this step if you already have a parameter that accepts state names for data filtering. In our example, we create a parameter called 'ClickedMapParameter'.

Add a new parameter.

Add a new parameter.

  • Make sure that there is a single resource folder containing all of the maps you want to use as drill-down maps. In the below image, the US state county maps are all loaded into a single folder - this will allow you to load those county-level maps in response to users clicking a top-level US map. For more information on creating map resources, or if you want to find maps, please see Adding Map Resources. See the image below for an example:

Target maps are all in one folder.

Target maps are all in one folder.

  • Finally, add a script which will load your map in response to the user input. If you are drilling down from another dashboard, you will want to use the dashboard's Load interaction. If you are loading a map in response to a parameter change, use the Parameter Changed interaction instead (also on the dashboard). Paste in the following script, modify the path (see below) and save.

// Get the name of the clicked map element, e.g. "Texas" string mapName = ClickedMapParameter.SingleValue.ToString();

// Get the path to the map in the shared resources folder string path = "Shared Resources\\Maps\\US States\\" + mapName;

// Load the map from the specified path MapControl1.LoadMapByFullPath(path);

You will need to modify this script to point to your map resources. In this case, the maps are stored as shared resources in the Shared Resources\Maps root folder. To specify a path, enter it as follows:

  1. Shared Resources: MapControl1.LoadMapByFullPath("Shared Resources\\Maps\\US States\\Texas");
  2. Project Resources: MapControl1.LoadMapByFullPath("ProjectName\\Resources\\Maps\\US States\\Texas");

Tip: You can clear existing shapes on the map using MapControl1.MapSources.Clear();
Tip: If your parameter is also a filter on your data, you can bind the full data set to the map and use this to drive both your data and to load the map resource. This allows you, for example, to load county-level data when you load the map of a US state.

Note: Loading maps requires an asynchronous server call. This means that the shapes will not be immediately available. If you want to modify the shapes after loading them, you will have to use a timer, or use the ViewportChanged interaction on the map - just keep in mind that the ViewportChanged event fires every time the viewport properties are updated (not just when shapes are loaded).

Drill-down in action

Here's how the above sample works. The first dashboard shows a map of the United States. The user will click on a state (California), and be taken to another dashboard which dynamically loads a county map of California.

A map of the United States.

A map of the United States.

The user clicks on California, which loads the county-level map:

A map of California.

A map of California.

Related topics

About Dundas | Contact Us Follow us on Twitter! | Privacy Statement | Report Site Issues

Copyright © 2009-2014 Dundas Data Visualization, Inc.