ui.ServerChart Extends goog.ui.Component
Will construct a chart using Google's chartserver.

Inheritance

Constructor

goog.ui.ServerChart(typeopt_widthopt_heightopt_domHelperopt_uri)

Parameters

type :
goog.ui.ServerChart.ChartType
The chart type.
opt_width :
(number | undefined)
The width of the chart.
opt_height :
(number | undefined)
The height of the chart.
opt_domHelper :
(goog.dom.DomHelper | null | undefined)
Optional DOM Helper.
opt_uri :
(string | undefined)
Optional uri used to connect to the chart server, if different than goog.ui.ServerChart.CHART_SERVER_SCHEME_INDEPENDENT_URI.

Instance Methods

Public Protected Private
addDataSet(datacoloropt_legendText)
Adds a data set. NOTE: The color string should NOT have a '#' at the beginning of it.
Arguments:
data :
(Array.<(null | number)> | null)
An array of numbers (values can be NaN or null).
color :
The hex value for this data set's color.
opt_legendText :
(string | undefined)
The legend text, if any, for this data series. NOTE: If specified, all previously added data sets must also have a legend text.
code »
addMultiAxis(axisType)
Adds a multi-axis to the chart, and sets its type. Multiple axes of the same type can be added.
Arguments:
axisType :
goog.ui.ServerChart.MultiAxisType.<string>
The desired axis type.
Returns:   The index of the newly inserted axis, suitable for feeding to the setMultiAxis*() functions.
code »
arrayMax_(ary)
Finds the maximum value in an array and returns it. Needed because Math.max does not handle sparse arrays the way we want.
Arguments:
ary :
(Array.<(null | number)> | null)
An array of values.
Returns:   The maximum value.
code »
arrayMin_(ary)
Finds the minimum value in an array and returns it. Needed because Math.min does not handle sparse arrays the way we want.
Arguments:
ary :
(Array.<(null | number)> | null)
An array of values.
Returns:   The minimum value.
code »
clearDataSets()
Clears the data sets from the graph. All data, including the colors and legend text, is cleared.
code »
computeDataStringForEncoding_(encoding)
Computes the data string using the data in this.dataSets_ and the encoding specified by the encoding parameter, which must not be AUTOMATIC, and sets the object's URI accordingly.
Arguments:
encoding :
goog.ui.ServerChart.EncodingType.<string>
The data encoding to use; must not be AUTOMATIC.
Returns:   False if the resulting URI is too long.
code »
computeDataString_()
Computes the data string using the data in this.dataSets_ and sets the object's URI accordingly. If the URI's length equals or exceeds the limit, goog.ui.ServerChart.UriTooLongEvent is dispatched on the goog.ui.ServerChart object.
code »
computeMultiAxisDataString_(dataindexSeparatorelementSeparatoraxisSeparator)
Computes a multi-axis data string from the given data and separators. The general data format for each index/element in the array will be "", with axisSeparator used between multiple elements.
Arguments:
data :
(Object | null)
The data to compute the data string for, as a sparse array of arrays. NOTE: The function uses the length of multiAxisType_ to determine the upper bound for the outer array.
indexSeparator :
The separator string inserted between each index and the data itself, commonly a comma (,).
elementSeparator :
The separator string inserted between each element inside each sub-array in the data, if there are more than one; commonly a comma (,).
axisSeparator :
The separator string inserted between each axis specification, if there are more than one; usually a pipe sign (|).
Returns:   The multi-axis data string.
code »
createDom()
Creates the DOM node (image) needed for the Chart
code »
decorateInternal(img)
Decorate an image already in the DOM. Expects the following structure:
- img
Arguments:
img :
(Element | null)
Image to decorate.
code »
disposeInternal()
No description.
code »
getBackgroundFill()
(Array.<(Object | null)> | null)
Returns the background fill.
Returns: 
(Array.<(Object | null)> | null)
  An array of background fill specifications. If the fill specification string is in an unsupported format, the method returns an empty array.
code »
getChartServerValues_(valuesminValuemaxValueencoding)
Creates the chd string for chartserver.
Arguments:
values :
(Array.<number> | null)
An array of numbers to graph.
minValue :
The minimum value (used for normalization).
maxValue :
The maximum value (used for normalization).
encoding :
goog.ui.ServerChart.EncodingType.<string>
The data encoding to use; must not be AUTOMATIC.
Returns:   The chd string for chartserver.
code »
getConvertedValue_(valueminValuemaxValueencoding)
Converts a single number to an encoded data value suitable for ChartServer. The TEXT encoding is the number in decimal; the SIMPLE encoding is a single character, and the EXTENDED encoding is two characters. See http://code.google.com/apis/chart/docs/data_formats.html for the detailed specification of these encoding formats.
Arguments:
value :
(null | number)
The value to convert (null for a missing data point).
minValue :
The minimum value (used for normalization).
maxValue :
The maximum value (used for normalization).
encoding :
goog.ui.ServerChart.EncodingType.<string>
The data encoding to use; must not be AUTOMATIC.
Returns:   The encoded data value.
code »
getData(opt_setNumber)
(Array | null)
Returns the given data set or all of them in a two-dimensional array if the set number is not given.
Arguments:
opt_setNumber :
(number | undefined)
Optional data set number to get.
Returns: 
(Array | null)
  The given data set or all of them in a two-dimensional array if the set number is not given.
code »
getEncodingType()
goog.ui.ServerChart.EncodingType.<string>
Gets the encoding type.
Returns: 
goog.ui.ServerChart.EncodingType.<string>
  The encoding type.
code »
getGridParameter()
(string | undefined)
Returns the 'chg' parameter of the chart Uri. This is used by various types of charts to specify Grids.
Returns: 
(string | undefined)
  The 'chg' parameter of the chart Uri.
