diff --git a/examples/multithreaded/README.md b/examples/multithreaded/README.md index 16ed638f9b..2d7912b12c 100644 --- a/examples/multithreaded/README.md +++ b/examples/multithreaded/README.md @@ -95,12 +95,12 @@ This test results in the following numbers (on my AMD Ryzen5 8/16-core laptop): [comment]:RESULTS VERSION: 5.0.0 -BUILD MODE: Release +BUILD MODE: Debug -SERIAL RESULTS:
runtime, overall = 4241.3ms
single runtimes = (176.7 +/- 319.6) ms
speedup = 1.00x
threads / available = 1 / 16


+SERIAL RESULTS:
runtime, overall = 31006.5ms
single runtimes = (1291.2 +/- 2643.4) ms
speedup = 1.00x
threads / available = 1 / 16


PARALLEL RESULTS:
-runtime, overall = 1025.3ms
single runtimes = (325.0 +/- 15.0) ms
speedup = 7.61x
threads / available = 8 / 16
batch runs = 3

speedup vs. serial = 4.1x +runtime, overall = 9779.0ms
single runtimes = (2961.1 +/- 921.5) ms
speedup = 7.27x
threads / available = 8 / 16
batch runs = 3

speedup vs. serial = 3.2x [comment]:RESULTS_END diff --git a/lib/jkqtplotter/jkqtpcoordinateaxes.cpp b/lib/jkqtplotter/jkqtpcoordinateaxes.cpp index aafd9b5634..f8b815b518 100644 --- a/lib/jkqtplotter/jkqtpcoordinateaxes.cpp +++ b/lib/jkqtplotter/jkqtpcoordinateaxes.cpp @@ -2141,6 +2141,40 @@ double JKQTPVerticalIndependentAxis::parentOtherAxisX2P(double /*x*/) const 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(); } + + +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)); +} diff --git a/lib/jkqtplotter/jkqtpcoordinateaxes.h b/lib/jkqtplotter/jkqtpcoordinateaxes.h index 0daefbe14f..74bb5de954 100644 --- a/lib/jkqtplotter/jkqtpcoordinateaxes.h +++ b/lib/jkqtplotter/jkqtpcoordinateaxes.h @@ -1072,6 +1072,10 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPVerticalIndependentAxis: public JKQTPVerticalA virtual double getParentOtheraxisOffset() const override; /** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */ 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: /** \brief set the axis offset */ virtual void setAxisOffset(double __value) ; @@ -1255,6 +1259,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPHorizontalIndependentAxis: public JKQTPHorizon virtual double getParentOtheraxisOffset() const override; /** copydoc JKQTPCoordinateAxis::parentOtherAxisX2P() */ 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: /** \brief set the axis offset */ virtual void setAxisOffset(double __value);