2018-11-25 21:53:26 +08:00
|
|
|
/*
|
2022-07-19 19:40:43 +08:00
|
|
|
Copyright (c) 2008-2022 Jan W. Krieger (<jan@jkrieger.de>)
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2019-02-08 00:24:46 +08:00
|
|
|
the Free Software Foundation, either version 2.1 of the License, or
|
2018-11-25 21:53:26 +08:00
|
|
|
(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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-06-20 22:06:31 +08:00
|
|
|
#include "jkqtplotter/graphs/jkqtpbarchart.h"
|
2018-11-26 03:25:44 +08:00
|
|
|
#include "jkqtplotter/jkqtpbaseplotter.h"
|
2018-11-25 21:53:26 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <iostream>
|
2019-05-30 04:40:02 +08:00
|
|
|
#include "jkqtplotter/jkqtptools.h"
|
2018-11-26 03:25:44 +08:00
|
|
|
#include "jkqtplotter/jkqtplotter.h"
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
#define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarVerticalGraph::JKQTPBarVerticalGraph(JKQTBasePlotter* parent):
|
2020-09-17 22:59:57 +08:00
|
|
|
JKQTPBarGraphBase(parent)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarVerticalGraph::JKQTPBarVerticalGraph(JKQTPlotter* parent):
|
2019-02-08 00:24:46 +08:00
|
|
|
JKQTPBarVerticalGraph(parent->getPlotter())
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPBarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
2018-11-25 21:53:26 +08:00
|
|
|
#ifdef JKQTBP_AUTOTIMER
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPAutoOutputTimer jkaaot("JKQTPBarHorizontalGraph::draw");
|
2018-11-25 21:53:26 +08:00
|
|
|
#endif
|
|
|
|
if (parent==nullptr) return;
|
2020-09-19 21:39:02 +08:00
|
|
|
const JKQTPDatastore* datastore=parent->getDatastore();
|
2018-11-25 21:53:26 +08:00
|
|
|
if (datastore==nullptr) return;
|
|
|
|
|
|
|
|
drawErrorsBefore(painter);
|
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
const QPen p=getLinePenForRects(painter, parent);
|
2022-10-22 22:40:44 +08:00
|
|
|
const auto fillFunctor=std::bind(constructFillBrushFunctor(), std::placeholders::_1, std::placeholders::_2, std::ref(painter), this);
|
2018-11-25 21:53:26 +08:00
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
int imax=0;
|
2018-11-25 21:53:26 +08:00
|
|
|
int imin=0;
|
2020-09-19 21:39:02 +08:00
|
|
|
if (getIndexRange(imin, imax)) {
|
2019-02-08 00:24:46 +08:00
|
|
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
|
|
|
|
|
|
|
// 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());
|
|
|
|
double delta=1;
|
|
|
|
double deltap=0;
|
|
|
|
double deltam=0;
|
|
|
|
intSortData();
|
|
|
|
const bool hasStackPar=hasStackParent();
|
|
|
|
for (int iii=imin; iii<imax; iii++) {
|
|
|
|
int i=qBound(imin, getDataIndex(iii), imax);
|
2020-09-19 21:39:02 +08:00
|
|
|
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);
|
2022-09-10 20:35:16 +08:00
|
|
|
const double yvdirect=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
|
|
|
|
double yv=yvdirect;
|
2019-02-08 00:24:46 +08:00
|
|
|
double yv0=y0;
|
2020-09-19 21:08:32 +08:00
|
|
|
if (!qFuzzyIsNull(getBaseline())) yv0=transformY(getBaseline());
|
2019-02-08 00:24:46 +08:00
|
|
|
if (hasStackPar) {
|
|
|
|
double stackLastY=getParentStackedMax(i);
|
|
|
|
const double yvold=yv;
|
|
|
|
yv0=transformY(stackLastY)-(getLineWidth());
|
|
|
|
yv=stackLastY+yvold;
|
|
|
|
}
|
|
|
|
if (sr<0 && lr<0) { // only one x-value
|
|
|
|
deltam=0.5;
|
|
|
|
deltap=0.5;
|
|
|
|
} else if (lr<0) { // the right-most x-value
|
|
|
|
deltap=deltam=fabs(xv-datastore->get(xColumn,sr))/2.0;
|
|
|
|
} else if (sr<0) { // the left-most x-value
|
|
|
|
deltam=deltap=fabs(datastore->get(xColumn,lr)-xv)/2.0;
|
|
|
|
} else {
|
|
|
|
deltam=fabs(xv-datastore->get(xColumn,sr))/2.0;
|
|
|
|
deltap=fabs(datastore->get(xColumn,lr)-xv)/2.0;
|
|
|
|
}
|
|
|
|
//std::cout<<iii<<", \t"<<i<<", \t"<<sr<<", \t"<<lr<<", \t"<<deltam<<", \t"<<deltap<<"\n\n";
|
|
|
|
delta=deltap+deltam;
|
|
|
|
|
|
|
|
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
|
2020-09-19 21:39:02 +08:00
|
|
|
const double x=transformX(xv+shift*delta-width*deltam);
|
2019-02-08 00:24:46 +08:00
|
|
|
double y=transformY(yv);
|
2020-09-19 21:39:02 +08:00
|
|
|
const double xx=transformX(xv+shift*delta+width*deltap);
|
2019-02-08 00:24:46 +08:00
|
|
|
double yy=yv0;
|
|
|
|
|
|
|
|
//std::cout<<"delta="<<delta<<" x="<<x<<" y="<<y<<" xx="<<xx<<" yy="<<yy<<std::endl;
|
2022-09-27 07:42:54 +08:00
|
|
|
bool swapped=false;
|
|
|
|
if (yy<y) { qSwap(y,yy); swapped=true; }
|
2019-02-08 00:24:46 +08:00
|
|
|
if (JKQTPIsOKFloat(x) && JKQTPIsOKFloat(xx) && JKQTPIsOKFloat(y) && JKQTPIsOKFloat(yy)) {
|
2022-10-22 22:40:44 +08:00
|
|
|
const QBrush b=fillFunctor(xv,yv);
|
|
|
|
painter.setBrush(b);
|
|
|
|
if (getFillMode()!=FillMode::SingleFilling) {
|
|
|
|
QPen pl=p;
|
|
|
|
pl.setColor(JKQTPGetDerivedColor(m_lineColorDerivationModeForSpecialFill,b.color()));
|
|
|
|
} else {
|
|
|
|
painter.setPen(p);
|
|
|
|
}
|
2022-09-10 20:35:16 +08:00
|
|
|
const QRectF r(QPointF(x, y), QPointF(xx, yy));
|
2022-09-27 07:42:54 +08:00
|
|
|
const double rAtBaseline=parent->pt2px(painter, rectRadiusAtBaseline);
|
|
|
|
const double rAtValue=parent->pt2px(painter, rectRadiusAtValue);
|
|
|
|
//qDebug()<<"r="<<r<<", rectRadiusAtBaseline="<<rectRadiusAtBaseline<<", rectRadiusAtValue="<<rectRadiusAtValue<<", rAtBaseline="<<rAtBaseline<<", rAtValue="<<rAtValue;
|
|
|
|
if (rAtBaseline+rAtValue>=r.height()+2) {
|
|
|
|
//qDebug()<<"drawRect";
|
|
|
|
painter.drawRect(r);
|
|
|
|
} else {
|
|
|
|
//qDebug()<<"drawRoundRect swapped="<<swapped;
|
|
|
|
if (swapped) {
|
|
|
|
painter.drawComplexRoundedRect(r,rAtBaseline,rAtBaseline,rAtValue,rAtValue,Qt::AbsoluteSize);
|
|
|
|
} else {
|
|
|
|
painter.drawComplexRoundedRect(r,rAtValue,rAtValue,rAtBaseline,rAtBaseline,Qt::AbsoluteSize);
|
|
|
|
}
|
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
|
2019-02-08 00:24:46 +08:00
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-08 00:24:46 +08:00
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
drawErrorsAfter(painter);
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarVerticalGraph::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
|
2020-09-17 22:59:57 +08:00
|
|
|
return getPositionsMinMax(minx, maxx, smallestGreaterZero);
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarVerticalGraph::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) {
|
2020-09-17 22:59:57 +08:00
|
|
|
return getValuesMinMax(miny, maxy, smallestGreaterZero);
|
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
|
2020-09-17 22:59:57 +08:00
|
|
|
bool JKQTPBarVerticalGraph::considerForAutoscaling(JKQTPBarGraphBase *other) const
|
|
|
|
{
|
|
|
|
return (dynamic_cast<JKQTPBarVerticalGraph*>(other)!=nullptr);
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarHorizontalGraph::JKQTPBarHorizontalGraph(JKQTBasePlotter *parent):
|
2020-09-17 22:59:57 +08:00
|
|
|
JKQTPBarGraphBase(parent)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarHorizontalGraph::JKQTPBarHorizontalGraph(JKQTPlotter *parent):
|
2019-02-08 00:24:46 +08:00
|
|
|
JKQTPBarHorizontalGraph(parent->getPlotter())
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-17 22:59:57 +08:00
|
|
|
|
2022-09-10 19:38:29 +08:00
|
|
|
int JKQTPBarHorizontalGraph::getKeyColumn() const
|
|
|
|
{
|
2022-10-22 22:40:44 +08:00
|
|
|
return yColumn;
|
2022-09-10 19:38:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int JKQTPBarHorizontalGraph::getValueColumn() const
|
|
|
|
{
|
2022-10-22 22:40:44 +08:00
|
|
|
return xColumn;
|
2022-09-10 19:38:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarHorizontalGraph::setKeyColumn(int __value)
|
|
|
|
{
|
2022-10-22 22:40:44 +08:00
|
|
|
yColumn=__value;
|
2022-09-10 19:38:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarHorizontalGraph::setValueColumn(int __value)
|
|
|
|
{
|
2022-10-22 22:40:44 +08:00
|
|
|
xColumn=__value;
|
2020-09-17 22:59:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool JKQTPBarHorizontalGraph::considerForAutoscaling(JKQTPBarGraphBase *other) const
|
|
|
|
{
|
|
|
|
return (dynamic_cast<JKQTPBarHorizontalGraph*>(other)!=nullptr);
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPBarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
2018-11-25 21:53:26 +08:00
|
|
|
#ifdef JKQTBP_AUTOTIMER
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPAutoOutputTimer jkaaot("JKQTPBarVerticalGraph::draw");
|
2018-11-25 21:53:26 +08:00
|
|
|
#endif
|
|
|
|
if (parent==nullptr) return;
|
2020-09-19 21:39:02 +08:00
|
|
|
const JKQTPDatastore* datastore=parent->getDatastore();
|
2018-11-25 21:53:26 +08:00
|
|
|
if (datastore==nullptr) return;
|
|
|
|
|
|
|
|
drawErrorsBefore(painter);
|
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
const QPen p=getLinePenForRects(painter, parent);
|
2022-10-22 22:40:44 +08:00
|
|
|
const auto fillFunctor=std::bind(constructFillBrushFunctor(), std::placeholders::_1, std::placeholders::_2, std::ref(painter), this);
|
2018-11-25 21:53:26 +08:00
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
int imax=0;
|
2018-11-25 21:53:26 +08:00
|
|
|
int imin=0;
|
2020-09-19 21:39:02 +08:00
|
|
|
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);
|
2022-09-10 20:35:16 +08:00
|
|
|
const double xvdirect=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
|
|
|
|
double xv=xvdirect;
|
2020-09-19 21:39:02 +08:00
|
|
|
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;
|
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
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);
|
2022-09-27 07:42:54 +08:00
|
|
|
bool swapped=false;
|
|
|
|
if (x>xx) { qSwap(x,xx); swapped=true; }
|
2020-09-19 21:39:02 +08:00
|
|
|
//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)) {
|
2022-10-22 22:40:44 +08:00
|
|
|
const QBrush b=fillFunctor(yv,xv);
|
|
|
|
painter.setBrush(b);
|
|
|
|
if (getFillMode()!=FillMode::SingleFilling) {
|
|
|
|
QPen pl=p;
|
|
|
|
pl.setColor(JKQTPGetDerivedColor(m_lineColorDerivationModeForSpecialFill,b.color()));
|
|
|
|
} else {
|
|
|
|
painter.setPen(p);
|
|
|
|
}
|
2022-09-27 07:42:54 +08:00
|
|
|
const QRectF r(QPointF(x, y), QPointF(xx, yy));
|
|
|
|
const double rAtBaseline=parent->pt2px(painter, rectRadiusAtBaseline);
|
|
|
|
const double rAtValue=parent->pt2px(painter, rectRadiusAtBaseline);
|
|
|
|
if (rAtBaseline+rAtValue>r.width()+2) {
|
|
|
|
painter.drawRect(r);
|
|
|
|
} else {
|
|
|
|
if (swapped) {
|
|
|
|
painter.drawComplexRoundedRect(r,rAtBaseline,rAtValue,rAtBaseline,rAtValue,Qt::AbsoluteSize);
|
|
|
|
} else {
|
|
|
|
painter.drawComplexRoundedRect(r,rAtValue,rAtBaseline,rAtValue,rAtBaseline,Qt::AbsoluteSize);
|
|
|
|
}
|
|
|
|
} }
|
2019-02-08 00:24:46 +08:00
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
}
|
2019-02-08 00:24:46 +08:00
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
drawErrorsAfter(painter);
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarHorizontalGraph::getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) {
|
2020-09-17 22:59:57 +08:00
|
|
|
return getValuesMinMax(minx, maxx, smallestGreaterZero);
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarHorizontalGraph::getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) {
|
2020-09-17 22:59:57 +08:00
|
|
|
return getPositionsMinMax(miny, maxy, smallestGreaterZero);
|
2019-04-22 19:27:50 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-25 21:53:26 +08:00
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarHorizontalErrorGraph::JKQTPBarHorizontalErrorGraph(JKQTBasePlotter *parent):
|
2019-05-06 01:31:20 +08:00
|
|
|
JKQTPBarHorizontalGraph(parent)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-04-22 19:27:50 +08:00
|
|
|
setErrorColorFromGraphColor(getKeyLabelColor());
|
2020-09-26 21:58:58 +08:00
|
|
|
initErrorStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Barchart);
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarHorizontalErrorGraph::JKQTPBarHorizontalErrorGraph(JKQTPlotter *parent):
|
2019-02-08 00:24:46 +08:00
|
|
|
JKQTPBarHorizontalErrorGraph(parent->getPlotter())
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-02-08 00:24:46 +08:00
|
|
|
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarHorizontalErrorGraph::usesColumn(int c) const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-01-20 17:49:29 +08:00
|
|
|
return JKQTPBarHorizontalGraph::usesColumn(c)|| JKQTPXGraphErrors::errorUsesColumn(c);
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarHorizontalErrorGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-01-20 17:49:29 +08:00
|
|
|
if (xErrorColumn<0 || xErrorStyle==JKQTPNoError) {
|
2018-11-25 21:53:26 +08:00
|
|
|
minx=0;
|
|
|
|
maxx=0;
|
|
|
|
smallestGreaterZero=0;
|
2022-09-11 04:35:30 +08:00
|
|
|
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));
|
|
|
|
if (JKQTPIsOKFloat(yv)) {
|
|
|
|
if (yv>maxx) maxx=yv;
|
|
|
|
if (yv<minx) minx=yv;
|
|
|
|
double xvsgz;
|
|
|
|
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
bool start=false;
|
|
|
|
minx=getBaseline();
|
|
|
|
maxx=getBaseline();
|
|
|
|
smallestGreaterZero=0;
|
|
|
|
if (getBaseline()>0) {
|
|
|
|
smallestGreaterZero=getBaseline();
|
|
|
|
minx=getBaseline();
|
|
|
|
maxx=getBaseline();
|
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
|
|
|
|
if (parent==nullptr) return false;
|
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
const JKQTPDatastore* datastore=parent->getDatastore();
|
|
|
|
int imax=0;
|
2018-11-25 21:53:26 +08:00
|
|
|
int imin=0;
|
2020-09-19 21:39:02 +08:00
|
|
|
if (getIndexRange(imin, imax)) {
|
|
|
|
|
2022-09-11 04:35:30 +08:00
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
for (int i=imin; i<imax; i++) {
|
2022-09-11 04:35:30 +08:00
|
|
|
const double yv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))+getXErrorU(i, datastore);
|
|
|
|
const double yvv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i))-getXErrorL(i, datastore);
|
|
|
|
if (JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(yvv) ) {
|
|
|
|
if (start || yv>maxx) maxx=yv;
|
|
|
|
if (start || yv<minx) minx=yv;
|
|
|
|
double xvsgz;
|
|
|
|
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
|
|
|
|
if (start || yvv>maxx) maxx=yvv;
|
|
|
|
if (start || yvv<minx) minx=yvv;
|
|
|
|
xvsgz=yvv; SmallestGreaterZeroCompare_xvsgz();
|
2020-09-19 21:39:02 +08:00
|
|
|
start=false;
|
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
2020-09-19 21:39:02 +08:00
|
|
|
return !start;
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
}
|
2022-09-11 04:35:30 +08:00
|
|
|
return false;
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPBarHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-02-03 21:04:48 +08:00
|
|
|
if (sortData==JKQTPXYGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, 0.0, shift);
|
|
|
|
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, 0.0, shift, &sortedIndices);
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2020-09-17 22:59:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
int JKQTPBarHorizontalErrorGraph::getBarErrorColumn() const
|
|
|
|
{
|
|
|
|
return getXErrorColumn();
|
|
|
|
}
|
|
|
|
|
|
|
|
int JKQTPBarHorizontalErrorGraph::getBarLowerErrorColumn() const
|
|
|
|
{
|
|
|
|
return getXErrorColumnLower();
|
|
|
|
}
|
|
|
|
|
2022-09-11 04:35:30 +08:00
|
|
|
JKQTPErrorPlotstyle JKQTPBarHorizontalErrorGraph::getBarErrorStyle() const
|
|
|
|
{
|
|
|
|
return getXErrorStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool JKQTPBarHorizontalErrorGraph::getBarErrorSymmetric() const
|
|
|
|
{
|
|
|
|
return getXErrorSymmetric();
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarHorizontalErrorGraph::setBarErrorSymmetric(bool __value)
|
|
|
|
{
|
|
|
|
setXErrorSymmetric(__value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarHorizontalErrorGraph::setBarErrorStyle(JKQTPErrorPlotstyle __value)
|
|
|
|
{
|
|
|
|
setXErrorStyle(__value);
|
|
|
|
}
|
|
|
|
|
2020-09-17 22:59:57 +08:00
|
|
|
void JKQTPBarHorizontalErrorGraph::setBarErrorColumn(int column)
|
|
|
|
{
|
|
|
|
setXErrorColumn(column);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarHorizontalErrorGraph::setBarErrorColumn(size_t column)
|
|
|
|
{
|
2022-07-23 22:05:13 +08:00
|
|
|
setXErrorColumn(static_cast<int>(column));
|
2020-09-17 22:59:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarHorizontalErrorGraph::setBarLowerErrorColumn(int column)
|
|
|
|
{
|
|
|
|
setXErrorColumnLower(column);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarHorizontalErrorGraph::setBarLowerErrorColumn(size_t column)
|
|
|
|
{
|
2022-07-23 22:05:13 +08:00
|
|
|
setXErrorColumnLower(static_cast<int>(column));
|
2020-09-17 22:59:57 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarVerticalErrorGraph::JKQTPBarVerticalErrorGraph(JKQTBasePlotter *parent):
|
2019-05-06 01:31:20 +08:00
|
|
|
JKQTPBarVerticalGraph(parent)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-04-22 19:27:50 +08:00
|
|
|
setErrorColorFromGraphColor(getKeyLabelColor());
|
2020-09-26 21:58:58 +08:00
|
|
|
initErrorStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Barchart);
|
2019-02-08 00:24:46 +08:00
|
|
|
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarVerticalErrorGraph::JKQTPBarVerticalErrorGraph(JKQTPlotter *parent):
|
2019-02-08 00:24:46 +08:00
|
|
|
JKQTPBarVerticalErrorGraph(parent->getPlotter())
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-02-08 00:24:46 +08:00
|
|
|
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarVerticalErrorGraph::usesColumn(int c) const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-01-20 17:49:29 +08:00
|
|
|
return JKQTPBarVerticalGraph::usesColumn(c)|| JKQTPYGraphErrors::errorUsesColumn(c);
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarVerticalErrorGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-01-20 17:49:29 +08:00
|
|
|
if (yErrorColumn<0 || yErrorStyle==JKQTPNoError) {
|
2018-11-25 21:53:26 +08:00
|
|
|
miny=0;
|
|
|
|
maxy=0;
|
|
|
|
smallestGreaterZero=0;
|
2020-09-19 21:08:32 +08:00
|
|
|
if (getBaseline()>0) {
|
|
|
|
smallestGreaterZero=getBaseline();
|
|
|
|
miny=getBaseline();
|
|
|
|
maxy=getBaseline();
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (parent==nullptr) return false;
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPDatastore* datastore=parent->getDatastore();
|
2020-09-19 21:39:02 +08:00
|
|
|
int imax=0;
|
2018-11-25 21:53:26 +08:00
|
|
|
int imin=0;
|
2020-09-19 21:39:02 +08:00
|
|
|
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();
|
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
2020-09-19 21:39:02 +08:00
|
|
|
return true;
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
bool start=false;
|
2020-09-19 21:08:32 +08:00
|
|
|
miny=getBaseline();
|
|
|
|
maxy=getBaseline();
|
2018-11-25 21:53:26 +08:00
|
|
|
smallestGreaterZero=0;
|
2020-09-19 21:08:32 +08:00
|
|
|
if (getBaseline()>0) {
|
|
|
|
smallestGreaterZero=getBaseline();
|
|
|
|
miny=getBaseline();
|
|
|
|
maxy=getBaseline();
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (parent==nullptr) return false;
|
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
const JKQTPDatastore* datastore=parent->getDatastore();
|
|
|
|
int imax=0;
|
2018-11-25 21:53:26 +08:00
|
|
|
int imin=0;
|
2020-09-19 21:39:02 +08:00
|
|
|
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);
|
|
|
|
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;
|
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
2020-09-19 21:39:02 +08:00
|
|
|
return !start;
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
}
|
2020-09-19 21:39:02 +08:00
|
|
|
return false;
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2020-09-17 22:59:57 +08:00
|
|
|
int JKQTPBarVerticalErrorGraph::getBarErrorColumn() const
|
|
|
|
{
|
|
|
|
return getYErrorColumn();
|
|
|
|
}
|
|
|
|
|
|
|
|
int JKQTPBarVerticalErrorGraph::getBarLowerErrorColumn() const
|
|
|
|
{
|
|
|
|
return getYErrorColumnLower();
|
|
|
|
}
|
|
|
|
|
2022-09-11 04:35:30 +08:00
|
|
|
JKQTPErrorPlotstyle JKQTPBarVerticalErrorGraph::getBarErrorStyle() const
|
|
|
|
{
|
|
|
|
return getYErrorStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool JKQTPBarVerticalErrorGraph::getBarErrorSymmetric() const
|
|
|
|
{
|
|
|
|
return getYErrorSymmetric();
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarVerticalErrorGraph::setBarErrorSymmetric(bool __value)
|
|
|
|
{
|
|
|
|
setYErrorSymmetric(__value);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarVerticalErrorGraph::setBarErrorStyle(JKQTPErrorPlotstyle __value)
|
|
|
|
{
|
|
|
|
setYErrorStyle(__value);
|
|
|
|
}
|
|
|
|
|
2020-09-17 22:59:57 +08:00
|
|
|
void JKQTPBarVerticalErrorGraph::setBarErrorColumn(int column)
|
|
|
|
{
|
|
|
|
setYErrorColumn(column);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarVerticalErrorGraph::setBarErrorColumn(size_t column)
|
|
|
|
{
|
2022-07-23 22:05:13 +08:00
|
|
|
setYErrorColumn(static_cast<int>(column));
|
2020-09-17 22:59:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarVerticalErrorGraph::setBarLowerErrorColumn(int column)
|
|
|
|
{
|
|
|
|
setYErrorColumnLower(column);
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPBarVerticalErrorGraph::setBarLowerErrorColumn(size_t column)
|
|
|
|
{
|
2022-07-23 22:05:13 +08:00
|
|
|
setYErrorColumnLower(static_cast<int>(column));
|
2020-09-17 22:59:57 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPBarVerticalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
2019-02-03 21:04:48 +08:00
|
|
|
//plotErrorIndicators(painter, parent, this, xColumn, yColumn, shift, 0.0);
|
|
|
|
if (sortData==JKQTPXYGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, shift, 0.0);
|
|
|
|
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, shift, 0, &sortedIndices);
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
|
2020-09-17 22:59:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarVerticalStackableGraph::JKQTPBarVerticalStackableGraph(JKQTBasePlotter *parent):
|
|
|
|
JKQTPBarVerticalGraph(parent), stackParent(nullptr)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarVerticalStackableGraph::JKQTPBarVerticalStackableGraph(JKQTPlotter *parent):
|
2019-02-08 00:24:46 +08:00
|
|
|
JKQTPBarVerticalStackableGraph(parent->getPlotter())
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPBarVerticalStackableGraph::stackUpon(JKQTPBarVerticalStackableGraph *parentGraph)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
stackParent=parentGraph;
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPBarVerticalStackableGraph::dontStackUpon()
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
stackParent=nullptr;
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
double JKQTPBarVerticalStackableGraph::getParentStackedMax(int index) const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
if (stackParent) {
|
|
|
|
return stackParent->getStackedMax(index);
|
|
|
|
} else {
|
2020-09-19 21:08:32 +08:00
|
|
|
return getBaseline();
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarVerticalStackableGraph::hasStackParent() const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
return stackParent!=nullptr;
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
const JKQTPBarVerticalStackableGraph *JKQTPBarVerticalStackableGraph::getStackParent() const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
return stackParent;
|
|
|
|
}
|
|
|
|
|
2020-09-17 22:59:57 +08:00
|
|
|
JKQTPBarVerticalStackableGraph *JKQTPBarVerticalStackableGraph::getStackParent()
|
|
|
|
{
|
|
|
|
return stackParent;
|
|
|
|
}
|
2018-11-25 21:53:26 +08:00
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
double JKQTPBarVerticalStackableGraph::getStackedMax(int index) const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
double height=0;
|
|
|
|
if (parent!=nullptr) {
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPDatastore* datastore=parent->getDatastore();
|
2018-11-25 21:53:26 +08:00
|
|
|
height=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(index));
|
|
|
|
}
|
|
|
|
if (stackParent==nullptr) {
|
|
|
|
return height;
|
|
|
|
} else {
|
|
|
|
return stackParent->getStackedMax(index)+height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPBarHorizontalStackableGraph::JKQTPBarHorizontalStackableGraph(JKQTBasePlotter *parent):
|
|
|
|
JKQTPBarHorizontalGraph(parent), stackParent(nullptr)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPBarHorizontalStackableGraph::JKQTPBarHorizontalStackableGraph(JKQTPlotter *parent):
|
2019-02-08 00:24:46 +08:00
|
|
|
JKQTPBarHorizontalStackableGraph(parent->getPlotter())
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPBarHorizontalStackableGraph::stackUpon(JKQTPBarHorizontalStackableGraph *parentGraph)
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
stackParent=parentGraph;
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPBarHorizontalStackableGraph::dontStackUpon()
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
stackParent=nullptr;
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
const JKQTPBarHorizontalStackableGraph *JKQTPBarHorizontalStackableGraph::getStackParent() const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
return stackParent;
|
|
|
|
}
|
|
|
|
|
2020-09-17 22:59:57 +08:00
|
|
|
JKQTPBarHorizontalStackableGraph *JKQTPBarHorizontalStackableGraph::getStackParent()
|
|
|
|
{
|
|
|
|
return stackParent;
|
|
|
|
}
|
|
|
|
|
2018-11-25 21:53:26 +08:00
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
double JKQTPBarHorizontalStackableGraph::getStackedMax(int index) const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
double height=0;
|
|
|
|
if (parent!=nullptr) {
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPDatastore* datastore=parent->getDatastore();
|
2018-11-25 21:53:26 +08:00
|
|
|
height=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(index));
|
|
|
|
}
|
|
|
|
if (stackParent==nullptr) {
|
|
|
|
return height;
|
|
|
|
} else {
|
|
|
|
return stackParent->getStackedMax(index)+height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
double JKQTPBarHorizontalStackableGraph::getParentStackedMax(int index) const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
if (stackParent) {
|
|
|
|
return stackParent->getStackedMax(index);
|
|
|
|
} else {
|
2020-09-19 21:08:32 +08:00
|
|
|
return getBaseline();
|
2018-11-25 21:53:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPBarHorizontalStackableGraph::hasStackParent() const
|
2018-11-25 21:53:26 +08:00
|
|
|
{
|
|
|
|
return stackParent!=nullptr;
|
|
|
|
}
|