code »
getGridX()
No description.
Returns:   The number of gridlines along the X-axis.
code »
getGridY()
No description.
Returns:   The number of gridlines along the Y-axis.
code »
getLeftLabels()
(Array.<string> | null)
No description.
Returns: 
(Array.<string> | null)
  The Left Labels for the chart.
code »
getLegendPosition()
goog.ui.ServerChart.LegendPosition.<string>
Returns the position relative to the chart where the legend is to be displayed.
Returns: 
goog.ui.ServerChart.LegendPosition.<string>
  Legend position.
code »
getMarkerParameter()
(string | undefined)
Returns the 'chm' parameter of the chart Uri. This is used by various types of charts to specify Markers.
Returns: 
(string | undefined)
  The 'chm' parameter of the chart Uri.
code »
getMaxValue()
No description.
Returns:   The maximum value of the chart.
code »
getMinValue()
No description.
Returns:   The minimum value of the chart.
code »
getMiscParameter()
(string | undefined)
Returns the 'chp' parameter of the chart Uri. This is used by various types of charts to specify certain options. e.g., finance charts use this to designate which line is the 0 axis.
Returns: 
(string | undefined)
  The 'chp' parameter of the chart Uri.
code »
getMultiAxisLabelPosition(opt_axisNumber)
(Object | null)
Returns the label positions for a given axis number, or all of them in a two-dimensional array if the axis number is not given.
Arguments:
opt_axisNumber :
(number | undefined)
The axis index, as returned by addMultiAxis.
Returns: 
(Object | null)
  The label positions for a given axis number, or all of them in a two-dimensional array if the axis number is not given.
code »
getMultiAxisLabelStyle(opt_axisNumber)
(Object | null)
Returns the label style for a given axis number as a one- to three-element array, or all of them in a two-dimensional array if the axis number is not given.
Arguments:
opt_axisNumber :
(number | undefined)
The axis index, as returned by addMultiAxis.
Returns: 
(Object | null)
  The label style for a given axis number as a one- to three-element array, or all of them in a two-dimensional array if the axis number is not given.
code »
getMultiAxisLabelText(opt_axisNumber)
(Object | null)
Returns the label text, or all of them in a two-dimensional array if the axis number is not given.
Arguments:
opt_axisNumber :
(number | undefined)
The axis index, as returned by addMultiAxis.
Returns: 
(Object | null)
  The label text, or all of them in a two-dimensional array if the axis number is not given.
code »
getMultiAxisRange(opt_axisNumber)
(Object | null)
Returns the label range for a given axis number as a two-element array of (range start, range end), or all of them in a two-dimensional array if the axis number is not given.
Arguments:
opt_axisNumber :
(number | undefined)
The axis index, as returned by addMultiAxis.
Returns: 
(Object | null)
  The label range for a given axis number as a two-element array of (range start, range end), or all of them in a two-dimensional array if the axis number is not given.
code »
getMultiAxisType(opt_axisNumber)
(Array.<goog.ui.ServerChart.MultiAxisType.<string>> | goog.ui.ServerChart.MultiAxisType.<string> | null)
Returns the axis type for the given axis, or all of them in an array if the axis number is not given.
Arguments:
opt_axisNumber :
(number | undefined)
The axis index, as returned by addMultiAxis.
Returns: 
(Array.<goog.ui.ServerChart.MultiAxisType.<string>> | goog.ui.ServerChart.MultiAxisType.<string> | null)
  The axis type for the given axis, or all of them in an array if the axis number is not given.
code »
getNumVisibleDataSets()
(null | number)
Returns the number of "visible" data sets. All data sets that come after the visible data set are not drawn as part of the chart. Instead, they are available for positioning markers.
Returns: 
(null | number)
  The number of visible data sets, or null if all data sets are visible.
code »
getRightLabels()
(Array.<string> | null)
No description.
Returns: 
(Array.<string> | null)
  The Right Labels for the chart.
code »
getSize()
(Array.<string> | null)
Returns the chart size.
Returns: 
(Array.<string> | null)
  [Width, Height].
code »
getTitleColor()
No description.
Returns:   color The hex value for the title color.
code »
getTitleSize()
No description.
Returns:   size The title size, in points.
code »
getType()
goog.ui.ServerChart.ChartType.<string>
Returns the chart type.
Returns: 
goog.ui.ServerChart.ChartType.<string>
  The chart type.
code »
getUri()
(goog.Uri | null)
Returns the URI of the chart.
Returns: 
(goog.Uri | null)
  The chart URI.
code »
getUriLengthLimit()
Returns the upper limit on the length of the chart image URI, after encoding. If the URI's length equals or exceeds it, goog.ui.ServerChart.UriTooLongEvent is dispatched on the goog.ui.ServerChart object.
Returns:   The chart URI length limit.
code »
getXLabels()
(Array.<string> | null)
No description.
Returns: 
(Array.<string> | null)
  The X Labels for the chart.
