clean up code, use override specifiers, prepare for plotObjects with different coordinate systems (e.g. relative ...)

This commit is contained in:
Jan W. Krieger 2018-12-27 22:52:00 +01:00
parent 877abaf2b8
commit 0abc131943
60 changed files with 1235 additions and 1026 deletions

View File

@ -1320,7 +1320,7 @@ double JKQTPverticalAxis::get_parent_otheraxis_width() const {
bool JKQTPverticalAxis::get_parent_otheraxis_inverted() const
{
return parent->getXAxis()->get_inverted();
return parent->get_xAxis()->get_inverted();
}
void JKQTPverticalAxis::drawGrids(JKQTPEnhancedPainter& painter) {
@ -1775,6 +1775,16 @@ void JKQTPverticalIndependentAxis::set_otherAxisInverted(bool __value) {
update_plot();
}
double JKQTPverticalIndependentAxis::get_parent_plotwidth() const { return axisWidth; }
double JKQTPverticalIndependentAxis::get_parent_plotoffset() const { return axisOffset; }
double JKQTPverticalIndependentAxis::get_parent_otheraxis_width() const { return otherAxisWidth; }
bool JKQTPverticalIndependentAxis::get_parent_otheraxis_inverted() const { return otherAxisInverted; }
double JKQTPverticalIndependentAxis::get_parent_otheraxis_offset() const { return otherAxisOffset; }
@ -1848,7 +1858,7 @@ double JKQTPhorizontalAxis::get_parent_otheraxis_width() const {
bool JKQTPhorizontalAxis::get_parent_otheraxis_inverted() const
{
return parent->getYAxis()->get_inverted();
return parent->get_yAxis()->get_inverted();
}
void JKQTPhorizontalAxis::drawGrids(JKQTPEnhancedPainter& painter) {

View File

@ -184,7 +184,7 @@ class LIB_EXPORT JKQTPcoordinateAxis: public QObject {
}
/** \brief return time coordinate coordinate from x-pixel */
inline double p2x(long x) const {
inline double p2x(double x) const {
double xx=x;
if (inverted) {
xx=2.0*get_parent_plotoffset()+get_parent_plotwidth()-x;
@ -767,31 +767,31 @@ class LIB_EXPORT JKQTPverticalAxis: public JKQTPcoordinateAxis {
JKQTPverticalAxis(JKQtBasePlotter* parent);
/** \brief returns the size of the left/bottom axis in pixels */
virtual QSize getSize1(JKQTPEnhancedPainter& painter);
virtual QSize getSize1(JKQTPEnhancedPainter& painter) override;
/** \brief returns the size of the right/top axis in pixels */
virtual QSize getSize2(JKQTPEnhancedPainter& painter);
virtual QSize getSize2(JKQTPEnhancedPainter& painter) override;
/** \brief draw axes */
virtual void drawAxes(JKQTPEnhancedPainter& painter);
virtual void drawAxes(JKQTPEnhancedPainter& painter) override;
/** \brief draw grids */
virtual void drawGrids(JKQTPEnhancedPainter& painter);
virtual void drawGrids(JKQTPEnhancedPainter& painter) override;
protected:
/** \brief width of the plot in the direction of the axis */
virtual double get_parent_plotwidth() const;
virtual double get_parent_plotwidth() const override;
/** \brief offset of the plot in the direction of the axis */
virtual double get_parent_plotoffset() const;
virtual double get_parent_plotoffset() const override;
/** \brief pixel of other (perpendicular) axis (needed for grids) */
virtual double get_parent_otheraxis_width() const;
virtual bool get_parent_otheraxis_inverted() const;
virtual double get_parent_otheraxis_width() const override;
virtual bool get_parent_otheraxis_inverted() const override;
/** \brief pixel offset of (perpendicular) other axis (needed for grids) */
virtual double get_parent_otheraxis_offset() const;
virtual double get_parent_otheraxis_offset() const override;
virtual void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize);
virtual void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize);
virtual void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize) ;
virtual void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize) ;
};
@ -807,25 +807,25 @@ class LIB_EXPORT JKQTPverticalIndependentAxis: public JKQTPverticalAxis {
/** \brief class constructor */
JKQTPverticalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQtBasePlotter* parent);
/** \brief set the axis offset */
virtual void set_axisOffset(double __value);
virtual void set_axisOffset(double __value) ;
/** \brief set the axis width */
virtual void set_axisWidth(double __value);
virtual void set_axisWidth(double __value) ;
/** \brief set the other axis offset */
virtual void set_otherAxisOffset(double __value);
virtual void set_otherAxisOffset(double __value) ;
/** \brief set the other axis width */
virtual void set_otherAxisWidth(double __value);
virtual void set_otherAxisWidth(double __value) ;
/** \brief set the other axis width */
virtual void set_otherAxisInverted(bool __value);
virtual void set_otherAxisInverted(bool __value) ;
protected:
/** \brief width of the plot in the direction of the axis */
virtual double get_parent_plotwidth() const { return axisWidth; }
virtual double get_parent_plotwidth() const override;
/** \brief offset of the plot in the direction of the axis */
virtual double get_parent_plotoffset() const { return axisOffset; }
virtual double get_parent_plotoffset() const override;
/** \brief pixel of other (perpendicular) axis (needed for grids) */
virtual double get_parent_otheraxis_width() const { return otherAxisWidth; }
virtual bool get_parent_otheraxis_inverted() const { return otherAxisInverted; }
virtual double get_parent_otheraxis_width() const override;
virtual bool get_parent_otheraxis_inverted() const override;
/** \brief pixel offset of (perpendicular) other axis (needed for grids) */
virtual double get_parent_otheraxis_offset() const { return otherAxisOffset; }
virtual double get_parent_otheraxis_offset() const override;
double axisOffset;
double axisWidth;
@ -848,31 +848,31 @@ class LIB_EXPORT JKQTPhorizontalAxis: public JKQTPcoordinateAxis {
JKQTPhorizontalAxis(JKQtBasePlotter* parent);
/** \brief returns the size of the left/bottom axis in pixels */
virtual QSize getSize1(JKQTPEnhancedPainter& painter);
virtual QSize getSize1(JKQTPEnhancedPainter& painter) override;
/** \brief returns the size of the right/top axis in pixels */
virtual QSize getSize2(JKQTPEnhancedPainter& painter);
virtual QSize getSize2(JKQTPEnhancedPainter& painter) override;
/** \brief draw axes */
virtual void drawAxes(JKQTPEnhancedPainter& painter);
virtual void drawAxes(JKQTPEnhancedPainter& painter) override;
/** \brief draw grids */
virtual void drawGrids(JKQTPEnhancedPainter& painter);
virtual void drawGrids(JKQTPEnhancedPainter& painter) override;
protected:
/** \brief width of the plot in the direction of the axis */
virtual double get_parent_plotwidth() const;
virtual double get_parent_plotwidth() const override;
/** \brief offset of the plot in the direction of the axis */
virtual double get_parent_plotoffset() const;
virtual double get_parent_plotoffset() const override;
/** \brief pixel of other (perpendicular) axis (needed for grids) */
virtual double get_parent_otheraxis_width() const;
virtual bool get_parent_otheraxis_inverted() const;
virtual double get_parent_otheraxis_width() const override;
virtual bool get_parent_otheraxis_inverted() const override;
/** \brief pixel offset of (perpendicular) other axis (needed for grids) */
virtual double get_parent_otheraxis_offset() const;
virtual double get_parent_otheraxis_offset() const override;
virtual void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize, double ascentMax, double descentMax);
virtual void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize, double ascentMax, double descentMax);
virtual void drawTickLabel1(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize, double ascentMax, double descentMax) ;
virtual void drawTickLabel2(JKQTPEnhancedPainter& painter, double xx, double yy, const QString &label, double fontSize, double ascentMax, double descentMax) ;
};
@ -899,14 +899,14 @@ class LIB_EXPORT JKQTPhorizontalIndependentAxis: public JKQTPhorizontalAxis {
virtual void set_otherAxisInverted(bool __value);
protected:
/** \brief width of the plot in the direction of the axis */
virtual double get_parent_plotwidth() const;
virtual double get_parent_plotwidth() const override;
/** \brief offset of the plot in the direction of the axis */
virtual double get_parent_plotoffset() const;
virtual double get_parent_plotoffset() const override;
/** \brief pixel of other (perpendicular) axis (needed for grids) */
virtual double get_parent_otheraxis_width() const;
virtual bool get_parent_otheraxis_inverted() const;
virtual double get_parent_otheraxis_width() const override;
virtual bool get_parent_otheraxis_inverted() const override;
/** \brief pixel offset of (perpendicular) other axis (needed for grids) */
virtual double get_parent_otheraxis_offset() const;
virtual double get_parent_otheraxis_offset() const override;
double axisOffset;
double axisWidth;

View File

@ -54,6 +54,9 @@
#include "jkqtplotter/jkqtpgraphsbarchart.h"
#include "jkqtplotter/jkqtpgraphsfilledcurve.h"
#include "jkqtplotter/jkqtpgraphsimpulses.h"
#include "jkqtplotter/jkqtpgraphs.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
static QString globalUserSettigsFilename="";
static QString globalUserSettigsPrefix="";
@ -3526,8 +3529,8 @@ void JKQtBasePlotter::plotGraphs(JKQTPEnhancedPainter& painter){
for (int j=0; j<graphs.size(); j++) {
//int leftSpace, rightSpace, topSpace, bottomSpace;
JKQTPgraph* g=graphs[j];
//qDebug()<<" drawing JKQTPgraph"<<j<<g->get_title()<<g->metaObject()->className();
JKQTPplotElement* g=graphs[j];
//qDebug()<<" drawing JKQTPplotElement"<<j<<g->get_title()<<g->metaObject()->className();
if (g->get_visible()) g->draw(painter);
}
@ -3537,7 +3540,7 @@ void JKQtBasePlotter::plotGraphs(JKQTPEnhancedPainter& painter){
for (int j=0; j<graphs.size(); j++) {
int leftSpace, rightSpace, topSpace, bottomSpace;
JKQTPgraph* g=graphs[j];
JKQTPplotElement* g=graphs[j];
if (g->get_visible()) {
g->getOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
ibTop+=topSpace;
@ -3579,7 +3582,7 @@ void JKQtBasePlotter::plotKeyContents(JKQTPEnhancedPainter& painter, double x, d
if (keyLayout==JKQTPkeyLayoutOneColumn) {
for (int i=0; i<graphs.size(); i++) {
JKQTPgraph* g=graphs[i];
JKQTPplotElement* g=graphs[i];
#ifdef JKQTBP_AUTOTIMER
jkaaot.write(QString("one-col: graph %1: %2").arg(i).arg(g->get_title()));
#endif
@ -3602,7 +3605,7 @@ void JKQtBasePlotter::plotKeyContents(JKQTPEnhancedPainter& painter, double x, d
} else if (keyLayout==JKQTPkeyLayoutOneRow) {
for (int i=0; i<graphs.size(); i++) {
JKQTPgraph* g=graphs[i];
JKQTPplotElement* g=graphs[i];
#ifdef JKQTBP_AUTOTIMER
jkaaot.write(QString("one-row: graph %1: %2").arg(i).arg(g->get_title()));
#endif
@ -3636,7 +3639,7 @@ void JKQtBasePlotter::plotKeyContents(JKQTPEnhancedPainter& painter, double x, d
double xx=x;
double yy=y;
for (int i=0; i<graphs.size(); i++) {
JKQTPgraph* g=graphs[i];
JKQTPplotElement* g=graphs[i];
#ifdef JKQTBP_AUTOTIMER
jkaaot.write(QString("multi-col: graph %1: %2").arg(i).arg(g->get_title()));
#endif
@ -4099,7 +4102,7 @@ QVector<QLineF> JKQtBasePlotter::getBoundingLinesX1Y1(QRectF* rect) const
JKQTPgraph* JKQtBasePlotter::getGraph(size_t i) {
JKQTPplotElement* JKQtBasePlotter::getGraph(size_t i) {
return graphs[i];
};
@ -4109,13 +4112,13 @@ size_t JKQtBasePlotter::getGraphCount() {
void JKQtBasePlotter::deleteGraph(size_t i, bool deletegraph) {
if (long(i)<0 || long(i)>=graphs.size()) return;
JKQTPgraph* g=graphs[i];
JKQTPplotElement* g=graphs[i];
graphs.removeAt(i);
if (deletegraph && g) delete g;
if (emitPlotSignals) emit plotUpdated();
};
void JKQtBasePlotter::deleteGraph(JKQTPgraph* gr, bool deletegraph) {
void JKQtBasePlotter::deleteGraph(JKQTPplotElement* gr, bool deletegraph) {
int i=graphs.indexOf(gr);
while (i>=0) {
graphs.removeAt(i);
@ -4128,7 +4131,7 @@ void JKQtBasePlotter::deleteGraph(JKQTPgraph* gr, bool deletegraph) {
void JKQtBasePlotter::clearGraphs(bool deleteGraphs) {
for (int i=0; i<graphs.size(); i++) {
JKQTPgraph* g=graphs[i];
JKQTPplotElement* g=graphs[i];
if (g && deleteGraphs) delete g;
}
graphs.clear();
@ -4139,7 +4142,7 @@ void JKQtBasePlotter::clearGraphs(bool deleteGraphs) {
void JKQtBasePlotter::setAllGraphsInvisible()
{
for (int i=0; i<graphs.size(); i++) {
JKQTPgraph* g=graphs[i];
JKQTPplotElement* g=graphs[i];
g->set_visible(false);
}
if (emitPlotSignals) emit plotUpdated();
@ -4148,7 +4151,7 @@ void JKQtBasePlotter::setAllGraphsInvisible()
void JKQtBasePlotter::setAllGraphsVisible()
{
for (int i=0; i<graphs.size(); i++) {
JKQTPgraph* g=graphs[i];
JKQTPplotElement* g=graphs[i];
g->set_visible(true);
}
if (emitPlotSignals) emit plotUpdated();
@ -4156,7 +4159,7 @@ void JKQtBasePlotter::setAllGraphsVisible()
void JKQtBasePlotter::setGraphVisible(int i, bool visible)
{
JKQTPgraph* g=graphs.value(i, nullptr);
JKQTPplotElement* g=graphs.value(i, nullptr);
if (g) g->set_visible(visible);
if (emitPlotSignals) emit plotUpdated();
}
@ -4164,10 +4167,10 @@ void JKQtBasePlotter::setGraphVisible(int i, bool visible)
void JKQtBasePlotter::setOnlyGraphVisible(int gr)
{
for (int i=0; i<graphs.size(); i++) {
JKQTPgraph* g=graphs[i];
JKQTPplotElement* g=graphs[i];
g->set_visible(false);
}
JKQTPgraph* g=graphs.value(gr, nullptr);
JKQTPplotElement* g=graphs.value(gr, nullptr);
if (g) g->set_visible(true);
if (emitPlotSignals) emit plotUpdated();
}
@ -4175,17 +4178,17 @@ void JKQtBasePlotter::setOnlyGraphVisible(int gr)
void JKQtBasePlotter::setOnlyNthGraphsVisible(int start, int n)
{
for (int i=0; i<graphs.size(); i++) {
JKQTPgraph* g=graphs[i];
JKQTPplotElement* g=graphs[i];
g->set_visible(false);
}
for (int i=start; i<graphs.size(); i+=n) {
JKQTPgraph* g=graphs.value(i, nullptr);
JKQTPplotElement* g=graphs.value(i, nullptr);
if (g) g->set_visible(true);
}
if (emitPlotSignals) emit plotUpdated();
}
size_t JKQtBasePlotter::addGraph(JKQTPgraph* gr) {
size_t JKQtBasePlotter::addGraph(JKQTPplotElement* gr) {
gr->setParent(this);
for (int i=0; i<graphs.size(); i++) {
if (graphs[i]==gr) return i;
@ -4195,7 +4198,7 @@ size_t JKQtBasePlotter::addGraph(JKQTPgraph* gr) {
return graphs.size()-1;
};
size_t JKQtBasePlotter::moveGraphTop(JKQTPgraph* gr) {
size_t JKQtBasePlotter::moveGraphTop(JKQTPplotElement* gr) {
gr->setParent(this);
for (int i=0; i<graphs.size(); i++) {
if (graphs[i]==gr) {
@ -4211,7 +4214,7 @@ size_t JKQtBasePlotter::moveGraphTop(JKQTPgraph* gr) {
return graphs.size()-1;
}
size_t JKQtBasePlotter::moveGraphBottom(JKQTPgraph *gr)
size_t JKQtBasePlotter::moveGraphBottom(JKQTPplotElement *gr)
{
gr->setParent(this);
for (int i=0; i<graphs.size(); i++) {
@ -4228,7 +4231,7 @@ size_t JKQtBasePlotter::moveGraphBottom(JKQTPgraph *gr)
return graphs.size()-1;
};
bool JKQtBasePlotter::containsGraph(JKQTPgraph* gr) const {
bool JKQtBasePlotter::containsGraph(JKQTPplotElement* gr) const {
for (int i=0; i<graphs.size(); i++) {
if (graphs[i]==gr) {
return true;
@ -4240,8 +4243,11 @@ bool JKQtBasePlotter::containsGraph(JKQTPgraph* gr) const {
void JKQtBasePlotter::setGraphsDataRange(int datarange_start, int datarange_end) {
for (int i=0; i<graphs.size(); i++) {
graphs[i]->set_datarange_start(datarange_start);
graphs[i]->set_datarange_end(datarange_end);
JKQTPgraph* g=dynamic_cast<JKQTPgraph*>(graphs[i]);
if (g) {
g->set_datarange_start(datarange_start);
g->set_datarange_end(datarange_end);
}
}
}

View File

@ -36,9 +36,6 @@
#include "jkqtplotter/jkqtpdatastorage.h"
#include "jkqtmathtext/jkqtmathtext.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplotter/jkqtpgraphs.h"
#include "jkqtplotter/jkqtpgraphsgeometric.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpelementsoverlay.h"
#include "jkqtplottertools/jkqtpenhancedpainter.h"
#include "jkqtplottergui/jkqtpenhancedspinboxes.h"
@ -70,6 +67,8 @@
class JKQTPgraphsModel; // forward
class JKQTPgraph; // forward
class JKQTPplotElement; // forward
/** \brief initialized Qt-ressources necessary for JKQtBasePlotter */
LIB_EXPORT void initJKQtBasePlotterResources();
@ -120,7 +119,7 @@ LIB_EXPORT void initJKQtBasePlotterResources();
* - The plotting of coordinate axes and grids, as well as coordinate transforms is done by
* JKQTPcoordinateAxis descendents (see documentation there)
* .
* If you want to set the axis properties, use getXAxis() or getYAxis() to get a pointer to the axis objects which then
* If you want to set the axis properties, use get_xAxis() or get_yAxis() to get a pointer to the axis objects which then
* may be used to set the axis properties.
*
*
@ -436,7 +435,7 @@ class LIB_EXPORT JKQtBasePlotter: public QObject {
/** \brief a vector that contains all graphs to be plottet in the system */
QList<JKQTPgraph*> graphs;
QList<JKQTPplotElement*> graphs;
QList<JKQTPoverlayElement*> overlays;
@ -770,6 +769,13 @@ class LIB_EXPORT JKQtBasePlotter: public QObject {
/** \brief returns model representing all Plots in this plotter and showing their visible/invisible state */
inline JKQTPgraphsModel* getPlotsModel() { return m_plotsModel; }
/** \brief returns a pointer to the datastore used by this object */
inline const JKQTPdatastore* getDatastore() const { return datastore; }
/** \brief returns model representing all Plots in this plotter and showing their visible/invisible state */
inline const JKQTPgraphsModel* getPlotsModel() const { return m_plotsModel; }
/** \brief tells the plotter object to use the given external datastore.
*
* If the current datastore is internally managed, this method will free that object and use the supplied datastore
@ -1077,10 +1083,11 @@ class LIB_EXPORT JKQtBasePlotter: public QObject {
JKQTPGET_MACRO(int, plotWidth)
JKQTPGET_MACRO(int, plotHeight)
inline JKQTmathText* get_mathText() { return &mathText; }
inline JKQTPhorizontalAxis* getXAxis() { return xAxis; }
inline JKQTPverticalAxis* getYAxis() { return yAxis; }
inline const JKQTmathText* get_mathText() const { return &mathText; }
inline JKQTPhorizontalAxis* get_xAxis() { return xAxis; }
inline JKQTPverticalAxis* get_yAxis() { return yAxis; }
inline const JKQTPhorizontalAxis* get_xAxis() const { return xAxis; }
inline const JKQTPverticalAxis* get_yAxis() const { return yAxis; }
JKQTPGET_MACRO(QAction*, actSavePlot)
@ -1118,7 +1125,7 @@ class LIB_EXPORT JKQtBasePlotter: public QObject {
/** \brief returns description of i'th graph */
JKQTPgraph* getGraph(size_t i);
JKQTPplotElement* getGraph(size_t i);
/** \brief returns the number of graphs */
size_t getGraphCount();
@ -1127,7 +1134,7 @@ class LIB_EXPORT JKQtBasePlotter: public QObject {
void deleteGraph(size_t i, bool deletegraph=true);
/** \brief remove the given graph, if it is contained */
void deleteGraph(JKQTPgraph* gr, bool deletegraph=true);
void deleteGraph(JKQTPplotElement* gr, bool deletegraph=true);
/** \brief remove all plots
*
@ -1140,15 +1147,15 @@ class LIB_EXPORT JKQtBasePlotter: public QObject {
void setGraphVisible(int i, bool visible=true);
/** \brief add a new graph, returns it's position in the graphs list, if the graph is already in the plot, this returns the index in the list */
size_t addGraph(JKQTPgraph* gr);
size_t addGraph(JKQTPplotElement* gr);
/** \brief returns \c true, if the given graph is in this plot */
bool containsGraph(JKQTPgraph* gr) const;
bool containsGraph(JKQTPplotElement* gr) const;
/** \brief move the given graph to the top, or add it, if it is not yet contained */
size_t moveGraphTop(JKQTPgraph* gr);
size_t moveGraphTop(JKQTPplotElement* gr);
/** \brief move the given graph to the top, or add it, if it is not yet contained */
size_t moveGraphBottom(JKQTPgraph* gr);
size_t moveGraphBottom(JKQTPplotElement* gr);
/** \brief add a new graphs from a QVector */
template <class TJKQTPgraphContainer>
@ -1170,7 +1177,7 @@ class LIB_EXPORT JKQtBasePlotter: public QObject {
* If you want to change them either use another overloaded version of addGraph(), or use getGraph() and setGraph():
* \code
* size_t i=addGraph(0,1,"graph1");
* JKQTPgraph gr=getGraph(i);
* JKQTPplotElement gr=getGraph(i);
* gr.color=QColor("red");
* setGraph(i, gr);
* \endcode

View File

@ -646,7 +646,7 @@ class LIB_EXPORT JKQTPcolumn {
inline bool isValid() const { return valid; }
/** \brief class destructor */
virtual ~JKQTPcolumn() ;
~JKQTPcolumn() ;
JKQTPGET_SET_MACRO(QString, name)
@ -775,7 +775,7 @@ class LIB_EXPORT JKQTPdatastoreItem {
/** \brief class constructor: initializes the object for external data storage */
JKQTPdatastoreItem(JKQTPdatastoreItemFormat dataformat, double* data, size_t columns, size_t rows, bool internal);
/** \brief class destructor: frees unfreed internal memory */
virtual ~JKQTPdatastoreItem();
~JKQTPdatastoreItem();
/** \brief change the size of all columns to the givne number of rows. The data will be lost */
void resizeColumns(size_t rows);
@ -836,14 +836,14 @@ class LIB_EXPORT JKQTPdatastoreModel: public QAbstractTableModel {
Q_OBJECT
public:
JKQTPdatastoreModel(JKQTPdatastore* datastore, QObject* parent=nullptr);
~JKQTPdatastoreModel();
virtual ~JKQTPdatastoreModel() override;
virtual QVariant data(const QModelIndex &index, int role) const;
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const ;
virtual QVariant data(const QModelIndex &index, int role) const override;
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
public slots:
void reloadModel();

View File

@ -149,8 +149,8 @@ void JKQTPxyLineGraph::draw(JKQTPEnhancedPainter& painter) {
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=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
double x=transformX(xv);
double y=transformY(yv);
//qDebug()<<"JKQTPxyLineGraph::draw(): (xv, yv) = ( "<<xv<<", "<<yv<<" )";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(x) && JKQTPIsOKFloat(y)) {
QColor symbColor=color;
@ -222,6 +222,14 @@ QColor JKQTPxyLineGraph::getKeyLabelColor() {
}
JKQTPxyLineErrorGraph::JKQTPxyLineErrorGraph(JKQtBasePlotter *parent):
JKQTPxyLineGraph(parent), JKQTPxyGraphErrors()
{ setErrorColorFromGraphColor(color); }
JKQTPxyLineErrorGraph::JKQTPxyLineErrorGraph(JKQtPlotter *parent):
JKQTPxyLineGraph(parent), JKQTPxyGraphErrors()
{ setErrorColorFromGraphColor(color); }
bool JKQTPxyLineErrorGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) {
if (xErrorColumn<0 || xErrorStyle==JKQTPnoError) {
return JKQTPxyLineGraph::getXMinMax(minx, maxx, smallestGreaterZero);
@ -318,7 +326,7 @@ bool JKQTPxyLineErrorGraph::getYMinMax(double &miny, double &maxy, double &small
}
}
bool JKQTPxyLineErrorGraph::usesColumn(int c)
bool JKQTPxyLineErrorGraph::usesColumn(int c) const
{
return JKQTPxyLineGraph::usesColumn(c)||JKQTPxyGraphErrors::errorUsesColumn(c);
}
@ -326,8 +334,8 @@ bool JKQTPxyLineErrorGraph::usesColumn(int c)
void JKQTPxyLineErrorGraph::drawErrorsBefore(JKQTPEnhancedPainter &painter)
{
intSortData();
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
}
@ -462,10 +470,10 @@ void JKQTPstepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
double yold=-1;
// double xstart=-1;
// double ystart=-1;
//double x0=xAxis->x2p(0);
//if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
double y0=yAxis->x2p(0);
if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
//double x0=transformX(0);
//if (parent->get_xAxis()->isLogAxis()) x0=transformX(parent->get_xAxis()->getMin());
double y0=transformY(0);
if (parent->get_yAxis()->isLogAxis()) y0=transformY(parent->get_yAxis()->getMin());
bool subsequentItem=false;
intSortData();
for (int iii=imin; iii<imax; iii++) {
@ -474,8 +482,8 @@ void JKQTPstepHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
double x=transformX(xv);
double y=transformY(yv);
if (subsequentItem) {
//double xl1=xold;
//double yl1=yold;
@ -605,10 +613,10 @@ void JKQTPstepVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
double xold=-1;
double yold=-1;
double x0=xAxis->x2p(0);
if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
//double y0=yAxis->x2p(0);
//if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
double x0=transformX(0);
if (parent->get_xAxis()->isLogAxis()) x0=transformX(parent->get_xAxis()->getMin());
//double y0=transformY(0);
//if (parent->get_yAxis()->isLogAxis()) y0=transformY(parent->get_yAxis()->getMin());
bool first=false;
intSortData();
for (int iii=imin; iii<imax; iii++) {
@ -617,8 +625,8 @@ void JKQTPstepVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
double x=transformX(xv);
double y=transformY(yv);
if (first) {
//double xl1=xold;
//double yl1=yold;
@ -765,15 +773,15 @@ void JKQTPhorizontalRange::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPhorizontalRange::draw");
#endif
double c=yAxis->x2p(rangeCenter);
double cmi=yAxis->x2p(rangeMin);
double cma=yAxis->x2p(rangeMax);
double smi=yAxis->x2p(parent->getYAxis()->getMin());
double sma=yAxis->x2p(parent->getYAxis()->getMax());
double mi=xAxis->x2p(parent->getXAxis()->getMin());
double ma=xAxis->x2p(parent->getXAxis()->getMax());
if (!unlimitedSizeMin) mi=xAxis->x2p(sizeMin);
if (!unlimitedSizeMax) ma=xAxis->x2p(sizeMax);
double c=transformY(rangeCenter);
double cmi=transformY(rangeMin);
double cma=transformY(rangeMax);
double smi=transformY(parent->get_yAxis()->getMin());
double sma=transformY(parent->get_yAxis()->getMax());
double mi=transformX(parent->get_xAxis()->getMin());
double ma=transformX(parent->get_xAxis()->getMax());
if (!unlimitedSizeMin) mi=transformX(sizeMin);
if (!unlimitedSizeMax) ma=transformX(sizeMax);
//std::cout<<"hor: rangeMin="<<rangeMin<<" -> "<<cmi<<std::endl;
//std::cout<<"hor: rangeMax="<<rangeMax<<" -> "<<cma<<std::endl;
painter.save();
@ -910,15 +918,15 @@ void JKQTPverticalRange::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPverticalRange::draw");
#endif
double c=xAxis->x2p(rangeCenter);
double cmi=xAxis->x2p(rangeMin);
double cma=xAxis->x2p(rangeMax);
double mi=yAxis->x2p(parent->getYAxis()->getMin());
double ma=yAxis->x2p(parent->getYAxis()->getMax());
double smi=xAxis->x2p(parent->getXAxis()->getMin());
double sma=xAxis->x2p(parent->getXAxis()->getMax());
if (!unlimitedSizeMin) mi=yAxis->x2p(sizeMin);
if (!unlimitedSizeMax) ma=yAxis->x2p(sizeMax);
double c=transformX(rangeCenter);
double cmi=transformX(rangeMin);
double cma=transformX(rangeMax);
double mi=transformY(parent->get_yAxis()->getMin());
double ma=transformY(parent->get_yAxis()->getMax());
double smi=transformX(parent->get_xAxis()->getMin());
double sma=transformX(parent->get_xAxis()->getMax());
if (!unlimitedSizeMin) mi=transformY(sizeMin);
if (!unlimitedSizeMax) ma=transformY(sizeMax);
painter.save();
if (plotRange && (cmi!=cma) && JKQTPIsOKFloat(mi) && JKQTPIsOKFloat(ma)) {
QPen p=painter.pen();
@ -1182,16 +1190,16 @@ void JKQTPxyParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
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=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
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(xAxis->x2p( xv+gridDeltaX*gridSymbolFractionSize/2.0)-xAxis->x2p( xv-gridDeltaX*gridSymbolFractionSize/2.0));
double sSY= fabs(yAxis->x2p( yv+gridDeltaY*gridSymbolFractionSize/2.0)-yAxis->x2p( yv-gridDeltaY*gridSymbolFractionSize/2.0));
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);
}
@ -1283,18 +1291,26 @@ void JKQTPxyParametrizedScatterGraph::drawKeyMarker(JKQTPEnhancedPainter &painte
QColor color1=getKeyLabelColor();
QColor color2=getKeyLabelColor();
if (colorColumn>=0 && colorColumnContainsRGB) {
JKQTPgraphSymbols symbol1=symbol;
JKQTPgraphSymbols symbol2=symbol;
if (colorColumn>=0) {
if (colorColumnContainsRGB) {
color1=QColor("red");
color2=QColor("blue");
}
if (colorColumn>=0 && !colorColumnContainsRGB) {
} else {
QImage img;
double colorval[]={0,1};
JKQTPimagePlot_array2image<double>(colorval, 2, 1, img, get_palette(), double(0.0), double(1.0));
color1=img.pixel(0,0);
color2=img.pixel(1,0);
}
}
if (symbolColumn>=0) {
symbol1=JKQTPfilledCircle;
symbol2=JKQTPfilledRect;
}
double symbolWidth=parent->pt2px(painter, this->symbolWidth*0.7*parent->get_lineWidthMultiplier());
if (symbolWidth>0.2*symbolSize) symbolWidth=0.3*symbolSize;
@ -1311,8 +1327,8 @@ void JKQTPxyParametrizedScatterGraph::drawKeyMarker(JKQTPEnhancedPainter &painte
double y1=rect.top()+symbolSize1/2.0;
double x2=rect.right()-symbolSize2/2.0;
double y2=rect.bottom()-symbolSize2/2.0;
JKQTPplotSymbol(painter, x1, y1, symbol, symbolSize1, symbolWidth, color1, color1.lighter());
JKQTPplotSymbol(painter, x2, y2, symbol, symbolSize2, symbolWidth, color2, color2.lighter());
JKQTPplotSymbol(painter, x1, y1, symbol1, symbolSize1, symbolWidth, color1, color1.lighter());
JKQTPplotSymbol(painter, x2, y2, symbol2, symbolSize2, symbolWidth, color2, color2.lighter());
if (drawLine) painter.drawLine(x1,y1, x2,y2);
painter.restore();
}
@ -1384,7 +1400,7 @@ void JKQTPxyParametrizedScatterGraph::cbGetDataMinMax(double &dmin, double &dmax
}
bool JKQTPxyParametrizedScatterGraph::usesColumn(int c)
bool JKQTPxyParametrizedScatterGraph::usesColumn(int c) const
{
return (c==colorColumn) || (c==sizeColumn) || (c==symbolColumn) || (c==linewidthColumn) || JKQTPxyLineGraph::usesColumn(c);
}
@ -1462,6 +1478,14 @@ JKQTPgraphSymbols JKQTPxyParametrizedScatterGraph::getLocalSymbolType(int i)
}
JKQTPxyParametrizedErrorScatterGraph::JKQTPxyParametrizedErrorScatterGraph(JKQtBasePlotter *parent):
JKQTPxyParametrizedScatterGraph(parent), JKQTPxyGraphErrors()
{ setErrorColorFromGraphColor(color); }
JKQTPxyParametrizedErrorScatterGraph::JKQTPxyParametrizedErrorScatterGraph(JKQtPlotter *parent):
JKQTPxyParametrizedScatterGraph(parent), JKQTPxyGraphErrors()
{ setErrorColorFromGraphColor(color); }
bool JKQTPxyParametrizedErrorScatterGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{
if (xErrorColumn<0 || xErrorStyle==JKQTPnoError) {
@ -1560,7 +1584,7 @@ bool JKQTPxyParametrizedErrorScatterGraph::getYMinMax(double &miny, double &maxy
}
}
bool JKQTPxyParametrizedErrorScatterGraph::usesColumn(int c)
bool JKQTPxyParametrizedErrorScatterGraph::usesColumn(int c) const
{
return JKQTPxyParametrizedScatterGraph::usesColumn(c)||JKQTPxyGraphErrors::errorUsesColumn(c);
@ -1569,11 +1593,11 @@ bool JKQTPxyParametrizedErrorScatterGraph::usesColumn(int c)
void JKQTPxyParametrizedErrorScatterGraph::drawErrorsBefore(JKQTPEnhancedPainter &painter)
{
intSortData();
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
}
bool JKQTPxyParametrizedErrorScatterGraph::intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter &/*painter*/, JKQtBasePlotter * /*parent*/, JKQTPcoordinateAxis* /*xAxis*/, JKQTPcoordinateAxis* /*yAxis*/, int /*xColumn*/, int /*yColumn*/, int /*xErrorColumn*/, int /*yErrorColumn*/, JKQTPerrorPlotstyle /*xErrorStyle*/, JKQTPerrorPlotstyle /*yErrorStyle*/, int index, QColor &/*errorColor*/, QColor &/*errorFillColor*/)
bool JKQTPxyParametrizedErrorScatterGraph::intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter &/*painter*/, JKQtBasePlotter * /*parent*/, JKQTPgraph* /*parentGraph*/, int /*xColumn*/, int /*yColumn*/, int /*xErrorColumn*/, int /*yErrorColumn*/, JKQTPerrorPlotstyle /*xErrorStyle*/, JKQTPerrorPlotstyle /*yErrorStyle*/, int index, QColor &/*errorColor*/, QColor &/*errorFillColor*/)
{
QColor c=getLocalColor(index);
errorColor=c.darker();

View File

@ -68,11 +68,11 @@ class LIB_EXPORT JKQTPxyLineGraph: public JKQTPxyGraph {
JKQTPxyLineGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
JKQTPGET_SET_MACRO(QColor, color)
JKQTPGET_SET_MACRO(QColor, fillColor)
@ -142,11 +142,11 @@ class LIB_EXPORT JKQTPxyParametrizedScatterGraph: public JKQTPxyLineGraph, publi
JKQTPxyParametrizedScatterGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
JKQTPGET_SET_MACRO(int, sizeColumn)
JKQTPSET_CAST_MACRO(size_t, int, sizeColumn)
@ -162,14 +162,14 @@ class LIB_EXPORT JKQTPxyParametrizedScatterGraph: public JKQTPxyLineGraph, publi
JKQTPGET_SET_MACRO(double, gridDeltaY)
JKQTPGET_SET_MACRO(double, gridSymbolFractionSize)
virtual void setParent(JKQtBasePlotter* parent);
virtual void setParent(JKQtBasePlotter* parent) override;
/*! \brief if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
\note If you want to draw outside, then you'll also have to implement drawOutside()
*/
virtual void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace);
virtual void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace) override;
/*! \brief plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
@ -177,17 +177,17 @@ class LIB_EXPORT JKQTPxyParametrizedScatterGraph: public JKQTPxyLineGraph, publi
The four value supplied tell the method where to draw (inside one of the rectangles).
*/
virtual void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace);
virtual void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace) override;
/** \brief determine min/max data value of the image */
virtual void cbGetDataMinMax(double& imin, double& imax);
virtual void cbGetDataMinMax(double& imin, double& imax) override;
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
virtual double getInternalDataMin() const ;
virtual double getInternalDataMax() const ;
virtual double getInternalDataMin() const override;
virtual double getInternalDataMax() const override;
protected:
/** \brief this column contains the symbol size in pt */
int sizeColumn;
@ -237,30 +237,26 @@ class LIB_EXPORT JKQTPxyLineErrorGraph: public JKQTPxyLineGraph, public JKQTPxyG
Q_OBJECT
public:
/** \brief class constructor */
inline JKQTPxyLineErrorGraph(JKQtBasePlotter* parent=nullptr):
JKQTPxyLineGraph(parent), JKQTPxyGraphErrors()
{ setErrorColorFromGraphColor(color); }
JKQTPxyLineErrorGraph(JKQtBasePlotter* parent=nullptr);
/** \brief class constructor */
inline JKQTPxyLineErrorGraph(JKQtPlotter* parent):
JKQTPxyLineGraph(parent), JKQTPxyGraphErrors()
{ setErrorColorFromGraphColor(color); }
JKQTPxyLineErrorGraph(JKQtPlotter* parent);
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) ;
virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) override;
};
@ -273,35 +269,31 @@ class LIB_EXPORT JKQTPxyLineErrorGraph: public JKQTPxyLineGraph, public JKQTPxyG
class LIB_EXPORT JKQTPxyParametrizedErrorScatterGraph: public JKQTPxyParametrizedScatterGraph, public JKQTPxyGraphErrors {
Q_OBJECT
public:
inline JKQTPxyParametrizedErrorScatterGraph(JKQtBasePlotter* parent=nullptr):
JKQTPxyParametrizedScatterGraph(parent), JKQTPxyGraphErrors()
{ setErrorColorFromGraphColor(color); }
inline JKQTPxyParametrizedErrorScatterGraph(JKQtPlotter* parent):
JKQTPxyParametrizedScatterGraph(parent), JKQTPxyGraphErrors()
{ setErrorColorFromGraphColor(color); }
JKQTPxyParametrizedErrorScatterGraph(JKQtBasePlotter* parent=nullptr);
JKQTPxyParametrizedErrorScatterGraph(JKQtPlotter* parent);
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) ;
virtual void drawErrorsBefore(JKQTPEnhancedPainter& painter) override;
/** \brief this function can be used to set the color of the error indicators automatically
*
* return \c true and the colors to use, if applicable, the default implementation returns false */
virtual bool intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, int index, QColor& errorColor, QColor& errorFillColor);
virtual bool intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, int index, QColor& errorColor, QColor& errorFillColor) override;
};
@ -335,11 +327,11 @@ class LIB_EXPORT JKQTPstepHorizontalGraph: public JKQTPxyGraph {
JKQTPstepHorizontalGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
JKQTPGET_SET_MACRO(QColor, color)
JKQTPGET_SET_MACRO(QColor, fillColor)
@ -404,7 +396,7 @@ class LIB_EXPORT JKQTPstepVerticalGraph: public JKQTPstepHorizontalGraph {
JKQTPstepVerticalGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
};
@ -429,22 +421,22 @@ class LIB_EXPORT JKQTPhorizontalRange: public JKQTPgraph {
JKQTPhorizontalRange(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
void setDrawCenterLineOnly();
@ -534,20 +526,20 @@ class LIB_EXPORT JKQTPverticalRange: public JKQTPhorizontalRange {
JKQTPverticalRange(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
};
#endif // jkqtpgraphs_H

View File

@ -134,10 +134,10 @@ void JKQTPbarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
if (imax<0) imax=0;
painter.save();
// double x0=xAxis->x2p(0);
// if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
double y0=yAxis->x2p(0);
if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
// double x0=transformX(0);
// if (parent->get_xAxis()->isLogAxis()) x0=transformX(parent->get_xAxis()->getMin());
double y0=transformY(0);
if (parent->get_yAxis()->isLogAxis()) y0=transformY(parent->get_yAxis()->getMin());
double delta=1;
double deltap=0;
double deltam=0;
@ -150,11 +150,11 @@ void JKQTPbarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
int lr=datastore->getNextHigherIndex(xColumn, i, datarange_start, datarange_end);
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
double yv0=y0;
if (!qFuzzyIsNull(baseline)) yv0=yAxis->x2p(baseline);
if (!qFuzzyIsNull(baseline)) yv0=transformY(baseline);
if (hasStackPar) {
double stackLastY=getParentStackedMax(i);
const double yvold=yv;
yv0=yAxis->x2p(stackLastY)-(get_lineWidth());
yv0=transformY(stackLastY)-(get_lineWidth());
yv=stackLastY+yvold;
}
if (sr<0 && lr<0) { // only one x-value
@ -172,9 +172,9 @@ void JKQTPbarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
delta=deltap+deltam;
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv+shift*delta-width*deltam);
double y=yAxis->x2p(yv);
double xx=xAxis->x2p(xv+shift*delta+width*deltap);
double x=transformX(xv+shift*delta-width*deltam);
double y=transformY(yv);
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;
@ -310,7 +310,7 @@ void JKQTPbarVerticalGraph::autoscaleBarWidthAndShift(double maxWidth, double sh
if (parent) {
double cntH=0;
for (size_t i=0; i<parent->getGraphCount(); i++) {
JKQTPgraph* g=parent->getGraph(i);
JKQTPplotElement* g=parent->getGraph(i);
JKQTPbarVerticalGraph* gb=qobject_cast<JKQTPbarVerticalGraph*>(g);
if (gb && gb->isHorizontal()==isHorizontal()) {
cntH++;
@ -322,7 +322,7 @@ void JKQTPbarVerticalGraph::autoscaleBarWidthAndShift(double maxWidth, double sh
double dH=maxWidth/(cntH);
double h=0.1+dH/2.0;
for (size_t i=0; i<parent->getGraphCount(); i++) {
JKQTPgraph* g=parent->getGraph(i);
JKQTPplotElement* g=parent->getGraph(i);
JKQTPbarVerticalGraph* gb=qobject_cast<JKQTPbarVerticalGraph*>(g);
if (gb && gb->isHorizontal()==isHorizontal()) {
if (cntH>1) {
@ -401,10 +401,10 @@ void JKQTPbarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
if (imin<0) imin=0;
if (imax<0) imax=0;
double x0=xAxis->x2p(0);
if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
// double y0=yAxis->x2p(0);
// if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
double x0=transformX(0);
if (parent->get_xAxis()->isLogAxis()) x0=transformX(parent->get_xAxis()->getMin());
// double y0=transformY(0);
// if (parent->get_yAxis()->isLogAxis()) y0=transformY(parent->get_yAxis()->getMin());
double delta=1;
double deltap=0;
double deltam=0;
@ -418,11 +418,11 @@ void JKQTPbarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
int sr=datastore->getNextLowerIndex(yColumn, i, datarange_start, datarange_end);
int lr=datastore->getNextHigherIndex(yColumn, i, datarange_start, datarange_end);
double xv0=x0;
if (!qFuzzyIsNull(baseline)) xv0=xAxis->x2p(baseline);
if (!qFuzzyIsNull(baseline)) xv0=transformX(baseline);
if (hasStackPar) {
double stackLastX=getParentStackedMax(i);
const double xvold=xv;
xv0=xAxis->x2p(stackLastX)+(get_lineWidth());
xv0=transformX(stackLastX)+(get_lineWidth());
xv=stackLastX+xvold;
}
@ -442,10 +442,10 @@ void JKQTPbarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xv0;
if (!qFuzzyIsNull(baseline)) x=xAxis->x2p(baseline);
double y=yAxis->x2p(yv+shift*delta+width*deltap);
double xx=xAxis->x2p(xv);
double yy=yAxis->x2p(yv+shift*delta-width*deltam);
if (!qFuzzyIsNull(baseline)) x=transformX(baseline);
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;
@ -642,7 +642,7 @@ JKQTPbarHorizontalErrorGraph::JKQTPbarHorizontalErrorGraph(JKQtPlotter *parent):
setErrorColorFromGraphColor(color);
}
bool JKQTPbarHorizontalErrorGraph::usesColumn(int c)
bool JKQTPbarHorizontalErrorGraph::usesColumn(int c) const
{
return JKQTPbarHorizontalGraph::usesColumn(c)|| JKQTPxGraphErrors::errorUsesColumn(c);
}
@ -698,8 +698,8 @@ bool JKQTPbarHorizontalErrorGraph::getXMinMax(double &minx, double &maxx, double
void JKQTPbarHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
{
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0.0, shift);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0.0, shift, &sortedIndices);
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, 0.0, shift);
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, 0.0, shift, &sortedIndices);
}
JKQTPbarVerticalErrorGraph::JKQTPbarVerticalErrorGraph(JKQtBasePlotter *parent):
@ -714,7 +714,7 @@ JKQTPbarVerticalErrorGraph::JKQTPbarVerticalErrorGraph(JKQtPlotter *parent):
setErrorColorFromGraphColor(color);
}
bool JKQTPbarVerticalErrorGraph::usesColumn(int c)
bool JKQTPbarVerticalErrorGraph::usesColumn(int c) const
{
return JKQTPbarVerticalGraph::usesColumn(c)|| JKQTPyGraphErrors::errorUsesColumn(c);
}
@ -820,9 +820,9 @@ bool JKQTPbarVerticalErrorGraph::getYMinMax(double &miny, double &maxy, double &
void JKQTPbarVerticalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
{
//plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, shift, 0.0);
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, shift, 0.0);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, shift, 0, &sortedIndices);
//plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, shift, 0.0);
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, shift, 0.0);
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, shift, 0, &sortedIndices);
}
JKQTPbarVerticalStackableGraph::JKQTPbarVerticalStackableGraph(JKQtBasePlotter *parent):

View File

@ -77,22 +77,22 @@ class LIB_EXPORT JKQTPbarVerticalGraph: public JKQTPxyGraph {
JKQTPbarVerticalGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief finds all bar charts of the same orientation and determines width and shift, so they stand side by side
*
@ -210,12 +210,12 @@ class LIB_EXPORT JKQTPbarVerticalStackableGraph: public JKQTPbarVerticalGraph {
JKQTPbarVerticalStackableGraph* stackParent;
/** \brief used to generate stacked plots: returns the upper boundary of this plot in a stack, for the index-th datapoint */
virtual double getStackedMax(int index) const;
virtual double getStackedMax(int index) const override;
/** \brief calls getStackedMax() on the stack parent (if available), or \c 0.0 */
virtual double getParentStackedMax(int index) const;
virtual double getParentStackedMax(int index) const override;
/** \brief returns \c true, if a stack parent is set (if available) */
virtual bool hasStackParent() const;
virtual bool hasStackParent() const override;
};
/*! \brief This implements a bar graph with bars starting at \f$ y=0 \f$ to \f$ y=f(x) \f$
@ -235,16 +235,16 @@ class LIB_EXPORT JKQTPbarVerticalErrorGraph: public JKQTPbarVerticalGraph, publi
JKQTPbarVerticalErrorGraph(JKQtPlotter* parent);
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) ;
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override;
};
@ -266,20 +266,20 @@ class LIB_EXPORT JKQTPbarHorizontalGraph: public JKQTPbarVerticalGraph {
JKQTPbarHorizontalGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
virtual bool isHorizontal() const;
virtual bool isHorizontal() const override;
};
@ -316,12 +316,12 @@ class LIB_EXPORT JKQTPbarHorizontalStackableGraph: public JKQTPbarHorizontalGrap
JKQTPbarHorizontalStackableGraph* stackParent;
/** \brief used to generate stacked plots: returns the upper boundary of this plot in a stack, for the index-th datapoint */
virtual double getStackedMax(int index) const;
virtual double getStackedMax(int index) const override;
/** \brief calls getStackedMax() on the stack parent (if available), or \c 0.0 */
virtual double getParentStackedMax(int index) const;
virtual double getParentStackedMax(int index) const override;
/** \brief returns \c true, if a stack parent is set (if available) */
virtual bool hasStackParent() const;
virtual bool hasStackParent() const override;
};
/*! \brief This implements a bar graph with bars starting at \f$ x=0 \f$ to \f$ x=f(y) \f$
@ -341,16 +341,16 @@ class LIB_EXPORT JKQTPbarHorizontalErrorGraph: public JKQTPbarHorizontalGraph, p
JKQTPbarHorizontalErrorGraph(JKQtPlotter* parent);
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) ;
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override;
};

View File

@ -28,24 +28,40 @@
#include "jkqtplotter/jkqtpgraphsimage.h"
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtpgraphsbase.h"
#define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz;
JKQTPgraph::JKQTPgraph(JKQtBasePlotter* parent):
JKQTPplotElement::JKQTPplotElement(JKQtBasePlotter* parent):
QObject(parent)
{
datarange_end=datarange_start=-1;
title="";
visible=true;
setParent(parent);
}
JKQTPgraph::JKQTPgraph(JKQtPlotter *parent):
JKQTPplotElement::JKQTPplotElement(JKQtPlotter *parent):
QObject(parent->get_plotter())
{
datarange_end=datarange_start=-1;
title="";
visible=true;
setParent(parent->get_plotter());
setParent(parent);
}
JKQTPplotElement::~JKQTPplotElement()
{
}
JKQTPgraph::JKQTPgraph(JKQtBasePlotter* parent):
JKQTPplotElement(parent)
{
datarange_start=datarange_end=-1;
}
JKQTPgraph::JKQTPgraph(JKQtPlotter *parent):
JKQTPplotElement(parent)
{
datarange_start=datarange_end=-1;
}
JKQTPgraph::~JKQTPgraph()
@ -53,7 +69,7 @@ JKQTPgraph::~JKQTPgraph()
}
QImage JKQTPgraph::generateKeyMarker(QSize size)
QImage JKQTPplotElement::generateKeyMarker(QSize size)
{
QImage img(size.width(),size.height(),QImage::Format_ARGB32);
if (parent) img.fill(parent->get_keyBackgroundColor());
@ -69,51 +85,20 @@ QImage JKQTPgraph::generateKeyMarker(QSize size)
return img;
}
QPointF JKQTPgraph::transform(const QPointF& x) {
if (xAxis&&yAxis) return QPointF(xAxis->x2p(x.x()), yAxis->x2p(x.y()));
return QPointF();
}
QPointF JKQTPgraph::backTransform(const QPointF& x) {
if (xAxis&&yAxis) return QPointF(xAxis->p2x(x.x()), yAxis->p2x(x.y()));
return QPointF();
}
void JKQTPgraph::setParent(JKQtBasePlotter* parent) {
void JKQTPplotElement::setParent(JKQtBasePlotter* parent) {
this->parent=parent;
if (parent) {
this->xAxis=parent->getXAxis();
this->yAxis=parent->getYAxis();
} else {
xAxis=nullptr;
yAxis=nullptr;
}
QObject::setParent(parent);
}
void JKQTPgraph::setParent(JKQtPlotter *parent)
void JKQTPplotElement::setParent(JKQtPlotter *parent)
{
setParent(parent->get_plotter());
}
QVector<QPointF> JKQTPgraph::transform(const QVector<QPointF>& x) {
QVector<QPointF> res;
for (int i=0; i<x.size(); i++) {
res.append(transform(x[i]));
}
return res;
}
QPainterPath JKQTPgraph::transformToLinePath(const QVector<QPointF>& x) {
QPainterPath res;
if (x.size()>0) {
res.moveTo(transform(x[0]));
for (int i=1; i<x.size(); i++) {
res.lineTo(transform(x[i]));
}
}
return res;
}
bool JKQTPgraph::getDataMinMax(int column, double &minx, double &maxx, double &smallestGreaterZero)
{
@ -128,12 +113,6 @@ bool JKQTPgraph::getDataMinMax(int column, double &minx, double &maxx, double &s
int imin=0;
int imax=datastore->getColumn(column).getRows();
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<int>(imax));
}
if (datarange_end>-1) {
imax=qMin(datarange_end, static_cast<int>(imax));
}
if (imax<imin) {
int h=imin;
imin=imax;
@ -153,28 +132,35 @@ bool JKQTPgraph::getDataMinMax(int column, double &minx, double &maxx, double &s
return !start;
}
void JKQTPgraph::getOutsideSize(JKQTPEnhancedPainter& /*painter*/, int& leftSpace, int& rightSpace, int& topSpace, int& bottomspace) {
void JKQTPplotElement::getOutsideSize(JKQTPEnhancedPainter& /*painter*/, int& leftSpace, int& rightSpace, int& topSpace, int& bottomspace) {
leftSpace=0;
rightSpace=0;
topSpace=0;
bottomspace=0;
}
void JKQTPgraph::drawOutside(JKQTPEnhancedPainter& /*painter*/, QRect /*leftSpace*/, QRect /*rightSpace*/, QRect /*topSpace*/, QRect /*bottomSpace*/) {
/*qDebug()<<"outside("<<title<<"): left="<<leftSpace<<" right="<<rightSpace<<" top="<<topSpace<<" bottom="<<bottomSpace;
painter.save();
painter.setPen(QColor("black"));
painter.drawRect(leftSpace);
painter.setPen(QColor("red"));
painter.drawRect(topSpace);
painter.setPen(QColor("blue"));
painter.drawRect(rightSpace);
painter.setPen(QColor("green"));
painter.drawRect(bottomSpace);
painter.restore();*/
void JKQTPplotElement::drawOutside(JKQTPEnhancedPainter& /*painter*/, QRect /*leftSpace*/, QRect /*rightSpace*/, QRect /*topSpace*/, QRect /*bottomSpace*/) {
}
bool JKQTPgraph::usesColumn(int /*column*/)
double JKQTPplotElement::transformX(double x) const {
return parent->get_xAxis()->x2p(x);
}
double JKQTPplotElement::transformY(double y) const {
return parent->get_yAxis()->x2p(y);
}
double JKQTPplotElement::backtransformX(double x) const {
return parent->get_xAxis()->p2x(x);
}
double JKQTPplotElement::backtransformY(double y) const {
return parent->get_yAxis()->p2x(y);
}
bool JKQTPgraph::usesColumn(int /*column*/) const
{
return false;
}
@ -189,7 +175,24 @@ void JKQTPgraph::drawErrorsAfter(JKQTPEnhancedPainter &)
}
QVector<QPointF> JKQTPplotElement::transform(const QVector<QPointF> &x) {
QVector<QPointF> res;
for (int i=0; i<x.size(); i++) {
res.append(transform(x[i]));
}
return res;
}
QPainterPath JKQTPplotElement::transformToLinePath(const QVector<QPointF> &x) {
QPainterPath res;
if (x.size()>0) {
res.moveTo(transform(x[0]));
for (int i=1; i<x.size(); i++) {
res.lineTo(transform(x[i]));
}
}
return res;
}
@ -291,11 +294,15 @@ bool JKQTPxyGraph::getYMinMax(double& miny, double& maxy, double& smallestGreate
return !start;
}
bool JKQTPxyGraph::usesColumn(int column)
bool JKQTPxyGraph::usesColumn(int column) const
{
return (column==xColumn)||(column==yColumn);
}
void JKQTPxyGraph::set_sortData(int __value) {
sortData=(DataSortOrder)__value;
}
@ -424,7 +431,12 @@ QColor JKQTPsingleColumnGraph::getKeyLabelColor()
return color;
}
bool JKQTPsingleColumnGraph::usesColumn(int c)
void JKQTPsingleColumnGraph::set_sortData(int __value) {
sortData=(DataSortOrder)__value;
if (__value>0) sortData=Sorted;
}
bool JKQTPsingleColumnGraph::usesColumn(int c) const
{
return c==dataColumn;
}
@ -504,9 +516,14 @@ JKQTPgraphErrors::JKQTPgraphErrors(QColor graphColor) {
errorbarSize=7;
}
JKQTPgraphErrors::~JKQTPgraphErrors()
{
}
void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, int datarange_start, int datarange_end, int xErrorColumnLower, int yErrorColumnLower, bool xErrorSymmetric, bool yErrorSymmetric, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, int datarange_start, int datarange_end, int xErrorColumnLower, int yErrorColumnLower, bool xErrorSymmetric, bool yErrorSymmetric, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
//std::cout<<"JKQTPgraphErrors::intPlotXYErrorIndicators(p, "<<parent<<", "<<xColumn<<", "<<yColumn<<", "<<xErrorColumn<<", "<<yErrorColumn<<", "<<xErrorStyle<<", "<<yErrorStyle<<", ...)\n";
if (parent==nullptr) return;
JKQTPdatastore* datastore=parent->getDatastore();
@ -634,19 +651,19 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
double yl=0; if (yErrorSymmetric) { yl=ye; plotlowerbary=plotupperbary||(yl>0); }
else if (yErrorStyle!=JKQTPnoError && yErrorColumnLower>=0) { yl=datastore->get(yErrorColumnLower,i); plotlowerbary=true; }
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) && JKQTPIsOKFloat(xe) && JKQTPIsOKFloat(ye) && JKQTPIsOKFloat(xl) && JKQTPIsOKFloat(yl)) {
double x=xAxis->x2p(xv+xrelshift*deltax); bool xok=JKQTPIsOKFloat(x);
double y=yAxis->x2p(yv+yrelshift*deltay); bool yok=JKQTPIsOKFloat(y);
double x=parentGraph->transformX(xv+xrelshift*deltax); bool xok=JKQTPIsOKFloat(x);
double y=parentGraph->transformY(yv+yrelshift*deltay); bool yok=JKQTPIsOKFloat(y);
QColor terrCol=errorColor;
QColor terrFillCol=errorFillColor;
defaultErrorColor = defaultErrorColor && !this->intPlotXYErrorIndicatorsGetColor(painter, parent, xAxis, yAxis, xColumn, yColumn, xErrorColumn, yErrorColumn, xErrorStyle, yErrorStyle, i, terrCol, terrFillCol);
defaultErrorColor = defaultErrorColor && !this->intPlotXYErrorIndicatorsGetColor(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, yErrorColumn, xErrorStyle, yErrorStyle, i, terrCol, terrFillCol);
// x-errorpolygons
if (/*pastFirst &&*/ (xErrorStyle==JKQTPerrorPolygons || xErrorStyle==JKQTPerrorBarsPolygons || xErrorStyle==JKQTPerrorSimpleBarsPolygons)) {
//double xl1m=xmold;
//double xl1p=xpold;
//double yl1=yold;
double xl2m=xAxis->x2p(xv+xrelshift*deltax-xl);
double xl2p=xAxis->x2p(xv+xrelshift*deltax+xe);
double xl2m=parentGraph->transformX(xv+xrelshift*deltax-xl);
double xl2p=parentGraph->transformX(xv+xrelshift*deltax+xe);
double yl2=y;
/*painter.save();
painter.setBrush(b);
@ -666,8 +683,8 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
//double yl1m=ymold;
//double yl1p=ypold;
//double xl1=xold;
double yl2m=yAxis->x2p(yv+yrelshift*deltay-yl);
double yl2p=yAxis->x2p(yv+yrelshift*deltay+ye);
double yl2m=parentGraph->transformY(yv+yrelshift*deltay-yl);
double yl2p=parentGraph->transformY(yv+yrelshift*deltay+ye);
double xl2=x;
/*painter.save();
painter.setBrush(b);
@ -687,8 +704,8 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
//x-errorbars
if ((xErrorColumn>=0 || xErrorColumnLower>=0) && (xErrorStyle==JKQTPerrorBars || xErrorStyle==JKQTPerrorBarsLines|| xErrorStyle==JKQTPerrorBarsPolygons
|| xErrorStyle==JKQTPerrorSimpleBars || xErrorStyle==JKQTPerrorSimpleBarsLines|| xErrorStyle==JKQTPerrorSimpleBarsPolygons)) {
double x0=xAxis->x2p(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
double x1=xAxis->x2p(xv+xrelshift*deltax+xe); bool x1ok=JKQTPIsOKFloat(x1);
double x0=parentGraph->transformX(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
double x1=parentGraph->transformX(xv+xrelshift*deltax+xe); bool x1ok=JKQTPIsOKFloat(x1);
painter.save();
QPen pp=p;
pp.setColor(terrCol);
@ -704,23 +721,23 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
if (xErrorStyle==JKQTPerrorBars || xErrorStyle==JKQTPerrorBarsLines|| xErrorStyle==JKQTPerrorBarsPolygons) {
if (plotlowerbarx) painter.drawLine(QLineF(x0,y-ebs_px/2.0,x0,y+ebs_px/2.0));
}
if (x0<x) painter.drawLine(QLineF(x,y,xAxis->x2p(parent->getXMax()),y));
else painter.drawLine(QLineF(x,y,xAxis->x2p(parent->getXMin()),y));
if (x0<x) painter.drawLine(QLineF(x,y,parentGraph->transformX(parent->getXMax()),y));
else painter.drawLine(QLineF(x,y,parentGraph->transformX(parent->getXMin()),y));
} else if (!x0ok&&x1ok&&xok&&yok) {
painter.drawLine(QLineF(x1, y, x, y));
if (xErrorStyle==JKQTPerrorBars || xErrorStyle==JKQTPerrorBarsLines|| xErrorStyle==JKQTPerrorBarsPolygons) {
if (plotupperbarx) painter.drawLine(QLineF(x1,y-ebs_px/2.0,x1,y+ebs_px/2.0));
}
if (x1<x) painter.drawLine(QLineF(x,y,xAxis->x2p(parent->getXMin()),y));
else painter.drawLine(QLineF(x,y,xAxis->x2p(parent->getXMax()),y));
if (x1<x) painter.drawLine(QLineF(x,y,parentGraph->transformX(parent->getXMin()),y));
else painter.drawLine(QLineF(x,y,parentGraph->transformX(parent->getXMax()),y));
}
painter.restore();
}
// y-errorbars
if ((yErrorColumn>=0 || yErrorColumnLower>=0) && (yErrorStyle==JKQTPerrorBars || yErrorStyle==JKQTPerrorBarsLines || yErrorStyle==JKQTPerrorBarsPolygons
|| yErrorStyle==JKQTPerrorSimpleBars || yErrorStyle==JKQTPerrorSimpleBarsLines || yErrorStyle==JKQTPerrorSimpleBarsPolygons)) {
double y0=yAxis->x2p(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=yAxis->x2p(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
double y0=parentGraph->transformY(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=parentGraph->transformY(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
painter.save();
QPen pp=p;
pp.setColor(terrCol);
@ -736,15 +753,15 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
if (yErrorStyle==JKQTPerrorBars || yErrorStyle==JKQTPerrorBarsLines || yErrorStyle==JKQTPerrorBarsPolygons) {
if (plotlowerbary) painter.drawLine(QLineF(x-ebs_px/2.0,y0,x+ebs_px/2.0,y0));
}
if (y0<y) painter.drawLine(QLineF(x,y,x,yAxis->x2p(parent->getYMin())));
else painter.drawLine(QLineF(x,y,x,yAxis->x2p(parent->getYMax()))); // inverted axis!
if (y0<y) painter.drawLine(QLineF(x,y,x,parentGraph->transformY(parent->getYMin())));
else painter.drawLine(QLineF(x,y,x,parentGraph->transformY(parent->getYMax()))); // inverted axis!
} else if (!y0ok&&y1ok&&xok&&yok) {
painter.drawLine(QLineF(x, y1, x, y));
if (yErrorStyle==JKQTPerrorBars || yErrorStyle==JKQTPerrorBarsLines || yErrorStyle==JKQTPerrorBarsPolygons) {
if (plotupperbary) painter.drawLine(QLineF(x-ebs_px/2.0,y1,x+ebs_px/2.0,y1));
}
if (y1<y) painter.drawLine(QLineF(x,y,x,yAxis->x2p(parent->getYMax())));
else painter.drawLine(QLineF(x,y,x,yAxis->x2p(parent->getYMin())));
if (y1<y) painter.drawLine(QLineF(x,y,x,parentGraph->transformY(parent->getYMax())));
else painter.drawLine(QLineF(x,y,x,parentGraph->transformY(parent->getYMin())));
}
painter.restore();
@ -752,10 +769,10 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
// error boxes
if (yErrorStyle==JKQTPerrorBoxes || xErrorStyle==JKQTPerrorBoxes || yErrorStyle==JKQTPerrorEllipses || xErrorStyle==JKQTPerrorEllipses ) {
double y0=yAxis->x2p(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=yAxis->x2p(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
double x0=xAxis->x2p(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
double x1=xAxis->x2p(xv+xrelshift*deltax+xe); bool x1ok=JKQTPIsOKFloat(x1);
double y0=parentGraph->transformY(yv+yrelshift*deltay-yl); bool y0ok=JKQTPIsOKFloat(y0);
double y1=parentGraph->transformY(yv+yrelshift*deltay+ye); bool y1ok=JKQTPIsOKFloat(y1);
double x0=parentGraph->transformX(xv+xrelshift*deltax-xl); bool x0ok=JKQTPIsOKFloat(x0);
double x1=parentGraph->transformX(xv+xrelshift*deltax+xe); bool x1ok=JKQTPIsOKFloat(x1);
painter.save();
QPen pp=p;
pp.setColor(terrCol);
@ -778,8 +795,8 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
double xl1m=xmold;
double xl1p=xpold;
double yl1=yold;
double xl2m=xAxis->x2p(xv+xrelshift*deltax-xl);
double xl2p=xAxis->x2p(xv+xrelshift*deltax+xe);
double xl2m=parentGraph->transformX(xv+xrelshift*deltax-xl);
double xl2p=parentGraph->transformX(xv+xrelshift*deltax+xe);
double yl2=y;
painter.save();
QPen pp=p;
@ -800,8 +817,8 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
double yl1m=ymold;
double yl1p=ypold;
double xl1=xold;
double yl2m=yAxis->x2p(yv+yrelshift*deltay-yl);
double yl2p=yAxis->x2p(yv+yrelshift*deltay+ye);
double yl2m=parentGraph->transformY(yv+yrelshift*deltay-yl);
double yl2p=parentGraph->transformY(yv+yrelshift*deltay+ye);
double xl2=x;
painter.save();
QPen pp=p;
@ -820,11 +837,11 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
pastFirst=true;
xold=x;
xmold=xAxis->x2p(xv+xrelshift*deltax-xl);
xpold=xAxis->x2p(xv+xrelshift*deltax+xe);
xmold=parentGraph->transformX(xv+xrelshift*deltax-xl);
xpold=parentGraph->transformX(xv+xrelshift*deltax+xe);
yold=y;
ymold=yAxis->x2p(yv+yrelshift*deltay-yl);
ypold=yAxis->x2p(yv+yrelshift*deltay+ye);
ymold=parentGraph->transformY(yv+yrelshift*deltay-yl);
ypold=parentGraph->transformY(yv+yrelshift*deltay+ye);
}
}
// x-errorpolygons
@ -861,7 +878,7 @@ void JKQTPgraphErrors::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, J
//std::cout<<"end\n";
}
bool JKQTPgraphErrors::intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter &/*painter*/, JKQtBasePlotter * /*parent*/, JKQTPcoordinateAxis* /*xAxis*/, JKQTPcoordinateAxis* /*yAxis*/, int /*xColumn*/, int /*yColumn*/, int /*xErrorColumn*/, int /*yErrorColumn*/, JKQTPerrorPlotstyle /*xErrorStyle*/, JKQTPerrorPlotstyle /*yErrorStyle*/, int /*index*/, QColor &/*errorColor*/, QColor &/*errorFillColor*/)
bool JKQTPgraphErrors::intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter &/*painter*/, JKQtBasePlotter * /*parent*/, JKQTPgraph* /*parentGraph*/, int /*xColumn*/, int /*yColumn*/, int /*xErrorColumn*/, int /*yErrorColumn*/, JKQTPerrorPlotstyle /*xErrorStyle*/, JKQTPerrorPlotstyle /*yErrorStyle*/, int /*index*/, QColor &/*errorColor*/, QColor &/*errorFillColor*/)
{
return false;
}
@ -901,8 +918,22 @@ JKQTPxGraphErrors::JKQTPxGraphErrors(QColor graphColor):
xErrorColumnLower=-1;
}
void JKQTPxGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis *xAxis, JKQTPcoordinateAxis *yAxis, int xColumn, int yColumn, int datarange_start, int datarange_end, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
intPlotXYErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, xErrorColumn, -1, xErrorStyle, JKQTPnoError, datarange_start, datarange_end, xErrorColumnLower, -1, xErrorSymmetric, true, xrelshift, yrelshift, dataorder);
void JKQTPxGraphErrors::set_xErrorColumn(int __value) {
if (this->xErrorColumn != __value) {
this->xErrorColumn = __value;
if (xErrorColumn>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars;
}
}
void JKQTPxGraphErrors::set_xErrorColumnLower(int __value) {
if (this->xErrorColumnLower != __value) {
this->xErrorColumnLower = __value;
if (xErrorColumnLower>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars;
}
}
void JKQTPxGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph *parentGraph, int xColumn, int yColumn, int datarange_start, int datarange_end, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, -1, xErrorStyle, JKQTPnoError, datarange_start, datarange_end, xErrorColumnLower, -1, xErrorSymmetric, true, xrelshift, yrelshift, dataorder);
}
double JKQTPxGraphErrors::getXErrorU(int i, JKQTPdatastore *ds) const
@ -937,8 +968,8 @@ JKQTPyGraphErrors::JKQTPyGraphErrors(QColor graphColor):
yErrorColumnLower=-1;
}
void JKQTPyGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int datarange_start, int datarange_end, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
intPlotXYErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, -1, yErrorColumn, JKQTPnoError, yErrorStyle, datarange_start, datarange_end, -1, yErrorColumnLower, true, yErrorSymmetric, xrelshift, yrelshift, dataorder);
void JKQTPyGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int datarange_start, int datarange_end, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, -1, yErrorColumn, JKQTPnoError, yErrorStyle, datarange_start, datarange_end, -1, yErrorColumnLower, true, yErrorSymmetric, xrelshift, yrelshift, dataorder);
}
double JKQTPyGraphErrors::getYErrorU(int i, JKQTPdatastore *ds) const
@ -978,8 +1009,8 @@ JKQTPxyGraphErrors::JKQTPxyGraphErrors(QColor graphColor):
}
void JKQTPxyGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int datarange_start, int datarange_end, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
this->intPlotXYErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, xErrorColumn, yErrorColumn, xErrorStyle, yErrorStyle, datarange_start, datarange_end, xErrorColumnLower, yErrorColumnLower, xErrorSymmetric, yErrorSymmetric, xrelshift, yrelshift, dataorder);
void JKQTPxyGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int datarange_start, int datarange_end, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
this->intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, yErrorColumn, xErrorStyle, yErrorStyle, datarange_start, datarange_end, xErrorColumnLower, yErrorColumnLower, xErrorSymmetric, yErrorSymmetric, xrelshift, yrelshift, dataorder);
}
double JKQTPxyGraphErrors::getXErrorU(int i, JKQTPdatastore *ds) const
@ -1076,12 +1107,12 @@ void JKQTPxyGraph::intSortData()
}
bool JKQTPxGraphErrors::errorUsesColumn(int c)
bool JKQTPxGraphErrors::errorUsesColumn(int c) const
{
return c==(xErrorColumn) || (c==xErrorColumnLower);
}
bool JKQTPgraphErrors::errorUsesColumn(int /*c*/)
bool JKQTPgraphErrors::errorUsesColumn(int /*c*/) const
{
return false;
}
@ -1093,12 +1124,26 @@ void JKQTPgraphErrors::setErrorColorFromGraphColor(QColor graphColor)
//errorColor.setAlphaF(0.5);
}
bool JKQTPyGraphErrors::errorUsesColumn(int c)
bool JKQTPyGraphErrors::errorUsesColumn(int c) const
{
return (c==yErrorColumn) || (c==yErrorColumnLower);
}
bool JKQTPxyGraphErrors::errorUsesColumn(int c)
void JKQTPyGraphErrors::set_yErrorColumn(int __value) {
if (this->yErrorColumn != __value) {
this->yErrorColumn = __value;
if (yErrorColumn>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars;
}
}
void JKQTPyGraphErrors::set_yErrorColumnLower(int __value) {
if (this->yErrorColumnLower != __value) {
this->yErrorColumnLower = __value;
if (yErrorColumnLower>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars;
}
}
bool JKQTPxyGraphErrors::errorUsesColumn(int c) const
{
return (c==xErrorColumn)||(c==yErrorColumn)||(c==xErrorColumnLower)||(c==yErrorColumnLower);
}
@ -1150,3 +1195,21 @@ void JKQTPxyGraphErrors::set_yErrorColumnLower(size_t __value)
{
set_yErrorColumnLower(static_cast<int>(__value));
}
JKQTPplotObject::JKQTPplotObject(JKQtBasePlotter *parent):
JKQTPplotElement(parent)
{
}
JKQTPplotObject::JKQTPplotObject(JKQtPlotter *parent):
JKQTPplotElement(parent)
{
}
JKQTPplotObject::~JKQTPplotObject()
{
}

View File

@ -33,6 +33,8 @@
#include <QString>
#include <QPainter>
#include <QPair>
#include "jkqtplotter/jkqtpbaseelements.h"
#include "jkqtplotter/jkqtpbaseplotter.h"
#include "jkqtplottertools/jkqtptools.h"
#include "jkqtplottertools/jkqtp_imexport.h"
#include "jkqtplottertools/jkqtpimagetools.h"
@ -41,44 +43,46 @@
#define jkqtpgraphsbase_H
// forward declarations
class JKQtBasePlotter;
class JKQtPlotter;
class JKQTPcoordinateAxis;
class JKQTPdatastore;
//class JKQTPColorPaletteTools;
/** \brief this virtual base class describes one of the graphs, which are part of a JKQtPlotter object
/** \brief this virtual base class of every element, which is part of a JKQtPlotter plot and may appear in its key
* (basically any type of graph, except overlay elements!)
* \ingroup jkqtplotter_plots
*
* Each possible graph is represented by a subgraph of this. So additional plots may be created by
* Each possible graph is represented by a child of this class. So additional plots may be created by
* deriving new JKQTPgraph classes. To do so implement/overwrite these functions:
* - void draw(JKQTPEnhancedPainter& painter);
* - void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
* - bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
* - void getGraphsYMinMax(double& miny, double& maxy);
* - QColor getKeyLabelColor()=0;
* - bool usesColumn(int column) const;
* .
*
* Optionally you may also overwrite these functions to draw elements outside the actual plot area (like e.g. colorbars):
* - void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace);
* - void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace);
* .
*
* There are two properties datarange_start and datarange_end. By default they are -1 and therefore ignored.
* if they are != -1 the plotter only displays the datapoints with the indexes [datarange_start .. datarange_end]
* although there might be more data points available (range [0 .. maxDataPoints]). The datarange is cut at the
* full range, i.e. if datarange_end>maxDataPoints the plotter displays [datarange_start .. maxDataPoints].
*/
class LIB_EXPORT JKQTPgraph: public QObject {
class LIB_EXPORT JKQTPplotElement: public QObject {
Q_OBJECT
public:
/** \brief class constructor */
explicit JKQTPgraph(JKQtBasePlotter* parent=nullptr);
explicit JKQTPplotElement(JKQtBasePlotter* parent=nullptr);
/** \brief class constructor */
explicit JKQTPgraph(JKQtPlotter* parent);
explicit JKQTPplotElement(JKQtPlotter* parent);
/** \brief default wirtual destructor */
virtual ~JKQTPgraph() ;
virtual ~JKQTPplotElement() ;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter)=0;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect)=0;
/** \brief returns an image with a key marker inside */
QImage generateKeyMarker(QSize size=QSize(16,16));
@ -96,8 +100,6 @@ class LIB_EXPORT JKQTPgraph: public QObject {
virtual QColor getKeyLabelColor()=0;
JKQTPGET_SET_VMACRO(QString, title)
JKQTPGET_SET_MACRO(int, datarange_start)
JKQTPGET_SET_MACRO(int, datarange_end)
JKQTPGET_SET_MACRO(bool, visible)
/** \brief returns the parent painter class */
@ -120,32 +122,41 @@ class LIB_EXPORT JKQTPgraph: public QObject {
The four value supplied tell the method where to draw (inside one of the rectangles).
*/
virtual void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace);
/** \brief returns \c true if the given column is used by the graph */
virtual bool usesColumn(int column);
protected:
/** \brief the plotter object this object belongs to */
JKQtBasePlotter* parent;
/** \brief this function is used to plot error inidcators before plotting the graphs.
*
* By default this function does nothing. But children of this class may overwrite it to implement
* drawing error indicators.
*/
virtual void drawErrorsBefore(JKQTPEnhancedPainter& /*painter*/);
/** \brief this function is used to plot error inidcators after plotting the graphs.
*
* By default this function does nothing. But children of this class may overwrite it to implement
* drawing error indicators.
*/
virtual void drawErrorsAfter(JKQTPEnhancedPainter& /*painter*/);
/** \brief title of the plot (for display in key!). If no title is supplied, no key entry is drawn. */
QString title;
/** \brief indicates whether the graph is visible in the plot */
bool visible;
/** \brief tool routine that transforms an x-coordinate for this plot element */
virtual double transformX(double x) const;
/** \brief tool routine that transforms a y-coordinate for this plot element */
virtual double transformY(double y) const;
/** \brief tool routine that backtransforms an x-coordinate for this plot element */
virtual double backtransformX(double x) const;
/** \brief tool routine that backtransforms a y-coordinate for this plot element */
virtual double backtransformY(double y) const;
/** \brief tool routine that transforms a QPointF according to the parent's transformation rules */
QPointF transform(const QPointF& x);
inline QPointF transform(const QPointF& x) {
return QPointF(transformX(x.x()), transformY(x.y()));
}
/** \brief tool routine that back-transforms a QPointF according to the parent's transformation rules */
QPointF backTransform(const QPointF& x);
inline QPointF backTransform(const QPointF& x) {
return QPointF(backtransformX(x.x()), backtransformY(x.y()));
}
/** \brief tool routine that transforms a QPointF according to the parent's transformation rules */
inline QPointF transform(double x, double y) {
@ -167,32 +178,101 @@ class LIB_EXPORT JKQTPgraph: public QObject {
inline QPolygonF transformToPolygon(const QVector<QPointF>& x) {
return QPolygonF(transform(x));
}
};
/** \brief this virtual base class of the (data-column based) graphs,
* which are part of a JKQtPlotter plot and which use the coordinate system
* of the JKQtPlotter (i.e. the two coordinate axes get_xAxis() and get_yAxis())
* as basis for the graphs
* \ingroup jkqtplotter_plots
*
* This class adds several features to work with data columns. In addition this class adds protected
* functions that do coordinate transforms based on the current coordinate system, of the paren
* JKQtPlotter (i.e. using the axes JKQtPlott:xAxis and JKQtPlotter::yAxis as basis for the plotting).
*
* There are two properties datarange_start and datarange_end. By default they are -1 and therefore ignored.
* if they are != -1 the plotter only displays the datapoints with the indexes [datarange_start .. datarange_end]
* although there might be more data points available (range [0 .. maxDataPoints]). The datarange is cut at the
* full range, i.e. if datarange_end>maxDataPoints the plotter displays [datarange_start .. maxDataPoints].
*/
class LIB_EXPORT JKQTPgraph: public JKQTPplotElement {
Q_OBJECT
public:
/** \brief class constructor */
explicit JKQTPgraph(JKQtBasePlotter* parent=nullptr);
/** \brief class constructor */
explicit JKQTPgraph(JKQtPlotter* parent);
/** \brief default wirtual destructor */
virtual ~JKQTPgraph() ;
JKQTPGET_SET_MACRO(int, datarange_start)
JKQTPGET_SET_MACRO(int, datarange_end)
/** \brief returns \c true if the given column is used by the graph */
virtual bool usesColumn(int column) const;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs.
*
* By default this function does nothing. But children of this class may overwrite it to implement
* drawing error indicators.
*/
virtual void drawErrorsBefore(JKQTPEnhancedPainter& /*painter*/);
/** \brief this function is used to plot error inidcators after plotting the graphs.
*
* By default this function does nothing. But children of this class may overwrite it to implement
* drawing error indicators.
*/
virtual void drawErrorsAfter(JKQTPEnhancedPainter& /*painter*/);
/** \brief title of the plot (for display in key!). If no title is supplied, no key entry is drawn. */
QString title;
/** \brief start of the range of plot data. -1 switches the lower data range border off. */
int datarange_start;
/** \brief end of the range of plot data. -1 switches the upper data range border off. */
int datarange_end;
/** \brief indicates whether the graph is visible in the plot */
bool visible;
/** \brief get the maximum and minimum value of the given column
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
bool getDataMinMax(int column, double& minx, double& maxx, double& smallestGreaterZero);
JKQTPcoordinateAxis* xAxis;
JKQTPcoordinateAxis* yAxis;
friend class JKQTPgraphErrors;
};
/** \brief this is the virtual base class of all JKQTPplotElement's in a JKQtPlotter plot that
* represent geometric forms or annotations. They have extended coordinate transform capabilities, because
* in addition to using the plot coordinates, you can also choose to use different other
* coordinate systems
* \ingroup jkqtplotter_plots
*
*/
class LIB_EXPORT JKQTPplotObject: public JKQTPplotElement {
Q_OBJECT
public:
/** \brief class constructor */
explicit JKQTPplotObject(JKQtBasePlotter* parent=nullptr);
/** \brief class constructor */
explicit JKQTPplotObject(JKQtPlotter* parent);
/** \brief default wirtual destructor */
virtual ~JKQTPplotObject() ;
protected:
};
/*! \brief This virtual JKQTPgraph descendent may be used as base for all graphs that use at least two columns
that specify x and y coordinates for the single plot points.
\ingroup jkqtplotter_plots
@ -222,15 +302,15 @@ class LIB_EXPORT JKQTPxyGraph: public JKQTPgraph {
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int column);
virtual bool usesColumn(int column) const override;
JKQTPGET_SET_MACRO(int, xColumn)
JKQTPSET_CAST_MACRO(size_t, int, xColumn)
@ -238,9 +318,7 @@ class LIB_EXPORT JKQTPxyGraph: public JKQTPgraph {
JKQTPSET_CAST_MACRO(size_t, int, yColumn)
JKQTPGET_SET_MACRO(DataSortOrder, sortData)
/** \brief sets the property sortData to the specified \a __value. \details Description of the parameter sortData is: <CENTER>\copybrief sortData.</CENTER> \see sortData for more information */
inline void set_sortData(int __value) {
sortData=(DataSortOrder)__value;
}
void set_sortData(int __value);
protected:
@ -254,6 +332,11 @@ class LIB_EXPORT JKQTPxyGraph: public JKQTPgraph {
/** \brief this array contains the order of indices, in which to access the data in the data columns */
QVector<int> sortedIndices;
virtual void intSortData();
/** \brief returns the index of the i-th datapoint (where i is an index into the SORTED datapoints)
*
* This function can beu used to get the correct datapoint after sorting the datapoints,
* As sorting is done by sorting an index and not reordering the data in the columns themselves.
* */
inline int getDataIndex(int i) {
if (sortData==Unsorted) return i;
return sortedIndices.value(i,i);
@ -293,13 +376,10 @@ class LIB_EXPORT JKQTPsingleColumnGraph: public JKQTPgraph {
JKQTPGET_SET_MACRO(double, lineWidth)
JKQTPGET_SET_MACRO(DataSortOrder, sortData)
/** \brief sets the property sortData to the specified \a __value. \details Description of the parameter sortData is: <CENTER>\copybrief sortData.</CENTER> \see sortData for more information */
inline void set_sortData(int __value) {
sortData=(DataSortOrder)__value;
if (__value>0) sortData=Sorted;
}
void set_sortData(int __value);
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
protected:
/** \brief the column that contains the datapoints */
@ -322,11 +402,17 @@ class LIB_EXPORT JKQTPsingleColumnGraph: public JKQTPgraph {
/** \brief this array contains the order of indices, in which to access the data in the data columns */
QVector<int> sortedIndices;
virtual void intSortData();
/** \brief returns the index of the i-th datapoint (where i is an index into the SORTED datapoints)
*
* This function can beu used to get the correct datapoint after sorting the datapoints,
* As sorting is done by sorting an index and not reordering the data in the columns themselves.
* */
inline int getDataIndex(int i) {
if (sortData==Unsorted) return i;
return sortedIndices.value(i,i);
}
};
@ -348,6 +434,7 @@ class LIB_EXPORT JKQTPgraphErrors {
public:
/** \brief class contructor */
JKQTPgraphErrors(QColor graphColor=QColor("black"));
virtual ~JKQTPgraphErrors();
JKQTPGET_SET_MACRO(QColor, errorColor)
JKQTPGET_SET_MACRO(Qt::PenStyle, errorStyle)
@ -356,7 +443,7 @@ class LIB_EXPORT JKQTPgraphErrors {
JKQTPGET_SET_MACRO(Qt::BrushStyle, errorFillStyle)
JKQTPGET_SET_MACRO(double, errorbarSize)
/** \brief returns true, if the error plots use the given column */
virtual bool errorUsesColumn(int c);
virtual bool errorUsesColumn(int c) const;
void setErrorColorFromGraphColor(QColor graphColor);
@ -377,16 +464,16 @@ class LIB_EXPORT JKQTPgraphErrors {
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. This method is called by
* the JKQTPgraph descendents */
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int datarange_start=-1, int datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector<int>* dataorder=nullptr)=0;
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int datarange_start=-1, int datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector<int>* dataorder=nullptr)=0;
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. */
void intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, int datarange_start=-1, int datarange_end=-1, int xErrorColumnLower=-1, int yErrorColumnLower=-1, bool xErrorSymmetric=true, bool yErrorSymmetric=true, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr);
void intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, int datarange_start=-1, int datarange_end=-1, int xErrorColumnLower=-1, int yErrorColumnLower=-1, bool xErrorSymmetric=true, bool yErrorSymmetric=true, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr);
/** \brief this function can be used to set the color of the error indicators automatically
*
* return \c true and the colors to use, if applicable, the default implementation returns false */
virtual bool intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, int index, QColor& errorColor, QColor& errorFillColor);
virtual bool intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPerrorPlotstyle xErrorStyle, JKQTPerrorPlotstyle yErrorStyle, int index, QColor& errorColor, QColor& errorFillColor);
virtual double getXErrorU(int i, JKQTPdatastore* ds) const;
@ -412,22 +499,13 @@ class LIB_EXPORT JKQTPxGraphErrors: public JKQTPgraphErrors {
JKQTPGET_MACRO(int, xErrorColumnLower)
JKQTPGET_MACRO(int, xErrorColumn)
JKQTPGET_SET_MACRO(JKQTPerrorPlotstyle, xErrorStyle)
inline void set_xErrorColumn(int __value) {
if (this->xErrorColumn != __value) { \
this->xErrorColumn = __value; \
if (xErrorColumn>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \
} \
}
inline void set_xErrorColumnLower(int __value) {
if (this->xErrorColumnLower != __value) { \
this->xErrorColumnLower = __value; \
if (xErrorColumnLower>=0 && xErrorStyle==JKQTPnoError) xErrorStyle=JKQTPerrorBars; \
} \
}
/** \brief set the column from which to read the error values for x-error indicators */
void set_xErrorColumn(int __value);
/** \brief set the column from which to read the error values for lower x-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
void set_xErrorColumnLower(int __value);
/** \brief returns true, if the error plots use the given column */
virtual bool errorUsesColumn(int c);
virtual bool errorUsesColumn(int c) const override;
protected:
/** \brief the column that contains the error of the x-component of the datapoints */
@ -441,10 +519,10 @@ class LIB_EXPORT JKQTPxGraphErrors: public JKQTPgraphErrors {
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. */
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int datarange_start=-1, int datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr);
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int datarange_start=-1, int datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) override;
virtual double getXErrorU(int i, JKQTPdatastore* ds) const;
virtual double getXErrorL(int i, JKQTPdatastore* ds) const;
virtual double getXErrorU(int i, JKQTPdatastore* ds) const override;
virtual double getXErrorL(int i, JKQTPdatastore* ds) const override;
};
@ -464,20 +542,12 @@ class LIB_EXPORT JKQTPyGraphErrors: public JKQTPgraphErrors {
JKQTPGET_MACRO(int, yErrorColumn)
JKQTPGET_SET_MACRO(JKQTPerrorPlotstyle, yErrorStyle)
/** \copydoc JKQTPgraphErrors::errorUsesColumn() */
virtual bool errorUsesColumn(int c);
virtual bool errorUsesColumn(int c) const override;
inline void set_yErrorColumn(int __value) {
if (this->yErrorColumn != __value) { \
this->yErrorColumn = __value; \
if (yErrorColumn>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \
} \
}
inline void set_yErrorColumnLower(int __value) {
if (this->yErrorColumnLower != __value) { \
this->yErrorColumnLower = __value; \
if (yErrorColumnLower>=0 && yErrorStyle==JKQTPnoError) yErrorStyle=JKQTPerrorBars; \
} \
}
/** \brief set the column from which to read the error values for y-error indicators */
void set_yErrorColumn(int __value);
/** \brief set the column from which to read the error values for lower y-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
void set_yErrorColumnLower(int __value);
protected:
/** \brief the column that contains the error of the x-component of the datapoints */
int yErrorColumn;
@ -490,10 +560,10 @@ class LIB_EXPORT JKQTPyGraphErrors: public JKQTPgraphErrors {
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. */
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int datarange_start=-1, int datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr);
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int datarange_start=-1, int datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) override;
virtual double getYErrorU(int i, JKQTPdatastore* ds) const;
virtual double getYErrorL(int i, JKQTPdatastore* ds) const;
virtual double getYErrorU(int i, JKQTPdatastore* ds) const override;
virtual double getYErrorL(int i, JKQTPdatastore* ds) const override;
};
@ -515,15 +585,23 @@ class LIB_EXPORT JKQTPxyGraphErrors: public JKQTPgraphErrors {
JKQTPGET_SET_MACRO(JKQTPerrorPlotstyle, yErrorStyle)
JKQTPGET_SET_MACRO(JKQTPerrorPlotstyle, xErrorStyle)
/** \copydoc JKQTPgraphErrors::errorUsesColumn() */
virtual bool errorUsesColumn(int c);
virtual bool errorUsesColumn(int c) const override;
/** \brief set the column from which to read the error values for x-error indicators */
void set_xErrorColumn(int __value);
/** \brief set the column from which to read the error values for lower x-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
void set_xErrorColumnLower(int __value);
/** \brief set the column from which to read the error values for x-error indicators */
void set_yErrorColumn(int __value);
/** \brief set the column from which to read the error values for lower x-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
void set_yErrorColumnLower(int __value);
/** \brief set the column from which to read the error values for y-error indicators */
void set_xErrorColumn(size_t __value);
/** \brief set the column from which to read the error values for lower y-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
void set_xErrorColumnLower(size_t __value);
/** \brief set the column from which to read the error values for y-error indicators */
void set_yErrorColumn(size_t __value);
/** \brief set the column from which to read the error values for lower y-error indicators (if not set [=-1], the xErrorColumn-values will be used for upper and lower error indicators) */
void set_yErrorColumnLower(size_t __value);
protected:
@ -546,15 +624,18 @@ class LIB_EXPORT JKQTPxyGraphErrors: public JKQTPgraphErrors {
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
* given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. */
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPcoordinateAxis* xAxis, JKQTPcoordinateAxis* yAxis, int xColumn, int yColumn, int datarange_start=-1, int datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr);
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQtBasePlotter* parent, JKQTPgraph* parentGraph, int xColumn, int yColumn, int datarange_start=-1, int datarange_end=-1, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) override;
virtual double getXErrorU(int i, JKQTPdatastore* ds) const;
virtual double getXErrorL(int i, JKQTPdatastore* ds) const;
virtual double getYErrorU(int i, JKQTPdatastore* ds) const;
virtual double getYErrorL(int i, JKQTPdatastore* ds) const;
virtual double getXErrorU(int i, JKQTPdatastore* ds) const override;
virtual double getXErrorL(int i, JKQTPdatastore* ds) const override;
virtual double getYErrorU(int i, JKQTPdatastore* ds) const override;
virtual double getYErrorL(int i, JKQTPdatastore* ds) const override;
};
#endif // jkqtpgraphsbase_H

View File

@ -151,8 +151,8 @@ void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
intSortData();
for (int iii=imin+1; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv0=xAxis->x2p(datastore->get(posColumn,i-1));
double xv=xAxis->x2p(datastore->get(posColumn,i));
double xv0=transformX(datastore->get(posColumn,i-1));
double xv=transformX(datastore->get(posColumn,i));
if (posColumn>=0 && JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(xv0)) {
if (bwfirst) {
boxwidth_real=fabs(xv-xv0);
@ -171,7 +171,7 @@ void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
double minv=datastore->get(minColumn,i);
double maxv=datastore->get(maxColumn,i);
double medianv=datastore->get(medianColumn,i);
double mean=yAxis->x2p(datastore->get(meanColumn,i));
double mean=transformY(datastore->get(meanColumn,i));
QVector<QLineF> lines_p, lines_pw;
@ -184,16 +184,16 @@ void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
painter.setPen(p);
painter.setBrush(b);
//std::cout<<"boxplot(med="<<medianv<<", min="<<minv<<", max="<<maxv<<", p25="<<p25v<<", p75="<<p75v<<")\n";
double x=xAxis->x2p(xv);
double p25=yAxis->x2p(p25v);
double p75=yAxis->x2p(p75v);
double min=yAxis->x2p(minv);
double max=yAxis->x2p(maxv);
double median=yAxis->x2p(medianv);
double x=transformX(xv);
double p25=transformY(p25v);
double p75=transformY(p75v);
double min=transformY(minv);
double max=transformY(maxv);
double median=transformY(medianv);
double xn=x+1;
if (i+1<imax) xn=xAxis->x2p(datastore->get(posColumn,i+1));
else if (i-1>=0) xn=xAxis->x2p(datastore->get(posColumn,i-1));
if (i+1<imax) xn=transformX(datastore->get(posColumn,i+1));
else if (i-1>=0) xn=transformX(datastore->get(posColumn,i-1));
else xn=x+1;
@ -212,10 +212,10 @@ void JKQTPboxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
double xmi4=x-w/4.0;
if (imax<=0) {
xma=xAxis->x2p(xv+boxWidth/2.0);
xmi=xAxis->x2p(xv-boxWidth/2.0);
xma4=xAxis->x2p(xv+boxWidth/4.0);
xmi4=xAxis->x2p(xv-boxWidth/4.0);
xma=transformX(xv+boxWidth/2.0);
xmi=transformX(xv-boxWidth/2.0);
xma4=transformX(xv+boxWidth/4.0);
xmi4=transformX(xv-boxWidth/4.0);
}
if (minColumn>=0) {
@ -357,11 +357,16 @@ bool JKQTPboxplotVerticalGraph::getYMinMax(double& miny, double& maxy, double& s
return !start;
}
bool JKQTPboxplotVerticalGraph::usesColumn(int c)
bool JKQTPboxplotVerticalGraph::usesColumn(int c) const
{
return (c==meanColumn)||(c==posColumn)||(c==medianColumn)||(c==minColumn)||(c==maxColumn)||(c==percentile25Column)||(c==percentile75Column);
}
void JKQTPboxplotVerticalGraph::set_sortData(int __value) {
sortData=(DataSortOrder)__value;
if (__value>0) sortData=Sorted;
}
void JKQTPboxplotVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
painter.save();
@ -555,6 +560,16 @@ bool JKQTPboxplotHorizontalGraph::getYMinMax(double& minx, double& maxx, double&
return !start;
}
JKQTPboxplotHorizontalGraph::JKQTPboxplotHorizontalGraph(JKQtBasePlotter *parent):
JKQTPboxplotVerticalGraph(parent)
{
}
JKQTPboxplotHorizontalGraph::JKQTPboxplotHorizontalGraph(JKQtPlotter *parent):
JKQTPboxplotVerticalGraph(parent)
{
}
void JKQTPboxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPboxplotHorizontalGraph::draw");
@ -603,8 +618,8 @@ void JKQTPboxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
intSortData();
for (int iii=imin+1; iii<imax; iii++) {
int i=qBound(imin, getDataIndex(iii), imax);
double xv0=yAxis->x2p(datastore->get(posColumn,i-1));
double xv=yAxis->x2p(datastore->get(posColumn,i));
double xv0=transformY(datastore->get(posColumn,i-1));
double xv=transformY(datastore->get(posColumn,i));
if (posColumn>=0 && JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(xv0)) {
if (bwfirst) {
boxwidth_real=fabs(xv-xv0);
@ -625,7 +640,7 @@ void JKQTPboxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
double minv=datastore->get(minColumn,i);
double maxv=datastore->get(maxColumn,i);
double medianv=datastore->get(medianColumn,i);
double mean=xAxis->x2p(datastore->get(meanColumn,i));
double mean=transformX(datastore->get(meanColumn,i));
QVector<QLineF> lines_p, lines_pw;
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
@ -641,15 +656,15 @@ void JKQTPboxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
painter.setBrush(b);
double p25=xAxis->x2p(p25v);
double p75=xAxis->x2p(p75v);
double min=xAxis->x2p(minv);
double max=xAxis->x2p(maxv);
double median=xAxis->x2p(medianv);
double p25=transformX(p25v);
double p75=transformX(p75v);
double min=transformX(minv);
double max=transformX(maxv);
double median=transformX(medianv);
//std::cout<<"boxplot(med="<<medianv<<", min="<<minv<<", max="<<maxv<<", p25="<<p25v<<", p75="<<p75v<<")\n";
double y=yAxis->x2p(yv);
double y=transformY(yv);
double minstop=p25;
double maxstop=p75;
if (percentile25Column<0 && medianColumn>=0) minstop=median;
@ -660,8 +675,8 @@ void JKQTPboxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
else if (percentile75Column<0 && meanColumn>=0) maxstop=mean;
double yn=y+1;
if (i+1<imax) yn=yAxis->x2p(datastore->get(posColumn,i+1));
else if (i-1>=0) yn=yAxis->x2p(datastore->get(posColumn,i-1));
if (i+1<imax) yn=transformY(datastore->get(posColumn,i+1));
else if (i-1>=0) yn=transformY(datastore->get(posColumn,i-1));
else yn=y+1;
double delta=fabs(yn-y);
double w=((boxwidth_real>0)?boxwidth_real:(delta))*boxWidth;
@ -671,10 +686,10 @@ void JKQTPboxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
double ymi4=y-w/4.0;
if (imax<=1) {
ymi=yAxis->x2p(yv+boxWidth/2.0);
yma=yAxis->x2p(yv-boxWidth/2.0);
yma4=yAxis->x2p(yv+boxWidth/4.0);
ymi4=yAxis->x2p(yv-boxWidth/4.0);
ymi=transformY(yv+boxWidth/2.0);
yma=transformY(yv-boxWidth/2.0);
yma4=transformY(yv+boxWidth/4.0);
ymi4=transformY(yv-boxWidth/4.0);
}
if (minColumn>=0) {
lines_p.append(QLineF(min, ymi4, min, yma4));
@ -825,12 +840,12 @@ void JKQTPboxplotVerticalElement::draw(JKQTPEnhancedPainter& painter) {
JKQTPIsOKFloat(maxv) && JKQTPIsOKFloat(medianv) ) {
//std::cout<<"boxplot(med="<<medianv<<", min="<<minv<<", max="<<maxv<<", p25="<<p25v<<", p75="<<p75v<<")\n";
double x=xAxis->x2p(xv);
double p25=yAxis->x2p(p25v);
double p75=yAxis->x2p(p75v);
double min=yAxis->x2p(minv);
double max=yAxis->x2p(maxv);
double median=yAxis->x2p(medianv);
double x=transformX(xv);
double p25=transformY(p25v);
double p75=transformY(p75v);
double min=transformY(minv);
double max=transformY(maxv);
double median=transformY(medianv);
double w=boxWidth;
double xma=x+w/2.0;
@ -855,7 +870,7 @@ void JKQTPboxplotVerticalElement::draw(JKQTPEnhancedPainter& painter) {
painter.restore();
if (drawMean) {
double mean=yAxis->x2p(this->mean);
double mean=transformY(this->mean);
JKQTPplotSymbol(painter, x, mean, meanSymbol, parent->pt2px(painter, meanSymbolSize), parent->pt2px(painter, meanSymbolWidth*parent->get_lineWidthMultiplier()), color, fillColor);
}
@ -1064,6 +1079,16 @@ bool JKQTPboxplotHorizontalElement::getYMinMax(double& minx, double& maxx, doubl
return true;
}
JKQTPboxplotHorizontalElement::JKQTPboxplotHorizontalElement(JKQtBasePlotter *parent):
JKQTPboxplotVerticalElement(parent)
{
}
JKQTPboxplotHorizontalElement::JKQTPboxplotHorizontalElement(JKQtPlotter *parent):
JKQTPboxplotVerticalElement(parent)
{
}
void JKQTPboxplotHorizontalElement::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPboxplotHorizontalElement::draw");
@ -1103,12 +1128,12 @@ void JKQTPboxplotHorizontalElement::draw(JKQTPEnhancedPainter& painter) {
JKQTPIsOKFloat(medianv)) {
//std::cout<<"boxplot(med="<<medianv<<", min="<<minv<<", max="<<maxv<<", p25="<<p25v<<", p75="<<p75v<<")\n";
double y=yAxis->x2p(yv);
double p25=xAxis->x2p(p25v);
double p75=xAxis->x2p(p75v);
double min=xAxis->x2p(minv);
double max=xAxis->x2p(maxv);
double median=xAxis->x2p(medianv);
double y=transformY(yv);
double p25=transformX(p25v);
double p75=transformX(p75v);
double min=transformX(minv);
double max=transformX(maxv);
double median=transformX(medianv);
double w=boxWidth;
double yma=y+w/2.0;
@ -1133,7 +1158,7 @@ void JKQTPboxplotHorizontalElement::draw(JKQTPEnhancedPainter& painter) {
painter.restore();
if (drawMean) {
double mean=yAxis->x2p(this->mean);
double mean=transformY(this->mean);
JKQTPplotSymbol(painter, mean, y, meanSymbol, parent->pt2px(painter, meanSymbolSize), parent->pt2px(painter, meanSymbolWidth*parent->get_lineWidthMultiplier()), color, fillColor);
}

View File

@ -80,22 +80,19 @@ class LIB_EXPORT JKQTPboxplotVerticalGraph: public JKQTPgraph {
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
JKQTPGET_SET_MACRO(DataSortOrder, sortData)
/** \brief sets the property sortData to the specified \a __value. \details Description of the parameter sortData is: <CENTER>\copybrief sortData.</CENTER> \see sortData for more information */
inline void set_sortData(int __value) {
sortData=(DataSortOrder)__value;
if (__value>0) sortData=Sorted;
}
void set_sortData(int __value);
JKQTPGET_SET_MACRO(int, posColumn)
JKQTPSET_CAST_MACRO(size_t, int, posColumn)
JKQTPGET_SET_MACRO(int, medianColumn)
@ -165,7 +162,7 @@ class LIB_EXPORT JKQTPboxplotVerticalGraph: public JKQTPgraph {
DataSortOrder sortData;
/** \brief this array contains the order of indices, in which to access the data in the data columns */
QVector<int> sortedIndices;
virtual void intSortData();
virtual void intSortData() ;
inline int getDataIndex(int i) {
if (sortData==Unsorted) return i;
return sortedIndices.value(i,i);
@ -186,31 +183,25 @@ class LIB_EXPORT JKQTPboxplotHorizontalGraph: public JKQTPboxplotVerticalGraph {
Q_OBJECT
public:
/** \brief class constructor */
inline JKQTPboxplotHorizontalGraph(JKQtBasePlotter* parent=nullptr):
JKQTPboxplotVerticalGraph(parent)
{
}
inline JKQTPboxplotHorizontalGraph(JKQtPlotter* parent):
JKQTPboxplotVerticalGraph(parent)
{
}
JKQTPboxplotHorizontalGraph(JKQtBasePlotter* parent=nullptr);
JKQTPboxplotHorizontalGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
};
@ -238,23 +229,23 @@ class LIB_EXPORT JKQTPboxplotVerticalElement: public JKQTPgraph {
JKQTPboxplotVerticalElement(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
JKQTPGET_SET_MACRO(double, pos)
@ -338,32 +329,26 @@ class LIB_EXPORT JKQTPboxplotHorizontalElement: public JKQTPboxplotVerticalEleme
Q_OBJECT
public:
/** \brief class constructor */
inline JKQTPboxplotHorizontalElement(JKQtBasePlotter* parent=nullptr):
JKQTPboxplotVerticalElement(parent)
{
}
JKQTPboxplotHorizontalElement(JKQtBasePlotter* parent=nullptr);
/** \brief class constructor */
inline JKQTPboxplotHorizontalElement(JKQtPlotter* parent):
JKQTPboxplotVerticalElement(parent)
{
}
JKQTPboxplotHorizontalElement(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
};

View File

@ -238,8 +238,8 @@ void JKQTPxFunctionLineGraph::createPlotData(bool collectParams) {
double xmin=parent->getXMin();
double xmax=parent->getXMax();
double pxmin=xAxis->x2p(xmin);
double pxmax=xAxis->x2p(xmax);
double pxmin=transformX(xmin);
double pxmax=transformX(xmax);
double delta0=(pxmax-pxmin)/(double)minSamples;
//double logdelta0=(log(xmax)-log(xmin))/(double)minSamples;
@ -249,7 +249,7 @@ void JKQTPxFunctionLineGraph::createPlotData(bool collectParams) {
d->f=func(xmin);
d->next=nullptr;
data=d;
/*if (parent && parent->getXAxis()->isLogAxis()) {
/*if (parent && parent->get_xAxis()->isLogAxis()) {
for (double x=log(xmin)+logdelta0; x<log(xmax); x=x+logdelta0) {
d->next = new doublePair;
d->next->x=exp(x+((double)rand()/(double)RAND_MAX-0.5)*delta0/2.0);
@ -331,15 +331,15 @@ void JKQTPxFunctionLineGraph::collectParameters()
void JKQTPxFunctionLineGraph::refine(doublePair* a, doublePair* b, unsigned int degree) {
if (degree>=maxRefinementDegree) return;
double ax=xAxis->x2p(a->x);
double af=xAxis->x2p(a->f);
double bx=xAxis->x2p(b->x);
double bf=xAxis->x2p(b->f);
double ax=transformX(a->x);
double af=transformX(a->f);
double bx=transformX(b->x);
double bf=transformX(b->f);
double delta=bx - ax;
//double logdelta=log(bx) - log(ax);
double xmid=ax+(delta)/2.0;
/*if (parent && parent->getXAxis()->isLogAxis()) {
/*if (parent && parent->get_xAxis()->isLogAxis()) {
xmid=log(a->x)+(logdelta)/2.0;
xmid=xmid+((double)rand()/(double)RAND_MAX-0.5)*delta/5.0;
xmid=exp(xmid);
@ -350,7 +350,7 @@ void JKQTPxFunctionLineGraph::refine(doublePair* a, doublePair* b, unsigned int
double realfmid;
if (plotFunction) realfmid=plotFunction(realxmid, params);
else if (simplePlotFunction) realfmid=simplePlotFunction(realxmid);
double fmid=yAxis->x2p(realfmid);
double fmid=transformY(realfmid);
double a1=(fmid - af)/(xmid - ax);
double a2=(bf - fmid)/(bx - xmid);
//std::cout<<std::string(degree*2, ' ')<<"refine( ["<<a->x<<", "<<a->f<<"], ["<<xmid<<", "<<fmid<<"], ["<<b->x<<", "<<b->f<<"] ): a1="<<a1<<", a2="<<a2<<" acrit="<<abs(a2/a1)-1.0<<"\n";
@ -412,18 +412,18 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
// double ypeold=-1;
// double ymeold=-1;
// double x0=xAxis->x2p(0);
// if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
double y0=yAxis->x2p(0);
if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
// double x0=transformX(0);
// if (parent->get_xAxis()->isLogAxis()) x0=transformX(parent->get_xAxis()->getMin());
double y0=transformY(0);
if (parent->get_yAxis()->isLogAxis()) y0=transformY(parent->get_yAxis()->getMin());
bool first=false;
doublePair* d=data;
//QPainterPath pa, pfill;
//QPainterPath pel, pef;
QPolygonF filledPolygon, linePolygon, errorLineTop, errorLineBottom;
QList<QPointF> epTop, epBottom;
double yami=qMin(yAxis->x2p(parent->getYAxis()->getMin()),yAxis->x2p(parent->getYAxis()->getMax()));
double yama=qMax(yAxis->x2p(parent->getYAxis()->getMin()),yAxis->x2p(parent->getYAxis()->getMax()));
double yami=qMin(transformY(parent->get_yAxis()->getMin()),transformY(parent->get_yAxis()->getMax()));
double yama=qMax(transformY(parent->get_yAxis()->getMin()),transformY(parent->get_yAxis()->getMax()));
double dypix=fabs(yama-yami);
yami=yami-2*dypix;
yama=yama+2*dypix;
@ -433,13 +433,13 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
double yv=d->f;
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
double x=transformX(xv);
double y=transformY(yv);
double ype=0, yme=0;
if ((drawErrorLines || drawErrorPolygons) && (static_cast<bool>(errorPlotFunction))) {
double e=errorPlotFunction(xv, errorParams);
ype=yAxis->x2p(yv+e);
yme=yAxis->x2p(yv-e);
ype=transformY(yv+e);
yme=transformY(yv-e);
ype=qBound(yami, ype, yama);
yme=qBound(yami, yme, yama);
}
@ -523,8 +523,8 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
double yv=d->f;
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
double x=transformX(xv);
double y=transformY(yv);
JKQTPplotSymbol(painter, x, y, JKQTPcross, 6,1*parent->get_lineWidthMultiplier(), c, QColor(Qt::transparent));
}
d=d->next;
@ -550,6 +550,10 @@ void JKQTPxFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
JKQTPyFunctionLineGraph::JKQTPyFunctionLineGraph(JKQtBasePlotter *parent):JKQTPxFunctionLineGraph(parent) {}
JKQTPyFunctionLineGraph::JKQTPyFunctionLineGraph(JKQtPlotter *parent):JKQTPxFunctionLineGraph(parent) {}
void JKQTPyFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
#ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaaot("JKQTPyFunctionLineGraph::draw");
@ -595,10 +599,10 @@ void JKQTPyFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
double xpeold=-1;
double xmeold=-1;
double x0=xAxis->x2p(0);
if (parent->getXAxis()->isLogAxis()) x0=xAxis->x2p(parent->getXAxis()->getMin());
// double y0=yAxis->x2p(0);
// if (parent->getYAxis()->isLogAxis()) y0=yAxis->x2p(parent->getYAxis()->getMin());
double x0=transformX(0);
if (parent->get_xAxis()->isLogAxis()) x0=transformX(parent->get_xAxis()->getMin());
// double y0=transformY(0);
// if (parent->get_yAxis()->isLogAxis()) y0=transformY(parent->get_yAxis()->getMin());
bool first=false;
doublePair* d=data;
@ -607,13 +611,13 @@ void JKQTPyFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
double xv=d->f;
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
double x=transformX(xv);
double y=transformY(yv);
double xpe=0, xme=0;
if ((drawErrorLines || drawErrorPolygons) && (static_cast<bool>(errorPlotFunction))) {
double e=errorPlotFunction(xv, errorParams);
xpe=xAxis->x2p(xv+e);
xme=xAxis->x2p(xv-e);
xpe=transformX(xv+e);
xme=transformX(xv-e);
}
if (first) {
@ -699,8 +703,8 @@ void JKQTPyFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
double xv=d->f;
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
double x=transformX(xv);
double y=transformY(yv);
JKQTPplotSymbol(painter, x, y, JKQTPcross, 6, 1*parent->get_lineWidthMultiplier(), c, QColor(Qt::transparent));
}
d=d->next;
@ -934,7 +938,7 @@ jkqtpSimplePlotFunctionType JKQTPxFunctionLineGraph::get_errorSimplePlotFunction
}
bool JKQTPxFunctionLineGraph::usesColumn(int c)
bool JKQTPxFunctionLineGraph::usesColumn(int c) const
{
return (c==parameterColumn)||(c==errorParameterColumn);
}

View File

@ -99,21 +99,21 @@ class LIB_EXPORT JKQTPxFunctionLineGraph: public JKQTPgraph {
virtual ~JKQTPxFunctionLineGraph();
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
/** \brief get the maximum and minimum x-value of the graph
*
* This functions returns 0 for both parameters, so that the plotter uses the predefined
* min and max values.
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief clear the data sampled from the function. */
void clearData();
@ -218,7 +218,7 @@ class LIB_EXPORT JKQTPxFunctionLineGraph: public JKQTPgraph {
JKQTPGET_SET_MACRO(double, errorLineWidth)
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
/** \brief sets function to the given special function */
@ -327,16 +327,16 @@ class LIB_EXPORT JKQTPyFunctionLineGraph: public JKQTPxFunctionLineGraph {
Q_OBJECT
public:
/** \brief class constructor */
inline JKQTPyFunctionLineGraph(JKQtBasePlotter* parent=nullptr):JKQTPxFunctionLineGraph(parent) {}
JKQTPyFunctionLineGraph(JKQtBasePlotter* parent=nullptr);
/** \brief class constructor */
inline JKQTPyFunctionLineGraph(JKQtPlotter* parent):JKQTPxFunctionLineGraph(parent) {}
JKQTPyFunctionLineGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
protected:
/** \brief fill the data array with data from the function plotFunction */
virtual void createPlotData( bool collectParams=true);
virtual void createPlotData( bool collectParams=true) override;
};

View File

@ -106,7 +106,7 @@ void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) {
b.setColor(fillColor);
b.setStyle(fillStyle);
int imax=qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imax=static_cast<int>(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()));
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
@ -127,16 +127,16 @@ void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) {
double xold=-1;
//double yold=-1;
// double x0=xAxis->x2p(baseline);
// if (parent->getXAxis()->isLogAxis()) {
// if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline);
// else x0=xAxis->x2p(parent->getXAxis()->getMin());
// double x0=transformX(baseline);
// if (parent->get_xAxis()->isLogAxis()) {
// if (baseline>0 && baseline>parent->get_xAxis()->getMin()) x0=transformX(baseline);
// else x0=transformX(parent->get_xAxis()->getMin());
// }
double y0=yAxis->x2p(baseline);
if (parent->getYAxis()->isLogAxis()) {
y0=yAxis->x2p(parent->getYAxis()->getMin());
if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline);
else y0=yAxis->x2p(parent->getYAxis()->getMin());
double y0=transformY(baseline);
if (parent->get_yAxis()->isLogAxis()) {
y0=transformY(parent->get_yAxis()->getMin());
if (baseline>0 && baseline>parent->get_yAxis()->getMin()) y0=transformY(baseline);
else y0=transformY(parent->get_yAxis()->getMin());
}
bool first=true;
intSortData();
@ -146,8 +146,8 @@ void JKQTPfilledCurveXGraph::draw(JKQTPEnhancedPainter& painter) {
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv); bool xok=JKQTPIsOKFloat(x);
double y=yAxis->x2p(yv); bool yok=JKQTPIsOKFloat(y);
double x=transformX(xv); bool xok=JKQTPIsOKFloat(x);
double y=transformY(yv); bool yok=JKQTPIsOKFloat(y);
if (!first) {
if (xok&&yok) {
@ -282,7 +282,7 @@ void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) {
b.setColor(fillColor);
b.setStyle(fillStyle);
int imax=qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows());
int imax=static_cast<int>(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()));
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
@ -303,17 +303,17 @@ void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) {
//double xold=-1;
double yold=-1;
double x0=xAxis->x2p(baseline);
if (parent->getXAxis()->isLogAxis()) {
if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline);
else x0=xAxis->x2p(parent->getXAxis()->getMin());
}
double y0=yAxis->x2p(baseline);
if (parent->getYAxis()->isLogAxis()) {
y0=yAxis->x2p(parent->getYAxis()->getMin());
if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline);
else y0=yAxis->x2p(parent->getYAxis()->getMin());
double x0=transformX(baseline);
if (parent->get_xAxis()->isLogAxis()) {
if (baseline>0 && baseline>parent->get_xAxis()->getMin()) x0=transformX(baseline);
else x0=transformX(parent->get_xAxis()->getMin());
}
/*double y0=transformY(baseline);
if (parent->get_yAxis()->isLogAxis()) {
y0=transformY(parent->get_yAxis()->getMin());
if (baseline>0 && baseline>parent->get_yAxis()->getMin()) y0=transformY(baseline);
else y0=transformY(parent->get_yAxis()->getMin());
}*/
bool first=true;
intSortData();
for (int iii=imin; iii<imax; iii++) {
@ -322,8 +322,8 @@ void JKQTPfilledCurveYGraph::draw(JKQTPEnhancedPainter& painter) {
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv); bool xok=JKQTPIsOKFloat(x);
double y=yAxis->x2p(yv); bool yok=JKQTPIsOKFloat(y);
double x=transformX(xv); bool xok=JKQTPIsOKFloat(x);
double y=transformY(yv); bool yok=JKQTPIsOKFloat(y);
if (!first) {
if (xok&&yok) {
@ -422,15 +422,15 @@ JKQTPfilledCurveXErrorGraph::JKQTPfilledCurveXErrorGraph(JKQtPlotter *parent):
setErrorColorFromGraphColor(color);
}
bool JKQTPfilledCurveXErrorGraph::usesColumn(int c)
bool JKQTPfilledCurveXErrorGraph::usesColumn(int c) const
{
return JKQTPfilledCurveXGraph::usesColumn(c)|| JKQTPyGraphErrors::errorUsesColumn(c);
}
void JKQTPfilledCurveXErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
{
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
}
@ -446,15 +446,15 @@ JKQTPfilledCurveYErrorGraph::JKQTPfilledCurveYErrorGraph(JKQtPlotter *parent):
setErrorColorFromGraphColor(color);
}
bool JKQTPfilledCurveYErrorGraph::usesColumn(int c)
bool JKQTPfilledCurveYErrorGraph::usesColumn(int c) const
{
return JKQTPfilledCurveYGraph::usesColumn(c)|| JKQTPxGraphErrors::errorUsesColumn(c);
}
void JKQTPfilledCurveYErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
{
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
}
@ -515,7 +515,7 @@ bool JKQTPfilledVerticalRangeGraph::getYMinMax(double &miny, double &maxy, doubl
JKQTPdatastore* datastore=parent->getDatastore();
int imin=0;
int imax=qMin(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()), datastore->getColumn(static_cast<size_t>(yColumn2)).getRows());
int imax=static_cast<int>(qMin(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()), datastore->getColumn(static_cast<size_t>(yColumn2)).getRows()));
// interpret data ranges
if (datarange_start>-1) {
imin=qMin(datarange_start, static_cast<int>(imax));
@ -552,7 +552,7 @@ bool JKQTPfilledVerticalRangeGraph::getYMinMax(double &miny, double &maxy, doubl
return !start;
}
bool JKQTPfilledVerticalRangeGraph::usesColumn(int column)
bool JKQTPfilledVerticalRangeGraph::usesColumn(int column) const
{
return JKQTPxyGraph::usesColumn(column)||(column==yColumn2);
}
@ -582,7 +582,7 @@ void JKQTPfilledVerticalRangeGraph::draw(JKQTPEnhancedPainter &painter)
b.setColor(fillColor);
b.setStyle(fillStyle);
int imax=qMin(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()), datastore->getColumn(static_cast<size_t>(yColumn2)).getRows());
int imax=static_cast<int>(qMin(qMin(datastore->getColumn(static_cast<size_t>(xColumn)).getRows(), datastore->getColumn(static_cast<size_t>(yColumn)).getRows()), datastore->getColumn(static_cast<size_t>(yColumn2)).getRows()));
int imin=0;
// interpret data ranges
if (datarange_start>-1) {
@ -612,9 +612,9 @@ void JKQTPfilledVerticalRangeGraph::draw(JKQTPEnhancedPainter &painter)
double yv2=datastore->get(static_cast<size_t>(yColumn2),static_cast<size_t>(i));
//std::cout<<"(xv, yv) = ( "<<xv<<", "<<yv<<" )\n";
if (JKQTPIsOKFloat(xv)) {
double x=xAxis->x2p(xv); bool xok=JKQTPIsOKFloat(x);
double y=yAxis->x2p(yv); bool yok=JKQTPIsOKFloat(y);
double y2=yAxis->x2p(yv2); bool y2ok=JKQTPIsOKFloat(y2);
double x=transformX(xv); bool xok=JKQTPIsOKFloat(x);
double y=transformY(yv); bool yok=JKQTPIsOKFloat(y);
double y2=transformY(yv2); bool y2ok=JKQTPIsOKFloat(y2);
if (xok&&yok) phigh.append(QPointF(x,y));
if (xok&&yok) poly_all.append(QPointF(x,y));

View File

@ -42,11 +42,11 @@ class LIB_EXPORT JKQTPfilledCurveXGraph: public JKQTPxyGraph {
JKQTPfilledCurveXGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
JKQTPGET_SET_MACRO(QColor, color)
JKQTPGET_SET_MACRO(QColor, fillColor)
@ -103,11 +103,11 @@ class LIB_EXPORT JKQTPfilledCurveXErrorGraph: public JKQTPfilledCurveXGraph, pub
/** \brief class constructor */
JKQTPfilledCurveXErrorGraph(JKQtPlotter* parent);
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter);
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override;
};
@ -130,7 +130,7 @@ class LIB_EXPORT JKQTPfilledCurveYGraph: public JKQTPfilledCurveXGraph {
JKQTPfilledCurveYGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
};
@ -147,11 +147,11 @@ class LIB_EXPORT JKQTPfilledCurveYErrorGraph: public JKQTPfilledCurveYGraph, pub
JKQTPfilledCurveYErrorGraph(JKQtBasePlotter* parent=nullptr);
JKQTPfilledCurveYErrorGraph(JKQtPlotter* parent);
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter);
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override;
};
@ -181,17 +181,17 @@ class LIB_EXPORT JKQTPfilledVerticalRangeGraph: public JKQTPxyGraph {
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int column);
virtual bool usesColumn(int column) const override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
JKQTPGET_SET_MACRO(int, yColumn2)
JKQTPSET_CAST_MACRO(size_t, int, yColumn2)

View File

@ -27,7 +27,7 @@
#define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgz<smallestGreaterZero))) smallestGreaterZero=xvsgz;
JKQTPgeoBaseLine::JKQTPgeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style, JKQtBasePlotter* parent):
JKQTPgraph(parent)
JKQTPplotObject(parent)
{
this->color=color;
this->lineWidth=lineWidth;
@ -36,7 +36,7 @@ JKQTPgeoBaseLine::JKQTPgeoBaseLine(QColor color, double lineWidth, Qt::PenStyle
}
JKQTPgeoBaseLine::JKQTPgeoBaseLine(QColor color, double lineWidth, Qt::PenStyle style, JKQtPlotter* parent):
JKQTPgraph(parent)
JKQTPplotObject(parent)
{
this->color=color;
this->lineWidth=lineWidth;
@ -118,7 +118,7 @@ void JKQTPgeoBaseFilled::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& re
JKQTPgeoText::JKQTPgeoText(JKQtBasePlotter* parent, double x, double y, QString text, double fontSize, QColor color):
JKQTPgraph(parent)
JKQTPplotObject(parent)
{
this->x=x;
this->y=y;
@ -128,7 +128,7 @@ JKQTPgeoText::JKQTPgeoText(JKQtBasePlotter* parent, double x, double y, QString
}
JKQTPgeoText::JKQTPgeoText(JKQtPlotter* parent, double x, double y, QString text, double fontSize, QColor color):
JKQTPgraph(parent)
JKQTPplotObject(parent)
{
this->x=x;
this->y=y;
@ -158,7 +158,7 @@ void JKQTPgeoText::draw(JKQTPEnhancedPainter& painter) {
parent->get_mathText()->set_fontSize(fontSize*parent->get_fontSizeMultiplier());
parent->get_mathText()->set_fontColor(color);
parent->get_mathText()->parse(text);
parent->get_mathText()->draw(painter, xAxis->x2p(x), yAxis->x2p(y));
parent->get_mathText()->draw(painter, transformX(x), transformY(y));
painter.restore();
}
@ -225,7 +225,7 @@ bool JKQTPgeoLine::getYMinMax(double& miny, double& maxy, double& smallestGreate
void JKQTPgeoLine::draw(JKQTPEnhancedPainter& painter) {
painter.save();
painter.setPen(getPen(painter));
QLineF l(QPointF(xAxis->x2p(x1), yAxis->x2p(y1)), QPointF(xAxis->x2p(x2), yAxis->x2p(y2)));
QLineF l(QPointF(transformX(x1), transformY(y1)), QPointF(transformX(x2), transformY(y2)));
if (l.length()>0) painter.drawLine(l);
painter.restore();
}
@ -273,10 +273,10 @@ bool JKQTPgeoInfiniteLine::getYMinMax(double& miny, double& maxy, double& smalle
void JKQTPgeoInfiniteLine::draw(JKQTPEnhancedPainter& painter) {
double xmin=parent->getXAxis()->getMin();
double xmax=parent->getXAxis()->getMax();
double ymin=parent->getYAxis()->getMin();
double ymax=parent->getYAxis()->getMax();
double xmin=parent->get_xAxis()->getMin();
double xmax=parent->get_xAxis()->getMax();
double ymin=parent->get_yAxis()->getMin();
double ymax=parent->get_yAxis()->getMax();
QRectF bbox(QPointF(xmin, ymin), QPointF(xmax, ymax));
bool doDraw=false;
double x2=x, y2=y;
@ -390,7 +390,7 @@ void JKQTPgeoInfiniteLine::draw(JKQTPEnhancedPainter& painter) {
if (doDraw) {
painter.save();
painter.setPen(getPen(painter));
QLineF l(QPointF(xAxis->x2p(x1), yAxis->x2p(y1)), QPointF(xAxis->x2p(x2), yAxis->x2p(y2)));
QLineF l(QPointF(transformX(x1), transformY(y1)), QPointF(transformX(x2), transformY(y2)));
if (l.length()>0) painter.drawLine(l);
painter.restore();
}
@ -525,7 +525,7 @@ void JKQTPgeoRectangle::draw(JKQTPEnhancedPainter& painter) {
QPolygonF poly=getPolygon();
QPolygonF rect;
for (int i=0; i<poly.size(); i++) {
rect.append(QPointF(xAxis->x2p(poly[i].x()), yAxis->x2p(poly[i].y())));
rect.append(QPointF(transformX(poly[i].x()), transformY(poly[i].y())));
}
painter.save();

View File

@ -42,12 +42,12 @@
#define jkqtpgraphsgeometric_H_INCLUDED
/*! \brief This virtual JKQTPgraph descendent may be used as base class for geometric drawing
/*! \brief This JKQTPplotObject is used as base class for geometric drawing
elements that only consist of lines (i.e. no filling of any kind is done)
\ingroup jkqtplotter_geoplots
*/
class LIB_EXPORT JKQTPgeoBaseLine: public JKQTPgraph {
class LIB_EXPORT JKQTPgeoBaseLine: public JKQTPplotObject {
Q_OBJECT
public:
/*! \brief class contructor
@ -71,9 +71,9 @@ class LIB_EXPORT JKQTPgeoBaseLine: public JKQTPgraph {
JKQTPGET_SET_MACRO(double, lineWidth)
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
protected:
/** \brief color of the graph */
@ -88,7 +88,7 @@ class LIB_EXPORT JKQTPgeoBaseLine: public JKQTPgraph {
};
/*! \brief This virtual JKQTPgraph descendent may be used as base class for geometric drawing
/*! \brief This JKQTPplotObject is used as base class for geometric drawing
elements that only consist of lines (i.e. no filling of any kind is done)
\ingroup jkqtplotter_geoplots
@ -140,7 +140,7 @@ class LIB_EXPORT JKQTPgeoBaseFilled: public JKQTPgeoBaseLine {
JKQTPGET_SET_MACRO(Qt::BrushStyle, fillStyle)
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
protected:
/** \brief filling color of the graph */
@ -154,12 +154,12 @@ class LIB_EXPORT JKQTPgeoBaseFilled: public JKQTPgeoBaseLine {
/*! \brief This virtual JKQTPgraph descendent may be used to display text. It uses the JKQTMathText
/*! \brief This JKQTPplotObject is used to display text. It uses the JKQTMathText
class in order to display LaTeX formulas.
\ingroup jkqtplotter_geoplots
*/
class LIB_EXPORT JKQTPgeoText: public JKQTPgraph {
class LIB_EXPORT JKQTPgeoText: public JKQTPplotObject {
Q_OBJECT
public:
/*! \brief class contructor
@ -189,18 +189,18 @@ class LIB_EXPORT JKQTPgeoText: public JKQTPgraph {
JKQTPGET_SET_MACRO(double, x)
JKQTPGET_SET_MACRO(double, y)
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \copydoc JKQTPplotObject::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPplotObject::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
protected:
double x,y;
@ -216,7 +216,7 @@ class LIB_EXPORT JKQTPgeoText: public JKQTPgraph {
QPen getPen(JKQTPEnhancedPainter& painter);
};
/*! \brief This virtual JKQTPgraph descendent may be used to draw a line
/*! \brief This JKQTPplotObject is used to draw a line
\ingroup jkqtplotter_geoplots
\image html plot_geoline.png
@ -251,13 +251,13 @@ class LIB_EXPORT JKQTPgeoLine: public JKQTPgeoBaseLine {
JKQTPgeoLine(JKQtPlotter* parent, double x1, double y1, double x2, double y2, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \copydoc JKQTPplotObject::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPplotObject::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
JKQTPGET_SET_MACRO(double, x1)
JKQTPGET_SET_MACRO(double, y1)
@ -269,7 +269,7 @@ class LIB_EXPORT JKQTPgeoLine: public JKQTPgeoBaseLine {
/*! \brief This virtual JKQTPgraph descendent may be used to draw an infinite line
/*! \brief This JKQTPplotObject is used to draw an infinite line
\ingroup jkqtplotter_geoplots
an infinite line has a starting point and then goes on in a given direction
@ -307,13 +307,13 @@ class LIB_EXPORT JKQTPgeoInfiniteLine: public JKQTPgeoBaseLine {
JKQTPgeoInfiniteLine(JKQtPlotter* parent, double x, double y, double dx, double dy, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \copydoc JKQTPplotObject::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPplotObject::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
JKQTPGET_SET_MACRO(double, x)
JKQTPGET_SET_MACRO(double, y)
@ -328,7 +328,7 @@ class LIB_EXPORT JKQTPgeoInfiniteLine: public JKQTPgeoBaseLine {
};
/*! \brief This virtual JKQTPgraph descendent may be used to draw a poly line
/*! \brief This JKQTPplotObject is used to draw a poly line
\ingroup jkqtplotter_geoplots
\image html plot_geolines.png
@ -363,30 +363,30 @@ class LIB_EXPORT JKQTPgeoLines: public JKQTPgeoBaseLine {
JKQTPgeoLines(JKQtPlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \copydoc JKQTPplotObject::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPplotObject::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
JKQTPGET_SET_MACRO(QVector<QPointF>, points)
/** \brief append a point to the polygon */
inline void appendPoint(const QPointF& p) {
points.append(p);
};
}
/** \brief append a point to the polygon */
inline void appendPoint(const double x, const double y) {
points.append(QPointF(x, y));
};
}
protected:
QVector<QPointF> points;
};
/*! \brief This virtual JKQTPgraph descendent may be used to draw a rectangle
/*! \brief This JKQTPplotObject is used to draw a rectangle
\ingroup jkqtplotter_geoplots
\image html plot_georectangle.png
@ -425,13 +425,13 @@ class LIB_EXPORT JKQTPgeoRectangle: public JKQTPgeoBaseFilled {
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \copydoc JKQTPplotObject::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPplotObject::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
JKQTPGET_SET_MACRO(double, x)
JKQTPGET_SET_MACRO(double, y)
@ -451,7 +451,7 @@ protected:
};
/*! \brief This virtual JKQTPgraph descendent may be used to draw a polygon
/*! \brief This JKQTPplotObject is used to draw a polygon
\ingroup jkqtplotter_geoplots
\image html plot_geopolygon.png
@ -486,31 +486,31 @@ class LIB_EXPORT JKQTPgeoPolygon: public JKQTPgeoBaseFilled {
JKQTPgeoPolygon(JKQtPlotter* parent, QVector<QPointF> points, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \copydoc JKQTPplotObject::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPplotObject::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
JKQTPGET_SET_MACRO(QVector<QPointF>, points)
/** \brief append a point to the polygon */
inline void appendPoint(const QPointF& p) {
points.append(p);
};
}
/** \brief append a point to the polygon */
inline void appendPoint(const double x, const double y) {
points.append(QPointF(x, y));
};
}
protected:
QVector<QPointF> points;
};
/*! \brief This virtual JKQTPgraph descendent may be used to draw an ellipse
/*! \brief This JKQTPplotObject is used to draw an ellipse
\ingroup jkqtplotter_geoplots
\image html plot_geoellipse.png
@ -553,7 +553,7 @@ class LIB_EXPORT JKQTPgeoEllipse: public JKQTPgeoRectangle {
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
JKQTPGET_SET_MACRO(unsigned int, controlPoints)
protected:
@ -562,7 +562,7 @@ class LIB_EXPORT JKQTPgeoEllipse: public JKQTPgeoRectangle {
};
/*! \brief This virtual JKQTPgraph descendent may be used to draw an arc
/*! \brief This JKQTPplotObject is used to draw an arc
\ingroup jkqtplotter_geoplots
\image html plot_geoarc.png
@ -597,14 +597,14 @@ class LIB_EXPORT JKQTPgeoArc: public JKQTPgeoBaseLine {
*/
JKQTPgeoArc(JKQtPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine);
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \copydoc JKQTPplotObject::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPplotObject::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
JKQTPGET_SET_MACRO(unsigned int, controlPoints)
JKQTPGET_SET_MACRO(double, angleStart)
@ -638,7 +638,7 @@ class LIB_EXPORT JKQTPgeoArc: public JKQTPgeoBaseLine {
/*! \brief This virtual JKQTPgraph descendent may be used to draw a pie
/*! \brief This JKQTPplotObject is used to draw a pie
\ingroup jkqtplotter_geoplots
\image html plot_geopie.png
@ -676,14 +676,14 @@ class LIB_EXPORT JKQTPgeoPie: public JKQTPgeoEllipse {
JKQTPgeoPie(JKQtPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \copydoc JKQTPplotObject::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPplotObject::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
JKQTPGET_SET_MACRO(double, angleStart)
JKQTPGET_SET_MACRO(double, angleStop)
@ -697,7 +697,7 @@ class LIB_EXPORT JKQTPgeoPie: public JKQTPgeoEllipse {
/*! \brief This virtual JKQTPgraph descendent may be used to draw a chord
/*! \brief This JKQTPplotObject is used to draw a chord
\ingroup jkqtplotter_geoplots
\image html plot_geochord.png
@ -734,13 +734,13 @@ class LIB_EXPORT JKQTPgeoChord: public JKQTPgeoPie {
*/
JKQTPgeoChord(JKQtPlotter* parent, double x, double y, double width, double height, double angleStart, double angleStop, QColor color=QColor("black"), double lineWidth=1, Qt::PenStyle style=Qt::SolidLine, QColor fillColor=QColor("transparent"), Qt::BrushStyle fillStyle=Qt::SolidPattern);
/** \copydoc JKQTPgraph::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
/** \copydoc JKQTPgraph::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
/** \copydoc JKQTPplotObject::getXMinMax() */
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \copydoc JKQTPplotObject::getYMinMax() */
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
};

View File

@ -650,7 +650,7 @@ void JKQTPMathImage::initJKQTPMathImage() {
connect(actCopyPalette, SIGNAL(triggered()), this, SLOT(copyColorbarPlotAsImage()));
colorBarRightAxis=new JKQTPverticalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarRightAxis->loadSettings(parent->getYAxis());
if (parent) colorBarRightAxis->loadSettings(parent->get_yAxis());
colorBarRightAxis->set_drawMode1(JKQTPCADMline);
colorBarRightAxis->set_drawMode2(JKQTPCADMcomplete);
colorBarRightAxis->set_axisLabel("");
@ -660,7 +660,7 @@ void JKQTPMathImage::initJKQTPMathImage() {
colorBarRightAxis->set_minorTickOutsideLength(0);
colorBarRightAxis->set_showZeroAxis(false);
colorBarTopAxis=new JKQTPhorizontalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarTopAxis->loadSettings(parent->getXAxis());
if (parent) colorBarTopAxis->loadSettings(parent->get_xAxis());
colorBarTopAxis->set_drawMode1(JKQTPCADMline);
colorBarTopAxis->set_drawMode2(JKQTPCADMcomplete);
colorBarTopAxis->set_axisLabel("");
@ -671,7 +671,7 @@ void JKQTPMathImage::initJKQTPMathImage() {
colorBarTopAxis->set_showZeroAxis(false);
modifierColorBarTopAxis=new JKQTPverticalIndependentAxis(0, 100, 0, 100, parent);
if (parent) modifierColorBarTopAxis->loadSettings(parent->getXAxis());
if (parent) modifierColorBarTopAxis->loadSettings(parent->get_xAxis());
modifierColorBarTopAxis->set_drawMode1(JKQTPCADMline);
modifierColorBarTopAxis->set_drawMode2(JKQTPCADMcomplete);
modifierColorBarTopAxis->set_axisLabel("");
@ -681,7 +681,7 @@ void JKQTPMathImage::initJKQTPMathImage() {
modifierColorBarTopAxis->set_tickOutsideLength(0);
modifierColorBarTopAxis->set_minorTickOutsideLength(0);
modifierColorBarRightAxis=new JKQTPhorizontalIndependentAxis (0, 100, 0, 100, parent);
if (parent) modifierColorBarRightAxis->loadSettings(parent->getYAxis());
if (parent) modifierColorBarRightAxis->loadSettings(parent->get_yAxis());
modifierColorBarRightAxis->set_drawMode1(JKQTPCADMline);
modifierColorBarRightAxis->set_drawMode2(JKQTPCADMcomplete);
modifierColorBarRightAxis->set_axisLabel("");
@ -1483,7 +1483,7 @@ void JKQTPRGBMathImage::initObject()
rgbMode=JKQTPRGBMathImageModeRGBMode;
colorBarRightAxis=new JKQTPverticalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarRightAxis->loadSettings(parent->getYAxis());
if (parent) colorBarRightAxis->loadSettings(parent->get_yAxis());
colorBarRightAxis->set_drawMode1(JKQTPCADMline);
colorBarRightAxis->set_drawMode2(JKQTPCADMcomplete);
colorBarRightAxis->set_axisLabel("");
@ -1493,7 +1493,7 @@ void JKQTPRGBMathImage::initObject()
colorBarRightAxis->set_minorTickOutsideLength(0);
colorBarRightAxis->set_showZeroAxis(false);
colorBarTopAxis=new JKQTPhorizontalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarTopAxis->loadSettings(parent->getXAxis());
if (parent) colorBarTopAxis->loadSettings(parent->get_xAxis());
colorBarTopAxis->set_drawMode1(JKQTPCADMline);
colorBarTopAxis->set_drawMode2(JKQTPCADMcomplete);
colorBarTopAxis->set_axisLabel("");
@ -1504,7 +1504,7 @@ void JKQTPRGBMathImage::initObject()
colorBarTopAxis->set_showZeroAxis(false);
colorBarRightAxisG=new JKQTPverticalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarRightAxisG->loadSettings(parent->getYAxis());
if (parent) colorBarRightAxisG->loadSettings(parent->get_yAxis());
colorBarRightAxisG->set_drawMode1(JKQTPCADMline);
colorBarRightAxisG->set_drawMode2(JKQTPCADMcomplete);
colorBarRightAxisG->set_axisLabel("");
@ -1514,7 +1514,7 @@ void JKQTPRGBMathImage::initObject()
colorBarRightAxisG->set_tickOutsideLength(0);
colorBarRightAxisG->set_minorTickOutsideLength(0);
colorBarTopAxisG=new JKQTPhorizontalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarTopAxisG->loadSettings(parent->getXAxis());
if (parent) colorBarTopAxisG->loadSettings(parent->get_xAxis());
colorBarTopAxisG->set_drawMode1(JKQTPCADMline);
colorBarTopAxisG->set_drawMode2(JKQTPCADMcomplete);
colorBarTopAxisG->set_axisLabel("");
@ -1525,7 +1525,7 @@ void JKQTPRGBMathImage::initObject()
colorBarTopAxisG->set_minorTickOutsideLength(0);
colorBarRightAxisB=new JKQTPverticalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarRightAxisB->loadSettings(parent->getYAxis());
if (parent) colorBarRightAxisB->loadSettings(parent->get_yAxis());
colorBarRightAxisB->set_drawMode1(JKQTPCADMline);
colorBarRightAxisB->set_drawMode2(JKQTPCADMcomplete);
colorBarRightAxisB->set_axisLabel("");
@ -1535,7 +1535,7 @@ void JKQTPRGBMathImage::initObject()
colorBarRightAxisB->set_tickOutsideLength(0);
colorBarRightAxisB->set_minorTickOutsideLength(0);
colorBarTopAxisB=new JKQTPhorizontalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarTopAxisB->loadSettings(parent->getXAxis());
if (parent) colorBarTopAxisB->loadSettings(parent->get_xAxis());
colorBarTopAxisB->set_drawMode1(JKQTPCADMline);
colorBarTopAxisB->set_drawMode2(JKQTPCADMcomplete);
colorBarTopAxisB->set_axisLabel("");
@ -2331,7 +2331,7 @@ JKQTPColumnMathImage::JKQTPColumnMathImage(double x, double y, double width, dou
this->imageColumn=imageColumn;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
bool JKQTPColumnMathImage::usesColumn(int c)
bool JKQTPColumnMathImage::usesColumn(int c) const
{
return (c==imageColumn)||(c==modifierColumn);
}
@ -2381,7 +2381,7 @@ void JKQTPColumnOverlayImageEnhanced::draw(JKQTPEnhancedPainter &painter) {
data=nullptr;
}
bool JKQTPColumnOverlayImageEnhanced::usesColumn(int c)
bool JKQTPColumnOverlayImageEnhanced::usesColumn(int c) const
{
return (c==imageColumn);
}
@ -2485,7 +2485,7 @@ JKQTPColumnRGBMathImage::JKQTPColumnRGBMathImage(double x, double y, double widt
this->imageBColumn=imageBColumn;
this->datatype=JKQTPMathImageBase::DoubleArray;
}
bool JKQTPColumnRGBMathImage::usesColumn(int c)
bool JKQTPColumnRGBMathImage::usesColumn(int c) const
{
return (c==imageRColumn)||(c==imageBColumn)||(c==imageGColumn)||(c==modifierColumn);
}

View File

@ -62,20 +62,20 @@ class LIB_EXPORT JKQTPImageBase: public JKQTPgraph {
/** \brief class constructor */
JKQTPImageBase(double x, double y, double width, double height, JKQtPlotter* parent);
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief get the maximum and minimum x-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
JKQTPGET_SET_MACRO(double, x)
JKQTPGET_SET_MACRO(double, y)
@ -162,7 +162,7 @@ class LIB_EXPORT JKQTPMathImageBase: public JKQTPImageBase {
JKQTPMathImageBase(double x, double y, double width, double height, DataType datatype, void* data, uint32_t Nx, uint32_t Ny, JKQtPlotter* parent);
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
JKQTPGET_SET_MACRO(uint32_t, Nx)
JKQTPGET_SET_MACRO(uint32_t, Ny)
@ -235,13 +235,13 @@ class LIB_EXPORT JKQTPImage: public JKQTPImageBase {
/** \brief class constructor, which generates an internal image object, by copying \a image */
JKQTPImage(double x, double y, double width, double height, const QImage& image, JKQtPlotter* parent);
virtual ~JKQTPImage();
virtual ~JKQTPImage() override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief copy an external image into an internally owned copy */
virtual void set_image(const QImage& image);
@ -265,8 +265,8 @@ class LIB_EXPORT JKQTPImage: public JKQTPImageBase {
QAction* actSaveImage;
QAction* actCopyImage;
public:
virtual void setParent(JKQtBasePlotter* parent);
virtual void set_title(const typedef_set_title& title);
virtual void setParent(JKQtBasePlotter* parent) override;
virtual void set_title(const typedef_set_title& title) override;
public slots:
void saveImagePlotAsImage(const QString &filename=QString(""), const QByteArray &outputFormat=QByteArray());
void copyImagePlotAsImage();
@ -291,9 +291,9 @@ class LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
JKQTPMathImage(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
virtual void setParent(JKQtBasePlotter* parent);
virtual void setParent(JKQtBasePlotter* parent) override;
/*! \brief get list with all available palettes */
static QStringList getPalettes() ;
@ -352,7 +352,7 @@ class LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
\note If you want to draw outside, then you'll also have to implement drawOutside()
*/
virtual void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace);
virtual void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace) override;
/*! \brief plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
@ -360,7 +360,7 @@ class LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
The four value supplied tell the method where to draw (inside one of the rectangles).
*/
virtual void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace);
virtual void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace) override;
/*! \brief returns a QImage, which contains the plaette drawn outside the plot. \a steps is the number of data-setps (and the size of the output image) used for the palette image. */
virtual QImage drawOutsidePalette(int steps=200);
@ -369,16 +369,16 @@ class LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
virtual QImage drawImage();
/** \brief determine min/max data value of the image */
virtual void getDataMinMax(double& imin, double& imax);
virtual void getDataMinMax(double& imin, double& imax) override;
/** \brief determine min/max data value of the image */
virtual void getModifierMinMax(double& imin, double& imax);
virtual void getModifierMinMax(double& imin, double& imax) override;
/** \brief return the value (raw data!) of the contained image at the given coordinate */
double getValueAt(double x, double y);
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
protected:
void initJKQTPMathImage();
@ -445,7 +445,7 @@ class LIB_EXPORT JKQTPMathImage: public JKQTPMathImageBase {
QAction* actSavePalette;
QAction* actCopyPalette;
public:
virtual void set_title(const typedef_set_title& title);
virtual void set_title(const typedef_set_title& title) override;
public slots:
void saveImagePlotAsImage(const QString &filename=QString(""), const QByteArray &outputFormat=QByteArray());
void copyImagePlotAsImage();
@ -483,9 +483,9 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
JKQTPRGBMathImage(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
virtual void setParent(JKQtBasePlotter* parent);
virtual void setParent(JKQtBasePlotter* parent) override;
@ -497,7 +497,7 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
/** \brief determine min/max data value of the image */
virtual void getDataMinMax(double& imin, double& imax);
virtual void getDataMinMax(double& imin, double& imax) override;
JKQTPGET_SET_MACRO(void*, dataG)
@ -548,7 +548,7 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
\note If you want to draw outside, then you'll also have to implement drawOutside()
*/
virtual void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace);
virtual void getOutsideSize(JKQTPEnhancedPainter& painter, int& leftSpace, int& rightSpace, int& topSpace, int& bottomSpace) override;
/*! \brief plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
@ -556,7 +556,7 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
The four value supplied tell the method where to draw (inside one of the rectangles).
*/
virtual void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace);
virtual void drawOutside(JKQTPEnhancedPainter& painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace) override;
/*! \brief return the plotted image only as a QImage */
virtual QImage drawImage();
@ -570,7 +570,7 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
double getValueAt(double x, double y, int channel=0) ;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
protected:
void initObject();
@ -647,7 +647,7 @@ class LIB_EXPORT JKQTPRGBMathImage: public JKQTPMathImageBase {
QAction* actSaveImage;
QAction* actCopyImage;
public:
virtual void set_title(const typedef_set_title& title);
virtual void set_title(const typedef_set_title& title) override;
public slots:
void saveImagePlotAsImage(const QString &filename=QString(""), const QByteArray &outputFormat=QByteArray());
void copyImagePlotAsImage();
@ -678,7 +678,7 @@ class LIB_EXPORT JKQTPColumnMathImage: public JKQTPMathImage {
JKQTPGET_SET_MACRO(int, modifierColumn)
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
@ -688,7 +688,7 @@ class LIB_EXPORT JKQTPColumnMathImage: public JKQTPMathImage {
/** \brief column containing the modifier image */
int modifierColumn;
virtual void ensureImageData();
virtual void ensureImageData() override;
};
@ -718,7 +718,7 @@ class LIB_EXPORT JKQTPColumnRGBMathImage: public JKQTPRGBMathImage {
JKQTPGET_SET_MACRO(int, imageBColumn)
JKQTPGET_SET_MACRO(int, modifierColumn)
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
protected:
/** \brief image column for R channel */
@ -730,7 +730,7 @@ class LIB_EXPORT JKQTPColumnRGBMathImage: public JKQTPRGBMathImage {
/** \brief column containing the modifier image */
int modifierColumn;
void ensureImageData();
void ensureImageData() override;
};
@ -751,15 +751,15 @@ class LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase {
JKQTPOverlayImage(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/*! \brief return the plotted image only as a QImage */
virtual QImage drawImage();
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
JKQTPGET_SET_MACRO(QColor, trueColor)
JKQTPGET_SET_MACRO(QColor, falseColor)
@ -788,8 +788,8 @@ class LIB_EXPORT JKQTPOverlayImage: public JKQTPImageBase {
QAction* actSaveImage;
QAction* actCopyImage;
public:
virtual void set_title(const typedef_set_title& title);
virtual void setParent(JKQtBasePlotter* parent);
virtual void set_title(const typedef_set_title& title) override;
virtual void setParent(JKQtBasePlotter* parent) override;
public slots:
void saveImagePlotAsImage(const QString &filename=QString(""), const QByteArray &outputFormat=QByteArray());
void copyImagePlotAsImage();
@ -816,9 +816,9 @@ class LIB_EXPORT JKQTPOverlayImageEnhanced: public JKQTPOverlayImage {
JKQTPOverlayImageEnhanced(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
JKQTPGET_SET_MACRO(JKQTPgraphSymbols, symbol)
JKQTPGET_SET_MACRO(double, symbolWidth)
@ -861,10 +861,10 @@ class LIB_EXPORT JKQTPColumnOverlayImageEnhanced: public JKQTPOverlayImageEnhanc
JKQTPGET_SET_MACRO(int, imageColumn)
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
protected:
@ -902,7 +902,7 @@ class LIB_EXPORT JKQTPContour: public JKQTPMathImage {
/** \brief class constructor */
JKQTPContour(double x, double y, double width, double height, void* data, uint32_t Nx, uint32_t Ny, JKQTPMathImageColorPalette palette, DataType datatype , JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief creates at nLevels contour levels linearly spaced between the data's minimum and maximum values */
void createContourLevels(int nLevels=3);
@ -942,7 +942,7 @@ class LIB_EXPORT JKQTPContour: public JKQTPMathImage {
QList<double> contourLevels;
// /** \brief indicates wether the contour levels are absolute values or relative to the maximum (max-min) */
bool relativeLevels;
virtual void ensureImageData();
virtual void ensureImageData() override;
private:
double value(int xIdx, int yIdx);

View File

@ -98,16 +98,16 @@ void JKQTPimpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
//double xold=-1;
//double yold=-1;
double x0=xAxis->x2p(baseline);
if (parent->getXAxis()->isLogAxis()) {
if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline);
else x0=xAxis->x2p(parent->getXAxis()->getMin());
double x0=transformX(baseline);
if (parent->get_xAxis()->isLogAxis()) {
if (baseline>0 && baseline>parent->get_xAxis()->getMin()) x0=transformX(baseline);
else x0=transformX(parent->get_xAxis()->getMin());
}
// double y0=yAxis->x2p(baseline);
// if (parent->getYAxis()->isLogAxis()) {
// y0=yAxis->x2p(parent->getYAxis()->getMin());
// if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline);
// else y0=yAxis->x2p(parent->getYAxis()->getMin());
// double y0=transformY(baseline);
// if (parent->get_yAxis()->isLogAxis()) {
// y0=transformY(parent->get_yAxis()->getMin());
// if (baseline>0 && baseline>parent->get_yAxis()->getMin()) y0=transformY(baseline);
// else y0=transformY(parent->get_yAxis()->getMin());
// }
//bool first=false;
QVector<QLineF> lines;
@ -117,8 +117,8 @@ void JKQTPimpulsesHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv)) {
double x=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
double x=transformX(xv);
double y=transformY(yv);
lines.append(QLineF(x0, y, x, y));
@ -213,16 +213,16 @@ void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
//double xold=-1;
//double yold=-1;
//bool first=false;
// double x0=xAxis->x2p(baseline);
// if (parent->getXAxis()->isLogAxis()) {
// if (baseline>0 && baseline>parent->getXAxis()->getMin()) x0=xAxis->x2p(baseline);
// else x0=xAxis->x2p(parent->getXAxis()->getMin());
// double x0=transformX(baseline);
// if (parent->get_xAxis()->isLogAxis()) {
// if (baseline>0 && baseline>parent->get_xAxis()->getMin()) x0=transformX(baseline);
// else x0=transformX(parent->get_xAxis()->getMin());
// }
double y0=yAxis->x2p(baseline);
if (parent->getYAxis()->isLogAxis()) {
y0=yAxis->x2p(parent->getYAxis()->getMin());
if (baseline>0 && baseline>parent->getYAxis()->getMin()) y0=yAxis->x2p(baseline);
else y0=yAxis->x2p(parent->getYAxis()->getMin());
double y0=transformY(baseline);
if (parent->get_yAxis()->isLogAxis()) {
y0=transformY(parent->get_yAxis()->getMin());
if (baseline>0 && baseline>parent->get_yAxis()->getMin()) y0=transformY(baseline);
else y0=transformY(parent->get_yAxis()->getMin());
}
QVector<QLineF> lines;
intSortData();
@ -231,8 +231,8 @@ void JKQTPimpulsesVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
double yv=datastore->get(static_cast<size_t>(yColumn),static_cast<size_t>(i));
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(yv) ) {
double x=xAxis->x2p(xv);
double y=yAxis->x2p(yv);
double x=transformX(xv);
double y=transformY(yv);
lines.append(QLineF(x, y0, x, y));
@ -275,15 +275,15 @@ JKQTPimpulsesHorizontalErrorGraph::JKQTPimpulsesHorizontalErrorGraph(JKQtPlotter
setErrorColorFromGraphColor(color);
}
bool JKQTPimpulsesHorizontalErrorGraph::usesColumn(int c)
bool JKQTPimpulsesHorizontalErrorGraph::usesColumn(int c) const
{
return JKQTPimpulsesHorizontalGraph::usesColumn(c)|| JKQTPxGraphErrors::errorUsesColumn(c);
}
void JKQTPimpulsesHorizontalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
{
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
}
JKQTPimpulsesVerticalErrorGraph::JKQTPimpulsesVerticalErrorGraph(JKQtBasePlotter *parent):
@ -298,14 +298,14 @@ JKQTPimpulsesVerticalErrorGraph::JKQTPimpulsesVerticalErrorGraph(JKQtPlotter *pa
setErrorColorFromGraphColor(color);
}
bool JKQTPimpulsesVerticalErrorGraph::usesColumn(int c)
bool JKQTPimpulsesVerticalErrorGraph::usesColumn(int c) const
{
return JKQTPimpulsesVerticalGraph::usesColumn(c)|| JKQTPyGraphErrors::errorUsesColumn(c);
}
void JKQTPimpulsesVerticalErrorGraph::drawErrorsAfter(JKQTPEnhancedPainter &painter)
{
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, xAxis, yAxis, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
if (sortData==JKQTPxyGraph::Unsorted) plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end);
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, datarange_start, datarange_end, 0, 0, &sortedIndices);
}

View File

@ -40,11 +40,11 @@ class LIB_EXPORT JKQTPimpulsesHorizontalGraph: public JKQTPxyGraph {
JKQTPimpulsesHorizontalGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
/** \brief returns the color to be used for the key label */
virtual QColor getKeyLabelColor();
virtual QColor getKeyLabelColor() override;
JKQTPGET_SET_MACRO(QColor, color)
JKQTPGET_SET_MACRO(double, lineWidth)
@ -79,11 +79,11 @@ class LIB_EXPORT JKQTPimpulsesHorizontalErrorGraph: public JKQTPimpulsesHorizont
JKQTPimpulsesHorizontalErrorGraph(JKQtBasePlotter* parent=nullptr);
JKQTPimpulsesHorizontalErrorGraph(JKQtPlotter* parent);
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) ;
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override ;
};
@ -104,7 +104,7 @@ class LIB_EXPORT JKQTPimpulsesVerticalGraph: public JKQTPimpulsesHorizontalGraph
JKQTPimpulsesVerticalGraph(JKQtPlotter* parent);
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
};
@ -122,11 +122,11 @@ class LIB_EXPORT JKQTPimpulsesVerticalErrorGraph: public JKQTPimpulsesVerticalGr
/** \brief class constructor */
JKQTPimpulsesVerticalErrorGraph(JKQtPlotter* parent);
/** \copydoc JKQTPgraph::usesColumn() */
virtual bool usesColumn(int c);
virtual bool usesColumn(int c) const override;
protected:
/** \brief this function is used to plot error inidcators before plotting the graphs. */
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) ;
virtual void drawErrorsAfter(JKQTPEnhancedPainter& painter) override ;
};

View File

@ -55,7 +55,7 @@ class LIB_EXPORT JKQTPxParsedFunctionLineGraph: public JKQTPxFunctionLineGraph {
/** \brief class destructor */
virtual ~JKQTPxParsedFunctionLineGraph();
virtual ~JKQTPxParsedFunctionLineGraph() override;
JKQTPGET_SET_MACRO(QString, function)
@ -86,10 +86,10 @@ class LIB_EXPORT JKQTPxParsedFunctionLineGraph: public JKQTPxFunctionLineGraph {
using JKQTPxFunctionLineGraph::set_errorParams;
/** \brief fill the data array with data from the function plotFunction */
virtual void createPlotData(bool collectParams=true);
virtual void createPlotData(bool collectParams=true) override;
/** \brief implements the actual plot function */
static double JKQTPxParsedFunctionLineGraphFunction(double x, void *data);
static double JKQTPxParsedFunctionLineGraphFunction(double x, void *data) ;
};
@ -115,7 +115,7 @@ class LIB_EXPORT JKQTPyParsedFunctionLineGraph: public JKQTPyFunctionLineGraph {
/** \brief class destructor */
virtual ~JKQTPyParsedFunctionLineGraph();
virtual ~JKQTPyParsedFunctionLineGraph() override;
JKQTPGET_SET_MACRO(QString, function)
@ -146,7 +146,7 @@ class LIB_EXPORT JKQTPyParsedFunctionLineGraph: public JKQTPyFunctionLineGraph {
using JKQTPxFunctionLineGraph::set_errorParams;
/** \brief fill the data array with data from the function plotFunction */
virtual void createPlotData(bool collectParams=true);
virtual void createPlotData(bool collectParams=true) override;
/** \brief implements the actual plot function */
static double JKQTPyParsedFunctionLineGraphFunction(double x, void *data);
};

View File

@ -68,18 +68,18 @@ class LIB_EXPORT JKQTPPeakStreamGraph: public JKQTPsingleColumnGraph {
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero);
virtual bool getXMinMax(double& minx, double& maxx, double& smallestGreaterZero) override;
/** \brief get the maximum and minimum y-value of the graph
*
* The result is given in the two parameters which are call-by-reference parameters!
*/
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero);
virtual bool getYMinMax(double& miny, double& maxy, double& smallestGreaterZero) override;
/** \brief plots the graph to the plotter object specified as parent */
virtual void draw(JKQTPEnhancedPainter& painter);
virtual void draw(JKQTPEnhancedPainter& painter) override;
/** \brief plots a key marker inside the specified rectangle \a rect */
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
JKQTPGET_SET_MACRO(double, baseline)
JKQTPGET_SET_MACRO(double, peakHeight)

View File

@ -33,6 +33,7 @@
#include <QtGui>
#endif
#include "jkqtplotter/jkqtplotter.h"
#include "jkqtplotter/jkqtpgraphs.h"
#define JKQTP_RESIZE_DELAY 100

View File

@ -70,7 +70,7 @@ LIB_EXPORT void initJKQtPlotterResources();
*
* This class is an implementation of JKQtPlotterBase. It uses the tools from this base class
* to display function graphs that use the internal datastore as data source. You can add graphs
* to this component which are described by a JKQTPgraph struct.
* to this component which are described by a JKQTPplotElement struct.
*/
class LIB_EXPORT JKQtPlotter: public QWidget {
Q_OBJECT
@ -119,12 +119,12 @@ class LIB_EXPORT JKQtPlotter: public QWidget {
toolbarIconSize=value;
QSize s=QSize(toolbarIconSize, toolbarIconSize);
toolbar->setIconSize(s);
};
}
/** \brief get the width/height of the icons in the toolbar in pixels */
inline int get_toolbarIconSize() {
return toolbarIconSize;
};
}
/** \brief returns the class internally used for plotting */
JKQtBasePlotter* get_plotter() const { return plotter; }
@ -203,32 +203,32 @@ class LIB_EXPORT JKQtPlotter: public QWidget {
inline void set_emitSignals(bool sig) { plotter->set_emitSignals(sig); }
inline bool get_emitSignals() { return plotter->get_emitSignals(); }
JKQTPGetMacro(bool, doDrawing);
JKQTPGetMacro(bool, doDrawing)
void set_doDrawing(bool enable);
bool get_zoomByMouseRectangle() const;
void set_zoomByMouseRectangle(bool zomByrectangle);
//GET_SET_MACRO(bool, zoomByDoubleAndRightMouseClick);
JKQTPGET_SET_MACRO(RightMouseButtonAction, rightMouseButtonAction);
JKQTPGET_SET_MACRO(LeftDoubleClickAction, leftDoubleClickAction);
JKQTPGET_MACRO(QMenu*, menuSpecialContextMenu);
JKQTPGET_SET_MACRO(RightMouseButtonAction, rightMouseButtonAction)
JKQTPGET_SET_MACRO(LeftDoubleClickAction, leftDoubleClickAction)
JKQTPGET_MACRO(QMenu*, menuSpecialContextMenu)
void set_menuSpecialContextMenu(QMenu* menu);
JKQTPGET_SET_MACRO(bool, zoomByMouseWheel);
JKQTPGET_SET_MACRO(bool, zoomByMouseWheel)
JKQTPGetMacro(double, mouseContextX)
JKQTPGetMacro(double, mouseContextY)
JKQTPGetMacro(int, mouseLastClickX)
JKQTPGetMacro(int, mouseLastClickY)
inline JKQTPhorizontalAxis* getXAxis() { return plotter->getXAxis(); }
inline JKQTPverticalAxis* getYAxis() { return plotter->getYAxis(); }
inline JKQTPhorizontalAxis* get_xAxis() { return plotter->get_xAxis(); }
inline JKQTPverticalAxis* get_yAxis() { return plotter->get_yAxis(); }
inline const JKQTPhorizontalAxis* get_xAxis() const { return plotter->get_xAxis(); }
inline const JKQTPverticalAxis* get_yAxis() const { return plotter->get_yAxis(); }
/** \brief returns description of i'th graph */
inline JKQTPgraph* getGraph(size_t i) { return plotter->getGraph(i); }
inline JKQTPplotElement* getGraph(size_t i) { return plotter->getGraph(i); }
/** \brief returns the number of graphs */
inline size_t getGraphCount() { return plotter->getGraphCount(); }
@ -237,10 +237,10 @@ class LIB_EXPORT JKQtPlotter: public QWidget {
inline void deleteGraph(size_t i, bool deletegraph=true) { plotter->deleteGraph(i, deletegraph); }
/** \brief returns \c true, if the given graph is present */
inline bool containsGraph(JKQTPgraph* gr) { return plotter->containsGraph(gr); }
inline bool containsGraph(JKQTPplotElement* gr) { return plotter->containsGraph(gr); }
/** \brief remove the given graph, if it is contained */
inline void deleteGraph(JKQTPgraph* gr, bool deletegraph=true) { plotter->deleteGraph(gr, deletegraph); };
inline void deleteGraph(JKQTPplotElement* gr, bool deletegraph=true) { plotter->deleteGraph(gr, deletegraph); };
/** \brief remove all plots
*
@ -249,15 +249,15 @@ class LIB_EXPORT JKQtPlotter: public QWidget {
inline void clearGraphs(bool deleteGraphs=true) { plotter->clearGraphs(deleteGraphs); }
/** \brief add a new graph, returns it's position in the graphs list */
inline size_t addGraph(JKQTPgraph* gr) { return plotter->addGraph(gr); }
inline size_t addGraph(JKQTPplotElement* gr) { return plotter->addGraph(gr); }
/** \brief move the given graph to the top, or add it, if it is not yet contained */
inline size_t moveGraphTop(JKQTPgraph* gr) { return plotter->moveGraphTop(gr); }
inline size_t moveGraphTop(JKQTPplotElement* gr) { return plotter->moveGraphTop(gr); }
/** \brief move the given graph to the top, or add it, if it is not yet contained */
inline size_t moveGraphBottom(JKQTPgraph* gr) { return plotter->moveGraphBottom(gr); }
inline size_t moveGraphBottom(JKQTPplotElement* gr) { return plotter->moveGraphBottom(gr); }
/** \brief add a new graphs from a QVector<JKQTPgraph*>, QList<JKQTPgraph*>, std::vector<JKQTPgraph*> ... or any standard-iterateable container with JKQTPgraph*-items */
/** \brief add a new graphs from a QVector<JKQTPplotElement*>, QList<JKQTPplotElement*>, std::vector<JKQTPplotElement*> ... or any standard-iterateable container with JKQTPplotElement*-items */
template <class TJKQTPgraphContainer>
inline void addGraphs(const TJKQTPgraphContainer& gr) { plotter->addGraphs(gr); }

View File

@ -35,9 +35,10 @@
#include "jkqtplotter/jkqtpbaseplotter.h"
#include "jkqtplottertools/jkqtp_imexport.h"
#include "jkqtplotter/jkqtpgraphsimage.h"
#include <QComboBox>
#include "jkqtplottertools/jkqtpimagetools.h"
#include "jkqtplottertools/jkqtptools.h"

View File

@ -26,6 +26,7 @@
#include "jkqtplottergui/jkqtpgraphsmodel.h"
#include "jkqtplotter/jkqtpbaseplotter.h"
#include "jkqtplottertools/jkqtptools.h"
#include "jkqtplotter/jkqtpgraphs.h"
#include <QImage>

View File

@ -44,7 +44,7 @@ class LIB_EXPORT JKQTPEnhancedPainter : public QPainter {
public:
JKQTPEnhancedPainter(QPaintDevice* device);
JKQTPEnhancedPainter();
virtual ~JKQTPEnhancedPainter();
virtual ~JKQTPEnhancedPainter() ;
//void drawPath(const QPainterPath &path);

View File

@ -1828,7 +1828,7 @@ JKQTPColorPaletteTools::JKQTPColorPaletteTools(JKQtBasePlotter *parent)
{
cbParent=parent;
colorBarRightAxis=new JKQTPverticalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarRightAxis->loadSettings(parent->getYAxis());
if (parent) colorBarRightAxis->loadSettings(parent->get_yAxis());
colorBarRightAxis->set_drawMode1(JKQTPCADMline);
colorBarRightAxis->set_drawMode2(JKQTPCADMcomplete);
colorBarRightAxis->set_axisLabel("");
@ -1838,7 +1838,7 @@ JKQTPColorPaletteTools::JKQTPColorPaletteTools(JKQtBasePlotter *parent)
colorBarRightAxis->set_tickOutsideLength(0);
colorBarRightAxis->set_minorTickOutsideLength(0);
colorBarTopAxis=new JKQTPhorizontalIndependentAxis(0, 100, 0, 100, parent);
if (parent) colorBarTopAxis->loadSettings(parent->getXAxis());
if (parent) colorBarTopAxis->loadSettings(parent->get_xAxis());
colorBarTopAxis->set_drawMode1(JKQTPCADMline);
colorBarTopAxis->set_drawMode2(JKQTPCADMcomplete);
colorBarTopAxis->set_axisLabel("");

View File

@ -31,7 +31,7 @@
/******************************************************************************************
* default-Funktionen für den Parser
* default-Funktionen f<EFBFBD>r den Parser
******************************************************************************************/
JKQTPMathParser::jkmpResult fFloatToStr(JKQTPMathParser::jkmpResult* params, unsigned char n, JKQTPMathParser* p){
@ -761,7 +761,7 @@ JKQTPMathParser::~JKQTPMathParser()
clearVariables();
}
// fügt eine Variable hinzu. Der Speicher wird extern verwaltet
// f<EFBFBD>gt eine Variable hinzu. Der Speicher wird extern verwaltet
void JKQTPMathParser::addVariableDouble(std::string name, double* v)
{
name=strip(name);
@ -901,7 +901,7 @@ void JKQTPMathParser::clearVariables(){
}
}
// gibt den aktuellen Wert einer Variablen zurück
// gibt den aktuellen Wert einer Variablen zur<EFBFBD>ck
JKQTPMathParser::jkmpResult JKQTPMathParser::getVariable(std::string name)
{
if (variableExists(name)) {
@ -1416,7 +1416,7 @@ std::string JKQTPMathParser::readDelim(char delimiter){
/******************************************************************************************
* Klassenhierarchie, um Ausdrücke darzustellen
* Klassenhierarchie, um Ausdr<EFBFBD>cke darzustellen
******************************************************************************************/
JKQTPMathParser::jkmpUnaryNode::jkmpUnaryNode(char op, JKQTPMathParser::jkmpNode* c, JKQTPMathParser* p, JKQTPMathParser::jkmpNode* par){
child=c;
@ -1426,6 +1426,8 @@ JKQTPMathParser::jkmpUnaryNode::jkmpUnaryNode(char op, JKQTPMathParser::jkmpNode
operation=op;
}
JKQTPMathParser::jkmpUnaryNode::~jkmpUnaryNode() {delete child;}
JKQTPMathParser::jkmpResult JKQTPMathParser::jkmpUnaryNode::evaluate(){
JKQTPMathParser::jkmpResult c=child->evaluate();
JKQTPMathParser::jkmpResult res;
@ -1466,6 +1468,8 @@ JKQTPMathParser::jkmpBinaryArithmeticNode::jkmpBinaryArithmeticNode(char op, JKQ
operation=op;
}
JKQTPMathParser::jkmpBinaryArithmeticNode::~jkmpBinaryArithmeticNode() { delete left; delete right;}
JKQTPMathParser::jkmpResult JKQTPMathParser::jkmpBinaryArithmeticNode::evaluate(){
JKQTPMathParser::jkmpResult l=left->evaluate();
JKQTPMathParser::jkmpResult r=right->evaluate();
@ -1563,6 +1567,8 @@ JKQTPMathParser::jkmpCompareNode::jkmpCompareNode(char op, JKQTPMathParser::jkmp
operation=op;
}
JKQTPMathParser::jkmpCompareNode::~jkmpCompareNode() { delete left; delete right;}
JKQTPMathParser::jkmpResult JKQTPMathParser::jkmpCompareNode::evaluate(){
JKQTPMathParser::jkmpResult l=left->evaluate();
JKQTPMathParser::jkmpResult r=right->evaluate();
@ -1718,7 +1724,7 @@ JKQTPMathParser::jkmpResult JKQTPMathParser::jkmpBinaryBoolNode::evaluate(){
}
JKQTPMathParser::jkmpBinaryBoolNode::~jkmpBinaryBoolNode() { delete left; delete right;}
JKQTPMathParser::jkmpVariableNode::jkmpVariableNode(std::string name, JKQTPMathParser* p, JKQTPMathParser::jkmpNode* par) {
var=name;
@ -1752,8 +1758,10 @@ JKQTPMathParser::jkmpResult JKQTPMathParser::jkmpNodeList::evaluate(){
return res;
}
JKQTPMathParser::jkmpNodeList::jkmpNodeList(JKQTPMathParser *p) { setParser(p); setParent(nullptr); }
JKQTPMathParser::jkmpNodeList::~jkmpNodeList() {
/* if (getCount()>0) {
/* if (getCount()>0) {
for (int i=0; i<getCount(); i++) {
delete list[i];
}
@ -1762,6 +1770,8 @@ JKQTPMathParser::jkmpNodeList::~jkmpNodeList() {
}
JKQTPMathParser::jkmpVariableAssignNode::~jkmpVariableAssignNode() {delete child;}
JKQTPMathParser::jkmpVariableAssignNode::jkmpVariableAssignNode(std::string var, JKQTPMathParser::jkmpNode* c, JKQTPMathParser* p, JKQTPMathParser::jkmpNode* par){
child=c;
child->setParent(this);
@ -1851,3 +1861,15 @@ std::string JKQTPMathParser::getArgCVParam(std::string name, std::string default
}
return defaultResult;
}
JKQTPMathParser::jkmpNode::~jkmpNode() {}
JKQTPMathParser::jkmpConstantNode::jkmpConstantNode(JKQTPMathParser::jkmpResult d, JKQTPMathParser *p, JKQTPMathParser::jkmpNode *par) { data=d; setParser(p); setParent(par); }
JKQTPMathParser::jkmpResult JKQTPMathParser::jkmpConstantNode::evaluate() { return data; }
JKQTPMathParser::jkmpException::~jkmpException() { }
const char *JKQTPMathParser::jkmpException::what() const noexcept {
return getMessage().c_str();
}

View File

@ -424,22 +424,22 @@ class JKQTPMathParser
jkmpNode* parent; /*!< \brief points to the parent node */
public:
/** \brief virtual class destructor */
virtual ~jkmpNode() {};
virtual ~jkmpNode();
/** \brief evaluate this node */
virtual jkmpResult evaluate()=0;
/** \brief return a pointer to the jkMathParser */
inline JKQTPMathParser* getParser(){ return parser; };
inline JKQTPMathParser* getParser(){ return parser; }
/** \brief set the jkMathParser */
inline void setParser(JKQTPMathParser* mp){ parser=mp; };
inline void setParser(JKQTPMathParser* mp){ parser=mp; }
/** \brief returns a pointer to the parent node */
inline jkmpNode* getParent(){ return parent; };
inline jkmpNode* getParent(){ return parent; }
/** \brief sets the parent node */
inline void setParent(jkmpNode* par) { parent=par; };
inline void setParent(jkmpNode* par) { parent=par; }
};
@ -462,10 +462,10 @@ class JKQTPMathParser
jkmpBinaryArithmeticNode(char op, jkmpNode* l, jkmpNode* r, JKQTPMathParser* p, jkmpNode* par);
/** \brief standard destructor, also destroy the children (recursively) */
~jkmpBinaryArithmeticNode() { delete left; delete right;};
virtual ~jkmpBinaryArithmeticNode() override;
/** \brief evaluate this node */
virtual jkmpResult evaluate();
virtual jkmpResult evaluate() override;
};
/**
@ -486,10 +486,10 @@ class JKQTPMathParser
jkmpBinaryBoolNode(char op, jkmpNode* l, jkmpNode* r, JKQTPMathParser* p, jkmpNode* par);
/** \brief standard destructor, also destroy the children (recursively) */
~jkmpBinaryBoolNode() { delete left; delete right;};
virtual ~jkmpBinaryBoolNode() override;
/** \brief evaluate this node */
virtual jkmpResult evaluate();
virtual jkmpResult evaluate() override;
};
/**
@ -510,10 +510,10 @@ class JKQTPMathParser
jkmpCompareNode(char op, jkmpNode* l, jkmpNode* r, JKQTPMathParser* p, jkmpNode* par);
/** \brief standard destructor, also destroy the children (recursively) */
~jkmpCompareNode () { delete left; delete right;};
virtual ~jkmpCompareNode () override;
/** \brief evaluate this node */
virtual jkmpResult evaluate();
virtual jkmpResult evaluate() override;
};
/**
@ -533,10 +533,10 @@ class JKQTPMathParser
jkmpUnaryNode(char op, jkmpNode* c, JKQTPMathParser* p, jkmpNode* par);
/** \brief standard destructor, also destroy the children (recursively) */
~jkmpUnaryNode() {delete child;};
virtual ~jkmpUnaryNode() override;
/** \brief evaluate this node */
virtual jkmpResult evaluate();
virtual jkmpResult evaluate() override;
};
/**
@ -549,7 +549,7 @@ class JKQTPMathParser
//char operation;
public:
/** \brief standard destructor, also destroy the children (recursively) */
~jkmpVariableAssignNode() {delete child;};
virtual ~jkmpVariableAssignNode() override;
/** \brief constructor for a jkmpVariableAssignNode
* \param var name of the variable to assign to
@ -560,7 +560,7 @@ class JKQTPMathParser
jkmpVariableAssignNode(std::string var, jkmpNode* c, JKQTPMathParser* p, jkmpNode* par);
/** \brief evaluate this node */
virtual jkmpResult evaluate();
virtual jkmpResult evaluate() override;
};
/**
@ -575,10 +575,10 @@ class JKQTPMathParser
* \param p a pointer to a jkMathParser object
* \param par a pointer to the parent node
*/
jkmpConstantNode(jkmpResult d, JKQTPMathParser* p, jkmpNode* par) { data=d; setParser(p); setParent(par); };
jkmpConstantNode(jkmpResult d, JKQTPMathParser* p, jkmpNode* par);
/** \brief evaluate this node */
virtual jkmpResult evaluate() { return data; };
virtual jkmpResult evaluate() override;;
};
/**
@ -596,7 +596,7 @@ class JKQTPMathParser
jkmpVariableNode(std::string name, JKQTPMathParser* p, jkmpNode* par);
/** \brief evaluate this node */
virtual jkmpResult evaluate();
virtual jkmpResult evaluate() override;
};
/**
@ -625,10 +625,10 @@ class JKQTPMathParser
jkmpFunctionNode(std::string name, jkmpNode** c, unsigned char num, JKQTPMathParser* p, jkmpNode* par);
/** \brief standard destructor, also destroy the children (recursively) */
~jkmpFunctionNode();
virtual ~jkmpFunctionNode() override;
/** \brief evaluate this node */
virtual jkmpResult evaluate();
virtual jkmpResult evaluate() override;
};
/**
@ -643,19 +643,19 @@ class JKQTPMathParser
/** \brief constructor for a jkmpNodeList
* \param p a pointer to a jkMathParser object
*/
jkmpNodeList(JKQTPMathParser* p) { setParser(p); setParent(nullptr); };
jkmpNodeList(JKQTPMathParser* p);
/** \brief standard destructor, also destroy the children (recursively) */
~jkmpNodeList();
virtual ~jkmpNodeList() override;
/** \brief add a jkmpNode n to the list */
void add(jkmpNode* n);
/** \brief evaluate the node */
virtual jkmpResult evaluate();
virtual jkmpResult evaluate() override;
/** \brief get the number of nodes in the list */
int getCount() {return list.size();};
inline int getCount() {return list.size();};
};
/*@}*/
@ -684,25 +684,25 @@ class JKQTPMathParser
std::string errormessage;
public:
/** \brief class constructors */
jkmpException() throw() {
inline jkmpException() {
errormessage="unknown error";
};
}
/** \brief constructor with supplied error message */
jkmpException(std::string msg) throw() {
inline jkmpException(std::string msg) {
errormessage=msg;
};
}
/** \brief class destructors */
~jkmpException() throw() { };
virtual ~jkmpException() override;
/** \brief returns the assigned errormessage */
inline std::string getMessage() const {
return errormessage;
};
}
/** \brief returns the error description as C string */
virtual const char* what() const throw() { return getMessage().c_str(); };
virtual const char* what() const throw();
};
/** \brief type for a custom error handler. This an alternative error handling ... may be used together with Matlab in a MEX file! */
@ -716,7 +716,7 @@ class JKQTPMathParser
} else {
throw jkmpException(st);
}
};
}
private:
/** \brief if this is nullptr then an exception may be thrown otherwise this should point to an error handler that will be called. */
@ -726,12 +726,12 @@ class JKQTPMathParser
/** \brief activate error handling by use of an exception function */
inline void set_exception_function(jkmpexceptionf exception_function) {
jkmathparser_exception_function=exception_function;
};
}
/** \brief deactivate error handling by use of an exception function */
inline void reset_exception_function() {
jkmathparser_exception_function=nullptr;
};
}
/*@}*/
@ -893,7 +893,7 @@ class JKQTPMathParser
if (tempvariables[i].name==name) return true;
}
return false;
};
}
/**\brief tests whether a variable exists */
inline bool variableExists(std::string name){ return tempvariableExists(name)||(variables.find(name)!=variables.end()); };
@ -910,7 +910,7 @@ class JKQTPMathParser
void deleteVariable(std::string name);
/**\brief clears the list of internal functions*/
inline void clearFunctions() {functions.clear();};
inline void clearFunctions() {functions.clear();}
/**\brief registers standard variables*/
void addStandardVariables();

View File

@ -22,8 +22,8 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
plotBarchart->get_plotter()->set_plotLabel(tr("\\textbf{bar charts}"));
plotBarchart->setObjectName("plotBarchart");
plotBarchart->get_plotter()->set_userSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plot_peaks/");
plotBarchart->get_plotter()->getXAxis()->set_labelType(JKQTPCALTdate);
plotBarchart->get_plotter()->getXAxis()->set_tickDateFormat("dd. MMM yyyy");
plotBarchart->get_plotter()->get_xAxis()->set_labelType(JKQTPCALTdate);
plotBarchart->get_plotter()->get_xAxis()->set_tickDateFormat("dd. MMM yyyy");
barchartLayout->addWidget(plotBarchart);
@ -134,22 +134,22 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
void TestWidgetBarcharts::setBarchartLogLog(bool checked)
{
plotBarchart->getXAxis()->set_logAxis(checked);
plotBarchart->getYAxis()->set_logAxis(checked);
plotBarchart->get_xAxis()->set_logAxis(checked);
plotBarchart->get_yAxis()->set_logAxis(checked);
plotBarchart->zoomToFit();
plotBarchart2->getXAxis()->set_logAxis(checked);
plotBarchart2->getYAxis()->set_logAxis(checked);
plotBarchart2->get_xAxis()->set_logAxis(checked);
plotBarchart2->get_yAxis()->set_logAxis(checked);
plotBarchart2->zoomToFit();
}
void TestWidgetBarcharts::setBarchartAngele(int angle)
{
plotBarchart->getXAxis()->set_tickLabelAngle(angle);
plotBarchart->getXAxis()->set_drawMode2(JKQTPCADMcomplete);
plotBarchart->get_xAxis()->set_tickLabelAngle(angle);
plotBarchart->get_xAxis()->set_drawMode2(JKQTPCADMcomplete);
}
void TestWidgetBarcharts::setBarchartAngele2(int angle)
{
plotBarchart->getYAxis()->set_tickLabelAngle(angle);
plotBarchart->getYAxis()->set_drawMode2(JKQTPCADMcomplete);
plotBarchart->get_yAxis()->set_tickLabelAngle(angle);
plotBarchart->get_yAxis()->set_drawMode2(JKQTPCADMcomplete);
}

View File

@ -56,8 +56,8 @@ TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
plotDensity->get_plotter()->clearGraphs(true);
ds->clear();
plotDensity->setGrid(false);
plotDensity->get_plotter()->getXAxis()->set_axisLabel("X");
plotDensity->get_plotter()->getYAxis()->set_axisLabel("Y");
plotDensity->get_plotter()->get_xAxis()->set_axisLabel("X");
plotDensity->get_plotter()->get_yAxis()->set_axisLabel("Y");
size_t colHist2D=ds->addCopiedImageAsColumn(histAlex.data(), histAlexNx, histAlexNy, tr("2Dhist"));
// size_t colContour=plotContour->getDatastore()->addCopiedImageAsColumnTranspose(histAlex.data(), histAlexNx, histAlexNy, tr("2Dhist"));

View File

@ -24,7 +24,7 @@ TestWidgetEmptyPlot::TestWidgetEmptyPlot(QWidget *parent) :
efunc->set_xColumn(plotEmpty->getDatastore()->addCopiedColumn(xef, NEMPTY, "x"));
efunc->set_yColumn(plotEmpty->getDatastore()->addCopiedColumn(efy, NEMPTY, "y"));
plotEmpty->addGraph(efunc);
plotEmpty->getYAxis()->set_logAxis(true);
plotEmpty->get_yAxis()->set_logAxis(true);
plotEmpty->zoomToFit();
plotEmpty->setY(0,0);

View File

@ -69,11 +69,11 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFuncE(QString)));
QCheckBox* chkFLogX=new QCheckBox(tr("x-axis: log-scale"));
chkFLogX->setChecked(false);
connect(chkFLogX, SIGNAL(toggled(bool)), plotFuncPlt->getXAxis(), SLOT(set_logAxis(bool)));
connect(chkFLogX, SIGNAL(toggled(bool)), plotFuncPlt->get_xAxis(), SLOT(set_logAxis(bool)));
plotFuncLayout->addWidget(chkFLogX);
QCheckBox* chkFLogY=new QCheckBox(tr("y-axis: log-scale"));
chkFLogY->setChecked(false);
connect(chkFLogY, SIGNAL(toggled(bool)), plotFuncPlt->getYAxis(), SLOT(set_logAxis(bool)));
connect(chkFLogY, SIGNAL(toggled(bool)), plotFuncPlt->get_yAxis(), SLOT(set_logAxis(bool)));
plotFuncLayout->addWidget(chkFLogY);

View File

@ -20,10 +20,10 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
plotGeo->setObjectName("plotGeo");
layout1->addWidget(plotGeo);
plotGeo->setXY(0,1,0,1);
plotGeo->get_plotter()->getXAxis()->set_axisLabel("$x$ [mm]");
plotGeo->get_plotter()->getYAxis()->set_axisLabel("$y$ [mm]");
/*plotGeo->get_plotter()->getXAxis()->set_linkedAxis(plotGeo->get_plotter()->getYAxis());
plotGeo->get_plotter()->getXAxis()->set_changeWidthToAspectRatio(true);*/
plotGeo->get_plotter()->get_xAxis()->set_axisLabel("$x$ [mm]");
plotGeo->get_plotter()->get_yAxis()->set_axisLabel("$y$ [mm]");
/*plotGeo->get_plotter()->get_xAxis()->set_linkedAxis(plotGeo->get_plotter()->get_yAxis());
plotGeo->get_plotter()->get_xAxis()->set_changeWidthToAspectRatio(true);*/
plotGeo->get_plotter()->set_maintainAspectRatio(true);
plotGeo->get_plotter()->set_aspectRatio(1);
plotGeo->get_plotter()->set_maintainAxisAspectRatio(true);

View File

@ -52,17 +52,17 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
plot->get_plotter()->addGridPrintingPlotter(0,1,plotBot->get_plotter());
plot->get_plotter()->addGridPrintingPlotter(0,2,plotBot2->get_plotter());
plot->get_plotter()->getXAxis()->set_axisLabel("$x$ axis with greek letters $\\sqrt{\\alpha\\cdot\\beta}$");
plot->get_plotter()->getYAxis()->set_axisLabel("$y$-axis label $f(x)=\\sin\\left(x^2\\right)$ [unit]");
plot->get_plotter()->get_xAxis()->set_axisLabel("$x$ axis with greek letters $\\sqrt{\\alpha\\cdot\\beta}$");
plot->get_plotter()->get_yAxis()->set_axisLabel("$y$-axis label $f(x)=\\sin\\left(x^2\\right)$ [unit]");
plotBot->get_plotter()->getXAxis()->set_axisLabel(plot->get_plotter()->getXAxis()->get_axisLabel());
plotBot->get_plotter()->getYAxis()->set_axisLabel("$y$-axis 2 [unit]");
plotBot2->get_plotter()->getXAxis()->set_axisLabel(plot->get_plotter()->getXAxis()->get_axisLabel());
plotBot2->get_plotter()->getYAxis()->set_axisLabel("$y$-axis 3 [unit]");
plotBot2->get_plotter()->getXAxis()->addAxisTickLabel(2.5, "tick 1");
plotBot2->get_plotter()->getXAxis()->addAxisTickLabel(7.5, "tick 2");
plotBot2->get_plotter()->getXAxis()->addAxisTickLabel(12.5, "tick 3");
plotBot2->get_plotter()->getXAxis()->addAxisTickLabel(17.5, "tick 4");
plotBot->get_plotter()->get_xAxis()->set_axisLabel(plot->get_plotter()->get_xAxis()->get_axisLabel());
plotBot->get_plotter()->get_yAxis()->set_axisLabel("$y$-axis 2 [unit]");
plotBot2->get_plotter()->get_xAxis()->set_axisLabel(plot->get_plotter()->get_xAxis()->get_axisLabel());
plotBot2->get_plotter()->get_yAxis()->set_axisLabel("$y$-axis 3 [unit]");
plotBot2->get_plotter()->get_xAxis()->addAxisTickLabel(2.5, "tick 1");
plotBot2->get_plotter()->get_xAxis()->addAxisTickLabel(7.5, "tick 2");
plotBot2->get_plotter()->get_xAxis()->addAxisTickLabel(12.5, "tick 3");
plotBot2->get_plotter()->get_xAxis()->addAxisTickLabel(17.5, "tick 4");
for (unsigned int i=0; i<N1; i++) {
@ -141,8 +141,8 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
b2[i]=1.5+cos(i+M_PI/8.0);
b3[i]=1.5+sin(i);
//plot->getXAxis()->addAxisTickLabel(i+1, QString("$\\pi_{%1}\\cdot 10^{%2}$").arg(i+1).arg(i+1-N3));
//plot->getYAxis()->addAxisTickLabel(i+1, QString("$\\pi_{%1}\\cdot 10^{%2}$").arg(i+1).arg(i+1-N3));
//plot->get_xAxis()->addAxisTickLabel(i+1, QString("$\\pi_{%1}\\cdot 10^{%2}$").arg(i+1).arg(i+1-N3));
//plot->get_yAxis()->addAxisTickLabel(i+1, QString("$\\pi_{%1}\\cdot 10^{%2}$").arg(i+1).arg(i+1-N3));
}
size_t cbp=ds->addLinearColumn(N3, 2, N3+2, "boxplot_x");
@ -217,16 +217,16 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
QCheckBox* chklogX=new QCheckBox("logarithmic X-axis", this);
QCheckBox* chklogY=new QCheckBox("logarithmic Y-axis", this);
connect(chklogX, SIGNAL(toggled(bool)), plot->get_plotter()->getXAxis(), SLOT(set_logAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plot->get_plotter()->getYAxis(), SLOT(set_logAxis(bool)));
connect(chklogX, SIGNAL(toggled(bool)), plotBot2->get_plotter()->getXAxis(), SLOT(set_logAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plotBot2->get_plotter()->getYAxis(), SLOT(set_logAxis(bool)));
connect(chklogX, SIGNAL(toggled(bool)), plot->get_plotter()->get_xAxis(), SLOT(set_logAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plot->get_plotter()->get_yAxis(), SLOT(set_logAxis(bool)));
connect(chklogX, SIGNAL(toggled(bool)), plotBot2->get_plotter()->get_xAxis(), SLOT(set_logAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plotBot2->get_plotter()->get_yAxis(), SLOT(set_logAxis(bool)));
layout->addWidget(chklogX);
layout->addWidget(chklogY);
QCheckBox* chkInvertX=new QCheckBox("invert X-axis", this);
QCheckBox* chkInvertY=new QCheckBox("invert Y-axis", this);
connect(chkInvertX, SIGNAL(toggled(bool)), plot->get_plotter()->getXAxis(), SLOT(set_inverted(bool)));
connect(chkInvertY, SIGNAL(toggled(bool)), plot->get_plotter()->getYAxis(), SLOT(set_inverted(bool)));
connect(chkInvertX, SIGNAL(toggled(bool)), plot->get_plotter()->get_xAxis(), SLOT(set_inverted(bool)));
connect(chkInvertY, SIGNAL(toggled(bool)), plot->get_plotter()->get_yAxis(), SLOT(set_inverted(bool)));
layout->addWidget(chkInvertX);
layout->addWidget(chkInvertY);
layout->addWidget(chkInvertX);

View File

@ -59,8 +59,8 @@ class TestWidgetGraphs : public QWidget
JKQtPlotter* plotBot;
JKQtPlotter* plotBot2;
JKQTPgraph* plteErrors;
JKQTPgraph* plteSymbols;
JKQTPplotElement* plteErrors;
JKQTPplotElement* plteSymbols;
JKQTPxyLineErrorGraph* pltePlot2;

View File

@ -29,9 +29,9 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
plotImg->get_plotter()->set_aspectRatio(3.0/2.0);
plotImg->get_plotter()->set_maintainAxisAspectRatio(true);
plotImg->get_plotter()->set_axisAspectRatio(4.0);
/*plotImg->get_plotter()->getXAxis()->set_linkedAxis(plotImg->get_plotter()->getYAxis());
plotImg->get_plotter()->getXAxis()->set_changeWidthToAspectRatio(true);
plotImg->get_plotter()->getXAxis()->set_aspectRatio(1.0);*/
/*plotImg->get_plotter()->get_xAxis()->set_linkedAxis(plotImg->get_plotter()->get_yAxis());
plotImg->get_plotter()->get_xAxis()->set_changeWidthToAspectRatio(true);
plotImg->get_plotter()->get_xAxis()->set_aspectRatio(1.0);*/
layouti->addWidget(plotImg);

View File

@ -21,7 +21,7 @@ TestWidgetLogGraphs::TestWidgetLogGraphs(QWidget *parent) :
JKQTPdatastore* ds=plotLOG->get_plotter()->getDatastore();
QVector<double> x,y;
for (unsigned int i=0; i<N2; i++) {
const double xx=static_cast<double>(i+1)/static_cast<double>(N2*8)*M_PI;
const double xx=static_cast<double>(i+1)/static_cast<double>(N2)*15.0;
x<<xx;
y<<pow(5,xx/5.0);
}
@ -47,64 +47,64 @@ TestWidgetLogGraphs::TestWidgetLogGraphs(QWidget *parent) :
QCheckBox* chklogX=new QCheckBox("logarithmic X-axis", this);
QCheckBox* chklogY=new QCheckBox("logarithmic Y-axis", this);
connect(chklogX, SIGNAL(toggled(bool)), plotLOG->get_plotter()->getXAxis(), SLOT(set_logAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plotLOG->get_plotter()->getYAxis(), SLOT(set_logAxis(bool)));
connect(chklogX, SIGNAL(toggled(bool)), plotLOG->get_plotter()->get_xAxis(), SLOT(set_logAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plotLOG->get_plotter()->get_yAxis(), SLOT(set_logAxis(bool)));
layWid->addWidget(chklogX);
layWid->addWidget(chklogY);
QCheckBox* chkXMinorTicks=new QCheckBox("minor X-tick labels", this);
QCheckBox* chkYMinorTicks=new QCheckBox("minor Y-tick labels", this);
connect(chkXMinorTicks, SIGNAL(toggled(bool)), plotLOG->get_plotter()->getXAxis(), SLOT(set_minorTickLabelsEnabled(bool)));
connect(chkYMinorTicks, SIGNAL(toggled(bool)), plotLOG->get_plotter()->getYAxis(), SLOT(set_minorTickLabelsEnabled(bool)));
connect(chkXMinorTicks, SIGNAL(toggled(bool)), plotLOG->get_plotter()->get_xAxis(), SLOT(set_minorTickLabelsEnabled(bool)));
connect(chkYMinorTicks, SIGNAL(toggled(bool)), plotLOG->get_plotter()->get_yAxis(), SLOT(set_minorTickLabelsEnabled(bool)));
layWid->addWidget(chkXMinorTicks);
layWid->addWidget(chkYMinorTicks);
QCheckBox* chkFullNumberMinor=new QCheckBox("full minor numbers", this);
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->get_plotter()->getXAxis(), SLOT(set_minorTickLabelFullNumber(bool)));
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->get_plotter()->getYAxis(), SLOT(set_minorTickLabelFullNumber(bool)));
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->get_plotter()->get_xAxis(), SLOT(set_minorTickLabelFullNumber(bool)));
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->get_plotter()->get_yAxis(), SLOT(set_minorTickLabelFullNumber(bool)));
layWid->addWidget(chkFullNumberMinor);
QComboBox* cmbTickMode=new QComboBox(this);
cmbTickMode->addItem("JKQTPLTMLinOrLog");
cmbTickMode->addItem("JKQTPLTMLin");
cmbTickMode->addItem("JKQTPLTMPower");
connect(cmbTickMode, SIGNAL(currentIndexChanged(int)), plotLOG->get_plotter()->getXAxis(), SLOT(set_tickMode(int)));
connect(cmbTickMode, SIGNAL(currentIndexChanged(int)), plotLOG->get_plotter()->get_xAxis(), SLOT(set_tickMode(int)));
layWid->addRow("X-Axis TickMode", cmbTickMode);
cmbTickMode=new QComboBox(this);
cmbTickMode->addItem("JKQTPLTMLinOrLog");
cmbTickMode->addItem("JKQTPLTMLin");
cmbTickMode->addItem("JKQTPLTMPower");
connect(cmbTickMode, SIGNAL(currentIndexChanged(int)), plotLOG->get_plotter()->getYAxis(), SLOT(set_tickMode(int)));
connect(cmbTickMode, SIGNAL(currentIndexChanged(int)), plotLOG->get_plotter()->get_yAxis(), SLOT(set_tickMode(int)));
layWid->addRow("Y-Axis TickMode", cmbTickMode);
cmbTickMode->setCurrentIndex(0);
plotLOG->get_plotter()->getYAxis()->set_tickMode(JKQTPLTMLinOrPower);
plotLOG->get_plotter()->getYAxis()->set_minorTicks(1);
plotLOG->get_plotter()->get_yAxis()->set_tickMode(JKQTPLTMLinOrPower);
plotLOG->get_plotter()->get_yAxis()->set_minorTicks(1);
plotLOG->get_plotter()->getYAxis()->set_drawMode2(JKQTPCADMcomplete);
plotLOG->get_plotter()->getXAxis()->set_drawMode2(JKQTPCADMcomplete);
plotLOG->get_plotter()->get_yAxis()->set_drawMode2(JKQTPCADMcomplete);
plotLOG->get_plotter()->get_xAxis()->set_drawMode2(JKQTPCADMcomplete);
QSpinBox* spinMinTicks=new QSpinBox(this);
spinMinTicks->setRange(0,999);
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->get_plotter()->getXAxis(), SLOT(set_minorTicks(int)));
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->get_plotter()->getYAxis(), SLOT(set_minorTicks(int)));
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->get_plotter()->get_xAxis(), SLOT(set_minorTicks(int)));
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->get_plotter()->get_yAxis(), SLOT(set_minorTicks(int)));
layWid->addRow("X/Y-axis minor tick count", spinMinTicks);
spinMinTicks->setValue(1);
QDoubleSpinBox* spinLOGAngle=new QDoubleSpinBox(this);
spinLOGAngle->setRange(-90,90);
spinLOGAngle->setSuffix(QLatin1String("°"));
connect(spinLOGAngle, SIGNAL(valueChanged(double)), plotLOG->get_plotter()->getXAxis(), SLOT(set_tickLabelAngle(double)));
connect(spinLOGAngle, SIGNAL(valueChanged(double)), plotLOG->get_plotter()->get_xAxis(), SLOT(set_tickLabelAngle(double)));
layWid->addRow("X-Axis tick label angle", spinLOGAngle);
spinLOGAngle->setValue(0);
spinLOGAngle=new QDoubleSpinBox(this);
spinLOGAngle->setRange(-90,90);
spinLOGAngle->setSuffix(QLatin1String("°"));
connect(spinLOGAngle, SIGNAL(valueChanged(double)), plotLOG->get_plotter()->getYAxis(), SLOT(set_tickLabelAngle(double)));
connect(spinLOGAngle, SIGNAL(valueChanged(double)), plotLOG->get_plotter()->get_yAxis(), SLOT(set_tickLabelAngle(double)));
layWid->addRow(tr("Y-axis label angle = "), spinLOGAngle);
spinLOGAngle->setValue(0);

View File

@ -24,32 +24,11 @@ greaterThan(QT_MAJOR_VERSION, 4) {
HEADERS +=EmfEngine/src/EmfEngine.h \
jkqtpemfengineadapter.h
LIBS += -lgdi32
}
}
CONFIG += qt
#QMAKE_LFLAGS += -s
win32: LIBS += -lgdi32
win32-msvc*: DEFINES += _USE_MATH_DEFINES
#QMAKE_CXXFLAGS += -O2
DEFINES -= -DQT_DLL
DEFINES +=
#SHOW_JKQTPLOTTER_DEBUG
#JKQTBP_AUTOTIMER
TARGET = jkqtplot_test
QT += core gui xml svg xml
win32:LIBS += -lgdi32
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
#if not added by qmake:
DEFINES += QT_XML_LIB
HEADERS += testmain.h \
TestWidgetFunctionPlots.h \
@ -66,19 +45,27 @@ HEADERS += testmain.h \
QTeXEngine/src/QTeXEngine.h
INCLUDEPATH +=
UI_DIR = .uics
OBJECTS_DIR = .objs
MOC_DIR = .mocs
RCC_DIR = .rccs
DESTDIR = ./
RESOURCES += jkqtplot_test.qrc
DEPENDPATH += . ../../lib
INCLUDEPATH += ../../lib
CONFIG (debug, debug|release):LIBS += -L../../lib/debug -ljkqtplotterlib
CONFIG (release):LIBS += -L../../lib/release -ljkqtplotterlib
win32-msvc*: DEFINES += _USE_MATH_DEFINES
TARGET = jkqtplot_test
# configure Qt
CONFIG += qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
# include JKQtPlotter source code
DEPENDPATH += $$PWD
#$$PWD/../../lib
INCLUDEPATH += $$PWD/../../lib
CONFIG (debug, debug|release):LIBS += -L$$PWD/../../lib/debug -ljkqtplotterlib
CONFIG (release):LIBS += -L$$PWD/../../lib/release -ljkqtplotterlib
# here you can activate some debug options
#DEFINES += SHOW_JKQTPLOTTER_DEBUG
#DEFINES += JKQTBP_AUTOTIMER

View File

@ -1,8 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += jkqtplotterlib jkqtplot_test
SUBDIRS += jkqtplotterlib jkqtplottest
jkqtplotterlib.file = ../../lib/jkqtplotterlib.pro
jkqtplot_test.file=$$PWD/jkqtplot_test.pro
jkqtplot_test.depends = jkqtplotterlib
jkqtplottest.file=$$PWD/jkqtplot_test.pro
jkqtplottest.depends = jkqtplotterlib

View File

@ -69,10 +69,10 @@ int main(int argc, char* argv[])
// 7. data is grouped into 5 numbere groups (1..5), but we also have string
// labels for these groups (stored in L). In order to display these labels,
// we have to tell the x-Axis to use these special labels:
plot.getXAxis()->addAxisTickLabels(X, L, Ndata);
plot.get_xAxis()->addAxisTickLabels(X, L, Ndata);
// also we can rotate the labels a bit (by 45 degree), so they fit better
plot.getXAxis()->set_tickLabelAngle(45);
plot.getXAxis()->set_tickLabelFontSize(12);
plot.get_xAxis()->set_tickLabelAngle(45);
plot.get_xAxis()->set_tickLabelFontSize(12);
// 8. finally we move the plot key/legend to the outside, top-right
// and lay it out as a single row

View File

@ -62,10 +62,10 @@ int main(int argc, char* argv[])
// 7. data is grouped into 5 numbere groups (1..5), but we also have string
// labels for these groups (stored in L). In order to display these labels,
// we have to tell the x-Axis to use these special labels:
plot.getXAxis()->addAxisTickLabels(X, L, Ndata);
plot.get_xAxis()->addAxisTickLabels(X, L, Ndata);
// also we can rotate the labels a bit (by 45 degree), so they fit better
plot.getXAxis()->set_tickLabelAngle(45);
plot.getXAxis()->set_tickLabelFontSize(12);
plot.get_xAxis()->set_tickLabelAngle(45);
plot.get_xAxis()->set_tickLabelFontSize(12);
// 8. finally we move the plot key/legend to the outside, top-right
// and lay it out as a single row

View File

@ -100,12 +100,12 @@ Finally the x-axis is formatted to display dates (see [Qt-Documentation of `QDat
// set the title above the plot, use LaTeX instructions to make text bold
plot.get_plotter()->set_plotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
// set x-axis date-time-axis
plot.getXAxis()->set_labelType(JKQTPCALTdatetime);
plot.getXAxis()->set_axisLabel("Date");
plot.get_xAxis()->set_labelType(JKQTPCALTdatetime);
plot.get_xAxis()->set_axisLabel("Date");
// set format string for date axis (e.g. Jan '18), see Documentation of QDateTime::toString()
plot.getXAxis()->set_tickDateTimeFormat("MMM ''yy");
plot.get_xAxis()->set_tickDateTimeFormat("MMM ''yy");
// set y-axis temperature axis
plot.getYAxis()->set_axisLabel("Average Daily Temperature [{\\degree}C]");
plot.get_yAxis()->set_axisLabel("Average Daily Temperature [{\\degree}C]");
```
The result looks like this:
@ -159,13 +159,13 @@ Axis formating for this example is done like this:
// set the title above the plot, use LaTeX instructions to make text bold
plot.get_plotter()->set_plotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");
// set x-axis date-time-axis
plot.getXAxis()->set_labelType(JKQTPCALTtime);
plot.getXAxis()->set_axisLabel("Time of Day");
plot.get_xAxis()->set_labelType(JKQTPCALTtime);
plot.get_xAxis()->set_axisLabel("Time of Day");
// set format string for time axis with 24-hour and minute only,
// see QDateTime::toString() documentation for details on format strings
plot.getXAxis()->set_tickTimeFormat("HH:mm");
plot.get_xAxis()->set_tickTimeFormat("HH:mm");
// set y-axis temperature axis
plot.getYAxis()->set_axisLabel("Temperature [{\\degree}C]");
plot.get_yAxis()->set_axisLabel("Temperature [{\\degree}C]");
```
[Back to JKQTPlotter main page](https://github.com/jkriege2/JKQtPlotter/)

View File

@ -75,12 +75,12 @@ void drawWithDateAxis(JKQtPlotter& plot) {
// set the title above the plot, use LaTeX instructions to make text bold
plot.get_plotter()->set_plotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
// set x-axis date-time-axis
plot.getXAxis()->set_labelType(JKQTPCALTdatetime);
plot.getXAxis()->set_axisLabel("Date");
plot.get_xAxis()->set_labelType(JKQTPCALTdatetime);
plot.get_xAxis()->set_axisLabel("Date");
// set format string for date axis (e.g. Jan '18), see Documentation of QDateTime::toString()
plot.getXAxis()->set_tickDateTimeFormat("MMM ''yy");
plot.get_xAxis()->set_tickDateTimeFormat("MMM ''yy");
// set y-axis temperature axis
plot.getYAxis()->set_axisLabel("Average Daily Temperature [{\\degree}C]");
plot.get_yAxis()->set_axisLabel("Average Daily Temperature [{\\degree}C]");
// 8. autoscale the plot so the graph is contained
plot.zoomToFit();
@ -142,13 +142,13 @@ void drawWithTimeAxis(JKQtPlotter& plot) {
// set the title above the plot, use LaTeX instructions to make text bold
plot.get_plotter()->set_plotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");
// set x-axis date-time-axis
plot.getXAxis()->set_labelType(JKQTPCALTtime);
plot.getXAxis()->set_axisLabel("Time of Day");
plot.get_xAxis()->set_labelType(JKQTPCALTtime);
plot.get_xAxis()->set_axisLabel("Time of Day");
// set format string for time axis with 24-hour and minute only,
// see QDateTime::toString() documentation for details on format strings
plot.getXAxis()->set_tickTimeFormat("HH:mm");
plot.get_xAxis()->set_tickTimeFormat("HH:mm");
// set y-axis temperature axis
plot.getYAxis()->set_axisLabel("Temperature [{\\degree}C]");
plot.get_yAxis()->set_axisLabel("Temperature [{\\degree}C]");
// 8. autoscale the plot so the graph is contained
plot.zoomToFit();

View File

@ -100,10 +100,10 @@ In addition the plot key is moved outside the pot and the grid in the plot is sw
// 6. change locaion of key (outside top-right)
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideRightTop);
// ... and switch off the grid
plot.getXAxis()->set_drawGrid(false);
plot.getXAxis()->set_drawMinorGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawMinorGrid(false);
plot.get_xAxis()->set_drawGrid(false);
plot.get_xAxis()->set_drawMinorGrid(false);
plot.get_yAxis()->set_drawGrid(false);
plot.get_yAxis()->set_drawMinorGrid(false);
```
The result looks like this:

View File

@ -96,10 +96,10 @@ int main(int argc, char* argv[])
// 6. change locaion of key (outside top-right)
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideRightTop);
// ... and switch off the grid
plot.getXAxis()->set_drawGrid(false);
plot.getXAxis()->set_drawMinorGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawMinorGrid(false);
plot.get_xAxis()->set_drawGrid(false);
plot.get_xAxis()->set_drawMinorGrid(false);
plot.get_yAxis()->set_drawGrid(false);
plot.get_yAxis()->set_drawMinorGrid(false);
// 7. show plotter and make it a decent size
plot.show();

View File

@ -80,8 +80,8 @@ int main(int argc, char* argv[])
plot.addGraph(graphR);
// 5. set axis labels
plot.getXAxis()->set_axisLabel("R/G/B-value");
plot.getYAxis()->set_axisLabel("normalized frequency [%]");
plot.get_xAxis()->set_axisLabel("R/G/B-value");
plot.get_yAxis()->set_axisLabel("normalized frequency [%]");
// 4. set the maximum size of the plot to 0..100% and 0..256

View File

@ -101,8 +101,8 @@ int main(int argc, char* argv[])
// 8. set some axis properties (we use LaTeX for nice equation rendering)
plot->getXAxis()->set_axisLabel(QObject::tr("x-axis"));
plot->getYAxis()->set_axisLabel(QObject::tr("y-axis"));
plot->get_xAxis()->set_axisLabel(QObject::tr("x-axis"));
plot->get_yAxis()->set_axisLabel(QObject::tr("y-axis"));
plot->get_plotter()->set_keyPosition(JKQTPkeyOutsideBottomLeft);

View File

@ -37,12 +37,12 @@ int main(int argc, char* argv[])
plot.addGraph(graph);
// 6. set some axis properties (we use LaTeX for nice equation rendering)
plot.getXAxis()->set_axisLabel(QObject::tr("x-axis"));
plot.getYAxis()->set_axisLabel(QObject::tr("y-axis"));
plot.get_xAxis()->set_axisLabel(QObject::tr("x-axis"));
plot.get_yAxis()->set_axisLabel(QObject::tr("y-axis"));
// 7. switch the grid off
plot.getXAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.get_xAxis()->set_drawGrid(false);
plot.get_yAxis()->set_drawGrid(false);
// 8. autoscale the plot so the graph is contained
plot.zoomToFit();

View File

@ -63,17 +63,17 @@ int main(int argc, char* argv[])
// and format the coordinate system and key
plot.get_plotter()->set_maintainAspectRatio(true);
plot.get_plotter()->set_aspectRatio(1);
plot.getXAxis()->set_axisLabel("x-axis");
plot.getYAxis()->set_axisLabel("y-axis");
plot.getXAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.get_xAxis()->set_axisLabel("x-axis");
plot.get_yAxis()->set_axisLabel("y-axis");
plot.get_xAxis()->set_drawGrid(false);
plot.get_yAxis()->set_drawGrid(false);
plot.setXY(-15,15,-15,15);
plot2.get_plotter()->set_maintainAspectRatio(true);
plot2.get_plotter()->set_aspectRatio(1);
plot2.getXAxis()->set_axisLabel("x-axis");
plot2.getYAxis()->set_axisLabel("y-axis");
plot2.getXAxis()->set_drawGrid(false);
plot2.getYAxis()->set_drawGrid(false);
plot2.get_xAxis()->set_axisLabel("x-axis");
plot2.get_yAxis()->set_axisLabel("y-axis");
plot2.get_xAxis()->set_drawGrid(false);
plot2.get_yAxis()->set_drawGrid(false);
plot2.setXY(-15,15,-15,15);

View File

@ -144,10 +144,10 @@ int main(int argc, char* argv[])
// 4. autoscale the plot so the graph is contained and format the coordinate system and key
plot.get_plotter()->set_keyPosition(JKQTPkeyOutsideBottomLeft);
plot.get_plotter()->set_keyLayout(JKQTPkeyLayoutOneRow);
plot.getXAxis()->set_axisLabel("x-axis");
plot.getYAxis()->set_axisLabel("y-axis");
plot.getXAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.get_xAxis()->set_axisLabel("x-axis");
plot.get_yAxis()->set_axisLabel("y-axis");
plot.get_xAxis()->set_drawGrid(false);
plot.get_yAxis()->set_drawGrid(false);
plot.zoomToFit();
// 5. show plotter and make it a decent size

View File

@ -63,10 +63,10 @@ For illustrative purposes, the original image is shown at the bottom-left:
Finally the plot is styled and the axis aspect ratios are fixed:
```c++
// scale the plot so the graph is contained and format the coordinate system
plot.getXAxis()->set_axisLabel("x-axis");
plot.getYAxis()->set_axisLabel("y-axis");
plot.getXAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.get_xAxis()->set_axisLabel("x-axis");
plot.get_yAxis()->set_axisLabel("y-axis");
plot.get_xAxis()->set_drawGrid(false);
plot.get_yAxis()->set_drawGrid(false);
// max. size is the size of the image
plot.setXY(0,image.width()-1,0,image.height()-1);
plot.setAbsoluteXY(0,image.width()-1,0,image.height()-1);

View File

@ -65,10 +65,10 @@ int main(int argc, char* argv[])
// 4. scale the plot so the graph is contained and format the coordinate system
plot.getXAxis()->set_axisLabel("x-axis");
plot.getYAxis()->set_axisLabel("y-axis");
plot.getXAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.get_xAxis()->set_axisLabel("x-axis");
plot.get_yAxis()->set_axisLabel("y-axis");
plot.get_xAxis()->set_drawGrid(false);
plot.get_yAxis()->set_drawGrid(false);
// max. size is the size of the image
plot.setXY(0,image.width()-1,0,image.height()-1);
plot.setAbsoluteXY(0,image.width()-1,0,image.height()-1);

View File

@ -61,8 +61,8 @@ int main(int argc, char* argv[])
// 3. set some axis properties (we use LaTeX for nice equation rendering)
plot->getXAxis()->set_axisLabel(QObject::tr("x-axis"));
plot->getYAxis()->set_axisLabel(QObject::tr("y-axis"));
plot->get_xAxis()->set_axisLabel(QObject::tr("x-axis"));
plot->get_yAxis()->set_axisLabel(QObject::tr("y-axis"));
// 4. scale the plot so the graph is contained

View File

@ -52,16 +52,16 @@ int main(int argc, char* argv[])
plot.addGraph(graph1);
// 6. hide 0-lines
plot.getXAxis()->set_showZeroAxis(false);
plot.getYAxis()->set_showZeroAxis(false);
plot.get_xAxis()->set_showZeroAxis(false);
plot.get_yAxis()->set_showZeroAxis(false);
// 7. set some axis properties (we use LaTeX for nice equation rendering)
plot.getXAxis()->set_axisLabel(QObject::tr("x-axis $x$ [mm]"));
plot.getYAxis()->set_axisLabel(QObject::tr("\\textbf{\\color{red}{y-axis} $\\left(y=\\sin(x)\\pm(0.2+0.25\\cdot x)\\right)$ [A.U.]}"));
plot.getXAxis()->set_labelFont("Arial");
plot.getYAxis()->set_labelFont("Times New Roman");
plot.getYAxis()->set_labelFontSize(12); // large x-axis label
plot.getYAxis()->set_tickLabelFontSize(10); // and larger y-axis tick labels
plot.get_xAxis()->set_axisLabel(QObject::tr("x-axis $x$ [mm]"));
plot.get_yAxis()->set_axisLabel(QObject::tr("\\textbf{\\color{red}{y-axis} $\\left(y=\\sin(x)\\pm(0.2+0.25\\cdot x)\\right)$ [A.U.]}"));
plot.get_xAxis()->set_labelFont("Arial");
plot.get_yAxis()->set_labelFont("Times New Roman");
plot.get_yAxis()->set_labelFontSize(12); // large x-axis label
plot.get_yAxis()->set_tickLabelFontSize(10); // and larger y-axis tick labels
// 8. autoscale the plot so the graph is contained
plot.zoomToFit();

View File

@ -43,16 +43,16 @@ int main(int argc, char* argv[])
plot.addGraph(graph1);
// 6. hide 0-lines
plot.getXAxis()->set_showZeroAxis(false);
plot.getYAxis()->set_showZeroAxis(false);
plot.get_xAxis()->set_showZeroAxis(false);
plot.get_yAxis()->set_showZeroAxis(false);
// 7. set some axis properties (we use LaTeX for nice equation rendering)
plot.getXAxis()->set_axisLabel(QObject::tr("x-axis $x$ [mm]"));
plot.getYAxis()->set_axisLabel(QObject::tr("\\textbf{\\color{red}{y-axis} $\\left(y=\\sin(x)\\pm(0.2+0.25\\cdot x)\\right)$ [A.U.]}"));
plot.getXAxis()->set_labelFont("Arial");
plot.getYAxis()->set_labelFont("Times New Roman");
plot.getYAxis()->set_labelFontSize(12); // large x-axis label
plot.getYAxis()->set_tickLabelFontSize(10); // and larger y-axis tick labels
plot.get_xAxis()->set_axisLabel(QObject::tr("x-axis $x$ [mm]"));
plot.get_yAxis()->set_axisLabel(QObject::tr("\\textbf{\\color{red}{y-axis} $\\left(y=\\sin(x)\\pm(0.2+0.25\\cdot x)\\right)$ [A.U.]}"));
plot.get_xAxis()->set_labelFont("Arial");
plot.get_yAxis()->set_labelFont("Times New Roman");
plot.get_yAxis()->set_labelFontSize(12); // large x-axis label
plot.get_yAxis()->set_tickLabelFontSize(10); // and larger y-axis tick labels
// 8. autoscale the plot so the graph is contained
plot.zoomToFit();