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

class anychart.data.View Improve this Doc

Extends: anychart.Base

View is a representation of raw data.
Note: Default View is a view with default mapping.

Methods Overview

Miscellaneous
concat()Concatenates two views to make a derived view that contains rows from both views.
derive()Creates a derived view, containing just the same data set and order as this view does.
filter()Creates a derived view, containing only the rows that pass the filter.
getIterator()Returns a new iterator for the current view.
getRowsCount()Returns the number of the rows in the current view.
meta()Getter for a metadata value.
row()Gets a full row of the set by an index.
sort()Creates a derived view that ensures sorting by a passed field.

Methods Description

concat

Concatenates two views to make a derived view that contains rows from both views.

Params:

NameTypeDescription
otherViewanychart.data.IView | ArrayA view, data set or even an array to concat with.

Returns:

anychart.data.IView - The new derived view.

derive

Creates a derived view, containing just the same data set and order as this view does.

Returns:

anychart.data.View - The new derived view.

filter

Creates a derived view, containing only the rows that pass the filter.

Params:

NameTypeDescription
fieldNamestringA field which value will be passed to a filter function.
funcfunctionA filter function that should accept a field value and return true if the row should be included into the resulting view.

Returns:

anychart.data.View - The new derived view.

getIterator

Returns a new iterator for the current view.

Returns:

anychart.data.Iterator - New iterator.

getRowsCount

Returns the number of the rows in the current view.

Returns:

number - The number of the rows in the set.

meta

Getter for a metadata value.
Learn how it works at anychart.data.Iterator#meta.

Params:

NameTypeDescription
indexnumberRow index.
namestringName of the metadata field.

Returns:

* - Current value.
Setter for a metadata value. Learn how it works at anychart.data.Iterator#meta.

Params:

NameTypeDescription
indexnumberRow index.
namestringName of the metadata field.
value*Value to set.

Returns:

anychart.data.View - The instance of anychart.data.View class for method chaining.

row

Gets a full row of the set by an index.
Note: If there is no row with the given index, methods returns undefined.
See sample at anychart.data.Set#row

Params:

NameTypeDescription
rowIndexnumberAn index of the row to fetch.

Returns:

* - The row.
Sets a row of the set by an index.
Note: Previous value of a row is returned but it is lost completely after that!.

Params:

NameTypeDescription
rowIndexnumberAn index of the row to fetch.
value*A value to set.

Returns:

* - Previous value of the row.

sort

Creates a derived view that ensures sorting by a passed field.

Params:

NameTypeDescription
fieldNamestringA field name to make sort by.
comparatorOrOrderanychart.enums.Sort | functionA sorting function that should accept two field values and return numeric result of the comparison or string value of anychart.enums.Sort enumeration except NONE. Defaults to anychart.enums.Sort.ASC.

Returns:

anychart.data.View - The new derived view.