C# Class Plasma.SignalPlotter

Inheritance: Qyoto.QGraphicsWidget, IDisposable
Show file Open project: 0xd34df00d/Qross

Private Properties

Property Type Description
Paint void
SetGeometry void

Public Methods

Method Description
AddPlot ( QColor color ) : void Add a new line to the graph plotter, with the specified color. Note that the order you add the plots must be the same order that the same data is given in (unless you reorder the plots). name="color" the color to use for this plot
AddSample ( List samples ) : void Add data to the graph, and advance the graph by one time period. The data must be given as a list in the same order that the plots were added (or consequently reordered). name="samples" a list with the new value for each plot
Dispose ( ) : void
GetSnapshotImage ( uint width, uint height ) : QPixmap Render the graph to the specified width and height, and return it as an image. This is useful, for example, if you draw a small version of the graph, but then want to show a large version in a tooltip etc name="width" the width of the snapshot name="height" the height of the snapshot
LastValue ( uint i ) : double Return the last value that we have for plot i. Returns 0 if not known. name="i" the plot we like to have the last value from
LastValueAsString ( uint i ) : string Return a translated string like: "34 %" or "100 KB" for plot i name="i" the plot we like to have the value as string from
PlotColors ( ) : List Return the list of plot colors, in the order that the plots were added (or later reordered).
RemovePlot ( uint pos ) : void Removes the plot at the specified index. name="pos" the index of the plot to be removed
ReorderPlots ( List newOrder ) : void Reorder the plots into the order given. For example:
 KSignalPlotter s = KSignalPlotter(parent); s.AddPlot(Qt.Blue); s.AddPlot(Qt.Green); QList neworder; neworder << 1 << 0; reorderPlots(newOrder); //Now the order is Green then Blue 
name="newOrder" a list with the new position of each plot
SetVerticalRange ( double min, double max ) : void Change the minimum and maximum values drawn on the graph. Note that these values are sanitised. For example, if you set the minimum as 3, and the maximum as 97, then the graph would be drawn between 0 and 100. The algorithm to determine this "nice range" attempts to minimize the number of non-zero digits. Use setAutoRange instead to determine the range automatically from the data. name="min" the minimum value to use for the vertical axis name="max" the maximum value to use for the vertical axis
SignalPlotter ( ) : System
SignalPlotter ( IQGraphicsItem parent ) : System
VerticalMaxValue ( ) : double Get the max value of the vertical axis. @see changeRange
VerticalMinValue ( ) : double Get the min value of the vertical axis. @see changeRange

Protected Methods

Method Description
CalculateNiceRange ( ) : void
CreateProxy ( ) : void
DrawAxisText ( QPainter p, int top, int h ) : void
DrawBackground ( QPainter p, int w, int h ) : void
DrawHorizontalLines ( QPainter p, int top, int w, int h ) : void
DrawPlots ( QPainter p, int top, int w, int h, int horizontalScale ) : void
DrawThinFrame ( QPainter p, int w, int h ) : void
DrawTopBarContents ( QPainter p, int x, int width, int height ) : void
DrawTopBarFrame ( QPainter p, int separatorX, int height ) : void
DrawVerticalLines ( QPainter p, int top, int w, int h ) : void
DrawWidget ( QPainter p, uint w, uint height, int horizontalScale ) : void
SignalPlotter ( Type dummy ) : System
UpdateDataBuffers ( ) : void

Private Methods

Method Description
Paint ( QPainter painter, QStyleOptionGraphicsItem option, QWidget widget ) : void
SetGeometry ( Qyoto.QRectF geometry ) : void

Method Details

AddPlot() public method

Add a new line to the graph plotter, with the specified color. Note that the order you add the plots must be the same order that the same data is given in (unless you reorder the plots). name="color" the color to use for this plot
public AddPlot ( QColor color ) : void
color Qyoto.QColor
return void

AddSample() public method

Add data to the graph, and advance the graph by one time period. The data must be given as a list in the same order that the plots were added (or consequently reordered). name="samples" a list with the new value for each plot
public AddSample ( List samples ) : void
samples List
return void

CalculateNiceRange() protected method

protected CalculateNiceRange ( ) : void
return void

CreateProxy() protected method

