Setting the Axis Mode

How to:

The mode property sets the axis mode as ordinal, numeric, time, or color. The axis mode is typically set to undefined which allows the charting engine to automatically set the mode based on the data.

Syntax: How to Set the Axis Mode

"axisname": { 
  "mode": "string" 
  }

where:

"axisname"

Can be:

  • "xaxis"
  • "yaxis"
  • "zaxis"
"mode": "string"

Is a string that specifies the axis mode. If the value is undefined, the mode is automatically chosen based on the data. Other supported values are:

  • "ordinal"
  • "numeric"
  • "count"

    This mode is supported for a numeric axis in order to guarantee an integer scale when the axis is assigned to a measure that has discrete, rather than continuous, values. This mode is useful for displaying histograms and other charts with a discrete measure.

  • "time"
  • "color"

    Note: For heatmap, treemap, and tagcloud charts, you can set mode to "color" and define colorScale colors to define the coloring of cells in heatmaps and treemaps, and the coloring of labels in tagclouds.

Example: Setting the Axis Mode

The following request generates a heatmap chart whose y-axis mode is set to "color" and whose color scale consists of the colors ghost white, tan, and antique white:

GRAPH FILE WF_RETAIL_LITE
SUM  REVENUE_US AS 'Revenue'
        GROSS_PROFIT_US AS 'Profit'
BY PRODUCT_SUBCATEG
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH SPECTRAL
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
*GRAPH_JS
"yaxis": {"mode": "color"},
"colorScale": {"colors": ["ghostwhite", "tan", "antiquewhite"]}
*END
ENDSTYLE
END

The output is:

Example: Using Count Mode for a Numeric Axis

The following request charts the number of days delayed by product category. The y-axis mode is set to "count", ensuring that the y-axis only shows integers.

GRAPH FILE wf_retail_lite
SUM LST.DAYSDELAYED
BY PRODUCT_CATEGORY
WHERE DAYSDELAYED GT 0
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET AUTOFIT ON
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=DATA, COLUMN=N1, BUCKET=x-axis, $
TYPE=DATA, COLUMN=N2, BUCKET=y-axis, $
*GRAPH_JS
  "yaxis": {"mode": "count"},
*END
ENDSTYLE
END

The output is shown in the following image.

WebFOCUS

Feedback