some reorganizations + QMake-build-projects with library

This commit is contained in:
jkriege2 2018-12-02 14:08:43 +01:00
parent 1a89d8ca52
commit ca4065dae9
52 changed files with 1734 additions and 1336 deletions

View File

@ -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

View File

@ -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

View File

@ -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`<br/>C-style arrays of data |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/JKQTPbarVerticalGraphStacked_small.png)<br>![](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`<br/>C++-style vectors of data |
### Styling the Plot, Key Axes
### Styling the Plot, Keys, Axes, ...
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |

View File

@ -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

View File

@ -0,0 +1,6 @@
TARGET = jkqtfastplotterlib
TEMPLATE = lib
CONFIG+=staticlib
include(jkqtfastplotter.pri)

View File

@ -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

View File

@ -1,3 +0,0 @@
include($$PWD/jkqtmathtext.pri)
include($$PWD/jkqtplotterressources/math_fonts/xits.pri)
DEFINES += AUTOLOAD_XITS_FONTS

View File

@ -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

View File

@ -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="";

View File

@ -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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
//double xold=-1;
//double yold=-1;
double x0=xAxis->x2p(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<QLineF> lines;
intSortData();
for (int iii=imin; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
//double xold=-1;
//double yold=-1;
//bool first=false;
// double x0=xAxis->x2p(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<QLineF> lines;
intSortData();
for (int iii=imin; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
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: "<<parentPlotStyle<<std::endl;
color=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: "<<parentPlotStyle<<std::endl;
color=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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
QPainterPath pl, pf;
double xold=-1;
//double yold=-1;
// double x0=xAxis->x2p(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; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
QPainterPath pl, pf;
//double xold=-1;
double yold=-1;
double x0=xAxis->x2p(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; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->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: "<<parentPlotStyle<<std::endl;
color=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: "<<parentPlotStyle<<std::endl;
color=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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()), datastore->getColumn(static_cast<size_t>(yColumn2)).getRows());
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
for (int i=imin; i<imax; i++) {
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
double yv2=datastore->get(static_cast<size_t>(yColumn2),static_cast<size_t>(i));
if (JKQTPIsOKFloat(yv)) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
if (JKQTPIsOKFloat(yv2)) {
if (start || yv2>maxy) maxy=yv2;
if (start || yv2<miny) miny=yv2;
double xvsgz;
xvsgz=yv2; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
}
return !start;
}
bool JKQTPfilledVerticalRangeGraph::usesColumn(int column)
{
return JKQTPxyGraph::usesColumn(column)||(column==yColumn2);
}
void JKQTPfilledVerticalRangeGraph::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(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()), datastore->getColumn(static_cast<size_t>(yColumn2)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
// upper points are added to poly_all, lower points to plow
// then plow points are added to poly_all in vewerse order
// then the whole thing is drawn
QPolygonF poly_all, phigh, plow;
double xold=-1;
bool first=true;
intSortData();
for (int iii=imin; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
double yv2=datastore->get(static_cast<size_t>(yColumn2),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv)) {
double x=xAxis->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;
}

View File

@ -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

View File

@ -0,0 +1,699 @@
/*
Copyright (c) 2008-2018 Jan W. Krieger (<jan@jkrieger.de>)
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License (LGPL) for more details.
You should have received a copy of the GNU Lesser General Public License (LGPL)
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "jkqtplotter/jkqtpfilledcurveelements.h"
#include "jkqtplotter/jkqtpbaseplotter.h"
#include <stdlib.h>
#include <QDebug>
#include <iostream>
#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) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz;
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: "<<parentPlotStyle<<std::endl;
color=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: "<<parentPlotStyle<<std::endl;
color=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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
QPainterPath pl, pf;
double xold=-1;
//double yold=-1;
// double x0=xAxis->x2p(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; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
QPainterPath pl, pf;
//double xold=-1;
double yold=-1;
double x0=xAxis->x2p(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; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->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: "<<parentPlotStyle<<std::endl;
color=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: "<<parentPlotStyle<<std::endl;
color=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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()), datastore->getColumn(static_cast<size_t>(yColumn2)).getRows());
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
for (int i=imin; i<imax; i++) {
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
double yv2=datastore->get(static_cast<size_t>(yColumn2),static_cast<size_t>(i));
if (JKQTPIsOKFloat(yv)) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
if (JKQTPIsOKFloat(yv2)) {
if (start || yv2>maxy) maxy=yv2;
if (start || yv2<miny) miny=yv2;
double xvsgz;
xvsgz=yv2; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
}
return !start;
}
bool JKQTPfilledVerticalRangeGraph::usesColumn(int column)
{
return JKQTPxyGraph::usesColumn(column)||(column==yColumn2);
}
void JKQTPfilledVerticalRangeGraph::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(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()), datastore->getColumn(static_cast<size_t>(yColumn2)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
// upper points are added to poly_all, lower points to plow
// then plow points are added to poly_all in vewerse order
// then the whole thing is drawn
QPolygonF poly_all, phigh, plow;
double xold=-1;
bool first=true;
intSortData();
for (int iii=imin; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
double yv2=datastore->get(static_cast<size_t>(yColumn2),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv)) {
double x=xAxis->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;
}

View File

@ -0,0 +1,240 @@
/*
Copyright (c) 2008-2018 Jan W. Krieger (<jan@jkrieger.de>)
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License (LGPL) for more details.
You should have received a copy of the GNU Lesser General Public License (LGPL)
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "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

View File

@ -0,0 +1,299 @@
/*
Copyright (c) 2008-2018 Jan W. Krieger (<jan@jkrieger.de>)
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License (LGPL) for more details.
You should have received a copy of the GNU Lesser General Public License (LGPL)
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "jkqtplotter/jkqtpimpulseselements.h"
#include "jkqtplotter/jkqtpbaseplotter.h"
#include <stdlib.h>
#include <QDebug>
#include <iostream>
#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) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz;
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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
//double xold=-1;
//double yold=-1;
double x0=xAxis->x2p(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<QLineF> lines;
intSortData();
for (int iii=imin; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
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<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<long long>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<long long>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
//double xold=-1;
//double yold=-1;
//bool first=false;
// double x0=xAxis->x2p(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<QLineF> lines;
intSortData();
for (int iii=imin; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
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);
}

View File

@ -0,0 +1,144 @@
/*
Copyright (c) 2008-2018 Jan W. Krieger (<jan@jkrieger.de>)
This software is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License (LGPL) as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License (LGPL) for more details.
You should have received a copy of the GNU Lesser General Public License (LGPL)
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "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

6
lib/jkqtplotterlib.pro Normal file
View File

@ -0,0 +1,6 @@
TARGET = jkqtplotterlib
TEMPLATE = lib
CONFIG+=staticlib
include(jkqtplotter.pri)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -4,7 +4,7 @@
#include <QDateTime>
#include <QApplication>
#include "jkqtplotter/jkqtpboxplotelements.h"
#include "jkqtplotter/jkqtpfilledcurveelements.h"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
#include <QApplication>
#include "jkqtplotter.h"
#include "jkqtpbarchartelements.h"
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpbarchartelements.h"
#define Ndata 5
int main(int argc, char* argv[])

View File

@ -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

View File

@ -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

View File

@ -6,6 +6,7 @@
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgeoelements.h"
#include "jkqtplottertools/jkqtptools.h"
#include "jkqtplotter/jkqtpfilledcurveelements.h"
void drawWithDateAxis(JKQtPlotter& plot) {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -2,7 +2,6 @@
#include <cmath>
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpimageelements.h"
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>

View File

@ -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

View File

@ -1,6 +1,6 @@
#include <QApplication>
#include "jkqtplotter.h"
#include "jkqtpbarchartelements.h"
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpbarchartelements.h"
template<class TGRAPH>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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