protected CreateProxy ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

DrawAxisText() protected method

protected DrawAxisText ( QPainter p, int top, int h ) : void
p Qyoto.QPainter
top int
h int
return void

DrawBackground() protected method

protected DrawBackground ( QPainter p, int w, int h ) : void
p Qyoto.QPainter
w int
h int
return void

DrawHorizontalLines() protected method

protected DrawHorizontalLines ( QPainter p, int top, int w, int h ) : void
p Qyoto.QPainter
top int
w int
h int
return void

DrawPlots() protected method

protected DrawPlots ( QPainter p, int top, int w, int h, int horizontalScale ) : void
p Qyoto.QPainter
top int
w int
h int
horizontalScale int
return void

DrawThinFrame() protected method

protected DrawThinFrame ( QPainter p, int w, int h ) : void
p Qyoto.QPainter
w int
h int
return void

DrawTopBarContents() protected method

protected DrawTopBarContents ( QPainter p, int x, int width, int height ) : void
p Qyoto.QPainter
x int
width int
height int
return void

DrawTopBarFrame() protected method

protected DrawTopBarFrame ( QPainter p, int separatorX, int height ) : void
p Qyoto.QPainter
separatorX int
height int
return void

DrawVerticalLines() protected method

protected DrawVerticalLines ( QPainter p, int top, int w, int h ) : void
p Qyoto.QPainter
top int
w int
h int
return void

DrawWidget() protected method

protected DrawWidget ( QPainter p, uint w, uint height, int horizontalScale ) : void
p Qyoto.QPainter
w uint
height uint
horizontalScale int
return void

GetSnapshotImage() public method

Render the graph to the specified width and height, and return it as an image. This is useful, for example, if you draw a small version of the graph, but then want to show a large version in a tooltip etc name="width" the width of the snapshot name="height" the height of the snapshot
public GetSnapshotImage ( uint width, uint height ) : QPixmap
width uint
height uint
return Qyoto.QPixmap

LastValue() public method

Return the last value that we have for plot i. Returns 0 if not known. name="i" the plot we like to have the last value from
public LastValue ( uint i ) : double
i uint
return double

LastValueAsString() public method

Return a translated string like: "34 %" or "100 KB" for plot i name="i" the plot we like to have the value as string from
public LastValueAsString ( uint i ) : string
i uint
return string

PlotColors() public method

Return the list of plot colors, in the order that the plots were added (or later reordered).
public PlotColors ( ) : List
return List

RemovePlot() public method

Removes the plot at the specified index. name="pos" the index of the plot to be removed
public RemovePlot ( uint pos ) : void
pos uint
return void

ReorderPlots() public method

Reorder the plots into the order given. For example:
 KSignalPlotter s = KSignalPlotter(parent); s.AddPlot(Qt.Blue); s.AddPlot(Qt.Green); QList neworder; neworder << 1 << 0; reorderPlots(newOrder); //Now the order is Green then Blue 
name="newOrder" a list with the new position of each plot
public ReorderPlots ( List newOrder ) : void
newOrder List
return void

SetVerticalRange() public method

Change the minimum and maximum values drawn on the graph. Note that these values are sanitised. For example, if you set the minimum as 3, and the maximum as 97, then the graph would be drawn between 0 and 100. The algorithm to determine this "nice range" attempts to minimize the number of non-zero digits. Use setAutoRange instead to determine the range automatically from the data. name="min" the minimum value to use for the vertical axis name="max" the maximum value to use for the vertical axis
public SetVerticalRange ( double min, double max ) : void
min double
max double
return void

SignalPlotter() public method

public SignalPlotter ( ) : System
return System

SignalPlotter() public method

public SignalPlotter ( IQGraphicsItem parent ) : System
parent IQGraphicsItem
return System

SignalPlotter() protected method

protected SignalPlotter ( Type dummy ) : System
dummy System.Type
return System

UpdateDataBuffers() protected method

protected UpdateDataBuffers ( ) : void
return void

VerticalMaxValue() public method

Get the max value of the vertical axis. @see changeRange
public VerticalMaxValue ( ) : double
return double

VerticalMinValue() public method

Get the min value of the vertical axis. @see changeRange
public VerticalMinValue ( ) : double
return double