Series¶
- class leather.Series(data, x=None, y=None, name=None)¶
A series of data and its associated metadata.
Series object does not modify the data it is passed.
- Parameters
data –
A sequence (rows) of sequences (columns), a.k.a.
csv.reader()format. If thexandyare not specified then the first column is used as the X values and the second column is used for Y.Or, a sequence of (rows) of dicts (columns), a.k.a.
csv.DictReaderformat. If this format is used thenxandyarguments must specify the columns to be charted.Or, a custom data format, in which case
xandymust specifykey_function().x –
If using sequence row data, then this may be either an integer index identifying the X column, or a
key_function().If using dict row data, then this may be either a key name identifying the X column, or a
key_function().If using a custom data format, then this must be a
key_function().`y – See
x.name – An optional name to be used in labeling this series. This will be used as the chart title if rendered in a
Lattice.
- leather.key_function(row, index)¶
This example shows how to define a function to extract X and Y values from custom data.
- Parameters
row – The function will be called with the row data, in whatever format it was provided to the
Series.index – The row index in the series data will also be provided.
- Returns
The function must return a chartable value.