goog.ui.ServerChart
Classgoog.ui.ServerChart
> goog.ui.Component
> goog.events.EventTarget
> goog.Disposable
goog.ui.ServerChart(type, opt_width, opt_height, opt_domHelper, opt_uri)
Will construct a chart using Google's chartserver.
type
{goog.ui.ServerChart.ChartType
}
opt_width
{number
=}
opt_height
{number
=}
opt_domHelper
{goog.dom.DomHelper
=}
opt_uri
{string
=}
goog.ui.ServerChart.AxisDisplayType
EnumEnum of line and tick options for an axis. … more
.CHART_SERVER_HTTPS_URI
{string
}Base HTTPS URI for the chart renderer.
.CHART_SERVER_HTTP_URI
{string
}Base HTTP URI for the chart renderer.
.CHART_SERVER_SCHEME_INDEPENDENT_URI
{string
}Base scheme-independent URI for the chart renderer.
.CHART_SERVER_URI
[deprecated] {string
}Deprecated. Use {@link goog.ui.ServerChart.CHART_SERVER_SCHEME_INDEPENDENT_URI}, {@link goog.ui.ServerChart.CHART_SERVER_HTTP_URI} or {@link goog.ui.ServerChart.CHART_SERVER_HTTPS_URI} instead.
Base URI for the chart renderer.
.CHART_VALUES
{string
}Array of possible ChartServer data values
.CHART_VALUES_EXTENDED
{string
}Array of extended ChartServer data values
goog.ui.ServerChart.ChartType
EnumEnum of chart types with their short names used by the chartserver. … more
.DEFAULT_NORMALIZATION
{number
}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.
.EXTENDED_UPPER_BOUND
Upper bound for extended values
goog.ui.ServerChart.EncodingType
EnumEnum of chart data encoding types … more
goog.ui.ServerChart.Event
EnumEvent types dispatched by the ServerChart object … more
goog.ui.ServerChart.LegendPosition
EnumEnum of legend positions. … more
goog.ui.ServerChart.MaximumValue
EnumEnum of chart maximum values in pixels, as listed at: http://code.google.com/apis/chart/basics.html … more
goog.ui.ServerChart.MultiAxisAlignment
EnumEnum of multi-axis alignments. … more
goog.ui.ServerChart.MultiAxisType
EnumEnum of multi-axis types. … more
goog.ui.ServerChart.UriParam
EnumEnum of ChartServer URI parameters. … more
goog.ui.ServerChart.UriTooLongEvent
ClassClass for the event dispatched on the ServerChart when the resulting URI exceeds the URI length limit. … more
.addChild(child, opt_render)
Inherited from goog.ui.Component
.
Adds the specified component as the last child of this component. See {@link goog.ui.Component#addChildAt} for detailed semantics.
child
{goog.ui.Component
}
opt_render
{boolean
=}
.addChildAt(child, index, opt_render)
Inherited from goog.ui.Component
.
Adds the specified component as a child of this component at the given 0-based index. Both {@code addChild} and {@code addChildAt} assume the following contract between parent and child components:
child
{goog.ui.Component
}
index
{number
}
opt_render
{boolean
=}
void
}
.addDataSet(data, color, opt_legendText)
Adds a data set. NOTE: The color string should NOT have a '#' at the beginning of it.
data
{Array
.<number
|null
>}
color
{string
}
opt_legendText
{string
=}
.addEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
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.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.addMultiAxis(axisType)
Adds a multi-axis to the chart, and sets its type. Multiple axes of the same type can be added.
axisType
{goog.ui.ServerChart.MultiAxisType
}
number
}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.canDecorate(element)
Inherited from goog.ui.Component
.
Determines if a given element can be decorated by this type of component. This method should be overridden by inheriting objects.
element
{Element
}
boolean
}
.clearDataSets()
Clears the data sets from the graph. All data, including the colors and legend text, is cleared.
.createDom()
Creates the DOM node (image) needed for the Chart
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.decorate(element)
Inherited from goog.ui.Component
.
Decorates the element for the UI component.
element
{Element
}
.decorateInternal(img)
[protected]Decorate an image already in the DOM. Expects the following structure:
- img
img
{Element
}
.dispatchEvent(e)
Inherited from goog.events.EventTarget
.
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.
e
{string
|Object
|goog.events.Event
}
boolean
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Disposes of the component. Calls {@code exitDocument}, which is expected to remove event handlers and clean up the component. Propagates the call to the component's children, if any. Removes the component's DOM from the document unless it was decorated.
.dom_
[protected] {!goog.dom.DomHelper
}Inherited from goog.ui.Component
.
DomHelper used to interact with the document, allowing components to be created in a different window.
.enterDocument()
Inherited from goog.ui.Component
.
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.
.exitDocument()
Inherited from goog.ui.Component
.
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.
.forEachChild(f, opt_obj)
Inherited from goog.ui.Component
.
Calls the given function on each of this component's children in order. If {@code opt_obj} is provided, it will be used as the 'this' 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.
f
{Function
}
opt_obj
{Object
=}
.getBackgroundFill()
Returns the background fill.
Array
.<Object
>}
.getChild(id)
Inherited from goog.ui.Component
.
Returns the child with the given ID, or null if no such child exists.
id
{string
}
goog.ui.Component
?}
.getChildAt(index)
Inherited from goog.ui.Component
.
Returns the child at the given index, or null if the index is out of bounds.
index
{number
}
goog.ui.Component
?}
.getChildCount()
Inherited from goog.ui.Component
.
Returns the number of children of this component.
number
}
.getChildIds()
Inherited from goog.ui.Component
.
Returns an array containing the IDs of the children of this component, or an empty array if the component has no children.
Array
.<string
>}
.getContentElement()
Inherited from goog.ui.Component
.
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.
Element
}
.getData(opt_setNumber)
Returns the given data set or all of them in a two-dimensional array if the set number is not given.
opt_setNumber
{number
=}
Array
}
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getDomHelper()
Inherited from goog.ui.Component
.
Returns the dom helper that is being used on this component.
goog.dom.DomHelper
}
.getElement()
Inherited from goog.ui.Component
.
Gets the component's element.
Element
}
.getElementByClass(className)
Inherited from goog.ui.Component
.
Returns the first element in this component's DOM with the provided className.
className
{string
}
Element
}
.getElementByFragment(idFragment)
Inherited from goog.ui.Component
.
Helper function for returning an element in the document with a unique id generated using makeId().
idFragment
{string
}
Element
}
.getElementsByClass(className)
Inherited from goog.ui.Component
.
Returns an array of all the elements in this component's DOM with the provided className.
className
{string
}
goog.array.ArrayLike
}
.getEncodingType()
Gets the encoding type.
goog.ui.ServerChart.EncodingType
}
.getFragmentFromId(id)
Inherited from goog.ui.Component
.
Helper function for returning the fragment portion of an id generated using makeId().
id
{string
}
string
}
.getGridParameter()
Returns the 'chg' parameter of the chart Uri. This is used by various types of charts to specify Grids.
string
|undefined
}
.getGridX()
number
}
.getGridY()
number
}
.getHandler()
[protected]Inherited from goog.ui.Component
.
Returns the event handler for this component, lazily created the first time this method is called.
goog.events.EventHandler
}
.getId()
Inherited from goog.ui.Component
.
Gets the unique ID for the instance of this component. If the instance doesn't already have an ID, generates one on the fly.
string
}
.getLeftLabels()
Array
.<string
>}
.getLegendPosition()
Returns the position relative to the chart where the legend is to be displayed.
goog.ui.ServerChart.LegendPosition
}
.getMarkerParameter()
Returns the 'chm' parameter of the chart Uri. This is used by various types of charts to specify Markers.
string
|undefined
}
.getMaxValue()
number
}
.getMinValue()
number
}
.getMiscParameter()
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.
string
|undefined
}
.getModel()
Inherited from goog.ui.Component
.
Returns the model associated with the UI component.
.getMultiAxisLabelPosition(opt_axisNumber)
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.
opt_axisNumber
{number
=}
Object
|Array
.<number
>}
.getMultiAxisLabelStyle(opt_axisNumber)
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.
opt_axisNumber
{number
=}
Object
|Array
.<number
>}
.getMultiAxisLabelText(opt_axisNumber)
Returns the label text, or all of them in a two-dimensional array if the axis number is not given.
opt_axisNumber
{number
=}
Object
|Array
.<string
>}
.getMultiAxisRange(opt_axisNumber)
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.
opt_axisNumber
{number
=}
Object
|Array
.<number
>}
.getMultiAxisType(opt_axisNumber)
Returns the axis type for the given axis, or all of them in an array if the axis number is not given.
opt_axisNumber
{number
=}
goog.ui.ServerChart.MultiAxisType
|
Array
.<goog.ui.ServerChart.MultiAxisType
>}
.getNumVisibleDataSets()
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.
number
}
.getParent()
Inherited from goog.ui.Component
.
Returns the component's parent, if any.
goog.ui.Component
?}
.getParentEventTarget()
Inherited from goog.events.EventTarget
.
Returns the parent of this event target to use for bubbling.
goog.events.EventTarget
}
.getRightLabels()
Array
.<string
>}
.getSize()
Returns the chart size.
Array
.<string
>}
.getTitleColor()
string
}
.getTitleSize()
number
}
.getType()
Returns the chart type.
goog.ui.ServerChart.ChartType
}
.getUri()
Returns the URI of the chart.
goog.Uri
}
.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.
number
}
.getXLabels()
Array
.<string
>}
.hasChildren()
Inherited from goog.ui.Component
.
Returns true if the component has children.
boolean
}
.indexOfChild(child)
Inherited from goog.ui.Component
.
Returns the 0-based index of the given child component, or -1 if no such child is found.
child
{goog.ui.Component
?}
number
}
.isBarChart()
boolean
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.isGroupedBarChart()
boolean
}
.isHorizontalBarChart()
boolean
}
.isInDocument()
Inherited from goog.ui.Component
.
Determines whether the component has been added to the document.
boolean
}
.isLineChart()
boolean
}
.isMap()
boolean
}
.isPieChart()
boolean
}
.isRightToLeft()
Inherited from goog.ui.Component
.
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.
boolean
}
.isStackedBarChart()
boolean
}
.isVerticalBarChart()
boolean
}
.makeId(idFragment)
Inherited from goog.ui.Component
.
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.
idFragment
{string
}
string
}
.makeIds(object)
Inherited from goog.ui.Component
.
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.
object
{Object
}
Object
}
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.removeChild(child, opt_unrender)
Inherited from goog.ui.Component
.
Removes the given child from this component, and returns it. Throws an error if the argument is invalid or if the specified child isn'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 {@code opt_unrender} is true, calls {@link goog.ui.component#exitDocument} on the removed child, and subsequently detaches the child's DOM from the document. Otherwise it is the caller's responsibility to clean up the child component's DOM.
child
{string
|goog.ui.Component
|null
}
opt_unrender
{boolean
=}
goog.ui.Component
}
.removeChildAt(index, opt_unrender)
Inherited from goog.ui.Component
.
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't found in the parent. See {@link goog.ui.Component#removeChild} for detailed semantics.
index
{number
}
opt_unrender
{boolean
=}
goog.ui.Component
}
.removeChildren(opt_unrender)
Inherited from goog.ui.Component
.
Removes every child component attached to this one and returns them.
opt_unrender
{boolean
=}
Array
.<goog.ui.Component
>|undefined
}
.removeEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
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.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.removeParameter(key)
Removes the given ChartServer parameter.
key
{goog.ui.ServerChart.UriParam
}
.render(opt_parentElement)
Inherited from goog.ui.Component
.
Renders the component. If a parent element is supplied, the component's element will be appended to it. If there is no optional parent element and the element doesn'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 {@code enterDocument} on this component. Throws an Error if the component is already rendered.
opt_parentElement
{Element
=}
.renderBefore(sibling)
Inherited from goog.ui.Component
.
Renders the component before another element. The other element should be in the document already. Throws an Error if the component is already rendered.
sibling
{Node
}
.setAutomaticBarWidth(opt_spaceBars, opt_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.
opt_spaceBars
{number
=}
opt_spaceGroups
{number
=}
.setBackgroundFill(fill)
Sets the background fill.
fill
{Array
.<Object
>}
.setBarSpaceWidths(barWidth, opt_spaceBars, opt_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.
barWidth
{number
}
opt_spaceBars
{number
=}
opt_spaceGroups
{number
=}
.setDataScaling(minimum, maximum)
Sets the data scaling. NOTE: This also changes the encoding type because data scaling will only work with {@code goog.ui.ServerChart.EncodingType.TEXT} encoding.
minimum
{number
}
maximum
{number
}
.setElementInternal(element)
[protected]Inherited from goog.ui.Component
.
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.
element
{Element
}
.setEncodingType(type)
Sets the encoding type.
type
{goog.ui.ServerChart.EncodingType
}
.setGridParameter(value)
Sets the 'chg' parameter of the chart Uri. This is used by various types of charts to specify Grids.
value
{string
}
.setGridX(gridlines)
Sets the number of grid lines along the X-axis.
gridlines
{number
}
.setGridY(gridlines)
Sets the number of grid lines along the Y-axis.
gridlines
{number
}
.setId(id)
Inherited from goog.ui.Component
.
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.
id
{string
}
.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].
labels
{Array
.<string
>}
.setLegend(legend)
Adds a legend to the chart.
legend
{Array
.<string
>}
.setLegendPosition(value)
Sets the position relative to the chart where the legend is to be displayed.
value
{goog.ui.ServerChart.LegendPosition
}
.setMargins(leftMargin, rightMargin, topMargin, bottomMargin)
Sets the chart margins.
leftMargin
{number
}
rightMargin
{number
}
topMargin
{number
}
bottomMargin
{number
}
.setMarkerParameter(value)
Sets the 'chm' parameter of the chart Uri. This is used by various types of charts to specify Markers.
value
{string
}
.setMaxValue(maxValue)
Sets the maximum value of the chart.
maxValue
{number
}
.setMinValue(minValue)
Sets the minimum value of the chart.
minValue
{number
}
.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.
value
{string
|number
}
.setModel(obj)
Inherited from goog.ui.Component
.
Sets the model associated with the UI component.
obj
{*}
.setMultiAxisLabelPosition(axisNumber, labelPosition)
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.
axisNumber
{number
}
labelPosition
{Array
.<number
>}
.setMultiAxisLabelStyle(axisNumber, color, opt_fontSize, opt_alignment, opt_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.
axisNumber
{number
}
color
{string
}
opt_fontSize
{number
=}
opt_alignment
{goog.ui.ServerChart.MultiAxisAlignment
=}
opt_axisDisplay
{goog.ui.ServerChart.AxisDisplayType
=}
.setMultiAxisLabelText(axisNumber, labelText)
Sets the label text (usually multiple values) for a given axis, overwriting any existing values.
axisNumber
{number
}
labelText
{Array
.<string
>}
.setMultiAxisRange(axisNumber, rangeStart, rangeEnd, opt_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.
axisNumber
{number
}
rangeStart
{number
}
rangeEnd
{number
}
opt_interval
{number
=}
.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.
n
{?number
}
.setParameterValue(key, value)
Sets the given ChartServer parameter.
key
{goog.ui.ServerChart.UriParam
}
value
{string
}
.setParent(parent)
Inherited from goog.ui.Component
.
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 {@code removeChild} or {@code removeChildAt} to remove components from their containers before calling this method.
parent
{goog.ui.Component
}
.setParentEventTarget(parent)
Inherited from goog.ui.Component
.
Overrides {@link goog.events.EventTarget#setParentEventTarget} to throw an error if the parent component is set, and the argument is not the parent.
parent
{goog.events.EventTarget
?}
.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].
labels
{Array
.<string
>}
.setRightToLeft(rightToLeft)
Inherited from goog.ui.Component
.
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 {@link #enterDocument} is called and is right-to-left is set).
rightToLeft
{boolean
}
.setSize(opt_width, opt_height)
Sets the chart size.
opt_width
{number
=}
opt_height
{number
=}
.setTitle(title)
Sets the title of the chart.
title
{string
}
.setTitleColor(color)
Sets the color of the chart title. NOTE: The color string should NOT have a '#' at the beginning of it.
color
{string
}
.setTitleSize(size)
Sets the size of the chart title.
size
{number
}
.setType(type)
Sets the chart type.
type
{goog.ui.ServerChart.ChartType
}
.setUri(uri)
Sets the URI of the chart.
uri
{goog.Uri
}
.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.
uriLengthLimit
{number
}
.setVennSeries(weights, opt_legendText, opt_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.
weights
{Array
.<number
>}
opt_legendText
{Array
.<string
>=}
opt_colors
{Array
.<string
>=}
.setXLabels(labels)
Sets the X Labels for the chart.
labels
{Array
.<string
>}
.updateChart()
Updates the image if any of the data or settings have changed.
.wasDecorated()
Inherited from goog.ui.Component
.
boolean
}