Hello Again - Adding a Glyph

Now let's flesh this out a bit with the help of a few more GenoViz classes.

Look at the source.

In the first few lines, we introduce a few methods for setting parameters of the map:

map.setMapRange(0, 1000);
map.setMapOffset(0, 100);
map.addAxis(10);
        

We set the horizontal range of the map and the vertical offsets the map will handle. Range numbers increase from left to right. Offset numbers increase from top to bottom. We also specify that we want an axis drawn near the top of the map (offset 10 from the top).

The next thing we do is add a glyph to the map. GenoViz supplies a number of glyphs you can use, and there are several ways to add glyphs to maps. The simplest way is:

map.addItem(300, 500);
        

The arguments to NeoMap.addItem() are the start and end coordinates of the glyph, specified in the coordinate system that was set by the NeoMap.setMapRange() call. In this case we are relying on the NeoMap's default glyph settings, which are to use a FillRectGlyph with color set to black and a defaut thickness.

You could add several glyphs all of the same type to the map in different horizontal locations without reconfiguring.
 

Here's how it looks running as an Applet.

Next: Simple Map