From ca4065dae93e53686a9e148e8e64fa4f1e7927b1 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Sun, 2 Dec 2018 14:08:43 +0100 Subject: [PATCH] some reorganizations + QMake-build-projects with library --- JKQtFastPlotterBuildAllExamples.pro | 9 + JKQtPlotterBuildAllExamples.pro | 70 ++ README.md | 2 +- lib/jkqtfastplotter.pri | 2 +- lib/jkqtfastplotterlib.pro | 6 + lib/jkqtmathtext.pri | 3 + lib/jkqtmathtext_with_xits.pri | 3 - lib/jkqtplotter.pri | 11 +- lib/jkqtplotter/jkqtpbaseplotter.cpp | 2 + lib/jkqtplotter/jkqtpelements.cpp | 939 ------------------ lib/jkqtplotter/jkqtpelements.h | 327 ------ lib/jkqtplotter/jkqtpfilledcurveelements.cpp | 699 +++++++++++++ lib/jkqtplotter/jkqtpfilledcurveelements.h | 240 +++++ lib/jkqtplotter/jkqtpimpulseselements.cpp | 299 ++++++ lib/jkqtplotter/jkqtpimpulseselements.h | 144 +++ lib/jkqtplotterlib.pro | 6 + .../jkqtfastplotter_test.pro | 8 +- .../jkqtmathtext_simpletest.pro | 12 +- .../jkqtmathtext_simpletest_and_lib.pro | 8 + test/jkqtmathtext_test/jkqtmathtext_test.pro | 13 +- .../jkqtmathtext_test_and_lib.pro | 8 + test/jkqtplot_test/TestWidgetGraphs.cpp | 2 +- test/jkqtplot_test/jkqtplot_test.pro | 14 +- ...mpletest_imageplot_nodatastore_and_lib.pro | 8 + .../jkqtplotter_simpletest.pro | 8 +- .../jkqtplotter_simpletest_and_lib.pro | 8 + .../jkqtplotter_simpletest_barchart.cpp | 4 +- .../jkqtplotter_simpletest_barchart.pro | 9 +- ...kqtplotter_simpletest_barchart_and_lib.pro | 8 + .../jkqtplotter_simpletest_dateaxes.cpp | 1 + .../jkqtplotter_simpletest_dateaxes.pro | 8 +- ...kqtplotter_simpletest_dateaxes_and_lib.pro | 8 + .../jkqtplotter_simpletest_errorbarstyles.pro | 8 +- ...tter_simpletest_errorbarstyles_and_lib.pro | 8 + .../jkqtplotter_simpletest_imageplot.pro | 9 +- ...qtplotter_simpletest_imageplot_and_lib.pro | 8 + ...tplotter_simpletest_imageplot_modifier.pro | 9 +- ..._simpletest_imageplot_modifier_and_lib.pro | 8 + ...otter_simpletest_imageplot_nodatastore.pro | 23 +- ...mpletest_imageplot_nodatastore_and_lib.pro | 8 + ...kqtplotter_simpletest_imageplot_opencv.pro | 10 +- .../jkqtplotter_simpletest_logaxes.pro | 13 +- ...jkqtplotter_simpletest_logaxes_and_lib.pro | 8 + ...plotter_simpletest_rgbimageplot_opencv.cpp | 1 - ...plotter_simpletest_rgbimageplot_opencv.pro | 10 +- .../jkqtplotter_simpletest_stackedbars.cpp | 4 +- .../jkqtplotter_simpletest_stackedbars.pro | 10 +- ...plotter_simpletest_stackedbars_and_lib.pro | 8 + ...tplotter_simpletest_symbols_and_errors.pro | 10 +- ..._simpletest_symbols_and_errors_and_lib.pro | 8 + ...tplotter_simpletest_symbols_and_styles.pro | 10 +- ..._simpletest_symbols_and_styles_and_lib.pro | 8 + 52 files changed, 1734 insertions(+), 1336 deletions(-) create mode 100644 JKQtFastPlotterBuildAllExamples.pro create mode 100644 JKQtPlotterBuildAllExamples.pro create mode 100644 lib/jkqtfastplotterlib.pro delete mode 100644 lib/jkqtmathtext_with_xits.pri create mode 100644 lib/jkqtplotter/jkqtpfilledcurveelements.cpp create mode 100644 lib/jkqtplotter/jkqtpfilledcurveelements.h create mode 100644 lib/jkqtplotter/jkqtpimpulseselements.cpp create mode 100644 lib/jkqtplotter/jkqtpimpulseselements.h create mode 100644 lib/jkqtplotterlib.pro create mode 100644 test/jkqtmathtext_simpletest/jkqtmathtext_simpletest_and_lib.pro create mode 100644 test/jkqtmathtext_test/jkqtmathtext_test_and_lib.pro create mode 100644 test/jkqtplot_test/jkqtplotter_simpletest_imageplot_nodatastore_and_lib.pro create mode 100644 test/jkqtplotter_simpletest/jkqtplotter_simpletest_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_imageplot/jkqtplotter_simpletest_imageplot_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_logaxes/jkqtplotter_simpletest_logaxes_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors_and_lib.pro create mode 100644 test/jkqtplotter_simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles_and_lib.pro diff --git a/JKQtFastPlotterBuildAllExamples.pro b/JKQtFastPlotterBuildAllExamples.pro new file mode 100644 index 0000000000..9af27bfb42 --- /dev/null +++ b/JKQtFastPlotterBuildAllExamples.pro @@ -0,0 +1,9 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtfastplotterlib \ + jkqtfastplotter_test + +jkqtfastplotterlib.file = lib/jkqtfastplotterlib.pro + +jkqtfastplotter_test.subdir = test/jkqtfastplotter_test +jkqtfastplotter_test.depends = jkqtfastplotterlib diff --git a/JKQtPlotterBuildAllExamples.pro b/JKQtPlotterBuildAllExamples.pro new file mode 100644 index 0000000000..9ed987d87f --- /dev/null +++ b/JKQtPlotterBuildAllExamples.pro @@ -0,0 +1,70 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib \ + jkqtmathtext_simpletest \ + jkqtplotter_simpletest_symbols_and_styles \ + jkqtplotter_simpletest_symbols_and_errors \ + jkqtplotter_simpletest_stackedbars \ + jkqtplotter_simpletest_logaxes \ + jkqtplotter_simpletest_imageplot_modifier \ + jkqtplotter_simpletest_imageplot \ + jkqtplotter_simpletest_errorbarstyles \ + jkqtplotter_simpletest_dateaxes \ + jkqtplotter_simpletest_barchart \ + jkqtplotter_simpletest \ + jkqtplot_test + #jkqtplotter_simpletest_imageplot_nodatastore \ + #jkqtplotter_simpletest_rgbimageplot_opencv \ + #jkqtplotter_simpletest_imageplot_opencv \ + + + + + +jkqtplotterlib.file = lib/jkqtplotterlib.pro + +jkqtmathtext_simpletest.subdir = test/jkqtmathtext_simpletest +jkqtmathtext_simpletest.depends = jkqtplotterlib + +jkqtmathtext_test.subdir = test/jkqtmathtext_test +jkqtmathtext_test.depends = jkqtplotterlib + +jkqtplot_test.subdir = test/jkqtplot_test +jkqtplot_test.depends = jkqtplotterlib + +jkqtplotter_simpletest.subdir = test/jkqtplotter_simpletest +jkqtplotter_simpletest.depends = jkqtplotterlib + +jkqtplotter_simpletest_barchart.subdir = test/jkqtplotter_simpletest_barchart +jkqtplotter_simpletest_barchart.depends = jkqtplotterlib + +jkqtplotter_simpletest_dateaxes.subdir = test/jkqtplotter_simpletest_dateaxes +jkqtplotter_simpletest_dateaxes.depends = jkqtplotterlib + +jkqtplotter_simpletest_errorbarstyles.subdir = test/jkqtplotter_simpletest_errorbarstyles +jkqtplotter_simpletest_errorbarstyles.depends = jkqtplotterlib + +jkqtplotter_simpletest_imageplot.subdir = test/jkqtplotter_simpletest_imageplot +jkqtplotter_simpletest_imageplot.depends = jkqtplotterlib + +jkqtplotter_simpletest_imageplot_modifier.subdir = test/jkqtplotter_simpletest_imageplot_modifier +jkqtplotter_simpletest_imageplot_modifier.depends = jkqtplotterlib + +jkqtplotter_simpletest_imageplot_nodatastore.subdir = test/jkqtplotter_simpletest_imageplot_nodatastore +jkqtplotter_simpletest_imageplot_nodatastore.depends = jkqtplotterlib + +jkqtplotter_simpletest_imageplot_opencv.subdir = test/jkqtplotter_simpletest_imageplot_opencv + +jkqtplotter_simpletest_logaxes.subdir = test/jkqtplotter_simpletest_logaxes +jkqtplotter_simpletest_logaxes.depends = jkqtplotterlib + +jkqtplotter_simpletest_rgbimageplot_opencv.subdir = test/jkqtplotter_simpletest_rgbimageplot_opencv + +jkqtplotter_simpletest_stackedbars.subdir = test/jkqtplotter_simpletest_stackedbars +jkqtplotter_simpletest_stackedbars.depends = jkqtplotterlib + +jkqtplotter_simpletest_symbols_and_errors.subdir = test/jkqtplotter_simpletest_symbols_and_errors +jkqtplotter_simpletest_symbols_and_errors.depends = jkqtplotterlib + +jkqtplotter_simpletest_symbols_and_styles.subdir = test/jkqtplotter_simpletest_symbols_and_styles +jkqtplotter_simpletest_symbols_and_styles.depends = jkqtplotterlib diff --git a/README.md b/README.md index 8e6c960bcd..cdca15a8c7 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,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_simpletest_barchart_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_barchart) | [Simple Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_barchart) | `JKQTPbarVerticalGraph`
C-style arrays of data | | [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/JKQTPbarVerticalGraphStacked_small.png)
![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/JKQTPbarHorizontalGraphStacked_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_stackedbars) | [Stacked Bar Charts](https://github.com/jkriege2/JKQtPlotter/tree/master/test/jkqtplotter_simpletest_stackedbars) | `JKQTPbarVerticalStackableGraph`, `JKQTPbarHorizontalStackableGraph`
C++-style vectors of data | -### Styling the Plot, Key Axes +### Styling the Plot, Keys, Axes, ... | Screenshot | Description | Notes | |:-------------:| ------------- | ------------- | diff --git a/lib/jkqtfastplotter.pri b/lib/jkqtfastplotter.pri index f9d49efc94..802b13867c 100644 --- a/lib/jkqtfastplotter.pri +++ b/lib/jkqtfastplotter.pri @@ -19,5 +19,5 @@ RESOURCES += $$PWD/jkqtplotterressources/jkqtpbaseplotter.qrc INCLUDEPATH += $$PWD QT += core gui opengl -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport diff --git a/lib/jkqtfastplotterlib.pro b/lib/jkqtfastplotterlib.pro new file mode 100644 index 0000000000..03aa4f4d89 --- /dev/null +++ b/lib/jkqtfastplotterlib.pro @@ -0,0 +1,6 @@ +TARGET = jkqtfastplotterlib + +TEMPLATE = lib +CONFIG+=staticlib + +include(jkqtfastplotter.pri) diff --git a/lib/jkqtmathtext.pri b/lib/jkqtmathtext.pri index ce607c1ae3..0219590b97 100644 --- a/lib/jkqtmathtext.pri +++ b/lib/jkqtmathtext.pri @@ -9,6 +9,9 @@ SOURCES += $$PWD/jkqtmathtext/jkqtmathtext.cpp \ INCLUDEPATH += $$PWD +include($$PWD/jkqtplotterressources/math_fonts/xits.pri) +DEFINES += AUTOLOAD_XITS_FONTS + QT += core gui #win32:LIBS += -lgdi32 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport diff --git a/lib/jkqtmathtext_with_xits.pri b/lib/jkqtmathtext_with_xits.pri deleted file mode 100644 index e49aa6a75f..0000000000 --- a/lib/jkqtmathtext_with_xits.pri +++ /dev/null @@ -1,3 +0,0 @@ -include($$PWD/jkqtmathtext.pri) -include($$PWD/jkqtplotterressources/math_fonts/xits.pri) -DEFINES += AUTOLOAD_XITS_FONTS diff --git a/lib/jkqtplotter.pri b/lib/jkqtplotter.pri index 6c2e364ce3..74e682b0c6 100644 --- a/lib/jkqtplotter.pri +++ b/lib/jkqtplotter.pri @@ -15,6 +15,8 @@ HEADERS += $$PWD/jkqtplotter/jkqtpbaseplotter.h \ $$PWD/jkqtplotter/jkqtpbarchartelements.h \ $$PWD/jkqtplotter/jkqtpboxplotelements.h \ $$PWD/jkqtplotter/jkqtpevaluatedfunctionelements.h \ + $$PWD/jkqtplotter/jkqtpfilledcurveelements.h \ + $$PWD/jkqtplotter/jkqtpimpulseselements.h \ $$PWD/jkqtplotter/jkqtpparsedfunctionelements.h \ $$PWD/jkqtplotter/jkqtpoverlayelements.h \ $$PWD/jkqtplotter/jkqtpgeoelements.h \ @@ -37,6 +39,8 @@ SOURCES += $$PWD/jkqtplotter/jkqtpbaseplotter.cpp \ $$PWD/jkqtplotter/jkqtpbarchartelements.cpp \ $$PWD/jkqtplotter/jkqtpboxplotelements.cpp \ $$PWD/jkqtplotter/jkqtpevaluatedfunctionelements.cpp \ + $$PWD/jkqtplotter/jkqtpfilledcurveelements.cpp \ + $$PWD/jkqtplotter/jkqtpimpulseselements.cpp \ $$PWD/jkqtplotter/jkqtpparsedfunctionelements.cpp \ $$PWD/jkqtplotter/jkqtpoverlayelements.cpp \ $$PWD/jkqtplotter/jkqtpgeoelements.cpp \ @@ -49,10 +53,13 @@ RESOURCES += $$PWD/jkqtplotterressources/jkqtpbaseplotter.qrc INCLUDEPATH += $$PWD -QT += core gui svg -win32:LIBS += -lgdi32 +QT += core gui xml svg +#win32:LIBS += -lgdi32 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport +include($$PWD/jkqtplotterressources/math_fonts/xits.pri) +DEFINES += AUTOLOAD_XITS_FONTS +DEFINES += USE_XITS_FONTS # for support of palettes stored as XML, use: QT += xml diff --git a/lib/jkqtplotter/jkqtpbaseplotter.cpp b/lib/jkqtplotter/jkqtpbaseplotter.cpp index e9ec9e6f75..97e345f6cc 100644 --- a/lib/jkqtplotter/jkqtpbaseplotter.cpp +++ b/lib/jkqtplotter/jkqtpbaseplotter.cpp @@ -51,6 +51,8 @@ #endif #include "jkqtplotter/jkqtpboxplotelements.h" #include "jkqtplotter/jkqtpbarchartelements.h" +#include "jkqtplotter/jkqtpfilledcurveelements.h" +#include "jkqtplotter/jkqtpimpulseselements.h" static QString globalUserSettigsFilename=""; static QString globalUserSettigsPrefix=""; diff --git a/lib/jkqtplotter/jkqtpelements.cpp b/lib/jkqtplotter/jkqtpelements.cpp index fc773477b8..45276fff9b 100644 --- a/lib/jkqtplotter/jkqtpelements.cpp +++ b/lib/jkqtplotter/jkqtpelements.cpp @@ -526,597 +526,6 @@ void JKQTPxyLineErrorGraph::drawErrorsBefore(JKQTPEnhancedPainter &painter) -JKQTPimpulsesVerticalGraph::JKQTPimpulsesVerticalGraph(JKQtBasePlotter* parent): - JKQTPxyGraph(parent) -{ - baseline=0; - color=QColor("red"); - lineWidth=3; - parentPlotStyle=-1; - - if (parent) { // get style settings from parent object - parentPlotStyle=parent->getNextStyle(); - color=parent->getPlotStyle(parentPlotStyle).color(); - } -} - -JKQTPimpulsesVerticalGraph::JKQTPimpulsesVerticalGraph(JKQtPlotter* parent): - JKQTPxyGraph(parent) -{ - baseline=0; - color=QColor("red"); - lineWidth=3; - parentPlotStyle=-1; - - if (parent) { // get style settings from parent object - parentPlotStyle=parent->getNextStyle(); - color=parent->getPlotStyle(parentPlotStyle).color(); - } -} -void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) { -#ifdef JKQTBP_AUTOTIMER - JKQTPAutoOutputTimer jkaaot("JKQTPimpulsesVerticalGraph::draw"); -#endif - if (parent==nullptr) return; - JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==nullptr) return; - - drawErrorsBefore(painter); - - painter.save(); - - QPen p=painter.pen(); - p.setColor(color); - p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); - p.setStyle(Qt::SolidLine); - p.setCapStyle(Qt::FlatCap); - - int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); - int imin=0; - // interpret data ranges - if (datarange_start>-1) { - imin=qMin(datarange_start, static_cast(imax)); - } - if (datarange_end>-1) { - imax=qMin(datarange_end, static_cast(imax)); - } - if (imaxx2p(baseline); - if (parent->getXAxis()->isLogAxis()) { - if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); - else x0=xAxis->x2p(parent->getXAxis()->getMin()); - } -// double y0=yAxis->x2p(baseline); -// if (parent->getYAxis()->isLogAxis()) { -// y0=yAxis->x2p(parent->getYAxis()->getMin()); -// if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline); -// else y0=yAxis->x2p(parent->getYAxis()->getMin()); -// } - //bool first=false; - QVector lines; - intSortData(); - for (int iii=imin; iiiget(static_cast(xColumn),static_cast(i)); - double yv=datastore->get(static_cast(yColumn),static_cast(i)); - if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) { - double x=xAxis->x2p(xv); - double y=yAxis->x2p(yv); - - - lines.append(QLineF(x0, y, x, y)); - -// xold=x; -// yold=y; - //first=true; - } - } - painter.setPen(p); - if (lines.size()>0) painter.drawLines(lines); - painter.restore(); - - drawErrorsAfter(painter); -} - -void JKQTPimpulsesVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { - - - painter.save(); - QPen p=painter.pen(); - p.setColor(color); - p.setStyle(Qt::SolidLine); - p.setCapStyle(Qt::FlatCap); - p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,qMin(parent->pt2px(painter, qMax(.01, lineWidth)), rect.height()/2.0)*parent->get_lineWidthMultiplier())); - painter.setPen(p); - int y=rect.top()+rect.height()/2.0; - painter.drawLine(rect.left(), y, rect.right(), y); - painter.restore(); -} - -QColor JKQTPimpulsesVerticalGraph::getKeyLabelColor() { - return color; -} - - - - - - - - - - - -JKQTPimpulsesHorizontalGraph::JKQTPimpulsesHorizontalGraph(JKQtBasePlotter* parent): - JKQTPimpulsesVerticalGraph(parent) -{ -} - -JKQTPimpulsesHorizontalGraph::JKQTPimpulsesHorizontalGraph(JKQtPlotter *parent): - JKQTPimpulsesVerticalGraph(parent) -{ - -} - -void JKQTPimpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { -#ifdef JKQTBP_AUTOTIMER - JKQTPAutoOutputTimer jkaaot("JKQTPimpulsesHorizontalGraph::draw"); -#endif - if (parent==nullptr) return; - JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==nullptr) return; - - drawErrorsBefore(painter); - - painter.save(); - - QPen p=painter.pen(); - p.setColor(color); - p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); - p.setStyle(Qt::SolidLine); - p.setCapStyle(Qt::FlatCap); - - int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); - int imin=0; - // interpret data ranges - if (datarange_start>-1) { - imin=qMin(datarange_start, static_cast(imax)); - } - if (datarange_end>-1) { - imax=qMin(datarange_end, static_cast(imax)); - } - if (imaxx2p(baseline); -// if (parent->getXAxis()->isLogAxis()) { -// if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); -// else x0=xAxis->x2p(parent->getXAxis()->getMin()); -// } - double y0=yAxis->x2p(baseline); - if (parent->getYAxis()->isLogAxis()) { - y0=yAxis->x2p(parent->getYAxis()->getMin()); - if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline); - else y0=yAxis->x2p(parent->getYAxis()->getMin()); - } - QVector lines; - intSortData(); - for (int iii=imin; iiiget(static_cast(xColumn),static_cast(i)); - double yv=datastore->get(static_cast(yColumn),static_cast(i)); - if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) ) { - double x=xAxis->x2p(xv); - double y=yAxis->x2p(yv); - - - lines.append(QLineF(x, y0, x, y)); - - //xold=x; - //yold=y; - //first=true; - } - } - painter.setPen(p); - if (lines.size()>0) painter.drawLines(lines); - painter.restore(); - - drawErrorsAfter(painter); -} - - - - - - - - - - - - - - - - - - - -JKQTPfilledCurveXGraph::JKQTPfilledCurveXGraph(JKQtBasePlotter* parent): - JKQTPxyGraph(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(); - style=parent->getPlotStyle(parentPlotStyle).style(); - fillColor=color.lighter(); - } -} - -JKQTPfilledCurveXGraph::JKQTPfilledCurveXGraph(JKQtPlotter *parent): - JKQTPxyGraph(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(); - style=parent->getPlotStyle(parentPlotStyle).style(); - fillColor=color.lighter(); - } -} - -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(); - - QPen p=painter.pen(); - p.setColor(color); - p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); - 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; - // interpret data ranges - if (datarange_start>-1) { - imin=qMin(datarange_start, static_cast(imax)); - } - if (datarange_end>-1) { - imax=qMin(datarange_end, static_cast(imax)); - } - if (imaxx2p(baseline); -// if (parent->getXAxis()->isLogAxis()) { -// if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); -// else x0=xAxis->x2p(parent->getXAxis()->getMin()); -// } - double y0=yAxis->x2p(baseline); - if (parent->getYAxis()->isLogAxis()) { - y0=yAxis->x2p(parent->getYAxis()->getMin()); - if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline); - else y0=yAxis->x2p(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) = ( "<x2p(xv); bool xok=JKQTPIsOKFloat(x); - double y=yAxis->x2p(yv); bool yok=JKQTPIsOKFloat(y); - - if (!first) { - if (xok&&yok) { - pf.lineTo(x, y); - if (drawLine) pl.lineTo(x, y); - xold=x; - //yold=y; - } else if (xok&&!yok){ - pf.lineTo(x, y0); - if (drawLine) pl.lineTo(x, y0); - xold=x; - //yold=y0; - } - } else { - if (xok&&yok) { - if (drawLine) pl.moveTo(x,y); - pf.moveTo(x, y0); - pf.lineTo(x, y); - xold=x; - //yold=y; - first=false; - } else if (xok&&!yok) { - if (drawLine) pl.moveTo(x,y0); - pf.moveTo(x, y0); - xold=x; - //yold=y0; - first=false; - } - } - - } - } - pf.lineTo(xold, y0); - pf.closeSubpath(); - if (drawLine) { - painter.save(); - - if (drawSelectionLine) { - QPen penSelection=p; penSelection.setStyle(Qt::SolidLine); - QColor selcol=penSelection.color(); selcol.setAlphaF(0.5); penSelection.setColor(selcol); - if (selectionLineColor!=Qt::transparent) { - penSelection.setColor(selectionLineColor); - } - penSelection.setWidthF(penSelection.widthF()*3.0); - painter.setPen(penSelection); - painter.drawPath(pl); - } - - - painter.setPen(p); - painter.drawPath(pl); - painter.restore(); - } - painter.setBrush(b); - painter.setPen(np); - painter.drawPath(pf); - - painter.restore(); - - drawErrorsAfter(painter); -} - -void JKQTPfilledCurveXGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { - painter.save(); - QPen p=painter.pen(); - QPen np(Qt::NoPen); - p.setColor(color); - p.setStyle(style); - p.setJoinStyle(Qt::RoundJoin); - p.setCapStyle(Qt::RoundCap); - QBrush b=painter.brush(); - b.setColor(fillColor); - b.setStyle(fillStyle); - //int y=rect.top()+rect.height()/2.0; - painter.setPen(np); - if (drawLine) painter.setPen(p); - painter.setBrush(b); - painter.drawRect(rect); - painter.restore(); -} - -QColor JKQTPfilledCurveXGraph::getKeyLabelColor() { - return color; -} - - - - - - - - - - - - - - -JKQTPfilledCurveYGraph::JKQTPfilledCurveYGraph(JKQtBasePlotter* parent): - JKQTPfilledCurveXGraph(parent) -{ -} - -JKQTPfilledCurveYGraph::JKQTPfilledCurveYGraph(JKQtPlotter *parent): - JKQTPfilledCurveXGraph(parent) -{ - -} - -void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) { -#ifdef JKQTBP_AUTOTIMER - JKQTPAutoOutputTimer jkaaot("JKQTPfilledCurveYGraph::draw"); -#endif - if (parent==nullptr) return; - JKQTPdatastore* datastore=parent->getDatastore(); - if (datastore==nullptr) return; - - drawErrorsBefore(painter); - - painter.save(); - - QPen p=painter.pen(); - p.setColor(color); - p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); - 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=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); - int imin=0; - // interpret data ranges - if (datarange_start>-1) { - imin=qMin(datarange_start, static_cast(imax)); - } - if (datarange_end>-1) { - imax=qMin(datarange_end, static_cast(imax)); - } - if (imaxx2p(baseline); - if (parent->getXAxis()->isLogAxis()) { - if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); - else x0=xAxis->x2p(parent->getXAxis()->getMin()); - } - double y0=yAxis->x2p(baseline); - if (parent->getYAxis()->isLogAxis()) { - y0=yAxis->x2p(parent->getYAxis()->getMin()); - if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline); - else y0=yAxis->x2p(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) = ( "<x2p(xv); bool xok=JKQTPIsOKFloat(x); - double y=yAxis->x2p(yv); bool yok=JKQTPIsOKFloat(y); - - if (!first) { - if (xok&&yok) { - pf.lineTo(x, y); - if (drawLine) pl.lineTo(x, y); - //xold=x; - yold=y; - } else if (!xok&&yok){ - pf.lineTo(x0, y); - if (drawLine) pl.lineTo(x0, y); - //xold=x0; - yold=y; - } - } else { - if (xok&&yok) { - if (drawLine) pl.moveTo(x,y); - pf.moveTo(x, y0); - pf.lineTo(x, y); - //xold=x; - yold=y; - first=false; - } else if (!xok&&yok) { - if (drawLine) pl.moveTo(x0,y); - pf.moveTo(x0, y); - //xold=x0; - yold=y; - first=false; - } - } - } - } - pf.lineTo(x0, yold); - pf.closeSubpath(); - if (drawLine) { - painter.save(); - if (drawSelectionLine) { - QPen penSelection=p; penSelection.setStyle(Qt::SolidLine); - QColor selcol=penSelection.color(); selcol.setAlphaF(0.5); penSelection.setColor(selcol); - if (selectionLineColor!=Qt::transparent) { - penSelection.setColor(selectionLineColor); - } - penSelection.setWidthF(penSelection.widthF()*3.0); - painter.setPen(penSelection); - painter.drawPath(pl); - } - - painter.setPen(p); - painter.drawPath(pl); - painter.restore(); - } - painter.setBrush(b); - painter.setPen(np); - painter.drawPath(pf); - - painter.restore(); - - drawErrorsAfter(painter); -} - - - - - - - - - - - - @@ -1805,34 +1214,6 @@ QBrush JKQTPxyLineGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const { } -QPen JKQTPimpulsesVerticalGraph::getPen(JKQTPEnhancedPainter& painter) const { - QPen p; - p.setColor(color); - p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->get_lineWidthMultiplier()*lineWidth))); - return p; - -} - - -QPen JKQTPfilledCurveXGraph::getLinePen(JKQTPEnhancedPainter& painter) const { - QPen p; - p.setColor(color); - p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->get_lineWidthMultiplier()*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; -} - - QBrush JKQTPstepHorizontalGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const { QBrush b; b.setColor(fillColor); @@ -1868,89 +1249,6 @@ QPen JKQTPhorizontalRange::getLinePen(JKQTPEnhancedPainter& painter) const { return p; } -bool JKQTPimpulsesHorizontalErrorGraph::usesColumn(int c) -{ - return JKQTPimpulsesVerticalGraph::usesColumn(c)|| JKQTPxGraphErrors::errorUsesColumn(c); -} - -void JKQTPimpulsesHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter) -{ - if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); - else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); -} - -JKQTPimpulsesVerticalErrorGraph::JKQTPimpulsesVerticalErrorGraph(JKQtBasePlotter *parent): - JKQTPimpulsesHorizontalGraph(parent), JKQTPyGraphErrors() -{ - setErrorColorFromGraphColor(color); -} - -JKQTPimpulsesVerticalErrorGraph::JKQTPimpulsesVerticalErrorGraph(JKQtPlotter *parent): - JKQTPimpulsesHorizontalGraph(parent), JKQTPyGraphErrors() -{ - setErrorColorFromGraphColor(color); -} - -bool JKQTPimpulsesVerticalErrorGraph::usesColumn(int c) -{ - return JKQTPimpulsesHorizontalGraph::usesColumn(c)|| JKQTPyGraphErrors::errorUsesColumn(c); -} - -void JKQTPimpulsesVerticalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter) -{ - if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); - else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); - -} - -JKQTPfilledCurveXErrorGraph::JKQTPfilledCurveXErrorGraph(JKQtBasePlotter *parent): - JKQTPfilledCurveXGraph(parent), JKQTPyGraphErrors() -{ - setErrorColorFromGraphColor(color); -} - -JKQTPfilledCurveXErrorGraph::JKQTPfilledCurveXErrorGraph(JKQtPlotter *parent): - JKQTPfilledCurveXGraph(parent), JKQTPyGraphErrors() -{ - setErrorColorFromGraphColor(color); -} - -bool JKQTPfilledCurveXErrorGraph::usesColumn(int c) -{ - return JKQTPfilledCurveXGraph::usesColumn(c)|| JKQTPyGraphErrors::errorUsesColumn(c); -} - -void JKQTPfilledCurveXErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter) -{ - if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); - else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); - -} - -JKQTPfilledCurveYErrorGraph::JKQTPfilledCurveYErrorGraph(JKQtBasePlotter *parent): - JKQTPfilledCurveYGraph(parent), JKQTPxGraphErrors() -{ - setErrorColorFromGraphColor(color); -} - -JKQTPfilledCurveYErrorGraph::JKQTPfilledCurveYErrorGraph(JKQtPlotter *parent): - JKQTPfilledCurveYGraph(parent), JKQTPxGraphErrors() -{ - setErrorColorFromGraphColor(color); -} - -bool JKQTPfilledCurveYErrorGraph::usesColumn(int c) -{ - return JKQTPfilledCurveYGraph::usesColumn(c)|| JKQTPxGraphErrors::errorUsesColumn(c); -} - -void JKQTPfilledCurveYErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter) -{ - if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); - else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); - -} - JKQTPxyParametrizedScatterGraph::JKQTPxyParametrizedScatterGraph(JKQtBasePlotter *parent): JKQTPxyLineGraph(parent), @@ -2389,240 +1687,3 @@ bool JKQTPxyParametrizedErrorScatterGraph::intPlotXYErrorIndicatorsGetColor(JKQT -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(); - style=parent->getPlotStyle(parentPlotStyle).style(); - fillColor=color.lighter(); - } -} - -JKQTPfilledVerticalRangeGraph::JKQTPfilledVerticalRangeGraph(JKQtPlotter *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(); - style=parent->getPlotStyle(parentPlotStyle).style(); - fillColor=color.lighter(); - } -} - -bool JKQTPfilledVerticalRangeGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) -{ - bool start=true; - miny=0; - maxy=0; - smallestGreaterZero=0; - - if (parent==nullptr) return false; - - JKQTPdatastore* datastore=parent->getDatastore(); - int imin=0; - int imax=qMin(qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()), datastore->getColumn(static_cast(yColumn2)).getRows()); - // interpret data ranges - if (datarange_start>-1) { - imin=qMin(datarange_start, static_cast(imax)); - } - if (datarange_end>-1) { - imax=qMin(datarange_end, static_cast(imax)); - } - if (imaxget(static_cast(yColumn),static_cast(i)); - double yv2=datastore->get(static_cast(yColumn2),static_cast(i)); - if (JKQTPIsOKFloat(yv)) { - if (start || yv>maxy) maxy=yv; - if (start || yvmaxy) maxy=yv2; - if (start || yv2getDatastore(); - if (datastore==nullptr) return; - - drawErrorsBefore(painter); - - painter.save(); - - QPen p=painter.pen(); - p.setColor(color); - p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); - 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(qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()), datastore->getColumn(static_cast(yColumn2)).getRows()); - int imin=0; - // interpret data ranges - if (datarange_start>-1) { - imin=qMin(datarange_start, static_cast(imax)); - } - if (datarange_end>-1) { - imax=qMin(datarange_end, static_cast(imax)); - } - if (imaxget(static_cast(xColumn),static_cast(i)); - double yv=datastore->get(static_cast(yColumn),static_cast(i)); - double yv2=datastore->get(static_cast(yColumn2),static_cast(i)); - //std::cout<<"(xv, yv) = ( "<x2p(xv); bool xok=JKQTPIsOKFloat(x); - double y=yAxis->x2p(yv); bool yok=JKQTPIsOKFloat(y); - double y2=yAxis->x2p(yv2); bool y2ok=JKQTPIsOKFloat(y2); - - if (xok&&yok) phigh.append(QPointF(x,y)); - if (xok&&yok) poly_all.append(QPointF(x,y)); - if (xok&&y2ok) plow.append(QPointF(x,y2)); - } - } - - if (plow.size()>0) { - for (int i=plow.size()-1; i>=0; i--) { - poly_all.append(plow[i]); - } - } - painter.setBrush(b); - painter.setPen(np); - painter.drawPolygon(poly_all); - - painter.restore(); - if (drawLine) { - painter.save(); - - if (drawSelectionLine) { - QPen penSelection=p; penSelection.setStyle(Qt::SolidLine); - QColor selcol=penSelection.color(); selcol.setAlphaF(0.5); penSelection.setColor(selcol); - if (selectionLineColor!=Qt::transparent) { - penSelection.setColor(selectionLineColor); - } - penSelection.setWidthF(penSelection.widthF()*3.0); - painter.setPen(penSelection); - painter.drawPolyline(phigh); - painter.drawPolyline(plow); - } - - - painter.setPen(p); - painter.drawPolyline(phigh); - painter.drawPolyline(plow); - painter.restore(); - } - - drawErrorsAfter(painter); -} - -void JKQTPfilledVerticalRangeGraph::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect) -{ - painter.save(); - QRectF r=rect; - r.setHeight(r.height()/2.0); - r.moveTo(r.x(), r.y()+r.height()-1); - painter.fillRect(r, getBrush(painter)); - if (drawLine) { - painter.setPen(getLinePen(painter)); - painter.drawLine(QLineF(r.topLeft(), r.topRight())); - } - painter.restore(); -} - -QColor JKQTPfilledVerticalRangeGraph::getKeyLabelColor() -{ - return color; -} - -QBrush JKQTPfilledVerticalRangeGraph::getBrush(JKQTPEnhancedPainter &painter) const -{ - QBrush b; - b.setColor(fillColor); - b.setStyle(fillStyle); - return b; -} - -QPen JKQTPfilledVerticalRangeGraph::getLinePen(JKQTPEnhancedPainter &painter) const -{ - QPen p; - p.setColor(color); - p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); - p.setStyle(style); - p.setJoinStyle(Qt::RoundJoin); - p.setCapStyle(Qt::RoundCap); - return p; -} diff --git a/lib/jkqtplotter/jkqtpelements.h b/lib/jkqtplotter/jkqtpelements.h index d077d8c011..be20af1a3c 100644 --- a/lib/jkqtplotter/jkqtpelements.h +++ b/lib/jkqtplotter/jkqtpelements.h @@ -355,333 +355,6 @@ class LIB_EXPORT JKQTPxyParametrizedErrorScatterGraph: public JKQTPxyParametrize }; -/*! \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) ) - \ingroup jkqtplotter_plots - - \image html plot_impulsesxplots.png - */ -class LIB_EXPORT JKQTPimpulsesVerticalGraph: public JKQTPxyGraph { - Q_OBJECT - public: - /** \brief class constructor */ - JKQTPimpulsesVerticalGraph(JKQtBasePlotter* parent=nullptr); - /** \brief class constructor */ - JKQTPimpulsesVerticalGraph(JKQtPlotter* parent); - - /** \brief plots the graph to the plotter object specified as parent */ - virtual void draw(JKQTPEnhancedPainter& painter); - /** \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(); - - JKQTPGET_SET_MACRO(QColor, color) - JKQTPGET_SET_MACRO(double, lineWidth) - JKQTPGET_SET_MACRO(double, baseline) - - /** \brief color of the graph */ - QColor color; - /** \brief width (pixels) of the lines */ - double lineWidth; - - protected: - /** \brief which plot style to use from the parent plotter (via JKQtPlotterBase::getPlotStyle() and JKQtPlotterBase::getNextStyle() ) */ - int parentPlotStyle; - - /** \brief baseline of the plot (NOTE: 0 is interpreted as until plot border in log-mode!!!) - */ - double baseline; - QPen getPen(JKQTPEnhancedPainter &painter) const; -}; - - - -/*! \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) ) - \ingroup jkqtplotter_plots - - \image html plot_impulsesxerrorsplots.png - */ -class LIB_EXPORT JKQTPimpulsesHorizontalErrorGraph: public JKQTPimpulsesVerticalGraph, public JKQTPxGraphErrors { - Q_OBJECT - public: - /** \brief class constructor */ - inline JKQTPimpulsesHorizontalErrorGraph(JKQtBasePlotter* parent=nullptr): - JKQTPimpulsesVerticalGraph(parent), JKQTPxGraphErrors() - { - setErrorColorFromGraphColor(color); - } - inline JKQTPimpulsesHorizontalErrorGraph(JKQtPlotter* parent): - JKQTPimpulsesVerticalGraph(parent), JKQTPxGraphErrors() - { - setErrorColorFromGraphColor(color); - } - /** \copydoc JKQTPgraph::usesColumn() */ - virtual bool usesColumn(int c); - - protected: - /** \brief this function is used to plot error inidcators before plotting the graphs. */ - virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) ; - -}; - - - - -/*! \brief This implements an impulse plot with impulses in direction of the Y axis (i.e. from y=0 to y=f(x) ) - \ingroup jkqtplotter_plots - - \image html plot_impulsesyplots.png - */ -class LIB_EXPORT JKQTPimpulsesHorizontalGraph: public JKQTPimpulsesVerticalGraph { - Q_OBJECT - public: - /** \brief class constructor */ - JKQTPimpulsesHorizontalGraph(JKQtBasePlotter* parent=nullptr); - /** \brief class constructor */ - JKQTPimpulsesHorizontalGraph(JKQtPlotter* parent); - - /** \brief plots the graph to the plotter object specified as parent */ - virtual void draw(JKQTPEnhancedPainter& painter); -}; - - - -/*! \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) ) - \ingroup jkqtplotter_plots - - \image html plot_impulsesyerrorsplots.png - */ -class LIB_EXPORT JKQTPimpulsesVerticalErrorGraph: public JKQTPimpulsesHorizontalGraph, public JKQTPyGraphErrors { - Q_OBJECT - public: - /** \brief class constructor */ - JKQTPimpulsesVerticalErrorGraph(JKQtBasePlotter* parent=nullptr); - /** \brief class constructor */ - JKQTPimpulsesVerticalErrorGraph(JKQtPlotter* parent); - /** \copydoc JKQTPgraph::usesColumn() */ - virtual bool usesColumn(int c); - - protected: - /** \brief this function is used to plot error inidcators before plotting the graphs. */ - virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) ; - -}; - - - - - - - -/*! \brief This implements filled curve plots where the area is filled between the plot line and the x-Axis. - \ingroup jkqtplotter_plots - - \image html plot_filledcurvexplots.png - */ -class LIB_EXPORT JKQTPfilledCurveXGraph: public JKQTPxyGraph { - 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); - /** \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(); - - JKQTPGET_SET_MACRO(QColor, color) - JKQTPGET_SET_MACRO(QColor, fillColor) - JKQTPGET_SET_MACRO(Qt::PenStyle, style) - JKQTPGET_SET_MACRO(double, lineWidth) - JKQTPGET_SET_MACRO(double, baseline) - JKQTPGET_SET_MACRO(bool, drawLine) - JKQTPGET_SET_MACRO(Qt::BrushStyle, fillStyle) - - JKQTPGET_SET_MACRO(bool, drawSelectionLine) - JKQTPGET_SET_MACRO(QColor, 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 JKQtPlotterBase::getPlotStyle() and JKQtPlotterBase::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; -}; - - - -/*! \brief This implements filled curve plots with y errors where the area is filled between the plot line and the x-Axis. - \ingroup jkqtplotter_plots - - \image html plot_filledcurvexerrorplots.png - */ -class LIB_EXPORT JKQTPfilledCurveXErrorGraph: public JKQTPfilledCurveXGraph, public JKQTPyGraphErrors { - Q_OBJECT - public: - /** \brief class constructor */ - JKQTPfilledCurveXErrorGraph(JKQtBasePlotter* parent=nullptr); - /** \brief class constructor */ - JKQTPfilledCurveXErrorGraph(JKQtPlotter* parent); - /** \copydoc JKQTPgraph::usesColumn() */ - virtual bool usesColumn(int c); - - protected: - /** \brief this function is used to plot error inidcators before plotting the graphs. */ - virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter); - -}; - - - - - - -/*! \brief This implements filled curve plots where the area is filled between the plot line and y-Axis - \ingroup jkqtplotter_plots - - \image html plot_filledcurveyplots.png - */ -class LIB_EXPORT JKQTPfilledCurveYGraph: public JKQTPfilledCurveXGraph { - Q_OBJECT - public: - /** \brief class constructor */ - JKQTPfilledCurveYGraph(JKQtBasePlotter* parent=nullptr); - /** \brief class constructor */ - JKQTPfilledCurveYGraph(JKQtPlotter* parent); - - /** \brief plots the graph to the plotter object specified as parent */ - virtual void draw(JKQTPEnhancedPainter& painter); -}; - - - -/*! \brief This implements filled curve plots with y errors where the area is filled between the plot line and the x-Axis. - \ingroup jkqtplotter_plots - - \image html plot_filledcurveyerrorplots.png - */ -class LIB_EXPORT JKQTPfilledCurveYErrorGraph: public JKQTPfilledCurveYGraph, public JKQTPxGraphErrors { - Q_OBJECT - public: - /** \brief class constructor */ - JKQTPfilledCurveYErrorGraph(JKQtBasePlotter* parent=nullptr); - JKQTPfilledCurveYErrorGraph(JKQtPlotter* parent); - /** \copydoc JKQTPgraph::usesColumn() */ - virtual bool usesColumn(int c); - - protected: - /** \brief this function is used to plot error inidcators before plotting the graphs. */ - virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter); - -}; - - - - - - - -/*! \brief This implements filled curve plots where the area is filled between two data columns for each x-value - \ingroup jkqtplotter_plots - - With set_drawlines(false): - \image html JKQTPfilledVerticalRangeGraph.png - - With set_drawlines(true): - \image html JKQTPfilledVerticalRangeGraph_WithLines.png - */ -class LIB_EXPORT JKQTPfilledVerticalRangeGraph: public JKQTPxyGraph { - Q_OBJECT - public: - /** \brief class constructor */ - JKQTPfilledVerticalRangeGraph(JKQtBasePlotter* parent=nullptr); - /** \brief class constructor */ - JKQTPfilledVerticalRangeGraph(JKQtPlotter* parent); - /** \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); - - /** \copydoc JKQTPgraph::usesColumn() */ - virtual bool usesColumn(int column); - - /** \brief plots the graph to the plotter object specified as parent */ - virtual void draw(JKQTPEnhancedPainter& painter); - /** \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(); - - JKQTPGET_SET_MACRO(int, yColumn2) - JKQTPSET_CAST_MACRO(size_t, int, yColumn2) - - JKQTPGET_SET_MACRO(QColor, color) - JKQTPGET_SET_MACRO(QColor, fillColor) - JKQTPGET_SET_MACRO(Qt::PenStyle, style) - JKQTPGET_SET_MACRO(bool, drawLine) - JKQTPGET_SET_MACRO(Qt::BrushStyle, fillStyle) - - JKQTPGET_SET_MACRO(bool, drawSelectionLine) - JKQTPGET_SET_MACRO(QColor, selectionLineColor) - - protected: - - /** \brief the column that contains the second y-component of the range */ - int yColumn2; - /** \brief if \c true, draws a thick shadow around the line*/ - bool drawSelectionLine; - /** \brief color for the shadow, or a lighter version of the line color, if transparent (default) */ - QColor selectionLineColor; - - /** \brief which plot style to use from the parent plotter (via JKQtPlotterBase::getPlotStyle() and JKQtPlotterBase::getNextStyle() ) */ - int parentPlotStyle; - - /** \brief color of the graph */ - QColor color; - /** \brief color of the graph fill */ - QColor fillColor; - /** \brief fill styl for the curve */ - Qt::BrushStyle fillStyle; - /** \brief linestyle of the graph lines */ - Qt::PenStyle style; - /** \brief width (pixels) of the graph */ - double lineWidth; - /** \brief indicates whether to draw a line or not */ - bool drawLine; - - QBrush getBrush(JKQTPEnhancedPainter& painter) const; - QPen getLinePen(JKQTPEnhancedPainter& painter) const; -}; - - - - /*! \brief This implements a step plot with values \f$ \left(x, f(x) \right) \f$ \ingroup jkqtplotter_plots diff --git a/lib/jkqtplotter/jkqtpfilledcurveelements.cpp b/lib/jkqtplotter/jkqtpfilledcurveelements.cpp new file mode 100644 index 0000000000..e46c3e9d0e --- /dev/null +++ b/lib/jkqtplotter/jkqtpfilledcurveelements.cpp @@ -0,0 +1,699 @@ +/* + Copyright (c) 2008-2018 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 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/jkqtpfilledcurveelements.h" +#include "jkqtplotter/jkqtpbaseplotter.h" +#include +#include +#include +#include "jkqtplottertools/jkqtptools.h" +#include "jkqtplotter/jkqtpimageelements.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(); + style=parent->getPlotStyle(parentPlotStyle).style(); + fillColor=color.lighter(); + } +} + +JKQTPfilledCurveXGraph::JKQTPfilledCurveXGraph(JKQtPlotter *parent): + JKQTPxyGraph(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(); + style=parent->getPlotStyle(parentPlotStyle).style(); + fillColor=color.lighter(); + } +} + +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(); + + QPen p=painter.pen(); + p.setColor(color); + p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); + 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; + // interpret data ranges + if (datarange_start>-1) { + imin=qMin(datarange_start, static_cast(imax)); + } + if (datarange_end>-1) { + imax=qMin(datarange_end, static_cast(imax)); + } + if (imaxx2p(baseline); +// if (parent->getXAxis()->isLogAxis()) { +// if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); +// else x0=xAxis->x2p(parent->getXAxis()->getMin()); +// } + double y0=yAxis->x2p(baseline); + if (parent->getYAxis()->isLogAxis()) { + y0=yAxis->x2p(parent->getYAxis()->getMin()); + if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline); + else y0=yAxis->x2p(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) = ( "<x2p(xv); bool xok=JKQTPIsOKFloat(x); + double y=yAxis->x2p(yv); bool yok=JKQTPIsOKFloat(y); + + if (!first) { + if (xok&&yok) { + pf.lineTo(x, y); + if (drawLine) pl.lineTo(x, y); + xold=x; + //yold=y; + } else if (xok&&!yok){ + pf.lineTo(x, y0); + if (drawLine) pl.lineTo(x, y0); + xold=x; + //yold=y0; + } + } else { + if (xok&&yok) { + if (drawLine) pl.moveTo(x,y); + pf.moveTo(x, y0); + pf.lineTo(x, y); + xold=x; + //yold=y; + first=false; + } else if (xok&&!yok) { + if (drawLine) pl.moveTo(x,y0); + pf.moveTo(x, y0); + xold=x; + //yold=y0; + first=false; + } + } + + } + } + pf.lineTo(xold, y0); + pf.closeSubpath(); + if (drawLine) { + painter.save(); + + if (drawSelectionLine) { + QPen penSelection=p; penSelection.setStyle(Qt::SolidLine); + QColor selcol=penSelection.color(); selcol.setAlphaF(0.5); penSelection.setColor(selcol); + if (selectionLineColor!=Qt::transparent) { + penSelection.setColor(selectionLineColor); + } + penSelection.setWidthF(penSelection.widthF()*3.0); + painter.setPen(penSelection); + painter.drawPath(pl); + } + + + painter.setPen(p); + painter.drawPath(pl); + painter.restore(); + } + painter.setBrush(b); + painter.setPen(np); + painter.drawPath(pf); + + painter.restore(); + + drawErrorsAfter(painter); +} + +void JKQTPfilledCurveXGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { + painter.save(); + QPen p=painter.pen(); + QPen np(Qt::NoPen); + p.setColor(color); + p.setStyle(style); + p.setJoinStyle(Qt::RoundJoin); + p.setCapStyle(Qt::RoundCap); + QBrush b=painter.brush(); + b.setColor(fillColor); + b.setStyle(fillStyle); + //int y=rect.top()+rect.height()/2.0; + painter.setPen(np); + if (drawLine) painter.setPen(p); + painter.setBrush(b); + painter.drawRect(rect); + painter.restore(); +} + +QColor JKQTPfilledCurveXGraph::getKeyLabelColor() { + return color; +} + + + + + + + + + + + + + + +JKQTPfilledCurveYGraph::JKQTPfilledCurveYGraph(JKQtBasePlotter* parent): + JKQTPfilledCurveXGraph(parent) +{ +} + +JKQTPfilledCurveYGraph::JKQTPfilledCurveYGraph(JKQtPlotter *parent): + JKQTPfilledCurveXGraph(parent) +{ + +} + +void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) { +#ifdef JKQTBP_AUTOTIMER + JKQTPAutoOutputTimer jkaaot("JKQTPfilledCurveYGraph::draw"); +#endif + if (parent==nullptr) return; + JKQTPdatastore* datastore=parent->getDatastore(); + if (datastore==nullptr) return; + + drawErrorsBefore(painter); + + painter.save(); + + QPen p=painter.pen(); + p.setColor(color); + p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); + 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=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); + int imin=0; + // interpret data ranges + if (datarange_start>-1) { + imin=qMin(datarange_start, static_cast(imax)); + } + if (datarange_end>-1) { + imax=qMin(datarange_end, static_cast(imax)); + } + if (imaxx2p(baseline); + if (parent->getXAxis()->isLogAxis()) { + if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); + else x0=xAxis->x2p(parent->getXAxis()->getMin()); + } + double y0=yAxis->x2p(baseline); + if (parent->getYAxis()->isLogAxis()) { + y0=yAxis->x2p(parent->getYAxis()->getMin()); + if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline); + else y0=yAxis->x2p(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) = ( "<x2p(xv); bool xok=JKQTPIsOKFloat(x); + double y=yAxis->x2p(yv); bool yok=JKQTPIsOKFloat(y); + + if (!first) { + if (xok&&yok) { + pf.lineTo(x, y); + if (drawLine) pl.lineTo(x, y); + //xold=x; + yold=y; + } else if (!xok&&yok){ + pf.lineTo(x0, y); + if (drawLine) pl.lineTo(x0, y); + //xold=x0; + yold=y; + } + } else { + if (xok&&yok) { + if (drawLine) pl.moveTo(x,y); + pf.moveTo(x, y0); + pf.lineTo(x, y); + //xold=x; + yold=y; + first=false; + } else if (!xok&&yok) { + if (drawLine) pl.moveTo(x0,y); + pf.moveTo(x0, y); + //xold=x0; + yold=y; + first=false; + } + } + } + } + pf.lineTo(x0, yold); + pf.closeSubpath(); + if (drawLine) { + painter.save(); + if (drawSelectionLine) { + QPen penSelection=p; penSelection.setStyle(Qt::SolidLine); + QColor selcol=penSelection.color(); selcol.setAlphaF(0.5); penSelection.setColor(selcol); + if (selectionLineColor!=Qt::transparent) { + penSelection.setColor(selectionLineColor); + } + penSelection.setWidthF(penSelection.widthF()*3.0); + painter.setPen(penSelection); + painter.drawPath(pl); + } + + painter.setPen(p); + painter.drawPath(pl); + painter.restore(); + } + painter.setBrush(b); + painter.setPen(np); + painter.drawPath(pf); + + painter.restore(); + + drawErrorsAfter(painter); +} + + + + + + + + + +QPen JKQTPfilledCurveXGraph::getLinePen(JKQTPEnhancedPainter& painter) const { + QPen p; + p.setColor(color); + p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->get_lineWidthMultiplier()*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() +{ + setErrorColorFromGraphColor(color); +} + +JKQTPfilledCurveXErrorGraph::JKQTPfilledCurveXErrorGraph(JKQtPlotter *parent): + JKQTPfilledCurveXGraph(parent), JKQTPyGraphErrors() +{ + setErrorColorFromGraphColor(color); +} + +bool JKQTPfilledCurveXErrorGraph::usesColumn(int c) +{ + return JKQTPfilledCurveXGraph::usesColumn(c)|| JKQTPyGraphErrors::errorUsesColumn(c); +} + +void JKQTPfilledCurveXErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter) +{ + if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); + else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); + +} + +JKQTPfilledCurveYErrorGraph::JKQTPfilledCurveYErrorGraph(JKQtBasePlotter *parent): + JKQTPfilledCurveYGraph(parent), JKQTPxGraphErrors() +{ + setErrorColorFromGraphColor(color); +} + +JKQTPfilledCurveYErrorGraph::JKQTPfilledCurveYErrorGraph(JKQtPlotter *parent): + JKQTPfilledCurveYGraph(parent), JKQTPxGraphErrors() +{ + setErrorColorFromGraphColor(color); +} + +bool JKQTPfilledCurveYErrorGraph::usesColumn(int c) +{ + return JKQTPfilledCurveYGraph::usesColumn(c)|| JKQTPxGraphErrors::errorUsesColumn(c); +} + +void JKQTPfilledCurveYErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter) +{ + if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); + else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); + +} + + + +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(); + style=parent->getPlotStyle(parentPlotStyle).style(); + fillColor=color.lighter(); + } +} + +JKQTPfilledVerticalRangeGraph::JKQTPfilledVerticalRangeGraph(JKQtPlotter *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(); + style=parent->getPlotStyle(parentPlotStyle).style(); + fillColor=color.lighter(); + } +} + +bool JKQTPfilledVerticalRangeGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) +{ + bool start=true; + miny=0; + maxy=0; + smallestGreaterZero=0; + + if (parent==nullptr) return false; + + JKQTPdatastore* datastore=parent->getDatastore(); + int imin=0; + int imax=qMin(qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()), datastore->getColumn(static_cast(yColumn2)).getRows()); + // interpret data ranges + if (datarange_start>-1) { + imin=qMin(datarange_start, static_cast(imax)); + } + if (datarange_end>-1) { + imax=qMin(datarange_end, static_cast(imax)); + } + if (imaxget(static_cast(yColumn),static_cast(i)); + double yv2=datastore->get(static_cast(yColumn2),static_cast(i)); + if (JKQTPIsOKFloat(yv)) { + if (start || yv>maxy) maxy=yv; + if (start || yvmaxy) maxy=yv2; + if (start || yv2getDatastore(); + if (datastore==nullptr) return; + + drawErrorsBefore(painter); + + painter.save(); + + QPen p=painter.pen(); + p.setColor(color); + p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); + 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(qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()), datastore->getColumn(static_cast(yColumn2)).getRows()); + int imin=0; + // interpret data ranges + if (datarange_start>-1) { + imin=qMin(datarange_start, static_cast(imax)); + } + if (datarange_end>-1) { + imax=qMin(datarange_end, static_cast(imax)); + } + if (imaxget(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); + double yv2=datastore->get(static_cast(yColumn2),static_cast(i)); + //std::cout<<"(xv, yv) = ( "<x2p(xv); bool xok=JKQTPIsOKFloat(x); + double y=yAxis->x2p(yv); bool yok=JKQTPIsOKFloat(y); + double y2=yAxis->x2p(yv2); bool y2ok=JKQTPIsOKFloat(y2); + + if (xok&&yok) phigh.append(QPointF(x,y)); + if (xok&&yok) poly_all.append(QPointF(x,y)); + if (xok&&y2ok) plow.append(QPointF(x,y2)); + } + } + + if (plow.size()>0) { + for (int i=plow.size()-1; i>=0; i--) { + poly_all.append(plow[i]); + } + } + painter.setBrush(b); + painter.setPen(np); + painter.drawPolygon(poly_all); + + painter.restore(); + if (drawLine) { + painter.save(); + + if (drawSelectionLine) { + QPen penSelection=p; penSelection.setStyle(Qt::SolidLine); + QColor selcol=penSelection.color(); selcol.setAlphaF(0.5); penSelection.setColor(selcol); + if (selectionLineColor!=Qt::transparent) { + penSelection.setColor(selectionLineColor); + } + penSelection.setWidthF(penSelection.widthF()*3.0); + painter.setPen(penSelection); + painter.drawPolyline(phigh); + painter.drawPolyline(plow); + } + + + painter.setPen(p); + painter.drawPolyline(phigh); + painter.drawPolyline(plow); + painter.restore(); + } + + drawErrorsAfter(painter); +} + +void JKQTPfilledVerticalRangeGraph::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect) +{ + painter.save(); + QRectF r=rect; + r.setHeight(r.height()/2.0); + r.moveTo(r.x(), r.y()+r.height()-1); + painter.fillRect(r, getBrush(painter)); + if (drawLine) { + painter.setPen(getLinePen(painter)); + painter.drawLine(QLineF(r.topLeft(), r.topRight())); + } + painter.restore(); +} + +QColor JKQTPfilledVerticalRangeGraph::getKeyLabelColor() +{ + return color; +} + +QBrush JKQTPfilledVerticalRangeGraph::getBrush(JKQTPEnhancedPainter &painter) const +{ + QBrush b; + b.setColor(fillColor); + b.setStyle(fillStyle); + return b; +} + +QPen JKQTPfilledVerticalRangeGraph::getLinePen(JKQTPEnhancedPainter &painter) const +{ + QPen p; + p.setColor(color); + p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); + p.setStyle(style); + p.setJoinStyle(Qt::RoundJoin); + p.setCapStyle(Qt::RoundCap); + return p; +} diff --git a/lib/jkqtplotter/jkqtpfilledcurveelements.h b/lib/jkqtplotter/jkqtpfilledcurveelements.h new file mode 100644 index 0000000000..5f339fb54c --- /dev/null +++ b/lib/jkqtplotter/jkqtpfilledcurveelements.h @@ -0,0 +1,240 @@ +/* + Copyright (c) 2008-2018 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 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 "jkqtplottertools/jkqtp_imexport.h" +#include "jkqtplotter/jkqtpbasegraphs.h" + +#ifndef JKQTPFILLEDCURVEELEMENTS_H +#define JKQTPFILLEDCURVEELEMENTS_H + + + + + +/*! \brief This implements filled curve plots where the area is filled between the plot line and the x-Axis. + \ingroup jkqtplotter_plots + + \image html plot_filledcurvexplots.png + */ +class LIB_EXPORT JKQTPfilledCurveXGraph: public JKQTPxyGraph { + 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); + /** \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(); + + JKQTPGET_SET_MACRO(QColor, color) + JKQTPGET_SET_MACRO(QColor, fillColor) + JKQTPGET_SET_MACRO(Qt::PenStyle, style) + JKQTPGET_SET_MACRO(double, lineWidth) + JKQTPGET_SET_MACRO(double, baseline) + JKQTPGET_SET_MACRO(bool, drawLine) + JKQTPGET_SET_MACRO(Qt::BrushStyle, fillStyle) + + JKQTPGET_SET_MACRO(bool, drawSelectionLine) + JKQTPGET_SET_MACRO(QColor, 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 JKQtPlotterBase::getPlotStyle() and JKQtPlotterBase::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; +}; + + + +/*! \brief This implements filled curve plots with y errors where the area is filled between the plot line and the x-Axis. + \ingroup jkqtplotter_plots + + \image html plot_filledcurvexerrorplots.png + */ +class LIB_EXPORT JKQTPfilledCurveXErrorGraph: public JKQTPfilledCurveXGraph, public JKQTPyGraphErrors { + Q_OBJECT + public: + /** \brief class constructor */ + JKQTPfilledCurveXErrorGraph(JKQtBasePlotter* parent=nullptr); + /** \brief class constructor */ + JKQTPfilledCurveXErrorGraph(JKQtPlotter* parent); + /** \copydoc JKQTPgraph::usesColumn() */ + virtual bool usesColumn(int c); + + protected: + /** \brief this function is used to plot error inidcators before plotting the graphs. */ + virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter); + +}; + + + + + + +/*! \brief This implements filled curve plots where the area is filled between the plot line and y-Axis + \ingroup jkqtplotter_plots + + \image html plot_filledcurveyplots.png + */ +class LIB_EXPORT JKQTPfilledCurveYGraph: public JKQTPfilledCurveXGraph { + Q_OBJECT + public: + /** \brief class constructor */ + JKQTPfilledCurveYGraph(JKQtBasePlotter* parent=nullptr); + /** \brief class constructor */ + JKQTPfilledCurveYGraph(JKQtPlotter* parent); + + /** \brief plots the graph to the plotter object specified as parent */ + virtual void draw(JKQTPEnhancedPainter& painter); +}; + + + +/*! \brief This implements filled curve plots with y errors where the area is filled between the plot line and the x-Axis. + \ingroup jkqtplotter_plots + + \image html plot_filledcurveyerrorplots.png + */ +class LIB_EXPORT JKQTPfilledCurveYErrorGraph: public JKQTPfilledCurveYGraph, public JKQTPxGraphErrors { + Q_OBJECT + public: + /** \brief class constructor */ + JKQTPfilledCurveYErrorGraph(JKQtBasePlotter* parent=nullptr); + JKQTPfilledCurveYErrorGraph(JKQtPlotter* parent); + /** \copydoc JKQTPgraph::usesColumn() */ + virtual bool usesColumn(int c); + + protected: + /** \brief this function is used to plot error inidcators before plotting the graphs. */ + virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter); + +}; + + + + + + + +/*! \brief This implements filled curve plots where the area is filled between two data columns for each x-value + \ingroup jkqtplotter_plots + + With set_drawlines(false): + \image html JKQTPfilledVerticalRangeGraph.png + + With set_drawlines(true): + \image html JKQTPfilledVerticalRangeGraph_WithLines.png + */ +class LIB_EXPORT JKQTPfilledVerticalRangeGraph: public JKQTPxyGraph { + Q_OBJECT + public: + /** \brief class constructor */ + JKQTPfilledVerticalRangeGraph(JKQtBasePlotter* parent=nullptr); + /** \brief class constructor */ + JKQTPfilledVerticalRangeGraph(JKQtPlotter* parent); + /** \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); + + /** \copydoc JKQTPgraph::usesColumn() */ + virtual bool usesColumn(int column); + + /** \brief plots the graph to the plotter object specified as parent */ + virtual void draw(JKQTPEnhancedPainter& painter); + /** \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(); + + JKQTPGET_SET_MACRO(int, yColumn2) + JKQTPSET_CAST_MACRO(size_t, int, yColumn2) + + JKQTPGET_SET_MACRO(QColor, color) + JKQTPGET_SET_MACRO(QColor, fillColor) + JKQTPGET_SET_MACRO(Qt::PenStyle, style) + JKQTPGET_SET_MACRO(bool, drawLine) + JKQTPGET_SET_MACRO(Qt::BrushStyle, fillStyle) + + JKQTPGET_SET_MACRO(bool, drawSelectionLine) + JKQTPGET_SET_MACRO(QColor, selectionLineColor) + + protected: + + /** \brief the column that contains the second y-component of the range */ + int yColumn2; + /** \brief if \c true, draws a thick shadow around the line*/ + bool drawSelectionLine; + /** \brief color for the shadow, or a lighter version of the line color, if transparent (default) */ + QColor selectionLineColor; + + /** \brief which plot style to use from the parent plotter (via JKQtPlotterBase::getPlotStyle() and JKQtPlotterBase::getNextStyle() ) */ + int parentPlotStyle; + + /** \brief color of the graph */ + QColor color; + /** \brief color of the graph fill */ + QColor fillColor; + /** \brief fill styl for the curve */ + Qt::BrushStyle fillStyle; + /** \brief linestyle of the graph lines */ + Qt::PenStyle style; + /** \brief width (pixels) of the graph */ + double lineWidth; + /** \brief indicates whether to draw a line or not */ + bool drawLine; + + QBrush getBrush(JKQTPEnhancedPainter& painter) const; + QPen getLinePen(JKQTPEnhancedPainter& painter) const; +}; + + + + +#endif // JKQTPFILLEDCURVEELEMENTS_H diff --git a/lib/jkqtplotter/jkqtpimpulseselements.cpp b/lib/jkqtplotter/jkqtpimpulseselements.cpp new file mode 100644 index 0000000000..e3ba082d44 --- /dev/null +++ b/lib/jkqtplotter/jkqtpimpulseselements.cpp @@ -0,0 +1,299 @@ +/* + Copyright (c) 2008-2018 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 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/jkqtpimpulseselements.h" +#include "jkqtplotter/jkqtpbaseplotter.h" +#include +#include +#include +#include "jkqtplottertools/jkqtptools.h" +#include "jkqtplotter/jkqtpimageelements.h" +#include "jkqtplotter/jkqtpbaseelements.h" +#include "jkqtplotter/jkqtplotter.h" +#define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgzgetNextStyle(); + color=parent->getPlotStyle(parentPlotStyle).color(); + } +} + +JKQTPimpulsesVerticalGraph::JKQTPimpulsesVerticalGraph(JKQtPlotter* parent): + JKQTPxyGraph(parent) +{ + baseline=0; + color=QColor("red"); + lineWidth=3; + parentPlotStyle=-1; + + if (parent) { // get style settings from parent object + parentPlotStyle=parent->getNextStyle(); + color=parent->getPlotStyle(parentPlotStyle).color(); + } +} +void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) { +#ifdef JKQTBP_AUTOTIMER + JKQTPAutoOutputTimer jkaaot("JKQTPimpulsesVerticalGraph::draw"); +#endif + if (parent==nullptr) return; + JKQTPdatastore* datastore=parent->getDatastore(); + if (datastore==nullptr) return; + + drawErrorsBefore(painter); + + painter.save(); + + QPen p=painter.pen(); + p.setColor(color); + p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); + p.setStyle(Qt::SolidLine); + p.setCapStyle(Qt::FlatCap); + + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); + int imin=0; + // interpret data ranges + if (datarange_start>-1) { + imin=qMin(datarange_start, static_cast(imax)); + } + if (datarange_end>-1) { + imax=qMin(datarange_end, static_cast(imax)); + } + if (imaxx2p(baseline); + if (parent->getXAxis()->isLogAxis()) { + if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); + else x0=xAxis->x2p(parent->getXAxis()->getMin()); + } +// double y0=yAxis->x2p(baseline); +// if (parent->getYAxis()->isLogAxis()) { +// y0=yAxis->x2p(parent->getYAxis()->getMin()); +// if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline); +// else y0=yAxis->x2p(parent->getYAxis()->getMin()); +// } + //bool first=false; + QVector lines; + intSortData(); + for (int iii=imin; iiiget(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); + if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) { + double x=xAxis->x2p(xv); + double y=yAxis->x2p(yv); + + + lines.append(QLineF(x0, y, x, y)); + +// xold=x; +// yold=y; + //first=true; + } + } + painter.setPen(p); + if (lines.size()>0) painter.drawLines(lines); + painter.restore(); + + drawErrorsAfter(painter); +} + +void JKQTPimpulsesVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) { + + + painter.save(); + QPen p=painter.pen(); + p.setColor(color); + p.setStyle(Qt::SolidLine); + p.setCapStyle(Qt::FlatCap); + p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,qMin(parent->pt2px(painter, qMax(.01, lineWidth)), rect.height()/2.0)*parent->get_lineWidthMultiplier())); + painter.setPen(p); + int y=rect.top()+rect.height()/2.0; + painter.drawLine(rect.left(), y, rect.right(), y); + painter.restore(); +} + +QColor JKQTPimpulsesVerticalGraph::getKeyLabelColor() { + return color; +} + + + + + + + + + + + +JKQTPimpulsesHorizontalGraph::JKQTPimpulsesHorizontalGraph(JKQtBasePlotter* parent): + JKQTPimpulsesVerticalGraph(parent) +{ +} + +JKQTPimpulsesHorizontalGraph::JKQTPimpulsesHorizontalGraph(JKQtPlotter *parent): + JKQTPimpulsesVerticalGraph(parent) +{ + +} + +void JKQTPimpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) { +#ifdef JKQTBP_AUTOTIMER + JKQTPAutoOutputTimer jkaaot("JKQTPimpulsesHorizontalGraph::draw"); +#endif + if (parent==nullptr) return; + JKQTPdatastore* datastore=parent->getDatastore(); + if (datastore==nullptr) return; + + drawErrorsBefore(painter); + + painter.save(); + + QPen p=painter.pen(); + p.setColor(color); + p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->get_lineWidthMultiplier()))); + p.setStyle(Qt::SolidLine); + p.setCapStyle(Qt::FlatCap); + + int imax=qMin(datastore->getColumn(static_cast(xColumn)).getRows(), datastore->getColumn(static_cast(yColumn)).getRows()); + int imin=0; + // interpret data ranges + if (datarange_start>-1) { + imin=qMin(datarange_start, static_cast(imax)); + } + if (datarange_end>-1) { + imax=qMin(datarange_end, static_cast(imax)); + } + if (imaxx2p(baseline); +// if (parent->getXAxis()->isLogAxis()) { +// if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline); +// else x0=xAxis->x2p(parent->getXAxis()->getMin()); +// } + double y0=yAxis->x2p(baseline); + if (parent->getYAxis()->isLogAxis()) { + y0=yAxis->x2p(parent->getYAxis()->getMin()); + if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline); + else y0=yAxis->x2p(parent->getYAxis()->getMin()); + } + QVector lines; + intSortData(); + for (int iii=imin; iiiget(static_cast(xColumn),static_cast(i)); + double yv=datastore->get(static_cast(yColumn),static_cast(i)); + if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) ) { + double x=xAxis->x2p(xv); + double y=yAxis->x2p(yv); + + + lines.append(QLineF(x, y0, x, y)); + + //xold=x; + //yold=y; + //first=true; + } + } + painter.setPen(p); + if (lines.size()>0) painter.drawLines(lines); + painter.restore(); + + drawErrorsAfter(painter); +} + + + + + +QPen JKQTPimpulsesVerticalGraph::getPen(JKQTPEnhancedPainter& painter) const { + QPen p; + p.setColor(color); + p.setWidthF(qMax(JKQTPLOTTER_ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->get_lineWidthMultiplier()*lineWidth))); + return p; + +} + + + +bool JKQTPimpulsesHorizontalErrorGraph::usesColumn(int c) +{ + return JKQTPimpulsesVerticalGraph::usesColumn(c)|| JKQTPxGraphErrors::errorUsesColumn(c); +} + +void JKQTPimpulsesHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter) +{ + if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); + else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); +} + +JKQTPimpulsesVerticalErrorGraph::JKQTPimpulsesVerticalErrorGraph(JKQtBasePlotter *parent): + JKQTPimpulsesHorizontalGraph(parent), JKQTPyGraphErrors() +{ + setErrorColorFromGraphColor(color); +} + +JKQTPimpulsesVerticalErrorGraph::JKQTPimpulsesVerticalErrorGraph(JKQtPlotter *parent): + JKQTPimpulsesHorizontalGraph(parent), JKQTPyGraphErrors() +{ + setErrorColorFromGraphColor(color); +} + +bool JKQTPimpulsesVerticalErrorGraph::usesColumn(int c) +{ + return JKQTPimpulsesHorizontalGraph::usesColumn(c)|| JKQTPyGraphErrors::errorUsesColumn(c); +} + +void JKQTPimpulsesVerticalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter) +{ + if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end); + else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices); + +} diff --git a/lib/jkqtplotter/jkqtpimpulseselements.h b/lib/jkqtplotter/jkqtpimpulseselements.h new file mode 100644 index 0000000000..91e694ebb0 --- /dev/null +++ b/lib/jkqtplotter/jkqtpimpulseselements.h @@ -0,0 +1,144 @@ +/* + Copyright (c) 2008-2018 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 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 "jkqtplottertools/jkqtp_imexport.h" +#include "jkqtplotter/jkqtpbasegraphs.h" + + +#ifndef JKQTPIMPULSESELEMENTS_H +#define JKQTPIMPULSESELEMENTS_H + + + +/*! \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) ) + \ingroup jkqtplotter_plots + + \image html plot_impulsesxplots.png + */ +class LIB_EXPORT JKQTPimpulsesVerticalGraph: public JKQTPxyGraph { + Q_OBJECT + public: + /** \brief class constructor */ + JKQTPimpulsesVerticalGraph(JKQtBasePlotter* parent=nullptr); + /** \brief class constructor */ + JKQTPimpulsesVerticalGraph(JKQtPlotter* parent); + + /** \brief plots the graph to the plotter object specified as parent */ + virtual void draw(JKQTPEnhancedPainter& painter); + /** \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(); + + JKQTPGET_SET_MACRO(QColor, color) + JKQTPGET_SET_MACRO(double, lineWidth) + JKQTPGET_SET_MACRO(double, baseline) + + /** \brief color of the graph */ + QColor color; + /** \brief width (pixels) of the lines */ + double lineWidth; + + protected: + /** \brief which plot style to use from the parent plotter (via JKQtPlotterBase::getPlotStyle() and JKQtPlotterBase::getNextStyle() ) */ + int parentPlotStyle; + + /** \brief baseline of the plot (NOTE: 0 is interpreted as until plot border in log-mode!!!) + */ + double baseline; + QPen getPen(JKQTPEnhancedPainter &painter) const; +}; + + + +/*! \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) ) + \ingroup jkqtplotter_plots + + \image html plot_impulsesxerrorsplots.png + */ +class LIB_EXPORT JKQTPimpulsesHorizontalErrorGraph: public JKQTPimpulsesVerticalGraph, public JKQTPxGraphErrors { + Q_OBJECT + public: + /** \brief class constructor */ + inline JKQTPimpulsesHorizontalErrorGraph(JKQtBasePlotter* parent=nullptr): + JKQTPimpulsesVerticalGraph(parent), JKQTPxGraphErrors() + { + setErrorColorFromGraphColor(color); + } + inline JKQTPimpulsesHorizontalErrorGraph(JKQtPlotter* parent): + JKQTPimpulsesVerticalGraph(parent), JKQTPxGraphErrors() + { + setErrorColorFromGraphColor(color); + } + /** \copydoc JKQTPgraph::usesColumn() */ + virtual bool usesColumn(int c); + + protected: + /** \brief this function is used to plot error inidcators before plotting the graphs. */ + virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) ; + +}; + + + + +/*! \brief This implements an impulse plot with impulses in direction of the Y axis (i.e. from y=0 to y=f(x) ) + \ingroup jkqtplotter_plots + + \image html plot_impulsesyplots.png + */ +class LIB_EXPORT JKQTPimpulsesHorizontalGraph: public JKQTPimpulsesVerticalGraph { + Q_OBJECT + public: + /** \brief class constructor */ + JKQTPimpulsesHorizontalGraph(JKQtBasePlotter* parent=nullptr); + /** \brief class constructor */ + JKQTPimpulsesHorizontalGraph(JKQtPlotter* parent); + + /** \brief plots the graph to the plotter object specified as parent */ + virtual void draw(JKQTPEnhancedPainter& painter); +}; + + + +/*! \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) ) + \ingroup jkqtplotter_plots + + \image html plot_impulsesyerrorsplots.png + */ +class LIB_EXPORT JKQTPimpulsesVerticalErrorGraph: public JKQTPimpulsesHorizontalGraph, public JKQTPyGraphErrors { + Q_OBJECT + public: + /** \brief class constructor */ + JKQTPimpulsesVerticalErrorGraph(JKQtBasePlotter* parent=nullptr); + /** \brief class constructor */ + JKQTPimpulsesVerticalErrorGraph(JKQtPlotter* parent); + /** \copydoc JKQTPgraph::usesColumn() */ + virtual bool usesColumn(int c); + + protected: + /** \brief this function is used to plot error inidcators before plotting the graphs. */ + virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) ; + +}; + + + + +#endif // JKQTPIMPULSESELEMENTS_H diff --git a/lib/jkqtplotterlib.pro b/lib/jkqtplotterlib.pro new file mode 100644 index 0000000000..a8288a22f1 --- /dev/null +++ b/lib/jkqtplotterlib.pro @@ -0,0 +1,6 @@ +TARGET = jkqtplotterlib + +TEMPLATE = lib +CONFIG+=staticlib + +include(jkqtplotter.pri) diff --git a/test/jkqtfastplotter_test/jkqtfastplotter_test.pro b/test/jkqtfastplotter_test/jkqtfastplotter_test.pro index a4ac3ffd1d..d147197ba2 100644 --- a/test/jkqtfastplotter_test/jkqtfastplotter_test.pro +++ b/test/jkqtfastplotter_test/jkqtfastplotter_test.pro @@ -5,8 +5,6 @@ TARGET = JKQTFastPlotter_test TEMPLATE = app -include(../../lib/jkqtfastplotter.pri) - SOURCES += jkqtfastplotter_test.cpp \ testmain.cpp @@ -29,3 +27,9 @@ DESTDIR = ./ DEFINES += DEBUG_TIMING greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport + +# include JKQtFastPlotter source code +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtfastplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtfastplotterlib diff --git a/test/jkqtmathtext_simpletest/jkqtmathtext_simpletest.pro b/test/jkqtmathtext_simpletest/jkqtmathtext_simpletest.pro index fba622abbc..16ecebb56c 100644 --- a/test/jkqtmathtext_simpletest/jkqtmathtext_simpletest.pro +++ b/test/jkqtmathtext_simpletest/jkqtmathtext_simpletest.pro @@ -1,10 +1,14 @@ -include(../../lib/jkqtmathtext_with_xits.pri) +TARGET = jkqtmathtext_simpletest +TEMPLATE = app + SOURCES += jkqtmathtext_simpletest.cpp CONFIG += qt -QT += core gui +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport -TARGET = jkqtmathtext_simpletest - +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib diff --git a/test/jkqtmathtext_simpletest/jkqtmathtext_simpletest_and_lib.pro b/test/jkqtmathtext_simpletest/jkqtmathtext_simpletest_and_lib.pro new file mode 100644 index 0000000000..bdfd2e3c48 --- /dev/null +++ b/test/jkqtmathtext_simpletest/jkqtmathtext_simpletest_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtmathtext_simpletest + +jkqtmathtext_simpletest.file=$$PWD/jkqtmathtext_simpletest.pro +jkqtmathtext_simpletest.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtmathtext_test/jkqtmathtext_test.pro b/test/jkqtmathtext_test/jkqtmathtext_test.pro index 544d72c33c..fbcea3668d 100644 --- a/test/jkqtmathtext_test/jkqtmathtext_test.pro +++ b/test/jkqtmathtext_test/jkqtmathtext_test.pro @@ -1,11 +1,9 @@ -include(../../lib/jkqtmathtext_with_xits.pri) include($$PWD/asana.pri) LIBS += SOURCES += jkqtmathtext_test.cpp \ - ../../lib/jkqtplottertools/jkqtphighrestimer.cpp \ testform.cpp RCC_DIR = rccs @@ -15,12 +13,11 @@ CONFIG += qt windows TARGET = jkqtplot_test -QT += core gui svg +QT += core gui svg xml UI_DIR = .uics -HEADERS += testform.h \ - ../../lib/jkqtplottertools/jkqtphighrestimer.h +HEADERS += testform.h OBJECTS_DIR = .objs @@ -36,3 +33,9 @@ DESTDIR = ./ DEFINES += AUTOLOAD_XITS_FONTS AUTOLOAD_Asana_FONTS greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport + + +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib \ No newline at end of file diff --git a/test/jkqtmathtext_test/jkqtmathtext_test_and_lib.pro b/test/jkqtmathtext_test/jkqtmathtext_test_and_lib.pro new file mode 100644 index 0000000000..2800b49698 --- /dev/null +++ b/test/jkqtmathtext_test/jkqtmathtext_test_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtmathtext_test + +jkqtmathtext_test.file=$$PWD/jkqtmathtext_test.pro +jkqtmathtext_test.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplot_test/TestWidgetGraphs.cpp b/test/jkqtplot_test/TestWidgetGraphs.cpp index 11d9c8bc85..a9dac2e9c5 100644 --- a/test/jkqtplot_test/TestWidgetGraphs.cpp +++ b/test/jkqtplot_test/TestWidgetGraphs.cpp @@ -4,7 +4,7 @@ #include #include #include "jkqtplotter/jkqtpboxplotelements.h" - +#include "jkqtplotter/jkqtpfilledcurveelements.h" diff --git a/test/jkqtplot_test/jkqtplot_test.pro b/test/jkqtplot_test/jkqtplot_test.pro index cc76072356..8d27e1b289 100644 --- a/test/jkqtplot_test/jkqtplot_test.pro +++ b/test/jkqtplot_test/jkqtplot_test.pro @@ -1,9 +1,3 @@ -# NOTE: This shouldn't be built as a SHADOW build -!equals(PWD, $${OUT_PWD}) { - warning(This project should not be built as a shadow build!!!) -} - -include(../../lib/jkqtplotter.pri) SOURCES += jkqtplot_test.cpp \ testmain.cpp \ @@ -48,7 +42,7 @@ DEFINES += TARGET = jkqtplot_test -QT += core gui svg xml +QT += core gui xml svg xml win32:LIBS += -lgdi32 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport @@ -80,3 +74,9 @@ DESTDIR = ./ RESOURCES += jkqtplot_test.qrc + + +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib diff --git a/test/jkqtplot_test/jkqtplotter_simpletest_imageplot_nodatastore_and_lib.pro b/test/jkqtplot_test/jkqtplotter_simpletest_imageplot_nodatastore_and_lib.pro new file mode 100644 index 0000000000..84daba629c --- /dev/null +++ b/test/jkqtplot_test/jkqtplotter_simpletest_imageplot_nodatastore_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplot_test + +jkqtplot_test.file=$$PWD/jkqtplot_test.pro +jkqtplot_test.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest/jkqtplotter_simpletest.pro b/test/jkqtplotter_simpletest/jkqtplotter_simpletest.pro index 8db2356ecc..dce8caaba4 100644 --- a/test/jkqtplotter_simpletest/jkqtplotter_simpletest.pro +++ b/test/jkqtplotter_simpletest/jkqtplotter_simpletest.pro @@ -3,14 +3,18 @@ SOURCES = jkqtplotter_simpletest.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER diff --git a/test/jkqtplotter_simpletest/jkqtplotter_simpletest_and_lib.pro b/test/jkqtplotter_simpletest/jkqtplotter_simpletest_and_lib.pro new file mode 100644 index 0000000000..4b05019c78 --- /dev/null +++ b/test/jkqtplotter_simpletest/jkqtplotter_simpletest_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest + +jkqtplotter_simpletest.file=$$PWD/jkqtplotter_simpletest.pro +jkqtplotter_simpletest.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart.cpp b/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart.cpp index d0250610b3..ded362e708 100644 --- a/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart.cpp +++ b/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart.cpp @@ -1,6 +1,6 @@ #include -#include "jkqtplotter.h" -#include "jkqtpbarchartelements.h" +#include "jkqtplotter/jkqtplotter.h" +#include "jkqtplotter/jkqtpbarchartelements.h" #define Ndata 5 int main(int argc, char* argv[]) diff --git a/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart.pro b/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart.pro index b3cd9cf474..c8c5ab162e 100644 --- a/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart.pro +++ b/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart.pro @@ -3,14 +3,19 @@ SOURCES = jkqtplotter_simpletest_barchart.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_barchart # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER diff --git a/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart_and_lib.pro b/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart_and_lib.pro new file mode 100644 index 0000000000..3b260e2d90 --- /dev/null +++ b/test/jkqtplotter_simpletest_barchart/jkqtplotter_simpletest_barchart_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_barchart + +jkqtplotter_simpletest_barchart.file=$$PWD/jkqtplotter_simpletest_barchart.pro +jkqtplotter_simpletest_barchart.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp b/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp index e650ac21af..3e7cce1c95 100644 --- a/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp +++ b/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.cpp @@ -6,6 +6,7 @@ #include "jkqtplotter/jkqtplotter.h" #include "jkqtplotter/jkqtpgeoelements.h" #include "jkqtplottertools/jkqtptools.h" +#include "jkqtplotter/jkqtpfilledcurveelements.h" void drawWithDateAxis(JKQtPlotter& plot) { diff --git a/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.pro b/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.pro index 85bb6ee6f3..8472f9c5a0 100644 --- a/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.pro +++ b/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes.pro @@ -3,14 +3,18 @@ SOURCES = jkqtplotter_simpletest_dateaxes.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_dateaxes # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG diff --git a/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes_and_lib.pro b/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes_and_lib.pro new file mode 100644 index 0000000000..36436d1856 --- /dev/null +++ b/test/jkqtplotter_simpletest_dateaxes/jkqtplotter_simpletest_dateaxes_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_dateaxes + +jkqtplotter_simpletest_dateaxes.file=$$PWD/jkqtplotter_simpletest_dateaxes.pro +jkqtplotter_simpletest_dateaxes.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.pro b/test/jkqtplotter_simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.pro index 1d5b490233..b2ab65eeac 100644 --- a/test/jkqtplotter_simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.pro +++ b/test/jkqtplotter_simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles.pro @@ -3,14 +3,18 @@ SOURCES = jkqtplotter_simpletest_errorbarstyles.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_errorbarstyles # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER diff --git a/test/jkqtplotter_simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles_and_lib.pro b/test/jkqtplotter_simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles_and_lib.pro new file mode 100644 index 0000000000..bf358d8be4 --- /dev/null +++ b/test/jkqtplotter_simpletest_errorbarstyles/jkqtplotter_simpletest_errorbarstyles_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_errorbarstyles + +jkqtplotter_simpletest_errorbarstyles.file=$$PWD/jkqtplotter_simpletest_errorbarstyles.pro +jkqtplotter_simpletest_errorbarstyles.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_imageplot/jkqtplotter_simpletest_imageplot.pro b/test/jkqtplotter_simpletest_imageplot/jkqtplotter_simpletest_imageplot.pro index d121f10f29..9e71a55267 100644 --- a/test/jkqtplotter_simpletest_imageplot/jkqtplotter_simpletest_imageplot.pro +++ b/test/jkqtplotter_simpletest_imageplot/jkqtplotter_simpletest_imageplot.pro @@ -3,14 +3,19 @@ SOURCES = jkqtplotter_simpletest_imageplot.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_imageplot # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER diff --git a/test/jkqtplotter_simpletest_imageplot/jkqtplotter_simpletest_imageplot_and_lib.pro b/test/jkqtplotter_simpletest_imageplot/jkqtplotter_simpletest_imageplot_and_lib.pro new file mode 100644 index 0000000000..0f0b5dca41 --- /dev/null +++ b/test/jkqtplotter_simpletest_imageplot/jkqtplotter_simpletest_imageplot_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_imageplot + +jkqtplotter_simpletest_imageplot.file=$$PWD/jkqtplotter_simpletest_imageplot.pro +jkqtplotter_simpletest_imageplot.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier.pro b/test/jkqtplotter_simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier.pro index b8034f92d0..87ae37fc9b 100644 --- a/test/jkqtplotter_simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier.pro +++ b/test/jkqtplotter_simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier.pro @@ -3,14 +3,19 @@ SOURCES = jkqtplotter_simpletest_imageplot_modifier.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_imageplot_modifier # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER diff --git a/test/jkqtplotter_simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier_and_lib.pro b/test/jkqtplotter_simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier_and_lib.pro new file mode 100644 index 0000000000..247705a130 --- /dev/null +++ b/test/jkqtplotter_simpletest_imageplot_modifier/jkqtplotter_simpletest_imageplot_modifier_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_imageplot_modifier + +jkqtplotter_simpletest_imageplot_modifier.file=$$PWD/jkqtplotter_simpletest_imageplot_modifier.pro +jkqtplotter_simpletest_imageplot_modifier.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.pro b/test/jkqtplotter_simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.pro index 4ec689b9d0..9f1142fb4f 100644 --- a/test/jkqtplotter_simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.pro +++ b/test/jkqtplotter_simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.pro @@ -1,16 +1,23 @@ -# source code for this simple demo -SOURCES = jkqtplotter_simpletest_imageplot_nodatastore.cpp - -# configure Qt -CONFIG += qt -QT += core gui svg -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport +TEMPLATE = app # output executable name TARGET = jkqtplotter_simpletest_imageplot_nodatastore +# source code for this simple demo +SOURCES = jkqtplotter_simpletest_imageplot_nodatastore.cpp + +# configure Qt +CONFIG += qt +QT += core gui xml svg +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport + # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER diff --git a/test/jkqtplotter_simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore_and_lib.pro b/test/jkqtplotter_simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore_and_lib.pro new file mode 100644 index 0000000000..b90d1512e5 --- /dev/null +++ b/test/jkqtplotter_simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_imageplot_nodatastore + +jkqtplotter_simpletest_imageplot_nodatastore.file=$$PWD/jkqtplotter_simpletest_imageplot_nodatastore.pro +jkqtplotter_simpletest_imageplot_nodatastore.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.pro b/test/jkqtplotter_simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.pro index 92d4b48002..2e13f1230e 100644 --- a/test/jkqtplotter_simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.pro +++ b/test/jkqtplotter_simpletest_imageplot_opencv/jkqtplotter_simpletest_imageplot_opencv.pro @@ -3,14 +3,19 @@ SOURCES = jkqtplotter_simpletest_imageplot_opencv.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_imageplot_opencv +# add OpenCV-interface to JKQTPdatastore +DEFINES += JKQTPLOTTER_OPENCV_INTERFACE + # include JKQtPlotter source code include(../../lib/jkqtplotter.pri) + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER @@ -19,6 +24,3 @@ include(../../lib/jkqtplotter.pri) # link agains OpenCV-3.4.1 INCLUDEPATH += $$PWD/OpenCV-3.4.1/include/ LIBS += -L$$PWD/OpenCV-3.4.1/bin/ -llibopencv_core341 - -# add OpenCV-interface to JKQTPdatastore -DEFINES += JKQTPLOTTER_OPENCV_INTERFACE diff --git a/test/jkqtplotter_simpletest_logaxes/jkqtplotter_simpletest_logaxes.pro b/test/jkqtplotter_simpletest_logaxes/jkqtplotter_simpletest_logaxes.pro index 4a8d1d6083..612163f014 100644 --- a/test/jkqtplotter_simpletest_logaxes/jkqtplotter_simpletest_logaxes.pro +++ b/test/jkqtplotter_simpletest_logaxes/jkqtplotter_simpletest_logaxes.pro @@ -3,17 +3,20 @@ SOURCES = jkqtplotter_simpletest_logaxes.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_logaxes # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) -include(../../lib/jkqtplotterressources/math_fonts/xits.pri) -DEFINES += AUTOLOAD_XITS_FONTS -DEFINES += USE_XITS_FONTS +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG diff --git a/test/jkqtplotter_simpletest_logaxes/jkqtplotter_simpletest_logaxes_and_lib.pro b/test/jkqtplotter_simpletest_logaxes/jkqtplotter_simpletest_logaxes_and_lib.pro new file mode 100644 index 0000000000..ad916ef1f8 --- /dev/null +++ b/test/jkqtplotter_simpletest_logaxes/jkqtplotter_simpletest_logaxes_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_logaxes + +jkqtplotter_simpletest_logaxes.file=$$PWD/jkqtplotter_simpletest_logaxes.pro +jkqtplotter_simpletest_logaxes.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp b/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp index 6ff3012fae..c7af5db41a 100644 --- a/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp +++ b/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.cpp @@ -2,7 +2,6 @@ #include #include "jkqtplotter/jkqtplotter.h" #include "jkqtplotter/jkqtpimageelements.h" -#include #include diff --git a/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.pro b/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.pro index b156e4ffee..49943a6651 100644 --- a/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.pro +++ b/test/jkqtplotter_simpletest_rgbimageplot_opencv/jkqtplotter_simpletest_rgbimageplot_opencv.pro @@ -3,14 +3,19 @@ SOURCES = jkqtplotter_simpletest_rgbimageplot_opencv.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_rgbimageplot_opencv +# add OpenCV-interface to JKQTPdatastore +DEFINES += JKQTPLOTTER_OPENCV_INTERFACE + # include JKQtPlotter source code include(../../lib/jkqtplotter.pri) + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER @@ -19,6 +24,3 @@ include(../../lib/jkqtplotter.pri) # link agains OpenCV-3.4.1 INCLUDEPATH += $$PWD/OpenCV-3.4.1/include/ LIBS += -L$$PWD/OpenCV-3.4.1/bin/ -llibopencv_core341 -llibopencv_imgcodecs341 - -# add OpenCV-interface to JKQTPdatastore -DEFINES += JKQTPLOTTER_OPENCV_INTERFACE diff --git a/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp b/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp index b4c25d6638..6d0cd46b50 100644 --- a/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp +++ b/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.cpp @@ -1,6 +1,6 @@ #include -#include "jkqtplotter.h" -#include "jkqtpbarchartelements.h" +#include "jkqtplotter/jkqtplotter.h" +#include "jkqtplotter/jkqtpbarchartelements.h" template diff --git a/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.pro b/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.pro index 3dfb88cb81..618b07ff38 100644 --- a/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.pro +++ b/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars.pro @@ -3,14 +3,20 @@ SOURCES = jkqtplotter_simpletest_stackedbars.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_stackedbars + # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER diff --git a/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars_and_lib.pro b/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars_and_lib.pro new file mode 100644 index 0000000000..2bdb16d4a9 --- /dev/null +++ b/test/jkqtplotter_simpletest_stackedbars/jkqtplotter_simpletest_stackedbars_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_stackedbars + +jkqtplotter_simpletest_stackedbars.file=$$PWD/jkqtplotter_simpletest_stackedbars.pro +jkqtplotter_simpletest_stackedbars.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.pro b/test/jkqtplotter_simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.pro index 6a9985ab2e..1717b39df3 100644 --- a/test/jkqtplotter_simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.pro +++ b/test/jkqtplotter_simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors.pro @@ -3,14 +3,20 @@ SOURCES = jkqtplotter_simpletest_symbols_and_errors.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_symbols_and_errors + # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER diff --git a/test/jkqtplotter_simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors_and_lib.pro b/test/jkqtplotter_simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors_and_lib.pro new file mode 100644 index 0000000000..f587d87a27 --- /dev/null +++ b/test/jkqtplotter_simpletest_symbols_and_errors/jkqtplotter_simpletest_symbols_and_errors_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_symbols_and_errors + +jkqtplotter_simpletest_symbols_and_errors.file=$$PWD/jkqtplotter_simpletest_symbols_and_errors.pro +jkqtplotter_simpletest_symbols_and_errors.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro diff --git a/test/jkqtplotter_simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.pro b/test/jkqtplotter_simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.pro index fefdbe5466..c795e203fc 100644 --- a/test/jkqtplotter_simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.pro +++ b/test/jkqtplotter_simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles.pro @@ -3,14 +3,20 @@ SOURCES = jkqtplotter_simpletest_symbols_and_styles.cpp # configure Qt CONFIG += qt -QT += core gui svg +QT += core gui xml svg greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport # output executable name TARGET = jkqtplotter_simpletest_symbols_and_styles + # include JKQtPlotter source code -include(../../lib/jkqtplotter.pri) +DEPENDPATH += . ../../lib +INCLUDEPATH += ../../lib +CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib +CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib + + # here you can activate some debug options #DEFINES += SHOW_JKQTPLOTTER_DEBUG #DEFINES += JKQTBP_AUTOTIMER diff --git a/test/jkqtplotter_simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles_and_lib.pro b/test/jkqtplotter_simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles_and_lib.pro new file mode 100644 index 0000000000..a6d9a88553 --- /dev/null +++ b/test/jkqtplotter_simpletest_symbols_and_styles/jkqtplotter_simpletest_symbols_and_styles_and_lib.pro @@ -0,0 +1,8 @@ +TEMPLATE = subdirs + +SUBDIRS += jkqtplotterlib jkqtplotter_simpletest_symbols_and_styles + +jkqtplotter_simpletest_symbols_and_styles.file=$$PWD/jkqtplotter_simpletest_symbols_and_styles.pro +jkqtplotter_simpletest_symbols_and_styles.depends = jkqtplotterlib + +jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro