class MyConnection
class Trace
start_client (loop, host, port, name)
lost_connection (client)
have_connection (client)
registerPoint (client, point_name, square=False, extend=False)
on_point_changed (client, point)
update_plot (client)
main ()
traceDictionary = dict()
int window_size = 60
current_time = datetime.now()
start_time = current_time - timedelta(minutes=1)
TrendChart.have_connection ( client)
Register points with the DataHub client upon connection.
Arguments:
client: The DataHub client.
TrendChart.lost_connection ( client)
Print out that the connection was lost.
Arguments:
client: The DataHub client.
TrendChart.main ( )
Main function to run everything.
TrendChart.on_point_changed ( client, point)
Handle point change events and update trend data.
Arguments:
client: The DataHub client.
point: The point that changed.
TrendChart.registerPoint ( client, point_name, square = False
, extend = False
)
Register a point with the DataHub client.
Arguments:
client: The DataHub client.
point_name: The name of the point.
square: Whether the trace should be a square wave.
extend: Whether the trace should extend the last value.
TrendChart.start_client ( loop, host, port, name)
Create and configure a DataHub client connection.
Arguments:
loop: The event loop.
host: The host address.
port: The port number.
name: The name of the connection.
Returns:
MyConnection: The configured client connection.
TrendChart.update_plot ( client)
Update the plot with new data.
Arguments:
client: The DataHub client.