TreeMap
class TreeMap extends Chart (View source)
TreeMap Chart Class
A visual representation of a data tree, where each node can have zero or more children, and one parent (except for the root, which has no parents). Each node is displayed as a rectangle, sized and colored according to values that you assign. Sizes and colors are valued relative to all other nodes in the graph. You can specify how many levels to display simultaneously, and optionally to display deeper levels in a hinted fashion. If a node is a leaf node, you can specify a size and color; if it is not a leaf, it will be displayed as a bounding box for leaf nodes. The default behavior is to move down the tree when a user left-clicks a node, and to move back up the tree when a user right-clicks the graph.
The total size of the graph is determined by the size of the containing element that you insert in your page. If you have leaf nodes with names too long to show, the name will be truncated with an ellipsis (...).
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 TreeMapChart with the given label, datatable and options.
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.
The color of the header section for each node. Specify an HTML color value.
The height of the header section for each node, in pixels (can be zero).
The color of the header of a node being hovered over. Specify an HTML color value or null; if null this value will be headerColor lightened by 35%
The color for a rectangle with a column 3 value of maxColorValue.
The maximum number of node levels to show in the current view. Levels will be flattened into the current plane. If your tree has more levels than this, you will have to go up or down to see them. You can additionally see maxPostDepth levels below this as shaded rectangles within these nodes.
The highlight color to use for the node with the largest value in column 3. Specify an HTML color value or null; If null, this value will be the value of maxColor lightened by 35%.
How many levels of nodes beyond maxDepth to show in "hinted" fashion.
The maximum value allowed in column 3. All values greater than this will be trimmed to this value. If set to null, it will be set to the max value in the column.
The color for a rectangle with a column 3 value midway between maxColorValue and minColorValue. Specify an HTML color value.
The highlight color to use for the node with a column 3 value near the median of minColorValue and maxColorValue. Specify an HTML color value or null; if null, this value will be the value of midColor lightened by 35%.
The color for a rectangle with the column 3 value of minColorValue.
The highlight color to use for the node with a column 3 value nearest to minColorValue. Specify an HTML color value or null; if null, this value will be the value of minColor lightened by 35%.
The minimum value allowed in column 3. All values less than this will be trimmed to this value. If set to null, it will be calculated as the minimum value in the column.
The color to use for a rectangle when a node has no value for column 3, and that node is a leaf (or contains only leaves). Specify an HTML color value.
The color to use for a rectangle of "no" color when highlighted. Specify an HTML color value or null; if null, this will be the value of noColor lightened by 35%.
Whether or not to show a color gradient scale from minColor to maxColor along the top of the chart. Specify true to show the scale.
Whether or not to show tooltips.
The font family to use for all text.
Details
at line 100
__construct(
Label $chartLabel,
DataTable $datatable,
array $config = array())
Builds a new TreeMapChart with the given label, datatable and options.
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']
at line 349
Chart
fontSize(
integer $fontSize)
The font size for all text, in points.
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.
at line 113
TreeMap
headerColor(
string $headerColor)
The color of the header section for each node. Specify an HTML color value.
at line 124
TreeMap
headerHeight(
integer $headerHeight)
The height of the header section for each node, in pixels (can be zero).
at line 137
TreeMap
headerHighlightColor(
string $headerHighlightColor)
The color of the header of a node being hovered over. Specify an HTML color value or null; if null this value will be headerColor lightened by 35%
at line 149
TreeMap
maxColor(
string $maxColor)
The color for a rectangle with a column 3 value of maxColorValue.
Specify an HTML color value.
at line 164
TreeMap
maxDepth(
integer $maxDepth)
The maximum number of node levels to show in the current view. Levels will be flattened into the current plane. If your tree has more levels than this, you will have to go up or down to see them. You can additionally see maxPostDepth levels below this as shaded rectangles within these nodes.
at line 177
TreeMap
maxHighlightColor(
string $maxHighlightColor)
The highlight color to use for the node with the largest value in column 3. Specify an HTML color value or null; If null, this value will be the value of maxColor lightened by 35%.
at line 190
TreeMap
maxPostDepth(
integer $maxPostDepth)
How many levels of nodes beyond maxDepth to show in "hinted" fashion.
Hinted nodes are shown as shaded rectangles within a node that is within the maxDepth limit.
at line 203
TreeMap
maxColorValue(
integer $maxColorValue)
The maximum value allowed in column 3. All values greater than this will be trimmed to this value. If set to null, it will be set to the max value in the column.
at line 215
TreeMap
midColor(
string $midColor)
The color for a rectangle with a column 3 value midway between maxColorValue and minColorValue. Specify an HTML color value.
at line 229
TreeMap
midHighlightColor(
string $midHighlightColor)
The highlight color to use for the node with a column 3 value near the median of minColorValue and maxColorValue. Specify an HTML color value or null; if null, this value will be the value of midColor lightened by 35%.
at line 241
TreeMap
minColor(
string $minColor)
The color for a rectangle with the column 3 value of minColorValue.
Specify an HTML color value.
at line 254
TreeMap
minHighlightColor(
string $minHighlightColor)
The highlight color to use for the node with a column 3 value nearest to minColorValue. Specify an HTML color value or null; if null, this value will be the value of minColor lightened by 35%.
at line 267
TreeMap
minColorValue(
integer $minColorValue)
The minimum value allowed in column 3. All values less than this will be trimmed to this value. If set to null, it will be calculated as the minimum value in the column.
at line 280
TreeMap
noColor(
string $noColor)
The color to use for a rectangle when a node has no value for column 3, and that node is a leaf (or contains only leaves). Specify an HTML color value.
at line 293
TreeMap
noHighlightColor(
string $noHighlightColor)
The color to use for a rectangle of "no" color when highlighted. Specify an HTML color value or null; if null, this will be the value of noColor lightened by 35%.
at line 305
TreeMap
showScale(
bool $showScale)
Whether or not to show a color gradient scale from minColor to maxColor along the top of the chart. Specify true to show the scale.
at line 316
TreeMap
showTooltips(
bool $showTooltips)
Whether or not to show tooltips.
at line 327
TreeMap
fontColor(
string $fontColor)
The text color. Specify an HTML color value.
at line 338
TreeMap
fontFamily(
string $fontFamily)
The font family to use for all text.