code »
isBarChart()
No description.
Returns:   Whether the chart is a bar chart.
code »
isGroupedBarChart()
No description.
Returns:   Whether the chart is a grouped bar chart.
code »
isHorizontalBarChart()
No description.
Returns:   Whether the chart is a horizontal bar chart.
code »
isLineChart()
No description.
Returns:   Whether the chart is a line chart.
code »
isMap()
No description.
Returns:   Whether the chart is a map.
code »
isPieChart()
No description.
Returns:   Whether the chart is a pie chart.
code »
isStackedBarChart()
No description.
Returns:   Whether the chart is a stacked bar chart.
code »
isVerticalBarChart()
No description.
Returns:   Whether the chart is a vertical bar chart.
code »
removeParameter(key)
Removes the given ChartServer parameter.
Arguments:
key :
goog.ui.ServerChart.UriParam.<string>
The ChartServer parameter to remove.
code »
setAutomaticBarWidth(opt_spaceBarsopt_spaceGroups)
Specifies that the bar width in a bar chart should be calculated automatically given the space available in the chart, while optionally setting the spaces between the bars. NOTE: If the space between groups is specified but the space between bars is left undefined, the space between groups will be interpreted as the space between bars because this is the behavior exposed in the external developers guide.
Arguments:
opt_spaceBars :
(number | undefined)
The width of the space between bars in a group in pixels.
opt_spaceGroups :
(number | undefined)
The width of the space between groups.
code »
setBackgroundFill(fill)
Sets the background fill.
Arguments:
fill :
(Array.<(Object | null)> | null)
An array of background fill specification objects. Each object may have the following properties: {string} area The area to fill, either &#39;bg&#39; for background or &#39;c&#39; for chart area. The default is &#39;bg&#39;. {string} color (required) The color of the background fill. // TODO(user): Add support for gradient/stripes, which requires // a different object structure.
code »
setBarSpaceWidths(barWidthopt_spaceBarsopt_spaceGroups)
Sets the widths of the bars and the spaces between the bars in a bar chart. NOTE: If the space between groups is specified but the space between bars is left undefined, the space between groups will be interpreted as the space between bars because this is the behavior exposed in the external developers guide.
Arguments:
barWidth :
The width of a bar in pixels.
opt_spaceBars :
(number | undefined)
The width of the space between bars in a group in pixels.
opt_spaceGroups :
(number | undefined)
The width of the space between groups.
code »
setDataScaling(minimummaximum)
Sets the data scaling. NOTE: This also changes the encoding type because data scaling will only work with goog.ui.ServerChart.EncodingType.TEXT encoding.
Arguments:
minimum :
The lowest number to apply to the data.
maximum :
The highest number to apply to the data.
code »
setEncodingType(type)
Sets the encoding type.
Arguments:
type :
goog.ui.ServerChart.EncodingType.<string>
Desired data encoding type.
code »
setGridParameter(value)
Sets the 'chg' parameter of the chart Uri. This is used by various types of charts to specify Grids.
Arguments:
value :
Value for the 'chg' parameter in the chart Uri.
code »
setGridX(gridlines)
Sets the number of grid lines along the X-axis.
Arguments:
gridlines :
The number of X-axis grid lines.
code »
setGridY(gridlines)
Sets the number of grid lines along the Y-axis.
Arguments:
gridlines :
The number of Y-axis grid lines.
code »
setGrids_(xy)
Sets the grids for the chart
Arguments:
x :
The number of grid lines along the x-axis.
y :
The number of grid lines along the y-axis.
code »
setLeftLabels(labels)
Sets the Left Labels for the chart. NOTE: The array should start with the lowest value, and then move progessively up the axis. So if you want labels from 0 to 100 with 0 at bottom of the graph, then you would want to pass something like [0,25,50,75,100].
Arguments:
labels :
(Array.<string> | null)
The Left Labels for the chart.
code »
setLegend(legend)
Adds a legend to the chart.
Arguments:
legend :
(Array.<string> | null)
The legend to add.
code »
setLegendPosition(value)
Sets the position relative to the chart where the legend is to be displayed.
Arguments:
value :
goog.ui.ServerChart.LegendPosition.<string>
Legend position.
code »
setMargins(leftMarginrightMargintopMarginbottomMargin)
Sets the chart margins.
Arguments:
leftMargin :
The size in pixels of the left margin.
rightMargin :
The size in pixels of the right margin.
topMargin :
The size in pixels of the top margin.
bottomMargin :
The size in pixels of the bottom margin.
code »
setMarkerParameter(value)
Sets the 'chm' parameter of the chart Uri. This is used by various types of charts to specify Markers.
Arguments:
value :
Value for the 'chm' parameter in the chart Uri.
code »
setMaxValue(maxValue)
Sets the maximum value of the chart.
Arguments:
maxValue :
The maximum value of the chart.
code »
setMinValue(minValue)
Sets the minimum value of the chart.
Arguments:
minValue :
The minimum value of the chart.
code »
setMiscParameter(value)
Sets the 'chp' parameter of the chart Uri. This is used by various types of charts to specify certain options. e.g., finance charts use this to designate which line is the 0 axis.
Arguments:
value :
Value for the 'chp' parameter in the chart Uri.
code »
setMultiAxisLabelPosition(axisNumberlabelPosition)
Sets the label positions for a given axis, overwriting any existing values. The label positions are assumed to be floating-point numbers within the range of the axis.
Arguments:
axisNumber :
The axis index, as returned by addMultiAxis.
labelPosition :
(Array.<number> | null)
The actual label positions to be added.
code »
setMultiAxisLabelStyle(axisNumbercoloropt_fontSizeopt_alignmentopt_axisDisplay)
Sets the label style for a given axis, overwriting any existing style. The default style is as follows: Default is x-axis labels are centered, left hand y-axis labels are right aligned, right hand y-axis labels are left aligned. The font size and alignment are optional parameters. NOTE: The color string should NOT have a '#' at the beginning of it.
Arguments:
axisNumber :
The axis index, as returned by addMultiAxis.
color :
The hex value for this label's color.
opt_fontSize :
(number | undefined)
The label font size, in pixels.
opt_alignment :
(goog.ui.ServerChart.MultiAxisAlignment.<number> | undefined)
The label alignment.
opt_axisDisplay :
(goog.ui.ServerChart.AxisDisplayType.<string> | undefined)
The axis line and ticks.
code »
setMultiAxisLabelText(axisNumberlabelText)
Sets the label text (usually multiple values) for a given axis, overwriting any existing values.
Arguments:
axisNumber :
The axis index, as returned by addMultiAxis.
labelText :
(Array.<string> | null)
The actual label text to be added.
code »
setMultiAxisRange(axisNumberrangeStartrangeEndopt_interval)
Sets the label range for a given axis, overwriting any existing range. The default range is from 0 to 100. If the start value is larger than the end value, the axis direction is reversed. rangeStart and rangeEnd must be two different finite numbers.
Arguments:
axisNumber :
The axis index, as returned by addMultiAxis.
rangeStart :
The new start of the range.
rangeEnd :
The new end of the range.
opt_interval :
(number | undefined)
The interval between axis labels.
code »
setNumVisibleDataSets(n)
Sets the number of "visible" data sets. All data sets that come after the visible data set are not drawn as part of the chart. Instead, they are available for positioning markers.
Arguments:
n :
(null | number)
The number of visible data sets, or null if all data sets are to be visible.
code »
setParameterValue(keyvalue)
Sets the given ChartServer parameter.
Arguments:
key :
goog.ui.ServerChart.UriParam.<string>
The ChartServer parameter to set.
value :
The value to set for the ChartServer parameter.
code »
setRightLabels(labels)
Sets the Right Labels for the chart. NOTE: The array should start with the lowest value, and then move progessively up the axis. So if you want labels from 0 to 100 with 0 at bottom of the graph, then you would want to pass something like [0,25,50,75,100].
Arguments:
labels :
(Array.<string> | null)
The Right Labels for the chart.
code »
setSize(opt_widthopt_height)
Sets the chart size.
Arguments:
opt_width :
(number | undefined)
Optional chart width, defaults to 300.
opt_height :
(number | undefined)
Optional chart height, defaults to 150.
code »
setTitle(title)
Sets the title of the chart.
Arguments:
title :
The chart title.
code »
setTitleColor(color)
Sets the color of the chart title. NOTE: The color string should NOT have a '#' at the beginning of it.
Arguments:
color :
The hex value for the title color.
code »
setTitleSize(size)
Sets the size of the chart title.
Arguments:
size :
The title size, in points.
code »
setType(type)
Sets the chart type.
Arguments:
type :
goog.ui.ServerChart.ChartType.<string>
The desired chart type.
code »
setUri(uri)
Sets the URI of the chart.
Arguments:
uri :
(goog.Uri | null)
The chart URI.
code »
setUriLengthLimit(uriLengthLimit)
Sets the upper limit on the length of the chart image URI, after encoding. If the URI's length equals or exceeds it, goog.ui.ServerChart.UriTooLongEvent is dispatched on the goog.ui.ServerChart object.
Arguments:
uriLengthLimit :
The chart URI length limit.
code »
setVennSeries(weightsopt_legendTextopt_colors)
Sets the weight function for a Venn Diagram along with the associated colors and legend text. Weights are assigned as follows: weights[0] is relative area of circle A. weights[1] is relative area of circle B. weights[2] is relative area of circle C. weights[3] is relative area of overlap of circles A and B. weights[4] is relative area of overlap of circles A and C. weights[5] is relative area of overlap of circles B and C. weights[6] is relative area of overlap of circles A, B and C. For a two circle Venn Diagram the weights are assigned as follows: weights[0] is relative area of circle A. weights[1] is relative area of circle B. weights[2] is relative area of overlap of circles A and B.
Arguments:
weights :
(Array.<number> | null)
The relative weights of the circles.
opt_legendText :
(Array.<string> | null | undefined)
The legend labels for the circles.
opt_colors :
(Array.<string> | null | undefined)
The colors for the circles.
code »
setXLabels(labels)
Sets the X Labels for the chart.
Arguments:
labels :
(Array.<string> | null)
The X Labels for the chart.
code »
updateChart()
Updates the image if any of the data or settings have changed.
code »
addChild(childopt_render)
Adds the specified component as the last child of this component. See goog.ui.Component#addChildAt for detailed semantics.
Arguments:
child :
The new child component.
opt_render :
(boolean | undefined)
If true, the child component will be rendered into the parent.
code »
addChildAt(childindexopt_render)
undefined
Adds the specified component as a child of this component at the given 0-based index. Both addChild and addChildAt assume the following contract between parent and child components:
  • the child component's element must be a descendant of the parent component's element, and
  • the DOM state of the child component must be consistent with the DOM state of the parent component (see isInDocument) in the steady state -- the exception is to addChildAt(child, i, false) and then immediately decorate/render the child.
