class ComboChart extends Chart (View source)

ComboChart Class

A chart that lets you render each series as a different marker type from the following list: line, area, bars, candlesticks and stepped area.

To assign a default marker type for series, specify the seriesType property. Use the series property to specify properties of each series individually.

Traits

Constants

TYPE

Javascript chart type.

VERSION

Javascript chart version.

VIZ_PACKAGE

Javascript chart package.

VIZ_CLASS

Google's visualization class name.

Methods

__construct( Label $chartLabel, DataTable $datatable, array $config = array())

Builds a new ComboChart with the given label, datatable and options.

mixed
__get( string $option)

Get the value of a set option via magic method.

from  JsonConfig
getOptions()

Gets the Options object for the JsonConfig

from  JsonConfig
setOption( string $option, mixed $value)

Shortcut method to set the value of an option and return $this.

from  JsonConfig
setOptions( array $config)

Parses the config array by passing the values through each method to check validity against if the option exists.

from  JsonConfig
array
jsonSerialize()

Custom serialization of the JsonConfig object.

from  JsonConfig
string
getType()

Returns the chart type.

from  Chart
bool
hasEvents()

Checks if any events have been assigned to the chart.

from  Chart
getEvents()

Retrieves the events if any have been assigned to the chart.

from  Chart
getLabel()

Returns the chart label.

from  Chart
events( array $events)

Register javascript callbacks for specific events.

from  Chart
datatable( DataTable $datatable)

Assigns a datatable to use for the Chart.

from  Chart
customize( array $optionArray)

Sets any configuration option, with no checks for type / validity

from  Chart
getDataTable()

Returns the DataTable

from  Chart
string
getDataTableJson()

Returns a JSON string representation of the datatable.

from  Chart
string
render( string $elemId)

Outputs the chart javascript into the page.

from  Chart
animation( array $animationConfig)

Set the animation options for a chart.

from  Chart
backgroundColor( array $backgroundColorConfig)

The background color for the main area of the chart.

from  Chart
chartArea( array $chartAreaConfig)

An object with members to configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends).

from  Chart
colors( array $colorArray)

The colors to use for the chart elements.

from  Chart
fontSize( integer $fontSize)

The default font size, in pixels, of all text in the chart.

from  Chart
fontName( string $fontName)

The default font face for all text in the chart.

from  Chart
height( int $height)

Height of the chart, in pixels.

from  Chart
legend( array $legendConfig)

An object with members to configure various aspects of the legend.

from  Chart
title( string $title)

Text to display above the chart.

from  Chart
titlePosition( string $titlePosition)

Where to place the chart title, compared to the chart area.

from  Chart
titleTextStyle( TextStyle $textStyle)

An array of options for defining the title text style.

from  Chart
tooltip( array $tooltip)

An object with members to configure various tooltip elements.

from  Chart
width( int $width)

Width of the chart, in pixels.

from  Chart
annotations( array $annotationConfig)

Defines how chart annotations will be displayed.

areaOpacity( float $areaOpacity)

The default opacity of the colored area under a chart series

axisTitlesPosition( string $position)

Where to place the axis titles, compared to the chart area.

barGroupWidth( int|string $barGroupWidth)

The width of a group of bars, specified in either of these formats: - Pixels (e.g. 50).

crosshair( array $crosshairConfig)

An array containing the crosshair properties for the chart.

curveType( string $curveType)

Controls the curve of the lines when the line width is not zero.

dataOpacity( float $dataOpacity)

The transparency of data points

enableInteractivity( boolean $enableInteractivity)

Whether the chart throws user-based events or reacts to user interaction.

focusTarget( string $focusTarget)

The type of the entity that receives focus on mouse hover.

forceIFrame( boolean $iframe)

Draws the chart inside an inline frame.

hAxis( array $horizontalAxisConfig)

An object with members to configure various horizontal axis elements.

interpolateNulls( boolean $interpolateNulls)

Whether to guess the value of missing points.

isStacked( bool|string $isStacked)

If set to true, stacks the elements for all series at each domain value.

lineWidth( integer $width)

Data line width in pixels.

orientation( boolean $orientation)

Sets the orientation of the chart.

pointShape( string $shape)

The shape of individual data elements.

pointSize( integer $size)

Diameter of displayed points in pixels.

reverseCategories( boolean $reverseCategories)

If set to true, will draw series from bottom to top.

selectionMode( string $selectionMode)

When selectionMode is 'multiple', users may select multiple data points.

series( array $seriesConfigArray)

An array of objects, each describing the format of the corresponding series in the chart.

theme( string $theme)

A theme is a set of predefined option values that work together to achieve a specific chart behavior or visual effect.

from  ThemeTrait
vAxes( array $vAxisConfigArray)

Specifies properties for individual vertical axes

vAxis( array $verticalAxisConfig)

An object with members to configure various vertical axis elements.

seriesType( string $seriesType)

The default line type for any series not specified in the series property.

Details

at line 125
__construct( Label $chartLabel, DataTable $datatable, array $config = array())

Builds a new ComboChart with the given label, datatable and options.

Parameters

Label $chartLabel Identifying label for the chart.
DataTable $datatable DataTable used for the chart.
array $config

in JsonConfig at line 64
mixed __get( string $option)

Get the value of a set option via magic method.

Parameters

string $option Name of option.

Return Value

mixed

Exceptions

InvalidConfigProperty

in JsonConfig at line 75
Options getOptions()

Gets the Options object for the JsonConfig

Return Value

Options

in JsonConfig at line 90
JsonConfig setOption( string $option, mixed $value)

Shortcut method to set the value of an option and return $this.

In order to maintain backwards compatibility, ConfigObjects will be unwrapped.

Parameters

string $option Option to set.
mixed $value Value of the option.

Return Value

JsonConfig

in JsonConfig at line 106
setOptions( array $config)

Parses the config array by passing the values through each method to check validity against if the option exists.

Parameters

array $config

Exceptions

InvalidConfigValue
InvalidConfigProperty

in JsonConfig at line 275
array jsonSerialize()

Custom serialization of the JsonConfig object.

Return Value

array

in Chart at line 111
string getType()

Returns the chart type.

Return Value

string

in Chart at line 122
bool hasEvents()

Checks if any events have been assigned to the chart.

Return Value

bool

in Chart at line 133
EventManager getEvents()

Retrieves the events if any have been assigned to the chart.

Return Value

EventManager

in Chart at line 145
Label getLabel()

Returns the chart label.

Return Value

Label

in Chart at line 164
Chart events( array $events)

Register javascript callbacks for specific events.

Set with an associative array where the keys are events and the values are the javascript callback functions.

Valid events are: [ animationfinish | error | onmouseover | onmouseout | ready | select | statechange ]

Parameters

array $events Array of events associated to a callback

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 196
Chart datatable( DataTable $datatable)

Assigns a datatable to use for the Chart.

Parameters

DataTable $datatable

Return Value

Chart

in Chart at line 221
Chart customize( array $optionArray)

Sets any configuration option, with no checks for type / validity

This is method was added in 2.5 as a bandaid to remove the handcuffs from users who want to add options that Google has added, that I have not. I didn't intend to restrict the user to only select options, as the goal was to type check and validate. This method can be used to set any option, just pass in arrays with key value pairs for any setting.

If the setting is an object, per the google docs, then use multi-dimensional arrays and they will be converted upon rendering.

Parameters

array $optionArray Array of customization options for the chart

Return Value

Chart

in Chart at line 234
DataTable getDataTable()

Returns the DataTable

Return Value

DataTable

Exceptions

DataTableNotFound

in Chart at line 251
string getDataTableJson()

Returns a JSON string representation of the datatable.

Return Value

string

Exceptions

DataTableNotFound

in Chart at line 271
string render( string $elemId)

Outputs the chart javascript into the page.

Pass in a string of the html elementID that you want the chart to be rendered into.

Parameters

