Elm-Vega Data Tests

Simple Data loading and generation

The following should all appear identical but were generated via different data functions.

Data from columns
Data from rows
Data from json
Data from csv file
Data from tsv file
Data from csv file using custom dsv with comma delimeter
Data from json file
Data named inline data row source
Data named inline data column source
Data named inline json source
Data from arrow file

Named datasets

Named data inline source
Named data url source
Named data but with no data specified

Loaded geo Files

Data from external topojson file. Should show London boroughs in multiple nominal colours with legend.

Programatically generated geoFiles

Data from inline geo file. Should be two coloured regions with legend.

Data transforms

Flattened data structures from arrays.
Folded data structures into key,value pairs.
Pivoted key,value pairs back to unfolded fields.

Domain Specification

Data ranging from 95-105 with no domain specified.
As previous but with domain set to [90,100].
As previous but unioned with domain set to [90,100] (should show 90 to 105).

Data imputation

Simple imputation as a transform adding missing values when a=3 and c=1 by inserting b=0
Simple imputation as a transform adding missing values when a=3 and c=1 by inserting b= mean of non-missing b values when c=1.
Simple imputation as a transform adding missing values when a=3 and c=1 by inserting b= mean of previous two b values when c=1.
Simple imputation as a channel adding missing values when a=3 and c=1 by inserting b=0
Simple imputation as a channel adding missing values when a=3 and c=1 by inserting b= mean of non-missing b values when c=1.
Simple imputation as a channel adding missing values when a=3 and c=1 by inserting b= mean of previous two b values when c=1.
Simple imputation as a channel inserting b=100 when a is 4
Simple imputation as a channel inserting b=100 when a is between 4 and less than 6

Data Sampling

Sample up to 200 points in right hand chart

Data Binning

Histogram based on pre-binned data
Default binning of Guassian distributed random numbers with mean of 10 and stdev of 2.
As previous but anchoring on 0.5

Sequence Generators

Sine curve sequence using default seq name
Sine curve sequence using custom seq name

Filtering

Filter using a single filter expression so that only A C or E categories are selected.
Filter using composed filter expressions so that only A C or E categories are selected (should appear identical to previous test).

Annotation

Annotation layer with null data to prevent inheriting parent in layered spec.
Use of datum literal to provide a dashed annotation line in data space at 200 on the y-axis.
and at 2016 on the x-axis.

Axis Replication/Shifting with Datum

Highlight origin-intersecting axes with datum and rule.
Shift axes to data origin. This approach avoids the use of experimental signals in vega-lite, but is not entirely satisfactory as it relies on hard coding of domain extents.

Text Encoding Datum

Create text datum numeric constant so it can be encoded and formatted to 2dp.
Create text datum boolean constant.
Create text datum string constant.
Create conditional text that depends on whether data values are odd or even.

Source