Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 1 of 1

Using ImportData and DisplayDataMap - Part 2 of 3 - Introducing DisplayDataMap

This is a discussion on Using ImportData and DisplayDataMap - Part 2 of 3 - Introducing DisplayDataMap within the MP2K Magazine Articles forums, part of the Map Forums category; DisplayDataMap DisplayDataMap is where things can become more difficult. This method is used to display a dataset. It is a ...

  1. #1
    Richard Marsden is offline Junior Member White Belt
    Join Date
    Jun 2011
    Posts
    5

    Using ImportData and DisplayDataMap - Part 2 of 3 - Introducing DisplayDataMap

    DisplayDataMap

    DisplayDataMap is where things can become more difficult. This method is used to display a dataset. It is a complicated method with lots of parameters. It is easy to make a mistake with the parameters, and all parameter errors result in an un-informative “The parameter is incorrect” error. It is therefore recommended that you start with a working example (e.g. from this article), and adjust it step-by-step until it does what you require. Diagnostics such as the field loop in the above code sample, can also help.

    The following code samples can all be inserted in the sample above where the comment “(data plotting code goes here)” appears.

    Before describing all the parameters, let’s start with an example. The following code plots the sales data as Sized Pie Charts:

    Code:
    // These are the (1-ref) indexes for the fields we are plotting
    object ourSalesIDX = 4;
    object compASalesIDX = 5;
    object compBSalesIDX = 6;
     
    // Use these indexes to create an array of data fields to plot
    datafields = new object[3];
    datafields[0] = ds.Fields.get_Item(ref ourSalesIDX);
    datafields[1] = ds.Fields.get_Item(ref compASalesIDX);
    datafields[2] = ds.Fields.get_Item(ref compBSalesIDX);
     
    Console.WriteLine("fields created");
     
    // change the dataset into Sized Pie Chart map
    datamap = ds.DisplayDataMap(MapPoint.GeoDataMapType.geoDataMapTypeSizedPie,
                       datafields,
                       MapPoint.GeoShowDataBy.geoShowByRegion1,
                       MapPoint.GeoCombineDataBy.geoCombineByNone,
                       MapPoint.GeoDataRangeType.geoRangeTypeDefault,
                       MapPoint.GeoDataRangeOrder.geoRangeOrderDefault,
                       6,
                       3,
                       missing,missing,missing,missing,missing);
     
                   datamap.LegendTitle = "Sales by State";
    This is what the resulting map looks like:



    There are potentially a lot of parameters but in this example we leave most of them as their defaults. Most of the other parameters are enumerations which define how the geographic data is displayed and grouped.

    The most complex parameter in this example is the second one, datafields. This lists the data field or fields which will be plotted. Specify a MapPoint Field object (for one data field – e.g. in a shaded area map), or as in this example, an array of MapPoint Field objects to specify multiple data fields. The Field objects are queried using Fields.get_Item. Note that this uses 1-referenced indices.

    All of the parameters are technically optional, although it is generally a good idea to explicitly specify many of them. .NET’s interface to COM requires all ‘missing’ optional parameters to be passed as System.Reflection.Missing.Value. All of the code in these examples use a variable called missing which is set to System.Reflection.Missing.Value.

    Many of the parameters are enumerations and the full set of values for these enumerations can be found in the MapPoint documentation.

    Continue Reading Using ImportData and DisplayDataMap - Part 3 of 3 - DisplayDataMap Parameters
    Last edited by Richard Marsden; 12-14-2011 at 10:06 AM.
    Winwaed Software Technology LLC
    http://www.winwaed.com
    See http://www.mapping-tools.com for MapPoint Tools

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Using ImportData and DisplayDataMap - Part 1 of 3 - The ImportData Method
    By Richard Marsden in forum MP2K Magazine Articles
    Replies: 2
    Last Post: 12-13-2011, 10:57 AM
  2. DisplayDataMap
    By chpw in forum MapPoint Desktop Discussion
    Replies: 9
    Last Post: 02-14-2011, 07:26 PM
  3. DisplayDataMap
    By mmartin in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 05-05-2008, 08:26 AM
  4. DisplayDataMap in Delphi 7
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 12-17-2004, 05:59 AM
  5. DisplayDataMap and C#
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 07-04-2003, 01:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122