Limiting rows Since 0.16.5
Sometimes you may have a big, flat, data file where you may want to use some rows for one series and other rows for another. For series-based charts (e.g. scatter, line, bar, ridgeline) we can limit a particular series
to only use certain rows by adding the where
option to the series
. This uses a very basic SQL-like syntax that can parse simple comparisons =
, <
, <=
, >
, >=
and the boolean operators AND
and OR
.
For example, say we have a column titled London borough
(that has the values either isLondon
or notLondon
in each row) and a numeric column titled vacants_per_thousand_dwellings
. We can create multiple series from a flat file with something like the following:
series:
- title: Outside London
x: wage_ratio
y: vacants_per_thousand_dwellings
where: '"London borough"="notLondon" AND "vacants_per_thousand_dwellings"<50'
- title: London
x: wage_ratio
y: vacants_per_thousand_dwellings
where: '"London borough"="isLondon" AND "vacants_per_thousand_dwellings"<50'
- title: Empties outside London
x: wage_ratio
y: vacants_per_thousand_dwellings
where: '"London borough"="notLondon" AND "vacants_per_thousand_dwellings">=50'
- title: Empties in London
x: wage_ratio
y: vacants_per_thousand_dwellings
where: '"London borough"="isLondon" AND "vacants_per_thousand_dwellings">=50'