# eric6.MicroPython.MicroPythonGraphWidget

Module implementing the MicroPython graph widget.

### Global Attributes

None

### Classes

MicroPythonGraphWidget | Class implementing the MicroPython graph widget.

### Functions

None

## MicroPythonGraphWidget

Class implementing the MicroPython graph widget.

### Signals

dataFlood
  emitted to indicate, that too much data is received

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

MicroPythonGraphWidget | Constructor
__addData | Private method to add a tuple of values to the graph.
__handleMaxXChanged | Private slot handling a change of the max.
hasData | Public method to check, if the chart contains some valid data.
isDirty | Public method to check, if the chart contains unsaved data.
on_saveButton_clicked | Private slot to save the raw data to a CSV file.
processData | Public slot to process the raw data.
saveData | Public method to save the dialog's raw data.

### Static Methods

None

#### MicroPythonGraphWidget (Constructor)

MicroPythonGraphWidget(parent=None)

Constructor

parent (QWidget)
  reference to the parent widget

#### MicroPythonGraphWidget.__addData

__addData(values)

Private method to add a tuple of values to the graph.

It ensures there are the required number of line series, adds the data to the line series and updates the range of the chart so the chart displays nicely.

values (tuple of int or float)
  tuple containing the data to be added

#### MicroPythonGraphWidget.__handleMaxXChanged

__handleMaxXChanged(value)

Private slot handling a change of the max. X spin box.

value (int)
  value of the spin box

#### MicroPythonGraphWidget.hasData

hasData()

Public method to check, if the chart contains some valid data.

Returns:
  flag indicating valid data

Return Type:
  bool

#### MicroPythonGraphWidget.isDirty

isDirty()

Public method to check, if the chart contains unsaved data.

Returns:
  flag indicating unsaved data

Return Type:
  bool

#### MicroPythonGraphWidget.on_saveButton_clicked

on_saveButton_clicked()

Private slot to save the raw data to a CSV file.

#### MicroPythonGraphWidget.processData

processData(data)

Public slot to process the raw data.

It takes raw bytes, checks the data for a valid tuple of ints or floats and adds the data to the graph. If the the length of the bytes data is greater than 1024 then a dataFlood signal is emitted to ensure eric can take action to remain responsive.

data (bytes)
  raw data received from the connected device via the main device widget

#### MicroPythonGraphWidget.saveData

saveData()

Public method to save the dialog's raw data.

Returns:
  flag indicating success

Return Type:
  bool

Up