diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
index 3a6d6c8f80..9e67a1c7d3 100644
--- a/doc/CMakeLists.txt
+++ b/doc/CMakeLists.txt
@@ -69,6 +69,7 @@ if(JKQtPlotter_BUILD_EXAMPLES)
# custom target that generates the images for the JKQTMathText documentation
set(JKQTPlotter_GenerateDocScreenshots_DefaultOptions --screenshotdir="${CMAKE_CURRENT_LIST_DIR}/../screenshots/" --screenshot --smallscreenshotplot)
set(JKQTPlotter_GenerateDocScreenshots_From
+ scatter
)
add_custom_target(JKQTPlotter_GenerateDocScreenshots
diff --git a/doc/dox/examples_and_tutorials.dox b/doc/dox/examples_and_tutorials.dox
index b7e82c2623..00e02e28d9 100644
--- a/doc/dox/examples_and_tutorials.dox
+++ b/doc/dox/examples_and_tutorials.dox
@@ -15,7 +15,10 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
Screenshot | Description | Notes
|
---|
\image html jkqtplotter_simpletest1_small.png
| \subpage JKQTPlotterSimpleTest
- | `JKQTPXYLineGraph` C++-style QVector arrays of data
+ | `JKQTPXYLineGraph` C++-style QVector arrays of data
+ |
\image html scatter_small.png
+ | \subpage JKQTPlotterscatter
+ | `JKQTPXYScatterGraph` Iterator-Interface for JKQTDatastore
|
\image html speed_small.png
| \subpage JKQTPlotterSpeedTest
| `JKQTPXYLineGraph` external `std::array` data, not owned by datastore live-data, measure plotting speed tipps to increas plotting speed
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 767f7bd0f2..4db5d2eb46 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -82,6 +82,7 @@ add_subdirectory(rgbimageplot)
add_subdirectory(rgbimageplot_cimg)
add_subdirectory(rgbimageplot_opencv)
add_subdirectory(rgbimageplot_qt)
+add_subdirectory(scatter)
add_subdirectory(speed)
add_subdirectory(stackedbars)
add_subdirectory(stepplots)
diff --git a/examples/README.md b/examples/README.md
index c6e753aa10..02fe34215d 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -8,6 +8,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
| Screenshot | Description | Notes |
|:-------------:| ------------- | ------------- |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/jkqtplotter_simpletest1_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest/README.md) | [Very Basic Example (Line Graph)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/simpletest/README.md) | `JKQTPXYLineGraph` C++-style QVector arrays of data |
+| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/scatter_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/scatter/README.md) | [Very Basic Example (Scatter Graph)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/scatter/README.md) | `JKQTPXYScatterGraph` Iterator-Interface for JKQTDatastore |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/speed_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/speed) | [Line Graph with Live Data / Speed Test](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/speed) | `JKQTPXYLineGraph` external `std::array` data, not owned by datastore live-data, measure plotting speed tipps to increas plotting speed |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/symbols_and_styles_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/symbols_and_styles) | [Line Graph with Different Symbols and Line Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/symbols_and_styles) | `JKQTPXYLineGraph` C++ vector of data setting line styles and symbol styles automatic graph coloring |
| [![](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/stepplots_small.png)](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/stepplots) | [Special Step Line Plots in Different Styles](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/stepplots) | `JKQTPSpecialLineHorizontalGraph` C++ vector of data different step modes, filled and line-only |
diff --git a/examples/scatter/CMakeLists.txt b/examples/scatter/CMakeLists.txt
new file mode 100644
index 0000000000..535f418076
--- /dev/null
+++ b/examples/scatter/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required(VERSION 3.16)
+
+set(EXAMPLE_NAME scatter)
+set(EXENAME jkqtptest_${EXAMPLE_NAME})
+
+message( STATUS ".. Building Example ${EXAMPLE_NAME}" )
+
+
+# Set up source files
+set(SOURCES scatter.cpp )
+set(HEADERS )
+set(RESOURCES )
+set(UIS )
+
+add_executable(${EXENAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} ${UIS})
+target_include_directories(${EXENAME} PRIVATE ../../lib)
+if(JKQtPlotter_BUILD_STATIC_LIBS)
+ target_link_libraries(${EXENAME} JKQTPlotterLib)
+
+elseif(JKQtPlotter_BUILD_SHARED_LIBS)
+ target_link_libraries(${EXENAME} JKQTPlotterSharedLib)
+endif()
+target_link_libraries(${EXENAME} JKQTPExampleToolsLib)
+
+# precomiled headers to speed up compilation
+target_precompile_headers(${EXENAME} PRIVATE ../../lib/jkqtplotter/private/jkqtplotter_precomp.h)
+
+
+# Installation
+install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+
+#Installation of Qt DLLs on Windows
+jkqtplotter_deployqt(${EXENAME})
diff --git a/examples/scatter/README.md b/examples/scatter/README.md
new file mode 100644
index 0000000000..d3d6866df6
--- /dev/null
+++ b/examples/scatter/README.md
@@ -0,0 +1,57 @@
+# Example (JKQTPlotter): Very simple scatter-graph {#JKQTPlotterscatter}
+
+This project (see `./examples/scatter/`) simply creates a JKQTPlotter widget (as a new window) and adds a single scatter graph of type JKQTPXYScatterGraph (a sine-wave with noise).
+
+
+
+The source code of the example can be found in [`jkqtplotter_scatter.cpp`](https://github.com/jkriege2/JKQtPlotter/tree/master/examples/scatter/scatter.cpp).
+
+First we create a plotter window and get a pointer to the internal datastore (for convenience):
+```.cpp
+ JKQTPlotter plot;
+ JKQTPDatastore* ds=plot.getDatastore();
+```
+Now we add two columns to the JKQTPDatastore and obtain back-inserter iterators for these:
+```.cpp
+ size_t columnX=ds->addColumn("x");
+ auto colXInserter=ds->backInserter(columnX);
+ size_t columnY=ds->addColumn("y");
+ auto colYInserter=ds->backInserter(columnY);
+```
+Now we create data for a simple plot (a sine curve with random noise):
+```.cpp
+ std::default_random_engine generator;
+ std::normal_distribution distribution(0,0.5);
+ const int Ndata=100;
+ for (int i=0; isetXColumn(columnX);
+ graph1->setYColumn(columnY);
+ graph1->setTitle(QObject::tr("sine graph"));
+```
+Now we add the graph to the plot, so it is actually displayed:
+```.cpp
+ plot.addGraph(graph1);
+```
+Finally we autoscale the plot so the graph is contained:
+```.cpp
+ plot.zoomToFit();
+```
+The result looks like this:
+
+![jkqtplotter_scatter](https://raw.githubusercontent.com/jkriege2/JKQtPlotter/master/screenshots/scatter.png)
+
+
+
diff --git a/examples/scatter/scatter.cpp b/examples/scatter/scatter.cpp
new file mode 100644
index 0000000000..a9dc0a8d9d
--- /dev/null
+++ b/examples/scatter/scatter.cpp
@@ -0,0 +1,68 @@
+/** \example scatter.cpp
+ * A very basic example for the usage of JKQTPScatterGraphh
+ *
+ * \ref JKQTPlotterscatter
+ */
+
+#include
+#include "jkqtplotter/jkqtplotter.h"
+#include "jkqtplotter/graphs/jkqtpscatter.h"
+#include "jkqtpexampleapplication.h"
+#include
+
+
+int main(int argc, char* argv[])
+{
+
+#if QT_VERSION >= QT_VERSION_CHECK(5,6,0) && QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
+ QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps
+#endif
+
+ JKQTPExampleApplication app(argc, argv);
+
+
+ // 1. create a plotter window and get a pointer to the internal datastore (for convenience)
+ JKQTPlotter plot;
+ JKQTPDatastore* ds=plot.getDatastore();
+
+ // 2. add two columns to the JKQTPDatastore and obtain back-inserter iterators for these
+ size_t columnX=ds->addColumn("x");
+ auto colXInserter=ds->backInserter(columnX);
+ size_t columnY=ds->addColumn("y");
+ auto colYInserter=ds->backInserter(columnY);
+
+ // 3. now we create data for a simple plot (a sine curve with random noise)
+ std::default_random_engine generator;
+ std::normal_distribution distribution(0,0.5);
+ const int Ndata=100;
+ for (int i=0; isetXColumn(columnX);
+ graph1->setYColumn(columnY);
+ graph1->setTitle(QObject::tr("sine graph"));
+
+ // 5. add the graph to the plot, so it is actually displayed
+ plot.addGraph(graph1);
+
+ // 6. autoscale the plot so the graph is contained
+ plot.zoomToFit();
+
+ // show plotter and make it a decent size
+ plot.getPlotter()->setPlotLabel(QObject::tr("Scatter Example"));
+ plot.show();
+ plot.resize(600,400);
+
+ return app.exec();
+}
diff --git a/examples/scatter/scatter.pro b/examples/scatter/scatter.pro
new file mode 100644
index 0000000000..557a429657
--- /dev/null
+++ b/examples/scatter/scatter.pro
@@ -0,0 +1,30 @@
+# source code for this simple demo
+SOURCES = scatter.cpp
+
+# add tools library
+include(../libexampletools/libexampletools.pri)
+
+# configure Qt
+CONFIG += link_prl qt
+QT += core gui xml svg
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
+
+# output executable name
+TARGET = scatter
+
+# include JKQTPlotter source headers and link against library
+DEPENDPATH += ../../lib ../../qmake/staticlib/jkqtplotterlib
+INCLUDEPATH += ../../lib
+CONFIG (debug, debug|release) {
+ LIBS += -L../../qmake/staticlib/jkqtplotterlib/debug -ljkqtplotterlib_debug
+} else {
+ LIBS += -L../../qmake/staticlib/jkqtplotterlib/release -ljkqtplotterlib
+}
+message("LIBS = $$LIBS")
+
+win32-msvc*: DEFINES += _USE_MATH_DEFINES
+win32-msvc*: DEFINES += NOMINMAX
+
+
+
+
diff --git a/examples/scatter/scatter_and_lib.pro b/examples/scatter/scatter_and_lib.pro
new file mode 100644
index 0000000000..8cc239e94c
--- /dev/null
+++ b/examples/scatter/scatter_and_lib.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+
+SUBDIRS += jkqtplotterlib scatter
+
+jkqtplotterlib.file = ../../qmake/staticlib/jkqtplotterlib/jkqtplotterlib.pro
+
+scatter.file=$$PWD/scatter.pro
+scatter.depends = jkqtplotterlib
|