string $elemId The id of an HTML element to render the chart into.

Return Value

string Javascript code blocks

Exceptions

InvalidElementId

in Chart at line 290
Chart animation( array $animationConfig)

Set the animation options for a chart.

Parameters

array $animationConfig Animation options

Return Value

Chart

in Chart at line 304
Chart backgroundColor( array $backgroundColorConfig)

The background color for the main area of the chart.

Can be a simple HTML color string, or hex code, for example: 'red' or '#00cc00'

Parameters

array $backgroundColorConfig Options for the chart's background color

Return Value

Chart

in Chart at line 321
Chart chartArea( array $chartAreaConfig)

An object with members to configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends).

Two formats are supported: a number, or a number followed by %. A simple number is a value in pixels; a number followed by % is a percentage.

Parameters

array $chartAreaConfig Options for the chart area.

Return Value

Chart

in Chart at line 338
Chart colors( array $colorArray)

The colors to use for the chart elements.

An array of strings, where each element is an HTML color string for example:['red','#004411']

Parameters

array $colorArray

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 362
Chart fontSize( integer $fontSize)

The default font size, in pixels, of all text in the chart.

You can override this using properties for specific chart elements.

Parameters

integer $fontSize

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 378
Chart fontName( string $fontName)

The default font face for all text in the chart.

You can override this using properties for specific chart elements.

Parameters

string $fontName

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 392
Chart height( int $height)

Height of the chart, in pixels.

Parameters

int $height

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 408
Chart legend( array $legendConfig)

An object with members to configure various aspects of the legend.

To specify properties of this object, pass in an array of valid options.

Parameters

array $legendConfig Options for the chart's legend.

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 422
Chart title( string $title)

Text to display above the chart.

Parameters

string $title

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 441
Chart titlePosition( string $titlePosition)

Where to place the chart title, compared to the chart area.

Supported values: 'in' - Draw the title inside the chart area. 'out' - Draw the title outside the chart area. 'none' - Omit the title.

Parameters

string $titlePosition

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 461
Chart titleTextStyle( TextStyle $textStyle)

An array of options for defining the title text style.

Parameters

TextStyle $textStyle

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 474
Chart tooltip( array $tooltip)

An object with members to configure various tooltip elements.

Parameters

array $tooltip Options for the tooltips

Return Value

Chart

Exceptions

InvalidConfigValue

in Chart at line 486
Chart width( int $width)

Width of the chart, in pixels.

Parameters

int $width

Return Value

Chart

Exceptions

InvalidConfigValue

in AnnotationsTrait at line 15
Chart annotations( array $annotationConfig)

Defines how chart annotations will be displayed.

Parameters

array $annotationConfig

Return Value

Chart

in AreaOpacityTrait at line 20
Chart areaOpacity( float $areaOpacity)

The default opacity of the colored area under a chart series

0.0 is fully transparent and 1.0 is fully opaque. To specify opacity for an individual series, set the areaOpacity value in the series property.

Parameters

float $areaOpacity

Return Value

Chart

Exceptions

InvalidConfigValue

Chart axisTitlesPosition( string $position)

Where to place the axis titles, compared to the chart area.

Supported values: in - Draw the axis titles inside the the chart area. out - Draw the axis titles outside the chart area. none - Omit the axis titles.

Parameters

string $position Accepted values [in|out|none]

Return Value

Chart

Exceptions

InvalidConfigValue

in BarGroupWidthTrait at line 20
Chart barGroupWidth( int|string $barGroupWidth)

The width of a group of bars, specified in either of these formats: - Pixels (e.g. 50).

  • Percentage of the available width for each group (e.g. '20%'), where '100%' means that groups have no space between them.

Parameters

int|string $barGroupWidth

Return Value

Chart

Exceptions

InvalidConfigValue

in CrosshairTrait at line 15
Chart crosshair( array $crosshairConfig)

An array containing the crosshair properties for the chart.

Parameters

array $crosshairConfig

Return Value

Chart

