diff --git a/.gitignore b/.gitignore
index 1908239aa6..b721d47578 100644
--- a/.gitignore
+++ b/.gitignore
@@ -183,3 +183,7 @@ Sicherungskopie_*
/doc/images/JKQTPGLabelCenteredOnData_small.png
/lib/jkqtplotter/resources/styles/default.ini.export.png
/lib/jkqtplotter/resources/styles/default.ini.png
+/doc/images/JKQTPBarHorizontalAutoscaleMaxWidthOnly_small.png
+/doc/images/JKQTPBarHorizontalAutoscaleShrinkOnly_small.png
+/doc/images/JKQTPBarVerticalAutoscaleMaxWidthOnly_small.png
+/doc/images/JKQTPBarVerticalAutoscaleShrinkOnly_small.png
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index cd722fa504..83f8452b0f 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -260,7 +260,7 @@ if(JKQtPlotter_BUILD_EXAMPLES)
stackedbars/JKQTPbarVerticalGraphStacked,JKQTPbarHorizontalGraphStacked/--smallscreenshotplot
scatter/JKQTPXYScatterGraph,JKQTPXYScatterErrorGraph/--smallscreenshotplot
simpletest/JKQTPXYLineGraph/--smallscreenshotplot
- barchart/JKQTPBarVerticalGraph,JKQTPBarHorizontalGraph,JKQTPBarVerticalGraphNoBaseline,JKQTPBarHorizontalGraphNoBaseline,JKQTPBarVerticalGraphBaseline,JKQTPBarHorizontalGraphBaseline/--iteratefunctorsteps--smallscreenshotplot
+ barchart/JKQTPBarVerticalGraph,JKQTPBarHorizontalGraph,JKQTPBarVerticalGraphNoBaseline,JKQTPBarHorizontalGraphNoBaseline,JKQTPBarVerticalGraphBaseline,JKQTPBarHorizontalGraphBaseline,JKQTPBarVerticalAutoscaleShrinkOnly,JKQTPBarHorizontalAutoscaleShrinkOnly,JKQTPBarVerticalAutoscaleMaxWidthOnly,JKQTPBarHorizontalAutoscaleMaxWidthOnly/--iteratefunctorsteps--smallscreenshotplot
barchart_twocolor/JKQTPBarVerticalGraphTwoColorFilling,JKQTPBarHorizontalGraphTwoColorFilling/--smallscreenshotplot
barchart_errorbars/JKQTPBarVerticalErrorGraph,JKQTPBarHorizontalErrorGraph/--smallscreenshotplot
barchart_functorfill/JKQTPBarVerticalGraphFunctorFilling,JKQTPBarHorizontalGraphFunctorFilling/--smallscreenshotplot
diff --git a/doc/dox/whatsnew.dox b/doc/dox/whatsnew.dox
index e53a74c1c1..45e3da7d53 100644
--- a/doc/dox/whatsnew.dox
+++ b/doc/dox/whatsnew.dox
@@ -64,6 +64,7 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
FIXED/REWORKED issue #111: Can't write to PDF files with JKQTPlotter::saveImage() when passing a filename ending in ".pdf" (thanks to user:fpalazzolo for reporting):
While fixing this issue, the functions JKQTBasePlotter::saveImage() etc. gained a bool return value to indicate whether sacing was successful.
IMPROVED/FIXED outside space requirements for color bars. Text was sometime too close to the plot border.
REWORKED JKQTBasePlotter::saveData() with a more consistent interface and a bool return value to indicate success or failure + improved documentation, added methods to JKQTPSaveDataAdapter that allow to specify file extensions and an ID for the plugin.
+ REWORKED: separation and gruping factor for barcharts on autoscaling
REORGANIZED: separated line-graphs from jkqtpscatter.h/.cpp into jkqtplines.h/.cpp
IMPROVED: QT6-compatibility by removing deprecated warnings
IMPROVED: added missing override declarations
@@ -132,6 +133,8 @@ Changes, compared to \ref page_whatsnew_V4_0_0 "v4.0.0" include:
NEW: JKQTPVectorFieldGraph for drawing "simple" vector fields/quiver plots (+example \ref JKQTPlotterVectorFieldExample)
NEW: JKQTPParametrizedVectorFieldGraph for drawing color-coded vector fields/quiver plots (+example \ref JKQTPParametrizedVectorFieldGraphExample)
NEW: JKQTPFinancialGraph for drawing candlestick or OHLC graphs of financial data, such as stock amrket prices (+example \ref JKQTPlotterFinancialChartExample)
+ NEW: stacked barcharts may have a small separation (default 1pt)
+ NEW: autoscaling for barcharts works now, also when stacked and unstacked charts are combined in one plot
JKQTMathText:
diff --git a/doc/images/JKQTBasePlotter_addSecondaryXAxis.png b/doc/images/JKQTBasePlotter_addSecondaryXAxis.png
index 80d21944a6..2d0fd4bb98 100644
Binary files a/doc/images/JKQTBasePlotter_addSecondaryXAxis.png and b/doc/images/JKQTBasePlotter_addSecondaryXAxis.png differ
diff --git a/doc/images/JKQTBasePlotter_addSecondaryYAxis.png b/doc/images/JKQTBasePlotter_addSecondaryYAxis.png
index 40b679814a..e1ee1c0282 100644
Binary files a/doc/images/JKQTBasePlotter_addSecondaryYAxis.png and b/doc/images/JKQTBasePlotter_addSecondaryYAxis.png differ
diff --git a/doc/images/JKQTPBarHorizontalAutoscaleMaxWidthOnly.png b/doc/images/JKQTPBarHorizontalAutoscaleMaxWidthOnly.png
new file mode 100644
index 0000000000..243488bc46
Binary files /dev/null and b/doc/images/JKQTPBarHorizontalAutoscaleMaxWidthOnly.png differ
diff --git a/doc/images/JKQTPBarHorizontalAutoscaleShrinkOnly.png b/doc/images/JKQTPBarHorizontalAutoscaleShrinkOnly.png
new file mode 100644
index 0000000000..6b41fe1f01
Binary files /dev/null and b/doc/images/JKQTPBarHorizontalAutoscaleShrinkOnly.png differ
diff --git a/doc/images/JKQTPBarHorizontalGraph.png b/doc/images/JKQTPBarHorizontalGraph.png
index 192c5e9096..ffa6397a29 100644
Binary files a/doc/images/JKQTPBarHorizontalGraph.png and b/doc/images/JKQTPBarHorizontalGraph.png differ
diff --git a/doc/images/JKQTPBarHorizontalGraph_small.png b/doc/images/JKQTPBarHorizontalGraph_small.png
index f640fc7284..6f003e9cf5 100644
Binary files a/doc/images/JKQTPBarHorizontalGraph_small.png and b/doc/images/JKQTPBarHorizontalGraph_small.png differ
diff --git a/doc/images/JKQTPBarVerticalAutoscaleMaxWidthOnly.png b/doc/images/JKQTPBarVerticalAutoscaleMaxWidthOnly.png
new file mode 100644
index 0000000000..59d5ad5967
Binary files /dev/null and b/doc/images/JKQTPBarVerticalAutoscaleMaxWidthOnly.png differ
diff --git a/doc/images/JKQTPBarVerticalAutoscaleShrinkOnly.png b/doc/images/JKQTPBarVerticalAutoscaleShrinkOnly.png
new file mode 100644
index 0000000000..5698ced10b
Binary files /dev/null and b/doc/images/JKQTPBarVerticalAutoscaleShrinkOnly.png differ
diff --git a/doc/images/JKQTPBarVerticalGraph.png b/doc/images/JKQTPBarVerticalGraph.png
index b63d8f25eb..fa101c3543 100644
Binary files a/doc/images/JKQTPBarVerticalGraph.png and b/doc/images/JKQTPBarVerticalGraph.png differ
diff --git a/doc/images/JKQTPBarVerticalGraphBaseline.png b/doc/images/JKQTPBarVerticalGraphBaseline.png
index 9cfd2be03e..2c42ccaa95 100644
Binary files a/doc/images/JKQTPBarVerticalGraphBaseline.png and b/doc/images/JKQTPBarVerticalGraphBaseline.png differ
diff --git a/doc/images/JKQTPBarVerticalGraphNoBaseline.png b/doc/images/JKQTPBarVerticalGraphNoBaseline.png
index b63d8f25eb..fa101c3543 100644
Binary files a/doc/images/JKQTPBarVerticalGraphNoBaseline.png and b/doc/images/JKQTPBarVerticalGraphNoBaseline.png differ
diff --git a/doc/images/JKQTPBarVerticalGraph_small.png b/doc/images/JKQTPBarVerticalGraph_small.png
index d87783ff08..5e76c3629c 100644
Binary files a/doc/images/JKQTPBarVerticalGraph_small.png and b/doc/images/JKQTPBarVerticalGraph_small.png differ
diff --git a/doc/images/JKQTPbarHorizontalGraphStacked.png b/doc/images/JKQTPbarHorizontalGraphStacked.png
index 5023bcd84b..c66e364ccf 100644
Binary files a/doc/images/JKQTPbarHorizontalGraphStacked.png and b/doc/images/JKQTPbarHorizontalGraphStacked.png differ
diff --git a/doc/images/JKQTPbarHorizontalGraphStacked_small.png b/doc/images/JKQTPbarHorizontalGraphStacked_small.png
index 82c547a37e..c516c0e96d 100644
Binary files a/doc/images/JKQTPbarHorizontalGraphStacked_small.png and b/doc/images/JKQTPbarHorizontalGraphStacked_small.png differ
diff --git a/doc/images/JKQTPbarVerticalGraphStacked.png b/doc/images/JKQTPbarVerticalGraphStacked.png
index 372c22c216..06b2e6e1e1 100644
Binary files a/doc/images/JKQTPbarVerticalGraphStacked.png and b/doc/images/JKQTPbarVerticalGraphStacked.png differ
diff --git a/doc/images/JKQTPbarVerticalGraphStacked_small.png b/doc/images/JKQTPbarVerticalGraphStacked_small.png
index fd11650146..53ebd67574 100644
Binary files a/doc/images/JKQTPbarVerticalGraphStacked_small.png and b/doc/images/JKQTPbarVerticalGraphStacked_small.png differ
diff --git a/doc/images/jkqtmathtext/jkqtmathtext_unicode.png b/doc/images/jkqtmathtext/jkqtmathtext_unicode.png
index e10bba73c9..41d09e50e8 100644
Binary files a/doc/images/jkqtmathtext/jkqtmathtext_unicode.png and b/doc/images/jkqtmathtext/jkqtmathtext_unicode.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_multi_column.png b/doc/images/keylayouts/JKQTPKeyLayout_multi_column.png
index 72bbd7fd3f..7aabf633ef 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_multi_column.png and b/doc/images/keylayouts/JKQTPKeyLayout_multi_column.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_multi_row.png b/doc/images/keylayouts/JKQTPKeyLayout_multi_row.png
index bb7c4d3e8e..b73240f51b 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_multi_row.png and b/doc/images/keylayouts/JKQTPKeyLayout_multi_row.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_one_column.png b/doc/images/keylayouts/JKQTPKeyLayout_one_column.png
index 4a436d494f..5caa4841c8 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_one_column.png and b/doc/images/keylayouts/JKQTPKeyLayout_one_column.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_one_row.png b/doc/images/keylayouts/JKQTPKeyLayout_one_row.png
index ee82b5868f..51b6fecf53 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_one_row.png and b/doc/images/keylayouts/JKQTPKeyLayout_one_row.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_multi_column.png b/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_multi_column.png
index cd5d1447fb..bb0629229c 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_multi_column.png and b/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_multi_column.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_multi_row.png b/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_multi_row.png
index b38cf02775..4a75c9c595 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_multi_row.png and b/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_multi_row.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_one_column.png b/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_one_column.png
index 0234b322c2..3e24a85145 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_one_column.png and b/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_one_column.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_one_row.png b/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_one_row.png
index e29eb05894..6da01507db 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_one_row.png and b/doc/images/keylayouts/JKQTPKeyLayout_outsidebottom_one_row.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_outsideright_multi_column.png b/doc/images/keylayouts/JKQTPKeyLayout_outsideright_multi_column.png
index 6ebe012c66..d8b3155808 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_outsideright_multi_column.png and b/doc/images/keylayouts/JKQTPKeyLayout_outsideright_multi_column.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_outsideright_multi_row.png b/doc/images/keylayouts/JKQTPKeyLayout_outsideright_multi_row.png
index d5ee18e649..1adddd594b 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_outsideright_multi_row.png and b/doc/images/keylayouts/JKQTPKeyLayout_outsideright_multi_row.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_outsideright_one_column.png b/doc/images/keylayouts/JKQTPKeyLayout_outsideright_one_column.png
index 090fa78487..41a42e3925 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_outsideright_one_column.png and b/doc/images/keylayouts/JKQTPKeyLayout_outsideright_one_column.png differ
diff --git a/doc/images/keylayouts/JKQTPKeyLayout_outsideright_one_row.png b/doc/images/keylayouts/JKQTPKeyLayout_outsideright_one_row.png
index 25f7de3bdf..ff71813669 100644
Binary files a/doc/images/keylayouts/JKQTPKeyLayout_outsideright_one_row.png and b/doc/images/keylayouts/JKQTPKeyLayout_outsideright_one_row.png differ
diff --git a/doc/images/palettes/palette_jkqtplotterdefault_step.png b/doc/images/palettes/palette_jkqtplotterdefault_step.png
index 6314a6325f..a3aec9a1c7 100644
Binary files a/doc/images/palettes/palette_jkqtplotterdefault_step.png and b/doc/images/palettes/palette_jkqtplotterdefault_step.png differ
diff --git a/doc/images/styles/blackandwhite.ini.png b/doc/images/styles/blackandwhite.ini.png
index ba65b2f7ad..26f81611f3 100644
Binary files a/doc/images/styles/blackandwhite.ini.png and b/doc/images/styles/blackandwhite.ini.png differ
diff --git a/doc/images/styles/blueprint.ini.png b/doc/images/styles/blueprint.ini.png
index a1220fc44b..a6237e988a 100644
Binary files a/doc/images/styles/blueprint.ini.png and b/doc/images/styles/blueprint.ini.png differ
diff --git a/doc/images/styles/cyberpunk.ini.png b/doc/images/styles/cyberpunk.ini.png
index 4f05adb2db..c0fac0cb11 100644
Binary files a/doc/images/styles/cyberpunk.ini.png and b/doc/images/styles/cyberpunk.ini.png differ
diff --git a/doc/images/styles/dark.ini.png b/doc/images/styles/dark.ini.png
index 8b4a49eb55..bb08ce39f2 100644
Binary files a/doc/images/styles/dark.ini.png and b/doc/images/styles/dark.ini.png differ
diff --git a/doc/images/styles/default.ini.png b/doc/images/styles/default.ini.png
index 3550a8a00f..17451a3842 100644
Binary files a/doc/images/styles/default.ini.png and b/doc/images/styles/default.ini.png differ
diff --git a/doc/images/styles/default.ini.symbols.png b/doc/images/styles/default.ini.symbols.png
index e55d50fc93..b1befb2af3 100644
Binary files a/doc/images/styles/default.ini.symbols.png and b/doc/images/styles/default.ini.symbols.png differ
diff --git a/doc/images/styles/legacy_default_style.ini.png b/doc/images/styles/legacy_default_style.ini.png
index 9450f0b096..6000d0b63c 100644
Binary files a/doc/images/styles/legacy_default_style.ini.png and b/doc/images/styles/legacy_default_style.ini.png differ
diff --git a/doc/images/styles/seaborn.ini.png b/doc/images/styles/seaborn.ini.png
index c1168e9eb9..04b05dd9e8 100644
Binary files a/doc/images/styles/seaborn.ini.png and b/doc/images/styles/seaborn.ini.png differ
diff --git a/doc/images/styles/simple_arrowsaxes.ini.png b/doc/images/styles/simple_arrowsaxes.ini.png
index 5770eb5ba2..3a23e6891d 100644
Binary files a/doc/images/styles/simple_arrowsaxes.ini.png and b/doc/images/styles/simple_arrowsaxes.ini.png differ
diff --git a/doc/images/styles/simple_arrowsaxes.ini.symbols.png b/doc/images/styles/simple_arrowsaxes.ini.symbols.png
index e55d50fc93..b1befb2af3 100644
Binary files a/doc/images/styles/simple_arrowsaxes.ini.symbols.png and b/doc/images/styles/simple_arrowsaxes.ini.symbols.png differ
diff --git a/doc/images/styles/simple_axesoffset.ini.png b/doc/images/styles/simple_axesoffset.ini.png
index 952b8012e4..5c458f8623 100644
Binary files a/doc/images/styles/simple_axesoffset.ini.png and b/doc/images/styles/simple_axesoffset.ini.png differ
diff --git a/doc/images/styles/simple_axesoffset.ini.symbols.png b/doc/images/styles/simple_axesoffset.ini.symbols.png
index e55d50fc93..b1befb2af3 100644
Binary files a/doc/images/styles/simple_axesoffset.ini.symbols.png and b/doc/images/styles/simple_axesoffset.ini.symbols.png differ
diff --git a/doc/images/styles/simple_axesoffset_plotbox.ini.png b/doc/images/styles/simple_axesoffset_plotbox.ini.png
index b4379f97b7..40cf090dc4 100644
Binary files a/doc/images/styles/simple_axesoffset_plotbox.ini.png and b/doc/images/styles/simple_axesoffset_plotbox.ini.png differ
diff --git a/doc/images/styles/simple_axesoffset_plotbox.ini.symbols.png b/doc/images/styles/simple_axesoffset_plotbox.ini.symbols.png
index e55d50fc93..b1befb2af3 100644
Binary files a/doc/images/styles/simple_axesoffset_plotbox.ini.symbols.png and b/doc/images/styles/simple_axesoffset_plotbox.ini.symbols.png differ
diff --git a/doc/images/styles/simple_gridandticks.ini.png b/doc/images/styles/simple_gridandticks.ini.png
index ab087e2074..aac7b75329 100644
Binary files a/doc/images/styles/simple_gridandticks.ini.png and b/doc/images/styles/simple_gridandticks.ini.png differ
diff --git a/doc/images/styles/simple_gridandticks.ini.symbols.png b/doc/images/styles/simple_gridandticks.ini.symbols.png
index e55d50fc93..b1befb2af3 100644
Binary files a/doc/images/styles/simple_gridandticks.ini.symbols.png and b/doc/images/styles/simple_gridandticks.ini.symbols.png differ
diff --git a/doc/images/styles/simple_noaxes.ini.png b/doc/images/styles/simple_noaxes.ini.png
index 11d4d47d01..fcdec85be0 100644
Binary files a/doc/images/styles/simple_noaxes.ini.png and b/doc/images/styles/simple_noaxes.ini.png differ
diff --git a/doc/images/styles/simple_noaxes.ini.symbols.png b/doc/images/styles/simple_noaxes.ini.symbols.png
index e55d50fc93..b1befb2af3 100644
Binary files a/doc/images/styles/simple_noaxes.ini.symbols.png and b/doc/images/styles/simple_noaxes.ini.symbols.png differ
diff --git a/examples/barchart/barchart.cpp b/examples/barchart/barchart.cpp
index 364e37ea33..fc5ad2d39b 100644
--- a/examples/barchart/barchart.cpp
+++ b/examples/barchart/barchart.cpp
@@ -66,7 +66,7 @@ std::vector doExample(JKQTPlotter& plot, const QString& title)
// This function searches all JKQTPBarHorizontalGraph in the current
// plot and sets their shift/scale so they form a nice plot with
// side-by-side groups
- graph1->autoscaleBarWidthAndShift(0.75, 1);
+ graph1->autoscaleBarWidthAndShift();
if (dynamic_cast(graph1)!=nullptr) {
// 7. data is grouped into 5 numbere groups (1..5), but we also have string
@@ -126,6 +126,8 @@ int main(int argc, char* argv[])
plotV.getYAxis()->setShowZeroAxis(false);
plotH.getXAxis()->setShowZeroAxis(false);
plotH.getYAxis()->setShowZeroAxis(false);
+ plotV.redrawPlot();
+ plotH.redrawPlot();
});
app.addExportStepFunctor([&](){
@@ -139,6 +141,42 @@ int main(int argc, char* argv[])
plotV.getYAxis()->setShowZeroAxis(false);
plotH.getXAxis()->setShowZeroAxis(false);
plotH.getYAxis()->setShowZeroAxis(false);
+ plotV.redrawPlot();
+ plotH.redrawPlot();
+ });
+
+ app.addExportStepFunctor([&](){
+ for (auto g: gV) {
+ g->setDrawBaseline(false);
+ }
+ for (auto g: gH) {
+ g->setDrawBaseline(false);
+ }
+ gV[0]->autoscaleBarWidthAndShift(1,0.9);
+ gH[0]->autoscaleBarWidthAndShift(1,0.9);
+ plotV.getXAxis()->setShowZeroAxis(false);
+ plotV.getYAxis()->setShowZeroAxis(false);
+ plotH.getXAxis()->setShowZeroAxis(false);
+ plotH.getYAxis()->setShowZeroAxis(false);
+ plotV.redrawPlot();
+ plotH.redrawPlot();
+ });
+
+ app.addExportStepFunctor([&](){
+ for (auto g: gV) {
+ g->setDrawBaseline(false);
+ }
+ for (auto g: gH) {
+ g->setDrawBaseline(false);
+ }
+ gV[0]->autoscaleBarWidthAndShift(0.75,1);
+ gH[0]->autoscaleBarWidthAndShift(0.75,1);
+ plotV.getXAxis()->setShowZeroAxis(false);
+ plotV.getYAxis()->setShowZeroAxis(false);
+ plotH.getXAxis()->setShowZeroAxis(false);
+ plotH.getYAxis()->setShowZeroAxis(false);
+ plotV.redrawPlot();
+ plotH.redrawPlot();
});
return app.exec();
}
diff --git a/examples/multithreaded/README.md b/examples/multithreaded/README.md
index a9efd12ecc..8694d068a5 100644
--- a/examples/multithreaded/README.md
+++ b/examples/multithreaded/README.md
@@ -97,10 +97,10 @@ This test results in the following numbers (on my AMD Ryzen5 8/16-core laptop):
VERSION: 5.0.0
BUILD MODE: Debug
-SERIAL RESULTS:
runtime, overall = 13010.9ms
single runtimes = (542.0 +/- 1807.8) ms
speedup = 1.00x
threads / available = 1 / 16
+SERIAL RESULTS:
runtime, overall = 12224.1ms
single runtimes = (509.2 +/- 1614.8) ms
speedup = 1.00x
threads / available = 1 / 16
PARALLEL RESULTS:
-runtime, overall = 2652.2ms
single runtimes = (690.9 +/- 79.5) ms
speedup = 6.25x
threads / available = 8 / 16
batch runs = 3
speedup vs. serial = 4.9x
+runtime, overall = 2905.3ms
single runtimes = (746.9 +/- 66.6) ms
speedup = 6.17x
threads / available = 8 / 16
batch runs = 3
speedup vs. serial = 4.2x
[comment]:RESULTS_END
diff --git a/examples/styling/build_test_graphs.h b/examples/styling/build_test_graphs.h
index aa8d6f801c..81b8367eb6 100644
--- a/examples/styling/build_test_graphs.h
+++ b/examples/styling/build_test_graphs.h
@@ -5,6 +5,7 @@
#include "jkqtplotter/graphs/jkqtpbarchart.h"
#include "jkqtplotter/graphs/jkqtpimage.h"
#include "jkqtplotter/graphs/jkqtpgeometric.h"
+#include "jkqtplotter/graphs/jkqtpfinancial.h"
#include "jkqtplotter/graphs/jkqtpgeoannotations.h"
#include "jkqtplotter/graphs/jkqtpboxplot.h"
#include "jkqtplotter/graphs/jkqtpfilledcurve.h"
@@ -30,6 +31,7 @@ inline void setupGridPrintingAndDatastores(QVector& plots, QSi
}
inline void buildPlots(QVector& plots) {
+ JKQTPFinancialGraph::clearColorAssignStore();
// 0. get a pointer to the internal datastore (for convenience)
JKQTPDatastore* ds=plots.first()->getDatastore();
@@ -41,7 +43,7 @@ inline void buildPlots(QVector& plots) {
ds->clear();
// 2. now we create data for a simple plot (a sine curve)
- QVector X, Y1, Y2, img, X3, Y3, Y3err, Xbar, Ybar, Ybar2, Ybar3, Y4, Y5, XImp, YImp, XBP, MinBP, Q25BP, MeanBP, MedianBP, Q75BP, MaxBP;
+ QVector X, Y1, Y2, img, X3, Y3, Y3err, Xbar, Ybar, Ybar2, Ybar2s1, Ybar2s2, Ybar3, Y4, Y5, XImp, YImp, XBP, MinBP, Q25BP, MeanBP, MedianBP, Q75BP, MaxBP, TFin, OFin1,CFin1,LFin1,HFin1, OFin2,CFin2,LFin2,HFin2;
const int Ndata=50;
for (int i=0; i& plots) {
if (i>0 && i%16==0) {
Xbar<& plots) {
Q75BP<<(i*1.3+6.0);
MaxBP<<(i*1.35+7.5);
}
+ if (i<=10) {
+ TFin << (i+1);
+ OFin1 << CFin1.value(CFin1.size()-1,30)+3.0*sin(i);
+ CFin1 << OFin1.value(OFin1.size()-1,30)+3.0*cos(i);
+ HFin1 << qMax(OFin1.last(),CFin1.last())+2;
+ LFin1 << qMin(OFin1.last(),CFin1.last())-2;
+ OFin2 << CFin2.value(CFin2.size()-1,20)+2.0*cos(i);
+ CFin2 << OFin2.value(OFin2.size()-1,20)+2.0*sin(i);
+ HFin2 << qMax(OFin2.last(),CFin2.last())+2;
+ LFin2 << qMin(OFin2.last(),CFin2.last())-2;
+ }
}
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);
@@ -99,6 +114,8 @@ inline void buildPlots(QVector& plots) {
size_t columnXbar=ds->addCopiedColumn(Xbar, "xbar");
size_t columnYbar=ds->addCopiedColumn(Ybar, "ybar");
size_t columnYbar2=ds->addCopiedColumn(Ybar2, "Ybar2");
+ size_t columnYbar2s1=ds->addCopiedColumn(Ybar2s1, "Ybar2, stack1");
+ size_t columnYbar2s2=ds->addCopiedColumn(Ybar2s2, "Ybar2, stack2");
size_t columnYbar3=ds->addCopiedColumn(Ybar3, "Ybar3");
size_t columnY4=ds->addCopiedColumn(Y4, "y4");
size_t columnY5=ds->addCopiedColumn(Y5, "y5");
@@ -113,6 +130,8 @@ inline void buildPlots(QVector& plots) {
size_t columnQ75BP=ds->addCopiedColumn(Q75BP, "Q75BP");
size_t columnMaxBP=ds->addCopiedColumn(MaxBP, "MaxBP");
+ size_t columnFinT=ds->addCopiedColumn(TFin, "FinT");
+
// 4. create diverse graphs in the plot:
JKQTPFilledCurveXGraph* graphf4=new JKQTPFilledCurveXGraph(plots[2]);
graphf4->setXColumn(columnX);
@@ -201,18 +220,33 @@ inline void buildPlots(QVector& plots) {
graphb->setTitle(QObject::tr("barchart"));
plots[3]->addGraph(graphb);
- JKQTPBarVerticalGraph* graphb2=new JKQTPBarVerticalGraph(plots[3]);
+ JKQTPBarVerticalStackableGraph* graphb2=new JKQTPBarVerticalStackableGraph(plots[3]);
graphb2->setXColumn(columnXbar);
graphb2->setYColumn(columnYbar2);
graphb2->setTitle(QObject::tr("2^{nd} barchart"));
plots[3]->addGraph(graphb2);
+ JKQTPBarVerticalStackableGraph* graphb2s1=new JKQTPBarVerticalStackableGraph(plots[3]);
+ graphb2s1->setXColumn(columnXbar);
+ graphb2s1->setYColumn(columnYbar2s1);
+ graphb2s1->setTitle(QObject::tr("3^{rd} barchart"));
+ plots[3]->addGraph(graphb2s1);
+ graphb2s1->stackUpon(graphb2);
+
+ JKQTPBarVerticalStackableGraph* graphb2s2=new JKQTPBarVerticalStackableGraph(plots[3]);
+ graphb2s2->setXColumn(columnXbar);
+ graphb2s2->setYColumn(columnYbar2s2);
+ graphb2s2->setTitle(QObject::tr("4^{th} barchart"));
+ plots[3]->addGraph(graphb2s2);
+ graphb2s2->stackUpon(graphb2s1);
+
JKQTPBarVerticalGraph* graphb3=new JKQTPBarVerticalGraph(plots[3]);
graphb3->setXColumn(columnXbar);
graphb3->setYColumn(columnYbar3);
- graphb3->setTitle(QObject::tr("3^{nd} barchart"));
+ graphb3->setTitle(QObject::tr("5^{th} barchart"));
plots[3]->addGraph(graphb3);
graphb3->autoscaleBarWidthAndShiftSeparatedGroups();
+ plots[3]->getMainKey()->setPosition(JKQTPKeyInsideTopLeft);
JKQTPBoxplotVerticalGraph* graphBP=new JKQTPBoxplotVerticalGraph(plots[plots.size()/2]);
@@ -225,6 +259,26 @@ inline void buildPlots(QVector& plots) {
graphBP->setMaxColumn(columnMaxBP);
plots[plots.size()/2]->addGraph(graphBP);
+
+ JKQTPFinancialGraph* graphF1=new JKQTPFinancialGraph(plots[plots.size()/2+1]);
+ graphF1->setXColumn(columnFinT);
+ graphF1->setOpenColumn(ds->addCopiedColumn(OFin1, "OFin1"));
+ graphF1->setHighColumn(ds->addCopiedColumn(HFin1, "HFin1"));
+ graphF1->setLowColumn(ds->addCopiedColumn(LFin1, "LFin1"));
+ graphF1->setCloseColumn(ds->addCopiedColumn(CFin1, "CFin1"));
+ graphF1->setGraphType(JKQTPFinancialGraph::OHLC);
+ graphF1->setTitle("OHLC");
+ plots[plots.size()/2+1]->addGraph(graphF1);
+ JKQTPFinancialGraph* graphF2=new JKQTPFinancialGraph(plots[plots.size()/2+1]);
+ graphF2->setXColumn(columnFinT);
+ graphF2->setOpenColumn(ds->addCopiedColumn(OFin2, "OFin2"));
+ graphF2->setHighColumn(ds->addCopiedColumn(HFin2, "HFin2"));
+ graphF2->setLowColumn(ds->addCopiedColumn(LFin2, "LFin2"));
+ graphF2->setCloseColumn(ds->addCopiedColumn(CFin2, "CFin2"));
+ graphF2->setGraphType(JKQTPFinancialGraph::CandleStick);
+ graphF2->setTitle("CandleStick");
+ plots[plots.size()/2+1]->addGraph(graphF2);
+
auto plotgeo=*(plots.rbegin()+1);
JKQTPGeoSymbol* annotSym=new JKQTPGeoSymbol(plotgeo, -1.5, 3);
plotgeo->addGraph(annotSym);
@@ -253,6 +307,8 @@ inline void buildPlots(QVector& plots) {
plotgeo->setMaintainAxisAspectRatio(true);
plotgeo->getXAxis()->setRange(-2.5,4);
plotgeo->getYAxis()->setRange(-2.5,4);
+ plots[plots.size()/2+1]->getXAxis()->setAxisLabel("time");
+ plots[plots.size()/2+1]->getYAxis()->setAxisLabel("price [\\euro]");
plots[0]->setPlotLabel("Line Graphs");
@@ -260,6 +316,7 @@ inline void buildPlots(QVector& plots) {
plots[2]->setPlotLabel("Filled Graphs");
plots[3]->setPlotLabel("Bar Charts");
plots[plots.size()/2]->setPlotLabel("Boxplots");
+ plots[plots.size()/2+1]->setPlotLabel("Financial Graphs");
plotgeo->setPlotLabel("Geometry & Annotations");
plots.last()->setPlotLabel("Image Plot");
diff --git a/lib/jkqtcommon/jkqtpbasicimagetools.cpp b/lib/jkqtcommon/jkqtpbasicimagetools.cpp
index 03d0ea2dcd..82716437fc 100644
--- a/lib/jkqtcommon/jkqtpbasicimagetools.cpp
+++ b/lib/jkqtcommon/jkqtpbasicimagetools.cpp
@@ -68,9 +68,9 @@ QMap JKQTPImageTools::getDefaultLUTs() {
lst<
#include
#include "jkqtplotter/jkqtptools.h"
+#include "jkqtcommon/jkqtpstringtools.h"
#include "jkqtplotter/jkqtplotter.h"
#define SmallestGreaterZeroCompare_xvsgz() if ((xvsgz>10.0*DBL_MIN)&&((smallestGreaterZero<10.0*DBL_MIN) || (xvsgzpt2px(painter, getStackSeparation());
+ const double lw=parent->pt2px(painter, getLineWidth());
int imax=0;
int imin=0;
@@ -88,7 +91,7 @@ void JKQTPBarVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
if (hasStackPar) {
double stackLastY=getParentStackedMax(i);
const double yvold=yv;
- yv0=transformY(stackLastY)-(getLineWidth());
+ yv0=transformY(stackLastY)-stackSep;
yv=stackLastY+yvold;
}
if (sr<0 && lr<0) { // only one x-value
@@ -239,6 +242,9 @@ void JKQTPBarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
const QPen p=getLinePenForRects(painter, parent);
const auto fillFunctor=std::bind(constructFillBrushFunctor(), std::placeholders::_1, std::placeholders::_2, std::ref(painter), this);
+ const double stackSep=parent->pt2px(painter, getStackSeparation());
+ const double lw=parent->pt2px(painter, getLineWidth());
+
int imax=0;
int imin=0;
@@ -270,7 +276,7 @@ void JKQTPBarHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
if (hasStackPar) {
double stackLastX=getParentStackedMax(i);
const double xvold=xv;
- xv0=transformX(stackLastX)+(getLineWidth());
+ xv0=transformX(stackLastX)+stackSep;
xv=stackLastX+xvold;
}
@@ -600,6 +606,13 @@ double JKQTPBarVerticalStackableGraph::getStackedMax(int index) const
}
}
+
+JKQTPBarGraphBase *JKQTPBarVerticalStackableGraph::getBottomOfStack()
+{
+ if (stackParent) return stackParent->getBottomOfStack();
+ else return this;
+}
+
JKQTPBarHorizontalStackableGraph::JKQTPBarHorizontalStackableGraph(JKQTBasePlotter *parent):
JKQTPBarHorizontalGraph(parent), stackParent(nullptr)
{
@@ -647,6 +660,13 @@ double JKQTPBarHorizontalStackableGraph::getStackedMax(int index) const
}
}
+JKQTPBarGraphBase *JKQTPBarHorizontalStackableGraph::getBottomOfStack()
+{
+ if (stackParent) return stackParent->getBottomOfStack();
+ else return this;
+
+}
+
double JKQTPBarHorizontalStackableGraph::getParentStackedMax(int index) const
{
if (stackParent) {
diff --git a/lib/jkqtplotter/graphs/jkqtpbarchart.h b/lib/jkqtplotter/graphs/jkqtpbarchart.h
index 8082c49e59..15575ec5b9 100644
--- a/lib/jkqtplotter/graphs/jkqtpbarchart.h
+++ b/lib/jkqtplotter/graphs/jkqtpbarchart.h
@@ -265,7 +265,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarHorizontalErrorGraph: public JKQTPBarHorizo
*
* \see JKQTPBarVerticalGraph, \ref JKQTPlotterStackedBarChart
*/
-class JKQTPLOTTER_LIB_EXPORT JKQTPBarVerticalStackableGraph: public JKQTPBarVerticalGraph {
+class JKQTPLOTTER_LIB_EXPORT JKQTPBarVerticalStackableGraph: public JKQTPBarVerticalGraph, public JKQTPBarGraphStackInternalInterface {
Q_OBJECT
public:
/** \brief class constructor */
@@ -293,10 +293,13 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarVerticalStackableGraph: public JKQTPBarVert
double getParentStackedMax(int index) const ;
- /** \brief returns \c true, if a stack parent is set (if available) */
- bool hasStackParent() const ;
+ /** \copydoc JKQTPBarGraphBase::hasStackParent() */
+ virtual bool hasStackParent() const override;
/** \brief used to generate stacked plots: returns the upper boundary of this plot in a stack, for the index-th datapoint */
double getStackedMax(int index) const;
+ /** \copydoc JKQTPBarGraphStackInternalInterface::getBottomOfStack() */
+ virtual JKQTPBarGraphBase* getBottomOfStack() override;
+
};
@@ -315,7 +318,7 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarVerticalStackableGraph: public JKQTPBarVert
*
* \see JKQTPBarHorizontalGraph, \ref JKQTPlotterStackedBarChart
*/
-class JKQTPLOTTER_LIB_EXPORT JKQTPBarHorizontalStackableGraph: public JKQTPBarHorizontalGraph {
+class JKQTPLOTTER_LIB_EXPORT JKQTPBarHorizontalStackableGraph: public JKQTPBarHorizontalGraph, public JKQTPBarGraphStackInternalInterface {
Q_OBJECT
public:
/** \brief class constructor */
@@ -342,10 +345,12 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarHorizontalStackableGraph: public JKQTPBarHo
/** \brief used to generate stacked plots: returns the upper boundary of the parent plot in a stack, for the index-th datapoint */
virtual double getParentStackedMax(int index) const override;
- /** \brief returns \c true, if a stack parent is set (if available) */
+ /** \copydoc JKQTPBarGraphBase::hasStackParent() */
virtual bool hasStackParent() const override;
/** \brief used to generate stacked plots: returns the upper boundary of this plot in a stack, for the index-th datapoint */
double getStackedMax(int index) const;
+ /** \copydoc JKQTPBarGraphStackInternalInterface::getBottomOfStack() */
+ virtual JKQTPBarGraphBase* getBottomOfStack() override;
};
diff --git a/lib/jkqtplotter/graphs/jkqtpbarchartbase.cpp b/lib/jkqtplotter/graphs/jkqtpbarchartbase.cpp
index ce59f4b2ca..0f3d1e44db 100644
--- a/lib/jkqtplotter/graphs/jkqtpbarchartbase.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpbarchartbase.cpp
@@ -40,7 +40,8 @@ JKQTPBarGraphBase::JKQTPBarGraphBase(JKQTBasePlotter* parent):
shift(0),
rectRadiusAtValue(0),
rectRadiusAtBaseline(0),
- m_drawBaseline(parent->getCurrentPlotterStyle().graphsStyle.barchartStyle.drawBaseline),
+ m_drawBaseline(false),
+ m_stackSeparation(1),
m_fillMode(FillMode::SingleFilling),
m_lineColorDerivationModeForSpecialFill(parent->getCurrentPlotterStyle().graphsStyle.barchartStyle.graphColorDerivationMode),
m_useCustomDrawFunctor(false)
@@ -48,11 +49,15 @@ JKQTPBarGraphBase::JKQTPBarGraphBase(JKQTBasePlotter* parent):
initFillStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Barchart);
initLineStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Barchart);
m_fillStyleBelow.initFillStyleInvertedColor(this);
- m_baselineStyle.setLineColor(parent->getCurrentPlotterStyle().xAxisStyle.colorZeroAxis);
m_baselineStyle.setLineStyle(Qt::SolidLine);
- m_baselineStyle.setLineWidth(parent->getCurrentPlotterStyle().xAxisStyle.lineWidthZeroAxis);
- rectRadiusAtBaseline= parent->getCurrentPlotterStyle().graphsStyle.barchartStyle.defaultRectRadiusAtBaseline;
- rectRadiusAtValue= parent->getCurrentPlotterStyle().graphsStyle.barchartStyle.defaultRectRadiusAtValue;
+ if (parent) {
+ m_baselineStyle.setLineColor(parent->getCurrentPlotterStyle().xAxisStyle.colorZeroAxis);
+ m_baselineStyle.setLineWidth(parent->getCurrentPlotterStyle().xAxisStyle.lineWidthZeroAxis);
+ rectRadiusAtBaseline= parent->getCurrentPlotterStyle().graphsStyle.barchartStyle.defaultRectRadiusAtBaseline;
+ rectRadiusAtValue= parent->getCurrentPlotterStyle().graphsStyle.barchartStyle.defaultRectRadiusAtValue;
+ m_drawBaseline=parent->getCurrentPlotterStyle().graphsStyle.barchartStyle.drawBaseline;
+ m_stackSeparation=parent->getCurrentPlotterStyle().graphsStyle.barchartStyle.stackSeparation;
+ }
}
@@ -86,11 +91,18 @@ QColor JKQTPBarGraphBase::getKeyLabelColor() const {
void JKQTPBarGraphBase::autoscaleBarWidthAndShift(double maxWidth, double shrinkFactor)
{
if (parent) {
+ auto isStackBase=[](JKQTPBarGraphBase* other) {
+ const auto vg=dynamic_cast(other);
+ return (vg && !other->hasStackParent());
+ };
+ auto isStackable=[](JKQTPBarGraphBase* other) {
+ return dynamic_cast(other);
+ };
double cntH=0;
for (size_t i=0; igetGraphCount(); i++) {
JKQTPPlotElement* g=parent->getGraph(i);
JKQTPBarGraphBase* gb=qobject_cast(g);
- if (gb && considerForAutoscaling(gb)) {
+ if (gb && considerForAutoscaling(gb) && (isStackBase(gb) || !isStackable(gb))) {
cntH++;
}
@@ -102,23 +114,37 @@ void JKQTPBarGraphBase::autoscaleBarWidthAndShift(double maxWidth, double shrink
for (size_t i=0; igetGraphCount(); i++) {
JKQTPPlotElement* g=parent->getGraph(i);
JKQTPBarGraphBase* gb=qobject_cast(g);
- if (gb && considerForAutoscaling(gb)) {
+ if (gb && considerForAutoscaling(gb) && (isStackBase(gb) || !isStackable(gb))) {
if (cntH>1) {
gb->width=widthH;
gb->shift=h-0.5;
h=h+dH;
} else {
+
gb->width=maxWidth;
gb->shift=0.0;
}
}
}
+ for (size_t i=0; igetGraphCount(); i++) {
+ JKQTPPlotElement* g=parent->getGraph(i);
+ JKQTPBarGraphStackInternalInterface* gbo=dynamic_cast(g);
+ JKQTPBarGraphBase* gb=qobject_cast(g);
+ if (gbo && gb) {
+ auto stackBottom=gbo->getBottomOfStack();
+ if (g!=stackBottom && stackBottom) {
+ gb->width=stackBottom->width;
+ gb->shift=stackBottom->shift;
+ }
+ }
+
+ }
}
}
void JKQTPBarGraphBase::autoscaleBarWidthAndShiftSeparatedGroups(double groupWidth) {
- autoscaleBarWidthAndShift(groupWidth, 1);
+ autoscaleBarWidthAndShift(groupWidth);
}
@@ -184,11 +210,21 @@ void JKQTPBarGraphBase::setDrawBaseline(bool __value)
m_drawBaseline=__value;
}
+void JKQTPBarGraphBase::setStackSeparation(double __value)
+{
+ m_stackSeparation=__value;
+}
+
bool JKQTPBarGraphBase::getDrawBaseline() const
{
return this->m_drawBaseline;
}
+double JKQTPBarGraphBase::getStackSeparation() const
+{
+ return m_stackSeparation;
+}
+
JKQTPGraphLineStyleMixin &JKQTPBarGraphBase::baselineStyle()
{
return m_baselineStyle;
diff --git a/lib/jkqtplotter/graphs/jkqtpbarchartbase.h b/lib/jkqtplotter/graphs/jkqtpbarchartbase.h
index c1e5290c69..cf22d94e09 100644
--- a/lib/jkqtplotter/graphs/jkqtpbarchartbase.h
+++ b/lib/jkqtplotter/graphs/jkqtpbarchartbase.h
@@ -223,6 +223,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarGraphBase: public JKQTPXYBaselineGraph, pub
bool usesCustomDrawFunctor() const;
/** \copydoc m_drawBaseline */
bool getDrawBaseline() const;
+ /** \copydoc m_stackSeparation */
+ double getStackSeparation() const;
/** \copydoc m_baselineStyle */
JKQTPGraphLineStyleMixin &baselineStyle();
/** \copydoc m_baselineStyle */
@@ -255,10 +257,31 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarGraphBase: public JKQTPXYBaselineGraph, pub
* \param shrinkFactor factor, by which the bar are shrinked compared to the available space
*
* \note This function will scale ALL graphs of the parent plot, which were derived from JKQTPBarHorizontalGraph, that match in orientation (as returned by isHorizontal() ).
+ *
+ * Using \c autoscaleBarWidthAndSHift(0.75,1.0) You can separate the different groups by soe distance, but the bars touch each other:
+ *
+ * \image html JKQTPBarVerticalAutoscaleMaxWidthOnly.png
+ *
+ * On the other hand, using the other extreme \c autoscaleBarWidthAndSHift(1.0,0.9) there is no grouping of the bars, but they have a slight distance between each other.
+ *
+ * \image html JKQTPBarVerticalAutoscaleShrinkOnly.png
+ *
+ * Finally the default parameters \c autoscaleBarWidthAndSHift(0.75,0.9) will lead to a separation of the bars AND a grouping:
+ *
+ * \image html JKQTPBarVerticalGraph.png
+ *
*/
- virtual void autoscaleBarWidthAndShift(double maxWidth=0.9, double shrinkFactor=0.8);
+ virtual void autoscaleBarWidthAndShift(double maxWidth=0.75, double shrinkFactor=0.9);
- /** \brief equivalent to \c autoscaleBarWidthAndShift(groupWidth,1);
+ /** \brief equivalent to \c autoscaleBarWidthAndShift(groupWidth,0.9);
+ *
+ * The default parameters \c autoscaleBarWidthAndShiftSeparatedGroups(0.75) will lead to a separation of the bars AND a grouping:
+ *
+ * \image html JKQTPBarVerticalGraph.png
+ *
+ * On the other hand, using \c autoscaleBarWidthAndShiftSeparatedGroups(1.0) there is no grouping of the bars, but they have a slight distance between each other.
+ *
+ * \image html JKQTPBarVerticalAutoscaleShrinkOnly.png
*/
void autoscaleBarWidthAndShiftSeparatedGroups(double groupWidth=0.75);
/** \copydoc shift */
@@ -268,6 +291,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarGraphBase: public JKQTPXYBaselineGraph, pub
/** \copydoc m_drawBaseline */
void setDrawBaseline(bool __value);
+ /** \copydoc m_stackSeparation */
+ void setStackSeparation(double __value);
/** \copydoc rectRadiusAtValue */
void setRectRadiusAtValue(double __value);
/** \copydoc rectRadiusAtBaseline */
@@ -302,13 +327,19 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarGraphBase: public JKQTPXYBaselineGraph, pub
/** \brief the width of the bargraphs, relative to the distance between the current and the next x-value
*
* See the following graphic to understand this concept:
- * \image html bargraph_basics.png
+ * \image html bargraph_basics_width.png
+ *
+ * \note this parameter can be combined with shift !
+ *
+ * \see setWidth(), getWidth(), setShift(), getShift(), shift, autoscaleBarWidthAndShift(), autoscaleBarWidthAndShiftSeparatedGroups()
*/
double width;
/** \brief the shift of the bargraphs, relative to the distance between the current and the next x-value
*
* See the following graphic to understand this concept:
* \image html bargraph_basics.png
+ *
+ * \see setShift(), getShift(), setWidth(), getWidth(), autoscaleBarWidthAndShift(), autoscaleBarWidthAndShiftSeparatedGroups()
*/
double shift;
/** \brief corner radius (in pt) for bars at the "value" end */
@@ -329,6 +360,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarGraphBase: public JKQTPXYBaselineGraph, pub
* \see baselineStyle() , setDrawBaseline() , m_baselineStyle
*/
bool m_drawBaseline;
+ /** \brief separation (in pt) between two bars in a stack of bars */
+ double m_stackSeparation;
/** \brief specifies how the area of the graph is filles
*
* \note If any fill style other than FillStyle::SingleFill is used, the peroperty m_lineColorDerivationModeForSpecialFill
@@ -411,7 +444,9 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarGraphBase: public JKQTPXYBaselineGraph, pub
virtual FillBrushFunctor constructFillBrushFunctor() const;
/** \brief this function is used by autoscaleBarWidthAndShift() to determine whether a given graph shall be taken into account when autoscaling.
- * Typically this returns \c true for all JKQTPBarGraphBase-derved objects with the same orientation (horizontal or vertical) */
+ * Typically this returns \c true for all JKQTPBarGraphBase-derived objects with the same orientation (horizontal or vertical). For stacked
+ * graphs it excludes everything except the bottom of the stack
+ */
virtual bool considerForAutoscaling( JKQTPBarGraphBase* other) const=0;
/** \brief used to generate stacked plots: returns the upper boundary of the parent plot in a stack, for the index-th datapoint */
@@ -434,7 +469,23 @@ class JKQTPLOTTER_LIB_EXPORT JKQTPBarGraphBase: public JKQTPXYBaselineGraph, pub
+/** \brief This is an interface-class for all stackable bargraphs ... it is used internally for autoscaling only
+ * \ingroup jkqtplotter_barcharts
+ *
+ * \c dynamic_cast 'ing to this indicates that a barchart is stackable.
+ *
+ *
+ */
+class JKQTPLOTTER_LIB_EXPORT JKQTPBarGraphStackInternalInterface {
+public:
+ inline virtual ~JKQTPBarGraphStackInternalInterface() {};
+protected:
+ /** \brief returns the barchart at the bottom of this stack (i.e. traverses the stack until there are no more parents */
+ virtual JKQTPBarGraphBase* getBottomOfStack()=0;
+
+ friend class JKQTPBarGraphBase;
+};
diff --git a/lib/jkqtplotter/graphs/jkqtpfinancial.cpp b/lib/jkqtplotter/graphs/jkqtpfinancial.cpp
index 412333fd5e..9c956a5b8c 100644
--- a/lib/jkqtplotter/graphs/jkqtpfinancial.cpp
+++ b/lib/jkqtplotter/graphs/jkqtpfinancial.cpp
@@ -31,7 +31,11 @@
+QSet JKQTPFinancialGraph::parentsAlreadySeen={};
+void JKQTPFinancialGraph::clearColorAssignStore() {
+ parentsAlreadySeen.clear();
+}
JKQTPFinancialGraph::JKQTPFinancialGraph(JKQTBasePlotter* parent):
@@ -45,24 +49,31 @@ JKQTPFinancialGraph::JKQTPFinancialGraph(JKQTBasePlotter* parent):
shift(0)
{
- m_fillStylePositive.initFillStyle(parent, parentPlotStyle, JKQTPPlotStyleType::Boxplot);
- m_fillStyleNegative.initFillStyleInvertedColor(&m_fillStylePositive);
+ //qDebug()<<"1: pos: "< parentsAlreadySeen;
- if (!parentsAlreadySeen.contains(parent)) {
+
+
+ if (parent && !parentsAlreadySeen.contains(parent)) {
// ensure, the first graph in a plot has default red/green colors
// further plots will have colors
- m_fillStylePositive.setFillColor(QColor("darkgreen"));
- m_fillStyleNegative.setFillColor(QColor("maroon"));
- m_lineStylePositive.setLineColor(QColor("darkgreen"));
- m_lineStyleNegative.setLineColor(QColor("maroon"));
+ //qDebug()<<"FIRST!"<getCurrentPlotterStyle().graphsStyle.financialStyle.positiveDefaultColor);
+ m_fillStyleNegative.setFillColor(parent->getCurrentPlotterStyle().graphsStyle.financialStyle.negativeDefaultColor);
+ m_lineStylePositive.setLineColor(parent->getCurrentPlotterStyle().graphsStyle.financialStyle.positiveDefaultColor);
+ m_lineStyleNegative.setLineColor(parent->getCurrentPlotterStyle().graphsStyle.financialStyle.negativeDefaultColor);
}
parentsAlreadySeen.insert(parent);
+ //qDebug()<<"3: pos: "< parentsAlreadySeen;
/** \brief type of the financial graph (OHLC or candle-stick)
*
* \see setGraphType(), getGraphType(), FinancialGraphType
diff --git a/lib/jkqtplotter/jkqtpgraphsbase.cpp b/lib/jkqtplotter/jkqtpgraphsbase.cpp
index c15294ec77..5893c50834 100644
--- a/lib/jkqtplotter/jkqtpgraphsbase.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsbase.cpp
@@ -1392,7 +1392,7 @@ void JKQTPXGraph::intSortData()
if (parent==nullptr) return ;
- if (sortData==JKQTPXYLineGraph::Unsorted) return ;
+ if (sortData==JKQTPXGraph::Unsorted) return ;
JKQTPDatastore* datastore=parent->getDatastore();
int imin=0;
diff --git a/lib/jkqtplotter/jkqtpgraphsbasestyle.cpp b/lib/jkqtplotter/jkqtpgraphsbasestyle.cpp
index a2b1439911..692a1ad469 100644
--- a/lib/jkqtplotter/jkqtpgraphsbasestyle.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsbasestyle.cpp
@@ -35,6 +35,14 @@ void JKQTGraphsSpecificStyleProperties::modifyForDefaultStyle(JKQTPPlotStyleType
switch(type) {
case JKQTPPlotStyleType::Default:
break;
+ case JKQTPPlotStyleType::FinancialNegative:
+ defaultLineWidth=1;
+ fillColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMSameColor;
+ break;
+ case JKQTPPlotStyleType::FinancialPositive:
+ defaultLineWidth=1;
+ fillColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMSameColor;
+ break;
case JKQTPPlotStyleType::Filled:
fillColorDerivationMode=JKQTPColorDerivationMode::JKQTPFFCMLighterAndTransparentColor;
break;
@@ -95,6 +103,7 @@ void JKQTGraphsSpecificStyleProperties::saveSettings(QSettings &settings, const
settings.setValue(group+"error_color_mode", JKQTPColorDerivationMode2String(errorColorDerivationMode));
settings.setValue(group+"error_fill_color_mode", JKQTPColorDerivationMode2String(errorFillColorDerivationMode));
settings.setValue(group+"symbol_fill_color_mode", JKQTPColorDerivationMode2String(symbolFillColorDerivationMode));
+
}
@@ -204,6 +213,7 @@ JKQTGraphsBaseStyle::JKQTGraphsBaseStyle(const JKQTBasePlotterStyle& parent):
impulseStyle(parent),
geometricStyle(parent),
annotationStyle(parent),
+ financialStyle(parent),
defaultPalette(JKQTPMathImageColorPalette::JKQTPMathImageMATLAB),
defaultGraphColors(getDefaultGraphColors()),
defaultGraphPenStyles(getDefaultGraphPenStyles()),
@@ -334,6 +344,7 @@ void JKQTGraphsBaseStyle::loadSettings(const QSettings &settings, const QString
impulseStyle.loadSettings(settings, group+"graphs_impulses/", JKQTImpulseSpecificStyleProperties(parent, defaultGraphStyle));
geometricStyle.loadSettings(settings, group+"graphs_geometric/", JKQTGeometricSpecificStyleProperties(parent, defaultGraphStyle));
annotationStyle.loadSettings(settings, group+"graphs_annotation/", JKQTAnnotationsSpecificStyleProperties(parent, defaultGraphStyle));
+ financialStyle.loadSettings(settings, group+"graphs_financial/", JKQTFinancialSpecificStyleProperties(parent, defaultGraphStyle));
}
@@ -410,6 +421,7 @@ void JKQTGraphsBaseStyle::saveSettings(QSettings &settings, const QString &group
impulseStyle.saveSettings(settings, group+"graphs_impulses/");
geometricStyle.saveSettings(settings, group+"graphs_geometric/");
annotationStyle.saveSettings(settings, group+"graphs_annotation/");
+ financialStyle.saveSettings(settings, group+"graphs_financial/");
}
const JKQTGraphsSpecificStyleProperties &JKQTGraphsBaseStyle::getGraphStyleByType(JKQTPPlotStyleType type) const
@@ -429,6 +441,9 @@ const JKQTGraphsSpecificStyleProperties &JKQTGraphsBaseStyle::getGraphStyleByTyp
return geometricStyle;
case JKQTPPlotStyleType::Annotation:
return annotationStyle;
+ case JKQTPPlotStyleType::FinancialNegative:
+ case JKQTPPlotStyleType::FinancialPositive:
+ return financialStyle;
}
return defaultGraphStyle;
}
@@ -439,7 +454,8 @@ JKQTBarchartSpecificStyleProperties::JKQTBarchartSpecificStyleProperties(const J
JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Barchart, parent),
defaultRectRadiusAtValue(0),
defaultRectRadiusAtBaseline(0),
- drawBaseline(false)
+ drawBaseline(false),
+ stackSeparation(1)
{
}
@@ -448,7 +464,8 @@ JKQTBarchartSpecificStyleProperties::JKQTBarchartSpecificStyleProperties(const J
JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Barchart, other),
defaultRectRadiusAtValue(0),
defaultRectRadiusAtBaseline(0),
- drawBaseline(false)
+ drawBaseline(false),
+ stackSeparation(1)
{
}
@@ -459,6 +476,7 @@ void JKQTBarchartSpecificStyleProperties::loadSettings(const QSettings &settings
defaultRectRadiusAtValue=settings.value(group+"radius_at_value", defaultStyle.defaultRectRadiusAtValue).toDouble();
defaultRectRadiusAtBaseline=settings.value(group+"radius_at_baseline", defaultStyle.defaultRectRadiusAtBaseline).toDouble();
drawBaseline=settings.value(group+"draw_baseline", defaultStyle.drawBaseline).toBool();
+ stackSeparation=settings.value(group+"stack_separation", defaultStyle.stackSeparation).toDouble();
}
void JKQTBarchartSpecificStyleProperties::saveSettings(QSettings &settings, const QString &group) const
@@ -467,7 +485,7 @@ void JKQTBarchartSpecificStyleProperties::saveSettings(QSettings &settings, cons
settings.setValue(group+"radius_at_value", defaultRectRadiusAtValue);
settings.setValue(group+"radius_at_baseline", defaultRectRadiusAtBaseline);
settings.setValue(group+"draw_baseline", drawBaseline);
-
+ settings.setValue(group+"stack_separation", stackSeparation);
}
@@ -499,6 +517,48 @@ void JKQTImpulseSpecificStyleProperties::saveSettings(QSettings &settings, const
}
+JKQTFinancialSpecificStyleProperties::JKQTFinancialSpecificStyleProperties(const JKQTBasePlotterStyle &parent):
+ JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Default, parent),
+ positiveDefaultColor("darkgreen"),
+ negativeDefaultColor("maroon"),
+ negativeGraphColorDerivationMode(JKQTPColorDerivationMode::JKQTPFFCMInvertedColor),
+ positiveFillStyle(Qt::SolidPattern),
+ negativeFillStyle(Qt::SolidPattern)
+{
+ defaultLineWidth=1;
+}
+
+JKQTFinancialSpecificStyleProperties::JKQTFinancialSpecificStyleProperties(const JKQTBasePlotterStyle &parent, const JKQTGraphsSpecificStyleProperties &other):
+ JKQTGraphsSpecificStyleProperties(JKQTPPlotStyleType::Default, parent),
+ positiveDefaultColor("darkgreen"),
+ negativeDefaultColor("maroon"),
+ negativeGraphColorDerivationMode(JKQTPColorDerivationMode::JKQTPFFCMInvertedColor),
+ positiveFillStyle(Qt::SolidPattern),
+ negativeFillStyle(Qt::SolidPattern)
+{
+ defaultLineWidth=1;
+}
+
+void JKQTFinancialSpecificStyleProperties::loadSettings(const QSettings &settings, const QString &group, const JKQTFinancialSpecificStyleProperties &defaultStyle)
+{
+ JKQTGraphsSpecificStyleProperties::loadSettings(settings, group, defaultStyle);
+ positiveDefaultColor=jkqtp_String2QColor(settings.value(group+"default_positive_color", jkqtp_QColor2String(positiveDefaultColor)).toString());
+ negativeDefaultColor=jkqtp_String2QColor(settings.value(group+"default_negative_color", jkqtp_QColor2String(negativeDefaultColor)).toString());
+ positiveFillStyle=JKQTFillStyleSummmary::fromString(settings.value(group+"positive_fill_style", positiveFillStyle.toCSSString()).toString());
+ negativeFillStyle=JKQTFillStyleSummmary::fromString(settings.value(group+"negative_fill_style", negativeFillStyle.toCSSString()).toString());
+ negativeGraphColorDerivationMode=String2JKQTPColorDerivationMode(settings.value(group+"negative_graph_color_mode", JKQTPColorDerivationMode2String(defaultStyle.negativeGraphColorDerivationMode)).toString());
+}
+
+void JKQTFinancialSpecificStyleProperties::saveSettings(QSettings &settings, const QString &group) const
+{
+ JKQTGraphsSpecificStyleProperties::saveSettings(settings, group);
+ settings.setValue(group+"default_positive_color", jkqtp_QColor2String(positiveDefaultColor));
+ settings.setValue(group+"default_negative_color", jkqtp_QColor2String(negativeDefaultColor));
+ settings.setValue(group+"positive_fill_style", positiveFillStyle.toCSSString());
+ settings.setValue(group+"negative_fill_style", negativeFillStyle.toCSSString());
+ settings.setValue(group+"negative_graph_color_mode", JKQTPColorDerivationMode2String(negativeGraphColorDerivationMode));
+}
+
JKQTFillStyleSummmary::JKQTFillStyleSummmary(Qt::BrushStyle style, const QGradient& grad):
brushStyle(style), gradient(grad)
@@ -532,3 +592,4 @@ QString JKQTFillStyleSummmary::toCSSString() const
{
return jkqtp_QBrushStyle2String(brushStyle);
}
+
diff --git a/lib/jkqtplotter/jkqtpgraphsbasestyle.h b/lib/jkqtplotter/jkqtpgraphsbasestyle.h
index 721e14c4f7..ab5e7db308 100644
--- a/lib/jkqtplotter/jkqtpgraphsbasestyle.h
+++ b/lib/jkqtplotter/jkqtpgraphsbasestyle.h
@@ -273,6 +273,8 @@ public:
double defaultRectRadiusAtBaseline;
/** \brief indicates whether to draw a baseline (style is derived from axis style) */
bool drawBaseline;
+ /** \brief separation between consecutive pars in a stack of bars [in pt] */
+ double stackSeparation;
};
@@ -286,7 +288,7 @@ public:
*/
class JKQTPLOTTER_LIB_EXPORT JKQTImpulseSpecificStyleProperties: public JKQTGraphsSpecificStyleProperties {
#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
- Q_GADGET
+ Q_GADGET
#endif
public:
explicit JKQTImpulseSpecificStyleProperties(const JKQTBasePlotterStyle& parent);
@@ -321,6 +323,61 @@ public:
+/** \brief Support Class for JKQTBasePlotter, which summarizes all properties that define the visual styling of impulse/stick graph elements
+* \ingroup jkqtpplotter_styling_classes
+*
+* \see JKQTBasePlotter, \ref jkqtpplotter_styling
+*/
+class JKQTPLOTTER_LIB_EXPORT JKQTFinancialSpecificStyleProperties: public JKQTGraphsSpecificStyleProperties {
+#ifndef JKQTPLOTTER_WORKAROUND_QGADGET_BUG
+ Q_GADGET
+#endif
+public:
+ explicit JKQTFinancialSpecificStyleProperties(const JKQTBasePlotterStyle& parent);
+ JKQTFinancialSpecificStyleProperties(const JKQTBasePlotterStyle& parent, const JKQTGraphsSpecificStyleProperties& other);
+ JKQTFinancialSpecificStyleProperties(const JKQTFinancialSpecificStyleProperties& other)=default;
+ JKQTFinancialSpecificStyleProperties(JKQTFinancialSpecificStyleProperties&& other)=default;
+ JKQTFinancialSpecificStyleProperties& operator=(const JKQTFinancialSpecificStyleProperties& other)=default;
+ JKQTFinancialSpecificStyleProperties& operator=(JKQTFinancialSpecificStyleProperties&& other)=default;
+
+
+ /** \brief loads the plot properties from a QSettings object
+ *
+ * \param settings QSettings-object to read from
+ * \param group Group in the QSettings-object to read from
+ * \param defaultStyle If a setting cannot be found in \a settings, default values are taken from this object
+ * By default, this is a default-constructed object
+ */
+ void loadSettings(const QSettings &settings, const QString& group, const JKQTFinancialSpecificStyleProperties &defaultStyle);
+
+ /** \brief saves the plot properties into a QSettings object.
+ *
+ * \param settings QSettings-object to save to
+ * \param group Group in the QSettings-object to save to
+ */
+ void saveSettings(QSettings& settings, const QString& group) const;
+
+ /** \brief default color to use for the (first) financial graph, positive elements */
+ QColor positiveDefaultColor;
+ /** \brief default color to use for the (first) financial graph, negative elements */
+ QColor negativeDefaultColor;
+ /** \brief defines how to derive the basic graph color for negative elements in a new graph from the color selected from JKQTGraphsBaseStyle::defaultGraphColors
+ *
+ * This property is usually JKQTPFFCMSameColor, but can be changed to allow to e.g. fill
+ * barcharts always with a lighter color than the full color ...
+ */
+ JKQTPColorDerivationMode negativeGraphColorDerivationMode;
+ /** \brief graph fill style used for positive element */
+ JKQTFillStyleSummmary positiveFillStyle;
+ /** \brief graph fill style used for negative element */
+ JKQTFillStyleSummmary negativeFillStyle;
+
+
+
+};
+
+
+
/** \brief Support Class for JKQTBasePlotter, which summarizes all properties that define the visual styling of a JKQTBasePlotter
* \ingroup jkqtpplotter_styling_classes
*
@@ -374,6 +431,8 @@ class JKQTPLOTTER_LIB_EXPORT JKQTGraphsBaseStyle {
JKQTGeometricSpecificStyleProperties geometricStyle;
/** \brief styling options for annotation elements */
JKQTAnnotationsSpecificStyleProperties annotationStyle;
+ /** \brief styling options for financial elements */
+ JKQTFinancialSpecificStyleProperties financialStyle;
/** \brief returns defaultGraphStyle, barchartStyle, ..., depending on the value of \a type */
const JKQTGraphsSpecificStyleProperties& getGraphStyleByType(JKQTPPlotStyleType type) const;
diff --git a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp
index 7b7f74d753..ff4ed3165c 100644
--- a/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp
+++ b/lib/jkqtplotter/jkqtpgraphsbasestylingmixins.cpp
@@ -43,6 +43,22 @@ void JKQTPGraphLineStyleMixin::initLineStyle(JKQTBasePlotter* parent, int &paren
m_lineWidth=m_linePen.widthF();
m_highlightingLineColor=getLineColor();
m_highlightingLineColor.setAlphaF(0.5);
+ } else if (styletype==JKQTPPlotStyleType::FinancialPositive) {
+ if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
+ const JKQTBasePlotter::JKQTPPen pen=parent->getPlotStyle(parentPlotStyle, styletype);
+ m_linePen.setColor(pen.color());
+ m_linePen.setStyle(Qt::SolidLine);
+ m_lineWidth=pen.widthF();
+ m_highlightingLineColor=getLineColor();
+ m_highlightingLineColor.setAlphaF(0.5);
+ } else if (styletype==JKQTPPlotStyleType::FinancialNegative) {
+ if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
+ const JKQTBasePlotter::JKQTPPen pen=parent->getPlotStyle(parentPlotStyle, styletype);
+ m_linePen.setColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphsStyle.financialStyle.negativeGraphColorDerivationMode, pen.color()));
+ m_linePen.setStyle(Qt::SolidLine);
+ m_lineWidth=pen.widthF();
+ m_highlightingLineColor=getLineColor();
+ m_highlightingLineColor.setAlphaF(0.5);
} else {
if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
const JKQTBasePlotter::JKQTPPen pen=parent->getPlotStyle(parentPlotStyle, styletype);
@@ -428,6 +444,16 @@ void JKQTPGraphFillStyleMixin::initFillStyle(JKQTBasePlotter *parent, int &paren
if (styletype==JKQTPPlotStyleType::Annotation) {
m_fillColor=JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphsStyle.annotationStyle.fillColorDerivationMode, parent->getCurrentPlotterStyle().graphsStyle.annotationStyle.defaultColor);
m_fillBrush=parent->getCurrentPlotterStyle().graphsStyle.annotationStyle.defaultFillStyle.brush(m_fillColor);
+ } else if (styletype==JKQTPPlotStyleType::FinancialPositive) {
+ if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
+ const JKQTBasePlotter::JKQTPPen pen=parent->getPlotStyle(parentPlotStyle, styletype);
+ m_fillColor=pen.color();
+ m_fillBrush=parent->getCurrentPlotterStyle().graphsStyle.financialStyle.positiveFillStyle.brush(m_fillColor);
+ } else if (styletype==JKQTPPlotStyleType::FinancialNegative) {
+ if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
+ const JKQTBasePlotter::JKQTPPen pen=parent->getPlotStyle(parentPlotStyle, styletype);
+ m_fillColor=JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphsStyle.financialStyle.negativeGraphColorDerivationMode, pen.color());
+ m_fillBrush=parent->getCurrentPlotterStyle().graphsStyle.financialStyle.negativeFillStyle.brush(m_fillColor);
} else {
if (parentPlotStyle<0) parentPlotStyle=parent->getNextStyle();
const JKQTBasePlotter::JKQTPPen pen=parent->getPlotStyle(parentPlotStyle, styletype);
diff --git a/lib/jkqtplotter/jkqtptools.h b/lib/jkqtplotter/jkqtptools.h
index 8b6cd47ca2..9964ef0ae5 100644
--- a/lib/jkqtplotter/jkqtptools.h
+++ b/lib/jkqtplotter/jkqtptools.h
@@ -73,6 +73,8 @@ enum class JKQTPPlotStyleType {
Impulses, /*!< impulse-type graphs */
Geometric, /*!< geometric elements (e.g. rectangles, circles, lines, ...) */
Annotation, /*!< annotation elements */
+ FinancialPositive, /*!< financial positive elements */
+ FinancialNegative, /*!< financial negative elements */
};
/** \brief Styles in which to mark single positions during user actions in JKQTPlotter
diff --git a/lib/jkqtplotter/resources/styles/.gitignore b/lib/jkqtplotter/resources/styles/.gitignore
new file mode 100644
index 0000000000..b44ef384e2
--- /dev/null
+++ b/lib/jkqtplotter/resources/styles/.gitignore
@@ -0,0 +1 @@
+/*.png
diff --git a/lib/jkqtplotter/resources/styles/blackandwhite.ini b/lib/jkqtplotter/resources/styles/blackandwhite.ini
index 323314e138..6e7cbbe8c7 100644
--- a/lib/jkqtplotter/resources/styles/blackandwhite.ini
+++ b/lib/jkqtplotter/resources/styles/blackandwhite.ini
@@ -74,3 +74,9 @@ graphs\auto_styles\fill_style3=ver
graphs\auto_styles\fill_style4=hor
graphs\auto_styles\fill_style5=cross
graphs\auto_styles\fill_style6=diagcross
+graphs\graphs_barchart\stack_separation=0
+graphs\graphs_financial\default_positive_color=grey50
+graphs\graphs_financial\default_negative_color=black
+graphs\graphs_financial\positive_fill_style=none
+graphs\graphs_financial\negative_fill_style=solid
+graphs\graphs_financial\negative_graph_color_mode=lighter
diff --git a/lib/jkqtplotter/resources/styles/blueprint.ini b/lib/jkqtplotter/resources/styles/blueprint.ini
index 77781a3f4f..faf841a807 100644
--- a/lib/jkqtplotter/resources/styles/blueprint.ini
+++ b/lib/jkqtplotter/resources/styles/blueprint.ini
@@ -66,3 +66,5 @@ graphs\auto_styles\color3="#E6EE9C"
graphs\auto_styles\color4="#FFB74D"
graphs\auto_styles\color5="#CE93D8"
graphs\graphs_base\symbol_fill_color_mode=lighter_color(130)
+graphs\graphs_financial\default_positive_color=limegreen
+graphs\graphs_financial\default_negative_color=red
\ No newline at end of file
diff --git a/lib/jkqtplotter/resources/styles/cyberpunk.ini b/lib/jkqtplotter/resources/styles/cyberpunk.ini
index 8e739503a3..3940e10a15 100644
--- a/lib/jkqtplotter/resources/styles/cyberpunk.ini
+++ b/lib/jkqtplotter/resources/styles/cyberpunk.ini
@@ -71,4 +71,6 @@ graphs\graphs_annotation\text_color=white
graphs\graphs_base\fill_color_mode="same_color,more_transparent(0.5)"
graphs\graphs_filled\fill_color_mode="same_color,more_transparent(0.33)"
graphs\graphs_boxplot\fill_color_mode="lighter,more_transparent(0.5)"
-
+graphs\graphs_barchart\stack_separation=0
+graphs\graphs_financial\default_positive_color=limegreen
+graphs\graphs_financial\default_negative_color=red
\ No newline at end of file
diff --git a/lib/jkqtplotter/resources/styles/dark.ini b/lib/jkqtplotter/resources/styles/dark.ini
index b96e22de69..6c63f4ee24 100644
--- a/lib/jkqtplotter/resources/styles/dark.ini
+++ b/lib/jkqtplotter/resources/styles/dark.ini
@@ -72,4 +72,5 @@ graphs\graphs_annotation\text_color=white
graphs\graphs_base\fill_color_mode="same_color,more_transparent(0.5)"
graphs\graphs_filled\fill_color_mode="same_color,more_transparent(0.33)"
graphs\graphs_boxplot\fill_color_mode="lighter,more_transparent(0.5)"
-
+graphs\graphs_financial\default_positive_color=limegreen
+graphs\graphs_financial\default_negative_color=red
diff --git a/lib/jkqtplotter/resources/styles/default.ini b/lib/jkqtplotter/resources/styles/default.ini
index c08d5c1f0e..b753fa88e3 100644
--- a/lib/jkqtplotter/resources/styles/default.ini
+++ b/lib/jkqtplotter/resources/styles/default.ini
@@ -308,6 +308,7 @@ graphs\graphs_barchart\symbol_fill_color_mode=lighter
graphs\graphs_barchart\radius_at_value=0
graphs\graphs_barchart\radius_at_baseline=0
graphs\graphs_barchart\draw_baseline=false
+graphs\graphs_barchart\stack_separation=1
graphs\graphs_boxplot\linewidth=1
graphs\graphs_boxplot\symbol_size=10
graphs\graphs_boxplot\symbol_line_width=1
@@ -380,3 +381,20 @@ graphs\graphs_annotation\fill_style=solid
graphs\graphs_annotation\text_color=black
graphs\graphs_annotation\font_size=12
graphs\graphs_annotation\font_name=GUI+FIRA
+graphs\graphs_financial\linewidth=2
+graphs\graphs_financial\symbol_size=10
+graphs\graphs_financial\symbol_line_width=1
+graphs\graphs_financial\error_indicator_width=1
+graphs\graphs_financial\head_decorator_size_factor=8
+graphs\graphs_financial\head_decorator_type=filled_arrow
+graphs\graphs_financial\error_fill_style=solid
+graphs\graphs_financial\graph_color_mode=same
+graphs\graphs_financial\fill_color_mode=lighter
+graphs\graphs_financial\error_color_mode=darker
+graphs\graphs_financial\error_fill_color_mode=lighter_transparent
+graphs\graphs_financial\symbol_fill_color_mode=lighter
+graphs\graphs_financial\default_positive_color=darkgreen
+graphs\graphs_financial\default_negative_color=maroon
+graphs\graphs_financial\positive_fill_style=solid
+graphs\graphs_financial\negative_fill_style=solid
+graphs\graphs_financial\negative_graph_color_mode=inverted
diff --git a/lib/jkqtplotter/resources/styles/legacy_default_style.ini b/lib/jkqtplotter/resources/styles/legacy_default_style.ini
index 34213ab4a5..a8945da460 100644
--- a/lib/jkqtplotter/resources/styles/legacy_default_style.ini
+++ b/lib/jkqtplotter/resources/styles/legacy_default_style.ini
@@ -414,3 +414,4 @@ graphs\graphs_annotation\fill_style=solid
graphs\graphs_annotation\text_color=black
graphs\graphs_annotation\font_size=12
graphs\graphs_annotation\font_name=GUI
+graphs\graphs_barchart\stack_separation=0
\ No newline at end of file
diff --git a/lib/jkqtplotter/resources/styles/seaborn.ini b/lib/jkqtplotter/resources/styles/seaborn.ini
index c6b111b86f..04846c151c 100644
--- a/lib/jkqtplotter/resources/styles/seaborn.ini
+++ b/lib/jkqtplotter/resources/styles/seaborn.ini
@@ -315,7 +315,8 @@ graphs\graphs_base\fill_color_mode=lighter_transparent
graphs\graphs_base\error_color_mode=same
graphs\graphs_base\error_fill_color_mode=lighter_transparent
graphs\graphs_base\symbol_fill_color_mode=same
-graphs\graphs_barchart\linewidth=1
+graphs\graphs_barchart\linewidth=0
+graphs\graphs_barchart\stack_separation=1
graphs\graphs_barchart\symbol_size=10
graphs\graphs_barchart\symbol_line_width=1
graphs\graphs_barchart\error_indicator_width=1
@@ -398,3 +399,5 @@ graphs\graphs_annotation\fill_style=solid
graphs\graphs_annotation\text_color=black
graphs\graphs_annotation\font_size=12
graphs\graphs_annotation\font_name=GUI
+graphs\graphs_financial\default_positive_color=seagreen
+graphs\graphs_financial\default_negative_color=maroon
diff --git a/screenshots/barchart.png b/screenshots/barchart.png
index b74ba5f697..f7765555b3 100644
Binary files a/screenshots/barchart.png and b/screenshots/barchart.png differ
diff --git a/screenshots/barchart_hor.png b/screenshots/barchart_hor.png
index 977d816c3e..b43bc4c42d 100644
Binary files a/screenshots/barchart_hor.png and b/screenshots/barchart_hor.png differ
diff --git a/screenshots/barchart_hor_small.png b/screenshots/barchart_hor_small.png
index f640fc7284..6f003e9cf5 100644
Binary files a/screenshots/barchart_hor_small.png and b/screenshots/barchart_hor_small.png differ
diff --git a/screenshots/barchart_small.png b/screenshots/barchart_small.png
index d87783ff08..5e76c3629c 100644
Binary files a/screenshots/barchart_small.png and b/screenshots/barchart_small.png differ
diff --git a/screenshots/datastore.png b/screenshots/datastore.png
index 6103759e5b..46bee70337 100644
Binary files a/screenshots/datastore.png and b/screenshots/datastore.png differ
diff --git a/screenshots/datastore_calccolumns.png b/screenshots/datastore_calccolumns.png
index 6e98b25c4d..db2235dcc3 100644
Binary files a/screenshots/datastore_calccolumns.png and b/screenshots/datastore_calccolumns.png differ
diff --git a/screenshots/datastore_regression.png b/screenshots/datastore_regression.png
index 1a8232cae3..23d7956588 100644
Binary files a/screenshots/datastore_regression.png and b/screenshots/datastore_regression.png differ
diff --git a/screenshots/datastore_regression_linrobust.png b/screenshots/datastore_regression_linrobust.png
index a39dab316c..4398a7e74b 100644
Binary files a/screenshots/datastore_regression_linrobust.png and b/screenshots/datastore_regression_linrobust.png differ
diff --git a/screenshots/datastore_regression_linrobust_p.png b/screenshots/datastore_regression_linrobust_p.png
index 66564546fb..103052f80a 100644
Binary files a/screenshots/datastore_regression_linrobust_p.png and b/screenshots/datastore_regression_linrobust_p.png differ
diff --git a/screenshots/datastore_regression_nonlinreg_pow.png b/screenshots/datastore_regression_nonlinreg_pow.png
index 200b9a5275..cdbf6eabca 100644
Binary files a/screenshots/datastore_regression_nonlinreg_pow.png and b/screenshots/datastore_regression_nonlinreg_pow.png differ
diff --git a/screenshots/datastore_regression_polynom.png b/screenshots/datastore_regression_polynom.png
index bd4faa7129..5be496c363 100644
Binary files a/screenshots/datastore_regression_polynom.png and b/screenshots/datastore_regression_polynom.png differ
diff --git a/screenshots/datastore_regression_polynom_errros.png b/screenshots/datastore_regression_polynom_errros.png
index 0c585d1ec8..a1b6e04724 100644
Binary files a/screenshots/datastore_regression_polynom_errros.png and b/screenshots/datastore_regression_polynom_errros.png differ
diff --git a/screenshots/datastore_regression_small.png b/screenshots/datastore_regression_small.png
index f23a54b24a..9edf4d586e 100644
Binary files a/screenshots/datastore_regression_small.png and b/screenshots/datastore_regression_small.png differ
diff --git a/screenshots/datastore_small.png b/screenshots/datastore_small.png
index 64c9e73ee3..6f63da3bac 100644
Binary files a/screenshots/datastore_small.png and b/screenshots/datastore_small.png differ
diff --git a/screenshots/datastore_statistics.png b/screenshots/datastore_statistics.png
index 51ee3e5ed8..55d118a8b2 100644
Binary files a/screenshots/datastore_statistics.png and b/screenshots/datastore_statistics.png differ
diff --git a/screenshots/datastore_statistics_hist.png b/screenshots/datastore_statistics_hist.png
index a6f83de32f..0c0f7bf2ae 100644
Binary files a/screenshots/datastore_statistics_hist.png and b/screenshots/datastore_statistics_hist.png differ
diff --git a/screenshots/datastore_statistics_kde.png b/screenshots/datastore_statistics_kde.png
index b7a6b79ded..20cf3dcf1c 100644
Binary files a/screenshots/datastore_statistics_kde.png and b/screenshots/datastore_statistics_kde.png differ
diff --git a/screenshots/datastore_statistics_small.png b/screenshots/datastore_statistics_small.png
index ef5ae3db78..f59bd1c066 100644
Binary files a/screenshots/datastore_statistics_small.png and b/screenshots/datastore_statistics_small.png differ
diff --git a/screenshots/errorbarstyles.png b/screenshots/errorbarstyles.png
index 77b6a8b74c..1f9e774caa 100644
Binary files a/screenshots/errorbarstyles.png and b/screenshots/errorbarstyles.png differ
diff --git a/screenshots/errorbarstyles_small.png b/screenshots/errorbarstyles_small.png
index cb0dfc99cc..e3701133ec 100644
Binary files a/screenshots/errorbarstyles_small.png and b/screenshots/errorbarstyles_small.png differ
diff --git a/screenshots/functionplot.png b/screenshots/functionplot.png
index 7b7df95e4c..36d703ef59 100644
Binary files a/screenshots/functionplot.png and b/screenshots/functionplot.png differ
diff --git a/screenshots/functionplot_fy.png b/screenshots/functionplot_fy.png
index f1af7944e2..702f549023 100644
Binary files a/screenshots/functionplot_fy.png and b/screenshots/functionplot_fy.png differ
diff --git a/screenshots/functionplot_fy_small.png b/screenshots/functionplot_fy_small.png
index a4c4e01873..c97c588340 100644
Binary files a/screenshots/functionplot_fy_small.png and b/screenshots/functionplot_fy_small.png differ
diff --git a/screenshots/functionplot_small.png b/screenshots/functionplot_small.png
index 2023b9094d..feb3e9d4a7 100644
Binary files a/screenshots/functionplot_small.png and b/screenshots/functionplot_small.png differ
diff --git a/screenshots/logaxes.png b/screenshots/logaxes.png
index 01a298af4e..5de912e606 100644
Binary files a/screenshots/logaxes.png and b/screenshots/logaxes.png differ
diff --git a/screenshots/logaxes_nolog.png b/screenshots/logaxes_nolog.png
index ce86eac371..4bec448ecf 100644
Binary files a/screenshots/logaxes_nolog.png and b/screenshots/logaxes_nolog.png differ
diff --git a/screenshots/logaxes_nominorgrid.png b/screenshots/logaxes_nominorgrid.png
index cda183b6ae..6f8abd3fab 100644
Binary files a/screenshots/logaxes_nominorgrid.png and b/screenshots/logaxes_nominorgrid.png differ
diff --git a/screenshots/logaxes_small.png b/screenshots/logaxes_small.png
index be1189866a..e877a40fb9 100644
Binary files a/screenshots/logaxes_small.png and b/screenshots/logaxes_small.png differ
diff --git a/screenshots/multithreaded.png b/screenshots/multithreaded.png
index 28c86e8fb0..96aeb9f607 100644
Binary files a/screenshots/multithreaded.png and b/screenshots/multithreaded.png differ
diff --git a/screenshots/multithreaded_small.png b/screenshots/multithreaded_small.png
index 4cd49259a7..e6fbb64f46 100644
Binary files a/screenshots/multithreaded_small.png and b/screenshots/multithreaded_small.png differ
diff --git a/screenshots/second_axis.png b/screenshots/second_axis.png
index 725fc90bac..a006f8cbbd 100644
Binary files a/screenshots/second_axis.png and b/screenshots/second_axis.png differ
diff --git a/screenshots/second_axis_hor.png b/screenshots/second_axis_hor.png
index 720adfab6a..f3fedf9ce2 100644
Binary files a/screenshots/second_axis_hor.png and b/screenshots/second_axis_hor.png differ
diff --git a/screenshots/second_axis_hor_small.png b/screenshots/second_axis_hor_small.png
index 1de12c09c0..383f3cb778 100644
Binary files a/screenshots/second_axis_hor_small.png and b/screenshots/second_axis_hor_small.png differ
diff --git a/screenshots/second_axis_small.png b/screenshots/second_axis_small.png
index 6d0e223f8d..88b1dbe706 100644
Binary files a/screenshots/second_axis_small.png and b/screenshots/second_axis_small.png differ
diff --git a/screenshots/stackedbars.png b/screenshots/stackedbars.png
index 204d2db02f..5b50f3e0b4 100644
Binary files a/screenshots/stackedbars.png and b/screenshots/stackedbars.png differ
diff --git a/screenshots/stackedbars_hor.png b/screenshots/stackedbars_hor.png
index ebd885657e..56b24ba544 100644
Binary files a/screenshots/stackedbars_hor.png and b/screenshots/stackedbars_hor.png differ
diff --git a/screenshots/stackedbars_hor_small.png b/screenshots/stackedbars_hor_small.png
index 82c547a37e..c516c0e96d 100644
Binary files a/screenshots/stackedbars_hor_small.png and b/screenshots/stackedbars_hor_small.png differ
diff --git a/screenshots/stackedbars_small.png b/screenshots/stackedbars_small.png
index fd11650146..53ebd67574 100644
Binary files a/screenshots/stackedbars_small.png and b/screenshots/stackedbars_small.png differ
diff --git a/screenshots/stepplots.png b/screenshots/stepplots.png
index 1701e3d50f..fb3740320c 100644
Binary files a/screenshots/stepplots.png and b/screenshots/stepplots.png differ
diff --git a/screenshots/stepplots_small.png b/screenshots/stepplots_small.png
index d7733f7269..b9df8dd559 100644
Binary files a/screenshots/stepplots_small.png and b/screenshots/stepplots_small.png differ
diff --git a/screenshots/symbols_and_styles.png b/screenshots/symbols_and_styles.png
index 1679bfbfd1..3df50ca3d6 100644
Binary files a/screenshots/symbols_and_styles.png and b/screenshots/symbols_and_styles.png differ
diff --git a/screenshots/symbols_and_styles_small.png b/screenshots/symbols_and_styles_small.png
index ed58fd428e..1be0fb9f7f 100644
Binary files a/screenshots/symbols_and_styles_small.png and b/screenshots/symbols_and_styles_small.png differ