From 3c9bd56d9eded34457c421f9e7158083038dc3b8 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Tue, 6 Feb 2024 14:49:14 +0100 Subject: [PATCH] NEW: JKQTPXYGraphLabels which can draw a label next to each datapoint in the given x/y-dataset. The labels can be x-/y- or x&y-coordinates or custom, then defined by a user-supplied functor (+example \ref JKQTPlotterGraphLabels) --- .gitignore | 12 + doc/CMakeLists.txt | 2 + doc/dox/examples_and_tutorials.dox | 3 + doc/dox/jkqtplotter_plotelements_classdoc.dox | 23 +- doc/dox/todo.dox | 1 - doc/dox/whatsnew.dox | 1 + doc/images/JKQTPGLSimple.png | Bin 0 -> 17868 bytes doc/images/JKQTPGLSimpleBoxAndLine.png | Bin 0 -> 18275 bytes .../JKQTPGLSimpleBoxAndLineONLYLABELS.png | Bin 0 -> 17447 bytes ...TPGLSimpleBoxAndLineONLYLABELSVertical.png | Bin 0 -> 16665 bytes ...mpleBoxAndLineONLYLABELSVertical_small.png | Bin 0 -> 6904 bytes ...KQTPGLSimpleBoxAndLineONLYLABELS_small.png | Bin 0 -> 6892 bytes .../JKQTPGLSimpleBoxAndLineVertical.png | Bin 0 -> 18063 bytes doc/images/JKQTPGLSimpleVertical.png | Bin 0 -> 18032 bytes doc/images/JKQTPGLabelAboveData.png | Bin 0 -> 16030 bytes doc/images/JKQTPGLabelAwayFromXAxis.png | Bin 0 -> 15659 bytes doc/images/JKQTPGLabelAwayFromYAxis.png | Bin 0 -> 15885 bytes doc/images/JKQTPGLabelBelowData.png | Bin 0 -> 16022 bytes doc/images/JKQTPGLabelLeftHandSide.png | Bin 0 -> 16282 bytes doc/images/JKQTPGLabelRightHandSide.png | Bin 0 -> 16344 bytes doc/images/JKQTPGLabelTowardsXAxis.png | Bin 0 -> 16348 bytes doc/images/JKQTPGLabelTowardsYAxis.png | Bin 0 -> 16614 bytes doc/images/jkqtpxygraphlabels.png | Bin 0 -> 11903 bytes doc/images/jkqtpxygraphlabels.svg | 310 +++++++++++ examples/CMakeLists.txt | 1 + examples/graphlabels/CMakeLists.txt | 25 + examples/graphlabels/README.md | 16 + examples/graphlabels/graphlabels.cpp | 144 +++++ examples/multithreaded/README.md | 4 +- lib/jkqtplotter.pri | 2 + lib/jkqtplotter/graphs/CMakeLists.txt | 6 +- .../graphs/jkqtpboxplotstylingmixins.h | 2 +- lib/jkqtplotter/graphs/jkqtpgraphlabels.cpp | 216 ++++++++ lib/jkqtplotter/graphs/jkqtpgraphlabels.h | 168 ++++++ .../graphs/jkqtpgraphlabelstylemixin.cpp | 524 ++++++++++++++++++ .../graphs/jkqtpgraphlabelstylemixin.h | 429 ++++++++++++++ .../graphs/jkqtpviolinplotstylingmixins.h | 2 +- .../jkqtpgraphsbasestylingmixins.cpp | 68 ++- screenshots/graphlabels.png | Bin 0 -> 14176 bytes screenshots/graphlabels_hor.png | Bin 0 -> 14299 bytes screenshots/graphlabels_hor_small.png | Bin 0 -> 6709 bytes screenshots/graphlabels_small.png | Bin 0 -> 6496 bytes 42 files changed, 1931 insertions(+), 28 deletions(-) create mode 100644 doc/images/JKQTPGLSimple.png create mode 100644 doc/images/JKQTPGLSimpleBoxAndLine.png create mode 100644 doc/images/JKQTPGLSimpleBoxAndLineONLYLABELS.png create mode 100644 doc/images/JKQTPGLSimpleBoxAndLineONLYLABELSVertical.png create mode 100644 doc/images/JKQTPGLSimpleBoxAndLineONLYLABELSVertical_small.png create mode 100644 doc/images/JKQTPGLSimpleBoxAndLineONLYLABELS_small.png create mode 100644 doc/images/JKQTPGLSimpleBoxAndLineVertical.png create mode 100644 doc/images/JKQTPGLSimpleVertical.png create mode 100644 doc/images/JKQTPGLabelAboveData.png create mode 100644 doc/images/JKQTPGLabelAwayFromXAxis.png create mode 100644 doc/images/JKQTPGLabelAwayFromYAxis.png create mode 100644 doc/images/JKQTPGLabelBelowData.png create mode 100644 doc/images/JKQTPGLabelLeftHandSide.png create mode 100644 doc/images/JKQTPGLabelRightHandSide.png create mode 100644 doc/images/JKQTPGLabelTowardsXAxis.png create mode 100644 doc/images/JKQTPGLabelTowardsYAxis.png create mode 100644 doc/images/jkqtpxygraphlabels.png create mode 100644 doc/images/jkqtpxygraphlabels.svg create mode 100644 examples/graphlabels/CMakeLists.txt create mode 100644 examples/graphlabels/README.md create mode 100644 examples/graphlabels/graphlabels.cpp create mode 100644 lib/jkqtplotter/graphs/jkqtpgraphlabels.cpp create mode 100644 lib/jkqtplotter/graphs/jkqtpgraphlabels.h create mode 100644 lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.cpp create mode 100644 lib/jkqtplotter/graphs/jkqtpgraphlabelstylemixin.h create mode 100644 screenshots/graphlabels.png create mode 100644 screenshots/graphlabels_hor.png create mode 100644 screenshots/graphlabels_hor_small.png create mode 100644 screenshots/graphlabels_small.png diff --git a/.gitignore b/.gitignore index 457645d81b..724b21d971 100644 --- a/.gitignore +++ b/.gitignore @@ -164,3 +164,15 @@ Sicherungskopie_* /screenshots/datastore_statistics_dataonly_small.png /screenshots/datastore_statistics_hist_small.png /screenshots/datastore_statistics_kde_small.png +/doc/images/JKQTPGLSimpleBoxAndLineVertical_small.png +/doc/images/JKQTPGLSimpleBoxAndLine_small.png +/doc/images/JKQTPGLSimpleVertical_small.png +/doc/images/JKQTPGLSimple_small.png +/doc/images/JKQTPGLabelAboveData_small.png +/doc/images/JKQTPGLabelAwayFromXAxis_small.png +/doc/images/JKQTPGLabelAwayFromYAxis_small.png +/doc/images/JKQTPGLabelBelowData_small.png +/doc/images/JKQTPGLabelLeftHandSide_small.png +/doc/images/JKQTPGLabelRightHandSide_small.png +/doc/images/JKQTPGLabelTowardsXAxis_small.png +/doc/images/JKQTPGLabelTowardsYAxis_small.png diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 9178be74f8..41a17e383f 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -244,6 +244,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) datastore_statistics_2d/datastore_statistics_2d multithreaded/multithreaded/--mdfile=${CMAKE_CURRENT_LIST_DIR}/../examples/multithreaded/README.md #"multithreaded_complex[multithreaded]/multithreaded_complex/--mdfile=${CMAKE_CURRENT_LIST_DIR}/../examples/multithreaded/README.md --complexlabel" + graphlabels/graphlabels,graphlabels_hor ) @@ -271,6 +272,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,JKQTPGLSimple,JKQTPGLSimpleVertical,JKQTPGLSimpleBoxAndLine,JKQTPGLSimpleBoxAndLineVertical,JKQTPGLSimpleBoxAndLineONLYLABELS,JKQTPGLSimpleBoxAndLineONLYLABELSVertical/--iteratefunctorsteps--smallscreenshotplot ) diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox index d31948cd18..475b312e5a 100644 --- a/doc/dox/examples_and_tutorials.dox +++ b/doc/dox/examples_and_tutorials.dox @@ -113,6 +113,9 @@ All test-projects are Qt-projects that use qmake to build. You can load them int \image html geo_coordinateaxis0_small.png \subpage JKQTPlotterGeometricCoordinateAxis0 `JKQTPCoordinateAxisStyle::drawMode0`, `JKQTPGeoPolygon`, `JKQTPGeoEllipse` + \image html JKQTPGLSimpleBoxAndLineONLYLABELS_small.png + \subpage JKQTPXYGraphLabels + `JKQTPXYGraphLabels` \subsection jkqtp_extut_keyaxesstyles Examples for Styling the Plot, Keys, Axes, ... diff --git a/doc/dox/jkqtplotter_plotelements_classdoc.dox b/doc/dox/jkqtplotter_plotelements_classdoc.dox index d68c72dfdb..a790e137e3 100644 --- a/doc/dox/jkqtplotter_plotelements_classdoc.dox +++ b/doc/dox/jkqtplotter_plotelements_classdoc.dox @@ -29,7 +29,10 @@ These classes are used by JKQTPlotterBase to output the plot. \defgroup jkqtplotter_basegraphserrors Mix-In Classes for Error Indicators \ingroup jkqtplotter_mixins -\defgroup jkqtplotter_basegraphs_stylemixins Mix-In Classes for Plot Styling +\defgroup jkqtplotter_basegraphs_stylemixins Mix-In Classes for Styling General Graphs +\ingroup jkqtplotter_mixins + +\defgroup jkqtplotter_specialgraphs_stylemixins Mix-In Classes for Styling Specialized Graphs (Boxplots etz.) \ingroup jkqtplotter_mixins @@ -116,6 +119,21 @@ This group assembles graphs that show their data with symbols and optionally wit +\defgroup jkqtplotter_graphlabels Labeling Datapoints +\ingroup jkqtplotter_concretegraphs + +This group assembles graphs that add (textual) labels to the datapoints in a plot: + + + +
Screenshot + Classes +
\image html JKQTPGLSimpleBoxAndLineONLYLABELS_small.png + JKQTPXYGraphLabels +
+ + + \defgroup jkqtplotter_filledgraphs Filled Polygon/Area Graphs \ingroup jkqtplotter_concretegraphs @@ -243,6 +261,9 @@ Examples: \image html geo_text_small.png JKQTPGeoText + + \image html JKQTPGLSimpleBoxAndLineONLYLABELS_small.png + JKQTPXYGraphLabels \image html JKQTPHorizontalRange_small.png JKQTPHorizontalRange, JKQTPVerticalRange diff --git a/doc/dox/todo.dox b/doc/dox/todo.dox index fcb914dab6..4c0a8ce3ad 100644 --- a/doc/dox/todo.dox +++ b/doc/dox/todo.dox @@ -20,7 +20,6 @@ This page lists several todos and wishes for future version of JKQTPlotter
  • graphs: gant-chart as simplified vector field with (x,y1,y2) or (x1,x2,y), or (x,y,dx), (x,y,dy) ... different head/tail style
  • graphs: matrix plots with boxes, labels, ...
  • graphs: matrix plots with symbols: symbol-type, color, size should be parametric, cf. scatter plots
  • -
  • graphs: text labels at positions/for graphs
  • graphs: vector field graph (arrows), variant (x,y,dx,dy), (x,y,alpha,length), (x1,y1,x2,y2) ... different head/tail styles
  • graphs: waterfall charts (see https://en.wikipedia.org/wiki/Waterfall_chart)
  • graphs: parametrized variant of JKQTPSingleColumnSymbolsGraph (beeswarm plots etz.) where each symbol may have a color given by a second column
  • diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index c59a08f60d..102d86b484 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -127,6 +127,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • NEW/REWORKED all functions in JKQTBasePlotter are re-entrant, i.e. different instances can be used from different threads in parallel (although there is some overhead due to shared caches between the threads!). This is demonstrated and discussed in \ref JKQTPlotterMultiThreaded .
  • NEW: allow linear-gradient(), currentcolor, ... in brush definitions of style.ini-file ... and using it is cyberpunk and dark styles
  • NEW: style simple_noaxes.ini
  • +
  • NEW: JKQTPXYGraphLabels which can draw a label next to each datapoint in the given x/y-dataset. The labels can be x-/y- or x&y-coordinates or custom, then defined by a user-supplied functor (+example \ref JKQTPlotterGraphLabels)
  • JKQTMathText: