Top
You are looking at an outdated 7.2.0 version of this document. Switch to the 8.0.1 version to see the up to date information.

class anychart.Chart Improve this Doc

Extends: anychart.VisualBaseWithBounds

Base class for all charts, contains the margins, the background and the title.

Methods Overview

Miscellaneous
background()Getter for the current chart background.
credits()Getter for current chart credits settings.
draw()Starts the rendering of the chart into the container.
label()Getter for chart label.
legend()Getter for current chart legend.
margin()Getter for the current chart margin.
padding()Getter for the current chart padding.
title()Getter for chart title.
toJson()Return chart configuration as JSON object or string.
toXml()Return chart configuration as XML string or XMLNode.

Methods Description

background

Getter for the current chart background.

Returns:

anychart.elements.Background - The current chart background.
Setter for the chart background.

Params:

Name Type Description
value anychart.elements.Background Background object to set.

Returns:

anychart.Chart - An instance of anychart.Chart class for method chaining.

Try it:

credits

Getter for current chart credits settings.

Returns:

anychart.elements.Credits - An instance of anychart.elements.Credits class for method chaining.
Setter for chart credits settings.

Params:

Name Type Description
value anychart.elements.Credits | Object | boolean

Returns:

anychart.Chart - An instance of anychart.Chart class for method chaining.

Try it:

draw

Starts the rendering of the chart into the container.

Returns:

anychart.Chart - An instance of anychart.Chart class for method chaining.

label

Getter for chart label.

Params:

Name Type Default Description
index string | null
0
Index of instance.

Returns:

anychart.elements.Label - An instance of anychart.elements.Label for method chaining.
Setter for chart label.

Params:

Name Type Description
value anychart.elements.Label | Object | string | null Chart label instance to add by index 0.

Returns:

anychart.Chart - An instance of anychart.Chart for method chaining.

Try it:

Setter for chart label.

Params:

Name Type Description
index string | null Index of instance.
value anychart.elements.Label | Object | string | null Chart label instance.

Returns:

anychart.Chart - An instance of anychart.Chart for method chaining.

Try it:

legend

Getter for current chart legend.

Returns:

anychart.elements.Legend - An instance of anychart.elements.Legend for method chaining.
Setter for chart legend setting.

Params:

Name Type Description
value null | string | Object | anychart.elements.Legend Legend settings.

Returns:

anychart.Chart - An instance of anychart.Chart for method chaining.

Try it:

margin

Getter for the current chart margin.

Returns:

anychart.utils.Margin - The current chart margin.
Setter for the chart margin in pixels using a single value.

Params:

Name Type Description
value string | number | anychart.utils.Space Value to set.

Returns:

anychart.Chart - An instance of anychart.Chart class for method chaining.
Setter for the chart margin in pixels using several numbers.

Params:

Name Type Description
value1 string | number Top or top-bottom space.
value2 string | number Right or right-left space.
value3 string | number Bottom space.
value4 string | number Left space.

Returns:

anychart.Chart - An instance of anychart.Chart class for method chaining.

padding

Getter for the current chart padding.

Returns:

anychart.utils.Padding - Current chart padding.
Setter for the chart paddings in pixels using a single value.

Params:

Name Type Description
value string | number | anychart.utils.Space Value to set.

Returns:

anychart.Chart - An instance of anychart.Chart class for method chaining.
Setter for the chart paddings in pixels using several numbers.

Params:

Name Type Description
value1 string | number Top or top-bottom space.
value2 string | number Right or right-left space.
value3 string | number Bottom space.
value4 string | number Left space.

Returns:

anychart.Chart - An instance of anychart.Chart class for method chaining.

title

Getter for chart title.

Returns:

anychart.elements.Title - The current chart title.
Setter for the chart title.

Params:

Name Type Description
value string | anychart.elements.Title Chart title text or title instance for copy settings from.

Returns:

anychart.Chart - An instance of anychart.Chart for method chaining.

toJson

Return chart configuration as JSON object or string. Note for documentation writers!: Google compiler thinks that "Object" has "toJSON" method that must accept string and return *. To avoid this we have to put in the "wrong" params. In external documentation parameter must be boolean, and method must return Object|string. For the moment we have no way around this "nice feature" of the compiler.

Params:

Name Type Description
stringify string Return as JSON as string.

Returns:

* - Chart JSON.

toXml

Return chart configuration as XML string or XMLNode.

Params:

Name Type Description
asXmlNode boolean Return XML as XMLNode.

Returns:

string Node - Chart configuration.