in CurveTypeTrait at line 18
Chart curveType( string $curveType)

Controls the curve of the lines when the line width is not zero.

Can be one of the following: 'none' - Straight lines without curve. 'function' - The angles of the line will be smoothed.

Parameters

string $curveType Accepted values [none|function]

Return Value

Chart

Exceptions

InvalidConfigValue

in DataOpacityTrait at line 19
Chart dataOpacity( float $dataOpacity)

The transparency of data points

1.0 being completely opaque and 0.0 fully transparent.

Parameters

float $dataOpacity

Return Value

Chart

Exceptions

InvalidConfigValue

Chart enableInteractivity( boolean $enableInteractivity)

Whether the chart throws user-based events or reacts to user interaction.

If false, the chart will not throw 'select' or other interaction-based events (but will throw ready or error events), and will not display hovertext or otherwise change depending on user input.

Parameters

boolean $enableInteractivity

Return Value

Chart

Exceptions

InvalidConfigValue

in FocusTargetTrait at line 26
Chart focusTarget( string $focusTarget)

The type of the entity that receives focus on mouse hover.

Also affects which entity is selected by mouse click, and which data table element is associated with events. Can be one of the following: 'datum' - Focus on a single data point. Correlates to a cell in the data table. 'category' - Focus on a grouping of all data points along the major axis. Correlates to a row in the data table.

In focusTarget 'category' the tooltip displays all the category values. This may be useful for comparing values of different series.

Parameters

string $focusTarget Accepted values [datum|category]

Return Value

Chart

Exceptions

InvalidConfigValue

in ForceIFrameTrait at line 16
Chart forceIFrame( boolean $iframe)

Draws the chart inside an inline frame.

Note that on IE8, this option is ignored; all IE8 charts are drawn in i-frames.

Parameters

boolean $iframe

Return Value

Chart

Exceptions

InvalidConfigValue

in HorizontalAxisTrait at line 18
Chart hAxis( array $horizontalAxisConfig)

An object with members to configure various horizontal axis elements.

To specify properties of this property, create a new HorizontalAxis object, set the values then pass it to this function or to the constructor.

Parameters

array $horizontalAxisConfig

Return Value

Chart

in InterpolateNullsTrait at line 18
Chart interpolateNulls( boolean $interpolateNulls)

Whether to guess the value of missing points.

If true, it will guess the value of any missing data based on neighboring points. If false, it will leave a break in the line at the unknown point.

Parameters

boolean $interpolateNulls

Return Value

Chart

Exceptions

InvalidConfigValue

in IsStackedTrait at line 51
Chart isStacked( bool|string $isStacked)

If set to true, stacks the elements for all series at each domain value.

Note: In Column, Area, and SteppedArea charts, Google Charts reverses the order of legend items to better correspond with the stacking of the series elements (E.g. series 0 will be the bottom-most legend item). This does not apply to Bar Charts.

The isStacked option also supports 100% stacking, where the stacks of elements at each domain value are rescaled to add up to 100%.

The options for isStacked are:

false — elements will not stack. This is the default option. true — stacks elements for all series at each domain value. 'percent' — stacks elements for all series at each domain value and rescales them such that they add up to 100%, with each element's value calculated as a percentage of 100%. 'relative' — stacks elements for all series at each domain value and rescales them such that they add up to 1, with each element's value calculated as a fraction of 1. 'absolute' — functions the same as isStacked: true.

For 100% stacking, the calculated value for each element will appear in the tooltip after its actual value.

The target axis will default to tick values based on the relative 0-1 scale as fractions of 1 for 'relative', and 0-100% for 'percent' (Note: when using the 'percent' option, the axis/tick values are displayed as percentages, however the actual values are the relative 0-1 scale values. This is because the percentage axis ticks are the result of applying a format of "#.##%" to the relative 0-1 scale values. When using isStacked: 'percent', be sure to specify any ticks/gridlines using the relative 0-1 scale values). You can customize the gridlines/tick values and formatting using the appropriate hAxis/vAxis options.

100% stacking only supports data values of type number, and must have a baseline of zero.

Parameters

bool|string $isStacked

Return Value

Chart

Exceptions

InvalidConfigValue

in LineWidthTrait at line 17
Chart lineWidth( integer $width)

Data line width in pixels.

Use zero to hide all lines and show only the points. You can override values for individual series using the series property.

Parameters

integer $width

Return Value

Chart

Exceptions

InvalidConfigValue

in OrientationTrait at line 17
Chart orientation( boolean $orientation)

Sets the orientation of the chart.

When set to 'vertical', rotates the axes of the chart so that (for instance) a column chart becomes a bar chart, and an area chart grows rightward instead of up

Parameters

boolean $orientation

Return Value

Chart

Exceptions

InvalidConfigValue

in PointShapeTrait at line 19
Chart pointShape( string $shape)

The shape of individual data elements.

'circle', 'triangle', 'square', 'diamond', 'star', or 'polygon'.

Parameters

string $shape Accepted values [circle|triangle|square|diamond|star|polygon]

Return Value

Chart

Exceptions

InvalidConfigValue

See also

https://developers.google.com/chart/interactive/docs/points

in PointSizeTrait at line 17
Chart pointSize( integer $size)

Diameter of displayed points in pixels.

Use zero to hide all points. You can override values for individual series using the series property.

Parameters

integer $size

Return Value

Chart

Exceptions

InvalidConfigValue

Chart reverseCategories( boolean $reverseCategories)

If set to true, will draw series from bottom to top.

The default is to draw top-to-bottom.

Parameters

boolean $reverseCategories

Return Value

Chart

Exceptions

InvalidConfigValue

in SelectionModeTrait at line 16
Chart selectionMode( string $selectionMode)

When selectionMode is 'multiple', users may select multiple data points.

Parameters

string $selectionMode Accepted values [single|multiple]

Return Value

Chart

Exceptions

InvalidConfigValue

in SeriesTrait at line 21
Chart series( array $seriesConfigArray)

An array of objects, each describing the format of the corresponding series in the chart.

To use default values for a series, specify an null in the array. If a series or a value is not specified, the global value will be used.

Parameters

array $seriesConfigArray Array of Series options.

Return Value

Chart

Exceptions

InvalidConfigValue

in ThemeTrait at line 26
Chart theme( string $theme)

A theme is a set of predefined option values that work together to achieve a specific chart behavior or visual effect.

Currently only one theme is available: 'maximized' - Maximizes the area of the chart, and draws the legend and all of the labels inside the chart area. Sets the following options:

chartArea: {width: '100%', height: '100%'}, legend: {position: 'in'}, titlePosition: 'in', axisTitlesPosition: 'in', hAxis: {textPosition: 'in'}, vAxis: {textPosition: 'in'}

Parameters

string $theme

Return Value

Chart

Exceptions

InvalidConfigValue

in VerticalAxesTrait at line 25
Chart vAxes( array $vAxisConfigArray)

Specifies properties for individual vertical axes

If the chart has multiple vertical axes. Each child object is a vAxis object, and can contain all the properties supported by vAxis. These property values override any global settings for the same property.

To specify a chart with multiple vertical axes, first define a new axis using series.targetAxisIndex, then configure the axis using vAxes.

Parameters

array $vAxisConfigArray Array of VerticalAxis configuration arrays

Return Value

Chart

Exceptions

InvalidConfigValue

in VerticalAxisTrait at line 18
Chart vAxis( array $verticalAxisConfig)

An object with members to configure various vertical axis elements.

To specify properties of this property, create a new VerticalAxis object, set the values then pass it to this function or to the constructor.

Parameters

array $verticalAxisConfig

Return Value

Chart

at line 143
ComboChart seriesType( string $seriesType)

The default line type for any series not specified in the series property.

Available values are: line, area, bars, candlesticks, and steppedArea

Parameters

string $seriesType

Return Value

ComboChart

Exceptions

InvalidConfigValue