In particular, parent.addChild(child) will throw an error if the child component is already in the document, but the parent isn&amp;#39;t. Clients of this API may call addChild and addChildAt with opt_render set to true. If opt_render is true, calling these methods will automatically render the child component&amp;amp;amp;amp;amp;#39;s element into the parent component&amp;amp;amp;amp;amp;#39;s element. However, parent.addChild(child, true) will throw an error if:
  • the parent component has no DOM (i.e. parent.getElement() is null), or
  • the child component is already in the document, regardless of the parent's DOM state.
If opt_render is true and the parent component is not already in the document, enterDocument will not be called on this component at this point. Finally, this method also throws an error if the new child already has a different parent, or the given index is out of bounds.
Arguments:
child :
The new child component.
index :
0-based index at which the new child component is to be added; must be between 0 and the current child count (inclusive).
opt_render :
(boolean | undefined)
If true, the child component will be rendered into the parent.
Returns: 
undefined
  Nada.
code »
canDecorate(element)
Determines if a given element can be decorated by this type of component. This method should be overridden by inheriting objects.
Arguments:
element :
(Element | null)
Element to decorate.
Returns:   True if the element can be decorated, false otherwise.
code »
createDom()
Creates the initial DOM representation for the component. The default implementation is to set this.element_ = div.
code »
decorate(element)
Decorates the element for the UI component.
Arguments:
element :
(Element | null)
Element to decorate.
code »
decorateInternal(element)
Actually decorates the element. Should be overridden by inheriting objects. This method can assume there are checks to ensure the component has not already been rendered have occurred and that enter document will be called afterwards. This method is considered protected.
Arguments:
element :
(Element | null)
Element to decorate.
code »
disposeInternal()
Disposes of the component. Calls exitDocument, which is expected to remove event handlers and clean up the component. Propagates the call to the component&#39;s children, if any. Removes the component&#39;s DOM from the document unless it was decorated.
code »
enterDocument()
Called when the component's element is known to be in the document. Anything using document.getElementById etc. should be done at this stage. If the component contains child components, this call is propagated to its children.
code »
exitDocument()
Called by dispose to clean up the elements and listeners created by a component, or by a parent component/application who has removed the component from the document but wants to reuse it later. If the component contains child components, this call is propagated to its children. It should be possible for the component to be rendered again once this method has been called.
code »
forEachChild(fopt_obj)
Calls the given function on each of this component&#39;s children in order. If opt_obj is provided, it will be used as the &#39;this&#39; object in the function when called. The function should take two arguments: the child component and its 0-based index. The return value is ignored.
Arguments:
f :
?function (this:T, ?, number):
The function to call for every child component; should take 2 arguments (the child and its index).
opt_obj :
(T | undefined)
Used as the 'this' object in f when called.
code »
getChild(id)
Returns the child with the given ID, or null if no such child exists.
Arguments:
id :
Child component ID.
Returns:   The child with the given ID; null if none.
code »
getChildAt(index)
Returns the child at the given index, or null if the index is out of bounds.
Arguments:
index :
0-based index.
Returns:   The child at the given index; null if none.
code »
getChildCount()
Returns the number of children of this component.
Returns:   The number of children.
code »
getChildIds()
(Array.<string> | null)
Returns an array containing the IDs of the children of this component, or an empty array if the component has no children.
Returns: 
(Array.<string> | null)
  Child component IDs.
