home *** CD-ROM | disk | FTP | other *** search
-
- #include "gpp.h"
- #include "vopl.h"
-
- extern float hstrlength();
-
- /*
- * drawlegend
- *
- * Draw a legend for gpp
- */
- void
- drawlegend()
- {
- float ydiff, x, y;
- char buf[80];
- int i = 0;
- graph *p;
-
- ydiff = 2 * TEXTHEIGHT;
- y = YMAX;
- x = XMAX + 3 * TEXTWIDTH;
-
- ortho2(-1.0, 1.75, -1.0, 1.25);
- hcentertext(1);
-
- htextsize(TEXTWIDTH * 1.2, TEXTHEIGHT * 1.2);
-
- /*
- * First draw all the marker symbols
- */
- for (i = 0; i < ngraphs; i++) {
- color((i % 7) + 1);
- move2(x, y);
- hdrawchar('a' + i);
- y -= ydiff;
- }
- x += TEXTWIDTH * 1.5;
-
- /*
- * Now fill in the legends
- */
-
- if (fontname[0])
- hfont(fontname);
- else
- hfont("futura.l");
-
- htextsize(TEXTWIDTH * 1.2, TEXTHEIGHT * 1.2);
-
- y = YMAX;
- i = 0;
-
- for (p = gp; p != (graph *)NULL; p = p->nxt) {
- color((i++ % 7) + 1);
- if (strlen(p->legend) != 0) {
- move2(x + hstrlength(p->legend) / 2, y);
- hcharstr(p->legend);
- y -= ydiff;
- }
- }
-
- hcentertext(0);
- }
-