Controlling the Number of Major Grid Lines, Ticks, and Labels

How to:

On a numeric axis, the intervalMode and intervalValue properties control the number of major grid lines, ticks, and labels.

Syntax: How to Control the Number of Major Grid Lines, Ticks, and Labels

"axisname": {
  "intervalMode": "string",
  "intervalValue": number}    

where:

"axisname"

Can be:

  • "xaxis"
  • "yaxis"
  • "y2axis"
  • "zaxis"
"intervalMode": "string"

Is a string that defines the interval mode. Valid values are:

  • "count", which indicates that intervalValue will specify the number of major grid lines to draw.
  • "interval", which indicates that intervalValue will specify the interval at which major grid lines are drawn.
  • "skip", which indicates that intervalValue will specify the number of major grid lines to skip.

The default value is "undefined", which automatically calculates the number and frequency of major grid lines.

"intervalValue": number

Is a number that depends on the intervalMode. if intervalMode is "count", set this property to the number of major grid lines to draw. If intervalMode is "interval", set this property to the interval at which major grid lines are drawn. If intervalMode is "skip", set this property to the number of grid lines to skip. The default value is "undefined" which automatically calculates the number and frequency of major grid lines.

Note: The first and last grid lines are always drawn regardless of the intervalMode or intervalValue.

Example: Setting intervalMode and intervalValue

The following request generates a vertical line chart with major grid lines calculated automatically:

GRAPH FILE WF_RETAIL_LITE
SUM COGS_US 
BY MODEL
WHERE PRODUCT_CATEGORY EQ 'Computers'
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": {
	"intervalMode": "undefined",
	"intervalValue": "undefined",
	"majorGrid": {
		"visible": true,
		"aboveRisers": true,
		"lineStyle": {"color": "red"}
		}}
*END
ENDSTYLE
END

The output is:

The following version of the request draws 5 major grid lines:

GRAPH FILE WF_RETAIL_LITE
SUM COGS_US 
BY MODEL
WHERE PRODUCT_CATEGORY EQ 'Computers'
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": {
	"majorGrid": {"visible": true},
	"intervalMode": "count",
	"intervalValue": 5}
*END
ENDSTYLE
END

The output is:

The following version of the request draws major grid lines at intervals of two thousand:

GRAPH FILE WF_RETAIL_LITE
SUM COGS_US 
BY MODEL
WHERE PRODUCT_CATEGORY EQ 'Computers'
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": {
	"majorGrid": {"visible": true},
	"intervalMode": "interval", 
	"intervalValue": 2000}
*END
ENDSTYLE
END

The output is:

The following version skips every other automatic major grid line:

GRAPH FILE WF_RETAIL_LITE
SUM COGS_US 
BY MODEL
WHERE PRODUCT_CATEGORY EQ 'Computers'
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": {
	"majorGrid": {"visible": true},
	"intervalMode": "skip",
	"intervalValue": 1
	}
*END
ENDSTYLE
END

The output is:

WebFOCUS

Feedback