chaco.function_data_source module

Defines the FunctionDataSource class to create an ArrayDataSource from a callable.

class chaco.function_data_source.FunctionDataSource(**kw)

Bases: chaco.array_data_source.ArrayDataSource

A data source that lazily generates its data array from a callable.

The signature of the func attribute is func(low, high) where low and high are attributes of the data_range attribute (instance of a DataRange1D).

This class does not listen to the array for value changes; if you need that behavior, create a subclass that hooks up the appropriate listeners.

data_range = Instance(DataRange1D)

A reference to a datarange

func = Callable

The function to call with the low and high values of the range. It should return an array of values.

recalculate(event=None)
remove_mask()

Removes the mask on this data source.

set_data(*args, **kw)

Sets the data, and optionally the sort order, for this data source.

Parameters
  • newdata (array) – The data to use.

  • sort_order (SortOrderTrait) – The sort order of the data

set_mask(mask)

Sets the mask for this data source.