Formatting the Legend Title

How to:

The title property controls the visibility and format of the legend title.


Top of page

x
Syntax: How to Format the Legend Title
legend: {
   title: {
      visible: boolean,
      text: 'tstring',
      font: 'fstring',
      color: 'cstring'
   }
}

where:

boolean

Can be:

  • true, which makes the legend title visible.
  • false, which makes the legend title not visible. This is the default value.
'tstring'

Is a string that defines the legend title text. The default value is 'Legend Title'.

'fstring'

Is a string that defines the size, style, and typeface of the legend title. The default value is '10pt Sans-Serif'.

'cstring'

Is a string that defines the color of the legend title using a color name or numeric specification string. The default value is 'black'.

For information about defining colors, see Colors and Gradients.



Example: Formatting the Legend Title

The following request defines a legend title that is red with a bold-italic 12pt Verdana font:

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: {
    title: 
    {visible: true,
    text: 'The Legend Title',
      font: 'Bold Italic 12pt Verdana',
      color: 'red'}  
},
 
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