DYNAMIC GRAPHICS Via .NET 2.0 Database

BrightIdeas
07-24-2006, 10:23 PM
I am stumped.. my friend has just about got the ASP.NET 2.0 data being presented in Crystal Reports and now comes the hard part (the 100th that is).

What we are trying to do is create a map of the US and as you have seen when there is an election year, being able to change the overall US map which is white with black state borders to filled with blue or red respective to their party winning the state respectively. For example, if Florida went Democratic it would turn blue simply by changing the data field in the database.. as Texas could turn red if it were to go Republican.

HOW DO YOU MAKE THE MAP IMAGE CHANGE VIA THE CHANGES IN THE .NET DATABASE?

HELP PLEASE

wayneph
07-25-2006, 08:43 AM
The System.Drawing class will allow you to create dynamic graphics. In ASP.NET, you can acutally set up an .aspx page to return an image.

in your page.aspx
<img src="map.aspx" alt="US Map" />

in map.aspx (pseudo code)
Change the page's ContentType to "image/gif" (or what ever format you want to use.)
use System.Drawing to load a base map image.
Have coordinates in your database that tell your app where each state is on the image
Search the database for states to color.
Loop through the results and color the states based on the coordinates.
Write the new images binary stream to the browser, and it will show up in the image tag.

There may be some controls out there that already have this functionality built, but I doubt any are free.

I'm moving this to the Graphics Forum. That seems to be where the greatest amount of work for this is going to be.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum