mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-24 17:41:39 +08:00
extensive renaming of classes --> using a unified CamelCase-Scheme now for class/function names
This commit is contained in:
parent
306436f770
commit
86c2f3fa76
14
README.md
14
README.md
@ -1,11 +1,11 @@
|
|||||||
# JKQtPlotter - A Qt Plotting Library
|
# JKQTPLotter - A Qt Plotting Library
|
||||||
This is an extensive library of function/data plotter classes for Qt (>= 4.7, tested with Qt up to 5.11).
|
This is an extensive library of function/data plotter classes for Qt (>= 4.7, tested with Qt up to 5.11).
|
||||||
|
|
||||||
This software is licensed under the term of the [GNU Lesser General Public License 2.1
|
This software is licensed under the term of the [GNU Lesser General Public License 2.1
|
||||||
(LGPL 2.1)](./LICENSE) or above.
|
(LGPL 2.1)](./LICENSE) or above.
|
||||||
|
|
||||||
## Main Features
|
## Main Features
|
||||||
- 2D Plotter class (JKQtPlotter)
|
- 2D Plotter class (JKQTPLotter)
|
||||||
- high-quality plotting
|
- high-quality plotting
|
||||||
- no other dependencies than Qt >=4.7 (compatible with Qt 5.xx)
|
- no other dependencies than Qt >=4.7 (compatible with Qt 5.xx)
|
||||||
- highly customizable axes/grids (linear/log, date/time, custom ticks ...)
|
- highly customizable axes/grids (linear/log, date/time, custom ticks ...)
|
||||||
@ -33,16 +33,16 @@ This software is licensed under the term of the [GNU Lesser General Public Licen
|
|||||||
- extensive library of image plots (inclusing different color-scale modes, RGBA-plots, overlays/masks)
|
- extensive library of image plots (inclusing different color-scale modes, RGBA-plots, overlays/masks)
|
||||||
- contour plots
|
- contour plots
|
||||||
- geometric forms/annotations
|
- geometric forms/annotations
|
||||||
- can be easily extended by deriving a new graph from JKQTPplotElement or JKQTPplotObject
|
- can be easily extended by deriving a new graph from JKQTPPlotElement or JKQTPPlotObject
|
||||||
- optional: OpenCV interface
|
- optional: OpenCV interface
|
||||||
- extensive set of [Examples/Tutorials](./examples/README.md)
|
- extensive set of [Examples/Tutorials](./examples/README.md)
|
||||||
- extensive doxygen-generated [Documentation](http://jkriege2.github.io/JKQtPlotter/index.html)
|
- extensive doxygen-generated [Documentation](http://jkriege2.github.io/JKQTPLotter/index.html)
|
||||||
|
|
||||||
## [Documentation](http://jkriege2.github.io/JKQtPlotter/index.html)
|
## [Documentation](http://jkriege2.github.io/JKQTPLotter/index.html)
|
||||||
A Documentation (auto-)generated with [doxygen](http://www.doxygen.nl/) from the trunk source code can be found here:
|
A Documentation (auto-)generated with [doxygen](http://www.doxygen.nl/) from the trunk source code can be found here:
|
||||||
**[http://jkriege2.github.io/JKQtPlotter/index.html](http://jkriege2.github.io/JKQtPlotter/index.html)**
|
**[http://jkriege2.github.io/JKQTPLotter/index.html](http://jkriege2.github.io/JKQTPLotter/index.html)**
|
||||||
|
|
||||||
Documentation is auto-generated after pushes by [Travis](https://travis-ci.org/jkriege2/JKQtPlotter): [![Build Status](https://travis-ci.org/jkriege2/JKQtPlotter.svg?branch=master)](https://travis-ci.org/jkriege2/JKQtPlotter)
|
Documentation is auto-generated after pushes by [Travis](https://travis-ci.org/jkriege2/JKQTPLotter): [![Build Status](https://travis-ci.org/jkriege2/JKQTPLotter.svg?branch=master)](https://travis-ci.org/jkriege2/JKQTPLotter)
|
||||||
|
|
||||||
## [Examples](./examples/)
|
## [Examples](./examples/)
|
||||||
There is a [large set of usage examples (with explanations for each) and tutorials](./examples/) in the folder [`./examples/`](./examples).
|
There is a [large set of usage examples (with explanations for each) and tutorials](./examples/) in the folder [`./examples/`](./examples).
|
||||||
|
@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
|
|||||||
# title of most generated pages and in a few other places.
|
# title of most generated pages and in a few other places.
|
||||||
# The default value is: My Project.
|
# The default value is: My Project.
|
||||||
|
|
||||||
PROJECT_NAME = JKQtPlotter
|
PROJECT_NAME = JKQTPLotter
|
||||||
|
|
||||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
|
||||||
# could be handy for archiving the generated documentation or if some version
|
# could be handy for archiving the generated documentation or if some version
|
||||||
@ -158,7 +158,7 @@ INLINE_INHERITED_MEMB = NO
|
|||||||
# shortest path that makes the file name unique will be used
|
# shortest path that makes the file name unique will be used
|
||||||
# The default value is: YES.
|
# The default value is: YES.
|
||||||
|
|
||||||
FULL_PATH_NAMES = YES
|
FULL_PATH_NAMES = NO
|
||||||
|
|
||||||
# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
|
# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
|
||||||
# Stripping is only done if one of the specified strings matches the left-hand
|
# Stripping is only done if one of the specified strings matches the left-hand
|
||||||
|
@ -12,53 +12,53 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
<table>
|
<table>
|
||||||
<tr><th>Screenshot<th>Description<th>Notes
|
<tr><th>Screenshot<th>Description<th>Notes
|
||||||
<tr><td> \image html jkqtplotter_simpletest1_small.png
|
<tr><td> \image html jkqtplotter_simpletest1_small.png
|
||||||
<td> \subpage JKQTPlotterSimpleTest
|
<td> \subpage JKQTPLotterSimpleTest
|
||||||
<td> `JKQTPxyLineGraph` <br> C++-style QVector arrays of data
|
<td> `JKQTPXYLineGraph` <br> C++-style QVector arrays of data
|
||||||
<tr><td> \image html jkqtplotter_simpletest_speed_small.png
|
<tr><td> \image html jkqtplotter_simpletest_speed_small.png
|
||||||
<td> \subpage JKQtPlotterSpeedTest
|
<td> \subpage JKQTPLotterSpeedTest
|
||||||
<td> `JKQTPxyLineGraph` <br> external `std::array<double,N>` data, not owned by datastore <br> live-data, measure plotting speed <br> tipps to increas plotting speed
|
<td> `JKQTPXYLineGraph` <br> external `std::array<double,N>` data, not owned by datastore <br> live-data, measure plotting speed <br> tipps to increas plotting speed
|
||||||
<tr><td> \image html jkqtplotter_simpletest_symbols_and_styles_small.png
|
<tr><td> \image html jkqtplotter_simpletest_symbols_and_styles_small.png
|
||||||
<td> \subpage JKQtPlotterSymbolsAndStyles
|
<td> \subpage JKQTPLotterSymbolsAndStyles
|
||||||
<td> `JKQTPxyLineGraph` <br> C++ vector of data <br> setting line styles and symbol styles <br> automatic graph coloring
|
<td> `JKQTPXYLineGraph` <br> C++ vector of data <br> setting line styles and symbol styles <br> automatic graph coloring
|
||||||
<tr><td> \image html jkqtplotter_simpletest_stepplots_small.png
|
<tr><td> \image html jkqtplotter_simpletest_stepplots_small.png
|
||||||
<td> \subpage JKQtPlotterStepPlot
|
<td> \subpage JKQTPLotterStepPlot
|
||||||
<td> `JKQTPstepHorizontalGraph` (and `JKQTPxyLineGraph`) <br> C++ vector of data <br> different step modes, filled and line-only
|
<td> `JKQTPStepHorizontalGraph` (and `JKQTPXYLineGraph`) <br> C++ vector of data <br> different step modes, filled and line-only
|
||||||
<tr><td> \image html jkqtplotter_simpletest_symbols_and_errors_small.png
|
<tr><td> \image html jkqtplotter_simpletest_symbols_and_errors_small.png
|
||||||
<td> \subpage JKQtPlotterSymbolsErrors
|
<td> \subpage JKQTPLotterSymbolsErrors
|
||||||
<td> `JKQTPxyLineErrorGraph` <br> C-style arrays of data
|
<td> `JKQTPXYLineErrorGraph` <br> C-style arrays of data
|
||||||
<tr><td> \image html jkqtplotter_simpletest_errorbarstyles_small.png
|
<tr><td> \image html jkqtplotter_simpletest_errorbarstyles_small.png
|
||||||
<td> \subpage JKQtPlotterErrorBarStyles
|
<td> \subpage JKQTPLotterErrorBarStyles
|
||||||
<td> `JKQTPxyLineErrorGraph` <br> different styles of error indicators for x- and y-errors <br> C++-style QVector for data <br> styling error indicators <br> moving key and formatting plotter grid
|
<td> `JKQTPXYLineErrorGraph` <br> different styles of error indicators for x- and y-errors <br> C++-style QVector for data <br> styling error indicators <br> moving key and formatting plotter grid
|
||||||
<tr><td> \image html jkqtplotter_simpletest_barchart_small.png
|
<tr><td> \image html jkqtplotter_simpletest_barchart_small.png
|
||||||
<td> \subpage JKQtPlotterBarcharts
|
<td> \subpage JKQTPLotterBarcharts
|
||||||
<td> `JKQTPbarVerticalGraph` <br> C-style arrays of data
|
<td> `JKQTPBarVerticalGraph` <br> C-style arrays of data
|
||||||
<tr><td> \image html JKQTPbarHorizontalGraphStacked_small.png
|
<tr><td> \image html JKQTPBarHorizontalGraphStacked_small.png
|
||||||
<td> \subpage JKQtPlotterStackedBarChart
|
<td> \subpage JKQTPLotterStackedBarChart
|
||||||
<td> `JKQTPbarVerticalStackableGraph`, `JKQTPbarHorizontalStackableGraph` <br> C++-style vectors of data
|
<td> `JKQTPBarVerticalStackableGraph`, `JKQTPBarHorizontalStackableGraph` <br> C++-style vectors of data
|
||||||
<tr><td> \image html jkqtplotter_simpletest_filledgraphs_small.png
|
<tr><td> \image html jkqtplotter_simpletest_filledgraphs_small.png
|
||||||
<td> \subpage JKQtPlotterFilledGraphs
|
<td> \subpage JKQTPLotterFilledGraphs
|
||||||
<td> `JKQTPbarVerticalGraph` <br> setting/altering data in `JKQTPdatstore` directly <br> transparent plots <br> calculating histograms
|
<td> `JKQTPBarVerticalGraph` <br> setting/altering data in `JKQTPDatstore` directly <br> transparent plots <br> calculating histograms
|
||||||
<tr><td> \image html jkqtplotter_simpletest_impulsesplot_small.png
|
<tr><td> \image html jkqtplotter_simpletest_impulsesplot_small.png
|
||||||
<td> \subpage JKQtPlotterImpulsePlots
|
<td> \subpage JKQTPLotterImpulsePlots
|
||||||
<td> `JKQTPimpulsesVerticalGraph` and `JKQTPimpulsesHorizontalGraph` <br> C++-style QVector as plot data
|
<td> `JKQTPImpulsesVerticalGraph` and `JKQTPImpulsesHorizontalGraph` <br> C++-style QVector as plot data
|
||||||
<tr><td> \image html jkqtplotter_simpletest_paramscatterplot_small.png
|
<tr><td> \image html jkqtplotter_simpletest_paramscatterplot_small.png
|
||||||
<td> \subpage JKQtPlotterParamScatter
|
<td> \subpage JKQTPLotterParamScatter
|
||||||
<td> `JKQTPxyParametrizedScatterGraph` <br> C++-style QVector as plot data <br> modify scatter/points/line-graph properties by data
|
<td> `JKQTPXYParametrizedScatterGraph` <br> C++-style QVector as plot data <br> modify scatter/points/line-graph properties by data
|
||||||
<tr><td> \image html jkqtplotter_simpletest_paramscatterplot_image_small.png
|
<tr><td> \image html jkqtplotter_simpletest_paramscatterplot_image_small.png
|
||||||
<td> \subpage JKQtPlotterParamScatterImage
|
<td> \subpage JKQTPLotterParamScatterImage
|
||||||
<td> `JKQTPxyParametrizedScatterGraph` <br> C++-style QVector as plot data <br> rectangular arrangement of scatters <br> generative computer graphics
|
<td> `JKQTPXYParametrizedScatterGraph` <br> C++-style QVector as plot data <br> rectangular arrangement of scatters <br> generative computer graphics
|
||||||
<tr><td> \image html jkqtplotter_simpletest_parametriccurve_small.png
|
<tr><td> \image html jkqtplotter_simpletest_parametriccurve_small.png
|
||||||
<td> \subpage JKQtPlotterParametricCurves
|
<td> \subpage JKQTPLotterParametricCurves
|
||||||
<td> `JKQTPxyLineGraph` and `JKQTPxyParametrizedScatterGraph` <br> C++-style QVector as plot data <br> parametric curve plotting
|
<td> `JKQTPXYLineGraph` and `JKQTPXYParametrizedScatterGraph` <br> C++-style QVector as plot data <br> parametric curve plotting
|
||||||
<tr><td> \image html jkqtplotter_simpletest_functionplot_small.png
|
<tr><td> \image html jkqtplotter_simpletest_functionplot_small.png
|
||||||
<td> \subpage JKQtPlotterFunctionPlots
|
<td> \subpage JKQTPLotterFunctionPlots
|
||||||
<td> `JKQTPxFunctionLineGraph` <br> diretly plotting C/C++-functions
|
<td> `JKQTPXFunctionLineGraph` <br> diretly plotting C/C++-functions
|
||||||
<tr><td> \image html jkqtplotter_simpletest_parsedfunctionplot_small.png
|
<tr><td> \image html jkqtplotter_simpletest_parsedfunctionplot_small.png
|
||||||
<td> \subpage JKQtPlotterParsedFunctionPlot
|
<td> \subpage JKQTPLotterParsedFunctionPlot
|
||||||
<td> `JKQTPxParsedFunctionLineGraph` <br> plotting functions with the internal math equation parser/evaluator
|
<td> `JKQTPXParsedFunctionLineGraph` <br> plotting functions with the internal math equation parser/evaluator
|
||||||
<tr><td> \image html jkqtplotter_simpletest_geometric_small.png
|
<tr><td> \image html jkqtplotter_simpletest_geometric_small.png
|
||||||
<td> \subpage JKQtPlotterGeometricGraphs
|
<td> \subpage JKQTPLotterGeometricGraphs
|
||||||
<td> `JKQTPplotObject`, `JKQTPgeoArc`, `JKQTPgeoLine`, `JKQTPgeoRectangle`, ...
|
<td> `JKQTPPlotObject`, `JKQTPGeoArc`, `JKQTPGeoLine`, `JKQTPGeoRectangle`, ...
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@ -67,11 +67,11 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
<table>
|
<table>
|
||||||
<tr><th> Screenshot <th> Description <th> Notes
|
<tr><th> Screenshot <th> Description <th> Notes
|
||||||
<tr><td> \image html jkqtplotter_simpletest_logaxes_small.png
|
<tr><td> \image html jkqtplotter_simpletest_logaxes_small.png
|
||||||
<td> \subpage JKQtPlotterLogAxes
|
<td> \subpage JKQTPLotterLogAxes
|
||||||
<td> `JKQTPxyLineGraph` and `JKQTPgeoText` <br> C++ vector of data <br> logarithmic axes and styling <br> plot line styles <br> internal LaTeX parser <br> add commenting text to a graph
|
<td> `JKQTPXYLineGraph` and `JKQTPGeoText` <br> C++ vector of data <br> logarithmic axes and styling <br> plot line styles <br> internal LaTeX parser <br> add commenting text to a graph
|
||||||
<tr><td> \image html jkqtplotter_simpletest_dateaxes_timeaxis_small.png
|
<tr><td> \image html jkqtplotter_simpletest_dateaxes_timeaxis_small.png
|
||||||
<td> \subpage JKQtPlotterDateTimeAxes
|
<td> \subpage JKQTPLotterDateTimeAxes
|
||||||
<td> `JKQTPxyLineGraph` and `JKQTPfilledVerticalRangeGraph` <br> C++ vector of data <br> date/time axes <br> plot min/max range graph <br> internal LaTeX parser <br> data from CSV files
|
<td> `JKQTPXYLineGraph` and `JKQTPFilledVerticalRangeGraph` <br> C++ vector of data <br> date/time axes <br> plot min/max range graph <br> internal LaTeX parser <br> data from CSV files
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@ -81,22 +81,22 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
<table>
|
<table>
|
||||||
<tr><th> Screenshot <th> Description <th> Notes
|
<tr><th> Screenshot <th> Description <th> Notes
|
||||||
<tr><td> \image html jkqtplotter_simpletest_rgbimageplot_qt_small.png
|
<tr><td> \image html jkqtplotter_simpletest_rgbimageplot_qt_small.png
|
||||||
<td> \subpage JKQtPlotterImagePlotQImageRGB
|
<td> \subpage JKQTPLotterImagePlotQImageRGB
|
||||||
<td> `JKQTPImage` <br> `QImage` drawn onto a plot with arbitrary scaling)
|
<td> `JKQTPImage` <br> `QImage` drawn onto a plot with arbitrary scaling)
|
||||||
<tr><td> \image html jkqtplotter_simpletest_imageplot_small.png
|
<tr><td> \image html jkqtplotter_simpletest_imageplot_small.png
|
||||||
<td> \subpage JKQtPlotterImagePlot
|
<td> \subpage JKQTPLotterImagePlot
|
||||||
<td> `JKQTPColumnMathImage` <br> image data copied from C-style row-major array into a single column of the internal datastore <br> Describes several options of the image plotting classes (different ways of color coding, what to do with data above/below the limits etc.)
|
<td> `JKQTPColumnMathImage` <br> image data copied from C-style row-major array into a single column of the internal datastore <br> Describes several options of the image plotting classes (different ways of color coding, what to do with data above/below the limits etc.)
|
||||||
<tr><td> \image html jkqtplotter_simpletest_imageplot_modifier_small.png
|
<tr><td> \image html jkqtplotter_simpletest_imageplot_modifier_small.png
|
||||||
<td> \subpage JKQtPlotterImagePlotModifier
|
<td> \subpage JKQTPLotterImagePlotModifier
|
||||||
<td> `JKQTPColumnMathImage` <br> image data copied from C-style row-major array into a single column of the internal datastore <br> Image is modified by a second image to display two data dimensions at the same time
|
<td> `JKQTPColumnMathImage` <br> image data copied from C-style row-major array into a single column of the internal datastore <br> Image is modified by a second image to display two data dimensions at the same time
|
||||||
<tr><td> \image html jkqtplotter_simpletest_imageplot_nodatastore_small.png
|
<tr><td> \image html jkqtplotter_simpletest_imageplot_nodatastore_small.png
|
||||||
<td> \subpage JKQtPlotterImagePlotNoDatastore
|
<td> \subpage JKQTPLotterImagePlotNoDatastore
|
||||||
<td> `JKQTPMathImage` <br> image data in a C-style row-major array, not using internal datastore
|
<td> `JKQTPMathImage` <br> image data in a C-style row-major array, not using internal datastore
|
||||||
<tr><td> \image html jkqtplotter_simpletest_imageplot_opencv_small.png
|
<tr><td> \image html jkqtplotter_simpletest_imageplot_opencv_small.png
|
||||||
<td> \subpage JKQtPlotterImagePlotOpenCV
|
<td> \subpage JKQTPLotterImagePlotOpenCV
|
||||||
<td> `JKQTPColumnMathImage` <br> image data copied from OpenCV cv::Mat-structure into a single column of the internal datastore
|
<td> `JKQTPColumnMathImage` <br> image data copied from OpenCV cv::Mat-structure into a single column of the internal datastore
|
||||||
<tr><td> \image html jkqtplotter_simpletest_rgbimageplot_opencv_small.png
|
<tr><td> \image html jkqtplotter_simpletest_rgbimageplot_opencv_small.png
|
||||||
<td> \subpage JKQtPlotterImagePlotRGBOpenCV
|
<td> \subpage JKQTPLotterImagePlotRGBOpenCV
|
||||||
<td> `JKQTPColumnRGBMathImage` <br> image data copied from OpenCV cv::Mat-structure into three columns of the internal datastore
|
<td> `JKQTPColumnRGBMathImage` <br> image data copied from OpenCV cv::Mat-structure into three columns of the internal datastore
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@ -107,11 +107,11 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
<table>
|
<table>
|
||||||
<tr><th> Screenshot <th> Description <th> Notes
|
<tr><th> Screenshot <th> Description <th> Notes
|
||||||
<tr><td> \image html test_multiplot_small.png
|
<tr><td> \image html test_multiplot_small.png
|
||||||
<td> \subpage JKQtPlotterMultiPlotLayout
|
<td> \subpage JKQTPLotterMultiPlotLayout
|
||||||
<td> Combining plots in Qt Layouts <br> linking plot axes <br> copy data from a `std::map` int the datastore <br> print plots/print preview
|
<td> Combining plots in Qt Layouts <br> linking plot axes <br> copy data from a `std::map` int the datastore <br> print plots/print preview
|
||||||
<tr><td> \image html jkqtplotter_simpletest_ui_small.png
|
<tr><td> \image html jkqtplotter_simpletest_ui_small.png
|
||||||
<td> \subpage JKQtPlotterQtCreator
|
<td> \subpage JKQTPLotterQtCreator
|
||||||
<td> using Qt Form Designer <br> parsed function plots (`JKQTPxParsedFunctionLineGraph`) </table>
|
<td> using Qt Form Designer <br> parsed function plots (`JKQTPXParsedFunctionLineGraph`) </table>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@ -121,8 +121,8 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
<table>
|
<table>
|
||||||
<tr><th> Screenshot <th> Description <th> Notes
|
<tr><th> Screenshot <th> Description <th> Notes
|
||||||
<tr><td> \image html jkqtmathtext_simpletest_small.png
|
<tr><td> \image html jkqtmathtext_simpletest_small.png
|
||||||
<td> \subpage JKQTmathTextSimpleExample
|
<td> \subpage JKQTMathTextSimpleExample
|
||||||
<td> JKQTmathText<br>render LaTeX markup (Schrödinger's equation)
|
<td> JKQTMathText<br>render LaTeX markup (Schrödinger's equation)
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
\defgroup jkqtfastplotter JKQTFastPlotter: Speed-Optimized Plotter class
|
\defgroup jkqtfastplotter JKQTFastPlotter: Speed-Optimized Plotter class
|
||||||
|
|
||||||
This is an indepent (and fully self-contained) plotter class, which is optimized for drawing speed, rather than
|
This is an indepent (and fully self-contained) plotter class, which is optimized for drawing speed, rather than
|
||||||
output quality. It lacks several of the advanced features of JKQtPlotter, but can be used in cases, where fast
|
output quality. It lacks several of the advanced features of JKQTPLotter, but can be used in cases, where fast
|
||||||
update of plots or real-time plotting is required.
|
update of plots or real-time plotting is required.
|
||||||
|
|
||||||
An example for the usage of this class can be found here: \link ../../examples/jkqtfastplotter_test \endlink
|
An example for the usage of this class can be found here: \link ../../examples/jkqtfastplotter_test \endlink
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/*!
|
/*!
|
||||||
|
|
||||||
\defgroup jkqtmathtext JKQTmathText LaTeX-Renderer for Qt
|
\defgroup jkqtmathtext JKQTMathText LaTeX-Renderer for Qt
|
||||||
|
|
||||||
This group contains JKQTmathText, a self-contained LaTeX-renderer for Qt. It is used to renderer
|
This group contains JKQTMathText, a self-contained LaTeX-renderer for Qt. It is used to renderer
|
||||||
labels in JKQtPlotter, but can be used independently. The class does not depend on any library,
|
labels in JKQTPLotter, but can be used independently. The class does not depend on any library,
|
||||||
except Qt. In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
|
except Qt. In particular it actually parses a LaTeX string and draws it in pure C++. It does NOT rely
|
||||||
on an installed LaTeX for the rendering!
|
on an installed LaTeX for the rendering!
|
||||||
|
|
||||||
|
|
||||||
Examples for the usage of this class can be found here:
|
Examples for the usage of this class can be found here:
|
||||||
- \ref JKQTmathTextSimpleExample
|
- \ref JKQTMathTextSimpleExample
|
||||||
.
|
.
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
|
|
||||||
\defgroup jkqtptools Tool Functions and Definitions for JKQtPlotter
|
\defgroup jkqtptools Tool Functions and Definitions for JKQTPLotter
|
||||||
|
|
||||||
This group contains a set of tools that I've written over the years to enhance the
|
This group contains a set of tools that I've written over the years to enhance the
|
||||||
C++ standard library.
|
C++ standard library.
|
||||||
@ -27,9 +27,9 @@ C++ standard library.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
\defgroup jkqtplotter JKQtPlotter: Qt based Scientific Plotter Class
|
\defgroup jkqtplotter JKQTPLotter: Qt based Scientific Plotter Class
|
||||||
|
|
||||||
A Qt based plotter for 2D scientific graphs. Main Plotting widget is JKQtPlotter.
|
A Qt based plotter for 2D scientific graphs. Main Plotting widget is JKQTPLotter.
|
||||||
|
|
||||||
|
|
||||||
\defgroup jkqtpdatastorage Data Storage Classes/System
|
\defgroup jkqtpdatastorage Data Storage Classes/System
|
||||||
@ -44,11 +44,11 @@ classes.
|
|||||||
\defgroup jkqtpopencvinterface OpenCV Interfaceing Tools
|
\defgroup jkqtpopencvinterface OpenCV Interfaceing Tools
|
||||||
\ingroup jkqtpdatastorage
|
\ingroup jkqtpdatastorage
|
||||||
|
|
||||||
Classes and functions in this group allow JKQtPlotter to directly work with <a href="https://opencv.org/">OpenCV</a> data structures.
|
Classes and functions in this group allow JKQTPLotter to directly work with <a href="https://opencv.org/">OpenCV</a> data structures.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
- \ref JKQtPlotterImagePlotOpenCV
|
- \ref JKQTPLotterImagePlotOpenCV
|
||||||
- \ref JKQtPlotterImagePlotRGBOpenCV
|
- \ref JKQTPLotterImagePlotRGBOpenCV
|
||||||
.
|
.
|
||||||
|
|
||||||
\defgroup jkqtpplotterclasses Plotter Class & Plotter Widget
|
\defgroup jkqtpplotterclasses Plotter Class & Plotter Widget
|
||||||
@ -58,15 +58,15 @@ This group contains the actual plotter classes, that implement layout management
|
|||||||
coordinate system management an actual plotter widget ...
|
coordinate system management an actual plotter widget ...
|
||||||
|
|
||||||
There are two main classes:
|
There are two main classes:
|
||||||
- JKQtBasePlotter is a QObject-derived class that implements all the plotting logic and drawing code. It does not implement a Qt widget though.
|
- JKQTBasePlotter is a QObject-derived class that implements all the plotting logic and drawing code. It does not implement a Qt widget though.
|
||||||
- JKQtPlotter is a QWidget-based class that contains a JKQtBasePlotter and uses it to draw plots onto a Qt form.
|
- JKQTPLotter is a QWidget-based class that contains a JKQTBasePlotter and uses it to draw plots onto a Qt form.
|
||||||
.
|
.
|
||||||
|
|
||||||
|
|
||||||
\defgroup jkqtplotter_elements Plot Elements
|
\defgroup jkqtplotter_elements Plot Elements
|
||||||
\ingroup jkqtplotter
|
\ingroup jkqtplotter
|
||||||
|
|
||||||
This group assembles all classes that represent different elements of a plot (managed by JKQtBasePlotter/JKQtPlotter).
|
This group assembles all classes that represent different elements of a plot (managed by JKQTBasePlotter/JKQTPLotter).
|
||||||
There are these major subgroups:
|
There are these major subgroups:
|
||||||
- \ref jkqtpbaseplotter_elements contains all non-graph objects, i.e. things like coordinate axes and so on
|
- \ref jkqtpbaseplotter_elements contains all non-graph objects, i.e. things like coordinate axes and so on
|
||||||
- \ref jkqtplotter_graphsgroup contains the actual graph classes
|
- \ref jkqtplotter_graphsgroup contains the actual graph classes
|
||||||
@ -77,7 +77,7 @@ There are these major subgroups:
|
|||||||
\ingroup jkqtplotter_elements
|
\ingroup jkqtplotter_elements
|
||||||
|
|
||||||
This group contains some tool classes that implement basic elements of the plot (coordinate axes, key, ...).
|
This group contains some tool classes that implement basic elements of the plot (coordinate axes, key, ...).
|
||||||
These classes are used by JKQtPlotterBase to output the plot
|
These classes are used by JKQTPLotterBase to output the plot
|
||||||
|
|
||||||
|
|
||||||
\defgroup jkqtplotter_graphsgroup Graph Classes
|
\defgroup jkqtplotter_graphsgroup Graph Classes
|
||||||
@ -109,7 +109,7 @@ These classes are used by JKQtPlotterBase to output the plot
|
|||||||
\ingroup jkqtplotter_graphsgroup
|
\ingroup jkqtplotter_graphsgroup
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
- \ref JKQtPlotterGeometricGraphs
|
- \ref JKQTPLotterGeometricGraphs
|
||||||
.
|
.
|
||||||
|
|
||||||
\defgroup jkqtplotter_diverse Diverse Other Graphs (Ranges, ...)
|
\defgroup jkqtplotter_diverse Diverse Other Graphs (Ranges, ...)
|
||||||
@ -133,17 +133,17 @@ Examples:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
\defgroup jkqtpqtwidgetsttools Qt Widgets/Tools to work with JKQtPlotter
|
\defgroup jkqtpqtwidgetsttools Qt Widgets/Tools to work with JKQTPLotter
|
||||||
\ingroup jkqtplotter
|
\ingroup jkqtplotter
|
||||||
|
|
||||||
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 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 ...)
|
||||||
|
|
||||||
\defgroup jkqtpgraphsmodel Qt Data Models to Access Graphs in a JKQtBasePlotter/JKQtPlotter
|
\defgroup jkqtpgraphsmodel Qt Data Models to Access Graphs in a JKQTBasePlotter/JKQTPLotter
|
||||||
\ingroup jkqtpqtwidgetsttools
|
\ingroup jkqtpqtwidgetsttools
|
||||||
|
|
||||||
Data models in this group allow to access different internal data from a JKQtBasePlotter/JKQtPlotter and in part to manipulate these.
|
Data models in this group allow to access different internal data from a JKQTBasePlotter/JKQTPLotter and in part to manipulate these.
|
||||||
|
|
||||||
\defgroup jkqtpcomboboxes Comboboxes for Properties of JKQtBasePlotter/JKQtPlotter
|
\defgroup jkqtpcomboboxes Comboboxes for Properties of JKQTBasePlotter/JKQTPLotter
|
||||||
\ingroup jkqtpqtwidgetsttools
|
\ingroup jkqtpqtwidgetsttools
|
||||||
|
|
||||||
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 ).
|
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 ).
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
|
|
||||||
\mainpage JKQtPlotter - A Qt Plotting Library
|
\mainpage JKQTPLotter - A Qt Plotting Library
|
||||||
This is an extensive library of function/data plotter classes for Qt (>= 4.7, tested with Qt up to 5.11).
|
This is an extensive library of function/data plotter classes for Qt (>= 4.7, tested with Qt up to 5.11).
|
||||||
|
|
||||||
This software is licensed under the term of the GNU Lesser General Public License 2.1
|
This software is licensed under the term of the GNU Lesser General Public License 2.1
|
||||||
@ -9,11 +9,11 @@ This software is licensed under the term of the GNU Lesser General Public Licens
|
|||||||
\image html examplesbanner.png
|
\image html examplesbanner.png
|
||||||
|
|
||||||
\section jkqtp_main_features Main Features
|
\section jkqtp_main_features Main Features
|
||||||
- Extensive Scientific 2D Plotting framework (JKQtPlotter/JKQtBasePlotter)
|
- Extensive Scientific 2D Plotting framework (JKQTPLotter/JKQTBasePlotter)
|
||||||
- high-quality plotting
|
- high-quality plotting
|
||||||
- no other dependencies than Qt >=4.7 (compatible with Qt 5.xx)
|
- no other dependencies than Qt >=4.7 (compatible with Qt 5.xx)
|
||||||
- highly customizable axes/grids (linear/log, date/time, custom ticks ...)
|
- highly customizable axes/grids (linear/log, date/time, custom ticks ...)
|
||||||
- integrated LaTeX parser/renderer JKQTmathText for axis labels, ticks, notes ...
|
- integrated LaTeX parser/renderer JKQTMathText for axis labels, ticks, notes ...
|
||||||
- extensive user-interactions pre-programmed (several zooming modes, selecting regions, custom context menus, switch graph visibility, ...)
|
- extensive user-interactions pre-programmed (several zooming modes, selecting regions, custom context menus, switch graph visibility, ...)
|
||||||
- full print and export (PDF,PNG,...) support with preview and parametrization out-the-box
|
- full print and export (PDF,PNG,...) support with preview and parametrization out-the-box
|
||||||
- highly customizable look and feel
|
- highly customizable look and feel
|
||||||
@ -37,20 +37,20 @@ This software is licensed under the term of the GNU Lesser General Public Licens
|
|||||||
- extensive library of image plots (inclusing different color-scale modes, RGBA-plots, overlays/masks)
|
- extensive library of image plots (inclusing different color-scale modes, RGBA-plots, overlays/masks)
|
||||||
- contour plots
|
- contour plots
|
||||||
- geometric forms/annotations, see: \ref jkqtplotter_geoplots
|
- geometric forms/annotations, see: \ref jkqtplotter_geoplots
|
||||||
- can be easily extended by deriving a new graph from JKQTPplotElement or JKQTPplotObject
|
- can be easily extended by deriving a new graph from JKQTPPlotElement or JKQTPPlotObject
|
||||||
- optional: OpenCV interface, see: \ref jkqtpopencvinterface
|
- optional: OpenCV interface, see: \ref jkqtpopencvinterface
|
||||||
- integrated LaTeX parser/renderer JKQTmathText:
|
- integrated LaTeX parser/renderer JKQTMathText:
|
||||||
- pure C++
|
- pure C++
|
||||||
- no dependencies in particular no installed LaTeX required
|
- no dependencies in particular no installed LaTeX required
|
||||||
- can be used independently of JKQtPlotter
|
- can be used independently of JKQTPLotter
|
||||||
- see: \ref jkqtmathtext
|
- see: \ref jkqtmathtext
|
||||||
- a second plotter widget JKQtFastPlotter:
|
- a second plotter widget JKQTFastPlotter:
|
||||||
- is optimized for fast plotting, but is not as feature-rich as JKQtPlotter
|
- is optimized for fast plotting, but is not as feature-rich as JKQTPLotter
|
||||||
- may be used independently of JKQtPlotter
|
- may be used independently of JKQTPLotter
|
||||||
- \see jkqtfastplotter
|
- \see jkqtfastplotter
|
||||||
- extensive set of Examples and Tutorials, see: \ref exampleTutorialProjects
|
- extensive set of Examples and Tutorials, see: \ref exampleTutorialProjects
|
||||||
- extensive doxygen-generated <a href="http://jkriege2.github.io/JKQtPlotter/index.html">Online-Documentation (http://jkriege2.github.io/JKQtPlotter/index.html)</a>
|
- extensive doxygen-generated <a href="http://jkriege2.github.io/JKQTPLotter/index.html">Online-Documentation (http://jkriege2.github.io/JKQTPLotter/index.html)</a>
|
||||||
- source code hosted&developed on GitHub <a href="https://github.com/jkriege2/JKQtPlotter">https://github.com/jkriege2/JKQtPlotter</a> (including continuous integration builds: <a href="https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master">https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master</a>)
|
- source code hosted&developed on GitHub <a href="https://github.com/jkriege2/JKQTPLotter">https://github.com/jkriege2/JKQTPLotter</a> (including continuous integration builds: <a href="https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master">https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master</a>)
|
||||||
|
|
||||||
\image html screenshotsbanner.png
|
\image html screenshotsbanner.png
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Example (JKQtPlotter): Examples & Tutorials {#exampleProjectsTutorials}
|
# Example (JKQTPLotter): Examples & Tutorials {#exampleProjectsTutorials}
|
||||||
This section assembles some simple examples of usage.
|
This section assembles some simple examples of usage.
|
||||||
You can find more (complex) examples for the classes in this repository in the subfolder "test".
|
You can find more (complex) examples for the classes in this repository in the subfolder "test".
|
||||||
All test-projects are Qt-projects that use qmake to build. You can load them into QtCreator easily.
|
All test-projects are Qt-projects that use qmake to build. You can load them into QtCreator easily.
|
||||||
@ -7,29 +7,29 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
|
|
||||||
| Screenshot | Description | Notes |
|
| Screenshot | Description | Notes |
|
||||||
|:-------------:| ------------- | ------------- |
|
|:-------------:| ------------- | ------------- |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest1_small.png)](./simpletest/README.md) | [Very Basic Example (Line Graph)](./simpletest/README.md) | `JKQTPxyLineGraph` <br> C++-style QVector arrays of data |
|
| [![](../screenshots/jkqtplotter_simpletest1_small.png)](./simpletest/README.md) | [Very Basic Example (Line Graph)](./simpletest/README.md) | `JKQTPXYLineGraph` <br> C++-style QVector arrays of data |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_speed_small.png)](./simpletest_speed) | [Line Graph with Live Data / Speed Test](./simpletest_speed) | `JKQTPxyLineGraph` <br> external `std::array<double,N>` data, not owned by datastore <br> live-data, measure plotting speed <br> tipps to increas plotting speed |
|
| [![](../screenshots/jkqtplotter_simpletest_speed_small.png)](./simpletest_speed) | [Line Graph with Live Data / Speed Test](./simpletest_speed) | `JKQTPXYLineGraph` <br> external `std::array<double,N>` data, not owned by datastore <br> live-data, measure plotting speed <br> tipps to increas plotting speed |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_symbols_and_styles_small.png)](./simpletest_symbols_and_styles) | [Line Graph with Different Symbols and Line Styles](./simpletest_symbols_and_styles) | `JKQTPxyLineGraph` <br> C++ vector of data <br> setting line styles and symbol styles <br> automatic graph coloring |
|
| [![](../screenshots/jkqtplotter_simpletest_symbols_and_styles_small.png)](./simpletest_symbols_and_styles) | [Line Graph with Different Symbols and Line Styles](./simpletest_symbols_and_styles) | `JKQTPXYLineGraph` <br> C++ vector of data <br> setting line styles and symbol styles <br> automatic graph coloring |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_stepplots_small.png)](./simpletest_stepplots) | [Step Line Plots in Different Styles](./simpletest_stepplots) | `JKQTPstepHorizontalGraph` (and `JKQTPxyLineGraph`) <br> C++ vector of data <br> different step modes, filled and line-only |
|
| [![](../screenshots/jkqtplotter_simpletest_stepplots_small.png)](./simpletest_stepplots) | [Step Line Plots in Different Styles](./simpletest_stepplots) | `JKQTPStepHorizontalGraph` (and `JKQTPXYLineGraph`) <br> C++ vector of data <br> different step modes, filled and line-only |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_symbols_and_errors_small.png)](./simpletest_symbols_and_errors) | [Simple Line/Symbol Graph With Errorbars](./simpletest_symbols_and_errors) | `JKQTPxyLineErrorGraph` <br> C-style arrays of data |
|
| [![](../screenshots/jkqtplotter_simpletest_symbols_and_errors_small.png)](./simpletest_symbols_and_errors) | [Simple Line/Symbol Graph With Errorbars](./simpletest_symbols_and_errors) | `JKQTPXYLineErrorGraph` <br> C-style arrays of data |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_errorbarstyles_small.png)](./simpletest_errorbarstyles) | [Different Types of Error Indicators](./simpletest_errorbarstyles) | `JKQTPxyLineErrorGraph` <br> different styles of error indicators for x- and y-errors <br> C++-style QVector for data <br> styling error indicators <br> moving key and formatting plotter grid |
|
| [![](../screenshots/jkqtplotter_simpletest_errorbarstyles_small.png)](./simpletest_errorbarstyles) | [Different Types of Error Indicators](./simpletest_errorbarstyles) | `JKQTPXYLineErrorGraph` <br> different styles of error indicators for x- and y-errors <br> C++-style QVector for data <br> styling error indicators <br> moving key and formatting plotter grid |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_barchart_small.png)](./simpletest_barchart) | [Simple Bar Charts](./simpletest_barchart) | `JKQTPbarVerticalGraph` <br> C-style arrays of data |
|
| [![](../screenshots/jkqtplotter_simpletest_barchart_small.png)](./simpletest_barchart) | [Simple Bar Charts](./simpletest_barchart) | `JKQTPBarVerticalGraph` <br> C-style arrays of data |
|
||||||
| [![](../screenshots/JKQTPbarVerticalGraphStacked_small.png) <br> ![](../screenshots/JKQTPbarHorizontalGraphStacked_small.png)](./simpletest_stackedbars) | [Stacked Bar Charts](./simpletest_stackedbars) | `JKQTPbarVerticalStackableGraph`, `JKQTPbarHorizontalStackableGraph` <br> C++-style vectors of data |
|
| [![](../screenshots/JKQTPBarVerticalGraphStacked_small.png) <br> ![](../screenshots/JKQTPBarHorizontalGraphStacked_small.png)](./simpletest_stackedbars) | [Stacked Bar Charts](./simpletest_stackedbars) | `JKQTPBarVerticalStackableGraph`, `JKQTPBarHorizontalStackableGraph` <br> C++-style vectors of data |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_filledgraphs_small.png)](./simpletest_filledgraphs) | [Filled Curve Plots](./simpletest_filledgraphs) | `JKQTPbarVerticalGraph` <br> setting/altering data in `JKQTPdatstore` directly <br> transparent plots <br> calculating histograms |
|
| [![](../screenshots/jkqtplotter_simpletest_filledgraphs_small.png)](./simpletest_filledgraphs) | [Filled Curve Plots](./simpletest_filledgraphs) | `JKQTPBarVerticalGraph` <br> setting/altering data in `JKQTPDatstore` directly <br> transparent plots <br> calculating histograms |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_impulsesplot_small.png)](./simpletest_impulsesplot) | [Impulse Plots](./simpletest_impulsesplot) | `JKQTPimpulsesVerticalGraph` and `JKQTPimpulsesHorizontalGraph` <br> C++-style QVector as plot data |
|
| [![](../screenshots/jkqtplotter_simpletest_impulsesplot_small.png)](./simpletest_impulsesplot) | [Impulse Plots](./simpletest_impulsesplot) | `JKQTPImpulsesVerticalGraph` and `JKQTPImpulsesHorizontalGraph` <br> C++-style QVector as plot data |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_paramscatterplot_small.png)](./simpletest_paramscatterplot) | [Scatter Graph with Parametrized Symbols/Colors](./simpletest_paramscatterplot) | `JKQTPxyParametrizedScatterGraph` <br> C++-style QVector as plot data <br> modify scatter/points/line-graph properties by data |
|
| [![](../screenshots/jkqtplotter_simpletest_paramscatterplot_small.png)](./simpletest_paramscatterplot) | [Scatter Graph with Parametrized Symbols/Colors](./simpletest_paramscatterplot) | `JKQTPXYParametrizedScatterGraph` <br> C++-style QVector as plot data <br> modify scatter/points/line-graph properties by data |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png)](./simpletest_paramscatterplot_image) | [Draw an Artistic Image with a Parametrized Scatter Graph](./simpletest_paramscatterplot_image) | `JKQTPxyParametrizedScatterGraph` <br> C++-style QVector as plot data <br> rectangular arrangement of scatters <br> generative computer graphics |
|
| [![](../screenshots/jkqtplotter_simpletest_paramscatterplot_image_small.png)](./simpletest_paramscatterplot_image) | [Draw an Artistic Image with a Parametrized Scatter Graph](./simpletest_paramscatterplot_image) | `JKQTPXYParametrizedScatterGraph` <br> C++-style QVector as plot data <br> rectangular arrangement of scatters <br> generative computer graphics |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_parametriccurve_small.png)](./simpletest_parametriccurve) | [Plotting Parametric Curves](./simpletest_parametriccurve) | `JKQTPxyLineGraph` and `JKQTPxyParametrizedScatterGraph` <br> C++-style QVector as plot data <br> parametric curve plotting |
|
| [![](../screenshots/jkqtplotter_simpletest_parametriccurve_small.png)](./simpletest_parametriccurve) | [Plotting Parametric Curves](./simpletest_parametriccurve) | `JKQTPXYLineGraph` and `JKQTPXYParametrizedScatterGraph` <br> C++-style QVector as plot data <br> parametric curve plotting |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_functionplot_small.png)](./simpletest_functionplot) | [Plotting Mathematical Functions as Line Graphs](./simpletest_functionplot) | `JKQTPxFunctionLineGraph` <br> diretly plotting C/C++-functions |
|
| [![](../screenshots/jkqtplotter_simpletest_functionplot_small.png)](./simpletest_functionplot) | [Plotting Mathematical Functions as Line Graphs](./simpletest_functionplot) | `JKQTPXFunctionLineGraph` <br> diretly plotting C/C++-functions |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.png)](./simpletest_parsedfunctionplot) | [Plotting Parsed Mathematical Functions as Line Graphs](./simpletest_parsedfunctionplot) | `JKQTPxParsedFunctionLineGraph` <br> plotting functions with the internal math equation parser/evaluator |
|
| [![](../screenshots/jkqtplotter_simpletest_parsedfunctionplot_small.png)](./simpletest_parsedfunctionplot) | [Plotting Parsed Mathematical Functions as Line Graphs](./simpletest_parsedfunctionplot) | `JKQTPXParsedFunctionLineGraph` <br> plotting functions with the internal math equation parser/evaluator |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_geometric_small.png)](./simpletest_geometric) | [Plotting Geometric Objects](./simpletest_geometric) | |
|
| [![](../screenshots/jkqtplotter_simpletest_geometric_small.png)](./simpletest_geometric) | [Plotting Geometric Objects](./simpletest_geometric) | |
|
||||||
|
|
||||||
## Styling the Plot, Keys, Axes, ...
|
## Styling the Plot, Keys, Axes, ...
|
||||||
|
|
||||||
| Screenshot | Description | Notes |
|
| Screenshot | Description | Notes |
|
||||||
|:-------------:| ------------- | ------------- |
|
|:-------------:| ------------- | ------------- |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_logaxes_small.png)](./simpletest_logaxes) | [logarithmic axes](./simpletest_logaxes) | `JKQTPxyLineGraph` and `JKQTPgeoText` <br> C++ vector of data <br> logarithmic axes and styling <br> plot line styles <br> internal LaTeX parser <br> add commenting text to a graph |
|
| [![](../screenshots/jkqtplotter_simpletest_logaxes_small.png)](./simpletest_logaxes) | [logarithmic axes](./simpletest_logaxes) | `JKQTPXYLineGraph` and `JKQTPGeoText` <br> C++ vector of data <br> logarithmic axes and styling <br> plot line styles <br> internal LaTeX parser <br> add commenting text to a graph |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_dateaxes_small.png) <br> ![](../screenshots/jkqtplotter_simpletest_dateaxes_dates_small.png) <br> ![](../screenshots/jkqtplotter_simpletest_dateaxes_timeaxis_small.png)](./simpletest_dateaxes) | [date/time axes](./simpletest_dateaxes) | `JKQTPxyLineGraph` and `JKQTPfilledVerticalRangeGraph` <br> C++ vector of data <br> date/time axes <br> plot min/max range graph <br> internal LaTeX parser <br> data from CSV files |
|
| [![](../screenshots/jkqtplotter_simpletest_dateaxes_small.png) <br> ![](../screenshots/jkqtplotter_simpletest_dateaxes_dates_small.png) <br> ![](../screenshots/jkqtplotter_simpletest_dateaxes_timeaxis_small.png)](./simpletest_dateaxes) | [date/time axes](./simpletest_dateaxes) | `JKQTPXYLineGraph` and `JKQTPFilledVerticalRangeGraph` <br> C++ vector of data <br> date/time axes <br> plot min/max range graph <br> internal LaTeX parser <br> data from CSV files |
|
||||||
|
|
||||||
|
|
||||||
## Image data Plots
|
## Image data Plots
|
||||||
@ -48,12 +48,12 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
| Screenshot | Description | Notes |
|
| Screenshot | Description | Notes |
|
||||||
|:-------------:| ------------- | ------------- |
|
|:-------------:| ------------- | ------------- |
|
||||||
| [![](../screenshots/test_multiplot_small.png)](./test_multiplot) | [Layouting Several Plots](./test_multiplot) | Combining plots in Qt Layouts <br> linking plot axes <br> copy data from a `std::map` int the datastore <br> print plots/print preview |
|
| [![](../screenshots/test_multiplot_small.png)](./test_multiplot) | [Layouting Several Plots](./test_multiplot) | Combining plots in Qt Layouts <br> linking plot axes <br> copy data from a `std::map` int the datastore <br> print plots/print preview |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_ui_small.png)](./simpletest_ui) | [Placing JKQtPlotter into a Qt User-Interface-XML-file (`*.ui`)](./simpletest_ui) | using Qt Form Designer <br> parsed function plots (`JKQTPxParsedFunctionLineGraph`) |
|
| [![](../screenshots/jkqtplotter_simpletest_ui_small.png)](./simpletest_ui) | [Placing JKQTPLotter into a Qt User-Interface-XML-file (`*.ui`)](./simpletest_ui) | using Qt Form Designer <br> parsed function plots (`JKQTPXParsedFunctionLineGraph`) |
|
||||||
|
|
||||||
## Tools and Special Features
|
## Tools and Special Features
|
||||||
|
|
||||||
| Screenshot | Description | Notes |
|
| Screenshot | Description | Notes |
|
||||||
|:-------------:| ------------- | ------------- |
|
|:-------------:| ------------- | ------------- |
|
||||||
| [![](../screenshots/jkqtmathtext_simpletest_small.png)](./jkqtmathtext_simpletest) | [JKQTmathText: LaTeX Renderer](./jkqtmathtext_simpletest) | |
|
| [![](../screenshots/jkqtmathtext_simpletest_small.png)](./jkqtmathtext_simpletest) | [JKQTMathText: LaTeX Renderer](./jkqtmathtext_simpletest) | |
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ DEFINES += DEBUG_TIMING
|
|||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
# include JKQtPlotter library
|
# include JKQTPLotter library
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/** \example jkqtfastplotter_test_testmain.cpp
|
/** \example jkqtfastplotter_test_testmain.cpp
|
||||||
* Example of how to use JKQtFastPlotter
|
* Example of how to use JKQTFastPlotter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "jkqtfastplotter_test_testmain.h"
|
#include "jkqtfastplotter_test_testmain.h"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# Example (JKQTmathText): A simple usage example {#JKQTmathTextSimpleExample}
|
# Example (JKQTMathText): A simple usage example {#JKQTMathTextSimpleExample}
|
||||||
JKQTmathText is a hand-written LaTeX-renderer for Qt (implemented in native C++, using Qt). It supports a large set of standard LaTeX markup and can render it to a QPainter.
|
JKQTMathText is a hand-written LaTeX-renderer for Qt (implemented in native C++, using Qt). It supports a large set of standard LaTeX markup and can render it to a QPainter.
|
||||||
|
|
||||||
This project (see `./examples/jkqtmathtext_simpletest/`) simply creates a QLabel (as a new window) that displays a rendered LaTeX equation (here the time-dependent Schrödinger equation).
|
This project (see `./examples/jkqtmathtext_simpletest/`) simply creates a QLabel (as a new window) that displays a rendered LaTeX equation (here the time-dependent Schrödinger equation).
|
||||||
The QMake project looks like this (see [`jkqtmathtext_simpletest.pro`](../jkqtmathtext_simpletest/jkqtmathtext_simpletest.pro):
|
The QMake project looks like this (see [`jkqtmathtext_simpletest.pro`](../jkqtmathtext_simpletest/jkqtmathtext_simpletest.pro):
|
||||||
```.qmake
|
```.qmake
|
||||||
# include JKQTmathText source-code, including the open-source XITS fonts
|
# include JKQTMathText source-code, including the open-source XITS fonts
|
||||||
include(../../lib/jkqtmathtext_with_xits.pri)
|
include(../../lib/jkqtmathtext_with_xits.pri)
|
||||||
SOURCES += jkqtmathtext_simpletest.cpp
|
SOURCES += jkqtmathtext_simpletest.cpp
|
||||||
|
|
||||||
@ -37,10 +37,10 @@ int main(int argc, char* argv[])
|
|||||||
pix.fill(QColor("white"));
|
pix.fill(QColor("white"));
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
|
|
||||||
// 2. now we create a JKQTmathText object.
|
// 2. now we create a JKQTMathText object.
|
||||||
// Also we configure the JKQTmathText to use the XITS fonts that
|
// Also we configure the JKQTMathText to use the XITS fonts that
|
||||||
// were included in the *.pro-file
|
// were included in the *.pro-file
|
||||||
JKQTmathText mathText;
|
JKQTMathText mathText;
|
||||||
mathText.useXITS();
|
mathText.useXITS();
|
||||||
mathText.set_fontSize(20);
|
mathText.set_fontSize(20);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtmathtext_simpletest.cpp
|
/** \example jkqtmathtext_simpletest.cpp
|
||||||
* A very basic example for the usage of JKQTmathText
|
* A very basic example for the usage of JKQTMathText
|
||||||
*
|
*
|
||||||
* \ref JKQTmathTextSimpleExample
|
* \ref JKQTMathTextSimpleExample
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -21,10 +21,10 @@ int main(int argc, char* argv[])
|
|||||||
pix.fill(QColor("white"));
|
pix.fill(QColor("white"));
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
|
|
||||||
// 2. now we create a JKQTmathText object.
|
// 2. now we create a JKQTMathText object.
|
||||||
// Also we configure the JKQTmathText to use the XITS fonts that
|
// Also we configure the JKQTMathText to use the XITS fonts that
|
||||||
// were included in the *.pro-file
|
// were included in the *.pro-file
|
||||||
JKQTmathText mathText;
|
JKQTMathText mathText;
|
||||||
mathText.useXITS();
|
mathText.useXITS();
|
||||||
mathText.set_fontSize(20);
|
mathText.set_fontSize(20);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/JKQTmathText/fonts">
|
<qresource prefix="/JKQTMathText/fonts">
|
||||||
<file alias="asana-math.otf">asana/Asana-Math.otf</file>
|
<file alias="asana-math.otf">asana/Asana-Math.otf</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
HighResTimer ht;
|
HighResTimer ht;
|
||||||
|
|
||||||
|
|
||||||
double draw(QPainter& painter, double X, double YY, JKQTmathText& mt, QString name) {
|
double draw(QPainter& painter, double X, double YY, JKQTMathText& mt, QString name) {
|
||||||
double Y=YY;
|
double Y=YY;
|
||||||
painter.save();
|
painter.save();
|
||||||
ht.start();
|
ht.start();
|
||||||
@ -67,7 +67,7 @@ void timingTest(QPainter& painter, QString text, QString name, double fontSize)
|
|||||||
std::cout<<"testing '"<<name.toStdString()<<"':\nparse [ms],\tsize [ms],\tdraw [ms]\n---------------------------------------------\n";
|
std::cout<<"testing '"<<name.toStdString()<<"':\nparse [ms],\tsize [ms],\tdraw [ms]\n---------------------------------------------\n";
|
||||||
for (int i=0; i<N; i++) {
|
for (int i=0; i<N; i++) {
|
||||||
double t;
|
double t;
|
||||||
JKQTmathText mt;
|
JKQTMathText mt;
|
||||||
mt.set_fontSize(fontSize);
|
mt.set_fontSize(fontSize);
|
||||||
ht.start(); mt.parse(text); t=ht.get_time()/1000.0;
|
ht.start(); mt.parse(text); t=ht.get_time()/1000.0;
|
||||||
sum_parse+=t;
|
sum_parse+=t;
|
||||||
@ -118,7 +118,7 @@ int main(int argc, char* argv[])
|
|||||||
QPixmap pix(W, H), pix2(W,H);
|
QPixmap pix(W, H), pix2(W,H);
|
||||||
pix.fill();
|
pix.fill();
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
JKQTmathText mt(&win);
|
JKQTMathText mt(&win);
|
||||||
|
|
||||||
double Y=Y1;
|
double Y=Y1;
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ TestForm::~TestForm()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
double TestForm::draw(QPainter& painter, double X, double YY, JKQTmathText& mt, QString name, double& durationSizingMS, double&durationTimingMS) {
|
double TestForm::draw(QPainter& painter, double X, double YY, JKQTMathText& mt, QString name, double& durationSizingMS, double&durationTimingMS) {
|
||||||
|
|
||||||
|
|
||||||
double Y=YY;
|
double Y=YY;
|
||||||
@ -190,34 +190,34 @@ double TestForm::draw(QPainter& painter, double X, double YY, JKQTmathText& mt,
|
|||||||
return mt.getDescent(painter)+mt.getAscent(painter)+40;
|
return mt.getDescent(painter)+mt.getAscent(painter)+40;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *TestForm::createTree(JKQTmathText::MTnode *node, QTreeWidgetItem* parent)
|
QTreeWidgetItem *TestForm::createTree(JKQTMathText::MTnode *node, QTreeWidgetItem* parent)
|
||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
JKQTmathText::MTtextNode* txtN=dynamic_cast<JKQTmathText::MTtextNode*>(node);
|
JKQTMathText::MTtextNode* txtN=dynamic_cast<JKQTMathText::MTtextNode*>(node);
|
||||||
JKQTmathText::MTwhitespaceNode* spN=dynamic_cast<JKQTmathText::MTwhitespaceNode*>(node);
|
JKQTMathText::MTwhitespaceNode* spN=dynamic_cast<JKQTMathText::MTwhitespaceNode*>(node);
|
||||||
JKQTmathText::MTsymbolNode* symN=dynamic_cast<JKQTmathText::MTsymbolNode*>(node);
|
JKQTMathText::MTsymbolNode* symN=dynamic_cast<JKQTMathText::MTsymbolNode*>(node);
|
||||||
JKQTmathText::MTlistNode* lstN=dynamic_cast<JKQTmathText::MTlistNode*>(node);
|
JKQTMathText::MTlistNode* lstN=dynamic_cast<JKQTMathText::MTlistNode*>(node);
|
||||||
JKQTmathText::MTinstruction1Node* inst1N=dynamic_cast<JKQTmathText::MTinstruction1Node*>(node);
|
JKQTMathText::MTinstruction1Node* inst1N=dynamic_cast<JKQTMathText::MTinstruction1Node*>(node);
|
||||||
JKQTmathText::MTsubscriptNode* subN=dynamic_cast<JKQTmathText::MTsubscriptNode*>(node);
|
JKQTMathText::MTsubscriptNode* subN=dynamic_cast<JKQTMathText::MTsubscriptNode*>(node);
|
||||||
JKQTmathText::MTsuperscriptNode* superN=dynamic_cast<JKQTmathText::MTsuperscriptNode*>(node);
|
JKQTMathText::MTsuperscriptNode* superN=dynamic_cast<JKQTMathText::MTsuperscriptNode*>(node);
|
||||||
JKQTmathText::MTbraceNode* braceN=dynamic_cast<JKQTmathText::MTbraceNode*>(node);
|
JKQTMathText::MTbraceNode* braceN=dynamic_cast<JKQTMathText::MTbraceNode*>(node);
|
||||||
JKQTmathText::MTsqrtNode* sqrtN=dynamic_cast<JKQTmathText::MTsqrtNode*>(node);
|
JKQTMathText::MTsqrtNode* sqrtN=dynamic_cast<JKQTMathText::MTsqrtNode*>(node);
|
||||||
JKQTmathText::MTfracNode* fracN=dynamic_cast<JKQTmathText::MTfracNode*>(node);
|
JKQTMathText::MTfracNode* fracN=dynamic_cast<JKQTMathText::MTfracNode*>(node);
|
||||||
JKQTmathText::MTmatrixNode* matrixN=dynamic_cast<JKQTmathText::MTmatrixNode*>(node);
|
JKQTMathText::MTmatrixNode* matrixN=dynamic_cast<JKQTMathText::MTmatrixNode*>(node);
|
||||||
JKQTmathText::MTdecoratedNode* decoN=dynamic_cast<JKQTmathText::MTdecoratedNode*>(node);
|
JKQTMathText::MTdecoratedNode* decoN=dynamic_cast<JKQTMathText::MTdecoratedNode*>(node);
|
||||||
|
|
||||||
QTreeWidgetItem* ti=nullptr;
|
QTreeWidgetItem* ti=nullptr;
|
||||||
if (parent) ti=new QTreeWidgetItem(parent);
|
if (parent) ti=new QTreeWidgetItem(parent);
|
||||||
else ti=new QTreeWidgetItem(ui->tree);
|
else ti=new QTreeWidgetItem(ui->tree);
|
||||||
|
|
||||||
if (decoN) {
|
if (decoN) {
|
||||||
name=QString("MTdecoratedNode: mode='%1'").arg(JKQTmathText::decorationToString(decoN->get_decoration()));
|
name=QString("MTdecoratedNode: mode='%1'").arg(JKQTMathText::decorationToString(decoN->get_decoration()));
|
||||||
if (decoN->get_child()) ti->addChild(createTree(decoN->get_child(), ti));
|
if (decoN->get_child()) ti->addChild(createTree(decoN->get_child(), ti));
|
||||||
} else if (matrixN) {
|
} else if (matrixN) {
|
||||||
int l=matrixN->get_lines();
|
int l=matrixN->get_lines();
|
||||||
int c=matrixN->get_columns();
|
int c=matrixN->get_columns();
|
||||||
name=QString("MTmatrixNode: l*c=%1*%2").arg(l).arg(c);
|
name=QString("MTmatrixNode: l*c=%1*%2").arg(l).arg(c);
|
||||||
QVector<QVector<JKQTmathText::MTnode*> > children=matrixN->get_children();
|
QVector<QVector<JKQTMathText::MTnode*> > children=matrixN->get_children();
|
||||||
for (int y=0; y<l; y++) {
|
for (int y=0; y<l; y++) {
|
||||||
for (int x=0; x<c; x++) {
|
for (int x=0; x<c; x++) {
|
||||||
if (children[y].at(x)!=nullptr) {
|
if (children[y].at(x)!=nullptr) {
|
||||||
@ -228,7 +228,7 @@ QTreeWidgetItem *TestForm::createTree(JKQTmathText::MTnode *node, QTreeWidgetIte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (fracN) {
|
} else if (fracN) {
|
||||||
name=QString("MTfracNode: mode='%1'").arg(JKQTmathText::fracModeToString(fracN->get_mode()));
|
name=QString("MTfracNode: mode='%1'").arg(JKQTMathText::fracModeToString(fracN->get_mode()));
|
||||||
if (fracN->get_child1()) ti->addChild(createTree(fracN->get_child1(), ti));
|
if (fracN->get_child1()) ti->addChild(createTree(fracN->get_child1(), ti));
|
||||||
if (fracN->get_child2()) ti->addChild(createTree(fracN->get_child2(), ti));
|
if (fracN->get_child2()) ti->addChild(createTree(fracN->get_child2(), ti));
|
||||||
} else if (sqrtN) {
|
} else if (sqrtN) {
|
||||||
@ -248,7 +248,7 @@ QTreeWidgetItem *TestForm::createTree(JKQTmathText::MTnode *node, QTreeWidgetIte
|
|||||||
if (inst1N->get_child()) ti->addChild(createTree(inst1N->get_child(), ti));
|
if (inst1N->get_child()) ti->addChild(createTree(inst1N->get_child(), ti));
|
||||||
} else if (lstN) {
|
} else if (lstN) {
|
||||||
name=QString("MTlistNode");
|
name=QString("MTlistNode");
|
||||||
QList<JKQTmathText::MTnode*> list=lstN->get_nodes();
|
QList<JKQTMathText::MTnode*> list=lstN->get_nodes();
|
||||||
for (int i=0; i<list.size(); i++) {
|
for (int i=0; i<list.size(); i++) {
|
||||||
ti->addChild(createTree(list[i], ti));
|
ti->addChild(createTree(list[i], ti));
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ void TestForm::updateMath()
|
|||||||
QPixmap pix(W, H);
|
QPixmap pix(W, H);
|
||||||
pix.fill();
|
pix.fill();
|
||||||
QPainter painter;
|
QPainter painter;
|
||||||
JKQTmathText mt(this);
|
JKQTMathText mt(this);
|
||||||
|
|
||||||
|
|
||||||
double Y=Y1;
|
double Y=Y1;
|
||||||
|
@ -26,9 +26,9 @@ class TestForm : public QWidget
|
|||||||
private:
|
private:
|
||||||
Ui::TestForm *ui;
|
Ui::TestForm *ui;
|
||||||
JKQTPHighResTimer ht;
|
JKQTPHighResTimer ht;
|
||||||
double draw(QPainter& painter, double X, double YY, JKQTmathText& mt, QString name, double &durationSizingMS, double &durationTimingMS);
|
double draw(QPainter& painter, double X, double YY, JKQTMathText& mt, QString name, double &durationSizingMS, double &durationTimingMS);
|
||||||
|
|
||||||
QTreeWidgetItem* createTree(JKQTmathText::MTnode* node, QTreeWidgetItem *parent=NULL);
|
QTreeWidgetItem* createTree(JKQTMathText::MTnode* node, QTreeWidgetItem *parent=NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TESTFORM_H
|
#endif // TESTFORM_H
|
||||||
|
@ -193,7 +193,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="15" column="0" colspan="2">
|
<item row="15" column="0" colspan="2">
|
||||||
<widget class="JKQTmathTextLabel" name="labMath">
|
<widget class="JKQTMathTextLabel" name="labMath">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>left(left[sqrt{2picdotint_{-infty}^infty f(x);mathrm{d}x}right]right) </string>
|
<string>left(left[sqrt{2picdotint_{-infty}^infty f(x);mathrm{d}x}right]right) </string>
|
||||||
</property>
|
</property>
|
||||||
@ -418,7 +418,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>JKQTmathTextLabel</class>
|
<class>JKQTMathTextLabel</class>
|
||||||
<extends>QLabel</extends>
|
<extends>QLabel</extends>
|
||||||
<header>jkqtmathtext/jkqtmathtext.h</header>
|
<header>jkqtmathtext/jkqtmathtext.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
@ -17,7 +17,7 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
QVBoxLayout* barchartLayout=new QVBoxLayout(this);
|
QVBoxLayout* barchartLayout=new QVBoxLayout(this);
|
||||||
setLayout(barchartLayout);
|
setLayout(barchartLayout);
|
||||||
resize(1000, 800);
|
resize(1000, 800);
|
||||||
plotBarchart=new JKQtPlotter(true, this);
|
plotBarchart=new JKQTPLotter(true, this);
|
||||||
plotBarchart->set_doDrawing(false);
|
plotBarchart->set_doDrawing(false);
|
||||||
plotBarchart->get_plotter()->set_plotLabel(tr("\\textbf{bar charts}"));
|
plotBarchart->get_plotter()->set_plotLabel(tr("\\textbf{bar charts}"));
|
||||||
plotBarchart->setObjectName("plotBarchart");
|
plotBarchart->setObjectName("plotBarchart");
|
||||||
@ -47,7 +47,7 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
size_t bcpy2=plotBarchart->getDatastore()->addCopiedColumn(dataBCY2, "y2");
|
size_t bcpy2=plotBarchart->getDatastore()->addCopiedColumn(dataBCY2, "y2");
|
||||||
size_t bcpye2=plotBarchart->getDatastore()->addCopiedColumn(dataBCYE2, "ye2");
|
size_t bcpye2=plotBarchart->getDatastore()->addCopiedColumn(dataBCYE2, "ye2");
|
||||||
|
|
||||||
JKQTPbarVerticalErrorGraph* plteBar1=new JKQTPbarVerticalErrorGraph(plotBarchart->get_plotter());
|
JKQTPBarVerticalErrorGraph* plteBar1=new JKQTPBarVerticalErrorGraph(plotBarchart->get_plotter());
|
||||||
plteBar1->set_title(tr("bars 1"));
|
plteBar1->set_title(tr("bars 1"));
|
||||||
plteBar1->set_xColumn(bcpxd);
|
plteBar1->set_xColumn(bcpxd);
|
||||||
plteBar1->set_yColumn(bcpy1);
|
plteBar1->set_yColumn(bcpy1);
|
||||||
@ -56,7 +56,7 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
plteBar1->set_shift(-0.25);
|
plteBar1->set_shift(-0.25);
|
||||||
plotBarchart->get_plotter()->addGraph(plteBar1);
|
plotBarchart->get_plotter()->addGraph(plteBar1);
|
||||||
|
|
||||||
JKQTPbarVerticalErrorGraph* plteBar2=new JKQTPbarVerticalErrorGraph(plotBarchart->get_plotter());
|
JKQTPBarVerticalErrorGraph* plteBar2=new JKQTPBarVerticalErrorGraph(plotBarchart->get_plotter());
|
||||||
plteBar2->set_xColumn(bcpxd);
|
plteBar2->set_xColumn(bcpxd);
|
||||||
plteBar2->set_yColumn(bcpy2);
|
plteBar2->set_yColumn(bcpy2);
|
||||||
plteBar2->set_yErrorColumn(bcpye2);
|
plteBar2->set_yErrorColumn(bcpye2);
|
||||||
@ -74,7 +74,7 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
plotBarchart2=new JKQtPlotter(false, this, plotBarchart->getDatastore());
|
plotBarchart2=new JKQTPLotter(false, this, plotBarchart->getDatastore());
|
||||||
plotBarchart2->set_doDrawing(false);
|
plotBarchart2->set_doDrawing(false);
|
||||||
plotBarchart2->get_plotter()->set_plotLabel(tr("\\textbf{bar charts}"));
|
plotBarchart2->get_plotter()->set_plotLabel(tr("\\textbf{bar charts}"));
|
||||||
plotBarchart2->setObjectName("plotBarchart2");
|
plotBarchart2->setObjectName("plotBarchart2");
|
||||||
@ -82,7 +82,7 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
|
|
||||||
barchartLayout->addWidget(plotBarchart2);
|
barchartLayout->addWidget(plotBarchart2);
|
||||||
|
|
||||||
JKQTPbarHorizontalErrorGraph* plteBar3=new JKQTPbarHorizontalErrorGraph(plotBarchart2->get_plotter());
|
JKQTPBarHorizontalErrorGraph* plteBar3=new JKQTPBarHorizontalErrorGraph(plotBarchart2->get_plotter());
|
||||||
plteBar3->set_title(tr("bars 1"));
|
plteBar3->set_title(tr("bars 1"));
|
||||||
plteBar3->set_yColumn(bcpx);
|
plteBar3->set_yColumn(bcpx);
|
||||||
plteBar3->set_xColumn(bcpy1);
|
plteBar3->set_xColumn(bcpy1);
|
||||||
@ -91,7 +91,7 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
plteBar3->set_shift(-0.25);
|
plteBar3->set_shift(-0.25);
|
||||||
plotBarchart2->get_plotter()->addGraph(plteBar3);
|
plotBarchart2->get_plotter()->addGraph(plteBar3);
|
||||||
|
|
||||||
JKQTPbarHorizontalErrorGraph* plteBar4=new JKQTPbarHorizontalErrorGraph(plotBarchart2->get_plotter());
|
JKQTPBarHorizontalErrorGraph* plteBar4=new JKQTPBarHorizontalErrorGraph(plotBarchart2->get_plotter());
|
||||||
plteBar4->set_yColumn(bcpx);
|
plteBar4->set_yColumn(bcpx);
|
||||||
plteBar4->set_xColumn(bcpy2);
|
plteBar4->set_xColumn(bcpy2);
|
||||||
plteBar4->set_xErrorColumn(bcpye2);
|
plteBar4->set_xErrorColumn(bcpye2);
|
||||||
|
@ -44,8 +44,8 @@ class TestWidgetBarcharts : public QWidget
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
JKQtPlotter* plotBarchart;
|
JKQTPLotter* plotBarchart;
|
||||||
JKQtPlotter* plotBarchart2;
|
JKQTPLotter* plotBarchart2;
|
||||||
QCheckBox* chkBarLog;
|
QCheckBox* chkBarLog;
|
||||||
QSpinBox* spinBarLabelAngel;
|
QSpinBox* spinBarLabelAngel;
|
||||||
QSpinBox* spinBarLabelAngel2;
|
QSpinBox* spinBarLabelAngel2;
|
||||||
|
@ -16,14 +16,14 @@ TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
|
|||||||
// contour plot
|
// contour plot
|
||||||
QHBoxLayout* layoutContour=new QHBoxLayout(this);
|
QHBoxLayout* layoutContour=new QHBoxLayout(this);
|
||||||
setLayout(layoutContour);
|
setLayout(layoutContour);
|
||||||
JKQtPlotter* plotContour=new JKQtPlotter(true, this);
|
JKQTPLotter* plotContour=new JKQTPLotter(true, this);
|
||||||
plotContour->set_doDrawing(false);
|
plotContour->set_doDrawing(false);
|
||||||
plotContour->get_plotter()->set_plotLabel(tr("\\textbf{hist contour plot}"));
|
plotContour->get_plotter()->set_plotLabel(tr("\\textbf{hist contour plot}"));
|
||||||
plotContour->setObjectName("contour");
|
plotContour->setObjectName("contour");
|
||||||
plotContour->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "contour/");
|
plotContour->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "contour/");
|
||||||
layoutContour->addWidget(plotContour);
|
layoutContour->addWidget(plotContour);
|
||||||
|
|
||||||
JKQtPlotter* plotDensity=new JKQtPlotter(true, this);
|
JKQTPLotter* plotDensity=new JKQTPLotter(true, this);
|
||||||
plotContour->set_doDrawing(false);
|
plotContour->set_doDrawing(false);
|
||||||
plotContour->get_plotter()->set_plotLabel(tr("\\textbf{2D histogram plot with contours}"));
|
plotContour->get_plotter()->set_plotLabel(tr("\\textbf{2D histogram plot with contours}"));
|
||||||
plotDensity->get_plotter()->set_plotLabel(tr("\\textbf{2D histogram}"));
|
plotDensity->get_plotter()->set_plotLabel(tr("\\textbf{2D histogram}"));
|
||||||
|
@ -14,8 +14,8 @@ TestWidgetEmptyPlot::TestWidgetEmptyPlot(QWidget *parent) :
|
|||||||
|
|
||||||
#define NEMPTY 500
|
#define NEMPTY 500
|
||||||
|
|
||||||
JKQtPlotter* plotEmpty=new JKQtPlotter(true, this);
|
JKQTPLotter* plotEmpty=new JKQTPLotter(true, this);
|
||||||
JKQTPxyLineGraph* efunc=new JKQTPxyLineGraph(plotEmpty->get_plotter());
|
JKQTPXYLineGraph* efunc=new JKQTPXYLineGraph(plotEmpty->get_plotter());
|
||||||
double xef[NEMPTY], efy[NEMPTY];
|
double xef[NEMPTY], efy[NEMPTY];
|
||||||
for (int i=0; i<NEMPTY; i++) {
|
for (int i=0; i<NEMPTY; i++) {
|
||||||
xef[i]=i;
|
xef[i]=i;
|
||||||
|
@ -16,9 +16,9 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
|
|||||||
|
|
||||||
QVBoxLayout* plotFuncLayout=new QVBoxLayout(this);
|
QVBoxLayout* plotFuncLayout=new QVBoxLayout(this);
|
||||||
setLayout(plotFuncLayout);
|
setLayout(plotFuncLayout);
|
||||||
plotFuncPlt=new JKQtPlotter(true, this);
|
plotFuncPlt=new JKQTPLotter(true, this);
|
||||||
plotFuncLayout->addWidget(plotFuncPlt);
|
plotFuncLayout->addWidget(plotFuncPlt);
|
||||||
pfunc=new JKQTPxParsedFunctionLineGraph(plotFuncPlt->get_plotter());
|
pfunc=new JKQTPXParsedFunctionLineGraph(plotFuncPlt->get_plotter());
|
||||||
pfunc->set_function("x^2/10+sin(x*pi*10)");
|
pfunc->set_function("x^2/10+sin(x*pi*10)");
|
||||||
pfunc->set_errorFunction("x^2/20");
|
pfunc->set_errorFunction("x^2/20");
|
||||||
pfunc->set_drawErrorPolygons(true);
|
pfunc->set_drawErrorPolygons(true);
|
||||||
@ -26,7 +26,7 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
|
|||||||
plotFuncPlt->addGraph(pfunc);
|
plotFuncPlt->addGraph(pfunc);
|
||||||
plotFuncPlt->update_plot();
|
plotFuncPlt->update_plot();
|
||||||
|
|
||||||
pfuncErrorStyle=new JKQTPerrorPlotstyleComboBox(this);
|
pfuncErrorStyle=new JKQTPErrorPlotstyleComboBox(this);
|
||||||
pfuncErrorStyle->setCurrentIndex(3);
|
pfuncErrorStyle->setCurrentIndex(3);
|
||||||
plotFuncLayout->addWidget(pfuncErrorStyle);
|
plotFuncLayout->addWidget(pfuncErrorStyle);
|
||||||
connect(pfuncErrorStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(setPFuncStyle()));
|
connect(pfuncErrorStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(setPFuncStyle()));
|
||||||
@ -84,8 +84,8 @@ void TestWidgetFunctionPlots::setPFuncStyle()
|
|||||||
{
|
{
|
||||||
pfunc->set_drawErrorLines(false);
|
pfunc->set_drawErrorLines(false);
|
||||||
pfunc->set_drawErrorPolygons(false);
|
pfunc->set_drawErrorPolygons(false);
|
||||||
if (pfuncErrorStyle->getErrorStyle()==JKQTPerrorLines) pfunc->set_drawErrorLines(true);
|
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorLines) pfunc->set_drawErrorLines(true);
|
||||||
if (pfuncErrorStyle->getErrorStyle()==JKQTPerrorPolygons) pfunc->set_drawErrorPolygons(true);
|
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorPolygons) pfunc->set_drawErrorPolygons(true);
|
||||||
pfunc->set_drawLine(chkPFuncDrawLine->isChecked());
|
pfunc->set_drawLine(chkPFuncDrawLine->isChecked());
|
||||||
pfunc->set_displaySamplePoints(chkPFuncDrawSamples->isChecked());
|
pfunc->set_displaySamplePoints(chkPFuncDrawSamples->isChecked());
|
||||||
plotFuncPlt->update_plot();
|
plotFuncPlt->update_plot();
|
||||||
|
@ -46,9 +46,9 @@ class TestWidgetFunctionPlots : public QWidget
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
JKQTPxParsedFunctionLineGraph* pfunc;
|
JKQTPXParsedFunctionLineGraph* pfunc;
|
||||||
JKQtPlotter* plotFuncPlt;
|
JKQTPLotter* plotFuncPlt;
|
||||||
JKQTPerrorPlotstyleComboBox* pfuncErrorStyle;
|
JKQTPErrorPlotstyleComboBox* pfuncErrorStyle;
|
||||||
QCheckBox* chkPFuncDrawSamples;
|
QCheckBox* chkPFuncDrawSamples;
|
||||||
QCheckBox* chkPFuncDrawLine;
|
QCheckBox* chkPFuncDrawLine;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
|
|||||||
QVBoxLayout* layout1=new QVBoxLayout(this);
|
QVBoxLayout* layout1=new QVBoxLayout(this);
|
||||||
setLayout(layout1);
|
setLayout(layout1);
|
||||||
resize(1000, 800);
|
resize(1000, 800);
|
||||||
JKQtPlotter* plotGeo=new JKQtPlotter(true, this);
|
JKQTPLotter* plotGeo=new JKQTPLotter(true, this);
|
||||||
plotGeo->set_doDrawing(false);
|
plotGeo->set_doDrawing(false);
|
||||||
plotGeo->setObjectName("plotGeo");
|
plotGeo->setObjectName("plotGeo");
|
||||||
layout1->addWidget(plotGeo);
|
layout1->addWidget(plotGeo);
|
||||||
@ -30,21 +30,21 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
|
|||||||
plotGeo->get_plotter()->set_axisAspectRatio(1);
|
plotGeo->get_plotter()->set_axisAspectRatio(1);
|
||||||
|
|
||||||
|
|
||||||
// JKQTPgeoLine* line1=new JKQTPgeoLine(plotGeo->get_plotter(), -1, -2, 2, 1.5);
|
// JKQTPGeoLine* line1=new JKQTPGeoLine(plotGeo->get_plotter(), -1, -2, 2, 1.5);
|
||||||
//plotGeo->get_plotter()->addGraph(line1);
|
//plotGeo->get_plotter()->addGraph(line1);
|
||||||
// JKQTPgeoLine* line2=new JKQTPgeoLine(plotGeo->get_plotter(), 1, -5, 4, 3, QColor("blue"), 4);
|
// JKQTPGeoLine* line2=new JKQTPGeoLine(plotGeo->get_plotter(), 1, -5, 4, 3, QColor("blue"), 4);
|
||||||
//plotGeo->get_plotter()->addGraph(line2);
|
//plotGeo->get_plotter()->addGraph(line2);
|
||||||
|
|
||||||
JKQTPgeoRectangle* rect1=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("blue"),2, Qt::SolidLine, QColor("lightblue"));
|
JKQTPGeoRectangle* rect1=new JKQTPGeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("blue"),2, Qt::SolidLine, QColor("lightblue"));
|
||||||
rect1->set_angle(30);
|
rect1->set_angle(30);
|
||||||
//plotGeo->get_plotter()->addGraph(rect1);
|
//plotGeo->get_plotter()->addGraph(rect1);
|
||||||
JKQTPgeoRectangle* rect2=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("red"),2);
|
JKQTPGeoRectangle* rect2=new JKQTPGeoRectangle(plotGeo->get_plotter(), 1,1,2,2, QColor("red"),2);
|
||||||
rect2->set_angle(45);
|
rect2->set_angle(45);
|
||||||
//plotGeo->get_plotter()->addGraph(rect2);
|
//plotGeo->get_plotter()->addGraph(rect2);
|
||||||
JKQTPgeoRectangle* rect3=new JKQTPgeoRectangle(plotGeo->get_plotter(), 1,1,2,4, QColor("green"),2);
|
JKQTPGeoRectangle* rect3=new JKQTPGeoRectangle(plotGeo->get_plotter(), 1,1,2,4, QColor("green"),2);
|
||||||
rect3->set_angle(-30);
|
rect3->set_angle(-30);
|
||||||
//plotGeo->get_plotter()->addGraph(rect3);
|
//plotGeo->get_plotter()->addGraph(rect3);
|
||||||
JKQTPgeoEllipse* ell3=new JKQTPgeoEllipse(plotGeo->get_plotter(), 1,1,2,4, QColor("green"),2, Qt::SolidLine, QColor("lightgreen"), Qt::CrossPattern);
|
JKQTPGeoEllipse* ell3=new JKQTPGeoEllipse(plotGeo->get_plotter(), 1,1,2,4, QColor("green"),2, Qt::SolidLine, QColor("lightgreen"), Qt::CrossPattern);
|
||||||
ell3->set_angle(-30);
|
ell3->set_angle(-30);
|
||||||
//plotGeo->get_plotter()->addGraph(ell3);
|
//plotGeo->get_plotter()->addGraph(ell3);
|
||||||
|
|
||||||
@ -55,31 +55,31 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
|
|||||||
p.append(QPointF(0,-2));
|
p.append(QPointF(0,-2));
|
||||||
p.append(QPointF(M_PI,5.5));
|
p.append(QPointF(M_PI,5.5));
|
||||||
|
|
||||||
// JKQTPgeoPolygon* poly=new JKQTPgeoPolygon(plotGeo->get_plotter(), p, QColor("black"), 1.5, Qt::SolidLine, QColor(128,128,0,128));
|
// JKQTPGeoPolygon* poly=new JKQTPGeoPolygon(plotGeo->get_plotter(), p, QColor("black"), 1.5, Qt::SolidLine, QColor(128,128,0,128));
|
||||||
//plotGeo->get_plotter()->addGraph(poly);
|
//plotGeo->get_plotter()->addGraph(poly);
|
||||||
// JKQTPgeoPolyLines* lines=new JKQTPgeoPolyLines(plotGeo->get_plotter(), p, QColor(255,255,0), 3);
|
// JKQTPGeoPolyLines* lines=new JKQTPGeoPolyLines(plotGeo->get_plotter(), p, QColor(255,255,0), 3);
|
||||||
//plotGeo->get_plotter()->addGraph(lines);
|
//plotGeo->get_plotter()->addGraph(lines);
|
||||||
|
|
||||||
JKQTPgeoEllipse* ell1=new JKQTPgeoEllipse(plotGeo->get_plotter(), 0,0,2,4, QColor("black"),1.5, Qt::DotLine);
|
JKQTPGeoEllipse* ell1=new JKQTPGeoEllipse(plotGeo->get_plotter(), 0,0,2,4, QColor("black"),1.5, Qt::DotLine);
|
||||||
plotGeo->get_plotter()->addGraph(ell1);
|
plotGeo->get_plotter()->addGraph(ell1);
|
||||||
// JKQTPgeoArc* arc=new JKQTPgeoArc(plotGeo->get_plotter(), 0,0,2,4,0, 135, QColor("blue"),3, Qt::SolidLine);
|
// JKQTPGeoArc* arc=new JKQTPGeoArc(plotGeo->get_plotter(), 0,0,2,4,0, 135, QColor("blue"),3, Qt::SolidLine);
|
||||||
//plotGeo->get_plotter()->addGraph(arc);
|
//plotGeo->get_plotter()->addGraph(arc);
|
||||||
// JKQTPgeoPie* pie=new JKQTPgeoPie(plotGeo->get_plotter(), 0,0,2,4,35, 98, QColor("blue"),3, Qt::SolidLine, QColor(0,0,255,127));
|
// JKQTPGeoPie* pie=new JKQTPGeoPie(plotGeo->get_plotter(), 0,0,2,4,35, 98, QColor("blue"),3, Qt::SolidLine, QColor(0,0,255,127));
|
||||||
//plotGeo->get_plotter()->addGraph(pie);
|
//plotGeo->get_plotter()->addGraph(pie);
|
||||||
// JKQTPgeoChord* chord=new JKQTPgeoChord(plotGeo->get_plotter(), 0,0,2,4,35, 98, QColor("blue"),3, Qt::SolidLine, QColor(0,0,255,127));
|
// JKQTPGeoChord* chord=new JKQTPGeoChord(plotGeo->get_plotter(), 0,0,2,4,35, 98, QColor("blue"),3, Qt::SolidLine, QColor(0,0,255,127));
|
||||||
//plotGeo->get_plotter()->addGraph(chord);
|
//plotGeo->get_plotter()->addGraph(chord);
|
||||||
|
|
||||||
JKQTPgeoInfiniteLine* iline=new JKQTPgeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,1,1, QColor("blue"), 3);
|
JKQTPGeoInfiniteLine* iline=new JKQTPGeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,1,1, QColor("blue"), 3);
|
||||||
plotGeo->get_plotter()->addGraph(iline);
|
plotGeo->get_plotter()->addGraph(iline);
|
||||||
JKQTPgeoInfiniteLine* iline1=new JKQTPgeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,-1,0, QColor("red"), 3);
|
JKQTPGeoInfiniteLine* iline1=new JKQTPGeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,-1,0, QColor("red"), 3);
|
||||||
plotGeo->get_plotter()->addGraph(iline1);
|
plotGeo->get_plotter()->addGraph(iline1);
|
||||||
JKQTPgeoInfiniteLine* iline2=new JKQTPgeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,0,1, QColor("red"), 3);
|
JKQTPGeoInfiniteLine* iline2=new JKQTPGeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,0,1, QColor("red"), 3);
|
||||||
plotGeo->get_plotter()->addGraph(iline2);
|
plotGeo->get_plotter()->addGraph(iline2);
|
||||||
JKQTPgeoInfiniteLine* iline3=new JKQTPgeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,-1,0.5, QColor("green"), 3);
|
JKQTPGeoInfiniteLine* iline3=new JKQTPGeoInfiniteLine(plotGeo->get_plotter(), 0.5,1,-1,0.5, QColor("green"), 3);
|
||||||
iline3->set_two_sided(true);
|
iline3->set_two_sided(true);
|
||||||
plotGeo->get_plotter()->addGraph(iline3);
|
plotGeo->get_plotter()->addGraph(iline3);
|
||||||
|
|
||||||
JKQTPgeoText* text=new JKQTPgeoText(plotGeo->get_plotter(), -1, -1, "Test $f(x)=\\sqrt{\\sin(x^2)}$ \\textbf{bold}", 12, QColor("red"));
|
JKQTPGeoText* text=new JKQTPGeoText(plotGeo->get_plotter(), -1, -1, "Test $f(x)=\\sqrt{\\sin(x^2)}$ \\textbf{bold}", 12, QColor("red"));
|
||||||
plotGeo->get_plotter()->addGraph(text);
|
plotGeo->get_plotter()->addGraph(text);
|
||||||
|
|
||||||
plotGeo->set_doDrawing(true);
|
plotGeo->set_doDrawing(true);
|
||||||
|
@ -19,11 +19,11 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
ovlTime.start();
|
ovlTime.start();
|
||||||
|
|
||||||
|
|
||||||
plot=new JKQtPlotter(true, this);
|
plot=new JKQTPLotter(true, this);
|
||||||
plot->set_doDrawing(false);
|
plot->set_doDrawing(false);
|
||||||
plotBot=new JKQtPlotter(false, this, plot->getDatastore());
|
plotBot=new JKQTPLotter(false, this, plot->getDatastore());
|
||||||
plotBot2=new JKQtPlotter(false, this, plot->getDatastore());
|
plotBot2=new JKQTPLotter(false, this, plot->getDatastore());
|
||||||
ovl1=new JKQTPoverlayVerticalLine(0.0, tr("test"), plot->get_plotter());
|
ovl1=new JKQTPOverlayVerticalLine(0.0, tr("test"), plot->get_plotter());
|
||||||
plot->get_plotter()->addOverlayElement(ovl1);
|
plot->get_plotter()->addOverlayElement(ovl1);
|
||||||
plot->setObjectName("plot");
|
plot->setObjectName("plot");
|
||||||
plotBot->setObjectName("plotBot");
|
plotBot->setObjectName("plotBot");
|
||||||
@ -48,7 +48,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
resize(1000, 800);
|
resize(1000, 800);
|
||||||
|
|
||||||
plotBot->synchronizeToMaster(plot, true, false);
|
plotBot->synchronizeToMaster(plot, true, false);
|
||||||
connect(plot, SIGNAL(zoomChangedLocally(double,double,double,double,JKQtPlotter*)), plotBot, SLOT(synchronizeXAxis(double,double,double,double,JKQtPlotter*)));
|
connect(plot, SIGNAL(zoomChangedLocally(double,double,double,double,JKQTPLotter*)), plotBot, SLOT(synchronizeXAxis(double,double,double,double,JKQTPLotter*)));
|
||||||
plot->get_plotter()->set_gridPrinting(true);
|
plot->get_plotter()->set_gridPrinting(true);
|
||||||
plot->get_plotter()->addGridPrintingPlotter(0,1,plotBot->get_plotter());
|
plot->get_plotter()->addGridPrintingPlotter(0,1,plotBot->get_plotter());
|
||||||
plot->get_plotter()->addGridPrintingPlotter(0,2,plotBot2->get_plotter());
|
plot->get_plotter()->addGridPrintingPlotter(0,2,plotBot2->get_plotter());
|
||||||
@ -75,16 +75,16 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
y21r[i]=double(rand()%100)/10.0-5.0;
|
y21r[i]=double(rand()%100)/10.0-5.0;
|
||||||
y21re[i]=y21r[i]*double(rand()%10)/40.0;
|
y21re[i]=y21r[i]*double(rand()%10)/40.0;
|
||||||
}
|
}
|
||||||
JKQTPdatastore* ds=plot->get_plotter()->getDatastore();
|
JKQTPDatastore* ds=plot->get_plotter()->getDatastore();
|
||||||
|
|
||||||
//size_t cx1=ds->addColumn(x1, N1, "x1");
|
//size_t cx1=ds->addColumn(x1, N1, "x1");
|
||||||
//size_t cy11=ds->addColumn(y11, N1, "y11");
|
//size_t cy11=ds->addColumn(y11, N1, "y11");
|
||||||
//size_t cy12=ds->addColumn(y12, N1, "y12");
|
//size_t cy12=ds->addColumn(y12, N1, "y12");
|
||||||
//size_t cy13=ds->addColumn(y13, N1, "y13");
|
//size_t cy13=ds->addColumn(y13, N1, "y13");
|
||||||
|
|
||||||
//plot->addGraph(cx1, cy11, "$\\sin(x)$", JKQTPpoints);
|
//plot->addGraph(cx1, cy11, "$\\sin(x)$", JKQTPPoints);
|
||||||
//plot->addGraph(cy12, cx1, "$\\cos(x)$", JKQTPfilledCurveY);
|
//plot->addGraph(cy12, cx1, "$\\cos(x)$", JKQTPFilledCurveY);
|
||||||
//plot->addGraphWithXError(cy12, cx1, cy13, "$\\cos(x)$ with errors", JKQTPfilledCurveY, JKQTPerrorPolygons);
|
//plot->addGraphWithXError(cy12, cx1, cy13, "$\\cos(x)$ with errors", JKQTPFilledCurveY, JKQTPErrorPolygons);
|
||||||
|
|
||||||
for (unsigned int i=0; i<N2; i++) {
|
for (unsigned int i=0; i<N2; i++) {
|
||||||
x2[i]=(double)(i+1)/(double)N2*8*M_PI;
|
x2[i]=(double)(i+1)/(double)N2*8*M_PI;
|
||||||
@ -104,26 +104,26 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
size_t cy21re=ds->addColumn(y21re, N2, "y21re");
|
size_t cy21re=ds->addColumn(y21re, N2, "y21re");
|
||||||
|
|
||||||
|
|
||||||
size_t id=plot->get_plotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPfilledCurveX);
|
size_t id=plot->get_plotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPFilledCurveX);
|
||||||
JKQTPfilledCurveXGraph* fcxgr=qobject_cast<JKQTPfilledCurveXGraph*>(plot->get_plotter()->getGraph(id));
|
JKQTPFilledCurveXGraph* fcxgr=qobject_cast<JKQTPFilledCurveXGraph*>(plot->get_plotter()->getGraph(id));
|
||||||
if (fcxgr) {
|
if (fcxgr) {
|
||||||
fcxgr->set_baseline(2);
|
fcxgr->set_baseline(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t yeb=plot->get_plotter()->addGraphWithXYError(cx2, cy21, cy22, cy22, "sine with errors", JKQTPfilledCurveX);
|
size_t yeb=plot->get_plotter()->addGraphWithXYError(cx2, cy21, cy22, cy22, "sine with errors", JKQTPFilledCurveX);
|
||||||
plteErrors=plot->get_plotter()->getGraph(yeb);
|
plteErrors=plot->get_plotter()->getGraph(yeb);
|
||||||
setErrorStyle(0);
|
setErrorStyle(0);
|
||||||
yeb=plot->get_plotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPlinesPoints);
|
yeb=plot->get_plotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPLinesPoints);
|
||||||
plteSymbols=plot->get_plotter()->getGraph(yeb);
|
plteSymbols=plot->get_plotter()->getGraph(yeb);
|
||||||
|
|
||||||
pltePlot2=new JKQTPxyLineErrorGraph(plotBot->get_plotter());
|
pltePlot2=new JKQTPXYLineErrorGraph(plotBot->get_plotter());
|
||||||
pltePlot2->set_xColumn(cx2r);
|
pltePlot2->set_xColumn(cx2r);
|
||||||
pltePlot2->set_yColumn(cy21r);
|
pltePlot2->set_yColumn(cy21r);
|
||||||
pltePlot2->set_title(tr("random numbers"));
|
pltePlot2->set_title(tr("random numbers"));
|
||||||
pltePlot2->set_drawLine(true);
|
pltePlot2->set_drawLine(true);
|
||||||
pltePlot2->set_yErrorColumn(cy21re);
|
pltePlot2->set_yErrorColumn(cy21re);
|
||||||
pltePlot2->set_yErrorStyle(JKQTPerrorBarsPolygons);
|
pltePlot2->set_yErrorStyle(JKQTPErrorBarsPolygons);
|
||||||
pltePlot2->set_symbol(JKQTPfilledStar);
|
pltePlot2->set_symbol(JKQTPFilledStar);
|
||||||
plotBot->get_plotter()->addGraph(pltePlot2);
|
plotBot->get_plotter()->addGraph(pltePlot2);
|
||||||
plotBot->zoomToFit();
|
plotBot->zoomToFit();
|
||||||
|
|
||||||
@ -164,21 +164,21 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
ts<<"bars 1"<<"bars 2"<<"bars 3";
|
ts<<"bars 1"<<"bars 2"<<"bars 3";
|
||||||
plot->get_plotter()->addVerticalBargraph(cb, cbp, ts);
|
plot->get_plotter()->addVerticalBargraph(cb, cbp, ts);
|
||||||
|
|
||||||
JKQTPverticalRange* r1=new JKQTPverticalRange(plot->get_plotter());
|
JKQTPVerticalRange* r1=new JKQTPVerticalRange(plot->get_plotter());
|
||||||
r1->set_rangeMin(5);
|
r1->set_rangeMin(5);
|
||||||
r1->set_rangeMax(10);
|
r1->set_rangeMax(10);
|
||||||
r1->set_rangeCenter(7.5);
|
r1->set_rangeCenter(7.5);
|
||||||
r1->set_title("vert. range");
|
r1->set_title("vert. range");
|
||||||
plot->get_plotter()->addGraph(r1);
|
plot->get_plotter()->addGraph(r1);
|
||||||
|
|
||||||
JKQTPhorizontalRange* r2=new JKQTPhorizontalRange(plot->get_plotter());
|
JKQTPHorizontalRange* r2=new JKQTPHorizontalRange(plot->get_plotter());
|
||||||
r2->set_rangeMin(5);
|
r2->set_rangeMin(5);
|
||||||
r2->set_rangeMax(10);
|
r2->set_rangeMax(10);
|
||||||
r2->set_rangeCenter(7.5);
|
r2->set_rangeCenter(7.5);
|
||||||
r2->set_title("hor. range");
|
r2->set_title("hor. range");
|
||||||
plot->get_plotter()->addGraph(r2);
|
plot->get_plotter()->addGraph(r2);
|
||||||
|
|
||||||
JKQTPboxplotVerticalGraph* box=new JKQTPboxplotVerticalGraph(plotBot2->get_plotter());
|
JKQTPBoxplotVerticalGraph* box=new JKQTPBoxplotVerticalGraph(plotBot2->get_plotter());
|
||||||
box->set_posColumn(cbxbox);
|
box->set_posColumn(cbxbox);
|
||||||
box->set_medianColumn(cbmed);
|
box->set_medianColumn(cbmed);
|
||||||
box->set_meanColumn(cbmean);
|
box->set_meanColumn(cbmean);
|
||||||
@ -190,7 +190,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
plotBot2->addGraph(box);
|
plotBot2->addGraph(box);
|
||||||
plotBot2->zoomToFit();
|
plotBot2->zoomToFit();
|
||||||
|
|
||||||
/*JKQTPyFunctionLineGraph* g=new JKQTPyFunctionLineGraph(&plot);
|
/*JKQTPYFunctionLineGraph* g=new JKQTPYFunctionLineGraph(&plot);
|
||||||
g->set_title("function 1");
|
g->set_title("function 1");
|
||||||
g->set_plotFunction(f1);
|
g->set_plotFunction(f1);
|
||||||
g->set_errorFunction(f1e);
|
g->set_errorFunction(f1e);
|
||||||
@ -199,18 +199,18 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
g->set_color(QColor("red"));
|
g->set_color(QColor("red"));
|
||||||
plot->addGraph(g);*/
|
plot->addGraph(g);*/
|
||||||
|
|
||||||
/*JKQTPxFunctionLineGraph* g=new JKQTPxFunctionLineGraph(&plot);
|
/*JKQTPXFunctionLineGraph* g=new JKQTPXFunctionLineGraph(&plot);
|
||||||
g->set_title("function 2");
|
g->set_title("function 2");
|
||||||
g->set_plotFunction(f2);
|
g->set_plotFunction(f2);
|
||||||
plot->addGraph(g);*/
|
plot->addGraph(g);*/
|
||||||
|
|
||||||
/*JKQTPstepVerticalGraph* g=new JKQTPstepVerticalGraph(&plot);
|
/*JKQTPStepVerticalGraph* g=new JKQTPStepVerticalGraph(&plot);
|
||||||
g->set_xColumn(cy11);
|
g->set_xColumn(cy11);
|
||||||
g->set_yColumn(cx1);
|
g->set_yColumn(cx1);
|
||||||
g->set_fillCurve(true);
|
g->set_fillCurve(true);
|
||||||
g->set_valuesCentered(true);
|
g->set_valuesCentered(true);
|
||||||
plot->addGraph(g);
|
plot->addGraph(g);
|
||||||
plot->addGraph(cy11, cx1, "$\\sin(x)$", JKQTPpoints);*/
|
plot->addGraph(cy11, cx1, "$\\sin(x)$", JKQTPPoints);*/
|
||||||
|
|
||||||
plot->set_doDrawing(true);
|
plot->set_doDrawing(true);
|
||||||
plot->get_plotter()->zoomToFit(true, false);//, true);
|
plot->get_plotter()->zoomToFit(true, false);//, true);
|
||||||
@ -232,12 +232,12 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
layout->addWidget(chkInvertY);
|
layout->addWidget(chkInvertY);
|
||||||
layout->addWidget(chkInvertX);
|
layout->addWidget(chkInvertX);
|
||||||
layout->addWidget(chkInvertY);
|
layout->addWidget(chkInvertY);
|
||||||
JKQTPSymbolComboBox* cmbJKQTPplotSymbol=new JKQTPSymbolComboBox(this);
|
JKQTPSymbolComboBox* cmbJKQTPPlotSymbol=new JKQTPSymbolComboBox(this);
|
||||||
cmbJKQTPplotSymbol->setSymbol(JKQTPplus);
|
cmbJKQTPPlotSymbol->setSymbol(JKQTPPlus);
|
||||||
connect(cmbJKQTPplotSymbol, SIGNAL(currentIndexChanged(int)), this, SLOT(setESSymbol(int)));
|
connect(cmbJKQTPPlotSymbol, SIGNAL(currentIndexChanged(int)), this, SLOT(setESSymbol(int)));
|
||||||
layout->addWidget(cmbJKQTPplotSymbol);
|
layout->addWidget(cmbJKQTPPlotSymbol);
|
||||||
JKQTPerrorPlotstyleComboBox* cmbErrors=new JKQTPerrorPlotstyleComboBox(this);
|
JKQTPErrorPlotstyleComboBox* cmbErrors=new JKQTPErrorPlotstyleComboBox(this);
|
||||||
cmbErrors->setCurrentErrorStyle(JKQTPerrorBars);
|
cmbErrors->setCurrentErrorStyle(JKQTPErrorBars);
|
||||||
connect(cmbErrors, SIGNAL(currentIndexChanged(int)), this, SLOT(setErrorStyle(int)));
|
connect(cmbErrors, SIGNAL(currentIndexChanged(int)), this, SLOT(setErrorStyle(int)));
|
||||||
layout->addWidget(cmbErrors);
|
layout->addWidget(cmbErrors);
|
||||||
QDoubleSpinBox* spinScale=new QDoubleSpinBox(this);
|
QDoubleSpinBox* spinScale=new QDoubleSpinBox(this);
|
||||||
@ -258,13 +258,13 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
layout->addWidget(cmbSortOrder2);
|
layout->addWidget(cmbSortOrder2);
|
||||||
|
|
||||||
|
|
||||||
JKQTPkeyLayoutComboBox* cmbKeyLayout=new JKQTPkeyLayoutComboBox(this);
|
JKQTPKeyLayoutComboBox* cmbKeyLayout=new JKQTPKeyLayoutComboBox(this);
|
||||||
connect(cmbKeyLayout, SIGNAL(currentLayoutChanged(JKQTPkeyLayout)), this, SLOT(setKeyLayout2(JKQTPkeyLayout)));
|
connect(cmbKeyLayout, SIGNAL(currentLayoutChanged(JKQTPKeyLayout)), this, SLOT(setKeyLayout2(JKQTPKeyLayout)));
|
||||||
layout->addWidget(cmbKeyLayout);
|
layout->addWidget(cmbKeyLayout);
|
||||||
|
|
||||||
|
|
||||||
JKQTPkeyPositionComboBox* cmbKeyPos=new JKQTPkeyPositionComboBox(this);
|
JKQTPKeyPositionComboBox* cmbKeyPos=new JKQTPKeyPositionComboBox(this);
|
||||||
connect(cmbKeyPos, SIGNAL(currentPositionChanged(JKQTPkeyPosition)), this, SLOT(setKeyPos2(JKQTPkeyPosition)));
|
connect(cmbKeyPos, SIGNAL(currentPositionChanged(JKQTPKeyPosition)), this, SLOT(setKeyPos2(JKQTPKeyPosition)));
|
||||||
layout->addWidget(cmbKeyPos);
|
layout->addWidget(cmbKeyPos);
|
||||||
|
|
||||||
|
|
||||||
@ -303,14 +303,14 @@ void TestWidgetGraphs::setErrorStyle(int /*index*/)
|
|||||||
{
|
{
|
||||||
QComboBox* cmb=qobject_cast<QComboBox*>(sender());
|
QComboBox* cmb=qobject_cast<QComboBox*>(sender());
|
||||||
if (cmb) {
|
if (cmb) {
|
||||||
JKQTPxyGraphErrors* exy=dynamic_cast<JKQTPxyGraphErrors*>(plteErrors);
|
JKQTPXYGraphErrors* exy=dynamic_cast<JKQTPXYGraphErrors*>(plteErrors);
|
||||||
// JKQTPxGraphErrors* ex=dynamic_cast<JKQTPxGraphErrors*>(plteErrors);
|
// JKQTPXGraphErrors* ex=dynamic_cast<JKQTPXGraphErrors*>(plteErrors);
|
||||||
JKQTPyGraphErrors* ey=dynamic_cast<JKQTPyGraphErrors*>(plteErrors);
|
JKQTPYGraphErrors* ey=dynamic_cast<JKQTPYGraphErrors*>(plteErrors);
|
||||||
if (exy) {
|
if (exy) {
|
||||||
exy->set_yErrorStyle(String2JKQTPerrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
|
exy->set_yErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
|
||||||
}
|
}
|
||||||
if (ey) {
|
if (ey) {
|
||||||
ey->set_yErrorStyle(String2JKQTPerrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
|
ey->set_yErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
|
||||||
}
|
}
|
||||||
plot->update_plot();
|
plot->update_plot();
|
||||||
}
|
}
|
||||||
@ -320,9 +320,9 @@ void TestWidgetGraphs::setESSymbol(int /*index*/)
|
|||||||
{
|
{
|
||||||
QComboBox* cmb=qobject_cast<QComboBox*>(sender());
|
QComboBox* cmb=qobject_cast<QComboBox*>(sender());
|
||||||
if (cmb) {
|
if (cmb) {
|
||||||
JKQTPxyLineGraph* exy=dynamic_cast<JKQTPxyLineGraph*>(plteSymbols);
|
JKQTPXYLineGraph* exy=dynamic_cast<JKQTPXYLineGraph*>(plteSymbols);
|
||||||
if (exy) {
|
if (exy) {
|
||||||
exy->set_symbol(String2JKQTPgraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
|
exy->set_symbol(String2JKQTPGraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
plot->update_plot();
|
plot->update_plot();
|
||||||
@ -332,13 +332,13 @@ void TestWidgetGraphs::setESSymbol(int /*index*/)
|
|||||||
|
|
||||||
void TestWidgetGraphs::setSortOrder2(int index)
|
void TestWidgetGraphs::setSortOrder2(int index)
|
||||||
{
|
{
|
||||||
if (index==0) pltePlot2->set_sortData(JKQTPxyGraph::Unsorted);
|
if (index==0) pltePlot2->set_sortData(JKQTPXYGraph::Unsorted);
|
||||||
if (index==1) pltePlot2->set_sortData(JKQTPxyLineGraph::SortedX);
|
if (index==1) pltePlot2->set_sortData(JKQTPXYLineGraph::SortedX);
|
||||||
if (index==2) pltePlot2->set_sortData(JKQTPxyLineGraph::SortedY);
|
if (index==2) pltePlot2->set_sortData(JKQTPXYLineGraph::SortedY);
|
||||||
plotBot->update_plot();
|
plotBot->update_plot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetGraphs::setKeyLayout2(JKQTPkeyLayout layout)
|
void TestWidgetGraphs::setKeyLayout2(JKQTPKeyLayout layout)
|
||||||
{
|
{
|
||||||
plot->get_plotter()->set_keyLayout(layout);
|
plot->get_plotter()->set_keyLayout(layout);
|
||||||
plotBot->get_plotter()->set_keyLayout(layout);
|
plotBot->get_plotter()->set_keyLayout(layout);
|
||||||
@ -348,7 +348,7 @@ void TestWidgetGraphs::setKeyLayout2(JKQTPkeyLayout layout)
|
|||||||
plotBot2->update_plot();
|
plotBot2->update_plot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetGraphs::setKeyPos2(JKQTPkeyPosition layout)
|
void TestWidgetGraphs::setKeyPos2(JKQTPKeyPosition layout)
|
||||||
{
|
{
|
||||||
plot->get_plotter()->set_keyPosition(layout);
|
plot->get_plotter()->set_keyPosition(layout);
|
||||||
plotBot->get_plotter()->set_keyPosition(layout);
|
plotBot->get_plotter()->set_keyPosition(layout);
|
||||||
|
@ -43,8 +43,8 @@ class TestWidgetGraphs : public QWidget
|
|||||||
|
|
||||||
void setSortOrder2(int index);
|
void setSortOrder2(int index);
|
||||||
|
|
||||||
void setKeyLayout2(JKQTPkeyLayout layout);
|
void setKeyLayout2(JKQTPKeyLayout layout);
|
||||||
void setKeyPos2(JKQTPkeyPosition layout);
|
void setKeyPos2(JKQTPKeyPosition layout);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double x1[N1], x2[N2], x2r[N2]/*, x3[N3]*/;
|
double x1[N1], x2[N2], x2r[N2]/*, x3[N3]*/;
|
||||||
@ -53,15 +53,15 @@ class TestWidgetGraphs : public QWidget
|
|||||||
double b1[N3], b2[N3], b3[N3];
|
double b1[N3], b2[N3], b3[N3];
|
||||||
|
|
||||||
|
|
||||||
JKQTPoverlayVerticalLine* ovl1;
|
JKQTPOverlayVerticalLine* ovl1;
|
||||||
JKQtPlotter* plot;
|
JKQTPLotter* plot;
|
||||||
JKQtPlotter* plotLOG;
|
JKQTPLotter* plotLOG;
|
||||||
JKQtPlotter* plotBot;
|
JKQTPLotter* plotBot;
|
||||||
JKQtPlotter* plotBot2;
|
JKQTPLotter* plotBot2;
|
||||||
|
|
||||||
JKQTPplotElement* plteErrors;
|
JKQTPPlotElement* plteErrors;
|
||||||
JKQTPplotElement* plteSymbols;
|
JKQTPPlotElement* plteSymbols;
|
||||||
JKQTPxyLineErrorGraph* pltePlot2;
|
JKQTPXYLineErrorGraph* pltePlot2;
|
||||||
|
|
||||||
|
|
||||||
int ovlCnt;
|
int ovlCnt;
|
||||||
|
@ -19,7 +19,7 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
|
|||||||
layouti->addLayout(layWid);
|
layouti->addLayout(layWid);
|
||||||
setLayout(layouti);
|
setLayout(layouti);
|
||||||
resize(1000, 800);
|
resize(1000, 800);
|
||||||
plotImg=new JKQtPlotter(true, this);
|
plotImg=new JKQTPLotter(true, this);
|
||||||
plotImg->set_doDrawing(false);
|
plotImg->set_doDrawing(false);
|
||||||
plotImg->get_plotter()->set_plotLabel(tr("\\textbf{image plot}"));
|
plotImg->get_plotter()->set_plotLabel(tr("\\textbf{image plot}"));
|
||||||
plotImg->setObjectName("plotImg");
|
plotImg->setObjectName("plotImg");
|
||||||
|
@ -47,7 +47,7 @@ class TestWidgetImages : public QWidget
|
|||||||
|
|
||||||
JKQTPMathImage* pimg2;
|
JKQTPMathImage* pimg2;
|
||||||
JKQTPMathImage* pimg3;
|
JKQTPMathImage* pimg3;
|
||||||
JKQtPlotter* plotImg;
|
JKQTPLotter* plotImg;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -13,12 +13,12 @@ TestWidgetLogGraphs::TestWidgetLogGraphs(QWidget *parent) :
|
|||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
JKQtPlotter* plotLOG=new JKQtPlotter(this);
|
JKQTPLotter* plotLOG=new JKQTPLotter(this);
|
||||||
plotLOG->set_doDrawing(false);
|
plotLOG->set_doDrawing(false);
|
||||||
plotLOG->setObjectName("plotLOG");
|
plotLOG->setObjectName("plotLOG");
|
||||||
plotLOG->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plotLOG/");
|
plotLOG->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plotLOG/");
|
||||||
|
|
||||||
JKQTPdatastore* ds=plotLOG->get_plotter()->getDatastore();
|
JKQTPDatastore* ds=plotLOG->get_plotter()->getDatastore();
|
||||||
QVector<double> x,y;
|
QVector<double> x,y;
|
||||||
for (unsigned int i=0; i<N2; i++) {
|
for (unsigned int i=0; i<N2; i++) {
|
||||||
const double xx=static_cast<double>(i+1)/static_cast<double>(N2)*15.0;
|
const double xx=static_cast<double>(i+1)/static_cast<double>(N2)*15.0;
|
||||||
@ -38,7 +38,7 @@ TestWidgetLogGraphs::TestWidgetLogGraphs(QWidget *parent) :
|
|||||||
resize(1000, 800);
|
resize(1000, 800);
|
||||||
|
|
||||||
|
|
||||||
plotLOG->get_plotter()->addGraph(cx2, cy23, "data, $f(x)=5^{x/5}$", JKQTPlines);
|
plotLOG->get_plotter()->addGraph(cx2, cy23, "data, $f(x)=5^{x/5}$", JKQTPLines);
|
||||||
|
|
||||||
|
|
||||||
plotLOG->set_doDrawing(true);
|
plotLOG->set_doDrawing(true);
|
||||||
|
@ -17,7 +17,7 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
|
|||||||
|
|
||||||
setLayout(layoutPSP);
|
setLayout(layoutPSP);
|
||||||
resize(1000, 800);
|
resize(1000, 800);
|
||||||
plotPSP=new JKQtPlotter(true, this);
|
plotPSP=new JKQTPLotter(true, this);
|
||||||
plotPSP->set_doDrawing(false);
|
plotPSP->set_doDrawing(false);
|
||||||
plotPSP->get_plotter()->set_plotLabel(tr("\\textbf{parametrized scatter plots}"));
|
plotPSP->get_plotter()->set_plotLabel(tr("\\textbf{parametrized scatter plots}"));
|
||||||
plotPSP->setObjectName("plotPSP");
|
plotPSP->setObjectName("plotPSP");
|
||||||
@ -50,7 +50,7 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
|
|||||||
int psps=plotPSP->getDatastore()->addCopiedColumn(dataS, "size");
|
int psps=plotPSP->getDatastore()->addCopiedColumn(dataS, "size");
|
||||||
int pspsy=plotPSP->getDatastore()->addCopiedColumn(dataSy, "symbol");
|
int pspsy=plotPSP->getDatastore()->addCopiedColumn(dataSy, "symbol");
|
||||||
|
|
||||||
pltePSPCol=new JKQTPxyParametrizedErrorScatterGraph(plotPSP->get_plotter());
|
pltePSPCol=new JKQTPXYParametrizedErrorScatterGraph(plotPSP->get_plotter());
|
||||||
pltePSPCol->set_title(tr("changing color"));
|
pltePSPCol->set_title(tr("changing color"));
|
||||||
pltePSPCol->set_xColumn(pspx);
|
pltePSPCol->set_xColumn(pspx);
|
||||||
pltePSPCol->set_yColumn(pspy);
|
pltePSPCol->set_yColumn(pspy);
|
||||||
@ -61,7 +61,7 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
|
|||||||
pltePSPCol->set_drawLine(true);
|
pltePSPCol->set_drawLine(true);
|
||||||
plotPSP->get_plotter()->addGraph(pltePSPCol);
|
plotPSP->get_plotter()->addGraph(pltePSPCol);
|
||||||
|
|
||||||
pltePSPSize=new JKQTPxyParametrizedScatterGraph(plotPSP->get_plotter());
|
pltePSPSize=new JKQTPXYParametrizedScatterGraph(plotPSP->get_plotter());
|
||||||
pltePSPSize->set_xColumn(pspx);
|
pltePSPSize->set_xColumn(pspx);
|
||||||
pltePSPSize->set_yColumn(pspy1);
|
pltePSPSize->set_yColumn(pspy1);
|
||||||
pltePSPSize->set_sizeColumn(psps);
|
pltePSPSize->set_sizeColumn(psps);
|
||||||
@ -69,7 +69,7 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
|
|||||||
plotPSP->get_plotter()->addGraph(pltePSPSize);
|
plotPSP->get_plotter()->addGraph(pltePSPSize);
|
||||||
|
|
||||||
|
|
||||||
pltePSPSymb=new JKQTPxyParametrizedScatterGraph(plotPSP->get_plotter());
|
pltePSPSymb=new JKQTPXYParametrizedScatterGraph(plotPSP->get_plotter());
|
||||||
pltePSPSymb->set_xColumn(pspx);
|
pltePSPSymb->set_xColumn(pspx);
|
||||||
pltePSPSymb->set_yColumn(pspy3);
|
pltePSPSymb->set_yColumn(pspy3);
|
||||||
pltePSPSymb->set_symbolColumn(pspsy);
|
pltePSPSymb->set_symbolColumn(pspsy);
|
||||||
|
@ -40,10 +40,10 @@ class TestWidgetParamScatterPlots : public QWidget
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
JKQtPlotter* plotPSP;
|
JKQTPLotter* plotPSP;
|
||||||
JKQTPxyParametrizedErrorScatterGraph* pltePSPCol;
|
JKQTPXYParametrizedErrorScatterGraph* pltePSPCol;
|
||||||
JKQTPxyParametrizedScatterGraph* pltePSPSize;
|
JKQTPXYParametrizedScatterGraph* pltePSPSize;
|
||||||
JKQTPxyParametrizedScatterGraph* pltePSPSymb;
|
JKQTPXYParametrizedScatterGraph* pltePSPSymb;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ TestWidgetPeaksPlots::TestWidgetPeaksPlots(QWidget *parent) :
|
|||||||
QVBoxLayout* layoutpeaks=new QVBoxLayout(this);
|
QVBoxLayout* layoutpeaks=new QVBoxLayout(this);
|
||||||
setLayout(layoutpeaks);
|
setLayout(layoutpeaks);
|
||||||
resize(1000, 800);
|
resize(1000, 800);
|
||||||
plotPeaks=new JKQtPlotter(true, this);
|
plotPeaks=new JKQTPLotter(true, this);
|
||||||
plotPeaks->set_doDrawing(false);
|
plotPeaks->set_doDrawing(false);
|
||||||
plotPeaks->get_plotter()->set_plotLabel(tr("\\textbf{peaks stream plot}"));
|
plotPeaks->get_plotter()->set_plotLabel(tr("\\textbf{peaks stream plot}"));
|
||||||
plotPeaks->setObjectName("plotPeaks");
|
plotPeaks->setObjectName("plotPeaks");
|
||||||
|
@ -34,7 +34,7 @@ class TestWidgetPeaksPlots : public QWidget
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
JKQtPlotter* plotPeaks;
|
JKQTPLotter* plotPeaks;
|
||||||
JKQTPPeakStreamGraph* graphPeakStream1;
|
JKQTPPeakStreamGraph* graphPeakStream1;
|
||||||
JKQTPPeakStreamGraph* graphPeakStream2;
|
JKQTPPeakStreamGraph* graphPeakStream2;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ TestWidgetRGBImages::TestWidgetRGBImages(QWidget *parent) :
|
|||||||
QFormLayout* frm=new QFormLayout(nullptr);
|
QFormLayout* frm=new QFormLayout(nullptr);
|
||||||
winrgb->setLayout(layoutrgb);
|
winrgb->setLayout(layoutrgb);
|
||||||
winrgb->resize(1000, 800);
|
winrgb->resize(1000, 800);
|
||||||
plotImgRGB=new JKQtPlotter(true, winrgb);
|
plotImgRGB=new JKQTPLotter(true, winrgb);
|
||||||
plotImgRGB->set_doDrawing(false);
|
plotImgRGB->set_doDrawing(false);
|
||||||
plotImgRGB->get_plotter()->set_plotLabel(tr("\\textbf{RGB image plot}"));
|
plotImgRGB->get_plotter()->set_plotLabel(tr("\\textbf{RGB image plot}"));
|
||||||
plotImgRGB->setObjectName("plotImgRGB");
|
plotImgRGB->setObjectName("plotImgRGB");
|
||||||
|
@ -54,7 +54,7 @@ class TestWidgetRGBImages : public QWidget
|
|||||||
int rgb_colr, rgb_colb, rgb_colg, rgb_cola;
|
int rgb_colr, rgb_colb, rgb_colg, rgb_cola;
|
||||||
|
|
||||||
|
|
||||||
JKQtPlotter* plotImgRGB;
|
JKQTPLotter* plotImgRGB;
|
||||||
JKQTPRGBMathImage* rgbimg;
|
JKQTPRGBMathImage* rgbimg;
|
||||||
JKQTPColumnRGBMathImage* rgbimg2;
|
JKQTPColumnRGBMathImage* rgbimg2;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include "../../../jkqtpbaseplotter.h"
|
#include "../../../jkqtpbaseplotter.h"
|
||||||
|
|
||||||
class JKQTPEmfEngineAdapter : public JKQtBasePlotter::JKQTPPaintDeviceAdapter
|
class JKQTPEmfEngineAdapter : public JKQTBasePlotter::JKQTPPaintDeviceAdapter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
JKQTPEmfEngineAdapter();
|
JKQTPEmfEngineAdapter();
|
||||||
|
@ -58,7 +58,7 @@ QT += core gui xml svg
|
|||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += $$PWD
|
DEPENDPATH += $$PWD
|
||||||
#$$PWD/../../lib
|
#$$PWD/../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
|
@ -27,7 +27,7 @@ TestMain::TestMain(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
JKQtBasePlotter::registerPaintDeviceAdapter(new JKQTPEmfEngineAdapter());
|
JKQTBasePlotter::registerPaintDeviceAdapter(new JKQTPEmfEngineAdapter());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Very simple line-graph {#JKQTPlotterSimpleTest}
|
# Example (JKQTPLotter): Very simple line-graph {#JKQTPLotterSimpleTest}
|
||||||
This project (see `./examples/simpletest/`) simply creates a JKQtPlotter widget (as a new window) and adds a single line-graph (a sine-wave). Data is initialized from two QVector<double> objects.
|
This project (see `./examples/simpletest/`) simply creates a JKQTPLotter widget (as a new window) and adds a single line-graph (a sine-wave). Data is initialized from two QVector<double> objects.
|
||||||
The QMake project looks like this (see [`jkqtplotter_simpletest.pro`](../simpletest/jkqtplotter_simpletest.pro):
|
The QMake project looks like this (see [`jkqtplotter_simpletest.pro`](../simpletest/jkqtplotter_simpletest.pro):
|
||||||
```.qmake
|
```.qmake
|
||||||
# source code for this simple demo
|
# source code for this simple demo
|
||||||
@ -13,7 +13,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest
|
TARGET = jkqtplotter_simpletest
|
||||||
|
|
||||||
# include JKQtPlotter source headers and link against library
|
# include JKQTPLotter source headers and link against library
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
@ -23,7 +23,7 @@ CONFIG (debug, debug|release) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively to linking agains a `libjkqtplotter`, you can also directy add the JKQtPlotter sources to the project:
|
Alternatively to linking agains a `libjkqtplotter`, you can also directy add the JKQTPLotter sources to the project:
|
||||||
```.qmake
|
```.qmake
|
||||||
# source code for this simple demo
|
# source code for this simple demo
|
||||||
SOURCES = jkqtplotter_simpletest.cpp
|
SOURCES = jkqtplotter_simpletest.cpp
|
||||||
@ -36,7 +36,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest
|
TARGET = jkqtplotter_simpletest
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
include(../../lib/jkqtplotter.pri)
|
include(../../lib/jkqtplotter.pri)
|
||||||
```
|
```
|
||||||
The soruce code of the main application is (see [`jkqtplotter_simpletest.cpp`](../simpletest/jkqtplotter_simpletest.cpp):
|
The soruce code of the main application is (see [`jkqtplotter_simpletest.cpp`](../simpletest/jkqtplotter_simpletest.cpp):
|
||||||
@ -51,8 +51,8 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore
|
// 1. create a plotter window and get a pointer to the internal datastore
|
||||||
// (for convenience)
|
// (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for a simple plot (a sine curve)
|
// 2. now we create data for a simple plot (a sine curve)
|
||||||
QVector<double> X, Y;
|
QVector<double> X, Y;
|
||||||
@ -63,7 +63,7 @@ int main(int argc, char* argv[])
|
|||||||
Y<<sin(x);
|
Y<<sin(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal
|
// 3. make data available to JKQTPLotter by adding it to the internal
|
||||||
// datastore.
|
// datastore.
|
||||||
// Note: In this step the data is copied (of not specified otherwise), so
|
// Note: In this step the data is copied (of not specified otherwise), so
|
||||||
// you can reuse X and Y afterwards!
|
// you can reuse X and Y afterwards!
|
||||||
@ -74,7 +74,7 @@ int main(int argc, char* argv[])
|
|||||||
size_t columnY=ds->addCopiedColumn(Y, "y");
|
size_t columnY=ds->addCopiedColumn(Y, "y");
|
||||||
|
|
||||||
// 4. create a graph in the plot, which plots the dataset X/Y:
|
// 4. create a graph in the plot, which plots the dataset X/Y:
|
||||||
JKQTPxyLineGraph* graph1=new JKQTPxyLineGraph(&plot);
|
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->set_yColumn(columnY);
|
||||||
graph1->set_title(QObject::tr("sine graph"));
|
graph1->set_title(QObject::tr("sine graph"));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest.cpp
|
/** \example jkqtplotter_simpletest.cpp
|
||||||
* A very basic example for the usage of JKQtPlotter
|
* A very basic example for the usage of JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQTPlotterSimpleTest
|
* \ref JKQTPLotterSimpleTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -14,8 +14,8 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for a simple plot (a sine curve)
|
// 2. now we create data for a simple plot (a sine curve)
|
||||||
QVector<double> X, Y;
|
QVector<double> X, Y;
|
||||||
@ -26,7 +26,7 @@ int main(int argc, char* argv[])
|
|||||||
Y<<sin(x);
|
Y<<sin(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// Note: In this step the data is copied (of not specified otherwise), so you can
|
// Note: In this step the data is copied (of not specified otherwise), so you can
|
||||||
// reuse X and Y afterwards!
|
// reuse X and Y afterwards!
|
||||||
// the variables columnX and columnY will contain the internal column ID of the newly
|
// the variables columnX and columnY will contain the internal column ID of the newly
|
||||||
@ -35,7 +35,7 @@ int main(int argc, char* argv[])
|
|||||||
size_t columnY=ds->addCopiedColumn(Y, "y");
|
size_t columnY=ds->addCopiedColumn(Y, "y");
|
||||||
|
|
||||||
// 4. create a graph in the plot, which plots the dataset X/Y:
|
// 4. create a graph in the plot, which plots the dataset X/Y:
|
||||||
JKQTPxyLineGraph* graph1=new JKQTPxyLineGraph(&plot);
|
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->set_yColumn(columnY);
|
||||||
graph1->set_title(QObject::tr("sine graph"));
|
graph1->set_title(QObject::tr("sine graph"));
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest
|
TARGET = jkqtplotter_simpletest
|
||||||
|
|
||||||
# include JKQtPlotter source headers and link against library
|
# include JKQTPLotter source headers and link against library
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Simple barchart {#JKQtPlotterBarcharts}
|
# Example (JKQTPLotter): Simple barchart {#JKQTPLotterBarcharts}
|
||||||
This project (see [`simpletest_barchart`](../simpletest_barchart) simply creates a JKQtPlotter widget (as a new window) and adds several barcharts. They are ordered in groups.
|
This project (see [`simpletest_barchart`](../simpletest_barchart) simply creates a JKQTPLotter widget (as a new window) and adds several barcharts. They are ordered in groups.
|
||||||
|
|
||||||
The soruce code of the main application is (see [`jkqtplotter_simpletest_barchart.cpp`](../simpletest_barchart/jkqtplotter_simpletest_barchart.cpp):
|
The soruce code of the main application is (see [`jkqtplotter_simpletest_barchart.cpp`](../simpletest_barchart/jkqtplotter_simpletest_barchart.cpp):
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -13,11 +13,11 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for three simple barchart
|
// 2. now we create data for three simple barchart
|
||||||
QString L[Ndata]={ "cat. A", "cat. B", "cat. C", "cat. D", "other"};
|
QString L[Ndata]={ "cat. A", "cat. B", "cat. C", "cat. D", "other"};
|
||||||
@ -26,7 +26,7 @@ int main(int argc, char* argv[])
|
|||||||
double Y2[Ndata]={ -5, -3, 1, 3, 6};
|
double Y2[Ndata]={ -5, -3, 1, 3, 6};
|
||||||
double Y3[Ndata]={ 6, 2, 5, 3, 6};
|
double Y3[Ndata]={ 6, 2, 5, 3, 6};
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// Note: In this step the data is copied (of not specified otherwise)
|
// Note: In this step the data is copied (of not specified otherwise)
|
||||||
// the variables columnX and columnY... will contain the internal column ID of the
|
// the variables columnX and columnY... will contain the internal column ID of the
|
||||||
// newly created columns with names "x" and "y..." and the (copied) data from X
|
// newly created columns with names "x" and "y..." and the (copied) data from X
|
||||||
@ -37,15 +37,15 @@ int main(int argc, char* argv[])
|
|||||||
size_t columnY3=ds->addCopiedColumn(Y3, Ndata, "y3");
|
size_t columnY3=ds->addCopiedColumn(Y3, Ndata, "y3");
|
||||||
|
|
||||||
// 4. create graphs in the plot, which plots the dataset X/Y1, X/Y2 and X/Y3:
|
// 4. create graphs in the plot, which plots the dataset X/Y1, X/Y2 and X/Y3:
|
||||||
JKQTPbarVerticalGraph* graph1=new JKQTPbarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph1=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY1);
|
graph1->set_yColumn(columnY1);
|
||||||
graph1->set_title(QObject::tr("dataset 1"));
|
graph1->set_title(QObject::tr("dataset 1"));
|
||||||
JKQTPbarVerticalGraph* graph2=new JKQTPbarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph2=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->set_xColumn(columnX);
|
||||||
graph2->set_yColumn(columnY2);
|
graph2->set_yColumn(columnY2);
|
||||||
graph2->set_title(QObject::tr("dataset 2"));
|
graph2->set_title(QObject::tr("dataset 2"));
|
||||||
JKQTPbarVerticalGraph* graph3=new JKQTPbarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph3=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph3->set_xColumn(columnX);
|
graph3->set_xColumn(columnX);
|
||||||
graph3->set_yColumn(columnY3);
|
graph3->set_yColumn(columnY3);
|
||||||
graph3->set_title(QObject::tr("dataset 3"));
|
graph3->set_title(QObject::tr("dataset 3"));
|
||||||
@ -57,7 +57,7 @@ int main(int argc, char* argv[])
|
|||||||
plot.addGraph(graph3);
|
plot.addGraph(graph3);
|
||||||
|
|
||||||
// 6. now we set the graphs, so they are plotted side-by-side
|
// 6. now we set the graphs, so they are plotted side-by-side
|
||||||
// This function searches all JKQTPbarVerticalGraph in the current
|
// This function searches all JKQTPBarVerticalGraph in the current
|
||||||
// plot and sets their shift/scale so they form a nice plot with
|
// plot and sets their shift/scale so they form a nice plot with
|
||||||
// side-by-side groups
|
// side-by-side groups
|
||||||
graph1->autoscaleBarWidthAndShift(0.75, 1);
|
graph1->autoscaleBarWidthAndShift(0.75, 1);
|
||||||
@ -76,8 +76,8 @@ int main(int argc, char* argv[])
|
|||||||
// type JKQTBasePlotter, which does the actual plotting.
|
// type JKQTBasePlotter, which does the actual plotting.
|
||||||
// So many properties of the plot are only available in this internal
|
// So many properties of the plot are only available in this internal
|
||||||
// object, which you can access by plot.get_plotter().
|
// object, which you can access by plot.get_plotter().
|
||||||
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideTopRight);
|
plot.get_plotter()->set_keyPosition(JKQTPKeyOutsideTopRight);
|
||||||
plot.get_plotter()->set_keyLayout(JKQTPkeyLayoutOneRow);
|
plot.get_plotter()->set_keyLayout(JKQTPKeyLayoutOneRow);
|
||||||
|
|
||||||
// 9 autoscale the plot so the graph is contained
|
// 9 autoscale the plot so the graph is contained
|
||||||
plot.zoomToFit();
|
plot.zoomToFit();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_barchart.cpp
|
/** \example jkqtplotter_simpletest_barchart.cpp
|
||||||
* Shows how to draw Barcharts with JKQtPlotter
|
* Shows how to draw Barcharts with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterBarcharts
|
* \ref JKQTPLotterBarcharts
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -15,11 +15,11 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for three simple barchart
|
// 2. now we create data for three simple barchart
|
||||||
QString L[Ndata]={ "cat. A", "cat. C", "cat. B", "cat. D", "other"}; // unsorted category axis
|
QString L[Ndata]={ "cat. A", "cat. C", "cat. B", "cat. D", "other"}; // unsorted category axis
|
||||||
@ -30,7 +30,7 @@ int main(int argc, char* argv[])
|
|||||||
double Y2[Ndata]={ -5, -3, 1, 3, 6};
|
double Y2[Ndata]={ -5, -3, 1, 3, 6};
|
||||||
double Y3[Ndata]={ 6, 2, 5, 3, 6};
|
double Y3[Ndata]={ 6, 2, 5, 3, 6};
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// Note: In this step the data is copied (of not specified otherwise)
|
// Note: In this step the data is copied (of not specified otherwise)
|
||||||
// the variables columnX and columnY... will contain the internal column ID of the
|
// the variables columnX and columnY... will contain the internal column ID of the
|
||||||
// newly created columns with names "x" and "y..." and the (copied) data from X
|
// newly created columns with names "x" and "y..." and the (copied) data from X
|
||||||
@ -41,15 +41,15 @@ int main(int argc, char* argv[])
|
|||||||
size_t columnY3=ds->addCopiedColumn(Y3, Ndata, "y3");
|
size_t columnY3=ds->addCopiedColumn(Y3, Ndata, "y3");
|
||||||
|
|
||||||
// 4. create graphs in the plot, which plots the dataset X/Y1, X/Y2 and X/Y3:
|
// 4. create graphs in the plot, which plots the dataset X/Y1, X/Y2 and X/Y3:
|
||||||
JKQTPbarVerticalGraph* graph1=new JKQTPbarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph1=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY1);
|
graph1->set_yColumn(columnY1);
|
||||||
graph1->set_title(QObject::tr("dataset 1"));
|
graph1->set_title(QObject::tr("dataset 1"));
|
||||||
JKQTPbarVerticalGraph* graph2=new JKQTPbarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph2=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->set_xColumn(columnX);
|
||||||
graph2->set_yColumn(columnY2);
|
graph2->set_yColumn(columnY2);
|
||||||
graph2->set_title(QObject::tr("dataset 2"));
|
graph2->set_title(QObject::tr("dataset 2"));
|
||||||
JKQTPbarVerticalGraph* graph3=new JKQTPbarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph3=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph3->set_xColumn(columnX);
|
graph3->set_xColumn(columnX);
|
||||||
graph3->set_yColumn(columnY3);
|
graph3->set_yColumn(columnY3);
|
||||||
graph3->set_title(QObject::tr("dataset 3"));
|
graph3->set_title(QObject::tr("dataset 3"));
|
||||||
@ -61,7 +61,7 @@ int main(int argc, char* argv[])
|
|||||||
plot.addGraph(graph3);
|
plot.addGraph(graph3);
|
||||||
|
|
||||||
// 6. now we set the graphs, so they are plotted side-by-side
|
// 6. now we set the graphs, so they are plotted side-by-side
|
||||||
// This function searches all JKQTPbarHorizontalGraph in the current
|
// This function searches all JKQTPBarHorizontalGraph in the current
|
||||||
// plot and sets their shift/scale so they form a nice plot with
|
// plot and sets their shift/scale so they form a nice plot with
|
||||||
// side-by-side groups
|
// side-by-side groups
|
||||||
graph1->autoscaleBarWidthAndShift(0.75, 1);
|
graph1->autoscaleBarWidthAndShift(0.75, 1);
|
||||||
@ -80,8 +80,8 @@ int main(int argc, char* argv[])
|
|||||||
// type JKQTBasePlotter, which does the actual plotting.
|
// type JKQTBasePlotter, which does the actual plotting.
|
||||||
// So many properties of the plot are only available in this internal
|
// So many properties of the plot are only available in this internal
|
||||||
// object, which you can access by plot.get_plotter().
|
// object, which you can access by plot.get_plotter().
|
||||||
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideTopRight);
|
plot.get_plotter()->set_keyPosition(JKQTPKeyOutsideTopRight);
|
||||||
plot.get_plotter()->set_keyLayout(JKQTPkeyLayoutOneRow);
|
plot.get_plotter()->set_keyLayout(JKQTPKeyLayoutOneRow);
|
||||||
|
|
||||||
// 9 autoscale the plot so the graph is contained
|
// 9 autoscale the plot so the graph is contained
|
||||||
plot.zoomToFit();
|
plot.zoomToFit();
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_barchart
|
TARGET = jkqtplotter_simpletest_barchart
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Example (JKQtPlotter): Date/Time Axes {#JKQtPlotterDateTimeAxes}
|
# Example (JKQTPLotter): Date/Time Axes {#JKQTPLotterDateTimeAxes}
|
||||||
|
|
||||||
## Date Axis
|
## Date Axis
|
||||||
This project (see `./examples/simpletest_dateaxes/`) simply creates a JKQtPlotter widget (as a new window) with the X-axis showing time or date(-time) values, formated as such.
|
This project (see `./examples/simpletest_dateaxes/`) simply creates a JKQTPLotter widget (as a new window) with the X-axis showing time or date(-time) values, formated as such.
|
||||||
|
|
||||||
The source code of the main application can be found in [`jkqtplotter_simpletest_dateaxes.cpp`](../simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp).
|
The source code of the main application can be found in [`jkqtplotter_simpletest_dateaxes.cpp`](../simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp).
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ The parsed data looks like this (data was taken from http://wetter.mpg-ge.de/NOA
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
Then two graphs are added. One of type `JKQTPfilledVerticalRangeGraph` plots the range of min+max temperature for each month:
|
Then two graphs are added. One of type `JKQTPFilledVerticalRangeGraph` plots the range of min+max temperature for each month:
|
||||||
```.cpp
|
```.cpp
|
||||||
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
|
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
|
||||||
JKQTPfilledVerticalRangeGraph* graphTemperatureRange=new JKQTPfilledVerticalRangeGraph(&plot);
|
JKQTPFilledVerticalRangeGraph* graphTemperatureRange=new JKQTPFilledVerticalRangeGraph(&plot);
|
||||||
|
|
||||||
// 4. copy data into datastore and immediately set the yColumn
|
// 4. copy data into datastore and immediately set the yColumn
|
||||||
size_t colDate=ds->addCopiedColumn(date, "date");
|
size_t colDate=ds->addCopiedColumn(date, "date");
|
||||||
@ -66,7 +66,7 @@ On top of that plot, a second plot is added, which draws the average temperature
|
|||||||
|
|
||||||
```.cpp
|
```.cpp
|
||||||
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
|
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
|
||||||
JKQTPxyLineErrorGraph* graphTemperature=new JKQTPxyLineErrorGraph(&plot);
|
JKQTPXYLineErrorGraph* graphTemperature=new JKQTPXYLineErrorGraph(&plot);
|
||||||
|
|
||||||
// 4. copy data into datastore and immediately set the yColumn
|
// 4. copy data into datastore and immediately set the yColumn
|
||||||
size_t colDate=ds->addCopiedColumn(date, "date");
|
size_t colDate=ds->addCopiedColumn(date, "date");
|
||||||
@ -79,7 +79,7 @@ On top of that plot, a second plot is added, which draws the average temperature
|
|||||||
|
|
||||||
// 6. average data
|
// 6. average data
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graphTemperature->set_symbol(JKQTPnoSymbol);
|
graphTemperature->set_symbol(JKQTPNoSymbol);
|
||||||
// set the line width
|
// set the line width
|
||||||
graphTemperature->set_lineWidth(1);
|
graphTemperature->set_lineWidth(1);
|
||||||
// draw small symbols
|
// draw small symbols
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_dateaxes.cpp
|
/** \example jkqtplotter_simpletest_dateaxes.cpp
|
||||||
* Shows how to use date/time axes with JKQtPlotter
|
* Shows how to use date/time axes with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterDateTimeAxes
|
* \ref JKQTPLotterDateTimeAxes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -15,10 +15,10 @@
|
|||||||
#include "jkqtplottertools/jkqtptools.h"
|
#include "jkqtplottertools/jkqtptools.h"
|
||||||
#include "jkqtplotter/jkqtpgraphsfilledcurve.h"
|
#include "jkqtplotter/jkqtpgraphsfilledcurve.h"
|
||||||
|
|
||||||
void drawWithDateAxis(JKQtPlotter& plot) {
|
void drawWithDateAxis(JKQTPLotter& plot) {
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data vectors with data parsed from a CSV-file
|
// 2. now we create data vectors with data parsed from a CSV-file
|
||||||
QVector<double> date;
|
QVector<double> date;
|
||||||
@ -43,8 +43,8 @@ void drawWithDateAxis(JKQtPlotter& plot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
|
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
|
||||||
JKQTPfilledVerticalRangeGraph* graphTemperatureRange=new JKQTPfilledVerticalRangeGraph(&plot);
|
JKQTPFilledVerticalRangeGraph* graphTemperatureRange=new JKQTPFilledVerticalRangeGraph(&plot);
|
||||||
JKQTPxyLineErrorGraph* graphTemperature=new JKQTPxyLineErrorGraph(&plot);
|
JKQTPXYLineErrorGraph* graphTemperature=new JKQTPXYLineErrorGraph(&plot);
|
||||||
|
|
||||||
// 4. copy data into datastore and immediately set the yColumn
|
// 4. copy data into datastore and immediately set the yColumn
|
||||||
size_t colDate=ds->addCopiedColumn(date, "date");
|
size_t colDate=ds->addCopiedColumn(date, "date");
|
||||||
@ -67,7 +67,7 @@ void drawWithDateAxis(JKQtPlotter& plot) {
|
|||||||
|
|
||||||
// 6. average data
|
// 6. average data
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graphTemperature->set_symbol(JKQTPnoSymbol);
|
graphTemperature->set_symbol(JKQTPNoSymbol);
|
||||||
// set the line width
|
// set the line width
|
||||||
graphTemperature->set_lineWidth(1);
|
graphTemperature->set_lineWidth(1);
|
||||||
// draw small symbols
|
// draw small symbols
|
||||||
@ -98,9 +98,9 @@ void drawWithDateAxis(JKQtPlotter& plot) {
|
|||||||
plot.setWindowTitle("Date Axis");
|
plot.setWindowTitle("Date Axis");
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawWithTimeAxis(JKQtPlotter& plot) {
|
void drawWithTimeAxis(JKQTPLotter& plot) {
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data vectors with data parsed from a CSV-file
|
// 2. now we create data vectors with data parsed from a CSV-file
|
||||||
QVector<double> time;
|
QVector<double> time;
|
||||||
@ -124,7 +124,7 @@ void drawWithTimeAxis(JKQtPlotter& plot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
|
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
|
||||||
JKQTPxyLineErrorGraph* graphTemperature=new JKQTPxyLineErrorGraph(&plot);
|
JKQTPXYLineErrorGraph* graphTemperature=new JKQTPXYLineErrorGraph(&plot);
|
||||||
|
|
||||||
// 4. copy data into datastore and immediately set the yColumn
|
// 4. copy data into datastore and immediately set the yColumn
|
||||||
size_t colDate=ds->addCopiedColumn(time, "time");
|
size_t colDate=ds->addCopiedColumn(time, "time");
|
||||||
@ -134,7 +134,7 @@ void drawWithTimeAxis(JKQtPlotter& plot) {
|
|||||||
|
|
||||||
// 6. average data
|
// 6. average data
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graphTemperature->set_symbol(JKQTPcross);
|
graphTemperature->set_symbol(JKQTPCross);
|
||||||
// set the line width
|
// set the line width
|
||||||
graphTemperature->set_lineWidth(1);
|
graphTemperature->set_lineWidth(1);
|
||||||
// draw small symbols
|
// draw small symbols
|
||||||
@ -169,10 +169,10 @@ void drawWithTimeAxis(JKQtPlotter& plot) {
|
|||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
JKQtPlotter plotDate;
|
JKQTPLotter plotDate;
|
||||||
drawWithDateAxis(plotDate);
|
drawWithDateAxis(plotDate);
|
||||||
plotDate.move(100,100);
|
plotDate.move(100,100);
|
||||||
JKQtPlotter plotTime;
|
JKQTPLotter plotTime;
|
||||||
drawWithTimeAxis(plotTime);
|
drawWithTimeAxis(plotTime);
|
||||||
plotTime.move(100,550);
|
plotTime.move(100,550);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_dateaxes
|
TARGET = jkqtplotter_simpletest_dateaxes
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Different Types of Errorindicators {#JKQtPlotterErrorBarStyles}
|
# Example (JKQTPLotter): Different Types of Errorindicators {#JKQTPLotterErrorBarStyles}
|
||||||
This project (see `./examples/simpletest_errorbarstyles/`) simply creates a JKQtPlotter widget (as a new window) and adds several curves show-casing different styles of error indicators. Data is initialized from two QVector<double> objects.
|
This project (see `./examples/simpletest_errorbarstyles/`) simply creates a JKQTPLotter widget (as a new window) and adds several curves show-casing different styles of error indicators. Data is initialized from two QVector<double> objects.
|
||||||
|
|
||||||
The source code of the main application can be found in [`jkqtplotter_simpletest_errorbarstyles.cpp`](../simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.cpp).
|
The source code of the main application can be found in [`jkqtplotter_simpletest_errorbarstyles.cpp`](../simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.cpp).
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ First some data is added to the internal datastore (mostly, like explained in se
|
|||||||
// the array showXandYError indicates whether we want x- and y-error
|
// the array showXandYError indicates whether we want x- and y-error
|
||||||
// for a style for all stywhere this is false, only y-error-indicators
|
// for a style for all stywhere this is false, only y-error-indicators
|
||||||
// are shown
|
// are shown
|
||||||
QVector<JKQTPerrorPlotstyle> errorStyles {JKQTPnoError, JKQTPerrorBars, JKQTPerrorSimpleBars, JKQTPerrorLines, JKQTPerrorPolygons, JKQTPerrorBoxes, JKQTPerrorEllipses, JKQTPerrorBarsPolygons, JKQTPerrorBarsLines, JKQTPerrorSimpleBarsLines, JKQTPerrorSimpleBarsPolygons };
|
QVector<JKQTPErrorPlotstyle> errorStyles {JKQTPNoError, JKQTPErrorBars, JKQTPErrorSimpleBars, JKQTPErrorLines, JKQTPErrorPolygons, JKQTPErrorBoxes, JKQTPErrorEllipses, JKQTPErrorBarsPolygons, JKQTPErrorBarsLines, JKQTPErrorSimpleBarsLines, JKQTPErrorSimpleBarsPolygons };
|
||||||
QVector<bool> showXandYError { false , true , true , false , false , true , true , false , false , false , false };
|
QVector<bool> showXandYError { false , true , true , false , false , true , true , false , false , false , false };
|
||||||
|
|
||||||
for (int errorID=0; errorID<errorStyles.size(); errorID++) {
|
for (int errorID=0; errorID<errorStyles.size(); errorID++) {
|
||||||
@ -22,7 +22,7 @@ First some data is added to the internal datastore (mostly, like explained in se
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create a graph object
|
// create a graph object
|
||||||
JKQTPxyLineErrorGraph* graph=new JKQTPxyLineErrorGraph(&plot);
|
JKQTPXYLineErrorGraph* graph=new JKQTPXYLineErrorGraph(&plot);
|
||||||
|
|
||||||
// copy data into datastore and immediately set the yColumn
|
// copy data into datastore and immediately set the yColumn
|
||||||
graph->set_xColumn(columnX);
|
graph->set_xColumn(columnX);
|
||||||
@ -33,7 +33,7 @@ First some data is added to the internal datastore (mostly, like explained in se
|
|||||||
// set error style, for the y-axis
|
// set error style, for the y-axis
|
||||||
graph->set_yErrorStyle(errorStyles[errorID]);
|
graph->set_yErrorStyle(errorStyles[errorID]);
|
||||||
// no error indicators for the x-values
|
// no error indicators for the x-values
|
||||||
graph->set_xErrorStyle(JKQTPnoError);
|
graph->set_xErrorStyle(JKQTPNoError);
|
||||||
// ... unless: for some error styles we want error in both directions
|
// ... unless: for some error styles we want error in both directions
|
||||||
if (showXandYError[errorID]) {
|
if (showXandYError[errorID]) {
|
||||||
graph->set_xErrorStyle(errorStyles[errorID]);
|
graph->set_xErrorStyle(errorStyles[errorID]);
|
||||||
@ -50,7 +50,7 @@ First some data is added to the internal datastore (mostly, like explained in se
|
|||||||
|
|
||||||
|
|
||||||
// set symbol (cross/X) + pen style (and color)dashed)
|
// set symbol (cross/X) + pen style (and color)dashed)
|
||||||
graph->set_symbol(JKQTPcross);
|
graph->set_symbol(JKQTPCross);
|
||||||
graph->set_style(Qt::DashLine);
|
graph->set_style(Qt::DashLine);
|
||||||
// set symbol size
|
// set symbol size
|
||||||
graph->set_symbolSize(5);
|
graph->set_symbolSize(5);
|
||||||
@ -60,9 +60,9 @@ First some data is added to the internal datastore (mostly, like explained in se
|
|||||||
graph->set_lineWidth(1);
|
graph->set_lineWidth(1);
|
||||||
|
|
||||||
// graph title is made from symbol+errorStylestyle, we use the LaTeX instruction \verb around the
|
// graph title is made from symbol+errorStylestyle, we use the LaTeX instruction \verb around the
|
||||||
// result of JKQTPerrorPlotstyle2String(), because it contains underscores that would otherwise
|
// result of JKQTPErrorPlotstyle2String(), because it contains underscores that would otherwise
|
||||||
// lead to lower-case letter, which we don't want
|
// lead to lower-case letter, which we don't want
|
||||||
graph->set_title("\\verb{"+JKQTPerrorPlotstyle2String(errorStyles[errorID])+"}");
|
graph->set_title("\\verb{"+JKQTPErrorPlotstyle2String(errorStyles[errorID])+"}");
|
||||||
|
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graph);
|
plot.addGraph(graph);
|
||||||
@ -89,12 +89,12 @@ There are several variables that can be used to further style the error indicato
|
|||||||
graph->set_errorbarSize(15);
|
graph->set_errorbarSize(15);
|
||||||
```
|
```
|
||||||
|
|
||||||
There are more properties that you can find in the documentation of the mix-in classes `JKQTPxyGraphErrors`, `JKQTPxGraphErrors`, `JKQTPyGraphErrors`, `JKQTPgraphErrors`.
|
There are more properties that you can find in the documentation of the mix-in classes `JKQTPXYGraphErrors`, `JKQTPXGraphErrors`, `JKQTPYGraphErrors`, `JKQTPGraphErrors`.
|
||||||
|
|
||||||
In addition the plot key is moved outside the pot and the grid in the plot is switched off:
|
In addition the plot key is moved outside the pot and the grid in the plot is switched off:
|
||||||
```.cpp
|
```.cpp
|
||||||
// 6. change locaion of key (outside top-right)
|
// 6. change locaion of key (outside top-right)
|
||||||
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideRightTop);
|
plot.get_plotter()->set_keyPosition(JKQTPKeyOutsideRightTop);
|
||||||
// ... and switch off the grid
|
// ... and switch off the grid
|
||||||
plot.get_xAxis()->set_drawGrid(false);
|
plot.get_xAxis()->set_drawGrid(false);
|
||||||
plot.get_xAxis()->set_drawMinorGrid(false);
|
plot.get_xAxis()->set_drawMinorGrid(false);
|
||||||
@ -106,10 +106,10 @@ The result looks like this:
|
|||||||
|
|
||||||
![jkqtplotter_simpletest_errorbarstyles](../../screenshots/jkqtplotter_simpletest_errorbarstyles.png)
|
![jkqtplotter_simpletest_errorbarstyles](../../screenshots/jkqtplotter_simpletest_errorbarstyles.png)
|
||||||
|
|
||||||
Error bars are implemented in the mixin-classes `JKQTPxyGraphErrors`, `JKQTPxGraphErrors` and `JKQTPyGraphErrors` that are all derived from `JKQTPgraphErrors`. With these it is simple to add error indicators to several different plot styles. Usually you can recognize these by looking at the class name, e.g. `JKQTPxyLineGraph` is a simple line+symbol graph, and `JKQTPxyLineErrorGraph` is the same with error indictaors (see above). There are also several other plots with error indicators:
|
Error bars are implemented in the mixin-classes `JKQTPXYGraphErrors`, `JKQTPXGraphErrors` and `JKQTPYGraphErrors` that are all derived from `JKQTPGraphErrors`. With these it is simple to add error indicators to several different plot styles. Usually you can recognize these by looking at the class name, e.g. `JKQTPXYLineGraph` is a simple line+symbol graph, and `JKQTPXYLineErrorGraph` is the same with error indictaors (see above). There are also several other plots with error indicators:
|
||||||
- `JKQTPbarVerticalErrorGraph` for barcharts with errors:<br>![](../../screenshots/jkqtplotter_simpletest_errorbarstyles_barcharts.png)
|
- `JKQTPBarVerticalErrorGraph` for barcharts with errors:<br>![](../../screenshots/jkqtplotter_simpletest_errorbarstyles_barcharts.png)
|
||||||
- `JKQTPimpulsesVerticalGraph` for impulse/candle-stick charts with errors:<br>![](../../screenshots/jkqtplotter_simpletest_errorbarstyles_impulses.png)
|
- `JKQTPImpulsesVerticalGraph` for impulse/candle-stick charts with errors:<br>![](../../screenshots/jkqtplotter_simpletest_errorbarstyles_impulses.png)
|
||||||
- `JKQTPfilledCurveXErrorGraph` for filled curves with errors:<br>![](../../screenshots/jkqtplotter_simpletest_errorbarstyles_filledcurves.png)
|
- `JKQTPFilledCurveXErrorGraph` for filled curves with errors:<br>![](../../screenshots/jkqtplotter_simpletest_errorbarstyles_filledcurves.png)
|
||||||
.
|
.
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_errorbarstyles.cpp
|
/** \example jkqtplotter_simpletest_errorbarstyles.cpp
|
||||||
* Shows how to use different error indicator styles with JKQtPlotter
|
* Shows how to use different error indicator styles with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterErrorBarStyles
|
* \ref JKQTPLotterErrorBarStyles
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -15,8 +15,8 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data a vector of x-values for a simple plot
|
// 2. now we create data a vector of x-values for a simple plot
|
||||||
// and generate some values for varying errors
|
// and generate some values for varying errors
|
||||||
@ -41,7 +41,7 @@ int main(int argc, char* argv[])
|
|||||||
// the array showXandYError indicates whether we want x- and y-error
|
// the array showXandYError indicates whether we want x- and y-error
|
||||||
// for a style for all stywhere this is false, only y-error-indicators
|
// for a style for all stywhere this is false, only y-error-indicators
|
||||||
// are shown
|
// are shown
|
||||||
QVector<JKQTPerrorPlotstyle> errorStyles {JKQTPnoError, JKQTPerrorBars, JKQTPerrorSimpleBars, JKQTPerrorLines, JKQTPerrorPolygons, JKQTPerrorBoxes, JKQTPerrorEllipses, JKQTPerrorBarsPolygons, JKQTPerrorBarsLines, JKQTPerrorSimpleBarsLines, JKQTPerrorSimpleBarsPolygons };
|
QVector<JKQTPErrorPlotstyle> errorStyles {JKQTPNoError, JKQTPErrorBars, JKQTPErrorSimpleBars, JKQTPErrorLines, JKQTPErrorPolygons, JKQTPErrorBoxes, JKQTPErrorEllipses, JKQTPErrorBarsPolygons, JKQTPErrorBarsLines, JKQTPErrorSimpleBarsLines, JKQTPErrorSimpleBarsPolygons };
|
||||||
QVector<bool> showXandYError { false , true , true , false , false , true , true , false , false , false , false };
|
QVector<bool> showXandYError { false , true , true , false , false , true , true , false , false , false , false };
|
||||||
|
|
||||||
for (int errorID=0; errorID<errorStyles.size(); errorID++) {
|
for (int errorID=0; errorID<errorStyles.size(); errorID++) {
|
||||||
@ -51,7 +51,7 @@ int main(int argc, char* argv[])
|
|||||||
Y<<xx*0.5+static_cast<double>(errorID)*2.5;
|
Y<<xx*0.5+static_cast<double>(errorID)*2.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTPxyLineErrorGraph* graph=new JKQTPxyLineErrorGraph(&plot);
|
JKQTPXYLineErrorGraph* graph=new JKQTPXYLineErrorGraph(&plot);
|
||||||
|
|
||||||
// copy data into datastore and immediately set the yColumn
|
// copy data into datastore and immediately set the yColumn
|
||||||
graph->set_xColumn(columnX);
|
graph->set_xColumn(columnX);
|
||||||
@ -62,7 +62,7 @@ int main(int argc, char* argv[])
|
|||||||
// set error style, for the y-axis
|
// set error style, for the y-axis
|
||||||
graph->set_yErrorStyle(errorStyles[errorID]);
|
graph->set_yErrorStyle(errorStyles[errorID]);
|
||||||
// no error indicators for the x-values
|
// no error indicators for the x-values
|
||||||
graph->set_xErrorStyle(JKQTPnoError);
|
graph->set_xErrorStyle(JKQTPNoError);
|
||||||
// ... unless: for some error styles we want error in both directions
|
// ... unless: for some error styles we want error in both directions
|
||||||
if (showXandYError[errorID]) {
|
if (showXandYError[errorID]) {
|
||||||
graph->set_xErrorStyle(errorStyles[errorID]);
|
graph->set_xErrorStyle(errorStyles[errorID]);
|
||||||
@ -79,7 +79,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
// set symbol (cross/X) + pen style (and color)dashed)
|
// set symbol (cross/X) + pen style (and color)dashed)
|
||||||
graph->set_symbol(JKQTPcross);
|
graph->set_symbol(JKQTPCross);
|
||||||
graph->set_style(Qt::DashLine);
|
graph->set_style(Qt::DashLine);
|
||||||
// set symbol size
|
// set symbol size
|
||||||
graph->set_symbolSize(5);
|
graph->set_symbolSize(5);
|
||||||
@ -89,9 +89,9 @@ int main(int argc, char* argv[])
|
|||||||
graph->set_lineWidth(1);
|
graph->set_lineWidth(1);
|
||||||
|
|
||||||
// graph title is made from symbol+errorStylestyle, we use the LaTeX instruction \verb around the
|
// graph title is made from symbol+errorStylestyle, we use the LaTeX instruction \verb around the
|
||||||
// result of JKQTPerrorPlotstyle2String(), because it contains underscores that would otherwise
|
// result of JKQTPErrorPlotstyle2String(), because it contains underscores that would otherwise
|
||||||
// lead to lower-case letter, which we don't want
|
// lead to lower-case letter, which we don't want
|
||||||
graph->set_title("\\verb{"+JKQTPerrorPlotstyle2String(errorStyles[errorID])+"}");
|
graph->set_title("\\verb{"+JKQTPErrorPlotstyle2String(errorStyles[errorID])+"}");
|
||||||
|
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graph);
|
plot.addGraph(graph);
|
||||||
@ -101,7 +101,7 @@ int main(int argc, char* argv[])
|
|||||||
plot.zoomToFit();
|
plot.zoomToFit();
|
||||||
|
|
||||||
// 6. change locaion of key (outside top-right)
|
// 6. change locaion of key (outside top-right)
|
||||||
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideRightTop);
|
plot.get_plotter()->set_keyPosition(JKQTPKeyOutsideRightTop);
|
||||||
// ... and switch off the grid
|
// ... and switch off the grid
|
||||||
plot.get_xAxis()->set_drawGrid(false);
|
plot.get_xAxis()->set_drawGrid(false);
|
||||||
plot.get_xAxis()->set_drawMinorGrid(false);
|
plot.get_xAxis()->set_drawMinorGrid(false);
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_errorbarstyles
|
TARGET = jkqtplotter_simpletest_errorbarstyles
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Filled Curve Plots {#JKQtPlotterFilledGraphs}
|
# Example (JKQTPLotter): Filled Curve Plots {#JKQTPLotterFilledGraphs}
|
||||||
This project (see `./examples/simpletest_filledgraphs/`) simply creates a JKQtPlotter widget (as a new window) and adds several filled curve graphs (Histograms). Data is initialized from QVector<int> objects.
|
This project (see `./examples/simpletest_filledgraphs/`) simply creates a JKQTPLotter widget (as a new window) and adds several filled curve graphs (Histograms). Data is initialized from QVector<int> objects.
|
||||||
|
|
||||||
The source code of the main application can be found in [`jkqtplotter_simpletest_filledgraphs.cpp`](../simpletest_filledgraphs/jkqtplotter_simpletest_filledgraphs.cpp).
|
The source code of the main application can be found in [`jkqtplotter_simpletest_filledgraphs.cpp`](../simpletest_filledgraphs/jkqtplotter_simpletest_filledgraphs.cpp).
|
||||||
|
|
||||||
@ -15,12 +15,12 @@ And three columns with 256 entries each, which will be filled with the R-, G- an
|
|||||||
size_t columnB=ds->addColumn(256, "historam_B");
|
size_t columnB=ds->addColumn(256, "historam_B");
|
||||||
```
|
```
|
||||||
|
|
||||||
In this example we will access the data in the internal datastore directly. This access is possible through objects of type JKQTPcolumn, which is a proxy to the data in one of the columns in a `JKQTdatastore`:
|
In this example we will access the data in the internal datastore directly. This access is possible through objects of type JKQTPColumn, which is a proxy to the data in one of the columns in a `JKQTdatastore`:
|
||||||
|
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPcolumn cG=ds->getColumn(columnG);
|
JKQTPColumn cG=ds->getColumn(columnG);
|
||||||
JKQTPcolumn cR=ds->getColumn(columnR);
|
JKQTPColumn cR=ds->getColumn(columnR);
|
||||||
JKQTPcolumn cB=ds->getColumn(columnB);
|
JKQTPColumn cB=ds->getColumn(columnB);
|
||||||
```
|
```
|
||||||
|
|
||||||
In order to calculate the histograms, first all enries in the columns are set to 0:
|
In order to calculate the histograms, first all enries in the columns are set to 0:
|
||||||
@ -48,10 +48,10 @@ Finally the histogram is calculated:
|
|||||||
cB.scale(100.0/static_cast<double>(image.width()*image.height()));
|
cB.scale(100.0/static_cast<double>(image.width()*image.height()));
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally three `JKQTPfilledCurveXGraph` objects are generated and added to the plot (here we show the code for the R-channel only):
|
Finally three `JKQTPFilledCurveXGraph` objects are generated and added to the plot (here we show the code for the R-channel only):
|
||||||
|
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPfilledCurveXGraph* graphR=new JKQTPfilledCurveXGraph(&plot);
|
JKQTPFilledCurveXGraph* graphR=new JKQTPFilledCurveXGraph(&plot);
|
||||||
|
|
||||||
// set graph titles
|
// set graph titles
|
||||||
graphR->set_title("R-channel");
|
graphR->set_title("R-channel");
|
||||||
@ -75,7 +75,7 @@ The result looks like this:
|
|||||||
|
|
||||||
![jkqtplotter_simpletest_filledgraphs](../../screenshots/jkqtplotter_simpletest_filledgraphs.png)
|
![jkqtplotter_simpletest_filledgraphs](../../screenshots/jkqtplotter_simpletest_filledgraphs.png)
|
||||||
|
|
||||||
If you use `JKQTPfilledCurveYGraph` instead of `JKQTPfilledCurveXGraph`, the curve will not be filled until the y=0-axis, but until the x=0-axis. Of course you will also have to swap the x- and y-data columns. The result will look like this:
|
If you use `JKQTPFilledCurveYGraph` instead of `JKQTPFilledCurveXGraph`, the curve will not be filled until the y=0-axis, but until the x=0-axis. Of course you will also have to swap the x- and y-data columns. The result will look like this:
|
||||||
|
|
||||||
![jkqtplotter_simpletest_filledgraphs_yaxis](../../screenshots/jkqtplotter_simpletest_filledgraphs_yaxis.png)
|
![jkqtplotter_simpletest_filledgraphs_yaxis](../../screenshots/jkqtplotter_simpletest_filledgraphs_yaxis.png)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_filledgraphs.cpp
|
/** \example jkqtplotter_simpletest_filledgraphs.cpp
|
||||||
* Shows how to use filled graphs with JKQtPlotter
|
* Shows how to use filled graphs with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterFilledGraphs
|
* \ref JKQTPLotterFilledGraphs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -13,8 +13,8 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create 4 datacolumns with length 256 entries in the datastore
|
// 2. now we create 4 datacolumns with length 256 entries in the datastore
|
||||||
// these will later hold the RGB-histogram and a linear x-values vector
|
// these will later hold the RGB-histogram and a linear x-values vector
|
||||||
@ -25,11 +25,11 @@ int main(int argc, char* argv[])
|
|||||||
size_t columnR=ds->addColumn(256, "historam_R");
|
size_t columnR=ds->addColumn(256, "historam_R");
|
||||||
size_t columnG=ds->addColumn(256, "historam_G");
|
size_t columnG=ds->addColumn(256, "historam_G");
|
||||||
size_t columnB=ds->addColumn(256, "historam_B");
|
size_t columnB=ds->addColumn(256, "historam_B");
|
||||||
// - in addition JKQTPcolumn objects are generated, which can be used to access
|
// - in addition JKQTPColumn objects are generated, which can be used to access
|
||||||
// the data in the columns
|
// the data in the columns
|
||||||
JKQTPcolumn cG=ds->getColumn(columnG);
|
JKQTPColumn cG=ds->getColumn(columnG);
|
||||||
JKQTPcolumn cR=ds->getColumn(columnR);
|
JKQTPColumn cR=ds->getColumn(columnR);
|
||||||
JKQTPcolumn cB=ds->getColumn(columnB);
|
JKQTPColumn cB=ds->getColumn(columnB);
|
||||||
// - now all columns for RGB are initialized to 0
|
// - now all columns for RGB are initialized to 0
|
||||||
cR.setAll(0);
|
cR.setAll(0);
|
||||||
cG.setAll(0);
|
cG.setAll(0);
|
||||||
@ -53,9 +53,9 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
// 4. now we add three semi-transparent, filled curve plots, one for each histogram
|
// 4. now we add three semi-transparent, filled curve plots, one for each histogram
|
||||||
JKQTPfilledCurveXGraph* graphR=new JKQTPfilledCurveXGraph(&plot);
|
JKQTPFilledCurveXGraph* graphR=new JKQTPFilledCurveXGraph(&plot);
|
||||||
JKQTPfilledCurveXGraph* graphG=new JKQTPfilledCurveXGraph(&plot);
|
JKQTPFilledCurveXGraph* graphG=new JKQTPFilledCurveXGraph(&plot);
|
||||||
JKQTPfilledCurveXGraph* graphB=new JKQTPfilledCurveXGraph(&plot);
|
JKQTPFilledCurveXGraph* graphB=new JKQTPFilledCurveXGraph(&plot);
|
||||||
|
|
||||||
// set graph titles
|
// set graph titles
|
||||||
graphR->set_title("R-channel");
|
graphR->set_title("R-channel");
|
||||||
|
@ -12,7 +12,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
TARGET = jkqtplotter_simpletest_filledgraphs
|
TARGET = jkqtplotter_simpletest_filledgraphs
|
||||||
|
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# Example (JKQtPlotter): Plotting Mathematical Functions as Line Graphs {#JKQtPlotterFunctionPlots}
|
# Example (JKQTPLotter): Plotting Mathematical Functions as Line Graphs {#JKQTPLotterFunctionPlots}
|
||||||
## Basics
|
## Basics
|
||||||
This project (see `./examples/simpletest_functionplot/`) demonstrates how to plot mathematical functions as line graphs. The functions may be defined as static C functions, C++ functors or c++ inline functions. See [test/simpletest_parsedfunctionplot](../simpletest_parsedfunctionplot) for an example of how to use an internal equation parser provided with JKQtPlotter instead of directly defining functions.
|
This project (see `./examples/simpletest_functionplot/`) demonstrates how to plot mathematical functions as line graphs. The functions may be defined as static C functions, C++ functors or c++ inline functions. See [test/simpletest_parsedfunctionplot](../simpletest_parsedfunctionplot) for an example of how to use an internal equation parser provided with JKQTPLotter instead of directly defining functions.
|
||||||
|
|
||||||
## Simple C++ inline function
|
## Simple C++ inline function
|
||||||
The first example shows how to plot a C++ inline function:
|
The first example shows how to plot a C++ inline function:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxFunctionLineGraph* func1=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
|
||||||
func1->set_plotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
func1->set_plotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
||||||
func1->set_title("C++-inline function $0.2x^2-0.015x^3$");
|
func1->set_title("C++-inline function $0.2x^2-0.015x^3$");
|
||||||
plot->addGraph(func1);
|
plot->addGraph(func1);
|
||||||
@ -14,7 +14,7 @@ The first example shows how to plot a C++ inline function:
|
|||||||
## Simple C++ inline function with parameters
|
## Simple C++ inline function with parameters
|
||||||
In any such plot function, you can also use parameters, provided via the second parameter. Usually these are "internal parameters", defined by `func2->set_paramsV(p0, p1, ...)`:
|
In any such plot function, you can also use parameters, provided via the second parameter. Usually these are "internal parameters", defined by `func2->set_paramsV(p0, p1, ...)`:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxFunctionLineGraph* func2=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func2=new JKQTPXFunctionLineGraph(plot);
|
||||||
func2->set_plotFunction([](double x, void* params) {
|
func2->set_plotFunction([](double x, void* params) {
|
||||||
QVector<double>* p=static_cast<QVector<double>*>(params);
|
QVector<double>* p=static_cast<QVector<double>*>(params);
|
||||||
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
||||||
@ -27,7 +27,7 @@ In any such plot function, you can also use parameters, provided via the second
|
|||||||
|
|
||||||
... but generally any pointer can be used as parameter (the set by `set_parameter(static_cast<void*>(myDataObject))`):
|
... but generally any pointer can be used as parameter (the set by `set_parameter(static_cast<void*>(myDataObject))`):
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxFunctionLineGraph* func3=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func3=new JKQTPXFunctionLineGraph(plot);
|
||||||
func3->set_plotFunction([](double x, void* params) {
|
func3->set_plotFunction([](double x, void* params) {
|
||||||
QMap<QString,double>* p=static_cast<QMap<QString,double>*>(params);
|
QMap<QString,double>* p=static_cast<QMap<QString,double>*>(params);
|
||||||
return p->value("amplitude")*sin(2.0*M_PI*x*p->value("frequency"));
|
return p->value("amplitude")*sin(2.0*M_PI*x*p->value("frequency"));
|
||||||
@ -56,7 +56,7 @@ You can also use C++ functors (or function objects):
|
|||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
JKQTPxFunctionLineGraph* func4=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
|
||||||
func4->set_plotFunction(SincSqr(-8));
|
func4->set_plotFunction(SincSqr(-8));
|
||||||
func4->set_title("C++ functor $-8*\\sin^2(x)/x^2$");
|
func4->set_title("C++ functor $-8*\\sin^2(x)/x^2$");
|
||||||
plot->addGraph(func4);
|
plot->addGraph(func4);
|
||||||
@ -71,17 +71,17 @@ You can also plot simple static C functions:
|
|||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
JKQTPxFunctionLineGraph* func5=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
|
||||||
func5->set_plotFunction(&sinc);
|
func5->set_plotFunction(&sinc);
|
||||||
func5->set_title("static C function $10*\\sin(x)/x$");
|
func5->set_title("static C function $10*\\sin(x)/x$");
|
||||||
plot->addGraph(func5);
|
plot->addGraph(func5);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Predefined "special" functions
|
## Predefined "special" functions
|
||||||
Finally `JKQTPxFunctionLineGraph` provides a small set of special functions (polynomial `p0+p1*x+p2*x^2+...`, exponential `p0+p1*exp(x/p2)`, power-law `p0+p1*x^p2`, ...), which are parametrized from the internal or external parameters:
|
Finally `JKQTPXFunctionLineGraph` provides a small set of special functions (polynomial `p0+p1*x+p2*x^2+...`, exponential `p0+p1*exp(x/p2)`, power-law `p0+p1*x^p2`, ...), which are parametrized from the internal or external parameters:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxFunctionLineGraph* func6=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func6=new JKQTPXFunctionLineGraph(plot);
|
||||||
func6->setSpecialFunction(JKQTPxFunctionLineGraph::Line);
|
func6->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
|
||||||
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
|
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
|
||||||
func6->set_paramsV(-1,1.5);
|
func6->set_paramsV(-1,1.5);
|
||||||
func6->set_title("special function: linear");
|
func6->set_title("special function: linear");
|
||||||
@ -90,8 +90,8 @@ Finally `JKQTPxFunctionLineGraph` provides a small set of special functions (pol
|
|||||||
|
|
||||||
To demonstrate how to use parameters from a datastore column, have a look at the next example. It is derived from the special-function plot above, but adds a line with a different offset and slope and reads the parameters from a datastore column `paramCol`, which is initialized from the vector `params`:
|
To demonstrate how to use parameters from a datastore column, have a look at the next example. It is derived from the special-function plot above, but adds a line with a different offset and slope and reads the parameters from a datastore column `paramCol`, which is initialized from the vector `params`:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxFunctionLineGraph* func7=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func7=new JKQTPXFunctionLineGraph(plot);
|
||||||
func7->setSpecialFunction(JKQTPxFunctionLineGraph::Line);
|
func7->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
|
||||||
// here we set offset p0=1 and slope p1=-1.5 of the line p0+p1*x by adding these into a column
|
// here we set offset p0=1 and slope p1=-1.5 of the line p0+p1*x by adding these into a column
|
||||||
// in the internal datastore and then set that column as parameterColumn for the function graph
|
// in the internal datastore and then set that column as parameterColumn for the function graph
|
||||||
QVector<double> params;
|
QVector<double> params;
|
||||||
@ -110,9 +110,9 @@ This code snippets above result in a plot like this:
|
|||||||
## Notes
|
## Notes
|
||||||
Note that all the different variants to provide parameters can be used with all types of functions!
|
Note that all the different variants to provide parameters can be used with all types of functions!
|
||||||
|
|
||||||
Also see the example [Plotting Parsed Mathematical Functions as Line Graphs](../simpletest_parsedfunctionplot) for details on how the actual plotting algorithm works. That example also shows how to define a function as a string, which is then parsed and evaluated by an expression parser library embedded in JKQtPlotter.
|
Also see the example [Plotting Parsed Mathematical Functions as Line Graphs](../simpletest_parsedfunctionplot) for details on how the actual plotting algorithm works. That example also shows how to define a function as a string, which is then parsed and evaluated by an expression parser library embedded in JKQTPLotter.
|
||||||
|
|
||||||
All examples above use the graph class `JKQTPxFunctionLineGraph`, which plots a function `y=f(x)`. If you want to plot a function `x=f(y)`, you can use the class `JKQTPyFunctionLineGraph` instead. If in the examples above, we exchange all `JKQTPxFunctionLineGraph` for `JKQTPyFunctionLineGraph`, the graphs will be rotated by 90 degree, as all functions are interpreted as `x=f(y)`:
|
All examples above use the graph class `JKQTPXFunctionLineGraph`, which plots a function `y=f(x)`. If you want to plot a function `x=f(y)`, you can use the class `JKQTPYFunctionLineGraph` instead. If in the examples above, we exchange all `JKQTPXFunctionLineGraph` for `JKQTPYFunctionLineGraph`, the graphs will be rotated by 90 degree, as all functions are interpreted as `x=f(y)`:
|
||||||
|
|
||||||
![jkqtplotter_simpletest_functionplot_fy](../../screenshots/jkqtplotter_simpletest_functionplot_fy.png)
|
![jkqtplotter_simpletest_functionplot_fy](../../screenshots/jkqtplotter_simpletest_functionplot_fy.png)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_functionplot.cpp
|
/** \example jkqtplotter_simpletest_functionplot.cpp
|
||||||
* Shows how to plot Mathematical Functions as Line Graphs with JKQtPlotter (as evaluated C/C++ functions)
|
* Shows how to plot Mathematical Functions as Line Graphs with JKQTPLotter (as evaluated C/C++ functions)
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterFunctionPlots
|
* \ref JKQTPLotterFunctionPlots
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -29,24 +29,24 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a window that conatins a line-edit to edit a function
|
// 1. create a window that conatins a line-edit to edit a function
|
||||||
// and a JKQtPlotter to display the function, combine everything in a layout
|
// and a JKQTPLotter to display the function, combine everything in a layout
|
||||||
QWidget mainWin;
|
QWidget mainWin;
|
||||||
JKQtPlotter* plot=new JKQtPlotter(&mainWin);
|
JKQTPLotter* plot=new JKQTPLotter(&mainWin);
|
||||||
QVBoxLayout* layout=new QVBoxLayout;
|
QVBoxLayout* layout=new QVBoxLayout;
|
||||||
mainWin.setLayout(layout);
|
mainWin.setLayout(layout);
|
||||||
layout->addWidget(plot);
|
layout->addWidget(plot);
|
||||||
|
|
||||||
// 2. now we add a JKQTPxFunctionLineGraph object, which will draw a simple function
|
// 2. now we add a JKQTPXFunctionLineGraph object, which will draw a simple function
|
||||||
// the function is defined as C++ inline function
|
// the function is defined as C++ inline function
|
||||||
JKQTPxFunctionLineGraph* func1=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
|
||||||
func1->set_plotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
func1->set_plotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
||||||
func1->set_title("C++-inline function $0.2x^2-0.015x^3$");
|
func1->set_title("C++-inline function $0.2x^2-0.015x^3$");
|
||||||
plot->addGraph(func1);
|
plot->addGraph(func1);
|
||||||
|
|
||||||
// 3. now we add a JKQTPxFunctionLineGraph object, which will draw a simple function
|
// 3. now we add a JKQTPXFunctionLineGraph object, which will draw a simple function
|
||||||
// the function is again defined as C++ inline function, but now uses internal
|
// the function is again defined as C++ inline function, but now uses internal
|
||||||
// parameters (handed over to the function as a pointer to QVector<double>
|
// parameters (handed over to the function as a pointer to QVector<double>
|
||||||
JKQTPxFunctionLineGraph* func2=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func2=new JKQTPXFunctionLineGraph(plot);
|
||||||
func2->set_plotFunction([](double x, void* params) {
|
func2->set_plotFunction([](double x, void* params) {
|
||||||
QVector<double>* p=static_cast<QVector<double>*>(params);
|
QVector<double>* p=static_cast<QVector<double>*>(params);
|
||||||
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
||||||
@ -56,10 +56,10 @@ int main(int argc, char* argv[])
|
|||||||
func2->set_title("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
func2->set_title("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
||||||
plot->addGraph(func2);
|
plot->addGraph(func2);
|
||||||
|
|
||||||
// 4. now we add a JKQTPxFunctionLineGraph object, which will draw a simple function
|
// 4. now we add a JKQTPXFunctionLineGraph object, which will draw a simple function
|
||||||
// the function is again defined as C++ inline function, but now uses external
|
// the function is again defined as C++ inline function, but now uses external
|
||||||
// parameters, which may have any type (here QMap<QString,double)
|
// parameters, which may have any type (here QMap<QString,double)
|
||||||
JKQTPxFunctionLineGraph* func3=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func3=new JKQTPXFunctionLineGraph(plot);
|
||||||
func3->set_plotFunction([](double x, void* params) {
|
func3->set_plotFunction([](double x, void* params) {
|
||||||
QMap<QString,double>* p=static_cast<QMap<QString,double>*>(params);
|
QMap<QString,double>* p=static_cast<QMap<QString,double>*>(params);
|
||||||
return p->value("amplitude")*sin(2.0*M_PI*x*p->value("frequency"));
|
return p->value("amplitude")*sin(2.0*M_PI*x*p->value("frequency"));
|
||||||
@ -73,29 +73,29 @@ int main(int argc, char* argv[])
|
|||||||
plot->addGraph(func3);
|
plot->addGraph(func3);
|
||||||
|
|
||||||
// 5. of course the function may also be any C+ funtor object:
|
// 5. of course the function may also be any C+ funtor object:
|
||||||
JKQTPxFunctionLineGraph* func4=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
|
||||||
func4->set_plotFunction(SincSqr(-8));
|
func4->set_plotFunction(SincSqr(-8));
|
||||||
func4->set_title("C++ functor $-8*\\sin^2(x)/x^2$");
|
func4->set_title("C++ functor $-8*\\sin^2(x)/x^2$");
|
||||||
plot->addGraph(func4);
|
plot->addGraph(func4);
|
||||||
|
|
||||||
|
|
||||||
// 6. now we use a JKQTPxFunctionLineGraph to draw a static C function
|
// 6. now we use a JKQTPXFunctionLineGraph to draw a static C function
|
||||||
JKQTPxFunctionLineGraph* func5=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
|
||||||
func5->set_plotFunction(&sinc);
|
func5->set_plotFunction(&sinc);
|
||||||
func5->set_title("static C function $10*\\sin(x)/x$");
|
func5->set_title("static C function $10*\\sin(x)/x$");
|
||||||
plot->addGraph(func5);
|
plot->addGraph(func5);
|
||||||
|
|
||||||
// 7. finally JKQTPxFunctionLineGraph defines a small set of common functions
|
// 7. finally JKQTPXFunctionLineGraph defines a small set of common functions
|
||||||
JKQTPxFunctionLineGraph* func6=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func6=new JKQTPXFunctionLineGraph(plot);
|
||||||
func6->setSpecialFunction(JKQTPxFunctionLineGraph::Line);
|
func6->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
|
||||||
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
|
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
|
||||||
func6->set_paramsV(-1,1.5);
|
func6->set_paramsV(-1,1.5);
|
||||||
func6->set_title("special function: linear p_0=-1, p_1=1.5");
|
func6->set_title("special function: linear p_0=-1, p_1=1.5");
|
||||||
plot->addGraph(func6);
|
plot->addGraph(func6);
|
||||||
|
|
||||||
// 7. finally JKQTPxFunctionLineGraph defines a small set of common functions
|
// 7. finally JKQTPXFunctionLineGraph defines a small set of common functions
|
||||||
JKQTPxFunctionLineGraph* func7=new JKQTPxFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func7=new JKQTPXFunctionLineGraph(plot);
|
||||||
func7->setSpecialFunction(JKQTPxFunctionLineGraph::Line);
|
func7->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
|
||||||
// here we set offset p0=1 and slope p1=-1.5 of the line p0+p1*x by adding these into a column
|
// here we set offset p0=1 and slope p1=-1.5 of the line p0+p1*x by adding these into a column
|
||||||
// in the internal datastore and then set that column as parameterColumn for the function graph
|
// in the internal datastore and then set that column as parameterColumn for the function graph
|
||||||
QVector<double> params;
|
QVector<double> params;
|
||||||
@ -109,7 +109,7 @@ int main(int argc, char* argv[])
|
|||||||
// 8. set some axis properties (we use LaTeX for nice equation rendering)
|
// 8. set some axis properties (we use LaTeX for nice equation rendering)
|
||||||
plot->get_xAxis()->set_axisLabel(QObject::tr("x-axis"));
|
plot->get_xAxis()->set_axisLabel(QObject::tr("x-axis"));
|
||||||
plot->get_yAxis()->set_axisLabel(QObject::tr("y-axis"));
|
plot->get_yAxis()->set_axisLabel(QObject::tr("y-axis"));
|
||||||
plot->get_plotter()->set_keyPosition(JKQTPkeyOutsideBottomLeft);
|
plot->get_plotter()->set_keyPosition(JKQTPKeyOutsideBottomLeft);
|
||||||
|
|
||||||
|
|
||||||
// 4. scale the plot so the graph is contained
|
// 4. scale the plot so the graph is contained
|
||||||
|
@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
TARGET = jkqtplotter_simpletest_functionplot
|
TARGET = jkqtplotter_simpletest_functionplot
|
||||||
|
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
# Example (JKQtPlotter): Plotting Geometric Objects {#JKQtPlotterGeometricGraphs}
|
# Example (JKQTPLotter): Plotting Geometric Objects {#JKQTPLotterGeometricGraphs}
|
||||||
This project (see `./test/simpletest_geometric/`) shows the capabilities of JKQtPlotter to also draw geometric elements, like circles, ellipses, rectangles etc.
|
This project (see `./test/simpletest_geometric/`) shows the capabilities of JKQTPLotter to also draw geometric elements, like circles, ellipses, rectangles etc.
|
||||||
|
|
||||||
The source code of the main application can be found in [`jkqtplotter_simpletest_geometric.cpp`](../simpletest_geometric/jkqtplotter_simpletest_geometric.cpp). First a plot is generated and the axis aspect ration is set to 1, so an accurate plot is generated. Then several geometric graphs are added to the plot. Here are some examples, you can find more more examples in the source code of the example:
|
The source code of the main application can be found in [`jkqtplotter_simpletest_geometric.cpp`](../simpletest_geometric/jkqtplotter_simpletest_geometric.cpp). First a plot is generated and the axis aspect ration is set to 1, so an accurate plot is generated. Then several geometric graphs are added to the plot. Here are some examples, you can find more more examples in the source code of the example:
|
||||||
|
|
||||||
```.cpp
|
```.cpp
|
||||||
// a text element
|
// a text element
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.6, "$x_{1/2}=\\frac{\\sqrt{b^2-4ac}}{2a}$", 10, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 0.1,0.6, "$x_{1/2}=\\frac{\\sqrt{b^2-4ac}}{2a}$", 10, QColor("red")));
|
||||||
|
|
||||||
|
|
||||||
// a single symbol
|
// a single symbol
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.1,0.6, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 0.1,0.6, JKQTPCircle, 5, QColor("grey")));
|
||||||
|
|
||||||
|
|
||||||
// a line
|
// a line
|
||||||
plot.addGraph(new JKQTPgeoLine(&plot, 1, 0.05, 1.9, 0.9, QColor("red"), 2));
|
plot.addGraph(new JKQTPGeoLine(&plot, 1, 0.05, 1.9, 0.9, QColor("red"), 2));
|
||||||
|
|
||||||
|
|
||||||
// a one-sided infinite line with slope dy/dx=0.25/0.2
|
// a one-sided infinite line with slope dy/dx=0.25/0.2
|
||||||
JKQTPgeoInfiniteLine* infLine=new JKQTPgeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
|
JKQTPGeoInfiniteLine* infLine=new JKQTPGeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
|
||||||
infLine->set_two_sided(false);
|
infLine->set_two_sided(false);
|
||||||
infLine->setAlpha(0.5);
|
infLine->setAlpha(0.5);
|
||||||
plot.addGraph(infLine);
|
plot.addGraph(infLine);
|
||||||
@ -26,23 +26,23 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
// a polyline
|
// a polyline
|
||||||
QVector<QPointF> p;
|
QVector<QPointF> p;
|
||||||
p<<QPointF(1, 0.1)<<QPointF(1.3, 0.9)<<QPointF(1.6, 0.3)<<QPointF(1.9, 0.8);
|
p<<QPointF(1, 0.1)<<QPointF(1.3, 0.9)<<QPointF(1.6, 0.3)<<QPointF(1.9, 0.8);
|
||||||
plot.addGraph(new JKQTPgeoPolyLines(&plot, p, QColor("darkgreen"), 4, Qt::PenStyle::DashDotLine));
|
plot.addGraph(new JKQTPGeoPolyLines(&plot, p, QColor("darkgreen"), 4, Qt::PenStyle::DashDotLine));
|
||||||
|
|
||||||
|
|
||||||
// rectangle:
|
// rectangle:
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, QPointF(0.4,1.3), QPointF(0.9,1.6), QColor("blue"), 1, Qt::SolidLine, rfill));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, QPointF(0.4,1.3), QPointF(0.9,1.6), QColor("blue"), 1, Qt::SolidLine, rfill));
|
||||||
// a rotated rectangle (rotated by 35 degrees):
|
// a rotated rectangle (rotated by 35 degrees):
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 0.5,1.5,0.8,0.5, 35, QColor("darkblue"), 2, Qt::DashLine));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 0.5,1.5,0.8,0.5, 35, QColor("darkblue"), 2, Qt::DashLine));
|
||||||
|
|
||||||
|
|
||||||
// ellipse:
|
// ellipse:
|
||||||
plot.addGraph(new JKQTPgeoEllipse(&plot, QPointF(0.4,1.3), QPointF(0.9,1.6), QColor("blue"), 1, Qt::SolidLine, rfill));
|
plot.addGraph(new JKQTPGeoEllipse(&plot, QPointF(0.4,1.3), QPointF(0.9,1.6), QColor("blue"), 1, Qt::SolidLine, rfill));
|
||||||
// a rotated ellipse (rotated by 35 degrees):
|
// a rotated ellipse (rotated by 35 degrees):
|
||||||
plot.addGraph(new JKQTPgeoEllipse(&plot, 0.5,1.5,0.8,0.5, 35, QColor("darkblue"), 2, Qt::DashLine));
|
plot.addGraph(new JKQTPGeoEllipse(&plot, 0.5,1.5,0.8,0.5, 35, QColor("darkblue"), 2, Qt::DashLine));
|
||||||
|
|
||||||
|
|
||||||
// a polygon
|
// a polygon
|
||||||
JKQTPgeoPolygon* polygraph=new JKQTPgeoPolygon(&plot, QColor("red"), 2, Qt::PenStyle::DashLine, QColor("salmon"));
|
JKQTPGeoPolygon* polygraph=new JKQTPGeoPolygon(&plot, QColor("red"), 2, Qt::PenStyle::DashLine, QColor("salmon"));
|
||||||
polygraph->appendPoint(2.1, 0.5);
|
polygraph->appendPoint(2.1, 0.5);
|
||||||
polygraph->appendPoint(2.9, 0.9);
|
polygraph->appendPoint(2.9, 0.9);
|
||||||
polygraph->appendPoint(2.2, 0.8);
|
polygraph->appendPoint(2.2, 0.8);
|
||||||
@ -53,15 +53,15 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
|
|
||||||
|
|
||||||
// an arc from an ellipse from -10 degrees to 117 degrees, centered at 2.5,1.5 and full axes of 0.5 and 0.5
|
// an arc from an ellipse from -10 degrees to 117 degrees, centered at 2.5,1.5 and full axes of 0.5 and 0.5
|
||||||
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.5,0.5, -10, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine));
|
plot.addGraph(new JKQTPGeoArc(&plot,2.5,1.5,0.5,0.5, -10, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine));
|
||||||
|
|
||||||
|
|
||||||
// a pie centered at 2.5,2.5 with ellipse axes 0.9 and 0.9 and from angle 0 degrees to 90 degrees
|
// a pie centered at 2.5,2.5 with ellipse axes 0.9 and 0.9 and from angle 0 degrees to 90 degrees
|
||||||
plot.addGraph(new JKQTPgeoPie(&plot,2.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
|
plot.addGraph(new JKQTPGeoPie(&plot,2.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
|
||||||
|
|
||||||
|
|
||||||
// a chord centered at 2.5,2.5 with ellipse axes 0.9 and 0.9 and from angle 0 degrees to 90 degrees
|
// a chord centered at 2.5,2.5 with ellipse axes 0.9 and 0.9 and from angle 0 degrees to 90 degrees
|
||||||
plot.addGraph(new JKQTPgeoChord(&plot,2.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
|
plot.addGraph(new JKQTPGeoChord(&plot,2.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_geometric.cpp
|
/** \example jkqtplotter_simpletest_geometric.cpp
|
||||||
* Shows how to plot several geometric forms with JKQtPlotter
|
* Shows how to plot several geometric forms with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterGeometricGraphs
|
* \ref JKQTPLotterGeometricGraphs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -14,7 +14,7 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window
|
// 1. create a plotter window
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
|
|
||||||
// 2. format graph:
|
// 2. format graph:
|
||||||
// 2.1 set the graph scales manually
|
// 2.1 set the graph scales manually
|
||||||
@ -31,75 +31,75 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 3. add some geometric plots
|
// 3. add some geometric plots
|
||||||
// 3.1 some text elements, also with formatting by LaTeX expressions
|
// 3.1 some text elements, also with formatting by LaTeX expressions
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.95, "\\textbf{Text:}", 14, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 0.1,0.95, "\\textbf{Text:}", 14, QColor("red")));
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.1, "A text object in 10pt", 10, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 0.1,0.1, "A text object in 10pt", 10, QColor("red")));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.1,0.1, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 0.1,0.1, JKQTPCircle, 5, QColor("grey")));
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.3, "A text object in 12pt", 12, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 0.1,0.3, "A text object in 12pt", 12, QColor("red")));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.1,0.3, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 0.1,0.3, JKQTPCircle, 5, QColor("grey")));
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.6, "$x_{1/2}=\\frac{\\sqrt{b^2-4ac}}{2a}$", 10, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 0.1,0.6, "$x_{1/2}=\\frac{\\sqrt{b^2-4ac}}{2a}$", 10, QColor("red")));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.1,0.6, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 0.1,0.6, JKQTPCircle, 5, QColor("grey")));
|
||||||
|
|
||||||
|
|
||||||
// 3.2 some lines elements (single lines and polylines)
|
// 3.2 some lines elements (single lines and polylines)
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 1.1,0.95, "\\textbf{Lines:}", 14, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 1.1,0.95, "\\textbf{Lines:}", 14, QColor("red")));
|
||||||
plot.addGraph(new JKQTPgeoLine(&plot, 1, 0.05, 1.9, 0.9, QColor("red"), 2));
|
plot.addGraph(new JKQTPGeoLine(&plot, 1, 0.05, 1.9, 0.9, QColor("red"), 2));
|
||||||
plot.addGraph(new JKQTPgeoLine(&plot, 1, 0.1, 1.9, 0.8, QColor("blue"), 1, Qt::PenStyle::DashLine));
|
plot.addGraph(new JKQTPGeoLine(&plot, 1, 0.1, 1.9, 0.8, QColor("blue"), 1, Qt::PenStyle::DashLine));
|
||||||
QVector<QPointF> p;
|
QVector<QPointF> p;
|
||||||
p<<QPointF(1, 0.1)<<QPointF(1.3, 0.9)<<QPointF(1.6, 0.3)<<QPointF(1.9, 0.8);
|
p<<QPointF(1, 0.1)<<QPointF(1.3, 0.9)<<QPointF(1.6, 0.3)<<QPointF(1.9, 0.8);
|
||||||
plot.addGraph(new JKQTPgeoPolyLines(&plot, p, QColor("darkgreen"), 4, Qt::PenStyle::DashDotLine));
|
plot.addGraph(new JKQTPGeoPolyLines(&plot, p, QColor("darkgreen"), 4, Qt::PenStyle::DashDotLine));
|
||||||
JKQTPgeoInfiniteLine* infLine=new JKQTPgeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
|
JKQTPGeoInfiniteLine* infLine=new JKQTPGeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
|
||||||
infLine->set_two_sided(false);
|
infLine->set_two_sided(false);
|
||||||
infLine->setAlpha(0.5);
|
infLine->setAlpha(0.5);
|
||||||
plot.addGraph(infLine);
|
plot.addGraph(infLine);
|
||||||
infLine=new JKQTPgeoInfiniteLine(&plot, 1.7, 0.2, 0.2, -0.15, QColor("blue"), 1.5, Qt::PenStyle::SolidLine);
|
infLine=new JKQTPGeoInfiniteLine(&plot, 1.7, 0.2, 0.2, -0.15, QColor("blue"), 1.5, Qt::PenStyle::SolidLine);
|
||||||
infLine->set_two_sided(true);
|
infLine->set_two_sided(true);
|
||||||
infLine->setAlpha(0.5);
|
infLine->setAlpha(0.5);
|
||||||
plot.addGraph(infLine);
|
plot.addGraph(infLine);
|
||||||
|
|
||||||
|
|
||||||
// 3.3 some rectangles (you give the center and width/height of the rectangle in the contructor)
|
// 3.3 some rectangles (you give the center and width/height of the rectangle in the contructor)
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 0.1,1.95, "\\textbf{Rectangles:}", 14, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 0.1,1.95, "\\textbf{Rectangles:}", 14, QColor("red")));
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 0.5,1.5,0.8,0.8, QColor("blue"), 1, Qt::SolidLine, QColor("lightblue")));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 0.5,1.5,0.8,0.8, QColor("blue"), 1, Qt::SolidLine, QColor("lightblue")));
|
||||||
QColor rfill("lightblue"); rfill.setAlphaF(0.5);
|
QColor rfill("lightblue"); rfill.setAlphaF(0.5);
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, QPointF(0.4,1.3), QPointF(0.9,1.6), QColor("blue"), 1, Qt::SolidLine, rfill));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, QPointF(0.4,1.3), QPointF(0.9,1.6), QColor("blue"), 1, Qt::SolidLine, rfill));
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 0.5,1.5,0.8,0.5, 35, QColor("darkblue"), 2, Qt::DashLine));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 0.5,1.5,0.8,0.5, 35, QColor("darkblue"), 2, Qt::DashLine));
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 0.5,1.5,0.6,0.6, -7, QColor("orange"), 2, Qt::DotLine, QColor("salmon"), Qt::FDiagPattern));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 0.5,1.5,0.6,0.6, -7, QColor("orange"), 2, Qt::DotLine, QColor("salmon"), Qt::FDiagPattern));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.5,1.5, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 0.5,1.5, JKQTPCircle, 5, QColor("grey")));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.4,1.3, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 0.4,1.3, JKQTPCircle, 5, QColor("grey")));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 0.9,1.6, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 0.9,1.6, JKQTPCircle, 5, QColor("grey")));
|
||||||
|
|
||||||
|
|
||||||
// 3.4 some circles and elllipses
|
// 3.4 some circles and elllipses
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 1.1,1.95, "\\textbf{Circles/Ellipses:}", 14, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 1.1,1.95, "\\textbf{Circles/Ellipses:}", 14, QColor("red")));
|
||||||
QColor col=QColor("blue"); col.setAlphaF(0.2);
|
QColor col=QColor("blue"); col.setAlphaF(0.2);
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 1.5,1.5,0.8,0.8, col, 0.5, Qt::SolidLine));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 1.5,1.5,0.8,0.8, col, 0.5, Qt::SolidLine));
|
||||||
col.setAlphaF(1);
|
col.setAlphaF(1);
|
||||||
plot.addGraph(new JKQTPgeoEllipse(&plot, 1.5,1.5,0.8,0.8, col, 1, Qt::SolidLine, QColor("lightblue")));
|
plot.addGraph(new JKQTPGeoEllipse(&plot, 1.5,1.5,0.8,0.8, col, 1, Qt::SolidLine, QColor("lightblue")));
|
||||||
col=QColor("blue"); col.setAlphaF(0.2);
|
col=QColor("blue"); col.setAlphaF(0.2);
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, QPointF(1.4,1.3), QPointF(1.9,1.6),col, 0.5, Qt::SolidLine));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, QPointF(1.4,1.3), QPointF(1.9,1.6),col, 0.5, Qt::SolidLine));
|
||||||
col.setAlphaF(1);
|
col.setAlphaF(1);
|
||||||
plot.addGraph(new JKQTPgeoEllipse(&plot, QPointF(1.4,1.3), QPointF(1.9,1.6), col, 1, Qt::SolidLine, rfill));
|
plot.addGraph(new JKQTPGeoEllipse(&plot, QPointF(1.4,1.3), QPointF(1.9,1.6), col, 1, Qt::SolidLine, rfill));
|
||||||
col=QColor("darkblue"); col.setAlphaF(0.2);
|
col=QColor("darkblue"); col.setAlphaF(0.2);
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 1.5,1.5,0.8,0.5, 35, col, 0.5, Qt::DashLine));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 1.5,1.5,0.8,0.5, 35, col, 0.5, Qt::DashLine));
|
||||||
col.setAlphaF(1);
|
col.setAlphaF(1);
|
||||||
plot.addGraph(new JKQTPgeoEllipse(&plot, 1.5,1.5,0.8,0.5, 35, col, 2, Qt::DashLine));
|
plot.addGraph(new JKQTPGeoEllipse(&plot, 1.5,1.5,0.8,0.5, 35, col, 2, Qt::DashLine));
|
||||||
col=QColor("orange"); col.setAlphaF(0.2);
|
col=QColor("orange"); col.setAlphaF(0.2);
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 1.5,1.5,0.6,0.6, -7, col, 0.5, Qt::DotLine));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 1.5,1.5,0.6,0.6, -7, col, 0.5, Qt::DotLine));
|
||||||
col.setAlphaF(1);
|
col.setAlphaF(1);
|
||||||
plot.addGraph(new JKQTPgeoEllipse(&plot, 1.5,1.5,0.6,0.6, -7, col, 2, Qt::DotLine, QColor("salmon"), Qt::FDiagPattern));
|
plot.addGraph(new JKQTPGeoEllipse(&plot, 1.5,1.5,0.6,0.6, -7, col, 2, Qt::DotLine, QColor("salmon"), Qt::FDiagPattern));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 1.5,1.5, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 1.5,1.5, JKQTPCircle, 5, QColor("grey")));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 1.4,1.3, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 1.4,1.3, JKQTPCircle, 5, QColor("grey")));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 1.9,1.6, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 1.9,1.6, JKQTPCircle, 5, QColor("grey")));
|
||||||
|
|
||||||
|
|
||||||
// 3.5 some polygon elements
|
// 3.5 some polygon elements
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 2.1,0.95, "\\textbf{PolyLines/Polygons:}", 14, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 2.1,0.95, "\\textbf{PolyLines/Polygons:}", 14, QColor("red")));
|
||||||
QVector<QPointF> polygon;
|
QVector<QPointF> polygon;
|
||||||
polygon<<QPointF(2, 0.1)<<QPointF(2.3, 0.9)<<QPointF(2.6, 0.3)<<QPointF(2, 0.8);
|
polygon<<QPointF(2, 0.1)<<QPointF(2.3, 0.9)<<QPointF(2.6, 0.3)<<QPointF(2, 0.8);
|
||||||
JKQTPgeoPolygon* polygraph=new JKQTPgeoPolygon(&plot, polygon, QColor("blue"), 2, Qt::PenStyle::DashLine, QColor("lightblue"));
|
JKQTPGeoPolygon* polygraph=new JKQTPGeoPolygon(&plot, polygon, QColor("blue"), 2, Qt::PenStyle::DashLine, QColor("lightblue"));
|
||||||
polygraph->setAlpha(0.75);
|
polygraph->setAlpha(0.75);
|
||||||
plot.addGraph(polygraph);
|
plot.addGraph(polygraph);
|
||||||
polygraph=new JKQTPgeoPolygon(&plot, QColor("red"), 2, Qt::PenStyle::DashLine, QColor("salmon"));
|
polygraph=new JKQTPGeoPolygon(&plot, QColor("red"), 2, Qt::PenStyle::DashLine, QColor("salmon"));
|
||||||
polygraph->appendPoint(2.1, 0.5);
|
polygraph->appendPoint(2.1, 0.5);
|
||||||
polygraph->appendPoint(2.9, 0.9);
|
polygraph->appendPoint(2.9, 0.9);
|
||||||
polygraph->appendPoint(2.2, 0.8);
|
polygraph->appendPoint(2.2, 0.8);
|
||||||
@ -110,43 +110,43 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
// 3.6 some arcs
|
// 3.6 some arcs
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 2.1,1.95, "\\textbf{Arcs:}", 14, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 2.1,1.95, "\\textbf{Arcs:}", 14, QColor("red")));
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 2.5,1.5,0.9,0.9, QColor("lightgrey"), 0.5, Qt::SolidLine));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 2.5,1.5,0.9,0.9, QColor("lightgrey"), 0.5, Qt::SolidLine));
|
||||||
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine));
|
plot.addGraph(new JKQTPGeoArc(&plot,2.5,1.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine));
|
||||||
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.8,0.8, 90,180 , QColor("red"), 4, Qt::PenStyle::SolidLine));
|
plot.addGraph(new JKQTPGeoArc(&plot,2.5,1.5,0.8,0.8, 90,180 , QColor("red"), 4, Qt::PenStyle::SolidLine));
|
||||||
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.7,0.7, 180,270 , QColor("darkblue"), 4, Qt::PenStyle::SolidLine));
|
plot.addGraph(new JKQTPGeoArc(&plot,2.5,1.5,0.7,0.7, 180,270 , QColor("darkblue"), 4, Qt::PenStyle::SolidLine));
|
||||||
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.6,0.6, 270,360 , QColor("maroon"), 4, Qt::PenStyle::DashDotLine));
|
plot.addGraph(new JKQTPGeoArc(&plot,2.5,1.5,0.6,0.6, 270,360 , QColor("maroon"), 4, Qt::PenStyle::DashDotLine));
|
||||||
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.5,0.5, -10, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine));
|
plot.addGraph(new JKQTPGeoArc(&plot,2.5,1.5,0.5,0.5, -10, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine));
|
||||||
plot.addGraph(new JKQTPgeoArc(&plot,2.5,1.5,0.4,0.4, 85, 347 , QColor("darkgreen"), 4, Qt::PenStyle::SolidLine));
|
plot.addGraph(new JKQTPGeoArc(&plot,2.5,1.5,0.4,0.4, 85, 347 , QColor("darkgreen"), 4, Qt::PenStyle::SolidLine));
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 2.5,1.5, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 2.5,1.5, JKQTPCircle, 5, QColor("grey")));
|
||||||
|
|
||||||
|
|
||||||
// 3.7 some pies
|
// 3.7 some pies
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 2.1,2.95, "\\textbf{Pies:}", 14, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 2.1,2.95, "\\textbf{Pies:}", 14, QColor("red")));
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 2.5,2.5,0.9,0.9, QColor("lightgrey"), 0.5, Qt::SolidLine));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 2.5,2.5,0.9,0.9, QColor("lightgrey"), 0.5, Qt::SolidLine));
|
||||||
JKQTPgeoPie* pie;
|
JKQTPGeoPie* pie;
|
||||||
plot.addGraph(pie=new JKQTPgeoPie(&plot,2.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
|
plot.addGraph(pie=new JKQTPGeoPie(&plot,2.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
|
||||||
plot.addGraph(pie=new JKQTPgeoPie(&plot,2.5,2.5,0.7,0.7, 180,270 , QColor("darkblue"), 4, Qt::PenStyle::SolidLine,QColor("blue")));
|
plot.addGraph(pie=new JKQTPGeoPie(&plot,2.5,2.5,0.7,0.7, 180,270 , QColor("darkblue"), 4, Qt::PenStyle::SolidLine,QColor("blue")));
|
||||||
pie->setAlpha(0.5);
|
pie->setAlpha(0.5);
|
||||||
plot.addGraph(pie=new JKQTPgeoPie(&plot,2.5,2.5,0.5,0.3, -25, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine,QColor("red")));
|
plot.addGraph(pie=new JKQTPGeoPie(&plot,2.5,2.5,0.5,0.3, -25, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine,QColor("red")));
|
||||||
pie->setAlpha(0.5);
|
pie->setAlpha(0.5);
|
||||||
plot.addGraph(pie=new JKQTPgeoPie(&plot,2.5,2.5,0.25,0.8, 85, 347 , QColor("darkgreen"), 4, Qt::PenStyle::SolidLine,QColor("green")));
|
plot.addGraph(pie=new JKQTPGeoPie(&plot,2.5,2.5,0.25,0.8, 85, 347 , QColor("darkgreen"), 4, Qt::PenStyle::SolidLine,QColor("green")));
|
||||||
pie->setAlpha(0.5);
|
pie->setAlpha(0.5);
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 2.5,2.5, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 2.5,2.5, JKQTPCircle, 5, QColor("grey")));
|
||||||
|
|
||||||
|
|
||||||
// 3.8 some chords
|
// 3.8 some chords
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 1.1,2.95, "\\textbf{Chords:}", 14, QColor("red")));
|
plot.addGraph(new JKQTPGeoText(&plot, 1.1,2.95, "\\textbf{Chords:}", 14, QColor("red")));
|
||||||
plot.addGraph(new JKQTPgeoRectangle(&plot, 1.5,2.5,0.9,0.9, QColor("lightgrey"), 0.5, Qt::SolidLine));
|
plot.addGraph(new JKQTPGeoRectangle(&plot, 1.5,2.5,0.9,0.9, QColor("lightgrey"), 0.5, Qt::SolidLine));
|
||||||
JKQTPgeoChord* chord;
|
JKQTPGeoChord* chord;
|
||||||
plot.addGraph(chord=new JKQTPgeoChord(&plot,1.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
|
plot.addGraph(chord=new JKQTPGeoChord(&plot,1.5,2.5,0.9,0.9, 0, 90 , QColor("blue"), 4, Qt::PenStyle::SolidLine,QColor("lightblue")));
|
||||||
plot.addGraph(chord=new JKQTPgeoChord(&plot,1.5,2.5,0.7,0.7, 180,270 , QColor("darkblue"), 4, Qt::PenStyle::SolidLine,QColor("blue")));
|
plot.addGraph(chord=new JKQTPGeoChord(&plot,1.5,2.5,0.7,0.7, 180,270 , QColor("darkblue"), 4, Qt::PenStyle::SolidLine,QColor("blue")));
|
||||||
chord->setAlpha(0.5);
|
chord->setAlpha(0.5);
|
||||||
plot.addGraph(chord=new JKQTPgeoChord(&plot,1.5,2.5,0.5,0.3, -25, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine,QColor("red")));
|
plot.addGraph(chord=new JKQTPGeoChord(&plot,1.5,2.5,0.5,0.3, -25, 117 , QColor("orange"), 4, Qt::PenStyle::DashLine,QColor("red")));
|
||||||
chord->setAlpha(0.5);
|
chord->setAlpha(0.5);
|
||||||
plot.addGraph(chord=new JKQTPgeoChord(&plot,1.5,2.5,0.25,0.8, 85, 347 , QColor("darkgreen"), 4, Qt::PenStyle::SolidLine,QColor("green")));
|
plot.addGraph(chord=new JKQTPGeoChord(&plot,1.5,2.5,0.25,0.8, 85, 347 , QColor("darkgreen"), 4, Qt::PenStyle::SolidLine,QColor("green")));
|
||||||
chord->setAlpha(0.5);
|
chord->setAlpha(0.5);
|
||||||
plot.addGraph(new JKQTPgeoSymbol(&plot, 1.5,2.5, JKQTPcircle, 5, QColor("grey")));
|
plot.addGraph(new JKQTPGeoSymbol(&plot, 1.5,2.5, JKQTPCircle, 5, QColor("grey")));
|
||||||
|
|
||||||
|
|
||||||
// 4. show plotter and make it a decent size
|
// 4. show plotter and make it a decent size
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_geometric
|
TARGET = jkqtplotter_simpletest_geometric
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Simple math image plot {#JKQtPlotterImagePlot}
|
# Example (JKQTPLotter): Simple math image plot {#JKQTPLotterImagePlot}
|
||||||
This project (see `./examples/simpletest_imageplot/`) simply creates a JKQtPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is stored as a simple C-array in row-major ordering and then copied into a single column of the internal datasdtore (JKQTPMathImage could be directly used without the internal datastore). This very simple interface can also be used to interface with many common image processing libraries, like CImg or OpenCV.
|
This project (see `./examples/simpletest_imageplot/`) simply creates a JKQTPLotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is stored as a simple C-array in row-major ordering and then copied into a single column of the internal datasdtore (JKQTPMathImage could be directly used without the internal datastore). This very simple interface can also be used to interface with many common image processing libraries, like CImg or OpenCV.
|
||||||
|
|
||||||
The soruce code of the main application is (see [`jkqtplotter_simpletest_imageplot.cpp`](../simpletest_imageplot/jkqtplotter_simpletest_imageplot.cpp):
|
The soruce code of the main application is (see [`jkqtplotter_simpletest_imageplot.cpp`](../simpletest_imageplot/jkqtplotter_simpletest_imageplot.cpp):
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -17,12 +17,12 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
||||||
const int NX=100; // image dimension in x-direction [pixels]
|
const int NX=100; // image dimension in x-direction [pixels]
|
||||||
@ -52,7 +52,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// In this step the contents of C-array airydisk is copied into a column
|
// In this step the contents of C-array airydisk is copied into a column
|
||||||
// of the datastore in row-major order
|
// of the datastore in row-major order
|
||||||
size_t cAiryDisk=ds->addCopiedImageAsColumn(airydisk, NX, NY, "imagedata");
|
size_t cAiryDisk=ds->addCopiedImageAsColumn(airydisk, NX, NY, "imagedata");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_imageplot.cpp
|
/** \example jkqtplotter_simpletest_imageplot.cpp
|
||||||
* Shows how to plot colored math images/matrices with JKQtPlotter
|
* Shows how to plot colored math images/matrices with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterImagePlot
|
* \ref JKQTPLotterImagePlot
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -18,12 +18,12 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
||||||
const int NX=100; // image dimension in x-direction [pixels]
|
const int NX=100; // image dimension in x-direction [pixels]
|
||||||
@ -53,7 +53,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// In this step the contents of C-array airydisk is copied into a column
|
// In this step the contents of C-array airydisk is copied into a column
|
||||||
// of the datastore in row-major order
|
// of the datastore in row-major order
|
||||||
size_t cAiryDisk=ds->addCopiedImageAsColumn(airydisk, NX, NY, "imagedata");
|
size_t cAiryDisk=ds->addCopiedImageAsColumn(airydisk, NX, NY, "imagedata");
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_imageplot
|
TARGET = jkqtplotter_simpletest_imageplot
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Simple math image plot {#JKQtPlotterImagePlotModifier}
|
# Example (JKQTPLotter): Simple math image plot {#JKQTPLotterImagePlotModifier}
|
||||||
This project (see `./examples/simpletest_imageplot_modifier/`) creates a JKQtPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here `sin(r)`). Then a second image (linearly scaling from 1 in the center to 0 at the borders) is used to modify the first image. The modification can alter several properties of the original image, like its saturation, its transparency (alpha) ...
|
This project (see `./examples/simpletest_imageplot_modifier/`) creates a JKQTPLotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here `sin(r)`). Then a second image (linearly scaling from 1 in the center to 0 at the borders) is used to modify the first image. The modification can alter several properties of the original image, like its saturation, its transparency (alpha) ...
|
||||||
|
|
||||||
The soruce code of the main application is (see [`jkqtplotter_simpletest_imageplot_modifier.cpp`](../simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier.cpp):
|
The soruce code of the main application is (see [`jkqtplotter_simpletest_imageplot_modifier.cpp`](../simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier.cpp):
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -17,12 +17,12 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
||||||
const int NX=150; // image dimension in x-direction [pixels]
|
const int NX=150; // image dimension in x-direction [pixels]
|
||||||
@ -45,7 +45,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// In this step the contents of C-array airydisk is copied into a column
|
// In this step the contents of C-array airydisk is copied into a column
|
||||||
// of the datastore in row-major order
|
// of the datastore in row-major order
|
||||||
size_t cImage=ds->addCopiedImageAsColumn(image, NX, NY, "imagedata");
|
size_t cImage=ds->addCopiedImageAsColumn(image, NX, NY, "imagedata");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_imageplot_modifier.cpp
|
/** \example jkqtplotter_simpletest_imageplot_modifier.cpp
|
||||||
* Shows how to plot colored math images/matrices modified by a second data-column/image with JKQtPlotter
|
* Shows how to plot colored math images/matrices modified by a second data-column/image with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterImagePlotModifier
|
* \ref JKQTPLotterImagePlotModifier
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -18,12 +18,12 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
||||||
const int NX=150; // image dimension in x-direction [pixels]
|
const int NX=150; // image dimension in x-direction [pixels]
|
||||||
@ -46,7 +46,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// In this step the contents of C-array airydisk is copied into a column
|
// In this step the contents of C-array airydisk is copied into a column
|
||||||
// of the datastore in row-major order
|
// of the datastore in row-major order
|
||||||
size_t cImage=ds->addCopiedImageAsColumn(image, NX, NY, "imagedata");
|
size_t cImage=ds->addCopiedImageAsColumn(image, NX, NY, "imagedata");
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_imageplot_modifier
|
TARGET = jkqtplotter_simpletest_imageplot_modifier
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Simple math image plot without use of central JKQTdatastore {#JKQtPlotterImagePlotNoDatastore}
|
# Example (JKQTPLotter): Simple math image plot without use of central JKQTdatastore {#JKQTPLotterImagePlotNoDatastore}
|
||||||
This project (see `./examples/simpletest_imageplot_nodatastore/`) simply creates a JKQtPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is stored as a simple C-array in row-major ordering and then given to a JKQTPMathImage to visualize it. The data is stored as a pointer directly in the JKQTPMathImage object. There is also a variant JKQTPColumnMathImage of JKQTPMathImage, which references a column in the internal JKQTdatastore and uses the data there for plotting. In both cases data has to be organized as a row-major matrix of values. JKQTPMathImage supports different dataytpes ([u]nit8/16/32/64,float,double see `JKQTPMathImageBase::DataType`) that can be configured e.g. by `set_data()`.
|
This project (see `./examples/simpletest_imageplot_nodatastore/`) simply creates a JKQTPLotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is stored as a simple C-array in row-major ordering and then given to a JKQTPMathImage to visualize it. The data is stored as a pointer directly in the JKQTPMathImage object. There is also a variant JKQTPColumnMathImage of JKQTPMathImage, which references a column in the internal JKQTdatastore and uses the data there for plotting. In both cases data has to be organized as a row-major matrix of values. JKQTPMathImage supports different dataytpes ([u]nit8/16/32/64,float,double see `JKQTPMathImageBase::DataType`) that can be configured e.g. by `set_data()`.
|
||||||
|
|
||||||
The soruce code of the main application is (see [`jkqtplotter_simpletest_imageplot_nodatastore.cpp`](../simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.cpp):
|
The soruce code of the main application is (see [`jkqtplotter_simpletest_imageplot_nodatastore.cpp`](../simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.cpp):
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -17,7 +17,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_imageplot_nodatastore.cpp
|
/** \example jkqtplotter_simpletest_imageplot_nodatastore.cpp
|
||||||
* Simple math image plot without use of central JKQTdatastore
|
* Simple math image plot without use of central JKQTdatastore
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterImagePlotNoDatastore
|
* \ref JKQTPLotterImagePlotNoDatastore
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -18,7 +18,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
|
@ -11,7 +11,7 @@ CONFIG += qt
|
|||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Example (JKQtPlotter): Simple math image plot, showin a 1-channel OpenCV cv::Mat {#JKQtPlotterImagePlotOpenCV}
|
# Example (JKQTPLotter): Simple math image plot, showin a 1-channel OpenCV cv::Mat {#JKQTPLotterImagePlotOpenCV}
|
||||||
This project (see `./examples/simpletest_imageplot_opencv/`) simply creates a JKQtPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is generated as an OpenCV cv::Mat image and then copied into a single column of the internal datasdtore (JKQTPMathImage could be directly used without the internal datastore).
|
This project (see `./examples/simpletest_imageplot_opencv/`) simply creates a JKQTPLotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is generated as an OpenCV cv::Mat image and then copied into a single column of the internal datasdtore (JKQTPMathImage could be directly used without the internal datastore).
|
||||||
To copy the data a special OpenCV Interface function `JKQTPcopyCvMatToColumn()` is used, that copies the data from a cv::Mat directly into a column.
|
To copy the data a special OpenCV Interface function `JKQTPCopyCvMatToColumn()` is used, that copies the data from a cv::Mat directly into a column.
|
||||||
|
|
||||||
The function `JKQTPcopyCvMatToColumn()` is available from the (non-default) header-only extension from `jkqtplotter/jkqtpopencvinterface.h`. This header provides facilities to interface JKQtPlotter with OPenCV.
|
The function `JKQTPCopyCvMatToColumn()` is available from the (non-default) header-only extension from `jkqtplotter/jkqtpopencvinterface.h`. This header provides facilities to interface JKQTPLotter with OPenCV.
|
||||||
|
|
||||||
The source code of the main application is (see [`jkqtplotter_simpletest_imageplot_opencv.cpp`](../simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp):
|
The source code of the main application is (see [`jkqtplotter_simpletest_imageplot_opencv.cpp`](../simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp):
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -22,14 +22,14 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
|
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
|
|
||||||
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
||||||
@ -57,10 +57,10 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// In this step the contents of one channel of the openCV cv::Mat is copied into a column
|
// In this step the contents of one channel of the openCV cv::Mat is copied into a column
|
||||||
// of the datastore in row-major order
|
// of the datastore in row-major order
|
||||||
size_t cAiryDisk=JKQTPcopyCvMatToColumn(ds, airydisk, "imagedata");
|
size_t cAiryDisk=JKQTPCopyCvMatToColumn(ds, airydisk, "imagedata");
|
||||||
|
|
||||||
|
|
||||||
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_imageplot_opencv.cpp
|
/** \example jkqtplotter_simpletest_imageplot_opencv.cpp
|
||||||
* Simple math image plot, showin a 1-channel OpenCV cv::Mat
|
* Simple math image plot, showin a 1-channel OpenCV cv::Mat
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterImagePlotOpenCV
|
* \ref JKQTPLotterImagePlotOpenCV
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -21,14 +21,14 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
|
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
|
|
||||||
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
||||||
@ -56,10 +56,10 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// In this step the contents of one channel of the openCV cv::Mat is copied into a column
|
// In this step the contents of one channel of the openCV cv::Mat is copied into a column
|
||||||
// of the datastore in row-major order
|
// of the datastore in row-major order
|
||||||
size_t cAiryDisk=JKQTPcopyCvMatToColumn(ds, airydisk, "imagedata");
|
size_t cAiryDisk=JKQTPCopyCvMatToColumn(ds, airydisk, "imagedata");
|
||||||
|
|
||||||
|
|
||||||
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_imageplot_opencv
|
TARGET = jkqtplotter_simpletest_imageplot_opencv
|
||||||
|
|
||||||
# add OpenCV-interface to JKQTPdatastore
|
# add OpenCV-interface to JKQTPDatastore
|
||||||
DEFINES += JKQTPLOTTER_OPENCV_INTERFACE
|
DEFINES += JKQTPLOTTER_OPENCV_INTERFACE
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Simple impulse plots {#JKQtPlotterImpulsePlots}
|
# Example (JKQTPLotter): Simple impulse plots {#JKQTPLotterImpulsePlots}
|
||||||
This project (see `./examples/simpletest_impulsesplot/`) simply creates a JKQtPlotter widget (as a new window) and adds a single impulse graph.
|
This project (see `./examples/simpletest_impulsesplot/`) simply creates a JKQTPLotter widget (as a new window) and adds a single impulse graph.
|
||||||
The soruce code of the main application is (see [`jkqtplotter_simpletest_impulsesplot.cpp`](../simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.cpp).
|
The soruce code of the main application is (see [`jkqtplotter_simpletest_impulsesplot.cpp`](../simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.cpp).
|
||||||
|
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ First data for a curve is calculated and stored in `QVector<double>`:
|
|||||||
|
|
||||||
Now an impulse graph object is generated and added to the plot:
|
Now an impulse graph object is generated and added to the plot:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPimpulsesVerticalGraph* graph=new JKQTPimpulsesVerticalGraph(&plot);
|
JKQTPImpulsesVerticalGraph* graph=new JKQTPImpulsesVerticalGraph(&plot);
|
||||||
graph->set_xColumn(columnX);
|
graph->set_xColumn(columnX);
|
||||||
graph->set_yColumn(columnY);
|
graph->set_yColumn(columnY);
|
||||||
graph->set_lineWidth(2);
|
graph->set_lineWidth(2);
|
||||||
@ -36,9 +36,9 @@ The result looks like this:
|
|||||||
|
|
||||||
![jkqtplotter_simpletest_impulsesplot](../../screenshots/jkqtplotter_simpletest_impulsesplot.png)
|
![jkqtplotter_simpletest_impulsesplot](../../screenshots/jkqtplotter_simpletest_impulsesplot.png)
|
||||||
|
|
||||||
There is an alternative class `JKQTPimpulsesHorizontalGraph` which draws horizontal impulse plots:
|
There is an alternative class `JKQTPImpulsesHorizontalGraph` which draws horizontal impulse plots:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPimpulsesHorizontalGraph* graph=new JKQTPimpulsesHorizontalGraph(&plot);
|
JKQTPImpulsesHorizontalGraph* graph=new JKQTPImpulsesHorizontalGraph(&plot);
|
||||||
graph->set_yColumn(columnX);
|
graph->set_yColumn(columnX);
|
||||||
graph->set_xColumn(columnY);
|
graph->set_xColumn(columnY);
|
||||||
graph->set_lineWidth(2);
|
graph->set_lineWidth(2);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_impulsesplot.cpp
|
/** \example jkqtplotter_simpletest_impulsesplot.cpp
|
||||||
* Shows how to plot impulse graphs with JKQtPlotter
|
* Shows how to plot impulse graphs with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterImpulsePlots
|
* \ref JKQTPLotterImpulsePlots
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -16,8 +16,8 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for a simple plot (a sine curve with lin. increasing errors)
|
// 2. now we create data for a simple plot (a sine curve with lin. increasing errors)
|
||||||
QVector<double> X, Y;
|
QVector<double> X, Y;
|
||||||
@ -32,7 +32,7 @@ int main(int argc, char* argv[])
|
|||||||
size_t columnY=ds->addCopiedColumn(Y, "y");
|
size_t columnY=ds->addCopiedColumn(Y, "y");
|
||||||
|
|
||||||
// 4. create a vertical impulse graph in the plot, which plots the dataset X/Y:
|
// 4. create a vertical impulse graph in the plot, which plots the dataset X/Y:
|
||||||
JKQTPimpulsesVerticalGraph* graph=new JKQTPimpulsesVerticalGraph(&plot);
|
JKQTPImpulsesVerticalGraph* graph=new JKQTPImpulsesVerticalGraph(&plot);
|
||||||
graph->set_xColumn(columnX);
|
graph->set_xColumn(columnX);
|
||||||
graph->set_yColumn(columnY);
|
graph->set_yColumn(columnY);
|
||||||
graph->set_lineWidth(2);
|
graph->set_lineWidth(2);
|
||||||
|
@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
TARGET = jkqtplotter_simpletest_impulsesplot
|
TARGET = jkqtplotter_simpletest_impulsesplot
|
||||||
|
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Line Graph with Logarithmic y-axis {#JKQtPlotterLogAxes}
|
# Example (JKQTPLotter): Line Graph with Logarithmic y-axis {#JKQTPLotterLogAxes}
|
||||||
This project (see `./examples/simpletest_logaxes/`) simply creates a JKQtPlotter widget (as a new window) and several line-graphs of different resonance curves.
|
This project (see `./examples/simpletest_logaxes/`) simply creates a JKQTPLotter widget (as a new window) and several line-graphs of different resonance curves.
|
||||||
|
|
||||||
The source code of the main application can be found in [`jkqtplotter_simpletest_logaxes.cpp`](../simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp). Mainly several graphs are generated in a loop and then different line styles are applied to the graphs (set by ``graph->set_style()`). The colors are set automtically from an internal default palette. The main loop looks like this:
|
The source code of the main application can be found in [`jkqtplotter_simpletest_logaxes.cpp`](../simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp). Mainly several graphs are generated in a loop and then different line styles are applied to the graphs (set by ``graph->set_style()`). The colors are set automtically from an internal default palette. The main loop looks like this:
|
||||||
|
|
||||||
@ -12,14 +12,14 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
Y<<1.0/sqrt(sqr(1-sqr(xx))+sqr(2*xx*D[id]));
|
Y<<1.0/sqrt(sqr(1-sqr(xx))+sqr(2*xx*D[id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTPxyLineGraph* graph=new JKQTPxyLineGraph(&plot);
|
JKQTPXYLineGraph* graph=new JKQTPXYLineGraph(&plot);
|
||||||
|
|
||||||
// copy data into datastore and immediately set the yColumn
|
// copy data into datastore and immediately set the yColumn
|
||||||
graph->set_xColumn(columnX);
|
graph->set_xColumn(columnX);
|
||||||
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
||||||
|
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graph->set_symbol(JKQTPnoSymbol);
|
graph->set_symbol(JKQTPNoSymbol);
|
||||||
// use one of different pens
|
// use one of different pens
|
||||||
graph->set_style(pens[id%pens.size()]);
|
graph->set_style(pens[id%pens.size()]);
|
||||||
// set width of graph line
|
// set width of graph line
|
||||||
@ -33,10 +33,10 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Then a `JKQTPgeoText` is added to the graph, which shows the function plotted in the plot:
|
Then a `JKQTPGeoText` is added to the graph, which shows the function plotted in the plot:
|
||||||
```.cpp
|
```.cpp
|
||||||
// 4. Also we add a text-element in the plot to show the plotted function
|
// 4. Also we add a text-element in the plot to show the plotted function
|
||||||
// This element (JKQTPgeoText) is taken from the set of geometric elements
|
// This element (JKQTPGeoText) is taken from the set of geometric elements
|
||||||
// and is simply parametrized by a position (1.25/10) and the text to display.
|
// and is simply parametrized by a position (1.25/10) and the text to display.
|
||||||
// In addition you can also set the font size (here to 15)
|
// In addition you can also set the font size (here to 15)
|
||||||
// Use '$...$' around the actual math string to ensure rendering with a math font
|
// Use '$...$' around the actual math string to ensure rendering with a math font
|
||||||
@ -44,7 +44,7 @@ Then a `JKQTPgeoText` is added to the graph, which shows the function plotted in
|
|||||||
// and loaded in the library). If you don't use the math-mode modifiers, the default
|
// and loaded in the library). If you don't use the math-mode modifiers, the default
|
||||||
// font of the other rendering text is used, which might not be suitable for
|
// font of the other rendering text is used, which might not be suitable for
|
||||||
// high-quality math rendering.
|
// high-quality math rendering.
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15));
|
plot.addGraph(new JKQTPGeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15));
|
||||||
```
|
```
|
||||||
The difference between not using and using `$...$` for the equation can be seen here:
|
The difference between not using and using `$...$` for the equation can be seen here:
|
||||||
- no $-math-mode: ![](../../screenshots/jkqtplotter_simpletest_logaxes_lowqmathrendering.png)
|
- no $-math-mode: ![](../../screenshots/jkqtplotter_simpletest_logaxes_lowqmathrendering.png)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_logaxes.cpp
|
/** \example jkqtplotter_simpletest_logaxes.cpp
|
||||||
* Shows how to use logarithmic axes with JKQtPlotter
|
* Shows how to use logarithmic axes with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterLogAxes
|
* \ref JKQTPLotterLogAxes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -17,8 +17,8 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data a vector of x-values for a simple plot (resonance curve with different damping value D)
|
// 2. now we create data a vector of x-values for a simple plot (resonance curve with different damping value D)
|
||||||
// see https://en.wikipedia.org/wiki/Resonance
|
// see https://en.wikipedia.org/wiki/Resonance
|
||||||
@ -42,14 +42,14 @@ int main(int argc, char* argv[])
|
|||||||
Y<<1.0/sqrt(sqr(1-sqr(xx))+sqr(2*xx*D[id]));
|
Y<<1.0/sqrt(sqr(1-sqr(xx))+sqr(2*xx*D[id]));
|
||||||
}
|
}
|
||||||
|
|
||||||
JKQTPxyLineGraph* graph=new JKQTPxyLineGraph(&plot);
|
JKQTPXYLineGraph* graph=new JKQTPXYLineGraph(&plot);
|
||||||
|
|
||||||
// copy data into datastore and immediately set the yColumn
|
// copy data into datastore and immediately set the yColumn
|
||||||
graph->set_xColumn(columnX);
|
graph->set_xColumn(columnX);
|
||||||
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
||||||
|
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graph->set_symbol(JKQTPnoSymbol);
|
graph->set_symbol(JKQTPNoSymbol);
|
||||||
// use one of different pens
|
// use one of different pens
|
||||||
graph->set_style(pens[id%pens.size()]);
|
graph->set_style(pens[id%pens.size()]);
|
||||||
// set width of graph line
|
// set width of graph line
|
||||||
@ -63,7 +63,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 4. Also we add a text-element in the plot to show the plotted function
|
// 4. Also we add a text-element in the plot to show the plotted function
|
||||||
// This element (JKQTPgeoText) is taken from the set of geometric elements
|
// This element (JKQTPGeoText) is taken from the set of geometric elements
|
||||||
// and is simply parametrized by a position (1.25/10) and the text to display.
|
// and is simply parametrized by a position (1.25/10) and the text to display.
|
||||||
// In addition you can also set the font size (here to 15)
|
// In addition you can also set the font size (here to 15)
|
||||||
// Use '$...$' around the actual math string to ensure rendering with a math font
|
// Use '$...$' around the actual math string to ensure rendering with a math font
|
||||||
@ -71,7 +71,7 @@ int main(int argc, char* argv[])
|
|||||||
// and loaded in the library). If you don't use the math-mode modifiers, the default
|
// and loaded in the library). If you don't use the math-mode modifiers, the default
|
||||||
// font of the other rendering text is used, which might not be suitable for
|
// font of the other rendering text is used, which might not be suitable for
|
||||||
// high-quality math rendering.
|
// high-quality math rendering.
|
||||||
plot.addGraph(new JKQTPgeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15));
|
plot.addGraph(new JKQTPGeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15));
|
||||||
|
|
||||||
// 5. set y-axis to logarithmic (x-axis would be analogous, but using `plot.get_xAxis()`)
|
// 5. set y-axis to logarithmic (x-axis would be analogous, but using `plot.get_xAxis()`)
|
||||||
plot.get_yAxis()->set_logAxis(true);
|
plot.get_yAxis()->set_logAxis(true);
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_logaxes
|
TARGET = jkqtplotter_simpletest_logaxes
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Plotting Parametric Curves {#JKQtPlotterParametricCurves}
|
# Example (JKQTPLotter): Plotting Parametric Curves {#JKQTPLotterParametricCurves}
|
||||||
This project (see `./examples/simpletest_parametriccurve/`) demonstrates how to draw parametric curves, using [`JKQTPxyLineGraph`}(../simpletest) and [`JKQTPxyParametrizedScatterGraph`](../simpletest_paramscatterplot).
|
This project (see `./examples/simpletest_parametriccurve/`) demonstrates how to draw parametric curves, using [`JKQTPXYLineGraph`}(../simpletest) and [`JKQTPXYParametrizedScatterGraph`](../simpletest_paramscatterplot).
|
||||||
|
|
||||||
The source code of the main application can be found in [`jkqtplotter_simpletest_parametriccurve.cpp`](../simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.cpp). First, the parametric curve (here a [logarithic spiral](https://en.wikipedia.org/wiki/Logarithmic_spiral)) is sampled into two columns containing the x- and y-values along the curve. In addition the radial distance from x=y=0 is added into a third column:
|
The source code of the main application can be found in [`jkqtplotter_simpletest_parametriccurve.cpp`](../simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.cpp). First, the parametric curve (here a [logarithic spiral](https://en.wikipedia.org/wiki/Logarithmic_spiral)) is sampled into two columns containing the x- and y-values along the curve. In addition the radial distance from x=y=0 is added into a third column:
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -24,23 +24,23 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
|
|
||||||
Then simples graph just uses the columns X and Y to plot the curve:
|
Then simples graph just uses the columns X and Y to plot the curve:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxyLineGraph* graph1=new JKQTPxyLineGraph(&plot);
|
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->set_yColumn(columnY);
|
||||||
graph1->set_drawLine(true);
|
graph1->set_drawLine(true);
|
||||||
graph1->set_symbol(JKQTPnoSymbol);
|
graph1->set_symbol(JKQTPNoSymbol);
|
||||||
graph1->set_title("one-colored spiral");
|
graph1->set_title("one-colored spiral");
|
||||||
plot.addGraph(graph1);
|
plot.addGraph(graph1);
|
||||||
```
|
```
|
||||||
|
|
||||||
If you use `JKQTPxyParametrizedScatterGraph` instead of `JKQTPxyLineGraph`, you can also modify the color of the line-segments, connecting the datapoints:
|
If you use `JKQTPXYParametrizedScatterGraph` instead of `JKQTPXYLineGraph`, you can also modify the color of the line-segments, connecting the datapoints:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxyParametrizedScatterGraph* graph2=new JKQTPxyParametrizedScatterGraph(&plot2);
|
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot2);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->set_xColumn(columnX);
|
||||||
graph2->set_yColumn(columnY);
|
graph2->set_yColumn(columnY);
|
||||||
graph2->set_colorColumn(columnR);
|
graph2->set_colorColumn(columnR);
|
||||||
graph2->set_palette(JKQTPMathImageMATLAB);
|
graph2->set_palette(JKQTPMathImageMATLAB);
|
||||||
graph2->set_symbol(JKQTPnoSymbol);
|
graph2->set_symbol(JKQTPNoSymbol);
|
||||||
graph2->set_drawLine(true);
|
graph2->set_drawLine(true);
|
||||||
graph2->set_title("colored spiral");
|
graph2->set_title("colored spiral");
|
||||||
graph2->get_colorBarRightAxis()->set_axisLabel("color scale radius $r(\\phi)$");
|
graph2->get_colorBarRightAxis()->set_axisLabel("color scale radius $r(\\phi)$");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_parametriccurve.cpp
|
/** \example jkqtplotter_simpletest_parametriccurve.cpp
|
||||||
* Shows how to plot parametric curves from datapoints with JKQtPlotter
|
* Shows how to plot parametric curves from datapoints with JKQTPLotter
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterParametricCurves
|
* \ref JKQTPLotterParametricCurves
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -14,8 +14,8 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create two plotter windows that share the same internal datastore (for convenience)
|
// 1. create two plotter windows that share the same internal datastore (for convenience)
|
||||||
JKQtPlotter plot, plot2;
|
JKQTPLotter plot, plot2;
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
plot2.useExternalDatastore(ds);
|
plot2.useExternalDatastore(ds);
|
||||||
|
|
||||||
// 2. now we create a vector of x- and y-values of the logarithmic spiral
|
// 2. now we create a vector of x- and y-values of the logarithmic spiral
|
||||||
@ -42,22 +42,22 @@ int main(int argc, char* argv[])
|
|||||||
// a datacolumn
|
// a datacolumn
|
||||||
|
|
||||||
// 3.1 the basic graph
|
// 3.1 the basic graph
|
||||||
JKQTPxyLineGraph* graph1=new JKQTPxyLineGraph(&plot);
|
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->set_yColumn(columnY);
|
||||||
graph1->set_drawLine(true);
|
graph1->set_drawLine(true);
|
||||||
graph1->set_symbol(JKQTPnoSymbol);
|
graph1->set_symbol(JKQTPNoSymbol);
|
||||||
graph1->set_title("one-colored spiral");
|
graph1->set_title("one-colored spiral");
|
||||||
plot.addGraph(graph1);
|
plot.addGraph(graph1);
|
||||||
|
|
||||||
// 3.2 for graph2 is the same as graph 1, but in addition, the color of the lines
|
// 3.2 for graph2 is the same as graph 1, but in addition, the color of the lines
|
||||||
// is set, based on the contents of column R, via the color-palette JKQTPMathImageMATLAB
|
// is set, based on the contents of column R, via the color-palette JKQTPMathImageMATLAB
|
||||||
JKQTPxyParametrizedScatterGraph* graph2=new JKQTPxyParametrizedScatterGraph(&plot2);
|
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot2);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->set_xColumn(columnX);
|
||||||
graph2->set_yColumn(columnY);
|
graph2->set_yColumn(columnY);
|
||||||
graph2->set_colorColumn(columnR);
|
graph2->set_colorColumn(columnR);
|
||||||
graph2->set_palette(JKQTPMathImageMATLAB);
|
graph2->set_palette(JKQTPMathImageMATLAB);
|
||||||
graph2->set_symbol(JKQTPnoSymbol);
|
graph2->set_symbol(JKQTPNoSymbol);
|
||||||
graph2->set_drawLine(true);
|
graph2->set_drawLine(true);
|
||||||
graph2->set_title("colored spiral");
|
graph2->set_title("colored spiral");
|
||||||
graph2->get_colorBarRightAxis()->set_axisLabel("color scale radius $r(\\phi)$");
|
graph2->get_colorBarRightAxis()->set_axisLabel("color scale radius $r(\\phi)$");
|
||||||
|
@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
TARGET = jkqtplotter_simpletest_parametriccurve
|
TARGET = jkqtplotter_simpletest_parametriccurve
|
||||||
|
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Scatter Graph with Parametrized Symbols/Colors {#JKQtPlotterParamScatter}
|
# Example (JKQTPLotter): Scatter Graph with Parametrized Symbols/Colors {#JKQTPLotterParamScatter}
|
||||||
This project (see `./examples/simpletest_paramscatterplot/`) demonstrates the capabilities of `JKQTPxyParametrizedScatterGraph`. This graph class plots symbol&line-graphs, juts like [`JKQTPxyLineGraph`](../simpletest_symbols_and_styles/) and in addition modifies several properties of each plot point by data from an additional column. These properties can be modified:
|
This project (see `./examples/simpletest_paramscatterplot/`) demonstrates the capabilities of `JKQTPXYParametrizedScatterGraph`. This graph class plots symbol&line-graphs, juts like [`JKQTPXYLineGraph`](../simpletest_symbols_and_styles/) and in addition modifies several properties of each plot point by data from an additional column. These properties can be modified:
|
||||||
- symbol size
|
- symbol size
|
||||||
- symbol type
|
- symbol type
|
||||||
- symbol/line color
|
- symbol/line color
|
||||||
@ -11,9 +11,9 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
|
|
||||||
Then several plots are added that modify different properties.
|
Then several plots are added that modify different properties.
|
||||||
|
|
||||||
The simplest case is to modify the symbol type. Simply set the property `symbolColumn` with `graph1->set_symbolColumn(columnP)` to a data column. The values in the data column will be cast to an integer and then will be translated to `JKQTPgraphSymbols`. If the numbers are larger than the available symbol types in `JKQTPgraphSymbols`, the graph will cycle through the available symbols (via a modulo-operation with the max. symbol count!).
|
The simplest case is to modify the symbol type. Simply set the property `symbolColumn` with `graph1->set_symbolColumn(columnP)` to a data column. The values in the data column will be cast to an integer and then will be translated to `JKQTPGraphSymbols`. If the numbers are larger than the available symbol types in `JKQTPGraphSymbols`, the graph will cycle through the available symbols (via a modulo-operation with the max. symbol count!).
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxyParametrizedScatterGraph* graph1=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY1);
|
graph1->set_yColumn(columnY1);
|
||||||
graph1->set_symbolColumn(columnP);
|
graph1->set_symbolColumn(columnP);
|
||||||
@ -27,22 +27,22 @@ The simplest case is to modify the symbol type. Simply set the property `symbolC
|
|||||||
The next two code snippets show how to modify the size of the symbols and the line width of the lines, connecting the symbols (ensure to set `graph6->set_drawLine(true)`, because otherwise no line will be drawn). The principle is the same as above, but here you need to set the properties `sizeColumn` for the symbol size and `linewidthColumn` for the line width. All values in the line width or symbol size columns are interpreted as sizes in dtp points (pt)!
|
The next two code snippets show how to modify the size of the symbols and the line width of the lines, connecting the symbols (ensure to set `graph6->set_drawLine(true)`, because otherwise no line will be drawn). The principle is the same as above, but here you need to set the properties `sizeColumn` for the symbol size and `linewidthColumn` for the line width. All values in the line width or symbol size columns are interpreted as sizes in dtp points (pt)!
|
||||||
```.cpp
|
```.cpp
|
||||||
// symbol size
|
// symbol size
|
||||||
JKQTPxyParametrizedScatterGraph* graph3=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph3=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph3->set_xColumn(columnX);
|
graph3->set_xColumn(columnX);
|
||||||
graph3->set_yColumn(columnY3);
|
graph3->set_yColumn(columnY3);
|
||||||
graph3->set_sizeColumn(columnS);
|
graph3->set_sizeColumn(columnS);
|
||||||
graph3->set_symbol(JKQTPfilledCircle);
|
graph3->set_symbol(JKQTPFilledCircle);
|
||||||
graph3->set_drawLine(true);
|
graph3->set_drawLine(true);
|
||||||
graph3->set_title("3: symbol size");
|
graph3->set_title("3: symbol size");
|
||||||
plot.addGraph(graph3);
|
plot.addGraph(graph3);
|
||||||
|
|
||||||
// line width
|
// line width
|
||||||
JKQTPxyParametrizedScatterGraph* graph6=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph6=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph6->set_xColumn(columnX);
|
graph6->set_xColumn(columnX);
|
||||||
graph6->set_yColumn(columnY6);
|
graph6->set_yColumn(columnY6);
|
||||||
graph6->set_linewidthColumn(columnLW);
|
graph6->set_linewidthColumn(columnLW);
|
||||||
graph6->set_drawLine(true);
|
graph6->set_drawLine(true);
|
||||||
graph6->set_symbol(JKQTPnoSymbol);
|
graph6->set_symbol(JKQTPNoSymbol);
|
||||||
graph6->set_title("6: line width");
|
graph6->set_title("6: line width");
|
||||||
plot.addGraph(graph6);
|
plot.addGraph(graph6);
|
||||||
```
|
```
|
||||||
@ -62,25 +62,25 @@ Basically the data points in a RGB(A)-column will be interpreted by castig them
|
|||||||
|
|
||||||
Now you can add the graph. In order to interpret the color column as RGB(A)-values, ensure to set `graph4->set_colorColumnContainsRGB(true)`:
|
Now you can add the graph. In order to interpret the color column as RGB(A)-values, ensure to set `graph4->set_colorColumnContainsRGB(true)`:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxyParametrizedScatterGraph* graph4=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph4=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph4->set_xColumn(columnX);
|
graph4->set_xColumn(columnX);
|
||||||
graph4->set_yColumn(columnY4);
|
graph4->set_yColumn(columnY4);
|
||||||
graph4->set_colorColumn(columnRGB);
|
graph4->set_colorColumn(columnRGB);
|
||||||
graph4->set_colorColumnContainsRGB(true);
|
graph4->set_colorColumnContainsRGB(true);
|
||||||
graph4->set_drawLine(true);
|
graph4->set_drawLine(true);
|
||||||
graph4->set_symbol(JKQTPfilledDownTriangle);
|
graph4->set_symbol(JKQTPFilledDownTriangle);
|
||||||
graph4->set_title("4: RGB-color");
|
graph4->set_title("4: RGB-color");
|
||||||
plot.addGraph(graph4);
|
plot.addGraph(graph4);
|
||||||
```
|
```
|
||||||
|
|
||||||
The second variant for setting the color of each datapoint is by mapping the values in the column to a color palette (`JKQTPMathImageRYGB` in this example). For this you simply need to define the color coumn and the palette to use. By default, the color palette spans the full range of values in `colorColumn`:
|
The second variant for setting the color of each datapoint is by mapping the values in the column to a color palette (`JKQTPMathImageRYGB` in this example). For this you simply need to define the color coumn and the palette to use. By default, the color palette spans the full range of values in `colorColumn`:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxyParametrizedScatterGraph* graph2=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->set_xColumn(columnX);
|
||||||
graph2->set_yColumn(columnY2);
|
graph2->set_yColumn(columnY2);
|
||||||
graph2->set_colorColumn(columnC);
|
graph2->set_colorColumn(columnC);
|
||||||
graph2->set_palette(JKQTPMathImageRYGB);
|
graph2->set_palette(JKQTPMathImageRYGB);
|
||||||
graph2->set_symbol(JKQTPfilledRect);
|
graph2->set_symbol(JKQTPFilledRect);
|
||||||
graph2->set_drawLine(true);
|
graph2->set_drawLine(true);
|
||||||
graph2->set_title("2: color");
|
graph2->set_title("2: color");
|
||||||
graph2->get_colorBarRightAxis()->set_axisLabel("color scale for graph2");
|
graph2->get_colorBarRightAxis()->set_axisLabel("color scale for graph2");
|
||||||
@ -91,7 +91,7 @@ Note: If you want to set the range manually, use `ste_imageMin()` and `set_image
|
|||||||
|
|
||||||
Note also that it is possible to combine any of parametrizations above in a single graph, by setting two or more columns:
|
Note also that it is possible to combine any of parametrizations above in a single graph, by setting two or more columns:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxyParametrizedScatterGraph* graph5=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph5=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph5->set_xColumn(columnX);
|
graph5->set_xColumn(columnX);
|
||||||
graph5->set_yColumn(columnY5);
|
graph5->set_yColumn(columnY5);
|
||||||
graph5->set_colorColumn(columnC);
|
graph5->set_colorColumn(columnC);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_paramscatterplot.cpp
|
/** \example jkqtplotter_simpletest_paramscatterplot.cpp
|
||||||
* JKQtPlotter: Examples: Scatter Graph with Parametrized Symbols/Colors
|
* JKQTPLotter: Examples: Scatter Graph with Parametrized Symbols/Colors
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterParamScatter
|
* \ref JKQTPLotterParamScatter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -14,8 +14,8 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create a vector of x- and y-values for a simple plot (a sine curve)
|
// 2. now we create a vector of x- and y-values for a simple plot (a sine curve)
|
||||||
// in addition, a vector P will hold values that will be mapped onto different plot styles
|
// in addition, a vector P will hold values that will be mapped onto different plot styles
|
||||||
@ -59,7 +59,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 3.1 for graph1, we use dataset X/Y1
|
// 3.1 for graph1, we use dataset X/Y1
|
||||||
// and the symbol type is choose according to the contents of column P:
|
// and the symbol type is choose according to the contents of column P:
|
||||||
JKQTPxyParametrizedScatterGraph* graph1=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY1);
|
graph1->set_yColumn(columnY1);
|
||||||
graph1->set_symbolColumn(columnP);
|
graph1->set_symbolColumn(columnP);
|
||||||
@ -71,12 +71,12 @@ int main(int argc, char* argv[])
|
|||||||
// 3.2 for graph2, we use dataset X/Y2
|
// 3.2 for graph2, we use dataset X/Y2
|
||||||
// and the symbol color is choose according to the contents of column C
|
// and the symbol color is choose according to the contents of column C
|
||||||
// and the actual colors are chose from palette JKQTPMathImageRYGB:
|
// and the actual colors are chose from palette JKQTPMathImageRYGB:
|
||||||
JKQTPxyParametrizedScatterGraph* graph2=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->set_xColumn(columnX);
|
||||||
graph2->set_yColumn(columnY2);
|
graph2->set_yColumn(columnY2);
|
||||||
graph2->set_colorColumn(columnC);
|
graph2->set_colorColumn(columnC);
|
||||||
graph2->set_palette(JKQTPMathImageRYGB);
|
graph2->set_palette(JKQTPMathImageRYGB);
|
||||||
graph2->set_symbol(JKQTPfilledRect);
|
graph2->set_symbol(JKQTPFilledRect);
|
||||||
graph2->set_drawLine(true);
|
graph2->set_drawLine(true);
|
||||||
graph2->set_title("2: color");
|
graph2->set_title("2: color");
|
||||||
graph2->get_colorBarRightAxis()->set_axisLabel("color scale for graph2");
|
graph2->get_colorBarRightAxis()->set_axisLabel("color scale for graph2");
|
||||||
@ -84,11 +84,11 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 3.3 for graph3, we use dataset X/Y3
|
// 3.3 for graph3, we use dataset X/Y3
|
||||||
// and the symbol size is choose according to the contents of column S:
|
// and the symbol size is choose according to the contents of column S:
|
||||||
JKQTPxyParametrizedScatterGraph* graph3=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph3=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph3->set_xColumn(columnX);
|
graph3->set_xColumn(columnX);
|
||||||
graph3->set_yColumn(columnY3);
|
graph3->set_yColumn(columnY3);
|
||||||
graph3->set_sizeColumn(columnS);
|
graph3->set_sizeColumn(columnS);
|
||||||
graph3->set_symbol(JKQTPfilledCircle);
|
graph3->set_symbol(JKQTPFilledCircle);
|
||||||
graph3->set_drawLine(true);
|
graph3->set_drawLine(true);
|
||||||
graph3->set_title("3: symbol size");
|
graph3->set_title("3: symbol size");
|
||||||
plot.addGraph(graph3);
|
plot.addGraph(graph3);
|
||||||
@ -96,13 +96,13 @@ int main(int argc, char* argv[])
|
|||||||
// 3.4 for graph4, we use X/Y4
|
// 3.4 for graph4, we use X/Y4
|
||||||
// and the symbol color is choose according to the contents of column RGB,
|
// and the symbol color is choose according to the contents of column RGB,
|
||||||
// which directly contains the RGB values, as set with qRgb():
|
// which directly contains the RGB values, as set with qRgb():
|
||||||
JKQTPxyParametrizedScatterGraph* graph4=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph4=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph4->set_xColumn(columnX);
|
graph4->set_xColumn(columnX);
|
||||||
graph4->set_yColumn(columnY4);
|
graph4->set_yColumn(columnY4);
|
||||||
graph4->set_colorColumn(columnRGB);
|
graph4->set_colorColumn(columnRGB);
|
||||||
graph4->set_colorColumnContainsRGB(true);
|
graph4->set_colorColumnContainsRGB(true);
|
||||||
graph4->set_drawLine(true);
|
graph4->set_drawLine(true);
|
||||||
graph4->set_symbol(JKQTPfilledDownTriangle);
|
graph4->set_symbol(JKQTPFilledDownTriangle);
|
||||||
graph4->set_title("4: RGB-color");
|
graph4->set_title("4: RGB-color");
|
||||||
plot.addGraph(graph4);
|
plot.addGraph(graph4);
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ int main(int argc, char* argv[])
|
|||||||
// and the symbol color and size are choose according to the contents
|
// and the symbol color and size are choose according to the contents
|
||||||
// of columns C and S respectively.
|
// of columns C and S respectively.
|
||||||
// The actual colors are chose from palette JKQTPMathImageBLUEYELLOW:
|
// The actual colors are chose from palette JKQTPMathImageBLUEYELLOW:
|
||||||
JKQTPxyParametrizedScatterGraph* graph5=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph5=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph5->set_xColumn(columnX);
|
graph5->set_xColumn(columnX);
|
||||||
graph5->set_yColumn(columnY5);
|
graph5->set_yColumn(columnY5);
|
||||||
graph5->set_colorColumn(columnC);
|
graph5->set_colorColumn(columnC);
|
||||||
@ -123,33 +123,33 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 3.6 for graph2, we use dataset X/Y6
|
// 3.6 for graph2, we use dataset X/Y6
|
||||||
// and the line width is set by column LW:
|
// and the line width is set by column LW:
|
||||||
JKQTPxyParametrizedScatterGraph* graph6=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph6=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph6->set_xColumn(columnX);
|
graph6->set_xColumn(columnX);
|
||||||
graph6->set_yColumn(columnY6);
|
graph6->set_yColumn(columnY6);
|
||||||
graph6->set_linewidthColumn(columnLW);
|
graph6->set_linewidthColumn(columnLW);
|
||||||
graph6->set_drawLine(true);
|
graph6->set_drawLine(true);
|
||||||
graph6->set_symbol(JKQTPnoSymbol);
|
graph6->set_symbol(JKQTPNoSymbol);
|
||||||
graph6->set_title("6: line width");
|
graph6->set_title("6: line width");
|
||||||
plot.addGraph(graph6);
|
plot.addGraph(graph6);
|
||||||
|
|
||||||
// 3.7 for graph2, we use dataset X/Y7
|
// 3.7 for graph2, we use dataset X/Y7
|
||||||
// and the line width is set by column LW and the color from palette JKQTPMathImageBLUEYELLOW via column C:
|
// and the line width is set by column LW and the color from palette JKQTPMathImageBLUEYELLOW via column C:
|
||||||
JKQTPxyParametrizedScatterGraph* graph7=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph7=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph7->set_xColumn(columnX);
|
graph7->set_xColumn(columnX);
|
||||||
graph7->set_yColumn(columnY7);
|
graph7->set_yColumn(columnY7);
|
||||||
graph7->set_linewidthColumn(columnLW);
|
graph7->set_linewidthColumn(columnLW);
|
||||||
graph7->set_drawLine(true);
|
graph7->set_drawLine(true);
|
||||||
graph7->set_colorColumn(columnC);
|
graph7->set_colorColumn(columnC);
|
||||||
graph7->set_palette(JKQTPMathImageBLUEYELLOW);
|
graph7->set_palette(JKQTPMathImageBLUEYELLOW);
|
||||||
graph7->set_symbol(JKQTPnoSymbol);
|
graph7->set_symbol(JKQTPNoSymbol);
|
||||||
graph7->set_colorBarRightVisible(false);
|
graph7->set_colorBarRightVisible(false);
|
||||||
graph7->set_colorBarTopVisible(false);
|
graph7->set_colorBarTopVisible(false);
|
||||||
graph7->set_title("7: color+line width");
|
graph7->set_title("7: color+line width");
|
||||||
plot.addGraph(graph7);
|
plot.addGraph(graph7);
|
||||||
|
|
||||||
// 4. autoscale the plot so the graph is contained and format the coordinate system and key
|
// 4. autoscale the plot so the graph is contained and format the coordinate system and key
|
||||||
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideBottomLeft);
|
plot.get_plotter()->set_keyPosition(JKQTPKeyOutsideBottomLeft);
|
||||||
plot.get_plotter()->set_keyLayout(JKQTPkeyLayoutOneRow);
|
plot.get_plotter()->set_keyLayout(JKQTPKeyLayoutOneRow);
|
||||||
plot.get_xAxis()->set_axisLabel("x-axis");
|
plot.get_xAxis()->set_axisLabel("x-axis");
|
||||||
plot.get_yAxis()->set_axisLabel("y-axis");
|
plot.get_yAxis()->set_axisLabel("y-axis");
|
||||||
plot.get_xAxis()->set_drawGrid(false);
|
plot.get_xAxis()->set_drawGrid(false);
|
||||||
|
@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
TARGET = jkqtplotter_simpletest_paramscatterplot
|
TARGET = jkqtplotter_simpletest_paramscatterplot
|
||||||
|
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Example (JKQtPlotter): Draw an Artistic Image with a Parametrized Scatter Graph {#JKQtPlotterParamScatterImage}
|
# Example (JKQTPLotter): Draw an Artistic Image with a Parametrized Scatter Graph {#JKQTPLotterParamScatterImage}
|
||||||
This project (see `./examples/simpletest_paramscatterplot_image/`) demonstrates the capabilities of `JKQTPxyParametrizedScatterGraph` to display parametrized scatters in a rectangular arrangement. See the test program in [`test/simpletest_paramscatterplot`](../simpletest_paramscatterplot) for a basic example of the capabilities of `JKQTPxyParametrizedScatterGraph`.
|
This project (see `./examples/simpletest_paramscatterplot_image/`) demonstrates the capabilities of `JKQTPXYParametrizedScatterGraph` to display parametrized scatters in a rectangular arrangement. See the test program in [`test/simpletest_paramscatterplot`](../simpletest_paramscatterplot) for a basic example of the capabilities of `JKQTPXYParametrizedScatterGraph`.
|
||||||
|
|
||||||
In this example, we load an image, convert it to greyscale and store it, together with x/y-coordinate-vectors in the datastore. Then a `JKQTPxyParametrizedScatterGraph` is used to draw the image as a pointilistic artwork, where each pixel is represented by a disk. The color of the disk is chosen from a color-palette, based on the grey-value. The size of each disk is chosen from the inverse grey value.
|
In this example, we load an image, convert it to greyscale and store it, together with x/y-coordinate-vectors in the datastore. Then a `JKQTPXYParametrizedScatterGraph` is used to draw the image as a pointilistic artwork, where each pixel is represented by a disk. The color of the disk is chosen from a color-palette, based on the grey-value. The size of each disk is chosen from the inverse grey value.
|
||||||
|
|
||||||
First we prepare the data, as described above. The image is loaded and then converted to the required data vectors.
|
First we prepare the data, as described above. The image is loaded and then converted to the required data vectors.
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -31,13 +31,13 @@ First we prepare the data, as described above. The image is loaded and then conv
|
|||||||
size_t columnS=ds->addCopiedColumn(pointSizes, "pointSizes");
|
size_t columnS=ds->addCopiedColumn(pointSizes, "pointSizes");
|
||||||
```
|
```
|
||||||
|
|
||||||
Now we can use th datavectors to add a `JKQTPxyParametrizedScatterGraph`:
|
Now we can use th datavectors to add a `JKQTPXYParametrizedScatterGraph`:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxyParametrizedScatterGraph* graph1=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->set_yColumn(columnY);
|
||||||
graph1->set_sizeColumn(columnS);
|
graph1->set_sizeColumn(columnS);
|
||||||
graph1->set_symbol(JKQTPfilledCircle);
|
graph1->set_symbol(JKQTPFilledCircle);
|
||||||
graph1->set_colorColumn(columnG);
|
graph1->set_colorColumn(columnG);
|
||||||
graph1->set_palette(JKQTPMathImageMATLAB);
|
graph1->set_palette(JKQTPMathImageMATLAB);
|
||||||
graph1->set_drawLine(false);
|
graph1->set_drawLine(false);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_paramscatterplot_image.cpp
|
/** \example jkqtplotter_simpletest_paramscatterplot_image.cpp
|
||||||
* JKQtPlotter: Examples: Draw an Artistic Image with a Parametrized Scatter Graph
|
* JKQTPLotter: Examples: Draw an Artistic Image with a Parametrized Scatter Graph
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterParamScatterImage
|
* \ref JKQTPLotterParamScatterImage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -15,8 +15,8 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. Prepare Data
|
// 2. Prepare Data
|
||||||
// 2.1 load image
|
// 2.1 load image
|
||||||
@ -48,12 +48,12 @@ int main(int argc, char* argv[])
|
|||||||
// 3.1 Now add a parametrized scatter graph with columnX, columnY for the positions of the
|
// 3.1 Now add a parametrized scatter graph with columnX, columnY for the positions of the
|
||||||
// scatter points, where the symbol size is given by column columnS and the color of
|
// scatter points, where the symbol size is given by column columnS and the color of
|
||||||
// each symbol is set from column columnG, via a color palette JKQTPMathImageMATLAB
|
// each symbol is set from column columnG, via a color palette JKQTPMathImageMATLAB
|
||||||
JKQTPxyParametrizedScatterGraph* graph1=new JKQTPxyParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->set_xColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->set_yColumn(columnY);
|
||||||
graph1->set_sizeColumn(columnS);
|
graph1->set_sizeColumn(columnS);
|
||||||
graph1->set_symbolColumn(columnS);
|
graph1->set_symbolColumn(columnS);
|
||||||
graph1->set_symbol(JKQTPfilledTriangle);
|
graph1->set_symbol(JKQTPFilledTriangle);
|
||||||
graph1->set_colorColumn(columnG);
|
graph1->set_colorColumn(columnG);
|
||||||
graph1->set_palette(JKQTPMathImageOCEAN);
|
graph1->set_palette(JKQTPMathImageOCEAN);
|
||||||
graph1->set_drawLine(false);
|
graph1->set_drawLine(false);
|
||||||
|
@ -12,7 +12,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
TARGET = jkqtplotter_simpletest_paramscatterplot_image
|
TARGET = jkqtplotter_simpletest_paramscatterplot_image
|
||||||
|
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
# Example (JKQtPlotter): Plotting Parsed Mathematical Functions as Line Graphs {#JKQtPlotterParsedFunctionPlot}
|
# Example (JKQTPLotter): Plotting Parsed Mathematical Functions as Line Graphs {#JKQTPLotterParsedFunctionPlot}
|
||||||
## Plot Function f(x)
|
## Plot Function f(x)
|
||||||
This project (see `./examples/simpletest_parsedfunctionplot/`) demonstrates how to plot mathematical functions as line graphs. The functions are defined as strings that will be evaluated with the equation parser, integrated into JKQtPlotter.
|
This project (see `./examples/simpletest_parsedfunctionplot/`) demonstrates how to plot mathematical functions as line graphs. The functions are defined as strings that will be evaluated with the equation parser, integrated into JKQTPLotter.
|
||||||
|
|
||||||
Note: See the example [Plotting Mathematical Functions as Line Graphs](../simpletest_functionplot) if you don't want to draw parsed functions, but want to provide a C function, or C++ functor!
|
Note: See the example [Plotting Mathematical Functions as Line Graphs](../simpletest_functionplot) if you don't want to draw parsed functions, but want to provide a C function, or C++ functor!
|
||||||
|
|
||||||
Adding an evaluated funtion to a graph is very simple:
|
Adding an evaluated funtion to a graph is very simple:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxParsedFunctionLineGraph* parsedFunc=new JKQTPxParsedFunctionLineGraph(plot);
|
JKQTPXParsedFunctionLineGraph* parsedFunc=new JKQTPXParsedFunctionLineGraph(plot);
|
||||||
parsedFunc->set_function("sin(x*8)*exp(-x/4)");
|
parsedFunc->set_function("sin(x*8)*exp(-x/4)");
|
||||||
parsedFunc->set_title("user function");
|
parsedFunc->set_title("user function");
|
||||||
```
|
```
|
||||||
As you can see a graph of the type `JKQTPxParsedFunctionLineGraph` is used, which plots a function that depends on the variable `x`. The given function is parsed and evaluated (see [`lib/jkqtplottertools/jkqtpmathparser.h`](https://github.com/jkriege2/JKQtPlotter/blob/master/lib/jkqtplottertools/jkqtpmathparser.h) for details on the features of the math parser). An intelligent drawing algorithm chooses the number of control points for drawing a smooth graph, with sufficient amount of details, by evaluating locally the slope of the function.
|
As you can see a graph of the type `JKQTPXParsedFunctionLineGraph` is used, which plots a function that depends on the variable `x`. The given function is parsed and evaluated (see [`lib/jkqtplottertools/jkqtpmathparser.h`](https://github.com/jkriege2/JKQTPLotter/blob/master/lib/jkqtplottertools/jkqtpmathparser.h) for details on the features of the math parser). An intelligent drawing algorithm chooses the number of control points for drawing a smooth graph, with sufficient amount of details, by evaluating locally the slope of the function.
|
||||||
|
|
||||||
In the example in [`test/simpletest_parsedfunctionplot/simpletest_parsedfunctionplot.cpp`](../simpletest_parsedfunctionplot/simpletest_parsedfunctionplot.cpp) we do not simply set a fixed function, but add a `QLineEdit` which allows to edit the function and redraws it, once ENTER is pressed:
|
In the example in [`test/simpletest_parsedfunctionplot/simpletest_parsedfunctionplot.cpp`](../simpletest_parsedfunctionplot/simpletest_parsedfunctionplot.cpp) we do not simply set a fixed function, but add a `QLineEdit` which allows to edit the function and redraws it, once ENTER is pressed:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQtPlotter* plot=new JKQtPlotter(&mainWin);
|
JKQTPLotter* plot=new JKQTPLotter(&mainWin);
|
||||||
QLineEdit* edit=new QLineEdit(&mainWin);
|
QLineEdit* edit=new QLineEdit(&mainWin);
|
||||||
edit->setToolTip("enter a function in dependence of the variable <tt>x</tt> and press ENTER to update the graph");
|
edit->setToolTip("enter a function in dependence of the variable <tt>x</tt> and press ENTER to update the graph");
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
|
|
||||||
|
|
||||||
// 2. now we add a JKQTPxParsedFunctionLineGraph object, which will draw the function from
|
// 2. now we add a JKQTPXParsedFunctionLineGraph object, which will draw the function from
|
||||||
// the line edit
|
// the line edit
|
||||||
JKQTPxParsedFunctionLineGraph* parsedFunc=new JKQTPxParsedFunctionLineGraph(plot);
|
JKQTPXParsedFunctionLineGraph* parsedFunc=new JKQTPXParsedFunctionLineGraph(plot);
|
||||||
plot->addGraph(parsedFunc);
|
plot->addGraph(parsedFunc);
|
||||||
// finally we connect the line edit with the graph, whenever RETURN is pressed,
|
// finally we connect the line edit with the graph, whenever RETURN is pressed,
|
||||||
// the graph is updated:
|
// the graph is updated:
|
||||||
@ -48,14 +48,14 @@ This code snippet results in a plot like this:
|
|||||||
As shown in [Plotting Mathematical Functions as Line Graphs](../simpletest_functionplot) you can also use externally set parameters in a plot function. These parameters can be double numbers and may be set with either as an internal parameter vector, or may be read from a parameter column (as shown in the [linked example](../simpletest_functionplot)). These parameters are available as variables `p1`, `p2`, ... in the function string. Here is a small example:
|
As shown in [Plotting Mathematical Functions as Line Graphs](../simpletest_functionplot) you can also use externally set parameters in a plot function. These parameters can be double numbers and may be set with either as an internal parameter vector, or may be read from a parameter column (as shown in the [linked example](../simpletest_functionplot)). These parameters are available as variables `p1`, `p2`, ... in the function string. Here is a small example:
|
||||||
|
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPxParsedFunctionLineGraph* parsedFunc=new JKQTPxParsedFunctionLineGraph(plot);
|
JKQTPXParsedFunctionLineGraph* parsedFunc=new JKQTPXParsedFunctionLineGraph(plot);
|
||||||
parsedFunc->set_function("sin(x*p1)*exp(-x/p2)");
|
parsedFunc->set_function("sin(x*p1)*exp(-x/p2)");
|
||||||
parsedFunc->set_paramV(/*p1=*/8, /*p2=*/4);
|
parsedFunc->set_paramV(/*p1=*/8, /*p2=*/4);
|
||||||
parsedFunc->set_title("user function");
|
parsedFunc->set_title("user function");
|
||||||
```
|
```
|
||||||
|
|
||||||
## Plot Function f(y)
|
## Plot Function f(y)
|
||||||
If you use the graph class `JKQTPyParsedFunctionLineGraph` instead of `JKQTPxParsedFunctionLineGraph`, you can plot functions `x=f(y)` (instead of `y=f(x)`). The function from the example above will then ahve to be changed to `sin(y*8)*exp(-y/4)` and the result will look like this:
|
If you use the graph class `JKQTPYParsedFunctionLineGraph` instead of `JKQTPXParsedFunctionLineGraph`, you can plot functions `x=f(y)` (instead of `y=f(x)`). The function from the example above will then ahve to be changed to `sin(y*8)*exp(-y/4)` and the result will look like this:
|
||||||
|
|
||||||
![jkqtplotter_simpletest_parsedfunctionplot_fy](../../screenshots/jkqtplotter_simpletest_parsedfunctionplot_fy.png)
|
![jkqtplotter_simpletest_parsedfunctionplot_fy](../../screenshots/jkqtplotter_simpletest_parsedfunctionplot_fy.png)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_parsedfunctionplot.cpp
|
/** \example jkqtplotter_simpletest_parsedfunctionplot.cpp
|
||||||
* JKQtPlotter: Examples: Plotting Parsed Mathematical Functions as Line Graphs
|
* JKQTPLotter: Examples: Plotting Parsed Mathematical Functions as Line Graphs
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterParsedFunctionPlot
|
* \ref JKQTPLotterParsedFunctionPlot
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -20,7 +20,7 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a window that conatins a line-edit to edit a function
|
// 1. create a window that conatins a line-edit to edit a function
|
||||||
// and a JKQtPlotter to display the function, combine everything in a layout
|
// and a JKQTPLotter to display the function, combine everything in a layout
|
||||||
QWidget mainWin;
|
QWidget mainWin;
|
||||||
QLineEdit* edit=new QLineEdit(&mainWin);
|
QLineEdit* edit=new QLineEdit(&mainWin);
|
||||||
edit->setToolTip("enter a function in dependence of the variable <tt>x</tt> and press ENTER to update the graph");
|
edit->setToolTip("enter a function in dependence of the variable <tt>x</tt> and press ENTER to update the graph");
|
||||||
@ -33,7 +33,7 @@ int main(int argc, char* argv[])
|
|||||||
spinP2->setValue(4);
|
spinP2->setValue(4);
|
||||||
spinP2->setRange(-10000,10000);
|
spinP2->setRange(-10000,10000);
|
||||||
spinP2->setToolTip("enter a Value for parameter <tt>p1</tt> and press ENTER to update the graph");
|
spinP2->setToolTip("enter a Value for parameter <tt>p1</tt> and press ENTER to update the graph");
|
||||||
JKQtPlotter* plot=new JKQtPlotter(&mainWin);
|
JKQTPLotter* plot=new JKQTPLotter(&mainWin);
|
||||||
QFormLayout* flayout=new QFormLayout;
|
QFormLayout* flayout=new QFormLayout;
|
||||||
QVBoxLayout* layout=new QVBoxLayout;
|
QVBoxLayout* layout=new QVBoxLayout;
|
||||||
mainWin.setLayout(layout);
|
mainWin.setLayout(layout);
|
||||||
@ -44,9 +44,9 @@ int main(int argc, char* argv[])
|
|||||||
layout->addLayout(flayout);
|
layout->addLayout(flayout);
|
||||||
layout->addWidget(plot);
|
layout->addWidget(plot);
|
||||||
|
|
||||||
// 2. now we add a JKQTPxParsedFunctionLineGraph object, which will draw the function from
|
// 2. now we add a JKQTPXParsedFunctionLineGraph object, which will draw the function from
|
||||||
// the line edit
|
// the line edit
|
||||||
JKQTPxParsedFunctionLineGraph* parsedFunc=new JKQTPxParsedFunctionLineGraph(plot);
|
JKQTPXParsedFunctionLineGraph* parsedFunc=new JKQTPXParsedFunctionLineGraph(plot);
|
||||||
plot->addGraph(parsedFunc);
|
plot->addGraph(parsedFunc);
|
||||||
// finally we connect the line edit with the graph, whenever RETURN is pressed,
|
// finally we connect the line edit with the graph, whenever RETURN is pressed,
|
||||||
// the graph is updated:
|
// the graph is updated:
|
||||||
|
@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
TARGET = jkqtplotter_simpletest_parsedfunctionplot
|
TARGET = jkqtplotter_simpletest_parsedfunctionplot
|
||||||
|
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Example (JKQtPlotter): Simple RGB image plot, showing a 3-channel OpenCV cv::Mat {#JKQtPlotterImagePlotRGBOpenCV}
|
# Example (JKQTPLotter): Simple RGB image plot, showing a 3-channel OpenCV cv::Mat {#JKQTPLotterImagePlotRGBOpenCV}
|
||||||
This project (see `./examples/simpletest_imageplot_opencv/`) simply creates a JKQtPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is generated as an OpenCV cv::Mat image and then copied into a single column of the internal datasdtore (JKQTPMathImage could be directly used without the internal datastore).
|
This project (see `./examples/simpletest_imageplot_opencv/`) simply creates a JKQTPLotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is generated as an OpenCV cv::Mat image and then copied into a single column of the internal datasdtore (JKQTPMathImage could be directly used without the internal datastore).
|
||||||
To copy the data a special OpenCV Interface function `JKQTPcopyCvMatToColumn()` is used, that copies the data from a cv::Mat directly into a column.
|
To copy the data a special OpenCV Interface function `JKQTPCopyCvMatToColumn()` is used, that copies the data from a cv::Mat directly into a column.
|
||||||
|
|
||||||
The function `JKQTPcopyCvMatToColumn()` is available from the (non-default) header-only extension from `jkqtplotter/jkqtpopencvinterface.h`. This header provides facilities to interface JKQtPlotter with OPenCV.
|
The function `JKQTPCopyCvMatToColumn()` is available from the (non-default) header-only extension from `jkqtplotter/jkqtpopencvinterface.h`. This header provides facilities to interface JKQTPLotter with OPenCV.
|
||||||
|
|
||||||
The source code of the main application is (see [`jkqtplotter_simpletest_imageplot_opencv.cpp`](../simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp):
|
The source code of the main application is (see [`jkqtplotter_simpletest_imageplot_opencv.cpp`](../simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp):
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -20,14 +20,14 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
|
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
|
|
||||||
// 2. now we open a BMP-file and load it into an OpenCV cv::Mat
|
// 2. now we open a BMP-file and load it into an OpenCV cv::Mat
|
||||||
@ -35,12 +35,12 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// In this step the contents of each channel of the openCV cv::Mat is copied into a column
|
// In this step the contents of each channel of the openCV cv::Mat is copied into a column
|
||||||
// of the datastore in row-major order
|
// of the datastore in row-major order
|
||||||
size_t cPictureR=JKQTPcopyCvMatToColumn(ds, picture, "R-channel", 2);
|
size_t cPictureR=JKQTPCopyCvMatToColumn(ds, picture, "R-channel", 2);
|
||||||
size_t cPictureG=JKQTPcopyCvMatToColumn(ds, picture, "G-channel", 1);
|
size_t cPictureG=JKQTPCopyCvMatToColumn(ds, picture, "G-channel", 1);
|
||||||
size_t cPictureB=JKQTPcopyCvMatToColumn(ds, picture, "B-channel", 0);
|
size_t cPictureB=JKQTPCopyCvMatToColumn(ds, picture, "B-channel", 0);
|
||||||
|
|
||||||
|
|
||||||
// 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data
|
// 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data
|
||||||
@ -97,6 +97,6 @@ The result looks like this:
|
|||||||
|
|
||||||
![jkqtplotter_simpletest_imageplot](../../screenshots/jkqtplotter_simpletest_rgbimageplot_opencv.png)
|
![jkqtplotter_simpletest_imageplot](../../screenshots/jkqtplotter_simpletest_rgbimageplot_opencv.png)
|
||||||
|
|
||||||
The image is upside-down, because computer images use a coordinate system with 0 at the top-left (left-handed coordinate system) and the JKQtPlotter has its 0 at the bottom-left (right-handed coordinate system).
|
The image is upside-down, because computer images use a coordinate system with 0 at the top-left (left-handed coordinate system) and the JKQTPLotter has its 0 at the bottom-left (right-handed coordinate system).
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_rgbimageplot_opencv.cpp
|
/** \example jkqtplotter_simpletest_rgbimageplot_opencv.cpp
|
||||||
* JKQtPlotter: Examples: Simple RGB image plot, showing a 3-channel OpenCV cv::Mat
|
* JKQTPLotter: Examples: Simple RGB image plot, showing a 3-channel OpenCV cv::Mat
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterImagePlotRGBOpenCV
|
* \ref JKQTPLotterImagePlotRGBOpenCV
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -18,14 +18,14 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
|
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
|
|
||||||
// 2. now we open a BMP-file and load it into an OpenCV cv::Mat
|
// 2. now we open a BMP-file and load it into an OpenCV cv::Mat
|
||||||
@ -33,12 +33,12 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// In this step the contents of each channel of the openCV cv::Mat is copied into a column
|
// In this step the contents of each channel of the openCV cv::Mat is copied into a column
|
||||||
// of the datastore in row-major order
|
// of the datastore in row-major order
|
||||||
size_t cPictureR=JKQTPcopyCvMatToColumn(ds, picture, "R-channel", 2);
|
size_t cPictureR=JKQTPCopyCvMatToColumn(ds, picture, "R-channel", 2);
|
||||||
size_t cPictureG=JKQTPcopyCvMatToColumn(ds, picture, "G-channel", 1);
|
size_t cPictureG=JKQTPCopyCvMatToColumn(ds, picture, "G-channel", 1);
|
||||||
size_t cPictureB=JKQTPcopyCvMatToColumn(ds, picture, "B-channel", 0);
|
size_t cPictureB=JKQTPCopyCvMatToColumn(ds, picture, "B-channel", 0);
|
||||||
|
|
||||||
|
|
||||||
// 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data
|
// 4. create a graph (JKQTPColumnRGBMathImage) with the columns created above as data
|
||||||
|
@ -9,7 +9,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_rgbimageplot_opencv
|
TARGET = jkqtplotter_simpletest_rgbimageplot_opencv
|
||||||
|
|
||||||
# add OpenCV-interface to JKQTPdatastore
|
# add OpenCV-interface to JKQTPDatastore
|
||||||
DEFINES += JKQTPLOTTER_OPENCV_INTERFACE
|
DEFINES += JKQTPLOTTER_OPENCV_INTERFACE
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): QImage as a Graph {#JKQtPlotterImagePlotQImageRGB}
|
# Example (JKQTPLotter): QImage as a Graph {#JKQTPLotterImagePlotQImageRGB}
|
||||||
This project (see `./examples/simpletest_rgbimageplot_qt/`) simply creates a JKQtPlotter widget (as a new window) and adds an image plot with an image taken from a [QImage](http://doc.qt.io/qt-5/qimage.html) object.
|
This project (see `./examples/simpletest_rgbimageplot_qt/`) simply creates a JKQTPLotter widget (as a new window) and adds an image plot with an image taken from a [QImage](http://doc.qt.io/qt-5/qimage.html) object.
|
||||||
|
|
||||||
The source code of the main application is (see [`jkqtplotter_simpletest_rgbimageplot_qt.cpp`](../simpletest_rgbimageplot_qt/jkqtplotter_simpletest_rgbimageplot_qt.cpp). the main parts are:
|
The source code of the main application is (see [`jkqtplotter_simpletest_rgbimageplot_qt.cpp`](../simpletest_rgbimageplot_qt/jkqtplotter_simpletest_rgbimageplot_qt.cpp). the main parts are:
|
||||||
```.cpp
|
```.cpp
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example jkqtplotter_simpletest_rgbimageplot_qt.cpp
|
/** \example jkqtplotter_simpletest_rgbimageplot_qt.cpp
|
||||||
* JKQtPlotter: Examples: `QImage` as a Graph
|
* JKQTPLotter: Examples: `QImage` as a Graph
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterImagePlotQImageRGB
|
* \ref JKQTPLotterImagePlotQImageRGB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -16,7 +16,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
|
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
|
@ -12,7 +12,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_rgbimageplot_qt
|
TARGET = jkqtplotter_simpletest_rgbimageplot_qt
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
# Example (JKQtPlotter): Simple line-graph with live-data (speed test) {#JKQtPlotterSpeedTest}
|
# Example (JKQTPLotter): Simple line-graph with live-data (speed test) {#JKQTPLotterSpeedTest}
|
||||||
This project (see `./examples/simpletest_speed/`) simply creates a JKQtPlotter widget (as a new window) and adds two line-graph (a sine and a cosine wave).
|
This project (see `./examples/simpletest_speed/`) simply creates a JKQTPLotter widget (as a new window) and adds two line-graph (a sine and a cosine wave).
|
||||||
Data is stored in two [`std::array<double, NDATA>`](https://en.cppreference.com/w/cpp/container/array) objects (`X`, `Y`, and `Y2`) and the data is added as external pointer to the datastore:
|
Data is stored in two [`std::array<double, NDATA>`](https://en.cppreference.com/w/cpp/container/array) objects (`X`, `Y`, and `Y2`) and the data is added as external pointer to the datastore:
|
||||||
```.cpp
|
```.cpp
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// Here the data from the std::array's is not copied, but only the pointer to
|
// Here the data from the std::array's is not copied, but only the pointer to
|
||||||
// the array is added to the datastore. therefore the datastore does not manage
|
// the array is added to the datastore. therefore the datastore does not manage
|
||||||
// the memory, oly uses the data stored in it!
|
// the memory, oly uses the data stored in it!
|
||||||
JKQTPdatastore* ds=getDatastore();
|
JKQTPDatastore* ds=getDatastore();
|
||||||
size_t columnX=ds->addColumn(X.data(), X.size(), "x");
|
size_t columnX=ds->addColumn(X.data(), X.size(), "x");
|
||||||
size_t columnY=ds->addColumn(Y.data(), Y.size(), "y");
|
size_t columnY=ds->addColumn(Y.data(), Y.size(), "y");
|
||||||
size_t columnY2=ds->addColumn(Y2.data(), Y2.size(), "y2");
|
size_t columnY2=ds->addColumn(Y2.data(), Y2.size(), "y2");
|
||||||
@ -54,7 +54,7 @@ The result looks like this:
|
|||||||
![jkqtplotter_simpletest_speed1](../../screenshots/jkqtplotter_simpletest_speed.png)
|
![jkqtplotter_simpletest_speed1](../../screenshots/jkqtplotter_simpletest_speed.png)
|
||||||
|
|
||||||
There are different facor affecting the replot speed:
|
There are different facor affecting the replot speed:
|
||||||
1. *Anti-Aliasing:* If `JKQtPlotter` uses Anti-Aliasing for plotting, the plots are much nicer, but also about a factor of 3-4 slower. This is due to the increased amount of calculations, necessary in the drawing sub-system of Qt.
|
1. *Anti-Aliasing:* If `JKQTPLotter` uses Anti-Aliasing for plotting, the plots are much nicer, but also about a factor of 3-4 slower. This is due to the increased amount of calculations, necessary in the drawing sub-system of Qt.
|
||||||
You can configrue anti-aliasing with these calls:
|
You can configrue anti-aliasing with these calls:
|
||||||
```.cpp
|
```.cpp
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(false);
|
plot.get_plotter()->set_useAntiAliasingForGraphs(false);
|
||||||
|
@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
|||||||
# output executable name
|
# output executable name
|
||||||
TARGET = jkqtplotter_simpletest_speed
|
TARGET = jkqtplotter_simpletest_speed
|
||||||
|
|
||||||
# include JKQtPlotter source code
|
# include JKQTPLotter source code
|
||||||
DEPENDPATH += . ../../lib
|
DEPENDPATH += . ../../lib
|
||||||
INCLUDEPATH += ../../lib
|
INCLUDEPATH += ../../lib
|
||||||
CONFIG (debug, debug|release) {
|
CONFIG (debug, debug|release) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** \example speedtestplot.cpp
|
/** \example speedtestplot.cpp
|
||||||
* JKQtPlotter: Examples: Simple line-graph with live-data (speed test)
|
* JKQTPLotter: Examples: Simple line-graph with live-data (speed test)
|
||||||
*
|
*
|
||||||
* \ref JKQtPlotterSpeedTest
|
* \ref JKQTPLotterSpeedTest
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "speedtestplot.h"
|
#include "speedtestplot.h"
|
||||||
@ -9,10 +9,10 @@
|
|||||||
|
|
||||||
|
|
||||||
SpeedTestPlot::SpeedTestPlot():
|
SpeedTestPlot::SpeedTestPlot():
|
||||||
JKQtPlotter(), dx(1.0/double(NDATA)*4.0*M_PI), x0(0)
|
JKQTPLotter(), dx(1.0/double(NDATA)*4.0*M_PI), x0(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
// 1. optimize JKQtPlotter for speed (by switching off anti-aliasing)
|
// 1. optimize JKQTPLotter for speed (by switching off anti-aliasing)
|
||||||
get_plotter()->set_useAntiAliasingForGraphs(false);
|
get_plotter()->set_useAntiAliasingForGraphs(false);
|
||||||
get_plotter()->set_useAntiAliasingForSystem(false);
|
get_plotter()->set_useAntiAliasingForSystem(false);
|
||||||
get_plotter()->set_useAntiAliasingForText(false);
|
get_plotter()->set_useAntiAliasingForText(false);
|
||||||
@ -26,24 +26,24 @@ SpeedTestPlot::SpeedTestPlot():
|
|||||||
Y2[i]=cos(x)+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
Y2[i]=cos(x)+static_cast<double>(std::rand())/static_cast<double>(RAND_MAX + 1u)-0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// Here the data from the std::array's is not copied, but only the pointer to
|
// Here the data from the std::array's is not copied, but only the pointer to
|
||||||
// the array is added to the datastore. therefore the datastore does not manage
|
// the array is added to the datastore. therefore the datastore does not manage
|
||||||
// the memory, oly uses the data stored in it!
|
// the memory, oly uses the data stored in it!
|
||||||
JKQTPdatastore* ds=getDatastore();
|
JKQTPDatastore* ds=getDatastore();
|
||||||
size_t columnX=ds->addColumn(X.data(), X.size(), "x");
|
size_t columnX=ds->addColumn(X.data(), X.size(), "x");
|
||||||
size_t columnY=ds->addColumn(Y.data(), Y.size(), "y");
|
size_t columnY=ds->addColumn(Y.data(), Y.size(), "y");
|
||||||
size_t columnY2=ds->addColumn(Y2.data(), Y2.size(), "y2");
|
size_t columnY2=ds->addColumn(Y2.data(), Y2.size(), "y2");
|
||||||
|
|
||||||
// 4. create two graphs in the plot, which plots the dataset X/Y:
|
// 4. create two graphs in the plot, which plots the dataset X/Y:
|
||||||
JKQTPxyLineGraph* graph=new JKQTPxyLineGraph(this);
|
JKQTPXYLineGraph* graph=new JKQTPXYLineGraph(this);
|
||||||
graph->set_xColumn(columnX);
|
graph->set_xColumn(columnX);
|
||||||
graph->set_yColumn(columnY);
|
graph->set_yColumn(columnY);
|
||||||
graph->set_title(QObject::tr("live sin() graph"));
|
graph->set_title(QObject::tr("live sin() graph"));
|
||||||
graph->set_lineWidth(1);
|
graph->set_lineWidth(1);
|
||||||
addGraph(graph);
|
addGraph(graph);
|
||||||
|
|
||||||
JKQTPxyLineGraph* graph2=new JKQTPxyLineGraph(this);
|
JKQTPXYLineGraph* graph2=new JKQTPXYLineGraph(this);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->set_xColumn(columnX);
|
||||||
graph2->set_yColumn(columnY2);
|
graph2->set_yColumn(columnY2);
|
||||||
graph2->set_title(QObject::tr("live cos() graph"));
|
graph2->set_title(QObject::tr("live cos() graph"));
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#define NDATA 500
|
#define NDATA 500
|
||||||
|
|
||||||
class SpeedTestPlot: public JKQtPlotter {
|
class SpeedTestPlot: public JKQTPLotter {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
protected:
|
protected:
|
||||||
std::array<double, NDATA> X, Y, Y2;
|
std::array<double, NDATA> X, Y, Y2;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQtPlotter): Simple stacked barchart {#JKQtPlotterStackedBarChart}
|
# Example (JKQTPLotter): Simple stacked barchart {#JKQTPLotterStackedBarChart}
|
||||||
This project (see `./examples/simpletest_stackedbars/`) simply creates a JKQtPlotter widget (as a new window) and adds several stacked barcharts.
|
This project (see `./examples/simpletest_stackedbars/`) simply creates a JKQTPLotter widget (as a new window) and adds several stacked barcharts.
|
||||||
|
|
||||||
The soruce code of the main application is (see [`jkqtplotter_simpletest_stackedbars.cpp`](../simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp):
|
The soruce code of the main application is (see [`jkqtplotter_simpletest_stackedbars.cpp`](../simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp):
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -13,11 +13,11 @@ int main(int argc, char* argv[])
|
|||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||||
JKQtPlotter plot;
|
JKQTPLotter plot;
|
||||||
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForGraphs(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
plot.get_plotter()->set_useAntiAliasingForSystem(true); // nicer (but slower) plotting
|
||||||
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
plot.get_plotter()->set_useAntiAliasingForText(true); // nicer (but slower) text rendering
|
||||||
JKQTPdatastore* ds=plot.getDatastore();
|
JKQTPDatastore* ds=plot.getDatastore();
|
||||||
|
|
||||||
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
// 2. now we create data for the charts (taken from https://commons.wikimedia.org/wiki/File:Energiemix_Deutschland.svg)
|
||||||
QVector<double> year, percentage_other, percentage_coaloil, percentage_gas, percentage_nuclear, percentage_green;
|
QVector<double> year, percentage_other, percentage_coaloil, percentage_gas, percentage_nuclear, percentage_green;
|
||||||
@ -29,7 +29,7 @@ int main(int argc, char* argv[])
|
|||||||
percentage_green << 3.6 << 4.4 << 6.2 << 9.5 << 15.8 << 28.1;
|
percentage_green << 3.6 << 4.4 << 6.2 << 9.5 << 15.8 << 28.1;
|
||||||
|
|
||||||
|
|
||||||
// 3. make data available to JKQtPlotter by adding it to the internal datastore.
|
// 3. make data available to JKQTPLotter by adding it to the internal datastore.
|
||||||
// Note: In this step the data is copied (of not specified otherwise)
|
// Note: In this step the data is copied (of not specified otherwise)
|
||||||
// the variables cYear, cOther ... will contain the internal column ID of the
|
// the variables cYear, cOther ... will contain the internal column ID of the
|
||||||
// newly created columns with names "year" and "other" ... and the (copied) data
|
// newly created columns with names "year" and "other" ... and the (copied) data
|
||||||
@ -44,31 +44,31 @@ int main(int argc, char* argv[])
|
|||||||
// The color of the graphs is set by calling set_fillColor_and_darkenedColor(), which sets the
|
// The color of the graphs is set by calling set_fillColor_and_darkenedColor(), which sets the
|
||||||
// fillColor to the given color and makes the outline of the bars (i.e. their "color") a darker
|
// fillColor to the given color and makes the outline of the bars (i.e. their "color") a darker
|
||||||
// shade of the given color.
|
// shade of the given color.
|
||||||
QVector<JKQTPbarVerticalStackableGraph*> graphs;
|
QVector<JKQTPBarVerticalStackableGraph*> graphs;
|
||||||
graphs.push_back(new JKQTPbarVerticalStackableGraph(&plot));
|
graphs.push_back(new JKQTPBarVerticalStackableGraph(&plot));
|
||||||
graphs.back()->set_xColumn(cYear);
|
graphs.back()->set_xColumn(cYear);
|
||||||
graphs.back()->set_yColumn(cOther);
|
graphs.back()->set_yColumn(cOther);
|
||||||
graphs.back()->set_title(QObject::tr("other sources"));
|
graphs.back()->set_title(QObject::tr("other sources"));
|
||||||
graphs.back()->set_fillColor_and_darkenedColor(QColor("red"));
|
graphs.back()->set_fillColor_and_darkenedColor(QColor("red"));
|
||||||
graphs.push_back(new JKQTPbarVerticalStackableGraph(&plot));
|
graphs.push_back(new JKQTPBarVerticalStackableGraph(&plot));
|
||||||
graphs.back()->set_xColumn(cYear);
|
graphs.back()->set_xColumn(cYear);
|
||||||
graphs.back()->set_yColumn(cCoalOil);
|
graphs.back()->set_yColumn(cCoalOil);
|
||||||
graphs.back()->set_title(QObject::tr("coal & oil"));
|
graphs.back()->set_title(QObject::tr("coal & oil"));
|
||||||
graphs.back()->set_fillColor_and_darkenedColor(QColor("darkgrey"));
|
graphs.back()->set_fillColor_and_darkenedColor(QColor("darkgrey"));
|
||||||
graphs.back()->stackUpon(graphs[graphs.size()-2]);
|
graphs.back()->stackUpon(graphs[graphs.size()-2]);
|
||||||
graphs.push_back(new JKQTPbarVerticalStackableGraph(&plot));
|
graphs.push_back(new JKQTPBarVerticalStackableGraph(&plot));
|
||||||
graphs.back()->set_xColumn(cYear);
|
graphs.back()->set_xColumn(cYear);
|
||||||
graphs.back()->set_yColumn(cGas);
|
graphs.back()->set_yColumn(cGas);
|
||||||
graphs.back()->set_title(QObject::tr("natural gas"));
|
graphs.back()->set_title(QObject::tr("natural gas"));
|
||||||
graphs.back()->set_fillColor_and_darkenedColor(QColor("blue"));
|
graphs.back()->set_fillColor_and_darkenedColor(QColor("blue"));
|
||||||
graphs.back()->stackUpon(graphs[graphs.size()-2]);
|
graphs.back()->stackUpon(graphs[graphs.size()-2]);
|
||||||
graphs.push_back(new JKQTPbarVerticalStackableGraph(&plot));
|
graphs.push_back(new JKQTPBarVerticalStackableGraph(&plot));
|
||||||
graphs.back()->set_xColumn(cYear);
|
graphs.back()->set_xColumn(cYear);
|
||||||
graphs.back()->set_yColumn(cNuclear);
|
graphs.back()->set_yColumn(cNuclear);
|
||||||
graphs.back()->set_title(QObject::tr("nuclear energy"));
|
graphs.back()->set_title(QObject::tr("nuclear energy"));
|
||||||
graphs.back()->set_fillColor_and_darkenedColor(QColor("gold"));
|
graphs.back()->set_fillColor_and_darkenedColor(QColor("gold"));
|
||||||
graphs.back()->stackUpon(graphs[graphs.size()-2]);
|
graphs.back()->stackUpon(graphs[graphs.size()-2]);
|
||||||
graphs.push_back(new JKQTPbarVerticalStackableGraph(&plot));
|
graphs.push_back(new JKQTPBarVerticalStackableGraph(&plot));
|
||||||
graphs.back()->set_xColumn(cYear);
|
graphs.back()->set_xColumn(cYear);
|
||||||
graphs.back()->set_yColumn(cGreen);
|
graphs.back()->set_yColumn(cGreen);
|
||||||
graphs.back()->set_title(QObject::tr("green energy"));
|
graphs.back()->set_title(QObject::tr("green energy"));
|
||||||
@ -89,8 +89,8 @@ int main(int argc, char* argv[])
|
|||||||
// type JKQTBasePlotter, which does the actual plotting.
|
// type JKQTBasePlotter, which does the actual plotting.
|
||||||
// So many properties of the plot are only available in this internal
|
// So many properties of the plot are only available in this internal
|
||||||
// object, which you can access by plot.get_plotter().
|
// object, which you can access by plot.get_plotter().
|
||||||
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideTopRight);
|
plot.get_plotter()->set_keyPosition(JKQTPKeyOutsideTopRight);
|
||||||
plot.get_plotter()->set_keyLayout(JKQTPkeyLayoutOneRow);
|
plot.get_plotter()->set_keyLayout(JKQTPKeyLayoutOneRow);
|
||||||
|
|
||||||
// 8 autoscale the plot so the graph is contained
|
// 8 autoscale the plot so the graph is contained
|
||||||
plot.zoomToFit();
|
plot.zoomToFit();
|
||||||
@ -104,8 +104,8 @@ int main(int argc, char* argv[])
|
|||||||
```
|
```
|
||||||
The result looks like this:
|
The result looks like this:
|
||||||
|
|
||||||
![JKQTPbarVerticalGraphStacked](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPbarVerticalGraphStacked.png)
|
![JKQTPBarVerticalGraphStacked](https://raw.githubusercontent.com/jkriege2/JKQTPLotter/master/doc/images/JKQTPBarVerticalGraphStacked.png)
|
||||||
|
|
||||||
If you use `JKQTPbarHorizontalGraphStacked` instead of `JKQTPbarVerticalStackableGraph`, you'll get a result like this:
|
If you use `JKQTPBarHorizontalGraphStacked` instead of `JKQTPBarVerticalStackableGraph`, you'll get a result like this:
|
||||||
![JKQTPbarHorizontalGraphStacked](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPbarHorizontalGraphStacked.png)
|
![JKQTPBarHorizontalGraphStacked](https://raw.githubusercontent.com/jkriege2/JKQTPLotter/master/doc/images/JKQTPBarHorizontalGraphStacked.png)
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user