CGView - Circular Genome Viewer
CGView XML - legendItem element
XML - legendItem element
The legendItem element is used to add text to map legends. The legendItem element is a child of the legend element.

The following sample CGView document shows how the legendItem element can be used to add text to a map:

<?xml version="1.0" encoding="ISO-8859-1"?> <cgview backboneRadius="160" sequenceLength="1000" height="600" width="600"> <featureSlot strand="direct"> <feature color="green" decoration="clockwise-arrow" label="feature X"> <featureRange start="463" stop="622" /> </feature> </featureSlot> <legend font="Monospaced,plain,25" backgroundColor="black" position="upper-center" textAlignment="center"> <legendItem text="Created using CGView" fontColor="white" /> </legend> <legend backgroundColor="navy" position="middle-right" backgroundOpacity="0.5" > <legendItem text="A legendItem" /> <legendItem text="A legendItem" drawSwatch="true" fontColor="white" swatchColor="green" /> <legendItem text="A legendItem" drawSwatch="true" fontColor="white" swatchColor="red" /> <legendItem text="A legendItem" drawSwatch="true" fontColor="white" swatchColor="yellow" /> </legend> <legend font="SansSerif,italic,12" position="lower-left" fontColor="purple"> <legendItem text="legendItem aligned to the left" textAlignment="left" /> <legendItem text="the right" textAlignment="right" /> <legendItem text="the center" textAlignment="center" /> </legend> </cgview>

This is the map generated by the above document:

output of above document

Required legendItem attributes
Attribute Description Values
text The text portion of this legendItem. text
Optional legendItem attributes
Attribute Description Values Default value
drawSwatch Specifies whether or not a colored rectangle should be drawn to the left of this legendItem's text. true - a colored rectangle should be drawn.
false - a colored rectangle should not be drawn.
false
font Sets the font used for the text in this legendItem. This setting overrides the font value of the parent legend element. font Inherited from the font value of the parent legend element.
fontColor Sets the color of the text used for this legendItem. This setting overrides the fontColor value of the parent legend element. color Inherited from the fontColor value of the parent legend element.
swatchColor Sets the color of the rectangle drawn to the left of this legendItem's text. color black
swatchOpacity Sets the opacity of the colored rectangle drawn to the left of this legendItem's text. real between 0.0 and 1.0, with 0.0 being completely transparent. 1.0
textAlignment Specifies how text should be aligned in this legendItem. This setting overrides the textAlignment value of the parent legend element. left - text should be aligned to the left.
center - text should be aligned to the center.
right - text should be aligned to the right.
Inherited from the textAlignment value of the parent legend element.

color = the color name (black for example), or the RGB values for the color (rgb(0,255,0) for example). The following color names are supported: aqua, black, blue, fuchsia, gray (and grey), green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white, and yellow.

font = the name of the font, followed by the style, and then the size. An example font is Monospaced, bold, 50. Valid font names are: Default, Dialog, DialogInput, Monospaced, Serif, and SansSerif. Valid styles are: plain, bold, italic, and bold-italic.

integer = a whole number between -2,147,483,648 and +2,147,483,647.

real = a real number between 1.4e-45 and 3.4e+38.

Citing CGView: