diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox
index e5e2e59d65..56785145f4 100644
--- a/doc/dox/examples_and_tutorials.dox
+++ b/doc/dox/examples_and_tutorials.dox
@@ -21,8 +21,8 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
\image html jkqtplotter_simpletest_stepplots_small.png
- | JKQTPStepHorizontalGraph, JKQTPStepVerticalGraph
+ | JKQTPSpecialLineHorizontalGraph, JKQTPSpecialLineVerticalGraph
diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox
index 5834c6c14a..b031fb504c 100644
--- a/doc/dox/whatsnew.dox
+++ b/doc/dox/whatsnew.dox
@@ -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:
- - update: refactoring of the library's directory structure
- new: added QMake-Projects for static and for shared library builds
- - update: refactoring/renaming of API, including the function anming scheme and class names
- new: \ref exampleTutorialProjects "extensive set of Examples and Tutorials"
- - update: massively improved (doxygen-generated) Online-Documentation (http://jkriege2.github.io/JKQtPlotter/index.html) (automatically generated after each commit using ravis CI)
- new: checked builds with continuous integration from AppVeyor: https://ci.appveyor.com/project/jkriege2/jkqtplotter/branch/master
- new/update: support for building with Microsoft Visual Studio (Win), MinGW (Win), GCC (Linux/MacOS)
+ - update: massively improved (doxygen-generated) Online-Documentation (http://jkriege2.github.io/JKQtPlotter/index.html) (automatically generated after each commit using ravis CI)
+ - update: refactoring of the library's directory structure
+ - update: refactoring/renaming of API, including the function anming scheme and class names
- 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 ...)
- Updates to JKQTPlotter:
- - update: \ref JKQTPLOTTER_USERINTERACTION "reworked user interactions API"
- new: added JKQTPSingleColumnSymbolsGraph for single-column data, e.g. drawn as (random) scatter or bee-swar plots
- new: stacked barcharts with JKQTPBarVerticalStackableGraph, JKQTPBarHorizontalStackableGraph
- - deprecated: Removed datarange-feature
- new: use/support of C++11 features (e.g. \c std::function<> and lambda functions in JKQTPXFunctionLineGraph / JKQTPYFunctionLineGraph )
- new: \ref jkqtpopencvinterface "optional OpenCV interface"
- new: \ref jkqtpplotter_styling "Styling System for JKQTPlotter"
- new: added debugging option, which surrounds different regions with visible rectangles (JKQTBasePlotter::enableDebugShowRegionBoxes() )
- - fixed: colorbars at top were positioned over the plot label
- new: frames (plot viewport, key/legend ...) may be rounded off at the corners
- new: diverse new styling options (default font name/size ...)
- new: additionl options for styling coordinate axes
+ - new: Mix-In classes to unify plot styleing functions (setters/getters) in all graphs
+ - new: additional options for graph filling (color gradients, textures, ...) as provided by QBrush
+ - new: added a general feature to JKQTPPlotElement which allows to show a graph in a highlighted state (if supported by the derived graph class!)
+ - new: JKQTPXYParametrizedScatterGraph: added functors to transform column values into symbol type+size and line-width to give even more control
+ - changed: removed old selection-code and replaced by general highlighting feature
+ - changed: JKQTPStepHorizontalGraph has been renamed to JKQTPSpecialLineHorizontalGraph (vertical variants also) and have gained additional features (baseline for filling and drawing of symbols)
+ - changed: filled curve graphs (e.g. JKQTPSpecialLineHorizontalGraph) are now merely a specializedly initialized JKQTPSpecialLineHorizontalGraph
+ - deprecated: Removed datarange-feature
+ - update: \ref JKQTPLOTTER_USERINTERACTION "reworked user interactions API"
+ - fixed: colorbars at top were positioned over the plot label
- fixed: RGB-image plots now work properly with inverted axes (image is inverted, befor image was not shown at all)
- Updates to JKQTMathText:
diff --git a/doc/images/JKQTPDirectLine.png b/doc/images/JKQTPDirectLine.png
new file mode 100644
index 0000000000..901c8b6209
Binary files /dev/null and b/doc/images/JKQTPDirectLine.png differ
diff --git a/doc/images/JKQTPStepAverage.png b/doc/images/JKQTPStepAverage.png
new file mode 100644
index 0000000000..b32ba7eea8
Binary files /dev/null and b/doc/images/JKQTPStepAverage.png differ
diff --git a/doc/images/JKQTPStepCenter.png b/doc/images/JKQTPStepCenter.png
index 25dba73482..8ede28f155 100644
Binary files a/doc/images/JKQTPStepCenter.png and b/doc/images/JKQTPStepCenter.png differ
diff --git a/doc/images/JKQTPStepLeft.png b/doc/images/JKQTPStepLeft.png
index 1b1c8359d6..9c9399f61a 100644
Binary files a/doc/images/JKQTPStepLeft.png and b/doc/images/JKQTPStepLeft.png differ
diff --git a/doc/images/JKQTPStepRight.png b/doc/images/JKQTPStepRight.png
index 7a872bfbd2..d117001d6e 100644
Binary files a/doc/images/JKQTPStepRight.png and b/doc/images/JKQTPStepRight.png differ
diff --git a/doc/images/JKQTPXYParametrizedScatterGraph_LinewidthFunctor.png b/doc/images/JKQTPXYParametrizedScatterGraph_LinewidthFunctor.png
new file mode 100644
index 0000000000..80a85247f7
Binary files /dev/null and b/doc/images/JKQTPXYParametrizedScatterGraph_LinewidthFunctor.png differ
diff --git a/doc/images/JKQTPXYParametrizedScatterGraph_MappedSymbolFunctor.cpt b/doc/images/JKQTPXYParametrizedScatterGraph_MappedSymbolFunctor.cpt
new file mode 100644
index 0000000000..cdfebe906a
Binary files /dev/null and b/doc/images/JKQTPXYParametrizedScatterGraph_MappedSymbolFunctor.cpt differ
diff --git a/doc/images/JKQTPXYParametrizedScatterGraph_MappedSymbolFunctor.png b/doc/images/JKQTPXYParametrizedScatterGraph_MappedSymbolFunctor.png
new file mode 100644
index 0000000000..9de1c22419
Binary files /dev/null and b/doc/images/JKQTPXYParametrizedScatterGraph_MappedSymbolFunctor.png differ
diff --git a/doc/images/JKQTPXYParametrizedScatterGraph_SymbolFunctor.png b/doc/images/JKQTPXYParametrizedScatterGraph_SymbolFunctor.png
new file mode 100644
index 0000000000..2fea354a49
Binary files /dev/null and b/doc/images/JKQTPXYParametrizedScatterGraph_SymbolFunctor.png differ
diff --git a/examples/README.md b/examples/README.md
index c825dd6757..650f627ab1 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -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`
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` external `std::array` data, not owned by datastore live-data, measure plotting speed 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` C++ vector of data setting line styles and symbol styles 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`) C++ vector of data 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` C++ vector of data 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` 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` different styles of error indicators for x- and y-errors C++-style QVector for data styling error indicators 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` C-style arrays of data |
diff --git a/examples/jkqtplot_test/TestWidgetFunctionPlots.cpp b/examples/jkqtplot_test/TestWidgetFunctionPlots.cpp
index 7c6e978b45..0f02ddaab3 100644
--- a/examples/jkqtplot_test/TestWidgetFunctionPlots.cpp
+++ b/examples/jkqtplot_test/TestWidgetFunctionPlots.cpp
@@ -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();
diff --git a/examples/jkqtplot_test/TestWidgetGraphs.cpp b/examples/jkqtplot_test/TestWidgetGraphs.cpp
index 380d6e0467..61cc1506e1 100644
--- a/examples/jkqtplot_test/TestWidgetGraphs.cpp
+++ b/examples/jkqtplot_test/TestWidgetGraphs.cpp
@@ -3,7 +3,7 @@
#include
#include
#include
-#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(plteSymbols);
if (exy) {
- exy->setSymbol(String2JKQTPGraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
+ exy->setSymbolType(String2JKQTPGraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
}
plot->redrawPlot();
diff --git a/examples/jkqtplot_test/TestWidgetImages.cpp b/examples/jkqtplot_test/TestWidgetImages.cpp
index 1eccc1aa9a..7f22bb78b4 100644
--- a/examples/jkqtplot_test/TestWidgetImages.cpp
+++ b/examples/jkqtplot_test/TestWidgetImages.cpp
@@ -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);
diff --git a/examples/jkqtplot_test/TestWidgetPeaksPlots.cpp b/examples/jkqtplot_test/TestWidgetPeaksPlots.cpp
index 50fea44900..38769bdf7a 100644
--- a/examples/jkqtplot_test/TestWidgetPeaksPlots.cpp
+++ b/examples/jkqtplot_test/TestWidgetPeaksPlots.cpp
@@ -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);
diff --git a/examples/simpletest/jkqtplotter_simpletest.cpp b/examples/simpletest/jkqtplotter_simpletest.cpp
index d07edaa7d1..fa03731f0c 100644
--- a/examples/simpletest/jkqtplotter_simpletest.cpp
+++ b/examples/simpletest/jkqtplotter_simpletest.cpp
@@ -6,7 +6,7 @@
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
int main(int argc, char* argv[])
diff --git a/examples/simpletest_barchart/jkqtplotter_simpletest_barchart.cpp b/examples/simpletest_barchart/jkqtplotter_simpletest_barchart.cpp
index 8fb1fbff50..b5bbbfc440 100644
--- a/examples/simpletest_barchart/jkqtplotter_simpletest_barchart.cpp
+++ b/examples/simpletest_barchart/jkqtplotter_simpletest_barchart.cpp
@@ -6,7 +6,7 @@
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
#include "jkqtplotter/jkqtpgraphsbarchart.h"
#define Ndata 5
diff --git a/examples/simpletest_boxplot/README.md b/examples/simpletest_boxplot/README.md
index e96d2deb34..6cbf91738b 100644
--- a/examples/simpletest_boxplot/README.md
+++ b/examples/simpletest_boxplot/README.md
@@ -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);
```
diff --git a/examples/simpletest_boxplot/jkqtplotter_simpletest_boxplot.cpp b/examples/simpletest_boxplot/jkqtplotter_simpletest_boxplot.cpp
index 3ef33a7806..61b07f050c 100644
--- a/examples/simpletest_boxplot/jkqtplotter_simpletest_boxplot.cpp
+++ b/examples/simpletest_boxplot/jkqtplotter_simpletest_boxplot.cpp
@@ -6,7 +6,7 @@
#include
#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);
diff --git a/examples/simpletest_dateaxes/README.md b/examples/simpletest_dateaxes/README.md
index 951fc69b93..db63e90037 100644
--- a/examples/simpletest_dateaxes/README.md
+++ b/examples/simpletest_dateaxes/README.md
@@ -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
diff --git a/examples/simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp b/examples/simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp
index ca3b9be351..21d3b9c5f8 100644
--- a/examples/simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp
+++ b/examples/simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp
@@ -10,7 +10,7 @@
#include
#include
#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
diff --git a/examples/simpletest_errorbarstyles/README.md b/examples/simpletest_errorbarstyles/README.md
index 6ff5a9bd93..733e5b3b29 100644
--- a/examples/simpletest_errorbarstyles/README.md
+++ b/examples/simpletest_errorbarstyles/README.md
@@ -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);
diff --git a/examples/simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.cpp b/examples/simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.cpp
index fdc9486dfe..8973651f80 100644
--- a/examples/simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.cpp
+++ b/examples/simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.cpp
@@ -6,7 +6,7 @@
#include
#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);
diff --git a/examples/simpletest_functionplot/README.md b/examples/simpletest_functionplot/README.md
index 67020a2a6f..087b76e0ce 100644
--- a/examples/simpletest_functionplot/README.md
+++ b/examples/simpletest_functionplot/README.md
@@ -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* p=static_cast*>(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(myDataObject))`):
```.cpp
JKQTPXFunctionLineGraph* func3=new JKQTPXFunctionLineGraph(plot);
- func3->setPlotFunction([](double x, void* params) {
+ func3->setPlotFunctionFunctor([](double x, void* params) {
QMap* p=static_cast*>(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);
```
diff --git a/examples/simpletest_functionplot/jkqtplotter_simpletest_functionplot.cpp b/examples/simpletest_functionplot/jkqtplotter_simpletest_functionplot.cpp
index 1663517c45..55b8d19b35 100644
--- a/examples/simpletest_functionplot/jkqtplotter_simpletest_functionplot.cpp
+++ b/examples/simpletest_functionplot/jkqtplotter_simpletest_functionplot.cpp
@@ -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
JKQTPXFunctionLineGraph* func2=new JKQTPXFunctionLineGraph(plot);
- func2->setPlotFunction([](double x, void* params) {
+ func2->setPlotFunctionFunctor([](double x, void* params) {
QVector* p=static_cast*>(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 QMapsetPlotFunction([](double x, void* params) {
+ func3->setPlotFunctionFunctor([](double x, void* params) {
QMap* p=static_cast*>(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);
diff --git a/examples/simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp b/examples/simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp
index aa568173c2..30961fd550 100644
--- a/examples/simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp
+++ b/examples/simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.cpp
@@ -7,7 +7,7 @@
#include
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpopencvinterface.h"
#include
diff --git a/examples/simpletest_impulsesplot/README.md b/examples/simpletest_impulsesplot/README.md
index e73ac5c18c..dd8409364c 100644
--- a/examples/simpletest_impulsesplot/README.md
+++ b/examples/simpletest_impulsesplot/README.md
@@ -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)
diff --git a/examples/simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.cpp b/examples/simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.cpp
index 96782de6f6..8f532bdc10 100644
--- a/examples/simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.cpp
+++ b/examples/simpletest_impulsesplot/jkqtplotter_simpletest_impulsesplot.cpp
@@ -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);
diff --git a/examples/simpletest_logaxes/README.md b/examples/simpletest_logaxes/README.md
index 064237b4d3..3f91c9e6b0 100644
--- a/examples/simpletest_logaxes/README.md
+++ b/examples/simpletest_logaxes/README.md
@@ -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 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)
diff --git a/examples/simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp b/examples/simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp
index 8278f28274..8d6926154a 100644
--- a/examples/simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp
+++ b/examples/simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp
@@ -6,7 +6,7 @@
#include
#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);
diff --git a/examples/simpletest_parametriccurve/README.md b/examples/simpletest_parametriccurve/README.md
index 7dd03c92b8..bf76f82464 100644
--- a/examples/simpletest_parametriccurve/README.md
+++ b/examples/simpletest_parametriccurve/README.md
@@ -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)$");
diff --git a/examples/simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.cpp b/examples/simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.cpp
index 8d6efd061c..73a33ef508 100644
--- a/examples/simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.cpp
+++ b/examples/simpletest_parametriccurve/jkqtplotter_simpletest_parametriccurve.cpp
@@ -6,7 +6,7 @@
#include
#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)$");
diff --git a/examples/simpletest_paramscatterplot/README.md b/examples/simpletest_paramscatterplot/README.md
index ea04c7199b..99eed041c5 100644
--- a/examples/simpletest_paramscatterplot/README.md
+++ b/examples/simpletest_paramscatterplot/README.md
@@ -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 (symNdata/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 (symNdata/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)
diff --git a/examples/simpletest_paramscatterplot/jkqtplotter_simpletest_paramscatterplot.cpp b/examples/simpletest_paramscatterplot/jkqtplotter_simpletest_paramscatterplot.cpp
index 7d5fe1057d..df7713d43b 100644
--- a/examples/simpletest_paramscatterplot/jkqtplotter_simpletest_paramscatterplot.cpp
+++ b/examples/simpletest_paramscatterplot/jkqtplotter_simpletest_paramscatterplot.cpp
@@ -6,7 +6,7 @@
#include
#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 (symNdata/2) {
+ return JKQTPGraphSymbols::JKQTPFilledCircle;
+ } else {
+ return JKQTPGraphSymbols::JKQTPPlus;
+ }
+ });*/
+ /*QMap 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");
diff --git a/examples/simpletest_paramscatterplot_image/README.md b/examples/simpletest_paramscatterplot_image/README.md
index 0949ba7ec1..fd0726558e 100644
--- a/examples/simpletest_paramscatterplot_image/README.md
+++ b/examples/simpletest_paramscatterplot_image/README.md
@@ -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);
diff --git a/examples/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.cpp b/examples/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.cpp
index 67244b9174..4bcb7af107 100644
--- a/examples/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.cpp
+++ b/examples/simpletest_paramscatterplot_image/jkqtplotter_simpletest_paramscatterplot_image.cpp
@@ -6,7 +6,7 @@
#include
#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);
diff --git a/examples/simpletest_parsedfunctionplot/jkqtplotter_simpletest_parsedfunctionplot.cpp b/examples/simpletest_parsedfunctionplot/jkqtplotter_simpletest_parsedfunctionplot.cpp
index f27143610e..eaec1d1cfa 100644
--- a/examples/simpletest_parsedfunctionplot/jkqtplotter_simpletest_parsedfunctionplot.cpp
+++ b/examples/simpletest_parsedfunctionplot/jkqtplotter_simpletest_parsedfunctionplot.cpp
@@ -10,7 +10,7 @@
#include
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
diff --git a/examples/simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp b/examples/simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp
index 761f647e93..2ccaae6891 100644
--- a/examples/simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp
+++ b/examples/simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp
@@ -7,7 +7,7 @@
#include
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
#include "jkqtplotter/jkqtpgraphsimagergb.h"
#include "jkqtplotter/jkqtpopencvinterface.h"
#include
diff --git a/examples/simpletest_rgbimageplot_qt/jkqtplotter_simpletest_rgbimageplot_qt.cpp b/examples/simpletest_rgbimageplot_qt/jkqtplotter_simpletest_rgbimageplot_qt.cpp
index 2e8dfb8abc..194a776d83 100644
--- a/examples/simpletest_rgbimageplot_qt/jkqtplotter_simpletest_rgbimageplot_qt.cpp
+++ b/examples/simpletest_rgbimageplot_qt/jkqtplotter_simpletest_rgbimageplot_qt.cpp
@@ -7,7 +7,7 @@
#include
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
#include "jkqtplotter/jkqtpgraphsimagergb.h"
diff --git a/examples/simpletest_speed/jkqtplotter_simpletest_speed.cpp b/examples/simpletest_speed/jkqtplotter_simpletest_speed.cpp
index 938f78a7e1..664815ccff 100644
--- a/examples/simpletest_speed/jkqtplotter_simpletest_speed.cpp
+++ b/examples/simpletest_speed/jkqtplotter_simpletest_speed.cpp
@@ -2,7 +2,7 @@
#include
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
#include "speedtestplot.h"
int main(int argc, char* argv[])
diff --git a/examples/simpletest_speed/speedtestplot.cpp b/examples/simpletest_speed/speedtestplot.cpp
index a6ce971203..29ba10e227 100644
--- a/examples/simpletest_speed/speedtestplot.cpp
+++ b/examples/simpletest_speed/speedtestplot.cpp
@@ -5,7 +5,7 @@
*/
#include "speedtestplot.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
SpeedTestPlot::SpeedTestPlot():
diff --git a/examples/simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp b/examples/simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp
index 40e73bf51e..e7ab27337a 100644
--- a/examples/simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp
+++ b/examples/simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp
@@ -6,7 +6,7 @@
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
#include "jkqtplotter/jkqtpgraphsbarchart.h"
diff --git a/examples/simpletest_stepplots/README.md b/examples/simpletest_stepplots/README.md
index 4c691fc9b2..c4a836b303 100644
--- a/examples/simpletest_stepplots/README.md
+++ b/examples/simpletest_stepplots/README.md
@@ -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 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.
diff --git a/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.cpp b/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.cpp
index 0d3a5b2953..0c75145adb 100644
--- a/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.cpp
+++ b/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.cpp
@@ -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
#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 X, Y1, Y2, Y3;
- const int Ndata=10; // number of plot points in each curve
- for (int i=0; i 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<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);
diff --git a/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.pro b/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.pro
index d566ac4515..16d572d589 100644
--- a/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.pro
+++ b/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots.pro
@@ -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
diff --git a/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots_vertical.cpp b/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots_vertical.cpp
new file mode 100644
index 0000000000..4d96f444e0
--- /dev/null
+++ b/examples/simpletest_stepplots/jkqtplotter_simpletest_stepplots_vertical.cpp
@@ -0,0 +1,180 @@
+/** \example jkqtplotter_simpletest_stepplots.cpp
+ * JKQTPlotter: Examples: Special/Step Line Plots in Different Styles
+ *
+ * \ref JKQTPlotterSpecialStepLinePlot
+ */
+
+#include
+#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 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<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();
+}
diff --git a/examples/simpletest_symbols_and_errors/README.md b/examples/simpletest_symbols_and_errors/README.md
index 77943f4c16..6de4f203a9 100644
--- a/examples/simpletest_symbols_and_errors/README.md
+++ b/examples/simpletest_symbols_and_errors/README.md
@@ -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"));
diff --git a/examples/simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.cpp b/examples/simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.cpp
index 6edbcfff30..fe2f32d36e 100644
--- a/examples/simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.cpp
+++ b/examples/simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.cpp
@@ -6,7 +6,7 @@
#include
#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"));
diff --git a/examples/simpletest_symbols_and_styles/README.md b/examples/simpletest_symbols_and_styles/README.md
index 387da6046f..dbd8c48e6e 100644
--- a/examples/simpletest_symbols_and_styles/README.md
+++ b/examples/simpletest_symbols_and_styles/README.md
@@ -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 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 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(symbolID));
- graph->setStyle(pens[ipen]);
+ graph->setSymbolType(static_cast(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(graph->getSymbol()))+QString(", ")+jkqtp_QPenStyle2String(graph->getStyle()));
+ graph->setTitle(JKQTPGraphSymbols2NameString(static_cast(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:
diff --git a/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.cpp b/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.cpp
index c38ab0e43f..b05ffa5b84 100644
--- a/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.cpp
+++ b/examples/simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.cpp
@@ -6,7 +6,7 @@
#include
#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(symbolID));
- graph->setStyle(pens[ipen]);
- QString lname=jkqtp_QPenStyle2String(graph->getStyle());
+ graph->setSymbolType(static_cast(symbolID));
+ graph->setLineStyle(pens[ipen]);
+ QString lname=jkqtp_QPenStyle2String(graph->getLineStyle());
graph->setDrawLine(static_cast(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(graph->getSymbol()))+QString(", ")+lname);
+ graph->setTitle(JKQTPGraphSymbols2NameString(static_cast(graph->getSymbolType()))+QString(", ")+lname);
// add the graph to the plot, so it is actually displayed
plot.addGraph(graph);
diff --git a/examples/test_distributionplot/README.md b/examples/test_distributionplot/README.md
index f4e05be47a..82019a82ff 100644
--- a/examples/test_distributionplot/README.md
+++ b/examples/test_distributionplot/README.md
@@ -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:
diff --git a/examples/test_distributionplot/test_distributionplot.cpp b/examples/test_distributionplot/test_distributionplot.cpp
index 088d094ac9..7b6d7fcb0b 100644
--- a/examples/test_distributionplot/test_distributionplot.cpp
+++ b/examples/test_distributionplot/test_distributionplot.cpp
@@ -6,7 +6,7 @@
#include
#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:
diff --git a/examples/test_multiplot/test_multiplot.cpp b/examples/test_multiplot/test_multiplot.cpp
index a0eee41ec1..0710610888 100644
--- a/examples/test_multiplot/test_multiplot.cpp
+++ b/examples/test_multiplot/test_multiplot.cpp
@@ -6,7 +6,7 @@
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
#include "jkqtplotter/jkqtpgraphsparsedfunction.h"
#include "jkqtplotter/jkqtpgraphsbarchart.h"
#include
@@ -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);
diff --git a/examples/test_styling/test_styling.cpp b/examples/test_styling/test_styling.cpp
index eb8fe8e949..8069a0400a 100644
--- a/examples/test_styling/test_styling.cpp
+++ b/examples/test_styling/test_styling.cpp
@@ -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);
diff --git a/examples/test_user_interaction/test_user_interaction.h b/examples/test_user_interaction/test_user_interaction.h
index bba230c4ce..26e843daab 100644
--- a/examples/test_user_interaction/test_user_interaction.h
+++ b/examples/test_user_interaction/test_user_interaction.h
@@ -3,7 +3,7 @@
#include
#include "jkqtplotter/jkqtplotter.h"
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
#include
#include
#include
diff --git a/lib/jkqtplotter.pri b/lib/jkqtplotter.pri
index 0bd7b42709..61a506e409 100644
--- a/lib/jkqtplotter.pri
+++ b/lib/jkqtplotter.pri
@@ -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 \
diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp
index 10475673fb..3d457c129f 100644
--- a/lib/jkqtplotter/jkqtpbaseplotter.cpp
+++ b/lib/jkqtplotter/jkqtpbaseplotter.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;
}
diff --git a/lib/jkqtplotter/jkqtpbaseplotter.h b/lib/jkqtplotter/jkqtpbaseplotter.h
index 03bad6bb6b..c8d3cdb0b5 100644
--- a/lib/jkqtplotter/jkqtpbaseplotter.h
+++ b/lib/jkqtplotter/jkqtpbaseplotter.h
@@ -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;
};
diff --git a/lib/jkqtplotter/jkqtpelementsoverlay.cpp b/lib/jkqtplotter/jkqtpelementsoverlay.cpp
index 955891f6ee..7d1a5d94d6 100644
--- a/lib/jkqtplotter/jkqtpelementsoverlay.cpp
+++ b/lib/jkqtplotter/jkqtpelementsoverlay.cpp
@@ -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 &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));
+}
diff --git a/lib/jkqtplotter/jkqtpelementsoverlay.h b/lib/jkqtplotter/jkqtpelementsoverlay.h
index e34c721220..da2e3b6501 100644
--- a/lib/jkqtplotter/jkqtpelementsoverlay.h
+++ b/lib/jkqtplotter/jkqtpelementsoverlay.h
@@ -24,6 +24,7 @@
#include
#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 according to the parent's transformation rules */
QVector transform(const QVector& 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:
};
diff --git a/lib/jkqtplotter/jkqtpgraphs.cpp b/lib/jkqtplotter/jkqtpgraphs.cpp
deleted file mode 100644
index caab661056..0000000000
--- a/lib/jkqtplotter/jkqtpgraphs.cpp
+++ /dev/null
@@ -1,1571 +0,0 @@
-/*
- Copyright (c) 2008-2019 Jan W. Krieger ()
-
-
-
- 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 .
-*/
-
-
-
-#include "jkqtplotter/jkqtpgraphs.h"
-#include "jkqtplotter/jkqtpbaseplotter.h"
-#include
-#include
-#include
-#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) || (xvsgzgetNextStyle();
- //std::cout<<"got style settings from 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();
- }
-}
-
-JKQTPXYLineGraph::JKQTPXYLineGraph(JKQTBasePlotter* parent):
- JKQTPXYGraph(parent)
-{
- sortData=JKQTPXYGraph::Unsorted;
- drawSelectionLine=false;
- selectionLineColor=Qt::transparent;
- color=QColor("red");
- style=Qt::SolidLine;
- lineWidth=2;
- parentPlotStyle=-1;
- symbolSize=12;
- symbolWidth=1;
- symbol=JKQTPNoSymbol;
- drawLine=true;
-
- if (parent) { // get style settings from parent object
- parentPlotStyle=parent->getNextStyle();
- //std::cout<<"got style settings from 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();
- }
-}
-
-void JKQTPXYLineGraph::draw(JKQTPEnhancedPainter& painter) {
-#ifdef JKQTBP_AUTOTIMER
- JKQTPAutoOutputTimer jkaaot("JKQTPXYLineGraph::draw");
-#endif
- if (parent==nullptr) return;
- JKQTPDatastore* datastore=parent->getDatastore();
- if (datastore==nullptr) return;
-
- //qDebug()<<"JKQTPXYLineGraph::draw();";
-
- drawErrorsBefore(painter);
- {
- //qDebug()<<"JKQTPXYLineGraph::draw(): "<<1;
- painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
- //qDebug()<<"JKQTPXYLineGraph::draw(): "<<2;
-
- 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 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);
-
-
- int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows());
- int imin=0;
-
- if (imaxpt2px(painter, symbolSize*1.5), parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), penSelection.color(), penSelection.color());
- }
- JKQTPPlotSymbol(painter, x, y, symbol, parent->pt2px(painter, symbolSize), parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), symbColor, symbFillColor);
- /*if (drawLine && first) {
- double xl1=xold;
- double yl1=yold;
- double xl2=x;
- double yl2=y;
- lines.append(QLineF(xl1, yl1, xl2, yl2));
- }*/
- if (drawLine) {
- linesP<pt2px(painter, this->symbolSize);
- if (symbolSize>minSize*0.9) symbolSize=minSize*0.9;
- double symbolWidth=parent->pt2px(painter, this->symbolWidth*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);
- painter.setPen(p);
- double y=rect.top()+rect.height()/2.0;
- if (drawLine) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
- JKQTPPlotSymbol(painter, rect.left()+rect.width()/2.0, rect.top()+rect.height()/2.0, symbol, symbolSize, symbolWidth, getKeyLabelColor(), fillColor);
-
-}
-
-QColor JKQTPXYLineGraph::getKeyLabelColor() {
- return color;
-}
-
-
-JKQTPXYLineErrorGraph::JKQTPXYLineErrorGraph(JKQTBasePlotter *parent):
- JKQTPXYLineGraph(parent), JKQTPXYGraphErrors(color, parent)
-{
- setErrorColorFromGraphColor(color);
- if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
-}
-
-JKQTPXYLineErrorGraph::JKQTPXYLineErrorGraph(JKQTPlotter *parent):
- JKQTPXYLineErrorGraph(parent->getPlotter())
-{
-
-}
-
-bool JKQTPXYLineErrorGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) {
- if (xErrorColumn<0 || xErrorStyle==JKQTPNoError) {
- return JKQTPXYLineGraph::getXMinMax(minx, maxx, smallestGreaterZero);
- } else {
- bool start=true;
- minx=0;
- maxx=0;
- smallestGreaterZero=0;
-
- if (parent==nullptr) return false;
-
- JKQTPDatastore* datastore=parent->getDatastore();
- int imin=0;
- int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows());
-
- if (imaxget(static_cast(xColumn),static_cast(i))+getXErrorU(i, datastore);
- if (JKQTPIsOKFloat(xv)) {
- if (start || xv>maxx) maxx=xv;
- if (start || xvget(static_cast(xColumn),static_cast(i))-getXErrorL(i, datastore);
- if (start || xv>maxx) maxx=xv;
- if (start || xvgetDatastore();
- int imin=0;
- int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows());
-
- if (imaxget(static_cast(yColumn),static_cast(i))+getYErrorU(i, datastore);
- if (JKQTPIsOKFloat(yv)) {
- if (start || yv>maxy) maxy=yv;
- if (start || yvget(static_cast(yColumn),static_cast(i))-getYErrorL(i, datastore);
- if (start || yv>maxy) maxy=yv;
- if (start || yvgetNextStyle();
- //std::cout<<"got style settings from parent: "<getPlotStyle(parentPlotStyle).color();
- fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
- style=parent->getPlotStyle(parentPlotStyle).style();
- lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
- }
-}
-
-
-JKQTPStepHorizontalGraph::JKQTPStepHorizontalGraph(JKQTPlotter* parent):
- JKQTPXYGraph(parent)
-{
- color=QColor("red");
- fillColor=color.lighter();
- style=Qt::SolidLine;
- lineWidth=2;
- fillStyle=Qt::SolidPattern;
- drawLine=true;
- fillCurve=true;
- stepType=JKQTPStepLeft;
-
-
- if (parent) { // get style settings from parent object
- parentPlotStyle=parent->getNextStyle();
- //std::cout<<"got style settings from parent: "<getPlotStyle(parentPlotStyle).color();
- fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
- style=parent->getPlotStyle(parentPlotStyle).style();
- lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
- }
-}
-
-
-void JKQTPStepHorizontalGraph::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);
- if (fillCurve) painter.drawRect(rect);
- if (!fillCurve & drawLine) painter.drawLine(QLineF(rect.left(), y, rect.right(), y));
-
-}
-
-QColor JKQTPStepHorizontalGraph::getKeyLabelColor() {
- return color;
-}
-
-
-void JKQTPStepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
-#ifdef JKQTBP_AUTOTIMER
- JKQTPAutoOutputTimer jkaaot("JKQTPStepHorizontalGraph::draw");
-#endif
- if (parent==nullptr) return;
- JKQTPDatastore* datastore=parent->getDatastore();
- if (datastore==nullptr) return;
-
- 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);
- p.setJoinStyle(Qt::RoundJoin);
- p.setCapStyle(Qt::RoundCap);
-
- QPen np(Qt::NoPen);
-
- QBrush b=painter.brush();
- b.setColor(fillColor);
- b.setStyle(fillStyle);
-
- int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows());
- int imin=0;
-
- if (imaxgetXAxis()->isLogAxis()) x0=transformX(parent->getXAxis()->getMin());
- double y0=transformY(0);
- if (parent->getYAxis()->isLogAxis()) y0=transformY(parent->getYAxis()->getMin());
- bool subsequentItem=false;
- intSortData();
- for (int iii=imin; iiiget(static_cast(xColumn),static_cast(i));
- double yv=datastore->get(static_cast(yColumn),static_cast(i));
- //std::cout<<"(xv, yv) = ( "<getDatastore();
- if (datastore==nullptr) return;
-
- 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);
- p.setCapStyle(Qt::RoundCap);
- QPen np(Qt::NoPen);
-
- QBrush b=painter.brush();
- b.setColor(fillColor);
- b.setStyle(fillStyle);
-
- int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows());
- int imin=0;
-
- if (imaxgetXAxis()->isLogAxis()) x0=transformX(parent->getXAxis()->getMin());
- //double y0=transformY(0);
- //if (parent->getYAxis()->isLogAxis()) y0=transformY(parent->getYAxis()->getMin());
- bool first=false;
- intSortData();
- for (int iii=imin; iiiget(static_cast(xColumn),static_cast(i));
- double yv=datastore->get(static_cast(yColumn),static_cast(i));
- //std::cout<<"(xv, yv) = ( "<getNextStyle();
- centerColor=parent->getPlotStyle(parentPlotStyle).color();
- fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
- style=parent->getPlotStyle(parentPlotStyle).style();
- lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
- color=centerColor.darker();
- }
- fillColor.setAlphaF(0.5);
-
- rangeMin=rangeMax=0;
- rangeCenter=0;
- plotCenterLine=true;
- plotRange=true;
- plotRangeLines=true;
- fillRange=true;
-}
-
-
-JKQTPHorizontalRange::JKQTPHorizontalRange(JKQTPlotter* parent):
- JKQTPGraph(parent)
-{
- color=QColor("red").darker();
- fillColor=QColor("red").lighter();
- style=Qt::DotLine;
- lineWidth=1;
- fillStyle=Qt::SolidPattern;
- 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
- centerColor=parent->getPlotStyle(parentPlotStyle).color();
- fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
- style=parent->getPlotStyle(parentPlotStyle).style();
- lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
- color=centerColor.darker();
- }
- fillColor.setAlphaF(0.5);
-
- rangeMin=rangeMax=0;
- rangeCenter=0;
- plotCenterLine=true;
- plotRange=true;
- plotRangeLines=true;
- fillRange=true;
-}
-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="< "< "<pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
- QBrush nb(Qt::NoBrush);
- QBrush b=painter.brush();
- b.setColor(fillColor);
- b.setStyle(fillStyle);
- 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="<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=painter.pen();
- QPen np(Qt::NoPen);
- p.setColor(color);
- p.setStyle(style);
- p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
- QBrush nb(Qt::NoBrush);
- QBrush b=painter.brush();
- b.setColor(fillColor);
- b.setStyle(fillStyle);
- 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=painter.pen();
- QPen np(Qt::NoPen);
- p.setColor(color);
- p.setStyle(style);
- QBrush nb(Qt::NoBrush);
- QBrush b=painter.brush();
- b.setColor(fillColor);
- b.setStyle(fillStyle);
- //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;
-}
-
-
-QPen JKQTPXYLineGraph::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;
-}
-
-QPen JKQTPXYLineGraph::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 JKQTPXYLineGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
- QBrush b;
- b.setColor(fillColor);
- return b;
-}
-
-
-QBrush JKQTPStepHorizontalGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
- QBrush b;
- b.setColor(fillColor);
- b.setStyle(fillStyle);
- return b;
-}
-
-QPen JKQTPStepHorizontalGraph::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 JKQTPHorizontalRange::getBrush(JKQTPEnhancedPainter& /*painter*/ ) const {
- QBrush b;
- b.setColor(fillColor);
- b.setStyle(fillStyle);
- return b;
-}
-
-QPen JKQTPHorizontalRange::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;
-}
-
-
-JKQTPXYParametrizedScatterGraph::JKQTPXYParametrizedScatterGraph(JKQTBasePlotter *parent):
- JKQTPXYLineGraph(parent),
- JKQTPColorPaletteTools(parent)
-{
- sizeColumn=-1;
- colorColumn=-1;
- symbolColumn=-1;
- linewidthColumn=-1;
- palette=JKQTPMathImageMATLAB;
- colorColumnContainsRGB=false;
- symbol=JKQTPFilledCircle;
- drawLine=false;
-
- gridModeForSymbolSize=false;
- gridDeltaX=1;
- gridDeltaY=1;
- gridSymbolFractionSize=0.9;
- symbolFillDerivationMode=JKQTPFFCMLighterColor;
- if (parent) {
- symbolFillDerivationMode=parent->getCurrentPlotterStyle().graphFillColorDerivationMode;
- }
-}
-
-JKQTPXYParametrizedScatterGraph::JKQTPXYParametrizedScatterGraph(JKQTPlotter *parent):
- JKQTPXYParametrizedScatterGraph(parent->getPlotter())
-{
-
-}
-
-void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
-{
-#ifdef JKQTBP_AUTOTIMER
- JKQTPAutoOutputTimer jkaaot("JKQTPXYParametrizedScatterGraph::draw");
-#endif
- if (parent==nullptr) return;
- JKQTPDatastore* datastore=parent->getDatastore();
- if (datastore==nullptr) return;
-
- cbGetDataMinMax(intColMin, intColMax);
-
- 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.setJoinStyle(Qt::RoundJoin);
- p.setCapStyle(Qt::RoundCap);
-
-
- 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);
-
-
- int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows());
- int imin=0;
- if (imax(colorval, 2, 1, img, getPalette(), double(0.0), double(1.0));
- color1=img.pixel(0,0);
- color2=img.pixel(1,0);
- }
- }
-
- if (symbolColumn>=0) {
- symbol1=JKQTPFilledCircle;
- symbol2=JKQTPFilledRect;
- }
-
- double symbolWidth=parent->pt2px(painter, this->symbolWidth*0.7*parent->getLineWidthMultiplier());
- if (symbolWidth>0.2*symbolSize) symbolWidth=0.3*symbolSize;
- double lineWidth=parent->pt2px(painter, this->lineWidth*0.7*parent->getLineWidthMultiplier());
- if (lineWidth>0.1*maxSize) lineWidth=0.1*maxSize;
-
- painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
- QPen p=painter.pen();
- p.setColor(color1);
- p.setStyle(style);
- p.setWidthF(lineWidth);
- painter.setPen(p);
- double x1=rect.left()+symbolSize1/2.0;
- double y1=rect.top()+symbolSize1/2.0;
- double x2=rect.right()-symbolSize2/2.0;
- double y2=rect.bottom()-symbolSize2/2.0;
- JKQTPPlotSymbol(painter, x1, y1, symbol1, symbolSize1, symbolWidth, color1, JKQTPGetDerivedColor(symbolFillDerivationMode, color1));
- JKQTPPlotSymbol(painter, x2, y2, symbol2, symbolSize2, symbolWidth, color2, JKQTPGetDerivedColor(symbolFillDerivationMode, color2));
- if (drawLine) painter.drawLine(x1,y1, x2,y2);
-
-}
-
-QColor JKQTPXYParametrizedScatterGraph::getKeyLabelColor()
-{
- return getLocalColor(-1);
-}
-
-void JKQTPXYParametrizedScatterGraph::setParent(JKQTBasePlotter *parent)
-{
- JKQTPXYLineGraph::setParent(parent);
- cbSetParent(parent);
-}
-
-void JKQTPXYParametrizedScatterGraph::getOutsideSize(JKQTPEnhancedPainter &painter, int &leftSpace, int &rightSpace, int &topSpace, int &bottomSpace)
-{
- JKQTPXYLineGraph::getOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
- if (showColorBar&& colorColumn>=0 && !colorColumnContainsRGB) cbGetOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
-}
-
-void JKQTPXYParametrizedScatterGraph::drawOutside(JKQTPEnhancedPainter &painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace)
-{
- JKQTPXYLineGraph::drawOutside(painter, leftSpace, rightSpace, topSpace, bottomSpace);
- if (showColorBar&& colorColumn>=0 && !colorColumnContainsRGB) cbDrawOutside(painter, leftSpace, rightSpace, topSpace, bottomSpace);
-}
-
-void JKQTPXYParametrizedScatterGraph::cbGetDataMinMax(double &dmin, double &dmax)
-{
- if (autoImageRange) {
- dmin=dmax=0;
- if (parent==nullptr) return;
- JKQTPDatastore* datastore=parent->getDatastore();
- if (datastore==nullptr) return;
- if (colorColumn<0) return;
- int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows());
- int imin=0;
- if (imaxget(colorColumn,i);
- if (first) {
- dmin=dmax=xv;
- first=false;
- } else {
- dmin=qMin(xv, dmin);
- dmax=qMax(xv, dmax);
- }
- }
-
- } else {
- dmin=imageMin;
- dmax=imageMax;
- }
-
-}
-
-bool JKQTPXYParametrizedScatterGraph::usesColumn(int c) const
-{
- return (c==colorColumn) || (c==sizeColumn) || (c==symbolColumn) || (c==linewidthColumn) || JKQTPXYLineGraph::usesColumn(c);
-}
-
-double JKQTPXYParametrizedScatterGraph::getInternalDataMin() const
-{
- return 0;
-}
-
-double JKQTPXYParametrizedScatterGraph::getInternalDataMax() const
-{
- return 0;
-}
-
-double JKQTPXYParametrizedScatterGraph::getLocalSymbolSize(int i)
-{
- if (parent==nullptr) return symbolSize;
- JKQTPDatastore* datastore=parent->getDatastore();
- if (datastore==nullptr) return symbolSize;
- if (sizeColumn<0) return symbolSize;
- if (i>=(int64_t)datastore->getColumn(sizeColumn).getRows()) return symbolSize;
- return datastore->get(sizeColumn,i);
-}
-
-double JKQTPXYParametrizedScatterGraph::getLocalLineWidth(int i)
-{
- if (parent==nullptr) return lineWidth;
- JKQTPDatastore* datastore=parent->getDatastore();
- if (datastore==nullptr) return lineWidth;
- if (linewidthColumn<0) return lineWidth;
- if (i>=(int64_t)datastore->getColumn(linewidthColumn).getRows()) return lineWidth;
- return datastore->get(linewidthColumn,i);
-}
-
-QColor JKQTPXYParametrizedScatterGraph::getLocalColor(int i)
-{
- if (parent==nullptr) return color;
- JKQTPDatastore* datastore=parent->getDatastore();
- if (datastore==nullptr) return color;
- if (colorColumn<0) return color;
- if (colorColumnContainsRGB) {
- if (i<0 || i>=(int64_t)datastore->getColumn(colorColumn).getRows()) return color;
- //QRgb rgb=
- return QRgb(round(datastore->get(colorColumn,i)));
- } else {
- QImage img;
- double colorval=0;
- if (i>=0 && i<(int64_t)datastore->getColumn(colorColumn).getRows()) colorval=datastore->get(colorColumn,i);
- double colMin=0;
- double colMax=0;
- if (intColMin==intColMax) {
- colMin=0;
- colMax=datastore->getColumn(colorColumn).getRows()-1;
- } else {
- colMin=intColMin;
- colMax=intColMax;
- }
- JKQTPImagePlot_array2image(&colorval, 1, 1, img, palette, colMin, colMax);
- return img.pixel(0,0);
- }
-
-}
-
-JKQTPGraphSymbols JKQTPXYParametrizedScatterGraph::getLocalSymbolType(int i)
-{
- if (parent==nullptr) return symbol;
- JKQTPDatastore* datastore=parent->getDatastore();
- if (datastore==nullptr) return symbol;
- if (symbolColumn<0) return symbol;
- if (i>=static_cast(datastore->getColumn(symbolColumn).getRows())) return symbol;
- int id=static_cast(floor(datastore->get(symbolColumn,i)));
- if (id<0) return symbol;
- return JKQTPGraphSymbols(id%(JKQTPMaxSymbolID+1));
-
-}
-
-
-JKQTPXYParametrizedErrorScatterGraph::JKQTPXYParametrizedErrorScatterGraph(JKQTBasePlotter *parent):
- JKQTPXYParametrizedScatterGraph(parent), JKQTPXYGraphErrors(color, parent)
-{
- setErrorColorFromGraphColor(color);
- if (parentPlotStyle>=0) setErrorStyleFromPen(parent->getPlotStyle(parentPlotStyle));
-}
-
-JKQTPXYParametrizedErrorScatterGraph::JKQTPXYParametrizedErrorScatterGraph(JKQTPlotter *parent):
- JKQTPXYParametrizedErrorScatterGraph(parent->getPlotter())
-{
-
-}
-
-bool JKQTPXYParametrizedErrorScatterGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
-{
- if (xErrorColumn<0 || xErrorStyle==JKQTPNoError) {
- return JKQTPXYLineGraph::getXMinMax(minx, maxx, smallestGreaterZero);
- } else {
- bool start=true;
- minx=0;
- maxx=0;
- smallestGreaterZero=0;
-
- if (parent==nullptr) return false;
-
- JKQTPDatastore* datastore=parent->getDatastore();
- int imin=0;
- int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows());
-
- if (imaxget(static_cast(xColumn),static_cast(i))+getXErrorU(i, datastore);
- double xvv=datastore->get(static_cast(xColumn),static_cast(i))-getXErrorL(i, datastore);
- if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(xvv) ) {
- if (start || xv>maxx) maxx=xv;
- if (start || xvmaxx) maxx=xvv;
- if (start || xvvgetDatastore();
- int imin=0;
- int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows());
-
- if (imaxget(static_cast(yColumn),static_cast(i))+getYErrorU(i, datastore);
- double yvv=datastore->get(static_cast(yColumn),static_cast(i))-getYErrorL(i, datastore);
- if (JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(yvv) ) {
- if (start || yv>maxy) maxy=yv;
- if (start || yvmaxy) maxy=yvv;
- if (start || yvv)
-
-
-
- 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 .
-*/
-
-
-#include
-#include
-#include
-#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"
-
-#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 {
- 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() 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 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 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 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 linestyle of the graph lines */
- Qt::PenStyle style;
- /** \brief width (pixels) of the graph, given in pt */
- double lineWidth;
- /** \brief which symbol to use for the datapoints */
- JKQTPGraphSymbols symbol;
- /** \brief size (diameter in pt) of the symbol for the data points, given in pt */
- double symbolSize;
- /** \brief width (in pt) of the lines used to plot the symbol for the data points, given in pt */
- double symbolWidth;
- /** \brief indicates whether to draw a line or not */
- bool drawLine;
-
-
- QPen getLinePen(JKQTPEnhancedPainter &painter) const;
- QPen getSymbolPen(JKQTPEnhancedPainter& painter) const;
- QBrush getBrush(JKQTPEnhancedPainter &painter) const;
-
-
-
-};
-
-
-
-
-
-
-
-
-
-/*! \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"
-
-
- \see JKQTPXYParametrizedErrorScatterGraph, \ref JKQTPlotterParamScatter , \ref JKQTPlotterParamScatterImage
-*/
-class JKQTP_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph, public JKQTPColorPaletteTools {
- Q_OBJECT
- public:
- /** \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() override;
-
- /*! \copydoc sizeColumn
- \see see sizeColumn for details */
- inline virtual void setSizeColumn(int __value)
- {
- this->sizeColumn = __value;
- }
- /*! \copydoc sizeColumn
- \see see sizeColumn for details */
- inline virtual int getSizeColumn() const
- {
- return this->sizeColumn;
- }
- /*! \brief sets the property sizeColumn ( \copybrief sizeColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
- \details Description of the parameter sizeColumn is: \copydoc sizeColumn
- \see sizeColumn for more information */
- inline virtual void setSizeColumn (size_t __value) { this->sizeColumn = static_cast(__value); }
- /*! \copydoc colorColumn
- \see see colorColumn for details */
- inline virtual void setColorColumn(int __value)
- {
- this->colorColumn = __value;
- }
- /*! \copydoc colorColumn
- \see see colorColumn for details */
- inline virtual int getColorColumn() const
- {
- return this->colorColumn;
- }
- /*! \brief sets the property colorColumn ( \copybrief colorColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
- \details Description of the parameter colorColumn is: \copydoc colorColumn
- \see colorColumn for more information */
- inline virtual void setColorColumn (size_t __value) { this->colorColumn = static_cast(__value); }
- /*! \copydoc symbolColumn
- \see see symbolColumn for details */
- inline virtual void setSymbolColumn(int __value)
- {
- this->symbolColumn = __value;
- }
- /*! \copydoc symbolColumn
- \see see symbolColumn for details */
- inline virtual int getSymbolColumn() const
- {
- return this->symbolColumn;
- }
- /*! \brief sets the property symbolColumn ( \copybrief symbolColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
- \details Description of the parameter symbolColumn is: \copydoc symbolColumn
- \see symbolColumn for more information */
- inline virtual void setSymbolColumn (size_t __value) { this->symbolColumn = static_cast(__value); }
- /*! \copydoc linewidthColumn
- \see see linewidthColumn for details */
- inline virtual void setLinewidthColumn(int __value)
- {
- this->linewidthColumn = __value;
- }
- /*! \copydoc linewidthColumn
- \see see linewidthColumn for details */
- inline virtual int getLinewidthColumn() const
- {
- return this->linewidthColumn;
- }
- /*! \brief sets the property linewidthColumn ( \copybrief linewidthColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
- \details Description of the parameter linewidthColumn is: \copydoc linewidthColumn
- \see linewidthColumn for more information */
- inline virtual void setLinewidthColumn( size_t __value) { this->linewidthColumn = static_cast(__value); }
- /*! \copydoc colorColumnContainsRGB
- \see see colorColumnContainsRGB for details */
- inline virtual void setColorColumnContainsRGB(bool __value)
- {
- this->colorColumnContainsRGB = __value;
- }
- /*! \copydoc colorColumnContainsRGB
- \see see colorColumnContainsRGB for details */
- inline virtual bool getColorColumnContainsRGB() const
- {
- return this->colorColumnContainsRGB;
- }
- /*! \copydoc gridModeForSymbolSize
- \see see gridModeForSymbolSize for details */
- inline virtual void setGridModeForSymbolSize(bool __value)
- {
- this->gridModeForSymbolSize = __value;
- }
- /*! \copydoc gridModeForSymbolSize
- \see see gridModeForSymbolSize for details */
- inline virtual bool getGridModeForSymbolSize() const
- {
- return this->gridModeForSymbolSize;
- }
- /*! \copydoc gridDeltaX
- \see see gridDeltaX for details */
- inline virtual void setGridDeltaX(double __value)
- {
- this->gridDeltaX = __value;
- }
- /*! \copydoc gridDeltaX
- \see see gridDeltaX for details */
- inline virtual double getGridDeltaX() const
- {
- return this->gridDeltaX;
- }
- /*! \copydoc gridDeltaY
- \see see gridDeltaY for details */
- inline virtual void setGridDeltaY(double __value)
- {
- this->gridDeltaY = __value;
- }
- /*! \copydoc gridDeltaY
- \see see gridDeltaY for details */
- inline virtual double getGridDeltaY() const
- {
- return this->gridDeltaY;
- }
- /*! \copydoc gridSymbolFractionSize
- \see see gridSymbolFractionSize for details */
- inline virtual void setGridSymbolFractionSize(double __value)
- {
- this->gridSymbolFractionSize = __value;
- }
- /*! \copydoc gridSymbolFractionSize
- \see see gridSymbolFractionSize for details */
- inline virtual double getGridSymbolFractionSize() const
- {
- return this->gridSymbolFractionSize;
- }
- /*! \copydoc symbolFillDerivationMode
- \see see symbolFillDerivationMode for details */
- inline virtual JKQTPColorDerivationMode getSymbolFillDerivationMode() const
- {
- return this->symbolFillDerivationMode;
- }
- /*! \copydoc symbolFillDerivationMode
- \see see symbolFillDerivationMode for details */
- inline virtual void setSymbolFillDerivationMode(JKQTPColorDerivationMode m)
- {
- this->symbolFillDerivationMode=m;
- }
-
- virtual void setParent(JKQTBasePlotter* parent) override;
-
-
- /*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
-
- \note If you want to draw outside, then you'll also have to implement drawOutside()
- */
- virtual void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace) override;
-
- /*! \brief plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
-
- \note If you want to draw outside, then you'll also have to implement getOutsideSize(), so enough space is reserved
-
- The four value supplied tell the method where to draw (inside one of the rectangles).
- */
- 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;
-
- double getLocalLineWidth(int i);
- double getLocalSymbolSize(int i);
- QColor getLocalColor(int i);
- 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 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;
-
-};
-
-
-
-/*! \brief This implements a step plot with values \f$ \left(x, f(x) \right) \f$
- \ingroup jkqtplotter_linesymbolgraphs_simple
-
- \image html jkqtplotter_simpletest_stepplots.png
-
- \see JKQTPStepVerticalGraph, \ref JKQTPlotterStepPlot
- */
-class JKQTP_LIB_EXPORT JKQTPStepHorizontalGraph: public JKQTPXYGraph {
- Q_OBJECT
- public:
- /** \brief class constructor */
- JKQTPStepHorizontalGraph(JKQTBasePlotter* parent=nullptr);
- /** \brief class constructor */
- JKQTPStepHorizontalGraph(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 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;
- }
- /*! \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 fillCurve
- \see see fillCurve for details */
- inline virtual void setFillCurve(bool __value)
- {
- this->fillCurve = __value;
- }
- /*! \copydoc fillCurve
- \see see fillCurve for details */
- inline virtual bool getFillCurve() const
- {
- return this->fillCurve;
- }
- /*! \copydoc stepType
- \see see stepType for details */
- inline virtual void setStepType(const JKQTPStepType & __value)
- {
- this->stepType = __value;
- }
- /*! \copydoc stepType
- \see see stepType for details */
- inline virtual JKQTPStepType getStepType() const
- {
- return this->stepType;
- }
- 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 (pixels) of the graph, given in pt */
- 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 */
- bool fillCurve;
- /** \brief specifies whether the steps elongate to the left, the right, or are centered around the \f$ x_i \f$ values. */
- JKQTPStepType stepType;
-
- /** \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 This implements a step plot with values \f$ \left(f(y), y \right) \f$
- \ingroup jkqtplotter_linesymbolgraphs_simple
-
- \image html plot_stepverplot1.png
-
- \see JKQTPStepHorizontalGraph, \ref JKQTPlotterStepPlot
- */
-class JKQTP_LIB_EXPORT JKQTPStepVerticalGraph: public JKQTPStepHorizontalGraph {
- Q_OBJECT
- public:
- /** \brief class constructor */
- JKQTPStepVerticalGraph(JKQTBasePlotter* parent=nullptr);
- /** \brief class constructor */
- JKQTPStepVerticalGraph(JKQTPlotter* parent);
-
- /** \brief plots the graph to the plotter object specified as parent */
- virtual void draw(JKQTPEnhancedPainter& painter) override;
-};
-
-
-
-
-
-
-
-
-
-/*! \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 {
- 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!
- */
- 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;
- /** \brief returns the color to be used for the key label */
- virtual QColor getKeyLabelColor() override;
-
- void setDrawCenterLineOnly();
-
- /*! \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;
- }
- /*! \copydoc centerColor
- \see see centerColor for details */
- inline virtual void setCenterColor(const QColor & __value)
- {
- this->centerColor = __value;
- }
- /*! \copydoc centerColor
- \see see centerColor for details */
- inline virtual QColor getCenterColor() const
- {
- return this->centerColor;
- }
- /*! \copydoc centerStyle
- \see see centerStyle for details */
- inline virtual void setCenterStyle(const Qt::PenStyle & __value)
- {
- this->centerStyle = __value;
- }
- /*! \copydoc centerStyle
- \see see centerStyle for details */
- inline virtual Qt::PenStyle getCenterStyle() const
- {
- return this->centerStyle;
- }
- /*! \copydoc centerLineWidth
- \see see centerLineWidth for details */
- inline virtual void setCenterLineWidth(double __value)
- {
- this->centerLineWidth = __value;
- }
- /*! \copydoc centerLineWidth
- \see see centerLineWidth for details */
- inline virtual double getCenterLineWidth() const
- {
- return this->centerLineWidth;
- }
- /*! \copydoc rangeMin
- \see see rangeMin for details */
- inline virtual void setRangeMin(double __value)
- {
- this->rangeMin = __value;
- }
- /*! \copydoc rangeMin
- \see see rangeMin for details */
- inline virtual double getRangeMin() const
- {
- return this->rangeMin;
- }
- /*! \copydoc rangeMax
- \see see rangeMax for details */
- inline virtual void setRangeMax(double __value)
- {
- this->rangeMax = __value;
- }
- /*! \copydoc rangeMax
- \see see rangeMax for details */
- inline virtual double getRangeMax() const
- {
- return this->rangeMax;
- }
- /*! \copydoc sizeMin
- \see see sizeMin for details */
- inline virtual void setSizeMin(double __value)
- {
- this->sizeMin = __value;
- }
- /*! \copydoc sizeMin
- \see see sizeMin for details */
- inline virtual double getSizeMin() const
- {
- return this->sizeMin;
- }
- /*! \copydoc sizeMax
- \see see sizeMax for details */
- inline virtual void setSizeMax(double __value)
- {
- this->sizeMax = __value;
- }
- /*! \copydoc sizeMax
- \see see sizeMax for details */
- inline virtual double getSizeMax() const
- {
- return this->sizeMax;
- }
- /*! \copydoc unlimitedSizeMin
- \see see unlimitedSizeMin for details */
- inline virtual void setUnlimitedSizeMin(bool __value)
- {
- this->unlimitedSizeMin = __value;
- }
- /*! \copydoc unlimitedSizeMin
- \see see unlimitedSizeMin for details */
- inline virtual bool getUnlimitedSizeMin() const
- {
- return this->unlimitedSizeMin;
- }
- /*! \copydoc unlimitedSizeMax
- \see see unlimitedSizeMax for details */
- inline virtual void setUnlimitedSizeMax(bool __value)
- {
- this->unlimitedSizeMax = __value;
- }
- /*! \copydoc unlimitedSizeMax
- \see see unlimitedSizeMax for details */
- inline virtual bool getUnlimitedSizeMax() const
- {
- return this->unlimitedSizeMax;
- }
-
- /*! \copydoc rangeCenter
- \see see rangeCenter for details */
- inline virtual void setRangeCenter(double __value)
- {
- this->rangeCenter = __value;
- }
- /*! \copydoc rangeCenter
- \see see rangeCenter for details */
- inline virtual double getRangeCenter() const
- {
- return this->rangeCenter;
- }
- /*! \copydoc plotCenterLine
- \see see plotCenterLine for details */
- inline virtual void setPlotCenterLine(bool __value)
- {
- this->plotCenterLine = __value;
- }
- /*! \copydoc plotCenterLine
- \see see plotCenterLine for details */
- inline virtual bool getPlotCenterLine() const
- {
- return this->plotCenterLine;
- }
- /*! \copydoc invertedRange
- \see see invertedRange for details */
- inline virtual void setInvertedRange(bool __value)
- {
- this->invertedRange = __value;
- }
- /*! \copydoc invertedRange
- \see see invertedRange for details */
- inline virtual bool getInvertedRange() const
- {
- return this->invertedRange;
- }
- /*! \copydoc plotRange
- \see see plotRange for details */
- inline virtual void setPlotRange(bool __value)
- {
- this->plotRange = __value;
- }
- /*! \copydoc plotRange
- \see see plotRange for details */
- inline virtual bool getPlotRange() const
- {
- return this->plotRange;
- }
- /*! \copydoc fillRange
- \see see fillRange for details */
- inline virtual void setFillRange(bool __value)
- {
- this->fillRange = __value;
- }
- /*! \copydoc fillRange
- \see see fillRange for details */
- inline virtual bool getFillRange() const
- {
- return this->fillRange;
- }
- /*! \copydoc plotRangeLines
- \see see plotRangeLines for details */
- inline virtual void setPlotRangeLines(bool __value)
- {
- this->plotRangeLines = __value;
- }
- /*! \copydoc plotRangeLines
- \see see plotRangeLines for details */
- inline virtual bool getPlotRangeLines() const
- {
- return this->plotRangeLines;
- }
- 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 graph */
- QColor color;
- /** \brief color of the center line graph */
- QColor centerColor;
- /** \brief color of the graph fill */
- QColor fillColor;
- /** \brief linestyle of the graph lines */
- Qt::PenStyle style;
- /** \brief linestyle of the center line graph lines */
- Qt::PenStyle centerStyle;
- /** \brief width (pt) of the graph, given in pt */
- double lineWidth;
- /** \brief width (pt) of the center line graph, given in pt */
- double centerLineWidth;
- /** \brief fill style, if the curve should be filled */
- Qt::BrushStyle fillStyle;
-
- /** \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 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!
- */
- 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;
-};
-
-#endif // jkqtpgraphs_H
diff --git a/lib/jkqtplotter/jkqtpgraphsbarchart.cpp b/lib/jkqtplotter/jkqtpgraphsbarchart.cpp
index 28ccfcd4b3..40b7155279 100644
--- a/lib/jkqtplotter/jkqtpgraphsbarchart.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsbarchart.cpp
@@ -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(xColumn)).getRows(), datastore->getColumn(static_cast(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(xColumn)).getRows(), datastore->getColumn(static_cast(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));
}
diff --git a/lib/jkqtplotter/jkqtpgraphsbarchart.h b/lib/jkqtplotter/jkqtpgraphsbarchart.h
index 2e7280e06e..5451adacdc 100644
--- a/lib/jkqtplotter/jkqtpgraphsbarchart.h
+++ b/lib/jkqtplotter/jkqtpgraphsbarchart.h
@@ -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
*
diff --git a/lib/jkqtplotter/jkqtpgraphsbase.cpp b/lib/jkqtplotter/jkqtpgraphsbase.cpp
index 38361872f4..2f5a6a89f0 100644
--- a/lib/jkqtplotter/jkqtpgraphsbase.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsbase.cpp
@@ -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: "<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: "<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: "<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: "<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(__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()
{
diff --git a/lib/jkqtplotter/jkqtpgraphsbase.h b/lib/jkqtplotter/jkqtpgraphsbase.h
index a5d8d18434..b0e3558d53 100644
--- a/lib/jkqtplotter/jkqtpgraphsbase.h
+++ b/lib/jkqtplotter/jkqtpgraphsbase.h
@@ -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: \copydoc dataColumn
\see dataColumn for more information */
- inline virtual void setDataColumn (size_t __value) { this->dataColumn = static_cast(__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: \copydoc sortData \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);
}
diff --git a/lib/jkqtplotter/jkqtpgraphsbaseerrors.cpp b/lib/jkqtplotter/jkqtpgraphsbaseerrors.cpp
index a2757ec243..e059c14eb6 100644
--- a/lib/jkqtplotter/jkqtpgraphsbaseerrors.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsbaseerrors.cpp
@@ -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* dataorder) {
diff --git a/lib/jkqtplotter/jkqtpgraphsbaseerrors.h b/lib/jkqtplotter/jkqtpgraphsbaseerrors.h
index ef6c79ec61..32a1bef6b7 100644
--- a/lib/jkqtplotter/jkqtpgraphsbaseerrors.h
+++ b/lib/jkqtplotter/jkqtpgraphsbaseerrors.h
@@ -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;
diff --git a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp
new file mode 100644
index 0000000000..e434f99211
--- /dev/null
+++ b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp
@@ -0,0 +1,446 @@
+/*
+ Copyright (c) 2008-2019 Jan W. Krieger ()
+
+
+
+ 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 .
+*/
+
+#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
+#include "jkqtplotter/jkqtpbaseplotter.h"
+#include "jkqtplotter/jkqtplotter.h"
+#include
+#include
+
+
+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 &pattern)
+{
+ m_linePen.setDashPattern(pattern);
+ m_linePen.setStyle(Qt::CustomDashLine);
+}
+
+QVector 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;
+}
diff --git a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h
new file mode 100644
index 0000000000..87f7f64044
--- /dev/null
+++ b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.h
@@ -0,0 +1,381 @@
+/*
+ Copyright (c) 2008-2019 Jan W. Krieger ()
+
+
+
+ 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 .
+*/
+
+
+#include
+#include
+#include
+#include
+#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 &pattern);
+ /** \brief gets the dash pattern for a custom dash style
+ * \see https://doc.qt.io/qt-5/qpen.html#setDashPattern
+ */
+ QVector 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 QPainter 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 QPainter 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 QPainter 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 QPainter 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
diff --git a/lib/jkqtplotter/jkqtpgraphsboxplot.cpp b/lib/jkqtplotter/jkqtpgraphsboxplot.cpp
index 7aaa47cd4a..17373002c2 100644
--- a/lib/jkqtplotter/jkqtpgraphsboxplot.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsboxplot.cpp
@@ -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;
}
diff --git a/lib/jkqtplotter/jkqtpgraphsboxplot.h b/lib/jkqtplotter/jkqtpgraphsboxplot.h
index 3da09e3e9f..5ab6e198c8 100644
--- a/lib/jkqtplotter/jkqtpgraphsboxplot.h
+++ b/lib/jkqtplotter/jkqtpgraphsboxplot.h
@@ -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;
}
diff --git a/lib/jkqtplotter/jkqtpgraphscontour.cpp b/lib/jkqtplotter/jkqtpgraphscontour.cpp
index 8f5c7094d8..218046dce3 100644
--- a/lib/jkqtplotter/jkqtpgraphscontour.cpp
+++ b/lib/jkqtplotter/jkqtpgraphscontour.cpp
@@ -32,6 +32,44 @@
#include
# include
+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 &__value)
+{
+ this->contourLevels = __value;
+}
+
+QList 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)
diff --git a/lib/jkqtplotter/jkqtpgraphscontour.h b/lib/jkqtplotter/jkqtpgraphscontour.h
index 2789bdfdc3..ac7096e4f9 100644
--- a/lib/jkqtplotter/jkqtpgraphscontour.h
+++ b/lib/jkqtplotter/jkqtpgraphscontour.h
@@ -26,10 +26,11 @@
#include
#include
#include
-#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 & __value)
- {
- this->contourLevels = __value;
- }
+ void setContourLevels(const QList & __value);
/*! \copydoc contourLevels
\see see contourLevels for details */
- inline virtual QList getContourLevels() const
- {
- return this->contourLevels;
- }
+ QList 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 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);
diff --git a/lib/jkqtplotter/jkqtpgraphsevaluatedfunction.cpp b/lib/jkqtplotter/jkqtpgraphsevaluatedfunction.cpp
index 26f05005d2..f70b543367 100644
--- a/lib/jkqtplotter/jkqtpgraphsevaluatedfunction.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsevaluatedfunction.cpp
@@ -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: "<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: "<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(rand())/static_cast(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 &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(__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(__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* d=static_cast*>(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* d=static_cast*>(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* d=static_cast*>(param);
if (d) {
@@ -909,6 +865,86 @@ QVector 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
{
diff --git a/lib/jkqtplotter/jkqtpgraphsevaluatedfunction.h b/lib/jkqtplotter/jkqtpgraphsevaluatedfunction.h
index 718458c209..89821bf3ff 100644
--- a/lib/jkqtplotter/jkqtpgraphsevaluatedfunction.h
+++ b/lib/jkqtplotter/jkqtpgraphsevaluatedfunction.h
@@ -22,7 +22,8 @@
#include
#include
#include
-#include "jkqtplotter/jkqtpgraphs.h"
+#include "jkqtplotter/jkqtpgraphsscatter.h"
+#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
#include "jkqtplottertools/jkqtp_imexport.h"
#include
@@ -65,7 +66,7 @@ typedef std::function 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: \copydoc plotFunction
* \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: \copydoc plotFunction
* \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: \copydoc plotFunction
* \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: \copydoc plotFunction
* \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& params);
+ virtual void setParams(const QVector& 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 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: \copydoc errorPlotFunction
@@ -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& 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: \copydoc parameterColumn
\see parameterColumn for more information */
- inline virtual void setParameterColumn (size_t __value) { this->parameterColumn = static_cast(__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: \copydoc errorParameterColumn
\see errorParameterColumn for more information */
- inline virtual void setErrorParameterColumn (size_t __value) { this->errorParameterColumn = static_cast(__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;
diff --git a/lib/jkqtplotter/jkqtpgraphsfilledcurve.cpp b/lib/jkqtplotter/jkqtpgraphsfilledcurve.cpp
index 52063dfa15..35e2049816 100644
--- a/lib/jkqtplotter/jkqtpgraphsfilledcurve.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsfilledcurve.cpp
@@ -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: "<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(qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()));
- int imin=0;
- if (imaxgetXAxis()->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; iiiget(static_cast(xColumn),static_cast(i));
- double yv=datastore->get(static_cast(yColumn),static_cast(i));
- //std::cout<<"(xv, yv) = ( "<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(qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()));
- int imin=0;
- if (imaxgetXAxis()->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; iiiget(static_cast(xColumn),static_cast(i));
- double yv=datastore->get(static_cast(yColumn),static_cast(i));
- //std::cout<<"(xv, yv) = ( "<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: "<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(qMin(qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()), datastore->getColumn(static_cast(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(__value);
+}
+
+void JKQTPFilledVerticalRangeGraph::setDrawLine(bool __value)
+{
+ drawLine=__value;
+}
+
+bool JKQTPFilledVerticalRangeGraph::getDrawLine() const
+{
+ return drawLine;
}
diff --git a/lib/jkqtplotter/jkqtpgraphsfilledcurve.h b/lib/jkqtplotter/jkqtpgraphsfilledcurve.h
index 979e49d013..806b604e6e 100644
--- a/lib/jkqtplotter/jkqtpgraphsfilledcurve.h
+++ b/lib/jkqtplotter/jkqtpgraphsfilledcurve.h
@@ -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: |