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 |