From f61b46b96b9fcfcf4bb46c4ca767dfe5a394c853 Mon Sep 17 00:00:00 2001 From: jkriege2 Date: Thu, 23 Mar 2023 13:55:18 +0100 Subject: [PATCH] NEW: secondary axes: added functionality to manage additional secondary axes in a JKQTPBasePlotter and to select which x-/y-Axis to use for drawing a JKQTPPlotElement, see also issue #87 --- doc/CMakeLists.txt | 2 + doc/dox/examples_and_tutorials.dox | 7 +- doc/dox/jkqtplotter_naming.dox | 1 + doc/dox/todo.dox | 1 - doc/dox/whatsnew.dox | 1 + .../JKQTBasePlotter_addSecondaryXAxis.png | Bin 0 -> 54532 bytes .../JKQTBasePlotter_addSecondaryYAxis.png | Bin 0 -> 59528 bytes .../JKQTPCoordinateAxisStyleDrawMode0.png | Bin 17974 -> 21938 bytes doc/images/JKQTPXYFunctionLineGraph.png | Bin 96430 -> 96406 bytes doc/images/JKQTPXYFunctionLineGraph_small.png | Bin 17633 -> 17625 bytes examples/CMakeLists.txt | 1 + examples/second_axis/CMakeLists.txt | 34 ++ examples/second_axis/README.md | 135 +++++++ examples/second_axis/second_axis.cpp | 160 ++++++++ lib/jkqtmath/CMakeLists.txt | 2 +- lib/jkqtplotter/graphs/jkqtpbarchart.cpp | 8 +- .../graphs/jkqtpevaluatedfunction.cpp | 12 +- lib/jkqtplotter/graphs/jkqtpfilledcurve.cpp | 14 +- lib/jkqtplotter/graphs/jkqtpgeolines.cpp | 22 +- lib/jkqtplotter/graphs/jkqtpgeoshapes.cpp | 4 +- lib/jkqtplotter/graphs/jkqtpimpulses.cpp | 12 +- lib/jkqtplotter/graphs/jkqtplines.cpp | 10 +- lib/jkqtplotter/graphs/jkqtprange.cpp | 16 +- lib/jkqtplotter/graphs/jkqtpscatter.cpp | 12 +- lib/jkqtplotter/graphs/jkqtpspecialline.cpp | 28 +- lib/jkqtplotter/jkqtpbaseplotter.cpp | 355 ++++++++++++------ lib/jkqtplotter/jkqtpbaseplotter.h | 247 +++++++++++- lib/jkqtplotter/jkqtpbaseplotterstyle.cpp | 3 + lib/jkqtplotter/jkqtpbaseplotterstyle.h | 2 + lib/jkqtplotter/jkqtpcoordinateaxes.cpp | 209 +++++++---- lib/jkqtplotter/jkqtpcoordinateaxes.h | 181 +++++++-- lib/jkqtplotter/jkqtpgraphsbase.cpp | 34 +- lib/jkqtplotter/jkqtpgraphsbase.h | 38 +- lib/jkqtplotter/jkqtpgraphsbaseerrors.cpp | 8 +- lib/jkqtplotter/jkqtplotter.cpp | 14 +- lib/jkqtplotter/jkqtplotter.h | 14 +- screenshots/advancedlineandfillstyling.png | Bin 104773 -> 104740 bytes screenshots/barchart.png | Bin 12260 -> 12232 bytes screenshots/barchart_customdrawfunctor.png | Bin 12561 -> 12529 bytes .../barchart_customdrawfunctor_hor.png | Bin 12643 -> 12625 bytes screenshots/barchart_errorbars.png | Bin 14152 -> 14125 bytes screenshots/barchart_errorbars_hor.png | Bin 12648 -> 12615 bytes screenshots/barchart_functorfill.png | Bin 9176 -> 9146 bytes screenshots/barchart_functorfill_hor.png | Bin 9086 -> 9059 bytes screenshots/barchart_hor.png | Bin 12883 -> 12855 bytes screenshots/barchart_twocolor.png | Bin 11821 -> 11786 bytes screenshots/barchart_twocolor_hor.png | Bin 10763 -> 10740 bytes screenshots/boxplot.png | Bin 23120 -> 23095 bytes screenshots/contourplot.png | Bin 81642 -> 81624 bytes screenshots/dateaxes.png | Bin 36934 -> 36917 bytes screenshots/dateaxes_timeaxis.png | Bin 26156 -> 26133 bytes screenshots/errorbarstyles.png | Bin 84070 -> 84055 bytes screenshots/errorbarstyles_impulses.png | Bin 10153 -> 10129 bytes .../errorbarstyles_impulses_horizontal.png | Bin 9404 -> 9372 bytes screenshots/evalcurve.png | Bin 96430 -> 96406 bytes screenshots/evalcurve_small.png | Bin 17633 -> 17625 bytes screenshots/filledgraphs.png | Bin 20502 -> 20489 bytes screenshots/filledgraphs_errors.png | Bin 30926 -> 30899 bytes screenshots/filledgraphs_errors_y.png | Bin 29677 -> 29653 bytes screenshots/filledgraphs_y.png | Bin 20783 -> 20762 bytes screenshots/functionplot.png | Bin 52130 -> 52024 bytes screenshots/functionplot_fy.png | Bin 52856 -> 52750 bytes screenshots/functionplot_fy_small.png | Bin 16504 -> 16504 bytes screenshots/functionplot_small.png | Bin 15995 -> 15996 bytes screenshots/geo_coordinateaxis0.png | Bin 17114 -> 21092 bytes screenshots/geo_coordinateaxis0_small.png | Bin 12154 -> 12861 bytes screenshots/geometric.png | Bin 176553 -> 176379 bytes screenshots/geometric_small.png | Bin 15088 -> 15086 bytes screenshots/imageplot.png | Bin 17692 -> 17660 bytes screenshots/imageplot_modifier.png | Bin 66023 -> 65995 bytes screenshots/imageplot_nodatastore.png | Bin 20565 -> 20484 bytes screenshots/imageplot_userpal_program.png | Bin 13409 -> 13266 bytes .../imageplot_userpal_program_small.png | Bin 7747 -> 7751 bytes screenshots/impulsesplot.png | Bin 8538 -> 8514 bytes screenshots/impulsesplot_horizontal.png | Bin 8946 -> 8924 bytes screenshots/impulsesplot_symbols.png | Bin 20393 -> 20369 bytes screenshots/mandelbrot.png | Bin 69168 -> 68927 bytes screenshots/mandelbrot_small.png | Bin 10566 -> 10569 bytes screenshots/multiplot.png | Bin 61298 -> 61269 bytes screenshots/multiplot_controlwindow.png | Bin 23569 -> 23170 bytes screenshots/multiplot_controlwindow_small.png | Bin 6226 -> 6245 bytes screenshots/multiplot_small.png | Bin 9784 -> 9786 bytes screenshots/parametriccurve1.png | Bin 13438 -> 13402 bytes screenshots/parametriccurve2.png | Bin 15752 -> 15724 bytes screenshots/paramscatterplot.png | Bin 68587 -> 68556 bytes screenshots/paramscatterplot_customsymbol.png | Bin 17761 -> 17734 bytes screenshots/parsedfunctionplot.png | Bin 28943 -> 28674 bytes screenshots/parsedfunctionplot_small.png | Bin 6919 -> 6936 bytes screenshots/rgbimageplot.png | Bin 28139 -> 28112 bytes screenshots/rgbimageplot_qt.png | Bin 99927 -> 99879 bytes screenshots/rgbimageplot_qt_upsidedown.png | Bin 99372 -> 99332 bytes screenshots/scatter.png | Bin 22374 -> 22353 bytes screenshots/scatter_customsymbol.png | Bin 33108 -> 33084 bytes screenshots/scatter_error.png | Bin 26231 -> 26205 bytes screenshots/second_axis.png | Bin 0 -> 57857 bytes screenshots/second_axis_hor.png | Bin 0 -> 52532 bytes screenshots/second_axis_hor_small.png | Bin 0 -> 19215 bytes screenshots/second_axis_small.png | Bin 0 -> 14200 bytes screenshots/simpletest.png | Bin 27092 -> 27070 bytes screenshots/stackedbars.png | Bin 14176 -> 14150 bytes screenshots/stackedbars_hor.png | Bin 15152 -> 15126 bytes screenshots/stepplots.png | Bin 34959 -> 34933 bytes screenshots/symbols_and_errors.png | Bin 21305 -> 21269 bytes screenshots/test_distributionplot.png | Bin 58367 -> 58345 bytes screenshots/test_styledboxplot.png | Bin 12044 -> 12019 bytes screenshots/violinplot_hor.png | Bin 23156 -> 23122 bytes screenshots/violinplot_vert.png | Bin 24499 -> 24478 bytes screenshots/wiggleplot_x.png | Bin 26804 -> 26782 bytes screenshots/wiggleplot_y.png | Bin 40717 -> 40695 bytes 109 files changed, 1246 insertions(+), 341 deletions(-) create mode 100644 doc/images/JKQTBasePlotter_addSecondaryXAxis.png create mode 100644 doc/images/JKQTBasePlotter_addSecondaryYAxis.png create mode 100644 examples/second_axis/CMakeLists.txt create mode 100644 examples/second_axis/README.md create mode 100644 examples/second_axis/second_axis.cpp create mode 100644 screenshots/second_axis.png create mode 100644 screenshots/second_axis_hor.png create mode 100644 screenshots/second_axis_hor_small.png create mode 100644 screenshots/second_axis_small.png diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 8a3edc05bf..fd330bd17f 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -180,6 +180,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) rgbimageplot_qt/rgbimageplot_qt,rgbimageplot_qt_upsidedown/--iteratefunctorsteps mandelbrot geo_coordinateaxis0 + second_axis/second_axis,second_axis_hor #speed ) @@ -207,6 +208,7 @@ if(JKQtPlotter_BUILD_EXAMPLES) impulsesplot/JKQTPImpulsesVerticalGraph,JKQTPImpulsesVerticalGraph_Symbols,JKQTPImpulsesHorizontalGraph,JKQTPImpulsesVerticalErrorGraph,JKQTPImpulsesHorizontalErrorGraph,JKQTPImpulsesVerticalGraphNoBaseline,JKQTPImpulsesVerticalGraph_SymbolsNoBaseline,JKQTPImpulsesHorizontalGraphNoBaseline,JKQTPImpulsesVerticalErrorGraphNoBaseline,JKQTPImpulsesHorizontalErrorGraphNoBaseline,JKQTPImpulsesVerticalGraphBaseline,JKQTPImpulsesVerticalGraph_SymbolsBaseline,JKQTPImpulsesHorizontalGraphBaseline,JKQTPImpulsesVerticalErrorGraphBaseline,JKQTPImpulsesHorizontalErrorGraphBaseline/--iteratefunctorsteps--smallscreenshotplot 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 ) diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox index 7d313c07f4..e9d9494502 100644 --- a/doc/dox/examples_and_tutorials.dox +++ b/doc/dox/examples_and_tutorials.dox @@ -122,9 +122,12 @@ All test-projects are Qt-projects that use qmake to build. You can load them int \image html logaxes_small.png \subpage JKQTPlotterLogAxes `JKQTPXYLineGraph` and `JKQTPGeoText`
C++ vector of data
logarithmic axes and styling
plot line styles
internal LaTeX parser
add commenting text to a graph - \image html dateaxes_timeaxis_small.png - \subpage JKQTPlotterDateTimeAxes + \image html dateaxes_timeaxis_small.png + \subpage JKQTPlotterDateTimeAxes `JKQTPXYLineGraph` and `JKQTPFilledVerticalRangeGraph`
C++ vector of data
date/time axes
plot min/max range graph
internal LaTeX parser
data from CSV files + \image html second_axis_small.png + \subpage JKQTPlotterSecondaryAxes + plottig with secondary axes, `JKQTPBasePlotter::addSecondaryXAxis()`/`JKQTPBasePlotter::addSecondaryYAxis()` \image html advancedlineandfillstyling_small.png \subpage JKQTPlotterAdvancedLineAndFillStyling `JKQTPXYLineGraph`, `JKQTPSpecialLineHorizontalGraph` and `JKQTPBarVerticalGraph`
C++ vector of data
advanced line styling and filling diff --git a/doc/dox/jkqtplotter_naming.dox b/doc/dox/jkqtplotter_naming.dox index 8ee69ff702..ff08beab40 100644 --- a/doc/dox/jkqtplotter_naming.dox +++ b/doc/dox/jkqtplotter_naming.dox @@ -18,6 +18,7 @@ derived from JKQTPPlotAnnotationElement
  • \b key is the legend of the plot, showing a list of the graphs, each represented by a entry marker (showing the graphs color/symbol/...) and a entry title.
  • coordinate axis is each of the x- or y-axis (there might be addition axes, e.g. when showing a color-scale). Each coordinate axis is composed from several elements: the axis line itself, an axis label, axis ticks and corresponding tick labels (major and a second set of minor ticks in between are available) +
  • secondary coordinate axis you can add additional secondary x- and y-axes to a plot, which are shown stacked, beside the plot.
  • zero axis: a pair of axes through the origin \c x=0 and \c y=0 of the coordinate system
  • \b grid a grid of horizontal/vertical lines, drawn behind the graph and providing visual guidance for the viewer of the graph. The grid is actually a part of the coordinate axes, as the lines are positioned at the same position as the axis ticks
  • minor grid in addition to the grid, corresponding to the major axis ticks, you can add additional lines that correspond to the minor axis ticks diff --git a/doc/dox/todo.dox b/doc/dox/todo.dox index 2b0b27f632..b8768aad15 100644 --- a/doc/dox/todo.dox +++ b/doc/dox/todo.dox @@ -29,7 +29,6 @@ This page lists several todos and wishes for future version of JKQTPlotter
  • plot: legend positioning as combination of 3 values: inside|outside + left|center|right + top|vcenter|bottom
  • plot: refactor print preview/export preview code
  • plot: rework layouting of legends: there are some inconsistencies/too large gaps ...
  • -
  • plot: secondary axes: independent and dependent (i.e. with transformation function from primary axis)
  • sryling: better styling/more styling options for data-tooltips
  • styling: color gradients as fill-styles in style-INIs
  • styling: style.ini with glowing colors in dark background ("techno" or "cyberpunk")
  • diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox index 7a96b62809..d5bf9b31fa 100644 --- a/doc/dox/whatsnew.dox +++ b/doc/dox/whatsnew.dox @@ -67,6 +67,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
  • NEW: barcharts can be colored by a user-specified functor
  • NEW: you can provide a custom draw functor to barcharts to completely customize their look
  • NEW: barcharts and impulse graphs may now draw their baseline as stylable line (default: off)
  • +
  • NEW: secondary axes: added functionality to manage additional secondary axes in a JKQTPBasePlotter and to select which x-/y-Axis to use for drawing a JKQTPPlotElement
  • JKQTMathText: