#set TITLE = "proc legendentry"
#include top

.SH DESCRIPTION
Defines one legend entry.
This entry will be rendered the next time that 
\fBproc legend\fR is executed.
Usually, legends are built by successive plotting procs
having a \fClegendlabel\fR attribute.  However, if additional
flexibility is needed to make custom legend entries, this
proc may be invoked, once per legend entry.
.LP
For example, if a scatterplot is being created with various sized
points, there is no automatic way to get a legend of the various
point sizes, so \fBproc legendentry\fR could be executed (probably several 
times) to define legend information, then \fBproc legend\fR could be
executed to render it.
.LP
\fBproc legendentry\fR is also useful in setting up
#set FILE = "#legenddriven"
#set TAG = "legend-driven plots"
#include link
which allow things like bar color, or scatterplot symbol color, size, or
shape to be controlled by a data field.

#include space
.SH EXAMPLE
See the gallery example
.ig >>
<a href="../gallery/scatterplot3a.html">
.>>
scatterplot3a 
.ig >>
</a>
.>>

#include space
.SH PREREQUISITES
None.

.SH MANDATORY ATTRIBUTES
None.  

#include space
.SH ATTRIBUTES

.LP
\fBsampletype\fR \fIt\fR
.IP
The type of sample to be displayed with the entry.
\fIt\fR may be one of:
\fCline\fR, \fCcolor\fR , \fCsymbol\fR , \fCtext\fR , \fCline+symbol\fR , or 
\fCtext+symbol\fR, or \fCnone\fR.
.br
\fCnone\fR may be used to insert spacing or text headers/separators into the legend.
.br
Example: \fCsampletype: text\fR

.LP
\fBlabel\fR  
.ig >>
<a href="attributetypes.html#text">
.>>
\fI text \fR
.ig >>
</a>
.>>
.IP
The label for the entry.
Example: \fClabel: Eastern counties\fR

.LP
\fBtag\fR
#set FILE = "attributetypes.html#string"
#set TAG = "\\fI string \\fR"
#include link
.IP
An optional short identifier to be associated with the entry,
so that the entry can be accessed later.
Used with proc bars colorfield, as in this example:
#set FILE = "../gallery/colorfld.htm"
#set TAG = "colorfld"
#include link


.LP
\fBdetails\fR  
.ig >>
<a href="attributetypes.html#text">
.>>
\fI text \fR
.ig >>
</a>
.>>
.IP
Details regarding the rendering of the sample.
What this is depends on the \fCsampletype\fR.  

.IP
For \fCline\fR, a 
.ig >>
<a href="linedetails.html">
.>>
\fI linedetails \fR
.ig >>
</a>
.>>
specification should be given.

.IP
For \fCcolor\fR, a 
.ig >>
<a href="color.html">
.>>
\fI color \fR
.ig >>
</a>
.>>
should be given.

.IP
For \fCsymbol\fR, a 
.ig >>
<a href="symboldetails.html">
.>>
\fI symboldetails \fR
.ig >>
</a>
.>>
specification should be given.

.IP
For \fCtext\fR, the character or word should be given here, and a
.ig >>
<a href="textdetails.html">
.>>
\fI textdetails \fR
.ig >>
</a>
.>>
specification may be given using the \fCdetails2\fR attribute.

.IP
For \fCline+symbol\fR, a 
.ig >>
<a href="linedetails.html">
.>>
\fI linedetails \fR
.ig >>
</a>
.>>
specification should be given here,
and a 
.ig >>
<a href="symboldetails.html">
.>>
\fI symboldetails \fR
.ig >>
</a>
.>>
specification given using the \fCdetails2\fR attribute.

.IP
For \fCtext+symbol\fR, the character or word should be given here, a 
.ig >>
<a href="textdetails.html">
.>>
\fI textdetails \fR
.ig >>
</a>
.>>
specification should be given using the \fCdetails2\fR attribute,
and a 
.ig >>
<a href="symboldetails.html">
.>>
\fI symboldetails \fR
.ig >>
</a>
.>>
specification given using the \fCdetails3\fR attribute.

.IP
If \fCsampletype\fR is \fCnone\fR, nothing should be given for this attribute.

.LP
\fBdetails2\fR  
.ig >>
<a href="attributetypes.html#text">
.>>
\fI text \fR
.ig >>
</a>
.>>
.IP
Secondary details attribute.  See \fCdetails\fR above.

.LP
\fBdetails3\fR  
.ig >>
<a href="attributetypes.html#text">
.>>
\fI text \fR
.ig >>
</a>
.>>
.IP
See \fCdetails\fR above.

.ig >>
<a name="legenddriven"></a>
.>>
#include space

.SH LEGEND-DRIVEN TECHNIQUE

.LP
"Legend-driven technique" allows 
bar color, scatterplot symbol, etc. to be controlled by a data field.
This technique involves defining a legend \fIfirst\fR, containing information
to associate data field contents with appearance details.
Then the plotting is done.

.LP
Here is the procedure:
.IP
1. For every expected variation,
set up an explicit legend entry using \fBproc legendentry\fR.
\fClabel\fR, \fCtag\fR, and \fCdetails\fR attributes should be supplied.
The \fCtag\fR will be compared with data field contents.
The \fCdetails\fR attributes control appearance.
.IP
2. Plot, using the appropriate attribute.  For example, if you are
doing a bar graph where individual bar colors are controlled by a data
field, you would use \fBproc bars\fR and specify a \fCcolorfield\fR.

.LP
Examples of legend-driven technique are
#set FILE = "../gallery/colorfld.htm"
#set TAG = "colorfld"
#include link

#set FILE = "../gallery/symfld.htm"
#set TAG = "symfld"
#include link

#set FILE = "../gallery/symfld.htm"
#set TAG = "symfld"
#include link

#set FILE = "../gallery/dupsleg.htm"
#set TAG = "dupsleg"
#include link

#include bottom
