Home

# Class goog.ui.ServerChart

Will construct a chart using Google's chartserver.

extends goog.ui.Component

Instance Method Summary
| `addDataSet(?Array.<(null|number)> data, string color, string= opt_legendText)` Adds a data set. NOTE: The color string should NOT have a '#' at the beginning of it.
| `addMultiAxis(?goog.ui.ServerChart.MultiAxisType axisType) ⇒ number` Adds a multi-axis to the chart, and sets its type. Multiple axes of the same type can be added.
| `arrayMax_(?Array.<(null|number)> ary) ⇒ number` Finds the maximum value in an array and returns it. Needed because Math.max does not handle sparse arrays the way we want.
| `arrayMin_(?Array.<(null|number)> ary) ⇒ number` Finds the minimum value in an array and returns it. Needed because Math.min does not handle sparse arrays the way we want.
| `clearDataSets()` Clears the data sets from the graph. All data, including the colors and legend text, is cleared.
| `computeDataStringForEncoding_(?goog.ui.ServerChart.EncodingType encoding) ⇒ boolean` 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.
| `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.
| `computeMultiAxisDataString_(?Object data, string indexSeparator, string elementSeparator, string axisSeparator) ⇒ string` 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 "<arrayIndex><indexSeparator><arrayElement.join(elementSeparator)>", with axisSeparator used between multiple elements.
| `createDom()` Creates the DOM node (image) needed for the Chart

`decorateInternal(?Element img)`

Decorate an image already in the DOM. Expects the following structure:

    - img

| `disposeInternal()` 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.
| `getBackgroundFill() ⇒ ?Array.<(Object|null)>` Returns the background fill.
| `getChartServerValues_(?Array.<number> values, number minValue, number maxValue, ?goog.ui.ServerChart.EncodingType encoding) ⇒ string` Creates the chd string for chartserver.

`getConvertedValue_(?number value, number minValue, number maxValue, ?goog.ui.ServerChart.EncodingType encoding) ⇒ string`

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.

| `getData(number= opt_setNumber) ⇒ ?Array` Returns the given data set or all of them in a two-dimensional array if the set number is not given.
| `getEncodingType() ⇒ ?goog.ui.ServerChart.EncodingType` Gets the encoding type.
| `getGridParameter() ⇒ (string|undefined)` Returns the 'chg' parameter of the chart Uri. This is used by various types of charts to specify Grids.
| `getGridX() ⇒ number`
| `getGridY() ⇒ number`
| `getLeftLabels() ⇒ ?Array.<string>`
| `getLegendPosition() ⇒ ?goog.ui.ServerChart.LegendPosition` Returns the position relative to the chart where the legend is to be displayed.
| `getMarkerParameter() ⇒ (string|undefined)` Returns the 'chm' parameter of the chart Uri. This is used by various types of charts to specify Markers.
| `getMaxValue() ⇒ number`
| `getMinValue() ⇒ number`
| `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.
| `getMultiAxisLabelPosition(number= opt_axisNumber) ⇒ ?Object` 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.
| `getMultiAxisLabelStyle(number= opt_axisNumber) ⇒ ?Object` 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.
| `getMultiAxisLabelText(number= opt_axisNumber) ⇒ ?Object` Returns the label text, or all of them in a two-dimensional array if the axis number is not given.
| `getMultiAxisRange(number= opt_axisNumber) ⇒ ?Object` 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.
| `getMultiAxisType(number= opt_axisNumber) ⇒ (Array|goog.ui.ServerChart.MultiAxisType|null)` Returns the axis type for the given axis, or all of them in an array if the axis number is not given.
| `getNumVisibleDataSets() ⇒ ?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.
| `getRightLabels() ⇒ ?Array.<string>`
| `getSize() ⇒ ?Array.<string>` Returns the chart size.
| `getTitleColor() ⇒ string`
| `getTitleSize() ⇒ number`
| `getType() ⇒ ?goog.ui.ServerChart.ChartType` Returns the chart type.
| `getUri() ⇒ ?goog.Uri` Returns the URI of the chart.
| `getUriLengthLimit() ⇒ number` 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.
| `getXLabels() ⇒ ?Array.<string>`
| `isBarChart() ⇒ boolean`
| `isGroupedBarChart() ⇒ boolean`
| `isHorizontalBarChart() ⇒ boolean`
| `isLineChart() ⇒ boolean`
| `isMap() ⇒ boolean`
| `isPieChart() ⇒ boolean`
| `isStackedBarChart() ⇒ boolean`
| `isVerticalBarChart() ⇒ boolean`
| `removeParameter(?goog.ui.ServerChart.UriParam key)` Removes the given ChartServer parameter.

`setAutomaticBarWidth(number= opt_spaceBars, number= 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.

| `setBackgroundFill(?Array.<(Object|null)> fill)` Sets the background fill.
| `setBarSpaceWidths(number barWidth, number= opt_spaceBars, number= 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.
| `setDataScaling(number minimum, number 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.
| `setEncodingType(?goog.ui.ServerChart.EncodingType type)` Sets the encoding type.
| `setGridParameter(string value)` Sets the 'chg' parameter of the chart Uri. This is used by various types of charts to specify Grids.
| `setGridX(number gridlines)` Sets the number of grid lines along the X-axis.
| `setGridY(number gridlines)` Sets the number of grid lines along the Y-axis.
| `setGrids_(number x, number y)` Sets the grids for the chart
| `setLeftLabels(?Array.<string> 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].
| `setLegend(?Array.<string> legend)` Adds a legend to the chart.
| `setLegendPosition(?goog.ui.ServerChart.LegendPosition value)` Sets the position relative to the chart where the legend is to be displayed.
| `setMargins(number leftMargin, number rightMargin, number topMargin, number bottomMargin)` Sets the chart margins.
| `setMarkerParameter(string value)` Sets the 'chm' parameter of the chart Uri. This is used by various types of charts to specify Markers.
| `setMaxValue(number maxValue)` Sets the maximum value of the chart.
| `setMinValue(number minValue)` Sets the minimum value of the chart.
| `setMiscParameter((number|string) 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.
| `setMultiAxisLabelPosition(number axisNumber, ?Array.<number> 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.

`setMultiAxisLabelStyle(number axisNumber, string color, number= opt_fontSize, ?goog.ui.ServerChart.MultiAxisAlignment= opt_alignment, ?goog.ui.ServerChart.AxisDisplayType= 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.

| `setMultiAxisLabelText(number axisNumber, ?Array.<string> labelText)` Sets the label text (usually multiple values) for a given axis, overwriting any existing values.
| `setMultiAxisRange(number axisNumber, number rangeStart, number rangeEnd, number= 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.
| `setNumVisibleDataSets(?number 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.
| `setParameterValue(?goog.ui.ServerChart.UriParam key, string value)` Sets the given ChartServer parameter.
| `setRightLabels(?Array.<string> 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].
| `setSize(number= opt_width, number= opt_height)` Sets the chart size.
| `setTitle(string title)` Sets the title of the chart.
| `setTitleColor(string color)` Sets the color of the chart title. NOTE: The color string should NOT have a '#' at the beginning of it.
| `setTitleSize(number size)` Sets the size of the chart title.
| `setType(?goog.ui.ServerChart.ChartType type)` Sets the chart type.
| `setUri(?goog.Uri uri)` Sets the URI of the chart.
| `setUriLengthLimit(number 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.

`setVennSeries(?Array.<number> weights, ?Array.<string>= opt_legendText, ?Array.<string>= 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.

| `setXLabels(?Array.<string> labels)` Sets the X Labels for the chart.
| `updateChart()` Updates the image if any of the data or settings have changed.