AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated 7.2.0 version of this document. Switch to the 8.4.0 version to see the up to date information.

class anychart.cartesian.series.Base Improve this Doc

Extends: anychart.VisualBaseWithBounds

Base class for all cartesian series.
Base class defines common methods, such as those for:

  • Binding series to a scale: xScale, yScale
  • Base color settings: color
You can also obtain getIterator, getResetIterator iterators here.

Methods Overview

Miscellaneous
clip()Getter for series clip settings.
color()Getter for current series color.
data()Getter for series mapping.
draw()Draws series into the current container. If series has no scales - creates them.
getIterator()Returns current mapping iterator.
getResetIterator()Returns new default iterator for the current mapping.
labels()Getter for current series data labels.
meta()Getter for series meta data.
name()Getter for series name.
tooltip()Getter for current series data tooltip.
xPointPosition()Returns current position of the point on an ordinal scale.
xScale()Getter for current series X scale.
yScale()Getter for current series Y scale.

Methods Description

clip

Getter for series clip settings.

Returns:

boolean | anychart.math.Rect - Current clip settings.
Setter for series clip settings. Clips visible part of a series by a rectangle (or chart).

Params:

NameTypeDefaultDescription
valueboolean | anychart.math.Rect
False, if series is created manually.
True, if created via chart
Enable/disable series clip.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.

color

Getter for current series color.

Returns:

anychart.graphics.vector.Fill - Current color.
Sets color settings using an object or a string.
Note: color methods sets fill and stroke settings, which means it is not wise to pass image fill here - stroke doesn't accept image fill.
Learn more about coloring at: https://docs.anychart.com/__VERSION__/General_settings/Elements_Fill

Params:

NameTypeDefaultDescription
valueanychart.graphics.vector.Fill
null
Color as an object or a string.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.
Color with opacity.
Note: If color is set as a string (e.g. 'red .5') it has a priority over opt_opacity, which means: color set like this rect.fill('red 0.3', 0.7) will have 0.3 opacity.

Params:

NameTypeDescription
colorstringColor as a string.
opacitynumberColor opacity.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.
Linear gradient.
Learn more about coloring at: https://docs.anychart.com/__VERSION__/General_settings/Elements_Fill

Params:

NameTypeDescription
keysArray.<(anychart.graphics.vector.GradientKey|string)>Gradient keys.
anglenumberGradient angle.
modeboolean | anychart.graphics.vector.Rect | ObjectGradient mode.
opacitynumberGradient opacity.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.
Radial gradient.
Learn more about coloring at: https://docs.anychart.com/__VERSION__/General_settings/Elements_Fill

Params:

NameTypeDescription
keysArray.<(anychart.graphics.vector.GradientKey|string)>Color-stop gradient keys.
cxnumberX ratio of center radial gradient.
cynumberY ratio of center radial gradient.
modeanychart.graphics.math.RectIf defined then userSpaceOnUse mode, else objectBoundingBox.
opacitynumberOpacity of the gradient.
fxnumberX ratio of focal point.
fynumberY ratio of focal point.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.

data

Getter for series mapping.

Returns:

anychart.data.View - Returns current mapping.
Setter for series mapping.

Params:

NameTypeDescription
valueanychart.data.View | anychart.data.Set | Array | stringValue to set.
csvSettingsObject.<string, (string|boolean)>If CSV string is passed by first param, you can pass CSV parser settings here as a hash map.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.

draw

Draws series into the current container. If series has no scales - creates them.

Params:

NameTypeDefaultDescription
parentWidthnumber
0
Optional width of the parent container for series bounds calculation. By default use 100%.
parentHeightnumber
0
Optional height of the parent container for series bounds calculation. By default use 100%.

Returns:

anychart.cartesian.series.Base - An instance of anychart.cartesian.series.Base class for method chaining.

getIterator

Returns current mapping iterator.

Returns:

anychart.data.Iterator - Current series iterator.

getResetIterator

Returns new default iterator for the current mapping.

Returns:

anychart.data.Iterator - New iterator.

labels

Getter for current series data labels.

Returns:

anychart.elements.LabelsFactory - Labels instance.
Setter for series data labels.

Params:

NameTypeDescription
valueanychart.elements.LabelsFactory | Object | string | nullSeries data labels settings. Note: Pass null or 'none' to turn off a label.

Returns:

anychart.cartesian.series.Base - An instance of the anychart.cartesian.series.Base class for method chaining.

meta

Getter for series meta data.

Params:

NameTypeDescription
key*Metadata key.

Returns:

* - Metadata object by key.
Setter for series meta data.

Params:

NameTypeDescription
object*Object to replace metadata.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.
Add/Replace meta data for series by key.

Params:

NameTypeDescription
keystringMetadata key.
value*Metadata value.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.

name

Getter for series name.

Returns:

string | undefined - Series name value.
Setter for series name.
Basically, name of series is used in Legend displaying, but it can be used in tooltips as well.

Params:

NameTypeDescription
valuestringValue to set.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.

tooltip

Getter for current series data tooltip.

Returns:

anychart.elements.Tooltip - Tooltip instance.
Setter for series data tooltip.

Params:

NameTypeDescription
valuenull | string | Object | anychart.elements.TooltipTooltip settings. Note: Pass null or 'none' to turn off tooltip.

Returns:

anychart.cartesian.series.Base - An instance of the anychart.cartesian.series.Base class for method chaining.

xPointPosition

Returns current position of the point on an ordinal scale.

Returns:

number - Current x-point position.
Sets position of the point on an oridnal scale.

Params:

NameTypeDefaultDescription
positionnumber
0.5
Point position (in 0 to 1 range).
For bars, columns and ohlc series it's autocalculated if chart contains more than one series.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.

xScale

Getter for current series X scale.

Returns:

anychart.scales.Base - Current series X Scale.
Setter for series X scale.

Params:

NameTypeDescription
valueanychart.scales.BaseValue to set.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.

yScale

Getter for current series Y scale.

Returns:

anychart.scales.Base - Current series Y Scale.
Setter for series Y scale.

Params:

NameTypeDescription
valueanychart.scales.BaseValue to set.

Returns:

anychart.cartesian.series.Base - anychart.cartesian.series.Base instance for method chaining.