BarChart
class BarChart extends Chart (View source)
Properties
$type | |||
$label | from Chart | ||
$datatable | from Chart | ||
$deferedRender | from Chart |
Methods
Builds a new chart with a label.
Sets any configuration option, with no checks for type / validity
The background color for the main area of the chart. Can be either a simple HTML color string, for example: 'red' or '#00cc00', or a backgroundColor object
An object with members to configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends).
The colors to use for the chart elements. An array of strings, where each element is an HTML color string, for example: colors:['red','#004411'].
Set up the chart with no datatable to defer rendering via AJAX
The default font size, in pixels, of all text in the chart. You can override this using properties for specific chart elements.
The default font face for all text in the chart. You can override this using properties for specific chart elements.
An object with members to configure various aspects of the legend. To specify properties of this object, create a new legend() object, set the values then pass it to this function or to the constructor.
Where to place the chart title, compared to the chart area. Supported values: 'in' - Draw the title inside the chart area.
An object that specifies the title text style. create a new textStyle() object, set the values then pass it to this function or to the constructor.
An object with members to configure various tooltip elements. To specify properties of this object, create a new tooltip() object, set the values then pass it to this function or to the constructor.
Defines how chart annotations will be displayed.
Where to place the axis titles, compared to the chart area. Supported values: in - Draw the axis titles inside the the chart area.
The width of a group of bars, specified in either of these formats: - Pixels (e.g. 50).
The transparency of data points, with 1.0 being completely opaque and 0.0 fully transparent.
Whether the chart throws user-based events or reacts to user interaction.
The type of the entity that receives focus on mouse hover.
Draws the chart inside an inline frame.
Specifies properties for individual horizontal axes, if the chart has multiple horizontal axes.
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.
No description
If set to true, will draw series from bottom to top. The default is to draw top-to-bottom.
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.
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:
Details
at line 30
__construct(
string $chartLabel)
Builds a new chart with a label.
in
Chart at line 87
this
customize(
array $optionArray)
Sets any configuration option, with no checks for type / validity
This is more or less 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.
This method will most likely be brought into 3.0 to prevent BC breaks, but I will incorporate the same functionality without the need for the extra customize() method call.
in
Chart at line 136
Chart
setOptions(
array $o)
Sets configuration options from array of values
You can set the options all at once instead of passing them individually or chaining the functions from the chart objects.
in
Chart at line 164
array
getOptions()
Gets the current chart options.
in
Chart at line 176
mixed
getOption(
string $o)
Gets a specific option from the array.
in
Chart at line 194
bool
hasEvents()
Checks if any events have been assigned to the chart.
in
Chart at line 204
bool
getEvents()
Checks if any events have been assigned to the chart.
in
Chart at line 215
string
getDataTableJson()
Returns a JSON string representation of the datatable.
in
Chart at line 229
Chart
backgroundColor(
BackgroundColor $bc)
The background color for the main area of the chart. Can be either a simple HTML color string, for example: 'red' or '#00cc00', or a backgroundColor object
in
Chart at line 245
Chart
chartArea(
ChartArea $ca)
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.
in
Chart at line 259
Chart
colors(
array $cArr)
The colors to use for the chart elements. An array of strings, where each element is an HTML color string, for example: colors:['red','#004411'].
in
Chart at line 285
Chart
datatable(
DataTable $d)
Assigns wich Datatable will be used for this Chart.
If a label is provided then the defined Datatable will be used. If called with no argument, or the chart is attempted to be generated without calling this function, the chart will search for a Datatable with the same label as the Chart.
in
Chart at line 301
void
deferedRender(
bool $dr)
Set up the chart with no datatable to defer rendering via AJAX
in
Chart at line 327
Chart
events(
array $e)
Register javascript callbacks for specific events.
Valid values include: [ animationfinish | error | onmouseover | onmouseout | ready | select ] associated to a respective pre-defined javascript function as the callback.
in
Chart at line 368
Chart
fontSize(
int $fs)
The default font size, in pixels, of all text in the chart. You can override this using properties for specific chart elements.
in
Chart at line 389
Chart
fontName(
string $fn)
The default font face for all text in the chart. You can override this using properties for specific chart elements.
in
Chart at line 432
Chart
legend(
Legend $l)
An object with members to configure various aspects of the legend. To specify properties of this object, create a new legend() object, set the values then pass it to this function or to the constructor.
in
Chart at line 442
string
optionsToJson()
Returns a JSON string representation of the chart's properties.
in
Chart at line 459
string
render(
string $ei)
Outputs the chart javascript into the page
Pass in a string of the html elementID that you want the chart to be rendered into.
in
Chart at line 497
Chart
titlePosition(
string $tp)
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.
in
Chart at line 526
Chart
titleTextStyle(
TextStyle $ts)
An object that specifies the title text style. create a new textStyle() object, set the values then pass it to this function or to the constructor.
in
Chart at line 542
Chart
tooltip(
Tooltip $t)
An object with members to configure various tooltip elements. To specify properties of this object, create a new tooltip() object, set the values then pass it to this function or to the constructor.
at line 77
BarChart
annotations(
Annotation $a)
Defines how chart annotations will be displayed.
at line 93
BarChart
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.
at line 123
BarChart
barGroupWidth(
mixed $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.
at line 144
BarChart
dataOpacity(
float $do)
The transparency of data points, with 1.0 being completely opaque and 0.0 fully transparent.
at line 169
BarChart
enableInteractivity(
bool $ei)
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.
at line 198
BarChart
focusTarget(
string $ft)
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.
at line 226
BarChart
forceIFrame(
bool $iframe)
Draws the chart inside an inline frame.
Note that on IE8, this option is ignored; all IE8 charts are drawn in i-frames.
at line 254
ComboChart
hAxes(
array $arr)
Specifies properties for individual horizontal axes, if the chart has multiple horizontal axes.
Each child object is a hAxis object, and can contain all the properties supported by hAxis. These property values override any global settings for the same property.
To specify a chart with multiple horizontal axes, first define a new axis using series.targetAxisIndex, then configure the axis using hAxes.
at line 278
BarChart
hAxis(
HorizontalAxis $ha)
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.
at line 285
orientation($o)
at line 311
BarChart
isStacked(
bool $is)
If set to true, series elements are stacked.
at line 332
BarChart
reverseCategories(
bool $rc)
If set to true, will draw series from bottom to top. The default is to draw top-to-bottom.
at line 355
BarChart
series(
array $arr)
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.
at line 384
BarChart
theme(
string $t)
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'}
at line 418
BarChart
vAxes(
array $arr)
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.
at line 442
BarChart
vAxis(
VerticalAxis $va)
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.