updated impulse plots & doc

This commit is contained in:
jkriege2 2022-09-26 02:08:01 +02:00
parent d82e20fd33
commit 3de1df2b94
78 changed files with 556 additions and 38 deletions

View File

@ -168,7 +168,7 @@ if(JKQtPlotter_BUILD_EXAMPLES)
imageplot_modifier
imageplot_nodatastore
imageplot_userpal/imageplot_userpal_program
impulsesplot
impulsesplot/impulsesplot,impulsesplot_symbols,impulsesplot_horizontal,errorbarstyles_impulses,errorbarstyles_impulses_horizontal
parametriccurve/parametriccurve1,parametriccurve2
paramscatterplot
paramscatterplot_customsymbol
@ -200,6 +200,9 @@ if(JKQtPlotter_BUILD_EXAMPLES)
filledgraphs_errors/JKQTPFilledCurveXErrorGraph,JKQTPFilledCurveYErrorGraph/--smallscreenshotplot
evalcurve/JKQTPXYFunctionLineGraph/--smallscreenshotplot
geo_coordinateaxis0/JKQTPCoordinateAxisStyleDrawMode0
impulsesplot/JKQTPImpulsesVerticalGraph,JKQTPImpulsesVerticalGraph_Symbols,JKQTPImpulsesHorizontalGraph,JKQTPImpulsesVerticalErrorGraph,JKQTPImpulsesHorizontalErrorGraph/--smallscreenshotplot
symbols_and_errors/JKQTPXYLineErrorGraph_JKQTPErrorBars,JKQTPXYLineErrorGraph_JKQTPErrorLines,JKQTPXYLineErrorGraph_JKQTPErrorPolygons/--iteratefunctorsteps--iteratefunctorsteps_suppressinitial--smallscreenshotplot
boxplot/JKQTPBoxplotVerticalGraph,JKQTPBoxplotHorizontalGraph/--iteratefunctorsteps--iteratefunctorsteps_suppressinitial--smallscreenshotplot
)
@ -227,6 +230,7 @@ if(JKQtPlotter_BUILD_EXAMPLES)
endif()
endif()
set(loc_target_name JKQTPlotter_GenerateDocScreenshots_${example})
set(dep_name jkqtptest_${example})
string(TOUPPER ${example} example_upper)
@ -265,6 +269,10 @@ if(JKQtPlotter_BUILD_EXAMPLES)
endif()
if (NOT extra_command STREQUAL "")
string(REPLACE "--" ";--" extra_command "${extra_command}")
endif()
set(loc_target_name JKQTPlotter_GenerateDocImages_${example})
set(dep_name jkqtptest_${example})
string(TOUPPER ${example} example_upper)

View File

@ -101,7 +101,7 @@ This group assembles graphs that show their data with symbols and optionally wit
<th> Screenshot
<th> Classes
<tr>
<td>\image html filledgraphs_small.png
<td>\image html JKQTPFilledCurveXGraph_small.png
<td> JKQTPFilledCurveXGraph, JKQTPFilledCurveYGraph
<tr>
<td>\image html JKQTPFilledCurveXErrorGraph_small.png
@ -146,19 +146,19 @@ This group assembles graphs that show their data with symbols and optionally wit
<th> Screenshot
<th> Classes
<tr>
<td>\image html barchart_small.png
<td>\image html JKQTPBarVerticalGraph_small.png
<td> JKQTPBarVerticalGraph, JKQTPBarHorizontalGraph
<tr>
<td>\image html barchart_error_small.png
<td>\image html JKQTPBarVerticalErrorGraph_small.png
<td> JKQTPBarVerticalErrorGraph, JKQTPBarHorizontalErrorGraph
<tr>
<td>\image html JKQTPbarVerticalGraphStacked_small.png
<td> JKQTPBarVerticalStackableGraph, JKQTPBarHorizontalStackableGraph
<tr>
<td>\image html impulsesplot_small.png
<td>\image html JKQTPImpulsesVerticalGraph_Symbols_small.png
<td> JKQTPImpulsesHorizontalGraph, JKQTPImpulsesVerticalGraph
<tr>
<td>\image html impulses_errors_small.png
<td>\image html JKQTPImpulsesVerticalErrorGraph_small.png
<td> JKQTPImpulsesHorizontalErrorGraph, JKQTPImpulsesVerticalErrorGraph
</table>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -164,7 +164,7 @@ int main(int argc, char* argv[])
// 10. show plotter and make it a decent size
plot.show();
plot.resize(600,600);
plot.resize(600/plot.devicePixelRatioF(),600/plot.devicePixelRatioF());
return app.exec();
}

View File

@ -100,7 +100,7 @@ void doExample(const QString& title)
// show plotter and make it a decent size
plot->setWindowTitle(title);
plot->show();
plot->resize(600,400);
plot->resize(600/plot->devicePixelRatioF(),550/plot->devicePixelRatioF());
}
int main(int argc, char* argv[])

View File

@ -115,7 +115,19 @@ int main(int argc, char* argv[])
// show plotter and make it a decent size
plot.show();
plot.resize(600,600);
plot.resize(600/plot.devicePixelRatioF(),600/plot.devicePixelRatioF());
app.addExportStepFunctor([&]() {
graph->setVisible(true);
graphOutliers->setVisible(false);
graphh->setVisible(false);
plot.zoomToFit();
});
app.addExportStepFunctor([&]() {
graph->setVisible(false);
graphOutliers->setVisible(false);
graphh->setVisible(true);
plot.zoomToFit();
});
return app.exec();
}

View File

@ -10,38 +10,41 @@
#include "jkqtplotter/graphs/jkqtpimpulses.h"
// number of datapoints:
#define Ndata 40
int main(int argc, char* argv[])
{
JKQTPAppSettingController highDPIController(argc, argv);
JKQTPExampleApplication app(argc, argv);
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
JKQTPlotter plot;
template<class TGRAPH>
TGRAPH* drawPlot(JKQTPlotter& plot, int NData=40, double baseline=0.0) {
JKQTPDatastore* ds=plot.getDatastore();
// 2. now we create data for a simple plot (a sine curve with lin. increasing errors)
QVector<double> X, Y;
for (int i=0; i<Ndata; i++) {
const double xx=double(i)/double(Ndata)*6.0*JKQTPSTATISTICS_PI;
QVector<double> X, Y, E;
for (int i=0; i<NData; i++) {
const double xx=double(i)/40.0*8.0*JKQTPSTATISTICS_PI;
X << xx;
Y << cos(xx)*exp(-xx/10.0);
E << 0.2*Y.last();
}
// 3. add data from vectors to the datastore
size_t columnX=ds->addCopiedColumn(X, "x");
size_t columnY=ds->addCopiedColumn(Y, "y");
size_t columnE=ds->addCopiedColumn(E, "e");
// 4. create a vertical impulse graph in the plot, which plots the dataset X/Y:
JKQTPImpulsesVerticalGraph* graph=new JKQTPImpulsesVerticalGraph(&plot);
graph->setXColumn(columnX);
graph->setYColumn(columnY);
TGRAPH* graph=new TGRAPH(&plot);
graph->setKeyColumn(columnX);
graph->setValueColumn(columnY);
graph->setLineWidth(2);
graph->setBaseline(baseline);
graph->setColor(QColor("red"));
graph->setTitle(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
if (dynamic_cast<JKQTPYGraphErrors*>(graph)) {
dynamic_cast<JKQTPYGraphErrors*>(graph)->setYErrorColumn(columnE);
dynamic_cast<JKQTPYGraphErrors*>(graph)->setYErrorStyle(JKQTPErrorBars);
}
if (dynamic_cast<JKQTPXGraphErrors*>(graph)) {
dynamic_cast<JKQTPXGraphErrors*>(graph)->setXErrorColumn(columnE);
dynamic_cast<JKQTPXGraphErrors*>(graph)->setXErrorStyle(JKQTPErrorBars);
}
//graph->setDrawSymbols(true);
//graph->setSymbolType(JKQTPGraphSymbols::JKQTPFilledStar);
//graph->setBaseline(0.25);
@ -59,10 +62,53 @@ int main(int argc, char* argv[])
// 8. autoscale the plot so the graph is contained
plot.zoomToFit();
plot.getPlotter()->setShowKey(false);
// show plotter and make it a decent size
plot.show();
plot.resize(600/plot.devicePixelRatioF(),400/plot.devicePixelRatioF());
return graph;
}
int main(int argc, char* argv[])
{
JKQTPAppSettingController highDPIController(argc, argv);
JKQTPExampleApplication app(argc, argv);
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
JKQTPlotter plot;
drawPlot<JKQTPImpulsesVerticalGraph>(plot);
plot.setWindowTitle("1: JKQTPImpulsesVerticalGraph");
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
JKQTPlotter plotS;
auto grS=drawPlot<JKQTPImpulsesVerticalGraph>(plotS, 25);
plotS.setWindowTitle("2: JKQTPImpulsesVerticalGraph + Symbols");
grS->setDrawSymbols(true);
grS->setSymbolType(JKQTPFilledStar);
grS->setSymbolFillColor(QColor("cornflowerblue"));
grS->setSymbolColor(QColor("blue"));
grS->setSymbolSize(12);
JKQTPlotter plotH;
drawPlot<JKQTPImpulsesHorizontalGraph>(plotH);
plotH.setWindowTitle("3: JKQTPImpulsesHorizontalGraph");
plotH.resize(400/plot.devicePixelRatioF(),600/plot.devicePixelRatioF());
JKQTPlotter plotE;
auto grE=drawPlot<JKQTPImpulsesVerticalErrorGraph>(plotE,10);
plotE.setWindowTitle("4: JKQTPImpulsesVerticalErrorGraph");
grE->setLineWidth(5);
JKQTPlotter plotEH;
auto grEH=drawPlot<JKQTPImpulsesHorizontalErrorGraph>(plotEH,10);
plotEH.setWindowTitle("5: JKQTPImpulsesHorizontalErrorGraph");
grEH->setLineWidth(4);
plotEH.resize(400/plot.devicePixelRatioF(),600/plot.devicePixelRatioF());
return app.exec();
}

View File

@ -68,7 +68,28 @@ int main(int argc, char* argv[])
// show plotter and make it a decent size
plot.show();
plot.resize(600/plot.devicePixelRatioF(),400/plot.devicePixelRatioF());
plot.resize(600/plot.devicePixelRatioF(),500/plot.devicePixelRatioF());
app.addExportStepFunctor([&]() {
plot.getXAxis()->setAxisLabel(QObject::tr("$x$-axis [mm]"));
plot.getYAxis()->setAxisLabel(QObject::tr("$y$-axis [mm]"));
plot.getXAxis()->setTickLabelFontSize(8);
plot.getYAxis()->setTickLabelFontSize(8);
graph1->setDrawLine(true);
graph1->setYErrorStyle(JKQTPErrorBars);
plot.redrawPlot();
});
app.addExportStepFunctor([&]() {
graph1->setSymbolType(JKQTPNoSymbol);
graph1->setDrawLine(true);
graph1->setYErrorStyle(JKQTPErrorLines);
plot.redrawPlot();
});
app.addExportStepFunctor([&]() {
graph1->setSymbolType(JKQTPNoSymbol);
graph1->setDrawLine(true);
graph1->setYErrorStyle(JKQTPErrorPolygons);
plot.redrawPlot();
});
return app.exec();
}

View File

@ -66,6 +66,91 @@ bool JKQTPImpulsesGraphBase::getDrawSymbols() const
}
bool JKQTPImpulsesGraphBase::getValuesMinMax(double &mmin, double &mmax, double &smallestGreaterZero)
{
mmin=0;
mmax=0;
smallestGreaterZero=0;
if (getBaseline()>0) {
smallestGreaterZero=getBaseline();
mmin=getBaseline();
mmax=getBaseline();
}
if (getKeyColumn()<0 || getValueColumn()<0) return false;
const size_t datacol=static_cast<size_t>(getValueColumn());
if (parent==nullptr) return false;
const JKQTPDatastore* datastore=parent->getDatastore();
int imin=0, imax=0;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
double yv=getBaseline();
if (JKQTPIsOKFloat(yv)) {
if (yv>mmax) mmax=yv;
if (yv<mmin) mmin=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
}
yv=datastore->get(datacol,static_cast<size_t>(i));
if (JKQTPIsOKFloat(yv)) {
if (yv>mmax) mmax=yv;
if (yv<mmin) mmin=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
}
}
return true;
}
return false;
}
bool JKQTPImpulsesGraphBase::getPositionsMinMax(double &mmin, double &mmax, double &smallestGreaterZero)
{
bool start=true;
mmin=0;
mmax=0;
smallestGreaterZero=0;
if (getKeyColumn()<0 || getValueColumn()<0) return false;
const size_t poscol=static_cast<size_t>(getKeyColumn());
if (parent==nullptr) return false;
const JKQTPDatastore* datastore=parent->getDatastore();
int imin=0, imax=0;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
double xv=datastore->get(poscol,static_cast<size_t>(i));
if (JKQTPIsOKFloat(xv)) {
if (start || xv>mmax) mmax=xv;
if (start || xv<mmin) mmin=xv;
double xvsgz;
xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
}
return !start;
}
return false;
}
JKQTPImpulsesHorizontalGraph::JKQTPImpulsesHorizontalGraph(JKQTBasePlotter* parent):
JKQTPImpulsesGraphBase(parent)
{
@ -144,6 +229,37 @@ void JKQTPImpulsesHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter,
painter.drawLine(rect.left(), y, rect.right(), y);
}
int JKQTPImpulsesHorizontalGraph::getKeyColumn() const
{
return getYColumn();
}
int JKQTPImpulsesHorizontalGraph::getValueColumn() const
{
return getXColumn();
}
bool JKQTPImpulsesHorizontalGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{
return getValuesMinMax(minx, maxx, smallestGreaterZero);
}
bool JKQTPImpulsesHorizontalGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
{
return getPositionsMinMax(miny, maxy, smallestGreaterZero);
}
void JKQTPImpulsesHorizontalGraph::setKeyColumn(int __value)
{
setYColumn(__value);
}
void JKQTPImpulsesHorizontalGraph::setValueColumn(int __value)
{
setXColumn(__value);
}
@ -178,6 +294,17 @@ void JKQTPImpulsesVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QR
}
bool JKQTPImpulsesVerticalGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{
return getPositionsMinMax(minx, maxx, smallestGreaterZero);
}
bool JKQTPImpulsesVerticalGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
{
return getValuesMinMax(miny, maxy, smallestGreaterZero);
}
void JKQTPImpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPImpulsesVerticalGraph::draw");
@ -259,6 +386,107 @@ bool JKQTPImpulsesHorizontalErrorGraph::usesColumn(int c) const
return JKQTPImpulsesHorizontalGraph::usesColumn(c)|| JKQTPXGraphErrors::errorUsesColumn(c);
}
bool JKQTPImpulsesHorizontalErrorGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{
if (xErrorColumn>=0 && xErrorStyle!=JKQTPNoError) {
minx=0;
maxx=0;
smallestGreaterZero=0;
if (getBaseline()>0) {
smallestGreaterZero=getBaseline();
minx=getBaseline();
maxx=getBaseline();
}
if (parent==nullptr) return false;
JKQTPDatastore* datastore=parent->getDatastore();
int imax=0;
int imin=0;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
double yv=getBaseline();
if (JKQTPIsOKFloat(yv)) {
if (yv>maxx) maxx=yv;
if (yv<minx) minx=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
}
yv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))+datastore->get(static_cast<size_t>(xErrorColumn),static_cast<size_t>(i));
if (JKQTPIsOKFloat(yv)) {
if (yv>maxx) maxx=yv;
if (yv<minx) minx=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
}
yv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))-datastore->get(static_cast<size_t>(xErrorColumn),static_cast<size_t>(i));
if (JKQTPIsOKFloat(yv)) {
if (yv>maxx) maxx=yv;
if (yv<minx) minx=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
}
}
return true;
}
} else {
return JKQTPImpulsesHorizontalGraph::getXMinMax(minx,maxx,smallestGreaterZero);
}
return false;
}
int JKQTPImpulsesHorizontalErrorGraph::getErrorColumn() const
{
return getXErrorColumn();
}
int JKQTPImpulsesHorizontalErrorGraph::getErrorColumnLower() const
{
return getXErrorColumnLower();
}
JKQTPErrorPlotstyle JKQTPImpulsesHorizontalErrorGraph::getErrorStyle() const
{
return getXErrorStyle();
}
bool JKQTPImpulsesHorizontalErrorGraph::getErrorSymmetric() const
{
return getXErrorSymmetric();
}
void JKQTPImpulsesHorizontalErrorGraph::setErrorSymmetric(bool __value)
{
setXErrorSymmetric(__value);
}
void JKQTPImpulsesHorizontalErrorGraph::setErrorStyle(JKQTPErrorPlotstyle __value)
{
setXErrorStyle(__value);
}
void JKQTPImpulsesHorizontalErrorGraph::setErrorColumn(size_t column)
{
setXErrorColumn(column);
}
void JKQTPImpulsesHorizontalErrorGraph::setErrorColumn(int column)
{
setXErrorColumn(column);
}
void JKQTPImpulsesHorizontalErrorGraph::setErrorColumnLower(int column)
{
setXErrorColumnLower(column);
}
void JKQTPImpulsesHorizontalErrorGraph::setErrorColumnLower(size_t column)
{
setXErrorColumnLower(column);
}
void JKQTPImpulsesHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
{
if (sortData==JKQTPXYGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn);
@ -278,11 +506,120 @@ JKQTPImpulsesVerticalErrorGraph::JKQTPImpulsesVerticalErrorGraph(JKQTPlotter *pa
}
int JKQTPImpulsesVerticalErrorGraph::getErrorColumn() const
{
return getYErrorColumn();
}
int JKQTPImpulsesVerticalErrorGraph::getErrorColumnLower() const
{
return getYErrorColumnLower();
}
JKQTPErrorPlotstyle JKQTPImpulsesVerticalErrorGraph::getErrorStyle() const
{
return getYErrorStyle();
}
bool JKQTPImpulsesVerticalErrorGraph::getErrorSymmetric() const
{
return getYErrorSymmetric();
}
void JKQTPImpulsesVerticalErrorGraph::setErrorSymmetric(bool __value)
{
setYErrorSymmetric(__value);
}
void JKQTPImpulsesVerticalErrorGraph::setErrorStyle(JKQTPErrorPlotstyle __value)
{
setYErrorStyle(__value);
}
void JKQTPImpulsesVerticalErrorGraph::setErrorColumn(size_t column)
{
setYErrorColumn(column);
}
void JKQTPImpulsesVerticalErrorGraph::setErrorColumn(int column)
{
setYErrorColumn(column);
}
void JKQTPImpulsesVerticalErrorGraph::setErrorColumnLower(int column)
{
setYErrorColumnLower(column);
}
void JKQTPImpulsesVerticalErrorGraph::setErrorColumnLower(size_t column)
{
setYErrorColumnLower(column);
}
bool JKQTPImpulsesVerticalErrorGraph::usesColumn(int c) const
{
return JKQTPImpulsesVerticalGraph::usesColumn(c)|| JKQTPYGraphErrors::errorUsesColumn(c);
}
bool JKQTPImpulsesVerticalErrorGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
{
if (yErrorColumn>=0 && yErrorStyle!=JKQTPNoError) {
miny=0;
maxy=0;
smallestGreaterZero=0;
if (getBaseline()>0) {
smallestGreaterZero=getBaseline();
miny=getBaseline();
maxy=getBaseline();
}
if (parent==nullptr) return false;
JKQTPDatastore* datastore=parent->getDatastore();
int imax=0;
int imin=0;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
double yv=getBaseline();
if (JKQTPIsOKFloat(yv)) {
if (yv>maxy) maxy=yv;
if (yv<miny) miny=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
}
yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
if (JKQTPIsOKFloat(yv)) {
if (yv>maxy) maxy=yv;
if (yv<miny) miny=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
}
yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))+datastore->get(static_cast<size_t>(yErrorColumn),static_cast<size_t>(i));
if (JKQTPIsOKFloat(yv)) {
if (yv>maxy) maxy=yv;
if (yv<miny) miny=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
}
yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))-datastore->get(static_cast<size_t>(yErrorColumn),static_cast<size_t>(i));
if (JKQTPIsOKFloat(yv)) {
if (yv>maxy) maxy=yv;
if (yv<miny) miny=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
}
}
return true;
}
} else {
return JKQTPImpulsesVerticalGraph::getYMinMax(miny,maxy,smallestGreaterZero);
}
return false;
}
void JKQTPImpulsesVerticalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
{
if (sortData==JKQTPXYGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn);

View File

@ -30,6 +30,8 @@
/** \brief This is a base class for all impulse graphs
* \ingroup jkqtplotter_barssticks
*
* \image html JKQTPImpulsesVerticalGraph.png
*
* \see JKQTPImpulsesHorizontalGraph, JKQTPImpulsesVerticalGraph
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesGraphBase: public JKQTPXYBaselineGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphSymbolStyleMixin{
@ -58,13 +60,25 @@ protected:
* \image html impulsesplot_symbols.png
*/
bool drawSymbols;
/** \brief get the maximum and minimum value in the impulse-elongation (i.e. value) direction of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
bool getValuesMinMax(double& mmin, double& mmax, double& smallestGreaterZero) ;
/** \brief get the maximum and minimum value of the impulse positions of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
bool getPositionsMinMax(double& mmin, double& mmax, double& smallestGreaterZero) ;
};
/** \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from y=0 to y=f(x) )
/** \brief This implements an impulse plot with horizontal impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
* \ingroup jkqtplotter_barssticks
*
* \image html plot_impulsesxplots.png
* \image html JKQTPImpulsesHorizontalGraph.png
*
* \see JKQTPImpulsesVerticalGraph, \ref JKQTPlotterImpulsePlots
*/
@ -80,16 +94,32 @@ public:
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the column used as "key" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
virtual int getKeyColumn() const override;
/** \brief returns the column used as "value" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() ) */
virtual int getValueColumn() const override;
/** \copydoc JKQTPXYGraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPXYGraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
public slots:
/** \brief sets the column used as "key" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
virtual void setKeyColumn(int __value) override;
/** \brief sets the column used as "value" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() ) */
virtual void setValueColumn(int __value) override;
protected:
};
/** \brief This implements an impulse plot with impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
/** \brief This implements an impulse plot with horizontal impulses in direction of the X axis (i.e. from x=0 to x=f(y) )
* \ingroup jkqtplotter_barssticks
*
* \image html plot_impulsesxerrorsplots.png
* \image html JKQTPImpulsesHorizontalErrorGraph.png
*
* \see jkqtpstatAddXErrorImpulsesGraph(), JKQTPImpulsesHorizontalGraph, \ref JKQTPlotterImpulsePlots
*/
@ -102,6 +132,33 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesHorizontalErrorGraph: public JKQTPImpu
/** \copydoc JKQTPGraph::usesColumn() */
virtual bool usesColumn(int c) const override;
/** \copydoc JKQTPXYGraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief returns the column that contains the bar height errors */
int getErrorColumn() const;
/** \brief returns the column that contains the lower bar height errors */
int getErrorColumnLower() const;
/** \brief returns the error style of the bar */
JKQTPErrorPlotstyle getErrorStyle() const;
/** \brief returns whether the errors of the bars are symmetric */
bool getErrorSymmetric() const;
public slots:
/** \brief sets whether the errors of the bars are symmetric */
void setErrorSymmetric(bool __value);
/** \brief sets the error style of the bar */
void setErrorStyle(JKQTPErrorPlotstyle __value);
/** \brief sets the column that contains the bar height errors */
void setErrorColumn(int column) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumn(size_t column) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumnLower(int column) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumnLower(size_t column) ;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override ;
@ -114,9 +171,10 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesHorizontalErrorGraph: public JKQTPImpu
/*! \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_barssticks
\image html plot_impulsesyplots.png
\image html JKQTPImpulsesVerticalGraph.png
\image html JKQTPImpulsesVerticalGraph_Symbols.png "generated by setting setDrawSymbols(true)"
\see \ref JKQTPlotterImpulsePlots
\see JKQTPImpulsesGraphBase, JKQTPImpulsesVerticalErrorGraph, \ref JKQTPlotterImpulsePlots
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesVerticalGraph: public JKQTPImpulsesGraphBase {
Q_OBJECT
@ -130,6 +188,10 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesVerticalGraph: public JKQTPImpulsesGra
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \copydoc JKQTPXYGraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPXYGraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
};
@ -137,7 +199,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesVerticalGraph: public JKQTPImpulsesGra
/*! \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_barssticks
\image html plot_impulsesyerrorsplots.png
\image html JKQTPImpulsesVerticalErrorGraph.png
\see JKQTPImpulsesVerticalGraph, jkqtpstatAddYErrorImpulsesGraph(), \ref JKQTPlotterImpulsePlots
*/
@ -150,7 +212,33 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPImpulsesVerticalErrorGraph: public JKQTPImpuls
JKQTPImpulsesVerticalErrorGraph(JKQTPlotter* parent);
/** \copydoc JKQTPGraph::usesColumn() */
virtual bool usesColumn(int c) const override;
/** \copydoc JKQTPXYGraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief returns the column that contains the bar height errors */
int getErrorColumn() const;
/** \brief returns the column that contains the lower bar height errors */
int getErrorColumnLower() const;
/** \brief returns the error style of the bar */
JKQTPErrorPlotstyle getErrorStyle() const;
/** \brief returns whether the errors of the bars are symmetric */
bool getErrorSymmetric() const;
public slots:
/** \brief sets whether the errors of the bars are symmetric */
void setErrorSymmetric(bool __value);
/** \brief sets the error style of the bar */
void setErrorStyle(JKQTPErrorPlotstyle __value);
/** \brief sets the column that contains the bar height errors */
void setErrorColumn(int column) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumn(size_t column) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumnLower(int column) ;
/** \brief sets the column that contains the bar height errors */
void setErrorColumnLower(size_t column);
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override ;

View File

@ -103,9 +103,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXYLineGraph: public JKQTPXYGraph, public JKQTP
/*! \brief This implements xy line plots with x and y error indicators.
\ingroup jkqtplotter_linesymbolgraphs_simple
\image html plot_errorbarlineplots.png
\image html plot_errorlinelineplots.png
\image html plot_errorpolygonlineplots.png
\image html JKQTPXYLineErrorGraph_JKQTPErrorBars.png "setYErrorStyle(JKQTPErrorBars)"
\image html JKQTPXYLineErrorGraph_JKQTPErrorLines.png "setYErrorStyle(JKQTPErrorLines)"
\image html JKQTPXYLineErrorGraph_JKQTPErrorPolygons.png "setYErrorStyle(JKQTPErrorPolygins;"
\see jkqtpstatAddXYErrorLineGraph(), jkqtpstatAddXErrorLineGraph(), jkqtpstatAddYErrorLineGraph(), \ref JKQTPlotterErrorBarStyles, \ref JKQTPlotterBasicJKQTPDatastoreStatisticsGroupedStat
*/

View File

@ -1015,6 +1015,7 @@ JKQTBasePlotter::JKQTPPen JKQTBasePlotter::getPlotStyle(int i, JKQTPPlotStyleTyp
Qt::BrushStyle basebrushStyle=plotterStyle.graphsStyle.defaultGraphFillStyles[brushI];
JKQTPGraphSymbols baseSymbol=plotterStyle.graphsStyle.defaultGraphSymbols[symbolI];
QColor baseColor=plotterStyle.graphsStyle.defaultGraphColors[colorI];
double baseWidth=baseProps.defaultLineWidth;
if (type==JKQTPPlotStyleType::Annotation || type==JKQTPPlotStyleType::Geometric) {
baseColor=plotterStyle.graphsStyle.annotationStyle.defaultColor;
basePenStyle=plotterStyle.graphsStyle.annotationStyle.defaultLineStyle;
@ -1024,9 +1025,14 @@ JKQTBasePlotter::JKQTPPen JKQTBasePlotter::getPlotStyle(int i, JKQTPPlotStyleTyp
if (type==JKQTPPlotStyleType::Barchart || type==JKQTPPlotStyleType::Boxplot || type==JKQTPPlotStyleType::Impulses) {
basePenStyle=Qt::SolidLine;
}
if (type==JKQTPPlotStyleType::Barchart) {
basebrushStyle=Qt::SolidPattern;
}
if (type==JKQTPPlotStyleType::Boxplot) {
basebrushStyle=Qt::SolidPattern;
}
if (type==JKQTPPlotStyleType::Impulses) {
}
const QColor lineColor=JKQTPGetDerivedColor(baseProps.graphColorDerivationMode, baseColor);
const QColor errorColor=JKQTPGetDerivedColor(baseProps.errorColorDerivationMode, baseColor);
@ -1035,7 +1041,7 @@ JKQTBasePlotter::JKQTPPen JKQTBasePlotter::getPlotStyle(int i, JKQTPPlotStyleTyp
p.setSymbolType(baseSymbol);
p.setFillStyle(basebrushStyle);
p.setErrorFillStyle(Qt::SolidPattern);
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, baseProps.defaultLineWidth));
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH, baseWidth));
p.setFillColor(JKQTPGetDerivedColor(baseProps.fillColorDerivationMode, baseColor));
p.setErrorLineColor(errorColor);
p.setErrorFillColor(JKQTPGetDerivedColor(baseProps.errorFillColorDerivationMode, baseColor));

View File

@ -104,7 +104,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTGraphsSpecificStyleProperties {
JKQTPColorDerivationMode errorFillColorDerivationMode;
/** \brief defines how to derive a symbol fill color for a new graph */
JKQTPColorDerivationMode symbolFillColorDerivationMode;
protected:
private:
/** \brief modifies some of the settings to match the defaults for the given JKQTPPlotStyleType (e.g. sets line-width for impulses ...) */
void modifyForDefaultStyle(JKQTPPlotStyleType type);
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 178 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB