improved code (removed code repeats by using getIndexRange(), using const where appropriate)

This commit is contained in:
jkriege2 2020-09-19 15:39:02 +02:00
parent 7e425e7bb5
commit abe1c655ba
5 changed files with 403 additions and 498 deletions

View File

@ -53,27 +53,17 @@ void JKQTPBarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
JKQTPAutoOutputTimer jkaaot("JKQTPBarHorizontalGraph::draw");
#endif
if (parent==nullptr) return;
JKQTPDatastore* datastore=parent->getDatastore();
const JKQTPDatastore* datastore=parent->getDatastore();
if (datastore==nullptr) return;
drawErrorsBefore(painter);
QPen p=getLinePenForRects(painter, parent);
const QPen p=getLinePenForRects(painter, parent);
const QBrush b=getFillBrush(painter, parent);
QBrush b=getFillBrush(painter, parent);
int imax=static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
int imax=0;
int imin=0;
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
{
if (getIndexRange(imin, imax)) {
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
// double x0=transformX(0);
@ -87,9 +77,9 @@ void JKQTPBarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
const bool hasStackPar=hasStackParent();
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));
int sr=datastore->getNextLowerIndex(xColumn, i);
int lr=datastore->getNextHigherIndex(xColumn, i);
const double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
const int sr=datastore->getNextLowerIndex(xColumn, i);
const int lr=datastore->getNextHigherIndex(xColumn, i);
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
double yv0=y0;
if (!qFuzzyIsNull(getBaseline())) yv0=transformY(getBaseline());
@ -114,9 +104,9 @@ void JKQTPBarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
delta=deltap+deltam;
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=transformX(xv+shift*delta-width*deltam);
const double x=transformX(xv+shift*delta-width*deltam);
double y=transformY(yv);
double xx=transformX(xv+shift*delta+width*deltap);
const double xx=transformX(xv+shift*delta+width*deltap);
double yy=yv0;
//std::cout<<"delta="<<delta<<" x="<<x<<" y="<<y<<" xx="<<xx<<" yy="<<yy<<std::endl;
@ -239,83 +229,76 @@ void JKQTPBarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
JKQTPAutoOutputTimer jkaaot("JKQTPBarVerticalGraph::draw");
#endif
if (parent==nullptr) return;
JKQTPDatastore* datastore=parent->getDatastore();
const JKQTPDatastore* datastore=parent->getDatastore();
if (datastore==nullptr) return;
drawErrorsBefore(painter);
QPen p=getLinePenForRects(painter, parent);
const QPen p=getLinePenForRects(painter, parent);
const QBrush b=getFillBrush(painter, parent);
QBrush b=getFillBrush(painter, parent);
int imax=static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
int imax=0;
int imin=0;
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
if (getIndexRange(imin, imax)) {
double x0=transformX(0);
if (parent->getXAxis()->isLogAxis()) x0=transformX(parent->getXAxis()->getMin());
// double y0=transformY(0);
// if (parent->getYAxis()->isLogAxis()) y0=transformY(parent->getYAxis()->getMin());
{
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
intSortData();
const bool hasStackPar=hasStackParent();
double delta=1;
double deltap=0;
double deltam=0;
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));
int sr=datastore->getNextLowerIndex(yColumn, i);
int lr=datastore->getNextHigherIndex(yColumn, i);
double xv0=x0;
if (!qFuzzyIsNull(getBaseline())) xv0=transformX(getBaseline());
if (hasStackPar) {
double stackLastX=getParentStackedMax(i);
const double xvold=xv;
xv0=transformX(stackLastX)+(getLineWidth());
xv=stackLastX+xvold;
}
double x0=transformX(0);
if (parent->getXAxis()->isLogAxis()) x0=transformX(parent->getXAxis()->getMin());
// double y0=transformY(0);
// if (parent->getYAxis()->isLogAxis()) y0=transformY(parent->getYAxis()->getMin());
{
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
intSortData();
const bool hasStackPar=hasStackParent();
double delta=1;
double deltap=0;
double deltam=0;
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));
int sr=datastore->getNextLowerIndex(yColumn, i);
int lr=datastore->getNextHigherIndex(yColumn, i);
double xv0=x0;
if (!qFuzzyIsNull(getBaseline())) xv0=transformX(getBaseline());
if (hasStackPar) {
double stackLastX=getParentStackedMax(i);
const double xvold=xv;
xv0=transformX(stackLastX)+(getLineWidth());
xv=stackLastX+xvold;
}
if (sr<0 && lr<0) { // only one y-value
deltam=0.5;
deltap=0.5;
} else if (lr<0) { // the right-most y-value
deltap=deltam=fabs(yv-datastore->get(yColumn,sr))/2.0;
} else if (sr<0) { // the left-most y-value
deltam=deltap=fabs(datastore->get(yColumn,lr)-yv)/2.0;
} else {
deltam=fabs(yv-datastore->get(yColumn,sr))/2.0;
deltap=fabs(datastore->get(yColumn,lr)-yv)/2.0;
}
delta=deltap+deltam;
if (sr<0 && lr<0) { // only one y-value
deltam=0.5;
deltap=0.5;
} else if (lr<0) { // the right-most y-value
deltap=deltam=fabs(yv-datastore->get(yColumn,sr))/2.0;
} else if (sr<0) { // the left-most y-value
deltam=deltap=fabs(datastore->get(yColumn,lr)-yv)/2.0;
} else {
deltam=fabs(yv-datastore->get(yColumn,sr))/2.0;
deltap=fabs(datastore->get(yColumn,lr)-yv)/2.0;
}
delta=deltap+deltam;
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xv0;
if (!qFuzzyIsNull(getBaseline())) x=transformX(getBaseline());
double y=transformY(yv+shift*delta+width*deltap);
double xx=transformX(xv);
double yy=transformY(yv+shift*delta-width*deltam);
if (x>xx) { qSwap(x,xx); }
//qDebug()<<"delta="<<delta<<" x="<<x<<" y="<<y<<" xx="<<xx<<" yy="<<yy;
//qDebug()<<"xv="<<xv<<" x0="<<x0<<" x="<<x<<"..."<<xx;
if (JKQTPIsOKFloat(x) && JKQTPIsOKFloat(xx) && JKQTPIsOKFloat(y) && JKQTPIsOKFloat(yy)) {
painter.setBrush(b);
painter.setPen(p);
QRectF r(QPointF(x, y), QPointF(xx, yy));
painter.drawRect(r);
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xv0;
if (!qFuzzyIsNull(getBaseline())) x=transformX(getBaseline());
double y=transformY(yv+shift*delta+width*deltap);
double xx=transformX(xv);
double yy=transformY(yv+shift*delta-width*deltam);
if (x>xx) { qSwap(x,xx); }
//qDebug()<<"delta="<<delta<<" x="<<x<<" y="<<y<<" xx="<<xx<<" yy="<<yy;
//qDebug()<<"xv="<<xv<<" x0="<<x0<<" x="<<x<<"..."<<xx;
if (JKQTPIsOKFloat(x) && JKQTPIsOKFloat(xx) && JKQTPIsOKFloat(y) && JKQTPIsOKFloat(yy)) {
painter.setBrush(b);
painter.setPen(p);
QRectF r(QPointF(x, y), QPointF(xx, yy));
painter.drawRect(r);
}
}
}
}
}
drawErrorsAfter(painter);
}
@ -363,33 +346,29 @@ bool JKQTPBarHorizontalErrorGraph::getXMinMax(double &minx, double &maxx, double
if (parent==nullptr) return false;
JKQTPDatastore* datastore=parent->getDatastore();
const JKQTPDatastore* datastore=parent->getDatastore();
int imax=0;
int imin=0;
int imax=static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
double xvsgz;
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))+getXErrorU(i, datastore);
double xvv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))-getXErrorL(i, datastore);
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(xvv) ) {
if (start || xv>maxx) maxx=xv;
if (start || xv<minx) minx=xv;
xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
start=false;
if (xvv>maxx) maxx=xvv;
if (xvv<minx) minx=xvv;
xvsgz=xvv; SmallestGreaterZeroCompare_xvsgz();
start=false;
for (int i=imin; i<imax; i++) {
double xvsgz;
const double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))+getXErrorU(i, datastore);
const double xvv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))-getXErrorL(i, datastore);
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(xvv) ) {
if (start || xv>maxx) maxx=xv;
if (start || xv<minx) minx=xv;
xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
start=false;
if (xvv>maxx) maxx=xvv;
if (xvv<minx) minx=xvv;
xvsgz=xvv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
}
return !start;
}
return !start;
return false;
}
}
@ -465,33 +444,29 @@ bool JKQTPBarVerticalErrorGraph::getYMinMax(double &miny, double &maxy, double &
if (parent==nullptr) return false;
JKQTPDatastore* datastore=parent->getDatastore();
int imax=0;
int imin=0;
int imax=static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=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();
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();
}
}
return true;
}
return true;
} else {
bool start=false;
miny=getBaseline();
@ -505,34 +480,30 @@ bool JKQTPBarVerticalErrorGraph::getYMinMax(double &miny, double &maxy, double &
if (parent==nullptr) return false;
JKQTPDatastore* datastore=parent->getDatastore();
const JKQTPDatastore* datastore=parent->getDatastore();
int imax=0;
int imin=0;
int imax=static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))+getYErrorU(i, datastore);
double yvv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))-getYErrorL(i, datastore);
if (JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(yvv) ) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
if (start || yvv>maxy) maxy=yvv;
if (start || yvv<miny) miny=yvv;
xvsgz=yvv; SmallestGreaterZeroCompare_xvsgz();
start=false;
for (int i=imin; i<imax; i++) {
const double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))+getYErrorU(i, datastore);
const double yvv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))-getYErrorL(i, datastore);
if (JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(yvv) ) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
double xvsgz;
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
if (start || yvv>maxy) maxy=yvv;
if (start || yvv<miny) miny=yvv;
xvsgz=yvv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
}
return !start;
}
return !start;
}
return false;
}
int JKQTPBarVerticalErrorGraph::getBarErrorColumn() const

