mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2025-01-12 08:50:31 +08:00
breaking: made more functions and function parameters const
This commit is contained in:
parent
3105d88740
commit
8cee70bdca
@ -28,6 +28,7 @@ Changes, compared to \ref page_whatsnew_V2019_11 "v2019.11" include:
|
|||||||
<li>improved/breaking change: reworked class hierarchy of parsed function plots and declared several setters as slots.</li>
|
<li>improved/breaking change: reworked class hierarchy of parsed function plots and declared several setters as slots.</li>
|
||||||
<li>improved/breaking change: reworked class hierarchy of bar charts.</li>
|
<li>improved/breaking change: reworked class hierarchy of bar charts.</li>
|
||||||
<li>improved/breaking change: reworked graph Base-Classes (promoted several setters to slots, added Q_PROPERTY- and Q_ENUM-declarations...)</li>
|
<li>improved/breaking change: reworked graph Base-Classes (promoted several setters to slots, added Q_PROPERTY- and Q_ENUM-declarations...)</li>
|
||||||
|
<li>improved/breaking change: made more functions and function parameters const</li>
|
||||||
<li>bugfixed/improved: aspect ratio handling in JKQTPlotter.</li>
|
<li>bugfixed/improved: aspect ratio handling in JKQTPlotter.</li>
|
||||||
<li>new: added geometric plot objects JKQTPGeoArrow to draw arrows (aka lines with added line-end decorators, also extended JKQTPGeoLine, JKQTPGeoInfiniteLine, JKQTPGeoPolyLines to draw line-end decorator (aka arrows)</li>
|
<li>new: added geometric plot objects JKQTPGeoArrow to draw arrows (aka lines with added line-end decorators, also extended JKQTPGeoLine, JKQTPGeoInfiniteLine, JKQTPGeoPolyLines to draw line-end decorator (aka arrows)</li>
|
||||||
<li>new: all geometric objects can either be drawn as graphic element (i.e. lines are straight line, even on non-linear axes), or as mathematical curve (i.e. on non-linear axes, lines become the appropriate curve representing the linear function, connecting the given start/end-points). The only exceptions are ellipses (and the derived arcs,pies,chords), which are always drawn as mathematical curves</li>
|
<li>new: all geometric objects can either be drawn as graphic element (i.e. lines are straight line, even on non-linear axes), or as mathematical curve (i.e. on non-linear axes, lines become the appropriate curve representing the linear function, connecting the given start/end-points). The only exceptions are ellipses (and the derived arcs,pies,chords), which are always drawn as mathematical curves</li>
|
||||||
|
@ -173,45 +173,40 @@ bool JKQTPBarGraphBase::getValuesMinMax(double &mmin, double &mmax, double &smal
|
|||||||
|
|
||||||
if (getBarPositionColumn()<0 || getBarHeightColumn()<0) return false;
|
if (getBarPositionColumn()<0 || getBarHeightColumn()<0) return false;
|
||||||
|
|
||||||
const size_t poscol=static_cast<size_t>(getBarPositionColumn());
|
|
||||||
const size_t datacol=static_cast<size_t>(getBarHeightColumn());
|
const size_t datacol=static_cast<size_t>(getBarHeightColumn());
|
||||||
|
|
||||||
if (parent==nullptr) return false;
|
if (parent==nullptr) return false;
|
||||||
|
|
||||||
JKQTPDatastore* datastore=parent->getDatastore();
|
const JKQTPDatastore* datastore=parent->getDatastore();
|
||||||
int imin=0;
|
int imin=0, imax=0;
|
||||||
int imax=static_cast<int>(qMin(datastore->getRows(poscol), datastore->getRows(datacol)));
|
if (getIndexRange(imin, imax)) {
|
||||||
if (imax<imin) {
|
|
||||||
int h=imin;
|
|
||||||
imin=imax;
|
|
||||||
imax=h;
|
|
||||||
}
|
|
||||||
if (imin<0) imin=0;
|
|
||||||
if (imax<0) imax=0;
|
|
||||||
|
|
||||||
for (int i=imin; i<imax; i++) {
|
|
||||||
double stack=0;
|
for (int i=imin; i<imax; i++) {
|
||||||
double yv=baseline;
|
double stack=0;
|
||||||
const double boxstart=getParentStackedMax(i);
|
double yv=baseline;
|
||||||
if (hasStackParent()) {
|
const double boxstart=getParentStackedMax(i);
|
||||||
stack=boxstart;
|
if (hasStackParent()) {
|
||||||
yv=stack;
|
stack=boxstart;
|
||||||
}
|
yv=stack;
|
||||||
if (JKQTPIsOKFloat(yv)) {
|
}
|
||||||
if (yv>mmax) mmax=yv;
|
if (JKQTPIsOKFloat(yv)) {
|
||||||
if (yv<mmin) mmin=yv;
|
if (yv>mmax) mmax=yv;
|
||||||
double xvsgz;
|
if (yv<mmin) mmin=yv;
|
||||||
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
|
double xvsgz;
|
||||||
}
|
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
|
||||||
yv=stack+datastore->get(datacol,static_cast<size_t>(i));
|
}
|
||||||
if (JKQTPIsOKFloat(yv)) {
|
yv=stack+datastore->get(datacol,static_cast<size_t>(i));
|
||||||
if (yv>mmax) mmax=yv;
|
if (JKQTPIsOKFloat(yv)) {
|
||||||
if (yv<mmin) mmin=yv;
|
if (yv>mmax) mmax=yv;
|
||||||
double xvsgz;
|
if (yv<mmin) mmin=yv;
|
||||||
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
|
double xvsgz;
|
||||||
|
xvsgz=yv; SmallestGreaterZeroCompare_xvsgz();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JKQTPBarGraphBase::getPositionsMinMax(double &mmin, double &mmax, double &smallestGreaterZero)
|
bool JKQTPBarGraphBase::getPositionsMinMax(double &mmin, double &mmax, double &smallestGreaterZero)
|
||||||
@ -224,50 +219,43 @@ bool JKQTPBarGraphBase::getPositionsMinMax(double &mmin, double &mmax, double &s
|
|||||||
if (getBarPositionColumn()<0 || getBarHeightColumn()<0) return false;
|
if (getBarPositionColumn()<0 || getBarHeightColumn()<0) return false;
|
||||||
|
|
||||||
const size_t poscol=static_cast<size_t>(getBarPositionColumn());
|
const size_t poscol=static_cast<size_t>(getBarPositionColumn());
|
||||||
const size_t datacol=static_cast<size_t>(getBarHeightColumn());
|
|
||||||
|
|
||||||
if (parent==nullptr) return false;
|
if (parent==nullptr) return false;
|
||||||
|
|
||||||
JKQTPDatastore* datastore=parent->getDatastore();
|
const JKQTPDatastore* datastore=parent->getDatastore();
|
||||||
int imin=0;
|
int imin=0, imax=0;
|
||||||
int imax=static_cast<int>(qMin(datastore->getRows(poscol), datastore->getRows(datacol)));
|
if (getIndexRange(imin, imax)) {
|
||||||
if (imax<imin) {
|
for (int i=imin; i<imax; i++) {
|
||||||
int h=imin;
|
double xv=datastore->get(poscol,static_cast<size_t>(i));
|
||||||
imin=imax;
|
int sr=datastore->getNextLowerIndex(poscol, i);
|
||||||
imax=h;
|
int lr=datastore->getNextHigherIndex(poscol, i);
|
||||||
}
|
double delta, deltap, deltam;
|
||||||
if (imin<0) imin=0;
|
|
||||||
if (imax<0) imax=0;
|
|
||||||
|
|
||||||
for (int i=imin; i<imax; i++) {
|
if (sr<0 && lr<0) { // only one x-value
|
||||||
double xv=datastore->get(poscol,static_cast<size_t>(i));
|
deltam=0.5;
|
||||||
int sr=datastore->getNextLowerIndex(poscol, i);
|
deltap=0.5;
|
||||||
int lr=datastore->getNextHigherIndex(poscol, i);
|
} else if (lr<0) { // the right-most x-value
|
||||||
double delta, deltap, deltam;
|
deltap=deltam=fabs(xv-datastore->get(poscol,sr))/2.0;
|
||||||
|
} else if (sr<0) { // the left-most x-value
|
||||||
|
deltam=deltap=fabs(datastore->get(poscol,lr)-xv)/2.0;
|
||||||
|
} else {
|
||||||
|
deltam=fabs(xv-datastore->get(poscol,sr))/2.0;
|
||||||
|
deltap=fabs(datastore->get(poscol,lr)-xv)/2.0;
|
||||||
|
}
|
||||||
|
delta=deltap+deltam;
|
||||||
|
|
||||||
if (sr<0 && lr<0) { // only one x-value
|
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(delta) ) {
|
||||||
deltam=0.5;
|
|
||||||
deltap=0.5;
|
if (start || xv+shift*delta+width*delta/2.0>mmax) mmax=xv+shift*delta+width*delta/2.0;
|
||||||
} else if (lr<0) { // the right-most x-value
|
if (start || xv+shift*delta-width*delta/2.0<mmin) mmin=xv+shift*delta-width*delta/2.0;
|
||||||
deltap=deltam=fabs(xv-datastore->get(poscol,sr))/2.0;
|
double xvsgz;
|
||||||
} else if (sr<0) { // the left-most x-value
|
xvsgz=xv+shift*delta+width*delta/2.0; SmallestGreaterZeroCompare_xvsgz();
|
||||||
deltam=deltap=fabs(datastore->get(poscol,lr)-xv)/2.0;
|
xvsgz=xv+shift*delta-width*delta/2.0; SmallestGreaterZeroCompare_xvsgz();
|
||||||
} else {
|
start=false;
|
||||||
deltam=fabs(xv-datastore->get(poscol,sr))/2.0;
|
}
|
||||||
deltap=fabs(datastore->get(poscol,lr)-xv)/2.0;
|
|
||||||
}
|
|
||||||
delta=deltap+deltam;
|
|
||||||
|
|
||||||
if (JKQTPIsOKFloat(xv) && JKQTPIsOKFloat(delta) ) {
|
|
||||||
|
|
||||||
if (start || xv+shift*delta+width*delta/2.0>mmax) mmax=xv+shift*delta+width*delta/2.0;
|
|
||||||
if (start || xv+shift*delta-width*delta/2.0<mmin) mmin=xv+shift*delta-width*delta/2.0;
|
|
||||||
double xvsgz;
|
|
||||||
xvsgz=xv+shift*delta+width*delta/2.0; SmallestGreaterZeroCompare_xvsgz();
|
|
||||||
xvsgz=xv+shift*delta-width*delta/2.0; SmallestGreaterZeroCompare_xvsgz();
|
|
||||||
start=false;
|
|
||||||
}
|
}
|
||||||
|
return !start;
|
||||||
}
|
}
|
||||||
return !start;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,11 +163,11 @@ public:
|
|||||||
virtual QColor getKeyLabelColor() const override;
|
virtual QColor getKeyLabelColor() const override;
|
||||||
|
|
||||||
/*! \copydoc yColumn2 */
|
/*! \copydoc yColumn2 */
|
||||||
void setYColumn2(int __value);
|
void setYColumn2(int __value);
|
||||||
/*! \copydoc yColumn2 */
|
/*! \copydoc yColumn2 */
|
||||||
int getYColumn2() const;
|
int getYColumn2() const;
|
||||||
/*! \copydoc yColumn2 */
|
/*! \copydoc yColumn2 */
|
||||||
void setYColumn2 (size_t __value);
|
void setYColumn2 (size_t __value);
|
||||||
|
|
||||||
/*! \copydoc drawLine */
|
/*! \copydoc drawLine */
|
||||||
void setDrawLine(bool __value);
|
void setDrawLine(bool __value);
|
||||||
|
@ -986,7 +986,7 @@ void JKQTPXYParametrizedErrorScatterGraph::drawErrorsBefore(JKQTPEnhancedPainter
|
|||||||
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, 0, 0, &sortedIndices);
|
else plotErrorIndicators(painter, parent, this, xColumn, yColumn, 0, 0, &sortedIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JKQTPXYParametrizedErrorScatterGraph::intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter &/*painter*/, JKQTBasePlotter * /*parent*/, JKQTPGraph* /*parentGraph*/, int /*xColumn*/, int /*yColumn*/, int /*xErrorColumn*/, int /*yErrorColumn*/, JKQTPErrorPlotstyle /*xErrorStyle*/, JKQTPErrorPlotstyle /*yErrorStyle*/, int index, QColor &errorLineColor, QColor &errorFillColor)
|
bool JKQTPXYParametrizedErrorScatterGraph::intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter &/*painter*/, const JKQTBasePlotter * /*parent*/, const JKQTPGraph * /*parentGraph*/, int /*xColumn*/, int /*yColumn*/, int /*xErrorColumn*/, int /*yErrorColumn*/, JKQTPErrorPlotstyle /*xErrorStyle*/, JKQTPErrorPlotstyle /*yErrorStyle*/, int index, QColor &errorLineColor, QColor &errorFillColor) const
|
||||||
{
|
{
|
||||||
QColor c=getLocalColor(index);
|
QColor c=getLocalColor(index);
|
||||||
errorLineColor=c.darker();
|
errorLineColor=c.darker();
|
||||||
|
@ -436,7 +436,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXYParametrizedErrorScatterGraph: public JKQTPX
|
|||||||
/** \brief this function can be used to set the color of the error indicators automatically
|
/** \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 */
|
* return \c true and the colors to use, if applicable, the default implementation returns false */
|
||||||
virtual bool intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, int index, QColor& errorLineColor, QColor& errorFillColor) override;
|
virtual bool intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter& painter, const JKQTBasePlotter* parent, const JKQTPGraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, int index, QColor& errorLineColor, QColor& errorFillColor) const override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -921,7 +921,7 @@ void JKQTPGraphViolinplotStyleMixin::plotHorizontalViolinplot(JKQTBasePlotter *p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void JKQTPGraphViolinplotStyleMixin::plotVerticalKeyMarker(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, const QRectF &rect)
|
void JKQTPGraphViolinplotStyleMixin::plotVerticalKeyMarker(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, const QRectF &rect) const
|
||||||
{
|
{
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
QPen p=getLinePenForRects(painter, parent);
|
QPen p=getLinePenForRects(painter, parent);
|
||||||
@ -967,7 +967,7 @@ void JKQTPGraphViolinplotStyleMixin::plotVerticalKeyMarker(JKQTBasePlotter *pare
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JKQTPGraphViolinplotStyleMixin::plotHorizontalKeyMarker(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, const QRectF &rect)
|
void JKQTPGraphViolinplotStyleMixin::plotHorizontalKeyMarker(JKQTBasePlotter *parent, JKQTPEnhancedPainter &painter, const QRectF &rect) const
|
||||||
{
|
{
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
|
|
||||||
|
@ -377,10 +377,10 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphViolinplotStyleMixin: public JKQTPGraphLi
|
|||||||
void plotHorizontalViolinplot(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double yp, double ypbottom, double yptop, const QVector<double>& violin_cat, const QVector<double>& violin_freq, double minp, double medianp, double maxp, double meanp=JKQTP_NAN) const;
|
void plotHorizontalViolinplot(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, double yp, double ypbottom, double yptop, const QVector<double>& violin_cat, const QVector<double>& violin_freq, double minp, double medianp, double maxp, double meanp=JKQTP_NAN) const;
|
||||||
|
|
||||||
/** \brief draw a small, stylized, vertical symbol into \a rect that symbolizes a boxplot, e.g. in a plot legend */
|
/** \brief draw a small, stylized, vertical symbol into \a rect that symbolizes a boxplot, e.g. in a plot legend */
|
||||||
void plotVerticalKeyMarker(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, const QRectF& rect);
|
void plotVerticalKeyMarker(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, const QRectF& rect) const;
|
||||||
|
|
||||||
/** \brief draw a small, stylized, horizontal symbol into \a rect that symbolizes a boxplot, e.g. in a plot legend */
|
/** \brief draw a small, stylized, horizontal symbol into \a rect that symbolizes a boxplot, e.g. in a plot legend */
|
||||||
void plotHorizontalKeyMarker(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, const QRectF& rect);
|
void plotHorizontalKeyMarker(JKQTBasePlotter* parent, JKQTPEnhancedPainter &painter, const QRectF& rect) const;
|
||||||
private:
|
private:
|
||||||
/** \brief which symbol to use for the datapoints */
|
/** \brief which symbol to use for the datapoints */
|
||||||
JKQTPGraphSymbols m_meanSymbolType;
|
JKQTPGraphSymbols m_meanSymbolType;
|
||||||
|
@ -81,6 +81,10 @@ JKQTMathText* JKQTPCoordinateAxis::getParentMathText() {
|
|||||||
return parent->getMathText();
|
return parent->getMathText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const JKQTMathText* JKQTPCoordinateAxis::getParentMathText() const {
|
||||||
|
return parent->getMathText();
|
||||||
|
}
|
||||||
|
|
||||||
void JKQTPCoordinateAxis::clearAxisTickLabels() {
|
void JKQTPCoordinateAxis::clearAxisTickLabels() {
|
||||||
tickLabels.clear();
|
tickLabels.clear();
|
||||||
redrawPlot();
|
redrawPlot();
|
||||||
@ -357,7 +361,7 @@ double JKQTPCoordinateAxis::calcLogTickSpacing() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString JKQTPCoordinateAxis::floattolabel(double data) {
|
QString JKQTPCoordinateAxis::floattolabel(double data) const {
|
||||||
int past_comma=axisStyle.labelDigits;
|
int past_comma=axisStyle.labelDigits;
|
||||||
const bool remove_trail0=true;
|
const bool remove_trail0=true;
|
||||||
QLocale loc=QLocale::system();
|
QLocale loc=QLocale::system();
|
||||||
@ -414,7 +418,7 @@ QString JKQTPCoordinateAxis::floattolabel(double data) {
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString JKQTPCoordinateAxis::floattolabel(double data, int past_comma) {
|
QString JKQTPCoordinateAxis::floattolabel(double data, int past_comma) const {
|
||||||
bool remove_trail0=true;
|
bool remove_trail0=true;
|
||||||
QLocale loc=QLocale::system();
|
QLocale loc=QLocale::system();
|
||||||
loc.setNumberOptions(QLocale::OmitGroupSeparator);
|
loc.setNumberOptions(QLocale::OmitGroupSeparator);
|
||||||
|
@ -565,6 +565,12 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
|
|||||||
protected:
|
protected:
|
||||||
/** \brief indicates whether one of the parameters has changed sinse the last recalculation of tickSpacing ... */
|
/** \brief indicates whether one of the parameters has changed sinse the last recalculation of tickSpacing ... */
|
||||||
bool paramsChanged;
|
bool paramsChanged;
|
||||||
|
/** \brief can be used to switch off calcPlotScaling() temporarily, while modifying some properties
|
||||||
|
*
|
||||||
|
* use setDoUpdateScaling() to set this property
|
||||||
|
*
|
||||||
|
* \see setDoUpdateScaling() and getDoUpdateScaling()
|
||||||
|
*/
|
||||||
bool doUpdateScaling;
|
bool doUpdateScaling;
|
||||||
|
|
||||||
/** \brief simply calls the redrawPlot method of the parent plotter class */
|
/** \brief simply calls the redrawPlot method of the parent plotter class */
|
||||||
@ -577,14 +583,16 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPCoordinateAxis: public QObject {
|
|||||||
*/
|
*/
|
||||||
QVector<QPair<double, QString> > tickLabels;
|
QVector<QPair<double, QString> > tickLabels;
|
||||||
/** \brief retun parents JKQTMathText* object */
|
/** \brief retun parents JKQTMathText* object */
|
||||||
virtual JKQTMathText* getParentMathText();
|
JKQTMathText* getParentMathText();
|
||||||
|
/** \brief retun parents JKQTMathText* object */
|
||||||
|
const JKQTMathText* getParentMathText() const;
|
||||||
|
|
||||||
|
|
||||||
/** \brief convert a float to a tick label string */
|
/** \brief convert a float to a tick label string */
|
||||||
QString floattolabel(double data);
|
QString floattolabel(double data) const;
|
||||||
|
|
||||||
/** \brief convert a float to a tick label string with a given precision */
|
/** \brief convert a float to a tick label string with a given precision */
|
||||||
QString floattolabel(double data, int past_comma);
|
QString floattolabel(double data, int past_comma) const;
|
||||||
/** \brief parent plotter class */
|
/** \brief parent plotter class */
|
||||||
JKQTBasePlotter* parent;
|
JKQTBasePlotter* parent;
|
||||||
/** \brief current view: minimum of time axis */
|
/** \brief current view: minimum of time axis */
|
||||||
|
@ -98,6 +98,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPPlotElement: public QObject {
|
|||||||
/*! \brief returns whether the graph is shown in a highlighted style in the plot */
|
/*! \brief returns whether the graph is shown in a highlighted style in the plot */
|
||||||
bool isHighlighted() const;
|
bool isHighlighted() const;
|
||||||
|
|
||||||
|
/** \brief returns the parent painter class */
|
||||||
|
inline const JKQTBasePlotter* getParent() const { return parent; }
|
||||||
/** \brief returns the parent painter class */
|
/** \brief returns the parent painter class */
|
||||||
inline JKQTBasePlotter* getParent() { return parent; }
|
inline JKQTBasePlotter* getParent() { return parent; }
|
||||||
/** \brief sets the parent painter class */
|
/** \brief sets the parent painter class */
|
||||||
@ -620,7 +622,7 @@ protected:
|
|||||||
*
|
*
|
||||||
* \see setDataSortOrder(), getDataSortOrder()
|
* \see setDataSortOrder(), getDataSortOrder()
|
||||||
* */
|
* */
|
||||||
inline int getDataIndex(int i) {
|
inline int getDataIndex(int i) const {
|
||||||
if (sortData==Unsorted) return i;
|
if (sortData==Unsorted) return i;
|
||||||
return sortedIndices.value(i,i);
|
return sortedIndices.value(i,i);
|
||||||
}
|
}
|
||||||
@ -688,7 +690,7 @@ protected:
|
|||||||
* \param[out] imax last usable row-index
|
* \param[out] imax last usable row-index
|
||||||
* \return \c true on success and \c false if the information is not available
|
* \return \c true on success and \c false if the information is not available
|
||||||
*/
|
*/
|
||||||
virtual bool getIndexRange(int &imin, int &imax) const;
|
virtual bool getIndexRange(int &imin, int &imax) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -745,7 +747,7 @@ protected:
|
|||||||
* \param[out] imax last usable row-index
|
* \param[out] imax last usable row-index
|
||||||
* \return \c true on success and \c false if the information is not available
|
* \return \c true on success and \c false if the information is not available
|
||||||
*/
|
*/
|
||||||
virtual bool getIndexRange(int &imin, int &imax) const;
|
virtual bool getIndexRange(int &imin, int &imax) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -831,7 +833,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPSingleColumnGraph: public JKQTPGraph {
|
|||||||
* This function can beu used to get the correct datapoint after sorting the 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.
|
* As sorting is done by sorting an index and not reordering the data in the columns themselves.
|
||||||
* */
|
* */
|
||||||
inline int getDataIndex(int i) {
|
inline int getDataIndex(int i) const {
|
||||||
if (sortData==Unsorted) return i;
|
if (sortData==Unsorted) return i;
|
||||||
return sortedIndices.value(i,i);
|
return sortedIndices.value(i,i);
|
||||||
}
|
}
|
||||||
|
@ -79,21 +79,21 @@ void JKQTPGraphErrorStyleMixin::setErrorColorFromGraphColor(QColor graphColor)
|
|||||||
//errorColor.setAlphaF(0.5);
|
//errorColor.setAlphaF(0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPen JKQTPGraphErrorStyleMixin::getErrorLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
|
QPen JKQTPGraphErrorStyleMixin::getErrorLinePen(JKQTPEnhancedPainter &painter, const JKQTBasePlotter *parent) const
|
||||||
{
|
{
|
||||||
QPen p=m_errorLinePen;
|
QPen p=m_errorLinePen;
|
||||||
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*m_errorLineWidth)));
|
p.setWidthF(qMax(JKQTPlotterDrawingTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*m_errorLineWidth)));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPen JKQTPGraphErrorStyleMixin::getErrorLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
|
QPen JKQTPGraphErrorStyleMixin::getErrorLinePenForRects(JKQTPEnhancedPainter &painter, const JKQTBasePlotter *parent) const
|
||||||
{
|
{
|
||||||
QPen p=getErrorLinePen(painter, parent);
|
QPen p=getErrorLinePen(painter, parent);
|
||||||
p.setJoinStyle(Qt::MiterJoin);
|
p.setJoinStyle(Qt::MiterJoin);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
QBrush JKQTPGraphErrorStyleMixin::getErrorFillBrush(JKQTPEnhancedPainter &/*painter*/, JKQTBasePlotter * /*parent*/) const
|
QBrush JKQTPGraphErrorStyleMixin::getErrorFillBrush(JKQTPEnhancedPainter &/*painter*/, const JKQTBasePlotter * /*parent*/) const
|
||||||
{
|
{
|
||||||
return m_errorFillBrush;
|
return m_errorFillBrush;
|
||||||
}
|
}
|
||||||
@ -259,10 +259,10 @@ void JKQTPGraphErrorStyleMixin::setErrorFillTransform(const QTransform &b)
|
|||||||
m_errorFillBrush.setTransform(b);
|
m_errorFillBrush.setTransform(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, int xErrorColumnLower, int yErrorColumnLower, bool xErrorSymmetric, bool yErrorSymmetric, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
|
void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, const JKQTBasePlotter* parent, const JKQTPGraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, int xErrorColumnLower, int yErrorColumnLower, bool xErrorSymmetric, bool yErrorSymmetric, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
|
||||||
//std::cout<<"JKQTPGraphErrors::intPlotXYErrorIndicators(p, "<<parent<<", "<<xColumn<<", "<<yColumn<<", "<<xErrorColumn<<", "<<yErrorColumn<<", "<<xErrorStyle<<", "<<yErrorStyle<<", ...)\n";
|
//std::cout<<"JKQTPGraphErrors::intPlotXYErrorIndicators(p, "<<parent<<", "<<xColumn<<", "<<yColumn<<", "<<xErrorColumn<<", "<<yErrorColumn<<", "<<xErrorStyle<<", "<<yErrorStyle<<", ...)\n";
|
||||||
if (parent==nullptr) return;
|
if (parent==nullptr) return;
|
||||||
JKQTPDatastore* datastore=parent->getDatastore();
|
const JKQTPDatastore* datastore=parent->getDatastore();
|
||||||
if (datastore==nullptr) return;
|
if (datastore==nullptr) return;
|
||||||
|
|
||||||
if ((yErrorStyle==JKQTPNoError) && (xErrorStyle==JKQTPNoError)) return;
|
if ((yErrorStyle==JKQTPNoError) && (xErrorStyle==JKQTPNoError)) return;
|
||||||
@ -561,7 +561,7 @@ void JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicators(JKQTPEnhancedPainter& p
|
|||||||
//std::cout<<"end\n";
|
//std::cout<<"end\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JKQTPGraphErrorStyleMixin::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*/)
|
bool JKQTPGraphErrorStyleMixin::intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter &/*painter*/, const JKQTBasePlotter * /*parent*/, const JKQTPGraph* /*parentGraph*/, int /*xColumn*/, int /*yColumn*/, int /*xErrorColumn*/, int /*yErrorColumn*/, JKQTPErrorPlotstyle /*xErrorStyle*/, JKQTPErrorPlotstyle /*yErrorStyle*/, int /*index*/, QColor &/*errorColor*/, QColor &/*errorFillColor*/) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -735,7 +735,7 @@ bool JKQTPXGraphErrors::errorUsesColumn(int c) const
|
|||||||
return c==(xErrorColumn) || (c==xErrorColumnLower);
|
return c==(xErrorColumn) || (c==xErrorColumnLower);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JKQTPXGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph *parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
|
void JKQTPXGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph *parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
|
||||||
intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, -1, xErrorStyle, JKQTPNoError, xErrorColumnLower, -1, xErrorSymmetric, true, xrelshift, yrelshift, dataorder);
|
intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, -1, xErrorStyle, JKQTPNoError, xErrorColumnLower, -1, xErrorSymmetric, true, xrelshift, yrelshift, dataorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -747,7 +747,7 @@ JKQTPYGraphErrors::JKQTPYGraphErrors()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void JKQTPYGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
|
void JKQTPYGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
|
||||||
intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, -1, yErrorColumn, JKQTPNoError, yErrorStyle, -1, yErrorColumnLower, true, yErrorSymmetric, xrelshift, yrelshift, dataorder);
|
intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, -1, yErrorColumn, JKQTPNoError, yErrorStyle, -1, yErrorColumnLower, true, yErrorSymmetric, xrelshift, yrelshift, dataorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +767,7 @@ JKQTPXYGraphErrors::JKQTPXYGraphErrors()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void JKQTPXYGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) {
|
void JKQTPXYGraphErrors::plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift, double yrelshift, const QVector<int>* dataorder) const {
|
||||||
this->intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, yErrorColumn, xErrorStyle, yErrorStyle, xErrorColumnLower, yErrorColumnLower, xErrorSymmetric, yErrorSymmetric, xrelshift, yrelshift, dataorder);
|
this->intPlotXYErrorIndicators(painter, parent, parentGraph, xColumn, yColumn, xErrorColumn, yErrorColumn, xErrorStyle, yErrorStyle, xErrorColumnLower, yErrorColumnLower, xErrorSymmetric, yErrorSymmetric, xrelshift, yrelshift, dataorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,20 +169,20 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPGraphErrorStyleMixin {
|
|||||||
|
|
||||||
|
|
||||||
/** \brief constructs a QPen from the error indicator line styling properties */
|
/** \brief constructs a QPen from the error indicator line styling properties */
|
||||||
QPen getErrorLinePen(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
QPen getErrorLinePen(JKQTPEnhancedPainter &painter, const JKQTBasePlotter* parent) const;
|
||||||
/** \brief constructs a QPen from the error indicator line styling properties, suitable for drawing rectangles with sharp edges */
|
/** \brief constructs a QPen from the error indicator line styling properties, suitable for drawing rectangles with sharp edges */
|
||||||
QPen getErrorLinePenForRects(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
QPen getErrorLinePenForRects(JKQTPEnhancedPainter &painter, const JKQTBasePlotter* parent) const;
|
||||||
|
|
||||||
/** \brief constructs a QBrush from the error indicator fill styling properties */
|
/** \brief constructs a QBrush from the error indicator fill styling properties */
|
||||||
QBrush getErrorFillBrush(JKQTPEnhancedPainter &painter, JKQTBasePlotter* parent) const;
|
QBrush getErrorFillBrush(JKQTPEnhancedPainter &painter, const JKQTBasePlotter *parent) const;
|
||||||
|
|
||||||
/** \brief draw error indicators with the parameters defined in this class. The position of the datapoints is
|
/** \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. */
|
* given by the \a xColumn and \a yColumn. It is also possible to specify a datarange. */
|
||||||
void intPlotXYErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, 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, const JKQTBasePlotter *parent, const JKQTPGraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, int xErrorColumnLower=-1, int yErrorColumnLower=-1, bool xErrorSymmetric=true, bool yErrorSymmetric=true, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const;
|
||||||
/** \brief this function can be used to set the color of the error indicators automatically
|
/** \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 */
|
* return \c true and the colors to use, if applicable, the default implementation returns false */
|
||||||
virtual bool intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, int index, QColor& errorLineColor, QColor& errorFillColor);
|
virtual bool intPlotXYErrorIndicatorsGetColor(JKQTPEnhancedPainter& painter, const JKQTBasePlotter* parent, const JKQTPGraph *parentGraph, int xColumn, int yColumn, int xErrorColumn, int yErrorColumn, JKQTPErrorPlotstyle xErrorStyle, JKQTPErrorPlotstyle yErrorStyle, int index, QColor& errorLineColor, QColor& errorFillColor) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXGraphErrors: public JKQTPXGraphErrorData, pub
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** \brief draws the error indicators */
|
/** \brief draws the error indicators */
|
||||||
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) ;
|
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPYGraphErrors: public JKQTPYGraphErrorData, pub
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** \brief draws the error indicators */
|
/** \brief draws the error indicators */
|
||||||
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) ;
|
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXYGraphErrors: public JKQTPXGraphErrorData, pu
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** \brief draws the error indicators */
|
/** \brief draws the error indicators */
|
||||||
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) ;
|
virtual void plotErrorIndicators(JKQTPEnhancedPainter& painter, JKQTBasePlotter* parent, JKQTPGraph* parentGraph, int xColumn, int yColumn, double xrelshift=0, double yrelshift=0.0, const QVector<int> *dataorder=nullptr) const ;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user