Dataset and transform

A dataset holds a chart's data as one table that several series can share, map with encode and reshape with sort and filter transforms.

LLMs

Rows of arrays

Pass a table to dataset.source with a header row, and each bar series picks up the next column on its own, one series per year.

Rows of objects

Give dataset.source an array of objects and list the keys in dimensions, which also sets the order the series read them in.

Rows or columns

Set seriesLayoutBy to row to read one series per product in the top chart, while the bottom chart reads one series per year.

Several pies, one table

Four pies share one dataset: the first takes the first column by default and the others pick a year with encode.value.

Encode

Map columns to axes with encode, products on the y axis and amounts on the x axis, and color each bar by its score with visualMap.

Shared dataset

A line chart and a pie read the same dataset, and the pie switches to the year under the pointer through updateAxisPointer.

Sort transform

Add a transform of type sort as a second dataset and point the series at it with datasetIndex, so the bars run highest first.

Filter transform

Split one table into a pie per year with filter transforms, and lay the pies out side by side or stacked with media queries.

Encode matrix

Four scatter plots in four grids read one dataset, each with its own encode pairing of income, life expectancy, population and country.