Jump to content
Software FX Community

Setting map data with the API


Recommended Posts

Hello, I'm using the trial version of the ChartFX and Map extensions for a project for my company.  We are using it to evaluate if it will meet our needs and the needs of our clients.  We manipulate the data before binding to the charts, which is why for what we are doing, using the API is the best option for setting the data.  I'm having a difficult time finding good examples of how the map extension is used and of the couple that I did find, they use txt files for the data source.  I am using the .net 6.2 software, Visual Studio, c#.  I attempted using the following code, for example, to do the same as the WorldPopSample (in fact, I tried to modify that exact sample) by doing the following code, but it doesn't seem to be mapping it to the correct continents.  What am I doing wrong? 

 Also, it mentions this in the API reference: "By default, Chart FX Maps assumes that labels passed with chart data match the text labels that exist in the configured SVG MapSource. For instances when these labels do not correspond, a conversion table is used to connect the data labels to SVG labels. This table is referred to as the LabelLinks collection."  How do I know what the map's key to a particular country is, so I can reference it correctly.

Any help is much appreciated!

 //Set Continental Map

map1.MapSource = "World\\ContinentalOutline.svg";

// Set the data source to populate the map

map1.OpenData(COD.Values, 1, 1);

map1.Value[0,0] = 793627;

map1.LabelLinks[0].DataText = "Africa";

map1.Value[0,1] = 3672342;

map1.LabelLinks[1].DataText = "Asia";

map1.Value[0,2] = 314113;

map1.LabelLinks[2].DataText = "North America";

map1.Value[0,3] = 480867;

map1.LabelLinks[3].DataText = "South America";

map1.Value[0,4] = 727304;

map1.LabelLinks[4].DataText = "Europe";

map1.Value[0,5] = 30521;

map1.LabelLinks[5].DataText = "Oceania";


//map1.DataSource = new TextProvider("../../../../WorldPopData/continentalPopData.txt"); //commented out the use of a txt file


Link to comment
Share on other sites

I finally figured this out on my own.  I didn't realize you set the label the same way you do with a chart:

map1.AxisX.Label[0] = "Africa";

 It wasn't obvious to me that the axis was still something you used in the map object.

 Thanks to anyone who might have looked into this.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...