cleaned/improved doc further

This commit is contained in:
jkriege2 2019-01-19 09:40:52 +01:00
parent 3a346cd4b4
commit 7adc6c8b82
60 changed files with 1068 additions and 210 deletions

1
.gitignore vendored
View File

@ -88,3 +88,4 @@ Thumbs.db
.qmake.stash
moc_predefs.h
/lib/jkqtplotter/*.TMP
/doc/doxygen_log.txt

View File

@ -44,7 +44,7 @@ PROJECT_NUMBER =
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF =
PROJECT_BRIEF = "an extensive Qt4/Qt5 Plotter framework (including a fast variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies"
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
@ -68,7 +68,7 @@ OUTPUT_DIRECTORY = ./
# performance problems for the file system.
# The default value is: NO.
CREATE_SUBDIRS = NO
CREATE_SUBDIRS = YES
# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
# characters to appear in the names of generated files. If set to NO, non-ASCII
@ -186,7 +186,7 @@ STRIP_FROM_INC_PATH =
# support long names like on DOS, Mac, or CD-ROM.
# The default value is: NO.
SHORT_NAMES = NO
SHORT_NAMES = YES
# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
# first line (until the first dot) of a Javadoc-style comment as the brief
@ -332,7 +332,7 @@ MARKDOWN_SUPPORT = YES
# Minimum value: 0, maximum value: 99, default value: 0.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 0
TOC_INCLUDE_HEADINGS = 3
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
@ -389,7 +389,7 @@ DISTRIBUTE_GROUP_DOC = NO
# is disabled and one has to add nested compounds explicitly via \ingroup.
# The default value is: NO.
GROUP_NESTED_COMPOUNDS = NO
GROUP_NESTED_COMPOUNDS = YES
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
# (for instance a group of public functions) to be put as a subgroup of that
@ -537,7 +537,7 @@ HIDE_IN_BODY_DOCS = NO
# will be excluded. Set it to YES to include the internal documentation.
# The default value is: NO.
INTERNAL_DOCS = NO
INTERNAL_DOCS = YES
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
# names in lower-case letters. If set to YES, upper-case letters are also
@ -866,11 +866,11 @@ FILE_PATTERNS = *.d \
*.f \
*.vhd \
*.vhdl \
*.md \
*.qrc \
*.pro \
*.ui \
*.pri
*.pri \
*.md
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
@ -896,6 +896,9 @@ EXCLUDE = moc_*.* \
../examples/jkqtplot_test/QTeXEngine \
html \
../lib/README.md \
html/* \
*/html/* \
*/html/* \
../examples/README.md
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
@ -912,7 +915,8 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS = */build-*
EXCLUDE_PATTERNS = */build-* \
*/html/*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@ -1299,7 +1303,7 @@ HTML_DYNAMIC_MENUS = YES
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_DYNAMIC_SECTIONS = YES
HTML_DYNAMIC_SECTIONS = NO
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
# shown in the various tree structured indices initially; the user can expand
@ -2472,7 +2476,7 @@ INTERACTIVE_SVG = NO
# found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_PATH =
DOT_PATH = "C:\Program Files (x86)\Graphviz2.38\bin"
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile

View File

@ -0,0 +1,129 @@
/*!
\page exampleTutorialProjects Example & Tutorial Projects
This section assembles some simple examples of usage.
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.
\section jkqtp_extut Overview of Examples&Tutorials
\subsection jkqtp_extut_plotstyles Different Plot Data Styles
<table>
<tr><th>Screenshot<th>Description<th>Notes
<tr><td> \image html jkqtplotter_simpletest1_small.png
<td> \subpage JKQTPlotterSimpleTest
<td> `JKQTPxyLineGraph` <br> C++-style QVector arrays of data
<tr><td> \image html jkqtplotter_simpletest_speed_small.png
<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
<tr><td> \image html jkqtplotter_simpletest_symbols_and_styles_small.png
<td> \subpage JKQtPlotterSymbolsAndStyles
<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
<td> \subpage JKQtPlotterStepPlot
<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
<td> \subpage JKQtPlotterSymbolsErrors
<td> `JKQTPxyLineErrorGraph` <br> C-style arrays of data
<tr><td> \image html jkqtplotter_simpletest_errorbarstyles_small.png
<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
<tr><td> \image html jkqtplotter_simpletest_barchart_small.png
<td> \subpage JKQtPlotterBarcharts
<td> `JKQTPbarVerticalGraph` <br> C-style arrays of data
<tr><td> \image html JKQTPbarHorizontalGraphStacked_small.png
<td> \subpage JKQtPlotterStackedBarChart
<td> `JKQTPbarVerticalStackableGraph`, `JKQTPbarHorizontalStackableGraph` <br> C++-style vectors of data
<tr><td> \image html jkqtplotter_simpletest_filledgraphs_small.png
<td> \subpage JKQtPlotterFilledGraphs
<td> `JKQTPbarVerticalGraph` <br> setting/altering data in `JKQTPdatstore` directly <br> transparent plots <br> calculating histograms
<tr><td> \image html jkqtplotter_simpletest_impulsesplot_small.png
<td> \subpage JKQtPlotterImpulsePlots
<td> `JKQTPimpulsesVerticalGraph` and `JKQTPimpulsesHorizontalGraph` <br> C++-style QVector as plot data
<tr><td> \image html jkqtplotter_simpletest_paramscatterplot_small.png
<td> \subpage JKQtPlotterParamScatter
<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
<td> \subpage JKQtPlotterParamScatterImage
<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
<td> \subpage JKQtPlotterParametricCurves
<td> `JKQTPxyLineGraph` and `JKQTPxyParametrizedScatterGraph` <br> C++-style QVector as plot data <br> parametric curve plotting
<tr><td> \image html jkqtplotter_simpletest_functionplot_small.png
<td> \subpage JKQtPlotterFunctionPlots
<td> `JKQTPxFunctionLineGraph` <br> diretly plotting C/C++-functions
<tr><td> \image html jkqtplotter_simpletest_parsedfunctionplot_small.png
<td> \subpage JKQtPlotterParsedFunctionPlot
<td> `JKQTPxParsedFunctionLineGraph` <br> plotting functions with the internal math equation parser/evaluator
<tr><td> \image html jkqtplotter_simpletest_geometric_small.png
<td> \subpage JKQtPlotterGeometricGraphs
<td> `JKQTPplotObject`, `JKQTPgeoArc`, `JKQTPgeoLine`, `JKQTPgeoRectangle`, ...
</table>
\subsection jkqtp_extut_keyaxesstyles Styling the Plot, Keys, Axes, ...
<table>
<tr><th> Screenshot <th> Description <th> Notes
<tr><td> \image html jkqtplotter_simpletest_logaxes_small.png
<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
<tr><td> \image html jkqtplotter_simpletest_dateaxes_timeaxis_small.png
<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
</table>
\subsection jkqtp_extut_plotimagedata Image data Plots
<table>
<tr><th> Screenshot <th> Description <th> Notes
<tr><td> \image html jkqtplotter_simpletest_rgbimageplot_qt_small.png
<td> \subpage JKQtPlotterImagePlotQImageRGB
<td> `JKQTPImage` <br> `QImage` drawn onto a plot with arbitrary scaling)
<tr><td> \image html jkqtplotter_simpletest_imageplot_small.png
<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.)
<tr><td> \image html jkqtplotter_simpletest_imageplot_modifier_small.png
<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
<tr><td> \image html jkqtplotter_simpletest_imageplot_nodatastore_small.png
<td> \subpage JKQtPlotterImagePlotNoDatastore
<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
<td> \subpage JKQtPlotterImagePlotOpenCV
<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
<td> \subpage JKQtPlotterImagePlotRGBOpenCV
<td> `JKQTPColumnRGBMathImage` <br> image data copied from OpenCV cv::Mat-structure into three columns of the internal datastore
</table>
\subsection jkqtp_extut_guitoolslayout GUI Tools and Plot Layout
<table>
<tr><th> Screenshot <th> Description <th> Notes
<tr><td> \image html test_multiplot_small.png
<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
<tr><td> \image html jkqtplotter_simpletest_ui_small.png
<td> \subpage JKQtPlotterQtCreator
<td> using Qt Form Designer <br> parsed function plots (`JKQTPxParsedFunctionLineGraph`) </table>
</table>
\subsection jkqtp_extut_specialfeatures Tools and Special Features
<table>
<tr><th> Screenshot <th> Description <th> Notes
<tr><td> \image html jkqtmathtext_simpletest_small.png
<td> \subpage JKQTmathTextSimpleExample
<td> JKQTMathText<br>render LaTeX markup (Schrödinger's equation)
</table>
*/

View File

@ -4,12 +4,12 @@
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,
except Qt.
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!
Examples for the usage of this class can be found here:
- \ref JKQTmathTextSimpleExample with the main source: \link ../../examples/jkqtmathtext_simpletest/jkqtmathtext_simpletest.cpp \endlink
- \link ../../examples/jkqtmathtext_test/jkqtfastplotter_test_testmain.cpp \endlink
- \ref JKQTmathTextSimpleExample
.

View File

@ -29,7 +29,7 @@ C++ standard library.
\defgroup jkqtplotter JKQtPlotter: Qt based Scientific Plotter Class
A Qt based plotter for 2D scientific graphs.
A Qt based plotter for 2D scientific graphs. Main Plotting widget is JKQtPlotter.
\defgroup jkqtpdatastorage Data Storage Classes/System
@ -46,54 +46,77 @@ classes.
Classes and functions in this group allow JKQtPlotter to directly work with <a href="https://opencv.org/">OpenCV</a> data structures.
Examples:
- \ref JKQtPlotterImagePlotOpenCV
- \ref JKQtPlotterImagePlotRGBOpenCV
.
\defgroup jkqtpbaseplotter Plotter Base Class
\defgroup jkqtpplotterclasses Plotter Class & Plotter Widget
\ingroup jkqtplotter
This class implements the basis for plotter classes. It contains layout management code,
coordinate system management ... Use JKQPlotter if you need a widget
This group contains the actual plotter classes, that implement layout management code,
coordinate system management an actual plotter widget ...
\defgroup jkqtpbaseplotter_elements Basic Plot Elements (coordinate axes, key, ...)
\ingroup jkqtplotter
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
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.
- 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
\ingroup jkqtplotter
This group assembles all classes that represent different elements of a plot (managed by JKQtBasePlotter/JKQtPlotter).
There are these major subgroups:
- \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_overlays contains classes for overlay elements (lines, marker ...) that can be drawn quickly on top of a plot
.
\defgroup jkqtpbaseplotter_elements Basic (non-graph) Plot Elements (coordinate axes, ...)
\ingroup jkqtplotter_elements
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
\defgroup jkqtplotter_graphsgroup Graph Classes
\ingroup jkqtplotter_elements
\defgroup jkqtplotter_basegraphs Baseclasses for Graphs
\ingroup jkqtplotter_elements
\ingroup jkqtplotter_graphsgroup
\defgroup jkqtplotter_basegraphserrors Base Classes for Error Indicators
\ingroup jkqtplotter_basegraphs
\defgroup jkqtplotter_linesymbolgraphs Line/Symbol Graphs
\ingroup jkqtplotter_elements
\ingroup jkqtplotter_graphsgroup
\defgroup jkqtplotter_Fgraphs Function Graphs
\defgroup jkqtplotter_functiongraphs Function Graphs
\ingroup jkqtplotter_linesymbolgraphs
\defgroup jkqtplotter_parsedFgraphs Parsed Function Graphs
\ingroup jkqtplotter_linesymbolgraphs
\defgroup jkqtplotter_barssticks Barcharts, Stick-Charts, ...
\ingroup jkqtplotter_elements
\ingroup jkqtplotter_graphsgroup
\defgroup jkqtplotter_statgraphs Statistical Graphs (e.g. Boxplots ...)
\ingroup jkqtplotter_elements
\ingroup jkqtplotter_graphsgroup
\defgroup jkqtplotter_geoplots Geometric Elements (Lines, Rectangles, ...)
\ingroup jkqtplotter_elements
\ingroup jkqtplotter_graphsgroup
Examples:
- \ref JKQtPlotterGeometricGraphs
.
\defgroup jkqtplotter_diverse Diverse Other Graphs (Ranges, ...)
\ingroup jkqtplotter_elements
\ingroup jkqtplotter_graphsgroup
\defgroup jkqtplotter_imagelots Matrix/Image Plotting
\ingroup jkqtplotter_elements
\ingroup jkqtplotter_graphsgroup
\defgroup jkqtplotter_imagelots_elements Image Plotting Graphs
\ingroup jkqtplotter_imagelots
@ -110,15 +133,20 @@ These classes are used by JKQtPlotterBase to output the plot
\defgroup jkqtpgraphsmodel Data Models to Access Graphs in a JKQtBasePlotter/JKQtPlotter
\defgroup jkqtpqtwidgetsttools Qt Widgets/Tools to work with 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 ...)
\defgroup jkqtpgraphsmodel Qt Data Models to Access Graphs in a JKQtBasePlotter/JKQtPlotter
\ingroup jkqtpqtwidgetsttools
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
\ingroup jkqtplotter
\defgroup jkqtplotter_guitools Qt GUI classes to work with JKQtPlotter
\ingroup jkqtplotter
\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 ).

516
doc/dox/license.dox Normal file
View File

@ -0,0 +1,516 @@
/*!
\page licensesec License Terms (LGPL >= 2.1)
This software is licensed under the term of the <a href="https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html">GNU Lesser General Public License 2.1
(LGPL 2.1)</a> or above.
\verbatim
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
(This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.)
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.
{signature of Ty Coon}, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
\endverbatim
*/

57
doc/dox/mainpage.dox Normal file
View File