code »
getContentElement()
(Element | null)
Returns the DOM element into which child components are to be rendered, or null if the component itself hasn't been rendered yet. This default implementation returns the component's root element. Subclasses with complex DOM structures must override this method.
Returns: 
(Element | null)
  Element to contain child elements (null if none).
code »
getDomHelper()
Returns the dom helper that is being used on this component.
Returns:   The dom helper used on this component.
code »
getElement()
(Element | null)
Gets the component's element.
Returns: 
(Element | null)
  The element for the component.
code »
getElementByClass(className)
(Element | null)
Returns the first element in this component's DOM with the provided className.
Arguments:
className :
The name of the class to look for.
Returns: 
(Element | null)
  The first item with the class name provided.
code »
getElementByFragment(idFragment)
(Element | null)
Helper function for returning an element in the document with a unique id generated using makeId().
Arguments:
idFragment :
The partial id.
Returns: 
(Element | null)
  The element with the unique id, or null if it cannot be found.
code »
getElementsByClass(className)
{length: number}
Returns an array of all the elements in this component's DOM with the provided className.
Arguments:
className :
The name of the class to look for.
Returns: 
{length: number}
  The items found with the class name provided.
code »
getFragmentFromId(id)
Helper function for returning the fragment portion of an id generated using makeId().
Arguments:
id :
Id generated with makeId().
Returns:   Fragment.
code »
getHandler()
Returns the event handler for this component, lazily created the first time this method is called.
Returns:   Event handler for this component.
code »
getId()
Gets the unique ID for the instance of this component. If the instance doesn't already have an ID, generates one on the fly.
Returns:   Unique component ID.
code »
getModel()
*
Returns the model associated with the UI component.
Returns: 
*
  The model.
code »
getParent()
Returns the component's parent, if any.
Returns:   The parent component.
code »
hasChildren()
Returns true if the component has children.
Returns:   True if the component has children.
code »
indexOfChild(child)
Returns the 0-based index of the given child component, or -1 if no such child is found.
Arguments:
child :
The child component.
Returns:   0-based index of the child component; -1 if not found.
code »
isInDocument()
Determines whether the component has been added to the document.
Returns:   TRUE if rendered. Otherwise, FALSE.
code »
isRightToLeft()
Returns true if the component is rendered right-to-left, false otherwise. The first time this function is invoked, the right-to-left rendering property is set if it has not been already.
Returns:   Whether the control is rendered right-to-left.
code »
makeId(idFragment)
Helper function for subclasses that gets a unique id for a given fragment, this can be used by components to generate unique string ids for DOM elements.
Arguments:
idFragment :
A partial id.
Returns:   Unique element id.
code »
makeIds(object)
(Object | null)
Makes a collection of ids. This is a convenience method for makeId. The object's values are the id fragments and the new values are the generated ids. The key will remain the same.
Arguments:
object :
(Object | null)
The object that will be used to create the ids.
Returns: 
(Object | null)
  An object of id keys to generated ids.
