Axis
class Axis extends ConfigObject (View source)
Properties
int|Carbon | $baseline | The baseline for the axis. | |
string | $baselineColor | The color of the baseline for the axis. | |
int | $direction | The direction in which the values along the axis grow. | |
string | $format | A format string for numeric axis labels. | |
array | $gridlines | An array with key => value pairs to configure the gridlines. | |
bool | $logScale | Linear or Logarithmic scaled axis. | |
int | $maxAlternation | Moves the max value of the axis to the specified value. | |
int | $maxTextLines | Maximum number of lines allowed for the text labels. | |
int | $maxValue | Moves the max value of the axis to the specified value. | |
array | $minorGridlines | An array with key => value pairs to configure the minorGridlines. | |
int | $minTextSpacing | Minimum spacing, in pixels, allowed between two adjacent text labels. | |
int | $minValue | Moves the min value of the axis to the specified value. | |
int | $showTextEvery | How many axis labels to show. | |
string | $textPosition | Position of the vertical axis text, relative to the chart area. | |
TextStyle | $textStyle | An object that specifies the axis text style. | |
string | $title | Property that specifies a title for the axis. | |
textStyle | $titleTextStyle | An object that specifies the text style of the chart title. | |
array | $viewWindow | Specifies the cropping range of the vertical axis. | |
string | $viewWindowMode | Specifies how to scale the axis to render the values within the chart area. |
Methods
Builds the configuration when passed an array of options.
Returns an array representation of the object.
Same as toArray, but without the class name as a key to being multi-dimension.
Sets the color of the baseline for the axis.
Sets the formatting applied to the axis label. This is a subset of the ICU pattern set. For instance, '#,###%' will display values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5.
Sets the axis property that makes the axis a logarithmic scale (requires all values to be positive). Set to [ true | false ].
Sets the color and count of the minorGridlines
Maximum number of levels of axis text.
Maximum number of lines allowed for the text labels.
Minimum spacing, in pixels, allowed between two adjacent text labels.
Axis property that specifies the highest axis grid line. The actual grid line will be the greater of two values: the maxValue option value, or the highest data value, rounded up to the next higher grid mark.
axis property that specifies the lowest axis grid line. The actual grid line will be the lower of two values: the minValue option value, or the lowest data value, rounded down to the next lower grid mark.
How many axis labels to show
Position of the axis text, relative to the chart area.
An object that specifies the axis title text style.
Specifies the cropping range of the axis.
Specifies how to scale the axis to render the values within the chart area. The following string values are supported:
Details
at line 173
mixed
__construct(
mixed $child,
array $config)
Builds the configuration when passed an array of options.
All options can be set by either passing an array with associative values for option => value, or by chaining together the functions once an object has been created.
in
ConfigObject at line 93
array
toArray(
string $keyName = null)
Returns an array representation of the object.
If passed a label, then the array will be returned with the label as the key.
Called with no label returns an array with the classname as the key.
in
ConfigObject at line 115
array
getValues()
Same as toArray, but without the class name as a key to being multi-dimension.
at line 187
Axis
baseline(
mixed $baseline)
Sets the baseline for the axis.
This option is only supported for a continuous axis.
at line 217
Axis
baselineColor(
string $color)
Sets the color of the baseline for the axis.
Can be any HTML color string, for example: 'red' or '#00cc00'.
This option is only supported for a continuous axis.
at line 241
Axis
direction(
int $direction)
Sets the direction of the axis values.
specify 1 for normal, -1 to reverse the order of the values.
at line 271
Axis
format(
string $format)
Sets the formatting applied to the axis label. This is a subset of the ICU pattern set. For instance, '#,###%' will display values "1,000%", "750%", and "50%" for values 10, 7.5, and 0.5.
For date axis labels, this is a subset of the date formatting ICU pattern set. For instance, "MMM d, y" will display the value "Jul 1, 2011" for the date of July first in 2011.
This option is only supported for a continuous axis.
at line 300
Axis
gridlines(
array $gridlines)
Sets the color and count of the gridlines.
'color' - The color of the gridlines, Specify a valid HTML color string. 'count' - The number of horizontal gridlines inside the chart area. Minimum value is 2. Specify -1 to automatically compute the number of gridlines. array('color' => '#333', 'count' => 4);
This option is only supported for a continuous axis.
at line 343
Axis
logScale(
bool $logScale)
Sets the axis property that makes the axis a logarithmic scale (requires all values to be positive). Set to [ true | false ].
This option is only supported for a continuous axis.
at line 370
Axis
minorGridlines(
array $minorGridlines)
Sets the color and count of the minorGridlines
'color' - The color of the minor gridlines inside the chart area, specify a valid HTML color string. 'count' - The number of minor gridlines between two regular gridlines.
This option is only supported for a continuous axis.
at line 418
Axis
maxAlternation(
int $alternation)
Maximum number of levels of axis text.
If axis text labels become too crowded, the server might shift neighboring labels up or down in order to fit labels closer together. This value specifies the most number of levels to use; the server can use fewer levels, if labels can fit without overlapping.
This option is only supported for a discrete axis.
at line 445
Axis
maxTextLines(
int $maxTextLines)
Maximum number of lines allowed for the text labels.
Labels can span multiple lines if they are too long, and the nuber of lines is, by default, limited by the height of the available space.
This option is only supported for a discrete axis.
at line 473
Axis
minTextSpacing(
int $minTextSpacing)
Minimum spacing, in pixels, allowed between two adjacent text labels.
If the labels are spaced too densely, or they are too long, the spacing can drop below this threshold, and in this case one of the label-unclutter measures will be applied (e.g, truncating the lables or dropping some of them).
This option is only supported for a discrete axis.
at line 498
Axis
maxValue(
int $max)
Axis property that specifies the highest axis grid line. The actual grid line will be the greater of two values: the maxValue option value, or the highest data value, rounded up to the next higher grid mark.
This option is only supported for a continuous axis.
at line 523
Axis
minValue(
int $min)
axis property that specifies the lowest axis grid line. The actual grid line will be the lower of two values: the minValue option value, or the lowest data value, rounded down to the next lower grid mark.
This option is only supported for a continuous axis.
at line 550
Axis
showTextEvery(
int $showTextEvery)
How many axis labels to show
1 means show every label, 2 means show every other label, and so on. Default is to try to show as many labels as possible without overlapping.
This option is only supported for a discrete axis.
at line 572
Axis
textPosition(
string $position)
Position of the axis text, relative to the chart area.
Supported values: 'out', 'in', 'none'.
at line 600
Axis
textStyle(
TextStyle $textStyle)
Sets the textstyle for the axis
at line 614
Axis
title(
string $title)
Axis property that specifies the title of the axis.
at line 635
Axis
titleTextStyle(
TextStyle $titleTextStyle)
An object that specifies the axis title text style.
at line 666
Axis
viewWindow(
array $viewWindow)
Specifies the cropping range of the axis.
For a continuous axis: The minimum and maximum data value to render. Has an effect only if $this->viewWindowMode = 'explicit'.
For a discrete axis: 'min' - The zero-based row index where the cropping window begins. Data points at indices lower than this will be cropped out. In conjunction with VerticalAxis->viewWindow['max'], it defines a half-opened range (min, max) that denotes the element indices to display. In other words, every index such that min <= index < max will be displayed.
'max' - The zero-based row index where the cropping window ends. Data points at this index and higher will be cropped out. In conjunction with VerticalAxis->viewWindow['min'], it defines a half-opened range (min, max) that denotes the element i(ndices to display. In other words, every index such that min <= index < max will be displayed.
at line 706
Axis
viewWindowMode(
string $viewMode)
Specifies how to scale the axis to render the values within the chart area. The following string values are supported:
'pretty' - Scale the values so that the maximum and minimum data values are rendered a bit inside the left and right of the chart area. 'maximized' - Scale the values so that the maximum and minimum data values touch the left and right of the chart area. 'explicit' - Specify the left and right scale values of the chart area. Data values outside these values will be cropped. You must specify an axis.viewWindow array describing the maximum and minimum values to show.
This option is only supported for a continuous axis.