- added styling system for JKQTPlotter (+example app)

- improved documentation
- changed: using static const variables instead of \c #define for fixed default values (e.g. JKQTPImageTools::LUTSIZE, JKQTPImageTools::PALETTE_ICON_WIDTH, JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, JKQTMathText::ABS_MIN_LINEWIDTH ...)
- new: added debugging option, which surrounds different regions with visible rectangles (JKQTBasePlotter::enableDebugShowRegionBoxes() )
- fixed: colorbars at top were positioned over the plot label
- new: frames (plot viewport, key/legend ...) may be rounded off at the corners
- new: diverse new styling options (default font name/size ...)
- speed improvements to JKQTMathText::useSTIX()
This commit is contained in:
jkriege2 2019-02-07 17:24:46 +01:00
parent 6082010c98
commit 69ad2a0182
190 changed files with 20827 additions and 16128 deletions

6
.gitignore vendored
View File

@ -90,7 +90,5 @@ moc_predefs.h
/lib/jkqtplotter/*.TMP
/doc/doxygen_log.txt
/doc/*.tmp
/staticlib/debug/*.prl
/staticlib/release/*.prl
/sharedlib/debug/jkqtplotterlib_debug.prl
/sharedlib/release/jkqtplotterlib.prl
*.prl
Sicherungskopie_*

View File

@ -38,7 +38,7 @@ script:
- cd ${TRAVIS_BUILD_DIR}
- cd doc
- doxygen --version
- doxygen -d Markdown Doxyfile
- doxygen Doxyfile
deploy:
provider: pages

View File

@ -83,5 +83,6 @@ defineTest(addTest) {
addTest(multiplot)
addTest(user_interaction)
addTest(styling)
#addTest(distributionplot)

View File

@ -419,7 +419,7 @@ INLINE_GROUPED_CLASSES = NO
# Man pages) or section (for LaTeX and RTF).
# The default value is: NO.
INLINE_SIMPLE_STRUCTS = NO
INLINE_SIMPLE_STRUCTS = YES
# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
# enum is documented as struct, union, or enum with the name of the typedef. So

View File

@ -29,7 +29,9 @@ They will produce a static link library that you can include into your projects,
\code{.qmake}
# include JKQTPlotter library
DEPENDPATH += <PATHTOJKQTPLOTTERDIR>/lib
DEPENDPATH += \
<PATHTOJKQTPLOTTERDIR>/lib \
<PATHTOJKQTPLOTTERDIR>/staticlib
INCLUDEPATH += <PATHTOJKQTPLOTTERDIR>/lib
CONFIG (debug, debug|release) {
LIBS += -L<PATHTOJKQTPLOTTERDIR>/staticlib/debug -ljkqtplotterlib_debug
@ -66,11 +68,13 @@ They will produce a dynamic link library that you can include into your projects
\code{.qmake}
# include JKQTPlotter library
DEPENDPATH += <PATHTOJKQTPLOTTERDIR>/lib
DEPENDPATH += \
<PATHTOJKQTPLOTTERDIR>/lib \
<PATHTOJKQTPLOTTERDIR>/sharedlib
INCLUDEPATH += <PATHTOJKQTPLOTTERDIR>/lib
CONFIG (debug, debug|release) {
# ensure that DLLs are copied to the output directory
install_jkqtplotter_dll.files = <PATHTOJKQTPLOTTERDIR>/sharedlib/debu/jkqtplotterlib_debug.*
install_jkqtplotter_dll.files = <PATHTOJKQTPLOTTERDIR>/sharedlib/debug/jkqtplotterlib_debug.*
install_jkqtplotter_dll.path = $$OUT_PWD
INSTALLS += install_jkqtplotter_dll
# link agains DLLs

View File

@ -134,7 +134,7 @@ mainly used for the \ref jkqtplotter_imagelots "Image/Matrix graphs", but also b
\ingroup jkqtplotter_graphsgroup
\defgroup jkqtplotter_basegraphserrors Mix-In Classes for Error Indicators
\ingroup jkqtplotter_graphsgroup
\ingroup jkqtplotter_basegraphs
\defgroup jkqtplotter_linesymbolgraphs Line/Symbol Graphs
\ingroup jkqtplotter_graphsgroup
@ -421,6 +421,76 @@ Examples:
\defgroup jkqtpplotter_styling JKQTPlotter Styling System
\ingroup jkqtplotter
\image html stylesbanner.png
JKQTPlotter (and JKQTBasePlotter) offer a styling system, which allows to easily define and transfer plot styling from one object to another.
The system is based on a hirarchy of structs, which summarize properties, describing how a plot looks in general. The classes contained in this system are:
- JKQTPlotterStyle for JKQTPlotter: Defines e.g. basic user-interactions, the display options of the toolbar
- JKQTBasePlotterStyle for JKQTBasePlotter defines the appearance of the plot itself (colors, axis properties, key properties, default graph colors/styles, ...), contains JKQTPCoordinateAxisStyle instances to configrue the plot's coordinate axes
- JKQTPCoordinateAxisStyle for JKQTPCoordinateAxis defines the appearance of a coordinate axis (colors, axis properties, ...)
- JKQTPKeyStyle for the style of the key/legend in a JKQTBasePlotterStyle
.
In addition there are static methods that allow to manage a system-wide (actually program-instance wide) style that is applied to any new instance of JKQTPlotter and JKQTBasePlotter on construction:
- JKQTPGetSystemDefaultStyle() / JKQTPSetSystemDefaultStyle() allows to access the central instace of JKQTPlotterStyle (mainly properties/style of the GUI-parts and user-action bindings)
- JKQTPGetSystemDefaultBaseStyle() / JKQTPSetSystemDefaultBaseStyle() accesses the central instance of JKQTBasePlotterStyle (styles the actual plot/graphs with colors, axes styles, ...)
.
You can e.g. use these general methods to alter the styles for all JKQTPlotter instances, created in the future:
\code{.cpp}
// load the system-wide default settings from an INI-file:
QSettings plotSettings("JKQTPlotterSettings.ini", QSettings::IniFormat);;
JKQTPGetSystemDefaultStyle().loadSettings(plotSettings);
JKQTPGetSystemDefaultBaseStyle().loadSettings(plotSettings);
// alter a system-wide default setting by hand (here: set color of zooming rect to red)
JKQTPGetSystemDefaultStyle().userActionColor=QColor("red");
\endcode
Several pre-made styles are available in the JKQTPlotter repository (<a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/">https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/</a>).
These are also linked into the JKQTPlotter library as Qt ressource into the subdirectory \c :/JKQTPlotter/styles/ . You can use them as follows:
\code{.cpp}
QSettings plotSettings(":/JKQTPlotter/styles/blackandwhite.ini", QSettings::IniFormat);;
JKQTPGetSystemDefaultStyle().loadSettings(plotSettings);
JKQTPGetSystemDefaultBaseStyle().loadSettings(plotSettings);
\endcode
Here is a table with all available ready-made styles:
<table>
<tr>
<th> Style-file
<th> Screenshot
<tr>
<td> <b> The Default Style </b>
<td> \image html style_default.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/simple_gridandticks.ini"> \c :/JKQTPlotter/styles/simple_gridandticks.ini</a>
<td> \image html style_simple_axesoffset_plotbox.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/simple_axesoffset.ini"> \c :/JKQTPlotter/styles/simple_axesoffset.ini</a>
<td> \image html style_simple_axesoffset.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/simple_axesoffset_plotbox.ini"> \c :/JKQTPlotter/styles/simple_axesoffset_plotbox.ini</a>
<td> \image html style_simple_axesoffset_plotbox.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/dark.ini"> \c :/JKQTPlotter/styles/dark.ini</a>
<td> \image html style_dark.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/blueprint.ini"> \c :/JKQTPlotter/styles/blueprint.ini</a>
<td> \image html style_blueprint.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/blackandwhite.ini"> \c :/JKQTPlotter/styles/blackandwhite.ini</a>
<td> \image html style_blackandwhite.png
</table>
\see For a detailed example, see \ref JKQTPlotterStyling
\defgroup jkqtpqtwidgetsttools Qt Widgets/Tools to work with JKQTPlotter
\ingroup jkqtplotter

View File

@ -1,8 +1,13 @@
/*!
\page licensesec License Terms (LGPL >= 2.1)
\page licensepage Licensing Terms for JKQTPlotter
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.
\tableofcontents
\section licensesec JKQTPlotter/JKQTFastPlotter/JKQTMathText: 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
@ -71,7 +76,7 @@ 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
ordinary GNU Lesser 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
@ -218,14 +223,14 @@ 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,
that they refer to the ordinary GNU Lesser 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
ordinary GNU Lesser 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
that copy, so the ordinary GNU Lesser 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
@ -513,4 +518,42 @@ That's all there is to it!
\endverbatim
\section extlicense_sec Licenses of 3rd Party Products Contained in JKQTPlotter
JKQTPlotter is mostly self-conatined. The only exceptions are listed below
\subsection extlicense_xits XITS Fonts for JKQTMathText
JKQTMathText comes prepackaged with the XITS fonts from <a href="https://www.stixfonts.org/">https://www.stixfonts.org/</a>. With these it can produceh
high-quality math rendering. It is possible to use the class with other fonts, but XITS is highly recommended. XITS fonts are licensed as follows:
\verbatim
XITS is a Times-like typeface for mathematical and scientific publishing,
based on STIX fonts (https://www.stixfonts.org/). The main mission of XITS
is to provide a version of STIX fonts enriched with the OpenType MATH extension,
making it suitable for high quality mathematic typesetting with OpenType MATH
capable layout systems, like MS Office 2007 and the new TeX engines XeTeX and
LuaTeX.
XITS font is free, open source font, under Open Font License
(https://scripts.sil.org/OFL), version 1.1.
The current version of XITS is based on version 1.1.0-beta1 of STIX fonts.
This is work in progress, feedback, bug reports and even patches are welcomed.
\endverbatim
The source for this library can be found here: https://github.com/alif-type/xits
\note The XITS fonts are distributed in
<a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/math_fonts/xits">lib/jkqtplotterressources/math_fonts/xits</a>
and are automatically added to the binary libraries as Qt Resources. You can prevent this by adding the line
\code
DEFINES += NO_XITS_FONTS
\endcode
To the QMake project that you use to build the JKQTPlotter/JKQTMathText libraries (see the ready-made \c .pro -files for static and dynamic libs, which
already contain this line, but commented out. QMake will tell you with a message whether XITS is linked in or not.
*/

View File

@ -16,7 +16,7 @@ This software is licensed under the term of the GNU Lesser General Public Licens
- integrated LaTeX parser/renderer JKQTMathText for axis labels, ticks, notes ...
- \ref JKQTPLOTTER_USERINTERACTION "extensive user-interactions pre-programmed (several zooming modes, selecting regions, custom context menus, switch graph visibility, ...)"
- \ref jkqtbaseplotter_dataexport_print "full print and export (PDF,PNG,...) support with preview and parametrization out-the-box "
- highly customizable look and feel
- \ref jkqtpplotter_styling "highly customizable look and feel (styling system)"
- \ref JKQTBASEPLOTTER_SYNCMULTIPLOT "supports the Qt layout system for graphs and allows to symchronize several graphs with each other "
- <b>\ref jkqtpdatastorage "centralized data management in an internal datastore)":</b>
- data organized by columns, can also represent image data (row-major)

View File

@ -23,23 +23,36 @@ Changes, compared to \ref WHATSNEW_V2018_08 "v2018.08" include:
<li> update: massively improved (doxygen-generated) <a href="http://jkriege2.github.io/JKQtPlotter/index.html">Online-Documentation (http://jkriege2.github.io/JKQtPlotter/index.html)</a> (automatically generated after each commit using ravis CI) </li>
<li> new: checked builds with continuous integration from AppVeyor: <a href="https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master">https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master</a> </li>
<li> new/update: support for building with Microsoft Visual Studio (Win), MinGW (Win), GCC (Linux/MacOS) </li>
<li> changed: using static const variables instead of \c #define for fixed default values (e.g. JKQTPImageTools::LUTSIZE, JKQTPImageTools::PALETTE_ICON_WIDTH, JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, JKQTMathText::ABS_MIN_LINEWIDTH ...)</li>
<li> Updates to JKQTPlotter:
<ul>
<li> update: \ref JKQTPLOTTER_USERINTERACTION "reworked user interactions API" </li>
<li> new: added JKQTPSingleColumnSymbolsGraph for single-column data, e.g. drawn as (random) scatter or bee-swar plots </li>
<li> new: stacked barcharts with JKQTPBarVerticalStackableGraph, JKQTPBarHorizontalStackableGraph </li>
<li> deprecated: Removed datarange-feature </li>
<li> new: use/support of C++11 features (e.g. \c std::function<> in JKQTPXFunctionLineGraph / JKQTPYFunctionLineGraph </li>
<li> new: use/support of C++11 features (e.g. \c std::function<> and lambda functions in JKQTPXFunctionLineGraph / JKQTPYFunctionLineGraph )</li>
<li> new: \ref jkqtpopencvinterface "optional OpenCV interface" </li>
<li> new: \ref jkqtpplotter_styling "Styling System for JKQTPlotter" </li>
<li> new: added debugging option, which surrounds different regions with visible rectangles (JKQTBasePlotter::enableDebugShowRegionBoxes() ) </li>
<li> fixed: colorbars at top were positioned over the plot label </li>
<li> new: frames (plot viewport, key/legend ...) may be rounded off at the corners</li>
<li> new: diverse new styling options (default font name/size ...)</li>
<li> new: additionl options for styling coordinate axes</li>
</ul></li>
<li> Updates to JKQTMathText:
<ul>
<li> update/fix: several general improvements and bugfixes </li>
<li> update/fix: improved error handling </li>
<li> update: updated contained version of STIX fonts, better handling of different STIX versions </li>
</ul></li>
<li> update/fix: several improvements and bugfixes to JKQTMathText </li>
</ul>
\subsection WHATSNEW_TRUNK_DOWNLOAD trunk: Download
This release is available from:
- Source code branch: <a href="https://github.com/jkriege2/JKQtPlotter/tree/v2018.08">https://github.com/jkriege2/JKQtPlotter/tree/v2018.08</a>
- Latest Release/Tag: <a href="https://github.com/jkriege2/JKQtPlotter/releases/tag/v2018.08">https://github.com/jkriege2/JKQtPlotter/releases/tag/v2018.08</a> (2018-Aug-19)
- Source code branch: <a href="https://github.com/jkriege2/JKQtPlotter">https://github.com/jkriege2/JKQtPlotter</a>
- Source Code download (ZIP): <a href="https://github.com/jkriege2/JKQtPlotter/archive/master.zip">https://github.com/jkriege2/JKQtPlotter/archive/master.zip</a>
- Git-Link: <a href="https://github.com/jkriege2/JKQtPlotter.git">https://github.com/jkriege2/JKQtPlotter.git</a>
.

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,182 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.46"
sodipodi:docname="plot_widget_orientation.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="D:\kriegerj\c++\quickfit2\doc\images\plot_widget_orientation.png"
inkscape:export-xdpi="146.66"
inkscape:export-ydpi="146.66">
<defs
id="defs4">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 526.18109 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="744.09448 : 526.18109 : 1"
inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
id="perspective10" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
inkscape:cx="271.52455"
inkscape:cy="831.44106"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1280"
inkscape:window-height="975"
inkscape:window-x="1276"
inkscape:window-y="-4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Ebene 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.5981288;stroke-linecap:butt;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect2383"
width="292.82428"
height="165.69046"
x="117.87356"
y="131.65982" />
<rect
style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.17256832;stroke-linecap:butt;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect3155"
width="209.48619"
height="124.68149"
x="158.36818"
y="153.64368" />
<text
xml:space="preserve"
style="font-size:11px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="260.32983"
y="125.21932"
id="text3157"><tspan
sodipodi:role="line"
id="tspan3159"
x="260.32983"
y="125.21932"
style="font-size:10px">widgetWidth</tspan></text>
<text
xml:space="preserve"
style="font-size:11px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="-215.20093"
y="111.81258"
id="text3161"
transform="matrix(0,-1,1,0,0,0)"><tspan
sodipodi:role="line"
id="tspan3163"
x="-215.20093"
y="111.81258"
style="font-size:10px">widgetHeight</tspan></text>
<text
xml:space="preserve"
style="font-size:11px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="261.44345"
y="167.74617"
id="text3165"><tspan
sodipodi:role="line"
id="tspan3167"
x="261.44345"
y="167.74617"
style="font-size:10px">plotWidth</tspan></text>
<text
xml:space="preserve"
style="font-size:11px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="-215.51587"
y="171.09828"
id="text3169"
transform="matrix(0,-1,1,0,0,0)"><tspan
sodipodi:role="line"
id="tspan3171"
x="-215.51587"
y="171.09828"
style="font-size:10px">plotHeight</tspan></text>
<text
xml:space="preserve"
style="font-size:11px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="-215.54541"
y="140.37894"
id="text3173"
transform="matrix(0,-1,1,0,0,0)"><tspan
sodipodi:role="line"
id="tspan3175"
x="-215.54541"
y="140.37894">plotBorderLeft</tspan></text>
<text
xml:space="preserve"
style="font-size:11px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="-215.54541"
y="392.91113"
id="text3177"
transform="matrix(0,-1,1,0,0,0)"><tspan
sodipodi:role="line"
id="tspan3179"
x="-215.54541"
y="392.91113">plotBorderRight</tspan></text>
<text
xml:space="preserve"
style="font-size:11px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="261.2916"
y="146.64789"
id="text3181"><tspan
sodipodi:role="line"
id="tspan3183"
x="261.2916"
y="146.64789">plotBorderTop</tspan></text>
<text
xml:space="preserve"
style="font-size:11px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
x="261.42856"
y="290.21933"
id="text3185"><tspan
sodipodi:role="line"
id="tspan3187"
x="261.42856"
y="290.21933">plotBorderBottom</tspan></text>
<path
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:1.1196053px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 118.69475,217.71932 L 158.09097,217.71932"
id="path3191" />
<path
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:1.16313291px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 367.66906,217.36218 L 410.18808,217.36218"
id="path3193" />
<path
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.83823812px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 261.78572,153.93944 L 261.78572,131.85637"
id="path3195" />
<path
style="fill:none;fill-rule:evenodd;stroke:#ff0000;stroke-width:0.77017045px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 261.42857,297.04045 L 261.42857,278.3982"
id="path3197" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -29,7 +29,7 @@ DEFINES += DEBUG_TIMING
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# include JKQTPlotter library
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug

View File

@ -8,7 +8,7 @@ QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug

View File

@ -35,7 +35,7 @@ DEFINES += AUTOLOAD_XITS_FONTS AUTOLOAD_Asana_FONTS
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug

View File

@ -12,7 +12,7 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* the Free Software Foundation; either version 2.1 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *

View File

@ -12,7 +12,7 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* the Free Software Foundation; either version 2.1 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *

View File

@ -12,7 +12,7 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* the Free Software Foundation; either version 2.1 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *

View File

@ -11,7 +11,7 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* the Free Software Foundation; either version 2.1 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *

View File

@ -11,7 +11,7 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* the Free Software Foundation; either version 2.1 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *

View File

@ -11,7 +11,7 @@
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3 of the License, or *
* the Free Software Foundation; either version 2.1 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *

View File

@ -13,6 +13,7 @@
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpgraphscontour.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"

View File

@ -4,6 +4,9 @@
#include <QDateTime>
#include <QApplication>
#include "jkqtplottergui/jkqtpcomboboxes.h"
#include "jkqtplotter/jkqtpgraphsimageoverlays.h"
#include "jkqtplotter/jkqtpgraphsimagergb.h"

View File

@ -13,6 +13,7 @@
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpgraphsimagergb.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpbaseelements.h"

View File

@ -70,6 +70,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -14,7 +14,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest
# include JKQTPlotter source headers and link against library
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest
# include JKQTPlotter source headers and link against library
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -21,6 +21,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_barchart
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -20,6 +20,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_boxplot
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -20,6 +20,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_dateaxes
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -20,9 +20,9 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER
RESOURCES += \
jkqtplotter_simpletest_dateaxes.qrc

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_errorbarstyles
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -19,6 +19,6 @@ CONFIG (debug, debug|release) {
}
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -13,7 +13,7 @@ TARGET = jkqtplotter_simpletest_filledgraphs
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -23,6 +23,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -11,7 +11,7 @@ TARGET = jkqtplotter_simpletest_functionplot
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -1,7 +1,7 @@
# 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`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_geometric/jkqtplotter_simpletest_geometric.cpp). First a plot is generated and the axis aspect ration is set to 1, so an accurate plot is generated. Then several geometric graphs are added to the plot. Here are some examples, you can find more more examples in the source code of the example:
The source code of the main application can be found in [`jkqtplotter_simpletest_geometric.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_geometric/jkqtplotter_simpletest_geometric.cpp). First a plot is generated and the axis aspect ratio is set to 1, so an accurate plot is generated. Then several geometric graphs are added to the plot. Here are some examples, you can find more more examples in the source code of the example:
```.cpp
// a text element

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_geometric
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -20,6 +20,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_imageplot
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -20,6 +20,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_imageplot_modifier
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -20,6 +20,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -12,7 +12,7 @@ QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -14,9 +14,9 @@ DEFINES += JKQTPLOTTER_OPENCV_INTERFACE
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER
# link agains OpenCV-3.4.1

View File

@ -11,7 +11,7 @@ TARGET = jkqtplotter_simpletest_impulsesplot
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_logaxes
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -11,7 +11,7 @@ TARGET = jkqtplotter_simpletest_parametriccurve
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -11,7 +11,7 @@ TARGET = jkqtplotter_simpletest_paramscatterplot
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -66,7 +66,7 @@ Finally the plot is styled and the axis aspect ratios are fixed:
// max. size is the size of the image
plot.setXY(0,image.width()-1,0,image.height()-1);
plot.setAbsoluteXY(0,image.width()-1,0,image.height()-1);
// ensure that axis aspect ration and coordinate system aspect ratio are maintained
// ensure that axis aspect ratio and coordinate system aspect ratio are maintained
plot.getPlotter()->setMaintainAspectRatio(true);
plot.getPlotter()->setAspectRatio(1);
plot.getPlotter()->setMaintainAxisAspectRatio(true);

View File

@ -78,7 +78,7 @@ int main(int argc, char* argv[])
// max. size is the size of the image
plot.setXY(0,image.width()-1,0,image.height()-1);
plot.setAbsoluteXY(0,image.width()-1,0,image.height()-1);
// ensure that axis aspect ration and coordinate system aspect ratio are maintained
// ensure that axis aspect ratio and coordinate system aspect ratio are maintained
plot.getPlotter()->setMaintainAspectRatio(true);
plot.getPlotter()->setAspectRatio(1);
plot.getPlotter()->setMaintainAxisAspectRatio(true);

View File

@ -13,7 +13,7 @@ TARGET = jkqtplotter_simpletest_paramscatterplot_image
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -24,6 +24,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -11,7 +11,7 @@ TARGET = jkqtplotter_simpletest_parsedfunctionplot
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -8,7 +8,7 @@
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphs.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpgraphsimagergb.h"
#include "jkqtplotter/jkqtpopencvinterface.h"
#include <opencv2/imgcodecs.hpp>

View File

@ -13,9 +13,9 @@ TARGET = jkqtplotter_simpletest_rgbimageplot_opencv
DEFINES += JKQTPLOTTER_OPENCV_INTERFACE
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER
# link agains OpenCV-3.4.1

View File

@ -8,7 +8,7 @@
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphs.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpgraphsimagergb.h"

View File

@ -13,7 +13,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_rgbimageplot_qt
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ CONFIG (debug, debug|release) {
}
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -11,7 +11,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_speed
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -11,7 +11,7 @@ TARGET = jkqtplotter_simpletest_stackedbars
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -21,6 +21,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -11,7 +11,7 @@ TARGET = jkqtplotter_simpletest_stepplots
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -21,6 +21,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -54,8 +54,6 @@ int main(int argc, char* argv[])
// 7. set some axis properties (we use LaTeX for nice equation rendering)
plot.getXAxis()->setAxisLabel(QObject::tr("x-axis $x$ [mm]"));
plot.getYAxis()->setAxisLabel(QObject::tr("\\textbf{\\color{red}{y-axis} $\\left(y=\\sin(x)\\pm(0.2+0.25\\cdot x)\\right)$ [A.U.]}"));
plot.getXAxis()->setLabelFont("Arial");
plot.getYAxis()->setLabelFont("Times New Roman");
plot.getYAxis()->setLabelFontSize(12); // large x-axis label
plot.getYAxis()->setTickLabelFontSize(10); // and larger y-axis tick labels

View File

@ -56,8 +56,6 @@ int main(int argc, char* argv[])
// 7. set some axis properties (we use LaTeX for nice equation rendering)
plot.getXAxis()->setAxisLabel(QObject::tr("x-axis $x$ [mm]"));
plot.getYAxis()->setAxisLabel(QObject::tr("\\textbf{\\color{red}{y-axis} $\\left(y=\\sin(x)\\pm(0.2+0.25\\cdot x)\\right)$ [A.U.]}"));
plot.getXAxis()->setLabelFont("Arial");
plot.getYAxis()->setLabelFont("Times New Roman");
plot.getYAxis()->setLabelFontSize(12); // large x-axis label
plot.getYAxis()->setTickLabelFontSize(10); // and larger y-axis tick labels

View File

@ -11,7 +11,7 @@ TARGET = jkqtplotter_simpletest_symbols_and_errors
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -11,7 +11,7 @@ TARGET = jkqtplotter_simpletest_symbols_and_styles
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -22,6 +22,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -37,7 +37,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_ui
# include JKQTPlotter source headers and link against library
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -48,9 +48,9 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER
```
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).

View File

@ -15,7 +15,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = jkqtplotter_simpletest_ui
# include JKQTPlotter source headers and link against library
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -26,6 +26,6 @@ message("LIBS = $$LIBS")
win32-msvc*: DEFINES += _USE_MATH_DEFINES
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -10,7 +10,7 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = test_distributionplot
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -20,6 +20,6 @@ CONFIG (debug, debug|release) {
message("LIBS = $$LIBS")
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -66,19 +66,19 @@ Finally the axes and plots need a bit of formatting to make them look nicer:
plotResid->getYAxis()->setAxisLabel("residuals");
plotResidHist->getXAxis()->setAxisLabel("frequency");
// 6.2 switch off the tick labels on the axes that directly face another plot
plotMain->getXAxis()->setDrawMode1(JKQTPCADMticks);
plotResidHist->getYAxis()->setDrawMode1(JKQTPCADMticks);
plotMain->getXAxis()->setDrawMode1(JKQTPCADMLineTicks);
plotResidHist->getYAxis()->setDrawMode1(JKQTPCADMLineTicks);
// 6.3 show tick labels on the rhs y-axis of the residual histogram plot
plotResidHist->getYAxis()->setDrawMode2(JKQTPCADMticksAndLabels);
plotResidHist->getYAxis()->setDrawMode2(JKQTPCADMLineTicksTickLabels);
// 6.4 hide keys in all plots but the main plot
plotResid->getPlotter()->setShowKey(false);
plotResidHist->getPlotter()->setShowKey(false);
// 6.5 hide position label and toolbars in the plots except main plot
plotResid->setToolbarVisible(false);
plotResid->setToolbarEnabled(false);
plotResid->setMousePositionShown(false);
plotResidHist->setToolbarVisible(false);
plotResidHist->setToolbarEnabled(false);
plotResidHist->setMousePositionShown(false);
plotMain->setToolbarVisible(true);
plotMain->setToolbarEnabled(true);
```
As a last step, the axes are scaled automatically, so the data fills the plots:

View File

@ -131,19 +131,19 @@ int main(int argc, char* argv[])
plotResid->getYAxis()->setAxisLabel("residuals");
plotResidHist->getXAxis()->setAxisLabel("frequency");
// 6.2 switch off the tick labels on the axes that directly face another plot
plotMain->getXAxis()->setDrawMode1(JKQTPCADMticks);
plotResidHist->getYAxis()->setDrawMode1(JKQTPCADMticks);
plotMain->getXAxis()->setDrawMode1(JKQTPCADMLineTicks);
plotResidHist->getYAxis()->setDrawMode1(JKQTPCADMLineTicks);
// 6.3 show tick labels on the rhs y-axis of the residual histogram plot
plotResidHist->getYAxis()->setDrawMode2(JKQTPCADMticksAndLabels);
plotResidHist->getYAxis()->setDrawMode2(JKQTPCADMLineTicksTickLabels);
// 6.4 hide keys in all plots but the main plot
plotResid->getPlotter()->setShowKey(false);
plotResidHist->getPlotter()->setShowKey(false);
// 6.5 hide position label and toolbars in the plots except main plot
plotResid->setToolbarVisible(false);
plotResid->setToolbarEnabled(false);
plotResid->setMousePositionShown(false);
plotResidHist->setToolbarVisible(false);
plotResidHist->setToolbarEnabled(false);
plotResidHist->setMousePositionShown(false);
plotMain->setToolbarVisible(true);
plotMain->setToolbarEnabled(true);
// 7. scale plots automatically to data

View File

@ -13,7 +13,7 @@ TARGET = test_multiplot
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -32,9 +32,9 @@ win32-msvc* {
}
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER
FORMS += \
test_multiplot_ui.ui

View File

@ -0,0 +1,95 @@
# Tutorial (JKQTPlotter): Styling a JKQtPlotter {#JKQTPlotterStyling}
[TOC]
## Basic Description
This project (see `./examples/test_styling/`) demonstrates different types of user-interactions in JKQTPlotter.
It contains a simple plot with two graphs and provides several widgets that allow to modify the plot styling by editing an INI file:
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/test_styling.png)
## Altering the Default Style
### Global/System-wide Settings
The `main()`-function can be found in [`test_styling_main.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling/test_styling_main.cpp). Here the Qt application is initialized in the usual way and the main window `win` is created and shown. After instanciating the `QApplication`, but befor instanciating the window (and thus the JKQTPlotter), you can already alter the system-wide default styling. It is accessible via the function `JKQTPGetSystemDefaultStyle()`, which returns a reference to the central style object of type `JKQTPlotterStyle`. In the example below, the color of the user-actions (e.g. of the zooming rectangle, that can be drawn with the mouse) is set to red:
```.cpp
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// you can set the system-wide default style properties early on
// all JKQTPlotter instance created after this, will use these
// settings as their initial settings
JKQTPGetSystemDefaultStyle().userActionColor=QColor("red");
TestStyling win;
win.show();
return app.exec();
}
```
In addition to `JKQTPGetSystemDefaultStyle()`, which allows to style the `JKQTPlotter` (mainly the GUI-parts and user-action bindings), there is also `JKQTPGetSystemDefaultBaseStyle()`, which accesses a central instance of `JKQTBasePlotterStyle`. The latter object contains the styling of the graph itself (colors, axis properties, ...).
You can also store these settings in an INI-file (or any file supported by [`QSettings`](http://doc.qt.io/qt-5/qsettings.html)) and load such a file on startup, using:
```.cpp
QSettings plotSettings("JKQTPlotterSettings.ini", QSettings::IniFormat);;
JKQTPGetSystemDefaultStyle().loadSettings(plotSettings);
JKQTPGetSystemDefaultBaseStyle().loadSettings(plotSettings);
```
### Apply a new Style to an Existing JKQTPlotter
The major part of the source code of the main application can be found in [`test_styling.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/test_styling/test_styling.cpp). It opens a window with a plotter, that contains a set of test graphs to demonstrate the styling. The following function is connected to the "Update Graph"-button and applys the style defined by the INI in the plainTextEdit to the plotter:
```.cpp
void TestStyling::on_btnUpdate_clicked()
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
// In this function, we store the data from the plainTextEdit into a temporary file
// tmpfn and the use that file's contents to create a QSettings object, which is used
// to read the plotterStyle into the JKQTPlotter-object ui->plot (using loadCurrentPlotterStyle(settings) )
QString tmpfn=QDir::tempPath()+"/jkqtplotter_config.tmp";
{
QFile data(tmpfn);
if (data.open(QFile::WriteOnly|QFile::Text)) {
QTextStream out(&data);
out << ui->plainTextEdit->toPlainText();
}
}
{
QSettings settings(tmpfn, QSettings::IniFormat);
ui->plot->loadCurrentPlotterStyle(settings);
initPlot();
ui->chkDebugBoxes->setChecked(ui->plot->getPlotter()->isDebugShowRegionBoxesEnabled());
}
QFile::remove(tmpfn);
QApplication::restoreOverrideCursor();
}
```
## Some Example Styles
The following gallery shows a set of example styles:
| Style-file | Screenshot |
|:-------------:| ------------- |
| <b> The Default Style </b> | ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/style_default.png) |
| [`lib/jkqtplotterressources/style/simple_gridandticks.ini`](https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/simple_gridandticks.ini) | ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/style_simple_axesoffset_plotbox.png) |
| [`lib/jkqtplotterressources/style/simple_axesoffset.ini`](https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/simple_axesoffset.ini) | ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/style_simple_axesoffset.png) |
| [`lib/jkqtplotterressources/style/simple_axesoffset_plotbox.ini`](https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/simple_axesoffset_plotbox.ini) | ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/style_simple_axesoffset_plotbox.png) |
| [`lib/jkqtplotterressources/style/dark.ini`](https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/dark.ini) | ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/style_dark.png) |
| [`lib/jkqtplotterressources/style/blueprint.ini`](https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/blueprint.ini) | ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/style_blueprint.png) |
| [`lib/jkqtplotterressources/style/blackandwhite.ini`](https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotterressources/styles/blackandwhite.ini) | ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/style_blackandwhite.png) |
<b>Note:</b> The styles listed above are also linked into the executable as Qt ressource ... you can use them e.g. as follows:
```.cpp
QSettings plotSettings(":/JKQTPlotter/styles/blackandwhite.ini", QSettings::IniFormat);;
JKQTPGetSystemDefaultStyle().loadSettings(plotSettings);
JKQTPGetSystemDefaultBaseStyle().loadSettings(plotSettings);
```

View File

@ -0,0 +1,283 @@
#include "test_styling.h"
#include "ui_test_styling.h"
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphs.h"
#include "jkqtplotter/jkqtpgraphsbarchart.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include <QDir>
#include <QTextStream>
#include <QFileDialog>
TestStyling::TestStyling(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::TestStyling)
{
// set up the GUI
ui->setupUi(this);
ui->splitter->setStretchFactor(0,1);
ui->splitter->setStretchFactor(1,1);
// initialize a simple plot
initPlot();
// connect GUI to JKQTPlotter
connect(ui->chkGrid, SIGNAL(toggled(bool)), ui->plot, SLOT(setGrid(bool)));
connect(ui->chkLogX, SIGNAL(toggled(bool)), ui->plot->getXAxis(), SLOT(setLogAxis(bool)));
connect(ui->chkLogY, SIGNAL(toggled(bool)), ui->plot->getYAxis(), SLOT(setLogAxis(bool)));
connect(ui->chkDebugBoxes, SIGNAL(toggled(bool)), ui->plot->getPlotter(), SLOT(enableDebugShowRegionBoxes(bool)));
// store JKQTPlotter plotterStyle to a temporary INI-file
// and then load that temporary file into the plainTextEdit,
// using on_btnLoad_clicked(tmpfn). This ensures that the currently
// set plotterStyle is visible in the plainTextEdit and can be edited
// by the user
QString tmpfn=QDir::tempPath()+"/jkqtplotter_config.tmp";
{
QSettings settings(tmpfn, QSettings::IniFormat);
ui->plot->saveCurrentPlotterStyle(settings);
}
on_btnLoad_clicked(tmpfn);
QFile::remove(tmpfn);
}
TestStyling::~TestStyling()
{
delete ui;
if (!plotExtra.isNull()) {
plotExtra->close();
plotExtra.clear();
}
}
void TestStyling::on_btnUpdate_clicked()
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
// In this function, we store the data from the plainTextEdit into a temporary file
// tmpfn and the use that file's contents to create a QSettings object, which is used
// to read the plotterStyle into the JKQTPlotter-object ui->plot (using loadCurrentPlotterStyle(settings) )
QString tmpfn=QDir::tempPath()+"/jkqtplotter_config.tmp";
{
QFile data(tmpfn);
if (data.open(QFile::WriteOnly|QFile::Text)) {
QTextStream out(&data);
out << ui->plainTextEdit->toPlainText();
}
}
{
QSettings settings(tmpfn, QSettings::IniFormat);
ui->plot->loadCurrentPlotterStyle(settings);
initPlot();
ui->chkDebugBoxes->setChecked(ui->plot->getPlotter()->isDebugShowRegionBoxesEnabled());
}
QFile::remove(tmpfn);
QApplication::restoreOverrideCursor();
}
void TestStyling::on_btnLoad_clicked(const QString& filename)
{
// loads a plotterTsyle INI file from harddisk into the plainTextEdit
// and then calls on_btnUpdate_clicked() to apply it immediately to plot
QString fn=filename;
if (fn.size()==0) {
fn=QFileDialog::getOpenFileName(this, tr("Open Styling INI-File"),
"",
tr("Styling INI (*.ini *.cfg *.txt)"));
}
if (fn.size()>0) {
QFile data(fn);
if (data.open(QFile::ReadOnly|QFile::Text)) {
ui->plainTextEdit->setPlainText(data.readAll());
}
}
on_btnUpdate_clicked();
}
void TestStyling::on_btnSave_clicked()
{
// stores the contents of plainTextEdit into a file on the harddisk
QString fn=QFileDialog::getSaveFileName(this, tr("Save Styling INI-File"),
"",
tr("Styling INI (*.ini *.cfg *.txt)"));
if (fn.size()>0) {
QFile data(fn);
if (data.open(QFile::WriteOnly|QFile::Text)) {
QTextStream out(&data);
out << ui->plainTextEdit->toPlainText();
}
QPixmap img=ui->plot->grab();
img.save(fn+".png", "png");
ui->plot->saveImage(fn+".export.png", false);
}
}
void TestStyling::initPlot()
{
ui->plot->setPlotUpdateEnabled(false);
// 0. get a pointer to the internal datastore (for convenience)
JKQTPDatastore* ds=ui->plot->getDatastore();
// 1. clear old graphs/data
ui->plot->clearGraphs(true);
ds->clear();
// 2. now we create data for a simple plot (a sine curve)
QVector<double> X, Y1, Y2, img, X3, Y3, Y3err, Xbar, Ybar, Ybar2;
const int Ndata=100;
for (int i=0; i<Ndata; i++) {
const double x=double(i)/double(Ndata)*8.0*M_PI;
X<<x;
Y1<<1.1+sin(x);
Y2<<1.1+sin(x)*exp(-0.2*x);
if (i%5==0) {
X3<<x;
Y3<<(1.5+Y1.last());
Y3err<<(double(i+5)/double(Ndata)*0.5);
}
if (i>0 && i%20==0) {
Xbar<<x;
Ybar<<(double(i+5)/double(Ndata)*(-1.5));
Ybar2<<(double(i+5)/double(Ndata)*(-1.2));
}
}
auto fgauss=[](double x, double y, double x0, double y0, double sx, double sy) {
return exp(-2.0*(x-x0)*(x-x0)/sx/sx-2.0*(y-y0)*(y-y0)/sy/sy);
};
for (int i=0; i<Ndata; i++) {
for (int j=0; j<Ndata; j++) {
img.push_back(fgauss(j,i,Ndata/3,Ndata/3,Ndata/5,Ndata/3)+fgauss(j,i,Ndata*3/4,Ndata*2/3,Ndata/2,Ndata/4));
}
}
// 3. make data available to JKQTPlotter by adding it to the internal datastore.
// Note: In this step the data is copied (of not specified otherwise), so you can
// reuse X and Y afterwards!
// the variables columnX and columnY will contain the internal column ID of the newly
// created columns with names "x" and "y" and the (copied) data from X and Y.
size_t columnX=ds->addCopiedColumn(X, "x");
size_t columnY1=ds->addCopiedColumn(Y1, "y1");
size_t columnY2=ds->addCopiedColumn(Y2, "y2");
size_t columnImg=ds->addCopiedColumn(img, "img");
size_t columnX3=ds->addCopiedColumn(X3, "x3");
size_t columnY3=ds->addCopiedColumn(Y3, "y3");
size_t columnY3err=ds->addCopiedColumn(Y3err, "y3err");
size_t columnXbar=ds->addCopiedColumn(Xbar, "xbar");
size_t columnYbar=ds->addCopiedColumn(Ybar, "ybar");
size_t columnYbar2=ds->addCopiedColumn(Ybar2, "Ybar2");
// 4. create a graph in the plot, which plots the dataset X/Y:
JKQTPColumnMathImage* graphI=new JKQTPColumnMathImage(ui->plot);
graphI->setImageColumn(columnImg);
graphI->setNx(Ndata);
graphI->setNy(Ndata);
graphI->setColorBarTopVisible(true);
graphI->setColorBarRightVisible(true);
graphI->setX(0.5);
graphI->setY(-1.5);
graphI->setWidth(5);
graphI->setHeight(1);
graphI->setTitle(QObject::tr("2{\\times}Gauss"));
ui->plot->addGraph(graphI);
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(ui->plot);
graph1->setXColumn(columnX);
graph1->setYColumn(columnY1);
graph1->setTitle(QObject::tr("sine graph $f(x)=\\sin(x)$"));
ui->plot->addGraph(graph1);
JKQTPXYLineGraph* graph2=new JKQTPXYLineGraph(ui->plot);
graph2->setXColumn(columnX);
graph2->setYColumn(columnY2);
graph2->setSymbol(JKQTPNoSymbol);
//graph2->setTitle(QObject::tr("sine{\\cdot}exp graph $f(x)=\\sin(x)\\cdot\\exp\\left(-\\frac{x}{5}\\right)$"));
graph2->setTitle(QObject::tr("sine*exp graph"));
ui->plot->addGraph(graph2);
JKQTPXYLineErrorGraph* graph3=new JKQTPXYLineErrorGraph(ui->plot);
graph3->setXColumn(columnX3);
graph3->setYColumn(columnY3);
graph3->setYErrorColumn(columnY3err);
graph3->setDrawLine(false);
graph3->setTitle(QObject::tr("sine \\pm errors graph"));
ui->plot->addGraph(graph3);
JKQTPBarVerticalGraph* graphb=new JKQTPBarVerticalGraph(ui->plot);
graphb->setXColumn(columnXbar);
graphb->setYColumn(columnYbar);
graphb->setTitle(QObject::tr("barchart"));
ui->plot->addGraph(graphb);
JKQTPBarVerticalGraph* graphb2=new JKQTPBarVerticalGraph(ui->plot);
graphb2->setXColumn(columnXbar);
graphb2->setYColumn(columnYbar2);
graphb2->setTitle(QObject::tr("2^{nd} barchart"));
ui->plot->addGraph(graphb2);
graphb2->autoscaleBarWidthAndShiftSeparatedGroups();
// 6. autoscale the plot so the graph is contained
ui->plot->zoomToFit();
ui->plot->getPlotter()->setPlotLabel("Sine Plots - User-Interaction Example");
ui->plot->getXAxis()->setAxisLabel("x-axis");
ui->plot->getYAxis()->setAxisLabel("y-axis");
ui->plot->setPlotUpdateEnabled(true);
ui->plot->redrawPlot();
if (!plotExtra) {
plotExtra=new JKQTPlotter;
plotExtra->show();
plotExtra->resize(width(),300);
plotExtra->move(pos().x(), pos().y()+height()+32);
}
plotExtra->setPlotUpdateEnabled(false);
plotExtra->clearGraphs(true);
plotExtra->getPlotter()->setBackgroundColor(ui->plot->getPlotter()->getBackgroundColor());
plotExtra->getPlotter()->setExportBackgroundColor(ui->plot->getPlotter()->getExportBackgroundColor());
plotExtra->getPlotter()->setPlotBackgroundColor(ui->plot->getPlotter()->getPlotBackgroundColor());
plotExtra->getXAxis()->setDrawMode1(JKQTPCADMnone);
plotExtra->getXAxis()->setDrawMode2(JKQTPCADMnone);
plotExtra->getYAxis()->setDrawMode1(JKQTPCADMnone);
plotExtra->getYAxis()->setDrawMode2(JKQTPCADMnone);
double x=1;
double xlineend=6;
double y=1;
double xmax=15;
int cnt=0;
for (auto s: ui->plot->getPlotter()->getCurrentPlotterStyle().defaultGraphSymbols) {
plotExtra->addGraph(new JKQTPGeoSymbol(plotExtra.data(), x, y, s, 12, QColor("red"), QColor("salmon") ));
x+=1;
xmax=qMax(x, xmax);
if (cnt>0 && cnt%25==0) {
x=1;
y+=1.0;
}
cnt++;
}
y=y+1;
double ycoltest=y;
for (auto s: ui->plot->getPlotter()->getCurrentPlotterStyle().defaultGraphPenStyles) {
plotExtra->addGraph(new JKQTPGeoLine(plotExtra.data(), 1,y,xlineend,y,QColor("red"), 2, s));
plotExtra->addGraph(new JKQTPGeoLine(plotExtra.data(), 1,y-0.25,xlineend,y-0.25,QColor("maroon"), 1, s));
y+=0.75;
}
x=xlineend+1;
double dx=(xmax-xlineend-1.0)/static_cast<double>(ui->plot->getPlotter()->getCurrentPlotterStyle().defaultGraphColors.size());
for (auto s: ui->plot->getPlotter()->getCurrentPlotterStyle().defaultGraphColors) {
plotExtra->addGraph(new JKQTPGeoLine(plotExtra.data(), x,ycoltest,x,y-0.5,s,5));
plotExtra->addGraph(new JKQTPGeoRectangle(plotExtra.data(), x+dx/2,(ycoltest+y-0.5)/2.0, dx*0.5, y-ycoltest-0.5, s,1, Qt::SolidLine, JKQTPGetDerivedColor(ui->plot->getPlotter()->getCurrentPlotterStyle().graphFillColorDerivationMode, s)));
x+=dx;
}
plotExtra->zoomToFit();
plotExtra->setX(0, plotExtra->getXMax()+2);
plotExtra->setY(0, plotExtra->getYMax()+1);
plotExtra->setGrid(false);
plotExtra->getPlotter()->setPlotLabel("default symbols/lines/colors");
plotExtra->setPlotUpdateEnabled(true);
plotExtra->redrawPlot();
}

View File

@ -0,0 +1,30 @@
#ifndef TEST_STYLING_H
#define TEST_STYLING_H
#include <QMainWindow>
#include "jkqtplotter/jkqtplotter.h"
namespace Ui {
class TestStyling;
}
class TestStyling : public QMainWindow
{
Q_OBJECT
public:
explicit TestStyling(QWidget *parent = nullptr);
~TestStyling();
protected slots:
void on_btnUpdate_clicked();
void on_btnLoad_clicked(const QString &filename=QString());
void on_btnSave_clicked();
private:
Ui::TestStyling *ui;
void initPlot();
QPointer<JKQTPlotter> plotExtra;
};
#endif // TEST_STYLING_H

View File

@ -0,0 +1,48 @@
# configure Qt
CONFIG += link_prl qt c++11
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# output executable name
TARGET = test_styling
# source code for this simple demo
SOURCES = test_styling_main.cpp \
test_styling.cpp
HEADERS += \
test_styling.h
FORMS += \
test_styling.ui
# include JKQTPlotter source code
DEPENDPATH += ../../lib \
../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
} else {
LIBS += -L../../staticlib/release -ljkqtplotterlib
}
message("LIBS = $$LIBS")
win32-msvc* {
QMAKE_CXXFLAGS += /EHsc /std:c++14
# To enable M_PI, M_E,...
DEFINES += _USE_MATH_DEFINES
# To fix error: C2338: va_start argument must not
# have reference type and must not be parenthesized
DEFINES += _CRT_NO_VA_START_VALIDATION
}

View File

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TestStyling</class>
<widget class="QMainWindow" name="TestStyling">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>863</width>
<height>559</height>
</rect>
</property>
<property name="windowTitle">
<string>Tutorial/TestApp: JKQTPlotter Styling</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="JKQTPlotter" name="plot" native="true"/>
<widget class="QWidget" name="layoutWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>debug-boxes:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkDebugBoxes">
<property name="text">
<string>enabled</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>log scales:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkLogX">
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkLogY">
<property name="text">
<string>Y</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>grids:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkGrid">
<property name="text">
<string>X + Y</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="btnLoad">
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="btnUpdate">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Update Graph</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="btnSave">
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QPlainTextEdit" name="plainTextEdit">
<property name="font">
<font>
<family>Courier New</family>
<pointsize>10</pointsize>
</font>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="placeholderText">
<string>enter plotter style INI contents here ...</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>plotter style:</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>863</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>JKQTPlotter</class>
<extends>QWidget</extends>
<header>jkqtplotter/jkqtplotter.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
jkqtplotterlib.file = ../../staticlib/jkqtplotterlib.pro
test_styling.file=$$PWD/test_styling.pro
test_styling.depends = jkqtplotterlib
SUBDIRS += jkqtplotterlib test_styling

View File

@ -0,0 +1,19 @@
#include <QApplication>
#include "test_styling.h"
#include "jkqtplotter/jkqtplotterstyle.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// you can set the system-wide default style properties early on
// all JKQTPlotter instance created after this, will use these
// settings as their initial settings
JKQTPGetSystemDefaultStyle().userActionColor=QColor("red");
TestStyling win;
win.show();
return app.exec();
}

View File

@ -34,14 +34,14 @@ The rest of the form contains several Qt widgets which switch diverse aspects of
// add a QComboBox that allows to set the left mouse button action for the JKQTPlotter
cmbLeftNoModMouseAction=new QComboBox(this);
layForm->addRow("mouse action: left-click, no modifiers", cmbLeftNoModMouseAction);
cmbLeftNoModMouseAction->addItem("PanPlotOnMove");
cmbLeftNoModMouseAction->addItem("PanPlotOnRelease");
cmbLeftNoModMouseAction->addItem("ZoomRectangle");
cmbLeftNoModMouseAction->addItem("DrawRectangleForEvent");
cmbLeftNoModMouseAction->addItem("DrawCircleForEvent");
cmbLeftNoModMouseAction->addItem("DrawEllipseForEvent");
cmbLeftNoModMouseAction->addItem("DrawLineForEvent");
cmbLeftNoModMouseAction->addItem("ScribbleForEvents");
cmbLeftNoModMouseAction->addItem("jkqtpmdaPanPlotOnMove");
cmbLeftNoModMouseAction->addItem("jkqtpmdaPanPlotOnRelease");
cmbLeftNoModMouseAction->addItem("jkqtpmdaZoomByRectangle");
cmbLeftNoModMouseAction->addItem("jkqtpmdaDrawRectangleForEvent");
cmbLeftNoModMouseAction->addItem("jkqtpmdaDrawCircleForEvent");
cmbLeftNoModMouseAction->addItem("jkqtpmdaDrawEllipseForEvent");
cmbLeftNoModMouseAction->addItem("jkqtpmdaDrawLineForEvent");
cmbLeftNoModMouseAction->addItem("jkqtpmdaScribbleForEvents");
cmbLeftNoModMouseAction->addItem("NoMouseAction");
cmbLeftNoModMouseAction->setCurrentIndex(2);
connect(cmbLeftNoModMouseAction, SIGNAL(currentIndexChanged(int)), this, SLOT(setLeftMouseAction(int)));
@ -52,7 +52,7 @@ The rest of the form contains several Qt widgets which switch diverse aspects of
void TestUserInteraction::setLeftMouseAction(int index)
{
if (index==cmbLeftNoModMouseAction->count()-1) plot->deregisterMouseDragAction(Qt::LeftButton, Qt::NoModifier);
else plot->registerMouseDragAction(Qt::LeftButton, Qt::NoModifier, static_cast<JKQTPlotter::MouseDragActions>(index));
else plot->registerMouseDragAction(Qt::LeftButton, Qt::NoModifier, static_cast<JKQTPMouseDragActions>(index));
}
```
@ -85,7 +85,7 @@ The JKQTPlotter contains a small text display for the current mouse position (in
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/mousepositiondisplay.gif)
### Drag the Plot Viewport
You can move the viewport of the graph using the mouse ("PanPlotOnMove"-action). If you drag inside the plot window, you can move in both directions, if you drag over one of the coordinate axes, you can change the range of this axis only:
You can move the viewport of the graph using the mouse ("jkqtpmdaPanPlotOnMove"-action). If you drag inside the plot window, you can move in both directions, if you drag over one of the coordinate axes, you can change the range of this axis only:
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/drag_viewport.gif)
@ -93,7 +93,7 @@ You can move the viewport of the graph using the mouse ("PanPlotOnMove"-action).
There are several options to zoom, using the mouse:
* using the mouse wheel
* with double-click actions ClickZoomsOut, ClickZoomsIn
* with double-click actions jkqtpdcaClickZoomsOut, jkqtpdcaClickZoomsIn
* using the context menu (or the toolbar)<br>
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/zoomin_mouse_contextmenu.gif)

View File

@ -51,8 +51,8 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
// add a checkbox to en-/disable the toolbar of the JKQTPlotter
chkShowToolbar=new QCheckBox(tr("enable toolbar"), this);
chkShowToolbar->setChecked(plot->isToolbarVisible());
connect(chkShowToolbar, SIGNAL(toggled(bool)), plot, SLOT(setToolbarVisible(bool)));
chkShowToolbar->setChecked(plot->isToolbarEnabled());
connect(chkShowToolbar, SIGNAL(toggled(bool)), plot, SLOT(setToolbarEnabled(bool)));
layChk->addWidget(chkShowToolbar);
// add a checkbox to switch the toolbar between always visible and the hiding mode,
@ -68,7 +68,7 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
connect(chkGrid, SIGNAL(toggled(bool)), plot, SLOT(setGrid(bool)));
layChk->addWidget(chkGrid);
// add a checkbox to switch the grid on and off
// add a checkbox to switch log-scale on each axis on or off
chkLogX=new QCheckBox(tr("X log-scale"), this);
chkLogX->setChecked(false);
connect(chkLogX, SIGNAL(toggled(bool)), plot->getXAxis(), SLOT(setLogAxis(bool)));
@ -93,14 +93,14 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
// add a QComboBox that allows to set the left mouse button action for the JKQTPlotter
cmbLeftNoModMouseAction=new QComboBox(this);
layForm->addRow("mouse action: left-click, no modifiers", cmbLeftNoModMouseAction);
cmbLeftNoModMouseAction->addItem("PanPlotOnMove");
cmbLeftNoModMouseAction->addItem("PanPlotOnRelease");
cmbLeftNoModMouseAction->addItem("ZoomRectangle");
cmbLeftNoModMouseAction->addItem("DrawRectangleForEvent");
cmbLeftNoModMouseAction->addItem("DrawCircleForEvent");
cmbLeftNoModMouseAction->addItem("DrawEllipseForEvent");
cmbLeftNoModMouseAction->addItem("DrawLineForEvent");
cmbLeftNoModMouseAction->addItem("ScribbleForEvents");
cmbLeftNoModMouseAction->addItem("jkqtpmdaPanPlotOnMove");
cmbLeftNoModMouseAction->addItem("jkqtpmdaPanPlotOnRelease");
cmbLeftNoModMouseAction->addItem("jkqtpmdaZoomByRectangle");
cmbLeftNoModMouseAction->addItem("jkqtpmdaDrawRectangleForEvent");
cmbLeftNoModMouseAction->addItem("jkqtpmdaDrawCircleForEvent");
cmbLeftNoModMouseAction->addItem("jkqtpmdaDrawEllipseForEvent");
cmbLeftNoModMouseAction->addItem("jkqtpmdaDrawLineForEvent");
cmbLeftNoModMouseAction->addItem("jkqtpmdaScribbleForEvents");
cmbLeftNoModMouseAction->addItem("NoMouseAction");
cmbLeftNoModMouseAction->setCurrentIndex(2);
connect(cmbLeftNoModMouseAction, SIGNAL(currentIndexChanged(int)), this, SLOT(setLeftMouseAction(int)));
@ -109,14 +109,14 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
// add a QComboBox that allows to set the left mouse button action for the JKQTPlotter
cmbLeftCtrlModMouseAction=new QComboBox(this);
layForm->addRow("mouse action: left-click, Ctrl modifier", cmbLeftCtrlModMouseAction);
cmbLeftCtrlModMouseAction->addItem("PanPlotOnMove");
cmbLeftCtrlModMouseAction->addItem("PanPlotOnRelease");
cmbLeftCtrlModMouseAction->addItem("ZoomRectangle");
cmbLeftCtrlModMouseAction->addItem("DrawRectangleForEvent");
cmbLeftCtrlModMouseAction->addItem("DrawCircleForEvent");
cmbLeftCtrlModMouseAction->addItem("DrawEllipseForEvent");
cmbLeftCtrlModMouseAction->addItem("DrawLineForEvent");
cmbLeftCtrlModMouseAction->addItem("ScribbleForEvents");
cmbLeftCtrlModMouseAction->addItem("jkqtpmdaPanPlotOnMove");
cmbLeftCtrlModMouseAction->addItem("jkqtpmdaPanPlotOnRelease");
cmbLeftCtrlModMouseAction->addItem("jkqtpmdaZoomByRectangle");
cmbLeftCtrlModMouseAction->addItem("jkqtpmdaDrawRectangleForEvent");
cmbLeftCtrlModMouseAction->addItem("jkqtpmdaDrawCircleForEvent");
cmbLeftCtrlModMouseAction->addItem("jkqtpmdaDrawEllipseForEvent");
cmbLeftCtrlModMouseAction->addItem("jkqtpmdaDrawLineForEvent");
cmbLeftCtrlModMouseAction->addItem("jkqtpmdaScribbleForEvents");
cmbLeftCtrlModMouseAction->addItem("NoMouseAction");
cmbLeftCtrlModMouseAction->setCurrentIndex(0);
connect(cmbLeftCtrlModMouseAction, SIGNAL(currentIndexChanged(int)), this, SLOT(setLeftCtrlMouseAction(int)));
@ -125,14 +125,14 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
// add a QComboBox that allows to set the left mouse button action for the JKQTPlotter
cmbRightNoModMouseAction=new QComboBox(this);
layForm->addRow("mouse action: right-click, no modifiers", cmbRightNoModMouseAction);
cmbRightNoModMouseAction->addItem("PanPlotOnMove");
cmbRightNoModMouseAction->addItem("PanPlotOnRelease");
cmbRightNoModMouseAction->addItem("ZoomRectangle");
cmbRightNoModMouseAction->addItem("DrawRectangleForEvent");
cmbRightNoModMouseAction->addItem("DrawCircleForEvent");
cmbRightNoModMouseAction->addItem("DrawEllipseForEvent");
cmbRightNoModMouseAction->addItem("DrawLineForEvent");
cmbRightNoModMouseAction->addItem("ScribbleForEvents");
cmbRightNoModMouseAction->addItem("jkqtpmdaPanPlotOnMove");
cmbRightNoModMouseAction->addItem("jkqtpmdaPanPlotOnRelease");
cmbRightNoModMouseAction->addItem("jkqtpmdaZoomByRectangle");
cmbRightNoModMouseAction->addItem("jkqtpmdaDrawRectangleForEvent");
cmbRightNoModMouseAction->addItem("jkqtpmdaDrawCircleForEvent");
cmbRightNoModMouseAction->addItem("jkqtpmdaDrawEllipseForEvent");
cmbRightNoModMouseAction->addItem("jkqtpmdaDrawLineForEvent");
cmbRightNoModMouseAction->addItem("jkqtpmdaScribbleForEvents");
cmbRightNoModMouseAction->addItem("ContextMenu");
cmbRightNoModMouseAction->setCurrentIndex(5);
connect(cmbRightNoModMouseAction, SIGNAL(currentIndexChanged(int)), this, SLOT(setRightMouseAction(int)));
@ -140,10 +140,10 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
// add a QComboBox that allows to set whether the right mouse button may show the context menu on a single click
cmbRightClickContextMenu=new QComboBox(this);
cmbRightClickContextMenu->addItem("StandardContextMenu");
cmbRightClickContextMenu->addItem("SpecialContextMenu");
cmbRightClickContextMenu->addItem("StandardAndSpecialContextMenu");
cmbRightClickContextMenu->addItem("NoContextMenu");
cmbRightClickContextMenu->addItem("jkqtpcmmStandardContextMenu");
cmbRightClickContextMenu->addItem("jkqtpcmmSpecialContextMenu");
cmbRightClickContextMenu->addItem("jkqtpcmmStandardAndSpecialContextMenu");
cmbRightClickContextMenu->addItem("jkqtpcmmNoContextMenu");
cmbRightClickContextMenu->setCurrentIndex(0);
layForm->addRow("mouse action: right-click context menu:", cmbRightClickContextMenu);
connect(cmbRightClickContextMenu, SIGNAL(currentIndexChanged(int)), this, SLOT(setRightClickContextMenu(int)));
@ -158,11 +158,11 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
// add a QComboBox that allows to set the left mouse button double-click action for the JKQTPlotter
cmbLeftDoubleClickMouseAction=new QComboBox(this);
layForm->addRow("mouse action: left double-click, no modifiers", cmbLeftDoubleClickMouseAction);
cmbLeftDoubleClickMouseAction->addItem("ClickZoomsIn");
cmbLeftDoubleClickMouseAction->addItem("ClickZoomsOut");
cmbLeftDoubleClickMouseAction->addItem("ClickOpensContextMenu");
cmbLeftDoubleClickMouseAction->addItem("ClickOpensSpecialContextMenu");
cmbLeftDoubleClickMouseAction->addItem("ClickMovesViewport");
cmbLeftDoubleClickMouseAction->addItem("jkqtpdcaClickZoomsIn");
cmbLeftDoubleClickMouseAction->addItem("jkqtpdcaClickZoomsOut");
cmbLeftDoubleClickMouseAction->addItem("jkqtpdcaClickOpensContextMenu");
cmbLeftDoubleClickMouseAction->addItem("jkqtpdcaClickOpensSpecialContextMenu");
cmbLeftDoubleClickMouseAction->addItem("jkqtpdcaClickMovesViewport");
cmbLeftDoubleClickMouseAction->addItem("NoAction");
cmbLeftDoubleClickMouseAction->setCurrentIndex(4);
connect(cmbLeftDoubleClickMouseAction, SIGNAL(currentIndexChanged(int)), this, SLOT(setLeftDoubleClickMouseAction(int)));
@ -171,11 +171,11 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
// add a QComboBox that allows to set the left mouse button double-click action for the JKQTPlotter
cmbRightDoubleClickMouseAction=new QComboBox(this);
layForm->addRow("mouse action: right double-click, no modifiers", cmbRightDoubleClickMouseAction);
cmbRightDoubleClickMouseAction->addItem("ClickZoomsIn");
cmbRightDoubleClickMouseAction->addItem("ClickZoomsOut");
cmbRightDoubleClickMouseAction->addItem("ClickOpensContextMenu");
cmbRightDoubleClickMouseAction->addItem("ClickOpensSpecialContextMenu");
cmbRightDoubleClickMouseAction->addItem("ClickMovesViewport");
cmbRightDoubleClickMouseAction->addItem("jkqtpdcaClickZoomsIn");
cmbRightDoubleClickMouseAction->addItem("jkqtpdcaClickZoomsOut");
cmbRightDoubleClickMouseAction->addItem("jkqtpdcaClickOpensContextMenu");
cmbRightDoubleClickMouseAction->addItem("jkqtpdcaClickOpensSpecialContextMenu");
cmbRightDoubleClickMouseAction->addItem("jkqtpdcaClickMovesViewport");
cmbRightDoubleClickMouseAction->addItem("NoAction");
cmbRightDoubleClickMouseAction->setCurrentIndex(1);
connect(cmbRightDoubleClickMouseAction, SIGNAL(currentIndexChanged(int)), this, SLOT(setRightDoubleClickMouseAction(int)));
@ -185,8 +185,8 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
// add a QComboBox that allows to set the mouse wheel action without modifiers
cmbMouseWheelAction=new QComboBox(this);
layForm->addRow("mouse action: mouse wheel, no modifiers", cmbMouseWheelAction);
cmbMouseWheelAction->addItem("ZoomByWheel");
cmbMouseWheelAction->addItem("PanByWheel");
cmbMouseWheelAction->addItem("jkqtpmwaZoomByWheel");
cmbMouseWheelAction->addItem("jkqtpmwaPanByWheel");
cmbMouseWheelAction->addItem("NoAction");
cmbMouseWheelAction->setCurrentIndex(0);
connect(cmbMouseWheelAction, SIGNAL(currentIndexChanged(int)), this, SLOT(setMouseWheelNoModAction(int)));
@ -223,19 +223,19 @@ TestUserInteraction::TestUserInteraction(QWidget *parent) :
void TestUserInteraction::setLeftMouseAction(int index)
{
if (index==cmbLeftNoModMouseAction->count()-1) plot->deregisterMouseDragAction(Qt::LeftButton, Qt::NoModifier);
else plot->registerMouseDragAction(Qt::LeftButton, Qt::NoModifier, static_cast<JKQTPlotter::MouseDragActions>(index));
else plot->registerMouseDragAction(Qt::LeftButton, Qt::NoModifier, static_cast<JKQTPMouseDragActions>(index));
}
void TestUserInteraction::setLeftCtrlMouseAction(int index)
{
if (index==cmbLeftCtrlModMouseAction->count()-1) plot->deregisterMouseDragAction(Qt::LeftButton, Qt::ControlModifier);
else plot->registerMouseDragAction(Qt::LeftButton, Qt::ControlModifier, static_cast<JKQTPlotter::MouseDragActions>(index));
else plot->registerMouseDragAction(Qt::LeftButton, Qt::ControlModifier, static_cast<JKQTPMouseDragActions>(index));
}
void TestUserInteraction::setRightMouseAction(int index)
{
if (index==cmbRightNoModMouseAction->count()-1) plot->deregisterMouseDragAction(Qt::RightButton, Qt::NoModifier);
else plot->registerMouseDragAction(Qt::RightButton, Qt::NoModifier, static_cast<JKQTPlotter::MouseDragActions>(index));
else plot->registerMouseDragAction(Qt::RightButton, Qt::NoModifier, static_cast<JKQTPMouseDragActions>(index));
}
void TestUserInteraction::setPlotMagnification(int index)
@ -245,25 +245,25 @@ void TestUserInteraction::setPlotMagnification(int index)
void TestUserInteraction::setRightClickContextMenu(int index)
{
plot->setContextMenuMode(static_cast<JKQTPlotter::ContextMenuModes>(index));
plot->setContextMenuMode(static_cast<JKQTPContextMenuModes>(index));
}
void TestUserInteraction::setLeftDoubleClickMouseAction(int index)
{
if (index>=cmbLeftDoubleClickMouseAction->count()-1) plot->deregisterMouseDoubleClickAction(Qt::LeftButton, Qt::NoModifier);
else plot->registerMouseDoubleClickAction(Qt::LeftButton, Qt::NoModifier, static_cast<JKQTPlotter::MouseDoubleClickActions>(index));
else plot->registerMouseDoubleClickAction(Qt::LeftButton, Qt::NoModifier, static_cast<JKQTPMouseDoubleClickActions>(index));
}
void TestUserInteraction::setRightDoubleClickMouseAction(int index)
{
if (index>=cmbLeftDoubleClickMouseAction->count()-1) plot->deregisterMouseDoubleClickAction(Qt::RightButton, Qt::NoModifier);
else plot->registerMouseDoubleClickAction(Qt::RightButton, Qt::NoModifier, static_cast<JKQTPlotter::MouseDoubleClickActions>(index));
else plot->registerMouseDoubleClickAction(Qt::RightButton, Qt::NoModifier, static_cast<JKQTPMouseDoubleClickActions>(index));
}
void TestUserInteraction::setMouseWheelNoModAction(int index)
{
if (index>=cmbMouseWheelAction->count()-1) plot->deregisterMouseWheelAction(Qt::NoModifier);
else plot->registerMouseWheelAction(Qt::NoModifier, static_cast<JKQTPlotter::MouseWheelActions>(index));
else plot->registerMouseWheelAction(Qt::NoModifier, static_cast<JKQTPMouseWheelActions>(index));
}
void TestUserInteraction::plotMouseMove(double x, double y)

View File

@ -16,7 +16,7 @@ HEADERS += \
test_user_interaction.h
# include JKQTPlotter source code
DEPENDPATH += . ../../lib
DEPENDPATH += ../../lib ../../staticlib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release) {
LIBS += -L../../staticlib/debug -ljkqtplotterlib_debug
@ -35,7 +35,7 @@ win32-msvc* {
}
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -1,3 +1,5 @@
# uncomment this line to prevent linking in of the XITS fonts
#DEFINES += NO_XITS_FONTS
include($$PWD/common.pri)

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -20,6 +20,7 @@
#include "jkqtfastplotter.h"
#include "jkqtplottertools/jkqtptools.h"
#include <QLocale>
#include <QPainter>
#include <QPaintEvent>
@ -45,6 +46,8 @@
#define JKQTFPPROPERTYload(settings, group, var, varname, varconvert) \
var=(settings).value((group)+(varname), var).varconvert;
const double JKQTFastPlotter::ABS_MIN_LINEWIDTH=0.05;
const int JKQTFastPlotter::LUTSIZE=256;
JKQTFPPlot::JKQTFPPlot(JKQTFastPlotter* parent):
QObject(parent)
@ -286,7 +289,7 @@ void JKQTFastPlotter::plotSystem(QPainter& painter) {
std::cout<<"timing plotSystem():\n";
timer.start();
#endif
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
///////////////////////////////////////////////////////////////////
// FILL WIDGET BACKGROUND
///////////////////////////////////////////////////////////////////
@ -309,11 +312,11 @@ void JKQTFastPlotter::plotSystem(QPainter& painter) {
///////////////////////////////////////////////////////////////////
QPen p=painter.pen();
QPen pSystem(systemColor);
pSystem.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, systemWidth));
pSystem.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, systemWidth));
pSystem.setJoinStyle(Qt::MiterJoin);
pSystem.setCapStyle(Qt::SquareCap);
QPen pGrid(gridColor);
pGrid.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, gridWidth));
pGrid.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, gridWidth));
pGrid.setStyle(gridStyle);
pGrid.setJoinStyle(Qt::MiterJoin);
pGrid.setCapStyle(Qt::SquareCap);
@ -453,11 +456,11 @@ void JKQTFastPlotter::plotSystem(QPainter& painter) {
painter.drawText(QPointF(internalPlotBorderLeft+plotWidth-fmLabels.width(xAxisLabel), internalPlotBorderTop+plotHeight+fmTicks.height()+fmTicks.width("x")/2.0+fmLabels.ascent()+tickLength), xAxisLabel);
}
if (yAxisLabelVisible) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.translate(fmLabels.ascent(), internalPlotBorderTop+fmLabels.width(yAxisLabel));
painter.rotate(-90);
painter.drawText(QPointF(0, 0), yAxisLabel);
painter.restore();
}
#ifdef DEBUG_TIMING
time_gt=timer.getTime();
@ -489,7 +492,7 @@ void JKQTFastPlotter::plotSystem(QPainter& painter) {
timer.start();
#endif
painter.restore();
#ifdef DEBUG_TIMING
time_gt=timer.getTime();
time_sum+=time_gt;
@ -506,7 +509,7 @@ void JKQTFastPlotter::plotGraphs(QPainter& painter) {
std::cout<<"timing plotGraphs():\n";
timer.start();
#endif
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
for (int i=0; i<plots.size(); i++) {
#ifdef DEBUG_TIMING
timer.start();
@ -519,7 +522,7 @@ void JKQTFastPlotter::plotGraphs(QPainter& painter) {
timer.start();
#endif
}
painter.restore();
#ifdef DEBUG_TIMING
time_gt=timer.getTime();
time_sum+=time_gt;
@ -874,12 +877,12 @@ void JKQTFPLinePlot::drawGraph(QPainter& painter) {
//std::cout<<"JKQTFPLinePlot::drawGraph()\n";
QPen p(color);
p.setStyle(style);
p.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, width));
p.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, width));
p.setCapStyle(Qt::RoundCap);
p.setJoinStyle(Qt::RoundJoin);
QPen pe(errorColor);
pe.setStyle(errorStyle);
pe.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, errorWidth));
pe.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, errorWidth));
pe.setCapStyle(Qt::RoundCap);
pe.setJoinStyle(Qt::RoundJoin);
QPainterPath path, epath;
@ -960,12 +963,12 @@ void JKQTFPVCrossPlot::drawGraph(QPainter& painter) {
//std::cout<<"JKQTFPVCrossPlot::drawGraph()\n";
QPen p(color);
p.setStyle(style);
p.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, width));
p.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, width));
p.setCapStyle(Qt::RoundCap);
p.setJoinStyle(Qt::RoundJoin);
QPen pe(errorColor);
pe.setStyle(errorStyle);
pe.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, errorWidth));
pe.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, errorWidth));
pe.setCapStyle(Qt::RoundCap);
pe.setJoinStyle(Qt::RoundJoin);
QPainterPath path, epath;
@ -1047,7 +1050,7 @@ void JKQTFPVBarPlot::drawGraph(QPainter& painter) {
QPen p(color);
p.setStyle(style);
p.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, width));
p.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, width));
p.setCapStyle(Qt::RoundCap);
p.setJoinStyle(Qt::RoundJoin);
@ -1112,7 +1115,7 @@ void JKQTFPXRangePlot::drawGraph(QPainter& painter) {
b.setColor(fillColor);
QPen p(color);
p.setStyle(style);
p.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, width));
p.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, width));
painter.setPen(p);
painter.fillRect(r, b);
if (showCenterline) {
@ -1357,11 +1360,11 @@ void JKQTFPimageOverlayPlot::drawGraph(QPainter& painter) {
}
}
}
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.setTransform(trans, true);
QPen p=painter.pen();
p.setColor(color);
p.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH,linewidth));
p.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH,linewidth));
painter.setPen(p);
for (int i=0; i<qMin(x.size(), y.size()); i++) {
double px=parent->x2p(x[i]);
@ -1370,7 +1373,7 @@ void JKQTFPimageOverlayPlot::drawGraph(QPainter& painter) {
if (this->symboltype==stCircle) painter.drawEllipse(r);
else painter.drawRect(r);
}
painter.restore();
} else {
QImage img(width, height, QImage::Format_ARGB32);
QColor tc(Qt::transparent);
@ -1419,7 +1422,7 @@ JKQTFPQScaleBarXPlot::JKQTFPQScaleBarXPlot(JKQTFastPlotter* parent, double width
}
void JKQTFPQScaleBarXPlot::drawGraph(QPainter& painter) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QRectF r(QPointF(parent->getInternalPlotBorderLeft(), parent->getInternalPlotBorderTop()), QPointF(parent->getInternalPlotBorderLeft()+parent->getPlotWidth(), parent->getInternalPlotBorderTop()+parent->getPlotHeight()));
@ -1428,7 +1431,7 @@ void JKQTFPQScaleBarXPlot::drawGraph(QPainter& painter) {
int yDistance=static_cast<double>(parent->getPlotHeight())*borderfraction;
QPen p(color);
p.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, lineWidth));
p.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, lineWidth));
p.setColor(color);
QString s=label.arg(width);
@ -1481,7 +1484,7 @@ void JKQTFPQScaleBarXPlot::drawGraph(QPainter& painter) {
}
painter.restore();
}
@ -1500,10 +1503,10 @@ JKQTFPQOverlayLinearGridPlot::JKQTFPQOverlayLinearGridPlot(JKQTFastPlotter* pare
}
void JKQTFPQOverlayLinearGridPlot::drawGraph(QPainter& painter) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p(color);
p.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, lineWidth));
p.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, lineWidth));
p.setColor(color);
p.setStyle(style);
@ -1539,7 +1542,7 @@ void JKQTFPQOverlayLinearGridPlot::drawGraph(QPainter& painter) {
painter.setPen(p);
painter.drawPath(gridPath);
painter.restore();
}
@ -1779,7 +1782,7 @@ void JKQTFPYRangePlot::drawGraph(QPainter& painter) {
b.setColor(fillColor);
QPen p(color);
p.setStyle(style);
p.setWidthF(qMax(JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH, width));
p.setWidthF(qMax(JKQTFastPlotter::ABS_MIN_LINEWIDTH, width));
painter.setPen(p);
painter.fillRect(r, b);
if (showCenterline) {
@ -1788,4 +1791,3 @@ void JKQTFPYRangePlot::drawGraph(QPainter& painter) {
painter.drawRect(r);
}

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -47,7 +47,7 @@
# include "jkqtplottertools/jkqtphighrestimer.h"
#endif
#define JKQTFASTPLOTTER_ABS_MIN_LINEWIDTH 0.05
// forward declaration
class JKQTFPPlot;
@ -84,7 +84,7 @@ class JKQTFPPlot;
- plot may contain a grid (x and y grid may be switched on/off separately).
- plots are represented by descendents of JKQTFPPlot and the plotting code is completely
contained therein (and should be speed optimized).
- it is possible to keep a specified aspect ration
- it is possible to keep a specified aspect ratio
- it is possible to couple different plots in a way, that they are plottetd with the same width/height
both in pixel and world coordinates by using plotterSizesChanged() and synchronizeX() / synchronizeY().
.
@ -92,6 +92,16 @@ class JKQTFPPlot;
*/
class JKQTP_LIB_EXPORT JKQTFastPlotter : public QGLWidget {
Q_OBJECT
public:
/*! \brief smallest allowed line width for JKQTFastPlotter
*/
static const double ABS_MIN_LINEWIDTH;
/*! \brief size of the lookup tables used by JKQTFPimagePlot_array2image()
*/
static const int LUTSIZE;
protected:
/** \brief indicates whether to do full repaint (system and data) at the next repaint (any of the repaint meothods) */
bool doFullRepaint;
@ -294,7 +304,7 @@ class JKQTP_LIB_EXPORT JKQTFastPlotter : public QGLWidget {
/** \brief synchronize y-axis settings to this plotter */
JKQTFastPlotter* synchronizeY;
/** \brief aspect ration of the plot, only used when maintainAspectRation is \c true
/** \brief aspect ratio of the plot, only used when maintainAspectRation is \c true
*
* The aspect ratio is defined as \c width/height of the plot in pt.
* So if you want to have a plot spanning \c x=0..20 and \c y=0..10 where each 1x1 square should be
@ -2098,18 +2108,13 @@ enum JKQTFPImageFormat {
};
/*! \brief size of the lookup tables used by JKQTFPimagePlot_array2image()
\ingroup jkqtfastplotter
*/
#define JKQTFPimagePlot_LUTSIZE 256
/*! \brief convert a 2D image (as 1D array) into a QImage with given palette (see JKQTFPColorPalette)
\ingroup jkqtfastplotter
This method uses lookup tables which are saved as static variables to convert the 2D array into
an image. The luts are only created once, and stored then, so mor CPU time is saved. The precompiler define
JKQTFPimagePlot_LUTSIZE sets the size of the LUTs. Note that if you don't use a specific color palette,
JKQTFastPlotter::LUTSIZE sets the size of the LUTs. Note that if you don't use a specific color palette,
the according LUT won't be calculated and stored!
*/
template <class T>
@ -2182,10 +2187,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_red;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
(*plut)[l]=qRgb(static_cast<int>(255.0*v), 0, 0);
}
}
@ -2197,10 +2202,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_green;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
(*plut)[l]=qRgb(0, static_cast<int>(255.0*v), 0);
}
}
@ -2212,10 +2217,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_blue;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
(*plut)[l]=qRgb(0, 0, static_cast<int>(255.0*v));
}
}
@ -2229,10 +2234,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_gray;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
(*plut)[l]=qRgb(static_cast<int>(255.0*v),
static_cast<int>(255.0*v),
static_cast<int>(255.0*v));
@ -2246,10 +2251,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_invred;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
(*plut)[l]=qRgb(static_cast<int>(255.0*(1.0-v)), 0, 0);
}
}
@ -2261,10 +2266,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_invgreen;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
(*plut)[l]=qRgb(0, static_cast<int>(255.0*(1.0-v)), 0);
}
}
@ -2275,10 +2280,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_invblue;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
(*plut)[l]=qRgb(0, 0, static_cast<int>(255.0*(1.0-v)));
}
}
@ -2289,10 +2294,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_invgray;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=1.0-(l/static_cast<double>(JKQTFPimagePlot_LUTSIZE));
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=1.0-(l/static_cast<double>(JKQTFastPlotter::LUTSIZE));
(*plut)[l]=qRgb(static_cast<int>(255.0*v),
static_cast<int>(255.0*v),
static_cast<int>(255.0*v));
@ -2306,10 +2311,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_matlab;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
double r = 382.5 - 1020.0 * std::abs(v - 0.75);
if (r > 255.0)
r = 255.0;
@ -2339,10 +2344,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_rygb;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
double r = 796.875*v - 199.21875;
if (r > 255.0)
r = 255.0;
@ -2365,10 +2370,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_hsv;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
int h = static_cast<int>(floor(6*v));
double f = 6*v-double(h);
@ -2391,10 +2396,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_invhsv;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
int h = static_cast<int>(floor(6.0-6.0*v));
double f = 6.0-6.0*v-double(h);
@ -2417,11 +2422,11 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
else if (palette == JKQTFP_RAINBOW) //gnuplot: 33,13,10
{
if (lut_rainbow==nullptr) {
lut_rainbow=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
lut_rainbow=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
//std::cout<<"!!! creating rainbow lut\n";
if (lut_rainbow!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
double r = 255.0*std::abs(2.0*v-0.5);
if (r > 255.0)
r = 255.0;
@ -2440,10 +2445,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_hot;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
double r = 765.0*v;
if (r > 255.0)
r = 255.0;
@ -2467,10 +2472,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_ocean;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
double r = 765.0*v-510.0;
if (r < 0.0)
r = 0.0;
@ -2488,10 +2493,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_bluemagentayellow;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
double r = (v/0.32-0.78125);
if (r < 0.0) r = 0.0;
if (r > 1.0) r = 1.0;
@ -2517,10 +2522,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_blueyellow;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
double r = sqrt(sqrt(v));
if (r < 0.0) r = 0.0;
if (r > 1.0) r = 1.0;
@ -2544,10 +2549,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_cyan;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
double r = v*0.5;
if (r < 0.0) r = 0.0;
if (r > 1.0) r = 1.0;
@ -2570,10 +2575,10 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
{
QRgb** plut=&lut_trafficlight;
if ((*plut)==nullptr) {
(*plut)=static_cast<QRgb*>(malloc((JKQTFPimagePlot_LUTSIZE+2)*sizeof(QRgb)));
(*plut)=static_cast<QRgb*>(malloc((JKQTFastPlotter::LUTSIZE+2)*sizeof(QRgb)));
if ((*plut)!=nullptr) {
for (int l=0; l<=JKQTFPimagePlot_LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFPimagePlot_LUTSIZE);
for (int l=0; l<=JKQTFastPlotter::LUTSIZE; l++) {
double v=l/static_cast<double>(JKQTFastPlotter::LUTSIZE);
double r = (v < 0.5) ? 128.0*sin(M_PI*(2.0*v-0.5))+128.0 : 255.0;
if (r > 255.0)
r = 255.0;
@ -2600,8 +2605,8 @@ inline void JKQTFPimagePlot_array2image(T* dbl, int width, int height, QImage &i
for (int j=0; j<height; ++j) {
QRgb* line=reinterpret_cast<QRgb *>(img.scanLine(height-1-j));
for (int i=0; i<width; ++i) {
int v = (dbl[j*width+i]-min)/delta*JKQTFPimagePlot_LUTSIZE;
v = (v < 0) ? 0 : ( (v > JKQTFPimagePlot_LUTSIZE) ? JKQTFPimagePlot_LUTSIZE : v);
int v = (dbl[j*width+i]-min)/delta*JKQTFastPlotter::LUTSIZE;
v = (v < 0) ? 0 : ( (v > JKQTFastPlotter::LUTSIZE) ? JKQTFastPlotter::LUTSIZE : v);
line[i]=lut_used[v];
}
}
@ -2681,6 +2686,8 @@ class JKQTP_LIB_EXPORT JKQTFPimagePlot: public JKQTFPPlot {
/** \brief rotation of the image when plotting in units of 90 degrees (counter clock wise) */
int rotation;
public:
/*! \brief class constructor
*/

View File

@ -1,3 +1,5 @@
# uncomment this line to prevent linking in of the XITS fonts
#DEFINES += NO_XITS_FONTS
include($$PWD/common.pri)

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -20,12 +20,12 @@
#include "jkqtmathtext/jkqtmathtext.h"
#include "jkqtplottertools/jkqtptools.h"
#include <QFontMetricsF>
#include <QDebug>
#include <QFontDatabase>
#include <typeinfo>
#include <QApplication>
//#define jkqtp_QColor2String(color) QString(jkqtp_rgbtostring((color).red(), (color).green(), (color).blue(), (color).alpha()).c_str())
/**
* \brief saves the given property (for which also a default_property exists) into the given settings object
@ -42,6 +42,7 @@
#define JKQTMTPROPERTYload(settings, group, var, varname, varconvert) \
var=settings.value(group+varname, var).varconvert;
const double JKQTMathText::ABS_MIN_LINEWIDTH=0.02;
QPainterPath makeHBracePath(double x, double ybrace, double width, double bw, double cubicshrink=0.5, double cubiccontrolfac=0.3) {
double xl1=x-(width)*cubicshrink+bw*cubicshrink;
@ -215,7 +216,7 @@ bool JKQTMathText::MTnode::toHtml(QString &/*html*/, JKQTMathText::MTenvironment
void JKQTMathText::MTnode::doDrawBoxes(QPainter& painter, double x, double y, JKQTMathText::MTenvironment currentEv) {
if (drawBoxes) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
double w, oh, bh, sp;
getSize(painter, currentEv, w, bh, oh, sp);
QPen p=painter.pen();
@ -234,7 +235,7 @@ void JKQTMathText::MTnode::doDrawBoxes(QPainter& painter, double x, double y, JK
painter.setPen(p);
painter.drawLine(x-2.0, y, x+2.0, y);
painter.drawLine(x, y-2, x, y+2.0);
painter.restore();
}
}
@ -667,10 +668,10 @@ double JKQTMathText::MTsqrtNode::draw(QPainter& painter, double x, double y, JKQ
double w=fm.boundingRect("A").width();
double a=baselineHeight*1.15;
double d=overallHeight-baselineHeight;
//painter.save();
//painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=painter.pen();
p.setColor(currentEv.color);
p.setWidthF(qMax(JKQTMATHTEXT_ABS_MIN_LINEWIDTH,ceil(currentEv.fontSize/16.0)));
p.setWidthF(qMax(JKQTMathText::ABS_MIN_LINEWIDTH,ceil(currentEv.fontSize/16.0)));
//painter.setPen(p);
QPainterPath path;
if (w>0) {
@ -687,14 +688,14 @@ double JKQTMathText::MTsqrtNode::draw(QPainter& painter, double x, double y, JKQ
}
//painter.restore();
double xnew=child->draw(painter, x+1.2*w, y, currentEv);
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.setPen(p);
if (w>0) {
path.lineTo( xnew+0.2*w, y-a);
path.lineTo(xnew+0.2*w, y-0.8*a);
painter.drawPath(path);
}
painter.restore();
return xnew+0.33*w;
}
@ -857,8 +858,8 @@ double JKQTMathText::MTfracNode::draw(QPainter& painter, double x, double y, JKQ
QPen p=painter.pen();
p.setColor(ev1.color);
p.setStyle(Qt::SolidLine);
p.setWidthF(qMax(JKQTMATHTEXT_ABS_MIN_LINEWIDTH, lw));
painter.save();
p.setWidthF(qMax(JKQTMathText::ABS_MIN_LINEWIDTH, lw));
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.setPen(p);
if (mode==MTFMfrac || mode==MTFMdfrac || mode==MTFMtfrac) {
QLineF l(x+xw/4.0, yline, x+width+xw/2.0, yline);
@ -884,17 +885,17 @@ double JKQTMathText::MTfracNode::draw(QPainter& painter, double x, double y, JKQ
} else if (mode==MTFMoverbrace) {
double ybrace=y-ascent1-bw/2.0;
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.translate(x+xw/2.0+(width1)/2.0, ybrace);
painter.rotate(180);
QPainterPath path=makeHBracePath(0,0, width, bw);
painter.drawPath(path);
painter.restore();
child1->draw(painter, x+xw/2.0+(width-width1)/2.0, y, ev1);
child2->draw(painter, x+xw/2.0+(width-width2)/2.0, y-ascent1-bw-descent2, ev2);
}
painter.restore();
if (mode==MTFMstackrel) return x+width+ xw;
return x+width+xw;
@ -1121,7 +1122,7 @@ double JKQTMathText::MTdecoratedNode::draw(QPainter& painter, double x, double y
QPen pold=painter.pen();
QPen p=pold;
p.setColor(ev.color);
p.setWidthF(qMax(JKQTMATHTEXT_ABS_MIN_LINEWIDTH, fm.lineWidth()));//ceil(currentEv.fontSize/16.0));
p.setWidthF(qMax(JKQTMathText::ABS_MIN_LINEWIDTH, fm.lineWidth()));//ceil(currentEv.fontSize/16.0));
if (decoration==MTDbar) ev.overline=true;
double xnew=child->draw(painter, x, y, ev);
if (decoration==MTDvec) {
@ -1386,11 +1387,11 @@ double JKQTMathText::MTbraceNode::draw(QPainter& painter, double x, double y, JK
painter.drawPath(path);
} else if (openbrace=="{") {
QPainterPath path=makeHBracePath(0,0,coverallHeight, bracewidth*brace_fraction);
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.translate(xnew+bracewidth*(1.0-brace_fraction), y-cbaselineHeight+coverallHeight/2.0);
painter.rotate(90);
painter.drawPath(path);
painter.restore();
} else if (openbrace=="_") {
QPainterPath path;
double y1=y+(coverallHeight-cbaselineHeight);
@ -1456,11 +1457,11 @@ double JKQTMathText::MTbraceNode::draw(QPainter& painter, double x, double y, JK
painter.drawPath(path);
} else if (closebrace=="}") {
QPainterPath path=makeHBracePath(0,0,coverallHeight, bracewidth*brace_fraction);
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.translate(xnew+bracewidth*brace_fraction, y-cbaselineHeight+coverallHeight/2.0);
painter.rotate(270);
painter.drawPath(path);
painter.restore();
} else if (closebrace=="_") {
QPainterPath path;
double y1=y+(coverallHeight-cbaselineHeight);
@ -2828,7 +2829,7 @@ double JKQTMathText::MTsymbolNode::draw(QPainter& painter, double x, double y, J
QPen p=painter.pen();
p.setColor(currentEv.color);
p.setWidthF(qMax(JKQTMATHTEXT_ABS_MIN_LINEWIDTH, fm.lineWidth()));
p.setWidthF(qMax(JKQTMathText::ABS_MIN_LINEWIDTH, fm.lineWidth()));
p.setStyle(Qt::SolidLine);
painter.setPen(p);
double xwi=fm.width("x");
@ -2846,22 +2847,22 @@ double JKQTMathText::MTsymbolNode::draw(QPainter& painter, double x, double y, J
//std::cout<<"draw infty\n";
f1.setItalic(false);
painter.setFont(f1);
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.translate(x+shift+fm1.width("8")/3.0, y-fm1.xHeight());
painter.rotate(90);
painter.drawText(QPointF(0,0), "8");
painter.restore();
} else if (symbolName=="|") {
//std::cout<<"draw infty\n";
f1.setItalic(false);
painter.setFont(f1);
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.translate(x+shift, y);
painter.drawText(QPointF(0,0), "|");
painter.translate(fm1.width("8")/3.0, 0);
painter.drawText(QPointF(0,0), "|");
painter.restore();
// here are some spaces
} else if (symbolName==" ") { // full space
@ -3236,7 +3237,7 @@ JKQTMathText::~JKQTMathText() {
void JKQTMathText::loadSettings(const QSettings& settings, const QString& group){
fontSize=settings.value(group+"font_size", fontSize).toDouble();
fontColor=QColor(settings.value(group+"font_color", jkqtp_QColor2String(fontColor)).toString());
fontColor=jkqtp_String2QColor(settings.value(group+"font_color", jkqtp_QColor2String(fontColor)).toString());
fontRoman=settings.value(group+"font_roman", fontRoman).toString();
fontSans=settings.value(group+"font_sans", fontSans).toString();
fontTypewriter=settings.value(group+"font_typewriter", fontTypewriter).toString();
@ -3346,10 +3347,11 @@ void JKQTMathText::useSTIX() {
void JKQTMathText::useXITS()
{
//JKQTPAutoOutputTimer jkaaot(QString("JKQTMathText::useXITS():ALL"));
QFontDatabase fdb;
#ifdef AUTOLOAD_XITS_FONTS
//qDebug()<<"has XITS: "<<fdb.families().contains("XITS");
if (!fdb.families().contains("XITS")) {
//JKQTPAutoOutputTimer jkaaot(QString("JKQTMathText::useXITS():addAutoXITS"));
int i=0;
if (QFile::exists(":/JKQTMathText/fonts/xits-bold.otf")) { i=QFontDatabase::addApplicationFont(":/JKQTMathText/fonts/xits-bold.otf"); }
//qDebug()<<QFontDatabase::applicationFontFamilies(i);
@ -3365,26 +3367,29 @@ void JKQTMathText::useXITS()
//qDebug()<<QFontDatabase::applicationFontFamilies(i);
(void)i;
}
#endif
//qDebug()<<"has XITS: "<<fdb.families().contains("XITS")<<"\n"<<fdb.families();
bool hasXITS=false;
QString XITSfam;
//bool hasXITSMath=false;
QString XITSMathfam;
if (defaultXITSMathFontName.size()==0/* || defaultXITSFontName.size()==0*/) {
{
//JKQTPAutoOutputTimer jkaaot(QString("JKQTMathText::useXITS():scanFamilies"));
for (int i=0; i<fdb.families().size(); i++) {
//::cout<<fdb.families().at(i).simplified().toStdString()<<"\n";
//qDebug()<<fdb.families().at(i).simplified();
if (fdb.families().at(i).contains("XITS Math")) {
//hasXITSMath=true;
XITSMathfam=fdb.families().at(i);
defaultXITSMathFontName=fdb.families().at(i);
} else if (fdb.families().at(i).contains("XITS")) {
hasXITS=true;
XITSfam=fdb.families().at(i);
defaultXITSFontName=fdb.families().at(i);
}
}
}
} else {
hasXITS=true;
}
QString fam="XITS";
if (hasXITS) fam=XITSfam;
//if (hasXITSMath) fam=XITSMathfam;
if (hasXITS) fam=defaultXITSFontName;
//if (hasXITSMath) fam=defaultXITSMathFontName;
useXITSfonts=true;
//fontRoman=fam;
//fontSans=fam;
@ -3479,6 +3484,46 @@ QString JKQTMathText::toHtml(bool *ok, double fontPointSize) {
return s;
}
void JKQTMathText::setFontRomanOrSpecial(const QString &__value)
{
if (__value.toUpper()=="XITS") {
useXITS();
} else if (__value.toUpper()=="STIX") {
useSTIX();
} else if (__value.toUpper()=="ASANA") {
useASANA();
} else {
if (__value.toUpper().endsWith("+XITS")) {
useXITS();
setFontRoman(__value.left(__value.size()-5));
} else if (__value.toUpper().endsWith("+STIX")) {
useSTIX();
setFontRoman(__value.left(__value.size()-5));
} else if (__value.toUpper().endsWith("+ASANA")) {
useASANA();
setFontRoman(__value.left(__value.size()-6));
} else {
setFontRoman(__value);
}
}
}
void JKQTMathText::setFontRomanOrSpecial(const QString &roman, const QString &math)
{
if (math.toUpper()=="XITS") {
useXITS();
} else if (math.toUpper()=="STIX") {
useSTIX();
} else if (math.toUpper()=="ASANA") {
useASANA();
} else {
setFontMathRoman(math);
}
setFontRoman(roman);
}
void JKQTMathText::useAnyUnicode(QString timesFont, const QString& sansFont) {
if (!timesFont.isEmpty()) { fontMathRoman=timesFont; fontRoman=timesFont; }
if (!sansFont.isEmpty()) { fontMathSans=sansFont; fontSans=sansFont; }

View File

@ -6,7 +6,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -42,8 +42,6 @@
#include <QLabel>
#include <QHash>
#define JKQTMATHTEXT_ABS_MIN_LINEWIDTH 0.02
/** \brief initialized Qt-ressources necessary for JKQTMathText
@ -221,14 +219,17 @@ JKQTP_LIB_EXPORT void initJKQTMathTextResources();
class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
Q_OBJECT
public:
/** \brief minimum linewidth allowed in a JKQTMathText (given in pt) */
static const double ABS_MIN_LINEWIDTH;
/** \brief class constructor */
JKQTMathText(QObject * parent = nullptr);
/** \brief class destructor */
~JKQTMathText();
/** \brief load the object settings from the given QSettings object with the given name prefix */
void loadSettings(const QSettings& settings, const QString& group=QString("mathtext"));
void loadSettings(const QSettings& settings, const QString& group=QString("mathtext/"));
/** \brief store the object settings to the given QSettings object with the given name prefix */
void saveSettings(QSettings& settings, const QString& group=QString("mathtext")) const;
void saveSettings(QSettings& settings, const QString& group=QString("mathtext/")) const;
/** \brief parse the given enhanced string. Returns \c true on success. */
bool parse(QString text);
/** \brief get the size of the drawn representation. returns an invalid size if no text has been parsed. */
@ -303,241 +304,183 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
MTFElatex
};
/*! \brief sets the property fontColor ( \copybrief fontColor ) to the specified \a __value.
\details Description of the parameter fontColor is: <BLOCKQUOTE>\copydoc fontColor </BLOCKQUOTE>
\see fontColor for more information */
inline virtual void setFontColor(const QColor & __value)
/*! \copydoc fontColor \see fontColor */
inline void setFontColor(const QColor & __value)
{
this->fontColor = __value;
}
/*! \brief returns the property fontColor ( \copybrief fontColor ).
\details Description of the parameter fontColor is: <BLOCKQUOTE>\copydoc fontColor </BLOCKQUOTE>
\see fontColor for more information */
inline virtual QColor getFontColor() const
/*! \copydoc fontColor \see fontColor */
inline QColor getFontColor() const
{
return this->fontColor;
}
/*! \brief sets the property fontSize ( \copybrief fontSize ) to the specified \a __value.
\details Description of the parameter fontSize is: <BLOCKQUOTE>\copydoc fontSize </BLOCKQUOTE>
\see fontSize for more information */
inline virtual void setFontSize(double __value)
/*! \copydoc fontSize \see fontSize */
inline void setFontSize(double __value)
{
this->fontSize = __value;
}
/*! \brief returns the property fontSize ( \copybrief fontSize ).
\details Description of the parameter fontSize is: <BLOCKQUOTE>\copydoc fontSize </BLOCKQUOTE>
\see fontSize for more information */
inline virtual double getFontSize() const
/*! \copydoc fontSize \see fontSize */
inline double getFontSize() const
{
return this->fontSize;
}
/*! \brief sets the property fontRoman ( \copybrief fontRoman ) to the specified \a __value.
\details Description of the parameter fontRoman is: <BLOCKQUOTE>\copydoc fontRoman </BLOCKQUOTE>
\see fontRoman for more information */
inline virtual void setFontRoman(const QString & __value)
inline void setFontRoman(const QString & __value)
{
this->fontRoman = __value;
}
/*! \brief returns the property fontRoman ( \copybrief fontRoman ).
\details Description of the parameter fontRoman is: <BLOCKQUOTE>\copydoc fontRoman </BLOCKQUOTE>
/*! \brief sets the property fontRoman ( \copybrief fontRoman ) to \a __value, or calls useXITS() if \a __value \c =="XITS". calls useSTIX() if \a __value \c =="STIX", ...
\see fontRoman for more information */
inline virtual QString getFontRoman() const
void setFontRomanOrSpecial(const QString & __value);
/*! \brief sets the property fontRoman ( \copybrief fontRoman ) to \a __value, or calls useXITS() if \a __value \c =="XITS". calls useSTIX() if \a __value \c =="STIX", ...
\see fontRoman for more information */
void setFontRomanOrSpecial(const QString & roman, const QString & math);
/*! \copydoc fontRoman \see fontRoman */
inline QString getFontRoman() const
{
return this->fontRoman;
}
/*! \brief sets the property fontSans ( \copybrief fontSans ) to the specified \a __value.
\details Description of the parameter fontSans is: <BLOCKQUOTE>\copydoc fontSans </BLOCKQUOTE>
\see fontSans for more information */
inline virtual void setFontSans(const QString & __value)
/*! \copydoc fontSans \see fontSans */
inline void setFontSans(const QString & __value)
{
this->fontSans = __value;
}
/*! \brief returns the property fontSans ( \copybrief fontSans ).
\details Description of the parameter fontSans is: <BLOCKQUOTE>\copydoc fontSans </BLOCKQUOTE>
\see fontSans for more information */
inline virtual QString getFontSans() const
/*! \copydoc fontSans \see fontSans */
inline QString getFontSans() const
{
return this->fontSans;
}
/*! \brief sets the property fontTypewriter ( \copybrief fontTypewriter ) to the specified \a __value.
\details Description of the parameter fontTypewriter is: <BLOCKQUOTE>\copydoc fontTypewriter </BLOCKQUOTE>
\see fontTypewriter for more information */
inline virtual void setFontTypewriter(const QString & __value)
/*! \copydoc fontTypewriter \see fontTypewriter */
inline void setFontTypewriter(const QString & __value)
{
this->fontTypewriter = __value;
}
/*! \brief returns the property fontTypewriter ( \copybrief fontTypewriter ).
\details Description of the parameter fontTypewriter is: <BLOCKQUOTE>\copydoc fontTypewriter </BLOCKQUOTE>
\see fontTypewriter for more information */
inline virtual QString getFontTypewriter() const
/*! \copydoc fontTypewriter \see fontTypewriter */
inline QString getFontTypewriter() const
{
return this->fontTypewriter;
}
/*! \brief sets the property fontScript ( \copybrief fontScript ) to the specified \a __value.
\details Description of the parameter fontScript is: <BLOCKQUOTE>\copydoc fontScript </BLOCKQUOTE>
\see fontScript for more information */
inline virtual void setFontScript(const QString & __value)
/*! \copydoc fontScript \see fontScript */
inline void setFontScript(const QString & __value)
{
this->fontScript = __value;
}
/*! \brief returns the property fontScript ( \copybrief fontScript ).
\details Description of the parameter fontScript is: <BLOCKQUOTE>\copydoc fontScript </BLOCKQUOTE>
\see fontScript for more information */
inline virtual QString getFontScript() const
/*! \copydoc fontScript \see fontScript */
inline QString getFontScript() const
{
return this->fontScript;
}
/*! \brief sets the property fontGreek ( \copybrief fontGreek ) to the specified \a __value.
\details Description of the parameter fontGreek is: <BLOCKQUOTE>\copydoc fontGreek </BLOCKQUOTE>
\see fontGreek for more information */
inline virtual void setFontGreek(const QString & __value)
/*! \copydoc fontGreek \see fontGreek */
inline void setFontGreek(const QString & __value)
{
this->fontGreek = __value;
}
/*! \brief returns the property fontGreek ( \copybrief fontGreek ).
\details Description of the parameter fontGreek is: <BLOCKQUOTE>\copydoc fontGreek </BLOCKQUOTE>
\see fontGreek for more information */
inline virtual QString getFontGreek() const
/*! \copydoc fontGreek \see fontGreek */
inline QString getFontGreek() const
{
return this->fontGreek;
}
/*! \brief sets the property fontSymbol ( \copybrief fontSymbol ) to the specified \a __value.
\details Description of the parameter fontSymbol is: <BLOCKQUOTE>\copydoc fontSymbol </BLOCKQUOTE>
\see fontSymbol for more information */
inline virtual void setFontSymbol(const QString & __value)
/*! \copydoc fontSymbol \see fontSymbol */
inline void setFontSymbol(const QString & __value)
{
this->fontSymbol = __value;
}
/*! \brief returns the property fontSymbol ( \copybrief fontSymbol ).
\details Description of the parameter fontSymbol is: <BLOCKQUOTE>\copydoc fontSymbol </BLOCKQUOTE>
\see fontSymbol for more information */
inline virtual QString getFontSymbol() const
/*! \copydoc fontSymbol \see fontSymbol */
inline QString getFontSymbol() const
{
return this->fontSymbol;
}
/*! \brief sets the property fontBraces ( \copybrief fontBraces ) to the specified \a __value.
\details Description of the parameter fontBraces is: <BLOCKQUOTE>\copydoc fontBraces </BLOCKQUOTE>
\see fontBraces for more information */
inline virtual void setFontBraces(const QString & __value)
/*! \copydoc fontBraces \see fontBraces */
inline void setFontBraces(const QString & __value)
{
this->fontBraces = __value;
}
/*! \brief returns the property fontBraces ( \copybrief fontBraces ).
\details Description of the parameter fontBraces is: <BLOCKQUOTE>\copydoc fontBraces </BLOCKQUOTE>
\see fontBraces for more information */
inline virtual QString getFontBraces() const
/*! \copydoc fontBraces \see fontBraces */
inline QString getFontBraces() const
{
return this->fontBraces;
}
/*! \brief sets the property fontIntegrals ( \copybrief fontIntegrals ) to the specified \a __value.
\details Description of the parameter fontIntegrals is: <BLOCKQUOTE>\copydoc fontIntegrals </BLOCKQUOTE>
\see fontIntegrals for more information */
inline virtual void setFontIntegrals(const QString & __value)
/*! \copydoc fontIntegrals \see fontIntegrals */
inline void setFontIntegrals(const QString & __value)
{
this->fontIntegrals = __value;
}
/*! \brief returns the property fontIntegrals ( \copybrief fontIntegrals ).
\details Description of the parameter fontIntegrals is: <BLOCKQUOTE>\copydoc fontIntegrals </BLOCKQUOTE>
\see fontIntegrals for more information */
inline virtual QString getFontIntegrals() const
/*! \copydoc fontIntegrals \see fontIntegrals */
inline QString getFontIntegrals() const
{
return this->fontIntegrals;
}
/*! \brief sets the property fontCaligraphic ( \copybrief fontCaligraphic ) to the specified \a __value.
\details Description of the parameter fontCaligraphic is: <BLOCKQUOTE>\copydoc fontCaligraphic </BLOCKQUOTE>
\see fontCaligraphic for more information */
inline virtual void setFontCaligraphic(const QString & __value)
/*! \copydoc fontCaligraphic \see fontCaligraphic */
inline void setFontCaligraphic(const QString & __value)
{
this->fontCaligraphic = __value;
}
/*! \brief returns the property fontCaligraphic ( \copybrief fontCaligraphic ).
\details Description of the parameter fontCaligraphic is: <BLOCKQUOTE>\copydoc fontCaligraphic </BLOCKQUOTE>
\see fontCaligraphic for more information */
inline virtual QString getFontCaligraphic() const
/*! \copydoc fontCaligraphic \see fontCaligraphic */
inline QString getFontCaligraphic() const
{
return this->fontCaligraphic;
}
/*! \brief sets the property fontBlackboard ( \copybrief fontBlackboard ) to the specified \a __value.
\details Description of the parameter fontBlackboard is: <BLOCKQUOTE>\copydoc fontBlackboard </BLOCKQUOTE>
\see fontBlackboard for more information */
inline virtual void setFontBlackboard(const QString & __value)
/*! \copydoc fontBlackboard \see fontBlackboard */
inline void setFontBlackboard(const QString & __value)
{
this->fontBlackboard = __value;
}
/*! \brief returns the property fontBlackboard ( \copybrief fontBlackboard ).
\details Description of the parameter fontBlackboard is: <BLOCKQUOTE>\copydoc fontBlackboard </BLOCKQUOTE>
\see fontBlackboard for more information */
inline virtual QString getFontBlackboard() const
/*! \copydoc fontBlackboard \see fontBlackboard */
inline QString getFontBlackboard() const
{
return this->fontBlackboard;
}
/*! \brief sets the property fontMathRoman ( \copybrief fontMathRoman ) to the specified \a __value.
\details Description of the parameter fontMathRoman is: <BLOCKQUOTE>\copydoc fontMathRoman </BLOCKQUOTE>
\see fontMathRoman for more information */
inline virtual void setFontMathRoman(const QString & __value)
/*! \copydoc fontMathRoman \see fontMathRoman */
inline void setFontMathRoman(const QString & __value)
{
this->fontMathRoman = __value;
}
/*! \brief returns the property fontMathRoman ( \copybrief fontMathRoman ).
\details Description of the parameter fontMathRoman is: <BLOCKQUOTE>\copydoc fontMathRoman </BLOCKQUOTE>
\see fontMathRoman for more information */
inline virtual QString getFontMathRoman() const
/*! \copydoc fontMathRoman \see fontMathRoman */
inline QString getFontMathRoman() const
{
return this->fontMathRoman;
}
/*! \brief sets the property fontMathSans ( \copybrief fontMathSans ) to the specified \a __value.
\details Description of the parameter fontMathSans is: <BLOCKQUOTE>\copydoc fontMathSans </BLOCKQUOTE>
\see fontMathSans for more information */
inline virtual void setFontMathSans(const QString & __value)
/*! \copydoc fontMathSans \see fontMathSans */
inline void setFontMathSans(const QString & __value)
{
this->fontMathSans = __value;
}
/*! \brief returns the property fontMathSans ( \copybrief fontMathSans ).
\details Description of the parameter fontMathSans is: <BLOCKQUOTE>\copydoc fontMathSans </BLOCKQUOTE>
\see fontMathSans for more information */
inline virtual QString getFontMathSans() const
/*! \copydoc fontMathSans \see fontMathSans */
inline QString getFontMathSans() const
{
return this->fontMathSans;
}
/*! \brief sets the property fontLatexPrefix ( \copybrief fontLatexPrefix ) to the specified \a __value.
\details Description of the parameter fontLatexPrefix is: <BLOCKQUOTE>\copydoc fontLatexPrefix </BLOCKQUOTE>
\see fontLatexPrefix for more information */
inline virtual void setFontLatexPrefix(const QString & __value)
/*! \copydoc fontLatexPrefix \see fontLatexPrefix */
inline void setFontLatexPrefix(const QString & __value)
{
this->fontLatexPrefix = __value;
}
/*! \brief returns the property fontLatexPrefix ( \copybrief fontLatexPrefix ).
\details Description of the parameter fontLatexPrefix is: <BLOCKQUOTE>\copydoc fontLatexPrefix </BLOCKQUOTE>
\see fontLatexPrefix for more information */
inline virtual QString getFontLatexPrefix() const
/*! \copydoc fontLatexPrefix \see fontLatexPrefix */
inline QString getFontLatexPrefix() const
{
return this->fontLatexPrefix;
}
/*! \brief sets the property fontLatexPostfix ( \copybrief fontLatexPostfix ) to the specified \a __value.
\details Description of the parameter fontLatexPostfix is: <BLOCKQUOTE>\copydoc fontLatexPostfix </BLOCKQUOTE>
\see fontLatexPostfix for more information */
inline virtual void setFontLatexPostfix(const QString & __value)
/*! \copydoc fontLatexPostfix \see fontLatexPostfix */
inline void setFontLatexPostfix(const QString & __value)
{
this->fontLatexPostfix = __value;
}
/*! \brief returns the property fontLatexPostfix ( \copybrief fontLatexPostfix ).
\details Description of the parameter fontLatexPostfix is: <BLOCKQUOTE>\copydoc fontLatexPostfix </BLOCKQUOTE>
\see fontLatexPostfix for more information */
inline virtual QString getFontLatexPostfix() const
/*! \copydoc fontLatexPostfix \see fontLatexPostfix */
inline QString getFontLatexPostfix() const
{
return this->fontLatexPostfix;
}
/*! \brief sets the property fontEncoding ( \copybrief fontEncoding ) to the specified \a __value.
\details Description of the parameter fontEncoding is: <BLOCKQUOTE>\copydoc fontEncoding </BLOCKQUOTE>
\see fontEncoding for more information */
inline virtual void setFontEncoding(const MTfontEncoding & __value)
/*! \copydoc fontEncoding \see fontEncoding */
inline void setFontEncoding(const MTfontEncoding & __value)
{
this->fontEncoding = __value;
}
/*! \brief returns the property fontEncoding ( \copybrief fontEncoding ).
\details Description of the parameter fontEncoding is: <BLOCKQUOTE>\copydoc fontEncoding </BLOCKQUOTE>
\see fontEncoding for more information */
inline virtual MTfontEncoding getFontEncoding() const
/*! \copydoc fontEncoding \see fontEncoding */
inline MTfontEncoding getFontEncoding() const
{
return this->fontEncoding;
}
@ -553,227 +496,163 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
inline bool isUsingXITSfonts() const {
return this->useXITSfonts;
}
/*! \brief sets the property brace_factor ( \copybrief brace_factor ) to the specified \a __value.
\details Description of the parameter brace_factor is: <BLOCKQUOTE>\copydoc brace_factor </BLOCKQUOTE>
\see brace_factor for more information */
inline virtual void setBraceFactor(double __value)
/*! \copydoc brace_factor \see brace_factor */
inline void setBraceFactor(double __value)
{
this->brace_factor = __value;
}
/*! \brief returns the property brace_factor ( \copybrief brace_factor ).
\details Description of the parameter brace_factor is: <BLOCKQUOTE>\copydoc brace_factor </BLOCKQUOTE>
\see brace_factor for more information */
inline virtual double getBraceFactor() const
/*! \copydoc brace_factor \see brace_factor */
inline double getBraceFactor() const
{
return this->brace_factor;
}
/*! \brief sets the property subsuper_size_factor ( \copybrief subsuper_size_factor ) to the specified \a __value.
\details Description of the parameter subsuper_size_factor is: <BLOCKQUOTE>\copydoc subsuper_size_factor </BLOCKQUOTE>
\see subsuper_size_factor for more information */
inline virtual void setSubsuperSizeFactor(double __value)
/*! \copydoc subsuper_size_factor \see subsuper_size_factor */
inline void setSubsuperSizeFactor(double __value)
{
this->subsuper_size_factor = __value;
}
/*! \brief returns the property subsuper_size_factor ( \copybrief subsuper_size_factor ).
\details Description of the parameter subsuper_size_factor is: <BLOCKQUOTE>\copydoc subsuper_size_factor </BLOCKQUOTE>
\see subsuper_size_factor for more information */
inline virtual double getSubsuperSizeFactor() const
/*! \copydoc subsuper_size_factor \see subsuper_size_factor */
inline double getSubsuperSizeFactor() const
{
return this->subsuper_size_factor;
}
/*! \brief sets the property italic_correction_factor ( \copybrief italic_correction_factor ) to the specified \a __value.
\details Description of the parameter italic_correction_factor is: <BLOCKQUOTE>\copydoc italic_correction_factor </BLOCKQUOTE>
\see italic_correction_factor for more information */
inline virtual void setItalicCorrectionFactor(double __value)
/*! \copydoc italic_correction_factor \see italic_correction_factor */
inline void setItalicCorrectionFactor(double __value)
{
this->italic_correction_factor = __value;
}
/*! \brief returns the property italic_correction_factor ( \copybrief italic_correction_factor ).
\details Description of the parameter italic_correction_factor is: <BLOCKQUOTE>\copydoc italic_correction_factor </BLOCKQUOTE>
\see italic_correction_factor for more information */
inline virtual double getItalicCorrectionFactor() const
/*! \copydoc italic_correction_factor \see italic_correction_factor */
inline double getItalicCorrectionFactor() const
{
return this->italic_correction_factor;
}
/*! \brief sets the property operatorsubsuper_size_factor ( \copybrief operatorsubsuper_size_factor ) to the specified \a __value.
\details Description of the parameter operatorsubsuper_size_factor is: <BLOCKQUOTE>\copydoc operatorsubsuper_size_factor </BLOCKQUOTE>
\see operatorsubsuper_size_factor for more information */
inline virtual void setOperatorsubsuperSizeFactor(double __value)
/*! \copydoc operatorsubsuper_size_factor \see operatorsubsuper_size_factor */
inline void setOperatorsubsuperSizeFactor(double __value)
{
this->operatorsubsuper_size_factor = __value;
}
/*! \brief returns the property operatorsubsuper_size_factor ( \copybrief operatorsubsuper_size_factor ).
\details Description of the parameter operatorsubsuper_size_factor is: <BLOCKQUOTE>\copydoc operatorsubsuper_size_factor </BLOCKQUOTE>
\see operatorsubsuper_size_factor for more information */
inline virtual double getOperatorsubsuperSizeFactor() const
/*! \copydoc operatorsubsuper_size_factor \see operatorsubsuper_size_factor */
inline double getOperatorsubsuperSizeFactor() const
{
return this->operatorsubsuper_size_factor;
}
/*! \brief sets the property mathoperator_width_factor ( \copybrief mathoperator_width_factor ) to the specified \a __value.
\details Description of the parameter mathoperator_width_factor is: <BLOCKQUOTE>\copydoc mathoperator_width_factor </BLOCKQUOTE>
\see mathoperator_width_factor for more information */
inline virtual void setMathoperatorWidthFactor(double __value)
/*! \copydoc mathoperator_width_factor \see mathoperator_width_factor */
inline void setMathoperatorWidthFactor(double __value)
{
this->mathoperator_width_factor = __value;
}
/*! \brief returns the property mathoperator_width_factor ( \copybrief mathoperator_width_factor ).
\details Description of the parameter mathoperator_width_factor is: <BLOCKQUOTE>\copydoc mathoperator_width_factor </BLOCKQUOTE>
\see mathoperator_width_factor for more information */
inline virtual double getMathoperatorWidthFactor() const
/*! \copydoc mathoperator_width_factor \see mathoperator_width_factor */
inline double getMathoperatorWidthFactor() const
{
return this->mathoperator_width_factor;
}
/*! \brief sets the property super_shift_factor ( \copybrief super_shift_factor ) to the specified \a __value.
\details Description of the parameter super_shift_factor is: <BLOCKQUOTE>\copydoc super_shift_factor </BLOCKQUOTE>
\see super_shift_factor for more information */
inline virtual void setSuperShiftFactor(double __value)
/*! \copydoc super_shift_factor \see super_shift_factor */
inline void setSuperShiftFactor(double __value)
{
this->super_shift_factor = __value;
}
/*! \brief returns the property super_shift_factor ( \copybrief super_shift_factor ).
\details Description of the parameter super_shift_factor is: <BLOCKQUOTE>\copydoc super_shift_factor </BLOCKQUOTE>
\see super_shift_factor for more information */
inline virtual double getSuperShiftFactor() const
/*! \copydoc super_shift_factor \see super_shift_factor */
inline double getSuperShiftFactor() const
{
return this->super_shift_factor;
}
/*! \brief sets the property sub_shift_factor ( \copybrief sub_shift_factor ) to the specified \a __value.
\details Description of the parameter sub_shift_factor is: <BLOCKQUOTE>\copydoc sub_shift_factor </BLOCKQUOTE>
\see sub_shift_factor for more information */
inline virtual void setSubShiftFactor(double __value)
/*! \copydoc sub_shift_factor \see sub_shift_factor */
inline void setSubShiftFactor(double __value)
{
this->sub_shift_factor = __value;
}
/*! \brief returns the property sub_shift_factor ( \copybrief sub_shift_factor ).
\details Description of the parameter sub_shift_factor is: <BLOCKQUOTE>\copydoc sub_shift_factor </BLOCKQUOTE>
\see sub_shift_factor for more information */
inline virtual double getSubShiftFactor() const
/*! \copydoc sub_shift_factor \see sub_shift_factor */
inline double getSubShiftFactor() const
{
return this->sub_shift_factor;
}
/*! \brief sets the property brace_shrink_factor ( \copybrief brace_shrink_factor ) to the specified \a __value.
\details Description of the parameter brace_shrink_factor is: <BLOCKQUOTE>\copydoc brace_shrink_factor </BLOCKQUOTE>
\see brace_shrink_factor for more information */
inline virtual void setBraceShrinkFactor(double __value)
/*! \copydoc brace_shrink_factor \see brace_shrink_factor */
inline void setBraceShrinkFactor(double __value)
{
this->brace_shrink_factor = __value;
}
/*! \brief returns the property brace_shrink_factor ( \copybrief brace_shrink_factor ).
\details Description of the parameter brace_shrink_factor is: <BLOCKQUOTE>\copydoc brace_shrink_factor </BLOCKQUOTE>
\see brace_shrink_factor for more information */
inline virtual double getBraceShrinkFactor() const
/*! \copydoc brace_shrink_factor \see brace_shrink_factor */
inline double getBraceShrinkFactor() const
{
return this->brace_shrink_factor;
}
/*! \brief sets the property underbrace_factor ( \copybrief underbrace_factor ) to the specified \a __value.
\details Description of the parameter underbrace_factor is: <BLOCKQUOTE>\copydoc underbrace_factor </BLOCKQUOTE>
\see underbrace_factor for more information */
inline virtual void setUnderbraceFactor(double __value)
/*! \copydoc underbrace_factor \see underbrace_factor */
inline void setUnderbraceFactor(double __value)
{
this->underbrace_factor = __value;
}
/*! \brief returns the property underbrace_factor ( \copybrief underbrace_factor ).
\details Description of the parameter underbrace_factor is: <BLOCKQUOTE>\copydoc underbrace_factor </BLOCKQUOTE>
\see underbrace_factor for more information */
inline virtual double getUnderbraceFactor() const
/*! \copydoc underbrace_factor \see underbrace_factor */
inline double getUnderbraceFactor() const
{
return this->underbrace_factor;
}
/*! \brief sets the property undersetFactor ( \copybrief undersetFactor ) to the specified \a __value.
\details Description of the parameter undersetFactor is: <BLOCKQUOTE>\copydoc undersetFactor </BLOCKQUOTE>
\see undersetFactor for more information */
inline virtual void setUndersetFactor(double __value)
/*! \copydoc undersetFactor \see undersetFactor */
inline void setUndersetFactor(double __value)
{
this->undersetFactor = __value;
}
/*! \brief returns the property undersetFactor ( \copybrief undersetFactor ).
\details Description of the parameter undersetFactor is: <BLOCKQUOTE>\copydoc undersetFactor </BLOCKQUOTE>
\see undersetFactor for more information */
inline virtual double getUndersetFactor() const
/*! \copydoc undersetFactor \see undersetFactor */
inline double getUndersetFactor() const
{
return this->undersetFactor;
}
/*! \brief sets the property frac_factor ( \copybrief frac_factor ) to the specified \a __value.
\details Description of the parameter frac_factor is: <BLOCKQUOTE>\copydoc frac_factor </BLOCKQUOTE>
\see frac_factor for more information */
inline virtual void setFracFactor(double __value)
/*! \copydoc frac_factor \see frac_factor */
inline void setFracFactor(double __value)
{
this->frac_factor = __value;
}
/*! \brief returns the property frac_factor ( \copybrief frac_factor ).
\details Description of the parameter frac_factor is: <BLOCKQUOTE>\copydoc frac_factor </BLOCKQUOTE>
\see frac_factor for more information */
inline virtual double getFracFactor() const
/*! \copydoc frac_factor \see frac_factor */
inline double getFracFactor() const
{
return this->frac_factor;
}
/*! \brief sets the property frac_shift_factor ( \copybrief frac_shift_factor ) to the specified \a __value.
\details Description of the parameter frac_shift_factor is: <BLOCKQUOTE>\copydoc frac_shift_factor </BLOCKQUOTE>
\see frac_shift_factor for more information */
inline virtual void setFracShiftFactor(double __value)
/*! \copydoc frac_shift_factor \see frac_shift_factor */
inline void setFracShiftFactor(double __value)
{
this->frac_shift_factor = __value;
}
/*! \brief returns the property frac_shift_factor ( \copybrief frac_shift_factor ).
\details Description of the parameter frac_shift_factor is: <BLOCKQUOTE>\copydoc frac_shift_factor </BLOCKQUOTE>
\see frac_shift_factor for more information */
inline virtual double getFracShiftFactor() const
/*! \copydoc frac_shift_factor \see frac_shift_factor */
inline double getFracShiftFactor() const
{
return this->frac_shift_factor;
}
/*! \brief sets the property brace_y_shift_factor ( \copybrief brace_y_shift_factor ) to the specified \a __value.
\details Description of the parameter brace_y_shift_factor is: <BLOCKQUOTE>\copydoc brace_y_shift_factor </BLOCKQUOTE>
\see brace_y_shift_factor for more information */
inline virtual void setBraceYShiftFactor(double __value)
/*! \copydoc brace_y_shift_factor \see brace_y_shift_factor */
inline void setBraceYShiftFactor(double __value)
{
this->brace_y_shift_factor = __value;
}
/*! \brief returns the property brace_y_shift_factor ( \copybrief brace_y_shift_factor ).
\details Description of the parameter brace_y_shift_factor is: <BLOCKQUOTE>\copydoc brace_y_shift_factor </BLOCKQUOTE>
\see brace_y_shift_factor for more information */
inline virtual double getBraceYShiftFactor() const
/*! \copydoc brace_y_shift_factor \see brace_y_shift_factor */
inline double getBraceYShiftFactor() const
{
return this->brace_y_shift_factor;
}
/*! \brief sets the property decoration_height_factor ( \copybrief decoration_height_factor ) to the specified \a __value.
\details Description of the parameter decoration_height_factor is: <BLOCKQUOTE>\copydoc decoration_height_factor </BLOCKQUOTE>
\see decoration_height_factor for more information */
inline virtual void setDecorationHeightFactor(double __value)
/*! \copydoc decoration_height_factor \see decoration_height_factor */
inline void setDecorationHeightFactor(double __value)
{
this->decoration_height_factor = __value;
}
/*! \brief returns the property decoration_height_factor ( \copybrief decoration_height_factor ).
\details Description of the parameter decoration_height_factor is: <BLOCKQUOTE>\copydoc decoration_height_factor </BLOCKQUOTE>
\see decoration_height_factor for more information */
inline virtual double getDecorationHeightFactor() const
/*! \copydoc decoration_height_factor \see decoration_height_factor */
inline double getDecorationHeightFactor() const
{
return this->decoration_height_factor;
}
/*! \brief sets the property expensiveRendering ( \copybrief expensiveRendering ) to the specified \a __value.
\details Description of the parameter expensiveRendering is: <BLOCKQUOTE>\copydoc expensiveRendering </BLOCKQUOTE>
\see expensiveRendering for more information */
inline virtual void setExpensiveRendering(bool __value)
/*! \copydoc expensiveRendering \see expensiveRendering */
inline void setExpensiveRendering(bool __value)
{
this->expensiveRendering = __value;
}
/*! \brief returns the property expensiveRendering ( \copybrief expensiveRendering ).
\details Description of the parameter expensiveRendering is: <BLOCKQUOTE>\copydoc expensiveRendering </BLOCKQUOTE>
\see expensiveRendering for more information */
inline virtual bool getExpensiveRendering() const
/*! \copydoc expensiveRendering \see expensiveRendering */
inline bool getExpensiveRendering() const
{
return this->expensiveRendering;
}
/*! \brief sets the property useUnparsed ( \copybrief useUnparsed ) to the specified \a __value.
\details Description of the parameter useUnparsed is: <BLOCKQUOTE>\copydoc useUnparsed </BLOCKQUOTE>
\see useUnparsed for more information */
inline virtual void setUseUnparsed(bool __value)
/*! \copydoc useUnparsed \see useUnparsed */
inline void setUseUnparsed(bool __value)
{
this->useUnparsed = __value;
}
/*! \brief returns the property useUnparsed ( \copybrief useUnparsed ).
\details Description of the parameter useUnparsed is: <BLOCKQUOTE>\copydoc useUnparsed </BLOCKQUOTE>
\see useUnparsed for more information */
inline virtual bool isUsingUnparsed() const
/*! \copydoc useUnparsed \see useUnparsed */
inline bool isUsingUnparsed() const
{
return this->useUnparsed;
}
@ -1355,6 +1234,10 @@ class JKQTP_LIB_EXPORT JKQTMathText : public QObject {
bool default_useSTIXfonts;
/** \brief indicates whether to use XITS fonts or not */
bool useXITSfonts;
/** \brief the first call to useXITS() determines this name for the default XITS fonts */
QString defaultXITSFontName;
/** \brief the call to useXITS() determines this name for the default XITS Math fonts */
QString defaultXITSMathFontName;
/*! \brief default value for property useXITSfonts.
\see useXITSfonts for more information */
bool default_useXITSfonts;

View File

@ -1,3 +1,6 @@
# uncomment this line to prevent linking in of the XITS fonts
#DEFINES += NO_XITS_FONTS
include($$PWD/common.pri)
@ -12,6 +15,7 @@ HEADERS += \
$$PWD/jkqtplotter/jkqtpgraphs.h \
$$PWD/jkqtplotter/jkqtpgraphsbarchart.h \
$$PWD/jkqtplotter/jkqtpgraphsbase.h \
$$PWD/jkqtplotter/jkqtpgraphsbaseerrors.h \
$$PWD/jkqtplotter/jkqtpgraphsboxplot.h \
$$PWD/jkqtplotter/jkqtpgraphsevaluatedfunction.h \
$$PWD/jkqtplotter/jkqtpgraphsfilledcurve.h \
@ -21,7 +25,14 @@ HEADERS += \
$$PWD/jkqtplotter/jkqtpgraphsparsedfunction.h \
$$PWD/jkqtplotter/jkqtpgraphspeakstream.h \
$$PWD/jkqtplotter/jkqtpgraphssinglecolumnsymbols.h \
$$PWD/jkqtplotter/jkqtpgraphsimageoverlays.h \
$$PWD/jkqtplotter/jkqtpgraphscontour.h \
$$PWD/jkqtplotter/jkqtpgraphsimagergb.h \
$$PWD/jkqtplotter/jkqtplotter.h \
$$PWD/jkqtplotter/jkqtplotterstyle.h \
$$PWD/jkqtplotter/jkqtpbaseplotterstyle.h \
$$PWD/jkqtplotter/jkqtpcoordinateaxes.h \
$$PWD/jkqtplotter/jkqtpcoordinateaxesstyle.h \
$$PWD/jkqtplottergui/jkqtpcomboboxes.h \
$$PWD/jkqtplottergui/jkqtpenhancedspinboxes.h \
$$PWD/jkqtplottergui/jkqtpenhancedtableview.h \
@ -32,7 +43,8 @@ HEADERS += \
$$PWD/jkqtplottertools/jkqtphighrestimer.h \
$$PWD/jkqtplottertools/jkqtpimagetools.h \
$$PWD/jkqtplottertools/jkqtpmathparser.h \
$$PWD/jkqtplottertools/jkqttools.h
$$PWD/jkqtplottertools/jkqttools.h \
$$PWD/jkqtplotter/jkqtpkeystyle.h
SOURCES += \
@ -45,6 +57,7 @@ SOURCES += \
$$PWD/jkqtplotter/jkqtpgraphs.cpp \
$$PWD/jkqtplotter/jkqtpgraphsbarchart.cpp \
$$PWD/jkqtplotter/jkqtpgraphsbase.cpp \
$$PWD/jkqtplotter/jkqtpgraphsbaseerrors.cpp \
$$PWD/jkqtplotter/jkqtpgraphsboxplot.cpp \
$$PWD/jkqtplotter/jkqtpgraphsevaluatedfunction.cpp \
$$PWD/jkqtplotter/jkqtpgraphsfilledcurve.cpp \
@ -54,7 +67,14 @@ SOURCES += \
$$PWD/jkqtplotter/jkqtpgraphsparsedfunction.cpp \
$$PWD/jkqtplotter/jkqtpgraphspeakstream.cpp \
$$PWD/jkqtplotter/jkqtpgraphssinglecolumnsymbols.cpp \
$$PWD/jkqtplotter/jkqtpgraphsimageoverlays.cpp \
$$PWD/jkqtplotter/jkqtpgraphscontour.cpp \
$$PWD/jkqtplotter/jkqtpgraphsimagergb.cpp \
$$PWD/jkqtplotter/jkqtplotter.cpp \
$$PWD/jkqtplotter/jkqtplotterstyle.cpp \
$$PWD/jkqtplotter/jkqtpbaseplotterstyle.cpp \
$$PWD/jkqtplotter/jkqtpcoordinateaxes.cpp \
$$PWD/jkqtplotter/jkqtpcoordinateaxesstyle.cpp \
$$PWD/jkqtplottergui/jkqtpcomboboxes.cpp \
$$PWD/jkqtplottergui/jkqtpenhancedspinboxes.cpp \
$$PWD/jkqtplottergui/jkqtpenhancedtableview.cpp \
@ -65,10 +85,12 @@ SOURCES += \
$$PWD/jkqtplottertools/jkqtphighrestimer.cpp \
$$PWD/jkqtplottertools/jkqtpimagetools.cpp \
$$PWD/jkqtplottertools/jkqtpmathparser.cpp \
$$PWD/jkqtplottertools/jkqttools.cpp
$$PWD/jkqtplottertools/jkqttools.cpp \
$$PWD/jkqtplotter/jkqtpkeystyle.cpp
RESOURCES += $$PWD/jkqtplotterressources/jkqtpbaseplotter.qrc
RESOURCES += $$PWD/jkqtplotterressources/jkqtpbaseplotter.qrc \
$$PWD/jkqtplotterressources/jkqtpstyles.qrc
QT += xml svg opengl

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,235 @@
#include "jkqtpbaseplotterstyle.h"
#include <QPalette>
#include <QApplication>
#include "jkqtplottertools/jkqtptools.h"
JKQTBasePlotterStyle::JKQTBasePlotterStyle():
debugShowRegionBoxes(false),
debugRegionLineWidth(3),
CSVdecimalSeparator("."),
CSVcommentInitializer("# "),
plotBorderTop(5),
plotBorderLeft(5),
plotBorderBottom(5),
plotBorderRight(5),
defaultGraphWidth(2),
defaultGraphSymbolSize(10),
defaultGraphSymbolLineWidth(1),
widgetBackgroundColor(QApplication::palette().color(QPalette::Window)),
exportBackgroundColor(QColor("white")),
plotBackgroundColor(QColor("white")),
plotFrameColor(QColor("black")),
plotFrameWidth(2),
plotFrameRounding(0),
plotFrameVisible(false),
plotLabelFontName(QApplication::font().family()+"+XITS"),
plotLabelFontSize(12),
useAntiAliasingForSystem(true),
useAntiAliasingForGraphs(true),
useAntiAliasingForText(true),
defaultTextColor(QColor("black")),
defaultFontSize(8),
defaultFontName(QApplication::font().family()+"+XITS"),
defaultPalette(JKQTPMathImageMATLAB),
graphFillColorDerivationMode(JKQTPFFCMLighterColor),
graphErrorColorDerivationMode(JKQTPFFCMDarkerColor),
graphErrorFillColorDerivationMode(JKQTPFFCMEvenLighterColor),
keyStyle(*this),
xAxisStyle(*this),
yAxisStyle(*this),
rightColorbarAxisStyle(*this),
topColorbarAxisStyle(*this)
{
/*
keyStyle=JKQTPKeyStyle(*this);
xAxisStyle=JKQTPCoordinateAxisStyle(*this);
yAxisStyle=JKQTPCoordinateAxisStyle(*this);
rightColorbarAxisStyle=JKQTPCoordinateAxisStyle(*this);
topColorbarAxisStyle=JKQTPCoordinateAxisStyle(*this);
*/
defaultGraphColors<<QColor("red")<<QColor("green")<<QColor("blue")<<QColor("fuchsia")<<QColor("darkorange")
<<QColor("navy")<<QColor("firebrick")<<QColor("darkgreen")<<QColor("darkmagenta")
<<QColor("darkgreen")<<QColor("darkslateblue")<<QColor("maroon")<<QColor("indianred")
<<QColor("darkolivegreen")<<QColor("mediumpurple")<<QColor("darkcyan");
defaultGraphPenStyles<<Qt::SolidLine<<Qt::DashLine<<Qt::DotLine<<Qt::DashDotLine<<Qt::DashDotDotLine;
for (int i=2; i<=JKQTPMaxSymbolID; i++) defaultGraphSymbols.push_back(static_cast<JKQTPGraphSymbols>(i));
defaultGraphFillStyles<<Qt::SolidPattern;
}
void JKQTBasePlotterStyle::loadSettings(const QSettings &settings, const QString &group, const JKQTBasePlotterStyle &defaultStyle)
{
CSVdecimalSeparator=settings.value(group+"csv_decimal_separator", defaultStyle.CSVdecimalSeparator).toString();
CSVcommentInitializer=settings.value(group+"csv_comment_initializer", defaultStyle.CSVcommentInitializer).toString();
plotBorderLeft=settings.value(group+"plot_border_left", defaultStyle.plotBorderLeft).toInt();
plotBorderRight=settings.value(group+"plot_border_right", defaultStyle.plotBorderRight).toInt();
plotBorderTop=settings.value(group+"plot_border_top", defaultStyle.plotBorderTop).toInt();
plotBorderBottom=settings.value(group+"plot_border_bottom", defaultStyle.plotBorderBottom).toInt();
debugShowRegionBoxes=settings.value(group+"debug_show_region_boxes", defaultStyle.debugShowRegionBoxes).toBool();
debugRegionLineWidth=settings.value(group+"debug_region_linewidth", defaultStyle.debugRegionLineWidth).toDouble();
plotLabelFontName=settings.value(group+"plot_label_font_name", defaultStyle.plotLabelFontName).toString();
plotLabelFontSize=settings.value(group+"plot_label_font_size", defaultStyle.debugRegionLineWidth).toDouble();
widgetBackgroundColor=jkqtp_String2QColor(settings.value(group+"widget_background_color", jkqtp_QColor2String(defaultStyle.widgetBackgroundColor)).toString());
exportBackgroundColor=jkqtp_String2QColor(settings.value(group+"widget_background_color_for_export", jkqtp_QColor2String(defaultStyle.exportBackgroundColor)).toString());
plotBackgroundColor=jkqtp_String2QColor(settings.value(group+"plot_background_color", jkqtp_QColor2String(defaultStyle.plotBackgroundColor)).toString());
plotFrameColor=jkqtp_String2QColor(settings.value(group+"plot_frame_color", jkqtp_QColor2String(defaultStyle.plotFrameColor)).toString());
plotFrameWidth=settings.value(group+"plot_frame_width", defaultStyle.plotFrameWidth).toDouble();
plotFrameVisible=settings.value(group+"plot_frame_visible", defaultStyle.plotFrameVisible).toBool();
plotFrameRounding=settings.value(group+"plot_frame_rounded", defaultStyle.plotFrameRounding).toDouble();
useAntiAliasingForSystem=settings.value(group+"antialiase_system", defaultStyle.useAntiAliasingForSystem).toBool();
useAntiAliasingForGraphs=settings.value(group+"antialiase_graphs", defaultStyle.useAntiAliasingForGraphs).toBool();
useAntiAliasingForText=settings.value(group+"antialiase_text", defaultStyle.useAntiAliasingForText).toBool();
defaultTextColor=jkqtp_String2QColor(settings.value(group+"text_default_color", jkqtp_QColor2String(defaultStyle.defaultTextColor)).toString());
defaultFontSize=settings.value(group+"text_default_size", defaultStyle.defaultFontSize).toDouble();
defaultFontName=settings.value(group+"text_default_font_name", defaultStyle.defaultFontName).toString();
defaultPalette=String2JKQTPMathImageColorPalette(settings.value(group+"graph_default_palette", JKQTPMathImageColorPalette2String(defaultStyle.defaultPalette)).toString());
defaultGraphWidth=settings.value(group+"graph_default_linewidth", defaultStyle.debugRegionLineWidth).toDouble();
defaultGraphSymbolSize=settings.value(group+"graph_default_symbolsize", defaultStyle.defaultGraphSymbolSize).toDouble();
defaultGraphSymbolLineWidth=settings.value(group+"graph_default_symbol_linewidtht", defaultStyle.defaultGraphSymbolLineWidth).toDouble();
graphFillColorDerivationMode=String2JKQTPColorDerivationMode(settings.value(group+"graph_default_fill_color_mode", JKQTPColorDerivationMode2String(defaultStyle.graphFillColorDerivationMode)).toString());
graphErrorFillColorDerivationMode=String2JKQTPColorDerivationMode(settings.value(group+"graph_default_error_fill_color_mode", JKQTPColorDerivationMode2String(defaultStyle.graphErrorFillColorDerivationMode)).toString());
graphErrorColorDerivationMode=String2JKQTPColorDerivationMode(settings.value(group+"graph_default_error_color_mode", JKQTPColorDerivationMode2String(defaultStyle.graphErrorColorDerivationMode)).toString());
keyStyle.loadSettings(settings, group+"key/", defaultStyle.keyStyle);
xAxisStyle.loadSettings(settings, group+"axis_x/", defaultStyle.xAxisStyle);
yAxisStyle.loadSettings(settings, group+"axis_y/", defaultStyle.yAxisStyle);
rightColorbarAxisStyle.loadSettings(settings, group+"axis_colorbar_right/", defaultStyle.rightColorbarAxisStyle);
topColorbarAxisStyle.loadSettings(settings, group+"axis_colorbar_top/", defaultStyle.topColorbarAxisStyle);
auto readID=[](const QString& k, const QString& start) {
if (k.startsWith(start)) {
QString kk=k;
kk.remove(0, start.size());
QString num="";
while (kk.front().isDigit()) {
num+=kk.front();
kk.remove(0, 1);
}
bool ok=false;
int id=num.toInt(&ok);
if (ok) {
return id;
}
}
return -1;
};
defaultGraphColors.clear();
defaultGraphPenStyles.clear();
defaultGraphSymbols.clear();
defaultGraphFillStyles.clear();
QStringList allk=settings.allKeys();
for (auto& k: allk) {
int id=readID(k, group+"default_graph_styles/color");
if (id>=0) {
defaultGraphColors.push_back(jkqtp_String2QColor(settings.value(group+"default_graph_styles/color"+QString::number(id), jkqtp_QColor2String(QColor("red"))).toString()));
}
id=readID(k, group+"default_graph_styles/line_style");
if (id>=0) {
defaultGraphPenStyles.push_back(jkqtp_String2QPenStyle(settings.value(group+"default_graph_styles/line_style"+QString::number(id), jkqtp_QPenStyle2String(Qt::SolidLine)).toString()));
}
id=readID(k, group+"default_graph_styles/symbol");
if (id>=0) {
defaultGraphSymbols.push_back(String2JKQTPGraphSymbols(settings.value(group+"default_graph_styles/symbol"+QString::number(id), JKQTPGraphSymbols2String(JKQTPCross)).toString()));
}
id=readID(k, group+"default_graph_styles/fill_style");
if (id>=0) {
defaultGraphFillStyles.push_back(jkqtp_String2QBrushStyle(settings.value(group+"default_graph_styles/fill_style"+QString::number(id), jkqtp_QBrushStyle2String(Qt::SolidPattern)).toString()));
}
}
if (defaultGraphColors.size()==0) {
for (int i=defaultGraphColors.size(); i<defaultStyle.defaultGraphColors.size(); i++) {
defaultGraphColors.push_back(defaultStyle.defaultGraphColors[i]);
}
}
if (defaultGraphPenStyles.size()==0) {
for (int i=defaultGraphPenStyles.size(); i<defaultStyle.defaultGraphPenStyles.size(); i++) {
defaultGraphPenStyles.push_back(defaultStyle.defaultGraphPenStyles[i]);
}
}
if (defaultGraphSymbols.size()==0) {
for (int i=defaultGraphSymbols.size(); i<defaultStyle.defaultGraphSymbols.size(); i++) {
defaultGraphSymbols.push_back(defaultStyle.defaultGraphSymbols[i]);
}
}
if (defaultGraphFillStyles.size()==0) {
for (int i=defaultGraphFillStyles.size(); i<defaultStyle.defaultGraphFillStyles.size(); i++) {
defaultGraphFillStyles.push_back(defaultStyle.defaultGraphFillStyles[i]);
}
}
}
void JKQTBasePlotterStyle::saveSettings(QSettings &settings, const QString &group) const
{
settings.setValue(group+"csv_decimal_separator", CSVdecimalSeparator);
settings.setValue(group+"csv_comment_initializer", CSVcommentInitializer);
settings.setValue(group+"debug_show_region_boxes", debugShowRegionBoxes);
settings.setValue(group+"debug_region_linewidth", debugRegionLineWidth);
settings.setValue(group+"antialiase_system", useAntiAliasingForSystem);
settings.setValue(group+"antialiase_graphs", useAntiAliasingForGraphs);
settings.setValue(group+"antialiase_text", useAntiAliasingForText);
settings.setValue(group+"widget_background_color", jkqtp_QColor2String(widgetBackgroundColor));
settings.setValue(group+"widget_background_color_for_export", jkqtp_QColor2String(exportBackgroundColor));
settings.setValue(group+"plot_background_color", jkqtp_QColor2String(plotBackgroundColor));
settings.setValue(group+"plot_border_left", plotBorderLeft);
settings.setValue(group+"plot_border_right", plotBorderRight);
settings.setValue(group+"plot_border_top", plotBorderTop);
settings.setValue(group+"plot_border_bottom", plotBorderBottom);
settings.setValue(group+"graph_default_linewidth", defaultGraphWidth);
settings.setValue(group+"graph_default_symbolsize", defaultGraphSymbolSize);
settings.setValue(group+"graph_default_symbol_linewidtht", defaultGraphSymbolLineWidth);
settings.setValue(group+"graph_default_palette", JKQTPMathImageColorPalette2String(defaultPalette));
settings.setValue(group+"graph_default_fill_color_mode", JKQTPColorDerivationMode2String(graphFillColorDerivationMode));
settings.setValue(group+"graph_default_error_color_mode", JKQTPColorDerivationMode2String(graphErrorColorDerivationMode));
settings.setValue(group+"graph_default_error_fill_color_mode", JKQTPColorDerivationMode2String(graphErrorFillColorDerivationMode));
settings.setValue(group+"text_default_color", jkqtp_QColor2String(defaultTextColor));
settings.setValue(group+"text_default_size", defaultFontSize);
settings.setValue(group+"text_default_font_name", defaultFontName);
settings.setValue(group+"plot_label_font_name", plotLabelFontName);
settings.setValue(group+"plot_label_font_size", plotLabelFontSize);
settings.setValue(group+"plot_frame_visible", plotFrameVisible);
settings.setValue(group+"plot_frame_color", jkqtp_QColor2String(plotFrameColor));
settings.setValue(group+"plot_frame_width", plotFrameWidth);
settings.setValue(group+"plot_frame_rounded", plotFrameRounding);
keyStyle.saveSettings(settings, group+"key/");
xAxisStyle.saveSettings(settings, group+"axis_x/");
yAxisStyle.saveSettings(settings, group+"axis_y/");
rightColorbarAxisStyle.saveSettings(settings, group+"axis_colorbar_right/");
topColorbarAxisStyle.saveSettings(settings, group+"axis_colorbar_top/");
int cnt=0;
for (auto& gs: defaultGraphColors) {
settings.setValue(group+"default_graph_styles/color"+QString::number(cnt), jkqtp_QColor2String(gs));
cnt++;
}
cnt=0;
for (auto& gs: defaultGraphPenStyles) {
settings.setValue(group+"default_graph_styles/line_style"+QString::number(cnt), jkqtp_QPenStyle2String(gs));
cnt++;
}
cnt=0;
for (auto& gs: defaultGraphSymbols) {
settings.setValue(group+"default_graph_styles/symbol"+QString::number(cnt), JKQTPGraphSymbols2String(gs));
cnt++;
}
cnt=0;
for (auto& gs: defaultGraphFillStyles) {
settings.setValue(group+"default_graph_styles/fill_style"+QString::number(cnt), jkqtp_QBrushStyle2String(gs));
cnt++;
}
}
JKQTBasePlotterStyle &JKQTPGetSystemDefaultBaseStyle()
{
static JKQTBasePlotterStyle instance=JKQTBasePlotterStyle();
return instance;
}
void JKQTPSetSystemDefaultBaseStyle(JKQTBasePlotterStyle &newStyle)
{
JKQTPGetSystemDefaultBaseStyle().operator=(newStyle);
}

View File

@ -0,0 +1,198 @@
/*
Copyright (c) 2008-2019 Jan W. Krieger (<jan@jkrieger.de>, <j.krieger@dkfz.de>)
This software 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef JKQTBASEPLOTTERSTYLE_H
#define JKQTBASEPLOTTERSTYLE_H
#include "jkqtplottertools/jkqtptools.h"
#include "jkqtplotter/jkqtpcoordinateaxesstyle.h"
#include "jkqtplotter/jkqtpkeystyle.h"
#include "jkqtplottertools/jkqtpimagetools.h"
#include "jkqtplottertools/jkqtp_imexport.h"
#include <QColor>
#include <QPainter>
#include <QString>
#include <QHash>
#include <QPair>
#include <QVector>
#include <QSettings>
/** \brief Support Class for JKQTBasePlotter, which summarizes all proeprties that define the visual styling of a JKQTBasePlotter
* \ingroup jkqtpplotter_styling
*
* \see JKQTBasePlotter, \ref jkqtpplotter_styling
*/
class JKQTP_LIB_EXPORT JKQTBasePlotterStyle {
Q_GADGET
public:
JKQTBasePlotterStyle();
/** \brief loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object
*
* \param settings QSettings-object to read from
* \param group Group in the QSettings-object to read from
* \param defaultStyle If a setting cannot be found in \a settings, default values are taken from this object
* By default, this is a default-constructed object
*/
void loadSettings(const QSettings &settings, const QString& group=QString("plots/"), const JKQTBasePlotterStyle &defaultStyle=JKQTBasePlotterStyle());
/** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
*
* \param settings QSettings-object to save to
* \param group Group in the QSettings-object to save to
*/
void saveSettings(QSettings& settings, const QString& group=QString("plots/")) const;
/** \brief if set \c true (default: \c false ) the JKQTBasePlotter draws colored rectangles to indicate the different regions in the plot (border, axes, ...) */
bool debugShowRegionBoxes;
/** \brief width of the lines that are drawn, when debugShowRegionBoxes \c ==true [in pixels] */
double debugRegionLineWidth;
/** \brief the decimal separator used when exporting data to text files */
QString CSVdecimalSeparator;
/** \brief this string is used to introduce comments in text output when exporting data */
QString CSVcommentInitializer;
/** \brief free space between widget top border and plot top border, this property may be set by the user and is possibly altered
* by the key positioning algorithm. The altered value is written to internalPlotBorderTop
*
* \image html plot_widget_orientation.png
*
* \see JKQTBasePlotter::setBorder(), \ref jkqtplotter_base_plotsize
*/
int plotBorderTop;
/** \brief free space between widget left border and plot left border, this property may be set by the user and is possibly altered
* by the key positioning algorithm. The altered value is written to internalPlotBorderLeft
*
* \image html plot_widget_orientation.png
*
* \see JKQTBasePlotter::setBorder(), \ref jkqtplotter_base_plotsize
*/
int plotBorderLeft;
/** \brief free space between widget bottom border and plot bottom border, this property may be set by the user and is possibly altered
* by the key positioning algorithm. The altered value is written to internalPlotBorderBottom
*
* \image html plot_widget_orientation.png
*
* \see JKQTBasePlotter::setBorder(), \ref jkqtplotter_base_plotsize
*/
int plotBorderBottom;
/** \brief free space between widget right border and plot right border, this property may be set by the user and is possibly altered
* by the key positioning algorithm. The altered value is written to internalPlotBorderRight
*
* \image html plot_widget_orientation.png
*
* \see JKQTBasePlotter::setBorder(), \ref jkqtplotter_base_plotsize
*/
int plotBorderRight;
/** \brief width (in pt) of lines used for newly added graphs */
double defaultGraphWidth;
/** \brief size (in pt) of symbols used for newly added graphs */
double defaultGraphSymbolSize;
/** \brief with (in pt) of symbol lines used for newly added graphs */
double defaultGraphSymbolLineWidth;
/** \brief color of the background of the plot (widget area) when drawing (to the screen) */
QColor widgetBackgroundColor;
/** \brief color of the background of the plot (widget area) when exporting*/
QColor exportBackgroundColor;
/** \brief color of the plot's background (i.e. of the area within the coordinate axes rectangle) */
QColor plotBackgroundColor;
/** \brief if \c plotFrameVisible==true, JKQTBasePlotter will draw a rectangle/frame around the plot in this color */
QColor plotFrameColor;
/** \brief if \c plotFrameVisible==true, JKQTBasePlotter will draw a rectangle/frame around the plot in this width [pt] */
double plotFrameWidth;
/** \brief if \c plotFrameVisible==true, JKQTBasePlotter will draw a rectangle/frame around the plot, rounding the corners with this redius (<=0 -> no rounded rectangle) [pt] */
double plotFrameRounding;
/** \brief if \c true, JKQTBasePlotter will draw a rectangle/frame around the plot */
bool plotFrameVisible;
/** \brief the plot label font name */
QString plotLabelFontName;
/** \brief the plot label font size [pt] */
double plotLabelFontSize;
/** \brief specifies whether to use antialiasing for plotting the coordinate system */
bool useAntiAliasingForSystem;
/** \brief specifies whether to use antialiasing for plotting the graphs
*
* \note You can set this property \c false to increase plotting speed of complex plots (with many graphs inside). You can reach a
* roughly three-fold speed improvement!
*/
bool useAntiAliasingForGraphs;
/** \brief specifies whether to use antialiasing when drawing any text
* \note You can set this property \c false to increase plotting speed of complex plots (with many graphs inside). You can reach a
* roughly three-fold speed improvement!
*/
bool useAntiAliasingForText;
/** \brief default text color in the plot */
QColor defaultTextColor;
/** \brief default font size in the plot [pt] */
double defaultFontSize;
/** \brief default font name in the plot */
QString defaultFontName;
/** \brief color palette used by default for new graphs */
JKQTPMathImageColorPalette defaultPalette;
/** \brief defines how to derive a fill color for a new graph */
JKQTPColorDerivationMode graphFillColorDerivationMode;
/** \brief defines how to derive an error color for a new graph */
JKQTPColorDerivationMode graphErrorColorDerivationMode;
/** \brief defines how to derive an error fill color from the error color for a new graph */
JKQTPColorDerivationMode graphErrorFillColorDerivationMode;
/** \brief colors used to automatically collor different graphs differently */
QVector<QColor> defaultGraphColors;
/** \brief Qt::PenStyle used to automatically style different graphs differently */
QVector<Qt::PenStyle> defaultGraphPenStyles;
/** \brief JKQTPGraphSymbols used to automatically assign to different graphs */
QVector<JKQTPGraphSymbols> defaultGraphSymbols;
/** \brief Qt::BrushStyle used to automatically style different graphs differently */
QVector<Qt::BrushStyle> defaultGraphFillStyles;
/** \brief style of the plot key/legend */
JKQTPKeyStyle keyStyle;
/** \brief style of the x-axis of the main coordinate system */
JKQTPCoordinateAxisStyle xAxisStyle;
/** \brief style of the y-axis of the main coordinate system */
JKQTPCoordinateAxisStyle yAxisStyle;
/** \brief style of the coordinate axes used to display colorbars in the right */
JKQTPCoordinateAxisStyle rightColorbarAxisStyle;
/** \brief style of the coordinate axes used to display colorbars at the top */
JKQTPCoordinateAxisStyle topColorbarAxisStyle;
};
/** \brief returns the system-wide default JKQTPlotterStyle
* \ingroup jkqtpplotter_styling
*
* \see JKQTPGetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), JKQTPSetSystemDefaultBaseStyle(), \ref jkqtpplotter_styling
*/
JKQTP_LIB_EXPORT JKQTBasePlotterStyle& JKQTPGetSystemDefaultBaseStyle();
/** \brief replaces the system-wide default JKQTPlotterStyle with the given \a newStyle
* \ingroup jkqtpplotter_styling
*
* \see JKQTPGetSystemDefaultStyle(), JKQTPSetSystemDefaultStyle(), JKQTPGetSystemDefaultBaseStyle(), \ref jkqtpplotter_styling
*/
JKQTP_LIB_EXPORT void JKQTPSetSystemDefaultBaseStyle(JKQTBasePlotterStyle& newStyle);
#endif // JKQTBASEPLOTTERSTYLE_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,981 @@
/*
Copyright (c) 2008-2019 Jan W. Krieger (<jan@jkrieger.de>)
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program 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 (LGPL) for more details.
You should have received a copy of the GNU Lesser General Public License (LGPL)
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef JKQTPCOORDINATEAXES_H
#define JKQTPCOORDINATEAXES_H
#include <QString>
#include <QPainter>
#include <QPair>
#include <QSettings>
#include "jkqtplottertools/jkqtptools.h"
#include "jkqtmathtext/jkqtmathtext.h"
#include "jkqtplottertools/jkqtp_imexport.h"
#include "jkqtplotter/jkqtpcoordinateaxesstyle.h"
// forward declarations
class JKQTBasePlotter;
/*! \brief this virtual class is the base for any type of coordinate axis, to be drawn by JKQTBasePlotter.
\ingroup jkqtpbaseplotter_elements
This class implements all the functionality needed for a coordinate axis:
- transform world to screen coordinates and vice versa
- draw the axis (implemented by child classes!) with these elements: axis lines, JKQTPCoordinateAxisStyle::ticks, tick labels, axis label, x/y=0 axis
- measure the axes in screen coordinates
- load and save the settings to an ini file
.
Most of the actual draw and measure functions have to be implemented in descendents of this class (namely
JKQTPHorizontalAxis and JKQTPVerticalAxis, as they are specific to whether the axis is drawn horizontally or
vertically.
Each axis is split up into several parts, as depicted in this image:
\image html jkqtpcoordinateaxis1.png
Which parts to actually draw is set by the diverse properties.
\section jkqtplotter_base_systems_baseelements Coordinate Systems and Transformations
The plot itself is positioned inside the widget (see \ref jkqtplotter_base_plotsize for details).
You simply supply the widget dimensions and the border
widths between the plot and the widget. The Object then calculates the size of the plot:
\image html plot_widget_orientation.png
The plot shows the parameter range xmin ... xmax and ymin ... ymax. Note that if you plot logarithmic plots
you may only plot positive (>0) values. Any other value may lead to an error or unpredictable behaviour.
From these parameters the object calculates the scaling laws for plotting pints to the screen. The next paragraphs
show all calculations for x- and y-coordinates, ahough this class only implements a generic form. The actual calculation
is also influenced by the parameters set in the child classes!
-# <tt>width = xmax - xmin</tt>
-# <tt>height = ymax - ymin</tt>
-# <tt>plotWidth = widgetWidth - plotBorderLeft - plotBorderRight</tt>
-# <tt>plotHeight = widgetHeight - plotBorderTop - plotBorderBottom</tt>
-# <tt>xPlotOffset = plotBorderLeft</tt>
-# <tt>yPlotOffset = plotBorderTop</tt>
.
These parameters are common to all scaling laws. The next image explains these formulas:
\image html plot_coordinates.png
The actual scaling laws \f$ (x_p(x), y_p(y)) \f$ may be derived from these equations:
\f[ x_p(\mbox{xmin})=\mbox{xPlotOffset},\ \ \ \ \ x_p(\mbox{xmax})=\mbox{xPlotOffset}+\mbox{plotWidth} \f]
\f[ y_p(\mbox{ymax})=\mbox{yPlotOffset},\ \ \ \ \ y_p(\mbox{ymin})=\mbox{yPlotOffset}+\mbox{plotHeight} \f]
Here \f$ (x_p, y_p) \f$ denotes a point in pixel coordinates (green coordinate system) and \f$ (x,y) \f$ denotes a point in the
plotting coordinate system.
If you assume a <b>linear scaling law</b>. \f[ x_p(x)=\mbox{xoffset}+x\cdot\mbox{xscale} \ \ \ \ \ \ \ \ \ y_p(y)=\mbox{yoffset}-y\cdot\mbox{yscale} \f]
you can derive:
\f[ \mbox{xscale}=\frac{\mbox{plotWidth}}{\mbox{xwidth}},\ \ \ \ \ \ \mbox{xoffset}=\mbox{xPlotOffset}-\mbox{xmin}\cdot\mbox{xscale} \f]
\f[ \mbox{yscale}=\frac{\mbox{plotHeight}}{\mbox{ywidth}},\ \ \ \ \ \ \mbox{yoffset}=\mbox{yPlotOffset}+\mbox{ymax}\cdot\mbox{yscale} \f]
If you have a <b>logarithmic axis</b> (i.e. we plot \f$ \log_b(x) \f$ insetad of \f$ x \f$ for a given base \f$ b \f$ ) we get the same
formulas, but with \f$ x \f$ exchanged by \f$ \log_b(x) \f$. If we use the equation \f$ \log_b(x)=\log(x)/\log(b) \f$ we finally get
the scaling laws:
\f[ x_p(x)=\mbox{xoffset}+\frac{\log(x)}{\log(\mbox{logXAxisBase})}\cdot\mbox{xscale} \ \ \ \ \ \ \ \ \ y_p(y)=\mbox{yoffset}-\frac{\log(y)}{\log(\mbox{logYAxisBase})}\cdot\mbox{yscale} \f]
From these we can calculate their parameters with the same defining equations as above:
\f[ \mbox{xscale}=\frac{\mbox{plotWidth}\cdot\log(\mbox{logXAxisBase})}{\log(\mbox{xmax})-\log(\mbox{xmin})},\ \ \ \ \ \ \mbox{xoffset}=\mbox{xPlotOffset}-\frac{\log(\mbox{xmin})}{\log(\mbox{logXAxisBase})}\cdot\mbox{xscale} \f]
\f[ \mbox{yscale}=\frac{\mbox{plotHeight}\cdot\log(\mbox{logYAxisBase})}{\log(\mbox{ymax})-\log(\mbox{ymin})},\ \ \ \ \ \ \mbox{yoffset}=\mbox{yPlotOffset}+\frac{\log(\mbox{ymax})}{\log(\mbox{logYAxisBase})}\cdot\mbox{yscale} \f]
The object implements the above coordinate transformations in the (inline) method x2p(). The inverse transformations
are implemented in p2x(). They can be used to show the system coordinates of the current mouse position.
\section jkqtplotter_base_grids_baseelemenets Axis JKQTPCoordinateAxisStyle::Ticks and Grids
This section explains how this component draws the JKQTPCoordinateAxisStyle::ticks on coordinate axes and the grids that may be drawn below
the plots. In principle both - grids and axes - are drawn the same way, i.e. with the same step widths. There are
two types of JKQTPCoordinateAxisStyle::ticks and grids: The major and the minor JKQTPCoordinateAxisStyle::ticks/grids. The major JKQTPCoordinateAxisStyle::ticks also show a label that denotes the
value they represent. Between two major JKQTPCoordinateAxisStyle::ticks the axis shows \a JKQTPCoordinateAxisStyle::minorTicks small JKQTPCoordinateAxisStyle::ticks that are not
accompanied by a label. The next image shows an example of an axis:
\image html plot_axis_ticksandlabels.png
For the labels this class also uses an algorithm that extimates the number of valid digits (after the comma) that are
needed so that two adjacent labels do not show the same text, so if you plot the range 1.10 .. 1.15 The algorithm will
show at least two valid digits, as with one digit the labels would be 1.1, 1.1, 1.1, 1.1, 1.1, 1.1. With two digits they
are 1.10, 1.11, 1.12, 1.13, 1.14, 1.15. The class may also use a method that can write \c 1m instead of \c 0.001 and \c 1k
instead of \c 1000 (the algorithm supports the "exponent letters" f, p, n, u, m, k, M, G, T, P. The latter option may
(de)activated by using showXExponentCharacter and showYExponentCharacter.
For grids applies the same. There are two grids that are drawn in different styles (often the major grid is drawn
thicker and darker than the minor grid).
The minor JKQTPCoordinateAxisStyle::ticks and grid lines are generated automatically, depending in the setting of \a JKQTPCoordinateAxisStyle::minorTicks.
These properties give the number of minor JKQTPCoordinateAxisStyle::ticks between two major JKQTPCoordinateAxisStyle::ticks, so if the major JKQTPCoordinateAxisStyle::ticks are at 1,2,3,... and you
want minor JKQTPCoordinateAxisStyle::ticks at 1.1, 1.2, 1.3,... then you will have to set \c JKQTPCoordinateAxisStyle::minorTicks=9 as there are nine JKQTPCoordinateAxisStyle::ticks between two major
JKQTPCoordinateAxisStyle::ticks. So the minor tick spacing is calculated as: \f[ \Delta\mbox{MinorTicks}=\frac{\Delta\mbox{ticks}}{\mbox{minorTicks}+1} \f]
The same applies for logarithmic axes. If the major JKQTPCoordinateAxisStyle::ticks are at 1,10,100,... and you set \c JKQTPCoordinateAxisStyle::minorTicks=9 the program will
generate 9 equally spaced minor JKQTPCoordinateAxisStyle::ticks in between, so you have minor JKQTPCoordinateAxisStyle::ticks at 2,3,4,...,11,12,13,... This results in a standard
logarithmic axis. If you set \c JKQTPCoordinateAxisStyle::minorTicks=1 then you will get minor JKQTPCoordinateAxisStyle::ticks at 5,15,150,...
\image html plot_logaxis_ticksandlabels.png
The major tick-tick distances of linear axes may be calculated automatically in a way that the axis shows at least a given
number of JKQTPCoordinateAxisStyle::ticks \c JKQTPCoordinateAxisStyle::minTicks. The algorithm takes that tick spacing that will give a number of JKQTPCoordinateAxisStyle::ticks per axis
nearest but \c ">=" to the given \c JKQTPCoordinateAxisStyle::minTicks. The Algorithm is described in detail with the function
calcLinearTickSpacing(). To activate this automatic tick spacing you have to set <code>autoAxisSpacing=true</code>.
*/
class JKQTP_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
Q_OBJECT
protected:
public:
/** \brief class constructor */
explicit JKQTPCoordinateAxis(JKQTBasePlotter* parent);
/** \brief class destructor */
virtual ~JKQTPCoordinateAxis();
virtual void setParent(JKQTBasePlotter* parent);
/** \brief loads the plot properties from a QSettings object */
virtual void loadSettings(const QSettings &settings, const QString& group=QString("plots/axes/"));
/** \brief saves the plot properties into a QSettings object.
*
* This method only saves those properties that differ from their default value.
*/
virtual void saveSettings(QSettings& settings, const QString& group=QString("plots/axes/")) const;
/** \brief return x-pixel coordinate from time coordinate */
inline double x2p(double x) const {
double r=0;
if (logAxis) {
if (x<=0) r= offset+scaleSign*log(axismin)/log(logAxisBase)*scale;
else r= offset+scaleSign*log(x)/log(logAxisBase)*scale;
} else {
r= offset+scaleSign*x*scale;
}
if (inverted) {
return 2.0*getParentPlotOffset()+getParentPlotWidth()-r;//getParentPlotOffset()+getParentPlotWidth()-(r-getParentPlotOffset());
} else {
return r;
}
}
/** \brief return time coordinate coordinate from x-pixel */
inline double p2x(double x) const {
double xx=x;
if (inverted) {
xx=2.0*getParentPlotOffset()+getParentPlotWidth()-x;
}
xx=xx-offset;
if (logAxis) {
return exp(log(logAxisBase)*(xx)/(scaleSign*scale));
} else {
return xx/(scaleSign*scale);
}
}
/** \brief clear axis tick labels. This switches back to automatic labels mode for the axis. */
void clearAxisTickLabels();
/** \brief add a new tick label to the axis */
void addAxisTickLabel(double x, const QString& label);
/** \brief add a new tick label to the axis */
void addAxisTickLabels(const QVector<double>& x, const QStringList& label);
/** \brief add a new tick label to the axis */
void addAxisTickLabels(const double* x, const QStringList& label);
/** \brief add a new tick label to the axis */
void addAxisTickLabels(const QVector<double>& x, const QString* label);
/** \brief add a new tick label to the axis */
void addAxisTickLabels(const double* x, const QString* label, int items);
/** \brief returns the size of the left/bottom axis in pt */
virtual QSizeF getSize1(JKQTPEnhancedPainter& painter)=0;
/** \brief returns the size of the right/top axis in pt */
virtual QSizeF getSize2(JKQTPEnhancedPainter& painter)=0;
/** \brief draw axes */
virtual void drawAxes(JKQTPEnhancedPainter& painter)=0;
/** \brief draw grids */
virtual void drawGrids(JKQTPEnhancedPainter& painter)=0;
/*! \copydoc tickSpacing
\see tickSpacing */
inline double getTickSpacing() const { return this->tickSpacing; }
/*! \copydoc JKQTPCoordinateAxisStyle::labelDigits
\see JKQTPCoordinateAxisStyle::labelDigits */
inline int getLabelDigits() const { return this->axisStyle.labelDigits; }
/*! \copydoc autoAxisSpacing
\see autoAxisSpacing */
inline bool getAutoAxisSpacing() const { return this->autoAxisSpacing; }
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickLabelsEnabled
\see JKQTPCoordinateAxisStyle::minorTickLabelsEnabled */
inline bool getMinorTickLabelsEnabled() const { return this->axisStyle.minorTickLabelsEnabled; }
/*! \copydoc logAxis
\see logAxis */
inline bool getLogAxis() const { return this->logAxis; }
/*! \copydoc inverted
\see inverted */
inline bool getInverted() const { return this->inverted; }
/*! \copydoc logAxisBase
\see logAxisBase */
inline double getLogAxisBase() const { return this->logAxisBase; }
/*! \copydoc userTickSpacing
\see userTickSpacing */
inline double getUserTickSpacing() const { return this->userTickSpacing; }
/*! \copydoc userLogTickSpacing
\see userLogTickSpacing */
inline double getUserLogTickSpacing() const { return this->userLogTickSpacing; }
/*! \copydoc JKQTPCoordinateAxisStyle::labelType
\see JKQTPCoordinateAxisStyle::labelType */
inline JKQTPCALabelType getLabelType() const { return this->axisStyle.labelType; }
/*! \copydoc axisLabel
\see axisLabel */
inline QString getAxisLabel() const { return this->axisLabel; }
/*! \copydoc JKQTPCoordinateAxisStyle::labelPosition
\see JKQTPCoordinateAxisStyle::labelPosition */
inline JKQTPLabelPosition getLabelPosition() const { return this->axisStyle.labelPosition; }
/*! \copydoc JKQTPCoordinateAxisStyle::labelFontSize
\see JKQTPCoordinateAxisStyle::labelFontSize */
inline double getLabelFontSize() const { return this->axisStyle.labelFontSize; }
/*! \copydoc JKQTPCoordinateAxisStyle::tickLabelFontSize
\see JKQTPCoordinateAxisStyle::tickLabelFontSize */
inline double getTickLabelFontSize() const { return this->axisStyle.tickLabelFontSize; }
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickLabelFontSize
\see JKQTPCoordinateAxisStyle::minorTickLabelFontSize */
inline double getMinorTickLabelFontSize() const { return this->axisStyle.minorTickLabelFontSize; }
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickLabelFullNumber
\see JKQTPCoordinateAxisStyle::minorTickLabelFullNumber */
inline bool getMinorTickLabelFullNumber() const { return this->axisStyle.minorTickLabelFullNumber; }
/*! \copydoc JKQTPCoordinateAxisStyle::tickLabelAngle
\see JKQTPCoordinateAxisStyle::tickLabelAngle */
inline double getTickLabelAngle() const { return this->axisStyle.tickLabelAngle; }
/*! \copydoc JKQTPCoordinateAxisStyle::minTicks
\see JKQTPCoordinateAxisStyle::minTicks */
inline unsigned int getMinTicks() const { return this->axisStyle.minTicks; }
/*! \copydoc JKQTPCoordinateAxisStyle::minorTicks
\see JKQTPCoordinateAxisStyle::minorTicks */
inline unsigned int getMinorTicks() const { return this->axisStyle.minorTicks; }
/*! \copydoc JKQTPCoordinateAxisStyle::tickOutsideLength
\see JKQTPCoordinateAxisStyle::tickOutsideLength */
inline double getTickOutsideLength() const { return this->axisStyle.tickOutsideLength; }
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickOutsideLength
\see JKQTPCoordinateAxisStyle::minorTickOutsideLength */
inline double getMinorTickOutsideLength() const { return this->axisStyle.minorTickOutsideLength; }
/*! \copydoc JKQTPCoordinateAxisStyle::axisColor
\see JKQTPCoordinateAxisStyle::axisColor */
inline QColor getAxisColor() const { return this->axisStyle.axisColor; }
/*! \copydoc JKQTPCoordinateAxisStyle::showZeroAxis
\see JKQTPCoordinateAxisStyle::showZeroAxis */
inline bool getShowZeroAxis() const { return this->axisStyle.showZeroAxis; }
/*! \copydoc JKQTPCoordinateAxisStyle::gridColor
\see JKQTPCoordinateAxisStyle::gridColor */
inline QColor getGridColor() const { return this->axisStyle.gridColor; }
/*! \copydoc JKQTPCoordinateAxisStyle::minorGridColor
\see JKQTPCoordinateAxisStyle::minorGridColor */
inline QColor getMinorGridColor() const { return this->axisStyle.minorGridColor; }
/*! \copydoc JKQTPCoordinateAxisStyle::gridWidth
\see JKQTPCoordinateAxisStyle::gridWidth */
inline double getGridWidth() const { return this->axisStyle.gridWidth; }
/*! \copydoc JKQTPCoordinateAxisStyle::gridStyle
\see JKQTPCoordinateAxisStyle::gridStyle */
inline Qt::PenStyle getGridStyle() const { return this->axisStyle.gridStyle; }
/*! \copydoc JKQTPCoordinateAxisStyle::minorGridWidth
\see JKQTPCoordinateAxisStyle::minorGridWidth */
inline double getMinorGridWidth() const { return this->axisStyle.minorGridWidth; }
/*! \copydoc JKQTPCoordinateAxisStyle::minorGridStyle
\see JKQTPCoordinateAxisStyle::minorGridStyle */
inline Qt::PenStyle getMinorGridStyle() const { return this->axisStyle.minorGridStyle; }
/*! \copydoc JKQTPCoordinateAxisStyle::tickTimeFormat
\see JKQTPCoordinateAxisStyle::tickTimeFormat */
inline QString getTickTimeFormat() const { return this->axisStyle.tickTimeFormat; }
/*! \copydoc JKQTPCoordinateAxisStyle::tickDateFormat
\see JKQTPCoordinateAxisStyle::tickDateFormat */
inline QString getTickDateFormat() const { return this->axisStyle.tickDateFormat; }
/*! \copydoc JKQTPCoordinateAxisStyle::tickDateTimeFormat
\see JKQTPCoordinateAxisStyle::tickDateTimeFormat */
inline QString getTickDateTimeFormat() const { return this->axisStyle.tickDateTimeFormat; }
/*! \copydoc JKQTPCoordinateAxisStyle::tickMode
\see JKQTPCoordinateAxisStyle::tickMode */
inline JKQTPLabelTickMode getTickMode() const { return this->axisStyle.tickMode; }
/*! \copydoc JKQTPCoordinateAxisStyle::drawMode1
\see JKQTPCoordinateAxisStyle::drawMode1 */
inline JKQTPCADrawMode getDrawMode1() const { return this->axisStyle.drawMode1; }
/*! \copydoc JKQTPCoordinateAxisStyle::drawMode2
\see JKQTPCoordinateAxisStyle::drawMode2 */
inline JKQTPCADrawMode getDrawMode2() const { return this->axisStyle.drawMode2; }
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickWidth
\see JKQTPCoordinateAxisStyle::minorTickWidth */
inline double getMinorTickWidth() const { return this->axisStyle.minorTickWidth; }
/*! \copydoc JKQTPCoordinateAxisStyle::tickWidth
\see JKQTPCoordinateAxisStyle::tickWidth */
inline double getTickWidth() const { return this->axisStyle.tickWidth; }
/*! \copydoc JKQTPCoordinateAxisStyle::lineWidth
\see JKQTPCoordinateAxisStyle::lineWidth */
inline double getLineWidth() const { return this->axisStyle.lineWidth; }
/*! \copydoc JKQTPCoordinateAxisStyle::lineWidthZeroAxis
\see JKQTPCoordinateAxisStyle::lineWidthZeroAxis */
inline double getLineWidthZeroAxis() const { return this->axisStyle.lineWidthZeroAxis; }
/*! \copydoc JKQTPCoordinateAxisStyle::tickLabelDistance
\see JKQTPCoordinateAxisStyle::tickLabelDistance */
inline double getTickLabelDistance() const { return this->axisStyle.tickLabelDistance; }
/*! \copydoc JKQTPCoordinateAxisStyle::labelDistance
\see JKQTPCoordinateAxisStyle::labelDistance */
inline double getLabelDistance() const { return this->axisStyle.labelDistance; }
/*! \copydoc JKQTPCoordinateAxisStyle::drawGrid
\see JKQTPCoordinateAxisStyle::drawGrid */
inline bool getDrawGrid() const { return this->axisStyle.drawGrid; }
/*! \copydoc JKQTPCoordinateAxisStyle::drawMinorGrid
\see JKQTPCoordinateAxisStyle::drawMinorGrid */
inline bool getDrawMinorGrid() const { return this->axisStyle.drawMinorGrid; }
/*! \copydoc JKQTPCoordinateAxisStyle::autoLabelDigits
\see JKQTPCoordinateAxisStyle::autoLabelDigits */
inline void setAutoLabelDigits(bool __value)
{
this->axisStyle.autoLabelDigits = __value;
}
/*! \copydoc JKQTPCoordinateAxisStyle::autoLabelDigits
\see JKQTPCoordinateAxisStyle::autoLabelDigits */
inline bool getAutoLabelDigits() const
{
return this->axisStyle.autoLabelDigits;
}
/*! \copydoc parent
\see parent */
inline const JKQTBasePlotter* getParent() const { return this->parent; }
/*! \brief returns the property parent ( \copybrief parent ). \details Description of the parameter parent is: <BLOCKQUOTE>\copydoc parent </BLOCKQUOTE>. \see parent for more information */
inline JKQTBasePlotter* getParent() { return this->parent; }
/*! \brief sets the property doUpdateScaling ( \copybrief doUpdateScaling ) to the specified \a __value.
\details Description of the parameter doUpdateScaling is: <BLOCKQUOTE>\copydoc doUpdateScaling </BLOCKQUOTE>
\see doUpdateScaling for more information */
inline void setDoUpdateScaling(bool __value)
{
this->doUpdateScaling = __value;
}
/*! \brief returns the property doUpdateScaling ( \copybrief doUpdateScaling ).
\details Description of the parameter doUpdateScaling is: <BLOCKQUOTE>\copydoc doUpdateScaling </BLOCKQUOTE>
\see doUpdateScaling for more information */
inline bool getDoUpdateScaling() const
{
return this->doUpdateScaling;
}
/** \brief returns the current min */
inline double getMin() const {return axismin; }
/** \brief returns the current max */
inline double getMax() const {return axismax; }
/** \brief returns the current absolute min */
inline double getAbsoluteMin() const {return axisabsoultemin; }
/** \brief returns the current absolute max */
inline double getAbsoluteMax() const {return axisabsoultemax; }
/** \brief calculate the scaling and offset values from axis min/max values
*
* This is only executed when \c paramChanged==true, as otherwise the data has to be still
* correct. recalculating may be forced by caling calcPlotScaing(true);
*/
void calcPlotScaling(bool force=false);
/** \brief returns whether this axis uses logarithmic scaling */
bool isLogAxis() const;
/** \brief current style properties for this JKQTBasePlotter
*
* \see JKQTPSetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), setCurrentAxisStyle(), getCurrentAxisStyle(), \ref jkqtpplotter_styling
*/
const JKQTPCoordinateAxisStyle &getCurrentAxisStyle() const;
/** \brief replace the current style properties for this JKQTBasePlotter
*
* \see JKQTPSetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), setCurrentAxisStyle(), getCurrentAxisStyle(), \ref jkqtpplotter_styling
*/
void setCurrentAxisStyle(const JKQTPCoordinateAxisStyle& style);
/** \brief replace the current style properties for this JKQTBasePlotter with properties loaded from \a settings
*
* \param settings the QSettings object to read from
* \param group group in \a settings to read from
*
* \see JKQTPCoordinateAxisStyle getCurrentAxisStyle(), \ref jkqtpplotter_styling
*/
void loadCurrentAxisStyle(const QSettings& settings, const QString& group="plot/axes/");
/** \brief store the current style properties for this JKQTBasePlotter with properties loaded from \a settings
*
* \param settings the QSettings object to write to
* \param group group in \a settings to write to
*
* \see JKQTPSetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), setCurrentAxisStyle(), getCurrentAxisStyle(), \ref jkqtpplotter_styling
*/
void saveCurrentAxisStyle(QSettings& settings, const QString& group="plot/axes/") const;
public slots:
/** \brief set range of plot axis */
void setRange(double amin, double amax);
/** \brief set absolute range of plot axis */
void setAbsoluteRange(double aamin, double aamax);
/** \brief do not use an absolute range of plot axis */
void setNoAbsoluteRange();
/*! \copydoc tickSpacing
\see tickSpacing */
void setTickSpacing(double __value);
/*! \copydoc axisMinWidth
\see axisMinWidth */
void setAxisMinWidth(double __value);
/*! \copydoc autoAxisSpacing
\see autoAxisSpacing */
void setAutoAxisSpacing(bool __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickLabelsEnabled
\see JKQTPCoordinateAxisStyle::minorTickLabelsEnabled */
void setMinorTickLabelsEnabled(bool __value);
/*! \copydoc logAxis
\see logAxis */
void setLogAxis(bool __value) ;
/*! \copydoc logAxisBase
\see logAxisBase */
void setLogAxisBase (double __value);
/*! \copydoc userTickSpacing
\see userTickSpacing */
void setUserTickSpacing (double __value);
/*! \copydoc userLogTickSpacing
\see userLogTickSpacing */
void setUserLogTickSpacing (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::labelType
\see JKQTPCoordinateAxisStyle::labelType */
void setLabelType (JKQTPCALabelType __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickMode
\see JKQTPCoordinateAxisStyle::tickMode */
void setTickMode (JKQTPLabelTickMode __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickMode
\see JKQTPCoordinateAxisStyle::tickMode */
void setTickMode (int __value);
/*! \copydoc axisLabel
\see axisLabel */
void setAxisLabel (const QString& __value);
/*! \copydoc JKQTPCoordinateAxisStyle::labelPosition
\see JKQTPCoordinateAxisStyle::labelPosition */
void setLabelPosition (JKQTPLabelPosition __value);
/*! \copydoc JKQTPCoordinateAxisStyle::labelFontSize
\see JKQTPCoordinateAxisStyle::labelFontSize */
void setLabelFontSize (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickTimeFormat
\see JKQTPCoordinateAxisStyle::tickTimeFormat */
void setTickTimeFormat (const QString& __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickDateFormat
\see JKQTPCoordinateAxisStyle::tickDateFormat */
void setTickDateFormat (const QString& __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickDateTimeFormat
\see JKQTPCoordinateAxisStyle::tickDateTimeFormat */
void setTickDateTimeFormat (const QString& __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickLabelFontSize
\see JKQTPCoordinateAxisStyle::tickLabelFontSize */
void setTickLabelFontSize (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickLabelFontSize
\see JKQTPCoordinateAxisStyle::minorTickLabelFontSize */
void setMinorTickLabelFontSize (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickLabelFullNumber
\see JKQTPCoordinateAxisStyle::minorTickLabelFullNumber */
void setMinorTickLabelFullNumber (bool __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minTicks
\see JKQTPCoordinateAxisStyle::minTicks */
void setMinTicks(unsigned int __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorTicks
\see JKQTPCoordinateAxisStyle::minorTicks */
void setMinorTicks (unsigned int __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorTicks
\see JKQTPCoordinateAxisStyle::minorTicks */
void setMinorTicks (int __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickOutsideLength
\see JKQTPCoordinateAxisStyle::tickOutsideLength */
void setTickOutsideLength(double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickOutsideLength
\see JKQTPCoordinateAxisStyle::minorTickOutsideLength */
void setMinorTickOutsideLength (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickInsideLength
\see JKQTPCoordinateAxisStyle::tickInsideLength */
void setTickInsideLength(double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickInsideLength
\see JKQTPCoordinateAxisStyle::minorTickInsideLength */
void setMinorTickInsideLength (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::axisColor
\see JKQTPCoordinateAxisStyle::axisColor */
void setAxisColor (const QColor& __value);
/*! \copydoc JKQTPCoordinateAxisStyle::showZeroAxis
\see JKQTPCoordinateAxisStyle::showZeroAxis */
void setShowZeroAxis(bool __value);
/*! \copydoc inverted
\see inverted */
void setInverted(bool __value);
/*! \copydoc JKQTPCoordinateAxisStyle::gridColor
\see JKQTPCoordinateAxisStyle::gridColor */
void setGridColor(const QColor& __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorGridColor
\see JKQTPCoordinateAxisStyle::minorGridColor */
void setMinorGridColor(const QColor& __value);
/*! \copydoc JKQTPCoordinateAxisStyle::gridWidth
\see JKQTPCoordinateAxisStyle::gridWidth */
void setGridWidth (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::gridStyle
\see JKQTPCoordinateAxisStyle::gridStyle */
void setGridStyle(Qt::PenStyle __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorGridWidth
\see JKQTPCoordinateAxisStyle::minorGridWidth */
void setMinorGridWidth(double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorGridStyle
\see JKQTPCoordinateAxisStyle::minorGridStyle */
void setMinorGridStyle (Qt::PenStyle __value);
/*! \copydoc JKQTPCoordinateAxisStyle::drawMode1
\see JKQTPCoordinateAxisStyle::drawMode1 */
void setDrawMode1 (JKQTPCADrawMode __value);
/*! \copydoc JKQTPCoordinateAxisStyle::drawMode2
\see JKQTPCoordinateAxisStyle::drawMode2 */
void setDrawMode2(JKQTPCADrawMode __value);
/*! \copydoc JKQTPCoordinateAxisStyle::minorTickWidth
\see JKQTPCoordinateAxisStyle::minorTickWidth */
void setMinorTickWidth(double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickWidth
\see JKQTPCoordinateAxisStyle::tickWidth */
void setTickWidth (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::lineWidth
\see JKQTPCoordinateAxisStyle::lineWidth */
void setLineWidth (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::lineWidthZeroAxis
\see JKQTPCoordinateAxisStyle::lineWidthZeroAxis */
void setLineWidthZeroAxis (double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickLabelDistance
\see JKQTPCoordinateAxisStyle::tickLabelDistance */
void setTickLabelDistance(double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::labelDistance
\see JKQTPCoordinateAxisStyle::labelDistance */
void setLabelDistance(double __value);
/*! \copydoc JKQTPCoordinateAxisStyle::labelDigits
\see JKQTPCoordinateAxisStyle::labelDigits */
void setLabelDigits(int __value);
/*! \copydoc JKQTPCoordinateAxisStyle::drawGrid
\see JKQTPCoordinateAxisStyle::drawGrid */
void setDrawGrid(bool __value);
/*! \copydoc JKQTPCoordinateAxisStyle::drawMinorGrid
\see JKQTPCoordinateAxisStyle::drawMinorGrid */
void setDrawMinorGrid(bool __value);
/*! \copydoc JKQTPCoordinateAxisStyle::tickLabelAngle
\see JKQTPCoordinateAxisStyle::tickLabelAngle */
void setTickLabelAngle(double __value);
protected:
/** \brief indicates whether one of the parameters has changed sinse the last recalculation of tickSpacing ... */
bool paramsChanged;
bool doUpdateScaling;
/** \brief simply calls the redrawPlot method of the parent plotter class */
void redrawPlot();
/** \brief a list of tick labels.
*
* If this list contains items, this class will NOT plot a standard x-axis,
* but only mark the positions in this list. Every item is a x-position together with
* the label to be plotted there. The label may contain LaTeX markup.
*/
QVector<QPair<double, QString> > tickLabels;
/** \brief width of the plot in the direction of the axis */
virtual double getParentPlotWidth() const=0;
/** \brief offset of the plot in the direction of the axis */
virtual double getParentPlotOffset() const=0;
/** \brief width of other (perpendicular) axis (needed for grids) */
virtual double getParentOtheraxisWidth() const=0;
/** \brief is other (perpendicular) axis inverted (needed for grids) */
virtual bool getParentOtheraxisInverted() const=0;
/** \brief pixel offset of (perpendicular) other axis (needed for grids) */
virtual double getParentOtheraxisOffset() const=0;
/** \brief retun parents JKQTMathText* object */
virtual JKQTMathText* getParentMathText();
/** \brief convert a float to a tick label string */
QString floattolabel(double data);
/** \brief convert a float to a tick label string with a given precision */
QString floattolabel(double data, int past_comma);
/** \brief parent plotter class */
JKQTBasePlotter* parent;
/** \brief current view: minimum of time axis */
double axismin;
/** \brief current view: maximum of time axis */
double axismax;
/** \brief absoulte minimum of axis (axismin/axismax xan not be set below this) */
double axisabsoultemin;
/** \brief absoulte maximum of axis (axismin/axismax xan not be set above this) */
double axisabsoultemax;
/** \brief current style properties for this coordinate axis instance
*
* \see JKQTBasePlotterStyle, JKQTPSetSystemDefaultBaseStyle(), JKQTPSetSystemDefaultBaseStyle(), setCurrentAxisStyle(), getCurrentAxisStyle(), \ref jkqtpplotter_styling
*/
JKQTPCoordinateAxisStyle axisStyle;
/** \brief absolute minimum range width, feature switched off when <0 */
double axisMinWidth;
/** \brief <b>calculated property:</b> width of plot on time axis (calculated by calcPlotScaling() )
*
* \see calcPlotScaling(), calcTickSpacing()
*/
double width;
/** \brief <b>calculated property:</b> time axis scaling factor (calculated by calcPlotScaling() )
*
* \see calcPlotScaling(), calcTickSpacing()
*/
double scale;
/** \brief <b>calculated property:</b> time axis offset (calculated by calcPlotScaling() )
*
* \see calcPlotScaling(), calcTickSpacing()
*/
double offset;
/** \brief indicates whether the axis is to be inverted or not */
bool inverted;
/** \brief <b>calculated property:</b> x position of the first tick (calculated by calcPlotScaling() ). Given in system coordinates, not pixel coordinates.
*
* \see calcPlotScaling(), calcTickSpacing()
*/
double tickStart;
/** \brief <b>calculated property:</b> indicates whether the object should use automatic tick spacing for the x axis (calculated by calcPlotScaling() )
*
* \see calcPlotScaling(), calcTickSpacing()
*/
bool autoAxisSpacing;
/** \brief indicates whether the y axis has a logarithmic scale */
bool logAxis;
/** \brief the base for a logarithmic x axis */
double logAxisBase;
/** \brief if autoXAxisSpacing is \c false then this value is used for xTickSpacing. So this is the property which
* is editable by use of public access methods.
*/
double userTickSpacing;
/** \brief if autoXAxisSpacing is \c false then this value is used for xTickSpacing. So this is the property which
* is editable by use of public access methods.
*/
double userLogTickSpacing;
/** \brief <b>calculated property:</b> axis tick spacing (calculated by calcPlotScaling() and calcTickSpacing() ) for logarithmic/linear axes.
*
* \see calcPlotScaling(), calcTickSpacing()
*/
double tickSpacing;
/** \brief <b>calculated property:</b> axis tick spacing for logarithmic JKQTPCoordinateAxisStyle::ticks (calculated by calcPlotScaling() and calcTickSpacing() ) axes.
*
* \see calcPlotScaling()
*/
double tickSpacingLog;
/** \brief axis label of the axis */
QString axisLabel;
/** \brief calculates the tick spacing for a linear axis that spans \a awidth and that should
* show at least \a JKQTPCoordinateAxisStyle::minTicks JKQTPCoordinateAxisStyle::ticks.
*
* The <b>algorithm</b> used in here works as follows:
*
* There is only a limited subset of allowed tick distances. These distances are 1 (resulting in 10 JKQTPCoordinateAxisStyle::ticks per decade, i.e. 0,1,2,3,4,...),
* 2 (5 JKQTPCoordinateAxisStyle::ticks/decade, i.e. 0,2,4,...), 2.5 (4 JKQTPCoordinateAxisStyle::ticks/decade, i.e. 0,2.5,5,...) and 5 (2 JKQTPCoordinateAxisStyle::ticks/decade, i.e. 0,5,10,15,...). So the
* axis is divided into decades that each is divided into JKQTPCoordinateAxisStyle::ticks, as defined above. With these preconditions the algorithm tries
* to find a tick increment \f$ \Delta\mbox{tick} \f$ which is one of the above distances multiplied by a power \f$ \rho \f$ of 10.
* This increment is determined in a way, that the axis contains at least \a JKQTPCoordinateAxisStyle::minTicks JKQTPCoordinateAxisStyle::ticks:
* \f[ \Delta\mbox{tick}=f\cdot 10^\rho,\ \ \ \ \ f\in\{1, 2, 2.5, 5\} \f]
*
* -# The algorithm starts by finding a start exponent \f$ \rho_s=\left\lfloor\log_{10}(\mbox{awidth})\right\rfloor+3 \f$. This
* is a good (over)estimate for the biggest possible power \f$ \rho \f$.
* -# now we set \f$ \rho=\rho_0 \f$ and \f$ f=10 \f$.
* -# now the algorithm cycles through all possible factors \f$ f\in\{1, 2, 2.5, 5, 10\} \f$ (starting from 10) and calculates
* \f$ \Delta\mbox{tick}=f\cdot 10^\rho \f$. Then it checks whether \f$ \mbox{tickcount}=\mbox{round}\left(\frac{\mbox{awidth}}{\Delta\mbox{tick}}\right) \f$
* is smaller than \a JKQTPCoordinateAxisStyle::minTicks (if yes the algorithm reached its end and \f$ \Delta\mbox{tick} \f$ can be used.
* -# if \f$ f=1 \f$ is reached and checked \c false, then the algorithm decreases the exponent \f$ \rho \leftarrow \rho-1 \f$ and returns to step 3.
*
*/
double calcLinearTickSpacing();
/** \brief same as calcLinearTickSpacing(), but for logarithmic scaling
*
* \see calcLinearTickSpacing()
* */
double calcLogTickSpacing();
/** \brief Calculate the number of digits needed for the labels of an axis that starts at
* \a minval and where the tick spacing is \a tickSpacing.
*
* This method determines how many digits to output for the labels on a coordinate axis.
* This is done by testing different digit numbers and comparing subsequent labels. If two labels
* are equal, then we need more valid digits to distinguish them.
*/
int calcLinearUnitDigits();
/** \brief axis prefix for storage of parameters */
QString axisPrefix;
/** \brief this is used by x2p() and p2x() to determine the sign */
double scaleSign;
/** \brief calculates the next label from the given parameters.
*
* \return \c true on success and \c false if there is no more label
* \param x \b before \b call: the position of the label for which the text should be returned (or JKQTPCoordinateAxisStyle::tickStart for first call),
* \b after \b call: position of the next label (given in world coordinates!)
* \param label \b after \b call: text of the (input) tick label This is an empty string, if the label is not visible!
* \param init call this function with \c init=true to obtain the first label (at JKQTPCoordinateAxisStyle::tickStart)
*/
bool getNextLabel(double& x, QString& label, bool init=false);
/** \brief returns the distance from the current tick position (x before call) to the next tick position */
double getNextLabelDistance(double x);
/** \brief calculates the maximum width and height (returned as QSize) of all tick labels.
* Ascent and descent may also be returned in the two additional pointer arguments- */
QSizeF getMaxTickLabelSize(JKQTPEnhancedPainter& painter, double* ascent=nullptr, double* descent=nullptr);
};
/*! \brief implements a vertical axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
\ingroup jkqtpbaseplotter_elements
*/
class JKQTP_LIB_EXPORT JKQTPVerticalAxis: public JKQTPCoordinateAxis {
Q_OBJECT
protected:
public:
/** \brief class constructor */
JKQTPVerticalAxis(JKQTBasePlotter* parent);
/** \brief returns the size of the left/bottom axis in pt */
virtual QSizeF getSize1(JKQTPEnhancedPainter& painter) override;
/** \brief returns the size of the right/top axis in pt */
virtual QSizeF getSize2(JKQTPEnhancedPainter& painter) override;
/** \brief draw axes */
virtual void drawAxes(JKQTPEnhancedPainter& painter) override;
/** \brief draw grids */
virtual void drawGrids(JKQTPEnhancedPainter& painter) override;
protected:
/** \brief width of the plot in the direction of the axis */
virtual double getParentPlotWidth() const override;
/** \brief offset of the plot in the direction of the axis */
virtual double getParentPlotOffset() const override;
/** \brief pixel of other (perpendicular) axis (needed for grids) */
virtual double getParentOtheraxisWidth() const override;
virtual bool getParentOtheraxisInverted() const override;
/** \brief pixel offset of (perpendicular) other axis (needed for grids) */
virtual double getParentOtheraxisOffset() const override;
virtual void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize) ;
virtual void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize) ;
};
/*! \brief implements a position-indipendent vertical axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
\ingroup jkqtpbaseplotter_elements
This axis may be draw at a user-supplied position (used e.g. for color bar axes)
*/
class JKQTP_LIB_EXPORT JKQTPVerticalIndependentAxis: public JKQTPVerticalAxis {
Q_OBJECT
protected:
public:
/** \brief class constructor */
JKQTPVerticalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter* parent);
/** \brief set the axis offset */
virtual void setAxisOffset(double __value) ;
/** \brief set the axis width */
virtual void setAxisWidth(double __value) ;
/** \brief set the other axis offset */
virtual void setOtherAxisOffset(double __value) ;
/** \brief set the other axis width */
virtual void setOtherAxisWidth(double __value) ;
/** \brief set the other axis width */
virtual void setOtherAxisInverted(bool __value) ;
protected:
/** \brief width of the plot in the direction of the axis */
virtual double getParentPlotWidth() const override;
/** \brief offset of the plot in the direction of the axis */
virtual double getParentPlotOffset() const override;
/** \brief pixel of other (perpendicular) axis (needed for grids) */
virtual double getParentOtheraxisWidth() const override;
virtual bool getParentOtheraxisInverted() const override;
/** \brief pixel offset of (perpendicular) other axis (needed for grids) */
virtual double getParentOtheraxisOffset() const override;
double axisOffset;
double axisWidth;
double otherAxisWidth;
double otherAxisOffset;
bool otherAxisInverted;
};
/*! \brief implements a horizontal axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
\ingroup jkqtpbaseplotter_elements
*/
class JKQTP_LIB_EXPORT JKQTPHorizontalAxis: public JKQTPCoordinateAxis {
Q_OBJECT
protected:
public:
/** \brief class constructor */
JKQTPHorizontalAxis(JKQTBasePlotter* parent);
/** \brief returns the size of the left/bottom axis in pt */
virtual QSizeF getSize1(JKQTPEnhancedPainter& painter) override;
/** \brief returns the size of the right/top axis in pt */
virtual QSizeF getSize2(JKQTPEnhancedPainter& painter) override;
/** \brief draw axes */
virtual void drawAxes(JKQTPEnhancedPainter& painter) override;
/** \brief draw grids */
virtual void drawGrids(JKQTPEnhancedPainter& painter) override;
protected:
/** \brief width of the plot in the direction of the axis */
virtual double getParentPlotWidth() const override;
/** \brief offset of the plot in the direction of the axis */
virtual double getParentPlotOffset() const override;
/** \brief pixel of other (perpendicular) axis (needed for grids) */
virtual double getParentOtheraxisWidth() const override;
virtual bool getParentOtheraxisInverted() const override;
/** \brief pixel offset of (perpendicular) other axis (needed for grids) */
virtual double getParentOtheraxisOffset() const override;
virtual void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize, double ascentMax, double descentMax) ;
virtual void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize, double ascentMax, double descentMax) ;
};
/*! \brief implements a position-indipendent horizontal axis, based on JKQTPCoordinateAxis (for most of documentation: see JKQTPCoordinateAxis).
\ingroup jkqtpbaseplotter_elements
This axis may be draw at a user-supplied position (used e.g. for color bar axes)
*/
class JKQTP_LIB_EXPORT JKQTPHorizontalIndependentAxis: public JKQTPHorizontalAxis {
Q_OBJECT
protected:
public:
/** \brief class constructor */
JKQTPHorizontalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter* parent);
/** \brief se the axis offset */
virtual void setAxisOffset(double __value);
/** \brief se the axis width */
virtual void setAxisWidth(double __value);
/** \brief set the other axis offset */
virtual void setOtherAxisOffset(double __value);
/** \brief set the other axis width */
virtual void setOtherAxisWidth(double __value);
virtual void setOtherAxisInverted(bool __value);
protected:
/** \brief width of the plot in the direction of the axis */
virtual double getParentPlotWidth() const override;
/** \brief offset of the plot in the direction of the axis */
virtual double getParentPlotOffset() const override;
/** \brief pixel of other (perpendicular) axis (needed for grids) */
virtual double getParentOtheraxisWidth() const override;
virtual bool getParentOtheraxisInverted() const override;
/** \brief pixel offset of (perpendicular) other axis (needed for grids) */
virtual double getParentOtheraxisOffset() const override;
double axisOffset;
double axisWidth;
double otherAxisWidth;
double otherAxisOffset;
bool otherAxisInverted;
};
#endif // JKQTPCOORDINATEAXES_H

View File

@ -0,0 +1,142 @@
#include "jkqtpcoordinateaxesstyle.h"
#include "jkqtpbaseplotterstyle.h"
#include <QApplication>
JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle():
labelDigits(3),
autoLabelDigits(true),
minorTickLabelsEnabled(false),
labelType(JKQTPCALTexponent),
tickMode(JKQTPLTMLinOrPower),
labelPosition(JKQTPLabelCenter),
labelFontSize(10),
tickLabelFontSize(10),
minorTickLabelFontSize(8),
showZeroAxis(true),
minorTickLabelFullNumber(true),
drawMode1(JKQTPCADMcomplete),
drawMode2(JKQTPCADMLineTicks),
minorTickWidth(1),
tickWidth(1.5),
lineWidth(1.5),
lineWidthZeroAxis(1.5),
tickTimeFormat(QLocale().timeFormat(QLocale::NarrowFormat)),
tickDateFormat(QLocale().dateFormat(QLocale::NarrowFormat)),
tickDateTimeFormat(QLocale().dateTimeFormat(QLocale::NarrowFormat)),
minTicks(5),
minorTicks(1),
tickOutsideLength(3),
minorTickOutsideLength(1.5),
tickInsideLength(3),
minorTickInsideLength(1.5),
axisColor(QColor("black")),
tickLabelDistance(3),
labelDistance(5),
tickLabelAngle(0),
drawGrid(true),
gridColor(QColor("gray")),
gridWidth(0.75),
gridStyle(Qt::DashLine),
drawMinorGrid(false),
minorGridColor(QColor("gray")),
minorGridWidth(0.5),
minorGridStyle(Qt::DotLine),
colorZeroAxis(QColor("black")),
styleZeroAxis(Qt::SolidLine),
axisLineOffset(0)
{
}
JKQTPCoordinateAxisStyle::JKQTPCoordinateAxisStyle(const JKQTBasePlotterStyle &baseStyle):
JKQTPCoordinateAxisStyle()
{
labelFontSize=baseStyle.defaultFontSize;
tickLabelFontSize=baseStyle.defaultFontSize;
minorTickLabelFontSize=baseStyle.defaultFontSize*0.8;
}
void JKQTPCoordinateAxisStyle::loadSettings(const QSettings &settings, const QString &group, const JKQTPCoordinateAxisStyle &defaultStyle)
{
showZeroAxis = settings.value(group+"zero_line/enabled", defaultStyle.showZeroAxis).toBool();
minorTickLabelsEnabled = settings.value(group+"minor_tick/labels_enabled", defaultStyle.minorTickLabelsEnabled).toBool();
minorTickWidth = settings.value(group+"minor_tick/width", defaultStyle.minorTickWidth).toDouble();
tickWidth = settings.value(group+"ticks/width", defaultStyle.tickWidth).toDouble();
lineWidth = settings.value(group+"line_width", defaultStyle.lineWidth).toDouble();
lineWidthZeroAxis = settings.value(group+"zero_line/line_width", defaultStyle.lineWidthZeroAxis).toDouble();
labelFontSize = settings.value(group+"axis_label/font_size", defaultStyle.labelFontSize).toDouble();
tickLabelFontSize = settings.value(group+"ticks/label_font_size", defaultStyle.tickLabelFontSize).toDouble();
minorTickLabelFontSize = settings.value(group+"minor_tick/label_font_size", defaultStyle.minorTickLabelFontSize).toDouble();
minorTickLabelFullNumber = settings.value(group+"minor_tick/label_full_number", defaultStyle.minorTickLabelFullNumber).toBool();
tickTimeFormat = settings.value(group+"ticks/time_format", defaultStyle.tickTimeFormat).toString();
tickDateFormat = settings.value(group+"ticks/date_format", defaultStyle.tickDateFormat).toString();
tickDateTimeFormat = settings.value(group+"ticks/datetime_format", defaultStyle.tickDateTimeFormat).toString();
minTicks = settings.value(group+"min_ticks", defaultStyle.minTicks).toUInt();
minorTicks = settings.value(group+"minor_tick/count", defaultStyle.minorTicks).toUInt();
tickOutsideLength = settings.value(group+"ticks/outside_length", defaultStyle.tickOutsideLength).toDouble();
minorTickOutsideLength = settings.value(group+"minor_tick/outside_length", defaultStyle.minorTickOutsideLength).toDouble();
tickInsideLength = settings.value(group+"ticks/inside_length", defaultStyle.tickInsideLength).toDouble();
minorTickInsideLength = settings.value(group+"minor_tick/inside_length", defaultStyle.minorTickInsideLength).toDouble();
tickLabelDistance = settings.value(group+"ticks/label_distance", defaultStyle.tickLabelDistance).toDouble();
labelDistance = settings.value(group+"axis_label/distance", defaultStyle.labelDistance).toDouble();
gridWidth = settings.value(group+"grid/width", defaultStyle.gridWidth).toDouble();
minorGridWidth = settings.value(group+"minor_grid/width", defaultStyle.minorGridWidth).toDouble();
drawGrid = settings.value(group+"grid/enabled", defaultStyle.drawGrid).toBool();
drawMinorGrid = settings.value(group+"minor_grid/enabled", defaultStyle.drawMinorGrid).toBool();
labelPosition=String2JKQTPLabelPosition(settings.value(group+"axis_label/position", JKQTPLabelPosition2String(labelPosition)).toString());
labelType=String2JKQTPCALabelType(settings.value(group+"axis_label/type", JKQTPCALabelType2String(labelType)).toString());
axisColor=jkqtp_String2QColor(settings.value(group+"color", jkqtp_QColor2String(axisColor)).toString());
gridColor=jkqtp_String2QColor(settings.value(group+"grid/color", jkqtp_QColor2String(gridColor)).toString());
minorGridColor=jkqtp_String2QColor(settings.value(group+"minor_grid/color", jkqtp_QColor2String(minorGridColor)).toString());
gridStyle=jkqtp_String2QPenStyle(settings.value(group+"grid/style", jkqtp_QPenStyle2String(gridStyle)).toString());
minorGridStyle=jkqtp_String2QPenStyle(settings.value(group+"minor_grid/style", jkqtp_QPenStyle2String(minorGridStyle)).toString());
drawMode1=String2JKQTPCADrawMode(settings.value(group+"draw_mode1", JKQTPCADrawMode2String(drawMode1)).toString());
drawMode2=String2JKQTPCADrawMode(settings.value(group+"draw_mode2", JKQTPCADrawMode2String(drawMode2)).toString());
tickMode=String2JKQTPLabelTickMode(settings.value(group+"ticks/mode", JKQTPLabelTickMode2String(tickMode)).toString());
colorZeroAxis=jkqtp_String2QColor(settings.value(group+"zero_line/color", jkqtp_QColor2String(colorZeroAxis)).toString());
styleZeroAxis=jkqtp_String2QPenStyle(settings.value(group+"zero_line/style", jkqtp_QPenStyle2String(styleZeroAxis)).toString());
axisLineOffset = settings.value(group+"axis_lines_offset", defaultStyle.axisLineOffset).toDouble();
}
void JKQTPCoordinateAxisStyle::saveSettings(QSettings &settings, const QString &group) const
{
settings.setValue(group+"color", jkqtp_QColor2String(axisColor));
settings.setValue(group+"draw_mode1", JKQTPCADrawMode2String(drawMode1));
settings.setValue(group+"draw_mode2", JKQTPCADrawMode2String(drawMode2));
settings.setValue(group+"line_width", lineWidth);
settings.setValue(group+"axis_lines_offset", axisLineOffset);
settings.setValue(group+"min_ticks", minTicks);
settings.setValue(group+"grid/enabled", drawGrid);
settings.setValue(group+"grid/color", jkqtp_QColor2String(gridColor));
settings.setValue(group+"grid/width", gridWidth);
settings.setValue(group+"grid/style", jkqtp_QPenStyle2String(gridStyle));
settings.setValue(group+"axis_label/distance", labelDistance);
settings.setValue(group+"axis_label/font_size", labelFontSize);
settings.setValue(group+"axis_label/position", JKQTPLabelPosition2String(labelPosition));
settings.setValue(group+"axis_label/type", JKQTPCALabelType2String(labelType));
settings.setValue(group+"minor_grid/enabled", drawMinorGrid);
settings.setValue(group+"minor_grid/color", jkqtp_QColor2String(minorGridColor));
settings.setValue(group+"minor_grid/style", jkqtp_QPenStyle2String(minorGridStyle));
settings.setValue(group+"minor_grid/width", minorGridWidth);
settings.setValue(group+"minor_tick/labels_enabled", minorTickLabelsEnabled);
settings.setValue(group+"minor_tick/inside_length", minorTickInsideLength);
settings.setValue(group+"minor_tick/label_font_size", minorTickLabelFontSize);
settings.setValue(group+"minor_tick/label_full_number", minorTickLabelFullNumber);
settings.setValue(group+"minor_tick/outside_length", minorTickOutsideLength);
settings.setValue(group+"minor_tick/width", minorTickWidth);
settings.setValue(group+"minor_tick/count", minorTicks);
settings.setValue(group+"ticks/date_format", tickDateFormat);
settings.setValue(group+"ticks/datetime_format", tickDateTimeFormat);
settings.setValue(group+"ticks/inside_length", tickInsideLength);
settings.setValue(group+"ticks/label_distance", tickLabelDistance);
settings.setValue(group+"ticks/label_font_size", tickLabelFontSize);
settings.setValue(group+"ticks/mode", JKQTPLabelTickMode2String(tickMode));
settings.setValue(group+"ticks/outside_length", tickOutsideLength);
settings.setValue(group+"ticks/time_format", tickTimeFormat);
settings.setValue(group+"ticks/width", tickWidth);
settings.setValue(group+"zero_line/enabled", showZeroAxis);
settings.setValue(group+"zero_line/line_width", lineWidthZeroAxis);
settings.setValue(group+"zero_line/color", jkqtp_QColor2String(colorZeroAxis));
settings.setValue(group+"zero_line/style", jkqtp_QPenStyle2String(styleZeroAxis));
}

View File

@ -0,0 +1,158 @@
/*
Copyright (c) 2008-2019 Jan W. Krieger (<jan@jkrieger.de>, <j.krieger@dkfz.de>)
This software 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 program 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 program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef JKQTPCOORDINATEAXESSTYLE_H
#define JKQTPCOORDINATEAXESSTYLE_H
#include <QSettings>
#include <QString>
#include <QColor>
#include "jkqtplottertools/jkqtptools.h"
#include "jkqtplottertools/jkqtp_imexport.h"
class JKQTBasePlotterStyle; // forward
/** \brief Support Class for JKQTPCoordinateAxis, which summarizes all proeprties that define the visual styling of a JKQTPCoordinateAxis
* \ingroup jkqtpplotter_styling
*
* \see JKQTPCoordinateAxis, \ref jkqtpplotter_styling
*
*/
class JKQTP_LIB_EXPORT JKQTPCoordinateAxisStyle {
Q_GADGET
public:
JKQTPCoordinateAxisStyle();
JKQTPCoordinateAxisStyle(const JKQTBasePlotterStyle& baseStyle);
/** \brief loads the plot properties from a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object
*
* \param settings QSettings-object to read from
* \param group Group in the QSettings-object to read from
* \param defaultStyle If a setting cannot be found in \a settings, default values are taken from this object
* By default, this is a default-constructed object
*/
void loadSettings(const QSettings &settings, const QString& group=QString("axis/"), const JKQTPCoordinateAxisStyle &defaultStyle=JKQTPCoordinateAxisStyle());
/** \brief saves the plot properties into a <a href="http://doc.qt.io/qt-5/qsettings.html")">QSettings</a> object.
*
* \param settings QSettings-object to save to
* \param group Group in the QSettings-object to save to
*/
void saveSettings(QSettings& settings, const QString& group=QString("axis/")) const;
/** \brief digits used for tick labels */
int labelDigits;
/** \brief when \c true, the digits of the labels are calculated automatically */
bool autoLabelDigits;
/** \brief if \c true, the plotter displays minor axis labels as number between 1 and 10 in some cases */
bool minorTickLabelsEnabled;
/** \brief indicates how to draw the labels */
JKQTPCALabelType labelType;
/** \brief mode of the major ticks */
JKQTPLabelTickMode tickMode;
/** \brief position of the axis label */
JKQTPLabelPosition labelPosition;
/** \brief fontsize of the axis labels */
double labelFontSize;
/** \brief fontsize of the axis tick labels */
double tickLabelFontSize;
/** \brief fontsize of the minor axis tick labels */
double minorTickLabelFontSize;
/** \brief indicates whether to draw a thick axis line at x=0 (zero axis) */
bool showZeroAxis;
/** \brief indicates whether the minor tick labels should be full numbers, or just a number between 0..10 */
bool minorTickLabelFullNumber;
/** \brief draw mode of the main (left/bottom) axis */
JKQTPCADrawMode drawMode1;
/** \brief draw mode of the secondary (right/top) axis */
JKQTPCADrawMode drawMode2;
/** \brief line width of minor ticks in pt */
double minorTickWidth;
/** \brief line width of ticks in pt */
double tickWidth;
/** \brief line width of axis in pt */
double lineWidth;
/** \brief line width of 0-line in pt */
double lineWidthZeroAxis;
/** \brief format string for time tick labels, see see QDateTime::toString() documentation for details on format strings */
QString tickTimeFormat;
/** \brief format string for date tick labels, see see QDateTime::toString() documentation for details on format strings */
QString tickDateFormat;
/** \brief format string for datetime tick labels, see see QDateTime::toString() documentation for details on format strings */
QString tickDateTimeFormat;
/** \brief minimum number of axis ticks */
unsigned int minTicks;
/** \brief number of minor grid lines per axis tick interval
*
* \image html docu_logaxis_set_minorticks.png
**/
unsigned int minorTicks;
/** \brief length of an axis tick outside the plot border in pt */
double tickOutsideLength;
/** \brief length of a minor axis tick outside the plot border in pt */
double minorTickOutsideLength;
/** \brief length of an axis tick inside the plot border in pt */
double tickInsideLength;
/** \brief length of a minor axis tick inside the plot border in pt */
double minorTickInsideLength;
/** \brief color of the axis (labels, ticks, axis itself ...) */
QColor axisColor;
/** \brief distance between tick end and label start in pt */
double tickLabelDistance;
/** \brief distance between tick label and axis label in pt */
double labelDistance;
/** \brief rotation angle of tick labels [-180..180], i.e. given in degrees, default is 0 (horizontal) */
double tickLabelAngle;
/** \brief indicates whether to draw the major grid lines */
bool drawGrid;
/** \brief color of the grid*/
QColor gridColor;
/** \brief width of the grid lines (in pixel) */
double gridWidth;
/** \brief line stye of the grid lines */
Qt::PenStyle gridStyle;
/** \brief indicates whether to draw the minor grid lines */
bool drawMinorGrid;
/** \brief color of the minor grid lines */
QColor minorGridColor;
/** \brief width of the minor grid lines (in pixel) */
double minorGridWidth;
/** \brief line stye of the minor grid lines */
Qt::PenStyle minorGridStyle;
/** \brief color of 0-line */
QColor colorZeroAxis;
/** \brief pen style of 0-line */
Qt::PenStyle styleZeroAxis;
/** \brief if non-zero, the line of the coordinate axis is moved outside by this amount [pt] */
double axisLineOffset;
};
#endif // JKQTPCOORDINATEAXESSTYLE_H

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -22,6 +22,7 @@
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplotter/jkqtpbaseplotter.h"
#include "jkqtplottertools/jkqtptools.h"
#include "jkqtplottertools/jkqtpdrawingtools.h"
#include <stdlib.h>
#include <QDebug>
@ -35,7 +36,7 @@ JKQTPOverlayElement::JKQTPOverlayElement(JKQTBasePlotter *parent) :
fillStyle=Qt::SolidPattern;
lineWidth=1.0;
text="";
fontName=QFont().family();
fontName=QFont().family()+"+XITS";
fontSize=QFont().pointSizeF();
visible=true;
}
@ -92,7 +93,7 @@ QBrush JKQTPOverlayElement::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
QPen JKQTPOverlayElement::getPen(JKQTPEnhancedPainter& painter) const {
QPen p;
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth)));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth)));
p.setStyle(lineStyle);
return p;
}
@ -136,7 +137,7 @@ void JKQTPOverlayVerticalLine::draw(JKQTPEnhancedPainter &painter) {
QPointF p1=transform(position, ymin);
QPointF p2=transform(position, ymax);
QPointF p3=p2-QPointF(0, (p2.y()-p1.y())*0.1);
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.setPen(getPen(painter));
painter.drawLine(p1, p2);
@ -146,14 +147,12 @@ void JKQTPOverlayVerticalLine::draw(JKQTPEnhancedPainter &painter) {
JKQTMathText* mt=parent->getMathText();
mt->setFontSize(fontSize);
mt->setFontColor(color);
#ifdef USE_XITS_FONTS
mt->useXITS();
#endif
mt->setFontRomanOrSpecial(fontName);
mt->parse(text);
mt->draw(painter, p3.x(), p3.y());
}
painter.restore();
}
JKQTPOverlayTwoCoordOverlay::JKQTPOverlayTwoCoordOverlay(double pos, double pos2, JKQTBasePlotter *parent):
@ -190,7 +189,7 @@ void JKQTPOverlayVerticalRange::draw(JKQTPEnhancedPainter &painter) {
QPointF p21=transform(position2, ymin);
QPointF p22=transform(position2, ymax);
//QPointF p23=p2-QPointF(0, (p2.y()-p1.y())*0.1);
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
if (fillColor!=QColor(Qt::transparent)) {
if (inverted) {
painter.fillRect(QRectF(transform(xmin, ymin), p2), getBrush(painter));
@ -208,14 +207,12 @@ void JKQTPOverlayVerticalRange::draw(JKQTPEnhancedPainter &painter) {
JKQTMathText* mt=parent->getMathText();
mt->setFontSize(fontSize);
mt->setFontColor(color);
#ifdef USE_XITS_FONTS
mt->useXITS();
#endif
mt->setFontRomanOrSpecial(fontName);
mt->parse(text);
mt->draw(painter, p3.x(), p3.y());
}
painter.restore();
}
JKQTPOverlayTwoPositionOverlay::JKQTPOverlayTwoPositionOverlay(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent):
@ -252,7 +249,7 @@ void JKQTPOverlayLine::draw(JKQTPEnhancedPainter &painter) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.setPen(getPen(painter));
if (infinite) {
double alpha=(p2.y()-p1.y())/(p2.x()-p1.x());
@ -270,7 +267,7 @@ void JKQTPOverlayLine::draw(JKQTPEnhancedPainter &painter) {
painter.restore();
}
@ -287,10 +284,10 @@ void JKQTPOverlayRectangle::draw(JKQTPEnhancedPainter &painter)
QPointF p2=transform(x2, y2);
QRectF rect(qMin(p1.x(), p2.x()), qMin(p1.y(), p2.y()), fabs(p1.x()-p2.x()), fabs(p1.y()-p2.y()));
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
painter.setPen(getPen(painter));
painter.setBrush(getBrush(painter));
//painter.fillRect(rect);
painter.drawRect(rect);
painter.restore();
}

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -51,128 +51,110 @@ class JKQTP_LIB_EXPORT JKQTPOverlayElement : public QObject {
/** \brief sets the parent painter class */
virtual void setParent(JKQTBasePlotter* parent);
/*! \brief sets the property color ( \copybrief color ) to the specified \a __value.
\details Description of the parameter color is: <BLOCKQUOTE>\copydoc color </BLOCKQUOTE>
\see color for more information */
/*! \copydoc color
\see see color for details */
inline virtual void setColor(const QColor & __value)
{
this->color = __value;
}
/*! \brief returns the property color ( \copybrief color ).
\details Description of the parameter color is: <BLOCKQUOTE>\copydoc color </BLOCKQUOTE>
\see color for more information */
/*! \copydoc color
\see see color for details */
inline virtual QColor getColor() const
{
return this->color;
}
/*! \brief sets the property fillColor ( \copybrief fillColor ) to the specified \a __value.
\details Description of the parameter fillColor is: <BLOCKQUOTE>\copydoc fillColor </BLOCKQUOTE>
\see fillColor for more information */
/*! \copydoc fillColor
\see see fillColor for details */
inline virtual void setFillColor(const QColor & __value)
{
this->fillColor = __value;
}
/*! \brief returns the property fillColor ( \copybrief fillColor ).
\details Description of the parameter fillColor is: <BLOCKQUOTE>\copydoc fillColor </BLOCKQUOTE>
\see fillColor for more information */
/*! \copydoc fillColor
\see see fillColor for details */
inline virtual QColor getFillColor() const
{
return this->fillColor;
}
/*! \brief sets the property lineStyle ( \copybrief lineStyle ) to the specified \a __value.
\details Description of the parameter lineStyle is: <BLOCKQUOTE>\copydoc lineStyle </BLOCKQUOTE>
\see lineStyle for more information */
/*! \copydoc lineStyle
\see see lineStyle for details */
inline virtual void setLineStyle(const Qt::PenStyle & __value)
{
this->lineStyle = __value;
}
/*! \brief returns the property lineStyle ( \copybrief lineStyle ).
\details Description of the parameter lineStyle is: <BLOCKQUOTE>\copydoc lineStyle </BLOCKQUOTE>
\see lineStyle for more information */
/*! \copydoc lineStyle
\see see lineStyle for details */
inline virtual Qt::PenStyle getLineStyle() const
{
return this->lineStyle;
}
/*! \brief sets the property fillStyle ( \copybrief fillStyle ) to the specified \a __value.
\details Description of the parameter fillStyle is: <BLOCKQUOTE>\copydoc fillStyle </BLOCKQUOTE>
\see fillStyle for more information */
/*! \copydoc fillStyle
\see see fillStyle for details */
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
{
this->fillStyle = __value;
}
/*! \brief returns the property fillStyle ( \copybrief fillStyle ).
\details Description of the parameter fillStyle is: <BLOCKQUOTE>\copydoc fillStyle </BLOCKQUOTE>
\see fillStyle for more information */
/*! \copydoc fillStyle
\see see fillStyle for details */
inline virtual Qt::BrushStyle getFillStyle() const
{
return this->fillStyle;
}
/*! \brief sets the property lineWidth ( \copybrief lineWidth ) to the specified \a __value.
\details Description of the parameter lineWidth is: <BLOCKQUOTE>\copydoc lineWidth </BLOCKQUOTE>
\see lineWidth for more information */
/*! \copydoc lineWidth
\see see lineWidth for details */
inline virtual void setLineWidth(double __value)
{
this->lineWidth = __value;
}
/*! \brief returns the property lineWidth ( \copybrief lineWidth ).
\details Description of the parameter lineWidth is: <BLOCKQUOTE>\copydoc lineWidth </BLOCKQUOTE>
\see lineWidth for more information */
/*! \copydoc lineWidth
\see see lineWidth for details */
inline virtual double getLineWidth() const
{
return this->lineWidth;
}
/*! \brief sets the property text ( \copybrief text ) to the specified \a __value.
\details Description of the parameter text is: <BLOCKQUOTE>\copydoc text </BLOCKQUOTE>
\see text for more information */
/*! \copydoc text
\see see text for details */
inline virtual void setText(const QString & __value)
{
this->text = __value;
}
/*! \brief returns the property text ( \copybrief text ).
\details Description of the parameter text is: <BLOCKQUOTE>\copydoc text </BLOCKQUOTE>
\see text for more information */
/*! \copydoc text
\see see text for details */
inline virtual QString getText() const
{
return this->text;
}
/*! \brief sets the property fontName ( \copybrief fontName ) to the specified \a __value.
\details Description of the parameter fontName is: <BLOCKQUOTE>\copydoc fontName </BLOCKQUOTE>
\see fontName for more information */
/*! \copydoc fontName
\see see fontName for details */
inline virtual void setFontName(const QString & __value)
{
this->fontName = __value;
}
/*! \brief returns the property fontName ( \copybrief fontName ).
\details Description of the parameter fontName is: <BLOCKQUOTE>\copydoc fontName </BLOCKQUOTE>
\see fontName for more information */
/*! \copydoc fontName
\see see fontName for details */
inline virtual QString getFontName() const
{
return this->fontName;
}
/*! \brief sets the property fontSize ( \copybrief fontSize ) to the specified \a __value.
\details Description of the parameter fontSize is: <BLOCKQUOTE>\copydoc fontSize </BLOCKQUOTE>
\see fontSize for more information */
/*! \copydoc fontSize
\see see fontSize for details */
inline virtual void setFontSize(double __value)
{
this->fontSize = __value;
}
/*! \brief returns the property fontSize ( \copybrief fontSize ).
\details Description of the parameter fontSize is: <BLOCKQUOTE>\copydoc fontSize </BLOCKQUOTE>
\see fontSize for more information */
/*! \copydoc fontSize
\see see fontSize for details */
inline virtual double getFontSize() const
{
return this->fontSize;
}
/*! \brief sets the property visible ( \copybrief visible ) to the specified \a __value.
\details Description of the parameter visible is: <BLOCKQUOTE>\copydoc visible </BLOCKQUOTE>
\see visible for more information */
/*! \copydoc visible
\see see visible for details */
inline virtual void setVisible(bool __value)
{
this->visible = __value;
}
/*! \brief returns the property visible ( \copybrief visible ).
\details Description of the parameter visible is: <BLOCKQUOTE>\copydoc visible </BLOCKQUOTE>
\see visible for more information */
/*! \copydoc visible
\see see visible for details */
inline virtual bool isVisible() const
{
return this->visible;
@ -239,58 +221,50 @@ class JKQTP_LIB_EXPORT JKQTPOverlayTwoPositionOverlay : public JKQTPOverlayEleme
public:
explicit JKQTPOverlayTwoPositionOverlay(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = 0);
/*! \brief sets the property x1 ( \copybrief x1 ) to the specified \a __value.
\details Description of the parameter x1 is: <BLOCKQUOTE>\copydoc x1 </BLOCKQUOTE>
\see x1 for more information */
/*! \copydoc x1
\see see x1 for details */
inline virtual void setX1(double __value)
{
this->x1 = __value;
}
/*! \brief returns the property x1 ( \copybrief x1 ).
\details Description of the parameter x1 is: <BLOCKQUOTE>\copydoc x1 </BLOCKQUOTE>
\see x1 for more information */
/*! \copydoc x1
\see see x1 for details */
inline virtual double getX1() const
{
return this->x1;
}
/*! \brief sets the property x2 ( \copybrief x2 ) to the specified \a __value.
\details Description of the parameter x2 is: <BLOCKQUOTE>\copydoc x2 </BLOCKQUOTE>
\see x2 for more information */
/*! \copydoc x2
\see see x2 for details */
inline virtual void setX2(double __value)
{
this->x2 = __value;
}
/*! \brief returns the property x2 ( \copybrief x2 ).
\details Description of the parameter x2 is: <BLOCKQUOTE>\copydoc x2 </BLOCKQUOTE>
\see x2 for more information */
/*! \copydoc x2
\see see x2 for details */
inline virtual double getX2() const
{
return this->x2;
}
/*! \brief sets the property y1 ( \copybrief y1 ) to the specified \a __value.
\details Description of the parameter y1 is: <BLOCKQUOTE>\copydoc y1 </BLOCKQUOTE>
\see y1 for more information */
/*! \copydoc y1
\see see y1 for details */
inline virtual void setY1(double __value)
{
this->y1 = __value;
}
/*! \brief returns the property y1 ( \copybrief y1 ).
\details Description of the parameter y1 is: <BLOCKQUOTE>\copydoc y1 </BLOCKQUOTE>
\see y1 for more information */
/*! \copydoc y1
\see see y1 for details */
inline virtual double getY1() const
{
return this->y1;
}
/*! \brief sets the property y2 ( \copybrief y2 ) to the specified \a __value.
\details Description of the parameter y2 is: <BLOCKQUOTE>\copydoc y2 </BLOCKQUOTE>
\see y2 for more information */
/*! \copydoc y2
\see see y2 for details */
inline virtual void setY2(double __value)
{
this->y2 = __value;
}
/*! \brief returns the property y2 ( \copybrief y2 ).
\details Description of the parameter y2 is: <BLOCKQUOTE>\copydoc y2 </BLOCKQUOTE>
\see y2 for more information */
/*! \copydoc y2
\see see y2 for details */
inline virtual double getY2() const
{
return this->y2;
@ -312,16 +286,14 @@ class JKQTP_LIB_EXPORT JKQTPOverlayOneCoordOverlay : public JKQTPOverlayElement
public:
explicit JKQTPOverlayOneCoordOverlay(double pos, JKQTBasePlotter *parent = 0);
/*! \brief sets the property position ( \copybrief position ) to the specified \a __value.
\details Description of the parameter position is: <BLOCKQUOTE>\copydoc position </BLOCKQUOTE>
\see position for more information */
/*! \copydoc position
\see see position for details */
inline virtual void setPosition(double __value)
{
this->position = __value;
}
/*! \brief returns the property position ( \copybrief position ).
\details Description of the parameter position is: <BLOCKQUOTE>\copydoc position </BLOCKQUOTE>
\see position for more information */
/*! \copydoc position
\see see position for details */
inline virtual double getPosition() const
{
return this->position;
@ -340,16 +312,14 @@ class JKQTP_LIB_EXPORT JKQTPOverlayTwoCoordOverlay : public JKQTPOverlayOneCoord
public:
explicit JKQTPOverlayTwoCoordOverlay(double pos, double pos2, JKQTBasePlotter *parent = 0);
/*! \brief sets the property position2 ( \copybrief position2 ) to the specified \a __value.
\details Description of the parameter position2 is: <BLOCKQUOTE>\copydoc position2 </BLOCKQUOTE>
\see position2 for more information */
/*! \copydoc position2
\see see position2 for details */
inline virtual void setPosition2(double __value)
{
this->position2 = __value;
}
/*! \brief returns the property position2 ( \copybrief position2 ).
\details Description of the parameter position2 is: <BLOCKQUOTE>\copydoc position2 </BLOCKQUOTE>
\see position2 for more information */
/*! \copydoc position2
\see see position2 for details */
inline virtual double getPosition2() const
{
return this->position2;
@ -392,16 +362,14 @@ class JKQTP_LIB_EXPORT JKQTPOverlayVerticalRange : public JKQTPOverlayTwoCoordOv
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
/*! \brief sets the property inverted ( \copybrief inverted ) to the specified \a __value.
\details Description of the parameter inverted is: <BLOCKQUOTE>\copydoc inverted </BLOCKQUOTE>
\see inverted for more information */
/*! \copydoc inverted
\see see inverted for details */
inline virtual void setInverted(bool __value)
{
this->inverted = __value;
}
/*! \brief returns the property inverted ( \copybrief inverted ).
\details Description of the parameter inverted is: <BLOCKQUOTE>\copydoc inverted </BLOCKQUOTE>
\see inverted for more information */
/*! \copydoc inverted
\see see inverted for details */
inline virtual bool getInverted() const
{
return this->inverted;
@ -423,16 +391,14 @@ class JKQTP_LIB_EXPORT JKQTPOverlayLine : public JKQTPOverlayTwoPositionOverlay
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
/*! \brief sets the property infinite ( \copybrief infinite ) to the specified \a __value.
\details Description of the parameter infinite is: <BLOCKQUOTE>\copydoc infinite </BLOCKQUOTE>
\see infinite for more information */
/*! \copydoc infinite
\see see infinite for details */
inline virtual void setInfinite(bool __value)
{
this->infinite = __value;
}
/*! \brief returns the property infinite ( \copybrief infinite ).
\details Description of the parameter infinite is: <BLOCKQUOTE>\copydoc infinite </BLOCKQUOTE>
\see infinite for more information */
/*! \copydoc infinite
\see see infinite for details */
inline virtual bool getInfinite() const
{
return this->infinite;

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -60,9 +60,13 @@ JKQTPXYLineGraph::JKQTPXYLineGraph(JKQTPlotter* parent):
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
style=parent->getPlotStyle(parentPlotStyle).style();
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
symbolSize=parent->getPlotStyle(parentPlotStyle).symbolSize();
symbolWidth=parent->getPlotStyle(parentPlotStyle).symbolLineWidthF();
symbol=parent->getPlotStyle(parentPlotStyle).symbol();
}
fillColor=color;
}
JKQTPXYLineGraph::JKQTPXYLineGraph(JKQTBasePlotter* parent):
@ -84,9 +88,13 @@ JKQTPXYLineGraph::JKQTPXYLineGraph(JKQTBasePlotter* parent):
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
style=parent->getPlotStyle(parentPlotStyle).style();
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
symbolSize=parent->getPlotStyle(parentPlotStyle).symbolSize();
symbolWidth=parent->getPlotStyle(parentPlotStyle).symbolLineWidthF();
symbol=parent->getPlotStyle(parentPlotStyle).symbol();
}
fillColor=color;
}
void JKQTPXYLineGraph::draw(JKQTPEnhancedPainter& painter) {
@ -100,14 +108,14 @@ void JKQTPXYLineGraph::draw(JKQTPEnhancedPainter& painter) {
//qDebug()<<"JKQTPXYLineGraph::draw();";
drawErrorsBefore(painter);
{
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<1;
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<2;
QPen p=painter.pen();
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
p.setCapStyle(Qt::RoundCap);
@ -183,7 +191,7 @@ void JKQTPXYLineGraph::draw(JKQTPEnhancedPainter& painter) {
painter.drawPolyline(linesP);
}
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<6;
painter.restore();
}
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<7;
drawErrorsAfter(painter);
//qDebug()<<"JKQTPXYLineGraph::draw() ... done";
@ -199,7 +207,7 @@ void JKQTPXYLineGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect
double lineWidth=parent->pt2px(painter, this->lineWidth*parent->getLineWidthMultiplier());
if (lineWidth>0.5*maxSize) lineWidth=0.5*maxSize;
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=painter.pen();
p.setColor(getKeyLabelColor());
p.setStyle(style);
@ -208,7 +216,7 @@ void JKQTPXYLineGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect
double y=rect.top()+rect.height()/2.0;
if (drawLine) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, symbol, symbolSize, symbolWidth, getKeyLabelColor(), fillColor);
painter.restore();
}
QColor JKQTPXYLineGraph::getKeyLabelColor() {
@ -217,12 +225,17 @@ QColor JKQTPXYLineGraph::getKeyLabelColor() {
JKQTPXYLineErrorGraph::JKQTPXYLineErrorGraph(JKQTBasePlotter *parent):
JKQTPXYLineGraph(parent), JKQTPXYGraphErrors()
{ setErrorColorFromGraphColor(color); }
JKQTPXYLineGraph(parent), JKQTPXYGraphErrors(color, parent)
{
setErrorColorFromGraphColor(color);
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
}
JKQTPXYLineErrorGraph::JKQTPXYLineErrorGraph(JKQTPlotter *parent):
JKQTPXYLineGraph(parent), JKQTPXYGraphErrors()
{ setErrorColorFromGraphColor(color); }
JKQTPXYLineErrorGraph(parent->getPlotter())
{
}
bool JKQTPXYLineErrorGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) {
if (xErrorColumn<0 || xErrorStyle==JKQTPNoError) {
@ -351,8 +364,9 @@ JKQTPStepHorizontalGraph::JKQTPStepHorizontalGraph(JKQTBasePlotter* parent):
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
fillColor=color.lighter();
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
style=parent->getPlotStyle(parentPlotStyle).style();
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
}
}
@ -374,14 +388,15 @@ JKQTPStepHorizontalGraph::JKQTPStepHorizontalGraph(JKQTPlotter* parent):
parentPlotStyle=parent->getNextStyle();
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
color=parent->getPlotStyle(parentPlotStyle).color();
fillColor=color.lighter();
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
style=parent->getPlotStyle(parentPlotStyle).style();
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
}
}
void JKQTPStepHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=painter.pen();
QPen np(Qt::NoPen);
p.setColor(color);
@ -397,7 +412,7 @@ void JKQTPStepHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRec
painter.setBrush(b);
if (fillCurve) painter.drawRect(rect);
if (!fillCurve & drawLine) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
painter.restore();
}
QColor JKQTPStepHorizontalGraph::getKeyLabelColor() {
@ -417,7 +432,7 @@ void JKQTPStepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
QPen p=painter.pen();
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
p.setJoinStyle(Qt::RoundJoin);
@ -509,7 +524,7 @@ void JKQTPStepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
pf.lineTo(xold, y0);
pf.closeSubpath();
}
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
if (fillCurve) {
painter.fillPath(pf, b);
@ -520,7 +535,7 @@ void JKQTPStepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
painter.setPen(p);
painter.drawPath(pl);
}
painter.restore();
drawErrorsAfter(painter);
}
@ -558,7 +573,7 @@ void JKQTPStepVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
QPen p=painter.pen();
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
p.setCapStyle(Qt::RoundCap);
@ -642,7 +657,7 @@ void JKQTPStepVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
}
pf.lineTo(x0, yold);
pf.closeSubpath();
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
if (drawLine) {
painter.setPen(p);
painter.drawPath(pl);
@ -651,7 +666,7 @@ void JKQTPStepVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
painter.setPen(np);
painter.drawPath(pf);
painter.restore();
drawErrorsAfter(painter);
}
@ -691,8 +706,10 @@ JKQTPHorizontalRange::JKQTPHorizontalRange(JKQTBasePlotter* parent):
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
centerColor=parent->getPlotStyle(parentPlotStyle).color();
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
style=parent->getPlotStyle(parentPlotStyle).style();
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
color=centerColor.darker();
fillColor=centerColor.lighter();
}
fillColor.setAlphaF(0.5);
@ -725,10 +742,11 @@ JKQTPHorizontalRange::JKQTPHorizontalRange(JKQTPlotter* parent):
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
centerColor=parent->getPlotStyle(parentPlotStyle).color();
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
style=parent->getPlotStyle(parentPlotStyle).style();
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
color=centerColor.darker();
fillColor=centerColor.lighter();
}
fillColor.setAlphaF(0.5);
@ -754,13 +772,13 @@ void JKQTPHorizontalRange::draw(JKQTPEnhancedPainter& painter) {
if (!unlimitedSizeMax) ma=transformX(sizeMax);
//std::cout<<"hor: rangeMin="<<rangeMin<<" -> "<<cmi<<std::endl;
//std::cout<<"hor: rangeMax="<<rangeMax<<" -> "<<cma<<std::endl;
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
if (plotRange && (cmi!=cma) && JKQTPIsOKFloat(mi) && JKQTPIsOKFloat(ma)) {
QPen p=painter.pen();
QPen np(Qt::NoPen);
p.setColor(color);
p.setStyle(style);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
QBrush nb(Qt::NoBrush);
QBrush b=painter.brush();
b.setColor(fillColor);
@ -798,15 +816,15 @@ void JKQTPHorizontalRange::draw(JKQTPEnhancedPainter& painter) {
QPen p=painter.pen();
p.setColor(centerColor);
p.setStyle(centerStyle);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, centerLineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, centerLineWidth*parent->getLineWidthMultiplier())));
painter.setPen(p);
painter.drawLine(QLineF(mi, c, ma, c));
}
painter.restore();
}
void JKQTPHorizontalRange::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=painter.pen();
QPen np(Qt::NoPen);
p.setColor(color);
@ -836,7 +854,7 @@ void JKQTPHorizontalRange::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF&
int y=rect.top()+rect.height()/2.0;
painter.drawLine(rect.left(), y, rect.right(), y);
}
painter.restore();
}
bool JKQTPHorizontalRange::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
@ -897,13 +915,13 @@ void JKQTPVerticalRange::draw(JKQTPEnhancedPainter& painter) {
double sma=transformX(parent->getXAxis()->getMax());
if (!unlimitedSizeMin) mi=transformY(sizeMin);
if (!unlimitedSizeMax) ma=transformY(sizeMax);
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
if (plotRange && (cmi!=cma) && JKQTPIsOKFloat(mi) && JKQTPIsOKFloat(ma)) {
QPen p=painter.pen();
QPen np(Qt::NoPen);
p.setColor(color);
p.setStyle(style);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
QBrush nb(Qt::NoBrush);
QBrush b=painter.brush();
b.setColor(fillColor);
@ -937,15 +955,15 @@ void JKQTPVerticalRange::draw(JKQTPEnhancedPainter& painter) {
QPen p=painter.pen();
p.setColor(centerColor);
p.setStyle(centerStyle);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, centerLineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, centerLineWidth*parent->getLineWidthMultiplier())));
painter.setPen(p);
painter.drawLine(QLineF(c, mi, c, ma));
}
painter.restore();
}
void JKQTPVerticalRange::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=painter.pen();
QPen np(Qt::NoPen);
p.setColor(color);
@ -974,7 +992,7 @@ void JKQTPVerticalRange::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& re
int y=rect.left()+rect.width()/2.0;
painter.drawLine(y, rect.top(), y, rect.bottom());
}
painter.restore();
}
bool JKQTPVerticalRange::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
@ -996,7 +1014,7 @@ bool JKQTPVerticalRange::getYMinMax(double &miny, double &maxy, double &smallest
QPen JKQTPXYLineGraph::getLinePen(JKQTPEnhancedPainter& painter) const {
QPen p;
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
p.setCapStyle(Qt::RoundCap);
@ -1006,7 +1024,7 @@ QPen JKQTPXYLineGraph::getLinePen(JKQTPEnhancedPainter& painter) const {
QPen JKQTPXYLineGraph::getSymbolPen(JKQTPEnhancedPainter& painter) const {
QPen p;
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*symbolWidth)));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*symbolWidth)));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
p.setCapStyle(Qt::RoundCap);
@ -1030,7 +1048,7 @@ QBrush JKQTPStepHorizontalGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) con
QPen JKQTPStepHorizontalGraph::getLinePen(JKQTPEnhancedPainter& painter) const {
QPen p;
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
p.setCapStyle(Qt::RoundCap);
@ -1048,7 +1066,7 @@ QBrush JKQTPHorizontalRange::getBrush(JKQTPEnhancedPainter& /*painter*/ ) const
QPen JKQTPHorizontalRange::getLinePen(JKQTPEnhancedPainter& painter) const {
QPen p;
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
p.setCapStyle(Qt::RoundCap);
@ -1073,25 +1091,16 @@ JKQTPXYParametrizedScatterGraph::JKQTPXYParametrizedScatterGraph(JKQTBasePlotter
gridDeltaX=1;
gridDeltaY=1;
gridSymbolFractionSize=0.9;
symbolFillDerivationMode=JKQTPFFCMLighterColor;
if (parent) {
symbolFillDerivationMode=parent->getCurrentPlotterStyle().graphFillColorDerivationMode;
}
}
JKQTPXYParametrizedScatterGraph::JKQTPXYParametrizedScatterGraph(JKQTPlotter *parent):
JKQTPXYLineGraph(parent),
JKQTPColorPaletteTools(parent->getPlotter())
JKQTPXYParametrizedScatterGraph(parent->getPlotter())
{
sizeColumn=-1;
colorColumn=-1;
symbolColumn=-1;
linewidthColumn=-1;
palette=JKQTPMathImageMATLAB;
colorColumnContainsRGB=false;
symbol=JKQTPFilledCircle;
drawLine=false;
gridModeForSymbolSize=false;
gridDeltaX=1;
gridDeltaY=1;
gridSymbolFractionSize=0.9;
}
void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
@ -1107,11 +1116,11 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
drawErrorsBefore(painter);
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=painter.pen();
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
p.setJoinStyle(Qt::RoundJoin);
@ -1148,7 +1157,8 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
intSortData();
double specSymbSize=0;
bool hasSpecSymbSize=false;
painter.save();
{
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
for (int iii=imin; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
@ -1169,7 +1179,7 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
symbSize=specSymbSize;
}
QColor symbColor=getLocalColor(i);
QColor symbFillColor=symbColor.lighter();
QColor symbFillColor=JKQTPGetDerivedColor(symbolFillDerivationMode, symbColor);
//qDebug()<<i<<symbolSize<<symbColor;
if (first && drawLine) {
double xl1=xold;
@ -1199,10 +1209,12 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
first=true;
}
}
painter.restore();
}
if (lines.size()>0) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
if (drawSelectionLine) {
QPen pp=penSelection;
if (colorColumn>=0) {
@ -1230,9 +1242,9 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
painter.setPen(pp);
painter.drawPolyline(linesP);
}
painter.restore();
}
painter.restore();
drawErrorsAfter(painter);
}
@ -1280,7 +1292,7 @@ void JKQTPXYParametrizedScatterGraph::drawKeyMarker(JKQTPEnhancedPainter &painte
double lineWidth=parent->pt2px(painter, this->lineWidth*0.7*parent->getLineWidthMultiplier());
if (lineWidth>0.1*maxSize) lineWidth=0.1*maxSize;
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=painter.pen();
p.setColor(color1);
p.setStyle(style);
@ -1290,10 +1302,10 @@ void JKQTPXYParametrizedScatterGraph::drawKeyMarker(JKQTPEnhancedPainter &painte
double y1=rect.top()+symbolSize1/2.0;
double x2=rect.right()-symbolSize2/2.0;
double y2=rect.bottom()-symbolSize2/2.0;
JKQTPPlotSymbol(painter, x1, y1, symbol1, symbolSize1, symbolWidth, color1, color1.lighter());
JKQTPPlotSymbol(painter, x2, y2, symbol2, symbolSize2, symbolWidth, color2, color2.lighter());
JKQTPPlotSymbol(painter, x1, y1, symbol1, symbolSize1, symbolWidth, color1, JKQTPGetDerivedColor(symbolFillDerivationMode, color1));
JKQTPPlotSymbol(painter, x2, y2, symbol2, symbolSize2, symbolWidth, color2, JKQTPGetDerivedColor(symbolFillDerivationMode, color2));
if (drawLine) painter.drawLine(x1,y1, x2,y2);
painter.restore();
}
QColor JKQTPXYParametrizedScatterGraph::getKeyLabelColor()
@ -1435,12 +1447,17 @@ JKQTPGraphSymbols JKQTPXYParametrizedScatterGraph::getLocalSymbolType(int i)
JKQTPXYParametrizedErrorScatterGraph::JKQTPXYParametrizedErrorScatterGraph(JKQTBasePlotter *parent):
JKQTPXYParametrizedScatterGraph(parent), JKQTPXYGraphErrors()
{ setErrorColorFromGraphColor(color); }
JKQTPXYParametrizedScatterGraph(parent), JKQTPXYGraphErrors(color, parent)
{
setErrorColorFromGraphColor(color);
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
}
JKQTPXYParametrizedErrorScatterGraph::JKQTPXYParametrizedErrorScatterGraph(JKQTPlotter *parent):
JKQTPXYParametrizedScatterGraph(parent), JKQTPXYGraphErrors()
{ setErrorColorFromGraphColor(color); }
JKQTPXYParametrizedErrorScatterGraph(parent->getPlotter())
{
}
bool JKQTPXYParametrizedErrorScatterGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -26,6 +26,7 @@
#include "jkqtplottertools/jkqtpdrawingtools.h"
#include "jkqtplotter/jkqtpgraphsbase.h"
#include "jkqtplottertools/jkqtpenhancedpainter.h"
#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
#ifndef jkqtpgraphs_H
#define jkqtpgraphs_H
@ -62,142 +63,122 @@ class JKQTP_LIB_EXPORT JKQTPXYLineGraph: public JKQTPXYGraph {
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() override;
/*! \brief sets the property color ( \copybrief color ) to the specified \a __value.
\details Description of the parameter color is: <BLOCKQUOTE>\copydoc color </BLOCKQUOTE>
\see color for more information */
/*! \copydoc color
\see see color for details */
inline virtual void setColor(const QColor & __value)
{
this->color = __value;
}
/*! \brief returns the property color ( \copybrief color ).
\details Description of the parameter color is: <BLOCKQUOTE>\copydoc color </BLOCKQUOTE>
\see color for more information */
/*! \copydoc color
\see see color for details */
inline virtual QColor getColor() const
{
return this->color;
}
/*! \brief sets the property fillColor ( \copybrief fillColor ) to the specified \a __value.
\details Description of the parameter fillColor is: <BLOCKQUOTE>\copydoc fillColor </BLOCKQUOTE>
\see fillColor for more information */
/*! \copydoc fillColor
\see see fillColor for details */
inline virtual void setFillColor(const QColor & __value)
{
this->fillColor = __value;
}
/*! \brief returns the property fillColor ( \copybrief fillColor ).
\details Description of the parameter fillColor is: <BLOCKQUOTE>\copydoc fillColor </BLOCKQUOTE>
\see fillColor for more information */
/*! \copydoc fillColor
\see see fillColor for details */
inline virtual QColor getFillColor() const
{
return this->fillColor;
}
/*! \brief sets the property style ( \copybrief style ) to the specified \a __value.
\details Description of the parameter style is: <BLOCKQUOTE>\copydoc style </BLOCKQUOTE>
\see style for more information */
/*! \copydoc style
\see see style for details */
inline virtual void setStyle(const Qt::PenStyle & __value)
{
this->style = __value;
}
/*! \brief returns the property style ( \copybrief style ).
\details Description of the parameter style is: <BLOCKQUOTE>\copydoc style </BLOCKQUOTE>
\see style for more information */
/*! \copydoc style
\see see style for details */
inline virtual Qt::PenStyle getStyle() const
{
return this->style;
}
/*! \brief sets the property lineWidth ( \copybrief lineWidth ) to the specified \a __value.
\details Description of the parameter lineWidth is: <BLOCKQUOTE>\copydoc lineWidth </BLOCKQUOTE>
\see lineWidth for more information */
/*! \copydoc lineWidth
\see see lineWidth for details */
inline virtual void setLineWidth(double __value)
{
this->lineWidth = __value;
}
/*! \brief returns the property lineWidth ( \copybrief lineWidth ).
\details Description of the parameter lineWidth is: <BLOCKQUOTE>\copydoc lineWidth </BLOCKQUOTE>
\see lineWidth for more information */
/*! \copydoc lineWidth
\see see lineWidth for details */
inline virtual double getLineWidth() const
{
return this->lineWidth;
}
/*! \brief sets the property symbol ( \copybrief symbol ) to the specified \a __value.
\details Description of the parameter symbol is: <BLOCKQUOTE>\copydoc symbol </BLOCKQUOTE>
\see symbol for more information */
/*! \copydoc symbol
\see see symbol for details */
inline virtual void setSymbol(const JKQTPGraphSymbols & __value)
{
this->symbol = __value;
}
/*! \brief returns the property symbol ( \copybrief symbol ).
\details Description of the parameter symbol is: <BLOCKQUOTE>\copydoc symbol </BLOCKQUOTE>
\see symbol for more information */
/*! \copydoc symbol
\see see symbol for details */
inline virtual JKQTPGraphSymbols getSymbol() const
{
return this->symbol;
}
/*! \brief sets the property symbolWidth ( \copybrief symbolWidth ) to the specified \a __value.
\details Description of the parameter symbolWidth is: <BLOCKQUOTE>\copydoc symbolWidth </BLOCKQUOTE>
\see symbolWidth for more information */
/*! \copydoc symbolWidth
\see see symbolWidth for details */
inline virtual void setSymbolWidth(double __value)
{
this->symbolWidth = __value;
}
/*! \brief returns the property symbolWidth ( \copybrief symbolWidth ).
\details Description of the parameter symbolWidth is: <BLOCKQUOTE>\copydoc symbolWidth </BLOCKQUOTE>
\see symbolWidth for more information */
/*! \copydoc symbolWidth
\see see symbolWidth for details */
inline virtual double getSymbolWidth() const
{
return this->symbolWidth;
}
/*! \brief sets the property symbolSize ( \copybrief symbolSize ) to the specified \a __value.
\details Description of the parameter symbolSize is: <BLOCKQUOTE>\copydoc symbolSize </BLOCKQUOTE>
\see symbolSize for more information */
/*! \copydoc symbolSize
\see see symbolSize for details */
inline virtual void setSymbolSize(double __value)
{
this->symbolSize = __value;
}
/*! \brief returns the property symbolSize ( \copybrief symbolSize ).
\details Description of the parameter symbolSize is: <BLOCKQUOTE>\copydoc symbolSize </BLOCKQUOTE>
\see symbolSize for more information */
/*! \copydoc symbolSize
\see see symbolSize for details */
inline virtual double getSymbolSize() const
{
return this->symbolSize;
}
/*! \brief sets the property drawLine ( \copybrief drawLine ) to the specified \a __value.
\details Description of the parameter drawLine is: <BLOCKQUOTE>\copydoc drawLine </BLOCKQUOTE>
\see drawLine for more information */
/*! \copydoc drawLine
\see see drawLine for details */
inline virtual void setDrawLine(bool __value)
{
this->drawLine = __value;
}
/*! \brief returns the property drawLine ( \copybrief drawLine ).
\details Description of the parameter drawLine is: <BLOCKQUOTE>\copydoc drawLine </BLOCKQUOTE>
\see drawLine for more information */
/*! \copydoc drawLine
\see see drawLine for details */
inline virtual bool getDrawLine() const
{
return this->drawLine;
}
/*! \brief sets the property drawSelectionLine ( \copybrief drawSelectionLine ) to the specified \a __value.
\details Description of the parameter drawSelectionLine is: <BLOCKQUOTE>\copydoc drawSelectionLine </BLOCKQUOTE>
\see drawSelectionLine for more information */
/*! \copydoc drawSelectionLine
\see see drawSelectionLine for details */
inline virtual void setDrawSelectionLine(bool __value)
{
this->drawSelectionLine = __value;
}
/*! \brief returns the property drawSelectionLine ( \copybrief drawSelectionLine ).
\details Description of the parameter drawSelectionLine is: <BLOCKQUOTE>\copydoc drawSelectionLine </BLOCKQUOTE>
\see drawSelectionLine for more information */
/*! \copydoc drawSelectionLine
\see see drawSelectionLine for details */
inline virtual bool getDrawSelectionLine() const
{
return this->drawSelectionLine;
}
/*! \brief sets the property selectionLineColor ( \copybrief selectionLineColor ) to the specified \a __value.
\details Description of the parameter selectionLineColor is: <BLOCKQUOTE>\copydoc selectionLineColor </BLOCKQUOTE>
\see selectionLineColor for more information */
/*! \copydoc selectionLineColor
\see see selectionLineColor for details */
inline virtual void setSelectionLineColor(const QColor & __value)
{
this->selectionLineColor = __value;
}
/*! \brief returns the property selectionLineColor ( \copybrief selectionLineColor ).
\details Description of the parameter selectionLineColor is: <BLOCKQUOTE>\copydoc selectionLineColor </BLOCKQUOTE>
\see selectionLineColor for more information */
/*! \copydoc selectionLineColor
\see see selectionLineColor for details */
inline virtual QColor getSelectionLineColor() const
{
return this->selectionLineColor;
@ -273,16 +254,14 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() override;
/*! \brief sets the property sizeColumn ( \copybrief sizeColumn ) to the specified \a __value.
\details Description of the parameter sizeColumn is: <BLOCKQUOTE>\copydoc sizeColumn </BLOCKQUOTE>
\see sizeColumn for more information */
/*! \copydoc sizeColumn
\see see sizeColumn for details */
inline virtual void setSizeColumn(int __value)
{
this->sizeColumn = __value;
}
/*! \brief returns the property sizeColumn ( \copybrief sizeColumn ).
\details Description of the parameter sizeColumn is: <BLOCKQUOTE>\copydoc sizeColumn </BLOCKQUOTE>
\see sizeColumn for more information */
/*! \copydoc sizeColumn
\see see sizeColumn for details */
inline virtual int getSizeColumn() const
{
return this->sizeColumn;
@ -291,16 +270,14 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
\details Description of the parameter sizeColumn is: <BLOCKQUOTE>\copydoc sizeColumn </BLOCKQUOTE>
\see sizeColumn for more information */
inline virtual void setSizeColumn (size_t __value) { this->sizeColumn = static_cast<int>(__value); }
/*! \brief sets the property colorColumn ( \copybrief colorColumn ) to the specified \a __value.
\details Description of the parameter colorColumn is: <BLOCKQUOTE>\copydoc colorColumn </BLOCKQUOTE>
\see colorColumn for more information */
/*! \copydoc colorColumn
\see see colorColumn for details */
inline virtual void setColorColumn(int __value)
{
this->colorColumn = __value;
}
/*! \brief returns the property colorColumn ( \copybrief colorColumn ).
\details Description of the parameter colorColumn is: <BLOCKQUOTE>\copydoc colorColumn </BLOCKQUOTE>
\see colorColumn for more information */
/*! \copydoc colorColumn
\see see colorColumn for details */
inline virtual int getColorColumn() const
{
return this->colorColumn;
@ -309,16 +286,14 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
\details Description of the parameter colorColumn is: <BLOCKQUOTE>\copydoc colorColumn </BLOCKQUOTE>
\see colorColumn for more information */
inline virtual void setColorColumn (size_t __value) { this->colorColumn = static_cast<int>(__value); }
/*! \brief sets the property symbolColumn ( \copybrief symbolColumn ) to the specified \a __value.
\details Description of the parameter symbolColumn is: <BLOCKQUOTE>\copydoc symbolColumn </BLOCKQUOTE>
\see symbolColumn for more information */
/*! \copydoc symbolColumn
\see see symbolColumn for details */
inline virtual void setSymbolColumn(int __value)
{
this->symbolColumn = __value;
}
/*! \brief returns the property symbolColumn ( \copybrief symbolColumn ).
\details Description of the parameter symbolColumn is: <BLOCKQUOTE>\copydoc symbolColumn </BLOCKQUOTE>
\see symbolColumn for more information */
/*! \copydoc symbolColumn
\see see symbolColumn for details */
inline virtual int getSymbolColumn() const
{
return this->symbolColumn;
@ -327,16 +302,14 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
\details Description of the parameter symbolColumn is: <BLOCKQUOTE>\copydoc symbolColumn </BLOCKQUOTE>
\see symbolColumn for more information */
inline virtual void setSymbolColumn (size_t __value) { this->symbolColumn = static_cast<int>(__value); }
/*! \brief sets the property linewidthColumn ( \copybrief linewidthColumn ) to the specified \a __value.
\details Description of the parameter linewidthColumn is: <BLOCKQUOTE>\copydoc linewidthColumn </BLOCKQUOTE>
\see linewidthColumn for more information */
/*! \copydoc linewidthColumn
\see see linewidthColumn for details */
inline virtual void setLinewidthColumn(int __value)
{
this->linewidthColumn = __value;
}
/*! \brief returns the property linewidthColumn ( \copybrief linewidthColumn ).
\details Description of the parameter linewidthColumn is: <BLOCKQUOTE>\copydoc linewidthColumn </BLOCKQUOTE>
\see linewidthColumn for more information */
/*! \copydoc linewidthColumn
\see see linewidthColumn for details */
inline virtual int getLinewidthColumn() const
{
return this->linewidthColumn;
@ -345,76 +318,78 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
\details Description of the parameter linewidthColumn is: <BLOCKQUOTE>\copydoc linewidthColumn </BLOCKQUOTE>
\see linewidthColumn for more information */
inline virtual void setLinewidthColumn( size_t __value) { this->linewidthColumn = static_cast<int>(__value); }
/*! \brief sets the property colorColumnContainsRGB ( \copybrief colorColumnContainsRGB ) to the specified \a __value.
\details Description of the parameter colorColumnContainsRGB is: <BLOCKQUOTE>\copydoc colorColumnContainsRGB </BLOCKQUOTE>
\see colorColumnContainsRGB for more information */
/*! \copydoc colorColumnContainsRGB
\see see colorColumnContainsRGB for details */
inline virtual void setColorColumnContainsRGB(bool __value)
{
this->colorColumnContainsRGB = __value;
}
/*! \brief returns the property colorColumnContainsRGB ( \copybrief colorColumnContainsRGB ).
\details Description of the parameter colorColumnContainsRGB is: <BLOCKQUOTE>\copydoc colorColumnContainsRGB </BLOCKQUOTE>
\see colorColumnContainsRGB for more information */
/*! \copydoc colorColumnContainsRGB
\see see colorColumnContainsRGB for details */
inline virtual bool getColorColumnContainsRGB() const
{
return this->colorColumnContainsRGB;
}
/*! \brief sets the property gridModeForSymbolSize ( \copybrief gridModeForSymbolSize ) to the specified \a __value.
\details Description of the parameter gridModeForSymbolSize is: <BLOCKQUOTE>\copydoc gridModeForSymbolSize </BLOCKQUOTE>
\see gridModeForSymbolSize for more information */
/*! \copydoc gridModeForSymbolSize
\see see gridModeForSymbolSize for details */
inline virtual void setGridModeForSymbolSize(bool __value)
{
this->gridModeForSymbolSize = __value;
}
/*! \brief returns the property gridModeForSymbolSize ( \copybrief gridModeForSymbolSize ).
\details Description of the parameter gridModeForSymbolSize is: <BLOCKQUOTE>\copydoc gridModeForSymbolSize </BLOCKQUOTE>
\see gridModeForSymbolSize for more information */
/*! \copydoc gridModeForSymbolSize
\see see gridModeForSymbolSize for details */
inline virtual bool getGridModeForSymbolSize() const
{
return this->gridModeForSymbolSize;
}
/*! \brief sets the property gridDeltaX ( \copybrief gridDeltaX ) to the specified \a __value.
\details Description of the parameter gridDeltaX is: <BLOCKQUOTE>\copydoc gridDeltaX </BLOCKQUOTE>
\see gridDeltaX for more information */
/*! \copydoc gridDeltaX
\see see gridDeltaX for details */
inline virtual void setGridDeltaX(double __value)
{
this->gridDeltaX = __value;
}
/*! \brief returns the property gridDeltaX ( \copybrief gridDeltaX ).
\details Description of the parameter gridDeltaX is: <BLOCKQUOTE>\copydoc gridDeltaX </BLOCKQUOTE>
\see gridDeltaX for more information */
/*! \copydoc gridDeltaX
\see see gridDeltaX for details */
inline virtual double getGridDeltaX() const
{
return this->gridDeltaX;
}
/*! \brief sets the property gridDeltaY ( \copybrief gridDeltaY ) to the specified \a __value.
\details Description of the parameter gridDeltaY is: <BLOCKQUOTE>\copydoc gridDeltaY </BLOCKQUOTE>
\see gridDeltaY for more information */
/*! \copydoc gridDeltaY
\see see gridDeltaY for details */
inline virtual void setGridDeltaY(double __value)
{
this->gridDeltaY = __value;
}
/*! \brief returns the property gridDeltaY ( \copybrief gridDeltaY ).
\details Description of the parameter gridDeltaY is: <BLOCKQUOTE>\copydoc gridDeltaY </BLOCKQUOTE>
\see gridDeltaY for more information */
/*! \copydoc gridDeltaY
\see see gridDeltaY for details */
inline virtual double getGridDeltaY() const
{
return this->gridDeltaY;
}
/*! \brief sets the property gridSymbolFractionSize ( \copybrief gridSymbolFractionSize ) to the specified \a __value.
\details Description of the parameter gridSymbolFractionSize is: <BLOCKQUOTE>\copydoc gridSymbolFractionSize </BLOCKQUOTE>
\see gridSymbolFractionSize for more information */
/*! \copydoc gridSymbolFractionSize
\see see gridSymbolFractionSize for details */
inline virtual void setGridSymbolFractionSize(double __value)
{
this->gridSymbolFractionSize = __value;
}
/*! \brief returns the property gridSymbolFractionSize ( \copybrief gridSymbolFractionSize ).
\details Description of the parameter gridSymbolFractionSize is: <BLOCKQUOTE>\copydoc gridSymbolFractionSize </BLOCKQUOTE>
\see gridSymbolFractionSize for more information */
/*! \copydoc gridSymbolFractionSize
\see see gridSymbolFractionSize for details */
inline virtual double getGridSymbolFractionSize() const
{
return this->gridSymbolFractionSize;
}
/*! \copydoc symbolFillDerivationMode
\see see symbolFillDerivationMode for details */
inline virtual JKQTPColorDerivationMode getSymbolFillDerivationMode() const
{
return this->symbolFillDerivationMode;
}
/*! \copydoc symbolFillDerivationMode
\see see symbolFillDerivationMode for details */
inline virtual void setSymbolFillDerivationMode(JKQTPColorDerivationMode m)
{
this->symbolFillDerivationMode=m;
}
virtual void setParent(JKQTBasePlotter* parent) override;
@ -475,6 +450,9 @@ class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph,
/** \brief internally used to store the range of the color column */
double intColMax;
/** \brief specifies how to derive the symbol fill color from the symbol/line color */
JKQTPColorDerivationMode symbolFillDerivationMode;
};
@ -579,114 +557,98 @@ class JKQTP_LIB_EXPORT JKQTPStepHorizontalGraph: public JKQTPXYGraph {
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor() override;
/*! \brief sets the property color ( \copybrief color ) to the specified \a __value.
\details Description of the parameter color is: <BLOCKQUOTE>\copydoc color </BLOCKQUOTE>
\see color for more information */
/*! \copydoc color
\see see color for details */
inline virtual void setColor(const QColor & __value)
{
this->color = __value;
}
/*! \brief returns the property color ( \copybrief color ).
\details Description of the parameter color is: <BLOCKQUOTE>\copydoc color </BLOCKQUOTE>
\see color for more information */
/*! \copydoc color
\see see color for details */
inline virtual QColor getColor() const
{
return this->color;
}
/*! \brief sets the property fillColor ( \copybrief fillColor ) to the specified \a __value.
\details Description of the parameter fillColor is: <BLOCKQUOTE>\copydoc fillColor </BLOCKQUOTE>
\see fillColor for more information */
/*! \copydoc fillColor
\see see fillColor for details */
inline virtual void setFillColor(const QColor & __value)
{
this->fillColor = __value;
}
/*! \brief returns the property fillColor ( \copybrief fillColor ).
\details Description of the parameter fillColor is: <BLOCKQUOTE>\copydoc fillColor </BLOCKQUOTE>
\see fillColor for more information */
/*! \copydoc fillColor
\see see fillColor for details */
inline virtual QColor getFillColor() const
{
return this->fillColor;
}
/*! \brief sets the property fillStyle ( \copybrief fillStyle ) to the specified \a __value.
\details Description of the parameter fillStyle is: <BLOCKQUOTE>\copydoc fillStyle </BLOCKQUOTE>
\see fillStyle for more information */
/*! \copydoc fillStyle
\see see fillStyle for details */
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
{
this->fillStyle = __value;
}
/*! \brief returns the property fillStyle ( \copybrief fillStyle ).
\details Description of the parameter fillStyle is: <BLOCKQUOTE>\copydoc fillStyle </BLOCKQUOTE>
\see fillStyle for more information */
/*! \copydoc fillStyle
\see see fillStyle for details */
inline virtual Qt::BrushStyle getFillStyle() const
{
return this->fillStyle;
}
/*! \brief sets the property style ( \copybrief style ) to the specified \a __value.
\details Description of the parameter style is: <BLOCKQUOTE>\copydoc style </BLOCKQUOTE>
\see style for more information */
/*! \copydoc style
\see see style for details */
inline virtual void setStyle(const Qt::PenStyle & __value)
{
this->style = __value;
}
/*! \brief returns the property style ( \copybrief style ).
\details Description of the parameter style is: <BLOCKQUOTE>\copydoc style </BLOCKQUOTE>
\see style for more information */
/*! \copydoc style
\see see style for details */
inline virtual Qt::PenStyle getStyle() const
{
return this->style;
}
/*! \brief sets the property lineWidth ( \copybrief lineWidth ) to the specified \a __value.
\details Description of the parameter lineWidth is: <BLOCKQUOTE>\copydoc lineWidth </BLOCKQUOTE>
\see lineWidth for more information */
/*! \copydoc lineWidth
\see see lineWidth for details */
inline virtual void setLineWidth(double __value)
{
this->lineWidth = __value;
}
/*! \brief returns the property lineWidth ( \copybrief lineWidth ).
\details Description of the parameter lineWidth is: <BLOCKQUOTE>\copydoc lineWidth </BLOCKQUOTE>
\see lineWidth for more information */
/*! \copydoc lineWidth
\see see lineWidth for details */
inline virtual double getLineWidth() const
{
return this->lineWidth;
}
/*! \brief sets the property drawLine ( \copybrief drawLine ) to the specified \a __value.
\details Description of the parameter drawLine is: <BLOCKQUOTE>\copydoc drawLine </BLOCKQUOTE>
\see drawLine for more information */
/*! \copydoc drawLine
\see see drawLine for details */
inline virtual void setDrawLine(bool __value)
{
this->drawLine = __value;
}
/*! \brief returns the property drawLine ( \copybrief drawLine ).
\details Description of the parameter drawLine is: <BLOCKQUOTE>\copydoc drawLine </BLOCKQUOTE>
\see drawLine for more information */
/*! \copydoc drawLine
\see see drawLine for details */
inline virtual bool getDrawLine() const
{
return this->drawLine;
}
/*! \brief sets the property fillCurve ( \copybrief fillCurve ) to the specified \a __value.
\details Description of the parameter fillCurve is: <BLOCKQUOTE>\copydoc fillCurve </BLOCKQUOTE>
\see fillCurve for more information */
/*! \copydoc fillCurve
\see see fillCurve for details */
inline virtual void setFillCurve(bool __value)
{
this->fillCurve = __value;
}
/*! \brief returns the property fillCurve ( \copybrief fillCurve ).
\details Description of the parameter fillCurve is: <BLOCKQUOTE>\copydoc fillCurve </BLOCKQUOTE>
\see fillCurve for more information */
/*! \copydoc fillCurve
\see see fillCurve for details */
inline virtual bool getFillCurve() const
{
return this->fillCurve;
}
/*! \brief sets the property stepType ( \copybrief stepType ) to the specified \a __value.
\details Description of the parameter stepType is: <BLOCKQUOTE>\copydoc stepType </BLOCKQUOTE>
\see stepType for more information */
/*! \copydoc stepType
\see see stepType for details */
inline virtual void setStepType(const JKQTPStepType & __value)
{
this->stepType = __value;
}
/*! \brief returns the property stepType ( \copybrief stepType ).
\details Description of the parameter stepType is: <BLOCKQUOTE>\copydoc stepType </BLOCKQUOTE>
\see stepType for more information */
/*! \copydoc stepType
\see see stepType for details */
inline virtual JKQTPStepType getStepType() const
{
return this->stepType;
@ -779,283 +741,243 @@ class JKQTP_LIB_EXPORT JKQTPHorizontalRange: public JKQTPGraph {
void setDrawCenterLineOnly();
/*! \brief sets the property color ( \copybrief color ) to the specified \a __value.
\details Description of the parameter color is: <BLOCKQUOTE>\copydoc color </BLOCKQUOTE>
\see color for more information */
/*! \copydoc color
\see see color for details */
inline virtual void setColor(const QColor & __value)
{
this->color = __value;
}
/*! \brief returns the property color ( \copybrief color ).
\details Description of the parameter color is: <BLOCKQUOTE>\copydoc color </BLOCKQUOTE>
\see color for more information */
/*! \copydoc color
\see see color for details */
inline virtual QColor getColor() const
{
return this->color;
}
/*! \brief sets the property fillColor ( \copybrief fillColor ) to the specified \a __value.
\details Description of the parameter fillColor is: <BLOCKQUOTE>\copydoc fillColor </BLOCKQUOTE>
\see fillColor for more information */
/*! \copydoc fillColor
\see see fillColor for details */
inline virtual void setFillColor(const QColor & __value)
{
this->fillColor = __value;
}
/*! \brief returns the property fillColor ( \copybrief fillColor ).
\details Description of the parameter fillColor is: <BLOCKQUOTE>\copydoc fillColor </BLOCKQUOTE>
\see fillColor for more information */
/*! \copydoc fillColor
\see see fillColor for details */
inline virtual QColor getFillColor() const
{
return this->fillColor;
}
/*! \brief sets the property fillStyle ( \copybrief fillStyle ) to the specified \a __value.
\details Description of the parameter fillStyle is: <BLOCKQUOTE>\copydoc fillStyle </BLOCKQUOTE>
\see fillStyle for more information */
/*! \copydoc fillStyle
\see see fillStyle for details */
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
{
this->fillStyle = __value;
}
/*! \brief returns the property fillStyle ( \copybrief fillStyle ).
\details Description of the parameter fillStyle is: <BLOCKQUOTE>\copydoc fillStyle </BLOCKQUOTE>
\see fillStyle for more information */
/*! \copydoc fillStyle
\see see fillStyle for details */
inline virtual Qt::BrushStyle getFillStyle() const
{
return this->fillStyle;
}
/*! \brief sets the property style ( \copybrief style ) to the specified \a __value.
\details Description of the parameter style is: <BLOCKQUOTE>\copydoc style </BLOCKQUOTE>
\see style for more information */
/*! \copydoc style
\see see style for details */
inline virtual void setStyle(const Qt::PenStyle & __value)
{
this->style = __value;
}
/*! \brief returns the property style ( \copybrief style ).
\details Description of the parameter style is: <BLOCKQUOTE>\copydoc style </BLOCKQUOTE>
\see style for more information */
/*! \copydoc style
\see see style for details */
inline virtual Qt::PenStyle getStyle() const
{
return this->style;
}
/*! \brief sets the property lineWidth ( \copybrief lineWidth ) to the specified \a __value.
\details Description of the parameter lineWidth is: <BLOCKQUOTE>\copydoc lineWidth </BLOCKQUOTE>
\see lineWidth for more information */
/*! \copydoc lineWidth
\see see lineWidth for details */
inline virtual void setLineWidth(double __value)
{
this->lineWidth = __value;
}
/*! \brief returns the property lineWidth ( \copybrief lineWidth ).
\details Description of the parameter lineWidth is: <BLOCKQUOTE>\copydoc lineWidth </BLOCKQUOTE>
\see lineWidth for more information */
/*! \copydoc lineWidth
\see see lineWidth for details */
inline virtual double getLineWidth() const
{
return this->lineWidth;
}
/*! \brief sets the property centerColor ( \copybrief centerColor ) to the specified \a __value.
\details Description of the parameter centerColor is: <BLOCKQUOTE>\copydoc centerColor </BLOCKQUOTE>
\see centerColor for more information */
/*! \copydoc centerColor
\see see centerColor for details */
inline virtual void setCenterColor(const QColor & __value)
{
this->centerColor = __value;
}
/*! \brief returns the property centerColor ( \copybrief centerColor ).
\details Description of the parameter centerColor is: <BLOCKQUOTE>\copydoc centerColor </BLOCKQUOTE>
\see centerColor for more information */
/*! \copydoc centerColor
\see see centerColor for details */
inline virtual QColor getCenterColor() const
{
return this->centerColor;
}
/*! \brief sets the property centerStyle ( \copybrief centerStyle ) to the specified \a __value.
\details Description of the parameter centerStyle is: <BLOCKQUOTE>\copydoc centerStyle </BLOCKQUOTE>
\see centerStyle for more information */
/*! \copydoc centerStyle
\see see centerStyle for details */
inline virtual void setCenterStyle(const Qt::PenStyle & __value)
{
this->centerStyle = __value;
}
/*! \brief returns the property centerStyle ( \copybrief centerStyle ).
\details Description of the parameter centerStyle is: <BLOCKQUOTE>\copydoc centerStyle </BLOCKQUOTE>
\see centerStyle for more information */
/*! \copydoc centerStyle
\see see centerStyle for details */
inline virtual Qt::PenStyle getCenterStyle() const
{
return this->centerStyle;
}
/*! \brief sets the property centerLineWidth ( \copybrief centerLineWidth ) to the specified \a __value.
\details Description of the parameter centerLineWidth is: <BLOCKQUOTE>\copydoc centerLineWidth </BLOCKQUOTE>
\see centerLineWidth for more information */
/*! \copydoc centerLineWidth
\see see centerLineWidth for details */
inline virtual void setCenterLineWidth(double __value)
{
this->centerLineWidth = __value;
}
/*! \brief returns the property centerLineWidth ( \copybrief centerLineWidth ).
\details Description of the parameter centerLineWidth is: <BLOCKQUOTE>\copydoc centerLineWidth </BLOCKQUOTE>
\see centerLineWidth for more information */
/*! \copydoc centerLineWidth
\see see centerLineWidth for details */
inline virtual double getCenterLineWidth() const
{
return this->centerLineWidth;
}
/*! \brief sets the property rangeMin ( \copybrief rangeMin ) to the specified \a __value.
\details Description of the parameter rangeMin is: <BLOCKQUOTE>\copydoc rangeMin </BLOCKQUOTE>
\see rangeMin for more information */
/*! \copydoc rangeMin
\see see rangeMin for details */
inline virtual void setRangeMin(double __value)
{
this->rangeMin = __value;
}
/*! \brief returns the property rangeMin ( \copybrief rangeMin ).
\details Description of the parameter rangeMin is: <BLOCKQUOTE>\copydoc rangeMin </BLOCKQUOTE>
\see rangeMin for more information */
/*! \copydoc rangeMin
\see see rangeMin for details */
inline virtual double getRangeMin() const
{
return this->rangeMin;
}
/*! \brief sets the property rangeMax ( \copybrief rangeMax ) to the specified \a __value.
\details Description of the parameter rangeMax is: <BLOCKQUOTE>\copydoc rangeMax </BLOCKQUOTE>
\see rangeMax for more information */
/*! \copydoc rangeMax
\see see rangeMax for details */
inline virtual void setRangeMax(double __value)
{
this->rangeMax = __value;
}
/*! \brief returns the property rangeMax ( \copybrief rangeMax ).
\details Description of the parameter rangeMax is: <BLOCKQUOTE>\copydoc rangeMax </BLOCKQUOTE>
\see rangeMax for more information */
/*! \copydoc rangeMax
\see see rangeMax for details */
inline virtual double getRangeMax() const
{
return this->rangeMax;
}
/*! \brief sets the property sizeMin ( \copybrief sizeMin ) to the specified \a __value.
\details Description of the parameter sizeMin is: <BLOCKQUOTE>\copydoc sizeMin </BLOCKQUOTE>
\see sizeMin for more information */
/*! \copydoc sizeMin
\see see sizeMin for details */
inline virtual void setSizeMin(double __value)
{
this->sizeMin = __value;
}
/*! \brief returns the property sizeMin ( \copybrief sizeMin ).
\details Description of the parameter sizeMin is: <BLOCKQUOTE>\copydoc sizeMin </BLOCKQUOTE>
\see sizeMin for more information */
/*! \copydoc sizeMin
\see see sizeMin for details */
inline virtual double getSizeMin() const
{
return this->sizeMin;
}
/*! \brief sets the property sizeMax ( \copybrief sizeMax ) to the specified \a __value.
\details Description of the parameter sizeMax is: <BLOCKQUOTE>\copydoc sizeMax </BLOCKQUOTE>
\see sizeMax for more information */
/*! \copydoc sizeMax
\see see sizeMax for details */
inline virtual void setSizeMax(double __value)
{
this->sizeMax = __value;
}
/*! \brief returns the property sizeMax ( \copybrief sizeMax ).
\details Description of the parameter sizeMax is: <BLOCKQUOTE>\copydoc sizeMax </BLOCKQUOTE>
\see sizeMax for more information */
/*! \copydoc sizeMax
\see see sizeMax for details */
inline virtual double getSizeMax() const
{
return this->sizeMax;
}
/*! \brief sets the property unlimitedSizeMin ( \copybrief unlimitedSizeMin ) to the specified \a __value.
\details Description of the parameter unlimitedSizeMin is: <BLOCKQUOTE>\copydoc unlimitedSizeMin </BLOCKQUOTE>
\see unlimitedSizeMin for more information */
/*! \copydoc unlimitedSizeMin
\see see unlimitedSizeMin for details */
inline virtual void setUnlimitedSizeMin(bool __value)
{
this->unlimitedSizeMin = __value;
}
/*! \brief returns the property unlimitedSizeMin ( \copybrief unlimitedSizeMin ).
\details Description of the parameter unlimitedSizeMin is: <BLOCKQUOTE>\copydoc unlimitedSizeMin </BLOCKQUOTE>
\see unlimitedSizeMin for more information */
/*! \copydoc unlimitedSizeMin
\see see unlimitedSizeMin for details */
inline virtual bool getUnlimitedSizeMin() const
{
return this->unlimitedSizeMin;
}
/*! \brief sets the property unlimitedSizeMax ( \copybrief unlimitedSizeMax ) to the specified \a __value.
\details Description of the parameter unlimitedSizeMax is: <BLOCKQUOTE>\copydoc unlimitedSizeMax </BLOCKQUOTE>
\see unlimitedSizeMax for more information */
/*! \copydoc unlimitedSizeMax
\see see unlimitedSizeMax for details */
inline virtual void setUnlimitedSizeMax(bool __value)
{
this->unlimitedSizeMax = __value;
}
/*! \brief returns the property unlimitedSizeMax ( \copybrief unlimitedSizeMax ).
\details Description of the parameter unlimitedSizeMax is: <BLOCKQUOTE>\copydoc unlimitedSizeMax </BLOCKQUOTE>
\see unlimitedSizeMax for more information */
/*! \copydoc unlimitedSizeMax
\see see unlimitedSizeMax for details */
inline virtual bool getUnlimitedSizeMax() const
{
return this->unlimitedSizeMax;
}
/*! \brief sets the property rangeCenter ( \copybrief rangeCenter ) to the specified \a __value.
\details Description of the parameter rangeCenter is: <BLOCKQUOTE>\copydoc rangeCenter </BLOCKQUOTE>
\see rangeCenter for more information */
/*! \copydoc rangeCenter
\see see rangeCenter for details */
inline virtual void setRangeCenter(double __value)
{
this->rangeCenter = __value;
}
/*! \brief returns the property rangeCenter ( \copybrief rangeCenter ).
\details Description of the parameter rangeCenter is: <BLOCKQUOTE>\copydoc rangeCenter </BLOCKQUOTE>
\see rangeCenter for more information */
/*! \copydoc rangeCenter
\see see rangeCenter for details */
inline virtual double getRangeCenter() const
{
return this->rangeCenter;
}
/*! \brief sets the property plotCenterLine ( \copybrief plotCenterLine ) to the specified \a __value.
\details Description of the parameter plotCenterLine is: <BLOCKQUOTE>\copydoc plotCenterLine </BLOCKQUOTE>
\see plotCenterLine for more information */
/*! \copydoc plotCenterLine
\see see plotCenterLine for details */
inline virtual void setPlotCenterLine(bool __value)
{
this->plotCenterLine = __value;
}
/*! \brief returns the property plotCenterLine ( \copybrief plotCenterLine ).
\details Description of the parameter plotCenterLine is: <BLOCKQUOTE>\copydoc plotCenterLine </BLOCKQUOTE>
\see plotCenterLine for more information */
/*! \copydoc plotCenterLine
\see see plotCenterLine for details */
inline virtual bool getPlotCenterLine() const
{
return this->plotCenterLine;
}
/*! \brief sets the property invertedRange ( \copybrief invertedRange ) to the specified \a __value.
\details Description of the parameter invertedRange is: <BLOCKQUOTE>\copydoc invertedRange </BLOCKQUOTE>
\see invertedRange for more information */
/*! \copydoc invertedRange
\see see invertedRange for details */
inline virtual void setInvertedRange(bool __value)
{
this->invertedRange = __value;
}
/*! \brief returns the property invertedRange ( \copybrief invertedRange ).
\details Description of the parameter invertedRange is: <BLOCKQUOTE>\copydoc invertedRange </BLOCKQUOTE>
\see invertedRange for more information */
/*! \copydoc invertedRange
\see see invertedRange for details */
inline virtual bool getInvertedRange() const
{
return this->invertedRange;
}
/*! \brief sets the property plotRange ( \copybrief plotRange ) to the specified \a __value.
\details Description of the parameter plotRange is: <BLOCKQUOTE>\copydoc plotRange </BLOCKQUOTE>
\see plotRange for more information */
/*! \copydoc plotRange
\see see plotRange for details */
inline virtual void setPlotRange(bool __value)
{
this->plotRange = __value;
}
/*! \brief returns the property plotRange ( \copybrief plotRange ).
\details Description of the parameter plotRange is: <BLOCKQUOTE>\copydoc plotRange </BLOCKQUOTE>
\see plotRange for more information */
/*! \copydoc plotRange
\see see plotRange for details */
inline virtual bool getPlotRange() const
{
return this->plotRange;
}
/*! \brief sets the property fillRange ( \copybrief fillRange ) to the specified \a __value.
\details Description of the parameter fillRange is: <BLOCKQUOTE>\copydoc fillRange </BLOCKQUOTE>
\see fillRange for more information */
/*! \copydoc fillRange
\see see fillRange for details */
inline virtual void setFillRange(bool __value)
{
this->fillRange = __value;
}
/*! \brief returns the property fillRange ( \copybrief fillRange ).
\details Description of the parameter fillRange is: <BLOCKQUOTE>\copydoc fillRange </BLOCKQUOTE>
\see fillRange for more information */
/*! \copydoc fillRange
\see see fillRange for details */
inline virtual bool getFillRange() const
{
return this->fillRange;
}
/*! \brief sets the property plotRangeLines ( \copybrief plotRangeLines ) to the specified \a __value.
\details Description of the parameter plotRangeLines is: <BLOCKQUOTE>\copydoc plotRangeLines </BLOCKQUOTE>
\see plotRangeLines for more information */
/*! \copydoc plotRangeLines
\see see plotRangeLines for details */
inline virtual void setPlotRangeLines(bool __value)
{
this->plotRangeLines = __value;
}
/*! \brief returns the property plotRangeLines ( \copybrief plotRangeLines ).
\details Description of the parameter plotRangeLines is: <BLOCKQUOTE>\copydoc plotRangeLines </BLOCKQUOTE>
\see plotRangeLines for more information */
/*! \copydoc plotRangeLines
\see see plotRangeLines for details */
inline virtual bool getPlotRangeLines() const
{
return this->plotRangeLines;

View File

@ -5,7 +5,7 @@
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
the Free Software Foundation, either version 2.1 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -51,32 +51,22 @@ JKQTPBarVerticalGraph::JKQTPBarVerticalGraph(JKQTBasePlotter* parent):
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
fillColor=parent->getPlotStyle(parentPlotStyle).color();
color=parent->getPlotStyle(parentPlotStyle).color();
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
fillStyle=parent->getPlotStyle(parentPlotStyle).fillStyle();
//style=parent->getPlotStyle(parentPlotStyle).style();
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
}
}
JKQTPBarVerticalGraph::JKQTPBarVerticalGraph(JKQTPlotter* parent):
JKQTPXYGraph(parent)
JKQTPBarVerticalGraph(parent->getPlotter())
{
baseline=0.0;
color=QColor("black");
fillColor=QColor("red");
style=Qt::SolidLine;
lineWidth=1;
fillStyle=Qt::SolidPattern;
width=0.9;
shift=0;
if (parent) { // get style settings from parent object
parentPlotStyle=parent->getNextStyle();
fillColor=parent->getPlotStyle(parentPlotStyle).color();
}
}
void JKQTPBarVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save();
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=painter.pen();
QPen np(Qt::NoPen);
p.setColor(color);
@ -88,7 +78,7 @@ void JKQTPBarVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF&
painter.setPen(p);
painter.setBrush(b);
painter.drawRect(rect);
painter.restore();
}
QColor JKQTPBarVerticalGraph::getKeyLabelColor() {
@ -108,7 +98,7 @@ void JKQTPBarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
QPen p=painter.pen();
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
@ -126,7 +116,9 @@ void JKQTPBarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
}
if (imin<0) imin=0;
if (imax<0) imax=0;
painter.save();
{
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
// double x0=transformX(0);
// if (parent->getXAxis()->isLogAxis()) x0=transformX(parent->getXAxis()->getMin());
@ -183,7 +175,7 @@ void JKQTPBarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
}
}
painter.restore();
}
drawErrorsAfter(painter);
}
@ -339,7 +331,7 @@ JKQTPBarHorizontalGraph::JKQTPBarHorizontalGraph(JKQTBasePlotter *parent):
}
JKQTPBarHorizontalGraph::JKQTPBarHorizontalGraph(JKQTPlotter *parent):
JKQTPBarVerticalGraph(parent)
JKQTPBarHorizontalGraph(parent->getPlotter())
{
}
@ -356,7 +348,7 @@ void JKQTPBarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
QPen p=painter.pen();
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
@ -381,7 +373,8 @@ void JKQTPBarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
double delta=1;
double deltap=0;
double deltam=0;
painter.save();
{
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
intSortData();
const bool hasStackPar=hasStackParent();
for (int iii=imin; iii<imax; iii++) {
@ -431,7 +424,7 @@ void JKQTPBarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
}
}
painter.restore();
}
drawErrorsAfter(painter);
}
@ -553,7 +546,7 @@ QBrush JKQTPBarVerticalGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const
QPen JKQTPBarVerticalGraph::getLinePen(JKQTPEnhancedPainter& painter) const {
QPen p;
p.setColor(color);
p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
p.setStyle(style);
p.setJoinStyle(Qt::RoundJoin);
p.setCapStyle(Qt::RoundCap);
@ -590,15 +583,16 @@ void JKQTPBarVerticalGraph::setFillColor_and_darkenedColor(QColor fill, int colo
}
JKQTPBarHorizontalErrorGraph::JKQTPBarHorizontalErrorGraph(JKQTBasePlotter *parent):
JKQTPBarHorizontalGraph(parent), JKQTPXGraphErrors()
JKQTPBarHorizontalGraph(parent), JKQTPXGraphErrors(color, parent)
{
setErrorColorFromGraphColor(color);
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
}
JKQTPBarHorizontalErrorGraph::JKQTPBarHorizontalErrorGraph(JKQTPlotter *parent):
JKQTPBarHorizontalGraph(parent), JKQTPXGraphErrors()
JKQTPBarHorizontalErrorGraph(parent->getPlotter())
{
setErrorColorFromGraphColor(color);
}
bool JKQTPBarHorizontalErrorGraph::usesColumn(int c) const
@ -655,15 +649,17 @@ void JKQTPBarHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter
}
JKQTPBarVerticalErrorGraph::JKQTPBarVerticalErrorGraph(JKQTBasePlotter *parent):
JKQTPBarVerticalGraph(parent), JKQTPYGraphErrors()
JKQTPBarVerticalGraph(parent), JKQTPYGraphErrors(color, parent)
{
setErrorColorFromGraphColor(color);
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
}
JKQTPBarVerticalErrorGraph::JKQTPBarVerticalErrorGraph(JKQTPlotter *parent):
JKQTPBarVerticalGraph(parent), JKQTPYGraphErrors()
JKQTPBarVerticalErrorGraph(parent->getPlotter())
{
setErrorColorFromGraphColor(color);
}
bool JKQTPBarVerticalErrorGraph::usesColumn(int c) const
@ -770,7 +766,7 @@ JKQTPBarVerticalStackableGraph::JKQTPBarVerticalStackableGraph(JKQTBasePlotter *
}
JKQTPBarVerticalStackableGraph::JKQTPBarVerticalStackableGraph(JKQTPlotter *parent):
JKQTPBarVerticalGraph(parent), stackParent(nullptr)
JKQTPBarVerticalStackableGraph(parent->getPlotter())
{
}
@ -827,7 +823,7 @@ JKQTPBarHorizontalStackableGraph::JKQTPBarHorizontalStackableGraph(JKQTBasePlott
}
JKQTPBarHorizontalStackableGraph::JKQTPBarHorizontalStackableGraph(JKQTPlotter *parent):
JKQTPBarHorizontalGraph(parent), stackParent(nullptr)
JKQTPBarHorizontalStackableGraph(parent->getPlotter())
{
}

Some files were not shown because too many files have changed in this diff Show More