code »
removeChild(childopt_unrender)
Removes the given child from this component, and returns it. Throws an error if the argument is invalid or if the specified child isn&#39;t found in the parent component. The argument can either be a string (interpreted as the ID of the child component to remove) or the child component itself. If opt_unrender is true, calls goog.ui.component#exitDocument on the removed child, and subsequently detaches the child&amp;#39;s DOM from the document. Otherwise it is the caller&amp;#39;s responsibility to clean up the child component&amp;#39;s DOM.
Arguments:
child :
(goog.ui.Component | null | string)
The ID of the child to remove, or the child component itself.
opt_unrender :
(boolean | undefined)
If true, calls exitDocument on the removed child component, and detaches its DOM from the document.
Returns:   The removed component, if any.
code »
removeChildAt(indexopt_unrender)
Removes the child at the given index from this component, and returns it. Throws an error if the argument is out of bounds, or if the specified child isn&#39;t found in the parent. See goog.ui.Component#removeChild for detailed semantics.
Arguments:
index :
0-based index of the child to remove.
opt_unrender :
(boolean | undefined)
If true, calls exitDocument on the removed child component, and detaches its DOM from the document.
Returns:   The removed component, if any.
code »
removeChildren(opt_unrender)
Removes every child component attached to this one and returns them.
Arguments:
opt_unrender :
(boolean | undefined)
If true, calls #exitDocument on the removed child components, and detaches their DOM from the document.
Returns:   The removed components if any.
code »
render(opt_parentElement)
Renders the component. If a parent element is supplied, the component&#39;s element will be appended to it. If there is no optional parent element and the element doesn&#39;t have a parentNode then it will be appended to the document body. If this component has a parent component, and the parent component is not in the document already, then this will not call enterDocument on this component. Throws an Error if the component is already rendered.
Arguments:
opt_parentElement :
(Element | null | undefined)
Optional parent element to render the component into.
code »
renderBefore(sibling)
Renders the component before another element. The other element should be in the document already. Throws an Error if the component is already rendered.
Arguments:
sibling :
(Node | null)
Node to render the component before.
code »
render_(opt_parentElementopt_beforeNode)
Renders the component. If a parent element is supplied, the component&#39;s element will be appended to it. If there is no optional parent element and the element doesn&#39;t have a parentNode then it will be appended to the document body. If this component has a parent component, and the parent component is not in the document already, then this will not call enterDocument on this component. Throws an Error if the component is already rendered.
Arguments:
opt_parentElement :
(Element | null | undefined)
Optional parent element to render the component into.
opt_beforeNode :
(Node | null | undefined)
Node before which the component is to be rendered. If left out the node is appended to the parent element.
code »
setElementInternal(element)
Sets the component's root element to the given element. Considered protected and final. This should generally only be called during createDom. Setting the element does not actually change which element is rendered, only the element that is associated with this UI component.
Arguments:
element :
(Element | null)
Root element for the component.
code »
setId(id)
Assigns an ID to this component instance. It is the caller's responsibility to guarantee that the ID is unique. If the component is a child of a parent component, then the parent component's child index is updated to reflect the new ID; this may throw an error if the parent already has a child with an ID that conflicts with the new ID.
Arguments:
id :
Unique component ID.
code »
setModel(obj)
Sets the model associated with the UI component.
Arguments:
obj :
*
The model.
code »
setParent(parent)
Sets the parent of this component to use for event bubbling. Throws an error if the component already has a parent or if an attempt is made to add a component to itself as a child. Callers must use removeChild or removeChildAt to remove components from their containers before calling this method.
Arguments:
parent :
The parent component.
code »
setParentEventTarget(parent)
Overrides goog.events.EventTarget#setParentEventTarget to throw an error if the parent component is set, and the argument is not the parent.
Arguments:
parent :
No description.
code »
setRightToLeft(rightToLeft)
Set is right-to-left. This function should be used if the component needs to know the rendering direction during dom creation (i.e. before #enterDocument is called and is right-to-left is set).
Arguments:
rightToLeft :
Whether the component is rendered right-to-left.
code »
wasDecorated()
No description.
Returns:   Whether the component was decorated.
code »
addEventListener(typehandleropt_captureopt_handlerScope)
Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched. Supported for legacy but use goog.events.listen(src, type, handler) instead.
Arguments:
type :
The type of the event to listen for.
handler :
(Object | null)
The function to handle the event. The handler can also be an object that implements the handleEvent method which takes the event object as argument.
opt_capture :
(boolean | undefined)
In DOM-compliant browsers, this determines whether the listener is fired during the capture or bubble phase of the event.
opt_handlerScope :
(Object | null | undefined)
Object in whose scope to call the listener.
code »
dispatchEvent(e)
Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object. If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.
Arguments:
e :
(Object | null | string)
Event object.
Returns:   If anyone called preventDefault on the event object (or if any of the handlers returns false this will also return false.
code »
disposeInternal()
Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() {
MyClass.superClass_.disposeInternal.call(this);
// Dispose logic for MyClass
};
code »
getParentEventTarget()
Returns the parent of this event target to use for bubbling.
Returns:   The parent EventTarget or null if there is no parent.
code »
removeEventListener(typehandleropt_captureopt_handlerScope)
Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.
Arguments:
type :
The type of the event to listen for.
handler :
(Object | null)
The function to handle the event. The handler can also be an object that implements the handleEvent method which takes the event object as argument.
opt_capture :
(boolean | undefined)
In DOM-compliant browsers, this determines whether the listener is fired during the capture or bubble phase of the event.
opt_handlerScope :
(Object | null | undefined)
Object in whose scope to call the listener.
code »
setParentEventTarget(parent)
Sets the parent of this event target to use for bubbling.
Arguments:
parent :
Parent EventTarget (null if none).
code »
addOnDisposeCallback(callbackopt_scope)
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
Arguments:
callback :
?function (this:T):
The callback function.
opt_scope :
(T | undefined)
An optional scope to call the callback in.
code »
dispose()
undefined
Disposes of the object. If the object hasn&amp;#39;t already been disposed of, calls #disposeInternal. Classes that extend goog.Disposable should override #disposeInternal in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
Returns: 
undefined
  Nothing.
code »
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend goog.Disposable should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass&amp;#39; disposeInternal method. Everywhere else the public dispose method must be used. For example:
mypackage.MyClass = function() {
goog.base(this);
// Constructor logic specific to MyClass.
...
};
goog.inherits(mypackage.MyClass, goog.Disposable);

mypackage.MyClass.prototype.disposeInternal = function() {
// Dispose logic specific to MyClass.
...
// Call superclass&#39;s disposeInternal at the end of the subclass&#39;s, like
// in C++, to avoid hard-to-catch issues.
goog.base(this, &#39;disposeInternal&#39;);
};
code »
getDisposed()
Use #isDisposed instead. No description.
Returns:   Whether the object has been disposed of.
code »
isDisposed()
No description.
Returns:   Whether the object has been disposed of.
code »
registerDisposable(disposable)
Associates a disposable object with this object so that they will be disposed together.
Arguments:
disposable :
that will be disposed when this object is disposed.
code »

Instance Properties

dataSets_ :
(Array.<(Array.<number> | null)> | null)
Two-dimensional array of the data sets on the chart.
Code »
encodingType_ :
goog.ui.ServerChart.EncodingType.<string>
Encoding method for the URI data format.
Code »
gridX_ :
Number of gridlines along the X-axis.
Code »
gridY_ :
Number of gridlines along the Y-axis.
Code »
leftLabels_ :
(Array.<string> | null)
Labels on the left along the Y-axis.
Code »
legend_ :
(Array.<string> | null)
Chart legend.
Code »
maxValue_ :
Maximum value for the chart (used for normalization). The minimum is declared in the constructor.
Code »
minValue_ :
Minimum value for the chart (used for normalization). By default, this is set to infinity, and is eventually updated to the lowest given value in the data. The minimum value is then subtracted from all other values. For a pie chart, subtracting the minimum value does not make sense, so minValue_ is set to zero because 0 is the additive identity.
Code »
multiAxisLabelPosition_ :
(Object | null)
Axis position for each multi-axis in the chart, indexed by the indices from multiAxisType_ in a sparse array.
Code »
multiAxisLabelStyle_ :
(Object | null)
Axis style for each multi-axis in the chart, indexed by the indices from multiAxisType_ in a sparse array.
Code »
multiAxisLabelText_ :
(Object | null)
Axis text for each multi-axis in the chart, indexed by the indices from multiAxisType_ in a sparse array.
Code »
multiAxisRange_ :
(Object | null)
Axis range for each multi-axis in the chart, indexed by the indices from multiAxisType_ in a sparse array.
Code »
multiAxisType_ :
(Array.<goog.ui.ServerChart.MultiAxisType.<string>> | null)
Axis type for each multi-axis in the chart. The indices into this array also work as the reference index for all other multi-axis properties.
Code »
numVisibleDataSets_ :
(null | number)
ChartServer supports using data sets to position markers. A data set that is being used for positioning only can be made "invisible", in other words, the caller can indicate to ChartServer that ordinary chart elements (e.g. bars in a bar chart) should not be drawn on the data points of the invisible data set. Such data sets must be provided at the end of the chd parameter, and if invisible data sets are being used, the chd parameter must indicate the number of visible data sets.
Code »
rightLabels_ :
(Array.<string> | null)
Labels on the right along the Y-axis.
Code »
setColors_ :
(Array.<string> | null)
Colors for each data set.
Code »
setLegendTexts_ :
(Array.<string> | null)
Legend texts for each data set.
Code »
titleColor_ :
Chart title color.
Code »
titleSize_ :
Chart title size.
Code »
title_ :
(null | string)
Chart title.
Code »
uriLengthLimit_ :
The upper limit on the length of the chart image URI, after encoding. If the URI's length equals or exceeds it, goog.ui.ServerChart.UriTooLongEvent is dispatched on the goog.ui.ServerChart object.
Code »
uri_ :
(goog.Uri | null)
Image URI.
Code »
xLabels_ :
(Array.<string> | null)
Labels on the X-axis.
Code »
childIndex_ :
(Object | null)
Map of child component IDs to child components. Used for constant-time random access to child components by ID. Lazily initialized on first use. Must be kept in sync with children_. This property is strictly private and must not be accessed directly outside of this class! We use a plain Object, not a goog.structs.Map, for simplicity. This means components can&amp;#39;t have children with IDs such as &amp;#39;constructor&amp;#39; or &amp;#39;valueOf&amp;#39;, but this shouldn&amp;#39;t really be an issue in practice, and if it is, we can always fix it later without changing the API.
Code »
children_ :
(Array.<(goog.ui.Component | null)> | null)
Array of child components. Lazily initialized on first use. Must be kept in sync with childIndex_. This property is strictly private and must not be accessed directly outside of this class!
Code »
DomHelper used to interact with the document, allowing components to be created in a different window.
Code »
element_ :
(Element | null)
The DOM element for the component.
Code »
googUiComponentHandler_ :
Event handler. TODO(user): rename it to handler_ after all component subclasses in inside Google have been cleaned up. Code search: http://go/component_code_search
Code »
idGenerator_ :
Generator for unique IDs.
Code »
id_ :
(null | string)
Unique ID of the component, lazily initialized in goog.ui.Component#getId if needed. This property is strictly private and must not be accessed directly outside of this class!
Code »
inDocument_ :
Whether the component is in the document.
Code »
model_ :
*
Arbitrary data object associated with the component. Such as meta-data.
Code »
parent_ :
Parent component to which events will be propagated. This property is strictly private and must not be accessed directly outside of this class!
Code »
rightToLeft_ :
(boolean | null)
Whether the component is rendered right-to-left. Right-to-left is set lazily when #isRightToLeft is called the first time, unless it has been set by calling #setRightToLeft explicitly.
Code »
wasDecorated_ :
Flag used to keep track of whether a component decorated an already existing element or whether it created the DOM itself. If an element is decorated, dispose will leave the node in the document. It is up to the app to remove the node. If an element was rendered, dispose will remove the node automatically.
Code »
customEvent_ :
Used to tell if an event is a real event in goog.events.listen() so we don't get listen() calling addEventListener() and vice-versa.
Code »
parentEventTarget_ :
Parent event target, used during event bubbling.
Code »
creationStack :
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
Code »
dependentDisposables_ :
(Array.<(goog.disposable.IDisposable | null)> | null)
Disposables that should be disposed when this object is disposed.
Code »
disposed_ :
Whether the object has been disposed of.
Code »
onDisposeCallbacks_ :
(Array.<Function> | null)
Callbacks to invoke when this object is disposed.
Code »

Static Properties

goog.ui.ServerChart.CHART_SERVER_HTTPS_URI :
Base HTTPS URI for the chart renderer.
Code »
goog.ui.ServerChart.CHART_SERVER_HTTP_URI :
Base HTTP URI for the chart renderer.
Code »
goog.ui.ServerChart.CHART_SERVER_SCHEME_INDEPENDENT_URI :
Base scheme-independent URI for the chart renderer.
Code »
goog.ui.ServerChart.CHART_SERVER_URI :
Base URI for the chart renderer.
Code »
goog.ui.ServerChart.CHART_VALUES :
Array of possible ChartServer data values
Code »
goog.ui.ServerChart.CHART_VALUES_EXTENDED :
Array of extended ChartServer data values
Code »
goog.ui.ServerChart.DEFAULT_NORMALIZATION :
The 0 - 1.0 ("fraction of the range") value to use when getMinValue() == getMaxValue(). This determines, for example, the vertical position of the line in a flat line-chart.
Code »

Enumerations

goog.ui.ServerChart.AxisDisplayType :
Enum of line and tick options for an axis.
Constants:
LINE_AND_TICKS
No description.
LINE
No description.
TICKS
No description.
Code »
goog.ui.ServerChart.ChartType :
Enum of chart types with their short names used by the chartserver.
Constants:
PIE
No description.
HORIZONTAL_GROUPED_BAR
No description.
CLOCK
No description.
CONCENTRIC_PIE
No description.
VERTICAL_STACKED_BAR
No description.
FINANCE
No description.
MAP
No description.
VERTICAL_GROUPED_BAR
No description.
BAR
No description.
RADAR
No description.
VENN
No description.
HORIZONTAL_STACKED_BAR
No description.
FILLEDLINE
No description.
GOOGLEOMETER
No description.
SCATTER
No description.
MAPWORLD
No description.
MAPUSA
No description.
PIE3D
No description.
SPARKLINE
No description.
LINE
No description.
XYLINE
No description.
Code »
goog.ui.ServerChart.EncodingType :
Enum of chart data encoding types
Constants:
SIMPLE
No description.
AUTOMATIC
No description.
TEXT
No description.
EXTENDED
No description.
Code »
goog.ui.ServerChart.Event :
Event types dispatched by the ServerChart object
Constants:
URI_TOO_LONG
Dispatched when the resulting URI reaches or exceeds the URI length limit.
Code »
goog.ui.ServerChart.LegendPosition :
Enum of legend positions.
Constants:
RIGHT
No description.
TOP
No description.
BOTTOM
No description.
LEFT
No description.
Code »
goog.ui.ServerChart.MaximumValue :
Enum of chart maximum values in pixels, as listed at: http://code.google.com/apis/chart/basics.html
Constants:
MAP_WIDTH
No description.
MAP_HEIGHT
No description.
WIDTH
No description.
TOTAL_AREA
No description.
HEIGHT
No description.
Code »
goog.ui.ServerChart.MultiAxisAlignment :
Enum of multi-axis alignments.
Constants:
ALIGN_LEFT
No description.
ALIGN_RIGHT
No description.
ALIGN_CENTER
No description.
Code »
goog.ui.ServerChart.MultiAxisType :
Enum of multi-axis types.
Constants:
TOP_AXIS
No description.
X_AXIS
No description.
LEFT_Y_AXIS
No description.
RIGHT_Y_AXIS
No description.
Code »
goog.ui.ServerChart.UriParam :
Enum of ChartServer URI parameters.
Constants:
RIGHT_LABEL_POSITIONS
No description.
TYPE
No description.
LEGEND_TEXTS
No description.
DATA_SCALING
No description.
BAR_HEIGHT
No description.
GRID
No description.
LINE_STYLES
No description.
LEGEND_POSITION
No description.
SIZE
No description.
MISC_PARAMS
No description.
RIGHT_LABELS
No description.
BACKGROUND_FILL
No description.
LABEL_COLORS
No description.
MULTI_AXIS_RANGE
No description.
DATA_LABELS
No description.
DIGITAL_SIGNATURE
No description.
X_AXIS_STYLE
No description.
X_LABELS
No description.
TITLE_FORMAT
No description.
MULTI_AXIS_STYLE
No description.
MULTI_AXIS_TYPES
No description.
LEFT_Y_LABELS
No description.
MARGINS
No description.
DATA_COLORS
No description.
MULTI_AXIS_LABEL_POSITION
No description.
MARKERS
No description.
DATA
No description.
LEGEND
No description.
MULTI_AXIS_LABEL_TEXT
No description.
GEOGRAPHICAL_REGION
No description.
TITLE
No description.
Code »

Package ui

Package Reference