The X axis or category axis. Normally this is the horizontal axis, though if the chart is inverted this is the vertical axis. In case of multiple axes, the xAxis node is an array of configuration objects.

Method used:

In case of multiple axes, the xAxis node is an array of configuration objects.
Parameters:

  • mixed $name: the option name for the loading. Can be a string or array. When used as array a key value pair should be defined, where the key is the name
  • mixed $mixvalue: a value option in case the name is a string

API Tags:
Return: instance
Access: public

Example:

... $chart = new jqChart(); $chart->setChartOptions(array("defaultSeriesType"=>"line","marginRight"=>130,"marginBottom"=>25)) ->setTitle(array('text'=>'Monthly Average Temperature',"x"=>-20)) ->setSubtitle(array("text"=>"Source: WorldClimate.com","x"=>-20)) ->setxAxis(array("categories"=>array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'))) ...


Option name Type Default
allowDecimals Boolean true
Whether to allow decimals in this axis' ticks. When counting integers, like persons or hits on a web page, decimals must be avoided in the axis tick labels.
alternateGridColor Color null
When using an alternate grid color, a band is painted across the plot area between every other grid line.
categories Array ()
If categories are present for the xAxis, names are used instead of numbers for that axis. Example:
"categories"=> array('Apples', 'Bananas', 'Oranges')
dateTimeLabelFormats Array
For a datetime axis, the scale will automatically adjust to the appropriate unit. This member gives the default string representations used for each unit. For an overview of the replacement codes, see dateFormat. Default
array(
"second"=> '%H:%M:%S',
"minute"=> '%H:%M',
"hour"=> '%H:%M',
"day"=> '%e. %b',
"week"=> '%e. %b',
"month"=> '%b '%y',
"year"=> '%Y'
)
endOnTick Boolean false
Whether to force the axis to end on a tick. Use this option with the maxPadding option to control the axis end.
events Array
A collection of event handlers.
gridLineColor Color "#C0C0C0"
Color of the grid lines extending the ticks across the plot area.
gridLineDashStyle String ShortDot
The dash or dot style of the grid lines.
gridLineWidth Number 0
The width of the grid lines extending the ticks across the plot area.
id String null
An id for the axis. This can be used after render time to get a pointer to the axis object
labels Array
Configuration object for the axis labels, usually displaying the number for each tick.
lineColor Color "#C0D0E0".
The color of the line marking the axis itself.
lineWidth Number 1
The width of the line marking the axis itself
linkedTo Number null
Index of another axis that this axis is linked to. When an axis is linked to a master axis, it will take the same extremes as the master, but as assigned by min or max or by setExtremes. It can be used to show additional info, or to ease reading the chart by duplicating the scales.
max Number null
The maximum value of the axis. If null, the max value is automatically calculated. If the endOnTick option is true, the max value might be rounded up. The actual maximum value is also influenced by chart.alignTicks.
maxPadding Number 0.01
Padding of the max value relative to the length of the axis. A padding of 0.05 will make a 100px axis 5px longer. This is useful when you don't want the highest data value to appear on the edge of the plot area. When the axis' max option is set or a max extreme is set using axis.setExtremes(), the maxPadding will be ignored.
maxZoom Number
The maximum amount of zoom on this axis. The entire axis will not be allowed to span over a smaller interval than this. For example, for a datetime axis the main unit is milliseconds. If maxZoom is set to 3600000, you can't zoom in more than to one hour.
The default maxZoom for the x axis is five times the smallest interval between any of the data points.
min Number null
The minimum value of the axis. If null the min value is automatically calculated. If the startOnTick option is true, the min value might be rounded down.
minorGridLineColor Color #E0E0E0
Color of the minor, secondary grid lines.
minorGridLineDashStyle String Solid
The dash or dot style of the minor grid lines.
minorTickColor Color #A0A0A0.
Color for the minor tick marks.
minorTickInterval Number null
Tick interval in scale units for the minor ticks. If "auto", the minor tick interval is calculated as a fifth of the tickInterval. If null, minor ticks are not shown.
minorTickLength Number 2
The pixel length of the minor tick marks.
minorTickPosition String outside
The position of the minor tick marks relative to the axis line. Can be one of inside and outside.
minorTickWidth Number 0
The pixel width of the minor tick mark.
minPadding Number 0.01
Padding of the min value relative to the length of the axis. A padding of 0.05 will make a 100px axis 5px longer. This is useful when you don't want the lowest data value to appear on the edge of the plot area. When the axis' min option is set or a min extreme is set using axis.setExtremes(), the minPadding will be ignored.
offset Number 0
The distance in pixels from the plot area to the axis line. A positive offset moves the axis with it's line, labels and ticks away from the plot area. This is typically used when two or more axes are displayed on the same side of the plot.
opposite Boolean false
Whether to display the axis on the opposite side of the normal. The normal is on the left side for vertical axes and bottom for horizontal, so the opposite sides will be right and top respectively. This is typically used with dual or multiple axes.
plotBands Array null
An array of configuration objects for plot bands colouring parts of the plot area background.
plotLines Array null
An array of configuration objects for plot lines marking specific values in the plot area.
reversed Boolen false
Whether to reverse the axis so that the highest number is closest to origo. If the chart is inverted, the x axis is reversed by default.
showFirstLabel Boolean true
Whether to show the first tick label.
showLastLabel Boolean false
Whether to show the last tick label.
startOfWeek Number 1
For datetime axes, this decides where to put the tick between weeks. 0 = Sunday, 1 = Monday.
startOnTick Boolean false
Whether to force the axis to start on a tick. Use this option with the maxPadding option to control the axis start.
tickColor Color #C0D0E0
Color for the main tick marks.
tickInterval Mixed null
tickInterval : Mixed null The interval of the tick marks in axis units. When null, the tick interval is computed to approximately follow the tickPixelInterval on linear and datetime axes. On categorized axes, a null tickInterval will default to 1, one category. Note that datetime axes are based on milliseconds, so for example an interval of one day is expressed as 24 * 3600 * 1000.
tickLength Number 5
The pixel length of the main tick marks.
tickmarkPlacement String between
For categorized axes only. If "on" the tick mark is placed in the center of the category, if "between" the tick mark is placed between categories.
tickPixelInterval Number
If tickInterval is null this option sets the approximate pixel interval of the tick marks. Not applicable to categorized axis. Defaults to 72 for the Y axis and 100 for the X axis.
tickPosition String "outside"
The position of the major tick marks relative to the axis line. Can be one of inside and outside.
tickWidth Number 1
The pixel width of the major tick marks.
title Array
Configuration array for the axis title.
type String linear
The type of axis. Can be one of "linear" or "datetime". In a datetime axis, the numbers are given in milliseconds, and tick marks are placed on appropriate values like full hours or days.