change parent-chld relationships of scatter graphs

This commit is contained in:
jkriege2 2022-08-25 17:34:12 +02:00
parent f4c4a693e4
commit 586548c7d6
2 changed files with 39 additions and 9 deletions

View File

@ -313,8 +313,9 @@ void JKQTPXYLineErrorGraph::drawErrorsBefore(JKQTPEnhancedPainter &painter)
JKQTPXYParametrizedScatterGraph::JKQTPXYParametrizedScatterGraph(JKQTBasePlotter *parent):
JKQTPXYLineGraph(parent),
JKQTPColorPaletteStyleAndToolsMixin(parent)
JKQTPXYGraph(parent),
JKQTPColorPaletteStyleAndToolsMixin(parent),
drawLine(false)
{
sizeColumn=-1;
colorColumn=-1;
@ -748,19 +749,19 @@ void JKQTPXYParametrizedScatterGraph::setSymbolFillDerivationMode(JKQTPColorDeri
void JKQTPXYParametrizedScatterGraph::setParent(JKQTBasePlotter *parent)
{
JKQTPXYLineGraph::setParent(parent);
JKQTPXYGraph::setParent(parent);
cbSetParent(parent);
}
void JKQTPXYParametrizedScatterGraph::getOutsideSize(JKQTPEnhancedPainter &painter, int &leftSpace, int &rightSpace, int &topSpace, int &bottomSpace)
{
JKQTPXYLineGraph::getOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
JKQTPXYGraph::getOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
if (showColorBar&& colorColumn>=0 && !colorColumnContainsRGB) cbGetOutsideSize(painter, leftSpace, rightSpace, topSpace, bottomSpace);
}
void JKQTPXYParametrizedScatterGraph::drawOutside(JKQTPEnhancedPainter &painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace)
{
JKQTPXYLineGraph::drawOutside(painter, leftSpace, rightSpace, topSpace, bottomSpace);
JKQTPXYGraph::drawOutside(painter, leftSpace, rightSpace, topSpace, bottomSpace);
if (showColorBar&& colorColumn>=0 && !colorColumnContainsRGB) cbDrawOutside(painter, leftSpace, rightSpace, topSpace, bottomSpace);
}
@ -803,7 +804,26 @@ void JKQTPXYParametrizedScatterGraph::cbGetDataMinMax(double &dmin, double &dmax
bool JKQTPXYParametrizedScatterGraph::usesColumn(int c) const
{
return (c==colorColumn) || (c==sizeColumn) || (c==symbolColumn) || (c==linewidthColumn) || JKQTPXYLineGraph::usesColumn(c);
return (c==colorColumn) || (c==sizeColumn) || (c==symbolColumn) || (c==linewidthColumn) || JKQTPXYGraph::usesColumn(c);
}
void JKQTPXYParametrizedScatterGraph::setDrawLine(bool __value)
{
drawLine=__value;
}
bool JKQTPXYParametrizedScatterGraph::getDrawLine() const
{
return drawLine;
}
void JKQTPXYParametrizedScatterGraph::setColor(QColor c)
{
setLineColor(c);
setSymbolColor(c);
setSymbolFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphsStyle.defaultGraphStyle.fillColorDerivationMode, c));
c.setAlphaF(0.5);
setHighlightingLineColor(c);
}
@ -884,7 +904,7 @@ JKQTPXYParametrizedErrorScatterGraph::JKQTPXYParametrizedErrorScatterGraph(JKQTP
bool JKQTPXYParametrizedErrorScatterGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{
if (xErrorColumn<0 || xErrorStyle==JKQTPNoError) {
return JKQTPXYLineGraph::getXMinMax(minx, maxx, smallestGreaterZero);
return JKQTPXYGraph::getXMinMax(minx, maxx, smallestGreaterZero);
} else {
bool start=true;
minx=0;
@ -922,7 +942,7 @@ bool JKQTPXYParametrizedErrorScatterGraph::getXMinMax(double &minx, double &maxx
bool JKQTPXYParametrizedErrorScatterGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
{
if (yErrorColumn<0 || yErrorStyle==JKQTPNoError) {
return JKQTPXYLineGraph::getYMinMax(miny, maxy, smallestGreaterZero);
return JKQTPXYGraph::getYMinMax(miny, maxy, smallestGreaterZero);
} else {
bool start=true;
miny=0;

View File

@ -123,7 +123,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXYLineGraph: public JKQTPXYGraph, public JKQTP
\see JKQTPXYParametrizedErrorScatterGraph, \ref JKQTPlotterParamScatter , \ref JKQTPlotterParamScatterImage, \ref JKQTPlotterParametricCurves
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLineGraph, public JKQTPColorPaletteStyleAndToolsMixin {
class JKQTPLOTTER_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYGraph, public JKQTPGraphLineStyleMixin, public JKQTPGraphSymbolStyleMixin, public JKQTPColorPaletteStyleAndToolsMixin {
Q_OBJECT
public:
/** \brief functor, which converts the value of the symbol column (at a location x,y) into a JKQTPGraphSymbols */
@ -312,8 +312,18 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXYParametrizedScatterGraph: public JKQTPXYLine
virtual void cbGetDataMinMax(double& imin, double& imax) override;
/** \copydoc JKQTPGraph::usesColumn() */
virtual bool usesColumn(int c) const override;
/** \copydoc drawLine */
void setDrawLine(bool __value);
/** \copydoc drawLine */
bool getDrawLine() const;
/** \brief set color of line and symbol */
void setColor(QColor c);
protected:
/** \brief indicates whether to draw a line or not */
bool drawLine;
/** \brief this column contains the symbol size in pt */
int sizeColumn;
/** \brief this column contains the symbol color */