Chart

class awe.chart.Chart[source]
add(data)[source]

Add new data to a chart after it has been created.

Parameters:data – A list of data items. Each data item is expected to match the format the transformer expects. A data item may also be supplied in the form of a 2-tuple (or a list) of (time, data), in which case, the first item is the epoch time in seconds with ms precision and the second item is the data item itself.
set(data)[source]

Override existing chart data with new data.

Parameters:data – A list of data items. Each data item is expected to match the format the transformer expects. A data item may also be supplied in the form of a 2-tuple (or a list) of (time, data), in which case, the first item is the epoch time in seconds with ms precision and the second item is the data item itself.
transformer
Returns:The currently set transformer.

Chart Data Transformers

noop

class awe.chart.NoOpTransformer[source]

The default transformer.

Assumes data is already in appropriate highcharts format.

key: noop

numbers

class awe.chart.NumberSequenceTransformer[source]

A numbers transformer.

Assumes each item in data is a single number or a list of numbers.

If a list of numbers is supplied, each number in the list is assumed to belong to a different series.

key: numbers

flat

class awe.chart.FlatDictTransformer(chart_mapping, series_mapping, value_key)[source]

A transformer that expects data items to be dictionaries.

key: flat

Parameters:
  • chart_mapping – A list of keys to build charts from. (combinations of them)
  • series_mapping – A list of keys to build chart series from. (combinations of them)
  • value_key – The key to the value of the data item.

[Ns]to[Ms]

class awe.chart.DictLevelsTransformer[source]

A transformer that handles nested dictionaries data items.

Usually instantiated by supplying a transform key in this format: [chart levels]to[series levels].

For example, a key of 23to1 assumes a “3 level” nested dictionary where the charts will be generated from the different combinations of keys in the 2nd and 3rd levels and the series for each chart will be generated from each key in the 1st level.

key: [Ns]to[Ms]