- major rework of graph styling (now using mix-in classes)
- some reorganizations into different files - additional options for graph filling (color gradients, textures, ...) as provided by QBrush - PREPARATIONS: added a general feature to JKQTPPlotElement which allows to show a graph in a highlighted state (if supported by the derived graph class!) - JKQTPXYParametrizedScatterGraph: added functors to transform column values into symbol type+size and line-width to give even more control - JKQTPStepHorizontalGraph has been renamed to JKQTPSpecialLineHorizontalGraph (vertical variants also) and have gained additional features (baseline for filling and drawing of symbols) - filled curve graphs (e.g. JKQTPSpecialLineHorizontalGraph) are now merely a specializedly initialized JKQTPSpecialLineHorizontalGraph
@ -21,8 +21,8 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
||||
<td> \subpage JKQTPlotterSymbolsAndStyles
|
||||
<td> `JKQTPXYLineGraph` <br> C++ vector of data <br> setting line styles and symbol styles <br> automatic graph coloring
|
||||
<tr><td> \image html jkqtplotter_simpletest_stepplots_small.png
|
||||
<td> \subpage JKQTPlotterStepPlot
|
||||
<td> `JKQTPStepHorizontalGraph` (and `JKQTPXYLineGraph`) <br> C++ vector of data <br> different step modes, filled and line-only
|
||||
<td> \subpage JKQTPlotterSpecialStepLinePlot
|
||||
<td> `JKQTPSpecialLineHorizontalGraph` <br> C++ vector of data <br> different step/special line modes, filled and line-only
|
||||
<tr><td> \image html jkqtplotter_simpletest_symbols_and_errors_small.png
|
||||
<td> \subpage JKQTPlotterSymbolsErrors
|
||||
<td> `JKQTPXYLineErrorGraph` <br> C-style arrays of data
|
||||
|
@ -115,7 +115,6 @@ derive from JKQTPPlotElement, but from a cass in it's hirarchy of children. Thes
|
||||
|
||||
\subsection jkqtplotter_graphsgroup_classstructure_mixins Mix-In Classes for Graphs
|
||||
|
||||
|
||||
In addition there are mix-in classes that are used via multiple inheritance
|
||||
that add additional features and properties to a graph. A prominent example are the classes for \ref jkqtplotter_basegraphserrors "error indicators".
|
||||
With these there are usually two variants of one type of graph: One without error indicators and one with error indicators, e.g.:
|
||||
@ -136,6 +135,9 @@ mainly used for the \ref jkqtplotter_imagelots "Image/Matrix graphs", but also b
|
||||
\defgroup jkqtplotter_basegraphserrors Mix-In Classes for Error Indicators
|
||||
\ingroup jkqtplotter_basegraphs
|
||||
|
||||
\defgroup jkqtplotter_basegraphs_stylemixins Mix-In Classes for Plot Styling
|
||||
\ingroup jkqtplotter_basegraphs
|
||||
|
||||
\defgroup jkqtplotter_linesymbolgraphs Line/Symbol Graphs
|
||||
\ingroup jkqtplotter_graphsgroup
|
||||
|
||||
@ -155,7 +157,7 @@ This group assembles graphs that show their data with symbols and optionally wit
|
||||
<td> JKQTPXYParametrizedScatterGraph, JKQTPXYParametrizedErrorScatterGraph
|
||||
<tr>
|
||||
<td>\image html jkqtplotter_simpletest_stepplots_small.png
|
||||
<td> JKQTPStepHorizontalGraph, JKQTPStepVerticalGraph
|
||||
<td> JKQTPSpecialLineHorizontalGraph, JKQTPSpecialLineVerticalGraph
|
||||
</table>
|
||||
|
||||
\defgroup jkqtplotter_linesymbolgraphs_simple Basic Line/Scatter Graphs
|
||||
@ -173,7 +175,7 @@ This group assembles graphs that show their data with symbols and optionally wit
|
||||
<td> JKQTPXYLineGraph, JKQTPXYLineErrorGraph
|
||||
<tr>
|
||||
<td>\image html jkqtplotter_simpletest_stepplots_small.png
|
||||
<td> JKQTPStepHorizontalGraph, JKQTPStepVerticalGraph
|
||||
<td> JKQTPSpecialLineHorizontalGraph, JKQTPSpecialLineVerticalGraph
|
||||
</table>
|
||||
|
||||
|
||||
|
@ -16,28 +16,35 @@ Starting in summer 2018, JKQTPlotter received some major workover. During this,
|
||||
|
||||
Changes, compared to \ref WHATSNEW_V2018_08 "v2018.08" include:
|
||||
<ul>
|
||||
<li> update: refactoring of the library's directory structure </li>
|
||||
<li> new: added QMake-Projects for static and for shared library builds </li>
|
||||
<li> update: refactoring/renaming of API, including the function anming scheme and class names </li>
|
||||
<li> new: \ref exampleTutorialProjects "extensive set of Examples and Tutorials" </li>
|
||||
<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> 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> update: refactoring of the library's directory structure </li>
|
||||
<li> update: refactoring/renaming of API, including the function anming scheme and class names </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<> 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>
|
||||
<li> new: Mix-In classes to unify plot styleing functions (setters/getters) in all graphs </li>
|
||||
<li> new: additional options for graph filling (color gradients, textures, ...) as provided by QBrush </li>
|
||||
<li> new: added a general feature to JKQTPPlotElement which allows to show a graph in a highlighted state (if supported by the derived graph class!) </li>
|
||||
<li> new: JKQTPXYParametrizedScatterGraph: added functors to transform column values into symbol type+size and line-width to give even more control </li>
|
||||
<li> changed: removed old selection-code and replaced by general highlighting feature </li>
|
||||
<li> changed: JKQTPStepHorizontalGraph has been renamed to JKQTPSpecialLineHorizontalGraph (vertical variants also) and have gained additional features (baseline for filling and drawing of symbols) </li>
|
||||
<li> changed: filled curve graphs (e.g. JKQTPSpecialLineHorizontalGraph) are now merely a specializedly initialized JKQTPSpecialLineHorizontalGraph </li>
|
||||
<li> deprecated: Removed datarange-feature </li>
|
||||
<li> update: \ref JKQTPLOTTER_USERINTERACTION "reworked user interactions API" </li>
|
||||
<li> fixed: colorbars at top were positioned over the plot label </li>
|
||||
<li> fixed: RGB-image plots now work properly with inverted axes (image is inverted, befor image was not shown at all) </li>
|
||||
</ul></li>
|
||||
<li> Updates to JKQTMathText:
|
||||
|
BIN
doc/images/JKQTPDirectLine.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
doc/images/JKQTPStepAverage.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.7 KiB |
BIN
doc/images/JKQTPXYParametrizedScatterGraph_LinewidthFunctor.png
Normal file
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 48 KiB |
BIN
doc/images/JKQTPXYParametrizedScatterGraph_SymbolFunctor.png
Normal file
After Width: | Height: | Size: 50 KiB |
@ -10,7 +10,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest1_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest/README.md) | [Very Basic Example (Line Graph)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest/README.md) | `JKQTPXYLineGraph` <br> C++-style QVector arrays of data |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_speed_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_speed) | [Line Graph with Live Data / Speed Test](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_speed) | `JKQTPXYLineGraph` <br> external `std::array<double,N>` data, not owned by datastore <br> live-data, measure plotting speed <br> tipps to increas plotting speed |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_symbols_and_styles_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_styles) | [Line Graph with Different Symbols and Line Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_styles) | `JKQTPXYLineGraph` <br> C++ vector of data <br> setting line styles and symbol styles <br> automatic graph coloring |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_stepplots_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stepplots) | [Step Line Plots in Different Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stepplots) | `JKQTPStepHorizontalGraph` (and `JKQTPXYLineGraph`) <br> C++ vector of data <br> different step modes, filled and line-only |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_stepplots_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stepplots) | [Special Step Line Plots in Different Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stepplots) | `JKQTPSpecialLineHorizontalGraph` <br> C++ vector of data <br> different step modes, filled and line-only |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_symbols_and_errors_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_errors) | [Simple Line/Symbol Graph With Errorbars](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_errors) | `JKQTPXYLineErrorGraph` <br> C-style arrays of data |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_errorbarstyles_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_errorbarstyles) | [Different Types of Error Indicators](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_errorbarstyles) | `JKQTPXYLineErrorGraph` <br> different styles of error indicators for x- and y-errors <br> C++-style QVector for data <br> styling error indicators <br> moving key and formatting plotter grid |
|
||||
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_barchart_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_barchart) | [Simple Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_barchart) | `JKQTPBarVerticalGraph` <br> C-style arrays of data |
|
||||
|
@ -22,7 +22,7 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
|
||||
pfunc->setFunction("x^2/10+sin(x*pi*10)");
|
||||
pfunc->setErrorFunction("x^2/20");
|
||||
pfunc->setDrawErrorPolygons(true);
|
||||
pfunc->setStyle(Qt::DashLine);
|
||||
pfunc->setLineStyle(Qt::DashLine);
|
||||
plotFuncPlt->addGraph(pfunc);
|
||||
plotFuncPlt->redrawPlot();
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <QDate>
|
||||
#include <QDateTime>
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsboxplot.h"
|
||||
#include "jkqtplotter/jkqtpgraphsfilledcurve.h"
|
||||
#include "jkqtplottergui/jkqtpcomboboxes.h"
|
||||
@ -122,7 +122,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
||||
pltePlot2->setDrawLine(true);
|
||||
pltePlot2->setYErrorColumn(cy21re);
|
||||
pltePlot2->setYErrorStyle(JKQTPErrorBarsPolygons);
|
||||
pltePlot2->setSymbol(JKQTPFilledStar);
|
||||
pltePlot2->setSymbolType(JKQTPFilledStar);
|
||||
plotBot->getPlotter()->addGraph(pltePlot2);
|
||||
plotBot->zoomToFit();
|
||||
|
||||
@ -191,7 +191,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
||||
|
||||
/*JKQTPYFunctionLineGraph* g=new JKQTPYFunctionLineGraph(&plot);
|
||||
g->setTitle("function 1");
|
||||
g->setPlotFunction(f1);
|
||||
g->setPlotFunctionFunctor(f1);
|
||||
g->setErrorFunction(f1e);
|
||||
g->setDrawErrorLines(true);
|
||||
g->setDrawErrorPolygons(false);
|
||||
@ -200,10 +200,10 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
||||
|
||||
/*JKQTPXFunctionLineGraph* g=new JKQTPXFunctionLineGraph(&plot);
|
||||
g->setTitle("function 2");
|
||||
g->setPlotFunction(f2);
|
||||
g->setPlotFunctionFunctor(f2);
|
||||
plot->addGraph(g);*/
|
||||
|
||||
/*JKQTPStepVerticalGraph* g=new JKQTPStepVerticalGraph(&plot);
|
||||
/*JKQTPSpecialLineVerticalGraph* g=new JKQTPSpecialLineVerticalGraph(&plot);
|
||||
g->setXColumn(cy11);
|
||||
g->setYColumn(cx1);
|
||||
g->setFillCurve(true);
|
||||
@ -232,7 +232,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
||||
layout->addWidget(chkInvertX);
|
||||
layout->addWidget(chkInvertY);
|
||||
JKQTPSymbolComboBox* cmbJKQTPPlotSymbol=new JKQTPSymbolComboBox(this);
|
||||
cmbJKQTPPlotSymbol->setSymbol(JKQTPPlus);
|
||||
cmbJKQTPPlotSymbol->setSymbolType(JKQTPPlus);
|
||||
connect(cmbJKQTPPlotSymbol, SIGNAL(currentIndexChanged(int)), this, SLOT(setESSymbol(int)));
|
||||
layout->addWidget(cmbJKQTPPlotSymbol);
|
||||
JKQTPErrorPlotstyleComboBox* cmbErrors=new JKQTPErrorPlotstyleComboBox(this);
|
||||
@ -321,7 +321,7 @@ void TestWidgetGraphs::setESSymbol(int /*index*/)
|
||||
if (cmb) {
|
||||
JKQTPXYLineGraph* exy=dynamic_cast<JKQTPXYLineGraph*>(plteSymbols);
|
||||
if (exy) {
|
||||
exy->setSymbol(String2JKQTPGraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
|
||||
exy->setSymbolType(String2JKQTPGraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
|
||||
}
|
||||
|
||||
plot->redrawPlot();
|
||||
|
@ -87,7 +87,7 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
|
||||
|
||||
JKQTPOverlayImageEnhanced* oimg2=new JKQTPOverlayImageEnhanced(10,0,10,10, bimg2, 100, 100, QColor("red"), plotImg->getPlotter());
|
||||
oimg2->setTitle("enhanced overlay");
|
||||
oimg2->setDrawAsRectangles(false);
|
||||
oimg2->setDrawMode(JKQTPOverlayImageEnhanced::DrawAsSymbols);
|
||||
plotImg->getPlotter()->addGraph(oimg2);
|
||||
|
||||
plotImg->setPlotUpdateEnabled(true);
|
||||
|
@ -44,10 +44,18 @@ TestWidgetPeaksPlots::TestWidgetPeaksPlots(QWidget *parent) :
|
||||
int phot1=plotPeaks->getDatastore()->addCopiedColumn(photons1, "photons 1");
|
||||
int phot2=plotPeaks->getDatastore()->addCopiedColumn(photons2, "photons 2");
|
||||
|
||||
graphPeakStream1=new JKQTPPeakStreamGraph(phot1, 0.05, 1, QColor("darkgreen"), plotPeaks->getPlotter());
|
||||
graphPeakStream1=new JKQTPPeakStreamGraph(plotPeaks->getPlotter());
|
||||
graphPeakStream1->setDataColumn(phot1);
|
||||
graphPeakStream1->setColor(QColor("darkgreen"));
|
||||
graphPeakStream1->setPeakHeight(1);
|
||||
graphPeakStream1->setBaseline(0.05);
|
||||
graphPeakStream1->setTitle("channel 1");
|
||||
plotPeaks->getPlotter()->addGraph(graphPeakStream1);
|
||||
graphPeakStream2=new JKQTPPeakStreamGraph(phot2, -0.05, -1, QColor("darkred"), plotPeaks->getPlotter());
|
||||
graphPeakStream2=new JKQTPPeakStreamGraph(plotPeaks->getPlotter());
|
||||
graphPeakStream2->setDataColumn(phot2);
|
||||
graphPeakStream2->setColor(QColor("darkred"));
|
||||
graphPeakStream2->setPeakHeight(-1);
|
||||
graphPeakStream2->setBaseline(-0.05);
|
||||
graphPeakStream2->setTitle("channel 2");
|
||||
plotPeaks->getPlotter()->addGraph(graphPeakStream2);
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbarchart.h"
|
||||
|
||||
#define Ndata 5
|
||||
|
@ -82,7 +82,7 @@ In addition to the simple box plots, the image above also shows outliers as smal
|
||||
graphOutliers->setColor(graph->getColor().darker());
|
||||
graphOutliers->setFillColor(QColor("white"));
|
||||
// draw outliers as small circles, without lines
|
||||
graphOutliers->setSymbol(JKQTPCircle);
|
||||
graphOutliers->setSymbolType(JKQTPCircle);
|
||||
graphOutliers->setDrawLine(false);
|
||||
graphOutliers->setSymbolSize(7);
|
||||
```
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsboxplot.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@ -64,9 +64,9 @@ int main(int argc, char* argv[])
|
||||
graphOutliers->setTitle("outliers");
|
||||
// make the color a darker shade of the color of graph
|
||||
graphOutliers->setColor(graph->getColor().darker());
|
||||
graphOutliers->setFillColor(QColor("white"));
|
||||
graphOutliers->setSymbolFillColor(QColor("white"));
|
||||
// draw outliers as small circles, without lines
|
||||
graphOutliers->setSymbol(JKQTPCircle);
|
||||
graphOutliers->setSymbolType(JKQTPCircle);
|
||||
graphOutliers->setDrawLine(false);
|
||||
graphOutliers->setSymbolSize(7);
|
||||
|
||||
|
@ -79,7 +79,7 @@ On top of that plot, a second plot is added, which draws the average temperature
|
||||
|
||||
// 6. average data
|
||||
// don't use symbols
|
||||
graphTemperature->setSymbol(JKQTPNoSymbol);
|
||||
graphTemperature->setSymbolType(JKQTPNoSymbol);
|
||||
// set the line width
|
||||
graphTemperature->setLineWidth(1);
|
||||
// draw small symbols
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsgeometric.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplotter/jkqtpgraphsfilledcurve.h"
|
||||
@ -57,7 +57,7 @@ void drawWithDateAxis(JKQTPlotter& plot) {
|
||||
|
||||
// 5. min/max range data
|
||||
// graph fill color is a lighter shade of the average graph
|
||||
graphTemperatureRange->setFillColor(graphTemperature->getColor().lighter());
|
||||
graphTemperatureRange->setFillColor(graphTemperature->getLineColor().lighter());
|
||||
// don't draw lines of the data
|
||||
graphTemperatureRange->setDrawLine(false);
|
||||
// plot label in key
|
||||
@ -67,7 +67,7 @@ void drawWithDateAxis(JKQTPlotter& plot) {
|
||||
|
||||
// 6. average data
|
||||
// don't use symbols
|
||||
graphTemperature->setSymbol(JKQTPNoSymbol);
|
||||
graphTemperature->setSymbolType(JKQTPNoSymbol);
|
||||
// set the line width
|
||||
graphTemperature->setLineWidth(1);
|
||||
// draw small symbols
|
||||
@ -134,7 +134,7 @@ void drawWithTimeAxis(JKQTPlotter& plot) {
|
||||
|
||||
// 6. average data
|
||||
// don't use symbols
|
||||
graphTemperature->setSymbol(JKQTPCross);
|
||||
graphTemperature->setSymbolType(JKQTPCross);
|
||||
// set the line width
|
||||
graphTemperature->setLineWidth(1);
|
||||
// draw small symbols
|
||||
|
@ -50,12 +50,12 @@ First some data is added to the internal datastore (mostly, like explained in se
|
||||
|
||||
|
||||
// set symbol (cross/X) + pen style (and color)dashed)
|
||||
graph->setSymbol(JKQTPCross);
|
||||
graph->setStyle(Qt::DashLine);
|
||||
graph->setSymbolType(JKQTPCross);
|
||||
graph->setLineStyle(Qt::DashLine);
|
||||
// set symbol size
|
||||
graph->setSymbolSize(5);
|
||||
// set width of symbol lines
|
||||
graph->setSymbolWidth(1);
|
||||
graph->setSymbolLineWidth(1);
|
||||
// set width of graph line
|
||||
graph->setLineWidth(1);
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
|
||||
|
||||
@ -79,12 +79,12 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
// set symbol (cross/X) + pen style (and color)dashed)
|
||||
graph->setSymbol(JKQTPCross);
|
||||
graph->setStyle(Qt::DashLine);
|
||||
graph->setSymbolType(JKQTPCross);
|
||||
graph->setLineStyle(Qt::DashLine);
|
||||
// set symbol size
|
||||
graph->setSymbolSize(5);
|
||||
// set width of symbol lines
|
||||
graph->setSymbolWidth(1);
|
||||
graph->setSymbolLineWidth(1);
|
||||
// set width of graph line
|
||||
graph->setLineWidth(1);
|
||||
|
||||
|
@ -6,7 +6,7 @@ This project (see `./examples/simpletest_functionplot/`) demonstrates how to plo
|
||||
The first example shows how to plot a C++ inline function:
|
||||
```.cpp
|
||||
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
|
||||
func1->setPlotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
||||
func1->setPlotFunctionFunctor([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
||||
func1->setTitle("C++-inline function $0.2x^2-0.015x^3$");
|
||||
plot->addGraph(func1);
|
||||
```
|
||||
@ -15,7 +15,7 @@ The first example shows how to plot a C++ inline function:
|
||||
In any such plot function, you can also use parameters, provided via the second parameter. Usually these are "internal parameters", defined by `func2->setParamsV(p0, p1, ...)`:
|
||||
```.cpp
|
||||
JKQTPXFunctionLineGraph* func2=new JKQTPXFunctionLineGraph(plot);
|
||||
func2->setPlotFunction([](double x, void* params) {
|
||||
func2->setPlotFunctionFunctor([](double x, void* params) {
|
||||
QVector<double>* p=static_cast<QVector<double>*>(params);
|
||||
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
||||
});
|
||||
@ -28,7 +28,7 @@ In any such plot function, you can also use parameters, provided via the second
|
||||
... but generally any pointer can be used as parameter (the set by `setParameter(static_cast<void*>(myDataObject))`):
|
||||
```.cpp
|
||||
JKQTPXFunctionLineGraph* func3=new JKQTPXFunctionLineGraph(plot);
|
||||
func3->setPlotFunction([](double x, void* params) {
|
||||
func3->setPlotFunctionFunctor([](double x, void* params) {
|
||||
QMap<QString,double>* p=static_cast<QMap<QString,double>*>(params);
|
||||
return p->value("amplitude")*sin(2.0*M_PI*x*p->value("frequency"));
|
||||
});
|
||||
@ -57,7 +57,7 @@ You can also use C++ functors (or function objects):
|
||||
// ...
|
||||
|
||||
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
|
||||
func4->setPlotFunction(SincSqr(-8));
|
||||
func4->setPlotFunctionFunctor(SincSqr(-8));
|
||||
func4->setTitle("C++ functor $-8*\\sin^2(x)/x^2$");
|
||||
plot->addGraph(func4);
|
||||
```
|
||||
@ -72,7 +72,7 @@ You can also plot simple static C functions:
|
||||
// ...
|
||||
|
||||
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
|
||||
func5->setPlotFunction(&sinc);
|
||||
func5->setPlotFunctionFunctor(&sinc);
|
||||
func5->setTitle("static C function $10*\\sin(x)/x$");
|
||||
plot->addGraph(func5);
|
||||
```
|
||||
|
@ -39,7 +39,7 @@ int main(int argc, char* argv[])
|
||||
// 2. now we add a JKQTPXFunctionLineGraph object, which will draw a simple function
|
||||
// the function is defined as C++ inline function
|
||||
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
|
||||
func1->setPlotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
||||
func1->setPlotFunctionFunctor([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
||||
func1->setTitle("C++-inline function $0.2x^2-0.015x^3$");
|
||||
plot->addGraph(func1);
|
||||
|
||||
@ -47,7 +47,7 @@ int main(int argc, char* argv[])
|
||||
// the function is again defined as C++ inline function, but now uses internal
|
||||
// parameters (handed over to the function as a pointer to QVector<double>
|
||||
JKQTPXFunctionLineGraph* func2=new JKQTPXFunctionLineGraph(plot);
|
||||
func2->setPlotFunction([](double x, void* params) {
|
||||
func2->setPlotFunctionFunctor([](double x, void* params) {
|
||||
QVector<double>* p=static_cast<QVector<double>*>(params);
|
||||
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
||||
});
|
||||
@ -60,7 +60,7 @@ int main(int argc, char* argv[])
|
||||
// the function is again defined as C++ inline function, but now uses external
|
||||
// parameters, which may have any type (here QMap<QString,double)
|
||||
JKQTPXFunctionLineGraph* func3=new JKQTPXFunctionLineGraph(plot);
|
||||
func3->setPlotFunction([](double x, void* params) {
|
||||
func3->setPlotFunctionFunctor([](double x, void* params) {
|
||||
QMap<QString,double>* p=static_cast<QMap<QString,double>*>(params);
|
||||
return p->value("amplitude")*sin(2.0*M_PI*x*p->value("frequency"));
|
||||
});
|
||||
@ -74,14 +74,14 @@ int main(int argc, char* argv[])
|
||||
|
||||
// 5. of course the function may also be any C+ funtor object:
|
||||
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
|
||||
func4->setPlotFunction(SincSqr(-8));
|
||||
func4->setPlotFunctionFunctor(SincSqr(-8));
|
||||
func4->setTitle("C++ functor $-8*\\sin^2(x)/x^2$");
|
||||
plot->addGraph(func4);
|
||||
|
||||
|
||||
// 6. now we use a JKQTPXFunctionLineGraph to draw a static C function
|
||||
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
|
||||
func5->setPlotFunction(&sinc);
|
||||
func5->setPlotFunctionFunctor(&sinc);
|
||||
func5->setTitle("static C function $10*\\sin(x)/x$");
|
||||
plot->addGraph(func5);
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <QApplication>
|
||||
#include <cmath>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimage.h"
|
||||
#include "jkqtplotter/jkqtpopencvinterface.h"
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
@ -50,4 +50,24 @@ This code snippet results in a plot like this:
|
||||
|
||||
![jkqtplotter_simpletest_impulsesplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_impulsesplot_horizontal.png)
|
||||
|
||||
The classes `JKQTPImpulsesVerticalGraph` and `JKQTPImpulsesHorizontalGraph` also provide the ability to draw a symbol at the end of the impulse, e.g. using this code:
|
||||
|
||||
```.cpp
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPFilledStar);
|
||||
```
|
||||
|
||||
This code snippet results in a plot like this:
|
||||
|
||||
![jkqtplotter_simpletest_impulsesplot_symbols](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_impulsesplot_symbols.png)
|
||||
|
||||
Finally you can move the baseline (i.e. the level, where the impulses start, which is typically x=0 or y=0) in the classes `JKQTPImpulsesVerticalGraph` and `JKQTPImpulsesHorizontalGraph`:
|
||||
|
||||
```.cpp
|
||||
graph->setBaseline(0.25);
|
||||
```
|
||||
|
||||
This code snippet results in a plot like this:
|
||||
|
||||
![jkqtplotter_simpletest_impulsesplot_baseline](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_impulsesplot_baseline.png)
|
||||
|
||||
|
@ -38,6 +38,9 @@ int main(int argc, char* argv[])
|
||||
graph->setLineWidth(2);
|
||||
graph->setColor(QColor("red"));
|
||||
graph->setTitle(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
|
||||
//graph->setDrawSymbols(true);
|
||||
//graph->setSymbolType(JKQTPGraphSymbols::JKQTPFilledStar);
|
||||
//graph->setBaseline(0.25);
|
||||
|
||||
// 5. add the graph to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Example (JKQTPlotter): Line Graph with Logarithmic y-axis {#JKQTPlotterLogAxes}
|
||||
This project (see `./examples/simpletest_logaxes/`) simply creates a JKQTPlotter widget (as a new window) and several line-graphs of different resonance curves.
|
||||
|
||||
The source code of the main application can be found in [`jkqtplotter_simpletest_logaxes.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp). Mainly several graphs are generated in a loop and then different line styles are applied to the graphs (set by ``graph->setStyle()`). The colors are set automtically from an internal default palette. The main loop looks like this:
|
||||
The source code of the main application can be found in [`jkqtplotter_simpletest_logaxes.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp). Mainly several graphs are generated in a loop and then different line styles are applied to the graphs (set by ``graph->setLineStyle()`). The colors are set automtically from an internal default palette. The main loop looks like this:
|
||||
|
||||
```.cpp
|
||||
QVector<Qt::PenStyle> pens {Qt::SolidLine, Qt::DashLine, Qt::DotLine, Qt::DashDotLine, Qt::DashDotDotLine };
|
||||
@ -19,9 +19,9 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
||||
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
||||
|
||||
// don't use symbols
|
||||
graph->setSymbol(JKQTPNoSymbol);
|
||||
graph->setSymbolType(JKQTPNoSymbol);
|
||||
// use one of different pens
|
||||
graph->setStyle(pens[id%pens.size()]);
|
||||
graph->setLineStyle(pens[id%pens.size()]);
|
||||
// set width of graph line
|
||||
graph->setLineWidth(1.5);
|
||||
|
||||
@ -44,7 +44,7 @@ Then a `JKQTPGeoText` is added to the graph, which shows the function plotted in
|
||||
// and loaded in the library). If you don't use the math-mode modifiers, the default
|
||||
// font of the other rendering text is used, which might not be suitable for
|
||||
// high-quality math rendering.
|
||||
plot.addGraph(new JKQTPGeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15));
|
||||
plot.addGraph(new JKQTPGeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15, QColor("black")));
|
||||
```
|
||||
The difference between not using and using `$...$` for the equation can be seen here:
|
||||
- no $-math-mode: ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_logaxes_lowqmathrendering.png)
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsgeometric.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
|
||||
@ -49,9 +49,9 @@ int main(int argc, char* argv[])
|
||||
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
||||
|
||||
// don't use symbols
|
||||
graph->setSymbol(JKQTPNoSymbol);
|
||||
graph->setSymbolType(JKQTPNoSymbol);
|
||||
// use one of different pens
|
||||
graph->setStyle(pens[id%pens.size()]);
|
||||
graph->setLineStyle(pens[id%pens.size()]);
|
||||
// set width of graph line
|
||||
graph->setLineWidth(1.5);
|
||||
|
||||
@ -71,7 +71,7 @@ int main(int argc, char* argv[])
|
||||
// and loaded in the library). If you don't use the math-mode modifiers, the default
|
||||
// font of the other rendering text is used, which might not be suitable for
|
||||
// high-quality math rendering.
|
||||
plot.addGraph(new JKQTPGeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15));
|
||||
plot.addGraph(new JKQTPGeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15, QColor("black")));
|
||||
|
||||
// 5. set y-axis to logarithmic (x-axis would be analogous, but using `plot.getXAxis()`)
|
||||
plot.getYAxis()->setLogAxis(true);
|
||||
|
@ -28,7 +28,7 @@ Then simples graph just uses the columns X and Y to plot the curve:
|
||||
graph1->setXColumn(columnX);
|
||||
graph1->setYColumn(columnY);
|
||||
graph1->setDrawLine(true);
|
||||
graph1->setSymbol(JKQTPNoSymbol);
|
||||
graph1->setSymbolType(JKQTPNoSymbol);
|
||||
graph1->setTitle("one-colored spiral");
|
||||
plot.addGraph(graph1);
|
||||
```
|
||||
@ -40,7 +40,7 @@ If you use `JKQTPXYParametrizedScatterGraph` instead of `JKQTPXYLineGraph`, you
|
||||
graph2->setYColumn(columnY);
|
||||
graph2->setColorColumn(columnR);
|
||||
graph2->setPalette(JKQTPMathImageMATLAB);
|
||||
graph2->setSymbol(JKQTPNoSymbol);
|
||||
graph2->setSymbolType(JKQTPNoSymbol);
|
||||
graph2->setDrawLine(true);
|
||||
graph2->setTitle("colored spiral");
|
||||
graph2->getColorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@ -46,7 +46,7 @@ int main(int argc, char* argv[])
|
||||
graph1->setXColumn(columnX);
|
||||
graph1->setYColumn(columnY);
|
||||
graph1->setDrawLine(true);
|
||||
graph1->setSymbol(JKQTPNoSymbol);
|
||||
graph1->setSymbolType(JKQTPNoSymbol);
|
||||
graph1->setTitle("one-colored spiral");
|
||||
plot.addGraph(graph1);
|
||||
|
||||
@ -57,7 +57,7 @@ int main(int argc, char* argv[])
|
||||
graph2->setYColumn(columnY);
|
||||
graph2->setColorColumn(columnR);
|
||||
graph2->setPalette(JKQTPMathImageMATLAB);
|
||||
graph2->setSymbol(JKQTPNoSymbol);
|
||||
graph2->setSymbolType(JKQTPNoSymbol);
|
||||
graph2->setDrawLine(true);
|
||||
graph2->setTitle("colored spiral");
|
||||
graph2->getColorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
|
||||
|
@ -31,7 +31,7 @@ The next two code snippets show how to modify the size of the symbols and the li
|
||||
graph3->setXColumn(columnX);
|
||||
graph3->setYColumn(columnY3);
|
||||
graph3->setSizeColumn(columnS);
|
||||
graph3->setSymbol(JKQTPFilledCircle);
|
||||
graph3->setSymbolType(JKQTPFilledCircle);
|
||||
graph3->setDrawLine(true);
|
||||
graph3->setTitle("3: symbol size");
|
||||
plot.addGraph(graph3);
|
||||
@ -42,7 +42,7 @@ The next two code snippets show how to modify the size of the symbols and the li
|
||||
graph6->setYColumn(columnY6);
|
||||
graph6->setLinewidthColumn(columnLW);
|
||||
graph6->setDrawLine(true);
|
||||
graph6->setSymbol(JKQTPNoSymbol);
|
||||
graph6->setSymbolType(JKQTPNoSymbol);
|
||||
graph6->setTitle("6: line width");
|
||||
plot.addGraph(graph6);
|
||||
```
|
||||
@ -68,7 +68,7 @@ Now you can add the graph. In order to interpret the color column as RGB(A)-valu
|
||||
graph4->setColorColumn(columnRGB);
|
||||
graph4->setColorColumnContainsRGB(true);
|
||||
graph4->setDrawLine(true);
|
||||
graph4->setSymbol(JKQTPFilledDownTriangle);
|
||||
graph4->setSymbolType(JKQTPFilledDownTriangle);
|
||||
graph4->setTitle("4: RGB-color");
|
||||
plot.addGraph(graph4);
|
||||
```
|
||||
@ -80,7 +80,7 @@ The second variant for setting the color of each datapoint is by mapping the val
|
||||
graph2->setYColumn(columnY2);
|
||||
graph2->setColorColumn(columnC);
|
||||
graph2->setPalette(JKQTPMathImageRYGB);
|
||||
graph2->setSymbol(JKQTPFilledRect);
|
||||
graph2->setSymbolType(JKQTPFilledRect);
|
||||
graph2->setDrawLine(true);
|
||||
graph2->setTitle("2: color");
|
||||
graph2->getColorBarRightAxis()->setAxisLabel("color scale for graph2");
|
||||
@ -109,4 +109,53 @@ The full test appication combines all these variants and the result looks like t
|
||||
![jkqtplotter_simpletest_paramscatterplot](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_paramscatterplot.png)
|
||||
|
||||
|
||||
In `` you can also set special functors that transform the values from the data columns (symbol type+size, datapoint), before using them for the plot, which gives you even more control. As an example you can set a special functor to `graph6`:
|
||||
|
||||
```.cpp
|
||||
graph6->setLinewidthColumnFunctor([](double x, double y, double w) {
|
||||
return fabs(sin(w/3.0)*25.0);
|
||||
});
|
||||
```
|
||||
|
||||
This will result in modulated linewidths as shown below:
|
||||
|
||||
![JKQTPXYParametrizedScatterGraph_LinewidthFunctor.png](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPXYParametrizedScatterGraph_LinewidthFunctor.png)
|
||||
|
||||
|
||||
The same can be done for symbol type, e.g. with code like this:
|
||||
|
||||
```.cpp
|
||||
graph1->setSymbolColumnFunctor([](double x, double y, double sym) -> JKQTPGraphSymbols {
|
||||
if (sym<Ndata/2) {
|
||||
return JKQTPGraphSymbols::JKQTPCircle;
|
||||
} else if (sym>Ndata/2) {
|
||||
return JKQTPGraphSymbols::JKQTPFilledCircle;
|
||||
} else {
|
||||
return JKQTPGraphSymbols::JKQTPPlus;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
This will result in symbols as shown below:
|
||||
|
||||
![JKQTPXYParametrizedScatterGraph_SymbolFunctor.png](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPXYParametrizedScatterGraph_SymbolFunctor.png)
|
||||
|
||||
As an alternaitve for symbols, you can define the functor also in terms of a QMap:
|
||||
|
||||
```.cpp
|
||||
graph1->setSymbolColumnFunctor([](double x, double y, double sym) -> JKQTPGraphSymbols {
|
||||
if (sym<Ndata/2) {
|
||||
return JKQTPGraphSymbols::JKQTPCircle;
|
||||
} else if (sym>Ndata/2) {
|
||||
return JKQTPGraphSymbols::JKQTPFilledCircle;
|
||||
} else {
|
||||
return JKQTPGraphSymbols::JKQTPPlus;
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
This will result in symbols as shown below:
|
||||
|
||||
![JKQTPXYParametrizedScatterGraph_MappedSymbolFunctor.png](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/JKQTPXYParametrizedScatterGraph_MappedSymbolFunctor.png)
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@ -66,6 +66,20 @@ int main(int argc, char* argv[])
|
||||
graph1->setDrawLine(true);
|
||||
graph1->setColor(QColor("blueviolet"));
|
||||
graph1->setTitle("1: symbol type");
|
||||
/*graph1->setSymbolColumnFunctor([](double x, double y, double sym) -> JKQTPGraphSymbols {
|
||||
if (sym<Ndata/2) {
|
||||
return JKQTPGraphSymbols::JKQTPCircle;
|
||||
} else if (sym>Ndata/2) {
|
||||
return JKQTPGraphSymbols::JKQTPFilledCircle;
|
||||
} else {
|
||||
return JKQTPGraphSymbols::JKQTPPlus;
|
||||
}
|
||||
});*/
|
||||
/*QMap<double, JKQTPGraphSymbols> mapped;
|
||||
mapped[0]=JKQTPGraphSymbols::JKQTPCircle;
|
||||
mapped[5]=JKQTPGraphSymbols::JKQTPFilledCircle;
|
||||
mapped[10]=JKQTPGraphSymbols::JKQTPPlus;
|
||||
graph1->setMappedSymbolColumnFunctor(mapped);*/
|
||||
plot.addGraph(graph1);
|
||||
|
||||
// 3.2 for graph2, we use dataset X/Y2
|
||||
@ -76,7 +90,7 @@ int main(int argc, char* argv[])
|
||||
graph2->setYColumn(columnY2);
|
||||
graph2->setColorColumn(columnC);
|
||||
graph2->setPalette(JKQTPMathImageRYGB);
|
||||
graph2->setSymbol(JKQTPFilledRect);
|
||||
graph2->setSymbolType(JKQTPFilledRect);
|
||||
graph2->setDrawLine(true);
|
||||
graph2->setTitle("2: color");
|
||||
graph2->getColorBarRightAxis()->setAxisLabel("color scale for graph2");
|
||||
@ -88,7 +102,7 @@ int main(int argc, char* argv[])
|
||||
graph3->setXColumn(columnX);
|
||||
graph3->setYColumn(columnY3);
|
||||
graph3->setSizeColumn(columnS);
|
||||
graph3->setSymbol(JKQTPFilledCircle);
|
||||
graph3->setSymbolType(JKQTPFilledCircle);
|
||||
graph3->setDrawLine(true);
|
||||
graph3->setTitle("3: symbol size");
|
||||
plot.addGraph(graph3);
|
||||
@ -102,7 +116,7 @@ int main(int argc, char* argv[])
|
||||
graph4->setColorColumn(columnRGB);
|
||||
graph4->setColorColumnContainsRGB(true);
|
||||
graph4->setDrawLine(true);
|
||||
graph4->setSymbol(JKQTPFilledDownTriangle);
|
||||
graph4->setSymbolType(JKQTPFilledDownTriangle);
|
||||
graph4->setTitle("4: RGB-color");
|
||||
plot.addGraph(graph4);
|
||||
|
||||
@ -128,8 +142,11 @@ int main(int argc, char* argv[])
|
||||
graph6->setYColumn(columnY6);
|
||||
graph6->setLinewidthColumn(columnLW);
|
||||
graph6->setDrawLine(true);
|
||||
graph6->setSymbol(JKQTPNoSymbol);
|
||||
graph6->setSymbolType(JKQTPNoSymbol);
|
||||
graph6->setTitle("6: line width");
|
||||
/*graph6->setLinewidthColumnFunctor([](double x, double y, double w) {
|
||||
return fabs(sin(w/3.0)*25.0);
|
||||
});*/
|
||||
plot.addGraph(graph6);
|
||||
|
||||
// 3.7 for graph2, we use dataset X/Y7
|
||||
@ -141,7 +158,7 @@ int main(int argc, char* argv[])
|
||||
graph7->setDrawLine(true);
|
||||
graph7->setColorColumn(columnC);
|
||||
graph7->setPalette(JKQTPMathImageBLUEYELLOW);
|
||||
graph7->setSymbol(JKQTPNoSymbol);
|
||||
graph7->setSymbolType(JKQTPNoSymbol);
|
||||
graph7->setColorBarRightVisible(false);
|
||||
graph7->setColorBarTopVisible(false);
|
||||
graph7->setTitle("7: color+line width");
|
||||
|
@ -37,7 +37,7 @@ Now we can use th datavectors to add a `JKQTPXYParametrizedScatterGraph`:
|
||||
graph1->setXColumn(columnX);
|
||||
graph1->setYColumn(columnY);
|
||||
graph1->setSizeColumn(columnS);
|
||||
graph1->setSymbol(JKQTPFilledCircle);
|
||||
graph1->setSymbolType(JKQTPFilledCircle);
|
||||
graph1->setColorColumn(columnG);
|
||||
graph1->setPalette(JKQTPMathImageMATLAB);
|
||||
graph1->setDrawLine(false);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimage.h"
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ int main(int argc, char* argv[])
|
||||
graph1->setYColumn(columnY);
|
||||
graph1->setSizeColumn(columnS);
|
||||
graph1->setSymbolColumn(columnS);
|
||||
graph1->setSymbol(JKQTPFilledTriangle);
|
||||
graph1->setSymbolType(JKQTPFilledTriangle);
|
||||
graph1->setColorColumn(columnG);
|
||||
graph1->setPalette(JKQTPMathImageOCEAN);
|
||||
graph1->setDrawLine(false);
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <QFormLayout>
|
||||
#include <QDoubleSpinBox>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <QApplication>
|
||||
#include <cmath>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimagergb.h"
|
||||
#include "jkqtplotter/jkqtpopencvinterface.h"
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <QApplication>
|
||||
#include <cmath>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimagergb.h"
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <array>
|
||||
#include <random>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "speedtestplot.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "speedtestplot.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
|
||||
|
||||
SpeedTestPlot::SpeedTestPlot():
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbarchart.h"
|
||||
|
||||
|
||||
|
@ -1,53 +1,50 @@
|
||||
# Example (JKQTPlotter): Step Line Plots in Different Styles {#JKQTPlotterStepPlot}
|
||||
# Example (JKQTPlotter): Step Line Plots in Different Styles {#JKQTPlotterSpecialStepLinePlot}
|
||||
This project (see `./examples/simpletest_stepplots/`) simply creates a JKQTPlotter widget (as a new window) and adds a single line-graph (a sine-wave). Data is initialized from two QVector<double> objects.
|
||||
|
||||
The source code of the main application can be found in [`jkqtplotter_simpletest_stepplots.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.cpp). For the most part, several datasets of cosine-curves are generated. then thrre tuples of graphs are added: One of type `JKQTPXYLineGraph`, which simply indicates the location of the actual datapoints. the second is of type `JKQTPStepHorizontalGraph`, which adds the step-graph to the plot:
|
||||
The source code of the main application can be found in [`jkqtplotter_simpletest_stepplots.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.cpp). For the most part, several datasets of cosine-curves are generated. Then graphs of type `JKQTPSpecialLineHorizontalGraph` are added to the plot:
|
||||
|
||||
```.cpp
|
||||
// 3 now we make several plots with different step styles, each one also contains a
|
||||
// symbol plot indicating the location of the datapoints themselves
|
||||
JKQTPStepHorizontalGraph* graph;
|
||||
JKQTPXYLineGraph* graphL;
|
||||
JKQTPSpecialLineHorizontalGraph* graph;
|
||||
|
||||
//-- JKQTPStepLeft ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPStepHorizontalGraph(&plot);
|
||||
graphL=new JKQTPXYLineGraph(&plot);
|
||||
graph=new JKQTPSpecialLineHorizontalGraph(&plot);
|
||||
|
||||
// set data for both graphs
|
||||
graph->setXColumn(columnX); graphL->setXColumn(graph->getXColumn());
|
||||
graph->setYColumn(columnY1); graphL->setYColumn(graph->getYColumn());
|
||||
// set data for the graph
|
||||
graph->setXColumn(columnX);
|
||||
graph->setYColumn(columnY1);
|
||||
|
||||
// set step style
|
||||
graph->setStepType(JKQTPStepLeft);
|
||||
graph->setSpecialLineType(JKQTPStepLeft);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(true);
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPStepLeft, filled");
|
||||
```
|
||||
Note that you can configure the step type (left/center/right by `graph->setStepType(JKQTPStepLeft)`. With `graph->setFillCurve(true)` you can draw the curve filled until the y=0-axis and with `graph->setDrawLine(true)` you can switch the line along the values on and off (e.g. to only have the filled area, but no line).
|
||||
|
||||
Finally the `JKQTPXYLineGraph` is configured:
|
||||
```.cpp
|
||||
// set symbol + pen style and color for the added circles, copy color
|
||||
graphL->setSymbol(JKQTPGraphSymbols::JKQTPCircle);
|
||||
graphL->setDrawLine(false);
|
||||
graphL->setSymbolSize(9);
|
||||
graphL->setSymbolWidth(1);
|
||||
graphL->setColor(graph->getColor());
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
```
|
||||
Note that you can configure the step type (left/center/right by `graph->setSpecialLineType(JKQTPStepLeft)`. With `graph->setFillCurve(true)` you can draw the curve filled until the y=0-axis and with `graph->setDrawLine(true)` you can switch the line along the values on and off (e.g. to only have the filled area, but no line). With `graph->setDrawSymbols(true)` you can switch on drawing of symbols at the location of the data points.
|
||||
|
||||
... and all graphs are added to the plot:
|
||||
```.cpp
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
plot.addGraph(graphL);
|
||||
```
|
||||
|
||||
In addition to the symbol type and line style, you can also alter the size of the symbols (`graph->setSymbolSize(14)`), the line-width used to draw them (`graph->setSymbolWidth(1.5)`) and the line width of the graph line (`graph->setLineWidth(1)`). If you want to switch off the line altogether, use `graph->setDrawLine(false`.
|
||||
In addition to the symbol type and line style, you can also alter the size of the symbols (`graph->setSymbolSize(14)`), the line-width used to draw them (`graph->setSymbolLineWidth(1.5)`) and the line width of the graph line (`graph->setLineWidth(1)`). If you want to switch off the line altogether, use `graph->setDrawLine(false`.
|
||||
|
||||
The result looks like this:
|
||||
|
||||
![jkqtplotter_simpletest_stepplots](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_stepplots.png)
|
||||
|
||||
|
||||
If you use `` instead of the horizontal variant `` and exchange x- for y-data, you will get a plot like this:
|
||||
|
||||
![jkqtplotter_simpletest_stepplots_vertical.png](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest_stepplots_vertical.png)
|
||||
|
||||
Also note how the red graph is filled towards the y-axis, not the x-axis.
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
/** \example jkqtplotter_simpletest_stepplots.cpp
|
||||
* JKQTPlotter: Examples: Step Line Plots in Different Styles
|
||||
* JKQTPlotter: Examples: Special/Step Line Plots in Different Styles
|
||||
*
|
||||
* \ref JKQTPlotterStepPlot
|
||||
* \ref JKQTPlotterSpecialStepLinePlot
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsspecialline.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@ -19,113 +20,159 @@ int main(int argc, char* argv[])
|
||||
|
||||
// 2. now we create data a vector of x-values for a simple plot and several sets of y-values for
|
||||
// cosine curves stacked above each other
|
||||
QVector<double> X, Y1, Y2, Y3;
|
||||
const int Ndata=10; // number of plot points in each curve
|
||||
for (int i=0; i<Ndata; i++) {
|
||||
const double x=double(i)/double(Ndata)*2.0*M_PI;
|
||||
QVector<double> X, Y1, Y2, Y3, Y4, Y5;
|
||||
const int Ndata=7; // number of plot points in each curve
|
||||
for (int i=0; i<=Ndata; i++) {
|
||||
const double x=0.0+double(i)*0.6*M_PI;
|
||||
X<<x;
|
||||
Y1<<cos(x)+1.0*1.5;
|
||||
Y2<<cos(x)+2.0*1.5;
|
||||
Y3<<cos(x)+3.0*1.5;
|
||||
Y1<<sin(x)+1.0*1.5;
|
||||
Y2<<sin(x)+3.0*1.5;
|
||||
Y3<<sin(x)+5.0*1.5;
|
||||
Y4<<sin(x)+7.0*1.5;
|
||||
Y5<<sin(x)+9.0*1.5;
|
||||
}
|
||||
|
||||
// and copy it to the datastore
|
||||
size_t columnX=ds->addCopiedColumn(X, "x");
|
||||
size_t columnY1=ds->addCopiedColumn(Y1, "y1");
|
||||
size_t columnY2=ds->addCopiedColumn(Y2, "y2");
|
||||
size_t columnY3=ds->addCopiedColumn(Y3, "y3");
|
||||
size_t columnY4=ds->addCopiedColumn(Y4, "y5");
|
||||
size_t columnY5=ds->addCopiedColumn(Y5, "y4");
|
||||
|
||||
// 3 now we make several plots with different step styles, each one also contains a
|
||||
// symbol plot indicating the location of the datapoints themselves
|
||||
JKQTPStepHorizontalGraph* graph;
|
||||
JKQTPXYLineGraph* graphL;
|
||||
JKQTPSpecialLineHorizontalGraph* graph;
|
||||
|
||||
//-- JKQTPStepLeft ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPStepHorizontalGraph(&plot);
|
||||
graphL=new JKQTPXYLineGraph(&plot);
|
||||
graph=new JKQTPSpecialLineHorizontalGraph(&plot);
|
||||
|
||||
// set data for both graphs
|
||||
graph->setXColumn(columnX); graphL->setXColumn(graph->getXColumn());
|
||||
graph->setYColumn(columnY1); graphL->setYColumn(graph->getYColumn());
|
||||
// set data for the graph
|
||||
graph->setXColumn(columnX);
|
||||
graph->setYColumn(columnY1);
|
||||
|
||||
// set step style
|
||||
graph->setStepType(JKQTPStepLeft);
|
||||
graph->setSpecialLineType(JKQTPStepLeft);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(true);
|
||||
/*QRadialGradient radialGrad(QPointF(0.5, 0.5), 0.5);
|
||||
radialGrad.setColorAt(0, Qt::red);
|
||||
radialGrad.setColorAt(0.5, Qt::blue);
|
||||
radialGrad.setColorAt(1, Qt::green);
|
||||
radialGrad.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||
graph->setFillGradient(radialGrad);*/
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPStepLeft, filled");
|
||||
graph->setBaseline(0.0);
|
||||
|
||||
// set symbol + pen style and color for the added circles, copy color
|
||||
graphL->setSymbol(JKQTPGraphSymbols::JKQTPCircle);
|
||||
graphL->setDrawLine(false);
|
||||
graphL->setSymbolSize(9);
|
||||
graphL->setSymbolWidth(1);
|
||||
graphL->setColor(graph->getColor());
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
plot.addGraph(graphL);
|
||||
|
||||
|
||||
//-- JKQTPStepCenter ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPStepHorizontalGraph(&plot);
|
||||
graphL=new JKQTPXYLineGraph(&plot);
|
||||
graph=new JKQTPSpecialLineHorizontalGraph(&plot);
|
||||
|
||||
// set data for both graphs
|
||||
graph->setXColumn(columnX); graphL->setXColumn(graph->getXColumn());
|
||||
graph->setYColumn(columnY2); graphL->setYColumn(graph->getYColumn());
|
||||
// set data for the graph
|
||||
graph->setXColumn(columnX);
|
||||
graph->setYColumn(columnY2);
|
||||
|
||||
// set step style
|
||||
graph->setStepType(JKQTPStepCenter);
|
||||
graph->setSpecialLineType(JKQTPStepCenter);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(false);
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPStepCenter");
|
||||
|
||||
// set symbol + pen style and color for the added circles, copy color
|
||||
graphL->setSymbol(JKQTPGraphSymbols::JKQTPCircle);
|
||||
graphL->setDrawLine(false);
|
||||
graphL->setSymbolSize(9);
|
||||
graphL->setSymbolWidth(1);
|
||||
graphL->setColor(graph->getColor());
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
plot.addGraph(graphL);
|
||||
|
||||
|
||||
//-- JKQTPStepRight ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPStepHorizontalGraph(&plot);
|
||||
graphL=new JKQTPXYLineGraph(&plot);
|
||||
graph=new JKQTPSpecialLineHorizontalGraph(&plot);
|
||||
|
||||
// set data for both graphs
|
||||
graph->setXColumn(columnX); graphL->setXColumn(graph->getXColumn());
|
||||
graph->setYColumn(columnY3); graphL->setYColumn(graph->getYColumn());
|
||||
// set data for the graph
|
||||
graph->setXColumn(columnX);
|
||||
graph->setYColumn(columnY3);
|
||||
|
||||
// set step style
|
||||
graph->setStepType(JKQTPStepRight);
|
||||
graph->setSpecialLineType(JKQTPStepRight);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(false);
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPStepRight");
|
||||
|
||||
// set symbol + pen style and color for the added circles, copy color
|
||||
graphL->setSymbol(JKQTPGraphSymbols::JKQTPCircle);
|
||||
graphL->setDrawLine(false);
|
||||
graphL->setSymbolSize(9);
|
||||
graphL->setSymbolWidth(1);
|
||||
graphL->setColor(graph->getColor());
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
plot.addGraph(graphL);
|
||||
|
||||
|
||||
|
||||
//-- JKQTPStepAverage ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPSpecialLineHorizontalGraph(&plot);
|
||||
|
||||
// set data for the graph
|
||||
graph->setXColumn(columnX);
|
||||
graph->setYColumn(columnY4);
|
||||
|
||||
// set step style
|
||||
graph->setSpecialLineType(JKQTPStepAverage);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(false);
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPStepAverage");
|
||||
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
|
||||
|
||||
//-- JKQTPDirectLine ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPSpecialLineHorizontalGraph(&plot);
|
||||
|
||||
// set data for the graph
|
||||
graph->setXColumn(columnX);
|
||||
graph->setYColumn(columnY5);
|
||||
|
||||
// set step style
|
||||
graph->setSpecialLineType(JKQTPDirectLine);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(false);
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPDirectLine");
|
||||
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
|
||||
|
||||
// 4. scale plot manually
|
||||
plot.setXY(-0.5, X.last()+0.5, -0.5, 7);
|
||||
plot.setXY(-0.5, X.last()+0.5, -0.5, 18);
|
||||
|
||||
// 5. show plotter and make it a decent size
|
||||
// 5. style the plot
|
||||
plot.setGrid(false);
|
||||
plot.getXAxis()->setShowZeroAxis(false);
|
||||
|
||||
// 6. show plotter and make it a decent size
|
||||
plot.show();
|
||||
plot.resize(800,600);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
# source code for this simple demo
|
||||
SOURCES = jkqtplotter_simpletest_stepplots.cpp
|
||||
SOURCES = jkqtplotter_simpletest_stepplots.cpp
|
||||
#SOURCES = jkqtplotter_simpletest_stepplots_vertical.cpp
|
||||
|
||||
# configure Qt
|
||||
CONFIG += link_prl qt
|
||||
|
@ -0,0 +1,180 @@
|
||||
/** \example jkqtplotter_simpletest_stepplots.cpp
|
||||
* JKQTPlotter: Examples: Special/Step Line Plots in Different Styles
|
||||
*
|
||||
* \ref JKQTPlotterSpecialStepLinePlot
|
||||
*/
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsspecialline.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
|
||||
JKQTPlotter plot;
|
||||
JKQTPDatastore* ds=plot.getDatastore();
|
||||
|
||||
// 2. now we create data a vector of x-values for a simple plot and several sets of y-values for
|
||||
// cosine curves stacked above each other
|
||||
QVector<double> X, Y1, Y2, Y3, Y4, Y5;
|
||||
const int Ndata=7; // number of plot points in each curve
|
||||
for (int i=0; i<=Ndata; i++) {
|
||||
const double x=0.0+double(i)*0.6*M_PI;
|
||||
X<<x;
|
||||
Y1<<sin(x)+1.0*1.5;
|
||||
Y2<<sin(x)+3.0*1.5;
|
||||
Y3<<sin(x)+5.0*1.5;
|
||||
Y4<<sin(x)+7.0*1.5;
|
||||
Y5<<sin(x)+9.0*1.5;
|
||||
}
|
||||
|
||||
// and copy it to the datastore
|
||||
size_t columnX=ds->addCopiedColumn(X, "x");
|
||||
size_t columnY1=ds->addCopiedColumn(Y1, "y1");
|
||||
size_t columnY2=ds->addCopiedColumn(Y2, "y2");
|
||||
size_t columnY3=ds->addCopiedColumn(Y3, "y3");
|
||||
size_t columnY4=ds->addCopiedColumn(Y4, "y5");
|
||||
size_t columnY5=ds->addCopiedColumn(Y5, "y4");
|
||||
|
||||
// 3 now we make several plots with different step styles, each one also contains a
|
||||
// symbol plot indicating the location of the datapoints themselves
|
||||
JKQTPSpecialLineVerticalGraph* graph;
|
||||
|
||||
//-- JKQTPStepLeft ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPSpecialLineVerticalGraph(&plot);
|
||||
|
||||
// set data for the graph
|
||||
graph->setYColumn(columnX);
|
||||
graph->setXColumn(columnY1);
|
||||
|
||||
// set step style
|
||||
graph->setSpecialLineType(JKQTPStepLeft);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(true);
|
||||
/*QRadialGradient radialGrad(QPointF(0.5, 0.5), 0.5);
|
||||
radialGrad.setColorAt(0, Qt::red);
|
||||
radialGrad.setColorAt(0.5, Qt::blue);
|
||||
radialGrad.setColorAt(1, Qt::green);
|
||||
radialGrad.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||
graph->setFillGradient(radialGrad);*/
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPStepLeft, filled");
|
||||
graph->setBaseline(0.5);
|
||||
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
|
||||
|
||||
//-- JKQTPStepCenter ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPSpecialLineVerticalGraph(&plot);
|
||||
|
||||
// set data for the graph
|
||||
graph->setYColumn(columnX);
|
||||
graph->setXColumn(columnY2);
|
||||
|
||||
// set step style
|
||||
graph->setSpecialLineType(JKQTPStepCenter);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(false);
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPStepCenter");
|
||||
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
|
||||
|
||||
//-- JKQTPStepRight ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPSpecialLineVerticalGraph(&plot);
|
||||
|
||||
// set data for the graph
|
||||
graph->setYColumn(columnX);
|
||||
graph->setXColumn(columnY3);
|
||||
|
||||
// set step style
|
||||
graph->setSpecialLineType(JKQTPStepRight);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(false);
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPStepRight");
|
||||
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
|
||||
|
||||
|
||||
//-- JKQTPStepAverage ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPSpecialLineVerticalGraph(&plot);
|
||||
|
||||
// set data for the graph
|
||||
graph->setYColumn(columnX);
|
||||
graph->setXColumn(columnY4);
|
||||
|
||||
// set step style
|
||||
graph->setSpecialLineType(JKQTPStepAverage);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(false);
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPStepAverage");
|
||||
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
|
||||
|
||||
//-- JKQTPDirectLine ----------------------------------------------------------------------------------------
|
||||
graph=new JKQTPSpecialLineVerticalGraph(&plot);
|
||||
|
||||
// set data for the graph
|
||||
graph->setYColumn(columnX);
|
||||
graph->setXColumn(columnY5);
|
||||
|
||||
// set step style
|
||||
graph->setSpecialLineType(JKQTPDirectLine);
|
||||
graph->setLineWidth(1);
|
||||
graph->setFillCurve(false);
|
||||
graph->setDrawLine(true);
|
||||
graph->setTitle("JKQTPDirectLine");
|
||||
|
||||
// enable symbols
|
||||
graph->setDrawSymbols(true);
|
||||
graph->setSymbolType(JKQTPGraphSymbols::JKQTPCircle);
|
||||
|
||||
|
||||
|
||||
// add the graphs to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
|
||||
|
||||
// 4. scale plot manually
|
||||
plot.setXY(-0.5, 18, -0.5, X.last()+0.5);
|
||||
|
||||
// 5. style the plot
|
||||
plot.setGrid(false);
|
||||
plot.getYAxis()->setShowZeroAxis(false);
|
||||
|
||||
// 6. show plotter and make it a decent size
|
||||
plot.show();
|
||||
plot.resize(600,800);
|
||||
|
||||
return app.exec();
|
||||
}
|
@ -39,7 +39,7 @@ int main(int argc, char* argv[])
|
||||
graph1->setXColumn(columnX);
|
||||
graph1->setYColumn(columnY);
|
||||
graph1->setYErrorColumn(columnYE);
|
||||
graph1->setSymbol(JKQTPFilledStar); // set symbol style
|
||||
graph1->setSymbolType(JKQTPFilledStar); // set symbol style
|
||||
graph1->setYErrorStyle(JKQTPErrorBars); // set error indicator type
|
||||
graph1->setDrawLine(false); // don't draw a line
|
||||
graph1->setTitle(QObject::tr("sine graph"));
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
|
||||
// number of datapoints:
|
||||
#define Ndata 10
|
||||
@ -41,7 +41,7 @@ int main(int argc, char* argv[])
|
||||
graph1->setXColumn(columnX);
|
||||
graph1->setYColumn(columnY);
|
||||
graph1->setYErrorColumn(columnYE);
|
||||
graph1->setSymbol(JKQTPFilledStar); // set symbol style
|
||||
graph1->setSymbolType(JKQTPFilledStar); // set symbol style
|
||||
graph1->setYErrorStyle(JKQTPErrorBars); // set error indicator type
|
||||
graph1->setDrawLine(false); // don't draw a line
|
||||
graph1->setTitle(QObject::tr("sine graph"));
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Example (JKQTPlotter): Line Graph with Different Symbols and Line Styles {#JKQTPlotterSymbolsAndStyles}
|
||||
This project (see `./examples/simpletest_symbols_and_styles/`) simply creates a JKQTPlotter widget (as a new window) and adds a single line-graph (a sine-wave). Data is initialized from two QVector<double> objects.
|
||||
|
||||
The source code of the main application can be found in [`jkqtplotter_simpletest_symbols_and_styles.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.cpp). Mainly several graphs are generated in a loop and then different symbol and line styles are applied to the graph (set by `graph->setSymbol()` for the symbol and `graph->setStyle()` for the line style). The colors are set automtically from an internal default palette. The main loop looks like this:
|
||||
The source code of the main application can be found in [`jkqtplotter_simpletest_symbols_and_styles.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.cpp). Mainly several graphs are generated in a loop and then different symbol and line styles are applied to the graph (set by `graph->setSymbolType()` for the symbol and `graph->setLineStyle()` for the line style). The colors are set automtically from an internal default palette. The main loop looks like this:
|
||||
|
||||
```.cpp
|
||||
QVector<Qt::PenStyle> pens {Qt::NoPen, Qt::SolidLine, Qt::DashLine, Qt::DotLine, Qt::DashDotLine, Qt::DashDotDotLine };
|
||||
@ -20,17 +20,17 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
||||
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(symbolID)));
|
||||
|
||||
// set symbol + pen style and color
|
||||
graph->setSymbol(static_cast<JKQTPGraphSymbols>(symbolID));
|
||||
graph->setStyle(pens[ipen]);
|
||||
graph->setSymbolType(static_cast<JKQTPGraphSymbols>(symbolID));
|
||||
graph->setLineStyle(pens[ipen]);
|
||||
// set symbol size
|
||||
graph->setSymbolSize(14);
|
||||
// set width of symbol lines
|
||||
graph->setSymbolWidth(1.5);
|
||||
graph->setSymbolLineWidth(1.5);
|
||||
// set width of graph line
|
||||
graph->setLineWidth(1);
|
||||
|
||||
// graph title is made from symbol+penstyle
|
||||
graph->setTitle(JKQTPGraphSymbols2NameString(static_cast<JKQTPGraphSymbols>(graph->getSymbol()))+QString(", ")+jkqtp_QPenStyle2String(graph->getStyle()));
|
||||
graph->setTitle(JKQTPGraphSymbols2NameString(static_cast<JKQTPGraphSymbols>(graph->getSymbolType()))+QString(", ")+jkqtp_QPenStyle2String(graph->getLineStyle()));
|
||||
|
||||
// add the graph to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
@ -40,7 +40,7 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
||||
}
|
||||
```
|
||||
|
||||
In addition to the symbol type and line style, you can also alter the size of the symbols (`graph->setSymbolSize(14)`), the line-width used to draw them (`graph->setSymbolWidth(1.5)`) and the line width of the graph line (`graph->setLineWidth(1)`). If you want to switch off the line altogether, use `graph->setDrawLine(false`.
|
||||
In addition to the symbol type and line style, you can also alter the size of the symbols (`graph->setSymbolSize(14)`), the line-width used to draw them (`graph->setSymbolLineWidth(1.5)`) and the line width of the graph line (`graph->setLineWidth(1)`). If you want to switch off the line altogether, use `graph->setDrawLine(false`.
|
||||
|
||||
The result looks like this:
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
|
||||
|
||||
@ -48,20 +48,20 @@ int main(int argc, char* argv[])
|
||||
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(symbolID)));
|
||||
|
||||
// set symbol + pen style and color
|
||||
graph->setSymbol(static_cast<JKQTPGraphSymbols>(symbolID));
|
||||
graph->setStyle(pens[ipen]);
|
||||
QString lname=jkqtp_QPenStyle2String(graph->getStyle());
|
||||
graph->setSymbolType(static_cast<JKQTPGraphSymbols>(symbolID));
|
||||
graph->setLineStyle(pens[ipen]);
|
||||
QString lname=jkqtp_QPenStyle2String(graph->getLineStyle());
|
||||
graph->setDrawLine(static_cast<JKQTPGraphSymbols>(symbolID)!=JKQTPDot);
|
||||
if (!graph->getDrawLine()) lname="";
|
||||
// set symbol size
|
||||
graph->setSymbolSize(14);
|
||||
// set width of symbol lines
|
||||
graph->setSymbolWidth(1.5);
|
||||
graph->setSymbolLineWidth(1.5);
|
||||
// set width of graph line
|
||||
graph->setLineWidth(1);
|
||||
|
||||
// graph title is made from symbol+penstyle
|
||||
graph->setTitle(JKQTPGraphSymbols2NameString(static_cast<JKQTPGraphSymbols>(graph->getSymbol()))+QString(", ")+lname);
|
||||
graph->setTitle(JKQTPGraphSymbols2NameString(static_cast<JKQTPGraphSymbols>(graph->getSymbolType()))+QString(", ")+lname);
|
||||
|
||||
// add the graph to the plot, so it is actually displayed
|
||||
plot.addGraph(graph);
|
||||
|
@ -65,7 +65,7 @@ After adding all necessary data to the JKQTDatastore:
|
||||
// data should scatter around position=-0.07 in a BeeSwarmScatter-Plot
|
||||
graphRANDVALS->setPositionScatterStyle(JKQTPSingleColumnSymbolsGraph::BeeSwarmScatter);
|
||||
// choose small filled circles as symbols, JKQTPGraphSymbols::set their color:
|
||||
graphRANDVALS->setSymbol(JKQTPFilledCircle);
|
||||
graphRANDVALS->setSymbolType(JKQTPFilledCircle);
|
||||
graphRANDVALS->setSymbolSize(5);
|
||||
graphRANDVALS->setColor(QColor("red"));
|
||||
graphRANDVALS->setFillColor(graphRANDVALS->getColor().lighter(180));
|
||||
@ -84,7 +84,7 @@ After adding all necessary data to the JKQTDatastore:
|
||||
// 6. draw the theoretical distribution as function graph:
|
||||
JKQTPXFunctionLineGraph* graphTheoDist=new JKQTPXFunctionLineGraph(&plot);
|
||||
// define the gaussian function used for the random number generator
|
||||
graphTheoDist->setPlotFunction([&th_mean,&th_std](double x) -> double {
|
||||
graphTheoDist->setPlotFunctionFunctor([&th_mean,&th_std](double x) -> double {
|
||||
return 1.0/(th_std*sqrt(2.0*M_PI))*exp(-0.5*(x-th_mean)*(x-th_mean)/th_std/th_std);
|
||||
});
|
||||
// set title:
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsboxplot.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbarchart.h"
|
||||
#include "jkqtplotter/jkqtpgraphssinglecolumnsymbols.h"
|
||||
@ -79,10 +79,9 @@ int main(int argc, char* argv[])
|
||||
// data should scatter around position=-0.07 in a BeeSwarmScatter-Plot
|
||||
graphRANDVALS->setPositionScatterStyle(JKQTPSingleColumnSymbolsGraph::BeeSwarmScatter);
|
||||
// choose small filled circles as symbols, JKQTPGraphSymbols::set their color:
|
||||
graphRANDVALS->setSymbol(JKQTPFilledCircle);
|
||||
graphRANDVALS->setSymbolType(JKQTPFilledCircle);
|
||||
graphRANDVALS->setSymbolSize(5);
|
||||
graphRANDVALS->setColor(QColor("red"));
|
||||
graphRANDVALS->setFillColor(graphRANDVALS->getColor().lighter(180));
|
||||
// set title:
|
||||
graphRANDVALS->setTitle("Random Data");
|
||||
|
||||
@ -98,7 +97,7 @@ int main(int argc, char* argv[])
|
||||
// 6. draw the theoretical distribution as function graph:
|
||||
JKQTPXFunctionLineGraph* graphTheoDist=new JKQTPXFunctionLineGraph(&plot);
|
||||
// define the gaussian function used for the random number generator
|
||||
graphTheoDist->setPlotFunction([&th_mean,&th_std](double x) -> double {
|
||||
graphTheoDist->setPlotFunctionFunctor([&th_mean,&th_std](double x) -> double {
|
||||
return 1.0/(th_std*sqrt(2.0*M_PI))*exp(-0.5*(x-th_mean)*(x-th_mean)/th_std/th_std);
|
||||
});
|
||||
// set title:
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbarchart.h"
|
||||
#include <random>
|
||||
@ -95,7 +95,7 @@ int main(int argc, char* argv[])
|
||||
graphD->setXColumn(cX);
|
||||
graphD->setYColumn(cY);
|
||||
graphD->setDrawLine(false);
|
||||
graphD->setSymbol(JKQTPCross);
|
||||
graphD->setSymbolType(JKQTPCross);
|
||||
graphD->setSymbolSize(10);
|
||||
graphD->setTitle("measurement data");
|
||||
plotMain->addGraph(graphD);
|
||||
@ -111,7 +111,7 @@ int main(int argc, char* argv[])
|
||||
graphResid->setXColumn(cX);
|
||||
graphResid->setYColumn(cRY);
|
||||
graphResid->setDrawLine(false);
|
||||
graphResid->setSymbol(JKQTPPlus);
|
||||
graphResid->setSymbolType(JKQTPPlus);
|
||||
graphResid->setSymbolSize(10);
|
||||
graphResid->setDrawLine(true);
|
||||
graphResid->setLineWidth(0.5);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "test_styling.h"
|
||||
#include "ui_test_styling.h"
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbarchart.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimage.h"
|
||||
#include "jkqtplotter/jkqtpgraphsgeometric.h"
|
||||
@ -192,7 +192,7 @@ void TestStyling::initPlot()
|
||||
JKQTPXYLineGraph* graph2=new JKQTPXYLineGraph(ui->plot);
|
||||
graph2->setXColumn(columnX);
|
||||
graph2->setYColumn(columnY2);
|
||||
graph2->setSymbol(JKQTPNoSymbol);
|
||||
graph2->setSymbolType(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);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include <QFormLayout>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
|
@ -12,10 +12,13 @@ HEADERS += \
|
||||
$$PWD/jkqtplotter/jkqtpbaseplotter.h \
|
||||
$$PWD/jkqtplotter/jkqtpdatastorage.h \
|
||||
$$PWD/jkqtplotter/jkqtpelementsoverlay.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphs.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsscatter.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsrange.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsspecialline.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsbarchart.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsbase.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsbaseerrors.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsbasestylingmixins.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsboxplot.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsevaluatedfunction.h \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsfilledcurve.h \
|
||||
@ -54,10 +57,13 @@ SOURCES += \
|
||||
$$PWD/jkqtplotter/jkqtpbaseplotter.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpdatastorage.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpelementsoverlay.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphs.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsscatter.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsrange.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsspecialline.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsbarchart.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsbase.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsbaseerrors.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsboxplot.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsevaluatedfunction.cpp \
|
||||
$$PWD/jkqtplotter/jkqtpgraphsfilledcurve.cpp \
|
||||
|
@ -49,8 +49,9 @@
|
||||
#include "jkqtplotter/jkqtpgraphsboxplot.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbarchart.h"
|
||||
#include "jkqtplotter/jkqtpgraphsfilledcurve.h"
|
||||
#include "jkqtplotter/jkqtpgraphsspecialline.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimpulses.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsgeometric.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimage.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimagergb.h"
|
||||
@ -951,9 +952,10 @@ JKQTBasePlotter::JKQTPPen JKQTBasePlotter::getPlotStyle(int i) const{
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, plotterStyle.defaultGraphWidth));
|
||||
p.setErrorWidth(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, plotterStyle.defaultGraphWidth));
|
||||
p.setSymbolSize(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, plotterStyle.defaultGraphSymbolSize));
|
||||
p.setSymbolFillColor(JKQTPGetDerivedColor(plotterStyle.graphFillColorDerivationMode, p.color()));
|
||||
p.setSymbolLineWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, plotterStyle.defaultGraphSymbolLineWidth));
|
||||
p.setStyle(plotterStyle.defaultGraphPenStyles[styleI]);
|
||||
p.setSymbol(plotterStyle.defaultGraphSymbols[symbolI]);
|
||||
p.setSymbolType(plotterStyle.defaultGraphSymbols[symbolI]);
|
||||
p.setFillStyle(plotterStyle.defaultGraphFillStyles[brushI]);
|
||||
p.setErrorFillStyle(plotterStyle.defaultGraphFillStyles[brushI]);
|
||||
return p;
|
||||
@ -3974,13 +3976,13 @@ size_t JKQTBasePlotter::addGraph(size_t xColumn, size_t yColumn, const QString&
|
||||
gr->setYColumn(yColumn);
|
||||
return addGraph(gr);
|
||||
} else if (graphStyle==JKQTPStepsX) {
|
||||
JKQTPStepHorizontalGraph* gr=new JKQTPStepHorizontalGraph(this);
|
||||
JKQTPSpecialLineHorizontalGraph* gr=new JKQTPSpecialLineHorizontalGraph(this);
|
||||
gr->setTitle(title);
|
||||
gr->setXColumn(xColumn);
|
||||
gr->setYColumn(yColumn);
|
||||
return addGraph(gr);
|
||||
} else if (graphStyle==JKQTPStepsY) {
|
||||
JKQTPStepVerticalGraph* gr=new JKQTPStepVerticalGraph(this);
|
||||
JKQTPSpecialLineVerticalGraph* gr=new JKQTPSpecialLineVerticalGraph(this);
|
||||
gr->setTitle(title);
|
||||
gr->setXColumn(xColumn);
|
||||
gr->setYColumn(yColumn);
|
||||
@ -3990,8 +3992,8 @@ size_t JKQTBasePlotter::addGraph(size_t xColumn, size_t yColumn, const QString&
|
||||
gr->setTitle(title);
|
||||
gr->setXColumn(xColumn);
|
||||
gr->setYColumn(yColumn);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbol(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbol(JKQTPPlus);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbolType(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbolType(JKQTPPlus);
|
||||
return addGraph(gr);
|
||||
}
|
||||
return -1;
|
||||
@ -4020,7 +4022,7 @@ size_t JKQTBasePlotter::addGraph(size_t xColumn, size_t yColumn, const QString&
|
||||
gr->setXColumn(xColumn);
|
||||
gr->setYColumn(yColumn);
|
||||
gr->setLineWidth(width);
|
||||
gr->setStyle(penstyle);
|
||||
gr->setLineStyle(penstyle);
|
||||
gr->setFillColor(color);
|
||||
return addGraph(gr);
|
||||
} else if (graphStyle==JKQTPFilledCurveY) {
|
||||
@ -4029,25 +4031,25 @@ size_t JKQTBasePlotter::addGraph(size_t xColumn, size_t yColumn, const QString&
|
||||
gr->setXColumn(xColumn);
|
||||
gr->setYColumn(yColumn);
|
||||
gr->setLineWidth(width);
|
||||
gr->setStyle(penstyle);
|
||||
gr->setLineStyle(penstyle);
|
||||
gr->setFillColor(color);
|
||||
return addGraph(gr);
|
||||
} else if (graphStyle==JKQTPStepsX) {
|
||||
JKQTPStepHorizontalGraph* gr=new JKQTPStepHorizontalGraph(this);
|
||||
JKQTPSpecialLineHorizontalGraph* gr=new JKQTPSpecialLineHorizontalGraph(this);
|
||||
gr->setTitle(title);
|
||||
gr->setXColumn(xColumn);
|
||||
gr->setYColumn(yColumn);
|
||||
gr->setLineWidth(width);
|
||||
gr->setStyle(penstyle);
|
||||
gr->setLineStyle(penstyle);
|
||||
gr->setFillColor(color);
|
||||
return addGraph(gr);
|
||||
} else if (graphStyle==JKQTPStepsY) {
|
||||
JKQTPStepVerticalGraph* gr=new JKQTPStepVerticalGraph(this);
|
||||
JKQTPSpecialLineVerticalGraph* gr=new JKQTPSpecialLineVerticalGraph(this);
|
||||
gr->setTitle(title);
|
||||
gr->setXColumn(xColumn);
|
||||
gr->setYColumn(yColumn);
|
||||
gr->setLineWidth(width);
|
||||
gr->setStyle(penstyle);
|
||||
gr->setYColumn(penstyle);
|
||||
gr->setFillColor(color);
|
||||
return addGraph(gr);
|
||||
} else {
|
||||
@ -4056,11 +4058,12 @@ size_t JKQTBasePlotter::addGraph(size_t xColumn, size_t yColumn, const QString&
|
||||
gr->setXColumn(xColumn);
|
||||
gr->setYColumn(yColumn);
|
||||
gr->setLineWidth(width);
|
||||
gr->setStyle(penstyle);
|
||||
gr->setColor(color);
|
||||
gr->setSymbol(symbol);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbol(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbol(JKQTPPlus);
|
||||
gr->setLineStyle(penstyle);
|
||||
gr->setLineColor(color);
|
||||
gr->setSymbolColor(color);
|
||||
gr->setSymbolType(symbol);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbolType(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbolType(JKQTPPlus);
|
||||
return addGraph(gr);
|
||||
}
|
||||
return -1;
|
||||
@ -4134,8 +4137,8 @@ size_t JKQTBasePlotter::addGraphWithXError(size_t xColumn, size_t yColumn, size_
|
||||
gr->setYColumn(yColumn);
|
||||
gr->setXErrorStyle(errorStyle);
|
||||
gr->setXErrorColumn(xErrorColumn);
|
||||
gr->setErrorColor(gr->getColor().darker());
|
||||
QColor fc=gr->getColor();
|
||||
gr->setErrorColor(gr->getLineColor().darker());
|
||||
QColor fc=gr->getLineColor();
|
||||
fc.setAlphaF(0.5);
|
||||
gr->setErrorFillColor(fc);
|
||||
return addGraph(gr);
|
||||
@ -4146,8 +4149,8 @@ size_t JKQTBasePlotter::addGraphWithXError(size_t xColumn, size_t yColumn, size_
|
||||
gr->setYColumn(yColumn);
|
||||
gr->setXErrorStyle(errorStyle);
|
||||
gr->setXErrorColumn(xErrorColumn);
|
||||
gr->setErrorColor(gr->getColor());
|
||||
QColor fc=gr->getColor();
|
||||
gr->setErrorColor(gr->getLineColor());
|
||||
QColor fc=gr->getLineColor();
|
||||
fc.setAlphaF(0.5);
|
||||
gr->setErrorFillColor(fc);
|
||||
return addGraph(gr);
|
||||
@ -4159,12 +4162,12 @@ size_t JKQTBasePlotter::addGraphWithXError(size_t xColumn, size_t yColumn, size_
|
||||
gr->setYErrorColumn(xErrorColumn);
|
||||
gr->setYErrorStyle(errorStyle);
|
||||
gr->setXErrorStyle(JKQTPNoError);
|
||||
gr->setErrorColor(gr->getColor());
|
||||
QColor fc=gr->getColor();
|
||||
gr->setErrorColor(gr->getSymbolColor());
|
||||
QColor fc=gr->getSymbolColor();
|
||||
fc.setAlphaF(0.5);
|
||||
gr->setErrorFillColor(fc);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbol(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbol(JKQTPPlus);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbolType(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbolType(JKQTPPlus);
|
||||
return addGraph(gr);
|
||||
}
|
||||
|
||||
@ -4178,9 +4181,9 @@ size_t JKQTBasePlotter::addGraphWithYError(size_t xColumn, size_t yColumn, size_
|
||||
gr->setYColumn(yColumn);
|
||||
gr->setYErrorStyle(errorStyle);
|
||||
gr->setYErrorColumn(yErrorColumn);
|
||||
gr->setErrorColor(gr->getColor().darker());
|
||||
gr->setErrorColor(gr->getLineColor().darker());
|
||||
gr->setErrorWidth(gr->getLineWidth()/3.0);
|
||||
QColor fc=gr->getColor();
|
||||
QColor fc=gr->getLineColor();
|
||||
fc.setAlphaF(0.5);
|
||||
gr->setErrorFillColor(fc);
|
||||
return addGraph(gr);
|
||||
@ -4191,8 +4194,8 @@ size_t JKQTBasePlotter::addGraphWithYError(size_t xColumn, size_t yColumn, size_
|
||||
gr->setYColumn(yColumn);
|
||||
gr->setYErrorStyle(errorStyle);
|
||||
gr->setYErrorColumn(yErrorColumn);
|
||||
gr->setErrorColor(gr->getColor());
|
||||
QColor fc=gr->getColor();
|
||||
gr->setErrorColor(gr->getLineColor());
|
||||
QColor fc=gr->getLineColor();
|
||||
fc.setAlphaF(0.5);
|
||||
gr->setErrorFillColor(fc);
|
||||
return addGraph(gr);
|
||||
@ -4204,12 +4207,12 @@ size_t JKQTBasePlotter::addGraphWithYError(size_t xColumn, size_t yColumn, size_
|
||||
gr->setYErrorColumn(yErrorColumn);
|
||||
gr->setYErrorStyle(errorStyle);
|
||||
gr->setXErrorStyle(JKQTPNoError);
|
||||
gr->setErrorColor(gr->getColor());
|
||||
QColor fc=gr->getColor();
|
||||
gr->setErrorColor(gr->getSymbolColor());
|
||||
QColor fc=gr->getSymbolColor();
|
||||
fc.setAlphaF(0.5);
|
||||
gr->setErrorFillColor(fc);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbol(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbol(JKQTPPlus);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbolType(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbolType(JKQTPPlus);
|
||||
return addGraph(gr);
|
||||
}
|
||||
}
|
||||
@ -4223,12 +4226,12 @@ size_t JKQTBasePlotter::addGraphWithXYError(size_t xColumn, size_t yColumn, size
|
||||
gr->setYErrorStyle(JKQTPErrorBars);
|
||||
gr->setXErrorColumn(xErrorColumn);
|
||||
gr->setXErrorStyle(JKQTPErrorBars);
|
||||
gr->setErrorColor(gr->getColor());
|
||||
QColor fc=gr->getColor();
|
||||
gr->setErrorColor(gr->getSymbolColor());
|
||||
QColor fc=gr->getSymbolColor();
|
||||
fc.setAlphaF(0.5);
|
||||
gr->setErrorFillColor(fc);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbol(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbol(JKQTPPlus);
|
||||
if (graphStyle==JKQTPPoints) { gr->setSymbolType(JKQTPPlus); gr->setDrawLine(false); }
|
||||
else if (graphStyle==JKQTPLinesPoints) gr->setSymbolType(JKQTPPlus);
|
||||
return addGraph(gr);
|
||||
|
||||
}
|
||||
@ -4300,7 +4303,7 @@ void JKQTBasePlotter::drawGraphs(JKQTPEnhancedPainter& painter){
|
||||
}
|
||||
|
||||
|
||||
void JKQTBasePlotter::drawKeyContents(JKQTPEnhancedPainter& painter, double x, double y, double width, double height){
|
||||
void JKQTBasePlotter::drawKeyContents(JKQTPEnhancedPainter& painter, double x, double y, double /*width*/, double /*height*/){
|
||||
#ifdef JKQTBP_AUTOTIMER
|
||||
JKQTPAutoOutputTimer jkaaot(QString("JKQTBasePlotter::plotKeyContents(%1, %2, %3, %4)").arg(x).arg(y).arg(width).arg(height));
|
||||
#endif
|
||||
@ -5290,6 +5293,7 @@ JKQTPSaveDataAdapter::~JKQTPSaveDataAdapter() = default;
|
||||
JKQTBasePlotter::JKQTPPen::JKQTPPen():
|
||||
m_color(QColor("red")),
|
||||
m_fillColor(QColor("red").lighter()),
|
||||
m_symbolFillColor(QColor("red").lighter()),
|
||||
m_errorColor(m_color.darker()),
|
||||
m_errorFillColor(m_color.lighter()),
|
||||
m_width(2),
|
||||
@ -5353,6 +5357,10 @@ QColor JKQTBasePlotter::JKQTPPen::color() const {
|
||||
return m_color;
|
||||
}
|
||||
|
||||
QColor JKQTBasePlotter::JKQTPPen::symbolFillColor() const {
|
||||
return m_symbolFillColor;
|
||||
}
|
||||
|
||||
QColor JKQTBasePlotter::JKQTPPen::errorColor() const {
|
||||
return m_errorColor;
|
||||
}
|
||||
@ -5402,6 +5410,11 @@ void JKQTBasePlotter::JKQTPPen::setFillStyle(Qt::BrushStyle s) {
|
||||
void JKQTBasePlotter::JKQTPPen::setErrorFillStyle(Qt::BrushStyle s) {
|
||||
m_errorFillStyle=s;
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::JKQTPPen::setSymbolFillColor(QColor c) {
|
||||
m_symbolFillColor=c;
|
||||
}
|
||||
|
||||
Qt::BrushStyle JKQTBasePlotter::JKQTPPen::fillStyle() const {
|
||||
return m_fillStyle;
|
||||
}
|
||||
@ -5416,7 +5429,7 @@ JKQTPGraphSymbols JKQTBasePlotter::JKQTPPen::symbol() const
|
||||
return m_symbol;
|
||||
}
|
||||
|
||||
void JKQTBasePlotter::JKQTPPen::setSymbol(JKQTPGraphSymbols symbol)
|
||||
void JKQTBasePlotter::JKQTPPen::setSymbolType(JKQTPGraphSymbols symbol)
|
||||
{
|
||||
m_symbol=symbol;
|
||||
}
|
||||
|
@ -569,6 +569,7 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
|
||||
protected:
|
||||
QColor m_color;
|
||||
QColor m_fillColor;
|
||||
QColor m_symbolFillColor;
|
||||
QColor m_errorColor;
|
||||
QColor m_errorFillColor;
|
||||
double m_width;
|
||||
@ -608,7 +609,9 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
|
||||
Qt::BrushStyle fillStyle() const;
|
||||
Qt::BrushStyle errorFillStyle() const;
|
||||
JKQTPGraphSymbols symbol() const;
|
||||
void setSymbol(JKQTPGraphSymbols symbol);
|
||||
void setSymbolType(JKQTPGraphSymbols symbol);
|
||||
void setSymbolFillColor(QColor c);
|
||||
QColor symbolFillColor() const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,14 +30,6 @@
|
||||
JKQTPOverlayElement::JKQTPOverlayElement(JKQTBasePlotter *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
color=QColor("red");
|
||||
fillColor=color.lighter();
|
||||
lineStyle=Qt::SolidLine;
|
||||
fillStyle=Qt::SolidPattern;
|
||||
lineWidth=1.0;
|
||||
text="";
|
||||
fontName=QFont().family()+"+XITS";
|
||||
fontSize=QFont().pointSizeF();
|
||||
visible=true;
|
||||
}
|
||||
|
||||
@ -46,6 +38,16 @@ void JKQTPOverlayElement::setParent(JKQTBasePlotter *parent) {
|
||||
QObject::setParent(parent);
|
||||
}
|
||||
|
||||
void JKQTPOverlayElement::setVisible(bool __value)
|
||||
{
|
||||
this->visible = __value;
|
||||
}
|
||||
|
||||
bool JKQTPOverlayElement::isVisible() const
|
||||
{
|
||||
return this->visible;
|
||||
}
|
||||
|
||||
QPointF JKQTPOverlayElement::transform(const QPointF &x) {
|
||||
return QPointF(parent->x2p(x.x()), parent->y2p(x.y()));
|
||||
}
|
||||
@ -83,27 +85,6 @@ QPainterPath JKQTPOverlayElement::transformToLinePath(const QVector<QPointF> &x)
|
||||
return res;
|
||||
}
|
||||
|
||||
QBrush JKQTPOverlayElement::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
|
||||
QBrush b;
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
return b;
|
||||
}
|
||||
|
||||
QPen JKQTPOverlayElement::getPen(JKQTPEnhancedPainter& painter) const {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth)));
|
||||
p.setStyle(lineStyle);
|
||||
return p;
|
||||
}
|
||||
|
||||
QFont JKQTPOverlayElement::getFont() const {
|
||||
QFont f;
|
||||
f.setFamily(fontName);
|
||||
f.setPointSizeF(fontSize);
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -113,18 +94,28 @@ JKQTPOverlayOneCoordOverlay::JKQTPOverlayOneCoordOverlay(double pos, JKQTBasePlo
|
||||
this->position=pos;
|
||||
}
|
||||
|
||||
void JKQTPOverlayOneCoordOverlay::setPosition(double __value)
|
||||
{
|
||||
this->position = __value;
|
||||
}
|
||||
|
||||
double JKQTPOverlayOneCoordOverlay::getPosition() const
|
||||
{
|
||||
return this->position;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JKQTPOverlayVerticalLine::JKQTPOverlayVerticalLine(double pos, JKQTBasePlotter *parent):
|
||||
JKQTPOverlayOneCoordOverlay(pos, parent)
|
||||
JKQTPOverlayOneCoordOverlay(pos, parent), JKQTPGraphTextStyleMixin(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JKQTPOverlayVerticalLine::JKQTPOverlayVerticalLine(double pos, const QString& text, JKQTBasePlotter *parent):
|
||||
JKQTPOverlayOneCoordOverlay(pos, parent)
|
||||
JKQTPOverlayOneCoordOverlay(pos, parent), JKQTPGraphTextStyleMixin(parent)
|
||||
{
|
||||
setText(text);
|
||||
}
|
||||
@ -138,16 +129,16 @@ void JKQTPOverlayVerticalLine::draw(JKQTPEnhancedPainter &painter) {
|
||||
QPointF p2=transform(position, ymax);
|
||||
QPointF p3=p2-QPointF(0, (p2.y()-p1.y())*0.1);
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.drawLine(p1, p2);
|
||||
|
||||
if (!text.isEmpty()) {
|
||||
|
||||
//JKQTMathText mt(this);
|
||||
JKQTMathText* mt=parent->getMathText();
|
||||
mt->setFontSize(fontSize);
|
||||
mt->setFontColor(color);
|
||||
mt->setFontRomanOrSpecial(fontName);
|
||||
mt->setFontSize(getTextFontSize());
|
||||
mt->setFontColor(getTextColor());
|
||||
mt->setFontRomanOrSpecial(getTextFontName());
|
||||
mt->parse(text);
|
||||
mt->draw(painter, p3.x(), p3.y());
|
||||
}
|
||||
@ -155,24 +146,48 @@ void JKQTPOverlayVerticalLine::draw(JKQTPEnhancedPainter &painter) {
|
||||
|
||||
}
|
||||
|
||||
void JKQTPOverlayVerticalLine::setColor(QColor c)
|
||||
{
|
||||
setLineColor(c);
|
||||
setTextColor(c);
|
||||
}
|
||||
|
||||
void JKQTPOverlayVerticalLine::setText(const QString &__value)
|
||||
{
|
||||
this->text = __value;
|
||||
}
|
||||
|
||||
QString JKQTPOverlayVerticalLine::getText() const
|
||||
{
|
||||
return this->text;
|
||||
}
|
||||
|
||||
JKQTPOverlayTwoCoordOverlay::JKQTPOverlayTwoCoordOverlay(double pos, double pos2, JKQTBasePlotter *parent):
|
||||
JKQTPOverlayOneCoordOverlay(pos, parent)
|
||||
{
|
||||
position2=pos2;
|
||||
}
|
||||
|
||||
JKQTPOverlayVerticalRange::JKQTPOverlayVerticalRange(double pos, double pos2, JKQTBasePlotter *parent):
|
||||
JKQTPOverlayTwoCoordOverlay(pos, pos2, parent)
|
||||
void JKQTPOverlayTwoCoordOverlay::setPosition2(double __value)
|
||||
{
|
||||
this->position2 = __value;
|
||||
}
|
||||
|
||||
double JKQTPOverlayTwoCoordOverlay::getPosition2() const
|
||||
{
|
||||
return this->position2;
|
||||
}
|
||||
|
||||
JKQTPOverlayVerticalRange::JKQTPOverlayVerticalRange(double pos, double pos2, JKQTBasePlotter *parent):
|
||||
JKQTPOverlayTwoCoordOverlay(pos, pos2, parent), JKQTPGraphTextStyleMixin(parent)
|
||||
{
|
||||
fillColor=QColor(Qt::transparent);
|
||||
inverted=false;
|
||||
}
|
||||
|
||||
JKQTPOverlayVerticalRange::JKQTPOverlayVerticalRange(double pos, double pos2, const QString& text, JKQTBasePlotter *parent):
|
||||
JKQTPOverlayTwoCoordOverlay(pos, pos2, parent)
|
||||
JKQTPOverlayTwoCoordOverlay(pos, pos2, parent), JKQTPGraphTextStyleMixin(parent)
|
||||
{
|
||||
setText(text);
|
||||
fillColor=QColor(Qt::transparent);
|
||||
inverted=false;
|
||||
}
|
||||
|
||||
@ -190,24 +205,24 @@ void JKQTPOverlayVerticalRange::draw(JKQTPEnhancedPainter &painter) {
|
||||
QPointF p22=transform(position2, ymax);
|
||||
//QPointF p23=p2-QPointF(0, (p2.y()-p1.y())*0.1);
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
if (fillColor!=QColor(Qt::transparent)) {
|
||||
if (getFillColor()!=QColor(Qt::transparent)) {
|
||||
if (inverted) {
|
||||
painter.fillRect(QRectF(transform(xmin, ymin), p2), getBrush(painter));
|
||||
painter.fillRect(QRectF(p21, transform(xmax, ymax)), getBrush(painter));
|
||||
painter.fillRect(QRectF(transform(xmin, ymin), p2), getFillBrush(painter, parent));
|
||||
painter.fillRect(QRectF(p21, transform(xmax, ymax)), getFillBrush(painter, parent));
|
||||
} else {
|
||||
painter.fillRect(QRectF(p2, p21), getBrush(painter));
|
||||
painter.fillRect(QRectF(p2, p21), getFillBrush(painter, parent));
|
||||
}
|
||||
}
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.drawLine(p1, p2);
|
||||
painter.drawLine(p21, p22);
|
||||
|
||||
if (!text.isEmpty()) {
|
||||
//JKQTMathText mt(this);
|
||||
JKQTMathText* mt=parent->getMathText();
|
||||
mt->setFontSize(fontSize);
|
||||
mt->setFontColor(color);
|
||||
mt->setFontRomanOrSpecial(fontName);
|
||||
mt->setFontSize(getTextFontSize());
|
||||
mt->setFontColor(getTextColor());
|
||||
mt->setFontRomanOrSpecial(getTextFontName());
|
||||
mt->parse(text);
|
||||
mt->draw(painter, p3.x(), p3.y());
|
||||
}
|
||||
@ -215,6 +230,33 @@ void JKQTPOverlayVerticalRange::draw(JKQTPEnhancedPainter &painter) {
|
||||
|
||||
}
|
||||
|
||||
void JKQTPOverlayVerticalRange::setColor(QColor c)
|
||||
{
|
||||
setLineColor(c);
|
||||
setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
|
||||
setTextColor(c);
|
||||
}
|
||||
|
||||
void JKQTPOverlayVerticalRange::setInverted(bool __value)
|
||||
{
|
||||
this->inverted = __value;
|
||||
}
|
||||
|
||||
bool JKQTPOverlayVerticalRange::getInverted() const
|
||||
{
|
||||
return this->inverted;
|
||||
}
|
||||
|
||||
void JKQTPOverlayVerticalRange::setText(const QString &__value)
|
||||
{
|
||||
text=__value;
|
||||
}
|
||||
|
||||
QString JKQTPOverlayVerticalRange::getText() const
|
||||
{
|
||||
return text;
|
||||
}
|
||||
|
||||
JKQTPOverlayTwoPositionOverlay::JKQTPOverlayTwoPositionOverlay(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent):
|
||||
JKQTPOverlayElement(parent)
|
||||
{
|
||||
@ -224,6 +266,46 @@ JKQTPOverlayTwoPositionOverlay::JKQTPOverlayTwoPositionOverlay(double x1, double
|
||||
this->y2=y2;
|
||||
}
|
||||
|
||||
void JKQTPOverlayTwoPositionOverlay::setX1(double __value)
|
||||
{
|
||||
this->x1 = __value;
|
||||
}
|
||||
|
||||
double JKQTPOverlayTwoPositionOverlay::getX1() const
|
||||
{
|
||||
return this->x1;
|
||||
}
|
||||
|
||||
void JKQTPOverlayTwoPositionOverlay::setX2(double __value)
|
||||
{
|
||||
this->x2 = __value;
|
||||
}
|
||||
|
||||
double JKQTPOverlayTwoPositionOverlay::getX2() const
|
||||
{
|
||||
return this->x2;
|
||||
}
|
||||
|
||||
void JKQTPOverlayTwoPositionOverlay::setY1(double __value)
|
||||
{
|
||||
this->y1 = __value;
|
||||
}
|
||||
|
||||
double JKQTPOverlayTwoPositionOverlay::getY1() const
|
||||
{
|
||||
return this->y1;
|
||||
}
|
||||
|
||||
void JKQTPOverlayTwoPositionOverlay::setY2(double __value)
|
||||
{
|
||||
this->y2 = __value;
|
||||
}
|
||||
|
||||
double JKQTPOverlayTwoPositionOverlay::getY2() const
|
||||
{
|
||||
return this->y2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -250,7 +332,7 @@ void JKQTPOverlayLine::draw(JKQTPEnhancedPainter &painter) {
|
||||
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
if (infinite) {
|
||||
double alpha=(p2.y()-p1.y())/(p2.x()-p1.x());
|
||||
double offset=p1.y()-alpha*p1.x();
|
||||
@ -270,6 +352,21 @@ void JKQTPOverlayLine::draw(JKQTPEnhancedPainter &painter) {
|
||||
|
||||
}
|
||||
|
||||
void JKQTPOverlayLine::setInfinite(bool __value)
|
||||
{
|
||||
this->infinite = __value;
|
||||
}
|
||||
|
||||
bool JKQTPOverlayLine::getInfinite() const
|
||||
{
|
||||
return this->infinite;
|
||||
}
|
||||
|
||||
void JKQTPOverlayLine::setColor(QColor c)
|
||||
{
|
||||
setLineColor(c);
|
||||
}
|
||||
|
||||
|
||||
JKQTPOverlayRectangle::JKQTPOverlayRectangle(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent):
|
||||
JKQTPOverlayTwoPositionOverlay(x1,y1,x2,y2,parent)
|
||||
@ -285,9 +382,15 @@ void JKQTPOverlayRectangle::draw(JKQTPEnhancedPainter &painter)
|
||||
QRectF rect(qMin(p1.x(), p2.x()), qMin(p1.y(), p2.y()), fabs(p1.x()-p2.x()), fabs(p1.y()-p2.y()));
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setBrush(getBrush(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.setBrush(getFillBrush(painter, parent));
|
||||
//painter.fillRect(rect);
|
||||
painter.drawRect(rect);
|
||||
|
||||
}
|
||||
|
||||
void JKQTPOverlayRectangle::setColor(QColor c)
|
||||
{
|
||||
setLineColor(c);
|
||||
setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <QPair>
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
|
||||
#ifndef jkqtpelementsoverlay_H
|
||||
#define jkqtpelementsoverlay_H
|
||||
@ -40,7 +41,7 @@ class JKQTBasePlotter;
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayElement : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JKQTPOverlayElement(JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayElement(JKQTBasePlotter *parent = nullptr);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter)=0;
|
||||
@ -51,129 +52,21 @@ class JKQTP_LIB_EXPORT JKQTPOverlayElement : public QObject {
|
||||
/** \brief sets the parent painter class */
|
||||
virtual void setParent(JKQTBasePlotter* parent);
|
||||
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc lineStyle
|
||||
\see see lineStyle for details */
|
||||
inline virtual void setLineStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->lineStyle = __value;
|
||||
}
|
||||
/*! \copydoc lineStyle
|
||||
\see see lineStyle for details */
|
||||
inline virtual Qt::PenStyle getLineStyle() const
|
||||
{
|
||||
return this->lineStyle;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
|
||||
{
|
||||
this->fillStyle = __value;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual Qt::BrushStyle getFillStyle() const
|
||||
{
|
||||
return this->fillStyle;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
/*! \copydoc text
|
||||
\see see text for details */
|
||||
inline virtual void setText(const QString & __value)
|
||||
{
|
||||
this->text = __value;
|
||||
}
|
||||
/*! \copydoc text
|
||||
\see see text for details */
|
||||
inline virtual QString getText() const
|
||||
{
|
||||
return this->text;
|
||||
}
|
||||
/*! \copydoc fontName
|
||||
\see see fontName for details */
|
||||
inline virtual void setFontName(const QString & __value)
|
||||
{
|
||||
this->fontName = __value;
|
||||
}
|
||||
/*! \copydoc fontName
|
||||
\see see fontName for details */
|
||||
inline virtual QString getFontName() const
|
||||
{
|
||||
return this->fontName;
|
||||
}
|
||||
/*! \copydoc fontSize
|
||||
\see see fontSize for details */
|
||||
inline virtual void setFontSize(double __value)
|
||||
{
|
||||
this->fontSize = __value;
|
||||
}
|
||||
/*! \copydoc fontSize
|
||||
\see see fontSize for details */
|
||||
inline virtual double getFontSize() const
|
||||
{
|
||||
return this->fontSize;
|
||||
}
|
||||
/*! \copydoc visible
|
||||
|
||||
|
||||
/*! \copydoc visible
|
||||
\see see visible for details */
|
||||
inline virtual void setVisible(bool __value)
|
||||
{
|
||||
this->visible = __value;
|
||||
}
|
||||
/*! \copydoc visible
|
||||
void setVisible(bool __value);
|
||||
/*! \copydoc visible
|
||||
\see see visible for details */
|
||||
inline virtual bool isVisible() const
|
||||
{
|
||||
return this->visible;
|
||||
}
|
||||
bool isVisible() const;
|
||||
|
||||
protected:
|
||||
/** \brief the plotter object this object belongs to */
|
||||
JKQTBasePlotter* parent;
|
||||
|
||||
QColor color;
|
||||
QColor fillColor;
|
||||
Qt::PenStyle lineStyle;
|
||||
Qt::BrushStyle fillStyle;
|
||||
double lineWidth;
|
||||
QString text;
|
||||
QString fontName;
|
||||
double fontSize;
|
||||
/** \brief indictaes whether the overlay is visible (at all) */
|
||||
bool visible;
|
||||
QFont getFont() const;
|
||||
|
||||
|
||||
/** \brief tool routine that transforms a QPointF according to the parent's transformation rules */
|
||||
@ -188,11 +81,11 @@ class JKQTP_LIB_EXPORT JKQTPOverlayElement : public QObject {
|
||||
/** \brief tool routine that transforms a QPointF according to the parent's transformation rules */
|
||||
inline QPointF transform(double x, double y) {
|
||||
return transform(QPointF(x,y));
|
||||
};
|
||||
}
|
||||
/** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules */
|
||||
inline QPointF backTransform(double x, double y) {
|
||||
return backTransform(QPointF(x,y));
|
||||
};
|
||||
}
|
||||
/** \brief tool routine that transforms a QVector<QPointF> according to the parent's transformation rules */
|
||||
QVector<QPointF> transform(const QVector<QPointF>& x);
|
||||
|
||||
@ -206,8 +99,7 @@ class JKQTP_LIB_EXPORT JKQTPOverlayElement : public QObject {
|
||||
return QPolygonF(transform(x));
|
||||
}
|
||||
|
||||
virtual QBrush getBrush(JKQTPEnhancedPainter &painter) const;
|
||||
virtual QPen getPen(JKQTPEnhancedPainter& painter) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
@ -219,60 +111,40 @@ class JKQTP_LIB_EXPORT JKQTPOverlayElement : public QObject {
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayTwoPositionOverlay : public JKQTPOverlayElement {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JKQTPOverlayTwoPositionOverlay(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayTwoPositionOverlay(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = nullptr);
|
||||
|
||||
/*! \copydoc x1
|
||||
/*! \copydoc x1
|
||||
\see see x1 for details */
|
||||
inline virtual void setX1(double __value)
|
||||
{
|
||||
this->x1 = __value;
|
||||
}
|
||||
/*! \copydoc x1
|
||||
void setX1(double __value);
|
||||
/*! \copydoc x1
|
||||
\see see x1 for details */
|
||||
inline virtual double getX1() const
|
||||
{
|
||||
return this->x1;
|
||||
}
|
||||
/*! \copydoc x2
|
||||
double getX1() const;
|
||||
/*! \copydoc x2
|
||||
\see see x2 for details */
|
||||
inline virtual void setX2(double __value)
|
||||
{
|
||||
this->x2 = __value;
|
||||
}
|
||||
/*! \copydoc x2
|
||||
void setX2(double __value);
|
||||
/*! \copydoc x2
|
||||
\see see x2 for details */
|
||||
inline virtual double getX2() const
|
||||
{
|
||||
return this->x2;
|
||||
}
|
||||
/*! \copydoc y1
|
||||
double getX2() const;
|
||||
/*! \copydoc y1
|
||||
\see see y1 for details */
|
||||
inline virtual void setY1(double __value)
|
||||
{
|
||||
this->y1 = __value;
|
||||
}
|
||||
/*! \copydoc y1
|
||||
void setY1(double __value);
|
||||
/*! \copydoc y1
|
||||
\see see y1 for details */
|
||||
inline virtual double getY1() const
|
||||
{
|
||||
return this->y1;
|
||||
}
|
||||
/*! \copydoc y2
|
||||
double getY1() const;
|
||||
/*! \copydoc y2
|
||||
\see see y2 for details */
|
||||
inline virtual void setY2(double __value)
|
||||
{
|
||||
this->y2 = __value;
|
||||
}
|
||||
/*! \copydoc y2
|
||||
void setY2(double __value);
|
||||
/*! \copydoc y2
|
||||
\see see y2 for details */
|
||||
inline virtual double getY2() const
|
||||
{
|
||||
return this->y2;
|
||||
}
|
||||
double getY2() const;
|
||||
protected:
|
||||
/** \brief x-coordinate of first point of overlay */
|
||||
double x1;
|
||||
/** \brief y-coordinate of first point of overlay */
|
||||
double y1;
|
||||
/** \brief x-coordinate of first second of overlay */
|
||||
double x2;
|
||||
/** \brief y-coordinate of first second of overlay */
|
||||
double y2;
|
||||
};
|
||||
|
||||
@ -284,21 +156,16 @@ class JKQTP_LIB_EXPORT JKQTPOverlayTwoPositionOverlay : public JKQTPOverlayEleme
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayOneCoordOverlay : public JKQTPOverlayElement {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JKQTPOverlayOneCoordOverlay(double pos, JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayOneCoordOverlay(double pos, JKQTBasePlotter *parent = nullptr);
|
||||
|
||||
/*! \copydoc position
|
||||
/*! \copydoc position
|
||||
\see see position for details */
|
||||
inline virtual void setPosition(double __value)
|
||||
{
|
||||
this->position = __value;
|
||||
}
|
||||
/*! \copydoc position
|
||||
void setPosition(double __value);
|
||||
/*! \copydoc position
|
||||
\see see position for details */
|
||||
inline virtual double getPosition() const
|
||||
{
|
||||
return this->position;
|
||||
}
|
||||
double getPosition() const;
|
||||
protected:
|
||||
/** \brief second position for the element */
|
||||
double position;
|
||||
};
|
||||
|
||||
@ -310,21 +177,16 @@ class JKQTP_LIB_EXPORT JKQTPOverlayOneCoordOverlay : public JKQTPOverlayElement
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayTwoCoordOverlay : public JKQTPOverlayOneCoordOverlay {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JKQTPOverlayTwoCoordOverlay(double pos, double pos2, JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayTwoCoordOverlay(double pos, double pos2, JKQTBasePlotter *parent = nullptr);
|
||||
|
||||
/*! \copydoc position2
|
||||
/*! \copydoc position2
|
||||
\see see position2 for details */
|
||||
inline virtual void setPosition2(double __value)
|
||||
{
|
||||
this->position2 = __value;
|
||||
}
|
||||
/*! \copydoc position2
|
||||
void setPosition2(double __value);
|
||||
/*! \copydoc position2
|
||||
\see see position2 for details */
|
||||
inline virtual double getPosition2() const
|
||||
{
|
||||
return this->position2;
|
||||
}
|
||||
double getPosition2() const;
|
||||
protected:
|
||||
/** \brief second position for the element */
|
||||
double position2;
|
||||
};
|
||||
|
||||
@ -336,14 +198,26 @@ class JKQTP_LIB_EXPORT JKQTPOverlayTwoCoordOverlay : public JKQTPOverlayOneCoord
|
||||
|
||||
These simple primitive elements can be used to e.g. display fast changing indicators on the graph ...
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayVerticalLine : public JKQTPOverlayOneCoordOverlay {
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayVerticalLine : public JKQTPOverlayOneCoordOverlay, public JKQTPGraphLineStyleMixin, public JKQTPGraphTextStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JKQTPOverlayVerticalLine(double pos, JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayVerticalLine(double pos, const QString& text, JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayVerticalLine(double pos, JKQTBasePlotter *parent = nullptr);
|
||||
explicit JKQTPOverlayVerticalLine(double pos, const QString& text, JKQTBasePlotter *parent = nullptr);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter);
|
||||
/** \brief set element color */
|
||||
virtual void setColor(QColor c);
|
||||
|
||||
/*! \copydoc text
|
||||
\see see text for details */
|
||||
void setText(const QString & __value);
|
||||
/*! \copydoc text
|
||||
\see see text for details */
|
||||
QString getText() const;
|
||||
protected:
|
||||
/** \brief a text to display next to the vertical line */
|
||||
QString text;
|
||||
};
|
||||
|
||||
|
||||
@ -353,28 +227,33 @@ class JKQTP_LIB_EXPORT JKQTPOverlayVerticalLine : public JKQTPOverlayOneCoordOve
|
||||
|
||||
These simple primitive elements can be used to e.g. display fast changing indicators on the graph ...
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayVerticalRange : public JKQTPOverlayTwoCoordOverlay {
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayVerticalRange : public JKQTPOverlayTwoCoordOverlay, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin, public JKQTPGraphTextStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JKQTPOverlayVerticalRange(double pos, double pos2, JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayVerticalRange(double pos, double pos2, const QString& text, JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayVerticalRange(double pos, double pos2, JKQTBasePlotter *parent = nullptr);
|
||||
explicit JKQTPOverlayVerticalRange(double pos, double pos2, const QString& text, JKQTBasePlotter *parent = nullptr);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter);
|
||||
/** \brief set element color */
|
||||
virtual void setColor(QColor c);
|
||||
|
||||
/*! \copydoc inverted
|
||||
/*! \copydoc inverted
|
||||
\see see inverted for details */
|
||||
inline virtual void setInverted(bool __value)
|
||||
{
|
||||
this->inverted = __value;
|
||||
}
|
||||
/*! \copydoc inverted
|
||||
void setInverted(bool __value);
|
||||
/*! \copydoc inverted
|
||||
\see see inverted for details */
|
||||
inline virtual bool getInverted() const
|
||||
{
|
||||
return this->inverted;
|
||||
}
|
||||
bool getInverted() const;
|
||||
|
||||
/*! \copydoc text
|
||||
\see see text for details */
|
||||
void setText(const QString & __value);
|
||||
/*! \copydoc text
|
||||
\see see text for details */
|
||||
QString getText() const;
|
||||
protected:
|
||||
/** \brief a text to display next to the range */
|
||||
QString text;
|
||||
/** \brief if set \c false, the range is filled, otherwise everything outside the range is filled */
|
||||
bool inverted;
|
||||
};
|
||||
@ -383,26 +262,22 @@ class JKQTP_LIB_EXPORT JKQTPOverlayVerticalRange : public JKQTPOverlayTwoCoordOv
|
||||
\ingroup jkqtplotter_overlays
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayLine : public JKQTPOverlayTwoPositionOverlay {
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayLine : public JKQTPOverlayTwoPositionOverlay, public JKQTPGraphLineStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JKQTPOverlayLine(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayLine(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = nullptr);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter);
|
||||
|
||||
/*! \copydoc infinite
|
||||
/*! \copydoc infinite
|
||||
\see see infinite for details */
|
||||
inline virtual void setInfinite(bool __value)
|
||||
{
|
||||
this->infinite = __value;
|
||||
}
|
||||
/*! \copydoc infinite
|
||||
void setInfinite(bool __value);
|
||||
/*! \copydoc infinite
|
||||
\see see infinite for details */
|
||||
inline virtual bool getInfinite() const
|
||||
{
|
||||
return this->infinite;
|
||||
}
|
||||
bool getInfinite() const;
|
||||
/** \brief set element color */
|
||||
virtual void setColor(QColor c);
|
||||
protected:
|
||||
/** \brief the line goes on infinitely */
|
||||
bool infinite;
|
||||
@ -412,13 +287,15 @@ class JKQTP_LIB_EXPORT JKQTPOverlayLine : public JKQTPOverlayTwoPositionOverlay
|
||||
\ingroup jkqtplotter_overlays
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayRectangle : public JKQTPOverlayTwoPositionOverlay {
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayRectangle : public JKQTPOverlayTwoPositionOverlay, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit JKQTPOverlayRectangle(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = 0);
|
||||
explicit JKQTPOverlayRectangle(double x1, double y1, double x2, double y2, JKQTBasePlotter *parent = nullptr);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter);
|
||||
/** \brief set element color */
|
||||
virtual void setColor(QColor c);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
@ -40,23 +40,11 @@ JKQTPBarVerticalGraph::JKQTPBarVerticalGraph(JKQTBasePlotter* parent):
|
||||
JKQTPXYGraph(parent)
|
||||
{
|
||||
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();
|
||||
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();
|
||||
}
|
||||
initFillStyle(parent, parentPlotStyle);
|
||||
initLineStyle(parent, parentPlotStyle);
|
||||
}
|
||||
|
||||
|
||||
@ -67,13 +55,9 @@ JKQTPBarVerticalGraph::JKQTPBarVerticalGraph(JKQTPlotter* parent):
|
||||
|
||||
void JKQTPBarVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
p.setColor(color);
|
||||
p.setStyle(style);
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
//int y=rect.top()+rect.height()/2.0;
|
||||
painter.setPen(p);
|
||||
painter.setBrush(b);
|
||||
@ -81,8 +65,8 @@ void JKQTPBarVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF&
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPBarVerticalGraph::getKeyLabelColor() {
|
||||
return fillColor;
|
||||
QColor JKQTPBarVerticalGraph::getKeyLabelColor() const {
|
||||
return getFillColor();
|
||||
}
|
||||
|
||||
|
||||
@ -96,15 +80,9 @@ void JKQTPBarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
drawErrorsBefore(painter);
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
||||
int imax=qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
|
||||
int imin=0;
|
||||
@ -346,15 +324,9 @@ void JKQTPBarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
drawErrorsBefore(painter);
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
||||
int imax=qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
|
||||
int imin=0;
|
||||
@ -536,23 +508,6 @@ bool JKQTPBarHorizontalGraph::isHorizontal() const
|
||||
|
||||
|
||||
|
||||
QBrush JKQTPBarVerticalGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
|
||||
QBrush b;
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
return b;
|
||||
}
|
||||
|
||||
QPen JKQTPBarVerticalGraph::getLinePen(JKQTPEnhancedPainter& painter) const {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
double JKQTPBarVerticalGraph::getParentStackedMax(int /*index*/) const
|
||||
{
|
||||
@ -576,16 +531,54 @@ bool JKQTPBarVerticalGraph::isHorizontal() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void JKQTPBarVerticalGraph::setColor(QColor c)
|
||||
{
|
||||
setLineColor(c);
|
||||
setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
|
||||
c.setAlphaF(0.5);
|
||||
setHighlightingLineColor(c);
|
||||
}
|
||||
|
||||
void JKQTPBarVerticalGraph::setShift(double __value)
|
||||
{
|
||||
this->shift = __value;
|
||||
}
|
||||
|
||||
double JKQTPBarVerticalGraph::getShift() const
|
||||
{
|
||||
return this->shift;
|
||||
}
|
||||
|
||||
void JKQTPBarVerticalGraph::setWidth(double __value)
|
||||
{
|
||||
this->width = __value;
|
||||
}
|
||||
|
||||
double JKQTPBarVerticalGraph::getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
|
||||
void JKQTPBarVerticalGraph::setBaseline(double __value)
|
||||
{
|
||||
this->baseline = __value;
|
||||
}
|
||||
|
||||
double JKQTPBarVerticalGraph::getBaseline() const
|
||||
{
|
||||
return this->baseline;
|
||||
}
|
||||
|
||||
void JKQTPBarVerticalGraph::setFillColor_and_darkenedColor(QColor fill, int colorDarker)
|
||||
{
|
||||
setFillColor(fill);
|
||||
setColor(fill.darker(colorDarker));
|
||||
setLineColor(fill.darker(colorDarker));
|
||||
}
|
||||
|
||||
JKQTPBarHorizontalErrorGraph::JKQTPBarHorizontalErrorGraph(JKQTBasePlotter *parent):
|
||||
JKQTPBarHorizontalGraph(parent), JKQTPXGraphErrors(color, parent)
|
||||
JKQTPBarHorizontalGraph(parent), JKQTPXGraphErrors(getKeyLabelColor(), parent)
|
||||
{
|
||||
setErrorColorFromGraphColor(color);
|
||||
setErrorColorFromGraphColor(getKeyLabelColor());
|
||||
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
|
||||
}
|
||||
|
||||
@ -649,9 +642,9 @@ void JKQTPBarHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter
|
||||
}
|
||||
|
||||
JKQTPBarVerticalErrorGraph::JKQTPBarVerticalErrorGraph(JKQTBasePlotter *parent):
|
||||
JKQTPBarVerticalGraph(parent), JKQTPYGraphErrors(color, parent)
|
||||
JKQTPBarVerticalGraph(parent), JKQTPYGraphErrors(getKeyLabelColor(), parent)
|
||||
{
|
||||
setErrorColorFromGraphColor(color);
|
||||
setErrorColorFromGraphColor(getKeyLabelColor());
|
||||
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
|
||||
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "jkqtplottertools/jkqtpimagetools.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbase.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
|
||||
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
#ifndef jkqtpgraphsbarchart_H
|
||||
#define jkqtpgraphsbarchart_H
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
By default the sift parameter is, so the bar is centered at the x-value. The width is 0.9,
|
||||
so adjacent bars are plotted with a small distance between them. It is possible to use these two parameters
|
||||
to plot multiple bars for every x-value, by having on JKQTPStepHorizontalGraph object per
|
||||
to plot multiple bars for every x-value, by having on JKQTPSpecialLineHorizontalGraph object per
|
||||
set of bars that belong together. For example for three bars per x-value one would set:
|
||||
\verbatim
|
||||
width=0.3
|
||||
@ -56,7 +56,7 @@
|
||||
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPBarVerticalGraph: public JKQTPXYGraph {
|
||||
class JKQTP_LIB_EXPORT JKQTPBarVerticalGraph: public JKQTPXYGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
@ -69,7 +69,7 @@ class JKQTP_LIB_EXPORT JKQTPBarVerticalGraph: public JKQTPXYGraph {
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
*
|
||||
@ -90,119 +90,42 @@ class JKQTP_LIB_EXPORT JKQTPBarVerticalGraph: public JKQTPXYGraph {
|
||||
* \note This function will scale ALL graphs of the parent plot, which were derived from JKQTPBarHorizontalGraph, that match in orientation (as returned by isHorizontal() ).
|
||||
*/
|
||||
virtual void autoscaleBarWidthAndShift(double maxWidth=0.9, double shrinkFactor=0.8);
|
||||
|
||||
/** \brief equivalent to \c autoscaleBarWidthAndShift(groupWidth,1);
|
||||
*/
|
||||
void autoscaleBarWidthAndShiftSeparatedGroups(double groupWidth=0.75);
|
||||
|
||||
/** \brief retruns \c true, if the bars are horizontal (JKQTPBarHorizontalGraph) and \c false if they are vertical (JKQTPBarVerticalGraph) */
|
||||
virtual bool isHorizontal() const;
|
||||
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
|
||||
{
|
||||
this->fillStyle = __value;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual Qt::BrushStyle getFillStyle() const
|
||||
{
|
||||
return this->fillStyle;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual void setStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->style = __value;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual Qt::PenStyle getStyle() const
|
||||
{
|
||||
return this->style;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
/** \brief set outline and fill color at the same time
|
||||
* \see setFillColor_and_darkenedColor()
|
||||
*/
|
||||
virtual void setColor(QColor c);
|
||||
|
||||
/*! \copydoc shift
|
||||
\see see shift for details */
|
||||
inline virtual void setShift(double __value)
|
||||
{
|
||||
this->shift = __value;
|
||||
}
|
||||
void setShift(double __value);
|
||||
/*! \copydoc shift
|
||||
\see see shift for details */
|
||||
inline virtual double getShift() const
|
||||
{
|
||||
return this->shift;
|
||||
}
|
||||
double getShift() const;
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual void setWidth(double __value)
|
||||
{
|
||||
this->width = __value;
|
||||
}
|
||||
void setWidth(double __value);
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual double getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
double getWidth() const;
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
inline virtual void setBaseline(double __value)
|
||||
{
|
||||
this->baseline = __value;
|
||||
}
|
||||
void setBaseline(double __value);
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
inline virtual double getBaseline() const
|
||||
{
|
||||
return this->baseline;
|
||||
}
|
||||
/** \brief sets the fill color and the color together, where fillColor is set to \a fill and the line-color is set to \c fill.darker(colorDarker) */
|
||||
double getBaseline() const;
|
||||
/** \brief sets the fill color and the color together, where fillColor is set to \a fill and the line-color is set to \c fill.darker(colorDarker)
|
||||
* \see setColor()
|
||||
*/
|
||||
void setFillColor_and_darkenedColor(QColor fill, int colorDarker=200);
|
||||
protected:
|
||||
/** \brief color of the graph */
|
||||
QColor color;
|
||||
/** \brief color of the graph fill */
|
||||
QColor fillColor;
|
||||
/** \brief linestyle of the graph lines */
|
||||
Qt::PenStyle style;
|
||||
/** \brief width (pt) of the graph, given in pt */
|
||||
double lineWidth;
|
||||
/** \brief fill style, if the curve should be filled */
|
||||
Qt::BrushStyle fillStyle;
|
||||
/** \brief the width of the bargraphs, relative to the distance between the current and the next x-value
|
||||
*
|
||||
* See the following graphic to understand this concept:
|
||||
@ -220,12 +143,6 @@ class JKQTP_LIB_EXPORT JKQTPBarVerticalGraph: public JKQTPXYGraph {
|
||||
*/
|
||||
double baseline;
|
||||
|
||||
/** \brief which plot style to use from the parent plotter (via JKQTBasePlotter::getPlotStyle() and JKQTBasePlotter::getNextStyle() ) */
|
||||
int parentPlotStyle;
|
||||
|
||||
|
||||
QBrush getBrush(JKQTPEnhancedPainter& painter) const;
|
||||
QPen getLinePen(JKQTPEnhancedPainter &painter) const;
|
||||
|
||||
/** \brief used to generate stacked plots: returns the upper boundary of this plot in a stack, for the index-th datapoint
|
||||
*
|
||||
|
@ -38,15 +38,14 @@ JKQTPPlotElement::JKQTPPlotElement(JKQTBasePlotter* parent):
|
||||
{
|
||||
title="";
|
||||
visible=true;
|
||||
highlighted=false;
|
||||
parentPlotStyle=-1;
|
||||
setParent(parent);
|
||||
}
|
||||
|
||||
JKQTPPlotElement::JKQTPPlotElement(JKQTPlotter *parent):
|
||||
QObject(parent->getPlotter())
|
||||
JKQTPPlotElement(parent->getPlotter())
|
||||
{
|
||||
title="";
|
||||
visible=true;
|
||||
setParent(parent);
|
||||
}
|
||||
|
||||
JKQTPGraph::JKQTPGraph(JKQTBasePlotter* parent):
|
||||
@ -96,6 +95,16 @@ bool JKQTPPlotElement::isVisible() const
|
||||
return this->visible;
|
||||
}
|
||||
|
||||
void JKQTPPlotElement::setHighlighted(bool __value)
|
||||
{
|
||||
highlighted=__value;
|
||||
}
|
||||
|
||||
bool JKQTPPlotElement::isHighlighted() const
|
||||
{
|
||||
return highlighted;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -303,131 +312,35 @@ JKQTPSingleColumnGraph::JKQTPSingleColumnGraph(JKQTBasePlotter *parent):
|
||||
{
|
||||
sortData=Unsorted;
|
||||
dataColumn=-1;
|
||||
color=QColor("red");
|
||||
style=Qt::SolidLine;
|
||||
lineWidth=2;
|
||||
parentPlotStyle=-1;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
style=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JKQTPSingleColumnGraph::JKQTPSingleColumnGraph(int dataColumn, JKQTBasePlotter *parent):
|
||||
JKQTPGraph(parent)
|
||||
{
|
||||
sortData=Unsorted;
|
||||
this->dataColumn=dataColumn;
|
||||
parentPlotStyle=-1;
|
||||
color=QColor("red");
|
||||
style=Qt::SolidLine;
|
||||
lineWidth=2;
|
||||
parentPlotStyle=-1;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
style=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
JKQTPSingleColumnGraph::JKQTPSingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style, double lineWidth, JKQTBasePlotter *parent):
|
||||
JKQTPGraph(parent)
|
||||
{
|
||||
sortData=Unsorted;
|
||||
this->dataColumn=dataColumn;
|
||||
this->color=color;
|
||||
this->style=style;
|
||||
this->lineWidth=lineWidth;
|
||||
parentPlotStyle=-1;
|
||||
}
|
||||
|
||||
|
||||
JKQTPSingleColumnGraph::JKQTPSingleColumnGraph(JKQTPlotter *parent):
|
||||
JKQTPGraph(parent)
|
||||
JKQTPSingleColumnGraph(parent->getPlotter())
|
||||
{
|
||||
sortData=Unsorted;
|
||||
dataColumn=-1;
|
||||
color=QColor("red");
|
||||
style=Qt::SolidLine;
|
||||
lineWidth=2;
|
||||
parentPlotStyle=-1;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
style=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JKQTPSingleColumnGraph::JKQTPSingleColumnGraph(int dataColumn, JKQTPlotter *parent):
|
||||
JKQTPGraph(parent)
|
||||
|
||||
void JKQTPSingleColumnGraph::setDataColumn(int __value)
|
||||
{
|
||||
sortData=Unsorted;
|
||||
this->dataColumn=dataColumn;
|
||||
parentPlotStyle=-1;
|
||||
color=QColor("red");
|
||||
style=Qt::SolidLine;
|
||||
lineWidth=2;
|
||||
parentPlotStyle=-1;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
style=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
|
||||
}
|
||||
this->dataColumn = __value;
|
||||
}
|
||||
|
||||
JKQTPSingleColumnGraph::JKQTPSingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style, double lineWidth, JKQTPlotter *parent):
|
||||
JKQTPGraph(parent)
|
||||
int JKQTPSingleColumnGraph::getDataColumn() const
|
||||
{
|
||||
sortData=Unsorted;
|
||||
this->dataColumn=dataColumn;
|
||||
this->color=color;
|
||||
this->style=style;
|
||||
this->lineWidth=lineWidth;
|
||||
parentPlotStyle=-1;
|
||||
return this->dataColumn;
|
||||
}
|
||||
|
||||
JKQTPSingleColumnGraph::JKQTPSingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style, JKQTPlotter *parent):
|
||||
JKQTPGraph(parent)
|
||||
void JKQTPSingleColumnGraph::setDataColumn(size_t __value) { this->dataColumn = static_cast<int>(__value); }
|
||||
|
||||
void JKQTPSingleColumnGraph::setDataSortOrder(const JKQTPSingleColumnGraph::DataSortOrder &__value)
|
||||
{
|
||||
sortData=Unsorted;
|
||||
this->dataColumn=dataColumn;
|
||||
this->color=color;
|
||||
this->style=style;
|
||||
this->lineWidth=2.0;
|
||||
parentPlotStyle=-1;
|
||||
this->sortData = __value;
|
||||
}
|
||||
|
||||
JKQTPSingleColumnGraph::JKQTPSingleColumnGraph(int dataColumn, QColor color, JKQTPlotter *parent):
|
||||
JKQTPGraph(parent)
|
||||
JKQTPSingleColumnGraph::DataSortOrder JKQTPSingleColumnGraph::getDataSortOrder() const
|
||||
{
|
||||
sortData=Unsorted;
|
||||
this->dataColumn=dataColumn;
|
||||
this->color=color;
|
||||
this->style=Qt::SolidLine;
|
||||
this->lineWidth=2.0;
|
||||
parentPlotStyle=-1;
|
||||
}
|
||||
QColor JKQTPSingleColumnGraph::getKeyLabelColor()
|
||||
{
|
||||
return color;
|
||||
return this->sortData;
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnGraph::setDataSortOrder(int __value) {
|
||||
@ -435,21 +348,21 @@ void JKQTPSingleColumnGraph::setDataSortOrder(int __value) {
|
||||
if (__value>0) sortData=Sorted;
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnGraph::setDataDirection(JKQTPSingleColumnGraph::DataDirection __value)
|
||||
{
|
||||
this->dataDirection = __value;
|
||||
}
|
||||
|
||||
JKQTPSingleColumnGraph::DataDirection JKQTPSingleColumnGraph::getDataDirection() const
|
||||
{
|
||||
return this->dataDirection;
|
||||
}
|
||||
|
||||
bool JKQTPSingleColumnGraph::usesColumn(int c) const
|
||||
{
|
||||
return c==dataColumn;
|
||||
}
|
||||
|
||||
QPen JKQTPSingleColumnGraph::getLinePen(JKQTPEnhancedPainter& painter) const
|
||||
{
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
return p;
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnGraph::intSortData()
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ class JKQTPDatastore;
|
||||
* - void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
|
||||
* - bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
|
||||
* - bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
|
||||
* - QColor getKeyLabelColor()=0;
|
||||
* - QColor getKeyLabelColor() const=0;
|
||||
* .
|
||||
*
|
||||
* Optionally you may also overwrite these functions to draw elements outside the actual plot area (like e.g. colorbars):
|
||||
@ -89,7 +89,7 @@ class JKQTP_LIB_EXPORT JKQTPPlotElement: public QObject {
|
||||
*/
|
||||
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero)=0;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor()=0;
|
||||
virtual QColor getKeyLabelColor() const=0;
|
||||
|
||||
/** \brief sets the title of the plot (for display in key!).
|
||||
*
|
||||
@ -101,6 +101,10 @@ class JKQTP_LIB_EXPORT JKQTPPlotElement: public QObject {
|
||||
void virtual setVisible(bool __value);
|
||||
/*! \brief returns whether the graph is visible in the plot */
|
||||
bool virtual isVisible() const;
|
||||
/*! \brief sets whether the graph is drawn in a highlighted style in the plot */
|
||||
void virtual setHighlighted(bool __value);
|
||||
/*! \brief returns whether the graph is shown in a highlighted style in the plot */
|
||||
bool virtual isHighlighted() const;
|
||||
|
||||
/** \brief returns the parent painter class */
|
||||
inline JKQTBasePlotter* getParent() { return parent; }
|
||||
@ -179,6 +183,10 @@ class JKQTP_LIB_EXPORT JKQTPPlotElement: public QObject {
|
||||
|
||||
/** \brief indicates whether the graph is visible in the plot */
|
||||
bool visible;
|
||||
/** \brief indicates whether the graph is shown in a "highlghted" in the plot */
|
||||
bool highlighted;
|
||||
/** \brief internal storage for the used parent plot style */
|
||||
int parentPlotStyle;
|
||||
};
|
||||
|
||||
/** \brief this virtual base class of the (data-column based) graphs,
|
||||
@ -432,101 +440,45 @@ class JKQTP_LIB_EXPORT JKQTPSingleColumnGraph: public JKQTPGraph {
|
||||
|
||||
/** \brief class constructor */
|
||||
JKQTPSingleColumnGraph(JKQTBasePlotter* parent=nullptr);
|
||||
JKQTPSingleColumnGraph(int dataColumn, JKQTBasePlotter* parent=nullptr);
|
||||
JKQTPSingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style=Qt::SolidLine, double lineWidth=2.0, JKQTBasePlotter* parent=nullptr);
|
||||
JKQTPSingleColumnGraph(JKQTPlotter* parent);
|
||||
JKQTPSingleColumnGraph(int dataColumn, JKQTPlotter* parent);
|
||||
JKQTPSingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style, double lineWidth, JKQTPlotter* parent);
|
||||
JKQTPSingleColumnGraph(int dataColumn, QColor color, Qt::PenStyle style, JKQTPlotter* parent);
|
||||
JKQTPSingleColumnGraph(int dataColumn, QColor color, JKQTPlotter* parent);
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override ;
|
||||
|
||||
/*! \copydoc dataColumn
|
||||
\see see dataColumn for details */
|
||||
inline virtual void setDataColumn(int __value)
|
||||
{
|
||||
this->dataColumn = __value;
|
||||
}
|
||||
void setDataColumn(int __value);
|
||||
/*! \copydoc dataColumn
|
||||
\see see dataColumn for details */
|
||||
inline virtual int getDataColumn() const
|
||||
{
|
||||
return this->dataColumn;
|
||||
}
|
||||
int getDataColumn() const;
|
||||
/*! \brief sets the property dataColumn ( \copybrief dataColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter dataColumn is: <BLOCKQUOTE>\copydoc dataColumn </BLOCKQUOTE>
|
||||
\see dataColumn for more information */
|
||||
inline virtual void setDataColumn (size_t __value) { this->dataColumn = static_cast<int>(__value); }
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual void setStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->style = __value;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual Qt::PenStyle getStyle() const
|
||||
{
|
||||
return this->style;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
void setDataColumn (size_t __value);
|
||||
|
||||
/*! \copydoc sortData
|
||||
\see see sortData for details */
|
||||
inline virtual void setDataSortOrder(const DataSortOrder & __value)
|
||||
{
|
||||
this->sortData = __value;
|
||||
}
|
||||
void setDataSortOrder(const DataSortOrder & __value);
|
||||
/*! \copydoc sortData
|
||||
\see see sortData for details */
|
||||
inline virtual DataSortOrder getDataSortOrder() const
|
||||
{
|
||||
return this->sortData;
|
||||
}
|
||||
DataSortOrder getDataSortOrder() const;
|
||||
/*! \brief sets the property sortData ( \copybrief sortData ) to the specified \a __value. \details Description of the parameter sortData is: <BLOCKQUOTE>\copydoc sortData </BLOCKQUOTE> \see sortData for more information */
|
||||
void setDataSortOrder(int __value);
|
||||
|
||||
|
||||
/*! \copydoc dataDirection
|
||||
\see see dataDirection for details */
|
||||
void setDataDirection(DataDirection __value);
|
||||
/*! \copydoc dataDirection
|
||||
\see see dataDirection for details */
|
||||
DataDirection getDataDirection() const;
|
||||
|
||||
/** \copydoc JKQTPGraph::usesColumn() */
|
||||
virtual bool usesColumn(int c) const override;
|
||||
|
||||
protected:
|
||||
/** \brief the column that contains the datapoints */
|
||||
int dataColumn;
|
||||
/** \brief interpret the data from dataColumn either as X- or Y-data */
|
||||
DataDirection dataDirection;
|
||||
|
||||
/** \brief which plot style to use from the parent plotter (via JKQTBasePlotter::getPlotStyle() and JKQTBasePlotter::getNextStyle() ) */
|
||||
int parentPlotStyle;
|
||||
|
||||
/** \brief color of the graph */
|
||||
QColor color;
|
||||
/** \brief linestyle of the graph lines */
|
||||
Qt::PenStyle style;
|
||||
/** \brief width (pt) of the graph, given in pt */
|
||||
double lineWidth;
|
||||
|
||||
QPen getLinePen(JKQTPEnhancedPainter &painter) const;
|
||||
|
||||
/** \brief if \c !=Unsorted, the data is sorted before plotting */
|
||||
DataSortOrder sortData;
|
||||
@ -538,7 +490,7 @@ class JKQTP_LIB_EXPORT JKQTPSingleColumnGraph: public JKQTPGraph {
|
||||
* This function can beu used to get the correct datapoint after sorting the datapoints,
|
||||
* As sorting is done by sorting an index and not reordering the data in the columns themselves.
|
||||
* */
|
||||
inline int getDataIndex(int i) {
|
||||
inline int getDataIndex(int i) {
|
||||
if (sortData==Unsorted) return i;
|
||||
return sortedIndices.value(i,i);
|
||||
}
|
||||
|
@ -63,6 +63,66 @@ void JKQTPGraphErrors::setErrorStyleFromPen(const JKQTBasePlotter::JKQTPPen &pen
|
||||
errorbarSize=pen.symbolSize()*0.75;
|
||||
}
|
||||
|
||||
void JKQTPGraphErrors::setErrorColor(const QColor &__value)
|
||||
{
|
||||
this->errorColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPGraphErrors::getErrorColor() const
|
||||
{
|
||||
return this->errorColor;
|
||||
}
|
||||
|
||||
void JKQTPGraphErrors::setErrorStyle(const Qt::PenStyle &__value)
|
||||
{
|
||||
this->errorStyle = __value;
|
||||
}
|
||||
|
||||
Qt::PenStyle JKQTPGraphErrors::getErrorStyle() const
|
||||
{
|
||||
return this->errorStyle;
|
||||
}
|
||||
|
||||
void JKQTPGraphErrors::setErrorWidth(double __value)
|
||||
{
|
||||
this->errorWidth = __value;
|
||||
}
|
||||
|
||||
double JKQTPGraphErrors::getErrorWidth() const
|
||||
{
|
||||
return this->errorWidth;
|
||||
}
|
||||
|
||||
void JKQTPGraphErrors::setErrorFillColor(const QColor &__value)
|
||||
{
|
||||
this->errorFillColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPGraphErrors::getErrorFillColor() const
|
||||
{
|
||||
return this->errorFillColor;
|
||||
}
|
||||
|
||||
void JKQTPGraphErrors::setErrorFillStyle(const Qt::BrushStyle &__value)
|
||||
{
|
||||
this->errorFillStyle = __value;
|
||||
}
|
||||
|
||||
Qt::BrushStyle JKQTPGraphErrors::getErrorFillStyle() const
|
||||
{
|
||||
return this->errorFillStyle;
|
||||
}
|
||||
|
||||
void JKQTPGraphErrors::setErrorbarSize(double __value)
|
||||
{
|
||||
this->errorbarSize = __value;
|
||||
}
|
||||
|
||||
double JKQTPGraphErrors::getErrorbarSize() const
|
||||
{
|
||||
return this->errorbarSize;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void JKQTPGraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, int xErrorColumnLower, int yErrorColumnLower, bool xErrorSymmetric, bool yErrorSymmetric, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
|
||||
|
@ -58,76 +58,40 @@ class JKQTP_LIB_EXPORT JKQTPGraphErrors {
|
||||
|
||||
/*! \copydoc errorColor
|
||||
\see see errorColor for details */
|
||||
inline virtual void setErrorColor(const QColor & __value)
|
||||
{
|
||||
this->errorColor = __value;
|
||||
}
|
||||
void setErrorColor(const QColor & __value);
|
||||
/*! \copydoc errorColor
|
||||
\see see errorColor for details */
|
||||
inline virtual QColor getErrorColor() const
|
||||
{
|
||||
return this->errorColor;
|
||||
}
|
||||
QColor getErrorColor() const;
|
||||
/*! \copydoc errorStyle
|
||||
\see see errorStyle for details */
|
||||
inline virtual void setErrorStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->errorStyle = __value;
|
||||
}
|
||||
void setErrorStyle(const Qt::PenStyle & __value);
|
||||
/*! \copydoc errorStyle
|
||||
\see see errorStyle for details */
|
||||
inline virtual Qt::PenStyle getErrorStyle() const
|
||||
{
|
||||
return this->errorStyle;
|
||||
}
|
||||
Qt::PenStyle getErrorStyle() const;
|
||||
/*! \copydoc errorWidth
|
||||
\see see errorWidth for details */
|
||||
inline virtual void setErrorWidth(double __value)
|
||||
{
|
||||
this->errorWidth = __value;
|
||||
}
|
||||
void setErrorWidth(double __value);
|
||||
/*! \copydoc errorWidth
|
||||
\see see errorWidth for details */
|
||||
inline virtual double getErrorWidth() const
|
||||
{
|
||||
return this->errorWidth;
|
||||
}
|
||||
double getErrorWidth() const;
|
||||
/*! \copydoc errorFillColor
|
||||
\see see errorFillColor for details */
|
||||
inline virtual void setErrorFillColor(const QColor & __value)
|
||||
{
|
||||
this->errorFillColor = __value;
|
||||
}
|
||||
void setErrorFillColor(const QColor & __value);
|
||||
/*! \copydoc errorFillColor
|
||||
\see see errorFillColor for details */
|
||||
inline virtual QColor getErrorFillColor() const
|
||||
{
|
||||
return this->errorFillColor;
|
||||
}
|
||||
QColor getErrorFillColor() const;
|
||||
/*! \copydoc errorFillStyle
|
||||
\see see errorFillStyle for details */
|
||||
inline virtual void setErrorFillStyle(const Qt::BrushStyle & __value)
|
||||
{
|
||||
this->errorFillStyle = __value;
|
||||
}
|
||||
void setErrorFillStyle(const Qt::BrushStyle & __value);
|
||||
/*! \copydoc errorFillStyle
|
||||
\see see errorFillStyle for details */
|
||||
inline virtual Qt::BrushStyle getErrorFillStyle() const
|
||||
{
|
||||
return this->errorFillStyle;
|
||||
}
|
||||
Qt::BrushStyle getErrorFillStyle() const;
|
||||
/*! \copydoc errorbarSize
|
||||
\see see errorbarSize for details */
|
||||
inline virtual void setErrorbarSize(double __value)
|
||||
{
|
||||
this->errorbarSize = __value;
|
||||
}
|
||||
void setErrorbarSize(double __value);
|
||||
/*! \copydoc errorbarSize
|
||||
\see see errorbarSize for details */
|
||||
inline virtual double getErrorbarSize() const
|
||||
{
|
||||
return this->errorbarSize;
|
||||
}
|
||||
double getErrorbarSize() const;
|
||||
/** \brief returns true, if the error plots use the given column */
|
||||
virtual bool errorUsesColumn(int c) const;
|
||||
|
||||
|
446
lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp
Normal file
@ -0,0 +1,446 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
#include "jkqtplotter/jkqtpbaseplotter.h"
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
JKQTPGraphLineStyleMixin::JKQTPGraphLineStyleMixin()
|
||||
{
|
||||
m_linePen=QPen(QColor("red"), Qt::SolidLine);
|
||||
m_linePen.setJoinStyle(Qt::RoundJoin);
|
||||
m_linePen.setCapStyle(Qt::RoundCap);
|
||||
m_lineWidth=2;
|
||||
m_highlightingLineColor=QColor("yellow");
|
||||
m_highlightingLineColor.setAlphaF(0.5);
|
||||
}
|
||||
|
||||
void JKQTPGraphLineStyleMixin::initLineStyle(JKQTBasePlotter* parent, int &parentPlotStyle)
|
||||
{
|
||||
if (parent) { // get style settings from parent object
|
||||
if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
|
||||
m_linePen.setColor(parent->getPlotStyle(parentPlotStyle).color());
|
||||
m_linePen.setStyle(parent->getPlotStyle(parentPlotStyle).style());
|
||||
m_lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
m_highlightingLineColor=getLineColor();
|
||||
m_highlightingLineColor.setAlphaF(0.5);
|
||||
}
|
||||
}
|
||||
|
||||
JKQTPGraphLineStyleMixin::~JKQTPGraphLineStyleMixin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGraphLineStyleMixin::setLineColor(const QColor &__value)
|
||||
{
|
||||
m_linePen.setColor(__value);
|
||||
}
|
||||
|
||||
QColor JKQTPGraphLineStyleMixin::getLineColor() const
|
||||
{
|
||||
return m_linePen.color();
|
||||
}
|
||||
|
||||
void JKQTPGraphLineStyleMixin::setLineStyle(Qt::PenStyle __value)
|
||||
{
|
||||
m_linePen.setStyle(__value);
|
||||
}
|
||||
|
||||
Qt::PenStyle JKQTPGraphLineStyleMixin::getLineStyle() const
|
||||
{
|
||||
return m_linePen.style();
|
||||
}
|
||||
|
||||
void JKQTPGraphLineStyleMixin::setLineWidth(double __value)
|
||||
{
|
||||
this->m_lineWidth = __value;
|
||||
}
|
||||
|
||||
double JKQTPGraphLineStyleMixin::getLineWidth() const
|
||||
{
|
||||
return this->m_lineWidth;
|
||||
}
|
||||
|
||||
void JKQTPGraphLineStyleMixin::setLineDashOffset(qreal offset)
|
||||
{
|
||||
m_linePen.setDashOffset(offset);
|
||||
}
|
||||
|
||||
qreal JKQTPGraphLineStyleMixin::getLineDashOffset() const
|
||||
{
|
||||
return m_linePen.dashOffset();
|
||||
}
|
||||
|
||||
void JKQTPGraphLineStyleMixin::setLineDashPattern(const QVector<qreal> &pattern)
|
||||
{
|
||||
m_linePen.setDashPattern(pattern);
|
||||
m_linePen.setStyle(Qt::CustomDashLine);
|
||||
}
|
||||
|
||||
QVector<qreal> JKQTPGraphLineStyleMixin::getLineDashPattern() const
|
||||
{
|
||||
return m_linePen.dashPattern();
|
||||
}
|
||||
|
||||
void JKQTPGraphLineStyleMixin::setLineJoinStyle(Qt::PenJoinStyle style)
|
||||
{
|
||||
m_linePen.setJoinStyle(style);
|
||||
}
|
||||
|
||||
Qt::PenJoinStyle JKQTPGraphLineStyleMixin::getLineJoinStyle() const
|
||||
{
|
||||
return m_linePen.joinStyle();
|
||||
}
|
||||
|
||||
void JKQTPGraphLineStyleMixin::setLineCapStyle(Qt::PenCapStyle style)
|
||||
{
|
||||
m_linePen.setCapStyle(style);
|
||||
}
|
||||
|
||||
Qt::PenCapStyle JKQTPGraphLineStyleMixin::getLineCapStyle() const
|
||||
{
|
||||
return m_linePen.capStyle();
|
||||
}
|
||||
|
||||
|
||||
QPen JKQTPGraphLineStyleMixin::getLinePen(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent) const {
|
||||
QPen p=m_linePen;
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*m_lineWidth)));
|
||||
return p;
|
||||
}
|
||||
|
||||
QPen JKQTPGraphLineStyleMixin::getLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
|
||||
{
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setJoinStyle(Qt::MiterJoin);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JKQTPGraphSymbolStyleMixin::JKQTPGraphSymbolStyleMixin()
|
||||
{
|
||||
m_symbolColor=QColor("red");
|
||||
m_symbolType=JKQTPGraphSymbols::JKQTPDefaultSymbol;
|
||||
m_symbolSize=12;
|
||||
m_symbolFillColor=m_symbolColor.lighter();
|
||||
m_symbolLineWidth=1;
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::initSymbolStyle(JKQTBasePlotter *parent, int& parentPlotStyle)
|
||||
{
|
||||
if (parent) { // get style settings from parent object
|
||||
if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
|
||||
m_symbolColor=parent->getPlotStyle(parentPlotStyle).color();
|
||||
m_symbolSize=parent->getPlotStyle(parentPlotStyle).symbolSize();
|
||||
m_symbolLineWidth=parent->getPlotStyle(parentPlotStyle).symbolLineWidthF();
|
||||
m_symbolType=parent->getPlotStyle(parentPlotStyle).symbol();
|
||||
m_symbolFillColor=parent->getPlotStyle(parentPlotStyle).symbolFillColor();
|
||||
}
|
||||
}
|
||||
|
||||
JKQTPGraphSymbolStyleMixin::~JKQTPGraphSymbolStyleMixin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::setSymbolType(JKQTPGraphSymbols __value)
|
||||
{
|
||||
m_symbolType=__value;
|
||||
}
|
||||
|
||||
JKQTPGraphSymbols JKQTPGraphSymbolStyleMixin::getSymbolType() const
|
||||
{
|
||||
return m_symbolType;
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::setSymbolSize(double __value)
|
||||
{
|
||||
m_symbolSize=__value;
|
||||
}
|
||||
|
||||
double JKQTPGraphSymbolStyleMixin::getSymbolSize() const
|
||||
{
|
||||
return m_symbolSize;
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::setSymbolColor(const QColor &__value)
|
||||
{
|
||||
m_symbolColor=__value;
|
||||
}
|
||||
|
||||
QColor JKQTPGraphSymbolStyleMixin::getSymbolColor() const
|
||||
{
|
||||
return m_symbolColor;
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::setSymbolFillColor(const QColor &__value)
|
||||
{
|
||||
m_symbolFillColor=__value;
|
||||
}
|
||||
|
||||
QColor JKQTPGraphSymbolStyleMixin::getSymbolFillColor() const
|
||||
{
|
||||
return m_symbolFillColor;
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::setSymbolLineWidth(double __value)
|
||||
{
|
||||
m_symbolLineWidth=__value;
|
||||
}
|
||||
|
||||
double JKQTPGraphSymbolStyleMixin::getSymbolLineWidth() const
|
||||
{
|
||||
return m_symbolLineWidth;
|
||||
}
|
||||
|
||||
QPen JKQTPGraphSymbolStyleMixin::getSymbolPen(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent) const {
|
||||
QPen p;
|
||||
p.setColor(m_symbolColor);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*m_symbolLineWidth)));
|
||||
p.setStyle(Qt::SolidLine);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
return p;
|
||||
}
|
||||
|
||||
QBrush JKQTPGraphSymbolStyleMixin::getSymbolBrush(JKQTPEnhancedPainter& /*painter*/, JKQTBasePlotter* /*parent*/) const {
|
||||
QBrush b;
|
||||
b.setColor(m_symbolFillColor);
|
||||
return b;
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double x, double y) const
|
||||
{
|
||||
JKQTPPlotSymbol(painter, x, y,m_symbolType, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor);
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double x, double y, JKQTPGraphSymbols type) const
|
||||
{
|
||||
JKQTPPlotSymbol(painter, x, y,type, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor);
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double x, double y, double symbolSize) const
|
||||
{
|
||||
JKQTPPlotSymbol(painter, x, y,m_symbolType, symbolSize, parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), m_symbolColor, m_symbolFillColor);
|
||||
}
|
||||
|
||||
void JKQTPGraphSymbolStyleMixin::plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double x, double y, QColor color, QColor fillColor) const
|
||||
{
|
||||
JKQTPPlotSymbol(painter, x, y,m_symbolType, parent->pt2px(painter, m_symbolSize), parent->pt2px(painter, m_symbolLineWidth*parent->getLineWidthMultiplier()), color, fillColor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JKQTPGraphFillStyleMixin::JKQTPGraphFillStyleMixin()
|
||||
{
|
||||
m_fillColor=QColor("red").lighter();
|
||||
m_fillBrush.setColor(m_fillColor);
|
||||
m_fillBrush.setStyle(Qt::SolidPattern);
|
||||
}
|
||||
|
||||
|
||||
void JKQTPGraphFillStyleMixin::initFillStyle(JKQTBasePlotter *parent, int &parentPlotStyle)
|
||||
{
|
||||
if (parent) { // get style settings from parent object
|
||||
if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
|
||||
m_fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
|
||||
m_fillBrush.setColor(m_fillColor);
|
||||
m_fillBrush.setStyle(parent->getPlotStyle(parentPlotStyle).fillStyle());
|
||||
}
|
||||
}
|
||||
|
||||
JKQTPGraphFillStyleMixin::~JKQTPGraphFillStyleMixin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGraphFillStyleMixin::setFillStyle(Qt::BrushStyle __value)
|
||||
{
|
||||
if (m_fillBrush.style()==Qt::LinearGradientPattern || m_fillBrush.style()==Qt::RadialGradientPattern || m_fillBrush.style()==Qt::ConicalGradientPattern || m_fillBrush.style()==Qt::TexturePattern) {
|
||||
m_fillBrush=QBrush(m_fillColor, __value);
|
||||
} else {
|
||||
m_fillBrush.setStyle(__value);
|
||||
}
|
||||
}
|
||||
|
||||
Qt::BrushStyle JKQTPGraphFillStyleMixin::getFillStyle() const
|
||||
{
|
||||
return m_fillBrush.style();
|
||||
}
|
||||
|
||||
void JKQTPGraphFillStyleMixin::setFillColor(const QColor &__value)
|
||||
{
|
||||
m_fillColor=__value;
|
||||
m_fillBrush.setColor(m_fillColor);
|
||||
}
|
||||
|
||||
QColor JKQTPGraphFillStyleMixin::getFillColor() const
|
||||
{
|
||||
return m_fillBrush.color();
|
||||
}
|
||||
|
||||
void JKQTPGraphFillStyleMixin::setFillTexture(const QPixmap &__value)
|
||||
{
|
||||
m_fillBrush.setStyle(Qt::TexturePattern);
|
||||
m_fillBrush.setTexture(__value);
|
||||
}
|
||||
|
||||
void JKQTPGraphFillStyleMixin::setFillTexture(const QImage &__value)
|
||||
{
|
||||
m_fillBrush.setStyle(Qt::TexturePattern);
|
||||
m_fillBrush.setTextureImage(__value);
|
||||
}
|
||||
|
||||
QPixmap JKQTPGraphFillStyleMixin::getFillTexture() const
|
||||
{
|
||||
return m_fillBrush.texture();
|
||||
}
|
||||
|
||||
QImage JKQTPGraphFillStyleMixin::getFillTextureImage() const
|
||||
{
|
||||
return m_fillBrush.textureImage();
|
||||
}
|
||||
|
||||
void JKQTPGraphFillStyleMixin::setFillGradient(const QGradient &__value)
|
||||
{
|
||||
m_fillBrush=QBrush(__value);
|
||||
}
|
||||
|
||||
const QGradient *JKQTPGraphFillStyleMixin::getFillGradient() const
|
||||
{
|
||||
return m_fillBrush.gradient();
|
||||
}
|
||||
|
||||
void JKQTPGraphFillStyleMixin::setFillBrush(const QBrush &b)
|
||||
{
|
||||
m_fillBrush=b;
|
||||
m_fillColor=b.color();
|
||||
}
|
||||
|
||||
void JKQTPGraphFillStyleMixin::setFillTransform(const QMatrix &b)
|
||||
{
|
||||
m_fillBrush.setMatrix(b);
|
||||
}
|
||||
|
||||
void JKQTPGraphFillStyleMixin::setFillTransform(const QTransform &b)
|
||||
{
|
||||
m_fillBrush.setTransform(b);
|
||||
}
|
||||
|
||||
QBrush JKQTPGraphFillStyleMixin::getFillBrush(JKQTPEnhancedPainter &/*painter*/, JKQTBasePlotter */*parent*/) const
|
||||
{
|
||||
return m_fillBrush;
|
||||
}
|
||||
|
||||
|
||||
void JKQTPGraphLineStyleMixin::setHighlightingLineColor(const QColor &__value)
|
||||
{
|
||||
m_highlightingLineColor=__value;
|
||||
}
|
||||
|
||||
QColor JKQTPGraphLineStyleMixin::getHighlightingLineColor() const
|
||||
{
|
||||
return m_highlightingLineColor;
|
||||
}
|
||||
|
||||
QPen JKQTPGraphLineStyleMixin::getHighlightingLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
|
||||
{
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setColor(m_highlightingLineColor);
|
||||
p.setWidthF(p.widthF()*3.0);
|
||||
return p;
|
||||
}
|
||||
|
||||
QPen JKQTPGraphLineStyleMixin::getHighlightingLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
|
||||
{
|
||||
QPen p=getHighlightingLinePen(painter, parent);
|
||||
p.setJoinStyle(Qt::MiterJoin);
|
||||
return p;
|
||||
}
|
||||
|
||||
JKQTPGraphTextStyleMixin::JKQTPGraphTextStyleMixin(JKQTBasePlotter *parent)
|
||||
{
|
||||
m_textFontName=parent->getDefaultTextFontName();
|
||||
m_textFontSize=parent->getDefaultTextSize();
|
||||
m_textColor=parent->getDefaultTextColor();
|
||||
}
|
||||
|
||||
void JKQTPGraphTextStyleMixin::initTextStyle(JKQTBasePlotter *parent, int &parentPlotStyle)
|
||||
{
|
||||
if (parent) { // get style settings from parent object
|
||||
if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
|
||||
m_textColor=parent->getPlotStyle(parentPlotStyle).color();
|
||||
}
|
||||
}
|
||||
|
||||
JKQTPGraphTextStyleMixin::~JKQTPGraphTextStyleMixin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGraphTextStyleMixin::setTextFontSize(double __value)
|
||||
{
|
||||
m_textFontSize=__value;
|
||||
}
|
||||
|
||||
double JKQTPGraphTextStyleMixin::getTextFontSize() const
|
||||
{
|
||||
return m_textFontSize;
|
||||
}
|
||||
|
||||
void JKQTPGraphTextStyleMixin::setTextFontName(const QString &__value)
|
||||
{
|
||||
m_textFontName=__value;
|
||||
}
|
||||
|
||||
QString JKQTPGraphTextStyleMixin::getTextFontName() const
|
||||
{
|
||||
return m_textFontName;
|
||||
}
|
||||
|
||||
void JKQTPGraphTextStyleMixin::setTextColor(const QColor &__value)
|
||||
{
|
||||
m_textColor=__value;
|
||||
}
|
||||
|
||||
QColor JKQTPGraphTextStyleMixin::getTextColor() const
|
||||
{
|
||||
return m_textColor;
|
||||
}
|
381
lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h
Normal file
@ -0,0 +1,381 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
#include <QPen>
|
||||
#include <QBrush>
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtplottertools/jkqtpdrawingtools.h"
|
||||
|
||||
|
||||
#ifndef jkqtpgraphsbasestylingmixins_H
|
||||
#define jkqtpgraphsbasestylingmixins_H
|
||||
|
||||
|
||||
class JKQTBasePlotter; // forward
|
||||
class JKQTPlotter; // forward
|
||||
|
||||
|
||||
/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for the graph line style
|
||||
\ingroup jkqtplotter_basegraphs_stylemixins
|
||||
|
||||
supported properties:
|
||||
- line color
|
||||
- line width
|
||||
- line style (including custom dash patterns, as in QPen)
|
||||
- line color, when graph is highlighted
|
||||
.
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPGraphLineStyleMixin {
|
||||
Q_GADGET
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPGraphLineStyleMixin();
|
||||
/** \brief initiaize the line style (from the parent plotter) */
|
||||
void initLineStyle(JKQTBasePlotter *parent, int &parentPlotStyle);
|
||||
|
||||
virtual ~JKQTPGraphLineStyleMixin();
|
||||
|
||||
/** \brief set the color of the graph line */
|
||||
void setLineColor(const QColor & __value);
|
||||
/** \brief get the color of the graph line */
|
||||
QColor getLineColor() const;
|
||||
|
||||
/** \brief set the style of the graph line */
|
||||
void setLineStyle(Qt::PenStyle __value);
|
||||
/** \brief get the style of the graph line */
|
||||
Qt::PenStyle getLineStyle() const;
|
||||
|
||||
/** \brief set the line width of the graph line (in pt) */
|
||||
void setLineWidth(double __value);
|
||||
/** \brief get the line width of the graph line (in pt) */
|
||||
double getLineWidth() const;
|
||||
|
||||
/** \brief sets the dash offset for a custom dash style
|
||||
* \see https://doc.qt.io/qt-5/qpen.html#setDashOffset
|
||||
*/
|
||||
void setLineDashOffset(qreal offset);
|
||||
/** \brief returns the dash offset for a custom dash style
|
||||
* \see https://doc.qt.io/qt-5/qpen.html#setDashOffset
|
||||
*/
|
||||
qreal getLineDashOffset() const;
|
||||
/** \brief sets the dash pattern for a custom dash style
|
||||
* \see https://doc.qt.io/qt-5/qpen.html#setDashPattern
|
||||
*/
|
||||
void setLineDashPattern(const QVector<qreal> &pattern);
|
||||
/** \brief gets the dash pattern for a custom dash style
|
||||
* \see https://doc.qt.io/qt-5/qpen.html#setDashPattern
|
||||
*/
|
||||
QVector<qreal> getLineDashPattern() const;
|
||||
/** \brief sets the join style
|
||||
* \see https://doc.qt.io/qt-5/qpen.html#setJoinStyle
|
||||
*/
|
||||
void setLineJoinStyle(Qt::PenJoinStyle style);
|
||||
/** \brief returns the join style
|
||||
* \see https://doc.qt.io/qt-5/qpen.html#setJoinStyle
|
||||
*/
|
||||
Qt::PenJoinStyle getLineJoinStyle() const;
|
||||
/** \brief sets the cap style
|
||||
* \see https://doc.qt.io/qt-5/qpen.html#setCapStyle
|
||||
*/
|
||||
void setLineCapStyle(Qt::PenCapStyle style);
|
||||
/** \brief gets the cap style
|
||||
* \see https://doc.qt.io/qt-5/qpen.html#setCapStyle
|
||||
*/
|
||||
Qt::PenCapStyle getLineCapStyle() const;
|
||||
|
||||
|
||||
/** \brief set the color of the graph line when highlighted */
|
||||
void setHighlightingLineColor(const QColor & __value);
|
||||
/** \brief get the color of the graph line when highlighted */
|
||||
QColor getHighlightingLineColor() const;
|
||||
|
||||
|
||||
Q_PROPERTY(QColor highlightingLineColor MEMBER m_highlightingLineColor READ getHighlightingLineColor WRITE setHighlightingLineColor)
|
||||
Q_PROPERTY(QColor lineColor MEMBER m_lineColor READ getLineColor WRITE setLineColor)
|
||||
Q_PROPERTY(Qt::PenStyle lineStyle MEMBER m_lineStyle READ getLineStyle WRITE setLineStyle)
|
||||
Q_PROPERTY(double lineWidth MEMBER m_lineWidth READ getLineWidth WRITE setLineWidth)
|
||||
private:
|
||||
/** \brief line pen */
|
||||
QPen m_linePen;
|
||||
/** \brief width of the graph, given in pt */
|
||||
double m_lineWidth;
|
||||
/** \brief line pen for the highlighted look */
|
||||
QColor m_highlightingLineColor;
|
||||
protected:
|
||||
/** \brief constructs a QPen from the line styleing properties */
|
||||
QPen getLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
/** \brief constructs a QPen from the line styleing properties, suitable for drawing rectangles with sharp edges */
|
||||
QPen getLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
/** \brief constructs a QPen from the line styleing properties */
|
||||
QPen getHighlightingLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
/** \brief constructs a QPen from the line styleing properties, suitable for drawing rectangle with sharp corners */
|
||||
QPen getHighlightingLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for the graph symbols style
|
||||
\ingroup jkqtplotter_basegraphs_stylemixins
|
||||
|
||||
supported properties:
|
||||
- symbol style
|
||||
- symbol size
|
||||
- symbol (outline) color
|
||||
- symbol fill color (not required for all symbols)
|
||||
- symbol (line) width
|
||||
.
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPGraphSymbolStyleMixin {
|
||||
Q_GADGET
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPGraphSymbolStyleMixin();
|
||||
/** \brief initiaize the symbol style (from the parent plotter) */
|
||||
void initSymbolStyle(JKQTBasePlotter *parent, int &parentPlotStyle);
|
||||
|
||||
virtual ~JKQTPGraphSymbolStyleMixin();
|
||||
|
||||
/** \brief set the type of the graph symbol */
|
||||
void setSymbolType(JKQTPGraphSymbols __value);
|
||||
/** \brief get the type of the graph symbol */
|
||||
JKQTPGraphSymbols getSymbolType() const;
|
||||
|
||||
/** \brief set the size (=diameter in pt) of the graph symbol (in pt) */
|
||||
void setSymbolSize(double __value);
|
||||
/** \brief get the size (=diameter in pt) of the graph symbol (in pt) */
|
||||
double getSymbolSize() const;
|
||||
|
||||
/** \brief set the color of the graph symbols */
|
||||
void setSymbolColor(const QColor & __value);
|
||||
/** \brief set the color of the graph symbols */
|
||||
QColor getSymbolColor() const;
|
||||
|
||||
/** \brief set the color of filling of the graph symbols */
|
||||
void setSymbolFillColor(const QColor & __value);
|
||||
/** \brief set the color of filling of the graph symbols */
|
||||
QColor getSymbolFillColor() const;
|
||||
|
||||
/** \brief set the line width of the graph symbol outline (in pt) */
|
||||
void setSymbolLineWidth(double __value);
|
||||
/** \brief get the line width of the graph symbol outline (in pt) */
|
||||
double getSymbolLineWidth() const;
|
||||
|
||||
|
||||
|
||||
Q_PROPERTY(JKQTPGraphSymbols symbolType MEMBER m_symbolType READ getSymbolType WRITE setSymbolType)
|
||||
Q_PROPERTY(QColor symbolColor MEMBER m_symbolColor READ getSymbolColor WRITE setSymbolColor)
|
||||
Q_PROPERTY(QColor symbolFillColor MEMBER m_symbolFillColor READ getSymbolFillColor WRITE setSymbolFillColor)
|
||||
Q_PROPERTY(double symbolSize MEMBER m_symbolSize READ getSymbolSize WRITE setSymbolSize)
|
||||
Q_PROPERTY(double symbolLineWidth MEMBER m_symbolLineWidth READ getSymbolLineWidth WRITE setSymbolLineWidth)
|
||||
private:
|
||||
/** \brief which symbol to use for the datapoints */
|
||||
JKQTPGraphSymbols m_symbolType;
|
||||
/** \brief size (diameter in pt) of the symbol for the data points, given in pt */
|
||||
double m_symbolSize;
|
||||
/** \brief (outline) color of the symbol */
|
||||
QColor m_symbolColor;
|
||||
/** \brief color of the symbol filling */
|
||||
QColor m_symbolFillColor;
|
||||
/** \brief width (in pt) of the lines used to plot the symbol for the data points, given in pt */
|
||||
double m_symbolLineWidth;
|
||||
protected:
|
||||
/** \brief constructs a QPen from the line styleing properties */
|
||||
QPen getSymbolPen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
/** \brief constructs a QPen from the line styleing properties */
|
||||
QBrush getSymbolBrush(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
/*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
|
||||
|
||||
\param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
|
||||
\param x x-coordinate of the symbol center
|
||||
\param y y-coordinate of the symbol center
|
||||
*/
|
||||
void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y) const;
|
||||
/*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
|
||||
|
||||
\param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
|
||||
\param x x-coordinate of the symbol center
|
||||
\param y y-coordinate of the symbol center
|
||||
\param symbolSize size of the symbol
|
||||
*/
|
||||
void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, double symbolSize) const;
|
||||
/*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
|
||||
|
||||
\param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
|
||||
\param x x-coordinate of the symbol center
|
||||
\param y y-coordinate of the symbol center
|
||||
\param type type of the symbol
|
||||
\param symbolSize size of the symbol
|
||||
*/
|
||||
void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, JKQTPGraphSymbols type) const;
|
||||
/*! \brief plot a symbol at location x,y (in painter coordinates), using the current style
|
||||
|
||||
\param painter the <a href="http://doc.qt.io/qt-5/qpainter.html">QPainter</a> to draw to
|
||||
\param x x-coordinate of the symbol center
|
||||
\param y y-coordinate of the symbol center
|
||||
\param color color of the symbol
|
||||
\param fillColor fill color of the symbol
|
||||
*/
|
||||
void plotStyledSymbol(JKQTBasePlotter* parent, JKQTPEnhancedPainter& painter, double x, double y, QColor color, QColor fillColor) const;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for the graph filling (NOT the symbol filling though!)
|
||||
\ingroup jkqtplotter_basegraphs_stylemixins
|
||||
|
||||
supported properties:
|
||||
- fill style
|
||||
- fill color
|
||||
- fill texture/gradient/matrix (if required by fill style)
|
||||
.
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPGraphFillStyleMixin {
|
||||
Q_GADGET
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPGraphFillStyleMixin();
|
||||
|
||||
/** \brief initiaize the fill style (from the parent plotter) */
|
||||
void initFillStyle(JKQTBasePlotter* parent, int &parentPlotStyle);
|
||||
|
||||
virtual ~JKQTPGraphFillStyleMixin();
|
||||
|
||||
/** \brief set the fill style of the graph */
|
||||
void setFillStyle(Qt::BrushStyle __value);
|
||||
/** \brief get the fill style of the graph */
|
||||
Qt::BrushStyle getFillStyle() const;
|
||||
|
||||
/** \brief set the color of the graph filling */
|
||||
void setFillColor(const QColor & __value);
|
||||
/** \brief set the color of the graph filling */
|
||||
QColor getFillColor() const;
|
||||
|
||||
/** \brief set the color of the graph filling and sets fill style to Qt::TexturePattern */
|
||||
void setFillTexture(const QPixmap & __value);
|
||||
/** \brief set the color of the graph filling and sets fill style to Qt::TexturePattern */
|
||||
void setFillTexture(const QImage & __value);
|
||||
/** \brief set the color of the graph filling */
|
||||
QPixmap getFillTexture() const;
|
||||
/** \brief set the color of the graph filling */
|
||||
QImage getFillTextureImage() const;
|
||||
|
||||
/** \brief set the filling of the graph to a gradient and sets fill style to a gradient setting */
|
||||
void setFillGradient(const QGradient & __value);
|
||||
/** \brief get the gradient object of the graph filling */
|
||||
const QGradient *getFillGradient() const;
|
||||
|
||||
/** \brief sets a fill brush (overwrites all internal properties!) */
|
||||
void setFillBrush(const QBrush& b);
|
||||
/** \brief sets a fill transformation matrix*/
|
||||
void setFillTransform(const QMatrix& b);
|
||||
/** \brief sets a fill transformation */
|
||||
void setFillTransform(const QTransform& b);
|
||||
|
||||
Q_PROPERTY(Qt::BrushStyle fillStyle MEMBER m_fillStyle READ getFillStyle WRITE setFillStyle)
|
||||
Q_PROPERTY(QColor fillColor MEMBER m_fillColor READ getFillColor WRITE setFillColor)
|
||||
private:
|
||||
/** \brief fill style of the graph */
|
||||
QBrush m_fillBrush;
|
||||
/** \brief last fill color of the graph */
|
||||
QColor m_fillColor;
|
||||
protected:
|
||||
/** \brief constructs a QPen from the line styleing properties */
|
||||
QBrush getFillBrush(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief This Mix-In class provides setter/getter methods, storage and other facilities for text in graphs
|
||||
\ingroup jkqtplotter_basegraphs_stylemixins
|
||||
|
||||
supported properties:
|
||||
- font name
|
||||
- font size
|
||||
- text color
|
||||
.
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPGraphTextStyleMixin {
|
||||
Q_GADGET
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPGraphTextStyleMixin(JKQTBasePlotter *parent);
|
||||
|
||||
/** \brief initiaize the fill style (from the parent plotter) */
|
||||
void initTextStyle(JKQTBasePlotter* parent, int &parentPlotStyle);
|
||||
|
||||
virtual ~JKQTPGraphTextStyleMixin();
|
||||
|
||||
/** \brief set the base font size of text */
|
||||
void setTextFontSize(double __value);
|
||||
/** \brief get the base font size of text */
|
||||
double getTextFontSize() const;
|
||||
|
||||
/** \brief set the base font name of text */
|
||||
void setTextFontName(const QString& __value);
|
||||
/** \brief get the base font name of text */
|
||||
QString getTextFontName() const;
|
||||
|
||||
/** \brief set the color of the text */
|
||||
void setTextColor(const QColor & __value);
|
||||
/** \brief set the color of the text */
|
||||
QColor getTextColor() const;
|
||||
|
||||
|
||||
|
||||
Q_PROPERTY(QColor textColor MEMBER m_textColor READ getTextColor WRITE setTextColor)
|
||||
Q_PROPERTY(double textFontSize MEMBER m_textFontSize READ getTextFontSize WRITE setTextFontSize)
|
||||
Q_PROPERTY(QString textFontName MEMBER m_textFontName READ getTextFontName WRITE setTextFontName)
|
||||
private:
|
||||
/** \brief color of the text */
|
||||
QColor m_textColor;
|
||||
|
||||
/** \brief base font size of text */
|
||||
double m_textFontSize;
|
||||
/** \brief name of the font to be used for the text */
|
||||
QString m_textFontName;
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // jkqtpgraphsbasestylingmixins_H
|
@ -397,7 +397,7 @@ void JKQTPBoxplotVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRe
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPBoxplotVerticalGraph::getKeyLabelColor() {
|
||||
QColor JKQTPBoxplotVerticalGraph::getKeyLabelColor() const {
|
||||
return color;
|
||||
}
|
||||
|
||||
@ -961,7 +961,7 @@ void JKQTPBoxplotVerticalElement::drawKeyMarker(JKQTPEnhancedPainter& painter, Q
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPBoxplotVerticalElement::getKeyLabelColor() {
|
||||
QColor JKQTPBoxplotVerticalElement::getKeyLabelColor() const {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
||||
graphOutliers->setColor(graph->getColor().darker());
|
||||
graphOutliers->setFillColor(QColor("white"));
|
||||
// draw outliers as small circles, without lines
|
||||
graphOutliers->setSymbol(JKQTPCircle);
|
||||
graphOutliers->setSymbolType(JKQTPCircle);
|
||||
graphOutliers->setDrawLine(false);
|
||||
graphOutliers->setSymbolSize(7);
|
||||
\endcode
|
||||
@ -106,7 +106,7 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalGraph: public JKQTPGraph {
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
@ -324,7 +324,7 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalGraph: public JKQTPGraph {
|
||||
|
||||
/*! \copydoc meanSymbol
|
||||
\see see meanSymbol for details */
|
||||
inline virtual void setMeanSymbol(const JKQTPGraphSymbols & __value)
|
||||
inline virtual void setMeanSymbol(JKQTPGraphSymbols __value)
|
||||
{
|
||||
this->meanSymbol = __value;
|
||||
}
|
||||
@ -485,7 +485,7 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPPlotObject {
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
@ -659,7 +659,7 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPPlotObject {
|
||||
|
||||
/*! \copydoc meanSymbol
|
||||
\see see meanSymbol for details */
|
||||
inline virtual void setMeanSymbol(const JKQTPGraphSymbols & __value)
|
||||
inline virtual void setMeanSymbol(JKQTPGraphSymbols __value)
|
||||
{
|
||||
this->meanSymbol = __value;
|
||||
}
|
||||
|
@ -32,6 +32,44 @@
|
||||
#include <QClipboard>
|
||||
# include <QVector3D>
|
||||
|
||||
JKQTPContour::JKQTPContour(JKQTBasePlotter *parent) :
|
||||
JKQTPMathImage(parent)
|
||||
{
|
||||
colorBarRightVisible=false;
|
||||
ignoreOnPlane=false;
|
||||
numberOfLevels=1;
|
||||
colorFromPalette=true;
|
||||
datatype=JKQTPMathImageBase::DoubleArray;
|
||||
relativeLevels=false;
|
||||
|
||||
initLineStyle(parent, parentPlotStyle);
|
||||
|
||||
}
|
||||
|
||||
JKQTPContour::JKQTPContour(double x, double y, double width, double height, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, DataType datatype, JKQTBasePlotter* parent) :
|
||||
JKQTPMathImage( x, y, width, height, datatype, data, Nx, Ny, palette, parent)
|
||||
{
|
||||
colorBarRightVisible=false;
|
||||
ignoreOnPlane=false;
|
||||
numberOfLevels=1;
|
||||
colorFromPalette=true;
|
||||
relativeLevels=false;
|
||||
|
||||
initLineStyle(parent, parentPlotStyle);
|
||||
}
|
||||
|
||||
|
||||
JKQTPContour::JKQTPContour(JKQTPlotter *parent) :
|
||||
JKQTPContour(parent->getPlotter())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JKQTPContour::JKQTPContour(double x, double y, double width, double height, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, DataType datatype, JKQTPlotter* parent) :
|
||||
JKQTPContour( x, y, width, height, data, Nx, Ny, palette, datatype, parent->getPlotter())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void JKQTPContour::draw(JKQTPEnhancedPainter &painter)
|
||||
{
|
||||
@ -54,10 +92,7 @@ void JKQTPContour::draw(JKQTPEnhancedPainter &painter)
|
||||
|
||||
// draw lines
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p;
|
||||
p.setStyle(style);
|
||||
p.setColor(lineColor);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
QPen p=getLinePen(painter, parent);
|
||||
|
||||
painter.setPen(p);
|
||||
QImage colorLevels = getPaletteImage(palette,numberOfLevels);
|
||||
@ -128,6 +163,56 @@ void JKQTPContour::createContourLevelsLog(int nLevels, int m)
|
||||
relativeLevels=false;
|
||||
}
|
||||
|
||||
void JKQTPContour::setIgnoreOnPlane(bool __value)
|
||||
{
|
||||
this->ignoreOnPlane = __value;
|
||||
}
|
||||
|
||||
bool JKQTPContour::getIgnoreOnPlane() const
|
||||
{
|
||||
return this->ignoreOnPlane;
|
||||
}
|
||||
|
||||
void JKQTPContour::setNumberOfLevels(int __value)
|
||||
{
|
||||
this->numberOfLevels = __value;
|
||||
}
|
||||
|
||||
int JKQTPContour::getNumberOfLevels() const
|
||||
{
|
||||
return this->numberOfLevels;
|
||||
}
|
||||
|
||||
void JKQTPContour::setColorFromPalette(bool __value)
|
||||
{
|
||||
this->colorFromPalette = __value;
|
||||
}
|
||||
|
||||
bool JKQTPContour::getColorFromPalette() const
|
||||
{
|
||||
return this->colorFromPalette;
|
||||
}
|
||||
|
||||
void JKQTPContour::setContourLevels(const QList<double> &__value)
|
||||
{
|
||||
this->contourLevels = __value;
|
||||
}
|
||||
|
||||
QList<double> JKQTPContour::getContourLevels() const
|
||||
{
|
||||
return this->contourLevels;
|
||||
}
|
||||
|
||||
void JKQTPContour::setRelativeLevels(bool __value)
|
||||
{
|
||||
this->relativeLevels = __value;
|
||||
}
|
||||
|
||||
bool JKQTPContour::getRelativeLevels() const
|
||||
{
|
||||
return this->relativeLevels;
|
||||
}
|
||||
|
||||
void JKQTPContour::setImageColumn(size_t columnID)
|
||||
{
|
||||
datatype=JKQTPMathImageBase::DoubleArray;
|
||||
@ -270,64 +355,6 @@ bool JKQTPContour::intersect(QLineF &line, const QVector3D &vertex1,const QVecto
|
||||
}
|
||||
|
||||
|
||||
JKQTPContour::JKQTPContour(JKQTBasePlotter *parent) :
|
||||
JKQTPMathImage(parent)
|
||||
{
|
||||
lineColor=QColor("red");
|
||||
colorBarRightVisible=false;
|
||||
lineWidth=1;
|
||||
style=Qt::SolidLine;
|
||||
ignoreOnPlane=false;
|
||||
numberOfLevels=1;
|
||||
colorFromPalette=true;
|
||||
datatype=JKQTPMathImageBase::DoubleArray;
|
||||
relativeLevels=false;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
int parentPlotStyle=parent->getNextStyle();
|
||||
style=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
}
|
||||
}
|
||||
|
||||
JKQTPContour::JKQTPContour(double x, double y, double width, double height, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, DataType datatype, JKQTBasePlotter* parent) :
|
||||
JKQTPMathImage( x, y, width, height, datatype, data, Nx, Ny, palette, parent)
|
||||
{
|
||||
lineColor=QColor("red");
|
||||
colorBarRightVisible=false;
|
||||
lineWidth=1;
|
||||
style=Qt::SolidLine;
|
||||
ignoreOnPlane=false;
|
||||
numberOfLevels=1;
|
||||
colorFromPalette=true;
|
||||
relativeLevels=false;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
int parentPlotStyle=parent->getNextStyle();
|
||||
style=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
JKQTPContour::JKQTPContour(JKQTPlotter *parent) :
|
||||
JKQTPContour(parent->getPlotter())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
JKQTPContour::JKQTPContour(double x, double y, double width, double height, void* data, int Nx, int Ny, JKQTPMathImageColorPalette palette, DataType datatype, JKQTPlotter* parent) :
|
||||
JKQTPMathImage( x, y, width, height, datatype, data, Nx, Ny, palette, parent)
|
||||
{
|
||||
lineColor=QColor("red");
|
||||
colorBarRightVisible=false;
|
||||
lineWidth=1;
|
||||
style=Qt::SolidLine;
|
||||
ignoreOnPlane=false;
|
||||
numberOfLevels=1;
|
||||
colorFromPalette=true;
|
||||
relativeLevels=false;
|
||||
}
|
||||
int JKQTPContour::compare2level(const QVector3D &vertex, double level)
|
||||
{
|
||||
if (vertex.z() > level)
|
||||
|
@ -26,10 +26,11 @@
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplotter/jkqtpbaseelements.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimage.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtplottertools/jkqtpimagetools.h"
|
||||
|
||||
@ -53,7 +54,7 @@
|
||||
*
|
||||
* \image html JKQTPContour.png
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPContour: public JKQTPMathImage {
|
||||
class JKQTP_LIB_EXPORT JKQTPContour: public JKQTPMathImage, public JKQTPGraphLineStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
@ -72,116 +73,44 @@ class JKQTP_LIB_EXPORT JKQTPContour: public JKQTPMathImage {
|
||||
/** \brief creates at least nLevels contour levels with logarithmic spacing. FIXME: Has not been tested yet */
|
||||
void createContourLevelsLog(int nLevels=3,int m=2);
|
||||
|
||||
/*! \copydoc lineColor
|
||||
\see see lineColor for details */
|
||||
inline virtual void setLineColor(const QColor & __value)
|
||||
{
|
||||
this->lineColor = __value;
|
||||
}
|
||||
/*! \copydoc lineColor
|
||||
\see see lineColor for details */
|
||||
inline virtual QColor getLineColor() const
|
||||
{
|
||||
return this->lineColor;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual void setStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->style = __value;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual Qt::PenStyle getStyle() const
|
||||
{
|
||||
return this->style;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
/*! \copydoc ignoreOnPlane
|
||||
\see see ignoreOnPlane for details */
|
||||
inline virtual void setIgnoreOnPlane(bool __value)
|
||||
{
|
||||
this->ignoreOnPlane = __value;
|
||||
}
|
||||
void setIgnoreOnPlane(bool __value);
|
||||
/*! \copydoc ignoreOnPlane
|
||||
\see see ignoreOnPlane for details */
|
||||
inline virtual bool getIgnoreOnPlane() const
|
||||
{
|
||||
return this->ignoreOnPlane;
|
||||
}
|
||||
bool getIgnoreOnPlane() const;
|
||||
/*! \copydoc numberOfLevels
|
||||
\see see numberOfLevels for details */
|
||||
inline virtual void setNumberOfLevels(int __value)
|
||||
{
|
||||
this->numberOfLevels = __value;
|
||||
}
|
||||
void setNumberOfLevels(int __value);
|
||||
/*! \copydoc numberOfLevels
|
||||
\see see numberOfLevels for details */
|
||||
inline virtual int getNumberOfLevels() const
|
||||
{
|
||||
return this->numberOfLevels;
|
||||
}
|
||||
int getNumberOfLevels() const;
|
||||
/*! \copydoc colorFromPalette
|
||||
\see see colorFromPalette for details */
|
||||
inline virtual void setColorFromPalette(bool __value)
|
||||
{
|
||||
this->colorFromPalette = __value;
|
||||
}
|
||||
void setColorFromPalette(bool __value);
|
||||
/*! \copydoc colorFromPalette
|
||||
\see see colorFromPalette for details */
|
||||
inline virtual bool getColorFromPalette() const
|
||||
{
|
||||
return this->colorFromPalette;
|
||||
}
|
||||
bool getColorFromPalette() const;
|
||||
/*! \copydoc contourLevels
|
||||
\see see contourLevels for details */
|
||||
inline virtual void setContourLevels(const QList<double> & __value)
|
||||
{
|
||||
this->contourLevels = __value;
|
||||
}
|
||||
void setContourLevels(const QList<double> & __value);
|
||||
/*! \copydoc contourLevels
|
||||
\see see contourLevels for details */
|
||||
inline virtual QList<double> getContourLevels() const
|
||||
{
|
||||
return this->contourLevels;
|
||||
}
|
||||
QList<double> getContourLevels() const;
|
||||
/*! \copydoc relativeLevels
|
||||
\see see relativeLevels for details */
|
||||
inline virtual void setRelativeLevels(bool __value)
|
||||
{
|
||||
this->relativeLevels = __value;
|
||||
}
|
||||
void setRelativeLevels(bool __value);
|
||||
/*! \copydoc relativeLevels
|
||||
\see see relativeLevels for details */
|
||||
inline virtual bool getRelativeLevels() const
|
||||
{
|
||||
return this->relativeLevels;
|
||||
}
|
||||
/** convenience function to work with JKQTPDatastore */
|
||||
bool getRelativeLevels() const;
|
||||
/** \brief convenience function to work with JKQTPDatastore */
|
||||
void setImageColumn(size_t columnID);
|
||||
|
||||
/** \brief add another level for which to draw a contour */
|
||||
void addContourLevel(double &level);
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
/** \brief color of the contour lines */
|
||||
QColor lineColor;
|
||||
/** \brief linestyle of the contour lines */
|
||||
Qt::PenStyle style;
|
||||
/** \brief width (pixels) of the graph */
|
||||
double lineWidth;
|
||||
/** \brief if true, vertices that all lie on the contour plane will be ignored*/
|
||||
bool ignoreOnPlane;
|
||||
/** \brief if true, the colors of the \a palette are used for the contour lines */
|
||||
@ -191,11 +120,11 @@ class JKQTP_LIB_EXPORT JKQTPContour: public JKQTPMathImage {
|
||||
|
||||
/** \brief the list of contour levels */
|
||||
QList<double> contourLevels;
|
||||
// /** \brief indicates wether the contour levels are absolute values or relative to the maximum (max-min) */
|
||||
/** \brief indicates wether the contour levels are absolute values or relative to the maximum (max-min) */
|
||||
bool relativeLevels;
|
||||
virtual void ensureImageData() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
double value(int xIdx, int yIdx);
|
||||
/// gives the intersection line of a plane defined by three vertices with a contour level in the x-y plane of heigth level
|
||||
bool intersect(QLineF &line, const QVector3D &vertex1,const QVector3D &vertex2,const QVector3D &vertex3,double level);
|
||||
|
@ -38,11 +38,6 @@ JKQTPXFunctionLineGraph::JKQTPXFunctionLineGraph(JKQTBasePlotter* parent):
|
||||
JKQTPGraph(parent)
|
||||
{
|
||||
functionType=SpecialFunction::UserFunction;
|
||||
color=QColor("red");
|
||||
fillColor=color.lighter();
|
||||
style=Qt::SolidLine;
|
||||
lineWidth=2;
|
||||
fillStyle=Qt::SolidPattern;
|
||||
drawLine=true;
|
||||
fillCurve=false;
|
||||
params=nullptr;
|
||||
@ -54,11 +49,14 @@ JKQTPXFunctionLineGraph::JKQTPXFunctionLineGraph(JKQTBasePlotter* parent):
|
||||
displaySamplePoints=false;
|
||||
data=nullptr;
|
||||
|
||||
initLineStyle(parent, parentPlotStyle);
|
||||
initFillStyle(parent, parentPlotStyle);
|
||||
|
||||
drawErrorPolygons=false;
|
||||
drawErrorLines=false;
|
||||
errorParams=nullptr;
|
||||
errorColor=color.lighter();
|
||||
errorFillColor=color.lighter();
|
||||
errorColor=getLineColor().lighter();
|
||||
errorFillColor=getLineColor().lighter();
|
||||
errorStyle=Qt::SolidLine;
|
||||
errorLineWidth=1;
|
||||
errorFillStyle=Qt::SolidPattern;
|
||||
@ -67,73 +65,21 @@ JKQTPXFunctionLineGraph::JKQTPXFunctionLineGraph(JKQTBasePlotter* parent):
|
||||
errorParameterColumn=-1;
|
||||
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
if (parent && parentPlotStyle>=0) { // get style settings from parent object
|
||||
//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();
|
||||
fillStyle=parent->getPlotStyle(parentPlotStyle).fillStyle();
|
||||
errorColor=parent->getPlotStyle(parentPlotStyle).errorColor();
|
||||
errorStyle=parent->getPlotStyle(parentPlotStyle).errorStyle();
|
||||
errorLineWidth=parent->getPlotStyle(parentPlotStyle).errorWidthF();
|
||||
errorFillStyle=parent->getPlotStyle(parentPlotStyle).errorFillStyle();
|
||||
errorFillColor=parent->getPlotStyle(parentPlotStyle).errorFillColor();
|
||||
}
|
||||
fillColor.setAlphaF(0.5);
|
||||
errorFillColor.setAlphaF(0.5);
|
||||
}
|
||||
|
||||
JKQTPXFunctionLineGraph::JKQTPXFunctionLineGraph(JKQTPlotter* parent):
|
||||
JKQTPGraph(parent)
|
||||
JKQTPXFunctionLineGraph(parent->getPlotter())
|
||||
{
|
||||
functionType=SpecialFunction::UserFunction;
|
||||
color=QColor("red");
|
||||
fillColor=color.lighter();
|
||||
style=Qt::SolidLine;
|
||||
lineWidth=2;
|
||||
fillStyle=Qt::SolidPattern;
|
||||
drawLine=true;
|
||||
fillCurve=false;
|
||||
params=nullptr;
|
||||
minSamples=10;
|
||||
maxRefinementDegree=7;
|
||||
slopeTolerance=0.005;
|
||||
minPixelPerSample=32;
|
||||
plotRefinement=true;
|
||||
displaySamplePoints=false;
|
||||
data=nullptr;
|
||||
|
||||
drawErrorPolygons=false;
|
||||
drawErrorLines=false;
|
||||
errorParams=nullptr;
|
||||
errorColor=color.lighter();
|
||||
errorFillColor=color.lighter();
|
||||
errorStyle=Qt::SolidLine;
|
||||
errorLineWidth=1;
|
||||
errorFillStyle=Qt::SolidPattern;
|
||||
|
||||
parameterColumn=-1;
|
||||
errorParameterColumn=-1;
|
||||
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
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();
|
||||
fillStyle=parent->getPlotStyle(parentPlotStyle).fillStyle();
|
||||
errorColor=parent->getPlotStyle(parentPlotStyle).errorColor();
|
||||
errorStyle=parent->getPlotStyle(parentPlotStyle).errorStyle();
|
||||
errorLineWidth=parent->getPlotStyle(parentPlotStyle).errorWidthF();
|
||||
errorFillStyle=parent->getPlotStyle(parentPlotStyle).errorFillStyle();
|
||||
errorFillColor=parent->getPlotStyle(parentPlotStyle).errorFillColor();
|
||||
}
|
||||
fillColor.setAlphaF(0.5);
|
||||
errorFillColor.setAlphaF(0.5);
|
||||
}
|
||||
|
||||
|
||||
@ -150,7 +96,17 @@ void JKQTPXFunctionLineGraph::clearData() {
|
||||
data=nullptr;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setPlotFunction(const jkqtpPlotFunctionType &__value)
|
||||
void JKQTPXFunctionLineGraph::setDrawLine(bool __value)
|
||||
{
|
||||
this->drawLine = __value;
|
||||
}
|
||||
|
||||
bool JKQTPXFunctionLineGraph::getDrawLine() const
|
||||
{
|
||||
return this->drawLine;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setPlotFunctionFunctor(const jkqtpPlotFunctionType &__value)
|
||||
{
|
||||
simplePlotFunction=jkqtpSimplePlotFunctionType();
|
||||
plotFunction = __value;
|
||||
@ -159,7 +115,7 @@ void JKQTPXFunctionLineGraph::setPlotFunction(const jkqtpPlotFunctionType &__val
|
||||
clearData();
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setPlotFunction(const jkqtpSimplePlotFunctionType &__value)
|
||||
void JKQTPXFunctionLineGraph::setPlotFunctionFunctor(const jkqtpSimplePlotFunctionType &__value)
|
||||
{
|
||||
plotFunction=jkqtpPlotFunctionType();
|
||||
simplePlotFunction=__value;
|
||||
@ -168,7 +124,7 @@ void JKQTPXFunctionLineGraph::setPlotFunction(const jkqtpSimplePlotFunctionType
|
||||
clearData();
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setPlotFunction(jkqtpPlotFunctionType &&__value)
|
||||
void JKQTPXFunctionLineGraph::setPlotFunctionFunctor(jkqtpPlotFunctionType &&__value)
|
||||
{
|
||||
simplePlotFunction=jkqtpSimplePlotFunctionType();
|
||||
plotFunction = std::move(__value);
|
||||
@ -176,7 +132,7 @@ void JKQTPXFunctionLineGraph::setPlotFunction(jkqtpPlotFunctionType &&__value)
|
||||
clearData();
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setPlotFunction(jkqtpSimplePlotFunctionType &&__value)
|
||||
void JKQTPXFunctionLineGraph::setPlotFunctionFunctor(jkqtpSimplePlotFunctionType &&__value)
|
||||
{
|
||||
plotFunction=jkqtpPlotFunctionType();
|
||||
simplePlotFunction=std::move(__value);
|
||||
@ -185,7 +141,7 @@ void JKQTPXFunctionLineGraph::setPlotFunction(jkqtpSimplePlotFunctionType &&__va
|
||||
clearData();
|
||||
}
|
||||
|
||||
jkqtpPlotFunctionType JKQTPXFunctionLineGraph::getPlotFunction() const
|
||||
jkqtpPlotFunctionType JKQTPXFunctionLineGraph::getPlotFunctionFunctor() const
|
||||
{
|
||||
return plotFunction;
|
||||
}
|
||||
@ -195,18 +151,27 @@ jkqtpSimplePlotFunctionType JKQTPXFunctionLineGraph::getSimplePlotFunction() con
|
||||
return simplePlotFunction;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setParams(void *__value)
|
||||
{
|
||||
if (this->params != __value) {
|
||||
this->params = __value;
|
||||
clearData();
|
||||
}
|
||||
}
|
||||
|
||||
void *JKQTPXFunctionLineGraph::getParams() const
|
||||
{
|
||||
return this->params;
|
||||
}
|
||||
|
||||
|
||||
void JKQTPXFunctionLineGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen np(Qt::NoPen);
|
||||
p.setColor(color);
|
||||
p.setStyle(style);
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
const double y=rect.top()+rect.height()/2.0;
|
||||
painter.setPen(np);
|
||||
if (drawLine) painter.setPen(p);
|
||||
@ -216,8 +181,8 @@ void JKQTPXFunctionLineGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRect
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPXFunctionLineGraph::getKeyLabelColor() {
|
||||
return color;
|
||||
QColor JKQTPXFunctionLineGraph::getKeyLabelColor() const {
|
||||
return getLineColor();
|
||||
}
|
||||
|
||||
bool JKQTPXFunctionLineGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
|
||||
@ -355,7 +320,7 @@ void JKQTPXFunctionLineGraph::refine(doublePair* a, doublePair* b, unsigned int
|
||||
xmid=xmid+(static_cast<double>(rand())/static_cast<double>(RAND_MAX)-0.5)*delta/5.0; // shake by 10%
|
||||
//}
|
||||
double realxmid=parent->p2x(xmid);
|
||||
double realfmid;
|
||||
double realfmid = 0.0;
|
||||
if (plotFunction) realfmid=plotFunction(realxmid, params);
|
||||
else if (simplePlotFunction) realfmid=simplePlotFunction(realxmid);
|
||||
double fmid=transformY(realfmid);
|
||||
@ -391,13 +356,7 @@ void JKQTPXFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
|
||||
QPen ep=painter.pen();
|
||||
@ -406,9 +365,7 @@ void JKQTPXFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
ep.setStyle(errorStyle);
|
||||
ep.setJoinStyle(Qt::RoundJoin);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
||||
QBrush eb=painter.brush();
|
||||
eb.setColor(errorFillColor);
|
||||
@ -521,8 +478,8 @@ void JKQTPXFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
}
|
||||
|
||||
|
||||
QColor c=color;
|
||||
c.setHsv(fmod(color.hue()+90, 360), color.saturation(), color.value());
|
||||
QColor c=getLineColor();
|
||||
c.setHsv(fmod(c.hue()+90, 360), c.saturation(), c.value());
|
||||
d=data;
|
||||
if (displaySamplePoints) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
@ -578,13 +535,7 @@ void JKQTPYFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
|
||||
QPen ep=painter.pen();
|
||||
@ -593,9 +544,7 @@ void JKQTPYFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
ep.setStyle(errorStyle);
|
||||
ep.setJoinStyle(Qt::RoundJoin);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
||||
QBrush eb=painter.brush();
|
||||
eb.setColor(errorFillColor);
|
||||
@ -703,8 +652,8 @@ void JKQTPYFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
}*/
|
||||
|
||||
QColor c=color;
|
||||
c.setHsv(fmod(color.hue()+90, 360), color.saturation(), color.value());
|
||||
QColor c=getLineColor();
|
||||
c.setHsv(fmod(c.hue()+90, 360), c.saturation(), c.value());
|
||||
d=data;
|
||||
if (displaySamplePoints) while (d!=nullptr) {
|
||||
double yv=d->x;
|
||||
@ -763,23 +712,6 @@ void JKQTPYFunctionLineGraph::createPlotData(bool collectParams) {
|
||||
|
||||
|
||||
|
||||
QBrush JKQTPXFunctionLineGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
|
||||
QBrush b;
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
return b;
|
||||
}
|
||||
|
||||
QPen JKQTPXFunctionLineGraph::getLinePen(JKQTPEnhancedPainter &painter) const {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
QBrush JKQTPXFunctionLineGraph::getErrorBrush(JKQTPEnhancedPainter& /*painter*/) const {
|
||||
QBrush b;
|
||||
@ -849,10 +781,34 @@ void JKQTPXFunctionLineGraph::setErrorParams(const QVector<double> &errorParams)
|
||||
setErrorParams(&ierrorparams);
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setParameterColumn(int __value)
|
||||
{
|
||||
this->parameterColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPXFunctionLineGraph::getParameterColumn() const
|
||||
{
|
||||
return this->parameterColumn;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setParameterColumn(size_t __value) { this->parameterColumn = static_cast<int>(__value); }
|
||||
|
||||
void JKQTPXFunctionLineGraph::setErrorParameterColumn(int __value)
|
||||
{
|
||||
this->errorParameterColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPXFunctionLineGraph::getErrorParameterColumn() const
|
||||
{
|
||||
return this->errorParameterColumn;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setErrorParameterColumn(size_t __value) { this->errorParameterColumn = static_cast<int>(__value); }
|
||||
|
||||
void JKQTPXFunctionLineGraph::setSpecialFunction(JKQTPXFunctionLineGraph::SpecialFunction function)
|
||||
{
|
||||
if (function==JKQTPXFunctionLineGraph::Polynomial) {
|
||||
setPlotFunction([](double x, void* param) {
|
||||
setPlotFunctionFunctor([](double x, void* param) {
|
||||
double res=0;
|
||||
QVector<double>* d=static_cast<QVector<double>*>(param);
|
||||
if (d && d->size()>0) {
|
||||
@ -867,7 +823,7 @@ void JKQTPXFunctionLineGraph::setSpecialFunction(JKQTPXFunctionLineGraph::Specia
|
||||
return res;
|
||||
});
|
||||
}
|
||||
else if (function==JKQTPXFunctionLineGraph::Exponential) setPlotFunction([](double x, void* param) {
|
||||
else if (function==JKQTPXFunctionLineGraph::Exponential) setPlotFunctionFunctor([](double x, void* param) {
|
||||
double res=0;
|
||||
QVector<double>* d=static_cast<QVector<double>*>(param);
|
||||
if (d) {
|
||||
@ -879,7 +835,7 @@ void JKQTPXFunctionLineGraph::setSpecialFunction(JKQTPXFunctionLineGraph::Specia
|
||||
}
|
||||
return res;
|
||||
});
|
||||
else if (function==JKQTPXFunctionLineGraph::PowerLaw) setPlotFunction([](double x, void* param) {
|
||||
else if (function==JKQTPXFunctionLineGraph::PowerLaw) setPlotFunctionFunctor([](double x, void* param) {
|
||||
double res=0;
|
||||
QVector<double>* d=static_cast<QVector<double>*>(param);
|
||||
if (d) {
|
||||
@ -909,6 +865,86 @@ QVector<double> JKQTPXFunctionLineGraph::getInternalErrorParams() const {
|
||||
return ierrorparams;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setMinSamples(const unsigned int &__value)
|
||||
{
|
||||
this->minSamples = __value;
|
||||
}
|
||||
|
||||
unsigned int JKQTPXFunctionLineGraph::getMinSamples() const
|
||||
{
|
||||
return this->minSamples;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setMaxRefinementDegree(const unsigned int &__value)
|
||||
{
|
||||
this->maxRefinementDegree = __value;
|
||||
}
|
||||
|
||||
unsigned int JKQTPXFunctionLineGraph::getMaxRefinementDegree() const
|
||||
{
|
||||
return this->maxRefinementDegree;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setSlopeTolerance(double __value)
|
||||
{
|
||||
this->slopeTolerance = __value;
|
||||
}
|
||||
|
||||
double JKQTPXFunctionLineGraph::getSlopeTolerance() const
|
||||
{
|
||||
return this->slopeTolerance;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setMinPixelPerSample(double __value)
|
||||
{
|
||||
this->minPixelPerSample = __value;
|
||||
}
|
||||
|
||||
double JKQTPXFunctionLineGraph::getMinPixelPerSample() const
|
||||
{
|
||||
return this->minPixelPerSample;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setPlotRefinement(bool __value)
|
||||
{
|
||||
this->plotRefinement = __value;
|
||||
}
|
||||
|
||||
bool JKQTPXFunctionLineGraph::getPlotRefinement() const
|
||||
{
|
||||
return this->plotRefinement;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setDisplaySamplePoints(bool __value)
|
||||
{
|
||||
this->displaySamplePoints = __value;
|
||||
}
|
||||
|
||||
bool JKQTPXFunctionLineGraph::getDisplaySamplePoints() const
|
||||
{
|
||||
return this->displaySamplePoints;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setDrawErrorPolygons(bool __value)
|
||||
{
|
||||
this->drawErrorPolygons = __value;
|
||||
}
|
||||
|
||||
bool JKQTPXFunctionLineGraph::getDrawErrorPolygons() const
|
||||
{
|
||||
return this->drawErrorPolygons;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setDrawErrorLines(bool __value)
|
||||
{
|
||||
this->drawErrorLines = __value;
|
||||
}
|
||||
|
||||
bool JKQTPXFunctionLineGraph::getDrawErrorLines() const
|
||||
{
|
||||
return this->drawErrorLines;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setErrorPlotFunction(const jkqtpPlotFunctionType &__value)
|
||||
{
|
||||
errorSimplePlotFunction=jkqtpSimplePlotFunctionType();
|
||||
@ -945,6 +981,16 @@ jkqtpSimplePlotFunctionType JKQTPXFunctionLineGraph::getErrorSimplePlotFunction(
|
||||
return errorSimplePlotFunction;
|
||||
}
|
||||
|
||||
void JKQTPXFunctionLineGraph::setErrorParams(void *__value)
|
||||
{
|
||||
this->errorParams = __value;
|
||||
}
|
||||
|
||||
void *JKQTPXFunctionLineGraph::getErrorParams() const
|
||||
{
|
||||
return this->errorParams;
|
||||
}
|
||||
|
||||
|
||||
bool JKQTPXFunctionLineGraph::usesColumn(int c) const
|
||||
{
|
||||
|
@ -22,7 +22,8 @@
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
#include <QPair>
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include <functional>
|
||||
|
||||
@ -65,7 +66,7 @@ typedef std::function<double(double)> jkqtpSimplePlotFunctionType;
|
||||
the following image
|
||||
\image html plot_functionplots.png
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph {
|
||||
class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@ -85,14 +86,14 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph {
|
||||
JKQTPXFunctionLineGraph(JKQTPlotter* parent);
|
||||
|
||||
/** \brief class destructor */
|
||||
virtual ~JKQTPXFunctionLineGraph();
|
||||
virtual ~JKQTPXFunctionLineGraph() override;
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
*
|
||||
@ -107,121 +108,49 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph {
|
||||
/** \brief clear the data sampled from the function. */
|
||||
void clearData();
|
||||
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
|
||||
{
|
||||
this->fillStyle = __value;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual Qt::BrushStyle getFillStyle() const
|
||||
{
|
||||
return this->fillStyle;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual void setStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->style = __value;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual Qt::PenStyle getStyle() const
|
||||
{
|
||||
return this->style;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
/*! \brief set color, fill color and error color at the same time */
|
||||
void setColor(QColor c);
|
||||
|
||||
/*! \copydoc drawLine
|
||||
\see see drawLine for details */
|
||||
inline virtual void setDrawLine(bool __value)
|
||||
{
|
||||
this->drawLine = __value;
|
||||
}
|
||||
void setDrawLine(bool __value);
|
||||
/*! \copydoc drawLine
|
||||
\see see drawLine for details */
|
||||
inline virtual bool getDrawLine() const
|
||||
{
|
||||
return this->drawLine;
|
||||
}
|
||||
bool getDrawLine() const;
|
||||
|
||||
/** \brief sets the property plotFunction ( \copybrief plotFunction ) to the specified \a __value.
|
||||
*
|
||||
* \details Description of the parameter plotFunction is: <BLOCKQUOTE>\copydoc plotFunction </BLOCKQUOTE>
|
||||
* \see plotFunction for more information */
|
||||
virtual void setPlotFunction (jkqtpPlotFunctionType && __value);
|
||||
virtual void setPlotFunctionFunctor (jkqtpPlotFunctionType && __value);
|
||||
/** \brief sets the property plotFunction ( \copybrief plotFunction ) to the specified \a __value.
|
||||
*
|
||||
* \details Description of the parameter plotFunction is: <BLOCKQUOTE>\copydoc plotFunction </BLOCKQUOTE>
|
||||
* \see plotFunction for more information */
|
||||
virtual void setPlotFunction (const jkqtpPlotFunctionType & __value);
|
||||
virtual void setPlotFunctionFunctor (const jkqtpPlotFunctionType & __value);
|
||||
/** \brief sets the property plotFunction ( \copybrief plotFunction ) to the specified \a __value.
|
||||
*
|
||||
* \details Description of the parameter plotFunction is: <BLOCKQUOTE>\copydoc plotFunction </BLOCKQUOTE>
|
||||
* \see plotFunction for more information */
|
||||
virtual void setPlotFunction (jkqtpSimplePlotFunctionType && __value);
|
||||
virtual void setPlotFunctionFunctor (jkqtpSimplePlotFunctionType && __value);
|
||||
/** \brief sets the property plotFunction ( \copybrief plotFunction ) to the specified \a __value.
|
||||
*
|
||||
* \details Description of the parameter plotFunction is: <BLOCKQUOTE>\copydoc plotFunction </BLOCKQUOTE>
|
||||
* \see plotFunction for more information */
|
||||
virtual void setPlotFunction (const jkqtpSimplePlotFunctionType & __value);
|
||||
virtual void setPlotFunctionFunctor (const jkqtpSimplePlotFunctionType & __value);
|
||||
/*! \brief returns the property plotFunction ( \copybrief plotFunction ). \see plotFunction for more information */ \
|
||||
virtual jkqtpPlotFunctionType getPlotFunction () const;
|
||||
virtual jkqtpPlotFunctionType getPlotFunctionFunctor () const;
|
||||
/*! \brief returns the property simplePlotFunction ( \copybrief simplePlotFunction ). \see simplePlotFunction for more information */ \
|
||||
virtual jkqtpSimplePlotFunctionType getSimplePlotFunction () const;
|
||||
|
||||
/*! \copydoc params
|
||||
\see see params for details */
|
||||
inline virtual void setParams(void* __value)
|
||||
{
|
||||
if (this->params != __value) {
|
||||
this->params = __value;
|
||||
clearData();
|
||||
}
|
||||
}
|
||||
virtual void setParams(void* __value);
|
||||
/*! \copydoc params
|
||||
\see see params for details */
|
||||
inline virtual void* getParams() const
|
||||
{
|
||||
return this->params;
|
||||
}
|
||||
void* getParams() const;
|
||||
/** \brief sets the params as a pointer to an internal COPY of the given vector (not the data of the vector, as then the size would be unknown!!!) */
|
||||
void setParams(const QVector<double>& params);
|
||||
virtual void setParams(const QVector<double>& params);
|
||||
/** \brief sets the params from a copy of the given array of length \a N */
|
||||
void setCopiedParams(const double* params, int N);
|
||||
/** \brief set an internal parameter vector as function parameters, initialized with {p1} */
|
||||
@ -241,100 +170,52 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph {
|
||||
QVector<double> getInternalErrorParams() const;
|
||||
/*! \copydoc minSamples
|
||||
\see see minSamples for details */
|
||||
inline virtual void setMinSamples(const unsigned int & __value)
|
||||
{
|
||||
this->minSamples = __value;
|
||||
}
|
||||
void setMinSamples(const unsigned int & __value);
|
||||
/*! \copydoc minSamples
|
||||
\see see minSamples for details */
|
||||
inline virtual unsigned int getMinSamples() const
|
||||
{
|
||||
return this->minSamples;
|
||||
}
|
||||
unsigned int getMinSamples() const;
|
||||
/*! \copydoc maxRefinementDegree
|
||||
\see see maxRefinementDegree for details */
|
||||
inline virtual void setMaxRefinementDegree(const unsigned int & __value)
|
||||
{
|
||||
this->maxRefinementDegree = __value;
|
||||
}
|
||||
void setMaxRefinementDegree(const unsigned int & __value);
|
||||
/*! \copydoc maxRefinementDegree
|
||||
\see see maxRefinementDegree for details */
|
||||
inline virtual unsigned int getMaxRefinementDegree() const
|
||||
{
|
||||
return this->maxRefinementDegree;
|
||||
}
|
||||
unsigned int getMaxRefinementDegree() const;
|
||||
/*! \copydoc slopeTolerance
|
||||
\see see slopeTolerance for details */
|
||||
inline virtual void setSlopeTolerance(double __value)
|
||||
{
|
||||
this->slopeTolerance = __value;
|
||||
}
|
||||
void setSlopeTolerance(double __value);
|
||||
/*! \copydoc slopeTolerance
|
||||
\see see slopeTolerance for details */
|
||||
inline virtual double getSlopeTolerance() const
|
||||
{
|
||||
return this->slopeTolerance;
|
||||
}
|
||||
double getSlopeTolerance() const;
|
||||
/*! \copydoc minPixelPerSample
|
||||
\see see minPixelPerSample for details */
|
||||
inline virtual void setMinPixelPerSample(double __value)
|
||||
{
|
||||
this->minPixelPerSample = __value;
|
||||
}
|
||||
void setMinPixelPerSample(double __value);
|
||||
/*! \copydoc minPixelPerSample
|
||||
\see see minPixelPerSample for details */
|
||||
inline virtual double getMinPixelPerSample() const
|
||||
{
|
||||
return this->minPixelPerSample;
|
||||
}
|
||||
double getMinPixelPerSample() const;
|
||||
/*! \copydoc plotRefinement
|
||||
\see see plotRefinement for details */
|
||||
inline virtual void setPlotRefinement(bool __value)
|
||||
{
|
||||
this->plotRefinement = __value;
|
||||
}
|
||||
void setPlotRefinement(bool __value);
|
||||
/*! \copydoc plotRefinement
|
||||
\see see plotRefinement for details */
|
||||
inline virtual bool getPlotRefinement() const
|
||||
{
|
||||
return this->plotRefinement;
|
||||
}
|
||||
bool getPlotRefinement() const;
|
||||
/*! \copydoc displaySamplePoints
|
||||
\see see displaySamplePoints for details */
|
||||
inline virtual void setDisplaySamplePoints(bool __value)
|
||||
{
|
||||
this->displaySamplePoints = __value;
|
||||
}
|
||||
void setDisplaySamplePoints(bool __value);
|
||||
/*! \copydoc displaySamplePoints
|
||||
\see see displaySamplePoints for details */
|
||||
inline virtual bool getDisplaySamplePoints() const
|
||||
{
|
||||
return this->displaySamplePoints;
|
||||
}
|
||||
bool getDisplaySamplePoints() const;
|
||||
/*! \copydoc drawErrorPolygons
|
||||
\see see drawErrorPolygons for details */
|
||||
inline virtual void setDrawErrorPolygons(bool __value)
|
||||
{
|
||||
this->drawErrorPolygons = __value;
|
||||
}
|
||||
void setDrawErrorPolygons(bool __value);
|
||||
/*! \copydoc drawErrorPolygons
|
||||
\see see drawErrorPolygons for details */
|
||||
inline virtual bool getDrawErrorPolygons() const
|
||||
{
|
||||
return this->drawErrorPolygons;
|
||||
}
|
||||
bool getDrawErrorPolygons() const;
|
||||
/*! \copydoc drawErrorLines
|
||||
\see see drawErrorLines for details */
|
||||
inline virtual void setDrawErrorLines(bool __value)
|
||||
{
|
||||
this->drawErrorLines = __value;
|
||||
}
|
||||
void setDrawErrorLines(bool __value);
|
||||
/*! \copydoc drawErrorLines
|
||||
\see see drawErrorLines for details */
|
||||
inline virtual bool getDrawErrorLines() const
|
||||
{
|
||||
return this->drawErrorLines;
|
||||
}
|
||||
bool getDrawErrorLines() const;
|
||||
/** \brief sets the property errorPlotFunction ( \copybrief errorPlotFunction ) to the specified \a __value.
|
||||
*
|
||||
* \details Description of the parameter errorPlotFunction is: <BLOCKQUOTE>\copydoc errorPlotFunction </BLOCKQUOTE>
|
||||
@ -361,51 +242,33 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph {
|
||||
virtual jkqtpSimplePlotFunctionType getErrorSimplePlotFunction () const;
|
||||
/*! \copydoc errorParams
|
||||
\see see errorParams for details */
|
||||
inline virtual void setErrorParams(void* __value)
|
||||
{
|
||||
this->errorParams = __value;
|
||||
}
|
||||
virtual void setErrorParams(void* __value);
|
||||
/*! \copydoc errorParams
|
||||
\see see errorParams for details */
|
||||
inline virtual void* getErrorParams() const
|
||||
{
|
||||
return this->errorParams;
|
||||
}
|
||||
void *getErrorParams() const;
|
||||
/** \brief sets the error params as a pointer to an internal COPY of the given vector (not the data of the vector, as then the size would be unknown!!!) */
|
||||
void setErrorParams(const QVector<double>& errorParams);
|
||||
|
||||
/*! \copydoc parameterColumn
|
||||
\see see parameterColumn for details */
|
||||
inline virtual void setParameterColumn(int __value)
|
||||
{
|
||||
this->parameterColumn = __value;
|
||||
}
|
||||
void setParameterColumn(int __value);
|
||||
/*! \copydoc parameterColumn
|
||||
\see see parameterColumn for details */
|
||||
inline virtual int getParameterColumn() const
|
||||
{
|
||||
return this->parameterColumn;
|
||||
}
|
||||
int getParameterColumn() const;
|
||||
/*! \brief sets the property parameterColumn ( \copybrief parameterColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter parameterColumn is: <BLOCKQUOTE>\copydoc parameterColumn </BLOCKQUOTE>
|
||||
\see parameterColumn for more information */
|
||||
inline virtual void setParameterColumn (size_t __value) { this->parameterColumn = static_cast<int>(__value); }
|
||||
void setParameterColumn (size_t __value);
|
||||
/*! \copydoc errorParameterColumn
|
||||
\see see errorParameterColumn for details */
|
||||
inline virtual void setErrorParameterColumn(int __value)
|
||||
{
|
||||
this->errorParameterColumn = __value;
|
||||
}
|
||||
void setErrorParameterColumn(int __value);
|
||||
/*! \copydoc errorParameterColumn
|
||||
\see see errorParameterColumn for details */
|
||||
inline virtual int getErrorParameterColumn() const
|
||||
{
|
||||
return this->errorParameterColumn;
|
||||
}
|
||||
int getErrorParameterColumn() const;
|
||||
/*! \brief sets the property errorParameterColumn ( \copybrief errorParameterColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter errorParameterColumn is: <BLOCKQUOTE>\copydoc errorParameterColumn </BLOCKQUOTE>
|
||||
\see errorParameterColumn for more information */
|
||||
inline virtual void setErrorParameterColumn (size_t __value) { this->errorParameterColumn = static_cast<int>(__value); }
|
||||
void setErrorParameterColumn (size_t __value);
|
||||
|
||||
/*! \copydoc errorColor
|
||||
\see see errorColor for details */
|
||||
@ -477,8 +340,7 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph {
|
||||
/** \brief returns, which special function is set (or if any is set) */
|
||||
SpecialFunction getFunctionType() const;
|
||||
protected:
|
||||
/** \brief which plot style to use from the parent plotter (via JKQTBasePlotter::getPlotStyle() and JKQTBasePlotter::getNextStyle() ) */
|
||||
int parentPlotStyle;
|
||||
|
||||
|
||||
struct doublePair {
|
||||
double x;
|
||||
@ -500,16 +362,6 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph {
|
||||
/** \brief if set, the values from this datatsore column are used for the parameters \c p1 , \c p2 , \c p3 , ... of the error plot function */
|
||||
int errorParameterColumn;
|
||||
|
||||
/** \brief color of the graph */
|
||||
QColor color;
|
||||
/** \brief color of the graph fill */
|
||||
QColor fillColor;
|
||||
/** \brief linestyle of the graph lines */
|
||||
Qt::PenStyle style;
|
||||
/** \brief width (pixels) of the graph */
|
||||
double lineWidth;
|
||||
/** \brief fill style, if the curve should be filled */
|
||||
Qt::BrushStyle fillStyle;
|
||||
/** \brief indicates whether to draw a line or not */
|
||||
bool drawLine;
|
||||
/** \brief indicates whether to fill the space between the curve and the x-axis */
|
||||
@ -549,6 +401,8 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph {
|
||||
jkqtpSimplePlotFunctionType errorSimplePlotFunction;
|
||||
/** \brief parameters for errorFunction */
|
||||
void* errorParams;
|
||||
|
||||
|
||||
/** \brief color of the error graph */
|
||||
QColor errorColor;
|
||||
/** \brief color of the error graph fill */
|
||||
@ -561,9 +415,6 @@ class JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph: public JKQTPGraph {
|
||||
Qt::BrushStyle errorFillStyle;
|
||||
|
||||
|
||||
QBrush getBrush(JKQTPEnhancedPainter& painter) const;
|
||||
QPen getLinePen(JKQTPEnhancedPainter& painter) const;
|
||||
|
||||
QBrush getErrorBrush(JKQTPEnhancedPainter& painter) const;
|
||||
QPen getErrorLinePen(JKQTPEnhancedPainter &painter) const;
|
||||
|
||||
|
@ -37,28 +37,12 @@
|
||||
|
||||
|
||||
JKQTPFilledCurveXGraph::JKQTPFilledCurveXGraph(JKQTBasePlotter* parent):
|
||||
JKQTPXYGraph(parent)
|
||||
JKQTPSpecialLineHorizontalGraph(parent)
|
||||
{
|
||||
baseline=0.0;
|
||||
drawSelectionLine=false;
|
||||
selectionLineColor=Qt::transparent;
|
||||
color=QColor("red");
|
||||
fillColor=color.lighter();
|
||||
style=Qt::SolidLine;
|
||||
lineWidth=2;
|
||||
parentPlotStyle=-1;
|
||||
drawLine=true;
|
||||
fillStyle=Qt::SolidPattern;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
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();
|
||||
fillStyle=parent->getPlotStyle(parentPlotStyle).fillStyle();
|
||||
}
|
||||
setDrawLine(true);
|
||||
setDrawSymbols(false);
|
||||
setFillCurve(true);
|
||||
setSpecialLineType(JKQTPDirectLine);
|
||||
}
|
||||
|
||||
JKQTPFilledCurveXGraph::JKQTPFilledCurveXGraph(JKQTPlotter *parent):
|
||||
@ -67,166 +51,15 @@ JKQTPFilledCurveXGraph::JKQTPFilledCurveXGraph(JKQTPlotter *parent):
|
||||
|
||||
}
|
||||
|
||||
void JKQTPFilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
#ifdef JKQTBP_AUTOTIMER
|
||||
JKQTPAutoOutputTimer jkaaot("JKQTPFilledCurveXGraph::draw");
|
||||
#endif
|
||||
if (parent==nullptr) return;
|
||||
JKQTPDatastore* datastore=parent->getDatastore();
|
||||
if (datastore==nullptr) return;
|
||||
|
||||
drawErrorsBefore(painter);
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen np(Qt::NoPen);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
|
||||
int imax=static_cast<int>(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()));
|
||||
int imin=0;
|
||||
if (imax<imin) {
|
||||
int h=imin;
|
||||
imin=imax;
|
||||
imax=h;
|
||||
}
|
||||
if (imin<0) imin=0;
|
||||
if (imax<0) imax=0;
|
||||
|
||||
QPainterPath pl, pf;
|
||||
|
||||
double xold=-1;
|
||||
//double yold=-1;
|
||||
// double x0=transformX(baseline);
|
||||
// if (parent->getXAxis()->isLogAxis()) {
|
||||
// if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=transformX(baseline);
|
||||
// else x0=transformX(parent->getXAxis()->getMin());
|
||||
// }
|
||||
double y0=transformY(baseline);
|
||||
if (parent->getYAxis()->isLogAxis()) {
|
||||
y0=transformY(parent->getYAxis()->getMin());
|
||||
if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=transformY(baseline);
|
||||
else y0=transformY(parent->getYAxis()->getMin());
|
||||
}
|
||||
bool first=true;
|
||||
intSortData();
|
||||
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));
|
||||
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
|
||||
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
|
||||
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
|
||||
double x=transformX(xv); bool xok=JKQTPIsOKFloat(x);
|
||||
double y=transformY(yv); bool yok=JKQTPIsOKFloat(y);
|
||||
|
||||
if (!first) {
|
||||
if (xok&&yok) {
|
||||
pf.lineTo(x, y);
|
||||
if (drawLine) pl.lineTo(x, y);
|
||||
xold=x;
|
||||
//yold=y;
|
||||
} else if (xok&&!yok){
|
||||
pf.lineTo(x, y0);
|
||||
if (drawLine) pl.lineTo(x, y0);
|
||||
xold=x;
|
||||
//yold=y0;
|
||||
}
|
||||
} else {
|
||||
if (xok&&yok) {
|
||||
if (drawLine) pl.moveTo(x,y);
|
||||
pf.moveTo(x, y0);
|
||||
pf.lineTo(x, y);
|
||||
xold=x;
|
||||
//yold=y;
|
||||
first=false;
|
||||
} else if (xok&&!yok) {
|
||||
if (drawLine) pl.moveTo(x,y0);
|
||||
pf.moveTo(x, y0);
|
||||
xold=x;
|
||||
//yold=y0;
|
||||
first=false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
pf.lineTo(xold, y0);
|
||||
pf.closeSubpath();
|
||||
if (drawLine) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
if (drawSelectionLine) {
|
||||
QPen penSelection=p; penSelection.setStyle(Qt::SolidLine);
|
||||
QColor selcol=penSelection.color(); selcol.setAlphaF(0.5); penSelection.setColor(selcol);
|
||||
if (selectionLineColor!=Qt::transparent) {
|
||||
penSelection.setColor(selectionLineColor);
|
||||
}
|
||||
penSelection.setWidthF(penSelection.widthF()*3.0);
|
||||
painter.setPen(penSelection);
|
||||
painter.drawPath(pl);
|
||||
}
|
||||
|
||||
|
||||
painter.setPen(p);
|
||||
painter.drawPath(pl);
|
||||
|
||||
}
|
||||
painter.setBrush(b);
|
||||
painter.setPen(np);
|
||||
painter.drawPath(pf);
|
||||
|
||||
}
|
||||
|
||||
drawErrorsAfter(painter);
|
||||
}
|
||||
|
||||
void JKQTPFilledCurveXGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
QPen np(Qt::NoPen);
|
||||
p.setColor(color);
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
//int y=rect.top()+rect.height()/2.0;
|
||||
painter.setPen(np);
|
||||
if (drawLine) painter.setPen(p);
|
||||
painter.setBrush(b);
|
||||
painter.drawRect(rect);
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPFilledCurveXGraph::getKeyLabelColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JKQTPFilledCurveYGraph::JKQTPFilledCurveYGraph(JKQTBasePlotter* parent):
|
||||
JKQTPFilledCurveXGraph(parent)
|
||||
JKQTPSpecialLineVerticalGraph(parent)
|
||||
{
|
||||
setDrawLine(true);
|
||||
setDrawSymbols(false);
|
||||
setFillCurve(true);
|
||||
setSpecialLineType(JKQTPDirectLine);
|
||||
}
|
||||
|
||||
JKQTPFilledCurveYGraph::JKQTPFilledCurveYGraph(JKQTPlotter *parent):
|
||||
@ -235,156 +68,12 @@ JKQTPFilledCurveYGraph::JKQTPFilledCurveYGraph(JKQTPlotter *parent):
|
||||
|
||||
}
|
||||
|
||||
void JKQTPFilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
#ifdef JKQTBP_AUTOTIMER
|
||||
JKQTPAutoOutputTimer jkaaot("JKQTPFilledCurveYGraph::draw");
|
||||
#endif
|
||||
if (parent==nullptr) return;
|
||||
JKQTPDatastore* datastore=parent->getDatastore();
|
||||
if (datastore==nullptr) return;
|
||||
|
||||
drawErrorsBefore(painter);
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
QPen np(Qt::NoPen);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
|
||||
int imax=static_cast<int>(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()));
|
||||
int imin=0;
|
||||
if (imax<imin) {
|
||||
int h=imin;
|
||||
imin=imax;
|
||||
imax=h;
|
||||
}
|
||||
if (imin<0) imin=0;
|
||||
if (imax<0) imax=0;
|
||||
|
||||
QPainterPath pl, pf;
|
||||
|
||||
//double xold=-1;
|
||||
double yold=-1;
|
||||
double x0=transformX(baseline);
|
||||
if (parent->getXAxis()->isLogAxis()) {
|
||||
if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=transformX(baseline);
|
||||
else x0=transformX(parent->getXAxis()->getMin());
|
||||
}
|
||||
/*double y0=transformY(baseline);
|
||||
if (parent->getYAxis()->isLogAxis()) {
|
||||
y0=transformY(parent->getYAxis()->getMin());
|
||||
if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=transformY(baseline);
|
||||
else y0=transformY(parent->getYAxis()->getMin());
|
||||
}*/
|
||||
bool first=true;
|
||||
intSortData();
|
||||
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));
|
||||
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
|
||||
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
|
||||
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
|
||||
double x=transformX(xv); bool xok=JKQTPIsOKFloat(x);
|
||||
double y=transformY(yv); bool yok=JKQTPIsOKFloat(y);
|
||||
|
||||
if (!first) {
|
||||
if (xok&&yok) {
|
||||
pf.lineTo(x, y);
|
||||
if (drawLine) pl.lineTo(x, y);
|
||||
//xold=x;
|
||||
yold=y;
|
||||
} else if (!xok&&yok){
|
||||
pf.lineTo(x0, y);
|
||||
if (drawLine) pl.lineTo(x0, y);
|
||||
//xold=x0;
|
||||
yold=y;
|
||||
}
|
||||
} else {
|
||||
if (xok&&yok) {
|
||||
if (drawLine) pl.moveTo(x,y);
|
||||
pf.moveTo(x0, y);
|
||||
pf.lineTo(x, y);
|
||||
//xold=x;
|
||||
yold=y;
|
||||
first=false;
|
||||
} else if (!xok&&yok) {
|
||||
if (drawLine) pl.moveTo(x0,y);
|
||||
pf.moveTo(x0, y);
|
||||
//xold=x0;
|
||||
yold=y;
|
||||
first=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pf.lineTo(x0, yold);
|
||||
pf.closeSubpath();
|
||||
if (drawLine) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
if (drawSelectionLine) {
|
||||
QPen penSelection=p; penSelection.setStyle(Qt::SolidLine);
|
||||
QColor selcol=penSelection.color(); selcol.setAlphaF(0.5); penSelection.setColor(selcol);
|
||||
if (selectionLineColor!=Qt::transparent) {
|
||||
penSelection.setColor(selectionLineColor);
|
||||
}
|
||||
penSelection.setWidthF(penSelection.widthF()*3.0);
|
||||
painter.setPen(penSelection);
|
||||
painter.drawPath(pl);
|
||||
}
|
||||
|
||||
painter.setPen(p);
|
||||
painter.drawPath(pl);
|
||||
|
||||
}
|
||||
painter.setBrush(b);
|
||||
painter.setPen(np);
|
||||
painter.drawPath(pf);
|
||||
|
||||
}
|
||||
|
||||
drawErrorsAfter(painter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QPen JKQTPFilledCurveXGraph::getLinePen(JKQTPEnhancedPainter& painter) const {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
QBrush JKQTPFilledCurveXGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
|
||||
QBrush b;
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
return b;
|
||||
}
|
||||
|
||||
|
||||
JKQTPFilledCurveXErrorGraph::JKQTPFilledCurveXErrorGraph(JKQTBasePlotter *parent):
|
||||
JKQTPFilledCurveXGraph(parent), JKQTPYGraphErrors(color, parent)
|
||||
JKQTPFilledCurveXGraph(parent), JKQTPYGraphErrors(getLineColor(), parent)
|
||||
{
|
||||
setErrorColorFromGraphColor(color);
|
||||
setErrorColorFromGraphColor(getLineColor());
|
||||
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
|
||||
|
||||
}
|
||||
@ -408,9 +97,9 @@ void JKQTPFilledCurveXErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
|
||||
}
|
||||
|
||||
JKQTPFilledCurveYErrorGraph::JKQTPFilledCurveYErrorGraph(JKQTBasePlotter *parent):
|
||||
JKQTPFilledCurveYGraph(parent), JKQTPXGraphErrors(color, parent)
|
||||
JKQTPFilledCurveYGraph(parent), JKQTPXGraphErrors(getLineColor(), parent)
|
||||
{
|
||||
setErrorColorFromGraphColor(color);
|
||||
setErrorColorFromGraphColor(getLineColor());
|
||||
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
|
||||
|
||||
}
|
||||
@ -438,26 +127,9 @@ void JKQTPFilledCurveYErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
|
||||
JKQTPFilledVerticalRangeGraph::JKQTPFilledVerticalRangeGraph(JKQTBasePlotter *parent):
|
||||
JKQTPXYGraph(parent)
|
||||
{
|
||||
drawSelectionLine=false;
|
||||
selectionLineColor=Qt::transparent;
|
||||
color=QColor("red");
|
||||
fillColor=color.lighter();
|
||||
style=Qt::SolidLine;
|
||||
lineWidth=2;
|
||||
parentPlotStyle=-1;
|
||||
drawLine=true;
|
||||
fillStyle=Qt::SolidPattern;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
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();
|
||||
fillStyle=parent->getPlotStyle(parentPlotStyle).fillStyle();
|
||||
|
||||
}
|
||||
initFillStyle(parent, parentPlotStyle);
|
||||
initLineStyle(parent, parentPlotStyle);
|
||||
}
|
||||
|
||||
JKQTPFilledVerticalRangeGraph::JKQTPFilledVerticalRangeGraph(JKQTPlotter *parent):
|
||||
@ -525,17 +197,11 @@ void JKQTPFilledVerticalRangeGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen ps=getHighlightingLinePen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
||||
int imax=static_cast<int>(qMin(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()), datastore->getColumn(static_cast<size_t>(yColumn2)).getRows()));
|
||||
int imin=0;
|
||||
@ -583,14 +249,9 @@ void JKQTPFilledVerticalRangeGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
if (drawLine) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
if (drawSelectionLine) {
|
||||
QPen penSelection=p; penSelection.setStyle(Qt::SolidLine);
|
||||
QColor selcol=penSelection.color(); selcol.setAlphaF(0.5); penSelection.setColor(selcol);
|
||||
if (selectionLineColor!=Qt::transparent) {
|
||||
penSelection.setColor(selectionLineColor);
|
||||
}
|
||||
penSelection.setWidthF(penSelection.widthF()*3.0);
|
||||
painter.setPen(penSelection);
|
||||
if (isHighlighted()) {
|
||||
|
||||
painter.setPen(ps);
|
||||
painter.drawPolyline(phigh);
|
||||
painter.drawPolyline(plow);
|
||||
}
|
||||
@ -611,34 +272,39 @@ void JKQTPFilledVerticalRangeGraph::drawKeyMarker(JKQTPEnhancedPainter &painter,
|
||||
QRectF r=rect;
|
||||
r.setHeight(r.height()/2.0);
|
||||
r.moveTo(r.x(), r.y()+r.height()-1);
|
||||
painter.fillRect(r, getBrush(painter));
|
||||
painter.fillRect(r, getFillBrush(painter, parent));
|
||||
if (drawLine) {
|
||||
painter.setPen(getLinePen(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.drawLine(QLineF(r.topLeft(), r.topRight()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPFilledVerticalRangeGraph::getKeyLabelColor()
|
||||
QColor JKQTPFilledVerticalRangeGraph::getKeyLabelColor() const
|
||||
{
|
||||
return color;
|
||||
return getLineColor();
|
||||
}
|
||||
|
||||
QBrush JKQTPFilledVerticalRangeGraph::getBrush(JKQTPEnhancedPainter &/*painter*/) const
|
||||
void JKQTPFilledVerticalRangeGraph::setYColumn2(int __value)
|
||||
{
|
||||
QBrush b;
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
return b;
|
||||
this->yColumn2 = __value;
|
||||
}
|
||||
|
||||
QPen JKQTPFilledVerticalRangeGraph::getLinePen(JKQTPEnhancedPainter &painter) const
|
||||
int JKQTPFilledVerticalRangeGraph::getYColumn2() const
|
||||
{
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
return p;
|
||||
return this->yColumn2;
|
||||
}
|
||||
|
||||
void JKQTPFilledVerticalRangeGraph::setYColumn2(size_t __value) {
|
||||
this->yColumn2 = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
void JKQTPFilledVerticalRangeGraph::setDrawLine(bool __value)
|
||||
{
|
||||
drawLine=__value;
|
||||
}
|
||||
|
||||
bool JKQTPFilledVerticalRangeGraph::getDrawLine() const
|
||||
{
|
||||
return drawLine;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbase.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
|
||||
#include "jkqtplotter/jkqtpgraphsspecialline.h"
|
||||
|
||||
#ifndef jkqtpgraphsfilledcurve_H
|
||||
#define jkqtpgraphsfilledcurve_H
|
||||
@ -36,158 +37,13 @@
|
||||
|
||||
\see \ref JKQTPlotterFilledGraphs
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPFilledCurveXGraph: public JKQTPXYGraph {
|
||||
class JKQTP_LIB_EXPORT JKQTPFilledCurveXGraph: public JKQTPSpecialLineHorizontalGraph {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPFilledCurveXGraph(JKQTBasePlotter* parent=nullptr);
|
||||
/** \brief class constructor */
|
||||
JKQTPFilledCurveXGraph(JKQTPlotter* parent);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual void setStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->style = __value;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual Qt::PenStyle getStyle() const
|
||||
{
|
||||
return this->style;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
inline virtual void setBaseline(double __value)
|
||||
{
|
||||
this->baseline = __value;
|
||||
}
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
inline virtual double getBaseline() const
|
||||
{
|
||||
return this->baseline;
|
||||
}
|
||||
/*! \copydoc drawLine
|
||||
\see see drawLine for details */
|
||||
inline virtual void setDrawLine(bool __value)
|
||||
{
|
||||
this->drawLine = __value;
|
||||
}
|
||||
/*! \copydoc drawLine
|
||||
\see see drawLine for details */
|
||||
inline virtual bool getDrawLine() const
|
||||
{
|
||||
return this->drawLine;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
|
||||
{
|
||||
this->fillStyle = __value;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual Qt::BrushStyle getFillStyle() const
|
||||
{
|
||||
return this->fillStyle;
|
||||
}
|
||||
|
||||
/*! \copydoc drawSelectionLine
|
||||
\see see drawSelectionLine for details */
|
||||
inline virtual void setDrawSelectionLine(bool __value)
|
||||
{
|
||||
this->drawSelectionLine = __value;
|
||||
}
|
||||
/*! \copydoc drawSelectionLine
|
||||
\see see drawSelectionLine for details */
|
||||
inline virtual bool getDrawSelectionLine() const
|
||||
{
|
||||
return this->drawSelectionLine;
|
||||
}
|
||||
/*! \copydoc selectionLineColor
|
||||
\see see selectionLineColor for details */
|
||||
inline virtual void setSelectionLineColor(const QColor & __value)
|
||||
{
|
||||
this->selectionLineColor = __value;
|
||||
}
|
||||
/*! \copydoc selectionLineColor
|
||||
\see see selectionLineColor for details */
|
||||
inline virtual QColor getSelectionLineColor() const
|
||||
{
|
||||
return this->selectionLineColor;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/** \brief if \c true, draws a thick shadow around the line*/
|
||||
bool drawSelectionLine;
|
||||
/** \brief color for the shadow, or a lighter version of the line color, if transparent (default) */
|
||||
QColor selectionLineColor;
|
||||
|
||||
/** \brief which plot style to use from the parent plotter (via JKQTBasePlotter::getPlotStyle() and JKQTBasePlotter::getNextStyle() ) */
|
||||
int parentPlotStyle;
|
||||
|
||||
/** \brief color of the graph */
|
||||
QColor color;
|
||||
/** \brief color of the graph fill */
|
||||
QColor fillColor;
|
||||
/** \brief fill styl for the curve */
|
||||
Qt::BrushStyle fillStyle;
|
||||
/** \brief linestyle of the graph lines */
|
||||
Qt::PenStyle style;
|
||||
/** \brief width (pixels) of the graph */
|
||||
double lineWidth;
|
||||
/** \brief indicates whether to draw a line or not */
|
||||
bool drawLine;
|
||||
/** \brief baseline of the plot (NOTE: 0 is interpreted as until plot border in log-mode!!!)
|
||||
*/
|
||||
double baseline;
|
||||
QBrush getBrush(JKQTPEnhancedPainter& painter) const;
|
||||
QPen getLinePen(JKQTPEnhancedPainter& painter) const;
|
||||
};
|
||||
|
||||
|
||||
@ -229,7 +85,7 @@ class JKQTP_LIB_EXPORT JKQTPFilledCurveXErrorGraph: public JKQTPFilledCurveXGrap
|
||||
\see \ref JKQTPlotterFilledGraphs
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPFilledCurveYGraph: public JKQTPFilledCurveXGraph {
|
||||
class JKQTP_LIB_EXPORT JKQTPFilledCurveYGraph: public JKQTPSpecialLineVerticalGraph {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
@ -237,8 +93,7 @@ class JKQTP_LIB_EXPORT JKQTPFilledCurveYGraph: public JKQTPFilledCurveXGraph {
|
||||
/** \brief class constructor */
|
||||
JKQTPFilledCurveYGraph(JKQTPlotter* parent);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -284,7 +139,7 @@ class JKQTP_LIB_EXPORT JKQTPFilledCurveYErrorGraph: public JKQTPFilledCurveYGrap
|
||||
|
||||
\see \ref JKQTPlotterDateTimeAxes
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPFilledVerticalRangeGraph: public JKQTPXYGraph {
|
||||
class JKQTP_LIB_EXPORT JKQTPFilledVerticalRangeGraph: public JKQTPXYGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
@ -305,138 +160,35 @@ class JKQTP_LIB_EXPORT JKQTPFilledVerticalRangeGraph: public JKQTPXYGraph {
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
/*! \copydoc yColumn2
|
||||
\see see yColumn2 for details */
|
||||
inline virtual void setYColumn2(int __value)
|
||||
{
|
||||
this->yColumn2 = __value;
|
||||
}
|
||||
void setYColumn2(int __value);
|
||||
/*! \copydoc yColumn2
|
||||
\see see yColumn2 for details */
|
||||
inline virtual int getYColumn2() const
|
||||
{
|
||||
return this->yColumn2;
|
||||
}
|
||||
int getYColumn2() const;
|
||||
/*! \brief sets the property yColumn2 ( \copybrief yColumn2 ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter yColumn2 is: <BLOCKQUOTE>\copydoc yColumn2 </BLOCKQUOTE>
|
||||
\see yColumn2 for more information */
|
||||
inline virtual void setYColumn2 (size_t __value) { this->yColumn2 = static_cast<int>(__value); }
|
||||
void setYColumn2 (size_t __value);
|
||||
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual void setStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->style = __value;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual Qt::PenStyle getStyle() const
|
||||
{
|
||||
return this->style;
|
||||
}
|
||||
/*! \copydoc drawLine
|
||||
\see see drawLine for details */
|
||||
inline virtual void setDrawLine(bool __value)
|
||||
{
|
||||
this->drawLine = __value;
|
||||
}
|
||||
\see see drawLine for details */
|
||||
void setDrawLine(bool __value);
|
||||
/*! \copydoc drawLine
|
||||
\see see drawLine for details */
|
||||
inline virtual bool getDrawLine() const
|
||||
{
|
||||
return this->drawLine;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
|
||||
{
|
||||
this->fillStyle = __value;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual Qt::BrushStyle getFillStyle() const
|
||||
{
|
||||
return this->fillStyle;
|
||||
}
|
||||
\see see drawLine for details */
|
||||
bool getDrawLine() const;
|
||||
|
||||
/*! \copydoc drawSelectionLine
|
||||
\see see drawSelectionLine for details */
|
||||
inline virtual void setDrawSelectionLine(bool __value)
|
||||
{
|
||||
this->drawSelectionLine = __value;
|
||||
}
|
||||
/*! \copydoc drawSelectionLine
|
||||
\see see drawSelectionLine for details */
|
||||
inline virtual bool getDrawSelectionLine() const
|
||||
{
|
||||
return this->drawSelectionLine;
|
||||
}
|
||||
/*! \copydoc selectionLineColor
|
||||
\see see selectionLineColor for details */
|
||||
inline virtual void setSelectionLineColor(const QColor & __value)
|
||||
{
|
||||
this->selectionLineColor = __value;
|
||||
}
|
||||
/*! \copydoc selectionLineColor
|
||||
\see see selectionLineColor for details */
|
||||
inline virtual QColor getSelectionLineColor() const
|
||||
{
|
||||
return this->selectionLineColor;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/** \brief the column that contains the second y-component of the range */
|
||||
int yColumn2;
|
||||
/** \brief if \c true, draws a thick shadow around the line*/
|
||||
bool drawSelectionLine;
|
||||
/** \brief color for the shadow, or a lighter version of the line color, if transparent (default) */
|
||||
QColor selectionLineColor;
|
||||
|
||||
/** \brief which plot style to use from the parent plotter (via JKQTBasePlotter::getPlotStyle() and JKQTBasePlotter::getNextStyle() ) */
|
||||
int parentPlotStyle;
|
||||
|
||||
/** \brief color of the graph */
|
||||
QColor color;
|
||||
/** \brief color of the graph fill */
|
||||
QColor fillColor;
|
||||
/** \brief fill styl for the curve */
|
||||
Qt::BrushStyle fillStyle;
|
||||
/** \brief linestyle of the graph lines */
|
||||
Qt::PenStyle style;
|
||||
/** \brief width (pixels) of the graph */
|
||||
double lineWidth;
|
||||
/** \brief indicates whether to draw a line or not */
|
||||
bool drawLine;
|
||||
|
||||
QBrush getBrush(JKQTPEnhancedPainter& painter) const;
|
||||
QPen getLinePen(JKQTPEnhancedPainter& painter) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -30,103 +30,115 @@
|
||||
JKQTPGeoBaseLine::JKQTPGeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style, JKQTBasePlotter* parent):
|
||||
JKQTPPlotObject(parent)
|
||||
{
|
||||
this->color=color;
|
||||
this->lineWidth=lineWidth;
|
||||
this->style=style;
|
||||
title="";
|
||||
setLineColor(color);
|
||||
setLineWidth(lineWidth);
|
||||
setLineStyle(style);
|
||||
}
|
||||
|
||||
JKQTPGeoBaseLine::JKQTPGeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style, JKQTPlotter* parent):
|
||||
JKQTPGeoBaseLine(color, lineWidth, style, parent->getPlotter())
|
||||
{
|
||||
}
|
||||
|
||||
JKQTPGeoBaseLine::JKQTPGeoBaseLine(JKQTBasePlotter *parent):
|
||||
JKQTPPlotObject(parent)
|
||||
{
|
||||
this->color=color;
|
||||
this->lineWidth=lineWidth;
|
||||
this->style=style;
|
||||
title="";
|
||||
|
||||
}
|
||||
|
||||
JKQTPGeoBaseLine::JKQTPGeoBaseLine(JKQTPlotter *parent):
|
||||
JKQTPGeoBaseLine(parent->getPlotter())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoBaseLine::setAlpha(float alpha)
|
||||
{
|
||||
auto color=getLineColor();
|
||||
color.setAlphaF(alpha);
|
||||
setLineColor(color);
|
||||
}
|
||||
|
||||
QPen JKQTPGeoBaseLine::getPen(JKQTPEnhancedPainter& painter) {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setStyle(style);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
return p;
|
||||
void JKQTPGeoBaseLine::setColor(QColor c)
|
||||
{
|
||||
setLineColor(c);
|
||||
}
|
||||
|
||||
|
||||
void JKQTPGeoBaseLine::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
double y=rect.top()+rect.height()/2.0;
|
||||
if (rect.width()>0) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPGeoBaseLine::getKeyLabelColor() {
|
||||
return color;
|
||||
QColor JKQTPGeoBaseLine::getKeyLabelColor() const {
|
||||
return getLineColor();
|
||||
}
|
||||
|
||||
|
||||
JKQTPGeoBaseFilled::JKQTPGeoBaseFilled(QColor color, QColor fillColor, double lineWidth, Qt::PenStyle style, Qt::BrushStyle fillStyle, JKQTBasePlotter* parent):
|
||||
JKQTPGeoBaseLine(color, lineWidth, style, parent)
|
||||
{
|
||||
this->fillColor=fillColor;
|
||||
this->fillStyle=fillStyle;
|
||||
setFillColor(fillColor);
|
||||
setFillStyle(fillStyle);
|
||||
}
|
||||
|
||||
JKQTPGeoBaseFilled::JKQTPGeoBaseFilled(QColor color, QColor fillColor, double lineWidth, Qt::PenStyle style, Qt::BrushStyle fillStyle, JKQTPlotter* parent):
|
||||
JKQTPGeoBaseLine(color, lineWidth, style, parent)
|
||||
{
|
||||
this->fillColor=fillColor;
|
||||
this->fillStyle=fillStyle;
|
||||
setFillColor(fillColor);
|
||||
setFillStyle(fillStyle);
|
||||
}
|
||||
|
||||
JKQTPGeoBaseFilled::JKQTPGeoBaseFilled(QColor color, QColor fillColor, double lineWidth, Qt::PenStyle style, JKQTPlotter* parent):
|
||||
JKQTPGeoBaseLine(color, lineWidth, style, parent)
|
||||
{
|
||||
this->fillColor=fillColor;
|
||||
this->fillStyle=Qt::SolidPattern;
|
||||
setFillColor(fillColor);
|
||||
setFillStyle(Qt::SolidPattern);
|
||||
}
|
||||
|
||||
JKQTPGeoBaseFilled::JKQTPGeoBaseFilled(QColor color, QColor fillColor, double lineWidth, JKQTPlotter* parent):
|
||||
JKQTPGeoBaseLine(color, lineWidth, Qt::SolidLine, parent)
|
||||
{
|
||||
this->fillColor=fillColor;
|
||||
this->fillStyle=Qt::SolidPattern;
|
||||
setFillColor(fillColor);
|
||||
setFillStyle(Qt::SolidPattern);
|
||||
}
|
||||
JKQTPGeoBaseFilled::JKQTPGeoBaseFilled(QColor color, QColor fillColor, JKQTPlotter* parent):
|
||||
JKQTPGeoBaseLine(color, 2.0, Qt::SolidLine, parent)
|
||||
{
|
||||
this->fillColor=fillColor;
|
||||
this->fillStyle=Qt::SolidPattern;
|
||||
setFillColor(fillColor);
|
||||
setFillStyle(Qt::SolidPattern);
|
||||
}
|
||||
|
||||
void JKQTPGeoBaseFilled::setAlpha(float alpha)
|
||||
{
|
||||
JKQTPGeoBaseLine::setAlpha(alpha);
|
||||
auto fillColor=getFillColor();
|
||||
fillColor.setAlphaF(alpha);
|
||||
setFillColor(fillColor);
|
||||
}
|
||||
|
||||
void JKQTPGeoBaseFilled::setAlpha(float alphaLine, float alphaFill)
|
||||
{
|
||||
JKQTPGeoBaseLine::setAlpha(alphaLine);
|
||||
auto fillColor=getFillColor();
|
||||
fillColor.setAlphaF(alphaFill);
|
||||
setFillColor(fillColor);
|
||||
}
|
||||
QBrush JKQTPGeoBaseFilled::getBrush(JKQTPEnhancedPainter &/*painter*/) {
|
||||
QBrush b;
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
return b;
|
||||
|
||||
void JKQTPGeoBaseFilled::setColor(QColor c)
|
||||
{
|
||||
JKQTPGeoBaseLine::setColor(c);
|
||||
setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
|
||||
}
|
||||
|
||||
|
||||
void JKQTPGeoBaseFilled::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setBrush(getBrush(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.setBrush(getFillBrush(painter, parent));
|
||||
painter.drawRect(rect);
|
||||
|
||||
}
|
||||
@ -136,18 +148,13 @@ void JKQTPGeoBaseFilled::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& re
|
||||
|
||||
|
||||
JKQTPGeoText::JKQTPGeoText(JKQTBasePlotter* parent, double x, double y, const QString& text, double fontSize, QColor color):
|
||||
JKQTPPlotObject(parent)
|
||||
JKQTPPlotObject(parent), JKQTPGraphTextStyleMixin(parent)
|
||||
{
|
||||
this->x=x;
|
||||
this->y=y;
|
||||
this->text=text;
|
||||
this->fontSize=fontSize;
|
||||
this->fontName=QApplication::font().family()+"+XITS";
|
||||
this->color=color;
|
||||
if (parent) {
|
||||
this->fontSize=parent->getCurrentPlotterStyle().defaultFontSize;
|
||||
this->fontName=parent->getCurrentPlotterStyle().defaultFontName;
|
||||
}
|
||||
setTextFontSize(fontSize);
|
||||
setTextColor(color);
|
||||
}
|
||||
|
||||
JKQTPGeoText::JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QString& text, double fontSize, QColor color):
|
||||
@ -155,6 +162,54 @@ JKQTPGeoText::JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QStrin
|
||||
{
|
||||
}
|
||||
|
||||
JKQTPGeoText::JKQTPGeoText(JKQTBasePlotter *parent, double x, double y, const QString &text):
|
||||
JKQTPPlotObject(parent), JKQTPGraphTextStyleMixin(parent)
|
||||
{
|
||||
this->x=x;
|
||||
this->y=y;
|
||||
this->text=text;
|
||||
}
|
||||
|
||||
JKQTPGeoText::JKQTPGeoText(JKQTPlotter *parent, double x, double y, const QString &text):
|
||||
JKQTPGeoText(parent->getPlotter(),x,y,text)
|
||||
{
|
||||
}
|
||||
|
||||
void JKQTPGeoText::setText(const QString &__value)
|
||||
{
|
||||
this->text = __value;
|
||||
}
|
||||
|
||||
QString JKQTPGeoText::getText() const
|
||||
{
|
||||
return this->text;
|
||||
}
|
||||
|
||||
void JKQTPGeoText::setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoText::getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
|
||||
void JKQTPGeoText::setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoText::getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
|
||||
void JKQTPGeoText::setColor(QColor c)
|
||||
{
|
||||
setTextColor(c);
|
||||
}
|
||||
|
||||
bool JKQTPGeoText::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
|
||||
minx=maxx=x;
|
||||
smallestGreaterZero=0;
|
||||
@ -171,9 +226,9 @@ bool JKQTPGeoText::getYMinMax(double& miny, double& maxy, double& smallestGreate
|
||||
|
||||
void JKQTPGeoText::draw(JKQTPEnhancedPainter& painter) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
parent->getMathText()->setFontRomanOrSpecial(fontName);
|
||||
parent->getMathText()->setFontSize(fontSize*parent->getFontSizeMultiplier());
|
||||
parent->getMathText()->setFontColor(color);
|
||||
parent->getMathText()->setFontRomanOrSpecial(getTextFontName());
|
||||
parent->getMathText()->setFontSize(getTextFontSize()*parent->getFontSizeMultiplier());
|
||||
parent->getMathText()->setFontColor(getTextColor());
|
||||
parent->getMathText()->parse(text);
|
||||
parent->getMathText()->draw(painter, transformX(x), transformY(y));
|
||||
|
||||
@ -181,20 +236,14 @@ void JKQTPGeoText::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
void JKQTPGeoText::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setPen(QPen(getTextColor()));
|
||||
double y=rect.top()+rect.height()/2.0;
|
||||
if (rect.width()>0) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPGeoText::getKeyLabelColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
QPen JKQTPGeoText::getPen(JKQTPEnhancedPainter &/*painter*/) {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
return p;
|
||||
QColor JKQTPGeoText::getKeyLabelColor() const {
|
||||
return getTextColor();
|
||||
}
|
||||
|
||||
|
||||
@ -212,13 +261,24 @@ JKQTPGeoLine::JKQTPGeoLine(JKQTBasePlotter* parent, double x1, double y1, double
|
||||
}
|
||||
|
||||
JKQTPGeoLine::JKQTPGeoLine(JKQTPlotter* parent, double x1, double y1, double x2, double y2, QColor color, double lineWidth, Qt::PenStyle style):
|
||||
JKQTPGeoBaseLine(color, lineWidth, style, parent)
|
||||
JKQTPGeoLine(parent->getPlotter(), x1,y1,x2,y2,color, lineWidth, style)
|
||||
{
|
||||
}
|
||||
|
||||
JKQTPGeoLine::JKQTPGeoLine(JKQTBasePlotter *parent, double x1, double y1, double x2, double y2):
|
||||
JKQTPGeoBaseLine(parent)
|
||||
{
|
||||
this->x1=x1;
|
||||
this->y1=y1;
|
||||
this->x2=x2;
|
||||
this->y2=y2;
|
||||
}
|
||||
|
||||
JKQTPGeoLine::JKQTPGeoLine(JKQTPlotter *parent, double x1, double y1, double x2, double y2):
|
||||
JKQTPGeoLine(parent->getPlotter(), x1,y1,x2,y2)
|
||||
{
|
||||
}
|
||||
|
||||
bool JKQTPGeoLine::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
|
||||
minx=qMin(x1, x2);
|
||||
maxx=qMax(x1, x2);
|
||||
@ -241,12 +301,52 @@ bool JKQTPGeoLine::getYMinMax(double& miny, double& maxy, double& smallestGreate
|
||||
|
||||
void JKQTPGeoLine::draw(JKQTPEnhancedPainter& painter) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
QLineF l(QPointF(transformX(x1), transformY(y1)), QPointF(transformX(x2), transformY(y2)));
|
||||
if (l.length()>0) painter.drawLine(l);
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoLine::setX1(double __value)
|
||||
{
|
||||
this->x1 = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoLine::getX1() const
|
||||
{
|
||||
return this->x1;
|
||||
}
|
||||
|
||||
void JKQTPGeoLine::setY1(double __value)
|
||||
{
|
||||
this->y1 = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoLine::getY1() const
|
||||
{
|
||||
return this->y1;
|
||||
}
|
||||
|
||||
void JKQTPGeoLine::setX2(double __value)
|
||||
{
|
||||
this->x2 = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoLine::getX2() const
|
||||
{
|
||||
return this->x2;
|
||||
}
|
||||
|
||||
void JKQTPGeoLine::setY2(double __value)
|
||||
{
|
||||
this->y2 = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoLine::getY2() const
|
||||
{
|
||||
return this->y2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -263,13 +363,8 @@ JKQTPGeoInfiniteLine::JKQTPGeoInfiniteLine(JKQTBasePlotter* parent, double x, do
|
||||
}
|
||||
|
||||
JKQTPGeoInfiniteLine::JKQTPGeoInfiniteLine(JKQTPlotter* parent, double x, double y, double dx, double dy, QColor color, double lineWidth, Qt::PenStyle style):
|
||||
JKQTPGeoBaseLine(color, lineWidth, style, parent)
|
||||
JKQTPGeoInfiniteLine(parent->getPlotter(), x, y, dx, dy, color, lineWidth, style)
|
||||
{
|
||||
this->x=x;
|
||||
this->y=y;
|
||||
this->dx=dx;
|
||||
this->dy=dy;
|
||||
this->two_sided=false;
|
||||
}
|
||||
|
||||
bool JKQTPGeoInfiniteLine::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
|
||||
@ -406,7 +501,7 @@ void JKQTPGeoInfiniteLine::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
if (doDraw) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
QLineF l(QPointF(transformX(x1), transformY(y1)), QPointF(transformX(x2), transformY(y2)));
|
||||
if (l.length()>0) painter.drawLine(l);
|
||||
|
||||
@ -414,6 +509,56 @@ void JKQTPGeoInfiniteLine::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoInfiniteLine::setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoInfiniteLine::getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
|
||||
void JKQTPGeoInfiniteLine::setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoInfiniteLine::getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
|
||||
void JKQTPGeoInfiniteLine::setDx(double __value)
|
||||
{
|
||||
this->dx = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoInfiniteLine::getDx() const
|
||||
{
|
||||
return this->dx;
|
||||
}
|
||||
|
||||
void JKQTPGeoInfiniteLine::setDy(double __value)
|
||||
{
|
||||
this->dy = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoInfiniteLine::getDy() const
|
||||
{
|
||||
return this->dy;
|
||||
}
|
||||
|
||||
void JKQTPGeoInfiniteLine::setTwoSided(bool __value)
|
||||
{
|
||||
this->two_sided = __value;
|
||||
}
|
||||
|
||||
bool JKQTPGeoInfiniteLine::getTwoSided() const
|
||||
{
|
||||
return this->two_sided;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -482,11 +627,29 @@ bool JKQTPGeoPolyLines::getYMinMax(double& miny, double& maxy, double& smallestG
|
||||
void JKQTPGeoPolyLines::draw(JKQTPEnhancedPainter& painter) {
|
||||
QPainterPath path=transformToLinePath(points);
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.drawPath(path);
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoPolyLines::setPoints(const QVector<QPointF> &__value)
|
||||
{
|
||||
this->points = __value;
|
||||
}
|
||||
|
||||
QVector<QPointF> JKQTPGeoPolyLines::getPoints() const
|
||||
{
|
||||
return this->points;
|
||||
}
|
||||
|
||||
void JKQTPGeoPolyLines::appendPoint(const QPointF &p) {
|
||||
points.append(p);
|
||||
}
|
||||
|
||||
void JKQTPGeoPolyLines::appendPoint(const double x, const double y) {
|
||||
points.append(QPointF(x, y));
|
||||
}
|
||||
|
||||
|
||||
JKQTPGeoRectangle::JKQTPGeoRectangle(JKQTBasePlotter* parent, double x, double y, double width, double height, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
|
||||
JKQTPGeoBaseFilled(color, fillColor, lineWidth, style, fillStyle, parent)
|
||||
@ -598,12 +761,62 @@ void JKQTPGeoRectangle::draw(JKQTPEnhancedPainter& painter) {
|
||||
}
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setBrush(getBrush(painter));
|
||||
painter.setPen(getLinePenForRects(painter, parent));
|
||||
painter.setBrush(getFillBrush(painter, parent));
|
||||
painter.drawPolygon(rect);
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoRectangle::setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoRectangle::getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
|
||||
void JKQTPGeoRectangle::setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoRectangle::getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
|
||||
void JKQTPGeoRectangle::setWidth(double __value)
|
||||
{
|
||||
this->width = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoRectangle::getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
|
||||
void JKQTPGeoRectangle::setHeight(double __value)
|
||||
{
|
||||
this->height = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoRectangle::getHeight() const
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
|
||||
void JKQTPGeoRectangle::setAngle(double __value)
|
||||
{
|
||||
this->angle = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoRectangle::getAngle() const
|
||||
{
|
||||
return this->angle;
|
||||
}
|
||||
|
||||
|
||||
void JKQTPGeoRectangle::setBottomleftrectangle(double x, double y, double width, double height) {
|
||||
this->x=x+width/2.0;
|
||||
@ -675,12 +888,30 @@ bool JKQTPGeoPolygon::getYMinMax(double& miny, double& maxy, double& smallestGre
|
||||
void JKQTPGeoPolygon::draw(JKQTPEnhancedPainter& painter) {
|
||||
QPolygonF path=transformToPolygon(points);
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setBrush(getBrush(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.setBrush(getFillBrush(painter, parent));
|
||||
painter.drawPolygon(path);
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoPolygon::setPoints(const QVector<QPointF> &__value)
|
||||
{
|
||||
this->points = __value;
|
||||
}
|
||||
|
||||
QVector<QPointF> JKQTPGeoPolygon::getPoints() const
|
||||
{
|
||||
return this->points;
|
||||
}
|
||||
|
||||
void JKQTPGeoPolygon::appendPoint(const QPointF &p) {
|
||||
points.append(p);
|
||||
}
|
||||
|
||||
void JKQTPGeoPolygon::appendPoint(const double x, const double y) {
|
||||
points.append(QPointF(x, y));
|
||||
}
|
||||
|
||||
|
||||
|
||||
JKQTPGeoEllipse::JKQTPGeoEllipse(JKQTBasePlotter* parent, double x, double y, double width, double height, QColor color, double lineWidth, Qt::PenStyle style, QColor fillColor, Qt::BrushStyle fillStyle):
|
||||
@ -727,12 +958,22 @@ void JKQTPGeoEllipse::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setBrush(getBrush(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.setBrush(getFillBrush(painter, parent));
|
||||
painter.drawPath(rect);
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoEllipse::setControlPoints(const unsigned int &__value)
|
||||
{
|
||||
this->controlPoints = __value;
|
||||
}
|
||||
|
||||
unsigned int JKQTPGeoEllipse::getControlPoints() const
|
||||
{
|
||||
return this->controlPoints;
|
||||
}
|
||||
|
||||
|
||||
|
||||
JKQTPGeoArc::JKQTPGeoArc(JKQTBasePlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color, double lineWidth, Qt::PenStyle style):
|
||||
@ -749,16 +990,8 @@ JKQTPGeoArc::JKQTPGeoArc(JKQTBasePlotter* parent, double x, double y, double wid
|
||||
}
|
||||
|
||||
JKQTPGeoArc::JKQTPGeoArc(JKQTPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color, double lineWidth, Qt::PenStyle style):
|
||||
JKQTPGeoBaseLine(color, lineWidth, style, parent)
|
||||
JKQTPGeoArc(parent->getPlotter(), x, y, width, height, angleStart, angleStop, color, lineWidth, style)
|
||||
{
|
||||
this->angleStart=angleStart;
|
||||
this->angleStop=angleStop;
|
||||
this->x=x;
|
||||
this->y=y;
|
||||
this->width=width;
|
||||
this->height=height;
|
||||
this->angle=0;
|
||||
this->controlPoints=180;
|
||||
}
|
||||
|
||||
|
||||
@ -767,11 +1000,91 @@ void JKQTPGeoArc::draw(JKQTPEnhancedPainter& painter) {
|
||||
rect=transformToLinePath(JKQTPDrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.drawPath(rect);
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoArc::setControlPoints(const unsigned int &__value)
|
||||
{
|
||||
this->controlPoints = __value;
|
||||
}
|
||||
|
||||
unsigned int JKQTPGeoArc::getControlPoints() const
|
||||
{
|
||||
return this->controlPoints;
|
||||
}
|
||||
|
||||
void JKQTPGeoArc::setAngleStart(double __value)
|
||||
{
|
||||
this->angleStart = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoArc::getAngleStart() const
|
||||
{
|
||||
return this->angleStart;
|
||||
}
|
||||
|
||||
void JKQTPGeoArc::setAngleStop(double __value)
|
||||
{
|
||||
this->angleStop = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoArc::getAngleStop() const
|
||||
{
|
||||
return this->angleStop;
|
||||
}
|
||||
|
||||
void JKQTPGeoArc::setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoArc::getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
|
||||
void JKQTPGeoArc::setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoArc::getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
|
||||
void JKQTPGeoArc::setWidth(double __value)
|
||||
{
|
||||
this->width = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoArc::getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
|
||||
void JKQTPGeoArc::setHeight(double __value)
|
||||
{
|
||||
this->height = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoArc::getHeight() const
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
|
||||
void JKQTPGeoArc::setAngle(double __value)
|
||||
{
|
||||
this->angle = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoArc::getAngle() const
|
||||
{
|
||||
return this->angle;
|
||||
}
|
||||
|
||||
|
||||
bool JKQTPGeoArc::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
|
||||
QPolygonF rect;
|
||||
@ -827,12 +1140,32 @@ void JKQTPGeoPie::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setBrush(getBrush(painter));
|
||||
painter.setPen(getLinePenForRects(painter, parent));
|
||||
painter.setBrush(getFillBrush(painter, parent));
|
||||
painter.drawPath(rect);
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoPie::setAngleStart(double __value)
|
||||
{
|
||||
this->angleStart = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoPie::getAngleStart() const
|
||||
{
|
||||
return this->angleStart;
|
||||
}
|
||||
|
||||
void JKQTPGeoPie::setAngleStop(double __value)
|
||||
{
|
||||
this->angleStop = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoPie::getAngleStop() const
|
||||
{
|
||||
return this->angleStop;
|
||||
}
|
||||
|
||||
bool JKQTPGeoPie::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
|
||||
QPolygonF rect;
|
||||
rect=QPolygonF(JKQTPDrawEllipse(x,y,width/2.0, height/2.0,angleStart,angleStop,angle, controlPoints));
|
||||
@ -884,8 +1217,8 @@ void JKQTPGeoChord::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(getPen(painter));
|
||||
painter.setBrush(getBrush(painter));
|
||||
painter.setPen(getLinePen(painter, parent));
|
||||
painter.setBrush(getFillBrush(painter, parent));
|
||||
painter.drawPath(rect);
|
||||
|
||||
}
|
||||
@ -920,11 +1253,11 @@ JKQTPGeoSymbol::JKQTPGeoSymbol(JKQTBasePlotter *parent, double x, double y, JKQT
|
||||
{
|
||||
this->x=x;
|
||||
this->y=y;
|
||||
this->symbol=symbol;
|
||||
this->symbolSize=symbolSize;
|
||||
this->color=color;
|
||||
this->fillColor=fillColor;
|
||||
this->symbolWidth=1;
|
||||
setSymbolType(symbol);
|
||||
setSymbolSize(symbolSize);
|
||||
setSymbolColor(color);
|
||||
setSymbolFillColor(fillColor);
|
||||
setSymbolLineWidth(1);
|
||||
}
|
||||
|
||||
JKQTPGeoSymbol::JKQTPGeoSymbol(JKQTPlotter *parent, double x, double y, JKQTPGraphSymbols symbol, double symbolSize, QColor color, QColor fillColor):
|
||||
@ -932,11 +1265,37 @@ JKQTPGeoSymbol::JKQTPGeoSymbol(JKQTPlotter *parent, double x, double y, JKQTPGra
|
||||
{
|
||||
this->x=x;
|
||||
this->y=y;
|
||||
this->symbol=symbol;
|
||||
this->symbolSize=symbolSize;
|
||||
this->color=color;
|
||||
this->fillColor=fillColor;
|
||||
this->symbolWidth=1;
|
||||
setSymbolType(symbol);
|
||||
setSymbolSize(symbolSize);
|
||||
setSymbolColor(color);
|
||||
setSymbolFillColor(fillColor);
|
||||
setSymbolLineWidth(1);
|
||||
}
|
||||
|
||||
void JKQTPGeoSymbol::setColor(QColor c)
|
||||
{
|
||||
setSymbolColor(c);
|
||||
setSymbolFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
|
||||
}
|
||||
|
||||
void JKQTPGeoSymbol::setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoSymbol::getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
|
||||
void JKQTPGeoSymbol::setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
|
||||
double JKQTPGeoSymbol::getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
|
||||
bool JKQTPGeoSymbol::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
|
||||
@ -962,24 +1321,24 @@ bool JKQTPGeoSymbol::getYMinMax(double &miny, double &maxy, double &smallestGrea
|
||||
void JKQTPGeoSymbol::draw(JKQTPEnhancedPainter &painter)
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
JKQTPPlotSymbol(painter, transformX(x), transformY(y), symbol, symbolSize, symbolWidth, color, fillColor);
|
||||
plotStyledSymbol(parent, painter, transformX(x), transformY(y));
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGeoSymbol::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
|
||||
{
|
||||
const double minSize=qMin(rect.width(), rect.height());
|
||||
double symbolSize=parent->pt2px(painter, this->symbolSize);
|
||||
double symbolSize=parent->pt2px(painter, this->getSymbolSize());
|
||||
if (symbolSize>minSize*0.9) symbolSize=minSize*0.9;
|
||||
double symbolWidth=parent->pt2px(painter, this->symbolWidth*parent->getLineWidthMultiplier());
|
||||
double symbolWidth=parent->pt2px(painter, this->getSymbolLineWidth()*parent->getLineWidthMultiplier());
|
||||
if (symbolWidth>0.3*symbolSize) symbolWidth=0.3*symbolSize;
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, symbol, symbolSize, symbolWidth, color, fillColor);
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), symbolSize, symbolWidth, getSymbolColor(), getSymbolFillColor());
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPGeoSymbol::getKeyLabelColor()
|
||||
QColor JKQTPGeoSymbol::getKeyLabelColor() const
|
||||
{
|
||||
return color;
|
||||
return getSymbolColor();
|
||||
}
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
#include <QPair>
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtmathtext/jkqtmathtext.h"
|
||||
@ -35,7 +36,7 @@
|
||||
\ingroup jkqtplotter_geoplots
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPGeoBaseLine: public JKQTPPlotObject {
|
||||
class JKQTP_LIB_EXPORT JKQTPGeoBaseLine: public JKQTPPlotObject, public JKQTPGraphLineStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/*! \brief class contructor
|
||||
@ -52,63 +53,29 @@ class JKQTP_LIB_EXPORT JKQTPGeoBaseLine: public JKQTPPlotObject {
|
||||
\param lineWidth lineWidth of drawing
|
||||
*/
|
||||
explicit JKQTPGeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style, JKQTPlotter* parent);
|
||||
/*! \brief class contructor
|
||||
|
||||
*/
|
||||
explicit JKQTPGeoBaseLine(JKQTBasePlotter* parent);
|
||||
/*! \brief class contructor
|
||||
|
||||
*/
|
||||
explicit JKQTPGeoBaseLine(JKQTPlotter* parent);
|
||||
|
||||
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual void setStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->style = __value;
|
||||
}
|
||||
/*! \copydoc style
|
||||
\see see style for details */
|
||||
inline virtual Qt::PenStyle getStyle() const
|
||||
{
|
||||
return this->style;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
|
||||
/** \brief sets the alpha-channel of the \a color (i.e. its transparency) */
|
||||
virtual void setAlpha(float alpha);
|
||||
/** \brief set line color */
|
||||
virtual void setColor(QColor c);
|
||||
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
protected:
|
||||
/** \brief color of the graph */
|
||||
QColor color;
|
||||
|
||||
/** \brief linestyle of the graph lines */
|
||||
Qt::PenStyle style;
|
||||
/** \brief width (pixels) of the graph */
|
||||
double lineWidth;
|
||||
/** \brief return a pen, that may be used for drawing */
|
||||
QPen getPen(JKQTPEnhancedPainter &painter);
|
||||
};
|
||||
|
||||
|
||||
@ -117,7 +84,7 @@ class JKQTP_LIB_EXPORT JKQTPGeoBaseLine: public JKQTPPlotObject {
|
||||
\ingroup jkqtplotter_geoplots
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPGeoBaseFilled: public JKQTPGeoBaseLine {
|
||||
class JKQTP_LIB_EXPORT JKQTPGeoBaseFilled: public JKQTPGeoBaseLine, public JKQTPGraphFillStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/*! \brief class contructor
|
||||
@ -160,46 +127,17 @@ class JKQTP_LIB_EXPORT JKQTPGeoBaseFilled: public JKQTPGeoBaseLine {
|
||||
*/
|
||||
JKQTPGeoBaseFilled(QColor color, QColor fillColor, JKQTPlotter* parent);
|
||||
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
|
||||
{
|
||||
this->fillStyle = __value;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual Qt::BrushStyle getFillStyle() const
|
||||
{
|
||||
return this->fillStyle;
|
||||
}
|
||||
|
||||
/** \brief sets the alpha-channel of the \a color and \a fillColor (i.e. its transparency) to the same value */
|
||||
virtual void setAlpha(float alpha) override;
|
||||
/** \brief sets the alpha-channel of the \a color and \a fillColor (i.e. its transparency) */
|
||||
virtual void setAlpha(float alphaLine, float alphaFill);
|
||||
/** \brief set line and fill color */
|
||||
virtual void setColor(QColor c) override;
|
||||
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
protected:
|
||||
|
||||
/** \brief filling color of the graph */
|
||||
QColor fillColor;
|
||||
/** \brief fill style for the curve */
|
||||
Qt::BrushStyle fillStyle;
|
||||
/** \brief return a brush that may be used for drawing */
|
||||
QBrush getBrush(JKQTPEnhancedPainter& painter);
|
||||
|
||||
};
|
||||
|
||||
@ -209,7 +147,7 @@ class JKQTP_LIB_EXPORT JKQTPGeoBaseFilled: public JKQTPGeoBaseLine {
|
||||
\ingroup jkqtplotter_geoplots
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject {
|
||||
class JKQTP_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject, public JKQTPGraphSymbolStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/*! \brief class contructor
|
||||
@ -235,118 +173,41 @@ class JKQTP_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject {
|
||||
*/
|
||||
JKQTPGeoSymbol(JKQTPlotter* parent, double x, double y, JKQTPGraphSymbols symbol=JKQTPCross, double symbolSize=10, QColor color=QColor("black"), QColor fillColor=QColor("grey"));
|
||||
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc symbol
|
||||
\see see symbol for details */
|
||||
inline virtual void setSymbol(const JKQTPGraphSymbols & __value)
|
||||
{
|
||||
this->symbol = __value;
|
||||
}
|
||||
/*! \copydoc symbol
|
||||
\see see symbol for details */
|
||||
inline virtual JKQTPGraphSymbols getSymbol() const
|
||||
{
|
||||
return this->symbol;
|
||||
}
|
||||
/*! \copydoc symbolSize
|
||||
\see see symbolSize for details */
|
||||
inline virtual void setSymbolSize(double __value)
|
||||
{
|
||||
this->symbolSize = __value;
|
||||
}
|
||||
/*! \copydoc symbolSize
|
||||
\see see symbolSize for details */
|
||||
inline virtual double getSymbolSize() const
|
||||
{
|
||||
return this->symbolSize;
|
||||
}
|
||||
/*! \copydoc symbolWidth
|
||||
\see see symbolWidth for details */
|
||||
inline virtual void setSymbolWidth(double __value)
|
||||
{
|
||||
this->symbolWidth = __value;
|
||||
}
|
||||
/*! \copydoc symbolWidth
|
||||
\see see symbolWidth for details */
|
||||
inline virtual double getSymbolWidth() const
|
||||
{
|
||||
return this->symbolWidth;
|
||||
}
|
||||
/*! set the symbol color and symbol fill color */
|
||||
virtual void setColor(QColor c);
|
||||
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual void setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
void setX(double __value);
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual double getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
double getX() const;
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual void setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
void setY(double __value);
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual double getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
double getY() const;
|
||||
|
||||
/** \copydoc JKQTPGraph::getXMinMax() */
|
||||
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
|
||||
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
|
||||
/** \copydoc JKQTPGraph::getYMinMax() */
|
||||
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
|
||||
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter);
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
protected:
|
||||
double x,y;
|
||||
/** \brief x-position (in plot coordinates) of the symbol (symbol center) */
|
||||
double x;
|
||||
/** \brief y-position (in plot coordinates) of the symbol (symbol center) */
|
||||
double y;
|
||||
|
||||
/** \brief color of the graph */
|
||||
QColor color;
|
||||
/** \brief fill-color of the graph */
|
||||
QColor fillColor;
|
||||
|
||||
/** \brief size of the symbol in pt */
|
||||
double symbolSize;
|
||||
/** \brief width of the symbol lines in pt */
|
||||
double symbolWidth;
|
||||
/** \brief type of the symbol */
|
||||
JKQTPGraphSymbols symbol;
|
||||
};
|
||||
|
||||
|
||||
@ -355,7 +216,7 @@ class JKQTP_LIB_EXPORT JKQTPGeoSymbol: public JKQTPPlotObject {
|
||||
\ingroup jkqtplotter_geoplots
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject {
|
||||
class JKQTP_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject, public JKQTPGraphTextStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/*! \brief class contructor
|
||||
@ -367,7 +228,7 @@ class JKQTP_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject {
|
||||
\param color color of drawing
|
||||
\param fontSize base font size of text
|
||||
*/
|
||||
JKQTPGeoText(JKQTBasePlotter* parent, double x, double y, const QString& text, double fontSize=10, QColor color=QColor("black"));
|
||||
JKQTPGeoText(JKQTBasePlotter* parent, double x, double y, const QString& text, double fontSize, QColor color);
|
||||
/*! \brief class contructor
|
||||
|
||||
\param parent parent plotter widget
|
||||
@ -377,80 +238,45 @@ class JKQTP_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject {
|
||||
\param color color of drawing
|
||||
\param fontSize base font size of text
|
||||
*/
|
||||
JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QString& text, double fontSize=10, QColor color=QColor("black"));
|
||||
JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QString& text, double fontSize, QColor color);
|
||||
/*! \brief class contructor
|
||||
|
||||
\param parent parent plotter widget
|
||||
\param x x-coordinate of text
|
||||
\param y y-coordinate of text
|
||||
\param text the text to display
|
||||
*/
|
||||
JKQTPGeoText(JKQTBasePlotter* parent, double x, double y, const QString& text);
|
||||
/*! \brief class contructor
|
||||
|
||||
\param parent parent plotter widget
|
||||
\param x x-coordinate of text
|
||||
\param y y-coordinate of text
|
||||
\param text the text to display
|
||||
*/
|
||||
JKQTPGeoText(JKQTPlotter* parent, double x, double y, const QString& text);
|
||||
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc text
|
||||
\see see text for details */
|
||||
inline virtual void setText(const QString & __value)
|
||||
{
|
||||
this->text = __value;
|
||||
}
|
||||
/*! \copydoc fontName
|
||||
\see see fontName for details */
|
||||
inline virtual void setFontName(const QString & __value)
|
||||
{
|
||||
this->fontName = __value;
|
||||
}
|
||||
void setText(const QString & __value);
|
||||
/*! \copydoc text
|
||||
\see see text for details */
|
||||
inline virtual QString getText() const
|
||||
{
|
||||
return this->text;
|
||||
}
|
||||
/*! \copydoc fontName
|
||||
\see see fontName for details */
|
||||
inline virtual QString getFontName() const
|
||||
{
|
||||
return this->fontName;
|
||||
}
|
||||
/*! \copydoc fontSize
|
||||
\see see fontSize for details */
|
||||
inline virtual void setFontSize(double __value)
|
||||
{
|
||||
this->fontSize = __value;
|
||||
}
|
||||
/*! \copydoc fontSize
|
||||
\see see fontSize for details */
|
||||
inline virtual double getFontSize() const
|
||||
{
|
||||
return this->fontSize;
|
||||
}
|
||||
QString getText() const;
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual void setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
void setX(double __value);
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual double getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
double getX() const;
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual void setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
void setY(double __value);
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual double getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
double getY() const;
|
||||
|
||||
/** \brief set line and fill color */
|
||||
virtual void setColor(QColor c) ;
|
||||
|
||||
/** \copydoc JKQTPPlotObject::getXMinMax() */
|
||||
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
|
||||
@ -463,18 +289,14 @@ class JKQTP_LIB_EXPORT JKQTPGeoText: public JKQTPPlotObject {
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
protected:
|
||||
double x,y;
|
||||
/** \brief x-position (in plot coordinates) of the text (left/baseline) */
|
||||
double x;
|
||||
/** \brief y-position (in plot coordinates) of the text (left/baseline) */
|
||||
double y;
|
||||
|
||||
/** \brief color of the graph */
|
||||
QColor color;
|
||||
|
||||
/** \brief base font size of text */
|
||||
double fontSize;
|
||||
/** \brief the text to display */
|
||||
QString fontName;
|
||||
/** \brief the text to display */
|
||||
QString text;
|
||||
/** \brief return a pen, that may be used for drawing */
|
||||
@ -501,7 +323,7 @@ class JKQTP_LIB_EXPORT JKQTPGeoLine: public JKQTPGeoBaseLine {
|
||||
\param lineWidth width of line
|
||||
\param style line style
|
||||
*/
|
||||
JKQTPGeoLine(JKQTBasePlotter* parent, double x1, double y1, double x2, double y2, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
|
||||
JKQTPGeoLine(JKQTBasePlotter* parent, double x1, double y1, double x2, double y2, QColor color, double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
|
||||
/*! \brief class constructor
|
||||
|
||||
\param parent the parent plotter class
|
||||
@ -513,7 +335,27 @@ class JKQTP_LIB_EXPORT JKQTPGeoLine: public JKQTPGeoBaseLine {
|
||||
\param lineWidth width of line
|
||||
\param style line style
|
||||
*/
|
||||
JKQTPGeoLine(JKQTPlotter* parent, double x1, double y1, double x2, double y2, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
|
||||
JKQTPGeoLine(JKQTPlotter* parent, double x1, double y1, double x2, double y2, QColor color, double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
|
||||
/*! \brief class constructor
|
||||
|
||||
\param parent the parent plotter class
|
||||
\param x1 x-coordinate of first point of line
|
||||
\param y1 y-coordinate of first point of line
|
||||
\param x2 x-coordinate of second point of line
|
||||
\param y2 y-coordinate of second point of line
|
||||
|
||||
*/
|
||||
JKQTPGeoLine(JKQTBasePlotter* parent, double x1, double y1, double x2, double y2);
|
||||
/*! \brief class constructor
|
||||
|
||||
\param parent the parent plotter class
|
||||
\param x1 x-coordinate of first point of line
|
||||
\param y1 y-coordinate of first point of line
|
||||
\param x2 x-coordinate of second point of line
|
||||
\param y2 y-coordinate of second point of line
|
||||
|
||||
*/
|
||||
JKQTPGeoLine(JKQTPlotter* parent, double x1, double y1, double x2, double y2);
|
||||
|
||||
|
||||
/** \copydoc JKQTPPlotObject::getXMinMax() */
|
||||
@ -526,54 +368,38 @@ class JKQTP_LIB_EXPORT JKQTPGeoLine: public JKQTPGeoBaseLine {
|
||||
|
||||
/*! \copydoc x1
|
||||
\see see x1 for details */
|
||||
inline virtual void setX1(double __value)
|
||||
{
|
||||
this->x1 = __value;
|
||||
}
|
||||
void setX1(double __value);
|
||||
/*! \copydoc x1
|
||||
\see see x1 for details */
|
||||
inline virtual double getX1() const
|
||||
{
|
||||
return this->x1;
|
||||
}
|
||||
double getX1() const;
|
||||
/*! \copydoc y1
|
||||
\see see y1 for details */
|
||||
inline virtual void setY1(double __value)
|
||||
{
|
||||
this->y1 = __value;
|
||||
}
|
||||
void setY1(double __value);
|
||||
/*! \copydoc y1
|
||||
\see see y1 for details */
|
||||
inline virtual double getY1() const
|
||||
{
|
||||
return this->y1;
|
||||
}
|
||||
double getY1() const;
|
||||
/*! \copydoc x2
|
||||
\see see x2 for details */
|
||||
inline virtual void setX2(double __value)
|
||||
{
|
||||
this->x2 = __value;
|
||||
}
|
||||
void setX2(double __value);
|
||||
/*! \copydoc x2
|
||||
\see see x2 for details */
|
||||
inline virtual double getX2() const
|
||||
{
|
||||
return this->x2;
|
||||
}
|
||||
double getX2() const;
|
||||
/*! \copydoc y2
|
||||
\see see y2 for details */
|
||||
inline virtual void setY2(double __value)
|
||||
{
|
||||
this->y2 = __value;
|
||||
}
|
||||
void setY2(double __value);
|
||||
/*! \copydoc y2
|
||||
\see see y2 for details */
|
||||
inline virtual double getY2() const
|
||||
{
|
||||
return this->y2;
|
||||
}
|
||||
double getY2() const;
|
||||
protected:
|
||||
double x1, y1, x2, y2;
|
||||
/** \brief x-coordinate of first point of line */
|
||||
double x1;
|
||||
/** \brief y-coordinate of first point of line */
|
||||
double y1;
|
||||
/** \brief x-coordinate of second point of line */
|
||||
double x2;
|
||||
/** \brief y-coordinate of second point of line */
|
||||
double y2;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -626,66 +452,43 @@ class JKQTP_LIB_EXPORT JKQTPGeoInfiniteLine: public JKQTPGeoBaseLine {
|
||||
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual void setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
void setX(double __value);
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual double getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
double getX() const;
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual void setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
void setY(double __value);
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual double getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
double getY() const;
|
||||
/*! \copydoc dx
|
||||
\see see dx for details */
|
||||
inline virtual void setDx(double __value)
|
||||
{
|
||||
this->dx = __value;
|
||||
}
|
||||
void setDx(double __value);
|
||||
/*! \copydoc dx
|
||||
\see see dx for details */
|
||||
inline virtual double getDx() const
|
||||
{
|
||||
return this->dx;
|
||||
}
|
||||
double getDx() const;
|
||||
/*! \copydoc dy
|
||||
\see see dy for details */
|
||||
inline virtual void setDy(double __value)
|
||||
{
|
||||
this->dy = __value;
|
||||
}
|
||||
void setDy(double __value);
|
||||
/*! \copydoc dy
|
||||
\see see dy for details */
|
||||
inline virtual double getDy() const
|
||||
{
|
||||
return this->dy;
|
||||
}
|
||||
double getDy() const;
|
||||
/*! \copydoc two_sided
|
||||
\see see two_sided for details */
|
||||
inline virtual void setTwoSided(bool __value)
|
||||
{
|
||||
this->two_sided = __value;
|
||||
}
|
||||
void setTwoSided(bool __value);
|
||||
/*! \copydoc two_sided
|
||||
\see see two_sided for details */
|
||||
inline virtual bool getTwoSided() const
|
||||
{
|
||||
return this->two_sided;
|
||||
}
|
||||
bool getTwoSided() const;
|
||||
protected:
|
||||
double x, y, dx, dy;
|
||||
/** \brief x-coordinate of a point on the line */
|
||||
double x;
|
||||
/** \brief y-coordinate of a point on the line */
|
||||
double y;
|
||||
/** \brief x-component of the slope of the line */
|
||||
double dx;
|
||||
/** \brief y-component of the slope of the line */
|
||||
double dy;
|
||||
/** \brief indicates whether the line ends at the given point \f$ (x,y) \f$ (false, default),
|
||||
* or is infinite in both directions (true) */
|
||||
bool two_sided;
|
||||
@ -749,27 +552,18 @@ class JKQTP_LIB_EXPORT JKQTPGeoPolyLines: public JKQTPGeoBaseLine {
|
||||
|
||||
/*! \copydoc points
|
||||
\see see points for details */
|
||||
inline virtual void setPoints(const QVector<QPointF> & __value)
|
||||
{
|
||||
this->points = __value;
|
||||
}
|
||||
void setPoints(const QVector<QPointF> & __value);
|
||||
/*! \copydoc points
|
||||
\see see points for details */
|
||||
inline virtual QVector<QPointF> getPoints() const
|
||||
{
|
||||
return this->points;
|
||||
}
|
||||
QVector<QPointF> getPoints() const;
|
||||
|
||||
/** \brief append a point to the polygon */
|
||||
inline void appendPoint(const QPointF& p) {
|
||||
points.append(p);
|
||||
}
|
||||
void appendPoint(const QPointF& p);
|
||||
|
||||
/** \brief append a point to the polygon */
|
||||
inline void appendPoint(const double x, const double y) {
|
||||
points.append(QPointF(x, y));
|
||||
}
|
||||
void appendPoint(const double x, const double y);
|
||||
protected:
|
||||
/** \brief list with all points on the poly-line */
|
||||
QVector<QPointF> points;
|
||||
};
|
||||
|
||||
@ -876,69 +670,46 @@ class JKQTP_LIB_EXPORT JKQTPGeoRectangle: public JKQTPGeoBaseFilled {
|
||||
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual void setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
void setX(double __value);
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual double getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
double getX() const;
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual void setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
void setY(double __value);
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual double getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
double getY() const;
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual void setWidth(double __value)
|
||||
{
|
||||
this->width = __value;
|
||||
}
|
||||
void setWidth(double __value);
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual double getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
double getWidth() const;
|
||||
/*! \copydoc height
|
||||
\see see height for details */
|
||||
inline virtual void setHeight(double __value)
|
||||
{
|
||||
this->height = __value;
|
||||
}
|
||||
void setHeight(double __value);
|
||||
/*! \copydoc height
|
||||
\see see height for details */
|
||||
inline virtual double getHeight() const
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
double getHeight() const;
|
||||
/*! \copydoc angle
|
||||
\see see angle for details */
|
||||
inline virtual void setAngle(double __value)
|
||||
{
|
||||
this->angle = __value;
|
||||
}
|
||||
void setAngle(double __value);
|
||||
/*! \copydoc angle
|
||||
\see see angle for details */
|
||||
inline virtual double getAngle() const
|
||||
{
|
||||
return this->angle;
|
||||
}
|
||||
|
||||
double getAngle() const;
|
||||
/** \brief set the rectangle using the bottom-left corner, as well as its width and height */
|
||||
void setBottomleftrectangle(double x, double y, double width, double height);
|
||||
protected:
|
||||
double x,y,width,height;
|
||||
/** \brief rotation angle of rectangle */
|
||||
/** \brief x-coordinate of a center of the rectangle */
|
||||
double x;
|
||||
/** \brief y-coordinate of a center of the rectangle */
|
||||
double y;
|
||||
/** \brief width of a center of the rectangle */
|
||||
double width;
|
||||
/** \brief height of a center of the rectangle */
|
||||
double height;
|
||||
/** \brief rotation angle of rectangle [degrees] around (x,y) */
|
||||
double angle;
|
||||
/** \brief returns the transformation matrix used for this rectangle */
|
||||
QMatrix getMatrix();
|
||||
@ -1013,28 +784,19 @@ class JKQTP_LIB_EXPORT JKQTPGeoPolygon: public JKQTPGeoBaseFilled {
|
||||
|
||||
/*! \copydoc points
|
||||
\see see points for details */
|
||||
inline virtual void setPoints(const QVector<QPointF> & __value)
|
||||
{
|
||||
this->points = __value;
|
||||
}
|
||||
void setPoints(const QVector<QPointF> & __value);
|
||||
/*! \copydoc points
|
||||
\see see points for details */
|
||||
inline virtual QVector<QPointF> getPoints() const
|
||||
{
|
||||
return this->points;
|
||||
}
|
||||
QVector<QPointF> getPoints() const;
|
||||
|
||||
/** \brief append a point to the polygon */
|
||||
inline void appendPoint(const QPointF& p) {
|
||||
points.append(p);
|
||||
}
|
||||
void appendPoint(const QPointF& p);
|
||||
|
||||
/** \brief append a point to the polygon */
|
||||
inline void appendPoint(const double x, const double y) {
|
||||
points.append(QPointF(x, y));
|
||||
}
|
||||
void appendPoint(const double x, const double y);
|
||||
|
||||
protected:
|
||||
/** \brief list with all points on the polygon */
|
||||
QVector<QPointF> points;
|
||||
};
|
||||
|
||||
@ -1139,16 +901,10 @@ class JKQTP_LIB_EXPORT JKQTPGeoEllipse: public JKQTPGeoRectangle {
|
||||
|
||||
/*! \copydoc controlPoints
|
||||
\see see controlPoints for details */
|
||||
inline virtual void setControlPoints(const unsigned int & __value)
|
||||
{
|
||||
this->controlPoints = __value;
|
||||
}
|
||||
void setControlPoints(const unsigned int & __value);
|
||||
/*! \copydoc controlPoints
|
||||
\see see controlPoints for details */
|
||||
inline virtual unsigned int getControlPoints() const
|
||||
{
|
||||
return this->controlPoints;
|
||||
}
|
||||
unsigned int getControlPoints() const;
|
||||
protected:
|
||||
/** \brief number of steps/control points to draw the ellipse */
|
||||
unsigned int controlPoints;
|
||||
@ -1200,120 +956,77 @@ class JKQTP_LIB_EXPORT JKQTPGeoArc: public JKQTPGeoBaseLine {
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
|
||||
/*! \copydoc controlPoints
|
||||
\see see controlPoints for details */
|
||||
inline virtual void setControlPoints(const unsigned int & __value)
|
||||
{
|
||||
this->controlPoints = __value;
|
||||
}
|
||||
\see see controlPoints for details */
|
||||
void setControlPoints(const unsigned int & __value);
|
||||
/*! \copydoc controlPoints
|
||||
\see see controlPoints for details */
|
||||
inline virtual unsigned int getControlPoints() const
|
||||
{
|
||||
return this->controlPoints;
|
||||
}
|
||||
\see see controlPoints for details */
|
||||
unsigned int getControlPoints() const;
|
||||
/*! \copydoc angleStart
|
||||
\see see angleStart for details */
|
||||
inline virtual void setAngleStart(double __value)
|
||||
{
|
||||
this->angleStart = __value;
|
||||
}
|
||||
void setAngleStart(double __value);
|
||||
/*! \copydoc angleStart
|
||||
\see see angleStart for details */
|
||||
inline virtual double getAngleStart() const
|
||||
{
|
||||
return this->angleStart;
|
||||
}
|
||||
double getAngleStart() const;
|
||||
/*! \copydoc angleStop
|
||||
\see see angleStop for details */
|
||||
inline virtual void setAngleStop(double __value)
|
||||
{
|
||||
this->angleStop = __value;
|
||||
}
|
||||
void setAngleStop(double __value);
|
||||
/*! \copydoc angleStop
|
||||
\see see angleStop for details */
|
||||
inline virtual double getAngleStop() const
|
||||
{
|
||||
return this->angleStop;
|
||||
}
|
||||
double getAngleStop() const;
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual void setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
\see see x for details */
|
||||
void setX(double __value);
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual double getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
\see see x for details */
|
||||
double getX() const;
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual void setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
\see see y for details */
|
||||
void setY(double __value);
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual double getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
\see see y for details */
|
||||
double getY() const;
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual void setWidth(double __value)
|
||||
{
|
||||
this->width = __value;
|
||||
}
|
||||
\see see width for details */
|
||||
void setWidth(double __value);
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual double getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
\see see width for details */
|
||||
double getWidth() const;
|
||||
/*! \copydoc height
|
||||
\see see height for details */
|
||||
inline virtual void setHeight(double __value)
|
||||
{
|
||||
this->height = __value;
|
||||
}
|
||||
\see see height for details */
|
||||
void setHeight(double __value);
|
||||
/*! \copydoc height
|
||||
\see see height for details */
|
||||
inline virtual double getHeight() const
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
\see see height for details */
|
||||
double getHeight() const;
|
||||
/*! \copydoc angle
|
||||
\see see angle for details */
|
||||
inline virtual void setAngle(double __value)
|
||||
{
|
||||
this->angle = __value;
|
||||
}
|
||||
\see see angle for details */
|
||||
void setAngle(double __value);
|
||||
/*! \copydoc angle
|
||||
\see see angle for details */
|
||||
inline virtual double getAngle() const
|
||||
{
|
||||
return this->angle;
|
||||
}
|
||||
\see see angle for details */
|
||||
double getAngle() const;
|
||||
protected:
|
||||
double x,y,width,height;
|
||||
/** \brief rotation angle of rectangle */
|
||||
/** \brief x-coordinate of a center of the rectangle */
|
||||
double x;
|
||||
/** \brief y-coordinate of a center of the rectangle */
|
||||
double y;
|
||||
/** \brief width of a center of the rectangle */
|
||||
double width;
|
||||
/** \brief height of a center of the rectangle */
|
||||
double height;
|
||||
/** \brief rotation angle of rectangle [degrees] around (x,y) */
|
||||
double angle;
|
||||
/** \brief if we only draw an arc, this is the starting angle in degrees */
|
||||
double angleStart;
|
||||
/** \brief if we only draw an arc, this is the ending angle in degrees */
|
||||
double angleStop;
|
||||
/** \brief closing mode for arcs: secand or pie */
|
||||
double angle_start;
|
||||
/** \brief if we only draw an arc, this is the ending angle */
|
||||
double angle_end;
|
||||
/** \brief number of steps/control points to draw the ellipse */
|
||||
unsigned int controlPoints;
|
||||
|
||||
/** \brief closing mode for arcs: secand or pie */
|
||||
/** \brief returns the transformation matrix used for this rectangle */
|
||||
QMatrix getMatrix();
|
||||
/** \brief returns a QPolygonF which represents the rectangle after rotation, but still in the world coordinate system, not in the screen/widget system */
|
||||
QPolygonF getPolygon();
|
||||
/** \brief number of steps/control points to draw the ellipse */
|
||||
unsigned int controlPoints;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -1368,28 +1081,16 @@ class JKQTP_LIB_EXPORT JKQTPGeoPie: public JKQTPGeoEllipse {
|
||||
|
||||
/*! \copydoc angleStart
|
||||
\see see angleStart for details */
|
||||
inline virtual void setAngleStart(double __value)
|
||||
{
|
||||
this->angleStart = __value;
|
||||
}
|
||||
void setAngleStart(double __value);
|
||||
/*! \copydoc angleStart
|
||||
\see see angleStart for details */
|
||||
inline virtual double getAngleStart() const
|
||||
{
|
||||
return this->angleStart;
|
||||
}
|
||||
double getAngleStart() const;
|
||||
/*! \copydoc angleStop
|
||||
\see see angleStop for details */
|
||||
inline virtual void setAngleStop(double __value)
|
||||
{
|
||||
this->angleStop = __value;
|
||||
}
|
||||
void setAngleStop(double __value);
|
||||
/*! \copydoc angleStop
|
||||
\see see angleStop for details */
|
||||
inline virtual double getAngleStop() const
|
||||
{
|
||||
return this->angleStop;
|
||||
}
|
||||
double getAngleStop() const;
|
||||
protected:
|
||||
/** \brief if we only draw an arc, this is the starting angle */
|
||||
double angleStart;
|
||||
|
@ -92,10 +92,50 @@ bool JKQTPImageBase::getYMinMax(double& miny, double& maxy, double& smallestGrea
|
||||
return true;
|
||||
}
|
||||
|
||||
QColor JKQTPImageBase::getKeyLabelColor() {
|
||||
QColor JKQTPImageBase::getKeyLabelColor() const {
|
||||
return QColor("black");
|
||||
}
|
||||
|
||||
void JKQTPImageBase::setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
|
||||
double JKQTPImageBase::getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
|
||||
void JKQTPImageBase::setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
|
||||
double JKQTPImageBase::getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
|
||||
void JKQTPImageBase::setWidth(double __value)
|
||||
{
|
||||
this->width = __value;
|
||||
}
|
||||
|
||||
double JKQTPImageBase::getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
|
||||
void JKQTPImageBase::setHeight(double __value)
|
||||
{
|
||||
this->height = __value;
|
||||
}
|
||||
|
||||
double JKQTPImageBase::getHeight() const
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
|
||||
void JKQTPImageBase::plotImage(JKQTPEnhancedPainter& painter, QImage& image, double x, double y, double width, double height) {
|
||||
if ((!JKQTPIsOKFloat(x))||(!JKQTPIsOKFloat(y))||(!JKQTPIsOKFloat(width))||(!JKQTPIsOKFloat(height))||(width==0) || (height==0) || image.isNull() || (image.width()<=0) || (image.height()<=0)) {
|
||||
return;
|
||||
@ -375,6 +415,76 @@ void JKQTPMathImageBase::drawKeyMarker(JKQTPEnhancedPainter &/*painter*/, QRectF
|
||||
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setNx(int __value)
|
||||
{
|
||||
this->Nx = __value;
|
||||
}
|
||||
|
||||
int JKQTPMathImageBase::getNx() const
|
||||
{
|
||||
return this->Nx;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setNy(int __value)
|
||||
{
|
||||
this->Ny = __value;
|
||||
}
|
||||
|
||||
int JKQTPMathImageBase::getNy() const
|
||||
{
|
||||
return this->Ny;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setData(void *__value)
|
||||
{
|
||||
this->data = __value;
|
||||
}
|
||||
|
||||
void *JKQTPMathImageBase::getData() const
|
||||
{
|
||||
return this->data;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setDatatype(JKQTPMathImageBase::DataType __value)
|
||||
{
|
||||
this->datatype = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::DataType JKQTPMathImageBase::getDatatype() const
|
||||
{
|
||||
return this->datatype;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setDataModifier(void *__value)
|
||||
{
|
||||
this->dataModifier = __value;
|
||||
}
|
||||
|
||||
void *JKQTPMathImageBase::getDataModifier() const
|
||||
{
|
||||
return this->dataModifier;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setDatatypeModifier(JKQTPMathImageBase::DataType __value)
|
||||
{
|
||||
this->datatypeModifier = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::DataType JKQTPMathImageBase::getDatatypeModifier() const
|
||||
{
|
||||
return this->datatypeModifier;
|
||||
}
|
||||
|
||||
void JKQTPMathImageBase::setModifierMode(const JKQTPMathImageBase::ModifierMode &__value)
|
||||
{
|
||||
this->modifierMode = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::ModifierMode JKQTPMathImageBase::getModifierMode() const
|
||||
{
|
||||
return this->modifierMode;
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::ModifierMode JKQTPMathImageBase::StringToModifierMode(const QString &mode) {
|
||||
QString m=mode.toLower();
|
||||
if (m=="value" ) return ModifyValue;
|
||||
@ -1260,6 +1370,259 @@ QImage JKQTPMathImage::getPaletteKeyImage(JKQTPMathImageColorPalette palette, in
|
||||
return getPaletteKeyImage(static_cast<int>(palette), width, height);
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setPalette(const JKQTPMathImageColorPalette &__value)
|
||||
{
|
||||
this->palette = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageColorPalette JKQTPMathImage::getPalette() const
|
||||
{
|
||||
return this->palette;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setRangeMinFailAction(const JKQTPMathImageColorRangeFailAction &__value)
|
||||
{
|
||||
this->rangeMinFailAction = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageColorRangeFailAction JKQTPMathImage::getActionRangeMinFail() const
|
||||
{
|
||||
return this->rangeMinFailAction;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setRangeMaxFailAction(const JKQTPMathImageColorRangeFailAction &__value)
|
||||
{
|
||||
this->rangeMaxFailAction = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageColorRangeFailAction JKQTPMathImage::getActionRangeMaxFail() const
|
||||
{
|
||||
return this->rangeMaxFailAction;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setRangeMinFailColor(const QColor &__value)
|
||||
{
|
||||
this->rangeMinFailColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPMathImage::getRangeMinFailColor() const
|
||||
{
|
||||
return this->rangeMinFailColor;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setRangeMaxFailColor(const QColor &__value)
|
||||
{
|
||||
this->rangeMaxFailColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPMathImage::getRangeMaxFailColor() const
|
||||
{
|
||||
return this->rangeMaxFailColor;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setNanColor(const QColor &__value)
|
||||
{
|
||||
this->nanColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPMathImage::getNanColor() const
|
||||
{
|
||||
return this->nanColor;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setInfColor(const QColor &__value)
|
||||
{
|
||||
this->infColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPMathImage::getInfColor() const
|
||||
{
|
||||
return this->infColor;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setShowColorBar(bool __value)
|
||||
{
|
||||
this->showColorBar = __value;
|
||||
}
|
||||
|
||||
bool JKQTPMathImage::getShowColorBar() const
|
||||
{
|
||||
return this->showColorBar;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setColorBarWidth(double __value)
|
||||
{
|
||||
this->colorBarWidth = __value;
|
||||
}
|
||||
|
||||
double JKQTPMathImage::getColorBarWidth() const
|
||||
{
|
||||
return this->colorBarWidth;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setColorBarModifiedWidth(double __value)
|
||||
{
|
||||
this->colorBarModifiedWidth = __value;
|
||||
}
|
||||
|
||||
double JKQTPMathImage::getColorBarModifiedWidth() const
|
||||
{
|
||||
return this->colorBarModifiedWidth;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setColorBarOffset(double __value)
|
||||
{
|
||||
this->colorBarOffset = __value;
|
||||
}
|
||||
|
||||
double JKQTPMathImage::getColorBarOffset() const
|
||||
{
|
||||
return this->colorBarOffset;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setColorBarRelativeHeight(double __value)
|
||||
{
|
||||
this->colorBarRelativeHeight = __value;
|
||||
}
|
||||
|
||||
double JKQTPMathImage::getColorBarRelativeHeight() const
|
||||
{
|
||||
return this->colorBarRelativeHeight;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setImageMin(double __value)
|
||||
{
|
||||
this->imageMin = __value;
|
||||
}
|
||||
|
||||
double JKQTPMathImage::getImageMin() const
|
||||
{
|
||||
return this->imageMin;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setImageMax(double __value)
|
||||
{
|
||||
this->imageMax = __value;
|
||||
}
|
||||
|
||||
double JKQTPMathImage::getImageMax() const
|
||||
{
|
||||
return this->imageMax;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setAutoImageRange(bool __value)
|
||||
{
|
||||
this->autoImageRange = __value;
|
||||
}
|
||||
|
||||
bool JKQTPMathImage::getAutoImageRange() const
|
||||
{
|
||||
return this->autoImageRange;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setImageName(const QString &__value)
|
||||
{
|
||||
this->imageName = __value;
|
||||
}
|
||||
|
||||
QString JKQTPMathImage::getImageName() const
|
||||
{
|
||||
return this->imageName;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setImageNameFontSize(double __value)
|
||||
{
|
||||
this->imageNameFontSize = __value;
|
||||
}
|
||||
|
||||
double JKQTPMathImage::getImageNameFontSize() const
|
||||
{
|
||||
return this->imageNameFontSize;
|
||||
}
|
||||
|
||||
JKQTPVerticalIndependentAxis *JKQTPMathImage::getColorBarRightAxis() {
|
||||
return this->colorBarRightAxis;
|
||||
}
|
||||
|
||||
JKQTPHorizontalIndependentAxis *JKQTPMathImage::getColorBarTopAxis() {
|
||||
return this->colorBarTopAxis;
|
||||
}
|
||||
|
||||
JKQTPVerticalIndependentAxis *JKQTPMathImage::getModifierColorBarTopAxis() {
|
||||
return this->modifierColorBarTopAxis;
|
||||
}
|
||||
|
||||
JKQTPHorizontalIndependentAxis *JKQTPMathImage::getModifierColorBarRightAxis() {
|
||||
return this->modifierColorBarRightAxis ;
|
||||
}
|
||||
|
||||
const JKQTPVerticalIndependentAxis *JKQTPMathImage::getColorBarRightAxis() const {
|
||||
return this->colorBarRightAxis;
|
||||
|
||||
}
|
||||
|
||||
const JKQTPHorizontalIndependentAxis *JKQTPMathImage::getColorBarTopAxis() const {
|
||||
return this->colorBarTopAxis;
|
||||
}
|
||||
|
||||
const JKQTPVerticalIndependentAxis *JKQTPMathImage::getModifierColorBarTopAxis() const {
|
||||
return this->modifierColorBarTopAxis;
|
||||
}
|
||||
|
||||
const JKQTPHorizontalIndependentAxis *JKQTPMathImage::getModifierColorBarRightAxis() const {
|
||||
return this->modifierColorBarRightAxis ;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setColorBarTopVisible(bool __value)
|
||||
{
|
||||
this->colorBarTopVisible = __value;
|
||||
}
|
||||
|
||||
bool JKQTPMathImage::getColorBarTopVisible() const
|
||||
{
|
||||
return this->colorBarTopVisible;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setColorBarRightVisible(bool __value)
|
||||
{
|
||||
this->colorBarRightVisible = __value;
|
||||
}
|
||||
|
||||
bool JKQTPMathImage::getColorBarRightVisible() const
|
||||
{
|
||||
return this->colorBarRightVisible;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setAutoModifierRange(bool __value)
|
||||
{
|
||||
this->autoModifierRange = __value;
|
||||
}
|
||||
|
||||
bool JKQTPMathImage::getAutoModifierRange() const
|
||||
{
|
||||
return this->autoModifierRange;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setModifierMin(double __value)
|
||||
{
|
||||
this->modifierMin = __value;
|
||||
}
|
||||
|
||||
double JKQTPMathImage::getModifierMin() const
|
||||
{
|
||||
return this->modifierMin;
|
||||
}
|
||||
|
||||
void JKQTPMathImage::setModifierMax(double __value)
|
||||
{
|
||||
this->modifierMax = __value;
|
||||
}
|
||||
|
||||
double JKQTPMathImage::getModifierMax() const
|
||||
{
|
||||
return this->modifierMax;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QImage JKQTPMathImage::drawImage() {
|
||||
@ -1360,6 +1723,26 @@ JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, dou
|
||||
this->imageColumn=imageColumn;
|
||||
this->datatype=JKQTPMathImageBase::DoubleArray;
|
||||
}
|
||||
|
||||
void JKQTPColumnMathImage::setImageColumn(int __value)
|
||||
{
|
||||
this->imageColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPColumnMathImage::getImageColumn() const
|
||||
{
|
||||
return this->imageColumn;
|
||||
}
|
||||
|
||||
void JKQTPColumnMathImage::setModifierColumn(int __value)
|
||||
{
|
||||
this->modifierColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPColumnMathImage::getModifierColumn() const
|
||||
{
|
||||
return this->modifierColumn;
|
||||
}
|
||||
bool JKQTPColumnMathImage::usesColumn(int c) const
|
||||
{
|
||||
return (c==imageColumn)||(c==modifierColumn);
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplotter/jkqtpbaseelements.h"
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
@ -62,56 +62,32 @@ class JKQTP_LIB_EXPORT JKQTPImageBase: public JKQTPGraph {
|
||||
*/
|
||||
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual void setX(double __value)
|
||||
{
|
||||
this->x = __value;
|
||||
}
|
||||
void setX(double __value);
|
||||
/*! \copydoc x
|
||||
\see see x for details */
|
||||
inline virtual double getX() const
|
||||
{
|
||||
return this->x;
|
||||
}
|
||||
double getX() const;
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual void setY(double __value)
|
||||
{
|
||||
this->y = __value;
|
||||
}
|
||||
void setY(double __value);
|
||||
/*! \copydoc y
|
||||
\see see y for details */
|
||||
inline virtual double getY() const
|
||||
{
|
||||
return this->y;
|
||||
}
|
||||
double getY() const;
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual void setWidth(double __value)
|
||||
{
|
||||
this->width = __value;
|
||||
}
|
||||
void setWidth(double __value);
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual double getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
double getWidth() const;
|
||||
/*! \copydoc height
|
||||
\see see height for details */
|
||||
inline virtual void setHeight(double __value)
|
||||
{
|
||||
this->height = __value;
|
||||
}
|
||||
void setHeight(double __value);
|
||||
/*! \copydoc height
|
||||
\see see height for details */
|
||||
inline virtual double getHeight() const
|
||||
{
|
||||
return this->height;
|
||||
}
|
||||
double getHeight() const;
|
||||
|
||||
protected:
|
||||
|
||||
@ -192,88 +168,46 @@ class JKQTP_LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
|
||||
|
||||
/*! \copydoc Nx
|
||||
\see see Nx for details */
|
||||
inline virtual void setNx(int __value)
|
||||
{
|
||||
this->Nx = __value;
|
||||
}
|
||||
void setNx(int __value);
|
||||
/*! \copydoc Nx
|
||||
\see see Nx for details */
|
||||
inline virtual int getNx() const
|
||||
{
|
||||
return this->Nx;
|
||||
}
|
||||
int getNx() const;
|
||||
/*! \copydoc Ny
|
||||
\see see Ny for details */
|
||||
inline virtual void setNy(int __value)
|
||||
{
|
||||
this->Ny = __value;
|
||||
}
|
||||
void setNy(int __value);
|
||||
/*! \copydoc Ny
|
||||
\see see Ny for details */
|
||||
inline virtual int getNy() const
|
||||
{
|
||||
return this->Ny;
|
||||
}
|
||||
int getNy() const;
|
||||
/*! \copydoc data
|
||||
\see see data for details */
|
||||
inline virtual void setData(void* __value)
|
||||
{
|
||||
this->data = __value;
|
||||
}
|
||||
virtual void setData(void* __value);
|
||||
/*! \copydoc data
|
||||
\see see data for details */
|
||||
inline virtual void* getData() const
|
||||
{
|
||||
return this->data;
|
||||
}
|
||||
virtual void *getData() const;
|
||||
/*! \copydoc datatype
|
||||
\see see datatype for details */
|
||||
inline virtual void setDatatype(const DataType & __value)
|
||||
{
|
||||
this->datatype = __value;
|
||||
}
|
||||
virtual void setDatatype(DataType __value);
|
||||
/*! \copydoc datatype
|
||||
\see see datatype for details */
|
||||
inline virtual DataType getDatatype() const
|
||||
{
|
||||
return this->datatype;
|
||||
}
|
||||
virtual DataType getDatatype() const;
|
||||
/*! \copydoc dataModifier
|
||||
\see see dataModifier for details */
|
||||
inline virtual void setDataModifier(void* __value)
|
||||
{
|
||||
this->dataModifier = __value;
|
||||
}
|
||||
virtual void setDataModifier(void* __value);
|
||||
/*! \copydoc dataModifier
|
||||
\see see dataModifier for details */
|
||||
inline virtual void* getDataModifier() const
|
||||
{
|
||||
return this->dataModifier;
|
||||
}
|
||||
virtual void *getDataModifier() const;
|
||||
/*! \copydoc datatypeModifier
|
||||
\see see datatypeModifier for details */
|
||||
inline virtual void setDatatypeModifier(const DataType & __value)
|
||||
{
|
||||
this->datatypeModifier = __value;
|
||||
}
|
||||
virtual void setDatatypeModifier(DataType __value);
|
||||
/*! \copydoc datatypeModifier
|
||||
\see see datatypeModifier for details */
|
||||
inline virtual DataType getDatatypeModifier() const
|
||||
{
|
||||
return this->datatypeModifier;
|
||||
}
|
||||
virtual DataType getDatatypeModifier() const;
|
||||
/*! \copydoc modifierMode
|
||||
\see see modifierMode for details */
|
||||
inline virtual void setModifierMode(const ModifierMode & __value)
|
||||
{
|
||||
this->modifierMode = __value;
|
||||
}
|
||||
void setModifierMode(const ModifierMode & __value);
|
||||
/*! \copydoc modifierMode
|
||||
\see see modifierMode for details */
|
||||
inline virtual ModifierMode getModifierMode() const
|
||||
{
|
||||
return this->modifierMode;
|
||||
}
|
||||
ModifierMode getModifierMode() const;
|
||||
|
||||
virtual void setDataModifier(void* data, DataType datatype);
|
||||
virtual void setData(void* data, int Nx, int Ny, DataType datatype);
|
||||
@ -428,284 +362,152 @@ class JKQTP_LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
|
||||
|
||||
/*! \copydoc palette
|
||||
\see see palette for details */
|
||||
inline virtual void setPalette(const JKQTPMathImageColorPalette & __value)
|
||||
{
|
||||
this->palette = __value;
|
||||
}
|
||||
void setPalette(const JKQTPMathImageColorPalette & __value);
|
||||
/*! \copydoc palette
|
||||
\see see palette for details */
|
||||
inline virtual JKQTPMathImageColorPalette getPalette() const
|
||||
{
|
||||
return this->palette;
|
||||
}
|
||||
JKQTPMathImageColorPalette getPalette() const;
|
||||
/*! \copydoc rangeMinFailAction
|
||||
\see see rangeMinFailAction for details */
|
||||
inline virtual void setRangeMinFailAction(const JKQTPMathImageColorRangeFailAction & __value)
|
||||
{
|
||||
this->rangeMinFailAction = __value;
|
||||
}
|
||||
void setRangeMinFailAction(const JKQTPMathImageColorRangeFailAction & __value);
|
||||
/*! \copydoc rangeMinFailAction
|
||||
\see see rangeMinFailAction for details */
|
||||
inline virtual JKQTPMathImageColorRangeFailAction getActionRangeMinFail() const
|
||||
{
|
||||
return this->rangeMinFailAction;
|
||||
}
|
||||
JKQTPMathImageColorRangeFailAction getActionRangeMinFail() const;
|
||||
/*! \copydoc rangeMaxFailAction
|
||||
\see see rangeMaxFailAction for details */
|
||||
inline virtual void setRangeMaxFailAction(const JKQTPMathImageColorRangeFailAction & __value)
|
||||
{
|
||||
this->rangeMaxFailAction = __value;
|
||||
}
|
||||
void setRangeMaxFailAction(const JKQTPMathImageColorRangeFailAction & __value);
|
||||
/*! \copydoc rangeMaxFailAction
|
||||
\see see rangeMaxFailAction for details */
|
||||
inline virtual JKQTPMathImageColorRangeFailAction getActionRangeMaxFail() const
|
||||
{
|
||||
return this->rangeMaxFailAction;
|
||||
}
|
||||
JKQTPMathImageColorRangeFailAction getActionRangeMaxFail() const;
|
||||
/*! \copydoc rangeMinFailColor
|
||||
\see see rangeMinFailColor for details */
|
||||
inline virtual void setRangeMinFailColor(const QColor & __value)
|
||||
{
|
||||
this->rangeMinFailColor = __value;
|
||||
}
|
||||
void setRangeMinFailColor(const QColor & __value);
|
||||
/*! \copydoc rangeMinFailColor
|
||||
\see see rangeMinFailColor for details */
|
||||
inline virtual QColor getRangeMinFailColor() const
|
||||
{
|
||||
return this->rangeMinFailColor;
|
||||
}
|
||||
QColor getRangeMinFailColor() const;
|
||||
/*! \copydoc rangeMaxFailColor
|
||||
\see see rangeMaxFailColor for details */
|
||||
inline virtual void setRangeMaxFailColor(const QColor & __value)
|
||||
{
|
||||
this->rangeMaxFailColor = __value;
|
||||
}
|
||||
void setRangeMaxFailColor(const QColor & __value);
|
||||
/*! \copydoc rangeMaxFailColor
|
||||
\see see rangeMaxFailColor for details */
|
||||
inline virtual QColor getRangeMaxFailColor() const
|
||||
{
|
||||
return this->rangeMaxFailColor;
|
||||
}
|
||||
QColor getRangeMaxFailColor() const;
|
||||
/*! \copydoc nanColor
|
||||
\see see nanColor for details */
|
||||
inline virtual void setNanColor(const QColor & __value)
|
||||
{
|
||||
this->nanColor = __value;
|
||||
}
|
||||
void setNanColor(const QColor & __value);
|
||||
/*! \copydoc nanColor
|
||||
\see see nanColor for details */
|
||||
inline virtual QColor getNanColor() const
|
||||
{
|
||||
return this->nanColor;
|
||||
}
|
||||
QColor getNanColor() const;
|
||||
/*! \copydoc infColor
|
||||
\see see infColor for details */
|
||||
inline virtual void setInfColor(const QColor & __value)
|
||||
{
|
||||
this->infColor = __value;
|
||||
}
|
||||
void setInfColor(const QColor & __value);
|
||||
/*! \copydoc infColor
|
||||
\see see infColor for details */
|
||||
inline virtual QColor getInfColor() const
|
||||
{
|
||||
return this->infColor;
|
||||
}
|
||||
QColor getInfColor() const;
|
||||
/*! \copydoc showColorBar
|
||||
\see see showColorBar for details */
|
||||
inline virtual void setShowColorBar(bool __value)
|
||||
{
|
||||
this->showColorBar = __value;
|
||||
}
|
||||
void setShowColorBar(bool __value);
|
||||
/*! \copydoc showColorBar
|
||||
\see see showColorBar for details */
|
||||
inline virtual bool getShowColorBar() const
|
||||
{
|
||||
return this->showColorBar;
|
||||
}
|
||||
bool getShowColorBar() const;
|
||||
/*! \copydoc colorBarWidth
|
||||
\see see colorBarWidth for details */
|
||||
inline virtual void setColorBarWidth(double __value)
|
||||
{
|
||||
this->colorBarWidth = __value;
|
||||
}
|
||||
void setColorBarWidth(double __value);
|
||||
/*! \copydoc colorBarWidth
|
||||
\see see colorBarWidth for details */
|
||||
inline virtual double getColorBarWidth() const
|
||||
{
|
||||
return this->colorBarWidth;
|
||||
}
|
||||
double getColorBarWidth() const;
|
||||
/*! \copydoc colorBarModifiedWidth
|
||||
\see see colorBarModifiedWidth for details */
|
||||
inline virtual void setColorBarModifiedWidth(double __value)
|
||||
{
|
||||
this->colorBarModifiedWidth = __value;
|
||||
}
|
||||
void setColorBarModifiedWidth(double __value);
|
||||
/*! \copydoc colorBarModifiedWidth
|
||||
\see see colorBarModifiedWidth for details */
|
||||
inline virtual double getColorBarModifiedWidth() const
|
||||
{
|
||||
return this->colorBarModifiedWidth;
|
||||
}
|
||||
double getColorBarModifiedWidth() const;
|
||||
/*! \copydoc colorBarOffset
|
||||
\see see colorBarOffset for details */
|
||||
inline virtual void setColorBarOffset(double __value)
|
||||
{
|
||||
this->colorBarOffset = __value;
|
||||
}
|
||||
void setColorBarOffset(double __value);
|
||||
/*! \copydoc colorBarOffset
|
||||
\see see colorBarOffset for details */
|
||||
inline virtual double getColorBarOffset() const
|
||||
{
|
||||
return this->colorBarOffset;
|
||||
}
|
||||
double getColorBarOffset() const;
|
||||
/*! \copydoc colorBarRelativeHeight
|
||||
\see see colorBarRelativeHeight for details */
|
||||
inline virtual void setColorBarRelativeHeight(double __value)
|
||||
{
|
||||
this->colorBarRelativeHeight = __value;
|
||||
}
|
||||
void setColorBarRelativeHeight(double __value);
|
||||
/*! \copydoc colorBarRelativeHeight
|
||||
\see see colorBarRelativeHeight for details */
|
||||
inline virtual double getColorBarRelativeHeight() const
|
||||
{
|
||||
return this->colorBarRelativeHeight;
|
||||
}
|
||||
double getColorBarRelativeHeight() const;
|
||||
/*! \copydoc imageMin
|
||||
\see see imageMin for details */
|
||||
inline virtual void setImageMin(double __value)
|
||||
{
|
||||
this->imageMin = __value;
|
||||
}
|
||||
void setImageMin(double __value);
|
||||
/*! \copydoc imageMin
|
||||
\see see imageMin for details */
|
||||
inline virtual double getImageMin() const
|
||||
{
|
||||
return this->imageMin;
|
||||
}
|
||||
double getImageMin() const;
|
||||
/*! \copydoc imageMax
|
||||
\see see imageMax for details */
|
||||
inline virtual void setImageMax(double __value)
|
||||
{
|
||||
this->imageMax = __value;
|
||||
}
|
||||
void setImageMax(double __value);
|
||||
/*! \copydoc imageMax
|
||||
\see see imageMax for details */
|
||||
inline virtual double getImageMax() const
|
||||
{
|
||||
return this->imageMax;
|
||||
}
|
||||
double getImageMax() const;
|
||||
/*! \copydoc autoImageRange
|
||||
\see see autoImageRange for details */
|
||||
inline virtual void setAutoImageRange(bool __value)
|
||||
{
|
||||
this->autoImageRange = __value;
|
||||
}
|
||||
void setAutoImageRange(bool __value);
|
||||
/*! \copydoc autoImageRange
|
||||
\see see autoImageRange for details */
|
||||
inline virtual bool getAutoImageRange() const
|
||||
{
|
||||
return this->autoImageRange;
|
||||
}
|
||||
bool getAutoImageRange() const;
|
||||
/*! \copydoc imageName
|
||||
\see see imageName for details */
|
||||
inline virtual void setImageName(const QString & __value)
|
||||
{
|
||||
this->imageName = __value;
|
||||
}
|
||||
void setImageName(const QString & __value);
|
||||
/*! \copydoc imageName
|
||||
\see see imageName for details */
|
||||
inline virtual QString getImageName() const
|
||||
{
|
||||
return this->imageName;
|
||||
}
|
||||
QString getImageName() const;
|
||||
/*! \copydoc imageNameFontSize
|
||||
\see see imageNameFontSize for details */
|
||||
inline virtual void setImageNameFontSize(double __value)
|
||||
{
|
||||
this->imageNameFontSize = __value;
|
||||
}
|
||||
void setImageNameFontSize(double __value);
|
||||
/*! \copydoc imageNameFontSize
|
||||
\see see imageNameFontSize for details */
|
||||
inline virtual double getImageNameFontSize() const
|
||||
{
|
||||
return this->imageNameFontSize;
|
||||
}
|
||||
double getImageNameFontSize() const;
|
||||
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
|
||||
inline JKQTPVerticalIndependentAxis* getColorBarRightAxis() { return this->colorBarRightAxis; }
|
||||
JKQTPVerticalIndependentAxis* getColorBarRightAxis();
|
||||
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
|
||||
inline JKQTPHorizontalIndependentAxis* getColorBarTopAxis() { return this->colorBarTopAxis; }
|
||||
JKQTPHorizontalIndependentAxis* getColorBarTopAxis();
|
||||
/*! \brief returns the property modifierColorBarTopAxis ( \copybrief modifierColorBarTopAxis ). \details Description of the parameter modifierColorBarTopAxis is: <BLOCKQUOTE>\copydoc modifierColorBarTopAxis </BLOCKQUOTE>. \see modifierColorBarTopAxis for more information */
|
||||
inline JKQTPVerticalIndependentAxis* getModifierColorBarTopAxis() { return this->modifierColorBarTopAxis; }
|
||||
JKQTPVerticalIndependentAxis* getModifierColorBarTopAxis();
|
||||
/*! \brief returns the property modifierColorBarRightAxis ( \copybrief modifierColorBarRightAxis ). \details Description of the parameter modifierColorBarRightAxis is: <BLOCKQUOTE>\copydoc modifierColorBarRightAxis </BLOCKQUOTE>. \see modifierColorBarRightAxis for more information */
|
||||
inline JKQTPHorizontalIndependentAxis* getModifierColorBarRightAxis() { return this->modifierColorBarRightAxis ; }
|
||||
JKQTPHorizontalIndependentAxis* getModifierColorBarRightAxis();
|
||||
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
|
||||
inline const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const { return this->colorBarRightAxis; }
|
||||
const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const;
|
||||
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
|
||||
inline const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const { return this->colorBarTopAxis; }
|
||||
const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const;
|
||||
/*! \brief returns the property modifierColorBarTopAxis ( \copybrief modifierColorBarTopAxis ). \details Description of the parameter modifierColorBarTopAxis is: <BLOCKQUOTE>\copydoc modifierColorBarTopAxis </BLOCKQUOTE>. \see modifierColorBarTopAxis for more information */
|
||||
inline const JKQTPVerticalIndependentAxis* getModifierColorBarTopAxis() const { return this->modifierColorBarTopAxis; }
|
||||
const JKQTPVerticalIndependentAxis* getModifierColorBarTopAxis() const;
|
||||
/*! \brief returns the property modifierColorBarRightAxis ( \copybrief modifierColorBarRightAxis ). \details Description of the parameter modifierColorBarRightAxis is: <BLOCKQUOTE>\copydoc modifierColorBarRightAxis </BLOCKQUOTE>. \see modifierColorBarRightAxis for more information */
|
||||
inline const JKQTPHorizontalIndependentAxis* getModifierColorBarRightAxis() const { return this->modifierColorBarRightAxis ; }
|
||||
const JKQTPHorizontalIndependentAxis *getModifierColorBarRightAxis() const;
|
||||
/*! \copydoc colorBarTopVisible
|
||||
\see see colorBarTopVisible for details */
|
||||
inline virtual void setColorBarTopVisible(bool __value)
|
||||
{
|
||||
this->colorBarTopVisible = __value;
|
||||
}
|
||||
void setColorBarTopVisible(bool __value);
|
||||
/*! \copydoc colorBarTopVisible
|
||||
\see see colorBarTopVisible for details */
|
||||
inline virtual bool getColorBarTopVisible() const
|
||||
{
|
||||
return this->colorBarTopVisible;
|
||||
}
|
||||
bool getColorBarTopVisible() const;
|
||||
/*! \copydoc colorBarRightVisible
|
||||
\see see colorBarRightVisible for details */
|
||||
inline virtual void setColorBarRightVisible(bool __value)
|
||||
{
|
||||
this->colorBarRightVisible = __value;
|
||||
}
|
||||
void setColorBarRightVisible(bool __value);
|
||||
/*! \copydoc colorBarRightVisible
|
||||
\see see colorBarRightVisible for details */
|
||||
inline virtual bool getColorBarRightVisible() const
|
||||
{
|
||||
return this->colorBarRightVisible;
|
||||
}
|
||||
bool getColorBarRightVisible() const;
|
||||
/*! \copydoc autoModifierRange
|
||||
\see see autoModifierRange for details */
|
||||
inline virtual void setAutoModifierRange(bool __value)
|
||||
{
|
||||
this->autoModifierRange = __value;
|
||||
}
|
||||
void setAutoModifierRange(bool __value);
|
||||
/*! \copydoc autoModifierRange
|
||||
\see see autoModifierRange for details */
|
||||
inline virtual bool getAutoModifierRange() const
|
||||
{
|
||||
return this->autoModifierRange;
|
||||
}
|
||||
bool getAutoModifierRange() const;
|
||||
/*! \copydoc modifierMin
|
||||
\see see modifierMin for details */
|
||||
inline virtual void setModifierMin(double __value)
|
||||
{
|
||||
this->modifierMin = __value;
|
||||
}
|
||||
void setModifierMin(double __value);
|
||||
/*! \copydoc modifierMin
|
||||
\see see modifierMin for details */
|
||||
inline virtual double getModifierMin() const
|
||||
{
|
||||
return this->modifierMin;
|
||||
}
|
||||
double getModifierMin() const;
|
||||
/*! \copydoc modifierMax
|
||||
\see see modifierMax for details */
|
||||
inline virtual void setModifierMax(double __value)
|
||||
{
|
||||
this->modifierMax = __value;
|
||||
}
|
||||
void setModifierMax(double __value);
|
||||
/*! \copydoc modifierMax
|
||||
\see see modifierMax for details */
|
||||
inline virtual double getModifierMax() const
|
||||
{
|
||||
return this->modifierMax;
|
||||
}
|
||||
double getModifierMax() const;
|
||||
|
||||
void setPalette(int pal);
|
||||
|
||||
@ -844,28 +646,16 @@ class JKQTP_LIB_EXPORT JKQTPColumnMathImage: public JKQTPMathImage {
|
||||
|
||||
/*! \copydoc imageColumn
|
||||
\see see imageColumn for details */
|
||||
inline virtual void setImageColumn(int __value)
|
||||
{
|
||||
this->imageColumn = __value;
|
||||
}
|
||||
virtual void setImageColumn(int __value);
|
||||
/*! \copydoc imageColumn
|
||||
\see see imageColumn for details */
|
||||
inline virtual int getImageColumn() const
|
||||
{
|
||||
return this->imageColumn;
|
||||
}
|
||||
int getImageColumn() const;
|
||||
/*! \copydoc modifierColumn
|
||||
\see see modifierColumn for details */
|
||||
inline virtual void setModifierColumn(int __value)
|
||||
{
|
||||
this->modifierColumn = __value;
|
||||
}
|
||||
virtual void setModifierColumn(int __value);
|
||||
/*! \copydoc modifierColumn
|
||||
\see see modifierColumn for details */
|
||||
inline virtual int getModifierColumn() const
|
||||
{
|
||||
return this->modifierColumn;
|
||||
}
|
||||
int getModifierColumn() const;
|
||||
|
||||
/** \copydoc JKQTPGraph::usesColumn() */
|
||||
virtual bool usesColumn(int c) const override;
|
||||
|
@ -98,8 +98,8 @@ QImage JKQTPOverlayImage::drawImage() {
|
||||
|
||||
//QRgb tc=trueColor.rgba();
|
||||
//QRgb fc=falseColor.rgba();
|
||||
QRgb tc=qRgba(round(trueColor.red()*trueColor.alphaF()), round(trueColor.green()*trueColor.alphaF()), round(trueColor.blue()*trueColor.alphaF()), trueColor.alpha());
|
||||
QRgb fc=qRgba(round(falseColor.red()*falseColor.alphaF()), round(falseColor.green()*falseColor.alphaF()), round(falseColor.blue()*falseColor.alphaF()), falseColor.alpha());
|
||||
QRgb tc=qRgba(jkqtp_roundTo<int>(trueColor.red()*trueColor.alphaF()), jkqtp_roundTo<int>(trueColor.green()*trueColor.alphaF()), jkqtp_roundTo<int>(trueColor.blue()*trueColor.alphaF()), trueColor.alpha());
|
||||
QRgb fc=qRgba(jkqtp_roundTo<int>(falseColor.red()*falseColor.alphaF()), jkqtp_roundTo<int>(falseColor.green()*falseColor.alphaF()), jkqtp_roundTo<int>(falseColor.blue()*falseColor.alphaF()), falseColor.alpha());
|
||||
|
||||
for (int32_t y=0; y<Ny; y++) {
|
||||
QRgb* line=(QRgb*)img.scanLine(Ny-1-y);
|
||||
@ -117,9 +117,9 @@ QImage JKQTPOverlayImage::drawImage() {
|
||||
}
|
||||
|
||||
void JKQTPOverlayImage::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
int w=rect.width()/2;
|
||||
double w=rect.width()/2;
|
||||
QRectF r1=QRectF(rect.topLeft(), QSizeF(w, rect.height()));
|
||||
QRectF r2=QRectF(QPoint(rect.left()+w, rect.top()), QSizeF(w, rect.height()));
|
||||
QRectF r2=QRectF(QPointF(rect.left()+w, rect.top()), QSizeF(w, rect.height()));
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
painter.setPen(Qt::transparent);
|
||||
painter.setBrush(QBrush(trueColor));
|
||||
@ -130,12 +130,62 @@ void JKQTPOverlayImage::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rec
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPOverlayImage::getKeyLabelColor() {
|
||||
QColor JKQTPOverlayImage::getKeyLabelColor() const {
|
||||
QColor c=trueColor;
|
||||
c.setAlpha(255);
|
||||
return c;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImage::setTrueColor(const QColor &__value)
|
||||
{
|
||||
this->trueColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPOverlayImage::getTrueColor() const
|
||||
{
|
||||
return this->trueColor;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImage::setFalseColor(const QColor &__value)
|
||||
{
|
||||
this->falseColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPOverlayImage::getFalseColor() const
|
||||
{
|
||||
return this->falseColor;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImage::setNx(int __value)
|
||||
{
|
||||
this->Nx = __value;
|
||||
}
|
||||
|
||||
int JKQTPOverlayImage::getNx() const
|
||||
{
|
||||
return this->Nx;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImage::setNy(int __value)
|
||||
{
|
||||
this->Ny = __value;
|
||||
}
|
||||
|
||||
int JKQTPOverlayImage::getNy() const
|
||||
{
|
||||
return this->Ny;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImage::setData(bool *__value)
|
||||
{
|
||||
this->data = __value;
|
||||
}
|
||||
|
||||
bool *JKQTPOverlayImage::getData() const
|
||||
{
|
||||
return this->data;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImage::setData(bool* data, int Nx, int Ny) {
|
||||
this->data=data;
|
||||
this->Nx=Nx;
|
||||
@ -147,50 +197,88 @@ JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(double x, double y, double
|
||||
JKQTPOverlayImage(x, y, width, height, data, Nx, Ny, colTrue, parent)
|
||||
{
|
||||
symbol=JKQTPTarget;
|
||||
symbolWidth=1;
|
||||
drawAsRectangles=true;
|
||||
symbolLineWidth=1;
|
||||
drawMode=OverlayImageEnhancedDrawMode::DrawAsRectangles;
|
||||
symbolSizeFactor=0.9;
|
||||
rectanglesAsImageOverlay=false;
|
||||
}
|
||||
|
||||
JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQTBasePlotter *parent):
|
||||
JKQTPOverlayImage(0,0,1,1,nullptr,0,0, QColor("red"), parent)
|
||||
{
|
||||
symbol=JKQTPTarget;
|
||||
symbolWidth=1;
|
||||
drawAsRectangles=true;
|
||||
symbolLineWidth=1;
|
||||
drawMode=OverlayImageEnhancedDrawMode::DrawAsRectangles;
|
||||
symbolSizeFactor=0.9;
|
||||
rectanglesAsImageOverlay=false;
|
||||
}
|
||||
|
||||
JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(double x, double y, double width, double height, bool* data, int Nx, int Ny, QColor colTrue, JKQTPlotter* parent):
|
||||
JKQTPOverlayImage(x, y, width, height, data, Nx, Ny, colTrue, parent)
|
||||
{
|
||||
symbol=JKQTPTarget;
|
||||
symbolWidth=1;
|
||||
drawAsRectangles=true;
|
||||
symbolLineWidth=1;
|
||||
drawMode=OverlayImageEnhancedDrawMode::DrawAsRectangles;
|
||||
symbolSizeFactor=0.9;
|
||||
rectanglesAsImageOverlay=false;
|
||||
}
|
||||
|
||||
JKQTPOverlayImageEnhanced::JKQTPOverlayImageEnhanced(JKQTPlotter *parent):
|
||||
JKQTPOverlayImage(0,0,1,1,nullptr,0,0, QColor("red"), parent)
|
||||
{
|
||||
symbol=JKQTPTarget;
|
||||
symbolWidth=1;
|
||||
drawAsRectangles=true;
|
||||
symbolLineWidth=1;
|
||||
drawMode=OverlayImageEnhancedDrawMode::DrawAsRectangles ;
|
||||
symbolSizeFactor=0.9;
|
||||
rectanglesAsImageOverlay=false;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImageEnhanced::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
if (drawAsRectangles) JKQTPOverlayImage::drawKeyMarker(painter, rect);
|
||||
else JKQTPPlotSymbol(painter, rect.center().x(), rect.center().y(), symbol, qMin(rect.width(), rect.height()), parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), trueColor, trueColor.lighter());
|
||||
if (drawMode!=OverlayImageEnhancedDrawMode::DrawAsSymbols) JKQTPOverlayImage::drawKeyMarker(painter, rect);
|
||||
else JKQTPPlotSymbol(painter, rect.center().x(), rect.center().y(), symbol, qMin(rect.width(), rect.height()), parent->pt2px(painter, symbolLineWidth*parent->getLineWidthMultiplier()), trueColor, trueColor.lighter());
|
||||
}
|
||||
|
||||
void JKQTPOverlayImageEnhanced::setSymbolType(JKQTPGraphSymbols __value)
|
||||
{
|
||||
this->symbol = __value;
|
||||
}
|
||||
|
||||
JKQTPGraphSymbols JKQTPOverlayImageEnhanced::getSymbol() const
|
||||
{
|
||||
return this->symbol;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImageEnhanced::setSymbolLineWidth(double __value)
|
||||
{
|
||||
this->symbolLineWidth = __value;
|
||||
}
|
||||
|
||||
double JKQTPOverlayImageEnhanced::getSymbolLineWidth() const
|
||||
{
|
||||
return this->symbolLineWidth;
|
||||
}
|
||||
|
||||
JKQTPOverlayImageEnhanced::OverlayImageEnhancedDrawMode JKQTPOverlayImageEnhanced::getDrawMode() const
|
||||
{
|
||||
return drawMode;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImageEnhanced::setDrawMode(OverlayImageEnhancedDrawMode __value)
|
||||
{
|
||||
this->drawMode = __value;
|
||||
}
|
||||
|
||||
|
||||
void JKQTPOverlayImageEnhanced::setSymbolSizeFactor(double __value)
|
||||
{
|
||||
this->symbolSizeFactor = __value;
|
||||
}
|
||||
|
||||
double JKQTPOverlayImageEnhanced::getSymbolSizeFactor() const
|
||||
{
|
||||
return this->symbolSizeFactor;
|
||||
}
|
||||
|
||||
void JKQTPOverlayImageEnhanced::draw(JKQTPEnhancedPainter& painter) {
|
||||
if (!data) return;
|
||||
|
||||
if (drawAsRectangles && rectanglesAsImageOverlay) {
|
||||
if (drawMode==DrawAsImage) {
|
||||
JKQTPOverlayImage::draw(painter);
|
||||
} else {
|
||||
|
||||
@ -202,7 +290,7 @@ void JKQTPOverlayImageEnhanced::draw(JKQTPEnhancedPainter& painter) {
|
||||
for (int iy=0; iy<static_cast<int64_t>(Ny); iy++) {
|
||||
QPointF p1=transform(x+static_cast<double>(ix)*dx, y+static_cast<double>(iy)*dy);
|
||||
QPointF p2=transform(x+static_cast<double>(ix+1)*dx, y+static_cast<double>(iy+1)*dx);
|
||||
if (drawAsRectangles) {
|
||||
if (drawMode==DrawAsRectangles) {
|
||||
if (data[ix+iy*Nx]) {
|
||||
if (trueColor.alpha()>0) {
|
||||
painter.fillRect(QRectF(qMin(p1.x(), p2.x())-1.0, qMin(p2.y(), p1.y())-1.0, fabs(p2.x()-p1.x())+1.0, fabs(p2.y()-p1.y())+1.0), QBrush(trueColor));
|
||||
@ -216,10 +304,10 @@ void JKQTPOverlayImageEnhanced::draw(JKQTPEnhancedPainter& painter) {
|
||||
//painter.drawRect(QRectF(qMin(p1.x(), p2.x()), qMin(p2.y(), p1.y()), fabs(p2.x()-p1.x()), fabs(p2.y()-p1.y())));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (drawMode==DrawAsSymbols){
|
||||
QPointF p=(p1+p2)/2.0;
|
||||
if (data[ix+iy*Nx]) {
|
||||
JKQTPPlotSymbol(painter, p.x(), p.y(), symbol, fabs(p2.x()-p1.x())*symbolSizeFactor, parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), trueColor, trueColor.lighter());
|
||||
JKQTPPlotSymbol(painter, p.x(), p.y(), symbol, fabs(p2.x()-p1.x())*symbolSizeFactor, parent->pt2px(painter, symbolLineWidth*parent->getLineWidthMultiplier()), trueColor, trueColor.lighter());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,13 +341,23 @@ JKQTPColumnOverlayImageEnhanced::JKQTPColumnOverlayImageEnhanced(JKQTPlotter *pa
|
||||
{
|
||||
imageColumn=-1;
|
||||
}
|
||||
|
||||
void JKQTPColumnOverlayImageEnhanced::setImageColumn(int __value)
|
||||
{
|
||||
this->imageColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPColumnOverlayImageEnhanced::getImageColumn() const
|
||||
{
|
||||
return this->imageColumn;
|
||||
}
|
||||
void JKQTPColumnOverlayImageEnhanced::draw(JKQTPEnhancedPainter &painter) {
|
||||
double* d=parent->getDatastore()->getColumn(imageColumn).getPointer(0);
|
||||
int imgSize=parent->getDatastore()->getColumn(imageColumn).getRows();
|
||||
size_t imgSize=parent->getDatastore()->getColumn(imageColumn).getRows();
|
||||
this->data=(bool*)malloc(imgSize*sizeof(bool));
|
||||
this->Ny=imgSize/this->Nx;
|
||||
for (int i=0; i<imgSize; i++) {
|
||||
data[i]=d[i];
|
||||
data[i]=(d[i]!=0.0);
|
||||
}
|
||||
JKQTPOverlayImageEnhanced::draw(painter);
|
||||
free(data);
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <QPainter>
|
||||
#include <QImage>
|
||||
#include <QIcon>
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplotter/jkqtpbaseelements.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimage.h"
|
||||
@ -62,71 +62,43 @@ class JKQTP_LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase {
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
/*! \copydoc trueColor
|
||||
\see see trueColor for details */
|
||||
inline virtual void setTrueColor(const QColor & __value)
|
||||
{
|
||||
this->trueColor = __value;
|
||||
}
|
||||
void setTrueColor(const QColor & __value);
|
||||
/*! \copydoc trueColor
|
||||
\see see trueColor for details */
|
||||
inline virtual QColor getTrueColor() const
|
||||
{
|
||||
return this->trueColor;
|
||||
}
|
||||
QColor getTrueColor() const;
|
||||
/*! \copydoc falseColor
|
||||
\see see falseColor for details */
|
||||
inline virtual void setFalseColor(const QColor & __value)
|
||||
{
|
||||
this->falseColor = __value;
|
||||
}
|
||||
void setFalseColor(const QColor & __value);
|
||||
/*! \copydoc falseColor
|
||||
\see see falseColor for details */
|
||||
inline virtual QColor getFalseColor() const
|
||||
{
|
||||
return this->falseColor;
|
||||
}
|
||||
QColor getFalseColor() const;
|
||||
/*! \copydoc Nx
|
||||
\see see Nx for details */
|
||||
inline virtual void setNx(int __value)
|
||||
{
|
||||
this->Nx = __value;
|
||||
}
|
||||
void setNx(int __value);
|
||||
/*! \copydoc Nx
|
||||
\see see Nx for details */
|
||||
inline virtual int getNx() const
|
||||
{
|
||||
return this->Nx;
|
||||
}
|
||||
int getNx() const;
|
||||
/*! \copydoc Ny
|
||||
\see see Ny for details */
|
||||
inline virtual void setNy(int __value)
|
||||
{
|
||||
this->Ny = __value;
|
||||
}
|
||||
void setNy(int __value);
|
||||
/*! \copydoc Ny
|
||||
\see see Ny for details */
|
||||
inline virtual int getNy() const
|
||||
{
|
||||
return this->Ny;
|
||||
}
|
||||
int getNy() const;
|
||||
/*! \copydoc data
|
||||
\see see data for details */
|
||||
inline virtual void setData(bool* __value)
|
||||
{
|
||||
this->data = __value;
|
||||
}
|
||||
virtual void setData(bool* __value);
|
||||
/*! \copydoc data
|
||||
\see see data for details */
|
||||
inline virtual bool* getData() const
|
||||
{
|
||||
return this->data;
|
||||
}
|
||||
bool *getData() const;
|
||||
|
||||
void setData(bool* data, int Nx, int Ny);
|
||||
/** \brief set the plot-data to a given array \a data with size \a Nx * \a Ny in row-major ordering */
|
||||
virtual void setData(bool* data, int Nx, int Ny);
|
||||
|
||||
/** \brief return the data used for plotting as a QVector<double> in row-major data-ordering */
|
||||
QVector<double> getDataAsDoubleVector() const;
|
||||
|
||||
protected:
|
||||
@ -143,13 +115,19 @@ class JKQTP_LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase {
|
||||
QColor falseColor;
|
||||
|
||||
protected:
|
||||
/** \brief action that calls saveImagePlotAsImage() */
|
||||
QAction* actSaveImage;
|
||||
/** \brief action that calls copyImagePlotAsImage() */
|
||||
QAction* actCopyImage;
|
||||
public:
|
||||
/** \copydoc JKQTPImageBase::setTitle() */
|
||||
virtual void setTitle(const QString& title) override;
|
||||
/** \copydoc JKQTPImageBase::setParent() */
|
||||
virtual void setParent(JKQTBasePlotter* parent) override;
|
||||
public slots:
|
||||
/** \brief save the plotted image as a file with \a filename and format \a outputFormat */
|
||||
void saveImagePlotAsImage(const QString &filename=QString(""), const QByteArray &outputFormat=QByteArray());
|
||||
/** \brief copy the plotted image as an image into the clipboard */
|
||||
void copyImagePlotAsImage();
|
||||
|
||||
};
|
||||
@ -167,6 +145,12 @@ class JKQTP_LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase {
|
||||
class JKQTP_LIB_EXPORT JKQTPOverlayImageEnhanced: public JKQTPOverlayImage {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum OverlayImageEnhancedDrawMode {
|
||||
DrawAsRectangles,
|
||||
DrawAsImage,
|
||||
DrawAsSymbols
|
||||
};
|
||||
|
||||
/** \brief class constructor */
|
||||
JKQTPOverlayImageEnhanced(double x, double y, double width, double height, bool* data, int Nx, int Ny, QColor colTrue, JKQTBasePlotter* parent=nullptr);
|
||||
JKQTPOverlayImageEnhanced(JKQTBasePlotter* parent=nullptr);
|
||||
@ -181,79 +165,41 @@ class JKQTP_LIB_EXPORT JKQTPOverlayImageEnhanced: public JKQTPOverlayImage {
|
||||
|
||||
/*! \copydoc symbol
|
||||
\see see symbol for details */
|
||||
inline virtual void setSymbol(const JKQTPGraphSymbols & __value)
|
||||
{
|
||||
this->symbol = __value;
|
||||
}
|
||||
void setSymbolType(JKQTPGraphSymbols __value);
|
||||
/*! \copydoc symbol
|
||||
\see see symbol for details */
|
||||
inline virtual JKQTPGraphSymbols getSymbol() const
|
||||
{
|
||||
return this->symbol;
|
||||
}
|
||||
/*! \copydoc symbolWidth
|
||||
\see see symbolWidth for details */
|
||||
inline virtual void setSymbolWidth(double __value)
|
||||
{
|
||||
this->symbolWidth = __value;
|
||||
}
|
||||
/*! \copydoc symbolWidth
|
||||
\see see symbolWidth for details */
|
||||
inline virtual double getSymbolWidth() const
|
||||
{
|
||||
return this->symbolWidth;
|
||||
}
|
||||
JKQTPGraphSymbols getSymbol() const;
|
||||
/*! \copydoc symbolLineWidth
|
||||
\see see symbolLineWidth for details */
|
||||
void setSymbolLineWidth(double __value);
|
||||
/*! \copydoc symbolLineWidth
|
||||
\see see symbolLineWidth for details */
|
||||
double getSymbolLineWidth() const;
|
||||
/*! \copydoc drawAsRectangles
|
||||
\see see drawAsRectangles for details */
|
||||
inline virtual void setDrawAsRectangles(bool __value)
|
||||
{
|
||||
this->drawAsRectangles = __value;
|
||||
}
|
||||
void setDrawMode(OverlayImageEnhancedDrawMode __value);
|
||||
/*! \copydoc drawAsRectangles
|
||||
\see see drawAsRectangles for details */
|
||||
inline virtual bool getDrawAsRectangles() const
|
||||
{
|
||||
return this->drawAsRectangles;
|
||||
}
|
||||
/*! \copydoc rectanglesAsImageOverlay
|
||||
\see see rectanglesAsImageOverlay for details */
|
||||
inline virtual void setRectanglesAsImageOverlay(bool __value)
|
||||
{
|
||||
this->rectanglesAsImageOverlay = __value;
|
||||
}
|
||||
/*! \copydoc rectanglesAsImageOverlay
|
||||
\see see rectanglesAsImageOverlay for details */
|
||||
inline virtual bool getRectanglesAsImageOverlay() const
|
||||
{
|
||||
return this->rectanglesAsImageOverlay;
|
||||
}
|
||||
OverlayImageEnhancedDrawMode getDrawMode() const;
|
||||
/*! \copydoc symbolSizeFactor
|
||||
\see see symbolSizeFactor for details */
|
||||
inline virtual void setSymbolSizeFactor(double __value)
|
||||
{
|
||||
this->symbolSizeFactor = __value;
|
||||
}
|
||||
void setSymbolSizeFactor(double __value);
|
||||
/*! \copydoc symbolSizeFactor
|
||||
\see see symbolSizeFactor for details */
|
||||
inline virtual double getSymbolSizeFactor() const
|
||||
{
|
||||
return this->symbolSizeFactor;
|
||||
}
|
||||
double getSymbolSizeFactor() const;
|
||||
|
||||
protected:
|
||||
/** \brief which symbol to use for the datapoints */
|
||||
JKQTPGraphSymbols symbol;
|
||||
/** \brief width (in pt) of the lines used to plot the symbol for the data points */
|
||||
double symbolWidth;
|
||||
double symbolLineWidth;
|
||||
|
||||
/** \brief indicates whether to draw filled rectangles (\c false, default) or symbols */
|
||||
bool drawAsRectangles;
|
||||
/** \brief indicates whether to draw filled rectangles, or symbols */
|
||||
OverlayImageEnhancedDrawMode drawMode;
|
||||
|
||||
/** \brief a rescaling factor for the symbols */
|
||||
double symbolSizeFactor;
|
||||
|
||||
/** \brief when \c drawAsRectangles==true this reactivates the drawing from JKQTPOverlayImage, i.e. the overlay is not drawn as separated rectangles, but as an overlay image */
|
||||
bool rectanglesAsImageOverlay;
|
||||
|
||||
};
|
||||
|
||||
@ -277,16 +223,10 @@ class JKQTP_LIB_EXPORT JKQTPColumnOverlayImageEnhanced: public JKQTPOverlayImage
|
||||
|
||||
/*! \copydoc imageColumn
|
||||
\see see imageColumn for details */
|
||||
inline virtual void setImageColumn(int __value)
|
||||
{
|
||||
this->imageColumn = __value;
|
||||
}
|
||||
virtual void setImageColumn(int __value);
|
||||
/*! \copydoc imageColumn
|
||||
\see see imageColumn for details */
|
||||
inline virtual int getImageColumn() const
|
||||
{
|
||||
return this->imageColumn;
|
||||
}
|
||||
int getImageColumn() const;
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
|
||||
@ -295,7 +235,7 @@ class JKQTP_LIB_EXPORT JKQTPColumnOverlayImageEnhanced: public JKQTPOverlayImage
|
||||
|
||||
|
||||
protected:
|
||||
/** \brief top color bar visible */
|
||||
/** \brief column to read overlay image from */
|
||||
int imageColumn;
|
||||
};
|
||||
|
||||
|
@ -102,13 +102,13 @@ void JKQTPRGBMathImage::initObject()
|
||||
this->colorBarTopVisible=true;
|
||||
this->colorBarRightVisible=true;
|
||||
this->imageNameFontSize=parent->getKeyFontSize();
|
||||
this->imageName="";
|
||||
this->imageNameR="";
|
||||
this->showColorBar=true;
|
||||
this->colorBarWidth=14;
|
||||
this->colorBarRelativeHeight=0.75;
|
||||
this->autoImageRange=true;
|
||||
this->imageMin=0;
|
||||
this->imageMax=1;
|
||||
this->imageMinR=0;
|
||||
this->imageMaxR=1;
|
||||
this->imageMinG=0;
|
||||
this->imageMaxG=1;
|
||||
this->imageMinB=0;
|
||||
@ -195,7 +195,7 @@ void JKQTPRGBMathImage::getOutsideSize(JKQTPEnhancedPainter& painter, int& leftS
|
||||
if (!colorbarsSideBySide || (colorbarsSideBySide && !firstC)) rightSpace+=parent->pt2px(painter, colorBarWidth+colorBarOffset);
|
||||
colorBarRightAxis->setRange(internalDataMin, internalDataMax);
|
||||
colorBarRightAxis->setAxisWidth(sizeFactor*colorBarRelativeHeight*parent->getPlotHeight());
|
||||
colorBarRightAxisB->setAxisLabel(imageName);
|
||||
colorBarRightAxisB->setAxisLabel(imageNameR);
|
||||
QSizeF s2=colorBarRightAxis->getSize2(painter);
|
||||
QSizeF s1=colorBarRightAxis->getSize1(painter);
|
||||
if (!colorbarsSideBySide || (colorbarsSideBySide && !firstC)) rightSpace+=parent->pt2px(painter, colorBarWidth+colorBarOffset)+static_cast<double>(s2.width()+s1.width());
|
||||
@ -204,7 +204,7 @@ void JKQTPRGBMathImage::getOutsideSize(JKQTPEnhancedPainter& painter, int& leftS
|
||||
//if (!colorbarsSideBySide || (colorbarsSideBySide && !firstC)) topSpace+=parent->pt2px(painter, colorBarWidth+colorBarOffset);
|
||||
colorBarTopAxis->setRange(internalDataMin, internalDataMax);
|
||||
colorBarTopAxis->setAxisWidth(sizeFactor*colorBarRelativeHeight*parent->getPlotWidth());
|
||||
colorBarTopAxisB->setAxisLabel(imageName);
|
||||
colorBarTopAxisB->setAxisLabel(imageNameR);
|
||||
QSizeF s2=colorBarTopAxisB->getSize2(painter);
|
||||
QSizeF s1=colorBarTopAxisB->getSize2(painter);
|
||||
if (!colorbarsSideBySide || (colorbarsSideBySide && !firstC)) topSpace+=parent->pt2px(painter, colorBarWidth+colorBarOffset)+static_cast<double>(s2.height()+s1.height());
|
||||
@ -278,7 +278,7 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS
|
||||
int visibleColorBars=0;
|
||||
const int pd_size=200;
|
||||
uint8_t pd[pd_size];
|
||||
for (int i=0; i<pd_size; i++) pd[i]=i;
|
||||
for (int i=0; i<pd_size; i++) pd[i]=static_cast<uint8_t>(i);
|
||||
|
||||
if (data) {
|
||||
RGBOutsizeData d;
|
||||
@ -288,7 +288,7 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS
|
||||
d.internalDataMax=internalDataMax;
|
||||
d.colorBarRightAxis=colorBarRightAxis;
|
||||
d.colorBarTopAxis=colorBarTopAxis;
|
||||
d.name=imageName;
|
||||
d.name=imageNameR;
|
||||
if (rgbMode==JKQTPRGBMathImageModeRGBMode) {
|
||||
d.palette=JKQTPMathImageRED;
|
||||
d.paletteImage=QImage(1, pd_size, QImage::Format_ARGB32);
|
||||
@ -331,7 +331,7 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS
|
||||
QRgb* line=reinterpret_cast<QRgb *>(d.paletteImage.scanLine(0));
|
||||
for (int i=0; i<pd_size; i++) {
|
||||
QColor c=QColor("red");
|
||||
c.setHsv(c.hue(), double(i)/double(pd_size-1)*255.0, c.value(), c.alpha());
|
||||
c.setHsv(c.hue(), jkqtp_roundTo<int>(double(i)/double(pd_size-1)*255.0), c.value(), c.alpha());
|
||||
line[i]=c.rgba();
|
||||
}
|
||||
} else if (rgbMode==JKQTPRGBMathImageModeHSLMode) {
|
||||
@ -341,7 +341,7 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS
|
||||
QRgb* line=reinterpret_cast<QRgb *>(d.paletteImage.scanLine(0));
|
||||
for (int i=0; i<pd_size; i++) {
|
||||
QColor c=QColor("red");
|
||||
c.setHsl(c.hue(), double(i)/double(pd_size-1)*255.0, c.lightness(), c.alpha());
|
||||
c.setHsl(c.hue(), jkqtp_roundTo<int>(double(i)/double(pd_size-1)*255.0), c.lightness(), c.alpha());
|
||||
line[i]=c.rgba();
|
||||
}
|
||||
}
|
||||
@ -374,7 +374,7 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS
|
||||
QRgb* line=reinterpret_cast<QRgb *>(d.paletteImage.scanLine(0));
|
||||
for (int i=0; i<pd_size; i++) {
|
||||
QColor c=QColor("red");
|
||||
c.setHsv(c.hue(), c.saturation(), double(i)/double(pd_size-1)*255.0, c.alpha());
|
||||
c.setHsv(c.hue(), c.saturation(), jkqtp_roundTo<int>(double(i)/double(pd_size-1)*255.0), c.alpha());
|
||||
line[i]=c.rgba();
|
||||
}
|
||||
} else if (rgbMode==JKQTPRGBMathImageModeHSLMode) {
|
||||
@ -384,7 +384,7 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS
|
||||
QRgb* line=reinterpret_cast<QRgb *>(d.paletteImage.scanLine(0));
|
||||
for (int i=0; i<pd_size; i++) {
|
||||
QColor c=QColor("red");
|
||||
c.setHsl(c.hue(), c.saturation(), double(i)/double(pd_size-1)*255.0, c.alpha());
|
||||
c.setHsl(c.hue(), c.saturation(), jkqtp_roundTo<int>(double(i)/double(pd_size-1)*255.0), c.alpha());
|
||||
line[i]=c.rgba();
|
||||
}
|
||||
}
|
||||
@ -421,7 +421,7 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
|
||||
QRect cb(rX, rY, parent->pt2px(painter, colorBarWidth), gbarHeight);
|
||||
QRectF cb(rX, rY, parent->pt2px(painter, colorBarWidth), gbarHeight);
|
||||
painter.drawImage(cb, l[li].paletteImage.mirrored(true, false));
|
||||
QPen p=painter.pen();
|
||||
p.setColor(l[li].colorBarRightAxis->getAxisColor());
|
||||
@ -450,7 +450,7 @@ void JKQTPRGBMathImage::drawOutside(JKQTPEnhancedPainter& painter, QRect /*leftS
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
|
||||
QRect cb(tX, tY, gbarWidth, parent->pt2px(painter, colorBarWidth));
|
||||
QRectF cb(tX, tY, gbarWidth, parent->pt2px(painter, colorBarWidth));
|
||||
QMatrix mt;
|
||||
mt.rotate(90);
|
||||
painter.drawImage(cb, l[li].paletteImage.transformed(mt));
|
||||
@ -487,11 +487,353 @@ void JKQTPRGBMathImage::getDataMinMax(double& imin, double& imax) {
|
||||
if (autoImageRange) {
|
||||
JKQTPMathImageBase::getDataMinMax(imin, imax);
|
||||
} else {
|
||||
imin=imageMin;
|
||||
imax=imageMax;
|
||||
imin=imageMinR;
|
||||
imax=imageMaxR;
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setDataR(void *__value)
|
||||
{
|
||||
setData(__value);
|
||||
}
|
||||
|
||||
void *JKQTPRGBMathImage::getDataR() const
|
||||
{
|
||||
return getData();
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setDatatypeR(JKQTPMathImageBase::DataType __value)
|
||||
{
|
||||
setDatatype(__value);
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::DataType JKQTPRGBMathImage::getDatatypeR() const
|
||||
{
|
||||
return getDatatype();
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setDataG(void *__value)
|
||||
{
|
||||
this->dataG = __value;
|
||||
}
|
||||
|
||||
void *JKQTPRGBMathImage::getDataG() const
|
||||
{
|
||||
return this->dataG;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setDatatypeG(JKQTPMathImageBase::DataType __value)
|
||||
{
|
||||
this->datatypeG = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::DataType JKQTPRGBMathImage::getDatatypeG() const
|
||||
{
|
||||
return this->datatypeG;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setDataB(void *__value)
|
||||
{
|
||||
this->dataB = __value;
|
||||
}
|
||||
|
||||
void *JKQTPRGBMathImage::getDataB() const
|
||||
{
|
||||
return this->dataB;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setDatatypeB(JKQTPMathImageBase::DataType __value)
|
||||
{
|
||||
this->datatypeB = __value;
|
||||
}
|
||||
|
||||
JKQTPMathImageBase::DataType JKQTPRGBMathImage::getDatatypeB() const
|
||||
{
|
||||
return this->datatypeB;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setShowColorBar(bool __value)
|
||||
{
|
||||
this->showColorBar = __value;
|
||||
}
|
||||
|
||||
bool JKQTPRGBMathImage::getShowColorBar() const
|
||||
{
|
||||
return this->showColorBar;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setColorBarWidth(int __value)
|
||||
{
|
||||
this->colorBarWidth = __value;
|
||||
}
|
||||
|
||||
int JKQTPRGBMathImage::getColorBarWidth() const
|
||||
{
|
||||
return this->colorBarWidth;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setColorBarOffset(int __value)
|
||||
{
|
||||
this->colorBarOffset = __value;
|
||||
}
|
||||
|
||||
int JKQTPRGBMathImage::getColorBarOffset() const
|
||||
{
|
||||
return this->colorBarOffset;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setColorBarRelativeHeight(double __value)
|
||||
{
|
||||
this->colorBarRelativeHeight = __value;
|
||||
}
|
||||
|
||||
double JKQTPRGBMathImage::getColorBarRelativeHeight() const
|
||||
{
|
||||
return this->colorBarRelativeHeight;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageMin(double __value)
|
||||
{
|
||||
this->imageMinR = __value;
|
||||
}
|
||||
|
||||
double JKQTPRGBMathImage::getImageMin() const
|
||||
{
|
||||
return this->imageMinR;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageMinR(double m) {
|
||||
setImageMin(m);
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageMax(double __value)
|
||||
{
|
||||
this->imageMaxR = __value;
|
||||
}
|
||||
|
||||
double JKQTPRGBMathImage::getImageMax() const
|
||||
{
|
||||
return this->imageMaxR;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageMaxR(double m) {
|
||||
setImageMax(m);
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageMinG(double __value)
|
||||
{
|
||||
this->imageMinG = __value;
|
||||
}
|
||||
|
||||
double JKQTPRGBMathImage::getImageMinG() const
|
||||
{
|
||||
return this->imageMinG;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageMaxG(double __value)
|
||||
{
|
||||
this->imageMaxG = __value;
|
||||
}
|
||||
|
||||
double JKQTPRGBMathImage::getImageMaxG() const
|
||||
{
|
||||
return this->imageMaxG;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageMinB(double __value)
|
||||
{
|
||||
this->imageMinB = __value;
|
||||
}
|
||||
|
||||
double JKQTPRGBMathImage::getImageMinB() const
|
||||
{
|
||||
return this->imageMinB;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageMaxB(double __value)
|
||||
{
|
||||
this->imageMaxB = __value;
|
||||
}
|
||||
|
||||
double JKQTPRGBMathImage::getImageMaxB() const {
|
||||
return imageMaxB;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setAutoImageRange(bool __value)
|
||||
{
|
||||
this->autoImageRange = __value;
|
||||
}
|
||||
|
||||
bool JKQTPRGBMathImage::getAutoImageRange() const
|
||||
{
|
||||
return this->autoImageRange;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageName(const QString &__value)
|
||||
{
|
||||
this->imageNameR = __value;
|
||||
}
|
||||
|
||||
QString JKQTPRGBMathImage::getImageName() const
|
||||
{
|
||||
return this->imageNameR;
|
||||
}
|
||||
|
||||
QString JKQTPRGBMathImage::getImageNameR() const
|
||||
{
|
||||
return this->imageNameR;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageNameR(const QString &m) {
|
||||
setImageName(m);
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageNameG(const QString &__value)
|
||||
{
|
||||
this->imageNameG = __value;
|
||||
}
|
||||
|
||||
QString JKQTPRGBMathImage::getImageNameG() const
|
||||
{
|
||||
return this->imageNameG;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageNameB(const QString &__value)
|
||||
{
|
||||
this->imageNameB = __value;
|
||||
}
|
||||
|
||||
QString JKQTPRGBMathImage::getImageNameB() const
|
||||
{
|
||||
return this->imageNameB;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageNameFontName(const QString &__value)
|
||||
{
|
||||
this->imageNameFontName = __value;
|
||||
}
|
||||
|
||||
QString JKQTPRGBMathImage::getImageNameFontName() const
|
||||
{
|
||||
return this->imageNameFontName;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setImageNameFontSize(double __value)
|
||||
{
|
||||
this->imageNameFontSize = __value;
|
||||
}
|
||||
|
||||
double JKQTPRGBMathImage::getImageNameFontSize() const
|
||||
{
|
||||
return this->imageNameFontSize;
|
||||
}
|
||||
|
||||
JKQTPVerticalIndependentAxis *JKQTPRGBMathImage::getColorBarRightAxis() {
|
||||
return this->colorBarRightAxis;
|
||||
}
|
||||
|
||||
JKQTPHorizontalIndependentAxis *JKQTPRGBMathImage::getColorBarTopAxis() {
|
||||
return this->colorBarTopAxis;
|
||||
}
|
||||
|
||||
JKQTPVerticalIndependentAxis *JKQTPRGBMathImage::getColorBarRightAxisR()
|
||||
{
|
||||
return this->colorBarRightAxis;
|
||||
}
|
||||
|
||||
JKQTPHorizontalIndependentAxis *JKQTPRGBMathImage::getColorBarTopAxisR()
|
||||
{
|
||||
return this->colorBarTopAxis;
|
||||
}
|
||||
|
||||
JKQTPVerticalIndependentAxis *JKQTPRGBMathImage::getColorBarRightAxisG() {
|
||||
return this->colorBarRightAxisG;
|
||||
}
|
||||
|
||||
JKQTPHorizontalIndependentAxis *JKQTPRGBMathImage::getColorBarTopAxisG() {
|
||||
return this->colorBarTopAxisG;
|
||||
}
|
||||
|
||||
JKQTPVerticalIndependentAxis *JKQTPRGBMathImage::getColorBarRightAxisB() {
|
||||
return this->colorBarRightAxisB;
|
||||
}
|
||||
|
||||
JKQTPHorizontalIndependentAxis *JKQTPRGBMathImage::getColorBarTopAxisB() {
|
||||
return this->colorBarTopAxisB;
|
||||
}
|
||||
|
||||
const JKQTPVerticalIndependentAxis *JKQTPRGBMathImage::getColorBarRightAxis() const {
|
||||
return this->colorBarRightAxis;
|
||||
}
|
||||
|
||||
const JKQTPHorizontalIndependentAxis *JKQTPRGBMathImage::getColorBarTopAxis() const {
|
||||
return this->colorBarTopAxis;
|
||||
}
|
||||
|
||||
const JKQTPVerticalIndependentAxis *JKQTPRGBMathImage::getColorBarRightAxisR() const {
|
||||
return this->colorBarRightAxis;
|
||||
}
|
||||
|
||||
const JKQTPHorizontalIndependentAxis *JKQTPRGBMathImage::getColorBarTopAxisR() const {
|
||||
return this->colorBarTopAxis;
|
||||
}
|
||||
|
||||
const JKQTPVerticalIndependentAxis *JKQTPRGBMathImage::getColorBarRightAxisG() const {
|
||||
return this->colorBarRightAxisG;
|
||||
}
|
||||
|
||||
const JKQTPHorizontalIndependentAxis *JKQTPRGBMathImage::getColorBarTopAxisG() const {
|
||||
return this->colorBarTopAxisG;
|
||||
}
|
||||
|
||||
const JKQTPVerticalIndependentAxis *JKQTPRGBMathImage::getColorBarRightAxisB() const {
|
||||
return this->colorBarRightAxisB;
|
||||
}
|
||||
|
||||
const JKQTPHorizontalIndependentAxis *JKQTPRGBMathImage::getColorBarTopAxisB() const {
|
||||
return this->colorBarTopAxisB;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setColorBarTopVisible(bool __value)
|
||||
{
|
||||
this->colorBarTopVisible = __value;
|
||||
}
|
||||
|
||||
bool JKQTPRGBMathImage::getColorBarTopVisible() const
|
||||
{
|
||||
return this->colorBarTopVisible;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setColorBarRightVisible(bool __value)
|
||||
{
|
||||
this->colorBarRightVisible = __value;
|
||||
}
|
||||
|
||||
bool JKQTPRGBMathImage::getColorBarRightVisible() const
|
||||
{
|
||||
return this->colorBarRightVisible;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setColorbarsSideBySide(bool __value)
|
||||
{
|
||||
this->colorbarsSideBySide = __value;
|
||||
}
|
||||
|
||||
bool JKQTPRGBMathImage::getColorbarsSideBySide() const
|
||||
{
|
||||
return this->colorbarsSideBySide;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::setRgbMode(JKQTPRGBMathImageRGBMode __value)
|
||||
{
|
||||
this->rgbMode = __value;
|
||||
}
|
||||
|
||||
JKQTPRGBMathImageRGBMode JKQTPRGBMathImage::getRgbMode() const
|
||||
{
|
||||
return this->rgbMode;
|
||||
}
|
||||
|
||||
void JKQTPRGBMathImage::getDataMinMaxG(double& imin, double& imax) {
|
||||
ensureImageData();
|
||||
if (autoImageRange) {
|
||||
@ -1002,3 +1344,43 @@ QVector<double> JKQTPRGBMathImage::getDataBAsDoubleVector() const
|
||||
|
||||
|
||||
|
||||
|
||||
int JKQTPColumnRGBMathImage::getModifierColumn() const
|
||||
{
|
||||
return this->modifierColumn;
|
||||
}
|
||||
|
||||
void JKQTPColumnRGBMathImage::setModifierColumn(int __value)
|
||||
{
|
||||
this->modifierColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPColumnRGBMathImage::getImageBColumn() const
|
||||
{
|
||||
return this->imageBColumn;
|
||||
}
|
||||
|
||||
void JKQTPColumnRGBMathImage::setImageBColumn(int __value)
|
||||
{
|
||||
this->imageBColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPColumnRGBMathImage::getImageGColumn() const
|
||||
{
|
||||
return this->imageGColumn;
|
||||
}
|
||||
|
||||
void JKQTPColumnRGBMathImage::setImageGColumn(int __value)
|
||||
{
|
||||
this->imageGColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPColumnRGBMathImage::getImageRColumn() const
|
||||
{
|
||||
return this->imageRColumn;
|
||||
}
|
||||
|
||||
void JKQTPColumnRGBMathImage::setImageRColumn(int __value)
|
||||
{
|
||||
this->imageRColumn = __value;
|
||||
}
|
||||
|
@ -61,344 +61,231 @@ class JKQTP_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
|
||||
/** \copydoc JKQTPImageBase::setParent() */
|
||||
virtual void setParent(JKQTBasePlotter* parent) override;
|
||||
|
||||
|
||||
|
||||
virtual void setData(void* data, void* dataG, void* dataB, int Nx, int Ny, DataType datatype);
|
||||
virtual void setData(void* data, void* dataG, void* dataB, int Nx, int Ny);
|
||||
/** \brief set the plot-data to a given array \a data (red), \a dataG (green), \a dataB (blue) with size \a Nx * \a Ny in row-major ordering and with the given \a datatype */
|
||||
virtual void setData(void* dataR, void* dataG, void* dataB, int Nx, int Ny, DataType datatype);
|
||||
/** \brief set the plot-data to a given array \a data (red), \a dataG (green), \a dataB (blue) with size \a Nx * \a Ny in row-major ordering */
|
||||
virtual void setData(void* dataR, void* dataG, void* dataB, int Nx, int Ny);
|
||||
|
||||
virtual void setData(void* data, int Nx, int Ny, DataType datatype) override;
|
||||
virtual void setData(void* data, int Nx, int Ny) override ;
|
||||
/** \brief set the plot-data to a given array \a data (red) with size \a Nx * \a Ny in row-major ordering and with the given \a datatype */
|
||||
virtual void setData(void* dataR, int Nx, int Ny, DataType datatype) override;
|
||||
/** \brief set the plot-data to a given array \a data (red) with size \a Nx * \a Ny in row-major ordering */
|
||||
virtual void setData(void* dataR, int Nx, int Ny) override ;
|
||||
|
||||
|
||||
/** \brief determine min/max data value of the image */
|
||||
virtual void getDataMinMax(double& imin, double& imax) override;
|
||||
|
||||
|
||||
/*! \copydoc dataG
|
||||
\see see dataG for details */
|
||||
inline virtual void setDataG(void* __value)
|
||||
{
|
||||
this->dataG = __value;
|
||||
}
|
||||
/*! \copydoc dataG
|
||||
\see see dataG for details */
|
||||
inline virtual void* getDataG() const
|
||||
{
|
||||
return this->dataG;
|
||||
}
|
||||
/*! \copydoc datatypeG
|
||||
\see see datatypeG for details */
|
||||
inline virtual void setDatatypeG(const DataType & __value)
|
||||
{
|
||||
this->datatypeG = __value;
|
||||
}
|
||||
/*! \copydoc datatypeG
|
||||
\see see datatypeG for details */
|
||||
inline virtual DataType getDatatypeG() const
|
||||
{
|
||||
return this->datatypeG;
|
||||
}
|
||||
/*! \copydoc dataB
|
||||
\see see dataB for details */
|
||||
inline virtual void setDataB(void* __value)
|
||||
{
|
||||
this->dataB = __value;
|
||||
}
|
||||
/*! \copydoc dataB
|
||||
\see see dataB for details */
|
||||
inline virtual void* getDataB() const
|
||||
{
|
||||
return this->dataB;
|
||||
}
|
||||
/*! \copydoc datatypeB
|
||||
\see see datatypeB for details */
|
||||
inline virtual void setDatatypeB(const DataType & __value)
|
||||
{
|
||||
this->datatypeB = __value;
|
||||
}
|
||||
/*! \copydoc datatypeB
|
||||
\see see datatypeB for details */
|
||||
inline virtual DataType getDatatypeB() const
|
||||
{
|
||||
return this->datatypeB;
|
||||
}
|
||||
/*! \copydoc showColorBar
|
||||
\see see showColorBar for details */
|
||||
inline virtual void setShowColorBar(bool __value)
|
||||
{
|
||||
this->showColorBar = __value;
|
||||
}
|
||||
/*! \copydoc showColorBar
|
||||
\see see showColorBar for details */
|
||||
inline virtual bool getShowColorBar() const
|
||||
{
|
||||
return this->showColorBar;
|
||||
}
|
||||
/*! \copydoc colorBarWidth
|
||||
\see see colorBarWidth for details */
|
||||
inline virtual void setColorBarWidth(int __value)
|
||||
{
|
||||
this->colorBarWidth = __value;
|
||||
}
|
||||
/*! \copydoc colorBarWidth
|
||||
\see see colorBarWidth for details */
|
||||
inline virtual int getColorBarWidth() const
|
||||
{
|
||||
return this->colorBarWidth;
|
||||
}
|
||||
/*! \copydoc colorBarOffset
|
||||
\see see colorBarOffset for details */
|
||||
inline virtual void setColorBarOffset(int __value)
|
||||
{
|
||||
this->colorBarOffset = __value;
|
||||
}
|
||||
/*! \copydoc colorBarOffset
|
||||
\see see colorBarOffset for details */
|
||||
inline virtual int getColorBarOffset() const
|
||||
{
|
||||
return this->colorBarOffset;
|
||||
}
|
||||
/*! \copydoc colorBarRelativeHeight
|
||||
\see see colorBarRelativeHeight for details */
|
||||
inline virtual void setColorBarRelativeHeight(double __value)
|
||||
{
|
||||
this->colorBarRelativeHeight = __value;
|
||||
}
|
||||
/*! \copydoc colorBarRelativeHeight
|
||||
\see see colorBarRelativeHeight for details */
|
||||
inline virtual double getColorBarRelativeHeight() const
|
||||
{
|
||||
return this->colorBarRelativeHeight;
|
||||
}
|
||||
/*! \copydoc imageMin
|
||||
\see see imageMin for details */
|
||||
inline virtual void setImageMin(double __value)
|
||||
{
|
||||
this->imageMin = __value;
|
||||
}
|
||||
/*! \copydoc imageMin
|
||||
\see see imageMin for details */
|
||||
inline virtual double getImageMin() const
|
||||
{
|
||||
return this->imageMin;
|
||||
}
|
||||
inline void setImageMinR(double m) {
|
||||
setImageMin(m);
|
||||
}
|
||||
/*! \copydoc imageMax
|
||||
\see see imageMax for details */
|
||||
inline virtual void setImageMax(double __value)
|
||||
{
|
||||
this->imageMax = __value;
|
||||
}
|
||||
/*! \copydoc imageMax
|
||||
\see see imageMax for details */
|
||||
inline virtual double getImageMax() const
|
||||
{
|
||||
return this->imageMax;
|
||||
}
|
||||
inline void setImageMaxR(double m) {
|
||||
setImageMax(m);
|
||||
}
|
||||
/*! \copydoc imageMinG
|
||||
\see see imageMinG for details */
|
||||
inline virtual void setImageMinG(double __value)
|
||||
{
|
||||
this->imageMinG = __value;
|
||||
}
|
||||
/*! \copydoc imageMinG
|
||||
\see see imageMinG for details */
|
||||
inline virtual double getImageMinG() const
|
||||
{
|
||||
return this->imageMinG;
|
||||
}
|
||||
/*! \copydoc imageMaxG
|
||||
\see see imageMaxG for details */
|
||||
inline virtual void setImageMaxG(double __value)
|
||||
{
|
||||
this->imageMaxG = __value;
|
||||
}
|
||||
/*! \copydoc imageMaxG
|
||||
\see see imageMaxG for details */
|
||||
inline virtual double getImageMaxG() const
|
||||
{
|
||||
return this->imageMaxG;
|
||||
}
|
||||
/*! \copydoc imageMinB
|
||||
\see see imageMinB for details */
|
||||
inline virtual void setImageMinB(double __value)
|
||||
{
|
||||
this->imageMinB = __value;
|
||||
}
|
||||
/*! \copydoc imageMinB
|
||||
\see see imageMinB for details */
|
||||
inline virtual double getImageMinB() const
|
||||
{
|
||||
return this->imageMinB;
|
||||
}
|
||||
/*! \copydoc imageMaxB
|
||||
\see see imageMaxB for details */
|
||||
inline virtual void setImageMaxB(double __value)
|
||||
{
|
||||
this->imageMaxB = __value;
|
||||
}
|
||||
/*! \copydoc imageMaxB
|
||||
\see see imageMaxB for details */
|
||||
inline virtual double getImageMaxB() const
|
||||
{
|
||||
return this->imageMaxB;
|
||||
}
|
||||
/*! \copydoc autoImageRange
|
||||
\see see autoImageRange for details */
|
||||
inline virtual void setAutoImageRange(bool __value)
|
||||
{
|
||||
this->autoImageRange = __value;
|
||||
}
|
||||
/*! \copydoc autoImageRange
|
||||
\see see autoImageRange for details */
|
||||
inline virtual bool getAutoImageRange() const
|
||||
{
|
||||
return this->autoImageRange;
|
||||
}
|
||||
/*! \copydoc imageName
|
||||
\see see imageName for details */
|
||||
inline virtual void setImageName(const QString & __value)
|
||||
{
|
||||
this->imageName = __value;
|
||||
}
|
||||
/*! \copydoc imageName
|
||||
\see see imageName for details */
|
||||
inline virtual QString getImageName() const
|
||||
{
|
||||
return this->imageName;
|
||||
}
|
||||
inline void setImageNameR(const QString& m) {
|
||||
setImageName(m);
|
||||
}
|
||||
/*! \copydoc imageNameG
|
||||
\see see imageNameG for details */
|
||||
inline virtual void setImageNameG(const QString & __value)
|
||||
{
|
||||
this->imageNameG = __value;
|
||||
}
|
||||
/*! \copydoc imageNameG
|
||||
\see see imageNameG for details */
|
||||
inline virtual QString getImageNameG() const
|
||||
{
|
||||
return this->imageNameG;
|
||||
}
|
||||
/*! \copydoc imageNameB
|
||||
\see see imageNameB for details */
|
||||
inline virtual void setImageNameB(const QString & __value)
|
||||
{
|
||||
this->imageNameB = __value;
|
||||
}
|
||||
/*! \copydoc imageNameB
|
||||
\see see imageNameB for details */
|
||||
inline virtual QString getImageNameB() const
|
||||
{
|
||||
return this->imageNameB;
|
||||
}
|
||||
/*! \copydoc imageNameFontName
|
||||
\see see imageNameFontName for details */
|
||||
inline virtual void setImageNameFontName(const QString & __value)
|
||||
{
|
||||
this->imageNameFontName = __value;
|
||||
}
|
||||
/*! \copydoc imageNameFontName
|
||||
\see see imageNameFontName for details */
|
||||
inline virtual QString getImageNameFontName() const
|
||||
{
|
||||
return this->imageNameFontName;
|
||||
}
|
||||
/*! \copydoc imageNameFontSize
|
||||
\see see imageNameFontSize for details */
|
||||
inline virtual void setImageNameFontSize(double __value)
|
||||
{
|
||||
this->imageNameFontSize = __value;
|
||||
}
|
||||
/*! \copydoc imageNameFontSize
|
||||
\see see imageNameFontSize for details */
|
||||
inline virtual double getImageNameFontSize() const
|
||||
{
|
||||
return this->imageNameFontSize;
|
||||
}
|
||||
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
|
||||
inline JKQTPVerticalIndependentAxis* getColorBarRightAxis() { return this->colorBarRightAxis; }
|
||||
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
|
||||
inline JKQTPHorizontalIndependentAxis* getColorBarTopAxis() { return this->colorBarTopAxis; }
|
||||
/*! \brief returns the property colorBarRightAxisG ( \copybrief colorBarRightAxisG ). \details Description of the parameter colorBarRightAxisG is: <BLOCKQUOTE>\copydoc colorBarRightAxisG </BLOCKQUOTE>. \see colorBarRightAxisG for more information */
|
||||
inline JKQTPVerticalIndependentAxis* getColorBarRightAxisG() { return this->colorBarRightAxisG; }
|
||||
/*! \brief returns the property colorBarTopAxisG ( \copybrief colorBarTopAxisG ). \details Description of the parameter colorBarTopAxisG is: <BLOCKQUOTE>\copydoc colorBarTopAxisG </BLOCKQUOTE>. \see colorBarTopAxisG for more information */
|
||||
inline JKQTPHorizontalIndependentAxis* getColorBarTopAxisG() { return this->colorBarTopAxisG; }
|
||||
/*! \brief returns the property colorBarRightAxisB ( \copybrief colorBarRightAxisB ). \details Description of the parameter colorBarRightAxisB is: <BLOCKQUOTE>\copydoc colorBarRightAxisB </BLOCKQUOTE>. \see colorBarRightAxisB for more information */
|
||||
inline JKQTPVerticalIndependentAxis* getColorBarRightAxisB() { return this->colorBarRightAxisB; }
|
||||
/*! \brief returns the property colorBarTopAxisB ( \copybrief colorBarTopAxisB ). \details Description of the parameter colorBarTopAxisB is: <BLOCKQUOTE>\copydoc colorBarTopAxisB </BLOCKQUOTE>. \see colorBarTopAxisB for more information */
|
||||
inline JKQTPHorizontalIndependentAxis* getColorBarTopAxisB() { return this->colorBarTopAxisB; }
|
||||
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
|
||||
inline const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const { return this->colorBarRightAxis; }
|
||||
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
|
||||
inline const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const { return this->colorBarTopAxis; }
|
||||
/*! \brief returns the property colorBarRightAxisG ( \copybrief colorBarRightAxisG ). \details Description of the parameter colorBarRightAxisG is: <BLOCKQUOTE>\copydoc colorBarRightAxisG </BLOCKQUOTE>. \see colorBarRightAxisG for more information */
|
||||
inline const JKQTPVerticalIndependentAxis* getColorBarRightAxisG() const { return this->colorBarRightAxisG; }
|
||||
/*! \brief returns the property colorBarTopAxisG ( \copybrief colorBarTopAxisG ). \details Description of the parameter colorBarTopAxisG is: <BLOCKQUOTE>\copydoc colorBarTopAxisG </BLOCKQUOTE>. \see colorBarTopAxisG for more information */
|
||||
inline const JKQTPHorizontalIndependentAxis* getColorBarTopAxisG() const { return this->colorBarTopAxisG; }
|
||||
/*! \brief returns the property colorBarRightAxisB ( \copybrief colorBarRightAxisB ). \details Description of the parameter colorBarRightAxisB is: <BLOCKQUOTE>\copydoc colorBarRightAxisB </BLOCKQUOTE>. \see colorBarRightAxisB for more information */
|
||||
inline const JKQTPVerticalIndependentAxis* getColorBarRightAxisB() const { return this->colorBarRightAxisB; }
|
||||
/*! \brief returns the property colorBarTopAxisB ( \copybrief colorBarTopAxisB ). \details Description of the parameter colorBarTopAxisB is: <BLOCKQUOTE>\copydoc colorBarTopAxisB </BLOCKQUOTE>. \see colorBarTopAxisB for more information */
|
||||
inline const JKQTPHorizontalIndependentAxis* getColorBarTopAxisB() const { return this->colorBarTopAxisB; }
|
||||
/*! \copydoc colorBarTopVisible
|
||||
\see see colorBarTopVisible for details */
|
||||
inline virtual void setColorBarTopVisible(bool __value)
|
||||
{
|
||||
this->colorBarTopVisible = __value;
|
||||
}
|
||||
/*! \copydoc colorBarTopVisible
|
||||
\see see colorBarTopVisible for details */
|
||||
inline virtual bool getColorBarTopVisible() const
|
||||
{
|
||||
return this->colorBarTopVisible;
|
||||
}
|
||||
/*! \copydoc colorBarRightVisible
|
||||
\see see colorBarRightVisible for details */
|
||||
inline virtual void setColorBarRightVisible(bool __value)
|
||||
{
|
||||
this->colorBarRightVisible = __value;
|
||||
}
|
||||
/*! \copydoc colorBarRightVisible
|
||||
\see see colorBarRightVisible for details */
|
||||
inline virtual bool getColorBarRightVisible() const
|
||||
{
|
||||
return this->colorBarRightVisible;
|
||||
}
|
||||
/*! \copydoc colorbarsSideBySide
|
||||
\see see colorbarsSideBySide for details */
|
||||
inline virtual void setColorbarsSideBySide(bool __value)
|
||||
{
|
||||
this->colorbarsSideBySide = __value;
|
||||
}
|
||||
/*! \copydoc colorbarsSideBySide
|
||||
\see see colorbarsSideBySide for details */
|
||||
inline virtual bool getColorbarsSideBySide() const
|
||||
{
|
||||
return this->colorbarsSideBySide;
|
||||
}
|
||||
/*! \copydoc rgbMode
|
||||
\see see rgbMode for details */
|
||||
inline virtual void setRgbMode(const JKQTPRGBMathImageRGBMode & __value)
|
||||
{
|
||||
this->rgbMode = __value;
|
||||
}
|
||||
/*! \copydoc rgbMode
|
||||
\see see rgbMode for details */
|
||||
inline virtual JKQTPRGBMathImageRGBMode getRgbMode() const
|
||||
{
|
||||
return this->rgbMode;
|
||||
}
|
||||
/*! \copydoc data
|
||||
\see see data for details */
|
||||
virtual void setDataR(void* __value);
|
||||
/*! \copydoc data
|
||||
\see see data for details */
|
||||
void* getDataR() const;
|
||||
/*! \copydoc datatype
|
||||
\see see datatype for details */
|
||||
void setDatatypeR(DataType __value);
|
||||
/*! \copydoc datatype
|
||||
\see see datatype for details */
|
||||
DataType getDatatypeR() const;
|
||||
|
||||
/*! \copydoc dataG
|
||||
\see see dataG for details */
|
||||
virtual void setDataG(void* __value);
|
||||
/*! \copydoc dataG
|
||||
\see see dataG for details */
|
||||
void* getDataG() const;
|
||||
/*! \copydoc datatypeG
|
||||
\see see datatypeG for details */
|
||||
void setDatatypeG(DataType __value);
|
||||
/*! \copydoc datatypeG
|
||||
\see see datatypeG for details */
|
||||
DataType getDatatypeG() const;
|
||||
/*! \copydoc dataB
|
||||
\see see dataB for details */
|
||||
virtual void setDataB(void* __value);
|
||||
/*! \copydoc dataB
|
||||
\see see dataB for details */
|
||||
void* getDataB() const;
|
||||
/*! \copydoc datatypeB
|
||||
\see see datatypeB for details */
|
||||
void setDatatypeB(DataType __value);
|
||||
/*! \copydoc datatypeB
|
||||
\see see datatypeB for details */
|
||||
DataType getDatatypeB() const;
|
||||
/*! \copydoc showColorBar
|
||||
\see see showColorBar for details */
|
||||
void setShowColorBar(bool __value);
|
||||
/*! \copydoc showColorBar
|
||||
\see see showColorBar for details */
|
||||
bool getShowColorBar() const;
|
||||
/*! \copydoc colorBarWidth
|
||||
\see see colorBarWidth for details */
|
||||
void setColorBarWidth(int __value);
|
||||
/*! \copydoc colorBarWidth
|
||||
\see see colorBarWidth for details */
|
||||
int getColorBarWidth() const;
|
||||
/*! \copydoc colorBarOffset
|
||||
\see see colorBarOffset for details */
|
||||
void setColorBarOffset(int __value);
|
||||
/*! \copydoc colorBarOffset
|
||||
\see see colorBarOffset for details */
|
||||
int getColorBarOffset() const;
|
||||
/*! \copydoc colorBarRelativeHeight
|
||||
\see see colorBarRelativeHeight for details */
|
||||
void setColorBarRelativeHeight(double __value);
|
||||
/*! \copydoc colorBarRelativeHeight
|
||||
\see see colorBarRelativeHeight for details */
|
||||
double getColorBarRelativeHeight() const;
|
||||
/*! \copydoc imageMinR
|
||||
\see see imageMinR for details */
|
||||
void setImageMin(double __value);
|
||||
/*! \copydoc imageMinR
|
||||
\see see imageMinR for details */
|
||||
double getImageMin() const;
|
||||
/*! \copydoc imageMinR
|
||||
\see see imageMinR for details */
|
||||
void setImageMinR(double m);
|
||||
/*! \copydoc imageMaxR
|
||||
\see see imageMaxR for details */
|
||||
void setImageMax(double __value);
|
||||
/*! \copydoc imageMaxR
|
||||
\see see imageMaxR for details */
|
||||
double getImageMax() const;
|
||||
/*! \copydoc imageMaxR
|
||||
\see see imageMaxR for details */
|
||||
void setImageMaxR(double m);
|
||||
/*! \copydoc imageMinG
|
||||
\see see imageMinG for details */
|
||||
void setImageMinG(double __value);
|
||||
/*! \copydoc imageMinG
|
||||
\see see imageMinG for details */
|
||||
double getImageMinG() const;
|
||||
/*! \copydoc imageMaxG
|
||||
\see see imageMaxG for details */
|
||||
void setImageMaxG(double __value);
|
||||
/*! \copydoc imageMaxG
|
||||
\see see imageMaxG for details */
|
||||
double getImageMaxG() const;
|
||||
/*! \copydoc imageMinB
|
||||
\see see imageMinB for details */
|
||||
void setImageMinB(double __value);
|
||||
/*! \copydoc imageMinB
|
||||
\see see imageMinB for details */
|
||||
double getImageMinB() const;
|
||||
/*! \copydoc imageMaxB
|
||||
\see see imageMaxB for details */
|
||||
void setImageMaxB(double __value);
|
||||
/*! \copydoc imageMaxB
|
||||
\see see imageMaxB for details */
|
||||
double getImageMaxB() const;
|
||||
/*! \copydoc autoImageRange
|
||||
\see see autoImageRange for details */
|
||||
void setAutoImageRange(bool __value);
|
||||
/*! \copydoc autoImageRange
|
||||
\see see autoImageRange for details */
|
||||
bool getAutoImageRange() const;
|
||||
/*! \copydoc imageName
|
||||
\see see imageName for details */
|
||||
void setImageName(const QString & __value);
|
||||
/*! \copydoc imageName
|
||||
\see see imageName for details */
|
||||
QString getImageName() const;
|
||||
/*! \copydoc imageName
|
||||
\see see imageName for details */
|
||||
QString getImageNameR() const;
|
||||
/*! \copydoc imageName
|
||||
\see see imageName for details */
|
||||
void setImageNameR(const QString& m);
|
||||
/*! \copydoc imageNameG
|
||||
\see see imageNameG for details */
|
||||
void setImageNameG(const QString & __value);
|
||||
/*! \copydoc imageNameG
|
||||
\see see imageNameG for details */
|
||||
QString getImageNameG() const;
|
||||
/*! \copydoc imageNameB
|
||||
\see see imageNameB for details */
|
||||
void setImageNameB(const QString & __value);
|
||||
/*! \copydoc imageNameB
|
||||
\see see imageNameB for details */
|
||||
QString getImageNameB() const;
|
||||
/*! \copydoc imageNameFontName
|
||||
\see see imageNameFontName for details */
|
||||
void setImageNameFontName(const QString & __value);
|
||||
/*! \copydoc imageNameFontName
|
||||
\see see imageNameFontName for details */
|
||||
QString getImageNameFontName() const;
|
||||
/*! \copydoc imageNameFontSize
|
||||
\see see imageNameFontSize for details */
|
||||
void setImageNameFontSize(double __value);
|
||||
/*! \copydoc imageNameFontSize
|
||||
\see see imageNameFontSize for details */
|
||||
double getImageNameFontSize() const;
|
||||
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
|
||||
JKQTPVerticalIndependentAxis* getColorBarRightAxis();
|
||||
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
|
||||
JKQTPHorizontalIndependentAxis* getColorBarTopAxis();
|
||||
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
|
||||
JKQTPVerticalIndependentAxis* getColorBarRightAxisR();
|
||||
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
|
||||
JKQTPHorizontalIndependentAxis *getColorBarTopAxisR();
|
||||
/*! \brief returns the property colorBarRightAxisG ( \copybrief colorBarRightAxisG ). \details Description of the parameter colorBarRightAxisG is: <BLOCKQUOTE>\copydoc colorBarRightAxisG </BLOCKQUOTE>. \see colorBarRightAxisG for more information */
|
||||
JKQTPVerticalIndependentAxis* getColorBarRightAxisG();
|
||||
/*! \brief returns the property colorBarTopAxisG ( \copybrief colorBarTopAxisG ). \details Description of the parameter colorBarTopAxisG is: <BLOCKQUOTE>\copydoc colorBarTopAxisG </BLOCKQUOTE>. \see colorBarTopAxisG for more information */
|
||||
JKQTPHorizontalIndependentAxis* getColorBarTopAxisG();
|
||||
/*! \brief returns the property colorBarRightAxisB ( \copybrief colorBarRightAxisB ). \details Description of the parameter colorBarRightAxisB is: <BLOCKQUOTE>\copydoc colorBarRightAxisB </BLOCKQUOTE>. \see colorBarRightAxisB for more information */
|
||||
JKQTPVerticalIndependentAxis* getColorBarRightAxisB();
|
||||
/*! \brief returns the property colorBarTopAxisB ( \copybrief colorBarTopAxisB ). \details Description of the parameter colorBarTopAxisB is: <BLOCKQUOTE>\copydoc colorBarTopAxisB </BLOCKQUOTE>. \see colorBarTopAxisB for more information */
|
||||
JKQTPHorizontalIndependentAxis* getColorBarTopAxisB();
|
||||
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
|
||||
const JKQTPVerticalIndependentAxis* getColorBarRightAxis() const;
|
||||
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
|
||||
const JKQTPHorizontalIndependentAxis* getColorBarTopAxis() const;
|
||||
/*! \brief returns the property colorBarRightAxis ( \copybrief colorBarRightAxis ). \details Description of the parameter colorBarRightAxis is: <BLOCKQUOTE>\copydoc colorBarRightAxis </BLOCKQUOTE>. \see colorBarRightAxis for more information */
|
||||
const JKQTPVerticalIndependentAxis* getColorBarRightAxisR() const;
|
||||
/*! \brief returns the property colorBarTopAxis ( \copybrief colorBarTopAxis ). \details Description of the parameter colorBarTopAxis is: <BLOCKQUOTE>\copydoc colorBarTopAxis </BLOCKQUOTE>. \see colorBarTopAxis for more information */
|
||||
const JKQTPHorizontalIndependentAxis* getColorBarTopAxisR() const;
|
||||
/*! \brief returns the property colorBarRightAxisG ( \copybrief colorBarRightAxisG ). \details Description of the parameter colorBarRightAxisG is: <BLOCKQUOTE>\copydoc colorBarRightAxisG </BLOCKQUOTE>. \see colorBarRightAxisG for more information */
|
||||
const JKQTPVerticalIndependentAxis* getColorBarRightAxisG() const;
|
||||
/*! \brief returns the property colorBarTopAxisG ( \copybrief colorBarTopAxisG ). \details Description of the parameter colorBarTopAxisG is: <BLOCKQUOTE>\copydoc colorBarTopAxisG </BLOCKQUOTE>. \see colorBarTopAxisG for more information */
|
||||
const JKQTPHorizontalIndependentAxis *getColorBarTopAxisG() const;
|
||||
/*! \brief returns the property colorBarRightAxisB ( \copybrief colorBarRightAxisB ). \details Description of the parameter colorBarRightAxisB is: <BLOCKQUOTE>\copydoc colorBarRightAxisB </BLOCKQUOTE>. \see colorBarRightAxisB for more information */
|
||||
const JKQTPVerticalIndependentAxis* getColorBarRightAxisB() const;
|
||||
/*! \brief returns the property colorBarTopAxisB ( \copybrief colorBarTopAxisB ). \details Description of the parameter colorBarTopAxisB is: <BLOCKQUOTE>\copydoc colorBarTopAxisB </BLOCKQUOTE>. \see colorBarTopAxisB for more information */
|
||||
const JKQTPHorizontalIndependentAxis *getColorBarTopAxisB() const;
|
||||
/*! \copydoc colorBarTopVisible
|
||||
\see see colorBarTopVisible for details */
|
||||
void setColorBarTopVisible(bool __value);
|
||||
/*! \copydoc colorBarTopVisible
|
||||
\see see colorBarTopVisible for details */
|
||||
bool getColorBarTopVisible() const;
|
||||
/*! \copydoc colorBarRightVisible
|
||||
\see see colorBarRightVisible for details */
|
||||
void setColorBarRightVisible(bool __value);
|
||||
/*! \copydoc colorBarRightVisible
|
||||
\see see colorBarRightVisible for details */
|
||||
bool getColorBarRightVisible() const;
|
||||
/*! \copydoc colorbarsSideBySide
|
||||
\see see colorbarsSideBySide for details */
|
||||
void setColorbarsSideBySide(bool __value);
|
||||
/*! \copydoc colorbarsSideBySide
|
||||
\see see colorbarsSideBySide for details */
|
||||
bool getColorbarsSideBySide() const;
|
||||
/*! \copydoc rgbMode
|
||||
\see see rgbMode for details */
|
||||
void setRgbMode(JKQTPRGBMathImageRGBMode __value);
|
||||
/*! \copydoc rgbMode
|
||||
\see see rgbMode for details */
|
||||
JKQTPRGBMathImageRGBMode getRgbMode() const;
|
||||
|
||||
/** \brief return the data of the green channel used for plotting as a QVector<double> in row-major data-ordering */
|
||||
QVector<double> getDataGAsDoubleVector() const;
|
||||
/** \brief return the data of the blue channel used for plotting as a QVector<double> in row-major data-ordering */
|
||||
QVector<double> getDataBAsDoubleVector() const;
|
||||
|
||||
|
||||
@ -441,17 +328,18 @@ class JKQTP_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
|
||||
/** \brief datatype of the data array data */
|
||||
DataType datatypeB;
|
||||
|
||||
/** \brief how to interpret the three data channels red, green and blue */
|
||||
JKQTPRGBMathImageRGBMode rgbMode;
|
||||
|
||||
/** \brief top color bar visible */
|
||||
bool colorBarTopVisible;
|
||||
/** \brief right color bar visible */
|
||||
bool colorBarRightVisible;
|
||||
/** \brief name of the image displayed above color bar (may contain LaTeX markup!) */
|
||||
QString imageName;
|
||||
/** \brief name of the image displayed above color bar (may contain LaTeX markup!) */
|
||||
/** \brief name of the red image channel displayed above color bar (may contain LaTeX markup!) */
|
||||
QString imageNameR;
|
||||
/** \brief name of the green image channel displayed above color bar (may contain LaTeX markup!) */
|
||||
QString imageNameG;
|
||||
/** \brief name of the image displayed above color bar (may contain LaTeX markup!) */
|
||||
/** \brief name of the blue image channel displayed above color bar (may contain LaTeX markup!) */
|
||||
QString imageNameB;
|
||||
/** \brief font name when displaying imageName */
|
||||
QString imageNameFontName;
|
||||
@ -466,17 +354,17 @@ class JKQTP_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
|
||||
double colorBarRelativeHeight;
|
||||
/** \brief indicates whether to estimate min/max of the image automatically */
|
||||
bool autoImageRange;
|
||||
/** \brief image value range minimum */
|
||||
double imageMin;
|
||||
/** \brief image value range maximum */
|
||||
double imageMax;
|
||||
/** \brief image value range minimum */
|
||||
/** \brief red image value range minimum */
|
||||
double imageMinR;
|
||||
/** \brief red image value range maximum */
|
||||
double imageMaxR;
|
||||
/** \brief green image value range minimum */
|
||||
double imageMinG;
|
||||
/** \brief image value range maximum */
|
||||
/** \brief green image value range maximum */
|
||||
double imageMaxG;
|
||||
/** \brief image value range minimum */
|
||||
/** \brief blue image value range minimum */
|
||||
double imageMinB;
|
||||
/** \brief image value range maximum */
|
||||
/** \brief blue image value range maximum */
|
||||
double imageMaxB;
|
||||
/** \brief offset between outside space border and color bar */
|
||||
int colorBarOffset;
|
||||
@ -502,12 +390,17 @@ class JKQTP_LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
|
||||
double internalDataMaxB;
|
||||
|
||||
protected:
|
||||
/** \brief action that calls saveImagePlotAsImage() */
|
||||
QAction* actSaveImage;
|
||||
/** \brief action that calls copyImagePlotAsImage() */
|
||||
QAction* actCopyImage;
|
||||
public:
|
||||
/** \copydoc JKQTPImageBase::setTitle() */
|
||||
virtual void setTitle(const QString& title) override;
|
||||
public slots:
|
||||
/** \brief save the plotted image as a file with \a filename and format \a outputFormat */
|
||||
void saveImagePlotAsImage(const QString &filename=QString(""), const QByteArray &outputFormat=QByteArray());
|
||||
/** \brief copy the plotted image as an image into the clipboard */
|
||||
void copyImagePlotAsImage();
|
||||
};
|
||||
|
||||
@ -544,52 +437,28 @@ class JKQTP_LIB_EXPORT JKQTPColumnRGBMathImage: public JKQTPRGBMathImage {
|
||||
|
||||
/*! \copydoc imageRColumn
|
||||
\see see imageRColumn for details */
|
||||
inline virtual void setImageRColumn(int __value)
|
||||
{
|
||||
this->imageRColumn = __value;
|
||||
}
|
||||
virtual void setImageRColumn(int __value);
|
||||
/*! \copydoc imageRColumn
|
||||
\see see imageRColumn for details */
|
||||
inline virtual int getImageRColumn() const
|
||||
{
|
||||
return this->imageRColumn;
|
||||
}
|
||||
int getImageRColumn() const;
|
||||
/*! \copydoc imageGColumn
|
||||
\see see imageGColumn for details */
|
||||
inline virtual void setImageGColumn(int __value)
|
||||
{
|
||||
this->imageGColumn = __value;
|
||||
}
|
||||
virtual void setImageGColumn(int __value);
|
||||
/*! \copydoc imageGColumn
|
||||
\see see imageGColumn for details */
|
||||
inline virtual int getImageGColumn() const
|
||||
{
|
||||
return this->imageGColumn;
|
||||
}
|
||||
int getImageGColumn() const;
|
||||
/*! \copydoc imageBColumn
|
||||
\see see imageBColumn for details */
|
||||
inline virtual void setImageBColumn(int __value)
|
||||
{
|
||||
this->imageBColumn = __value;
|
||||
}
|
||||
virtual void setImageBColumn(int __value);
|
||||
/*! \copydoc imageBColumn
|
||||
\see see imageBColumn for details */
|
||||
inline virtual int getImageBColumn() const
|
||||
{
|
||||
return this->imageBColumn;
|
||||
}
|
||||
int getImageBColumn() const;
|
||||
/*! \copydoc modifierColumn
|
||||
\see see modifierColumn for details */
|
||||
inline virtual void setModifierColumn(int __value)
|
||||
{
|
||||
this->modifierColumn = __value;
|
||||
}
|
||||
virtual void setModifierColumn(int __value);
|
||||
/*! \copydoc modifierColumn
|
||||
\see see modifierColumn for details */
|
||||
inline virtual int getModifierColumn() const
|
||||
{
|
||||
return this->modifierColumn;
|
||||
}
|
||||
int getModifierColumn() const;
|
||||
/** \copydoc JKQTPGraph::usesColumn() */
|
||||
virtual bool usesColumn(int c) const override;
|
||||
|
||||
|
@ -38,32 +38,17 @@ JKQTPImpulsesHorizontalGraph::JKQTPImpulsesHorizontalGraph(JKQTBasePlotter* pare
|
||||
JKQTPXYGraph(parent)
|
||||
{
|
||||
baseline=0;
|
||||
color=QColor("red");
|
||||
lineWidth=3;
|
||||
parentPlotStyle=-1;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
}
|
||||
drawSymbols=false;
|
||||
initLineStyle(parent, parentPlotStyle);
|
||||
initSymbolStyle(parent, parentPlotStyle);
|
||||
setLineWidth(3);
|
||||
}
|
||||
|
||||
JKQTPImpulsesHorizontalGraph::JKQTPImpulsesHorizontalGraph(JKQTPlotter* parent):
|
||||
JKQTPXYGraph(parent)
|
||||
JKQTPImpulsesHorizontalGraph(parent->getPlotter())
|
||||
{
|
||||
baseline=0;
|
||||
color=QColor("red");
|
||||
lineWidth=3;
|
||||
parentPlotStyle=-1;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
int parentPlotStyle=parent->getNextStyle();
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
}
|
||||
}
|
||||
|
||||
void JKQTPImpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
#ifdef JKQTBP_AUTOTIMER
|
||||
JKQTPAutoOutputTimer jkaaot("JKQTPImpulsesHorizontalGraph::draw");
|
||||
@ -76,10 +61,7 @@ void JKQTPImpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(Qt::SolidLine);
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setCapStyle(Qt::FlatCap);
|
||||
|
||||
int imax=qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
|
||||
@ -107,6 +89,7 @@ void JKQTPImpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
// }
|
||||
//bool first=false;
|
||||
QVector<QLineF> lines;
|
||||
QVector<QPointF> points;
|
||||
intSortData();
|
||||
for (int iii=imin; iii<imax; iii++) {
|
||||
int i=qBound(imin, getDataIndex(iii), imax);
|
||||
@ -118,7 +101,7 @@ void JKQTPImpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
|
||||
lines.append(QLineF(x0, y, x, y));
|
||||
|
||||
points.append(QPointF(x,y));
|
||||
// xold=x;
|
||||
// yold=y;
|
||||
//first=true;
|
||||
@ -126,6 +109,12 @@ void JKQTPImpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
}
|
||||
painter.setPen(p);
|
||||
if (lines.size()>0) painter.drawLines(lines);
|
||||
if (drawSymbols && points.size()>0) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
for (auto& p: points) {
|
||||
plotStyledSymbol(parent, painter, p.x(), p.y());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
drawErrorsAfter(painter);
|
||||
@ -135,19 +124,45 @@ void JKQTPImpulsesHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter,
|
||||
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setStyle(Qt::SolidLine);
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setCapStyle(Qt::FlatCap);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,qMin(parent->pt2px(painter, qMax(.01, lineWidth)), rect.height()/2.0)*parent->getLineWidthMultiplier()));
|
||||
painter.setPen(p);
|
||||
int y=rect.top()+rect.height()/2.0;
|
||||
painter.drawLine(rect.left(), y, rect.right(), y);
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPImpulsesHorizontalGraph::getKeyLabelColor() {
|
||||
return color;
|
||||
QColor JKQTPImpulsesHorizontalGraph::getKeyLabelColor() const {
|
||||
return getLineColor();
|
||||
}
|
||||
|
||||
void JKQTPImpulsesHorizontalGraph::setColor(QColor c)
|
||||
{
|
||||
setLineColor(c);
|
||||
setSymbolColor(c);
|
||||
setSymbolFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
|
||||
c.setAlphaF(0.5);
|
||||
setHighlightingLineColor(c);
|
||||
}
|
||||
|
||||
void JKQTPImpulsesHorizontalGraph::setBaseline(double __value)
|
||||
{
|
||||
this->baseline = __value;
|
||||
}
|
||||
|
||||
double JKQTPImpulsesHorizontalGraph::getBaseline() const
|
||||
{
|
||||
return this->baseline;
|
||||
}
|
||||
|
||||
void JKQTPImpulsesHorizontalGraph::setDrawSymbols(bool __value)
|
||||
{
|
||||
drawSymbols=__value;
|
||||
}
|
||||
|
||||
bool JKQTPImpulsesHorizontalGraph::getDrawSymbols() const
|
||||
{
|
||||
return drawSymbols;
|
||||
}
|
||||
|
||||
|
||||
@ -183,10 +198,7 @@ void JKQTPImpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setStyle(Qt::SolidLine);
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setCapStyle(Qt::FlatCap);
|
||||
|
||||
int imax=qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
|
||||
@ -214,6 +226,7 @@ void JKQTPImpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
else y0=transformY(parent->getYAxis()->getMin());
|
||||
}
|
||||
QVector<QLineF> lines;
|
||||
QVector<QPointF> points;
|
||||
intSortData();
|
||||
for (int iii=imin; iii<imax; iii++) {
|
||||
int i=qBound(imin, getDataIndex(iii), imax);
|
||||
@ -225,7 +238,7 @@ void JKQTPImpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
|
||||
lines.append(QLineF(x, y0, x, y));
|
||||
|
||||
points.append(QPointF(x,y));
|
||||
//xold=x;
|
||||
//yold=y;
|
||||
//first=true;
|
||||
@ -233,6 +246,12 @@ void JKQTPImpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
}
|
||||
painter.setPen(p);
|
||||
if (lines.size()>0) painter.drawLines(lines);
|
||||
if (drawSymbols && points.size()>0) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
for (auto& p: points) {
|
||||
plotStyledSymbol(parent, painter, p.x(), p.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
drawErrorsAfter(painter);
|
||||
@ -242,20 +261,11 @@ void JKQTPImpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
|
||||
|
||||
QPen JKQTPImpulsesHorizontalGraph::getPen(JKQTPEnhancedPainter& painter) const {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
|
||||
return p;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
JKQTPImpulsesHorizontalErrorGraph::JKQTPImpulsesHorizontalErrorGraph(JKQTBasePlotter *parent):
|
||||
JKQTPImpulsesHorizontalGraph(parent), JKQTPXGraphErrors(color, parent)
|
||||
JKQTPImpulsesHorizontalGraph(parent), JKQTPXGraphErrors(getLineColor(), parent)
|
||||
{
|
||||
setErrorColorFromGraphColor(color);
|
||||
setErrorColorFromGraphColor(getLineColor());
|
||||
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
|
||||
|
||||
}
|
||||
@ -278,9 +288,9 @@ void JKQTPImpulsesHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &pa
|
||||
}
|
||||
|
||||
JKQTPImpulsesVerticalErrorGraph::JKQTPImpulsesVerticalErrorGraph(JKQTBasePlotter *parent):
|
||||
JKQTPImpulsesVerticalGraph(parent), JKQTPYGraphErrors(color, parent)
|
||||
JKQTPImpulsesVerticalGraph(parent), JKQTPYGraphErrors(getLineColor(), parent)
|
||||
{
|
||||
setErrorColorFromGraphColor(color);
|
||||
setErrorColorFromGraphColor(getLineColor());
|
||||
if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbase.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
|
||||
#ifndef jkqtpgraphsimpulses_H
|
||||
#define jkqtpgraphsimpulses_H
|
||||
@ -31,7 +32,7 @@
|
||||
|
||||
\image html plot_impulsesxplots.png
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPImpulsesHorizontalGraph: public JKQTPXYGraph {
|
||||
class JKQTP_LIB_EXPORT JKQTPImpulsesHorizontalGraph: public JKQTPXYGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphSymbolStyleMixin{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
@ -44,58 +45,37 @@ class JKQTP_LIB_EXPORT JKQTPImpulsesHorizontalGraph: public JKQTPXYGraph {
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() override;
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
inline virtual void setBaseline(double __value)
|
||||
{
|
||||
this->baseline = __value;
|
||||
}
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
inline virtual double getBaseline() const
|
||||
{
|
||||
return this->baseline;
|
||||
}
|
||||
/*! \brief color of symbols and impulses in one call */
|
||||
virtual void setColor(QColor c);
|
||||
|
||||
/** \brief color of the graph */
|
||||
QColor color;
|
||||
/** \brief width (pixels) of the lines */
|
||||
double lineWidth;
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
void setBaseline(double __value);
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
double getBaseline() const;
|
||||
|
||||
/*! \copydoc drawSymbols
|
||||
\see see drawSymbols for details */
|
||||
void setDrawSymbols(bool __value);
|
||||
/*! \copydoc drawSymbols
|
||||
\see see drawSymbols for details */
|
||||
bool getDrawSymbols() const;
|
||||
|
||||
protected:
|
||||
/** \brief which plot style to use from the parent plotter (via JKQTBasePlotter::getPlotStyle() and JKQTBasePlotter::getNextStyle() ) */
|
||||
int parentPlotStyle;
|
||||
|
||||
/** \brief baseline of the plot (NOTE: 0 is interpreted as until plot border in log-mode!!!)
|
||||
*
|
||||
* \image html jkqtplotter_simpletest_impulsesplot_baseline.png
|
||||
*/
|
||||
double baseline;
|
||||
QPen getPen(JKQTPEnhancedPainter &painter) const;
|
||||
/** \brief indicates whether to draw symbols at the top of the impulse
|
||||
*
|
||||
* \image html jkqtplotter_simpletest_impulsesplot_symbols.png
|
||||
*/
|
||||
bool drawSymbols;
|
||||
};
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
|
||||
#include "jkqtplotter/jkqtpgraphs.h"
|
||||
#include "jkqtplotter/jkqtpgraphsscatter.h"
|
||||
#include "jkqtplotter/jkqtpbaseplotter.h"
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
@ -36,16 +36,14 @@ JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraph(JKQTBasePlotter *pa
|
||||
fdata.varcount=0;
|
||||
function="";
|
||||
parameterColumn=-1;
|
||||
setParams(&fdata);
|
||||
setPlotFunction(&JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunction);
|
||||
setPlotFunctionFunctor(std::bind(&JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &fdata));
|
||||
|
||||
efdata.parser=new JKQTPMathParser();
|
||||
efdata.node=nullptr;
|
||||
efdata.varcount=0;
|
||||
errorFunction="";
|
||||
errorParameterColumn=-1;
|
||||
setErrorParams(&efdata);
|
||||
setErrorPlotFunction(&JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunction);
|
||||
setErrorPlotFunction(std::bind(&JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &efdata));
|
||||
}
|
||||
|
||||
JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraph(JKQTPlotter *parent):
|
||||
@ -61,6 +59,26 @@ JKQTPXParsedFunctionLineGraph::~JKQTPXParsedFunctionLineGraph()
|
||||
delete efdata.parser;
|
||||
}
|
||||
|
||||
void JKQTPXParsedFunctionLineGraph::setFunction(const QString &__value)
|
||||
{
|
||||
this->function = __value;
|
||||
}
|
||||
|
||||
QString JKQTPXParsedFunctionLineGraph::getFunction() const
|
||||
{
|
||||
return this->function;
|
||||
}
|
||||
|
||||
void JKQTPXParsedFunctionLineGraph::setErrorFunction(const QString &__value)
|
||||
{
|
||||
this->errorFunction = __value;
|
||||
}
|
||||
|
||||
QString JKQTPXParsedFunctionLineGraph::getErrorFunction() const
|
||||
{
|
||||
return this->errorFunction;
|
||||
}
|
||||
|
||||
|
||||
void JKQTPXParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
|
||||
{
|
||||
@ -88,8 +106,8 @@ void JKQTPXParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
|
||||
//qDebug()<<"createPlotData(): adding variables: "<<t<<"ms";
|
||||
fdata.node=fdata.parser->parse(function.toStdString());
|
||||
//qDebug()<<"createPlotData(): parsing: "<<timer.elapsed()-t<<"ms";
|
||||
} catch(std::exception& /*E*/) {
|
||||
//qDebug()<<QString("parser error: %1").arg(E.what());
|
||||
} catch(std::exception& E) {
|
||||
qDebug()<<QString("parser error: %1").arg(E.what());
|
||||
}
|
||||
|
||||
//qint64 t0=timer.elapsed();
|
||||
@ -115,10 +133,8 @@ void JKQTPXParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
|
||||
//qDebug()<<QString("parser error: %1").arg(E.what());
|
||||
}
|
||||
|
||||
setParams(&fdata);
|
||||
setPlotFunction(JKQTPXParsedFunctionLineGraphFunction);
|
||||
setErrorParams(&efdata);
|
||||
setErrorPlotFunction(JKQTPXParsedFunctionLineGraphFunction);
|
||||
setPlotFunctionFunctor(std::bind(&JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &fdata));
|
||||
setErrorPlotFunction(std::bind(&JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &efdata));
|
||||
|
||||
//qint64 t=timer.elapsed();
|
||||
JKQTPXFunctionLineGraph::createPlotData(false);
|
||||
@ -134,8 +150,8 @@ void JKQTPXParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
|
||||
}
|
||||
|
||||
|
||||
double JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunction(double x, void* data) {
|
||||
JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunctionData* d=static_cast<JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunctionData*>(data);
|
||||
double JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunction(double x, void* /*data*/, JKQTPXParsedFunctionLineGraphFunctionData *fdata) {
|
||||
JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunctionData* d=fdata;//static_cast<JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunctionData*>(data);
|
||||
if (d && d->parser && d->node) {
|
||||
try {
|
||||
d->parser->addVariableDouble("x", x);
|
||||
@ -148,8 +164,8 @@ double JKQTPXParsedFunctionLineGraph::JKQTPXParsedFunctionLineGraphFunction(doub
|
||||
return r.num;
|
||||
}
|
||||
}
|
||||
} catch(std::exception& /*E*/) {
|
||||
//qDebug()<<QString("parser error: %1").arg(E.what());
|
||||
} catch(std::exception& E) {
|
||||
qDebug()<<QString("parser error: %1").arg(E.what());
|
||||
/*ok= QMessageBox::critical(this, tr("QuickFit-table"),
|
||||
tr("An error occured while parsing the expression '%1' in cell (row, column)=(%3, %4):\n%2\n\n\"OK\" will still go on evaluating\n\"Cancel\" will cancel evaluation for the rest of the cells.").arg(dlgMathExpression->getExpression()).arg(E.what()).arg(row).arg(column),
|
||||
QMessageBox::Ok|QMessageBox::Cancel, QMessageBox::Ok)==QMessageBox::Ok;*/
|
||||
@ -184,16 +200,14 @@ JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraph(JKQTBasePlotter *pa
|
||||
fdata.varcount=0;
|
||||
function="";
|
||||
parameterColumn=-1;
|
||||
setParams(&fdata);
|
||||
setPlotFunction(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction);
|
||||
setPlotFunctionFunctor(std::bind(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &fdata));
|
||||
|
||||
efdata.parser=new JKQTPMathParser();
|
||||
efdata.node=nullptr;
|
||||
efdata.varcount=0;
|
||||
errorFunction="";
|
||||
errorParameterColumn=-1;
|
||||
setErrorParams(&efdata);
|
||||
setErrorPlotFunction(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction);
|
||||
setErrorPlotFunction(std::bind(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &efdata));
|
||||
}
|
||||
|
||||
JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraph(JKQTPlotter *parent):
|
||||
@ -204,16 +218,14 @@ JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraph(JKQTPlotter *parent
|
||||
fdata.varcount=0;
|
||||
function="";
|
||||
parameterColumn=-1;
|
||||
setParams(&fdata);
|
||||
setPlotFunction(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction);
|
||||
setPlotFunctionFunctor(std::bind(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &fdata));
|
||||
|
||||
efdata.parser=new JKQTPMathParser();
|
||||
efdata.node=nullptr;
|
||||
efdata.varcount=0;
|
||||
errorFunction="";
|
||||
errorParameterColumn=-1;
|
||||
setErrorParams(&efdata);
|
||||
setErrorPlotFunction(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction);
|
||||
setErrorPlotFunction(std::bind(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &efdata));
|
||||
}
|
||||
|
||||
JKQTPYParsedFunctionLineGraph::~JKQTPYParsedFunctionLineGraph()
|
||||
@ -224,6 +236,26 @@ JKQTPYParsedFunctionLineGraph::~JKQTPYParsedFunctionLineGraph()
|
||||
delete efdata.parser;
|
||||
}
|
||||
|
||||
void JKQTPYParsedFunctionLineGraph::setFunction(const QString &__value)
|
||||
{
|
||||
this->function = __value;
|
||||
}
|
||||
|
||||
QString JKQTPYParsedFunctionLineGraph::getFunction() const
|
||||
{
|
||||
return this->function;
|
||||
}
|
||||
|
||||
void JKQTPYParsedFunctionLineGraph::setErrorFunction(const QString &__value)
|
||||
{
|
||||
this->errorFunction = __value;
|
||||
}
|
||||
|
||||
QString JKQTPYParsedFunctionLineGraph::getErrorFunction() const
|
||||
{
|
||||
return this->errorFunction;
|
||||
}
|
||||
|
||||
void JKQTPYParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
|
||||
{
|
||||
collectParameters();
|
||||
@ -251,8 +283,8 @@ void JKQTPYParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
|
||||
//qDebug()<<"createPlotData(): adding variables: "<<t<<"ms";
|
||||
fdata.node=fdata.parser->parse(function.toStdString());
|
||||
//qDebug()<<"createPlotData(): parsing: "<<timer.elapsed()-t<<"ms";
|
||||
} catch(std::exception& /*E*/) {
|
||||
//qDebug()<<QString("parser error: %1").arg(E.what());
|
||||
} catch(std::exception& E) {
|
||||
qDebug()<<QString("parser error: %1").arg(E.what());
|
||||
}
|
||||
|
||||
//qint64 t0=timer.elapsed();
|
||||
@ -275,14 +307,12 @@ void JKQTPYParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
|
||||
//qDebug()<<"createPlotData(): adding variables: "<<t-t0<<"ms";
|
||||
efdata.node=efdata.parser->parse(errorFunction.toStdString());
|
||||
//qDebug()<<"createPlotData(): parsing: "<<timer.elapsed()-t<<"ms";
|
||||
} catch(std::exception& /*E*/) {
|
||||
//qDebug()<<QString("parser error: %1").arg(E.what());
|
||||
} catch(std::exception& E) {
|
||||
qDebug()<<QString("parser error: %1").arg(E.what());
|
||||
}
|
||||
|
||||
setParams(&fdata);
|
||||
setPlotFunction(JKQTPYParsedFunctionLineGraphFunction);
|
||||
setErrorParams(&efdata);
|
||||
setErrorPlotFunction(JKQTPYParsedFunctionLineGraphFunction);
|
||||
setPlotFunctionFunctor(std::bind(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &fdata));
|
||||
setErrorPlotFunction(std::bind(&JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction, std::placeholders::_1, std::placeholders::_2, &efdata));
|
||||
|
||||
//qint64 t=timer.elapsed();
|
||||
JKQTPYFunctionLineGraph::createPlotData(false);
|
||||
@ -297,8 +327,8 @@ void JKQTPYParsedFunctionLineGraph::createPlotData(bool /*collectParams*/)
|
||||
qDebug()<<"refined to "<<count<<" daatapoints";*/
|
||||
}
|
||||
|
||||
double JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction(double x, void* data) {
|
||||
JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunctionData* d=static_cast<JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunctionData*>(data);
|
||||
double JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunction(double x, void* /*data*/, JKQTPYParsedFunctionLineGraphFunctionData *fdata) {
|
||||
JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunctionData* d=fdata;//static_cast<JKQTPYParsedFunctionLineGraph::JKQTPYParsedFunctionLineGraphFunctionData*>(data);
|
||||
if (d && d->parser && d->node) {
|
||||
try {
|
||||
d->parser->addVariableDouble("x", x);
|
||||
|
@ -57,31 +57,19 @@ class JKQTP_LIB_EXPORT JKQTPXParsedFunctionLineGraph: public JKQTPXFunctionLineG
|
||||
/** \brief class destructor */
|
||||
virtual ~JKQTPXParsedFunctionLineGraph() override;
|
||||
|
||||
/*! \copydoc function
|
||||
/*! \copydoc function
|
||||
\see see function for details */
|
||||
inline virtual void setFunction(const QString & __value)
|
||||
{
|
||||
this->function = __value;
|
||||
}
|
||||
/*! \copydoc function
|
||||
void setFunction(const QString & __value);
|
||||
/*! \copydoc function
|
||||
\see see function for details */
|
||||
inline virtual QString getFunction() const
|
||||
{
|
||||
return this->function;
|
||||
}
|
||||
QString getFunction() const;
|
||||
|
||||
/*! \copydoc errorFunction
|
||||
/*! \copydoc errorFunction
|
||||
\see see errorFunction for details */
|
||||
inline virtual void setErrorFunction(const QString & __value)
|
||||
{
|
||||
this->errorFunction = __value;
|
||||
}
|
||||
/*! \copydoc errorFunction
|
||||
void setErrorFunction(const QString & __value);
|
||||
/*! \copydoc errorFunction
|
||||
\see see errorFunction for details */
|
||||
inline virtual QString getErrorFunction() const
|
||||
{
|
||||
return this->errorFunction;
|
||||
}
|
||||
QString getErrorFunction() const;
|
||||
|
||||
/** \brief INTERNAL data structure
|
||||
* \internal
|
||||
@ -102,7 +90,7 @@ class JKQTP_LIB_EXPORT JKQTPXParsedFunctionLineGraph: public JKQTPXFunctionLineG
|
||||
JKQTPXParsedFunctionLineGraphFunctionData efdata;
|
||||
|
||||
// hide functions that should not be used in this class!
|
||||
using JKQTPXFunctionLineGraph::setPlotFunction;
|
||||
using JKQTPXFunctionLineGraph::setPlotFunctionFunctor;
|
||||
using JKQTPXFunctionLineGraph::setParams;
|
||||
using JKQTPXFunctionLineGraph::setErrorPlotFunction;
|
||||
using JKQTPXFunctionLineGraph::setErrorParams;
|
||||
@ -111,7 +99,7 @@ class JKQTP_LIB_EXPORT JKQTPXParsedFunctionLineGraph: public JKQTPXFunctionLineG
|
||||
virtual void createPlotData(bool collectParams=true) override;
|
||||
|
||||
/** \brief implements the actual plot function */
|
||||
static double JKQTPXParsedFunctionLineGraphFunction(double x, void *data) ;
|
||||
static double JKQTPXParsedFunctionLineGraphFunction(double x, void *data, JKQTPXParsedFunctionLineGraphFunctionData* fdata) ;
|
||||
};
|
||||
|
||||
|
||||
@ -139,31 +127,19 @@ class JKQTP_LIB_EXPORT JKQTPYParsedFunctionLineGraph: public JKQTPYFunctionLineG
|
||||
/** \brief class destructor */
|
||||
virtual ~JKQTPYParsedFunctionLineGraph() override;
|
||||
|
||||
/*! \copydoc function
|
||||
/*! \copydoc function
|
||||
\see see function for details */
|
||||
inline virtual void setFunction(const QString & __value)
|
||||
{
|
||||
this->function = __value;
|
||||
}
|
||||
/*! \copydoc function
|
||||
void setFunction(const QString & __value);
|
||||
/*! \copydoc function
|
||||
\see see function for details */
|
||||
inline virtual QString getFunction() const
|
||||
{
|
||||
return this->function;
|
||||
}
|
||||
QString getFunction() const;
|
||||
|
||||
/*! \copydoc errorFunction
|
||||
/*! \copydoc errorFunction
|
||||
\see see errorFunction for details */
|
||||
inline virtual void setErrorFunction(const QString & __value)
|
||||
{
|
||||
this->errorFunction = __value;
|
||||
}
|
||||
/*! \copydoc errorFunction
|
||||
void setErrorFunction(const QString & __value);
|
||||
/*! \copydoc errorFunction
|
||||
\see see errorFunction for details */
|
||||
inline virtual QString getErrorFunction() const
|
||||
{
|
||||
return this->errorFunction;
|
||||
}
|
||||
QString getErrorFunction() const;
|
||||
|
||||
/** \brief INTERNAL data structure
|
||||
* \internal
|
||||
@ -184,7 +160,7 @@ class JKQTP_LIB_EXPORT JKQTPYParsedFunctionLineGraph: public JKQTPYFunctionLineG
|
||||
JKQTPYParsedFunctionLineGraphFunctionData efdata;
|
||||
|
||||
// hide functions that should not be used in this class!
|
||||
using JKQTPXFunctionLineGraph::setPlotFunction;
|
||||
using JKQTPXFunctionLineGraph::setPlotFunctionFunctor;
|
||||
using JKQTPXFunctionLineGraph::setParams;
|
||||
using JKQTPXFunctionLineGraph::setErrorPlotFunction;
|
||||
using JKQTPXFunctionLineGraph::setErrorParams;
|
||||
@ -192,6 +168,6 @@ class JKQTP_LIB_EXPORT JKQTPYParsedFunctionLineGraph: public JKQTPYFunctionLineG
|
||||
/** \brief fill the data array with data from the function plotFunction */
|
||||
virtual void createPlotData(bool collectParams=true) override;
|
||||
/** \brief implements the actual plot function */
|
||||
static double JKQTPYParsedFunctionLineGraphFunction(double x, void *data);
|
||||
static double JKQTPYParsedFunctionLineGraphFunction(double x, void *data, JKQTPYParsedFunctionLineGraphFunctionData* fdata);
|
||||
};
|
||||
#endif // jkqtpgraphsparsedfunction_H
|
||||
|
@ -40,25 +40,9 @@ JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(JKQTBasePlotter *parent):
|
||||
yPeaks=true;
|
||||
peakHeight=1;
|
||||
drawBaseline=true;
|
||||
initLineStyle(parent, parentPlotStyle);
|
||||
}
|
||||
|
||||
JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQTBasePlotter *parent):
|
||||
JKQTPSingleColumnGraph(dataColumn, color, Qt::SolidLine, 2.0, parent)
|
||||
{
|
||||
yPeaks=true;
|
||||
this->baseline=baseline;
|
||||
this->peakHeight=peakHeight;
|
||||
drawBaseline=true;
|
||||
}
|
||||
|
||||
JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQTBasePlotter *parent):
|
||||
JKQTPSingleColumnGraph(dataColumn, parent)
|
||||
{
|
||||
yPeaks=true;
|
||||
this->baseline=baseline;
|
||||
this->peakHeight=peakHeight;
|
||||
drawBaseline=true;
|
||||
}
|
||||
|
||||
|
||||
JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(JKQTPlotter *parent):
|
||||
@ -66,23 +50,6 @@ JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(JKQTPlotter *parent):
|
||||
{
|
||||
}
|
||||
|
||||
JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQTPlotter *parent):
|
||||
JKQTPSingleColumnGraph(dataColumn, color, Qt::SolidLine, 2.0, parent)
|
||||
{
|
||||
yPeaks=true;
|
||||
this->baseline=baseline;
|
||||
this->peakHeight=peakHeight;
|
||||
drawBaseline=true;
|
||||
}
|
||||
|
||||
JKQTPPeakStreamGraph::JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQTPlotter *parent):
|
||||
JKQTPSingleColumnGraph(dataColumn, parent)
|
||||
{
|
||||
yPeaks=true;
|
||||
this->baseline=baseline;
|
||||
this->peakHeight=peakHeight;
|
||||
drawBaseline=true;
|
||||
}
|
||||
|
||||
bool JKQTPPeakStreamGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
|
||||
{
|
||||
@ -122,7 +89,7 @@ void JKQTPPeakStreamGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=getLinePen(painter);
|
||||
QPen p=getLinePen(painter, parent);
|
||||
p.setCapStyle(Qt::FlatCap);
|
||||
|
||||
int imax=static_cast<int>(datastore->getColumn(static_cast<size_t>(dataColumn)).getRows());
|
||||
@ -144,7 +111,7 @@ void JKQTPPeakStreamGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
intSortData();
|
||||
for (int iii=imin; iii<imax; iii++) {
|
||||
int i=qBound<int>(imin, getDataIndex(static_cast<int>(iii)), imax);
|
||||
const double xv=datastore->get(dataColumn,i);
|
||||
const double xv=datastore->get(dataColumn,static_cast<size_t>(i));
|
||||
if (JKQTPIsOKFloat(xv)) {
|
||||
lines<<QLineF(transform(xv, baseline), transform(xv, baseline+peakHeight));
|
||||
}
|
||||
@ -156,7 +123,7 @@ void JKQTPPeakStreamGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
intSortData();
|
||||
for (int iii=imin; iii<imax; iii++) {
|
||||
int i=qBound<int>(imin, getDataIndex(iii), imax);
|
||||
const double yv=datastore->get(dataColumn,i);
|
||||
const double yv=datastore->get(dataColumn,static_cast<size_t>(i));
|
||||
if (JKQTPIsOKFloat(yv)) {
|
||||
lines<<QLineF(transform(baseline, yv), transform(baseline+peakHeight, yv));
|
||||
}
|
||||
@ -175,7 +142,7 @@ void JKQTPPeakStreamGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
void JKQTPPeakStreamGraph::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter);
|
||||
QPen p=getLinePen(painter, parent);
|
||||
painter.setPen(p);
|
||||
if (yPeaks) {
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,qMin(parent->pt2px(painter, p.widthF()), rect.width()/10.0)));
|
||||
@ -202,6 +169,56 @@ void JKQTPPeakStreamGraph::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &
|
||||
|
||||
}
|
||||
|
||||
QColor JKQTPPeakStreamGraph::getKeyLabelColor() const
|
||||
{
|
||||
return getLineColor();
|
||||
}
|
||||
|
||||
void JKQTPPeakStreamGraph::setColor(QColor col)
|
||||
{
|
||||
setLineColor(col);
|
||||
}
|
||||
|
||||
void JKQTPPeakStreamGraph::setBaseline(double __value)
|
||||
{
|
||||
this->baseline = __value;
|
||||
}
|
||||
|
||||
double JKQTPPeakStreamGraph::getBaseline() const
|
||||
{
|
||||
return this->baseline;
|
||||
}
|
||||
|
||||
void JKQTPPeakStreamGraph::setPeakHeight(double __value)
|
||||
{
|
||||
this->peakHeight = __value;
|
||||
}
|
||||
|
||||
double JKQTPPeakStreamGraph::getPeakHeight() const
|
||||
{
|
||||
return this->peakHeight;
|
||||
}
|
||||
|
||||
void JKQTPPeakStreamGraph::setYPeaks(bool __value)
|
||||
{
|
||||
this->yPeaks = __value;
|
||||
}
|
||||
|
||||
bool JKQTPPeakStreamGraph::getYPeaks() const
|
||||
{
|
||||
return this->yPeaks;
|
||||
}
|
||||
|
||||
void JKQTPPeakStreamGraph::setDrawBaseline(bool __value)
|
||||
{
|
||||
this->drawBaseline = __value;
|
||||
}
|
||||
|
||||
bool JKQTPPeakStreamGraph::getDrawBaseline() const
|
||||
{
|
||||
return this->drawBaseline;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QPainter>
|
||||
#include <QPair>
|
||||
#include "jkqtplotter/jkqtpgraphsbase.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
|
||||
#ifndef jkqtpgraphspeakstream_H_INCLUDED
|
||||
#define jkqtpgraphspeakstream_H_INCLUDED
|
||||
@ -42,16 +43,12 @@ class JKQTPDatastore;
|
||||
\image html JKQTPPeakStreamGraphY.png "yPeaks=true"
|
||||
\image html JKQTPPeakStreamGraphX.png "yPeaks=false"
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPPeakStreamGraph: public JKQTPSingleColumnGraph {
|
||||
class JKQTP_LIB_EXPORT JKQTPPeakStreamGraph: public JKQTPSingleColumnGraph, public JKQTPGraphLineStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPPeakStreamGraph(JKQTBasePlotter* parent=nullptr);
|
||||
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQTBasePlotter* parent=nullptr);
|
||||
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQTBasePlotter* parent=nullptr);
|
||||
JKQTPPeakStreamGraph(JKQTPlotter* parent);
|
||||
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, QColor color, JKQTPlotter* parent);
|
||||
JKQTPPeakStreamGraph(int dataColumn, double baseline, double peakHeight, JKQTPlotter* parent);
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
*
|
||||
@ -69,55 +66,34 @@ class JKQTP_LIB_EXPORT JKQTPPeakStreamGraph: public JKQTPSingleColumnGraph {
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
|
||||
/*! \copydoc baseline
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
/** \brief set symbol color and fill color at the same time */
|
||||
void setColor(QColor col);
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
inline virtual void setBaseline(double __value)
|
||||
{
|
||||
this->baseline = __value;
|
||||
}
|
||||
/*! \copydoc baseline
|
||||
void setBaseline(double __value);
|
||||
/*! \copydoc baseline
|
||||
\see see baseline for details */
|
||||
inline virtual double getBaseline() const
|
||||
{
|
||||
return this->baseline;
|
||||
}
|
||||
/*! \copydoc peakHeight
|
||||
double getBaseline() const;
|
||||
/*! \copydoc peakHeight
|
||||
\see see peakHeight for details */
|
||||
inline virtual void setPeakHeight(double __value)
|
||||
{
|
||||
this->peakHeight = __value;
|
||||
}
|
||||
/*! \copydoc peakHeight
|
||||
void setPeakHeight(double __value);
|
||||
/*! \copydoc peakHeight
|
||||
\see see peakHeight for details */
|
||||
inline virtual double getPeakHeight() const
|
||||
{
|
||||
return this->peakHeight;
|
||||
}
|
||||
/*! \copydoc yPeaks
|
||||
double getPeakHeight() const;
|
||||
/*! \copydoc yPeaks
|
||||
\see see yPeaks for details */
|
||||
inline virtual void setYPeaks(bool __value)
|
||||
{
|
||||
this->yPeaks = __value;
|
||||
}
|
||||
/*! \copydoc yPeaks
|
||||
void setYPeaks(bool __value);
|
||||
/*! \copydoc yPeaks
|
||||
\see see yPeaks for details */
|
||||
inline virtual bool getYPeaks() const
|
||||
{
|
||||
return this->yPeaks;
|
||||
}
|
||||
/*! \copydoc drawBaseline
|
||||
bool getYPeaks() const;
|
||||
/*! \copydoc drawBaseline
|
||||
\see see drawBaseline for details */
|
||||
inline virtual void setDrawBaseline(bool __value)
|
||||
{
|
||||
this->drawBaseline = __value;
|
||||
}
|
||||
/*! \copydoc drawBaseline
|
||||
void setDrawBaseline(bool __value);
|
||||
/*! \copydoc drawBaseline
|
||||
\see see drawBaseline for details */
|
||||
inline virtual bool getDrawBaseline() const
|
||||
{
|
||||
return this->drawBaseline;
|
||||
}
|
||||
bool getDrawBaseline() const;
|
||||
|
||||
protected:
|
||||
|
||||
|
466
lib/jkqtplotter/jkqtpgraphsrange.cpp
Normal file
@ -0,0 +1,466 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "jkqtplotter/jkqtpgraphsrange.h"
|
||||
#include "jkqtplotter/jkqtpbaseplotter.h"
|
||||
#include <stdlib.h>
|
||||
#include <QDebug>
|
||||
#include <iostream>
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplottertools/jkqtpimagetools.h"
|
||||
#include "jkqtplotter/jkqtpgraphsimage.h"
|
||||
#include "jkqtplotter/jkqtpbaseelements.h"
|
||||
#include "jkqtplotter/jkqtplotter.h"
|
||||
#define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz;
|
||||
|
||||
|
||||
|
||||
|
||||
JKQTPHorizontalRange::JKQTPHorizontalRange(JKQTBasePlotter* parent):
|
||||
JKQTPGraph(parent)
|
||||
{
|
||||
centerColor=QColor("red");
|
||||
centerStyle=Qt::SolidLine;
|
||||
centerLineWidth=2;
|
||||
sizeMin=0;
|
||||
sizeMax=1;
|
||||
unlimitedSizeMin=true;
|
||||
unlimitedSizeMax=true;
|
||||
invertedRange=false;
|
||||
|
||||
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
initLineStyle(parent, parentPlotStyle);
|
||||
initFillStyle(parent, parentPlotStyle);
|
||||
centerColor=parent->getPlotStyle(parentPlotStyle).color();
|
||||
}
|
||||
|
||||
rangeMin=rangeMax=0;
|
||||
rangeCenter=0;
|
||||
plotCenterLine=true;
|
||||
plotRange=true;
|
||||
plotRangeLines=true;
|
||||
fillRange=true;
|
||||
}
|
||||
|
||||
|
||||
JKQTPHorizontalRange::JKQTPHorizontalRange(JKQTPlotter* parent):
|
||||
JKQTPHorizontalRange(parent->getPlotter())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::draw(JKQTPEnhancedPainter& painter) {
|
||||
#ifdef JKQTBP_AUTOTIMER
|
||||
JKQTPAutoOutputTimer jkaaot("JKQTPHorizontalRange::draw");
|
||||
#endif
|
||||
double c=transformY(rangeCenter);
|
||||
double cmi=transformY(rangeMin);
|
||||
double cma=transformY(rangeMax);
|
||||
double smi=transformY(parent->getYAxis()->getMin());
|
||||
double sma=transformY(parent->getYAxis()->getMax());
|
||||
double mi=transformX(parent->getXAxis()->getMin());
|
||||
double ma=transformX(parent->getXAxis()->getMax());
|
||||
if (!unlimitedSizeMin) mi=transformX(sizeMin);
|
||||
if (!unlimitedSizeMax) ma=transformX(sizeMax);
|
||||
//std::cout<<"hor: rangeMin="<<rangeMin<<" -> "<<cmi<<std::endl;
|
||||
//std::cout<<"hor: rangeMax="<<rangeMax<<" -> "<<cma<<std::endl;
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
if (plotRange && (cmi!=cma) && JKQTPIsOKFloat(mi) && JKQTPIsOKFloat(ma)) {
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush nb(Qt::NoBrush);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
QRectF rect(QPointF(mi, cmi), QPointF(ma, cma));
|
||||
if (fillRange) {
|
||||
painter.setPen(np);
|
||||
painter.setBrush(b);
|
||||
if (invertedRange) {
|
||||
if (JKQTPIsOKFloat(cmi)) {
|
||||
QRectF rectl(QPointF(mi, smi), QPointF(ma, cmi));
|
||||
painter.drawRect(rectl);
|
||||
}
|
||||
if (JKQTPIsOKFloat(cma)) {
|
||||
QRectF rectr(QPointF(mi, cma), QPointF(ma, sma));
|
||||
painter.drawRect(rectr);
|
||||
}
|
||||
} else {
|
||||
if (JKQTPIsOKFloat(cmi) && JKQTPIsOKFloat(cma)) painter.drawRect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
//std::cout<<"hor: rangeMin.rect.top="<<rect.top()<<std::endl;
|
||||
//std::cout<<"hor: rangeMax.rect.bottom="<<rect.bottom()<<std::endl;
|
||||
|
||||
if (plotRangeLines && JKQTPIsOKFloat(cmi) && JKQTPIsOKFloat(cma)) {
|
||||
painter.setPen(p);
|
||||
painter.setBrush(nb);
|
||||
painter.drawLine(rect.left(), rect.top(), rect.right(), rect.top());
|
||||
painter.drawLine(rect.left(), rect.bottom(), rect.right(), rect.bottom());
|
||||
}
|
||||
|
||||
}
|
||||
if (plotCenterLine && JKQTPIsOKFloat(c) && JKQTPIsOKFloat(mi) && JKQTPIsOKFloat(ma)) {
|
||||
QPen p=painter.pen();
|
||||
p.setColor(centerColor);
|
||||
p.setStyle(centerStyle);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, centerLineWidth*parent->getLineWidthMultiplier())));
|
||||
painter.setPen(p);
|
||||
painter.drawLine(QLineF(mi, c, ma, c));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush nb(Qt::NoBrush);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
//int y=rect.top()+rect.height()/2.0;
|
||||
if (plotRange) {
|
||||
painter.setPen(np);
|
||||
painter.setBrush(b);
|
||||
if (fillRange) painter.drawRect(rect);
|
||||
painter.setPen(p);
|
||||
painter.setBrush(nb);
|
||||
if (plotRangeLines) {
|
||||
painter.drawLine(rect.left(), rect.top(), rect.right(), rect.top());
|
||||
painter.drawLine(rect.left(), rect.bottom(), rect.right(), rect.bottom());
|
||||
}
|
||||
}
|
||||
|
||||
if (plotCenterLine) {
|
||||
QPen p=painter.pen();
|
||||
p.setColor(centerColor);
|
||||
p.setStyle(centerStyle);
|
||||
painter.setPen(p);
|
||||
int y=rect.top()+rect.height()/2.0;
|
||||
painter.drawLine(rect.left(), y, rect.right(), y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool JKQTPHorizontalRange::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
|
||||
{
|
||||
smallestGreaterZero=minx=maxx=0;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool JKQTPHorizontalRange::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
|
||||
{
|
||||
miny=rangeMin;
|
||||
maxy=rangeMax;
|
||||
smallestGreaterZero=0;
|
||||
if (rangeMin>0) smallestGreaterZero=rangeMin;
|
||||
return true;
|
||||
}
|
||||
|
||||
QColor JKQTPHorizontalRange::getKeyLabelColor() const
|
||||
{
|
||||
return centerColor;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setDrawCenterLineOnly()
|
||||
{
|
||||
plotCenterLine=true;
|
||||
plotRange=false;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setColor(QColor c)
|
||||
{
|
||||
setLineColor(c);
|
||||
centerColor=c;
|
||||
setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
|
||||
}
|
||||
|
||||
|
||||
void JKQTPHorizontalRange::setCenterColor(const QColor &__value)
|
||||
{
|
||||
this->centerColor = __value;
|
||||
}
|
||||
|
||||
QColor JKQTPHorizontalRange::getCenterColor() const
|
||||
{
|
||||
return this->centerColor;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setCenterStyle(const Qt::PenStyle &__value)
|
||||
{
|
||||
this->centerStyle = __value;
|
||||
}
|
||||
|
||||
Qt::PenStyle JKQTPHorizontalRange::getCenterStyle() const
|
||||
{
|
||||
return this->centerStyle;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setCenterLineWidth(double __value)
|
||||
{
|
||||
this->centerLineWidth = __value;
|
||||
}
|
||||
|
||||
double JKQTPHorizontalRange::getCenterLineWidth() const
|
||||
{
|
||||
return this->centerLineWidth;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setRangeMin(double __value)
|
||||
{
|
||||
this->rangeMin = __value;
|
||||
}
|
||||
|
||||
double JKQTPHorizontalRange::getRangeMin() const
|
||||
{
|
||||
return this->rangeMin;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setRangeMax(double __value)
|
||||
{
|
||||
this->rangeMax = __value;
|
||||
}
|
||||
|
||||
double JKQTPHorizontalRange::getRangeMax() const
|
||||
{
|
||||
return this->rangeMax;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setSizeMin(double __value)
|
||||
{
|
||||
this->sizeMin = __value;
|
||||
}
|
||||
|
||||
double JKQTPHorizontalRange::getSizeMin() const
|
||||
{
|
||||
return this->sizeMin;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setSizeMax(double __value)
|
||||
{
|
||||
this->sizeMax = __value;
|
||||
}
|
||||
|
||||
double JKQTPHorizontalRange::getSizeMax() const
|
||||
{
|
||||
return this->sizeMax;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setUnlimitedSizeMin(bool __value)
|
||||
{
|
||||
this->unlimitedSizeMin = __value;
|
||||
}
|
||||
|
||||
bool JKQTPHorizontalRange::getUnlimitedSizeMin() const
|
||||
{
|
||||
return this->unlimitedSizeMin;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setUnlimitedSizeMax(bool __value)
|
||||
{
|
||||
this->unlimitedSizeMax = __value;
|
||||
}
|
||||
|
||||
bool JKQTPHorizontalRange::getUnlimitedSizeMax() const
|
||||
{
|
||||
return this->unlimitedSizeMax;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setRangeCenter(double __value)
|
||||
{
|
||||
this->rangeCenter = __value;
|
||||
}
|
||||
|
||||
double JKQTPHorizontalRange::getRangeCenter() const
|
||||
{
|
||||
return this->rangeCenter;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setPlotCenterLine(bool __value)
|
||||
{
|
||||
this->plotCenterLine = __value;
|
||||
}
|
||||
|
||||
bool JKQTPHorizontalRange::getPlotCenterLine() const
|
||||
{
|
||||
return this->plotCenterLine;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setInvertedRange(bool __value)
|
||||
{
|
||||
this->invertedRange = __value;
|
||||
}
|
||||
|
||||
bool JKQTPHorizontalRange::getInvertedRange() const
|
||||
{
|
||||
return this->invertedRange;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setPlotRange(bool __value)
|
||||
{
|
||||
this->plotRange = __value;
|
||||
}
|
||||
|
||||
bool JKQTPHorizontalRange::getPlotRange() const
|
||||
{
|
||||
return this->plotRange;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setFillRange(bool __value)
|
||||
{
|
||||
this->fillRange = __value;
|
||||
}
|
||||
|
||||
bool JKQTPHorizontalRange::getFillRange() const
|
||||
{
|
||||
return this->fillRange;
|
||||
}
|
||||
|
||||
void JKQTPHorizontalRange::setPlotRangeLines(bool __value)
|
||||
{
|
||||
this->plotRangeLines = __value;
|
||||
}
|
||||
|
||||
bool JKQTPHorizontalRange::getPlotRangeLines() const
|
||||
{
|
||||
return this->plotRangeLines;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
JKQTPVerticalRange::JKQTPVerticalRange(JKQTBasePlotter* parent):
|
||||
JKQTPHorizontalRange(parent)
|
||||
{
|
||||
}
|
||||
|
||||
JKQTPVerticalRange::JKQTPVerticalRange(JKQTPlotter* parent):
|
||||
JKQTPHorizontalRange(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void JKQTPVerticalRange::draw(JKQTPEnhancedPainter& painter) {
|
||||
#ifdef JKQTBP_AUTOTIMER
|
||||
JKQTPAutoOutputTimer jkaaot("JKQTPVerticalRange::draw");
|
||||
#endif
|
||||
double c=transformX(rangeCenter);
|
||||
double cmi=transformX(rangeMin);
|
||||
double cma=transformX(rangeMax);
|
||||
double mi=transformY(parent->getYAxis()->getMin());
|
||||
double ma=transformY(parent->getYAxis()->getMax());
|
||||
double smi=transformX(parent->getXAxis()->getMin());
|
||||
double sma=transformX(parent->getXAxis()->getMax());
|
||||
if (!unlimitedSizeMin) mi=transformY(sizeMin);
|
||||
if (!unlimitedSizeMax) ma=transformY(sizeMax);
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
if (plotRange && (cmi!=cma) && JKQTPIsOKFloat(mi) && JKQTPIsOKFloat(ma)) {
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush nb(Qt::NoBrush);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
QRectF rect(QPointF(cmi, mi), QPointF(cma, ma));
|
||||
if (fillRange) {
|
||||
painter.setPen(np);
|
||||
painter.setBrush(b);
|
||||
if (invertedRange) {
|
||||
if (JKQTPIsOKFloat(cmi)) {
|
||||
QRectF rectl(QPointF(smi,mi), QPointF(cmi,ma));
|
||||
painter.drawRect(rectl);
|
||||
}
|
||||
if (JKQTPIsOKFloat(cma)) {
|
||||
QRectF rectr(QPointF(cma,mi), QPointF(sma,ma));
|
||||
painter.drawRect(rectr);
|
||||
}
|
||||
} else {
|
||||
if (JKQTPIsOKFloat(cmi) && JKQTPIsOKFloat(cma)) painter.drawRect(rect);
|
||||
}
|
||||
}
|
||||
if (plotRangeLines && JKQTPIsOKFloat(cmi) && JKQTPIsOKFloat(cma)) {
|
||||
painter.setPen(p);
|
||||
painter.setBrush(nb);
|
||||
painter.drawLine(rect.left(), rect.top(), rect.left(), rect.bottom());
|
||||
painter.drawLine(rect.right(), rect.top(), rect.right(), rect.bottom());
|
||||
}
|
||||
|
||||
}
|
||||
if (plotCenterLine&& JKQTPIsOKFloat(c) && JKQTPIsOKFloat(ma) && JKQTPIsOKFloat(mi)) {
|
||||
QPen p=painter.pen();
|
||||
p.setColor(centerColor);
|
||||
p.setStyle(centerStyle);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, centerLineWidth*parent->getLineWidthMultiplier())));
|
||||
painter.setPen(p);
|
||||
painter.drawLine(QLineF(c, mi, c, ma));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void JKQTPVerticalRange::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=getLinePen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush nb(Qt::NoBrush);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
//int y=rect.top()+rect.height()/2.0;
|
||||
if (plotRange) {
|
||||
painter.setPen(np);
|
||||
painter.setBrush(b);
|
||||
if (fillRange) painter.drawRect(rect);
|
||||
painter.setPen(p);
|
||||
painter.setBrush(nb);
|
||||
if (plotRangeLines) {
|
||||
painter.drawLine(rect.left(), rect.top(), rect.left(), rect.bottom());
|
||||
painter.drawLine(rect.right(), rect.top(), rect.right(), rect.bottom());
|
||||
}
|
||||
}
|
||||
if (plotCenterLine) {
|
||||
QPen p=painter.pen();
|
||||
p.setColor(centerColor);
|
||||
p.setStyle(centerStyle);
|
||||
painter.setPen(p);
|
||||
int y=rect.left()+rect.width()/2.0;
|
||||
painter.drawLine(y, rect.top(), y, rect.bottom());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool JKQTPVerticalRange::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
|
||||
{
|
||||
minx=rangeMin;
|
||||
maxx=rangeMax;
|
||||
smallestGreaterZero=0;
|
||||
if (rangeMin>0) smallestGreaterZero=rangeMin;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JKQTPVerticalRange::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
|
||||
{
|
||||
smallestGreaterZero=miny=maxy=0;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
242
lib/jkqtplotter/jkqtpgraphsrange.h
Normal file
@ -0,0 +1,242 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
#include <QPair>
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtplottertools/jkqtpdrawingtools.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbase.h"
|
||||
#include "jkqtplottertools/jkqtpenhancedpainter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
#ifndef jkqtpgraphsrange_H
|
||||
#define jkqtpgraphsrange_H
|
||||
|
||||
// forward declarations
|
||||
class JKQTBasePlotter;
|
||||
class JKQTPlotter;
|
||||
class JKQTPCoordinateAxis;
|
||||
class JKQTPDatastore;
|
||||
//class JKQTPColorPaletteTools;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
|
||||
or a range of interest, or the range of good values, ...
|
||||
\ingroup jkqtplotter_diverse
|
||||
|
||||
\image html JKQTPHorizontalRange.png
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPHorizontalRange: public JKQTPGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPHorizontalRange(JKQTBasePlotter* parent=nullptr);
|
||||
/** \brief class constructor */
|
||||
JKQTPHorizontalRange(JKQTPlotter* parent);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
*
|
||||
* The result is given in the two parameters which are call-by-reference parameters!
|
||||
*/
|
||||
bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
|
||||
/** \brief get the maximum and minimum y-value of the graph
|
||||
*
|
||||
* The result is given in the two parameters which are call-by-reference parameters!
|
||||
*/
|
||||
bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
/** \brief disables all drawing features except the centerline */
|
||||
void setDrawCenterLineOnly();
|
||||
|
||||
/*! \brief set the color of the graph (all lines and filling) */
|
||||
virtual void setColor(QColor c);
|
||||
|
||||
/*! \copydoc centerColor
|
||||
\see see centerColor for details */
|
||||
void setCenterColor(const QColor & __value);
|
||||
/*! \copydoc centerColor
|
||||
\see see centerColor for details */
|
||||
QColor getCenterColor() const;
|
||||
/*! \copydoc centerStyle
|
||||
\see see centerStyle for details */
|
||||
void setCenterStyle(const Qt::PenStyle & __value);
|
||||
/*! \copydoc centerStyle
|
||||
\see see centerStyle for details */
|
||||
Qt::PenStyle getCenterStyle() const;
|
||||
/*! \copydoc centerLineWidth
|
||||
\see see centerLineWidth for details */
|
||||
void setCenterLineWidth(double __value);
|
||||
/*! \copydoc centerLineWidth
|
||||
\see see centerLineWidth for details */
|
||||
double getCenterLineWidth() const;
|
||||
/*! \copydoc rangeMin
|
||||
\see see rangeMin for details */
|
||||
void setRangeMin(double __value);
|
||||
/*! \copydoc rangeMin
|
||||
\see see rangeMin for details */
|
||||
double getRangeMin() const;
|
||||
/*! \copydoc rangeMax
|
||||
\see see rangeMax for details */
|
||||
void setRangeMax(double __value);
|
||||
/*! \copydoc rangeMax
|
||||
\see see rangeMax for details */
|
||||
double getRangeMax() const;
|
||||
/*! \copydoc sizeMin
|
||||
\see see sizeMin for details */
|
||||
void setSizeMin(double __value);
|
||||
/*! \copydoc sizeMin
|
||||
\see see sizeMin for details */
|
||||
double getSizeMin() const;
|
||||
/*! \copydoc sizeMax
|
||||
\see see sizeMax for details */
|
||||
void setSizeMax(double __value);
|
||||
/*! \copydoc sizeMax
|
||||
\see see sizeMax for details */
|
||||
double getSizeMax() const;
|
||||
/*! \copydoc unlimitedSizeMin
|
||||
\see see unlimitedSizeMin for details */
|
||||
void setUnlimitedSizeMin(bool __value);
|
||||
/*! \copydoc unlimitedSizeMin
|
||||
\see see unlimitedSizeMin for details */
|
||||
bool getUnlimitedSizeMin() const;
|
||||
/*! \copydoc unlimitedSizeMax
|
||||
\see see unlimitedSizeMax for details */
|
||||
void setUnlimitedSizeMax(bool __value);
|
||||
/*! \copydoc unlimitedSizeMax
|
||||
\see see unlimitedSizeMax for details */
|
||||
bool getUnlimitedSizeMax() const;
|
||||
|
||||
/*! \copydoc rangeCenter
|
||||
\see see rangeCenter for details */
|
||||
void setRangeCenter(double __value);
|
||||
/*! \copydoc rangeCenter
|
||||
\see see rangeCenter for details */
|
||||
double getRangeCenter() const;
|
||||
/*! \copydoc plotCenterLine
|
||||
\see see plotCenterLine for details */
|
||||
void setPlotCenterLine(bool __value);
|
||||
/*! \copydoc plotCenterLine
|
||||
\see see plotCenterLine for details */
|
||||
bool getPlotCenterLine() const;
|
||||
/*! \copydoc invertedRange
|
||||
\see see invertedRange for details */
|
||||
void setInvertedRange(bool __value);
|
||||
/*! \copydoc invertedRange
|
||||
\see see invertedRange for details */
|
||||
bool getInvertedRange() const;
|
||||
/*! \copydoc plotRange
|
||||
\see see plotRange for details */
|
||||
void setPlotRange(bool __value);
|
||||
/*! \copydoc plotRange
|
||||
\see see plotRange for details */
|
||||
bool getPlotRange() const;
|
||||
/*! \copydoc fillRange
|
||||
\see see fillRange for details */
|
||||
void setFillRange(bool __value);
|
||||
/*! \copydoc fillRange
|
||||
\see see fillRange for details */
|
||||
bool getFillRange() const;
|
||||
/*! \copydoc plotRangeLines
|
||||
\see see plotRangeLines for details */
|
||||
void setPlotRangeLines(bool __value);
|
||||
/*! \copydoc plotRangeLines
|
||||
\see see plotRangeLines for details */
|
||||
bool getPlotRangeLines() const;
|
||||
protected:
|
||||
/** \brief min-value of range */
|
||||
double rangeMin;
|
||||
/** \brief max-value of range */
|
||||
double rangeMax;
|
||||
/** \brief where to plot the center line */
|
||||
double rangeCenter;
|
||||
double sizeMin;
|
||||
double sizeMax;
|
||||
bool unlimitedSizeMin;
|
||||
bool unlimitedSizeMax;
|
||||
/** \brief indicates whether to plot a center line */
|
||||
bool plotCenterLine;
|
||||
/** \brief if \c true, fills the parts outside the given range */
|
||||
bool invertedRange;
|
||||
/** \brief if \c true, the range is plotted, if \c false, only the center line is plotted (if \a plotCenterLine is \c true ) */
|
||||
bool plotRange;
|
||||
/** \brief if \c true, draws lines at the range borders \a color */
|
||||
bool plotRangeLines;
|
||||
/** \brief if \c true, this fills the range with \a fillColor */
|
||||
bool fillRange;
|
||||
/** \brief color of the center line graph */
|
||||
QColor centerColor;
|
||||
/** \brief linestyle of the center line graph lines */
|
||||
Qt::PenStyle centerStyle;
|
||||
/** \brief width (pt) of the center line graph, given in pt */
|
||||
double centerLineWidth;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief simply marks a range (and possibly a centerline) in a plot. This may be used to display e.g. mean +/- stddev
|
||||
or a range of interest, or the range of good values, ...
|
||||
\ingroup jkqtplotter_diverse
|
||||
|
||||
\image html JKQTPVerticalRange.png
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPVerticalRange: public JKQTPHorizontalRange {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPVerticalRange(JKQTBasePlotter* parent=nullptr);
|
||||
/** \brief class constructor */
|
||||
JKQTPVerticalRange(JKQTPlotter* parent);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
*
|
||||
* The result is given in the two parameters which are call-by-reference parameters!
|
||||
*/
|
||||
bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
|
||||
/** \brief get the maximum and minimum y-value of the graph
|
||||
*
|
||||
* The result is given in the two parameters which are call-by-reference parameters!
|
||||
*/
|
||||
bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
|
||||
};
|
||||
|
||||
#endif // jkqtpgraphsrange_H
|
1010
lib/jkqtplotter/jkqtpgraphsscatter.cpp
Normal file
472
lib/jkqtplotter/jkqtpgraphsscatter.h
Normal file
@ -0,0 +1,472 @@
|
||||
/*
|
||||
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/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include <QPainter>
|
||||
#include <QPair>
|
||||
#include <functional>
|
||||
#include "jkqtplottertools/jkqtptools.h"
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtplottertools/jkqtpdrawingtools.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbase.h"
|
||||
#include "jkqtplottertools/jkqtpenhancedpainter.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbaseerrors.h"
|
||||
#include "jkqtplotter/jkqtpgraphsrange.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
|
||||
#ifndef jkqtpgraphs_H
|
||||
#define jkqtpgraphs_H
|
||||
|
||||
// forward declarations
|
||||
class JKQTBasePlotter;
|
||||
class JKQTPlotter;
|
||||
class JKQTPCoordinateAxis;
|
||||
class JKQTPDatastore;
|
||||
//class JKQTPColorPaletteTools;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief This implements xy line plots. This also alows to draw symbols at the data points.
|
||||
\ingroup jkqtplotter_linesymbolgraphs_simple
|
||||
|
||||
\image html plot_lineplots.png
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPXYLineGraph: public JKQTPXYGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphSymbolStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPXYLineGraph(JKQTBasePlotter* parent=nullptr);
|
||||
/** \brief class constructor */
|
||||
JKQTPXYLineGraph(JKQTPlotter* parent);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
/*! \copydoc drawLine
|
||||
\see see drawLine for details */
|
||||
void setDrawLine(bool __value);
|
||||
/*! \copydoc drawLine
|
||||
\see see drawLine for details */
|
||||
bool getDrawLine() const;
|
||||
|
||||
/** \brief set color of line and symbol */
|
||||
void setColor(QColor c);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
/** \brief indicates whether to draw a line or not */
|
||||
bool drawLine;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief This implements xy scatter plots (like JKQTPXYLineGraph), but the color and size of the symbols may be taken from a column.
|
||||
\ingroup jkqtplotter_linesymbolgraphs_param
|
||||
|
||||
set the properties sizeColumn and/or colorColumn to change the size and/or color of the symbols according to the values in the column.
|
||||
|
||||
\image html jkqtplotter_simpletest_paramscatterplot.png "Different Styles of Parametrized Scatter/Line Graphs"
|
||||
|
||||
\image html jkqtplotter_simpletest_paramscatterplot_image_star.png "JKQTPXYParametrizedScatterGraph with symbols organized in a grid"
|
||||
|
||||
\note For the size, line width and symbol type columns, you can also set a functor, which converts the column value (optionally based
|
||||
also on the x- and y-location of the data point) into the local symbol size, symbol type or line width. Use the functions
|
||||
setLinewidthColumnFunctor(), setSymbolColumnFunctor() and setSizeColumnFunctor() to set these functors. This feature gives you
|
||||
even more control over the modification of the plot elements. Initially all functors are set to default values, that do not add
|
||||
any additional transformations.
|
||||
\image html JKQTPXYParametrizedScatterGraph_LinewidthFunctor.png
|
||||
\image html JKQTPXYParametrizedScatterGraph_SymbolFunctor.png
|
||||
|
||||
|
||||
\see JKQTPXYParametrizedErrorScatterGraph, \ref JKQTPlotterParamScatter , \ref JKQTPlotterParamScatterImage
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph, public JKQTPColorPaletteTools {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief functor, which converts the value of the symbol column (at a location x,y) into a JKQTPGraphSymbols */
|
||||
typedef std::function<JKQTPGraphSymbols(double x, double y, double symcolumn)> FunctorToSymbol;
|
||||
/** \brief functor, which converts the value of the line width column (at a location x,y) into a line width (in pt) */
|
||||
typedef std::function<double(double x, double y, double widcolumn)> FunctorToWidth;
|
||||
/** \brief functor, which converts the value of the line size column (at a location x,y) into a symbol size (in pt) */
|
||||
typedef std::function<double(double x, double y, double sizecolumn)> FunctorToSize;
|
||||
|
||||
/** \brief class constructor */
|
||||
JKQTPXYParametrizedScatterGraph(JKQTBasePlotter* parent=nullptr);
|
||||
/** \brief class constructor */
|
||||
JKQTPXYParametrizedScatterGraph(JKQTPlotter* parent);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
|
||||
/*! \copydoc sizeColumn
|
||||
\see see sizeColumn for details */
|
||||
void setSizeColumn(int __value);
|
||||
/*! \copydoc sizeColumn
|
||||
\see see sizeColumn for details */
|
||||
void setSizeColumn (size_t __value);
|
||||
/*! \copydoc sizeColumn
|
||||
\see see sizeColumn for details */
|
||||
int getSizeColumn() const;
|
||||
/** \brief defines a functor, which converts a value from the sizeColumn into an actual symbol size in pt
|
||||
*
|
||||
* \code
|
||||
* graph6->setSizeColumnFunctor([](double x, double y, double w) {
|
||||
* return fabs(sin(w/3.0)*25.0);
|
||||
* });
|
||||
* \endcode
|
||||
*
|
||||
* \see setSizeColumnFunctor(), clearSizeColumnFunctor() and getSizeColumnFunctor()
|
||||
*/
|
||||
void setSizeColumnFunctor(FunctorToSize ff);
|
||||
/** \brief defines a standard (1:1) functor, which converts a value from the sizeColumn into an actual symbol size in pt
|
||||
* \see setSizeColumnFunctor(), clearSizeColumnFunctor() and getSizeColumnFunctor()
|
||||
*/
|
||||
void clearSizeColumnFunctor();
|
||||
/** \brief returns the current functor, which converts a value from the sizeColumn into an actual symbol size in pt
|
||||
* \see setSizeColumnFunctor(), clearSizeColumnFunctor() and getSizeColumnFunctor()
|
||||
*/
|
||||
FunctorToSize getSizeColumnFunctor();
|
||||
|
||||
|
||||
/*! \copydoc colorColumn
|
||||
\see see colorColumn for details */
|
||||
void setColorColumn(int __value);
|
||||
/*! \copydoc colorColumn
|
||||
\see see colorColumn for details */
|
||||
int getColorColumn() const;
|
||||
/*! \copydoc colorColumn
|
||||
\see see colorColumn for details */
|
||||
void setColorColumn (size_t __value);
|
||||
|
||||
|
||||
/*! \copydoc symbolColumn
|
||||
\see see symbolColumn for details */
|
||||
void setSymbolColumn(int __value);
|
||||
/*! \copydoc symbolColumn
|
||||
\see see symbolColumn for details */
|
||||
int getSymbolColumn() const;
|
||||
/*! \copydoc symbolColumn
|
||||
\see see symbolColumn for details */
|
||||
void setSymbolColumn (size_t __value);
|
||||
/** \brief defines a functor, which converts a value from the symbolColumn into an actual symbol type
|
||||
*
|
||||
* \code
|
||||
* graph1->setSymbolColumnFunctor([](double x, double y, double sym) -> JKQTPGraphSymbols {
|
||||
* if (sym<Ndata/2) {
|
||||
* return JKQTPGraphSymbols::JKQTPCircle;
|
||||
* } else if (sym>Ndata/2) {
|
||||
* return JKQTPGraphSymbols::JKQTPFilledCircle;
|
||||
* } else {
|
||||
* return JKQTPGraphSymbols::JKQTPPlus;
|
||||
* }
|
||||
* });
|
||||
* \endcode
|
||||
*
|
||||
* \image html JKQTPXYParametrizedScatterGraph_SymbolFunctor.png
|
||||
* \see setSymbolColumnFunctor(), clearSymbolColumnFunctor() and getSymbolColumnFunctor(), setMappedSymbolColumnFunctor(), \ref JKQTPlotterParamScatter
|
||||
*/
|
||||
void setSymbolColumnFunctor(FunctorToSymbol ff);
|
||||
/** \brief defines a standard (1:1) functor, which converts a value from the symbolColumn into an actual symbol type
|
||||
* \image html JKQTPXYParametrizedScatterGraph_SymbolFunctor.png
|
||||
* \see setSymbolColumnFunctor(), clearSymbolColumnFunctor() and getSymbolColumnFunctor(), setMappedSymbolColumnFunctor(), \ref JKQTPlotterParamScatter
|
||||
*/
|
||||
void clearSymbolColumnFunctor();
|
||||
/** \brief defines a special functor, which converts a value from the symbolColumn into an actual symbol type,
|
||||
* where the relation between value and symbol is defined by a map double->symbol
|
||||
*
|
||||
* This generates a special functor, which will convert values to symbols by using the values from the given map
|
||||
* and these rules:
|
||||
* - everything below the smallest value is mapped to the smallest value's symbol
|
||||
* - everything abive the largest value is mapped to the largest value's symbol
|
||||
* - everything in between is mapped to the symbol of the value closest to the actual value
|
||||
* .
|
||||
*
|
||||
* \code
|
||||
* QMap<double, JKQTPGraphSymbols> mapped;
|
||||
* mapped[0]=JKQTPGraphSymbols::JKQTPCircle;
|
||||
* mapped[5]=JKQTPGraphSymbols::JKQTPFilledCircle;
|
||||
* mapped[10]=JKQTPGraphSymbols::JKQTPPlus;
|
||||
* graph1->setMappedSymbolColumnFunctor(mapped);
|
||||
* \endcode
|
||||
*
|
||||
* \see setSymbolColumnFunctor(), clearSymbolColumnFunctor() and getSymbolColumnFunctor(), setMappedSymbolColumnFunctor(), \ref JKQTPlotterParamScatter
|
||||
*/
|
||||
void setMappedSymbolColumnFunctor(const QMap<double, JKQTPGraphSymbols>& symmap);
|
||||
/** \brief returns the current functor, which converts a value from the symbolColumn into an actual symbol type
|
||||
* \see setSymbolColumnFunctor(), clearSymbolColumnFunctor() and getSymbolColumnFunctor(), setMappedSymbolColumnFunctor(), \ref JKQTPlotterParamScatter
|
||||
*/
|
||||
FunctorToSymbol getSymbolColumnFunctor();
|
||||
|
||||
|
||||
/*! \copydoc linewidthColumn
|
||||
\see see linewidthColumn for details */
|
||||
void setLinewidthColumn(int __value);
|
||||
/*! \copydoc linewidthColumn
|
||||
\see see linewidthColumn for details */
|
||||
int getLinewidthColumn() const;
|
||||
/*! \copydoc linewidthColumn
|
||||
\see see linewidthColumn for details */
|
||||
void setLinewidthColumn( size_t __value);
|
||||
/** \brief defines a functor, which converts a value from the symbolColumn into an actual line width in pt
|
||||
*
|
||||
* \code
|
||||
* graph6->setLinewidthColumnFunctor([](double x, double y, double w) {
|
||||
* return fabs(sin(w/3.0)*25.0);
|
||||
* });
|
||||
* \endcode
|
||||
*
|
||||
* \image html JKQTPXYParametrizedScatterGraph_LinewidthFunctor.png
|
||||
*
|
||||
* \see setLinewidthColumnFunctor(), clearLinewidthColumnFunctor() and getLinewidthColumnFunctor(), \ref JKQTPlotterParamScatter
|
||||
*/
|
||||
void setLinewidthColumnFunctor(FunctorToWidth ff);
|
||||
/** \brief defines a standard (1:1) functor, which converts a value from the symbolColumn into an actual line width in pt
|
||||
*
|
||||
* \image html JKQTPXYParametrizedScatterGraph_LinewidthFunctor.png
|
||||
*
|
||||
* \see setLinewidthColumnFunctor(), clearLinewidthColumnFunctor() and getLinewidthColumnFunctor(), \ref JKQTPlotterParamScatter
|
||||
*/
|
||||
void clearLinewidthColumnFunctor();
|
||||
/** \brief returns the current functor, which converts a value from the symbolColumn into an actual line width in pt
|
||||
* \see setLinewidthColumnFunctor(), clearLinewidthColumnFunctor() and getLinewidthColumnFunctor(), \ref JKQTPlotterParamScatter
|
||||
*/
|
||||
FunctorToWidth getLinewidthColumnFunctor();
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \copydoc colorColumnContainsRGB
|
||||
\see see colorColumnContainsRGB for details */
|
||||
void setColorColumnContainsRGB(bool __value);
|
||||
/*! \copydoc colorColumnContainsRGB
|
||||
\see see colorColumnContainsRGB for details */
|
||||
bool getColorColumnContainsRGB() const;
|
||||
|
||||
/*! \copydoc gridModeForSymbolSize
|
||||
\see see gridModeForSymbolSize for details */
|
||||
void setGridModeForSymbolSize(bool __value);
|
||||
/*! \copydoc gridModeForSymbolSize
|
||||
\see see gridModeForSymbolSize for details */
|
||||
bool getGridModeForSymbolSize() const;
|
||||
/*! \copydoc gridDeltaX
|
||||
\see see gridDeltaX for details */
|
||||
void setGridDeltaX(double __value);
|
||||
/*! \copydoc gridDeltaX
|
||||
\see see gridDeltaX for details */
|
||||
double getGridDeltaX() const;
|
||||
/*! \copydoc gridDeltaY
|
||||
\see see gridDeltaY for details */
|
||||
void setGridDeltaY(double __value);
|
||||
/*! \copydoc gridDeltaY
|
||||
\see see gridDeltaY for details */
|
||||
double getGridDeltaY() const;
|
||||
/*! \copydoc gridSymbolFractionSize
|
||||
\see see gridSymbolFractionSize for details */
|
||||
void setGridSymbolFractionSize(double __value);
|
||||
/*! \copydoc gridSymbolFractionSize
|
||||
\see see gridSymbolFractionSize for details */
|
||||
double getGridSymbolFractionSize() const;
|
||||
|
||||
/*! \copydoc symbolFillDerivationMode
|
||||
\see see symbolFillDerivationMode for details */
|
||||
JKQTPColorDerivationMode getSymbolFillDerivationMode() const;
|
||||
/*! \copydoc symbolFillDerivationMode
|
||||
\see see symbolFillDerivationMode for details */
|
||||
void setSymbolFillDerivationMode(JKQTPColorDerivationMode m);
|
||||
|
||||
/** \copydoc JKQTPGraph::setParent() */
|
||||
virtual void setParent(JKQTBasePlotter* parent) override;
|
||||
|
||||
|
||||
/** \copydoc JKQTPGraph::getOutsideSize() */
|
||||
virtual void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace) override;
|
||||
|
||||
/** \copydoc JKQTPGraph::drawOutside() */
|
||||
virtual void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace) override;
|
||||
|
||||
|
||||
/** \brief determine min/max data value of the image */
|
||||
virtual void cbGetDataMinMax(double& imin, double& imax) override;
|
||||
/** \copydoc JKQTPGraph::usesColumn() */
|
||||
virtual bool usesColumn(int c) const override;
|
||||
|
||||
|
||||
virtual double getInternalDataMin() const override;
|
||||
virtual double getInternalDataMax() const override;
|
||||
protected:
|
||||
/** \brief this column contains the symbol size in pt */
|
||||
int sizeColumn;
|
||||
/** \brief this column contains the symbol color */
|
||||
int colorColumn;
|
||||
/** \brief this column contains the symbol type */
|
||||
int symbolColumn;
|
||||
/** \brief this column contains the line width */
|
||||
int linewidthColumn;
|
||||
|
||||
/** \brief if the gridModeForSymbolSize mode is actiavted (true), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
|
||||
bool gridModeForSymbolSize;
|
||||
/** \brief if the gridModeForSymbolSize mode is actiavted (true), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
|
||||
double gridDeltaX;
|
||||
/** \brief if the gridModeForSymbolSize mode is actiavted (true), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
|
||||
double gridDeltaY;
|
||||
/** \brief if the gridModeForSymbolSize mode is actiavted (true), the plot assumes that the scatter symbols are ordered in a grid. It the uses the given griDeltaX and gridDeltaY to calculate the symbol size, so they fill the available space to a fraction gridSymbolFractionSize. */
|
||||
double gridSymbolFractionSize;
|
||||
|
||||
/** \brief if this is true, the value in the colorColumn is converted to an integer, representing a color in ARGB format (as in QRgb) */
|
||||
bool colorColumnContainsRGB;
|
||||
|
||||
/** \brief retrns the local line width for the i-th datapoint */
|
||||
double getLocalLineWidth(int i);
|
||||
/** \brief retrns the local symbol size for the i-th datapoint */
|
||||
double getLocalSymbolSize(int i);
|
||||
/** \brief retrns the local color for the i-th datapoint */
|
||||
QColor getLocalColor(int i) const;
|
||||
/** \brief retrns the local symbol type for the i-th datapoint */
|
||||
JKQTPGraphSymbols getLocalSymbolType(int i);
|
||||
|
||||
|
||||
/** \brief internally used to store the range of the color column */
|
||||
double intColMin;
|
||||
/** \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;
|
||||
|
||||
/** \brief functor, which converts the value of the symbol column (at a location x,y) into a JKQTPGraphSymbols */
|
||||
FunctorToSymbol m_toSymbolFunctor;
|
||||
/** \brief functor, which converts the value of the line width column (at a location x,y) into a line width (in pt) */
|
||||
FunctorToWidth m_toWidthPtFunctor;
|
||||
/** \brief functor, which converts the value of the line size column (at a location x,y) into a symbol size (in pt) */
|
||||
FunctorToSize m_toSizePtFunctor;
|
||||
|
||||
/** \brief helper class for setMappedSymbolColumnFunctor() */
|
||||
struct MappedSymbolFunctor {
|
||||
QMap<double, JKQTPGraphSymbols> mapping;
|
||||
JKQTPXYParametrizedScatterGraph* parent;
|
||||
MappedSymbolFunctor(const QMap<double, JKQTPGraphSymbols>& mapping_, JKQTPXYParametrizedScatterGraph *graph);
|
||||
JKQTPGraphSymbols operator()(double x, double y, double symcolumn) const;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief This implements xy line plots with x and y error indicators.
|
||||
\ingroup jkqtplotter_linesymbolgraphs_simple
|
||||
|
||||
\image html plot_errorbarlineplots.png
|
||||
\image html plot_errorlinelineplots.png
|
||||
\image html plot_errorpolygonlineplots.png
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPXYLineErrorGraph: public JKQTPXYLineGraph, public JKQTPXYGraphErrors {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPXYLineErrorGraph(JKQTBasePlotter* parent=nullptr);
|
||||
/** \brief class constructor */
|
||||
JKQTPXYLineErrorGraph(JKQTPlotter* parent);
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
*
|
||||
* The result is given in the two parameters which are call-by-reference parameters!
|
||||
*/
|
||||
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
|
||||
/** \brief get the maximum and minimum y-value of the graph
|
||||
*
|
||||
* The result is given in the two parameters which are call-by-reference parameters!
|
||||
*/
|
||||
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
|
||||
/** \copydoc JKQTPGraph::usesColumn() */
|
||||
virtual bool usesColumn(int c) const override;
|
||||
|
||||
protected:
|
||||
/** \brief this function is used to plot error inidcators before plotting the graphs. */
|
||||
virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*! \brief This implements xy scatter plots (like JKQTPXYLineGraph), but the color and size of the symbols may be taken from a column. with errorbars
|
||||
\ingroup jkqtplotter_linesymbolgraphs_param
|
||||
|
||||
set the properties sizeColumn and/or colorColumn to change the size and/or color of the symbols according to the values in the column.
|
||||
|
||||
\image html screen_parmetrizedplots_datatable.png
|
||||
|
||||
\see JKQTPXYParametrizedScatterGraph, \ref JKQTPlotterParamScatter
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPXYParametrizedErrorScatterGraph: public JKQTPXYParametrizedScatterGraph, public JKQTPXYGraphErrors {
|
||||
Q_OBJECT
|
||||
public:
|
||||
JKQTPXYParametrizedErrorScatterGraph(JKQTBasePlotter* parent=nullptr);
|
||||
JKQTPXYParametrizedErrorScatterGraph(JKQTPlotter* parent);
|
||||
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
*
|
||||
* The result is given in the two parameters which are call-by-reference parameters!
|
||||
*/
|
||||
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
|
||||
/** \brief get the maximum and minimum y-value of the graph
|
||||
*
|
||||
* The result is given in the two parameters which are call-by-reference parameters!
|
||||
*/
|
||||
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
|
||||
/** \copydoc JKQTPGraph::usesColumn() */
|
||||
virtual bool usesColumn(int c) const override;
|
||||
|
||||
protected:
|
||||
/** \brief this function is used to plot error inidcators before plotting the graphs. */
|
||||
virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) override;
|
||||
|
||||
/** \brief this function can be used to set the color of the error indicators automatically
|
||||
*
|
||||
* return \c true and the colors to use, if applicable, the default implementation returns false */
|
||||
virtual bool intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, int index, QColor& errorColor, QColor& errorFillColor) override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // jkqtpgraphs_H
|
@ -38,29 +38,11 @@
|
||||
JKQTPSingleColumnSymbolsGraph::JKQTPSingleColumnSymbolsGraph(JKQTBasePlotter *parent):
|
||||
JKQTPSingleColumnGraph(parent), seedValue(123456)
|
||||
{
|
||||
color=QColor("red");
|
||||
style=Qt::SolidLine;
|
||||
lineWidth=2;
|
||||
parentPlotStyle=-1;
|
||||
symbolSize=12;
|
||||
symbolWidth=1;
|
||||
symbol=JKQTPNoSymbol;
|
||||
dataDirection=DataDirection::Y;
|
||||
position=0;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
|
||||
int parentPlotStyle=parent->getNextStyle();
|
||||
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;
|
||||
initSymbolStyle(parent, parentPlotStyle);
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +115,7 @@ void JKQTPSingleColumnSymbolsGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
gen.seed(seedValue);
|
||||
std::uniform_real_distribution<> dRandomScatter{position-width/2.0, position+width/2.0};
|
||||
|
||||
const double symSize=parent->pt2px(painter, symbolSize);
|
||||
const double symSize=parent->pt2px(painter, getSymbolSize());
|
||||
|
||||
|
||||
QVector<QPointF> plotSymbols; // collects symbol locations e.g. for BeeSwarmScatter-plots
|
||||
@ -169,7 +151,7 @@ void JKQTPSingleColumnSymbolsGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
}
|
||||
plotSymbols.append(QPointF(x,y));
|
||||
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
|
||||
JKQTPPlotSymbol(painter, x, y, symbol, symSize, parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), color, fillColor);
|
||||
plotStyledSymbol(parent, painter, x, y);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -195,7 +177,7 @@ void JKQTPSingleColumnSymbolsGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
plotSymbols.append(QPointF(x,y));
|
||||
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
|
||||
plotSymbols.append(QPointF(x,y));
|
||||
JKQTPPlotSymbol(painter, x, y, symbol, symSize, parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), color, fillColor);
|
||||
plotStyledSymbol(parent, painter, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -211,39 +193,65 @@ void JKQTPSingleColumnSymbolsGraph::drawKeyMarker(JKQTPEnhancedPainter &painter,
|
||||
{
|
||||
const double minSize=qMin(rect.width(), rect.height());
|
||||
const double maxSize=qMax(rect.width(), rect.height());
|
||||
double symbolSize=parent->pt2px(painter, this->symbolSize);
|
||||
double symbolSize=parent->pt2px(painter, this->getSymbolSize());
|
||||
if (symbolSize>minSize*0.9) symbolSize=minSize*0.9;
|
||||
double symbolWidth=parent->pt2px(painter, this->symbolWidth*parent->getLineWidthMultiplier());
|
||||
double symbolWidth=parent->pt2px(painter, this->getSymbolLineWidth()*parent->getLineWidthMultiplier());
|
||||
if (symbolWidth>0.3*symbolSize) symbolWidth=0.3*symbolSize;
|
||||
double lineWidth=parent->pt2px(painter, this->lineWidth*parent->getLineWidthMultiplier());
|
||||
if (lineWidth>0.5*maxSize) lineWidth=0.5*maxSize;
|
||||
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
p.setColor(getKeyLabelColor());
|
||||
p.setStyle(style);
|
||||
p.setWidthF(lineWidth);
|
||||
QPen p=getSymbolPen(painter, parent);
|
||||
painter.setPen(p);
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, symbol, symbolSize, symbolWidth, getKeyLabelColor(), fillColor);
|
||||
JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, getSymbolType(), symbolSize, symbolWidth, getKeyLabelColor(), getSymbolFillColor());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
QPen JKQTPSingleColumnSymbolsGraph::getSymbolPen(JKQTPEnhancedPainter& painter) const {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*symbolWidth)));
|
||||
p.setStyle(style);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
return p;
|
||||
}
|
||||
|
||||
QBrush JKQTPSingleColumnSymbolsGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
|
||||
QBrush b;
|
||||
b.setColor(fillColor);
|
||||
return b;
|
||||
}
|
||||
|
||||
QColor JKQTPSingleColumnSymbolsGraph::getKeyLabelColor() const
|
||||
{
|
||||
return getSymbolColor();
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnSymbolsGraph::setColor(QColor col)
|
||||
{
|
||||
setSymbolColor(col);
|
||||
setSymbolFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, col));
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnSymbolsGraph::setPosition(double __value)
|
||||
{
|
||||
this->position = __value;
|
||||
}
|
||||
|
||||
double JKQTPSingleColumnSymbolsGraph::getPosition() const
|
||||
{
|
||||
return this->position;
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnSymbolsGraph::setWidth(double __value)
|
||||
{
|
||||
width=__value;
|
||||
}
|
||||
|
||||
double JKQTPSingleColumnSymbolsGraph::getWidth() const
|
||||
{
|
||||
return width;
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnSymbolsGraph::setPositionScatterStyle(JKQTPSingleColumnSymbolsGraph::ScatterStyle __value)
|
||||
{
|
||||
this->positionScatterStyle = __value;
|
||||
}
|
||||
|
||||
JKQTPSingleColumnSymbolsGraph::ScatterStyle JKQTPSingleColumnSymbolsGraph::getPositionScatterStyle() const
|
||||
{
|
||||
return this->positionScatterStyle;
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnSymbolsGraph::setSeedValue(unsigned int val) {
|
||||
seedValue=val;
|
||||
}
|
||||
|
||||
unsigned int JKQTPSingleColumnSymbolsGraph::getSeedValue() const {
|
||||
return seedValue;
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QPainter>
|
||||
#include <QPair>
|
||||
#include "jkqtplotter/jkqtpgraphsbase.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
|
||||
#ifndef jkqtpgraphssinglecolumnsymbols_H_INCLUDED
|
||||
#define jkqtpgraphssinglecolumnsymbols_H_INCLUDED
|
||||
@ -48,7 +49,7 @@
|
||||
\see \ref JKQTPlotterDistributionPlot
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPSingleColumnSymbolsGraph: public JKQTPSingleColumnGraph {
|
||||
class JKQTP_LIB_EXPORT JKQTPSingleColumnSymbolsGraph: public JKQTPSingleColumnGraph, public JKQTPGraphSymbolStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief describes how data from dataColumn of a JKQTPSingleColumnSymbolsGraph positioned at position */
|
||||
@ -78,142 +79,53 @@ class JKQTP_LIB_EXPORT JKQTPSingleColumnSymbolsGraph: public JKQTPSingleColumnGr
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
/** \brief set symbol color and fill color at the same time */
|
||||
void setColor(QColor col);
|
||||
|
||||
/*! \copydoc position
|
||||
/*! \copydoc position
|
||||
\see see position for details */
|
||||
inline virtual void setPosition(double __value)
|
||||
{
|
||||
this->position = __value;
|
||||
}
|
||||
/*! \copydoc position
|
||||
void setPosition(double __value);
|
||||
/*! \copydoc position
|
||||
\see see position for details */
|
||||
inline virtual double getPosition() const
|
||||
{
|
||||
return this->position;
|
||||
}
|
||||
/*! \copydoc width
|
||||
double getPosition() const;
|
||||
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual void setWidth(double __value)
|
||||
{
|
||||
this->width = __value;
|
||||
}
|
||||
/*! \copydoc width
|
||||
void setWidth(double __value);
|
||||
/*! \copydoc width
|
||||
\see see width for details */
|
||||
inline virtual double getWidth() const
|
||||
{
|
||||
return this->width;
|
||||
}
|
||||
double getWidth() const;
|
||||
|
||||
/*! \copydoc dataDirection
|
||||
\see see dataDirection for details */
|
||||
inline virtual void setDataDirection(DataDirection __value)
|
||||
{
|
||||
this->dataDirection = __value;
|
||||
}
|
||||
/*! \copydoc dataDirection
|
||||
\see see dataDirection for details */
|
||||
inline virtual DataDirection getDataDirection() const
|
||||
{
|
||||
return this->dataDirection;
|
||||
}
|
||||
|
||||
/*! \copydoc positionScatterStyle
|
||||
|
||||
/*! \copydoc positionScatterStyle
|
||||
\see see positionScatterStyle for details */
|
||||
inline virtual void setPositionScatterStyle(ScatterStyle __value)
|
||||
{
|
||||
this->positionScatterStyle = __value;
|
||||
}
|
||||
/*! \copydoc positionScatterStyle
|
||||
void setPositionScatterStyle(ScatterStyle __value);
|
||||
/*! \copydoc positionScatterStyle
|
||||
\see see positionScatterStyle for details */
|
||||
inline virtual ScatterStyle getPositionScatterStyle() const
|
||||
{
|
||||
return this->positionScatterStyle;
|
||||
}
|
||||
ScatterStyle getPositionScatterStyle() const;
|
||||
|
||||
|
||||
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc symbol
|
||||
\see see symbol for details */
|
||||
inline virtual void setSymbol(const JKQTPGraphSymbols & __value)
|
||||
{
|
||||
this->symbol = __value;
|
||||
}
|
||||
/*! \copydoc symbol
|
||||
\see see symbol for details */
|
||||
inline virtual JKQTPGraphSymbols getSymbol() const
|
||||
{
|
||||
return this->symbol;
|
||||
}
|
||||
/*! \copydoc symbolWidth
|
||||
\see see symbolWidth for details */
|
||||
inline virtual void setSymbolWidth(double __value)
|
||||
{
|
||||
this->symbolWidth = __value;
|
||||
}
|
||||
/*! \copydoc symbolWidth
|
||||
\see see symbolWidth for details */
|
||||
inline virtual double getSymbolWidth() const
|
||||
{
|
||||
return this->symbolWidth;
|
||||
}
|
||||
/*! \copydoc symbolSize
|
||||
\see see symbolSize for details */
|
||||
inline virtual void setSymbolSize(double __value)
|
||||
{
|
||||
this->symbolSize = __value;
|
||||
}
|
||||
/*! \copydoc symbolSize
|
||||
\see see symbolSize for details */
|
||||
inline virtual double getSymbolSize() const
|
||||
{
|
||||
return this->symbolSize;
|
||||
}
|
||||
/** \copydoc seedValue */
|
||||
inline void setSeedValue(unsigned int val) {
|
||||
seedValue=val;
|
||||
}
|
||||
void setSeedValue(unsigned int val);
|
||||
/** \copydoc seedValue */
|
||||
inline unsigned int getSeedValue() const {
|
||||
return seedValue;
|
||||
}
|
||||
unsigned int getSeedValue() const;
|
||||
protected:
|
||||
/** \brief interpret the data from dataColumn either as X- or Y-data */
|
||||
DataDirection dataDirection;
|
||||
/** \brief missing coordinate, i.e. if the data from \a dataColumn is interpreted as x-values, this is the y-position and vice versa (see DataDirection ) */
|
||||
double position;
|
||||
/** \brief width of data distribution around position for the missing coordinate (see positionScatterStyle and position) */
|
||||
double width;
|
||||
/** \brief how to distribute the datapoints from dataColumn at the location position */
|
||||
ScatterStyle positionScatterStyle;
|
||||
/** \brief color of the graph fill */
|
||||
QColor fillColor;
|
||||
/** \brief which symbol to use for the datapoints */
|
||||
JKQTPGraphSymbols symbol;
|
||||
/** \brief size (diameter in pt) of the symbol for the data points */
|
||||
double symbolSize;
|
||||
/** \brief width (in pt) of the lines used to plot the symbol for the data points */
|
||||
double symbolWidth;
|
||||
/** \brief seed value for the pseudo-random number generator used for drawing.
|
||||
*
|
||||
* This seed is used instead of e.g. the system time to ensure that replotting results in the
|
||||
* same plot every time. ou can set the seed using setSeedvalue() ) */
|
||||
unsigned int seedValue;
|
||||
|
||||
QPen getSymbolPen(JKQTPEnhancedPainter& painter) const;
|
||||
QBrush getBrush(JKQTPEnhancedPainter &painter) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|