ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Contour chart with geographical data
Posted by Lofi on Jul-23-2012 18:03
I was wondering if it would be possible with Chartdirector to create a contour chart (e. g. a heat map) which represents a country. If so, what data format is required? And is there an example source code?

e. g. I'd like to display the contour of Italy and the current temperature in all regions. And to make it even more complex: Would it also be possible to show e. g. the direction the window blows in the various regions with e. g. small arrows?

Thank you very much for your feedback!

  Re: Contour chart with geographical data
Posted by Peter Kwan on Jul-24-2012 00:44
Hi Lofi,

To create a heat map, just pass the data to ChartDirector like creating a normal XY contour chart. For a country, most people will consider it to be flat and use normal XY coordinates to represent the positions within the country (although actually the earth is round and the country is therefore a curved surface).

If you want to the display to the boundary of the country, you may add a foreground image with the boundary of the country is some easy to see color (such as black), and with the other parts transparent. In this way, you can see the border of the country on the heat map.

If you only want to see the country in the heat map, you may add a foreground image, with the country being transparent, and all other parts opaque (such as black or white or grey). In this way, you can only see the part of the heat map that is inside the country.

(In brief, the boundary of a country is just an artificial boundary for human display. It does not have any significance in computing the heat map. The chart can be plotted as if there is no boundary. You can then add a foreground image to block away the part you do not want to see.)

For plotting a heat map, you may refer to the sample code that comes with ChartDirector.

For adding a foreground image, the code is like:

c.addText(c.getPlotArea().getLeftX(), c.getPlotArea().getTopY(), "<*img=myForegroundImage.png*>");

The foreground image should be of the same size as the plot area. You can prepare the foreground image using common graphics editors (eg. Photoshop).

To create wind directions, you may consider to add a vector layer on top of the heat map. See the sample code "Vector Chart" for an example.

Hope this can help.

Regards
Peter Kwan