Class: Data

Highcharts. Data

new Data(dataOptions [, chartOptions] [, chart])

The Data class

Parameters:
Name Type Argument Description
dataOptions Highcharts.DataOptions
chartOptions Highcharts.Options <optional>
chart Highcharts.Chart <optional>
Requires:
  • module:modules/data

Requires

  • module:modules/data

Members

dateFormats :Highcharts.Dictionary.<Highcharts.DataDateFormatObject>

A collection of available date formats, extendable from the outside to support custom date formats.

Type:

Methods

fetchLiveData()

Fetch or refetch live data

Returns:
boolean .

The URLs that were tried can be found in the options

getData()

Get the parsed data in a form that we can apply directly to the series.data config. Array positions can be mapped using the series.keys option.

Returns:
Array.<Array.<DataValueType>> | undefined .

Data rows

Example
const data = Highcharts.data({
  csv: document.getElementById('data').innerHTML
}).getData();

getDataTable()

Return a DataTable with the parsed data

Since:
  • 13.0.0
Returns:
Highcharts.DataTable .

DataTable with the parsed data

Example
const csv = await fetch(
  'https://www.example.com/sample-data.csv'
).then(result => result.text());
const dataTable = new Highcharts.Data({ csv }).getDataTable();
Try it

parseCSV()

Parse a CSV input string

parseColumn(column, col)

Parse a single column. Set properties like .isDatetime and .isNumeric.

Parameters:
Name Type Description
column Array.<Highcharts.DataValueType>

Column to parse

col number

Column index

parseDate()

Parse a date and return it as a number. Overridable through options.parseDate.

parseGoogleSpreadsheet()

Parse a Google spreadsheet.

Returns:
boolean .

Always returns false, because it is an intermediate fetch.

parseTable()

Parse a HTML table

parseTypes()

Parse numeric cells in to number types and date types in to true dates.

parsed()

A hook for working directly on the parsed columns

trim(str [, inside])

Trim a string from whitespaces.

Parameters:
Name Type Argument Default Description
str string

String to trim

inside boolean <optional>
false

Remove all spaces between numbers.

Returns:
string .

Trimmed string

update(options [, redraw])

Updates the chart with new data options.

Parameters:
Name Type Argument Default Description
options Highcharts.DataOptions

The new data options.

redraw boolean <optional>
true

Whether to redraw the chart after the new options are set.

<static> rowsToColumns()

Reorganize rows into columns.