Class for drawing a graph having optional rulers and grid. This class uses sf::Draw class for drawing a graph rulers and grid. Use this class as a private class for a custom widget which produces a graph.
More...
#include <Graph.h>
|
| struct | RulerInfo |
| | Holds information on the rulers. Holds set and calculated information. More...
|
| |
|
| | Graph (const QPalette &palette={}) |
| | Constructor passing a palette.
|
| |
| void | setRuler (Draw::ERulerOrientation ro, double start, double stop, int digits, const QString &unit) |
| | Sets and thus enabling the ruler for the passed orientation.
|
| |
| void | setGrid (Draw::EGridOrientation go, Draw::ERulerOrientation ro) |
| | Enables grid painting in the graph. When painting this enables drawing grid for the passed orientation using the information of the passed ruler orientation.
|
| |
| void | setBounds (const QFontMetrics &fontMetrics, const QRect &bounds) |
| | Sets the bounding rectangle for the graph for painting in. Paints the graph passing the passed boundaries and the optional region when handling an event.
|
| |
| const QRect & | paint (QPainter &painter, const QRect &bounds, const QRegion ®ion=null_ref< QRegion >()) |
| | Paints the graph. Paints the graph passing the passed boundaries and the optional region when handling an event.
|
| |
| void | paintPlotCross (QPainter &painter, const QString &text) |
| | Paints a cross with text in the plot area. Used when a plot can not be painted.
|
| |
| const QRect & | getPlotArea () const |
| | Gets the remaining area to plot the graph after rulers and grid have been painted.
|
| |
| void | setColor (EColor index, QColor color) |
| | Allows setting of individual indexed colors for the graph.
|
| |
|
| bool | _debug {false} |
| | Draws only area bounds contours when enabled.
|
| |
Class for drawing a graph having optional rulers and grid. This class uses sf::Draw class for drawing a graph rulers and grid. Use this class as a private class for a custom widget which produces a graph.
◆ EColor
Colors enumeration of colors in the graph. Used by setColor function.
| Enumerator |
|---|
| cRulerText | Color of unit and values.
|
| cRulerLine | Color for lines of major and minor ticks.
|
| cGridLines | Color of the grid lines.
|
| cRulerBackground | Color of ruler background.
|
| cGraphBackground | Color of the graph area background.
|
| cGraphForeground | Color of the graph.
|
◆ Graph()
| sf::Graph::Graph |
( |
const QPalette & |
palette = {} | ) |
|
|
explicit |
Constructor passing a palette.
◆ getPlotArea()
| const QRect & sf::Graph::getPlotArea |
( |
| ) |
const |
Gets the remaining area to plot the graph after rulers and grid have been painted.
- Returns
- area rectangle to plot the actual graphic.
◆ getRulerInfo()
Gets the ruler information by orientation.
- Parameters
-
- Returns
- ruler information structure.
◆ paint()
| const QRect & sf::Graph::paint |
( |
QPainter & |
painter, |
|
|
const QRect & |
bounds, |
|
|
const QRegion & |
region = null_ref< QRegion >() |
|
) |
| |
Paints the graph. Paints the graph passing the passed boundaries and the optional region when handling an event.
- Parameters
-
| painter | Painter instance. |
| bounds | Boundaries to paint in. |
| region | Region in case of an event. |
- Returns
- Rectangle of the resulting graph area. Same value as getPlotArea() returns.
◆ paintPlotCross()
| void sf::Graph::paintPlotCross |
( |
QPainter & |
painter, |
|
|
const QString & |
text |
|
) |
| |
Paints a cross with text in the plot area. Used when a plot can not be painted.
- Parameters
-
| painter | Painter instance. |
| text | Text to paint in the middle in a rectangle. |
◆ setBounds()
| void sf::Graph::setBounds |
( |
const QFontMetrics & |
fontMetrics, |
|
|
const QRect & |
bounds |
|
) |
| |
Sets the bounding rectangle for the graph for painting in. Paints the graph passing the passed boundaries and the optional region when handling an event.
- Parameters
-
| fontMetrics | For calculating the ruler widths and heights. |
| bounds | Boundary to paint in. |
◆ setColor()
| void sf::Graph::setColor |
( |
EColor |
index, |
|
|
QColor |
color |
|
) |
| |
Allows setting of individual indexed colors for the graph.
- Parameters
-
| index | Index of the color which is set. |
| color | The specified color. |
◆ setGrid()
Enables grid painting in the graph. When painting this enables drawing grid for the passed orientation using the information of the passed ruler orientation.
- Parameters
-
| go | Grid orientation |
| ro | ruler orientation. |
◆ setRuler()
| void sf::Graph::setRuler |
( |
Draw::ERulerOrientation |
ro, |
|
|
double |
start, |
|
|
double |
stop, |
|
|
int |
digits, |
|
|
const QString & |
unit |
|
) |
| |
Sets and thus enabling the ruler for the passed orientation.
- Parameters
-
| ro | Orientation of the ruler. |
| start | ruler start value. |
| stop | ruler stop value. |
| digits | Precision of the ruler values. |
| unit | unit text of the ruler. |
◆ _bottom
◆ _colors
| QVector<QColor> sf::Graph::_colors |
|
protected |
Holds the colors for painting the rulers en grid.
◆ _debug
| bool sf::Graph::_debug {false} |
Draws only area bounds contours when enabled.
◆ _horizontal
Holds which ruler information is responsible.
◆ _left
◆ _plotArea
| QRect sf::Graph::_plotArea |
|
protected |
Holds the last calculated graph area rectangle.
◆ _right
◆ _top
◆ _vertical
The documentation for this class was generated from the following file: