DataConverter

class visualife.core.DataConverter(plot, x_code, y_code)

Bases: object

Converts plot data values to screen coordinates values

Also stores x and y ranges for class Plot and has set_nice_range() method which provides automatic nice range for axes

Creates a DataConverter object

Parameters:
  • plot (Plot) – referance to plot to get axis to convert values
  • x_code (string) – letter that defines a AxisX location
  • y_code (string) – letter that defines a AxisY location

Attributes Summary

max_x Returns maximum of X data in screen coordinates
max_y Returns maximum of Y data in screen coordinates
min_x Returns minimum of X data in screen coordinates
min_y Returns minimum of Y data in screen coordinates
plot Returns a reference to a Plot that this converter belongs to

Methods Summary

convert_data(x_data, y_data) Converts x_data and y_data to screen coordinates
set_min_and_max_data(dataset) Sets min and max for X and Y data of all this converter’s series in a Plot
set_nice_range([what]) Finds a nice tics ranges for Plot data

Attributes Documentation

max_x

Returns maximum of X data in screen coordinates

max_y

Returns maximum of Y data in screen coordinates

min_x

Returns minimum of X data in screen coordinates

min_y

Returns minimum of Y data in screen coordinates

plot

Returns a reference to a Plot that this converter belongs to

Methods Documentation

convert_data(x_data, y_data)

Converts x_data and y_data to screen coordinates

param x_data:x_data to convert
type x_data:list
param y_data:y_data to convert
type y_data:list
return:tuple like (x_screen_data,y_screen_data)
set_min_and_max_data(dataset)

Sets min and max for X and Y data of all this converter’s series in a Plot

This values is neccesary to set_nice_range() method.

set_nice_range(what='xy')

Finds a nice tics ranges for Plot data

Uses min and max data stored in self