Functions in this group form the basis for the statistics (\ref jkqtptools_math_statistics ) and linear algebra libraries (\ref jkqtptools_math_linalg ), by providing allocation and freeing of (aligned) memory arrays.
This group assembles a basic set of linear algebra methods, including matrix inversion, which are required e.g. by the statistics library (\ref jkqtptools_math_statistics )
In addition there is a set of "adaptors" (see \ref jkqtptools_math_statistics_adaptors ) that shortcut the calculation of a statistical property and the subsequent parametrization of a plot with the results. With these adaptors you can add e.g. a boxplot or histogram chart to a plot by calling only one function.
All statistics functions use an iterator-based interface, comparable to the interface of the <a href="http://www.cplusplus.com/reference/algorithm/">algorithms in the C++ standard template library</a>. To this end, the class `JKQTPDatastore` provides an iterator interface to its columns, using the functions `JKQTPDatastore::begin()` and `JKQTPDatastore::end()`. Both functions simply receive the column ID as parameter and exist in a const and a mutable variant. the latter allows to also edit the data. In addition the function `JKQTPDatastore::backInserter()` returns a back-inserter iterator (like generated for STL containers with `std::back_inserter(container)`) that also allows to append to the column.
Note that the iterator interface allows to use these functions with any container that provides such iterators (e.g. `std::vector<double>`, `std::list<int>`, `std::set<float>`, `QVector<double>`...).
Code using one of these statistics functions therefore may look e.g. like this:
All statistics functions use all values in the given range and convert each value to a `double`, using `jkqtp_todouble()`. The return values is always a dohble. Therefore you can use these functions to calculate statistics of ranges of any type that can be converted to `double`. Values that do not result in a valid `double`are not used in calculating the statistics. Therefore you can exclude values by setting them `JKQTP_DOUBLE_NAN` (i.e. "not a number").
\see see for detailed examples: \ref JKQTPlotterBasicJKQTPDatastoreStatistics
The OpenCV-binding itself is header-only, and NOT compiled into the JKQtPlotter libraries. Therefore you can simply include the header and use the facilities provided by it.
The CMake-build system of JKQtPlotter (and its examples) is compatible with both OpenCV 3.4.x and 4.x and uses the standard `find_package(OpenCV)` facilities provided by OpenCV to compile and bind against that library.
If you want to build the OpenCV-based JKQtPlotter examples (see list above), you either have to ensure that CMake finds OpenCV by itself (i.e. somewhere in the default search paths), or you can set the CMake variable `OpenCV_DIR` so it points to the OpenCV directory before configuring JKQtPlotter.
Classes and functions in this group allow JKQTPlotter to directly work with <a href="http://cimg.eu/">CImg</a> data structures <a href="http://cimg.eu/reference/structcimg__library_1_1CImg.html">CImg<T>></a>.
Examples:
- \ref JKQTPlotterImagePlotCImg
- \ref JKQTPlotterImagePlotRGBCImg
.
The CImg-binding itself is header-only (as CImg is itself), and NOT compiled into the JKQtPlotter libraries. Therefore you can simply include the header and use the facilities provided by it.
The CMake-build system of JKQtPlotter (and its examples) provides facilities to allow for `find_package(CImg)` to compile against that library.
If you want to build the CImg-based JKQtPlotter examples (see list above), you either have to ensure that CMake finds CImg by itself (i.e. somewhere in the default search paths, e.g. `CMAKE_INSTALL_PREFIX`), or you can set the CMake variable `CImg_DIR` so it points to the directory of the `CImg.h` file, or before configuring JKQtPlotter.
Each type of graph is represented by another class, which has to be derived from JKQTPPlotElement. This class provides a basic virtual interface
that allows JKQTPlotter to draw the graphs represented by them. This interface consists of these functions:
- JKQTPPlotElement::draw() draws the graph onto a given JKQTPEnhancedPainter (derived from <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a>)
- JKQTPPlotElement::drawKeyMarker() draws the small marker image in the plot legend
- JKQTPPlotElement::getKeyLabelColor() returns a color for the legend entry for the graph
- JKQTPPlotElement::getXMinMax() returns the extent of the graph in x-direction (e.g. for auto-zooming)
- JKQTPPlotElement::getYMinMax() returns the extent of the graph in Y-direction (e.g. for auto-zooming)
.
In addition to these basic functions, there are additional functions that can be used to draw something outside the actual plot rectangle.
These are used to e.g. add color-scales to the side of the graph:
- JKQTPPlotElement::getOutsideSize() returns the amount of space required outside the plot rectangle
- JKQTPPlotElement::drawOutside() draws the elements outside the plot rectangle
.
Usually if writing a new graph, one would not directly
derive from JKQTPPlotElement, but from a cass in it's hirarchy of children. These children already provide certain facilities for certain types of graphs.
\dotfile jkqtplotter_graphhirarchy.dot
\subsection jkqtplotter_graphsgroup_classstructure_mixins Mix-In Classes for Graphs
In addition there are mix-in classes that are used via multiple inheritance
that add additional features and properties to a graph. A prominent example are the classes for \ref jkqtplotter_basegraphserrors "error indicators".
With these there are usually two variants of one type of graph: One without error indicators and one with error indicators, e.g.:
- JKQTPXYLineGraph shows lines+symbols graphs made up from x/y-value pairs for each data point.
- JKQTPXYLineErrorGraph extends JKQTPXYLineGraph with error indicator drawing/properties provided by JKQTPXYGraphErrors
.
This approach allows to keep interfaces and appearance recognizeable over different graph classes and locates the source code
for a feature like error indicators in a single/in few class(es).
\defgroup jkqtpplotter_styling JKQTPlotter Styling System
\ingroup jkqtplotter
\image html stylesbanner.png
JKQTPlotter (and JKQTBasePlotter) offer a styling system, which allows to easily define and transfer plot styling from one object to another.
The system is based on a hirarchy of structs, which summarize properties, describing how a plot looks in general. The classes contained in this system are:
- JKQTPlotterStyle for JKQTPlotter: Defines e.g. basic user-interactions, the display options of the toolbar
- JKQTBasePlotterStyle for JKQTBasePlotter defines the appearance of the plot itself (colors, axis properties, key properties, default graph colors/styles, ...), contains JKQTPCoordinateAxisStyle instances to configrue the plot's coordinate axes
- JKQTPCoordinateAxisStyle for JKQTPCoordinateAxis defines the appearance of a coordinate axis (colors, axis properties, ...)
- JKQTPKeyStyle for the style of the key/legend in a JKQTBasePlotterStyle
.
In addition there are static methods that allow to manage a system-wide (actually program-instance wide) style that is applied to any new instance of JKQTPlotter and JKQTBasePlotter on construction:
- JKQTPGetSystemDefaultStyle() / JKQTPSetSystemDefaultStyle() allows to access the central instace of JKQTPlotterStyle (mainly properties/style of the GUI-parts and user-action bindings)
- JKQTPGetSystemDefaultBaseStyle() / JKQTPSetSystemDefaultBaseStyle() accesses the central instance of JKQTBasePlotterStyle (styles the actual plot/graphs with colors, axes styles, ...)
.
You can e.g. use these general methods to alter the styles for all JKQTPlotter instances, created in the future:
\code{.cpp}
// load the system-wide default settings from an INI-file:
Several pre-made styles are available in the JKQTPlotter repository (<a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/">https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/</a>).
This group assembles several Qt widgets and tool classes that are linked to JKQTPlotter/JKQTBasePlotter and allow to build advanced GUIs for these (e.g. model/view access to internal data ...)
This group contains several QComboBox-derived classes that can be used to select different enum-values (e.g. with JKQTPMathImageColorPaletteComboBox you can select a color-palette from JKQTPMathImageColorPalette ).