Formatting the Axis Labels

How to:

The labels properties control the visibility and format of the axis labels.


Top of page

x
Syntax: How to Format Axis Labels
axisname: {
  labels: {
    visible: boolean,
    font: 'fstring',
    color: 'cstring',
    rotation: rnumber  }
}

where:

axisname

Can be:

  • xaxisOrdinal
  • xaxisNumeric
  • yaxis
  • y2axis
  • zaxisOrdinal
boolean

Controls the visibility of the axis labels. Valid values are:

  • true, which makes the axis labels visible. This is the default value.
  • false, which makes the axis labels not visible.
'fstring'

Is a string that defines the size, style, and typeface of the axis labels. The default value is '7.5pt Sans-Serif'.

'cstring'

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

For information about defining colors, see Colors and Gradients.

rnumber

Defines the rotation of axis labels, in degrees. Valid values are 0 (no rotation), 45, 90, 135, 180, 270, or undefined. The default value is undefined. Any value other than undefined will disable automatic layout of axis labels. For information, see Controlling Automatic Layout of Ordinal Axis Labels.



Example: Formatting Axis Labels

The following request against the GGSALES data source generates a vertical line chart and makes the y-axis labels bold with a 12pt Bookman Old Style font, in red:

GRAPH FILE GGSALES
SUM DOLLARS 
BY PRODUCT
WHERE CATEGORY EQ 'Gifts'
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH VLINE
ON GRAPH SET STYLE *
*GRAPH_JS
border: {width: 2, color: 'teal'},
blaProperties: {lineConnection: 'curved'},
yaxis: {labels: {color: 'red', font: 'bold 12pt Bookman Old Style'}}
*END
ENDSTYLE
END

The output is:

The following request generates a bubble chart and formats the axes labels to have the font 'bold 10pt Bookman Old Style'. The y-axis labels are blue, and the x-axis labels are red. Note that to format x-axis labels in a bubble or scatter chart, the axis name is xaxisNumeric:

GRAPH FILE GGSALES
SUM  DOLLARS UNITS BUDUNITS
BY PRODUCT 
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH BUBBLE
ON GRAPH SET STYLE *
*GRAPH_JS
border: {width:0},
series: [{series: 'all', marker: {shape: 'circle'}}],
  xaxisNumeric: {
    labels: {font: 'bold 10pt Bookman Old Style',color: 'red'}},
  yaxis: {
    labels: {font: 'bold 10pt Bookman Old Style',color: 'blue'}}    
*END
ENDSTYLE
END

The output is:


WebFOCUS