This commit is contained in:
jkriege2 2022-08-29 21:46:38 +02:00
parent 6eba8acbf2
commit e729ebbc78
28 changed files with 115 additions and 30 deletions

View File

@ -74,7 +74,7 @@ if(JKQtPlotter_BUILD_EXAMPLES)
# e.g. "barchart/barchart,barchart_hor" # e.g. "barchart/barchart,barchart_hor"
# the basenames are applied to the windows in the order of their windowTitle()s! # the basenames are applied to the windows in the order of their windowTitle()s!
set(JKQTPlotter_GenerateDocScreenshots_From set(JKQTPlotter_GenerateDocScreenshots_From
scatter scatter/scatter,scatter_error
simpletest simpletest
barchart/barchart,barchart_hor barchart/barchart,barchart_hor
wiggleplots/wiggleplot_x,wiggleplot_y wiggleplots/wiggleplot_x,wiggleplot_y
@ -119,14 +119,14 @@ if(JKQtPlotter_BUILD_EXAMPLES)
# custom target that generates the images for the JKQTMathText documentation # custom target that generates the images for the JKQTMathText documentation
set(JKQTPlotter_GenerateDocImage_DefaultOptions --screenshotdir="${CMAKE_CURRENT_LIST_DIR}/../doc/images/" --screenshotplot --disablehighdpi) set(JKQTPlotter_GenerateDocImage_DefaultOptions --screenshotdir="${CMAKE_CURRENT_LIST_DIR}/../doc/images/" --screenshotplot --disablehighdpi)
set(JKQTPlotter_GenerateDocImages_From set(JKQTPlotter_GenerateDocImages_From
stackedbars/JKQTPbarVerticalGraphStacked,JKQTPbarHorizontalGraphStacked stackedbars/JKQTPbarVerticalGraphStacked,JKQTPbarHorizontalGraphStacked/--smallscreenshotplot
scatter/JKQTPXYScatterGraph scatter/JKQTPXYScatterGraph,JKQTPXYScatterErrorGraph/--smallscreenshotplot
simpletest/JKQTPXYLineGraph simpletest/JKQTPXYLineGraph/--smallscreenshotplot
barchart/JKQTPBarVerticalGraph,JKQTPBarHorizontalGraph barchart/JKQTPBarVerticalGraph,JKQTPBarHorizontalGraph/--smallscreenshotplot
wiggleplots/JKQTPFilledCurveXGraph_wiggle,JKQTPFilledCurveYGraph_wiggle wiggleplots/JKQTPFilledCurveXGraph_wiggle,JKQTPFilledCurveYGraph_wiggle
contourplot/JKQTPColumnContourPlot contourplot/JKQTPColumnContourPlot/--smallscreenshotplot
filledgraphs/JKQTPFilledCurveXGraph,JKQTPFilledCurveYGraph filledgraphs/JKQTPFilledCurveXGraph,JKQTPFilledCurveYGraph/--smallscreenshotplot
evalcurve/JKQTPXYFunctionLineGraph evalcurve/JKQTPXYFunctionLineGraph/--smallscreenshotplot
) )
add_custom_target(JKQTPlotter_GenerateDocScreenshots add_custom_target(JKQTPlotter_GenerateDocScreenshots
@ -147,12 +147,18 @@ if(JKQtPlotter_BUILD_EXAMPLES)
foreach(ex ${JKQTPlotter_GenerateDocScreenshots_From}) foreach(ex ${JKQTPlotter_GenerateDocScreenshots_From})
string(REGEX MATCH "(.+)/(.+)" dummy ${ex}) string(REGEX MATCH "(.+)/(.+)" dummy ${ex})
set(extra_command "")
if(CMAKE_MATCH_1 STREQUAL "" OR CMAKE_MATCH_2 STREQUAL "") if(CMAKE_MATCH_1 STREQUAL "" OR CMAKE_MATCH_2 STREQUAL "")
set(example ${ex}) set(example ${ex})
set(basename ${ex}) set(basename ${ex})
else() else()
set(example ${CMAKE_MATCH_1}) set(example ${CMAKE_MATCH_1})
set(basename ${CMAKE_MATCH_2}) set(basename ${CMAKE_MATCH_2})
if(NOT (CMAKE_MATCH_3 STREQUAL ""))
set(example ${CMAKE_MATCH_1})
set(basename ${CMAKE_MATCH_2})
set(extra_command ${CMAKE_MATCH_3})
endif()
endif() endif()
set(loc_target_name JKQTPlotter_GenerateDocScreenshots_${example}) set(loc_target_name JKQTPlotter_GenerateDocScreenshots_${example})
@ -160,7 +166,7 @@ if(JKQtPlotter_BUILD_EXAMPLES)
string(TOUPPER ${example} example_upper) string(TOUPPER ${example} example_upper)
add_custom_target(${loc_target_name} add_custom_target(${loc_target_name}
COMMENT "Building JKQTPlotter Documentation Screenshot: ${example_upper}" COMMENT "Building JKQTPlotter Documentation Screenshot: ${example_upper}"
COMMAND $<TARGET_FILE:${dep_name}> ${JKQTPlotter_GenerateDocScreenshots_DefaultOptions} --screenshotbasename=${basename} COMMAND $<TARGET_FILE:${dep_name}> ${JKQTPlotter_GenerateDocScreenshots_DefaultOptions} --screenshotbasename=${basename} ${extra_command}
WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR} WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR}
DEPENDS ${dep_name} DEPENDS ${dep_name}
) )
@ -177,12 +183,20 @@ if(JKQtPlotter_BUILD_EXAMPLES)
foreach(ex ${JKQTPlotter_GenerateDocImages_From}) foreach(ex ${JKQTPlotter_GenerateDocImages_From})
string(REGEX MATCH "(.+)/(.+)" dummy ${ex}) string(REGEX MATCH "(.+)/(.+)" dummy ${ex})
set(extra_command "")
if(CMAKE_MATCH_1 STREQUAL "" OR CMAKE_MATCH_2 STREQUAL "") if(CMAKE_MATCH_1 STREQUAL "" OR CMAKE_MATCH_2 STREQUAL "")
set(example ${ex}) set(example ${ex})
set(basename ${ex}) set(basename ${ex})
else() else()
set(example ${CMAKE_MATCH_1}) set(example ${CMAKE_MATCH_1})
set(basename ${CMAKE_MATCH_2}) set(basename ${CMAKE_MATCH_2})
string(REGEX MATCH "(.+)/(.*)/(.+)" dummy ${ex})
if(NOT (CMAKE_MATCH_3 STREQUAL ""))
set(example ${CMAKE_MATCH_1})
set(basename ${CMAKE_MATCH_2})
set(extra_command ${CMAKE_MATCH_3})
endif()
endif() endif()
set(loc_target_name JKQTPlotter_GenerateDocImages_${example}) set(loc_target_name JKQTPlotter_GenerateDocImages_${example})
@ -190,7 +204,7 @@ if(JKQtPlotter_BUILD_EXAMPLES)
string(TOUPPER ${example} example_upper) string(TOUPPER ${example} example_upper)
add_custom_target(${loc_target_name} add_custom_target(${loc_target_name}
COMMENT "Building JKQTPlotter Documentation Image: ${example_upper}" COMMENT "Building JKQTPlotter Documentation Image: ${example_upper}"
COMMAND $<TARGET_FILE:${dep_name}> ${JKQTPlotter_GenerateDocImage_DefaultOptions} --screenshotbasename=${basename} COMMAND $<TARGET_FILE:${dep_name}> ${JKQTPlotter_GenerateDocImage_DefaultOptions} --screenshotbasename=${basename} ${extra_command}
WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR} WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR}
DEPENDS ${dep_name} DEPENDS ${dep_name}
) )

