Assigning a Series to an Axis

How to:

The yAxisAssignment property assigns a series to an axis. When yAxisAssignment is set to 2, Y2-Axis labels are added to the chart. For information about properties that control y2axis objects, see Axis Properties.


Top of page

x
Syntax: How to Assign a Series to an Axis
series:
[
    {
      series: snumber,
      yaxisAssignment: ynumber,
   }
]

where:

snumber

Is a zero-based series number. If the series does not exist in the chart, the property is ignored.

ynumber

Assigns the specified series to the y- or y2-axis. Valid values are:

  • 1, which assigns the series to the y-axis. This is the default value.
  • 2, which assigns the series to the y2-axis.


Example: Assigning a Series to an Axis

The following request against the GGSALES data source generates a vertical bar chart with a y- and y2-axis and assigns series to each axis:

GRAPH FILE GGSALES
SUM  DOLLARS UNITS BUDDOLLARS BUDUNITS
BY CATEGORY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET STYLE *
*GRAPH_JS
border:{width:2, color:'teal'},
title: {text: 'yAxisAssignment',font: '14pt Sans-Serif', color: 'teal'},
yaxis:{title: {visible: true, text: 'Dollars'}},
y2axis:{title: {visible: true, text: 'Units'}},
series:[
{series: 0, color: 'cyan', yAxisAssignment: 1,  label: 'Y1', marker: 
{border: {width: 1, color: 'green'}}},
{series: 1, color: 'tan', yAxisAssignment: 2,  label: 'Y2', marker: 
{border: {width: 1, color: 'brown'}}},
{series: 2, color: 'cyan', yAxisAssignment: 1,  label: 'Y1', marker: 
{border: {width: 1, color: 'green'}}},
{series: 3, color: 'tan', yAxisAssignment: 2,  label: 'Y2', marker: 
{border: {width: 1, color: 'brown'}}},
]
*END
ENDSTYLE
END

The output is:


WebFOCUS