@ -0,0 +1,57 @@
/*!
\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 software is licensed under the term of the GNU Lesser General Public License 2.1
(LGPL 2.1) or above. See \ref licensesec for details.
\image html examplesbanner.png
\section jkqtp_main_features Main Features
- Extensive Scientific 2D Plotting framework (JKQtPlotter/JKQtBasePlotter)
- high-quality plotting
- no other dependencies than Qt >=4.7 (compatible with Qt 5.xx)
- highly customizable axes/grids (linear/log, date/time, custom ticks ...)
- 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, ...)
- full print and export (PDF,PNG,...) support with preview and parametrization out-the-box
- highly customizable look and feel
- supports the Qt layout system for graphs and allows to symchronize several graphs with each other
- centralized data management in an internal datastore:
- data organized by columns, can also represent image data (ropw-major)
- allows to reuse a column in several graphs
- access via Qt's model view framework
- external or internal datasets
- complete with GUI (table view)
- built-in export capabilities for datatables (e.g. to CSV, SYLK, ...)
- large variety of graphs that can be added to a plot, e.g.:
- scatter-plots (also parametrized color/size/symbol by a third data-column)
- line graphs, step graphs, impulses
- filled curves
- barcharts (also stacked)
- extensive support for different styles of error indicators
- integrated mathematical function parser for function plots (with intelligent rendering algorithm)
- line/scatter graphs can also be based on C/C++ functions instead of data series (C++11 support!)
- statistical plots (e.g. boxplots)
- extensive library of image plots (inclusing different color-scale modes, RGBA-plots, overlays/masks)
- contour plots
- geometric forms/annotations, see: \ref jkqtplotter_geoplots
- can be easily extended by deriving a new graph from JKQTPplotElement or JKQTPplotObject
- optional: OpenCV interface, see: \ref jkqtpopencvinterface
- integrated LaTeX parser/renderer JKQtMathText:
- pure C++
- no dependencies in particular no installed LaTeX required
- can be used independently of JKQtPlotter
- see: \ref jkqtmathtext
- a second plotter widget JKQtFastPlotter:
- is optimized for fast plotting, but is not as feature-rich as JKQtPlotter
- may be used independently of JKQtPlotter
- \see jkqtfastplotter
- 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>
- 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
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -1,4 +1,4 @@
# JKQtPlotter: Examples: Examples & Tutorials
# Example (JKQtPlotter): Examples & Tutorials {#exampleProjectsTutorials}
This section assembles some simple examples of usage.
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.
@ -7,7 +7,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
| [![](../screenshots/jkqtplotter_simpletest1_small.png)](./simpletest) | [Very Basic Example (Line Graph)](./simpletest) | `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_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 |

View File

@ -1,9 +1,9 @@
# 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.
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):
```qmake
```.qmake
# include JKQTmathText source-code, including the open-source XITS fonts
include(../../lib/jkqtmathtext_with_xits.pri)
SOURCES += jkqtmathtext_simpletest.cpp
@ -19,7 +19,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtmathtext_simpletest
```
And the soruce code of the main application is (see [`jkqtmathtext_simpletest.cpp`](../jkqtmathtext_simpletest/jkqtmathtext_simpletest.cpp):
```c++
```.cpp
#include <QApplication>
#include <QLabel>
#include <QPixmap>

View File

@ -1,7 +1,7 @@
# JKQtPlotter: Examples: 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.
The QMake project looks like this (see [`jkqtplotter_simpletest.pro`](../simpletest/jkqtplotter_simpletest.pro):
```qmake
```.qmake
# source code for this simple demo
SOURCES = jkqtplotter_simpletest.cpp
@ -24,7 +24,7 @@ CONFIG (debug, debug|release) {
```
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
SOURCES = jkqtplotter_simpletest.cpp
@ -40,7 +40,7 @@ TARGET = jkqtplotter_simpletest
include(../../lib/jkqtplotter.pri)
```
The soruce code of the main application is (see [`jkqtplotter_simpletest.cpp`](../simpletest/jkqtplotter_simpletest.cpp):
```c++
```.cpp
#include <QApplication>
#include "jkqtplotter/jkqtplotter.h"

View File

@ -1,8 +1,8 @@
# JKQtPlotter: Examples: 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.
The soruce code of the main application is (see [`jkqtplotter_simpletest_barchart.cpp`](../simpletest_barchart/jkqtplotter_simpletest_barchart.cpp):
```c++
```.cpp
#include <QApplication>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsbarchart.h"

View File

@ -1,4 +1,4 @@
# JKQtPlotter: Examples: Date/Time Axes {#JKQtPlotterDateTimeAxes}
# Example (JKQtPlotter): Date/Time Axes {#JKQtPlotterDateTimeAxes}
## 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.
@ -7,7 +7,7 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
First some data is parsed from a CSV-file (added as ressource to the example). Note that the Time/date or Date+Time data is internally stored as milliseconds since epoc (Jan 1st 1970, 00:00:00), therefore data has to be converted accordingly before beeing added to the graph.
```c++
```.cpp
QVector<double> date;
QVector<double> temperature, temperature_min, temperature_max;
// parse a textfile with comments on the first line and the
@ -40,7 +40,7 @@ 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:
```c++
```.cpp
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
JKQTPfilledVerticalRangeGraph* graphTemperatureRange=new JKQTPfilledVerticalRangeGraph(&plot);
@ -64,7 +64,7 @@ Then two graphs are added. One of type `JKQTPfilledVerticalRangeGraph` plots the
On top of that plot, a second plot is added, which draws the average temperatures of each month as a line:
```c++
```.cpp
// 3. add a plot for the data mean line (graphTemperature) and range (graphTemperatureRange)
JKQTPxyLineErrorGraph* graphTemperature=new JKQTPxyLineErrorGraph(&plot);
@ -91,7 +91,7 @@ On top of that plot, a second plot is added, which draws the average temperature
```
Finally the x-axis is formatted to display dates (see [Qt-Documentation of `QDateTime::toString()`]((http://doc.qt.io/qt-5/qdatetime.html#toString) for details on the formating strings):
```c++
```.cpp
// 7. format the plot
// set the title above the plot, use LaTeX instructions to make text bold
plot.get_plotter()->set_plotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
@ -116,7 +116,7 @@ A second variant (see the example CPP-file) displays data with a time-axis:
For that example data-pasring is a bit different, because the file only contains times and no dates:
```c++
```.cpp
// 2. now we create data vectors with data parsed from a CSV-file
QVector<double> time;
QVector<double> temperature;
@ -150,7 +150,7 @@ The parsed data looks like this:
```
Axis formating for this example is done like this:
```c++
```.cpp
// 7. format the plot
// set the title above the plot, use LaTeX instructions to make text bold
plot.get_plotter()->set_plotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");

View File

@ -1,11 +1,11 @@
# JKQtPlotter: Examples: 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.
The source code of the main application can be found in [`jkqtplotter_simpletest_errorbarstyles.cpp`](../simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.cpp).
First some data is added to the internal datastore (mostly, like explained in several other examples, like e.g. [Line Graph with Different Symbols and Line Styles](../simpletest_symbols_and_styles)). The (in a loop) several graphs are added, each with a distinct style for its error indicators:
```c++
```.cpp
// 3. now we make several plots with different error styles
// for that we iterate over every style from the vector errorStyles
// the array showXandYError indicates whether we want x- and y-error
@ -70,7 +70,7 @@ First some data is added to the internal datastore (mostly, like explained in se
```
The error styles are set in these lines:
```c++
```.cpp
// set error style, for the y-axis
graph->set_yErrorStyle(errorStyles[errorID]);
// no error indicators for the x-values
@ -78,7 +78,7 @@ The error styles are set in these lines:
```
There are several variables that can be used to further style the error indicator, like:
```c++
```.cpp
// make error indicator 30% transparent
QColor c=graph->get_errorFillColor();
c.setAlphaF(0.3);
@ -92,7 +92,7 @@ There are several variables that can be used to further style the error indicato
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:
```c++
```.cpp
// 6. change locaion of key (outside top-right)
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideRightTop);
// ... and switch off the grid

View File

@ -1,15 +1,15 @@
# JKQtPlotter: Examples: 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.
The source code of the main application can be found in [`jkqtplotter_simpletest_filledgraphs.cpp`](../simpletest_filledgraphs/jkqtplotter_simpletest_filledgraphs.cpp).
First the data columns for three x-y-curves are generated. One column of x-values with entries 0,1,2,...,254,255 (256 entries).
```c++
```.cpp
size_t columnX=ds->addLinearColumn(256, 0, 255, "x");
```
And three columns with 256 entries each, which will be filled with the R-, G- and B-histograms of an image `example.bmp`:
```c++
```.cpp
size_t columnR=ds->addColumn(256, "historam_R");
size_t columnG=ds->addColumn(256, "historam_G");
size_t columnB=ds->addColumn(256, "historam_B");
@ -17,7 +17,7 @@ And three columns with 256 entries each, which will be filled with the R-, G- an
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`:
```c++
```.cpp
JKQTPcolumn cG=ds->getColumn(columnG);
JKQTPcolumn cR=ds->getColumn(columnR);
JKQTPcolumn cB=ds->getColumn(columnB);
@ -25,7 +25,7 @@ In this example we will access the data in the internal datastore directly. This
In order to calculate the histograms, first all enries in the columns are set to 0:
```c++
```.cpp
cR.setAll(0);
cG.setAll(0);
cB.setAll(0);
@ -33,7 +33,7 @@ In order to calculate the histograms, first all enries in the columns are set to
Finally the histogram is calculated:
```c++
```.cpp
QImage image(":/example.bmp");
for (int y=0; y<image.height(); y++) {
for (int x=0; x<image.width(); x++) {
@ -50,7 +50,7 @@ Finally the histogram is calculated:
Finally three `JKQTPfilledCurveXGraph` objects are generated and added to the plot (here we show the code for the R-channel only):
```c++
```.cpp
JKQTPfilledCurveXGraph* graphR=new JKQTPfilledCurveXGraph(&plot);
// set graph titles

View File

@ -1,10 +1,10 @@
# JKQtPlotter: Examples: Plotting Mathematical Functions as Line Graphs {#JKQtPlotterFunctionPlots}
# Example (JKQtPlotter): Plotting Mathematical Functions as Line Graphs {#JKQtPlotterFunctionPlots}
## 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.
## Simple C++ inline function
The first example shows how to plot a C++ inline function:
```c++
```.cpp
JKQTPxFunctionLineGraph* func1=new JKQTPxFunctionLineGraph(plot);
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$");
@ -13,7 +13,7 @@ The first example shows how to plot a C++ inline function:
## 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, ...)`:
```c++
```.cpp
JKQTPxFunctionLineGraph* func2=new JKQTPxFunctionLineGraph(plot);
func2->set_plotFunction([](double x, void* params) {
QVector<double>* p=static_cast<QVector<double>*>(params);
@ -26,7 +26,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))`):
```c++
```.cpp
JKQTPxFunctionLineGraph* func3=new JKQTPxFunctionLineGraph(plot);
func3->set_plotFunction([](double x, void* params) {
QMap<QString,double>* p=static_cast<QMap<QString,double>*>(params);
@ -43,7 +43,7 @@ In any such plot function, you can also use parameters, provided via the second
## C++ functors as plot functions
You can also use C++ functors (or function objects):
```c++
```.cpp
struct SincSqr {
public:
inline SincSqr(double amplitude): a(amplitude) {}
@ -64,7 +64,7 @@ You can also use C++ functors (or function objects):
## Static C functions
You can also plot simple static C functions:
```c++
```.cpp
double sinc(double x) {
return 10.0*sin(x)/x;
}
@ -79,7 +79,7 @@ You can also plot simple static C 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:
```c++
```.cpp
JKQTPxFunctionLineGraph* func6=new JKQTPxFunctionLineGraph(plot);
func6->setSpecialFunction(JKQTPxFunctionLineGraph::Line);
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
@ -89,7 +89,7 @@ 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`:
```c++
```.cpp
JKQTPxFunctionLineGraph* func7=new JKQTPxFunctionLineGraph(plot);
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

View File

@ -1,9 +1,9 @@
# JKQtPlotter: Examples: 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.
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:
```c++
```.cpp
// a text element
plot.addGraph(new JKQTPgeoText(&plot, 0.1,0.6, "$x_{1/2}=\\frac{\\sqrt{b^2-4ac}}{2a}$", 10, QColor("red")));

View File

@ -1,8 +1,8 @@
# JKQtPlotter: Examples: 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.
The soruce code of the main application is (see [`jkqtplotter_simpletest_imageplot.cpp`](../simpletest_imageplot/jkqtplotter_simpletest_imageplot.cpp):
```c++
```.cpp
#include <QApplication>
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"

View File

@ -1,8 +1,8 @@
# JKQtPlotter: Examples: 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) ...
The soruce code of the main application is (see [`jkqtplotter_simpletest_imageplot_modifier.cpp`](../simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier.cpp):
```c++
```.cpp
#include <QApplication>
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"

View File

@ -1,8 +1,8 @@
# JKQtPlotter: Examples: 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()`.
The soruce code of the main application is (see [`jkqtplotter_simpletest_imageplot_nodatastore.cpp`](../simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.cpp):
```c++
```.cpp
#include <QApplication>
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"

View File

@ -1,11 +1,11 @@
# JKQtPlotter: Examples: 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).
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 source code of the main application is (see [`jkqtplotter_simpletest_imageplot_opencv.cpp`](../simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp):
```c++
```.cpp
#include <QApplication>
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"

View File

@ -1,11 +1,11 @@
# JKQtPlotter: Examples: 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.
The soruce code of the main application is (see [`jkqtplotter_simpletest_impulsesplot.cpp`](../simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.cpp).
First data for a curve is calculated and stored in `QVector<double>`:
```c++
```.cpp
QVector<double> X, Y;
for (int i=0; i<Ndata; i++) {
const double xx=double(i)/double(Ndata)*6.0*M_PI;
@ -15,13 +15,13 @@ First data for a curve is calculated and stored in `QVector<double>`:
```
... and finally the data is copied into the datastore
```c++
```.cpp
size_t columnX=ds->addCopiedColumn(X, "x");
size_t columnY=ds->addCopiedColumn(Y, "y");
```
Now an impulse graph object is generated and added to the plot:
```c++
```.cpp
JKQTPimpulsesVerticalGraph* graph=new JKQTPimpulsesVerticalGraph(&plot);
graph->set_xColumn(columnX);
graph->set_yColumn(columnY);
@ -37,7 +37,7 @@ The result looks like this:
![jkqtplotter_simpletest_impulsesplot](../../screenshots/jkqtplotter_simpletest_impulsesplot.png)
There is an alternative class `JKQTPimpulsesHorizontalGraph` which draws horizontal impulse plots:
```c++
```.cpp
JKQTPimpulsesHorizontalGraph* graph=new JKQTPimpulsesHorizontalGraph(&plot);
graph->set_yColumn(columnX);
graph->set_xColumn(columnY);

View File

@ -1,9 +1,9 @@
# JKQtPlotter: Examples: 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.
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:
```c++
```.cpp
QVector<Qt::PenStyle> pens {Qt::SolidLine, Qt::DashLine, Qt::DotLine, Qt::DashDotLine, Qt::DashDotDotLine };
for (int id=0; id<D.size(); id++) {
// generate some plot data
@ -34,7 +34,7 @@ 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:
```c++
```.cpp
// 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
// and is simply parametrized by a position (1.25/10) and the text to display.
@ -51,7 +51,7 @@ The difference between not using and using `$...$` for the equation can be seen
- using $-math-mode: ![](../../screenshots/jkqtplotter_simpletest_logaxes_highqmathrendering.png)
Finally the y-axis is switched to logarithmic scaling and the axis labels are set:
```c++
```.cpp
// 5. set y-axis to logarithmic (x-axis would be analogous, but using `plot.get_xAxis()`)
plot.get_yAxis()->set_logAxis(true);
// now we set the number of label ticks to 9 (you give the count if minor between two majors,

View File

@ -1,8 +1,8 @@
# JKQtPlotter: Examples: 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).
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:
```c++
```.cpp
QVector<double> X, Y, R;
const int Ndata=500; // number of plot points in each curve
const double phiMax=4.0*M_PI;
@ -23,7 +23,7 @@ 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:
```c++
```.cpp
JKQTPxyLineGraph* graph1=new JKQTPxyLineGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY);
@ -34,7 +34,7 @@ Then simples graph just uses the columns X and Y to plot the curve:
```
If you use `JKQTPxyParametrizedScatterGraph` instead of `JKQTPxyLineGraph`, you can also modify the color of the line-segments, connecting the datapoints:
```c++
```.cpp
JKQTPxyParametrizedScatterGraph* graph2=new JKQTPxyParametrizedScatterGraph(&plot2);
graph2->set_xColumn(columnX);
graph2->set_yColumn(columnY);

View File

@ -1,4 +1,4 @@
# JKQtPlotter: Examples: 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:
- symbol size
- symbol type
@ -12,7 +12,7 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
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!).
```c++
```.cpp
JKQTPxyParametrizedScatterGraph* graph1=new JKQTPxyParametrizedScatterGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY1);
@ -25,7 +25,7 @@ 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)!
```c++
```.cpp
// symbol size
JKQTPxyParametrizedScatterGraph* graph3=new JKQTPxyParametrizedScatterGraph(&plot);
graph3->set_xColumn(columnX);
@ -49,7 +49,7 @@ The next two code snippets show how to modify the size of the symbols and the li
Finally you can set the color of each symbol, based on data in the column `colorColumn`. Here two possibilities exist: First you can store the RGB(A) value for each datapoint explicitly. For this, you first need to create the data in the column, using the Qt-function [`qRgb()`](http://doc.qt.io/qt-5/qcolor.html#qRgb) or [`qRgba()`}(http://doc.qt.io/qt-5/qcolor.html#qRgba):
```c++
```.cpp
QVector<double> RGB;
const int Ndata=10; // number of plot points in each curve
for (int i=0; i<Ndata; i++) {
@ -57,11 +57,11 @@ Finally you can set the color of each symbol, based on data in the column `color
RGB<<double(qRgb(double(i)/double(Ndata)*255,0,255-double(i)/double(Ndata)*255));
}
size_t columnRGB=ds->addCopiedColumn(RGB, "rgb");
```c++
```.cpp
Basically the data points in a RGB(A)-column will be interpreted by castig them to [`QRgb`](http://doc.qt.io/qt-5/qcolor.html#QRgb-typedef).
Now you can add the graph. In order to interpret the color column as RGB(A)-values, ensure to set `graph4->set_colorColumnContainsRGB(true)`:
```c++
```.cpp
JKQTPxyParametrizedScatterGraph* graph4=new JKQTPxyParametrizedScatterGraph(&plot);
graph4->set_xColumn(columnX);
graph4->set_yColumn(columnY4);
@ -74,7 +74,7 @@ Now you can add the graph. In order to interpret the color column as RGB(A)-valu
```
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`:
```c++
```.cpp
JKQTPxyParametrizedScatterGraph* graph2=new JKQTPxyParametrizedScatterGraph(&plot);
graph2->set_xColumn(columnX);
graph2->set_yColumn(columnY2);
@ -90,7 +90,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:
```c++
```.cpp
JKQTPxyParametrizedScatterGraph* graph5=new JKQTPxyParametrizedScatterGraph(&plot);
graph5->set_xColumn(columnX);
graph5->set_yColumn(columnY5);

View File

@ -1,10 +1,10 @@
# JKQtPlotter: Examples: 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`.
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.
```c++
```.cpp
// 2.1 load image
QImage image(":/example.bmp");
QVector<double> imageVector, pointSizes;
@ -32,7 +32,7 @@ First we prepare the data, as described above. The image is loaded and then conv
```
Now we can use th datavectors to add a `JKQTPxyParametrizedScatterGraph`:
```c++
```.cpp
JKQTPxyParametrizedScatterGraph* graph1=new JKQTPxyParametrizedScatterGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY);
@ -46,7 +46,7 @@ Now we can use th datavectors to add a `JKQTPxyParametrizedScatterGraph`:
```
For illustrative purposes, the original image is shown at the bottom-left:
```c++
```.cpp
JKQTPImage* graph2=new JKQTPImage(&plot);
graph2->set_image(image);
graph2->set_x(0);
@ -57,7 +57,7 @@ For illustrative purposes, the original image is shown at the bottom-left:
```
Finally the plot is styled and the axis aspect ratios are fixed:
```c++
```.cpp
// scale the plot so the graph is contained and format the coordinate system
plot.get_xAxis()->set_axisLabel("x-axis");
plot.get_yAxis()->set_axisLabel("y-axis");

View File

@ -1,11 +1,11 @@
# JKQtPlotter: Examples: Plotting Parsed Mathematical Functions as Line Graphs {#JKQtPlotterParsedFunctionPlot}
# Example (JKQtPlotter): Plotting Parsed Mathematical Functions as Line Graphs {#JKQtPlotterParsedFunctionPlot}
## 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.
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:
```c++
```.cpp
JKQTPxParsedFunctionLineGraph* parsedFunc=new JKQTPxParsedFunctionLineGraph(plot);
parsedFunc->set_function("sin(x*8)*exp(-x/4)");
parsedFunc->set_title("user function");
@ -13,7 +13,7 @@ Adding an evaluated funtion to a graph is very simple:
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:
```c++
```.cpp
JKQtPlotter* plot=new JKQtPlotter(&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");
@ -47,7 +47,7 @@ This code snippet results in a plot like this:
## Plotting with parameters
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:
```c++
```.cpp
JKQTPxParsedFunctionLineGraph* parsedFunc=new JKQTPxParsedFunctionLineGraph(plot);
parsedFunc->set_function("sin(x*p1)*exp(-x/p2)");
parsedFunc->set_paramV(/*p1=*/8, /*p2=*/4);

View File

@ -1,11 +1,11 @@
# JKQtPlotter: Examples: 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).
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 source code of the main application is (see [`jkqtplotter_simpletest_imageplot_opencv.cpp`](../simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp):
```c++
```.cpp
#include <QApplication>
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"

View File

@ -1,8 +1,8 @@
# JKQtPlotter: Examples: `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.
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:
```c++
```.cpp
// 2. now we open a BMP-file and load it into an OpenCV cv::Mat
QImage image(":/example.bmp");

View File

@ -1,7 +1,7 @@
# JKQtPlotter: Examples: 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).
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:
```c++
```.cpp
// 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
// the array is added to the datastore. therefore the datastore does not manage
@ -14,14 +14,14 @@ Data is stored in two [`std::array<double, NDATA>`](https://en.cppreference.com/
The datastore then uses the data from the `std::array` instances, but does not own their memory, i.e. also does not free it. This is useful, when data fro external sources should be used without copying.
For this example we also don't use axis autoscaling, but set the axes explicitly:
```c++
```.cpp
// 6. scale the plot so the graph is contained
setX(X[0], X[NDATA-1]);
setY(-2,2);
```
Finally a slot is started with a one-shot timer. In that slot, the data is shifted one place to the left and the graph is updated. The slot also calculated the current framerate and displays it in the window title. Finally a single-shot timer with 1ms delay is used to call the slot again (i.e. continuously):
```c++
```.cpp
void SpeedTestPlot::plotNewData()
{
// move old data to the left
@ -56,7 +56,7 @@ The result looks like this:
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.
You can configrue anti-aliasing with these calls:
```c++
```.cpp
plot.get_plotter()->set_useAntiAliasingForGraphs(false);
plot.get_plotter()->set_useAntiAliasingForSystem(false);
plot.get_plotter()->set_useAntiAliasingForText(false);

View File

@ -1,8 +1,8 @@
# JKQtPlotter: Examples: 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.
The soruce code of the main application is (see [`jkqtplotter_simpletest_stackedbars.cpp`](../simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp):
```c++
```.cpp
#include <QApplication>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsbarchart.h"

View File

@ -1,9 +1,9 @@
# JKQtPlotter: Examples: Step Line Plots in Different Styles {#JKQtPlotterStepPlot}
# Example (JKQtPlotter): Step Line Plots in Different Styles {#JKQtPlotterStepPlot}
This project (see `./examples/simpletest_stepplots/`) 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 source code of the main application can be found in [`jkqtplotter_simpletest_stepplots.cpp`](../simpletest_stepplots/jkqtplotter_simpletest_stepplots.cpp). For the most part, several datasets of cosine-curves are generated. then thrre tuples of graphs are added: One of type `JKQTPxyLineGraph`, which simply indicates the location of the actual datapoints. the second is of type `JKQTPstepHorizontalGraph`, which adds the step-graph to the plot:
```c++
```.cpp
// 3 now we make several plots with different step styles, each one also contains a
// symbol plot indicating the location of the datapoints themselves
JKQTPstepHorizontalGraph* graph;
@ -27,7 +27,7 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
Note that you can configure the step type (left/center/right by `graph->set_stepType(JKQTPstepLeft)`. With `graph->set_fillCurve(true)` you can draw the curve filled until the y=0-axis and with `graph->set_drawLine(true)` you can switch the line along the values on and off (e.g. to only have the filled area, but no line).
Finally the `JKQTPxyLineGraph` is configured:
```c++
```.cpp
// set symbol + pen style and color for the added circles, copy color
graphL->set_symbol(JKQTPgraphSymbols::JKQTPcircle);
graphL->set_drawLine(false);
@ -37,7 +37,7 @@ Finally the `JKQTPxyLineGraph` is configured:
```
... and all graphs are added to the plot:
```c++
```.cpp
// add the graphs to the plot, so it is actually displayed
plot.addGraph(graph);
plot.addGraph(graphL);

View File

@ -1,8 +1,8 @@
# JKQtPlotter: Examples: Simple line-graph with error bars {#JKQtPlotterSymbolsErrors}
# Example (JKQtPlotter): Simple line-graph with error bars {#JKQtPlotterSymbolsErrors}
This project (see `./examples/simpletest_symbols_and_errors/`) simply creates a JKQtPlotter widget (as a new window) and adds a single line-graph (a sine-wave) that has y-errorbars. In addition, this example shows how to change some of the axis properties and how to use LaTeX markup to format axis labels (can actually be used for all labels in JKQtPlotter). Also, in comparison to the last example, here we initialize the data from C-type arrays (double*), instead of QVector<double> objects.
The soruce code of the main application is (see [`jkqtplotter_simpletest_symbols_and_errors.cpp`](../simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.cpp):
```c++
```.cpp
#include <QApplication>
#include "jkqtplotter/jkqtplotter.h"

View File

@ -1,9 +1,9 @@
# JKQtPlotter: Examples: Line Graph with Different Symbols and Line Styles {#JKQtPlotterSymbolsAndStyles}
# Example (JKQtPlotter): Line Graph with Different Symbols and Line Styles {#JKQtPlotterSymbolsAndStyles}
This project (see `./examples/simpletest_symbols_and_styles/`) 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 source code of the main application can be found in [`jkqtplotter_simpletest_symbols_and_styles.cpp`](../simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.cpp). Mainly several graphs are generated in a loop and then different symbol and line styles are applied to the graph (set by `graph->set_symbol()` for the symbol and `graph->set_style()` for the line style). The colors are set automtically from an internal default palette. The main loop looks like this:
```c++
```.cpp
QVector<Qt::PenStyle> pens {Qt::NoPen, Qt::SolidLine, Qt::DashLine, Qt::DotLine, Qt::DashDotLine, Qt::DashDotDotLine };
int ipen=0;
for (int symbolID=0; symbolID<=JKQTPmaxSymbolID; symbolID++) {

View File

@ -1,17 +1,17 @@
# JKQtPlotter: Examples: Using a JKQtPlotter inside a Qt User Interface Designer (UI) File {#JKQtPlotterQtCreator}
# Tutorial (JKQtPlotter): Using a JKQtPlotter inside a Qt User Interface Designer (UI) File {#JKQtPlotterQtCreator}
This project (see `./examples/simpletest_ui/`) demonstrates how to create add a `JKQtPlotter` inside the Qt Form Editor (e.g. called from of Qt Creator) into a widget.
## Instructions on how to use JKQtPlotter in the Qt Form Designer
For this to work you have to follow the steps shown below:
1. add a new UI-file to your project and open it in the Form Editor. Then right-click the form and select `Promote Widgets ...`:
1. add a new UI-file to your project and open it in the Form Editor. Then right-click the form and select `Promote Widgets ...`:<br>
![step1](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/uidesigner_step1.png)
2. In the dialog that opens, you have to define `JKQtPlotter` as a promotion to `QWidget` as shown below. Finally store the settings by clicking `Add` and closing the dialog with `Close`.
2. In the dialog that opens, you have to define `JKQtPlotter` as a promotion to `QWidget` as shown below. Finally store the settings by clicking `Add` and closing the dialog with `Close`.<br>
![step2](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/uidesigner_step2.png)
3. Now you can add a `QWidget`from the side-bar to the form and then promote it to `JKQtPlotter`, by selecting and right-clicking the `QWidget` and then selecting `Promote To | JKQtPlotter`:
3. Now you can add a `QWidget`from the side-bar to the form and then promote it to `JKQtPlotter`, by selecting and right-clicking the `QWidget` and then selecting `Promote To | JKQtPlotter`:<br>
![step3](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/uidesigner_step3.png)
@ -19,7 +19,7 @@ For this to work you have to follow the steps shown below:
## QMake-Project of this example
The QMake project for such a project looks like this (see [`jkqtplotter_simpletest_ui.pro`](../simpletest_ui/jkqtplotter_simpletest_ui.pro):
```qmake
```.qmake
# source code for this simple demo
SOURCES = jkqtplotter_simpletest_ui.cpp \
formwithjkqtplotter.cpp
@ -56,7 +56,7 @@ win32-msvc*: DEFINES += _USE_MATH_DEFINES
As you can see there is a main CPP-file (shown below) and a `formwithjkqtplotter.ui`-file with the `formwithjkqtplotter.cpp/.h`-files that are used to implement the functionality behind the form (see next chapter).
The soruce code of the main application is simply instanciating the Form class `FormWithJKQtPlotter` from `formwithjkqtplotter.ui/.h/.cpp`:
```c++
```.cpp
#include <QApplication>
#include "formwithjkqtplotter.h"
@ -76,10 +76,11 @@ int main(int argc, char* argv[])
## Form Class `FormWithJKQtPlotter`
The Form was designed in the Qt Form Designer within Qt Creator, using the method described above (see `formwithjkqtplotter.ui`):
![jkqtplotter_simpletest_ui1](../../screenshots/jkqtplotter_simpletest_ui_widget.png)
In addition the example implements some simple functionality in the `formwithjkqtplotter.cpp/.h`-files. A single graph, which parses and plots a function (from a `QLineEdit`) is added to the plot in the constructor:
```c++
```.cpp
#include "formwithjkqtplotter.h"
#include "ui_formwithjkqtplotter.h"
@ -97,7 +98,7 @@ FormWithJKQtPlotter::FormWithJKQtPlotter(QWidget *parent) :
```
Then three slots react to user interactions. First two interactions set the x- or y-axis to linear or logarithmic, depending on the state of the two check-boxes. It also sets the scaling of the axes to meaningful default values:
```c++
```.cpp
void FormWithJKQtPlotter::on_chkLogX_toggled(bool checked)
{
ui->plot->get_xAxis()->set_logAxis(checked);
@ -120,7 +121,7 @@ void FormWithJKQtPlotter::on_chkLogY_toggled(bool checked)
```
A third slot is connected to the `clicked()`-event of the `QPushButton` labeled "REPLOT!". This slot reads the function from the `QLineEdit` and updates the plot with it:
```c++
```.cpp
void FormWithJKQtPlotter::on_btnReplot_clicked()
{
graph->set_function(ui->edtEquation->text());

View File

@ -1,11 +1,11 @@
# JKQtPlotter: Examples: Laying out Several Plots {#JKQtPlotterMultiPlotLayout}
# Example (JKQtPlotter): Laying out Several Plots {#JKQtPlotterMultiPlotLayout}
This project (see `./examples/test_multiplot/`) shows how several JKQtPlotter widgets can be combined to in a layout (based on the [Qt layouting system](http://doc.qt.io/qt-5/layout.html)). It also shows how axes in such a layout can be linked to improve user experience.
The source code of the main application can be found in [`test_multiplot.cpp`](../test_multiplot/test_multiplot.cpp).
First three plots are generated and put into a [QGridLayout](http://doc.qt.io/qt-5/qgridlayout.html):
```c++
```.cpp
// 1. create a widget
QWidget mainWidget;
mainWidget.setWindowTitle("JKQtPlotter(s) in a QGridLayout");
@ -36,7 +36,7 @@ First three plots are generated and put into a [QGridLayout](http://doc.qt.io/qt
With this simple setup, all three plots would be arranged by the QLayout, but they were all independent. This example could be part of a data fitting application, where the main plot shows data and a fit curve. A plot below that will display the residulas (errors) of the fit. Now if a user zooms one of the plots, he would expect that athe x-axes of the two plots are synchronized. The same for a third plot on the rhs of the residuals, which will show a residual histogram. This linking of the axes can be achieved by the following code:
```c++
```.cpp
// 3.4 synchronize width/x-axis of plotResid to width/x-axis of plotMain
plotResid->get_plotter()->synchronizeToMaster(plotMain->get_plotter(), true, false, true, true);
@ -46,7 +46,7 @@ With this simple setup, all three plots would be arranged by the QLayout, but th
Finally: When printing or saving an image of the plots, the plotter will no know anything about the arrangement of the plots and the plots cannot be printed/drawn in the same arrangement as in the window. If you want to arrange the plots in the same layout in a printout, as in the window, you will have to tell the main plot, in which arrangement to print the plots:
```c++
```.cpp
// 3.6 ensure that the plot are printed/exported in whole, when printing in plotMain
plotMain->get_plotter()->set_gridPrinting(true);
plotMain->get_plotter()->addGridPrintingPlotter(0,1,plotResid->get_plotter());
@ -59,7 +59,7 @@ Now some data is generated and several curves are added to the graphs. See [`tes
Finally the axes and plots need a bit of formatting to make them look nicer:
```c++
```.cpp
// 6.1 axis labels, distributed over the several plots
plotMain->get_yAxis()->set_axisLabel("y axis");
plotResid->get_xAxis()->set_axisLabel("x axis");
@ -83,7 +83,7 @@ Finally the axes and plots need a bit of formatting to make them look nicer:
As a last step, the axes are scaled automatically, so the data fills the plots:
```c++
```.cpp
// 7. scale plots automatically to data
plotResid->zoomToFit();
plotResidHist->zoomToFit();

View File

@ -3321,12 +3321,29 @@ void JKQTmathText::saveSettings(QSettings& settings, QString group){
void JKQTmathText::useSTIX() {
useSTIXfonts=true;
fontGreek="STIXGeneral";
fontSymbol="STIXGeneral";
fontBraces="STIXGeneral";
fontIntegrals="STIXGeneral";
//fontRoman="STIXGeneral";
fontMathRoman="STIXGeneral";
QString fontname="STIX Two Math Standard";
QString fontnametxt="STIX Two Text";
QFontDatabase fdb;
if (!fdb.families().contains(fontname)) {
fontname="STIX Math Standard";
fontnametxt="STIX Math Standard";
if (!fdb.families().contains(fontname)) {
fontname="STIX";
fontnametxt="Times New Roman";
if (!fdb.families().contains(fontname)) {
fontname="STIXGeneral";
fontnametxt="Times New Roman";
}
}
}
fontGreek=fontname;
fontSymbol=fontname;
fontBraces=fontname;
fontIntegrals=fontname;
fontRoman=fontnametxt;
fontMathRoman=fontname;
fontEncoding=MTFEunicode;
brace_shrink_factor=0.6;
}

View File

@ -21,7 +21,7 @@
/*
Name: jkqtmathtext.h
Copyright: (c) 2010-2015
Copyright: (c) 2010-2019
Author: Jan krieger <jan@jkrieger.de>, http://www.jkrieger.de/
*/
@ -55,11 +55,68 @@
*/
LIB_EXPORT void initJKQtMathTextResources();
/*! \brief this class manages an enhanced text message (containing a subset of LaTeX markups) and allows to draw a representation
/*! \brief this class parses a LaTeX string and can then draw the contained text/equation onto a QPainter
\ingroup jkqtmathtext
This class first parses the enhanced text string and then allows to question the size of the representation
and to draw a representation to a given painter object.
JKQtMathText is a self-contained LaTeX-renderer for Qt. It is used to renderer
labels in JKQtPlotter/JKQtBasePlotter, 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
on an installed LaTeX for the rendering!
\section JKQtMathTextUsage Usage
\subsection JKQtMathTextUsageDirect Direct Usage
This small piece of C++ code may serve as an example of the usage and capabilities of the class:
\code
// create a JKQTmathText object.
JKQTmathText mathText;
// configure its properties to influence the rendering (e.g. fonts to use, font size, ...)
mathText.useXITS();
mathText.set_fontSize(20);
// parse some LaTeX code (the Schroedinger's equation)
mathText.parse("$\\left[-\\frac{\\hbar^2}{2m}\\frac{\\partial^2}{\\partial x^2}+V(x)\\right]\\Psi(x)=\\mathrm{i}\\hbar\\frac{\\partial}{\\partial t}\\Psi(x)$");
// use the draw() methods to draw the equation using a QPainter (here onto a QPixmap)
QPainter painter;
QPixmap pix(600,400);
painter.begin(&pix);
mathText.draw(painter, Qt::AlignCenter, QRectF(0,0,pix.width(), pix.height()), false);
painter.end();
\endcode
\subsection JKQtMathTextSizing Determining the size of an equation
In addition there are also functions that allow to calculate the size of the equation, before drawing it (just like the functions in <a href="http://doc.qt.io/qt-5/qfontmetrics.html">QFontMetrics</a> and <a href="http://doc.qt.io/qt-5/qfontmetricsf.html">QFontMetricsF</a>):
- getSizeDetail()
- getSize()
- getAscent(), getDescent()
.
\subsection JKQtMathTextErrorHandling Error Handling
The class is designed to be as robust as possible and will still return some output, even if the equation contains some errors.
Nevertheless, several errors are detected while parsing. You can get a list of error messages using get_error_list() after calling parse().
Also parse() will return \c false if an error occured while parsing.
\subsection JKQtMathTextUsageQLabel Usage within a QLabel class JKQTMathTextLabel
Finally, there is also a QLabel-derived class JKQTMathTextLabel which can be used for drawing a LaTeX string onto a Qt form.
\see JKQTMathTextLabel
\section JKQtMathTextExamples Examples
Examples for the usage of this class can be found here:
- \ref JKQTmathTextSimpleExample
.
\section JKQtMathTextSuppoertedLaTeX Supported LaTeX Subset
The supported LaTeX subset is listes below. Please note that some commands are used differently than in actual LaTeX.
For example \c \\bf is just a renamed form of \c \\textbf and used as \c \\bf{...} and NOT as \c {\\bf...} .
@ -95,27 +152,41 @@ LIB_EXPORT void initJKQtMathTextResources();
- \c \\left~ \c \\right~ : ceil braces |~ ~|
.
\section JKQtMathTextSuppoertedFonts Font Handling
Several fonts are defined as properties to the class:
- A "roman" font used as the standard font
- A "sans-serif" font which may be activated with \c \\sf ...
- A "typewriter" font which may be activated with \c \\tt ...
- A "script" font which may be activated with \c \\script ...
- A greek font which is used to display greek letters \c \\alpha ...
- A "roman" font used as the standard font ( set_fontRoman() in math-mode set_fontMathRoman() )
- A "sans-serif" font which may be activated with \c \\sf ... ( set_fontSans() in math-mode set_fontMathSans() )
- A "typewriter" font which may be activated with \c \\tt ... ( set_fontTypewriter() )
- A "script" font which may be activated with \c \\script ... ( set_fontScript() )
- A greek font which is used to display greek letters \c \\alpha ... ( set_fontGreek() )
- A symbol font used to display special (math) symbols.
- A "roman" font used as the standard font in math mode
- A "sans-serif" used as sans serif font in math mode
- A "blackboard" font used to display double stroked characters
- A "caligraphic" font used to display caligraphic characters
- A "blackboard" font used to display double stroked characters (set_fontBlackboard() )
- A "caligraphic" font used to display caligraphic characters ( set_fontCaligraphic() )
.
These fonts are generic font classes, which font is actually used can be configured in JKQtMathText class with the \c set_...() functions mentioned above. You can also use these functions to set the fonts used for math rendering in math-mode:
- useSTIX() use the STIX fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a> in math-mode<br>\image html jkqtmathparser_stix.png
- useXITS() use the XITS fonts from <a href="https://github.com/alif-type/xits">https://github.com/alif-type/xits</a> in math-mode. These are included by default in this library and also activated by default.<br>\image html jkqtmathparser_xits.png
- useASANA() use the ASANA fonts from <a href="https://ctan.org/tex-archive/fonts/Asana-Math/">https://ctan.org/tex-archive/fonts/Asana-Math/</a> in math-mode<br>\image html jkqtmathparser_asana.png
- useAnyUnicode() use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode. You should use fonts that contain as many of the mathematical symbols as possible to ensure good rendering results.<br>using "Times New Roman": \image html jkqtmathparser_timesnewroman.png
<br>using "Arial": \image html jkqtmathparser_arial.png
.
Math-mode is activated by enclosing your equation in \c $...$ or \c \\[...\\] . This mode is optimized for mathematical equations. Here is an example of the difference:
- <b>math-mode (XITS is used)</b> <code>"$\\left[-\\frac{\\hbar^2}{2m}\\frac{\\partial^2}{\\partial x^2}+V(x)\\right]\\Psi(x)=\\mathrm{i}\\hbar\\frac{\\partial}{\\partial t}\\Psi(x)$"</code>: <br>\image html jkqtmathparser_schreq_mathmode.png
- <b>normal mode (Times new Roman is used)</b> <code>"\\left[-\\frac{\\hbar^2}{2m}\\frac{\\partial^2}{\\partial x^2}+V(x)\\right]\\Psi(x)=\\mathrm{i}\\hbar\\frac{\\partial}{\\partial t}\\Psi(x)"</code>: <br>\image html jkqtmathparser_schreq_normalmode.png
.
\section JKQtMathTextToHTML Convert to HTML
The method toHtml() may be used to get a HTML representation of the LaTeX string, if possible (only for simple LaTeX equations!). Whether
the transformation was possible is returned as a call by value argument!
This small peace of C++ code may serve as an example of the usage and capabilities of the class:
\include test/jkqtmathtext_test/jkqtmathtext_test.cpp
Here is a qmake project file for this:
\include test/jkqtmathtext_test/jkqtmathtext_test.pro
*/
class LIB_EXPORT JKQTmathText : public QObject {
@ -147,16 +218,39 @@ class LIB_EXPORT JKQTmathText : public QObject {
*/
void draw(QPainter& painter, int flags, QRectF rect, bool drawBoxes=false);
/** \brief configures the class to use the STIX fonts in mathmode */
/** \brief configures the class to use the STIX fonts in mathmode
*
* use STIX (1.x/2.x) fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a> in math-mode
*
* \image html jkqtmathparser_stix.png
*/
void useSTIX();
/** \brief configures the class to use the XITS fonts in mathmode */
/** \brief configures the class to use the XITS fonts in mathmode
*
* use XITS fonts from <a href="https://github.com/alif-type/xits">https://github.com/alif-type/xits</a> in math-mode.
* These are included by default in this library and also activated by default.
*
* \image html jkqtmathparser_xits.png
*/
void useXITS();
/** \brief configures the class to use the ASANA fonts in mathmode */
/** \brief configures the class to use the ASANA fonts in mathmode
*
* use the ASANA fonts from <a href="https://ctan.org/tex-archive/fonts/Asana-Math/">https://ctan.org/tex-archive/fonts/Asana-Math/</a> in math-mode
*
* \image html jkqtmathparser_asana.png
*/
void useASANA();
/** \brief configures the class to use a unicode font for symbols in mathmode */
/** \brief configures the class to use a unicode font for symbols in mathmode
*
* use generic Unicode fonts, e.g. "Arial" and "Times New Roman" in math-mode.
* You should use fonts that contain as many of the mathematical symbols as possible to ensure good rendering results.
*
* <code>setAnyUnicode("Times New Roman", "Times New Roman")</code>:<br>\image html jkqtmathparser_timesnewroman.png
* <code>setAnyUnicode("Arial", "Arial")</code>:<br>\image html jkqtmathparser_arial.png
*/
void useAnyUnicode(QString timesFont=QString(""), QString sansFont=QString(""));
void useLatexFonts(QString prefix=QString(""), QString postfix=QString(""));
@ -1363,13 +1457,24 @@ inline uint qHash(const JKQTmathText::tbrDataH& data) {
/*! \brief A QLabel-derived class that draws an equation with LaTeX markup using JKQTmathText
\ingroup jkqtmathtext
\see JKQTmathText
*/
class LIB_EXPORT JKQTMathTextLabel: public QLabel {
Q_OBJECT
public:
explicit JKQTMathTextLabel(QWidget* parent=nullptr);
virtual ~JKQTMathTextLabel();
/** \brief returns the internal JKQTmathText instance used for drawing
*
* Use this function to set the font, font size and other properties of the used renderer.
*/
JKQTmathText* getMathText() const;
/** \brief set the equation to draw */
void setMath(const QString& text, bool doRepaint=true);
protected:
JKQTmathText* m_mathText;

View File

@ -20,7 +20,7 @@
/** \file jkqtpbaseelements.h
* \ingroup jkqtplotter_elements
* \ingroup jkqtpbaseplotter_elements
*/
#ifndef JKQTPBASEELEMENTS_H
@ -39,7 +39,7 @@
class JKQtBasePlotter;
/*! \brief this virtual class is the base for any type of coordinate axis, to be drawn by JKQTplotterBase.
\ingroup jkqtplotter_elements
\ingroup jkqtpbaseplotter_elements
This class implements all the functionality needed for a coordinate axis:
- transform world to screen coordinates and vice versa
@ -906,7 +906,7 @@ class LIB_EXPORT JKQTPcoordinateAxis: public QObject {
/*! \brief implements a vertical axis, based on JKQTPcoordinateAxis (for most of documentation: see JKQTPcoordinateAxis).
\ingroup jkqtplotter_elements
\ingroup jkqtpbaseplotter_elements
*/
class LIB_EXPORT JKQTPverticalAxis: public JKQTPcoordinateAxis {
@ -946,7 +946,7 @@ class LIB_EXPORT JKQTPverticalAxis: public JKQTPcoordinateAxis {
/*! \brief implements a position-indipendent vertical axis, based on JKQTPcoordinateAxis (for most of documentation: see JKQTPcoordinateAxis).
\ingroup jkqtplotter_elements
\ingroup jkqtpbaseplotter_elements
This axis may be draw at a user-supplied position (used e.g. for color bar axes)
*/
@ -987,7 +987,7 @@ class LIB_EXPORT JKQTPverticalIndependentAxis: public JKQTPverticalAxis {
/*! \brief implements a horizontal axis, based on JKQTPcoordinateAxis (for most of documentation: see JKQTPcoordinateAxis).
\ingroup jkqtplotter_elements
\ingroup jkqtpbaseplotter_elements
*/
class LIB_EXPORT JKQTPhorizontalAxis: public JKQTPcoordinateAxis {
@ -1028,7 +1028,7 @@ class LIB_EXPORT JKQTPhorizontalAxis: public JKQTPcoordinateAxis {
/*! \brief implements a position-indipendent horizontal axis, based on JKQTPcoordinateAxis (for most of documentation: see JKQTPcoordinateAxis).
\ingroup jkqtplotter_elements
\ingroup jkqtpbaseplotter_elements
This axis may be draw at a user-supplied position (used e.g. for color bar axes)
*/

View File

@ -20,7 +20,7 @@
/** \file jkqtpbaseplotter.cpp
* \ingroup jkqtplotter
* \ingroup jkqtpplotterclasses
*/
#include <QFileInfo>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))

View File

@ -20,7 +20,7 @@
/** \file jkqtpbaseplotter.h
* \ingroup jkqtpbaseplotter
* \ingroup jkqtpplotterclasses
*/
#include "jkqtplottertools/jkqtptools.h"
@ -66,7 +66,7 @@ LIB_EXPORT void initJKQtBasePlotterResources();
/** \brief base class for 2D plotter classes
* \ingroup jkqtpbaseplotter
* \ingroup jkqtpplotterclasses
*
* This class implements basic functionalities for the plotter classes. Those are:
* -# data storage using a JKQTPdatastore object

View File

@ -19,7 +19,7 @@
/** \file jkqtpgraphs.h
* \ingroup jkqtplotter
* \ingroup jkqtplotter_linesymbolgraphs
*/
#include <QString>

View File

@ -20,7 +20,7 @@
/** \file jkqtpgraphsevaluatedfunction.h
* \ingroup jkqtplotter_Fgraphs
* \ingroup jkqtplotter_functiongraphs
*/
#include <QString>
@ -37,7 +37,7 @@
/*! \brief type of functions that may be plottet
\ingroup jkqtplotter_Fgraphs
\ingroup jkqtplotter_functiongraphs
This is the type of functions \f$ y=f(x, \vec{p}) \f$ that may be plottet by JKQTPxFunctionLineGraph
and JKQTPyFunctionLineGraph. It is possible to supply parameters \f$ \vec{p} \f$ to the function that
@ -47,7 +47,7 @@
typedef std::function<double(double, void*)> jkqtpPlotFunctionType;
/*! \brief simplified type of functions (without parameters) that may be plottet
\ingroup jkqtplotter_Fgraphs
\ingroup jkqtplotter_functiongraphs
This is the type of functions \f$ y=f(x) \f$ that may be plottet by JKQTPxFunctionLineGraph
and JKQTPyFunctionLineGraph.
@ -56,7 +56,7 @@ typedef std::function<double(double)> jkqtpSimplePlotFunctionType;
/*! \brief This implements line plots where the data is taken from a user supplied function \f$ y=f(x) \f$
\ingroup jkqtplotter_Fgraphs
\ingroup jkqtplotter_functiongraphs
This class implements an intelligent plotting algorithm for functions. It starts by sampling
the function at minSamples positions. Then each function interval is bisected recursively if
@ -621,7 +621,7 @@ class LIB_EXPORT JKQTPxFunctionLineGraph: public JKQTPgraph {
};
/*! \brief This implements line plots where the data is taken from a user supplied function \f$ x=f(y) \f$
\ingroup jkqtplotter_Fgraphs
\ingroup jkqtplotter_functiongraphs
*/
class LIB_EXPORT JKQTPyFunctionLineGraph: public JKQTPxFunctionLineGraph {

View File

@ -19,7 +19,7 @@
/** \file jkqtpgraphspeakstream.h
* \ingroup jkqtplotter
* \ingroup jkqtplotter_diverse
*/
#include <QString>

View File

@ -21,7 +21,7 @@
/** \file jkqtplotter.cpp
* \ingroup jkqtplotter
* \ingroup jkqtpplotterclasses
*/

View File

@ -20,7 +20,7 @@
/** \file jkqtplotter.h
* \ingroup jkqtplotter
* \ingroup jkqtpplotterclasses
*
* A Qt based plotter for 2D scientific graphs.
*/
@ -54,13 +54,13 @@
#define JKQTPLOTTER_H
/** \brief initialized Qt-ressources necessary for JKQtPlotter
* \ingroup jkqtplotter
* \ingroup jkqtpplotterclasses
*/
LIB_EXPORT void initJKQtPlotterResources();
/** \brief class to plot function graphs in linear or (semi-)logarithmic scale
* \ingroup jkqtplotter
* \ingroup jkqtpplotterclasses
*
* This class is an implementation of JKQtPlotterBase. It uses the tools from this base class
* to display function graphs that use the internal datastore as data source. You can add graphs

View File

@ -20,7 +20,7 @@
/** \file jkqtpcomboboxes.cpp
* \ingroup jkqtplotter
* \ingroup jkqtpcomboboxes
*/
#include "jkqtplottergui/jkqtpcomboboxes.h"

View File

@ -20,7 +20,7 @@
/** \file jkqtpcomboboxes.h
* \ingroup jkqtplotter
* \ingroup jkqtpcomboboxes
*/
#ifndef JKQTPCOMBOBOXES_H

View File

@ -20,7 +20,7 @@
/** \file jkqtpgraphsmodel.cpp
* \ingroup jkqtplotter
* \ingroup jkqtpgraphsmodel
*/
#include "jkqtplottergui/jkqtpgraphsmodel.h"

View File

@ -20,7 +20,7 @@
/** \file jkvanishqtoolbar.cpp
* \ingroup jkqtplotter
* \ingroup jkqtptools_qtwidgets
*/
#include "jkqtplottergui/jkvanishqtoolbar.h"

View File

@ -1163,7 +1163,7 @@ int* JKQTPimagePlot_getCreateLUT(QList<int*>& lutstore, JKQTPMathImageColorPalet
}
}
lut_used=lutstore[palette];
} else if (palette == JKQTPMathImageBLACKBLUEVIOLETYELLOWWHITE) //gnuplot: 30,31,32
} else if (palette == JKQTPMathImageBLACKBLUEWHITEYELLOWWHITE) //gnuplot: 30,31,32
{
//int*& plut=&lut_BLACKBLUEVIOLETYELLOWWHITE;
if (lutstore[palette]==nullptr) {
@ -1182,7 +1182,7 @@ int* JKQTPimagePlot_getCreateLUT(QList<int*>& lutstore, JKQTPMathImageColorPalet
}
}
lut_used=lutstore[palette];
} else if (palette == JKQTPMathImageWHITEYELLOWVIOLETBLUEBLACK) //gnuplot: 30,31,32
} else if (palette == JKQTPMathImageWHITEYELLOWWHITEBLUEBLACK) //gnuplot: 30,31,32
{
//int*& plut=&lut_WHITEYELLOWVIOLETBLUEBLACK;
if (lutstore[palette]==nullptr) {

View File

@ -104,7 +104,7 @@ class JKQTPEnhancedPainter; // forward
class JKQtBasePlotter; // forward declaration
/** \brief smallest linewidth any line in JKQtPlotter may have
* \ingroup jkqtplotter
* \ingroup jkqtptools
*/
#define JKQTPLOTTER_ABS_MIN_LINEWIDTH 0.02

View File

@ -7,7 +7,7 @@ This directory contains Projects that can be used to build a shared library of J
### Build shared libraries
There are several `.PRO`-files, that can be used to build the full library, or a limited subsets. They will produce a dynamic link library that you can include into your projects, e.g. with the following QMake-snippet:
```qmake
```.qmake
# include JKQtPlotter library
DEPENDPATH += <PATHTOJKQTPLOTTERDIR>/lib
INCLUDEPATH += <PATHTOJKQTPLOTTERDIR>/lib

View File

@ -7,7 +7,7 @@ This directory contains Projects that can be used to build a static library of J
### Build shared libraries
There are several `.PRO`-files, that can be used to build the full library, or a limited subsets. They will produce a static link libraries that you can include into your projects, e.g. with the following QMake-snippet:
```qmake
```.qmake
# include JKQtPlotter library
DEPENDPATH += <PATHTOJKQTPLOTTERDIR>/lib
INCLUDEPATH += <PATHTOJKQTPLOTTERDIR>/lib