View File

@ -172,7 +172,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
<table> <table>
<tr><th> Screenshot <th> Description <th> Notes <tr><th> Screenshot <th> Description <th> Notes
<tr><td> \image html test_multiplot_small.png <tr><td> \image html multiplot_small.png
<td> \subpage JKQTPlotterMultiPlotLayout <td> \subpage JKQTPlotterMultiPlotLayout
<td> Combining plots in Qt Layouts <br> linking plot axes <br> copy data from a `std::map` int the datastore <br> print plots/print preview <td> Combining plots in Qt Layouts <br> linking plot axes <br> copy data from a `std::map` int the datastore <br> print plots/print preview
<tr><td> \image html test_styling_small.png <tr><td> \image html test_styling_small.png
@ -214,7 +214,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
<table> <table>
<tr><th> Screenshot <th> Description <th> Notes <tr><th> Screenshot <th> Description <th> Notes
<tr><td> \image html test_multiplot_small.png <tr><td> \image html multiplot_small.png
<td> \subpage JKQTPlotterMultiPlotLayout <td> \subpage JKQTPlotterMultiPlotLayout
<td> Combining plots in Qt Layouts <br> linking plot axes <br> copy data from a `std::map` int the datastore <br> print plots/print preview <td> Combining plots in Qt Layouts <br> linking plot axes <br> copy data from a `std::map` int the datastore <br> print plots/print preview
<tr><td> \image html test_distributionplot_small.png <tr><td> \image html test_distributionplot_small.png

View File

@ -284,7 +284,7 @@ This group assembles graphs that show their data with symbols and optionally wit
<td>\image html beeswarmplot_small.png <td>\image html beeswarmplot_small.png
<td> JKQTPSingleColumnSymbolsGraph <td> JKQTPSingleColumnSymbolsGraph
<tr> <tr>
<td>\image html scatter_small.png <td>\image html JKQTPXYScatterGraph_small.png
<td> JKQTPXYScatterGraph, JKQTPXYScatterErrorGraph <td> JKQTPXYScatterGraph, JKQTPXYScatterErrorGraph
<tr> <tr>
<td>\image html symbols_and_styles_small.png <td>\image html symbols_and_styles_small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -11,16 +11,7 @@
#include "jkqtpexampleapplication.h" #include "jkqtpexampleapplication.h"
#include <random> #include <random>
void createScatterGraph(JKQTPlotter&plot) {
int main(int argc, char* argv[])
{
JKQTPAppSettingController highDPIController(argc,argv);
JKQTPExampleApplication app(argc, argv);
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
JKQTPlotter plot;
JKQTPDatastore* ds=plot.getDatastore(); JKQTPDatastore* ds=plot.getDatastore();
// 2. add two columns to the JKQTPDatastore and obtain back-inserter iterators for these // 2. add two columns to the JKQTPDatastore and obtain back-inserter iterators for these
@ -60,6 +51,88 @@ int main(int argc, char* argv[])
plot.getPlotter()->setPlotLabel(QObject::tr("Scatter Example")); plot.getPlotter()->setPlotLabel(QObject::tr("Scatter Example"));
plot.show(); plot.show();
plot.resize(600/plot.devicePixelRatioF(),400/plot.devicePixelRatioF()); plot.resize(600/plot.devicePixelRatioF(),400/plot.devicePixelRatioF());
}
void createErrorScatterGraph(JKQTPlotter&plot) {
JKQTPDatastore* ds=plot.getDatastore();
// 2. add two columns to the JKQTPDatastore and obtain back-inserter iterators for these
size_t columnX=ds->addColumn("x");
auto colXInserter=ds->backInserter(columnX);
size_t columnY=ds->addColumn("y");
auto colYInserter=ds->backInserter(columnY);
size_t columnY2=ds->addColumn("y2");
auto colY2Inserter=ds->backInserter(columnY2);
size_t columnEX=ds->addColumn("xerr");
auto colEXInserter=ds->backInserter(columnEX);
size_t columnEY=ds->addColumn("yerr");
auto colEYInserter=ds->backInserter(columnEY);
// 3. now we create data for a simple plot (a sine curve with random noise)
std::default_random_engine generator(123);
std::normal_distribution<double> distribution(0,0.5);
const int Ndata=15;
for (int i=0; i<Ndata; i++) {
// put data
const double x=double(i)/double(Ndata)*8.0*JKQTPSTATISTICS_PI;
*colXInserter=x;
*colYInserter=sin(x)+2.0;
*colY2Inserter=cos(x)-2.0;
*colEXInserter=distribution(generator);
*colEYInserter=distribution(generator);
// advance back-inserters
colXInserter++;
colYInserter++;
colY2Inserter++;
colEXInserter++;
colEYInserter++;
}
// 4. create a graph in the plot, which plots the dataset X/Y:
JKQTPXYScatterErrorGraph* graph1=new JKQTPXYScatterErrorGraph(&plot);
graph1->setXColumn(columnX);
graph1->setYColumn(columnY);
graph1->setYErrorColumn(columnEY);
graph1->setYErrorStyle(JKQTPErrorSimpleBars);
graph1->setTitle(QObject::tr("y-errorlines"));
plot.addGraph(graph1);
JKQTPXYScatterErrorGraph* graph2=new JKQTPXYScatterErrorGraph(&plot);
graph2->setXColumn(columnX);
graph2->setYColumn(columnY2);
graph2->setXErrorColumn(columnEX);
graph2->setYErrorColumn(columnEY);
graph2->setXErrorStyle(JKQTPErrorBars);
graph2->setYErrorStyle(JKQTPErrorBars);
graph2->setTitle(QObject::tr("xy-errorbars"));
plot.addGraph(graph2);
// 6. autoscale the plot so the graph is contained
plot.zoomToFit();
// show plotter and make it a decent size
plot.getPlotter()->setPlotLabel(QObject::tr("Error Scatter Example"));
plot.show();
plot.resize(600/plot.devicePixelRatioF(),400/plot.devicePixelRatioF());
}
int main(int argc, char* argv[])
{
JKQTPAppSettingController highDPIController(argc,argv);
JKQTPExampleApplication app(argc, argv);
// 1. create a plotter window and get a pointer to the internal datastore (for convenience)
JKQTPlotter plot, plotErr;
createScatterGraph(plot);
plot.setWindowTitle("1: JKQTPXYScatterGraph");
createErrorScatterGraph(plotErr);
plotErr.setWindowTitle("2: JKQTPXYScatterErrorGraph");
return app.exec(); return app.exec();
} }

View File

@ -57,7 +57,7 @@ class JKQTMathTextVerticalListNode; // forward
The implementation is split over several classes: The implementation is split over several classes:
- JKQTMathText implements drawing, based on a memory representatioj of the markup. It also provides an interface for class users. - JKQTMathText implements drawing, based on a memory representatioj of the markup. It also provides an interface for class users.
- JKQTMathTextParser and its children like JKQTMathTextLatexParser parses mathamtical markup. - JKQTMathTextParser and its children like JKQTMathTextLatexParser parses mathamtical markup.
- The nodes summarized in \ref jkqtmathtext_nodes are used to build the memory representation of the markup. - The nodes summarized in \ref jkqtmathtext_items are used to build the memory representation of the markup.
. .
In particular JKQTMathTextLatexParser actually parses e.g. a LaTeX string and draws it in pure C++. It does NOT rely In particular JKQTMathTextLatexParser actually parses e.g. a LaTeX string and draws it in pure C++. It does NOT rely

View File

@ -91,10 +91,8 @@ class JKQTMATHTEXT_LIB_EXPORT JKQTMathTextNode {
* *
* \param painter painter to use for determining the size * \param painter painter to use for determining the size
* \param currentEv current environment object * \param currentEv current environment object
* \param[out] width width of the block/node *
* \param[out] baselineHeight distance from the bottom of the block/node-box to the baseline * \return all important box size parameters packed as JKQTMathTextNodeSize
* \param[out] overallHeight overall height (bottom to top) of the node, the ascent is \c overallHeight-baselineHeight
* \param[out] strikeoutPos position of the strikeout-line
* *
*/ */
virtual JKQTMathTextNodeSize getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const =0; virtual JKQTMathTextNodeSize getSizeInternal(QPainter& painter, JKQTMathTextEnvironment currentEv) const =0;

View File

@ -89,7 +89,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPXYScatterGraph: public JKQTPXYGraph, public JK
/*! \brief This implements xy scatter plots with x and y error indicators. /*! \brief This implements xy scatter plots with x and y error indicators.
\ingroup jkqtplotter_linesymbolgraphs_simple \ingroup jkqtplotter_linesymbolgraphs_simple
\image html plot_errorbarscatterlots.png \image html JKQTPXYScatterErrorGraph.png
\see JKQTPXYScatterGraph, JKQTPXYGraphErrors \see JKQTPXYScatterGraph, JKQTPXYGraphErrors
*/ */

View File

@ -140,7 +140,7 @@ JKQTPLOTTER_LIB_EXPORT void initJKQTPlotterResources();
* *
* Often a single plot is not sufficient, but several plots need to be aligned with respect to each other: * Often a single plot is not sufficient, but several plots need to be aligned with respect to each other:
* *
* \image html test_multiplot.png * \image html multiplot.png
* *
* In the Qt Window this is achieved by placing several JKQTPlotter objects into a <a href="http://doc.qt.io/qt-5/qgridlayout.html">QGridLayout</a>. * In the Qt Window this is achieved by placing several JKQTPlotter objects into a <a href="http://doc.qt.io/qt-5/qgridlayout.html">QGridLayout</a>.
* In order to support this alignment, also when exporting/printing a plot, and when the user interactions with the plot (e.g. zooming), * In order to support this alignment, also when exporting/printing a plot, and when the user interactions with the plot (e.g. zooming),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB