FIX: color bars did not show a complete frame around

This commit is contained in:
jkriege2 2024-02-02 14:43:10 +01:00
parent 57b298527e
commit 92b8894a3b
3 changed files with 79 additions and 3 deletions

View File

@ -95,12 +95,12 @@ This test results in the following numbers (on my AMD Ryzen5 8/16-core laptop):
[comment]:RESULTS [comment]:RESULTS
<b>VERSION:</b> 5.0.0 <b>VERSION:</b> 5.0.0
<b>BUILD MODE:</b> Release <b>BUILD MODE:</b> Debug
<u><b>SERIAL RESULTS:</b></u><br/>runtime, overall = 4241.3ms<br/>single runtimes = (176.7 +/- 319.6) ms<br/>speedup = 1.00x<br/>threads / available = 1 / 16<br/><br/><br/> <u><b>SERIAL RESULTS:</b></u><br/>runtime, overall = 31006.5ms<br/>single runtimes = (1291.2 +/- 2643.4) ms<br/>speedup = 1.00x<br/>threads / available = 1 / 16<br/><br/><br/>
<u><b>PARALLEL RESULTS:</b></u><br/> <u><b>PARALLEL RESULTS:</b></u><br/>
runtime, overall = 1025.3ms<br/>single runtimes = (325.0 +/- 15.0) ms<br/>speedup = 7.61x<br/>threads / available = 8 / 16<br/>batch runs = 3<br/><br/><b>speedup vs. serial = 4.1x</b> runtime, overall = 9779.0ms<br/>single runtimes = (2961.1 +/- 921.5) ms<br/>speedup = 7.27x<br/>threads / available = 8 / 16<br/>batch runs = 3<br/><br/><b>speedup vs. serial = 3.2x</b>
[comment]:RESULTS_END [comment]:RESULTS_END

View File

@ -2141,6 +2141,40 @@ double JKQTPVerticalIndependentAxis::parentOtherAxisX2P(double /*x*/) const
return qQNaN(); return qQNaN();
} }
void JKQTPVerticalIndependentAxis::drawAxes(JKQTPEnhancedPainter &painter, int move1, int move2)
{
JKQTPVerticalAxisBase::drawAxes(painter,move1,move2);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
const QPen pmain=axisStyle.getAxisPen(painter, parent);
const bool isSecondAxis=isSecondaryAxis();
// correct move1,move2 for the length of inside ticks for secondary axes
double moveForTicks1=0, moveForTicks2=0;
if (isSecondAxis && axisStyle.drawMode1.testFlag(JKQTPCADMTicks)) moveForTicks1=qMax(axisStyle.minorTickInsideLength,axisStyle.tickInsideLength);
if (isSecondAxis && axisStyle.drawMode2.testFlag(JKQTPCADMTicks)) moveForTicks2=qMax(axisStyle.minorTickInsideLength,axisStyle.tickInsideLength);
// determine pixel coordinates of important positions
double top=x2p(axismax);
double bottom=x2p(axismin);
double left=0;
double right=0;
if (inverted) {
qSwap(top, bottom);
}
if (getParentOtheraxisInverted()) {
left=getParentOtheraxisOffset()-getParentOtheraxisWidth();//;
right=getParentOtheraxisOffset();//;
} else {
left=getParentOtheraxisOffset();//;
right=getParentOtheraxisOffset()+getParentOtheraxisWidth();//;
}
// move axes outside plot rectangle, if required
left-=parent->pt2px(painter, axisStyle.axisLineOffset)+move1+moveForTicks1;
right+=parent->pt2px(painter, axisStyle.axisLineOffset)+move2+moveForTicks2;
painter.setPen(pmain);
painter.drawLine(QLineF(left,top,right,top));
painter.drawLine(QLineF(left,bottom,right,bottom));
}
@ -2937,3 +2971,39 @@ double JKQTPHorizontalIndependentAxis::parentOtherAxisX2P(double /*x*/) const
{ {
return qQNaN(); return qQNaN();
} }
void JKQTPHorizontalIndependentAxis::drawAxes(JKQTPEnhancedPainter &painter, int move1, int move2)
{
JKQTPHorizontalAxisBase::drawAxes(painter,move1,move2);
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
const QPen pmain=axisStyle.getAxisPen(painter, parent);
const bool isSecondAxis=isSecondaryAxis();
// correct move1,move2 for the length of inside ticks for secondary axes
double moveForTicks1=0, moveForTicks2=0;
if (isSecondAxis && axisStyle.drawMode1.testFlag(JKQTPCADMTicks)) moveForTicks1=qMax(axisStyle.minorTickInsideLength,axisStyle.tickInsideLength);
if (isSecondAxis && axisStyle.drawMode2.testFlag(JKQTPCADMTicks)) moveForTicks2=qMax(axisStyle.minorTickInsideLength,axisStyle.tickInsideLength);
// determine pixel coordinates of important positions
// determine pixel coordinates of important positions
double right=x2p(axismax);
double left=x2p(axismin);
double bottom=0;
double top=0;
if (inverted) {
qSwap(left, right);
}
if (getParentOtheraxisInverted()) {
top=getParentOtheraxisOffset()-getParentOtheraxisWidth();//;
bottom=getParentOtheraxisOffset();//;
} else {
top=getParentOtheraxisOffset();//;
bottom=getParentOtheraxisOffset()+getParentOtheraxisWidth();//;
}
// move axes outside plot rectangle, if required
top-=parent->pt2px(painter, axisStyle.axisLineOffset)+move2+moveForTicks2;
bottom+=parent->pt2px(painter, axisStyle.axisLineOffset)+move1+moveForTicks1;
painter.setPen(pmain);
painter.drawLine(QLineF(left,top,left,bottom));
painter.drawLine(QLineF(right,top,right,bottom));
}

View File

@ -1072,6 +1072,10 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPVerticalIndependentAxis: public JKQTPVerticalA
virtual double getParentOtheraxisOffset() const override; virtual double getParentOtheraxisOffset() const override;
/** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */ /** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */
virtual double parentOtherAxisX2P(double x) const override; virtual double parentOtherAxisX2P(double x) const override;
/** copydoc JKQTPCoordinateAxis::drawAxes() */
virtual void drawAxes(JKQTPEnhancedPainter& painter, int move1=0, int move2=0) override;
public Q_SLOTS: public Q_SLOTS:
/** \brief set the axis offset */ /** \brief set the axis offset */
virtual void setAxisOffset(double __value) ; virtual void setAxisOffset(double __value) ;
@ -1255,6 +1259,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPHorizontalIndependentAxis: public JKQTPHorizon
virtual double getParentOtheraxisOffset() const override; virtual double getParentOtheraxisOffset() const override;
/** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */ /** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */
virtual double parentOtherAxisX2P(double x) const override; virtual double parentOtherAxisX2P(double x) const override;
/** copydoc JKQTPCoordinateAxis::drawAxes() */
virtual void drawAxes(JKQTPEnhancedPainter& painter, int move1=0, int move2=0) override;
public Q_SLOTS: public Q_SLOTS:
/** \brief set the axis offset */ /** \brief set the axis offset */
virtual void setAxisOffset(double __value); virtual void setAxisOffset(double __value);