DonutChart
class DonutChart extends PieChart (View source)
DonutChart Class
Alias for a pie chart with pieHolethat is rendered within the browser using SVG or VML. Displays tooltips when hovering over slices.
Constants
TYPE |
Javascript chart type.
|
VERSION |
Javascript chart version.
|
VIZ_PACKAGE |
Javascript chart package.
|
VIZ_CLASS |
Google's visualization class name.
|
Methods
Builds a new chart with the given label and DataTable.
Shortcut method to set the value of an option and return $this.
Parses the config array by passing the values through each method to check validity against if the option exists.
Sets any configuration option, with no checks for type / validity
The background color for the main area of the chart.
An object with members to configure the placement and size of the chart area (where the chart itself is drawn, excluding axis and legends).
An object with members to configure various aspects of the legend.
Where to place the chart title, compared to the chart area.
An array of slice objects, each describing the format of the corresponding slice in the pie.
The color of the slice borders. Only applicable when the chart is two-dimensional; is3D == false || null
The content of the text displayed on the slice. Can be one of the following:
An object that specifies the slice text style. create a new textStyle() object, set the values then pass it to this function or to the constructor.
The angle, in degrees, to rotate the chart by. The default of 0 will orient the leftmost edge of the first slice directly up.
If set to true, will draw slices counterclockwise. The default is to draw clockwise.
The slice relative part, below which a slice will not show individually.
Color for the combination slice that holds all slices below sliceVisibilityThreshold.
A label for the combination slice that holds all slices below sliceVisibilityThreshold.
If between 0 and 1, displays a donut chart.
Details
at line 69
__construct(
Label $chartLabel,
DataTable $datatable,
array $config = array())
Builds a new chart with the given label and DataTable.
in
JsonConfig at line 64
mixed
__get(
string $option)
Get the value of a set option via magic method.
in
JsonConfig at line 75
Options
getOptions()
Gets the Options object for the JsonConfig
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.
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.
in
JsonConfig at line 275
array
jsonSerialize()
Custom serialization of the JsonConfig object.
in
Chart at line 111
string
getType()
Returns the chart type.
in
Chart at line 122
bool
hasEvents()
Checks if any events have been assigned to the chart.
in
Chart at line 133
EventManager
getEvents()
Retrieves the events if any have been assigned to the chart.
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 ]
in
Chart at line 196
Chart
datatable(
DataTable $datatable)
Assigns a datatable to use for the 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.
in
Chart at line 251
string
getDataTableJson()
Returns a JSON string representation of the datatable.
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.
in
Chart at line 290
Chart
animation(
array $animationConfig)
Set the animation options for a 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'
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.
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']
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.
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.
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.
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.
in
Chart at line 461
Chart
titleTextStyle(
TextStyle $textStyle)
An array of options for defining the title text style.
in
Chart at line 474
Chart
tooltip(
array $tooltip)
An object with members to configure various tooltip elements.
in
PieChart at line 97
PieChart
is3D(
bool $is3D)
If set to true, displays a three-dimensional chart.
in
PieChart at line 118
PieChart
slices(
array $slices)
An array of slice objects, each describing the format of the corresponding slice in the pie.
To use default values for a slice, specify a null. If a slice or a value is not specified, the global value will be used.
The values of the array keys will correspond to each numbered piece of the pie, starting from 0. You can skip slices by assigning the keys of the array as (int)s.
in
PieChart at line 145
PieChart
pieSliceBorderColor(
string $pieSliceBorderColor)
The color of the slice borders. Only applicable when the chart is two-dimensional; is3D == false || null
in
PieChart at line 163
PieChart
pieSliceText(
string $pieSliceText)
The content of the text displayed on the slice. Can be one of the following:
'percentage' - The percentage of the slice size out of the total. 'value' - The quantitative value of the slice. 'label' - The name of the slice. 'none' - No text is displayed.
in
PieChart at line 183
PieChart
pieSliceTextStyle(
array $textStyleConfig)
An object that specifies the slice text style. create a new textStyle() object, set the values then pass it to this function or to the constructor.
in
PieChart at line 196
PieChart
pieStartAngle(
int $pieStartAngle)
The angle, in degrees, to rotate the chart by. The default of 0 will orient the leftmost edge of the first slice directly up.
in
PieChart at line 209
PieChart
reverseCategories(
bool $reverseCategories)
If set to true, will draw slices counterclockwise. The default is to draw clockwise.
in
PieChart at line 224
PieChart
sliceVisibilityThreshold(
integer|float $sliceVizThreshold)
The slice relative part, below which a slice will not show individually.
All slices that have not passed this threshold will be combined to a single slice, whose size is the sum of all their sizes. Default is not to show individually any slice which is smaller than half a degree.
in
PieChart at line 237
PieChart
pieResidueSliceColor(
string $pieResidueSliceColor)
Color for the combination slice that holds all slices below sliceVisibilityThreshold.
in
PieChart at line 250
PieChart
pieResidueSliceLabel(
string $pieResidueSliceLabel)
A label for the combination slice that holds all slices below sliceVisibilityThreshold.
at line 89
DonutChart
pieHole(
integer|float $pieHole)
If between 0 and 1, displays a donut chart.
The hole with have a radius equal to $pieHole times the radius of the chart.