PyDocs - graphs module


To use:

import graphs 

Module graphs

This module allows you to draw basic line graphs on the LCD screen, or on the web graph if you are running inside websensors.

# Set the style of a named graph in the output box.
def set_style(graphName,colour,minVal,maxVal,subgraph_x=None,subgraph_y=None)

# Add a value to a named graph in the output box
def on_value(graphName,value)

graphs.set_style

# graphs.set_style
def set_style(
    graphName,
    colour,
    minVal,
    maxVal,
    subgraph_x=None,
    subgraph_y=None
)

Set the style of a named graph in the output box.

Parameters

  • graphName(str)
    The name of the graph, used to send values to it, and displayed on screen
  • colour(str)
    The colour of the line, can be in the format “rgb(0,255,0)” or “red”, “blue” etc.
  • minVal(float)
    The value of the bottom of the graph
  • maxVal(float)
    The value of the top of the graph
  • subgraph_x(int, optional)
    If you set x subgraphs, the graph window will be split horizontally from 0 to the maximum subgraph you set.
  • subgraph_y(int, optional)
    If you set y subgraphs, the graph window will be split vertically from 0 to the maximum subgraph you set.

graphs.on_value

# graphs.on_value
def on_value(
    graphName,
    value
)

Add a value to a named graph in the output box

Parameters

  • graphName(str)
    The name of the graph, which should be the same as passed to set_graph_style
  • value(float)
    The value you want to add to the graph. If you add None, it doesn’t change the graph, this allows you to directly pass in the output of a `BlockAverageFilter` or similar which return None when there is no new value.