Controlling the Location of a Free Legend

How to:

When legend position is set to 'free', the xy property controls the location of the legend, where x:0, y:0 is the upper left corner of the draw area.


Top of page

x
Syntax: How to Control the Location of a Free Legend
legend: {
   xy: {x:xnumber, y:ynumber}
   }

where:

xnumber

Is a number that defines the x/horizontal location of the legend. The default value is 320.

ynumber

Is a number that defines the y/vertical location of the legend. The default value is 80.



Example: Controlling the Location of a Free Legend

The following request generates a free (floating) legend and moves it to x:100 and y:20:

GRAPH FILE WF_RETAIL_LITE
SUM DISCOUNT_US GROSS_PROFIT_US REVENUE_US MSRP_US
BY PRODUCT_CATEGORY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET STYLE *
*GRAPH_JS
legend: {
    position: 'free',
    xy: {x:100, y:20}    
},
series: [
    {series: 0, color: 'lightgreen'},
    {series: 1, color: 'coral'},
    {series: 2, color: 'lightblue'},
    {series: 3, color: 'burlywood'} 
]
*END
INCLUDE=ENIADefault_combine.sty,$
ENDSTYLE
END

The output is:


WebFOCUS