|
AvogadroLibs 1.103.0
|
A Qt widget for displaying charts via JKQtPlotter. More...
#include <avogadro/qtgui/chartwidget.h>
Public Types | |
| enum class | Axis { x , y } |
| Axis enumeration. | |
| enum class | LegendLocation { None , TopLeft , TopRight , BottomLeft , BottomRight } |
| Legend location enumeration, relative to the plot. | |
Signals | |
| void | clicked (float x, float y, Qt::KeyboardModifiers modifiers) |
| Emitted when the user single-clicks on the chart. | |
Public Member Functions | |
| ChartWidget (QWidget *p=nullptr) | |
| bool | addPlot (const std::vector< float > &x, const std::vector< float > &y, const color4ub &color=color4ub{ 0, 0, 0, 255 }, const QString &xName="x", const QString &yName="y") |
| Add a plot to the chart. | |
| bool | addSeries (const std::vector< float > &y, const color4ub &color=color4ub{ 0, 0, 0, 255 }, const QString &name="") |
| Add a series to an existing chart. | |
| bool | addPlots (const std::vector< std::vector< float > > &plotData, const color4ub &color=color4ub{ 0, 0, 0, 255 }, const QStringList &names={}) |
| Add multiple lines to the chart. | |
| void | clearPlots () |
| Clear all plots and data. | |
| void | setXAxisTitle (const QString &title) |
| Set the title of the x axis. | |
| void | setYAxisTitle (const QString &title) |
| Set the title of the y axis. | |
| void | setTickLabels (Axis a, const std::vector< float > &tickPositions, const QStringList &tickLabels) |
| Set the custom tick positions and labels for an axis. | |
| void | setAxisLimits (Axis a, float min, float max) |
| Set the default axis limits. | |
| void | setXAxisLimits (float min, float max) |
| Set the default x-axis limits. | |
| void | setYAxisLimits (float min, float max) |
| Set the default y-axis limits. | |
| void | setFontSize (int size=14) |
| Set the font size for the ticks and axis titles. | |
| void | setLineWidth (float width=1.0) |
| Set the line width of the graph lines (in pt). | |
| void | setAxisLogScale (Axis a, bool logScale) |
| Set to logarithmic scale. | |
| void | setAxisDigits (Axis a, int digits=2) |
| Set the number of digits to display in tick labels. | |
| void | labelPeaks (int yColumn=1, float threshold=1.0, int windowSize=5) |
| Label peaks in the plot. | |
| void | setAxisColor (Axis a, const color4ub &color) |
| Set the color of an axis. | |
| void | setBackgroundColor (const color4ub &color) |
| Set the color of the plot area. | |
| void | setLegendLocation (LegendLocation location) |
| Set the location of the legend. | |
| void | setShowPoints (bool visible) |
| Set the visibility of data points. | |
A wrapper around the JKQtPlotter library, providing a widget for displaying line charts, with multiple series, configurable axes, and a legend, etc.
| bool addPlot | ( | const std::vector< float > & | x, |
| const std::vector< float > & | y, | ||
| const color4ub & | color = color4ub{ 0, 0, 0, 255 }, | ||
| const QString & | xName = "x", | ||
| const QString & | yName = "y" ) |
| x | The x values |
| y | The y values |
| color | The color of the line |
| xName | The name of the x axis |
| yName | The name of the y axis |
| bool addSeries | ( | const std::vector< float > & | y, |
| const color4ub & | color = color4ub{ 0, 0, 0, 255 }, | ||
| const QString & | name = "" ) |
| y | The y values |
| color | The color of the line |
| name | The name of the series |
| bool addPlots | ( | const std::vector< std::vector< float > > & | plotData, |
| const color4ub & | color = color4ub{ 0, 0, 0, 255 }, | ||
| const QStringList & | names = {} ) |
| plotData | The data for the plots, column[0] is x, rest are y |
| color | The color of the lines |
| names | The names of the lines (including for the x axis) |
| void setXAxisTitle | ( | const QString & | title | ) |
| title | The title |
| void setYAxisTitle | ( | const QString & | title | ) |
| title | The title |
| void setTickLabels | ( | Axis | a, |
| const std::vector< float > & | tickPositions, | ||
| const QStringList & | tickLabels ) |
| a | The axis |
| tickPositions | The tick positions |
| tickLabels | The tick labels |
| void setAxisLimits | ( | Axis | a, |
| float | min, | ||
| float | max ) |
| a | The axis |
| min | The minimum value |
| max | The maximum value |
If minimum is bigger than maximum, the axis will be reversed
| void setXAxisLimits | ( | float | min, |
| float | max ) |
| min | The minimum value |
| max | The maximum value |
If minimum is bigger than maximum, the axis will be reversed
| void setYAxisLimits | ( | float | min, |
| float | max ) |
| min | The minimum value |
| max | The maximum value |
If minimum is bigger than maximum, the axis will be reversed
| void setFontSize | ( | int | size = 14 | ) |
| size | The font size |
| void setLineWidth | ( | float | width = 1.0 | ) |
| width | The line width |
| void setAxisLogScale | ( | Axis | a, |
| bool | logScale ) |
| a | The axis |
| logScale | True for log scale, false for linear |
| void setAxisDigits | ( | Axis | a, |
| int | digits = 2 ) |
| a | The axis |
| digits | The number of digits |
| void labelPeaks | ( | int | yColumn = 1, |
| float | threshold = 1.0, | ||
| int | windowSize = 5 ) |
| yColumn | The column of the y values |
| threshold | The threshold for peak detection |
| windowSize | The window size for peak detection (in samples along the x-axis) |
| void setAxisColor | ( | Axis | a, |
| const color4ub & | color ) |
| a | The axis |
| color | The color |
| void setBackgroundColor | ( | const color4ub & | color | ) |
| color | The color |
| void setLegendLocation | ( | LegendLocation | location | ) |
| location | The location |
| void setShowPoints | ( | bool | visible | ) |
| visible | True to show data points, false to hide them |