From 24526aa6a549fc77574be4e1941f741e9f5d8750 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Fri, 9 Feb 2024 16:59:14 +0100 Subject: [PATCH] NEW: added JKQTPGLabelCenteredOnData to JKQTPGraphLabelPosition, so JKQTPXYGraphLabels can draw directly centered over the datapoint --- .gitignore | 3 +++ doc/CMakeLists.txt | 2 +- doc/images/JKQTPGLabelCenteredOnData.png | Bin 0 -> 14616 bytes examples/graphlabels/graphlabels.cpp | 12 ++++++++++++ .../graphs/jkqtpgraphlabelstylemixin.cpp | 10 +++++++++- .../graphs/jkqtpgraphlabelstylemixin.h | 5 ++++- 6 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 doc/images/JKQTPGLabelCenteredOnData.png diff --git a/.gitignore b/.gitignore index 514a656667..b7779bff54 100644 --- a/.gitignore +++ b/.gitignore @@ -178,3 +178,6 @@ Sicherungskopie_* /doc/images/JKQTPGLabelTowardsYAxis_small.png /doc/images/JKQTPGLSimpleBoxVertical_small.png /doc/images/JKQTPGLSimpleBox_small.png +/doc/images/JKQTPGLabelCenteredOnDataVertical.png +/doc/images/JKQTPGLabelCenteredOnDataVertical_small.png +/doc/images/JKQTPGLabelCenteredOnData_small.png diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index db2c5f4b27..581818fd9c 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -273,7 +273,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) symbols_and_errors/JKQTPXYLineErrorGraph_JKQTPErrorBars,JKQTPXYLineErrorGraph_JKQTPErrorLines,JKQTPXYLineErrorGraph_JKQTPErrorPolygons/--iteratefunctorsteps--iteratefunctorsteps_suppressinitial--smallscreenshotplot boxplot/JKQTPBoxplotVerticalGraph,JKQTPBoxplotHorizontalGraph/--iteratefunctorsteps--iteratefunctorsteps_suppressinitial--smallscreenshotplot second_axis/JKQTBasePlotter_addSecondaryYAxis,JKQTBasePlotter_addSecondaryXAxis - graphlabels/JKQTPGLabelAwayFromXAxis,JKQTPGLabelAwayFromYAxis,JKQTPGLabelTowardsXAxis,JKQTPGLabelTowardsYAxis,JKQTPGLabelAboveData,JKQTPGLabelRightHandSide,JKQTPGLabelBelowData,JKQTPGLabelLeftHandSide,JKQTPGLSimpleBox,JKQTPGLSimpleBoxVertical,JKQTPGLSimpleBoxAndLine,JKQTPGLSimpleBoxAndLineVertical,JKQTPGLSimpleBoxAndLineONLYLABELS,JKQTPGLSimpleBoxAndLineONLYLABELSVertical/--iteratefunctorsteps--smallscreenshotplot + graphlabels/JKQTPGLabelAwayFromXAxis,JKQTPGLabelAwayFromYAxis,JKQTPGLabelTowardsXAxis,JKQTPGLabelTowardsYAxis,JKQTPGLabelAboveData,JKQTPGLabelRightHandSide,JKQTPGLabelBelowData,JKQTPGLabelLeftHandSide,JKQTPGLabelCenteredOnData,JKQTPGLabelCenteredOnDataVertical,JKQTPGLSimpleBox,JKQTPGLSimpleBoxVertical,JKQTPGLSimpleBoxAndLine,JKQTPGLSimpleBoxAndLineVertical,JKQTPGLSimpleBoxAndLineONLYLABELS,JKQTPGLSimpleBoxAndLineONLYLABELSVertical/--iteratefunctorsteps--smallscreenshotplot vectorfield/JKQTPVectorFieldGraph,JKQTPVectorFieldGraphAnchorBottom,JKQTPVectorFieldGraphAnchorMid,JKQTPVectorFieldGraphAnchorTip,JKQTPVectorFieldGraphAutoscaleLength,JKQTPVectorFieldGraphLengthFromData,JKQTPVectorFieldGraphIgnoreLength,JKQTPVectorFieldGraphIgnoreLengthAutoscaleLineWidthFromLength,JKQTPVectorFieldGraphAutoscaleLengthAutoscaleLineWidthFromLength/--iteratefunctorsteps ) diff --git a/doc/images/JKQTPGLabelCenteredOnData.png b/doc/images/JKQTPGLabelCenteredOnData.png new file mode 100644 index 0000000000000000000000000000000000000000..39d4d5a53e112bef9cf362bb1ccfa99d73a05c6d GIT binary patch literal 14616 zcmZv@1z6Qh*FAg?q@=q;Qt9qeP(V_oySuv^kyb!KIuryck?sab=}zhHI>3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&x+)1B||$Viz6v&~Fp z{|Xm?6EKM+G&EGyE2ohLOcHd(;IfKscbAA%a8?eC#u8RY=1J*?0(0|tJ=+t`z~5om zQM^$G5snXFCdYN)$pHQ5L+7n=CU1#&}FIXxzQm9=JH%ygR`@ zgCz0Ur&G??yQ3w#4N=yfifi2)DRgRG-pRz%!&HA`W15I;v}7kwPXVBtm=C08mYTEw zf&f0-EfJU{%*u)5dvZPf7!%;8r>Db#+XB`5N~O4<;PKJ^}n1qZZS}#`jxhg9n_J2`_Z@myJk70RD+o{?>Fe-_)U#6Y^vRMNroCeDT8|; z0N;b=$2w!@(a-rMJvX5|H_eLj|ME1Tx&v=XK$eKFBFrXmNhnsWxGv(lh3CB1mj!5F zx>p~oV*p>AGCQktmbNe$&Owt*!BwL^2y%t-pYHd-xHYxw;poT#$WSs-pClwopCKgs z5wToykF!Ud;l(XVc8qC2LV>Fmic$CvqyxNZ4Pu+Kv-4D=uMkaV6oLWpnn8;3*FdfS z9tar9dfEgeJqWCCoJ)6JZbyNpC0x;vvkRH+l7_dTp^hgsR zwTSG4t-_MmZ{D;=;4=x2<5N-&-rij6QV*-^`zCIVU8}N79}7P1*hWF z_j?j}!StCmf3&lNjP(HB`#^OtC;sBXW4uIvVYiyW4dgBdnukp=V3T|f^I}2fCjvdP zw_974Uf!Rxza$J84h1~1m9)@7RMbDb%-^e92f)fLfd!uNUndIOc)B-w{&NlM-p&W} zYTg&PzgIVa=ko7GGuW*t7+Z6H4eYNa_*B5|M_1)*;PH)`Mw6_pGs zwBXp2<=`r59bo$twnPxv4hB9!yRJHcIBRV6o0!lBSp2h0>_2&=fj|l_ z70tyk6%-V}mA-`C4Ri#w`u(CWi~k+qKQXuyBXQaoKQoRk1y>y*GExeX#m@|a{vTG? B)bs!V literal 0 HcmV?d00001 diff --git a/examples/graphlabels/graphlabels.cpp b/examples/graphlabels/graphlabels.cpp index 623f7d7968..f052b427c3 100644 --- a/examples/graphlabels/graphlabels.cpp +++ b/examples/graphlabels/graphlabels.cpp @@ -110,7 +110,19 @@ int main(int argc, char* argv[]) plotV.redrawPlot(); plotH.redrawPlot(); }); + app.addExportStepFunctor([&](){ + gV.second->setLabelPosition(JKQTPGLabelCenteredOnData); + gH.second->setLabelPosition(JKQTPGLabelCenteredOnData); + gV.first->setVisible(false); + gH.first->setVisible(false); + plotV.redrawPlot(); + plotH.redrawPlot(); + }); + + app.addExportStepFunctor([&](){ + gV.first->setVisible(true); + gH.first->setVisible(true); gV.second->setLabelPosition(JKQTPGLabelAwayFromXAxis); gV.second->setLabelBoxType(JKQTPGLSimpleBox); gV.second->setDrawLabelBoxFrame(true); diff --git a/lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.cpp b/lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.cpp index 40dd7f0033..f5a8b57cf6 100644 --- a/lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.cpp +++ b/lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.cpp @@ -35,6 +35,7 @@ QString JKQTPGraphLabelPosition2String(JKQTPGraphLabelPosition pos) case JKQTPGLabelAwayFromYAxis: return "label_away_from_yaxis"; case JKQTPGLabelTowardsXAxis: return "label_towards_xaxis"; case JKQTPGLabelTowardsYAxis: return "label_towards_xaxis"; + case JKQTPGLabelCenteredOnData: return "label_centered"; } return "label_away_from_xaxis"; } @@ -50,6 +51,7 @@ JKQTPGraphLabelPosition String2JKQTPGraphLabelPosition(const QString &pos) if (m=="label_away_from_yaxis" || m=="away_from_yaxis") return JKQTPGLabelAwayFromYAxis; if (m=="label_towars_xaxis" || m=="towars_xaxis") return JKQTPGLabelTowardsXAxis; if (m=="label_towars_yaxis" || m=="towars_yaxis") return JKQTPGLabelTowardsYAxis; + if (m=="label_centered" || m=="centered" || m=="label_centered_on_data" || m=="centered_on_data") return JKQTPGLabelCenteredOnData; return JKQTPGraphLabelDefault; } @@ -185,6 +187,7 @@ bool JKQTPGraphValueLabelStyleMixin::isLabelPositioningGrowingInX() const case JKQTPGLabelAwayFromXAxis: case JKQTPGLabelTowardsXAxis: case JKQTPGLabelTowardsYAxis: + case JKQTPGLabelCenteredOnData: return false; } return false; @@ -202,6 +205,7 @@ bool JKQTPGraphValueLabelStyleMixin::isLabelPositioningGrowingInY() const case JKQTPGLabelTowardsYAxis: case JKQTPGLabelLeftHandSide: case JKQTPGLabelRightHandSide: + case JKQTPGLabelCenteredOnData: return false; } return false; @@ -257,7 +261,8 @@ void JKQTPGraphValueLabelStyleMixin::drawLabel(JKQTPEnhancedPainter &painter, co case LabelGeometry::BoxBottom: painter.drawLine(xDataPixel, QPointF(xDataPixel.x(), qMin(g.boxRect.top(),g.boxRect.bottom()))); break; - + case LabelGeometry::BoxCentered: + break; } } @@ -296,6 +301,9 @@ JKQTPGraphValueLabelStyleMixin::LabelGeometry JKQTPGraphValueLabelStyleMixin::ca // rhs res.textRect=QRectF(xDataPixel.x()+res.labelOffsetPx+res.padX+res.lw/2.0, xDataPixel.y()-res.textSize.overallHeight/2.0, res.textSize.width, res.textSize.overallHeight); res.boxpos=LabelGeometry::BoxRight; + } else if (m_labelPosition==JKQTPGLabelCenteredOnData) { + res.textRect=QRectF(xDataPixel.x()-res.textSize.width/2.0, xDataPixel.y()-res.textSize.overallHeight/2.0, res.textSize.width, res.textSize.overallHeight); + res.boxpos=LabelGeometry::BoxCentered; } res.boxRect=QRectF(res.textRect.x()-res.padX-res.lw/2.0, res.textRect.y()-res.padY-res.lw/2.0, res.textRect.width()+res.padX*2.0+res.lw, res.textRect.height()+res.padY*2.0+res.lw); diff --git a/lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.h b/lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.h index be89ca71f3..c957bee852 100644 --- a/lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.h +++ b/lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.h @@ -52,6 +52,8 @@ enum JKQTPGraphLabelPosition { JKQTPGLabelLeftHandSide, /*!< \brief all labels always on the left-hand side of the datapoint \image html JKQTPGLabelLeftHandSide.png */ JKQTPGLabelTowardsYAxis, /*!< \brief all labels between the datapoint and the y-axis the datapoint \image html JKQTPGLabelTowardsYAxis.png */ JKQTPGLabelAwayFromYAxis, /*!< \brief all labels pointing away from the y-axis \image html JKQTPGLabelAwayFromYAxis.png */ + JKQTPGLabelCenteredOnData, /*!< \brief graph label is drawn centered arond the data point \c (x,y) \image html JKQTPGLabelCenteredOnData.png */ + JKQTPGraphLabelDefault=JKQTPGLabelAwayFromXAxis, }; @@ -223,7 +225,8 @@ protected: BoxLeft, BoxRight, BoxTop, - BoxBottom + BoxBottom, + BoxCentered }; BoxPos boxpos; };