2018-12-02 21:08:43 +08:00
|
|
|
/*
|
2022-07-19 19:40:43 +08:00
|
|
|
Copyright (c) 2008-2022 Jan W. Krieger (<jan@jkrieger.de>)
|
2018-12-02 21:08:43 +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-12-02 21:08:43 +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/jkqtpimpulses.h"
|
2018-12-02 21:08:43 +08:00
|
|
|
#include "jkqtplotter/jkqtpbaseplotter.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <iostream>
|
2019-05-30 04:40:02 +08:00
|
|
|
#include "jkqtplotter/jkqtptools.h"
|
2018-12-02 21:08:43 +08:00
|
|
|
#include "jkqtplotter/jkqtplotter.h"
|
|
|
|
#define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-19 21:21:33 +08:00
|
|
|
|
|
|
|
JKQTPImpulsesGraphBase::JKQTPImpulsesGraphBase(JKQTBasePlotter* parent):
|
2022-11-01 03:34:01 +08:00
|
|
|
JKQTPXYBaselineGraph(parent),
|
|
|
|
drawSymbols(false),
|
|
|
|
m_drawBaseline(parent->getCurrentPlotterStyle().graphsStyle.impulseStyle.drawBaseline)
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
2020-09-26 21:58:58 +08:00
|
|
|
initLineStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Impulses);
|
|
|
|
initSymbolStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Impulses);
|
2022-11-01 03:34:01 +08:00
|
|
|
m_baselineStyle=*this;
|
2018-12-02 21:08:43 +08:00
|
|
|
}
|
|
|
|
|
2020-09-19 21:21:33 +08:00
|
|
|
QColor JKQTPImpulsesGraphBase::getKeyLabelColor() const {
|
|
|
|
return getLineColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPImpulsesGraphBase::setColor(QColor c)
|
|
|
|
{
|
|
|
|
setLineColor(c);
|
|
|
|
setSymbolColor(c);
|
2020-09-26 21:58:58 +08:00
|
|
|
setSymbolFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphsStyle.impulseStyle.fillColorDerivationMode, c));
|
2020-09-19 21:21:33 +08:00
|
|
|
c.setAlphaF(0.5);
|
|
|
|
setHighlightingLineColor(c);
|
2022-11-01 03:34:01 +08:00
|
|
|
m_baselineStyle.setLineColor(c);
|
2020-09-19 21:21:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void JKQTPImpulsesGraphBase::setDrawSymbols(bool __value)
|
|
|
|
{
|
|
|
|
drawSymbols=__value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool JKQTPImpulsesGraphBase::getDrawSymbols() const
|
|
|
|
{
|
|
|
|
return drawSymbols;
|
|
|
|
}
|
|
|
|
|
2022-11-01 03:34:01 +08:00
|
|
|
void JKQTPImpulsesGraphBase::setDrawBaseline(bool __value)
|
|
|
|
{
|
|
|
|
m_drawBaseline=__value;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool JKQTPImpulsesGraphBase::getDrawBaseline() const
|
|
|
|
{
|
|
|
|
return this->m_drawBaseline;
|
|
|
|
}
|
|
|
|
|
|
|
|
JKQTPGraphLineStyleMixin &JKQTPImpulsesGraphBase::baselineStyle()
|
|
|
|
{
|
|
|
|
return m_baselineStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
const JKQTPGraphLineStyleMixin &JKQTPImpulsesGraphBase::baselineStyle() const
|
|
|
|
{
|
|
|
|
return m_baselineStyle;
|
|
|
|
}
|
2020-09-19 21:21:33 +08:00
|
|
|
|
2022-09-26 08:08:01 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-19 21:21:33 +08:00
|
|
|
JKQTPImpulsesHorizontalGraph::JKQTPImpulsesHorizontalGraph(JKQTBasePlotter* parent):
|
|
|
|
JKQTPImpulsesGraphBase(parent)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPImpulsesHorizontalGraph::JKQTPImpulsesHorizontalGraph(JKQTPlotter* parent):
|
2019-04-22 19:27:50 +08:00
|
|
|
JKQTPImpulsesHorizontalGraph(parent->getPlotter())
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
|
|
|
}
|
2019-04-22 19:27:50 +08:00
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPImpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
2018-12-02 21:08:43 +08:00
|
|
|
#ifdef JKQTBP_AUTOTIMER
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPAutoOutputTimer jkaaot("JKQTPImpulsesHorizontalGraph::draw");
|
2018-12-02 21:08:43 +08:00
|
|
|
#endif
|
|
|
|
if (parent==nullptr) return;
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPDatastore* datastore=parent->getDatastore();
|
2018-12-02 21:08:43 +08:00
|
|
|
if (datastore==nullptr) return;
|
|
|
|
|
|
|
|
drawErrorsBefore(painter);
|
2019-02-08 00:24:46 +08:00
|
|
|
{
|
|
|
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
|
|
|
|
2019-04-22 19:27:50 +08:00
|
|
|
QPen p=getLinePen(painter, parent);
|
2019-02-08 00:24:46 +08:00
|
|
|
p.setCapStyle(Qt::FlatCap);
|
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
int imax=0;
|
2019-02-08 00:24:46 +08:00
|
|
|
int imin=0;
|
2022-11-01 03:34:01 +08:00
|
|
|
double bottom=-1e6;
|
|
|
|
double top=1e6;
|
|
|
|
bool firstXY=true;
|
2020-09-19 21:39:02 +08:00
|
|
|
if (getIndexRange(imin, imax)) {
|
|
|
|
|
|
|
|
double x0=transformX(getBaseline());
|
2023-03-23 20:55:18 +08:00
|
|
|
if (getXAxis()->isLogAxis()) {
|
|
|
|
if (getBaseline()>0 && getBaseline()>getXAxis()->getMin()) x0=transformX(getBaseline());
|
|
|
|
else x0=transformX(getXAxis()->getMin());
|
2019-02-08 00:24:46 +08:00
|
|
|
}
|
2020-09-19 21:39:02 +08:00
|
|
|
|
|
|
|
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);
|
2022-11-01 03:34:01 +08:00
|
|
|
if (firstXY) {
|
|
|
|
bottom=y;
|
|
|
|
top=y;
|
|
|
|
} else {
|
|
|
|
bottom=qMax(bottom, y);
|
|
|
|
top=qMin(top, y);
|
|
|
|
}
|
|
|
|
firstXY=false;
|
2020-09-19 21:39:02 +08:00
|
|
|
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());
|
|
|
|
}
|
2019-04-22 19:27:50 +08:00
|
|
|
}
|
|
|
|
}
|
2022-11-01 03:34:01 +08:00
|
|
|
if (getDrawBaseline() && top!=bottom) {
|
|
|
|
painter.setPen(baselineStyle().getLinePen(painter, parent));
|
|
|
|
const double xb=transformX(getBaseline());
|
|
|
|
if (JKQTPIsOKFloat(xb)) painter.drawLine(xb,top,xb,bottom);
|
|
|
|
}
|
2018-12-02 21:08:43 +08:00
|
|
|
|
2019-02-08 00:24:46 +08:00
|
|
|
}
|
2018-12-02 21:08:43 +08:00
|
|
|
drawErrorsAfter(painter);
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPImpulsesHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
2018-12-02 21:08:43 +08:00
|
|
|
|
|
|
|
|
2019-02-08 00:24:46 +08:00
|
|
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
2022-08-30 15:44:40 +08:00
|
|
|
QPen p=getKeyLinePen(painter, rect, parent);
|
2018-12-02 21:08:43 +08:00
|
|
|
p.setCapStyle(Qt::FlatCap);
|
|
|
|
painter.setPen(p);
|
2019-02-08 00:24:46 +08:00
|
|
|
|
2020-09-19 21:21:33 +08:00
|
|
|
const int y=rect.top()+rect.height()/2.0;
|
|
|
|
painter.drawLine(rect.left(), y, rect.right(), y);
|
2018-12-02 21:08:43 +08:00
|
|
|
}
|
|
|
|
|
2022-09-26 08:08:01 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2018-12-02 21:08:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPImpulsesVerticalGraph::JKQTPImpulsesVerticalGraph(JKQTBasePlotter* parent):
|
2020-09-19 21:21:33 +08:00
|
|
|
JKQTPImpulsesGraphBase(parent)
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPImpulsesVerticalGraph::JKQTPImpulsesVerticalGraph(JKQTPlotter *parent):
|
2020-09-19 21:21:33 +08:00
|
|
|
JKQTPImpulsesVerticalGraph(parent->getPlotter())
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-09-19 21:21:33 +08:00
|
|
|
void JKQTPImpulsesVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
|
|
|
|
|
|
|
|
|
|
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
2022-08-30 15:44:40 +08:00
|
|
|
QPen p=getKeyLinePen(painter, rect, parent);
|
2020-09-19 21:21:33 +08:00
|
|
|
p.setCapStyle(Qt::FlatCap);
|
|
|
|
painter.setPen(p);
|
|
|
|
const int x=rect.left()+rect.width()/2.0;
|
|
|
|
painter.drawLine(x, rect.bottom(), x, rect.top());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-09-26 08:08:01 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPImpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
2018-12-02 21:08:43 +08:00
|
|
|
#ifdef JKQTBP_AUTOTIMER
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPAutoOutputTimer jkaaot("JKQTPImpulsesVerticalGraph::draw");
|
2018-12-02 21:08:43 +08:00
|
|
|
#endif
|
|
|
|
if (parent==nullptr) return;
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPDatastore* datastore=parent->getDatastore();
|
2018-12-02 21:08:43 +08:00
|
|
|
if (datastore==nullptr) return;
|
|
|
|
|
|
|
|
drawErrorsBefore(painter);
|
2019-02-08 00:24:46 +08:00
|
|
|
{
|
|
|
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
|
|
|
|
2019-04-22 19:27:50 +08:00
|
|
|
QPen p=getLinePen(painter, parent);
|
2019-02-08 00:24:46 +08:00
|
|
|
p.setCapStyle(Qt::FlatCap);
|
|
|
|
|
2020-09-19 21:39:02 +08:00
|
|
|
int imax=0;
|
2019-02-08 00:24:46 +08:00
|
|
|
int imin=0;
|
2022-11-01 03:34:01 +08:00
|
|
|
double left=-1e6;
|
|
|
|
double right=1e6;
|
|
|
|
bool firstXY=true;
|
2020-09-19 21:39:02 +08:00
|
|
|
if (getIndexRange(imin, imax)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double y0=transformY(getBaseline());
|
2023-03-23 20:55:18 +08:00
|
|
|
if (getYAxis()->isLogAxis()) {
|
|
|
|
if (getBaseline()>0 && getBaseline()>getYAxis()->getMin()) y0=transformY(getBaseline());
|
|
|
|
else y0=transformY(getYAxis()->getMin());
|
2019-02-08 00:24:46 +08:00
|
|
|
}
|
2020-09-19 21:39:02 +08:00
|
|
|
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);
|
2022-11-01 03:34:01 +08:00
|
|
|
if (firstXY) {
|
|
|
|
left=x;
|
|
|
|
right=x;
|
|
|
|
} else {
|
|
|
|
left=qMin(left, x);
|
|
|
|
right=qMax(right, x);
|
|
|
|
}
|
|
|
|
firstXY=false;
|
2020-09-19 21:39:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
}
|
2019-04-22 19:27:50 +08:00
|
|
|
}
|
|
|
|
}
|
2022-11-01 03:34:01 +08:00
|
|
|
if (getDrawBaseline() && left!=right) {
|
|
|
|
painter.setPen(baselineStyle().getLinePen(painter, parent));
|
|
|
|
const double yb=transformY(getBaseline());
|
|
|
|
if (JKQTPIsOKFloat(yb)) painter.drawLine(left, yb, right, yb);
|
|
|
|
}
|
2018-12-02 21:08:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
drawErrorsAfter(painter);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPImpulsesHorizontalErrorGraph::JKQTPImpulsesHorizontalErrorGraph(JKQTBasePlotter *parent):
|
2019-05-06 01:31:20 +08:00
|
|
|
JKQTPImpulsesHorizontalGraph(parent)
|
2018-12-12 06:00:43 +08:00
|
|
|
{
|
2019-04-22 19:27:50 +08:00
|
|
|
setErrorColorFromGraphColor(getLineColor());
|
2020-09-26 21:58:58 +08:00
|
|
|
initErrorStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Impulses);
|
2018-12-12 06:00:43 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPImpulsesHorizontalErrorGraph::JKQTPImpulsesHorizontalErrorGraph(JKQTPlotter *parent):
|
2019-02-08 00:24:46 +08:00
|
|
|
JKQTPImpulsesHorizontalErrorGraph(parent->getPlotter())
|
2018-12-12 06:00:43 +08:00
|
|
|
{
|
2019-02-08 00:24:46 +08:00
|
|
|
|
2018-12-12 06:00:43 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPImpulsesHorizontalErrorGraph::usesColumn(int c) const
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
2019-01-20 17:49:29 +08:00
|
|
|
return JKQTPImpulsesHorizontalGraph::usesColumn(c)|| JKQTPXGraphErrors::errorUsesColumn(c);
|
2018-12-02 21:08:43 +08:00
|
|
|
}
|
|
|
|
|
2022-09-26 08:08:01 +08:00
|
|
|
bool JKQTPImpulsesHorizontalErrorGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
|
|
|
|
{
|
2022-11-03 22:48:48 +08:00
|
|
|
if (xErrorColumn<0 || xErrorStyle==JKQTPNoError) {
|
|
|
|
return getMinMaxWithBaseline(xColumn, minx, maxx, smallestGreaterZero);
|
2022-09-26 08:08:01 +08:00
|
|
|
} else {
|
2022-11-03 22:48:48 +08:00
|
|
|
return getMinMaxWithErrorsAndBaseline(xColumn, xErrorColumn, xErrorColumnLower, xErrorSymmetric, minx, maxx, smallestGreaterZero);
|
2022-09-26 08:08:01 +08:00
|
|
|
}
|
2022-11-03 22:48:48 +08:00
|
|
|
|
2022-09-26 08:08:01 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPImpulsesHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
2019-02-03 21:04:48 +08:00
|
|
|
if (sortData==JKQTPXYGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn);
|
|
|
|
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, 0, 0, &sortedIndices);
|
2018-12-02 21:08:43 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
JKQTPImpulsesVerticalErrorGraph::JKQTPImpulsesVerticalErrorGraph(JKQTBasePlotter *parent):
|
2019-05-06 01:31:20 +08:00
|
|
|
JKQTPImpulsesVerticalGraph(parent)
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
2019-04-22 19:27:50 +08:00
|
|
|
setErrorColorFromGraphColor(getLineColor());
|
2020-09-26 21:58:58 +08:00
|
|
|
initErrorStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Impulses);
|
2018-12-02 21:08:43 +08:00
|
|
|
}
|
|
|
|
|
2019-01-20 23:15:10 +08:00
|
|
|
JKQTPImpulsesVerticalErrorGraph::JKQTPImpulsesVerticalErrorGraph(JKQTPlotter *parent):
|
2019-02-08 00:24:46 +08:00
|
|
|
JKQTPImpulsesVerticalErrorGraph(parent->getPlotter())
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
2019-02-08 00:24:46 +08:00
|
|
|
|
2018-12-02 21:08:43 +08:00
|
|
|
}
|
|
|
|
|
2022-09-26 08:08:01 +08:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
bool JKQTPImpulsesVerticalErrorGraph::usesColumn(int c) const
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
2019-01-20 17:49:29 +08:00
|
|
|
return JKQTPImpulsesVerticalGraph::usesColumn(c)|| JKQTPYGraphErrors::errorUsesColumn(c);
|
2018-12-02 21:08:43 +08:00
|
|
|
}
|
|
|
|
|
2022-09-26 08:08:01 +08:00
|
|
|
bool JKQTPImpulsesVerticalErrorGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
|
|
|
|
{
|
2022-11-03 22:48:48 +08:00
|
|
|
if (yErrorColumn<0 || yErrorStyle==JKQTPNoError) {
|
|
|
|
return getMinMaxWithBaseline(yColumn, miny, maxy, smallestGreaterZero);
|
2022-09-26 08:08:01 +08:00
|
|
|
} else {
|
2022-11-03 22:48:48 +08:00
|
|
|
return getMinMaxWithErrorsAndBaseline(yColumn, yErrorColumn, yErrorColumnLower, yErrorSymmetric, miny, maxy, smallestGreaterZero);
|
2022-09-26 08:08:01 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-01-20 17:49:29 +08:00
|
|
|
void JKQTPImpulsesVerticalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
|
2018-12-02 21:08:43 +08:00
|
|
|
{
|
2019-02-03 21:04:48 +08:00
|
|
|
if (sortData==JKQTPXYGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn);
|
|
|
|
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, 0, 0, &sortedIndices);
|
2018-12-02 21:08:43 +08:00
|
|
|
|
|
|
|
}
|