I have a map of the US DMA areas (Market Areas, ie NY = 001, LA = 002 etc). Now I would like the chart and map to work together to display the data on the Map. I created a very simple Business object (based off of your PassingData example) that I wanted to use for the charts data, and then plot this data on the Map. For example:
dma_001_--_New_York_NY 1
dma_002_--_Los_Angeles_CA 10
dma_003_--_Chicago_IL 100This works fine when I retrieve these same values from a Text file in the AppData folder (similar to your WorldPopulation sample). So I know that the map should can display the items. I created a very simple class called DMA, as above the class has two properties Name, and Count to simulate my TextFile. Then I create an array of these DMA items, just like your PassingData sample application. But I get a TargetException Error when I try to assign the Chart1.DataSource property in the same fashion that your PassingData solution employs. Both of these throw the same error.
Chart1.DataSourceSettings.DataSource = lstProvider;
Chart1.DataSource = lstProvider;
Here is your sample code from the PassingData solution using a business object:
Chart1.Gallery = Gallery.Bar;
/* Chart FX also supports reading data from a Business Object. In this case, we have created a class containing the* data (DMA) and used the ListProvider to populate Chart FX with multiple instances of the class.
* Chart FX also supports direct databinding to business object, using the Smart Tag Data Wizard. Please refer to the
* .NET documentation to create a business object that can be used as a data source.*/
DMA[] dmas = new DMA[3];
dmas[0] =
new DMA("dma_001_--_New_York_NY ", 15);dmas[1] =
new DMA("dma_002_--_Los_Angeles_CA ", 0);dmas[2] =
new DMA("dma_003_--_Chicago_IL", 20);
ListProvider lstProvider = new ListProvider(dmas);Chart1.DataSourceSettings.DataSource = lstProvider;
This displays fine as a chart. But when I try to display those items on a map, in this case Chicago Market should have 20 items I get the error. Here is the method that throws this error modeled from the code above that works.
Map1.MapSource = "C:\\Maps svg\\USA_DMA_v1.svg";
DMA[] dmas = new DMA[211];string text;for (int i = 0; i < Map1.VisibleMapRegions.Count; i++){
text = Map1.VisibleMapRegions.DisplayText;
switch (i){
case 0:
case 1:
case 2:
dmas =
new DMA(text, 1000);
break;default:dmas =
new DMA(text, 0);
break;}
}
ListProvider lstProvider = new ListProvider(dmas);
Chart1.DataSourceSettings.DataSource = lstProvider;
//Chart1.DataSource = lstProvider;
l checked the Name value of the DMA object and it is correct. The code above was written to test plotting out certain regions within the map. In the case ab ove I simply wanted NY, LA, and Chicago's corresponding Total to be at 1000, and every other region to have a data value of 0. What am I missing??? This should be very easy to do but I cannot find out any additional information about:
* Chart FX also supports direct databinding to business object, using the Smart Tag Data Wizard. Please refer to the
* .NET documentation to create a business object that can be used as a data source.*/
I really need someones help on this. It is GREATLY APPRECIATED. Just to reiterate, I can display the map properly opening the file as a tab delimeted text file. It is when I try to assign the DataSource to a simple Business Object that will not work. What am I missing???? This should be an easy task.
Thanks,
Don