Plasma
signalplotter.cpp
Go to the documentation of this file.
573 uint horizontalStep = (uint)((1.0 * w / size().width()) + 0.5); // get the closest integer horizontal step
623 uint top = p->pen().width() / 2; // The y position of the top of the graph. Basically this is one more than the height of the top bar
629 bool showTopBar = d->showTopBar && h > (fontheight/*top bar size*/ +5/*smallest reasonable size for a graph*/);
631 top += fontheight; // The top bar has the same height as fontheight. Thus the top of the graph is at fontheight
923 int offset = 0; // Our line is 2 pixels thick. This means that when we draw the area, we need to offset
928 // If we use autorange, then we need to prepare the min and max values for _next_ time we paint.
1058 top + (y * (h - 1)) / (d->horizontalLinesCount + 1); // Make sure it's y*h first to avoid rounding bugs
1081 // note that the y_coord starts from 0. so we draw from pixel number 0 to h-1. Thus the -1 in the y_coord
1082 int y_coord = top + (y * (h - 1)) / (d->horizontalLinesCount + 1); // Make sure it's y*h first to avoid rounding bugs
1100 double value = d->plotData.first()[i] / d->scaledBy; // retrieve the newest value for this plot then scale it correct
void setShowTopBar(bool value)
Whether to show the title etc at the top.
Definition: signalplotter.cpp:467
qreal x() const
qreal y() const
int ascent() const
void setShowLabels(bool value)
Whether to show the vertical axis labels.
Definition: signalplotter.cpp:453
bool end()
void fillRect(const QRectF &rectangle, const QBrush &brush)
QPixmap getSnapshotImage(uint width, uint height)
Render the graph to the specified width and height, and return it as an image.
Definition: signalplotter.cpp:571
void setRenderHint(RenderHint hint, bool on)
void setMinimumSize(const QSizeF &size)
void drawWidget(QPainter *p, uint w, uint height, int horizontalScale)
Definition: signalplotter.cpp:606
void setColorAt(qreal position, const QColor &color)
bool showHorizontalLines() const
Whether to draw the horizontal grid lines.
void drawHorizontalLines(QPainter *p, int top, int w, int h)
Definition: signalplotter.cpp:1077
const T & at(int i) const
void removeAt(int i)
uint horizontalScale() const
The number of pixels horizontally between data points.
void drawAxisText(QPainter *p, int top, int h)
Definition: signalplotter.cpp:1038
void setUseAutoRange(bool value)
Set the minimum and maximum values on the vertical axis automatically from the data available...
Definition: signalplotter.cpp:306
void cubicTo(const QPointF &c1, const QPointF &c2, const QPointF &endPoint)
the text color to be used by items resting on the background
Definition: theme.h:63
QList< PlotColor > & plotColors()
Return the list of plot colors, in the order that the plots were added (or later reordered).
Definition: signalplotter.cpp:258
void setAlpha(int alpha)
void moveTo(const QPointF &point)
SignalPlotter(QGraphicsItem *parent=0)
Definition: signalplotter.cpp:116
Q_INVOKABLE void addPlot(const QColor &color)
Add a new line to the graph plotter, with the specified color.
Definition: signalplotter.cpp:169
void drawVerticalLines(QPainter *p, int top, int w, int h)
Definition: signalplotter.cpp:799
void drawLine(const QLineF &line)
void setThinFrame(bool set)
Whether to show a white line on the left and bottom of the widget, for a 3D effect.
Definition: signalplotter.cpp:533
QString lastValueAsString(uint i) const
Return a translated string like: "34 %" or "100 KB" for plot i.
Definition: signalplotter.cpp:1095
void update(const QRectF &rect)
QColor dark(int factor) const
int size() const
Q_INVOKABLE void removePlot(uint pos)
Removes the plot at the specified index.
Definition: signalplotter.cpp:263
void setHorizontalScale(uint scale)
Set the number of pixels horizontally between data points.
Definition: signalplotter.cpp:328
QSizeF size() const
void setCapStyle(Qt::PenCapStyle style)
void setShowHorizontalLines(bool value)
Whether to draw the horizontal grid lines.
Definition: signalplotter.cpp:400
void setFont(const QFont &font)
QPointF pos() const
int count(const T &value) const
Q_INVOKABLE void addSample(const QList< double > &samples)
Add data to the graph, and advance the graph by one time period.
Definition: signalplotter.cpp:182
void append(const T &value)
virtual void setGeometry(const QRectF &geometry)
Overwritten to be notified of size changes.
Definition: signalplotter.cpp:582
void setPen(const QColor &color)
void setVerticalLinesScroll(bool value)
Whether the vertical lines move with the data.
Definition: signalplotter.cpp:386
void lineTo(const QPointF &endPoint)
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
bool isEmpty() const
void drawBackground(QPainter *p, int w, int h)
Definition: signalplotter.cpp:699
void setFontColor(const QColor &color)
The color of the font used for the axis.
Definition: signalplotter.cpp:414
QColor verticalLinesColor() const
The color of the vertical grid lines.
void setBrush(const QBrush &brush)
void drawText(const QPointF &position, const QString &text)
QColor backgroundColor() const
The color to set the background.
double verticalMinValue() const
Get the min value of the vertical axis.
Definition: signalplotter.cpp:318
double verticalMaxValue() const
Get the max value of the vertical axis.
Definition: signalplotter.cpp:323
void drawTopBarContents(QPainter *p, int x, int width, int height)
Definition: signalplotter.cpp:768
void setColor(const QColor &color)
double lastValue(uint i) const
Return the last value that we have for plot i.
Definition: signalplotter.cpp:1087
void setSizePolicy(const QSizePolicy &policy)
bool verticalLinesScroll() const
Whether the vertical lines move with the data.
void setVerticalLinesColor(const QColor &color)
The color of the vertical grid lines.
Definition: signalplotter.cpp:358
void setBackgroundColor(const QColor &color)
The color to set the background.
Definition: signalplotter.cpp:519
QString unit() const
Return the units used on the vertical axis of the graph.
int leading() const
void setStackPlots(bool stack)
Whether to stack the plots on top of each other.
Definition: signalplotter.cpp:547
QVariant data(int key) const
void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation)
void drawPath(const QPainterPath &path)
int width() const
void setWidth(int width)
void drawTopBarFrame(QPainter *p, int separatorX, int height)
Definition: signalplotter.cpp:756
QColor horizontalLinesColor() const
The color of the horizontal grid lines.
bool thinFrame() const
show a white line on the left and bottom of the widget for a 3D effect
void setVerticalLinesDistance(uint distance)
The horizontal distance between the vertical grid lines.
Definition: signalplotter.cpp:372
QFontMetrics fontMetrics() const
void setHorizontalLinesColor(const QColor &color)
The color of the horizontal grid lines.
Definition: signalplotter.cpp:424
void drawThinFrame(QPainter *p, int w, int h)
Definition: signalplotter.cpp:709
int height() const
uint verticalLinesDistance() const
The horizontal distance between the vertical grid lines.
void setShowVerticalLines(bool value)
Whether to draw the vertical grid lines.
Definition: signalplotter.cpp:344
void setVerticalRange(double min, double max)
Change the minimum and maximum values drawn on the graph.
Definition: signalplotter.cpp:251
void setAlphaF(qreal alpha)
Q_INVOKABLE void reorderPlots(const QList< uint > &newOrder)
Reorder the plots into the order given.
Definition: signalplotter.cpp:222
Q_INVOKABLE QColor color(ColorRole role) const
Returns the text color to be used by items resting on the background.
Definition: theme.cpp:918
void setSvgBackground(const QString &filename)
The filename of the svg background.
Definition: signalplotter.cpp:497
bool showVerticalLines() const
Whether the vertical grid lines will be drawn.
qreal height() const
bool useAutoRange() const
Whether the vertical axis range is set automatically.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
const QPen & pen() const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
virtual void setGeometry(const QRectF &rect)
void drawPlots(QPainter *p, int top, int w, int h, int horizontalScale)
Definition: signalplotter.cpp:807
uint horizontalLinesCount() const
The number of horizontal lines to draw.
Definition: signalplotter.h:34
void setHorizontalLinesCount(uint count)
The number of horizontal lines to draw.
Definition: signalplotter.cpp:438
qreal width() const
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: signalplotter.cpp:589
qreal scale() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:12 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:12 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.