From e2057ae27a2e02a8012aecf0a050844a5400049a Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Thu, 8 Feb 2024 21:52:30 +0100 Subject: [PATCH] NEW: Base class JKQTPXYAndVectorGraph for graphs like vector fields, e.g. (x,y,dx,dy) or (x,y,angle,length) NEW: ... and an actual implementation JKQTPVectorFieldGraph (+example) --- doc/CMakeLists.txt | 2 + doc/dox/examples_and_tutorials.dox | 5 +- doc/dox/jkqtplotter_graphs.dox | 8 +- doc/dox/jkqtplotter_plotelements_classdoc.dox | 15 ++ doc/dox/todo.dox | 1 - doc/dox/whatsnew.dox | 1 + doc/images/JKQTPVectorFieldGraph.png | Bin 0 -> 57678 bytes .../JKQTPVectorFieldGraphAnchorBottom.png | Bin 0 -> 68871 bytes doc/images/JKQTPVectorFieldGraphAnchorMid.png | Bin 0 -> 68568 bytes doc/images/JKQTPVectorFieldGraphAnchorTip.png | Bin 0 -> 69066 bytes examples/CMakeLists.txt | 1 + examples/vectorfield/CMakeLists.txt | 25 +++ examples/vectorfield/README.md | 35 ++++ examples/vectorfield/vectorfield.cpp | 85 +++++++++ lib/jkqtcommon/jkqtpmathtools.h | 14 ++ lib/jkqtplotter.pri | 4 +- lib/jkqtplotter/graphs/CMakeLists.txt | 2 + lib/jkqtplotter/graphs/jkqtpvectorfield.cpp | 174 ++++++++++++++++++ lib/jkqtplotter/graphs/jkqtpvectorfield.h | 133 +++++++++++++ lib/jkqtplotter/jkqtpdatastorage.h | 3 + lib/jkqtplotter/jkqtpgraphsbase.cpp | 142 ++++++++++++++ lib/jkqtplotter/jkqtpgraphsbase.h | 118 ++++++++++++ screenshots/vectorfield.png | Bin 0 -> 53453 bytes screenshots/vectorfield_small.png | Bin 0 -> 20401 bytes 24 files changed, 763 insertions(+), 5 deletions(-) create mode 100644 doc/images/JKQTPVectorFieldGraph.png create mode 100644 doc/images/JKQTPVectorFieldGraphAnchorBottom.png create mode 100644 doc/images/JKQTPVectorFieldGraphAnchorMid.png create mode 100644 doc/images/JKQTPVectorFieldGraphAnchorTip.png create mode 100644 examples/vectorfield/CMakeLists.txt create mode 100644 examples/vectorfield/README.md create mode 100644 examples/vectorfield/vectorfield.cpp create mode 100644 lib/jkqtplotter/graphs/jkqtpvectorfield.cpp create mode 100644 lib/jkqtplotter/graphs/jkqtpvectorfield.h create mode 100644 screenshots/vectorfield.png create mode 100644 screenshots/vectorfield_small.png diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 6f9ef68983..2afad3a03a 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -245,6 +245,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) 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 + vectorfield ) @@ -273,6 +274,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) 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 + vectorfield/JKQTPVectorFieldGraph,JKQTPVectorFieldGraphAnchorBottom,JKQTPVectorFieldGraphAnchorMid,JKQTPVectorFieldGraphAnchorTip/--iteratefunctorsteps ) diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox index 475b312e5a..7319c8323c 100644 --- a/doc/dox/examples_and_tutorials.dox +++ b/doc/dox/examples_and_tutorials.dox @@ -94,6 +94,9 @@ All test-projects are Qt-projects that use qmake to build. You can load them int \image html violinplot_small.png \subpage JKQTPlotterViolinplotGraphs `JKQTPViolinplotVerticalElement`, `JKQTPViolinplotHorizontalElement`, ... + \image html vectorfield_small.png + \subpage JKQTPlotterVectorFieldExample + `JKQTPVectorFieldGraph` @@ -114,7 +117,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int \subpage JKQTPlotterGeometricCoordinateAxis0 `JKQTPCoordinateAxisStyle::drawMode0`, `JKQTPGeoPolygon`, `JKQTPGeoEllipse` \image html JKQTPGLSimpleBoxAndLineONLYLABELS_small.png - \subpage JKQTPXYGraphLabels + \subpage JKQTPlotterGraphLabelsExample `JKQTPXYGraphLabels` diff --git a/doc/dox/jkqtplotter_graphs.dox b/doc/dox/jkqtplotter_graphs.dox index 29074776ff..38369f4cc3 100644 --- a/doc/dox/jkqtplotter_graphs.dox +++ b/doc/dox/jkqtplotter_graphs.dox @@ -75,13 +75,17 @@ rank=same; JKQTPXYYGraph [URL="\ref JKQTPXYYGraph"] - noteJKQTPXYYGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x, y1, y2) data tripels"]; + noteJKQTPXYYGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x, y1, y2) data triples"]; JKQTPXYYGraph -> noteJKQTPXYYGraph [style=dashed,arrowhead=none]; JKQTPXXYGraph [URL="\ref JKQTPXXYGraph"] - noteJKQTPXXYGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x1, x2, y) data tripels"]; + noteJKQTPXXYGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x1, x2, y) data triples"]; JKQTPXXYGraph -> noteJKQTPXXYGraph [style=dashed,arrowhead=none]; + JKQTPXYAndVectorGraph [URL="\ref JKQTPXYAndVectorGraph"] + noteJJKQTPXYAndVectorGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\nvector field graphs based on\n (x, y, dx, dy) data quadruples"]; + JKQTPXYAndVectorGraph -> noteJJKQTPXYAndVectorGraph [style=dashed,arrowhead=none]; + JKQTPXYBaselineGraph [URL="\ref JKQTPXYBaselineGraph"] noteJJKQTPXYBaselineGraph [shape="note", color="lightyellow",style=filled,fontsize=8,label="base class for all\ngraphs based on\n (x,y) data pairs and a baseline"]; JKQTPXYBaselineGraph -> noteJJKQTPXYBaselineGraph [style=dashed,arrowhead=none]; diff --git a/doc/dox/jkqtplotter_plotelements_classdoc.dox b/doc/dox/jkqtplotter_plotelements_classdoc.dox index a790e137e3..517287d21e 100644 --- a/doc/dox/jkqtplotter_plotelements_classdoc.dox +++ b/doc/dox/jkqtplotter_plotelements_classdoc.dox @@ -285,6 +285,21 @@ Examples: JKQTPPeakStreamGraph + +\defgroup jkqtplotter_vectorfieldgraphs Vector Fields +\ingroup jkqtplotter_concretegraphs + +This group assembles graphs that represent vector fields (i.e. sets of quadruples (x,y,dx,dy) or (x,y,angle,lengthh) in a plot: + + + +
Screenshot + Classes +
\image html vectorfield_small.png + JKQTPVectorFieldGraph +
+ + \defgroup jkqtplotter_imagelots Matrix/Image Plotting \ingroup jkqtplotter_concretegraphs diff --git a/doc/dox/todo.dox b/doc/dox/todo.dox index 4c0a8ce3ad..94d56785f6 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: 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
  • graphs: option for JKQTPSingleColumnSymbolsGraph (beeswarm plots etz.) to have a distribution only on one side of the center (left or right)
  • diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index bb89e7faea..25054c5088 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -128,6 +128,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • 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 JKQTPlotterGraphLabelsExample)
  • +
  • NEW: Base class JKQTPXYAndVectorGraph for graphs like vector fields, e.g. (x,y,dx,dy) or (x,y,angle,length) and an actual implementation JKQTPVectorFieldGraph (+example \ref JKQTPlotterVectorFieldExample)
  • JKQTMathText: