UPDATED included styles INI-files + automatic generation of style.ini documentations

This commit is contained in:
jkriege2 2023-07-02 23:01:56 +02:00
parent dfa29b7b81
commit aee3b23696
34 changed files with 378 additions and 77 deletions

View File

@ -33,12 +33,12 @@ jobs:
sudo apt -y install build-essential doxygen graphviz doxygen-latex libclang-common-10-dev libclang-10-dev fonts-freefont-ttf
doxygen -v
- name: Update Doxygen to 1.9.6
- name: Update Doxygen to 1.9.7
run: |
currDir=`pwd`
cd $GITHUB_WORKSPACE
mkdir doxygen
wget -O - https://github.com/doxygen/doxygen/releases/download/Release_1_9_6/doxygen-1.9.6.linux.bin.tar.gz | tar --strip-components=1 -xz -C doxygen
wget -O - https://github.com/doxygen/doxygen/releases/download/Release_1_9_7/doxygen-1.9.7.linux.bin.tar.gz | tar --strip-components=1 -xz -C doxygen
export PATH=$GITHUB_WORKSPACE/doxygen/bin:${PATH}
echo PATH=$PATH
cd $currDir

View File

@ -1006,7 +1006,8 @@ EXCLUDE_SYMBOLS =
# command).
EXAMPLE_PATH = ./examples/ \
./tools/
./tools/ \
./doc/htmlinclude/
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and

View File

@ -88,6 +88,7 @@ if(JKQtPlotter_BUILD_TOOLS)
set(JKQTPlotter_GenerateDocImages_COMMAND $<TARGET_FILE:jkqtplotter_doc_imagegenerator> ${JKQTPlotter_GenerateDocImages_DefaultOptions})
set(JKQTPlotter_GenerateDocImages_OutputDir "${CMAKE_CURRENT_LIST_DIR}/images/")
set(JKQTPlotter_GenerateDocImages_DocOutputDir "${CMAKE_CURRENT_LIST_DIR}/htmlinclude/")
add_custom_target(JKQTPlotter_GenerateDocImages_listplotsymbols
@ -122,6 +123,14 @@ if(JKQtPlotter_BUILD_TOOLS)
)
add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listaxisstyleprops)
add_custom_target(JKQTPlotter_GenerateDocImages_liststyles
COMMENT "Building JKQTPlotter Documentation Images: liststyles"
COMMAND ${JKQTPlotter_GenerateDocImages_COMMAND} --liststyles --iconsize=500 --outputdir="${JKQTPlotter_GenerateDocImages_OutputDir}/styles/" --docoutputdir="${JKQTPlotter_GenerateDocImages_DocOutputDir}"
WORKING_DIRECTORY ${JKQtPlotter_QT_BINDIR}
DEPENDS jkqtplotter_doc_imagegenerator
)
add_dependencies(JKQTPlotter_GenerateDocImages JKQTPlotter_GenerateDocImages_listaxisstyleprops)
endif(JKQtPlotter_BUILD_TOOLS)

View File

@ -40,35 +40,7 @@ These are also linked into the JKQTPlotter library as Qt ressource into the subd
\endcode
Here is a table with all available ready-made styles:
<table>
<tr>
<th> Style-file
<th> Screenshot
<tr>
<td> <b> The Default Style </b>
<td> \image html default.ini.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blackandwhite.ini"> \c :/JKQTPlotter/styles/blackandwhite.ini</a>
<td> \image html blackandwhite.ini.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blueprint.ini"> \c :/JKQTPlotter/styles/blueprint.ini</a>
<td> \image html blueprint.ini.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/dark.ini"> \c :/JKQTPlotter/styles/dark.ini</a>
<td> \image html dark.ini.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/seaborn.ini"> \c :/JKQTPlotter/styles/seaborn.ini</a>
<td> \image html seaborn.ini.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_gridandticks.ini"> \c :/JKQTPlotter/styles/simple_gridandticks.ini</a>
<td> \image html simple_gridandticks.ini.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset.ini"> \c :/JKQTPlotter/styles/simple_axesoffset.ini</a>
<td> \image html simple_axesoffset.ini.png
<tr>
<td> <a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset_plotbox.ini"> \c :/JKQTPlotter/styles/simple_axesoffset_plotbox.ini</a>
<td> \image html simple_axesoffset_plotbox.ini.png
</table>
\htmlinclude styles.html
\see Classes are documented in \ref jkqtpplotter_styling_classes .
<br>See \ref JKQTPlotterStyling for a detailed example.

View File

@ -0,0 +1,3 @@
<table class="doxtable">
<tr><th>Style-file </th><th>Screenshot </th><th>Symbols </th></tr>
<tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blackandwhite.ini"><code>:/JKQTPlotter/styles/blackandwhite.ini</code></a></td><td><div class="image"><img src="blackandwhite.ini.png" alt=""/></div></td><td><div class="image"><img src="blackandwhite.ini.symbols.png" alt=""/></div></td></tr> <tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/blueprint.ini"><code>:/JKQTPlotter/styles/blueprint.ini</code></a></td><td><div class="image"><img src="blueprint.ini.png" alt=""/></div></td><td><div class="image"><img src="blueprint.ini.symbols.png" alt=""/></div></td></tr> <tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/dark.ini"><code>:/JKQTPlotter/styles/dark.ini</code></a></td><td><div class="image"><img src="dark.ini.png" alt=""/></div></td><td><div class="image"><img src="dark.ini.symbols.png" alt=""/></div></td></tr> <tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/default.ini"><code>:/JKQTPlotter/styles/default.ini</code></a></td><td><div class="image"><img src="default.ini.png" alt=""/></div></td><td><div class="image"><img src="default.ini.symbols.png" alt=""/></div></td></tr> <tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/legacy_default_style.ini"><code>:/JKQTPlotter/styles/legacy_default_style.ini</code></a></td><td><div class="image"><img src="legacy_default_style.ini.png" alt=""/></div></td><td><div class="image"><img src="legacy_default_style.ini.symbols.png" alt=""/></div></td></tr> <tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/seaborn.ini"><code>:/JKQTPlotter/styles/seaborn.ini</code></a></td><td><div class="image"><img src="seaborn.ini.png" alt=""/></div></td><td><div class="image"><img src="seaborn.ini.symbols.png" alt=""/></div></td></tr> <tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_arrowsaxes.ini"><code>:/JKQTPlotter/styles/simple_arrowsaxes.ini</code></a></td><td><div class="image"><img src="simple_arrowsaxes.ini.png" alt=""/></div></td><td><div class="image"><img src="simple_arrowsaxes.ini.symbols.png" alt=""/></div></td></tr> <tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset.ini"><code>:/JKQTPlotter/styles/simple_axesoffset.ini</code></a></td><td><div class="image"><img src="simple_axesoffset.ini.png" alt=""/></div></td><td><div class="image"><img src="simple_axesoffset.ini.symbols.png" alt=""/></div></td></tr> <tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_axesoffset_plotbox.ini"><code>:/JKQTPlotter/styles/simple_axesoffset_plotbox.ini</code></a></td><td><div class="image"><img src="simple_axesoffset_plotbox.ini.png" alt=""/></div></td><td><div class="image"><img src="simple_axesoffset_plotbox.ini.symbols.png" alt=""/></div></td></tr> <tr><td><a href="https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/simple_gridandticks.ini"><code>:/JKQTPlotter/styles/simple_gridandticks.ini</code></a></td><td><div class="image"><img src="simple_gridandticks.ini.png" alt=""/></div></td><td><div class="image"><img src="simple_gridandticks.ini.symbols.png" alt=""/></div></td></tr></table>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -77,7 +77,6 @@ The major part of the source code of the main application can be found in [`tes
The following gallery shows a set of example styles:
| Style-file | Screenshot |
|:-------------:| ------------- |
| <b> The Default Style </b> | ![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/doc/images/styles/default.ini.png) |

View File

@ -8,5 +8,7 @@
<file>styles/simple_axesoffset.ini</file>
<file>styles/simple_axesoffset_plotbox.ini</file>
<file>styles/simple_gridandticks.ini</file>
<file>styles/simple_arrowsaxes.ini</file>
<file>styles/legacy_default_style.ini</file>
</qresource>
</RCC>

View File

@ -1,7 +1,13 @@
[plots]
useraction_overlay_color=white
useraction_overlay_brushcolor="white,75"
useraction_opaque_color=white
useraction_opaque_brushcolor=#212571
useraction_marker_color=white
useraction_marker_brushcolor="white,51"
widget_background_color=#212571
widget_background_color_for_export=#212571
plot_background_color=transparent
plot_background_color=#212571
graphs\graphs_base\linewidth=1
graphs\graphs_base\symbol_size=8
graphs\graphs_base\symbol_line_width=0.75
@ -26,6 +32,7 @@ axis_x\minor_tick\color=#FAFAFA
axis_x\ticks\label_color=white
axis_x\ticks\color=#FAFAFA
axis_x\zero_line\color=#FAFAFA
axis_x\axis_label\color=white
axis_y\color=#FAFAFA
axis_y\grid\color=#616161
axis_y\minor_grid\color=#616161
@ -34,6 +41,7 @@ axis_y\minor_tick\color=#FAFAFA
axis_y\ticks\label_color=white
axis_y\ticks\color=#FAFAFA
axis_y\zero_line\color=#FAFAFA
axis_y\axis_label\color=white
axis_colorbar_right\color=#FAFAFA
axis_colorbar_right\grid\color=#616161
axis_colorbar_right\minor_grid\color=#616161

View File

@ -1,4 +1,10 @@
[plots]
useraction_overlay_color=white
useraction_overlay_brushcolor="white,75"
useraction_opaque_color=white
useraction_opaque_brushcolor=#212571
useraction_marker_color=white
useraction_marker_brushcolor="white,51"
widget_background_color=#212121
widget_background_color_for_export=#212121
plot_background_color=transparent
@ -20,48 +26,45 @@ key\frame_color=#FAFAFA
key\background_color=#424242
key\text_color=#FAFAFA
axis_x\color=#FAFAFA
axis_x\line_width=1
axis_x\grid\style=dash
axis_x\grid\color=#616161
axis_x\minor_grid\color=#616161
axis_x\minor_tick\inside_length=2
axis_x\minor_tick\outside_length=2
axis_x\ticks\width=1
axis_x\zero_line\line_width=1
axis_x\minor_tick\label_color=white
axis_x\minor_tick\color=#FAFAFA
axis_x\ticks\label_color=white
axis_x\ticks\color=#FAFAFA
axis_x\zero_line\color=#FAFAFA
axis_x\axis_label\color=white
axis_y\color=#FAFAFA
axis_y\line_width=1
axis_y\grid\color=#616161
axis_y\grid\style=dash
axis_y\minor_grid\color=#616161
axis_y\minor_tick\inside_length=2
axis_y\minor_tick\outside_length=2
axis_y\ticks\width=1
axis_y\zero_line\line_width=1
axis_y\minor_tick\label_color=white
axis_y\minor_tick\color=#FAFAFA
axis_y\ticks\label_color=white
axis_y\ticks\color=#FAFAFA
axis_y\zero_line\color=#FAFAFA
axis_y\axis_label\color=white
axis_colorbar_right\color=#FAFAFA
axis_colorbar_right\draw_mode2=line+ticks+labels+axislabel
axis_colorbar_right\line_width=1
axis_colorbar_right\grid\color=#616161
axis_colorbar_right\minor_tick\inside_length=2
axis_colorbar_right\minor_tick\outside_length=2
axis_colorbar_right\ticks\width=1
axis_colorbar_right\zero_line\line_width=1
axis_colorbar_right\minor_grid\color=#616161
axis_colorbar_right\minor_tick\label_color=white
axis_colorbar_right\minor_tick\color=#FAFAFA
axis_colorbar_right\ticks\label_color=white
axis_colorbar_right\ticks\color=#FAFAFA
axis_colorbar_right\zero_line\color=#FAFAFA
axis_colorbar_top\color=#FAFAFA
axis_colorbar_top\line_width=1
axis_colorbar_top\grid\color=#616161
axis_colorbar_top\minor_tick\inside_length=2
axis_colorbar_top\minor_tick\outside_length=2
axis_colorbar_top\ticks\width=1
axis_colorbar_top\zero_line\line_width=1
axis_colorbar_top\minor_grid\color=#616161
axis_colorbar_top\minor_tick\label_color=white
axis_colorbar_top\minor_tick\color=#FAFAFA
axis_colorbar_top\ticks\label_color=white
axis_colorbar_top\ticks\color=#FAFAFA
axis_colorbar_top\zero_line\color=#FAFAFA
graphs\auto_styles\color0="#FF3D00,80%"
graphs\auto_styles\color1="#4CAF50,80%"
graphs\auto_styles\color2="#00BCD4,80%"
graphs\auto_styles\color3="#FFEB3B,80%"
graphs\auto_styles\color4="#FF9800,80%"
graphs\auto_styles\color5="#9C27B0,80%"
graphs\auto_styles\color6="#29B6F6,80%"
graphs\auto_styles\color7="blue,80%"
graphs\auto_styles\color0="#FF3D00,20%"
graphs\auto_styles\color1="#4CAF50,20%"
graphs\auto_styles\color2="#00BCD4,20%"
graphs\auto_styles\color3="#FFEB3B,20%"
graphs\auto_styles\color4="#FF9800,20%"
graphs\auto_styles\color5="#9C27B0,20%"
graphs\auto_styles\color6="#29B6F6,20%"
graphs\auto_styles\color7="blue,20%"

View File

@ -0,0 +1,37 @@
[plots]
widget_background_color=white
plot_frame_width=1
plot_frame_rounded=3
key\xoffset=1
key\yoffset=1
key\xmargin=1
key\ymargin=1
key\frame_rounding=2
axis_x\draw_mode1=none
axis_x\draw_mode2=none
axis_x\draw_mode0=complete+max_filled_arrow
axis_x\line_width=1
axis_x\axis_lines_offset=6
axis_x\minor_tick\outside_length=3
axis_x\minor_tick\inside_length=3
axis_x\ticks\inside_length=6
axis_x\ticks\outside_length=6
axis_x\ticks\width=1
axis_x\zero_line\enabled=false
axis_x\zero_line\line_width=1
axis_x\zero_line\color=black
axis_x\axis_label\position=max
axis_y\draw_mode1=none
axis_y\draw_mode2=none
axis_y\draw_mode0=complete+max_filled_arrow
axis_y\line_width=1
axis_y\axis_lines_offset=6
axis_y\minor_tick\outside_length=3
axis_y\minor_tick\inside_length=3
axis_y\ticks\inside_length=6
axis_y\ticks\outside_length=6
axis_y\ticks\width=1
axis_y\zero_line\enabled=false
axis_y\zero_line\line_width=1
axis_y\zero_line\color=black
axis_y\axis_label\position=max

View File

@ -10,18 +10,22 @@ key\frame_rounding=2
axis_x\draw_mode2=none
axis_x\line_width=1
axis_x\axis_lines_offset=6
axis_x\minor_tick\outside_length=2
axis_x\minor_tick\outside_length=3
axis_x\minor_tick\inside_length=0
axis_x\ticks\inside_length=0
axis_x\ticks\outside_length=5
axis_x\ticks\outside_length=6
axis_x\ticks\width=1
axis_x\zero_line\enabled=false
axis_x\zero_line\line_width=1
axis_x\zero_line\color=black
axis_y\draw_mode2=none
axis_y\line_width=1
axis_y\axis_lines_offset=6
axis_y\minor_tick\outside_length=2
axis_y\minor_tick\outside_length=3
axis_y\minor_tick\inside_length=0
axis_y\ticks\inside_length=0
axis_y\ticks\label_distance=5
axis_y\ticks\outside_length=6
axis_y\ticks\width=1
axis_y\zero_line\enabled=false
axis_y\zero_line\line_width=1
axis_y\zero_line\color=black
axis_y\zero_line\color=black

View File

@ -9,10 +9,12 @@ key\xmargin=1
key\ymargin=1
key\frame_rounding=2
axis_x\draw_mode2=none
axis_x\line_width=1
axis_x\axis_lines_offset=6
axis_x\minor_tick\outside_length=2
axis_x\minor_tick\outside_length=3
axis_x\minor_tick\inside_length=0
axis_x\ticks\inside_length=0
axis_x\ticks\outside_length=5
axis_x\ticks\outside_length=6
axis_x\ticks\width=1
axis_x\zero_line\enabled=false
axis_x\zero_line\line_width=1
@ -20,11 +22,11 @@ axis_x\zero_line\color=black
axis_y\draw_mode2=none
axis_y\line_width=1
axis_y\axis_lines_offset=6
axis_y\minor_tick\outside_length=2
axis_y\minor_tick\outside_length=3
axis_y\minor_tick\inside_length=0
axis_y\ticks\inside_length=0
axis_y\ticks\label_distance=5
axis_y\ticks\outside_length=6
axis_y\ticks\width=1
axis_y\zero_line\enabled=false
axis_y\zero_line\line_width=1
axis_y\zero_line\color=black
axis_colorbar_right\zero_line\color=black
axis_colorbar_top\zero_line\color=black
axis_y\zero_line\color=black

View File

@ -26,6 +26,14 @@
#include "jkqtcommon/jkqtpenhancedpainter.h"
#include "jkqtplotter/jkqtpbaseplotter.h"
#include "jkqtplotter/graphs/jkqtplines.h"
#include "jkqtplotter/graphs/jkqtpscatter.h"
#include "jkqtplotter/graphs/jkqtpbarchart.h"
#include "jkqtplotter/graphs/jkqtpimage.h"
#include "jkqtplotter/graphs/jkqtpgeometric.h"
#include "jkqtplotter/graphs/jkqtpgeoannotations.h"
#include "jkqtplotter/graphs/jkqtpboxplot.h"
#include "jkqtplotter/graphs/jkqtpfilledcurve.h"
#include "jkqtplotter/graphs/jkqtpimpulses.h"
#include <iostream>
#if __cplusplus >= 202002L
# include <version>
@ -381,6 +389,252 @@ void doListAxisStyling(const QDir& outputDir, int iconsize, QColor backgroundCol
plot.grabPixelImage(QSize(plot.getWidth(),plot.getHeight()), false).copy(0,0,plot.getWidth(),plot.getHeight()).save(outputDir.absoluteFilePath("axis_unit_scaling_pi.png"), "png");
}
void plotStyle(JKQTBasePlotter& plot) {
// 0. get a pointer to the internal datastore (for convenience)
JKQTPDatastore* ds=plot.getDatastore();
// 1. clear old graphs/data
plot.clearGraphs(true);
ds->clear();
// 2. now we create data for a simple plot (a sine curve)
QVector<double> X, Y1, Y2, img, X3, Y3, Y3err, Xbar, Ybar, Ybar2, Y4, Y5, XImp, YImp;
const int Ndata=100;
for (int i=0; i<Ndata; i++) {
const double x=double(i)/double(Ndata)*8.0*JKQTPSTATISTICS_PI;
X<<x;
Y1<<1.1+sin(x);
Y2<<1.1+sin(x)*exp(-0.2*x);
Y4<<4.5*exp(-x/10.0);
Y5<<2.5*exp(-x/10.0)+1.0;
if (i%5==0) {
X3<<x;
Y3<<(2.5+Y1.last());
Y3err<<(double(i+5)/double(Ndata)*0.5);
}
if (i>0 && i%20==0) {
Xbar<<x/2.0;
Ybar<<(double(i+5)/double(Ndata)*(-1.5));
Ybar2<<(double(i+5)/double(Ndata)*(-1.2));
}
if (i%8==0) {
XImp<<15.0+x/3.0;
YImp<<-1.0+0.5*sin(x);
}
}
auto fgauss=[](double x, double y, double x0, double y0, double sx, double sy) {
return exp(-2.0*(x-x0)*(x-x0)/sx/sx-2.0*(y-y0)*(y-y0)/sy/sy);
};
for (int i=0; i<Ndata; i++) {
for (int j=0; j<Ndata; j++) {
img.push_back(fgauss(j,i,Ndata/3,Ndata/3,Ndata/5,Ndata/3)+fgauss(j,i,Ndata*3/4,Ndata*2/3,Ndata/2,Ndata/4));
}
}
// 3. make data available to JKQTPlotter by adding it to the internal datastore.
// Note: In this step the data is copied (of not specified otherwise), so you can
// reuse X and Y afterwards!
// the variables columnX and columnY will contain the internal column ID of the newly
// created columns with names "x" and "y" and the (copied) data from X and Y.
size_t columnX=ds->addCopiedColumn(X, "x");
size_t columnY1=ds->addCopiedColumn(Y1, "y1");
size_t columnY2=ds->addCopiedColumn(Y2, "y2");
size_t columnImg=ds->addCopiedColumn(img, "img");
size_t columnX3=ds->addCopiedColumn(X3, "x3");
size_t columnY3=ds->addCopiedColumn(Y3, "y3");
size_t columnY3err=ds->addCopiedColumn(Y3err, "y3err");
size_t columnXbar=ds->addCopiedColumn(Xbar, "xbar");
size_t columnYbar=ds->addCopiedColumn(Ybar, "ybar");
size_t columnYbar2=ds->addCopiedColumn(Ybar2, "Ybar2");
size_t columnY4=ds->addCopiedColumn(Y4, "y4");
size_t columnY5=ds->addCopiedColumn(Y5, "y5");
size_t columnXImp=ds->addCopiedColumn(XImp, "ximp");
size_t columnYImp=ds->addCopiedColumn(YImp, "yimp");
// 4. create diverse graphs in the plot:
JKQTPFilledCurveXGraph* graphf4=new JKQTPFilledCurveXGraph(&plot);
graphf4->setXColumn(columnX);
graphf4->setYColumn(columnY4);
graphf4->setTitle(QObject::tr("filled exp-function"));
plot.addGraph(graphf4);
JKQTPFilledCurveXGraph* graphf5=new JKQTPFilledCurveXGraph(&plot);
graphf5->setXColumn(columnX);
graphf5->setYColumn(columnY5);
graphf5->setTitle(QObject::tr("other filled exp-function"));
plot.addGraph(graphf5);
JKQTPColumnMathImage* graphI=new JKQTPColumnMathImage(&plot);
graphI->setImageColumn(columnImg);
graphI->setNx(Ndata);
graphI->setNy(Ndata);
graphI->setColorBarTopVisible(true);
graphI->setColorBarRightVisible(true);
graphI->setX(0.5);
graphI->setY(-2.0);
graphI->setWidth(5);
graphI->setHeight(1);
graphI->setTitle(QObject::tr("2{\\times}Gauss"));
plot.addGraph(graphI);
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
graph1->setXColumn(columnX);
graph1->setYColumn(columnY1);
graph1->setTitle(QObject::tr("sine graph $f(x)=\\sin(x)$"));
plot.addGraph(graph1);
JKQTPXYLineGraph* graph2=new JKQTPXYLineGraph(&plot);
graph2->setXColumn(columnX);
graph2->setYColumn(columnY2);
graph2->setSymbolType(JKQTPNoSymbol);
//graph2->setTitle(QObject::tr("sine{\\cdot}exp graph $f(x)=\\sin(x)\\cdot\\exp\\left(-\\frac{x}{5}\\right)$"));
graph2->setTitle(QObject::tr("sine*exp graph"));
plot.addGraph(graph2);
JKQTPXYLineErrorGraph* graph3=new JKQTPXYLineErrorGraph(&plot);
graph3->setXColumn(columnX3);
graph3->setYColumn(columnY3);
graph3->setYErrorColumn(columnY3err);
graph3->setDrawLine(true);
graph3->setYErrorStyle(JKQTPErrorBarsPolygons);
graph3->setTitle(QObject::tr("sine \\pm errors graph"));
plot.addGraph(graph3);
JKQTPBarVerticalGraph* graphb=new JKQTPBarVerticalGraph(&plot);
graphb->setXColumn(columnXbar);
graphb->setYColumn(columnYbar);
graphb->setTitle(QObject::tr("barchart"));
plot.addGraph(graphb);
JKQTPBarVerticalGraph* graphb2=new JKQTPBarVerticalGraph(&plot);
graphb2->setXColumn(columnXbar);
graphb2->setYColumn(columnYbar2);
graphb2->setTitle(QObject::tr("2^{nd} barchart"));
plot.addGraph(graphb2);
graphb2->autoscaleBarWidthAndShiftSeparatedGroups();
JKQTPImpulsesVerticalGraph* graphi2=new JKQTPImpulsesVerticalGraph(&plot);
graphi2->setXColumn(columnXImp);
graphi2->setYColumn(columnYImp);
graphi2->setTitle(QObject::tr("impulses"));
plot.addGraph(graphi2);
JKQTPBoxplotHorizontalElement* graphBP=new JKQTPBoxplotHorizontalElement(&plot);
graphBP->setData(-2, 7, 10,12,13,17,22);
plot.addGraph(graphBP);
JKQTPGeoSymbol* annotSym=new JKQTPGeoSymbol(&plot, 15, -3);
plot.addGraph(annotSym);
JKQTPGeoText* annotTxt=new JKQTPGeoText(&plot, 15.1, -3, "Annotation $\\int_{0}^{2\\pi}\\sin(x)\\;\\mathrm{d}x$");
plot.addGraph(annotTxt);
JKQTPGeoEllipse* geoEll=new JKQTPGeoEllipse(&plot, 5,-3,5,1);
geoEll->setAngle(-25);
plot.addGraph(geoEll);
plot.addGraph(new JKQTPGeoArrow(&plot, 5,-3,10,-3.5));
plot.addGraph(new JKQTPGeoLine(&plot, 5,-3,10,-4));
// 6. autoscale the plot so the graph is contained
plot.zoomToFit();
plot.setPlotLabel("Sine Plots - User-Interaction Example");
plot.getXAxis()->setAxisLabel("x-axis");
plot.getYAxis()->setAxisLabel("y-axis");
plot.redrawPlot();
}
void plotStyleSymbols(JKQTBasePlotter& plotExtra, const JKQTBasePlotter& plot) {
plotExtra.clearGraphs(true);
plotExtra.setBackgroundColor(plot.getBackgroundColor());
plotExtra.setExportBackgroundColor(plot.getExportBackgroundColor());
plotExtra.setPlotBackgroundColor(plot.getPlotBackgroundColor());
plotExtra.getXAxis()->setDrawMode1(JKQTPCADMnone);
plotExtra.getXAxis()->setDrawMode2(JKQTPCADMnone);
plotExtra.getYAxis()->setDrawMode1(JKQTPCADMnone);
plotExtra.getYAxis()->setDrawMode2(JKQTPCADMnone);
double x=1;
double xlineend=6;
double y=1;
double xmax=15;
int cnt=0;
for (auto s: plot.getCurrentPlotterStyle().graphsStyle.defaultGraphSymbols) {
plotExtra.addGraph(new JKQTPGeoSymbol(&plotExtra, x, y, s, 12 ));
const auto col=plot.getCurrentPlotterStyle().graphsStyle.defaultGraphColors.value(0, Qt::black);
dynamic_cast<JKQTPGeoSymbol*>(plotExtra.getGraph(cnt))->setSymbolColor(col);
dynamic_cast<JKQTPGeoSymbol*>(plotExtra.getGraph(cnt))->setSymbolFillColor(col);
x+=1;
xmax=qMax(x, xmax);
if (cnt>0 && cnt%25==0) {
x=1;
y+=1.0;
}
cnt++;
}
y=y+1;
double ycoltest=y;
for (auto s: plot.getCurrentPlotterStyle().graphsStyle.defaultGraphPenStyles) {
JKQTPGeoLine* l;
plotExtra.addGraph(l=new JKQTPGeoLine(&plotExtra, 1,y,xlineend,y)); l->setStyle(QColor("red"), 2, s);
const auto col=plot.getCurrentPlotterStyle().graphsStyle.defaultGraphColors.value(0, Qt::black);
dynamic_cast<JKQTPGeoLine*>(plotExtra.getGraph(cnt))->setLineColor(col);
y+=0.75;
}
x=xlineend+1;
const int cntFillTests=qMax(plot.getCurrentPlotterStyle().graphsStyle.defaultGraphColors.size(), plot.getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.size());
double dx=(xmax-xlineend-1.0)/static_cast<double>(cntFillTests);
for (int i=0; i<cntFillTests; i++) {
const auto col=plot.getCurrentPlotterStyle().graphsStyle.defaultGraphColors.value(i%plot.getCurrentPlotterStyle().graphsStyle.defaultGraphColors.size(), Qt::black);
const auto fs=plot.getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.value(i%plot.getCurrentPlotterStyle().graphsStyle.defaultGraphFillStyles.size(), Qt::SolidPattern);
JKQTPGeoLine* l;
plotExtra.addGraph(l=new JKQTPGeoLine(&plotExtra, x,ycoltest,x,y-0.5)); l->setStyle(col,5);
JKQTPGeoRectangle* r;
plotExtra.addGraph(r=new JKQTPGeoRectangle(&plotExtra, x+dx/2,(ycoltest+y-0.5)/2.0, dx*0.5, y-ycoltest-0.5));
r->setStyle(col,1, Qt::SolidLine, JKQTPGetDerivedColor(plot.getCurrentPlotterStyle().graphsStyle.defaultGraphStyle.fillColorDerivationMode, col), fs);
x+=dx;
}
plotExtra.zoomToFit();
plotExtra.setX(0, plotExtra.getXMax()+2);
plotExtra.setY(0, plotExtra.getYMax()+1);
plotExtra.setGrid(false);
plotExtra.setPlotLabel("default symbols/lines/colors");
plotExtra.redrawPlot();
}
void doListStyles(const QDir& outputDir, const QDir& docoutputDir, int iconsize, QColor backgroundColor) {
QDir dir(":/JKQTPlotter/styles/", "*.ini");
QFile fhtml(docoutputDir.absoluteFilePath("styles.html"));
fhtml.open(QFile::WriteOnly|QFile::Text);
QTextStream shtml(&fhtml);
shtml<<"<table class=\"doxtable\">\n <tr><th>Style-file </th><th>Screenshot </th><th>Symbols </th></tr>\n";
for (auto& f: dir.entryList()) {
qDebug()<<"plotting example for style "<<f;
JKQTBasePlotter plot(true);
plot.setWidgetSize(iconsize,iconsize);
plot.loadCurrentPlotterStyle(QSettings(dir.absoluteFilePath(f), QSettings::IniFormat));
plotStyle(plot);
plot.grabPixelImage(QSize(plot.getWidth(),plot.getHeight()), false).copy(0,0,plot.getWidth(),plot.getHeight()).save(outputDir.absoluteFilePath(f+".png"), "png");
JKQTBasePlotter plotExtra(true);
plotExtra.setWidgetSize(iconsize*2, iconsize/3);
plotStyleSymbols(plotExtra, plot);
plotExtra.grabPixelImage(QSize(plotExtra.getWidth(),plotExtra.getHeight()), false).copy(0,0,plotExtra.getWidth(),plotExtra.getHeight()).save(outputDir.absoluteFilePath(f+".symbols.png"), "png");
shtml<<" <tr>"
<<"<td><a href=\"https://github.com/jkriege2/JKQtPlotter/tree/master/lib/jkqtplotter/resources/styles/"<<f<<"\"><code>"<<dir.absoluteFilePath(f)<<"</code></a></td>"
<<"<td><div class=\"image\"><img src=\""<<f<<".png\" alt=\"\"/></div></td>"
<<"<td><div class=\"image\"><img src=\""<<f<<".symbols.png\" alt=\"\"/></div></td>"
<<"</tr>";
}
shtml<<"</table>";
}
int main(int argc, char* argv[])
{
// 1. create Qt Appcilation object and a QCommandLineParser to go with it
@ -391,6 +645,8 @@ int main(int argc, char* argv[])
parser.addVersionOption();
QCommandLineOption outputDirectoryOption("outputdir", "write results into this directory.", "outputdir", app.applicationDirPath());
parser.addOption(outputDirectoryOption);
QCommandLineOption docoutputDirectoryOption("docoutputdir", "write doc-file results into this directory.", "docoutputdir", app.applicationDirPath());
parser.addOption(docoutputDirectoryOption);
QCommandLineOption listsymbolsOption("listsymbols", "generate example images for all symbols.");
parser.addOption(listsymbolsOption);
QCommandLineOption listlinedecoratorsOption("listlinedecorators", "generate example images for all line-decorators.");
@ -399,6 +655,8 @@ int main(int argc, char* argv[])
parser.addOption(listerrorindicatorsOption);
QCommandLineOption listaxisstylepropsOption("listaxisstyleprops", "generate example images for JKQTPCALabelType and other coordinate axis properties.");
parser.addOption(listaxisstylepropsOption);
QCommandLineOption liststylesOption("liststyles", "generate example images for all predefined style INI files.");
parser.addOption(liststylesOption);
QCommandLineOption iconsizeOption("iconsize", "typical size of the generatued images.", "iconsize", "24");
parser.addOption(iconsizeOption);
QCommandLineOption backgroundOption("background", "background color.", "background", "white");
@ -406,10 +664,12 @@ int main(int argc, char* argv[])
parser.process(app);
const QDir outputDir(parser.value(outputDirectoryOption));
const QDir docoutputDir(parser.value(docoutputDirectoryOption));
const bool listsymbols=parser.isSet(listsymbolsOption);
const bool listlinedecorators=parser.isSet(listlinedecoratorsOption);
const bool listerrorindicators=parser.isSet(listerrorindicatorsOption);
const bool listaxisstyleprops=parser.isSet(listaxisstylepropsOption);
const bool liststyles=parser.isSet(liststylesOption);
const int iconsize=parser.value(iconsizeOption).toInt();
const QColor backgroundColor = jkqtp_String2QColor(parser.value(backgroundOption));
@ -419,6 +679,7 @@ int main(int argc, char* argv[])
if (listlinedecorators) doListLineDecorators(outputDir, iconsize, backgroundColor);
if (listerrorindicators) doListErrorIndicators(outputDir, iconsize, backgroundColor);
if (listaxisstyleprops) doListAxisStyling(outputDir, iconsize, backgroundColor);
if (liststyles) doListStyles(outputDir, docoutputDir, iconsize, backgroundColor);
return EXIT_SUCCESS;
}