View File

@ -93,55 +93,39 @@ void JKQTPImpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
QPen p=getLinePen(painter, parent);
p.setCapStyle(Qt::FlatCap);
int imax=static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
int imax=0;
int imin=0;
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
if (getIndexRange(imin, imax)) {
//double xold=-1;
//double yold=-1;
double x0=transformX(getBaseline());
if (parent->getXAxis()->isLogAxis()) {
if (getBaseline()>0 && getBaseline()>parent->getXAxis()->getMin()) x0=transformX(getBaseline());
else x0=transformX(parent->getXAxis()->getMin());
}
// double y0=transformY(getBaseline());
// if (parent->getYAxis()->isLogAxis()) {
// y0=transformY(parent->getYAxis()->getMin());
// if (getBaseline()>0 && getBaseline()>parent->getYAxis()->getMin()) y0=transformY(getBaseline());
// else y0=transformY(parent->getYAxis()->getMin());
// }
//bool first=false;
QVector<QLineF> lines;
QVector<QPointF> points;
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=transformX(xv);
double y=transformY(yv);
lines.append(QLineF(x0, y, x, y));
points.append(QPointF(x,y));
// xold=x;
// yold=y;
//first=true;
double x0=transformX(getBaseline());
if (parent->getXAxis()->isLogAxis()) {
if (getBaseline()>0 && getBaseline()>parent->getXAxis()->getMin()) x0=transformX(getBaseline());
else x0=transformX(parent->getXAxis()->getMin());
}
}
painter.setPen(p);
if (lines.size()>0) painter.drawLines(lines);
if (drawSymbols && points.size()>0) {
painter.save(); auto __finalpaintsym=JKQTPFinally([&painter]() {painter.restore();});
for (auto& p: points) {
plotStyledSymbol(parent, painter, p.x(), p.y());
QVector<QLineF> lines;
QVector<QPointF> points;
intSortData();
for (int iii=imin; iii<imax; iii++) {
const int i=qBound(imin, getDataIndex(iii), imax);
const double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
const double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
const double x=transformX(xv);
const double y=transformY(yv);
lines.append(QLineF(x0, y, x, y));
points.append(QPointF(x,y));
}
}
painter.setPen(p);
if (lines.size()>0) painter.drawLines(lines);
if (drawSymbols && points.size()>0) {
painter.save(); auto __finalpaintsym=JKQTPFinally([&painter]() {painter.restore();});
for (auto& p: points) {
plotStyledSymbol(parent, painter, p.x(), p.y());
}
}
}
@ -210,55 +194,42 @@ void JKQTPImpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
QPen p=getLinePen(painter, parent);
p.setCapStyle(Qt::FlatCap);
int imax=static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
int imax=0;
int imin=0;
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=transformX(getBaseline());
// if (parent->getXAxis()->isLogAxis()) {
// if (getBaseline()>0 && getBaseline()>parent->getXAxis()->getMin()) x0=transformX(getBaseline());
// else x0=transformX(parent->getXAxis()->getMin());
// }
double y0=transformY(getBaseline());
if (parent->getYAxis()->isLogAxis()) {
y0=transformY(parent->getYAxis()->getMin());
if (getBaseline()>0 && getBaseline()>parent->getYAxis()->getMin()) y0=transformY(getBaseline());
else y0=transformY(parent->getYAxis()->getMin());
}
QVector<QLineF> lines;
QVector<QPointF> points;
intSortData();
for (int iii=imin; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
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=transformX(xv);
double y=transformY(yv);
if (getIndexRange(imin, imax)) {
lines.append(QLineF(x, y0, x, y));
points.append(QPointF(x,y));
//xold=x;
//yold=y;
//first=true;
double y0=transformY(getBaseline());
if (parent->getYAxis()->isLogAxis()) {
y0=transformY(parent->getYAxis()->getMin());
if (getBaseline()>0 && getBaseline()>parent->getYAxis()->getMin()) y0=transformY(getBaseline());
else y0=transformY(parent->getYAxis()->getMin());
}
}
painter.setPen(p);
if (lines.size()>0) painter.drawLines(lines);
if (drawSymbols && points.size()>0) {
painter.save(); auto __finalpaintsym=JKQTPFinally([&painter]() {painter.restore();});
for (auto& p: points) {
plotStyledSymbol(parent, painter, p.x(), p.y());
QVector<QLineF> lines;
QVector<QPointF> points;
intSortData();
for (int iii=imin; iii<imax; iii++) {
const int i=qBound(imin, getDataIndex(iii), imax);
const double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
const double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) ) {
const double x=transformX(xv);
const double y=transformY(yv);
lines.append(QLineF(x, y0, x, y));
points.append(QPointF(x,y));
}
}
painter.setPen(p);
if (lines.size()>0) painter.drawLines(lines);
if (drawSymbols && points.size()>0) {
painter.save(); auto __finalpaintsym=JKQTPFinally([&painter]() {painter.restore();});
for (auto& p: points) {
plotStyledSymbol(parent, painter, p.x(), p.y());
}
}
}
}

View File

@ -61,7 +61,7 @@ void JKQTPXYLineGraph::draw(JKQTPEnhancedPainter& painter) {
JKQTPAutoOutputTimer jkaaot("JKQTPXYLineGraph::draw");
#endif
if (parent==nullptr) return;
JKQTPDatastore* datastore=parent->getDatastore();
const JKQTPDatastore* datastore=parent->getDatastore();
if (datastore==nullptr) return;
//qDebug()<<"JKQTPXYLineGraph::draw();";
@ -72,63 +72,56 @@ void JKQTPXYLineGraph::draw(JKQTPEnhancedPainter& painter) {
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<2;
QPen p=getLinePen(painter, parent);
const QPen p=getLinePen(painter, parent);
const QPen penSelection=getHighlightingLinePen(painter, parent);
QPen penSelection=getHighlightingLinePen(painter, parent);
int imax= static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
int imax=0;
int imin=0;
if (getIndexRange(imin, imax)) {
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
std::vector<QPolygonF> vec_linesP;
vec_linesP.push_back(QPolygonF());
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 x=transformX(xv);
double y=transformY(yv);
//qDebug()<<"JKQTPXYLineGraph::draw(): (xv, yv) = ( "<<xv<<", "<<yv<<" )";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(x) && JKQTPIsOKFloat(y)) {
std::vector<QPolygonF> vec_linesP;
vec_linesP.push_back(QPolygonF());
intSortData();
for (int iii=imin; iii<imax; iii++) {
const int i=qBound(imin, getDataIndex(iii), imax);
const double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
const double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
const double x=transformX(xv);
const double y=transformY(yv);
//qDebug()<<"JKQTPXYLineGraph::draw(): (xv, yv) = ( "<<xv<<", "<<yv<<" )";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(x) && JKQTPIsOKFloat(y)) {
if (isHighlighted() && getSymbolType()!=JKQTPNoSymbol) {
//JKQTPPlotSymbol(painter, x, y, JKQTPFilledCircle, parent->pt2px(painter, symbolSize*1.5), parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), penSelection.color(), penSelection.color());
}
if ((!parent->getXAxis()->isLogAxis() || xv>0.0) && (!parent->getYAxis()->isLogAxis() || yv>0.0) ) {
plotStyledSymbol(parent, painter, x, y);
if (drawLine) {
vec_linesP[vec_linesP.size()-1] << QPointF(x,y);
if (isHighlighted() && getSymbolType()!=JKQTPNoSymbol) {
//JKQTPPlotSymbol(painter, x, y, JKQTPFilledCircle, parent->pt2px(painter, symbolSize*1.5), parent->pt2px(painter, symbolWidth*parent->getLineWidthMultiplier()), penSelection.color(), penSelection.color());
}
if ((!parent->getXAxis()->isLogAxis() || xv>0.0) && (!parent->getYAxis()->isLogAxis() || yv>0.0) ) {
plotStyledSymbol(parent, painter, x, y);
if (drawLine) {
vec_linesP[vec_linesP.size()-1] << QPointF(x,y);
}
} else {
vec_linesP.push_back(QPolygonF());
}
} else {
vec_linesP.push_back(QPolygonF());
}
}
}
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<4<<" lines="<<lines.size();
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<5<<" p="<<painter.pen();
for (auto &linesP : vec_linesP) {
if (linesP.size()>0) {
if (isHighlighted()) {
painter.setPen(penSelection);
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<4<<" lines="<<lines.size();
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<5<<" p="<<painter.pen();
for (auto &linesP : vec_linesP) {
if (linesP.size()>0) {
if (isHighlighted()) {
painter.setPen(penSelection);
//painter.drawLines(lines);
painter.drawPolyline(linesP);
}
painter.setPen(p);
//painter.drawLines(lines);
painter.drawPolyline(linesP);
}
painter.setPen(p);
//painter.drawLines(lines);
painter.drawPolyline(linesP);
}
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<6;
}
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<6;
}
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<7;
drawErrorsAfter(painter);
@ -205,36 +198,30 @@ bool JKQTPXYLineErrorGraph::getXMinMax(double &minx, double &maxx, double &small
if (parent==nullptr) return false;
JKQTPDatastore* datastore=parent->getDatastore();
const JKQTPDatastore* datastore=parent->getDatastore();
int imax=0;
int imin=0;
int imax= static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
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 xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))+getXErrorU(i, datastore);
if (JKQTPIsOKFloat(xv)) {
if (start || xv>maxx) maxx=xv;
if (start || xv<minx) minx=xv;
const double xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))-getXErrorL(i, datastore);
if (JKQTPIsOKFloat(xv)) {
if (start || xv>maxx) maxx=xv;
if (start || xv<minx) minx=xv;
const double xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
start=false;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))+getXErrorU(i, datastore);
if (JKQTPIsOKFloat(xv)) {
if (start || xv>maxx) maxx=xv;
if (start || xv<minx) minx=xv;
const double xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))-getXErrorL(i, datastore);
if (JKQTPIsOKFloat(xv)) {
if (start || xv>maxx) maxx=xv;
if (start || xv<minx) minx=xv;
const double xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
}
return !start;
}
return !start;
}
return false;
}
bool JKQTPXYLineErrorGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) {
@ -248,36 +235,30 @@ bool JKQTPXYLineErrorGraph::getYMinMax(double &miny, double &maxy, double &small
if (parent==nullptr) return false;
JKQTPDatastore* datastore=parent->getDatastore();
const JKQTPDatastore* datastore=parent->getDatastore();
int imax=0;
int imin=0;
int imax= static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
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))+getYErrorU(i, datastore);
if (JKQTPIsOKFloat(yv)) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
const double xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))-getYErrorL(i, datastore);
if (JKQTPIsOKFloat(yv)) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
const double xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
start=false;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))+getYErrorU(i, datastore);
if (JKQTPIsOKFloat(yv)) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
const double xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))-getYErrorL(i, datastore);
if (JKQTPIsOKFloat(yv)) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
const double xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
}
return !start;
}
return !start;
}
return false;
}
bool JKQTPXYLineErrorGraph::usesColumn(int c) const
@ -359,102 +340,109 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
QPen p=getLinePen(painter, parent);
const QPen p=getLinePen(painter, parent);
const QPen penSelection=getHighlightingLinePen(painter, parent);
QPen penSelection=getHighlightingLinePen(painter, parent);
int imax= static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
int imax=0;
int imin=0;
if (imax<imin) {
int h=imin;
imin=imax;
imax=h;
}
if (imin<0) imin=0;
if (imax<0) imax=0;
if (getIndexRange(imin, imax)) {
QVector<QLineF> lines;
QPolygonF linesP;
QVector<QColor> linecols;
QVector<QColor> linecolss;
QVector<double> linewidths;
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<3<<" imin="<<imin<<" imax="<<imax;
{
painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();});
double xold=-1;
double yold=-1;
bool first=false;
intSortData();
double specSymbSize=0;
bool hasSpecSymbSize=false;
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 x=transformX(xv);
double y=transformY(yv);
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(x) && JKQTPIsOKFloat(y)) {
double symbSize= parent->pt2px(painter, getLocalSymbolSize(i));
double lineW= parent->pt2px(painter, getLocalLineWidth(i));
QVector<QLineF> lines;
QPolygonF linesP;
QVector<QColor> linecols;
QVector<QColor> linecolss;
QVector<double> linewidths;
//qDebug()<<"JKQTPXYLineGraph::draw(): "<<3<<" imin="<<imin<<" imax="<<imax;
{
painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();});
double xold=-1;
double yold=-1;
bool first=false;
if (gridModeForSymbolSize) {
if (!hasSpecSymbSize) {
double sSX= fabs(transformX( xv+gridDeltaX*gridSymbolFractionSize/2.0)-transformX( xv-gridDeltaX*gridSymbolFractionSize/2.0));
double sSY= fabs(transformY( yv+gridDeltaY*gridSymbolFractionSize/2.0)-transformY( yv-gridDeltaY*gridSymbolFractionSize/2.0));
hasSpecSymbSize=true;
specSymbSize=qMin(sSX,sSY);
intSortData();
double specSymbSize=0;
bool hasSpecSymbSize=false;
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 x=transformX(xv);
double y=transformY(yv);
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(x) && JKQTPIsOKFloat(y)) {
double symbSize= parent->pt2px(painter, getLocalSymbolSize(i));
double lineW= parent->pt2px(painter, getLocalLineWidth(i));
if (gridModeForSymbolSize) {
if (!hasSpecSymbSize) {
double sSX= fabs(transformX( xv+gridDeltaX*gridSymbolFractionSize/2.0)-transformX( xv-gridDeltaX*gridSymbolFractionSize/2.0));
double sSY= fabs(transformY( yv+gridDeltaY*gridSymbolFractionSize/2.0)-transformY( yv-gridDeltaY*gridSymbolFractionSize/2.0));
hasSpecSymbSize=true;
specSymbSize=qMin(sSX,sSY);
}
symbSize=specSymbSize;
}
symbSize=specSymbSize;
}
QColor symbColor=getLocalColor(i);
QColor symbFillColor=JKQTPGetDerivedColor(symbolFillDerivationMode, symbColor);
//qDebug()<<i<<symbolSize<<symbColor;
if (drawLine) {
linesP<<QPointF(x,y);
}
if (first && drawLine) {
double xl1=xold;
double yl1=yold;
double xl2=x;
double yl2=y;
if (isHighlighted()) {
if (colorColumn>=0) linecolss<<symbColor.lighter();
else linecolss<<getHighlightingLineColor();
QColor symbColor=getLocalColor(i);
QColor symbFillColor=JKQTPGetDerivedColor(symbolFillDerivationMode, symbColor);
//qDebug()<<i<<symbolSize<<symbColor;
if (drawLine) {
linesP<<QPointF(x,y);
}
linecols<<symbColor;
lines<<QLineF(xl1, yl1, xl2, yl2);
linewidths<<lineW;
}
if (first && drawLine) {
double xl1=xold;
double yl1=yold;
double xl2=x;
double yl2=y;
if ((!parent->getXAxis()->isLogAxis() || xv>0.0) && (!parent->getYAxis()->isLogAxis() || yv>0.0) ) {
if (isHighlighted() && getSymbolType()!=JKQTPNoSymbol && symbolColumn<0) {
JKQTPPlotSymbol(painter, x, y, JKQTPFilledCircle,symbSize, parent->pt2px(painter, getSymbolLineWidth()*parent->getLineWidthMultiplier()), penSelection.color(), penSelection.color());
} else {
JKQTPPlotSymbol(painter, x, y, getLocalSymbolType(i), symbSize, parent->pt2px(painter, getSymbolLineWidth()*parent->getLineWidthMultiplier()), symbColor, symbFillColor);
if (isHighlighted()) {
if (colorColumn>=0) linecolss<<symbColor.lighter();
else linecolss<<getHighlightingLineColor();
}
linecols<<symbColor;
lines<<QLineF(xl1, yl1, xl2, yl2);
linewidths<<lineW;
}
if ((!parent->getXAxis()->isLogAxis() || xv>0.0) && (!parent->getYAxis()->isLogAxis() || yv>0.0) ) {
if (isHighlighted() && getSymbolType()!=JKQTPNoSymbol && symbolColumn<0) {
JKQTPPlotSymbol(painter, x, y, JKQTPFilledCircle,symbSize, parent->pt2px(painter, getSymbolLineWidth()*parent->getLineWidthMultiplier()), penSelection.color(), penSelection.color());
} else {
JKQTPPlotSymbol(painter, x, y, getLocalSymbolType(i), symbSize, parent->pt2px(painter, getSymbolLineWidth()*parent->getLineWidthMultiplier()), symbColor, symbFillColor);
}
}
xold=x;
yold=y;
first=true;
}
xold=x;
yold=y;
first=true;
}
}
}
if (lines.size()>0) {
painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();});
if (isHighlighted()) {
QPen pp=penSelection;
if (colorColumn>=0) {
if (lines.size()>0) {
painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();});
if (isHighlighted()) {
QPen pp=penSelection;
if (colorColumn>=0) {
for (int i=0; i<lines.size(); i++) {
pp.setColor(linecolss.value(i, getHighlightingLineColor()));
painter.setPen(pp);
painter.drawLine(lines[i]);
}
} else {
pp.setColor(getHighlightingLineColor());
painter.setPen(pp);
painter.drawPolyline(linesP);
}
}
QPen pp=p;
if (colorColumn>=0 || linewidthColumn>=0) {
for (int i=0; i<lines.size(); i++) {
pp.setColor(linecolss.value(i, getHighlightingLineColor()));
pp.setColor(linecols.value(i, getLineColor()));
pp.setWidthF(linewidths.value(i, parent->pt2px(painter, getLineWidth()*parent->getLineWidthMultiplier())));
painter.setPen(pp);
painter.drawLine(lines[i]);
}
@ -463,21 +451,8 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
painter.setPen(pp);
painter.drawPolyline(linesP);
}
}
QPen pp=p;
if (colorColumn>=0 || linewidthColumn>=0) {
for (int i=0; i<lines.size(); i++) {
pp.setColor(linecols.value(i, getLineColor()));
pp.setWidthF(linewidths.value(i, parent->pt2px(painter, getLineWidth()*parent->getLineWidthMultiplier())));
painter.setPen(pp);
painter.drawLine(lines[i]);
}
} else {
pp.setColor(getHighlightingLineColor());
painter.setPen(pp);
painter.drawPolyline(linesP);
}
}
}
drawErrorsAfter(painter);
@ -897,36 +872,30 @@ bool JKQTPXYParametrizedErrorScatterGraph::getXMinMax(double &minx, double &maxx
if (parent==nullptr) return false;
JKQTPDatastore* datastore=parent->getDatastore();
const JKQTPDatastore* datastore=parent->getDatastore();
int imax=0;
int imin=0;
int imax= static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
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++) {
const double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))+getXErrorU(i, datastore);
if (JKQTPIsOKFloat(xv) ) {
if (start || xv>maxx) maxx=xv;
if (start || xv<minx) minx=xv;
const double xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
}
const double xvv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))-getXErrorL(i, datastore);
if (JKQTPIsOKFloat(xvv)) {
start=false;
if (start || xvv>maxx) maxx=xvv;
if (start || xvv<minx) minx=xvv;
const double xvsgz=xvv; SmallestGreaterZeroCompare_xvsgz();
start=false;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
const double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))+getXErrorU(i, datastore);
if (JKQTPIsOKFloat(xv) ) {
if (start || xv>maxx) maxx=xv;
if (start || xv<minx) minx=xv;
const double xvsgz=xv; SmallestGreaterZeroCompare_xvsgz();
}
const double xvv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))-getXErrorL(i, datastore);
if (JKQTPIsOKFloat(xvv)) {
start=false;
if (start || xvv>maxx) maxx=xvv;
if (start || xvv<minx) minx=xvv;
const double xvsgz=xvv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
}
return !start;
}
return !start;
}
return false;
}
bool JKQTPXYParametrizedErrorScatterGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
@ -941,36 +910,30 @@ bool JKQTPXYParametrizedErrorScatterGraph::getYMinMax(double &miny, double &maxy
if (parent==nullptr) return false;
JKQTPDatastore* datastore=parent->getDatastore();
const JKQTPDatastore* datastore=parent->getDatastore();
int imax=0;
int imin=0;
int imax= static_cast<int>(qMin(datastore->getRows(static_cast<size_t>(xColumn)), datastore->getRows(static_cast<size_t>(yColumn))));
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++) {
const double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))+getYErrorU(i, datastore);
if (JKQTPIsOKFloat(yv)) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
const double xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
const double yvv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))-getYErrorL(i, datastore);
if (JKQTPIsOKFloat(yvv) ) {
if (start || yvv>maxy) maxy=yvv;
if (start || yvv<miny) miny=yvv;
const double xvsgz=yvv; SmallestGreaterZeroCompare_xvsgz();
start=false;
if (getIndexRange(imin, imax)) {
for (int i=imin; i<imax; i++) {
const double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))+getYErrorU(i, datastore);
if (JKQTPIsOKFloat(yv)) {
if (start || yv>maxy) maxy=yv;
if (start || yv<miny) miny=yv;
const double xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
const double yvv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i))-getYErrorL(i, datastore);
if (JKQTPIsOKFloat(yvv) ) {
if (start || yvv>maxy) maxy=yvv;
if (start || yvv<miny) miny=yvv;
const double xvsgz=yvv; SmallestGreaterZeroCompare_xvsgz();
start=false;
}
}
return !start;
}
return !start;
}
return false;
}
bool JKQTPXYParametrizedErrorScatterGraph::usesColumn(int c) const

View File

@ -623,7 +623,7 @@ void JKQTPXGraphErrorData::setXErrorColumnLower(int __value) {
}
double JKQTPXGraphErrorData::getXErrorU(int i, JKQTPDatastore *ds) const
double JKQTPXGraphErrorData::getXErrorU(int i, const JKQTPDatastore *ds) const
{
if (ds && xErrorColumn>=0 && i>=0 && i<static_cast<int>(ds->getRows(xErrorColumn))) {
return ds->get(xErrorColumn, static_cast<size_t>(i));
@ -631,7 +631,7 @@ double JKQTPXGraphErrorData::getXErrorU(int i, JKQTPDatastore *ds) const
return 0.0;
}
double JKQTPXGraphErrorData::getXErrorL(int i, JKQTPDatastore *ds) const
double JKQTPXGraphErrorData::getXErrorL(int i, const JKQTPDatastore *ds) const
{
if (ds) {
if (xErrorSymmetric) {
@ -699,7 +699,7 @@ void JKQTPYGraphErrorData::setYErrorColumnLower(int __value) {
}
double JKQTPYGraphErrorData::getYErrorU(int i, JKQTPDatastore *ds) const
double JKQTPYGraphErrorData::getYErrorU(int i, const JKQTPDatastore *ds) const
{
if (ds && yErrorColumn>=0 && i>=0 && i<static_cast<int>(ds->getRows(yErrorColumn))) {
return ds->get(yErrorColumn, static_cast<size_t>(i));
@ -707,7 +707,7 @@ double JKQTPYGraphErrorData::getYErrorU(int i, JKQTPDatastore *ds) const
return 0.0;
}
double JKQTPYGraphErrorData::getYErrorL(int i, JKQTPDatastore *ds) const
double JKQTPYGraphErrorData::getYErrorL(int i, const JKQTPDatastore *ds) const
{
if (ds) {
if (yErrorSymmetric) {
@ -735,7 +735,7 @@ bool JKQTPXGraphErrors::errorUsesColumn(int c) const
return c==(xErrorColumn) || (c==xErrorColumnLower);
}
void JKQTPXGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph *parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
void JKQTPXGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, const JKQTBasePlotter* parent, const JKQTPGraph *parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, -1, xErrorStyle, JKQTPNoError, xErrorColumnLower, -1, xErrorSymmetric, true, xrelshift, yrelshift, dataorder);
}
@ -747,7 +747,7 @@ JKQTPYGraphErrors::JKQTPYGraphErrors()
{
}
void JKQTPYGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
void JKQTPYGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, const JKQTBasePlotter* parent, const JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, -1, yErrorColumn, JKQTPNoError, yErrorStyle, -1, yErrorColumnLower, true, yErrorSymmetric, xrelshift, yrelshift, dataorder);
}
@ -767,7 +767,7 @@ JKQTPXYGraphErrors::JKQTPXYGraphErrors()
}
void JKQTPXYGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
void JKQTPXYGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, const JKQTBasePlotter* parent, const JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
this->intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, yErrorColumn, xErrorStyle, yErrorStyle, xErrorColumnLower, yErrorColumnLower, xErrorSymmetric, yErrorSymmetric, xrelshift, yrelshift, dataorder);
}

View File

@ -227,9 +227,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXGraphErrorData {
JKQTPErrorPlotstyle xErrorStyle;
/** \brief returns the upper x-error for the i-th datapoint, read from datastore \a ds */
virtual double getXErrorU(int i, JKQTPDatastore* ds) const;
virtual double getXErrorU(int i, const JKQTPDatastore* ds) const;
/** \brief returns the lower x-error for the i-th datapoint, read from datastore \a ds */
virtual double getXErrorL(int i, JKQTPDatastore* ds) const;
virtual double getXErrorL(int i, const JKQTPDatastore *ds) const;
};
@ -277,9 +277,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPYGraphErrorData {
JKQTPErrorPlotstyle yErrorStyle;
/** \brief returns the upper y-error for the i-th datapoint, read from datastore \a ds */
virtual double getYErrorU(int i, JKQTPDatastore* ds) const;
virtual double getYErrorU(int i, const JKQTPDatastore* ds) const;
/** \brief returns the lower y-error for the i-th datapoint, read from datastore \a ds */
virtual double getYErrorL(int i, JKQTPDatastore* ds) const;
virtual double getYErrorL(int i, const JKQTPDatastore* ds) const;
};
@ -301,7 +301,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXGraphErrors: public JKQTPXGraphErrorData, pub
protected:
/** \brief draws the error indicators */
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const ;
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, const JKQTBasePlotter* parent, const JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const ;
};
@ -323,7 +323,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPYGraphErrors: public JKQTPYGraphErrorData, pub
protected:
/** \brief draws the error indicators */
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const ;
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, const JKQTBasePlotter* parent, const JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const ;
};
@ -347,7 +347,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXYGraphErrors: public JKQTPXGraphErrorData, pu
protected:
/** \brief draws the error indicators */
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const ;
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, const JKQTBasePlotter* parent, const JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const ;
};