PDA

View Full Version : DisplayDatamap and ArrayOfCustomValues



PGLRepDev
03-16-2005, 10:10 PM
I'm really at wits end here. I'm trying to display sized pie charts showing the balance of inbound and outbound shipments into an area. I'm outputting graphs for each state, and I'd like to equalize them so that all maps range between 1 and 3000.

However, the help files are mostly useless in this area. All it says is that only the first and last values should be passed, but doesn't show how. I've seen a handful (okay, 3) posts around the net that are kinda-sorta-related, but nothing substantial -- that works.

Every time I try to pass specific values, I recieve the oh-so-helpful "The parameter is incorrect." Below is the main example, with variations following.

I've got other issues going on, but this is by far the most frustrating. Help appreciated in advance.

Thanks,
Anthony.


(NOTE: I've tried in all of these both 0 and 1 as the starting value)
Main procedure call:
objDataSet.DisplayDataMap(geoDataMapTypeSizedPie, varArrayOfFields, , , geoRangeTypeContinuous, , , 3, Array(0,,3000), Array("0","1500","3000"))

Var1:
.....3, Array(0,1500,3000), Array("0","1500","3000"))

Var2:
Dim rngValues(1 To 3) As Variant
Dim rngNames(1 To 3) As Variant
rngValues(1) = 0
rngValues(3) = 3000
rngNames(1) = "0"
rngNames(2) = "1500"
rngNames(3) = "3000"
.....3, rngValues, rngNames)

Var2:
Dim rngValues(1 To 3) As Variant
Dim rngNames(1 To 2) As Variant
rngValues(1) = 0
rngValues(3) = 3000
rngNames(1) = "0"
rngNames(2) = "1500"
rngNames(3) = "3000"
.....3, rngValues, rngNames)

PGLRepDev
03-17-2005, 09:24 PM
1. No one has an answer.
2. No one (statistcally speaking) develops in this monster, so no one has an answer.

Seriously, this program is BEAUTIFUL. You can produce some truly amazing maps to represent data.

However, if you have a LOT to do with it, and are a programmer, you're gonna wanna take a crack at the object model. The problem? There are no resources out there. There's nothing like a "Developer's Guide to MapPoint Application Development" out there (as I doubt "MapPoint for Dummies" hits code that hard).

I just don't get it. Every other MS environment where there's an object model you can hit programmably has some sort of guide to it. MP is well over 5 years old, but there's nothing.

I'm just getting tired of telling my boss every day, "I'm not any further."

Eric Frost
03-18-2005, 07:48 AM
I've had a lot of trouble with DisplayDataMap.. it always seems like a minor miracle once it works.

There is a lot of good content in the articles section.. also try using the Search just below the MP2K above, also try the Google search at the bottom.

Eric

kdulaney
04-15-2005, 09:58 AM
PGLRepDev:

I had the same problem with DisplayDataMap when passing integer or string arrays in for the legendvalues and legendlabels. I changed them to object[] arrays in C# and viola!. Not sure how that works in VB but thought this might help.

KD

Roman Pfarrhofer
05-12-2005, 05:58 AM
1. No one has an answer.
2. No one (statistcally speaking) develops in this monster, so no one has an answer.


Hi kdulaney!

I've faced the same problem yesterday and today for many hours: The last hint I needed, I've found in this article: http://support.microsoft.com/default.aspx?scid=kb;EN-US;305200

Well, a long hardly commented peace of source, but it helped!

For everyone who has the same problems here my peace of code that is working. I'm loading my data from a small Excel-Sheet and display the column "Inquiries" as SizedCircles on the map.



object[,] dataArray = { {1, GeoFieldType.geoFieldName}, {
2, GeoFieldType.geoFieldInformation}, {
3, GeoFieldType.geoFieldLatitude}, {
4, GeoFieldType.geoFieldLongitude}, {
5, GeoFieldType.geoFieldData}
};
MapPoint.DataSet dataSet = map.DataSets.ImportData(
"C:\\temp\\Example.xls!Sheet1"
, dataArray
, MapPoint.GeoCountry.geoCountryMultiCountry
, MapPoint.GeoDelimiter.geoDelimiterDefault
, MapPoint.GeoImportFlags.geoImportExcelSheet
);

object key = "inquiries";
Field field = dataSet.Fields.get_Item(ref key);
if(field != null) {
object missing = System.Reflection.Missing.Value;
DataMap dataMap = dataSet.DisplayDataMap(
GeoDataMapType.geoDataMapTypeSizedCircle // DataMapType
, field // DataField
, GeoShowDataBy.geoShowByLatLong // ShowDataBy
, GeoCombineDataBy.geoCombineByNone // CombineDataBy
, GeoDataRangeType.geoRangeTypeDiscreteEqualRanges // DataRangeType
, GeoDataRangeOrder.geoRangeOrderHighToLow // DataRangeOrder
, 8 // ColorScheme
, 6 // DataRangeCount
, missing // ArrayOfCustomValues
, missing // ArrayOfCustomNames
, missing // DivideByField
, missing // ArrayOfDataFieldLabels
, missing // ArrayOfPushpinSymbols
);

if(dataMap != null) {
dataMap.LegendTitle = "some title";
}
}



Example.xls!Sheet1 has following columns:
Name Description Lat Long Inquiries

Let me know if this was useful to anyone.

CU Roman

chrishad95
06-21-2006, 03:35 PM
Here's my code where the enduser has given me a comma separated list of values:



Dim cvalues() As Object
if _datarangevalues <> "" then
ReDim cvalues&#40;_datarangecount&#41;
For irv As Integer = 0 To _datarangecount -1
cvalues&#40;irv&#41; = _datarangevalues.Split&#40;","&#41;&#40;irv&#41;.trim&#40;&#41;
Next

odatamap = dsgrid1.DisplayDataMap&#40; _
DataMapType&#58;=_datamaptype, _
DataField&#58;=oField, _
ShowDataBy&#58;=_showbydata , _
DataRangeCount&#58;=_datarangecount, _
DataRangeType&#58;=_datarangetype, _
DataRangeOrder&#58;=_datarangeorder , _
ArrayOfCustomValues&#58;=cvalues , _
ColorScheme&#58;=mappoint.GeoDataConstants.geoColorSch emeDefault &#41;

Else
' _datarangevalues = "" they didn't give me anything so
' I will leave out that parm and MP will split them up automatically


odatamap = dsgrid1.DisplayDataMap&#40; _
DataMapType&#58;=_datamaptype, _
DataField&#58;=oField, _
ShowDataBy&#58;=_showbydata , _
DataRangeCount&#58;=_datarangecount, _
DataRangeType&#58;=_datarangetype, _
DataRangeOrder&#58;=_datarangeorder , _
ColorScheme&#58;=mappoint.GeoDataConstants.geoColorSch emeDefault &#41;
end if

markmpf
07-22-2010, 11:04 AM
I know this thread is old, but I got the answer for this (in VBA at least)



Dim Arr(0 To 2)
Arr(0) = 0.01
Arr(2) = 2000.1

Set objDatamap = objDataset.DisplayDataMap(ArrayOfCustomValues:=Arr , _
' other parameters here
)


With this declaration it also works:



Dim Arr(0 To 2) As Variant