PyDMTimePlot

class pydm.widgets.timeplot.PyDMTimePlot(parent=None, init_y_channels=[], plot_by_timestamps=True, background='default')[source]

PyDMWaveformPlot is a widget to plot one or more waveforms.

Each curve can plot either a Y-axis waveform vs. its indices, or a Y-axis waveform against an X-axis waveform.

Parameters
  • parent (optional) – The parent of this widget.

  • init_y_channels (list) – A list of scalar channels to plot vs time.

  • plot_by_timestamps (bool) – If True, the x-axis shows timestamps as ticks, and those timestamps scroll to the left as time progresses. If False, the x-axis tick marks show time relative to the current time.

  • background (optional) – The background color for the plot. Accepts any arguments that pyqtgraph.mkColor will accept.

addLegendItem(item, pv_name, force_show_legend=False)[source]

Add an item into the graph’s legend.

Parameters
  • item (TimePlotCurveItem) – A curve being plotted in the graph

  • pv_name (str) – The PV channel

  • force_show_legend (bool) – True to make the legend to be displayed; False to just add the item, but do not display the legend.

addYChannel(y_channel=None, name=None, color=None, lineStyle=None, lineWidth=None, symbol=None, symbolSize=None)[source]

Adds a new curve to the current plot

Parameters
  • y_channel (str) – The PV address

  • name (str) – The name of the curve (usually made the same as the PV address)

  • color (QColor) – The color for the curve

  • lineStyle (str) – The line style of the curve, i.e. solid, dash, dot, etc.

  • lineWidth (int) – How thick the curve line should be

  • symbol (str) – The symbols as markers along the curve, i.e. circle, square, triangle, star, etc.

  • symbolSize (int) – How big the symbols should be

Returns

new_curve – The newly created curve.

Return type

TimePlotCurveItem

autoRangeY

Whether or not the Y-axis automatically rescales to fit the data. If true, the values in minYRange and maxYRange are ignored.

bufferSize

Get the size of the data buffer for the entire chart.

Returns

size – The chart’s data buffer size.

Return type

int

clearCurves()[source]

Remove all curves from the graph.

curves

Dump the current list of curves and each curve’s settings into a list of JSON-formatted strings.

Returns

settings – A list of JSON-formatted strings, each containing a curve’s settings

Return type

list

enableCrosshair(is_enabled, starting_x_pos=-30, starting_y_pos=0, vertical_angle=90, horizontal_angle=0, vertical_movable=False, horizontal_movable=False)[source]

Display a crosshair on the graph.

Parameters
  • is_enabled (bool) – True is to display the crosshair; False is to hide it.

  • starting_x_pos (float) – The x position where the vertical line will cross

  • starting_y_pos (float) – The y position where the horizontal line will cross

  • vertical_angle (int) – The angle of the vertical line

  • horizontal_angle (int) – The angle of the horizontal line

  • vertical_movable (bool) – True if the user can move the vertical line; False if not

  • horizontal_movable (bool) – True if the user can move the horizontal line; False if not

findCurve(pv_name)[source]

Find a curve from a graph’s curve list.

Parameters

pv_name (str) – The curve’s PV address.

Returns

curve – The found curve, or None.

Return type

TimePlotCurveItem

getBufferSize()[source]

Get the size of the data buffer for the entire chart.

Returns

size – The chart’s data buffer size.

Return type

int

getCurves()[source]

Dump the current list of curves and each curve’s settings into a list of JSON-formatted strings.

Returns

settings – A list of JSON-formatted strings, each containing a curve’s settings

Return type

list

getTimeSpan()[source]

The extent of the x-axis of the chart, in seconds. In other words, how long a data point stays on the plot before falling off the left edge.

Returns

time_span – The extent of the x-axis of the chart, in seconds.

Return type

float

getUpdateInterval()[source]

Get the update interval for the chart.

Returns

interval – The update interval of the chart.

Return type

float

maxYRange

Maximum Y-axis value visible on the plot.

minYRange

Minimum Y-axis value visible on the plot.

redrawPlot()[source]

Redraw the graph

refreshCurve(curve)[source]

Remove a curve currently being plotted on the timeplot, then redraw that curve, which could have been updated with a new symbol, line style, line width, etc.

Parameters

curve (TimePlotCurveItem) – The curve to be re-added.

removeLegendItem(pv_name)[source]

Remove an item from the legend.

Parameters

pv_name (str) – The PV channel, used to search for the legend item to remove.

removeYChannel(curve)[source]

Remove a curve from the graph. This also stops update the timer associated with the curve.

Parameters

curve (TimePlotCurveItem) – The curve to be removed.

removeYChannelAtIndex(index)[source]

Remove a curve from the graph, given its index in the graph’s curve list.

Parameters

index (int) – The curve’s index from the graph’s curve list.

resetBufferSize()[source]

Reset the data buffer size of the chart, and each of the chart’s curve’s data buffer, to the minimum

resetTimeSpan()[source]

Reset the timespan to the default value.

resetUpdateInterval()[source]

Reset the chart’s update interval to the default.

setBufferSize(value)[source]

Set the size of the data buffer of the entire chart. This will also update the same value for each of the data buffer of each chart’s curve.

Parameters

value (int) – The new buffer size for the chart.

setCurves(new_list)[source]

Add a list of curves into the graph.

Parameters

new_list (list) – A list of JSON-formatted strings, each contains a curve and its settings

setTimeSpan(value)[source]

Set the extent of the x-axis of the chart, in seconds. In aynchronous mode, the chart will allocate enough buffer for the new time span duration. Data arriving after each duration will be recorded into the buffer having been rotated.

Parameters

value (float) – The time span duration, in seconds, to allocate enough buffer to collect data for, before rotating the buffer.

setUpdateInterval(value)[source]

Set a new update interval for the chart and update its data buffer size.

Parameters

value (float) – The new update interval value.

timeSpan

The extent of the x-axis of the chart, in seconds. In other words, how long a data point stays on the plot before falling off the left edge.

Returns

time_span – The extent of the x-axis of the chart, in seconds.

Return type

float

updateInterval

Get the update interval for the chart.

Returns

interval – The update interval of the chart.

Return type

float

updateXAxis(update_immediately=False)[source]

Update the x-axis for every graph redraw.

Parameters

update_immediately (bool) – Update the axis range(s) immediately if True, or defer until the next rendering.