Legends

In this section:

The following properties and methods control graph legends.


Top of page

x
Legend Properties

These properties are used to control how the legend area, legend markers, and legend text are imaged in a graph:

Note: All scroll, zoom, and pan operations require that the graph be rendered as an applet in the browser.


Top of page

x
Legend Methods

You can use these methods to control how the legend area, legend markers, and legend text are imaged in a graph:


Top of page

x
Setting the Legend Position

How to:

You can select the position of the legend on your graph using setLegendPosition.

The code has been written so that additional presets can be added later if desired (for example place the legend inside the chart in the upper right corner). These positions are independent of Place Default Elements (PDE).

Place Default Elements should fix positioning issues. The user can define the legend rectangle by calling setLegendAutomatic(false) which instructs the legend engine to leave it alone. Similarly, calling setLegendPosition(-1) tells the legend engine to leave the legend's position alone.



x
Syntax: How to Set the Legend Position
setLegendPosition (value);

where:

value

Is one of the following:



Example: Free Float Legend
restoreDefaults();
setDisplay(getFootnote(), false);
setDisplay(getY1MajorGrid(),false);
setDisplay(getO1MajorGrid(),false);
setGridStyle(getO1MinorGrid(),0);
setLegendAutomatic(false);
setRect(getLegendArea(),new
Rectangle(-11318,5359,9066,5438));
setLegendPosition( -1);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(-1)");
setTitleString("Free Float");
setPlace(true); 

The output is:

Free Float Legend



Example: Auto Legends
restoreDefaults();
setLegendPosition(0);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(0)");
setTitleString("Auto");
setPlace(true);

The output is:

Auto Legend

restoreDefaults();
setLegendPosition(0);
setRect(getLegendArea(),new
Rectangle(8237,-1290,6637,11349));
setTitleString("Auto");
setSubtitleString("setLegendPosition(0)");
setFootnoteString("When the legend is taller
   than wide, 'auto' palces on the right");
setPlace(true);

The output is:

Auto Legend



Example: Bottom Legend
restoreDefaults();
setLegendPosition(1);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(1)");
setTitleString("Bottom");
setPlace(true);

The output is:

Bottom Legend



Example: Right Legend
restoreDefaults();
setLegendPosition(2);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(2)");
setTitleString("Right");
setPlace(true);

The output is:

Right Legend



Example: Left Legend
restoreDefaults();
setLegendPosition(3);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(3)");
setTitleString("Left");
setPlace(true);

The output is:

Left Legend



Example: Top Legend
restoreDefaults();
setLegendPosition(4);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(4)");
setTitleString("Top");
setPlace(true);

The output is:

Top Legend



Example: Right Top Legend
restoreDefaults();
setLegendPosition(5);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(5)");
setTitleString("Right Top");
setPlace(true);

The output is:

Right Top Legend



Example: Right Bottom Legend
restoreDefaults();
setLegendPosition(6);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(6)");
setTitleString("Right Bottom");
setPlace(true);

The output is:

Right Bottom Legend



Example: Left Top Legend
restoreDefaults();
setLegendPosition(7);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(7)");
setTitleString("Left Top");
setPlace(true);

The output is:

Left Top Legend



Example: Left Bottom Legend
restoreDefaults();
setLegendPosition(8);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(8)");
setTitleString("Left Bottom");
setPlace(true);

The output is:

Left Bottom Legend



Example: Bottom Left Legend
restoreDefaults();
setLegendPosition(9);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(9)");
setTitleString("Bottom Left");
setPlace(true);

The output is:

Bottom Left Legend



Example: Bottom Right Legend
restoreDefaults();
setLegendPosition(10);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(10)");
setTitleString("Bottom Right");
setPlace(true);

The output is:

Bottom Right Legend



Example: Top Left Legend
restoreDefaults();
setLegendPosition(11);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(11)");
setTitleString("Top Left");
setPlace(true);

The output is:

Top Left Legend



Example: Top Right Legend
restoreDefaults();
setLegendPosition(12);
setDisplay(getFootnote(), false);
setSubtitleString("setLegendPosition(12)");
setTitleString("Top Right");
setPlace(true);

The output is:

Top Right Legend


WebFOCUS