Class: DataTableCore

DataTableCore

new DataTableCore( [options])

Constructs an instance of the DataTable class.

Parameters:
Name Type Argument Description
options Highcharts.DataTableOptions <optional>

Options to initialize the new DataTable instance.

Example
const dataTable = new Highcharts.DataTableCore({
  columns: {
    year: [2020, 2021, 2022, 2023],
    cost: [11, 13, 12, 14],
    revenue: [12, 15, 14, 18]
  }
});

Methods

getColumn(columnName)

Fetches the given column by the canonical column name. Simplified version of the full DataTable.getRow method, always returning by reference.

Parameters:
Name Type Description
columnName string

Name of the column to get.

Returns:
Highcharts.DataTableColumn | undefined .

A copy of the column, or undefined if not found.

getColumns( [columnNames])

Retrieves all or the given columns. Simplified version of the full DataTable.getColumns method, always returning by reference.

Parameters:
Name Type Argument Description
columnNames Array.<string> <optional>

Column names to retrieve.

Returns:
Highcharts.DataTableColumnCollection .

Collection of columns. If a requested column was not found, it is undefined.

getRow(rowIndex [, columnNames])

Retrieves the row at a given index.

Parameters:
Name Type Argument Description
rowIndex number

Row index to retrieve. First row has index 0.

columnNames Array.<string> <optional>

Column names to retrieve.

Returns:
Record.<string, (number|string|undefined)> | undefined .

Returns the row values, or undefined if not found.

setColumn(columnName [, column] [, rowIndex] [, eventDetail])

Sets cell values for a column. Will insert a new column, if not found.

Parameters:
Name Type Argument Default Description
columnName string

Column name to set.

column Highcharts.DataTableColumn <optional>

Values to set in the column.

rowIndex number <optional>
0

Index of the first row to change. (Default: 0)

eventDetail Record.<string, (boolean|number|string|null|undefined)> <optional>

Custom information for pending events.

Fires:
  • event:#setColumns
  • event:#afterSetColumns

setColumns(columns [, rowIndex] [, eventDetail])

  • Sets cell values for multiple columns. Will insert new columns, if not found. Simplified version of the full DataTable.setColumns, limited to full replacement of the columns (undefined rowIndex).
Parameters:
Name Type Argument Description
columns Highcharts.DataTableColumnCollection

Columns as a collection, where the keys are the column names.

rowIndex number <optional>

Index of the first row to change. Keep undefined to reset.

eventDetail Record.<string, (boolean|number|string|null|undefined)> <optional>

Custom information for pending events.

Fires:
  • event:#setColumns
  • event:#afterSetColumns

setRow(row [, rowIndex] [, insert] [, eventDetail])

Sets cell values of a row. Will insert a new row if no index was provided, or if the index is higher than the total number of table rows. A simplified version of the full DateTable.setRow, limited to objects.

Parameters:
Name Type Argument Description
row Record.<string, (number|string|undefined)>

Cell values to set.

rowIndex number <optional>

Index of the row to set. Leave undefind to add as a new row.

insert boolean <optional>

Whether to insert the row at the given index, or to overwrite the row.

eventDetail Record.<string, (boolean|number|string|null|undefined)> <optional>

Custom information for pending events.

Fires:
  • event:#afterSetRows