- removed many compiler warnings

- enabled compiler-warnings in CMake-build
- several bugfixes (also to appveyor.yml)
- removed some function from JKQTBasePlotter, which were (messy) shortcuts to adding graphs
This commit is contained in:
jkriege2 2019-06-21 15:46:53 +02:00
parent 0399a41ec9
commit 77d799a742
43 changed files with 563 additions and 766 deletions

View File

@ -19,6 +19,9 @@ endif()
if(NOT DEFINED BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE) if(NOT DEFINED BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE)
option(BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE "If set, the build-type is appended to the library name" ON) option(BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE "If set, the build-type is appended to the library name" ON)
endif() endif()
if(NOT DEFINED BUILD_HIGH_COMPILE_WARNING_LEVEL)
option(BUILD_HIGH_COMPILE_WARNING_LEVEL "Set Compiler Warning level to high" OFF)
endif()
if(NOT DEFINED BUILD_EXAMPLES) if(NOT DEFINED BUILD_EXAMPLES)
option(BUILD_EXAMPLES "Build examples" ON) option(BUILD_EXAMPLES "Build examples" ON)
endif() endif()
@ -77,14 +80,9 @@ find_package(Qt5 5.0 REQUIRED Core Gui Widgets PrintSupport Svg Xml OpenGl)
set (CMAKE_CXX_STANDARD 11) set (CMAKE_CXX_STANDARD 11)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
if(MSVC) if(MSVC)
if(BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_compile_options(/EHsc) add_compile_options(/EHsc)
# To enable M_PI, M_E,... # To enable M_PI, M_E,...
add_definitions(/D_USE_MATH_DEFINES) add_definitions(/D_USE_MATH_DEFINES)
@ -95,6 +93,9 @@ if(MSVC)
add_definitions(/D_CRT_NO_VA_START_VALIDATION) add_definitions(/D_CRT_NO_VA_START_VALIDATION)
else() else()
add_compile_options(-fexceptions) add_compile_options(-fexceptions)
if(BUILD_HIGH_COMPILE_WARNING_LEVEL)
add_compile_options(-Wall -Wextra) # -Wimplicit-fallthrough -Wuninitialized -Wmaybe-uninitialized) # -Wmisleading-indentation -Weffc++)
endif(BUILD_HIGH_COMPILE_WARNING_LEVEL)
endif() endif()
if(BUILD_INCLUDE_XITS_FONTS) if(BUILD_INCLUDE_XITS_FONTS)

View File

@ -33,9 +33,6 @@ jkqtmathtext_simpletest.depends = jkqtmathtextlib
jkqtmathtext_test.subdir = examples/jkqtmathtext_test jkqtmathtext_test.subdir = examples/jkqtmathtext_test
jkqtmathtext_test.depends = jkqtplotterlib jkqtmathtext_test.depends = jkqtplotterlib
jkqtplot_test.subdir = examples/jkqtplot_test
jkqtplot_test.depends = jkqtplotterlib
jkqtplotter_simpletest.file = examples/simpletest/jkqtplotter_simpletest.pro jkqtplotter_simpletest.file = examples/simpletest/jkqtplotter_simpletest.pro
jkqtplotter_simpletest.depends = jkqtplotterlib jkqtplotter_simpletest.depends = jkqtplotterlib

View File

@ -8,9 +8,20 @@ environment:
QTVER: 5.11 QTVER: 5.11
JOMDIR: C:\Qt\Tools\QtCreator\bin JOMDIR: C:\Qt\Tools\QtCreator\bin
MINGWDIR: C:\Qt\Tools\mingw530_32 MINGWDIR: C:\Qt\Tools\mingw530_32
VSVER: 0
matrix: matrix:
- QTABI: mingw53_32
ARCH: x86
MAKETOOL: mingw32-make
CMAKE_GENERATOR: "MinGW Makefiles"
USE_CMAKE: true
MSBUILD_FLAGS:
- QTABI: mingw53_32
ARCH: x86
QMAKESPEC: win32-g++
MAKETOOL: mingw32-make
USE_CMAKE: false
- QTABI: msvc2017_64 - QTABI: msvc2017_64
ARCH: x64 ARCH: x64
VSVER: 2017 VSVER: 2017
@ -35,17 +46,6 @@ environment:
QMAKESPEC: win32-msvc QMAKESPEC: win32-msvc
MAKETOOL: jom MAKETOOL: jom
USE_CMAKE: false USE_CMAKE: false
- QTABI: mingw53_32
ARCH: x86
MAKETOOL: mingw32-make
CMAKE_GENERATOR: "MinGW Makefiles"
USE_CMAKE: true
MSBUILD_FLAGS:
- QTABI: mingw53_32
ARCH: x86
QMAKESPEC: win32-g++
MAKETOOL: mingw32-make
USE_CMAKE: false
skip_tags: true skip_tags: true
@ -57,6 +57,7 @@ configuration:
- release - release
- debug - debug
install: install:
- IF %VSVER% GTR 14 ( - IF %VSVER% GTR 14 (
call "C:\Program Files (x86)\Microsoft Visual Studio\%VSVER%\Community\VC\Auxiliary\Build\vcvarsall.bat" %ARCH% call "C:\Program Files (x86)\Microsoft Visual Studio\%VSVER%\Community\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
@ -69,6 +70,8 @@ install:
) )
- set PATH=C:\Qt\%QTVER%\%QTABI%\bin;%JOMDIR%;%PATH% - set PATH=C:\Qt\%QTVER%\%QTABI%\bin;%JOMDIR%;%PATH%
- echo "BUILD ID Qt%QTVER%_%QTABI%_%APPVEYOR_BUILD_VERSION%_%CONFIGURATION%" - echo "BUILD ID Qt%QTVER%_%QTABI%_%APPVEYOR_BUILD_VERSION%_%CONFIGURATION%"
# Rename sh.exe as sh.exe in PATH interferes with MinGW
- rename "C:\Program Files\Git\usr\bin\sh.exe" "sh2.exe"
build_script: build_script:
# - dir "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" # - dir "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include"
@ -83,7 +86,7 @@ build_script:
cmake --version && cmake --version &&
cmake -G "%CMAKE_GENERATOR%" "-DCMAKE_PREFIX_PATH=%QT5%" .. && cmake -G "%CMAKE_GENERATOR%" "-DCMAKE_PREFIX_PATH=%QT5%" .. &&
echo "Build..." && echo "Build..." &&
cmake --build --config "%CMAKE_CONFIGURATION%" -- %MSBUILD_FLAGS% ) cmake --build . --config "%CMAKE_CONFIGURATION%" -- %MSBUILD_FLAGS% )
else ( else (
echo "Call QMake..." && echo "Call QMake..." &&
qmake.exe -v && qmake.exe -v &&

View File

@ -12,6 +12,7 @@ The preferred way to build JKQTPlotter is using CMake. The CMake-build is define
You can build JKQTPlotter (and also the examples) by: You can build JKQTPlotter (and also the examples) by:
- Either opening the file <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/CMakeLists.txt">CMakeLists.txt</a> in QTCreator (which has CMake integration) - Either opening the file <a href="https://github.com/jkriege2/JKQtPlotter/blob/master/CMakeLists.txt">CMakeLists.txt</a> in QTCreator (which has CMake integration)
- Or by calling something like this from the source directory: - Or by calling something like this from the source directory:
\code{.sh} \code{.sh}
$ mkdir build; cd build $ mkdir build; cd build
$ cmake ../ $ cmake ../

View File

@ -10,6 +10,7 @@ add_subdirectory(jkqtfastplotter_test)
add_subdirectory(jkqtmathtext_simpletest) add_subdirectory(jkqtmathtext_simpletest)
add_subdirectory(jkqtmathtext_test) add_subdirectory(jkqtmathtext_test)
add_subdirectory(jkqtplot_test)
add_subdirectory(advplotstyling) add_subdirectory(advplotstyling)
add_subdirectory(barchart) add_subdirectory(barchart)

View File

@ -30,9 +30,9 @@ void ContourPlotAnimator::step() {
const double Q4=-1.6e-19; // charge of charged particle 4 const double Q4=-1.6e-19; // charge of charged particle 4
const double Q4_x0=r2*cos(angle); // x-position of charged particle 4 const double Q4_x0=r2*cos(angle); // x-position of charged particle 4
const double Q4_y0=-r2*sin(angle); // y-position of charged particle 4 const double Q4_y0=-r2*sin(angle); // y-position of charged particle 4
for (size_t iy=0; iy<NY; iy++ ) { for (size_t iy=0; iy<static_cast<size_t>(NY); iy++ ) {
x=-w/2.0; x=-w/2.0;
for (size_t ix=0; ix<NX; ix++ ) { for (size_t ix=0; ix<static_cast<size_t>(NX); ix++ ) {
const double r1=sqrt((x-Q1_x0)*(x-Q1_x0)+(y-Q1_y0)*(y-Q1_y0)); const double r1=sqrt((x-Q1_x0)*(x-Q1_x0)+(y-Q1_y0)*(y-Q1_y0));
const double r2=sqrt((x-Q2_x0)*(x-Q2_x0)+(y-Q2_y0)*(y-Q2_y0)); const double r2=sqrt((x-Q2_x0)*(x-Q2_x0)+(y-Q2_y0)*(y-Q2_y0));
const double r3=sqrt((x-Q3_x0)*(x-Q3_x0)+(y-Q3_y0)*(y-Q3_y0)); const double r3=sqrt((x-Q3_x0)*(x-Q3_x0)+(y-Q3_y0)*(y-Q3_y0));

View File

@ -40,8 +40,10 @@ int main(int argc, char* argv[])
auto biXCol=datastore->backInserter(XCol); auto biXCol=datastore->backInserter(XCol);
auto biYCol=datastore->backInserter(YCol); auto biYCol=datastore->backInserter(YCol);
for (double x=0; x<4.0*M_PI; x+=4.0*M_PI/50.0) { for (double x=0; x<4.0*M_PI; x+=4.0*M_PI/50.0) {
*++biXCol=x; *biXCol=x;
*++biYCol=cos(x); *biYCol=cos(x);
++biXCol;
++biYCol;
} }
// 2.3 combining with addLinearColumn() you can also use C++ STL algorithms: // 2.3 combining with addLinearColumn() you can also use C++ STL algorithms:
//size_t XCol=datastore->addLinearColumn(50, 0, 4.0*M_PI, "cos curve: x-data"); //size_t XCol=datastore->addLinearColumn(50, 0, 4.0*M_PI, "cos curve: x-data");

View File

@ -23,7 +23,7 @@ TestMain::TestMain(QWidget *parent) :
y3=(double*)calloc(N1, sizeof(double)); y3=(double*)calloc(N1, sizeof(double));
QGridLayout* gl=new QGridLayout(this); QGridLayout* gl=new QGridLayout();
setLayout(gl); setLayout(gl);
QTabWidget* t=new QTabWidget(this); QTabWidget* t=new QTabWidget(this);
gl->addWidget(t,0,0); gl->addWidget(t,0,0);

View File

@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.0)
set(EXAMPLE_NAME jkqtplot_test)
set(EXENAME ${EXAMPLE_NAME})
message( STATUS ".. Building Example ${EXAMPLE_NAME}" )
# Set up source files
set(SOURCES jkqtplot_test.cpp testmain.cpp TestWidgetBarcharts.cpp TestWidgetContourPlots.cpp TestWidgetEmptyPlot.cpp TestWidgetFunctionPlots.cpp TestWidgetGeometry.cpp TestWidgetGraphs.cpp TestWidgetImages.cpp TestWidgetLogGraphs.cpp TestWidgetParamScatterPlots.cpp TestWidgetPeaksPlots.cpp TestWidgetRGBImages.cpp )
# EmfEngine/src/EmfEngine.cpp
# EmfEngine/src/EmfPaintDevice.cpp
# QTeXEngine/src/QTeXPaintDevice.h
# QTeXEngine/src/QTeXPaintEngine.h
#)
set(HEADERS testmain.h TestWidgetBarcharts.h TestWidgetContourPlots.h TestWidgetEmptyPlot.h TestWidgetFunctionPlots.h TestWidgetGeometry.h TestWidgetGraphs.h TestWidgetImages.h TestWidgetLogGraphs.h TestWidgetParamScatterPlots.h TestWidgetPeaksPlots.h TestWidgetRGBImages.h)
# jkqtpemfengineadapter.h
# EmfEngine/src/EmfEngine.h
# QTeXEngine/src/QTeXEngine.h
#)
set(RESOURCES jkqtplot_test.qrc )
set(UIS )
add_executable(${EXENAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} ${UIS})
target_include_directories(${EXENAME} PRIVATE ../../lib)
if(BUILD_STATIC_LIBS)
target_link_libraries(${EXENAME} JKQTPlotterLib${LIBNAME_ADDITION})
elseif(BUILD_SHARED_LIBS)
target_link_libraries(${EXENAME} JKQTPlotterSharedLib${LIBNAME_ADDITION})
endif()
# Installation
if(LIB_INSTALL)
install(TARGETS ${EXENAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif(LIB_INSTALL)

View File

@ -14,7 +14,7 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
{ {
QVBoxLayout* barchartLayout=new QVBoxLayout(this); QVBoxLayout* barchartLayout=new QVBoxLayout();
setLayout(barchartLayout); setLayout(barchartLayout);
resize(1000, 800); resize(1000, 800);
plotBarchart=new JKQTPlotter(true, this); plotBarchart=new JKQTPlotter(true, this);

View File

@ -14,7 +14,7 @@ TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
// contour plot // contour plot
QHBoxLayout* layoutContour=new QHBoxLayout(this); QHBoxLayout* layoutContour=new QHBoxLayout();
setLayout(layoutContour); setLayout(layoutContour);
JKQTPlotter* plotContour=new JKQTPlotter(true, this); JKQTPlotter* plotContour=new JKQTPlotter(true, this);
plotContour->setPlotUpdateEnabled(false); plotContour->setPlotUpdateEnabled(false);

View File

@ -14,7 +14,7 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
{ {
QVBoxLayout* plotFuncLayout=new QVBoxLayout(this); QVBoxLayout* plotFuncLayout=new QVBoxLayout();
setLayout(plotFuncLayout); setLayout(plotFuncLayout);
plotFuncPlt=new JKQTPlotter(true, this); plotFuncPlt=new JKQTPlotter(true, this);
plotFuncLayout->addWidget(plotFuncPlt); plotFuncLayout->addWidget(plotFuncPlt);

View File

@ -12,7 +12,7 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
// create third plotter with output of a geometric drawing // create third plotter with output of a geometric drawing
QVBoxLayout* layout1=new QVBoxLayout(this); QVBoxLayout* layout1=new QVBoxLayout();
setLayout(layout1); setLayout(layout1);
resize(1000, 800); resize(1000, 800);
JKQTPlotter* plotGeo=new JKQTPlotter(true, this); JKQTPlotter* plotGeo=new JKQTPlotter(true, this);

View File

@ -4,6 +4,7 @@
#include <QDateTime> #include <QDateTime>
#include <QApplication> #include <QApplication>
#include "jkqtplotter/graphs/jkqtpscatter.h" #include "jkqtplotter/graphs/jkqtpscatter.h"
#include "jkqtplotter/graphs/jkqtpbarchart.h"
#include "jkqtplotter/graphs/jkqtpboxplot.h" #include "jkqtplotter/graphs/jkqtpboxplot.h"
#include "jkqtplotter/graphs/jkqtpfilledcurve.h" #include "jkqtplotter/graphs/jkqtpfilledcurve.h"
#include "jkqtplotter/gui/jkqtpcomboboxes.h" #include "jkqtplotter/gui/jkqtpcomboboxes.h"
@ -36,8 +37,8 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
QListView* listPlots=new QListView(this); QListView* listPlots=new QListView(this);
listPlots->setModel(plot->getPlotter()->getPlotsModel()); listPlots->setModel(plot->getPlotter()->getPlotsModel());
listPlots->setMaximumWidth(256); listPlots->setMaximumWidth(256);
QVBoxLayout* layout=new QVBoxLayout(this); QVBoxLayout* layout=new QVBoxLayout();
QGridLayout* layout_grid=new QGridLayout(this); QGridLayout* layout_grid=new QGridLayout();
layout_grid->addWidget(plot,0,0,1,1); layout_grid->addWidget(plot,0,0,1,1);
layout_grid->addWidget(plotBot,1,0,1,1); layout_grid->addWidget(plotBot,1,0,1,1);
layout_grid->addWidget(listPlots,0,1,1,1); layout_grid->addWidget(listPlots,0,1,1,1);
@ -47,7 +48,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
setLayout(layout); setLayout(layout);
resize(1000, 800); resize(1000, 800);
plotBot->synchronizeToMaster(plot, JKQTBasePlotter::sdXAxis, true, true, true); plotBot->synchronizeXToMaster(plot);
plot->getPlotter()->setGridPrinting(true); plot->getPlotter()->setGridPrinting(true);
plot->getPlotter()->addGridPrintingPlotter(0,1,plotBot->getPlotter()); plot->getPlotter()->addGridPrintingPlotter(0,1,plotBot->getPlotter());
plot->getPlotter()->addGridPrintingPlotter(0,2,plotBot2->getPlotter()); plot->getPlotter()->addGridPrintingPlotter(0,2,plotBot2->getPlotter());
@ -103,16 +104,30 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
size_t cy21re=ds->addColumn(y21re, N2, "y21re"); size_t cy21re=ds->addColumn(y21re, N2, "y21re");
size_t id=plot->getPlotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPFilledCurveX); JKQTPFilledCurveXGraph* fcxgr;
JKQTPFilledCurveXGraph* fcxgr=qobject_cast<JKQTPFilledCurveXGraph*>(plot->getPlotter()->getGraph(id)); size_t id=plot->getPlotter()->addGraph(fcxgr=new JKQTPFilledCurveXGraph(plot));
fcxgr->setXColumn(cx2);
fcxgr->setYColumn(cy21);
fcxgr->setTitle("$5\\cdot\\sin(x)$");
qobject_cast<JKQTPFilledCurveXGraph*>(plot->getPlotter()->getGraph(id));
if (fcxgr) { if (fcxgr) {
fcxgr->setBaseline(2); fcxgr->setBaseline(2);
} }
size_t yeb=plot->getPlotter()->addGraphWithXYError(cx2, cy21, cy22, cy22, "sine with errors", JKQTPFilledCurveX); JKQTPFilledCurveXErrorGraph* gELines;
size_t yeb=plot->getPlotter()->addGraph(gELines=new JKQTPFilledCurveXErrorGraph(plot));
gELines->setXColumn(cx2);
gELines->setYErrorColumnLower(cy22);
gELines->setYColumn(cy22);
gELines->setYErrorColumn(cy21);
gELines->setTitle("sine with errors");
plteErrors=plot->getPlotter()->getGraph(yeb); plteErrors=plot->getPlotter()->getGraph(yeb);
setErrorLineStyle(0); setErrorLineStyle(0);
yeb=plot->getPlotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPLinesPoints); JKQTPXYLineGraph* gLines;
yeb=plot->getPlotter()->addGraph(gLines=new JKQTPXYLineGraph(plot));
gLines->setXColumn(cx2);
gLines->setYColumn(cy21);
gLines->setTitle("$5\\cdot\\sin(x)$");
plteSymbols=plot->getPlotter()->getGraph(yeb); plteSymbols=plot->getPlotter()->getGraph(yeb);
pltePlot2=new JKQTPXYLineErrorGraph(plotBot->getPlotter()); pltePlot2=new JKQTPXYLineErrorGraph(plotBot->getPlotter());
@ -120,7 +135,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
pltePlot2->setYColumn(cy21r); pltePlot2->setYColumn(cy21r);
pltePlot2->setTitle(tr("random numbers")); pltePlot2->setTitle(tr("random numbers"));
pltePlot2->setDrawLine(true); pltePlot2->setDrawLine(true);
pltePlot2->setYErrorColumn(cy21re); pltePlot2->setYErrorColumn(static_cast<int>(cy21re));
pltePlot2->setYErrorStyle(JKQTPErrorBarsPolygons); pltePlot2->setYErrorStyle(JKQTPErrorBarsPolygons);
pltePlot2->setSymbolType(JKQTPFilledStar); pltePlot2->setSymbolType(JKQTPFilledStar);
plotBot->getPlotter()->addGraph(pltePlot2); plotBot->getPlotter()->addGraph(pltePlot2);
@ -161,7 +176,33 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
cb.push_back(ds->addColumn(b3, N3, "b3")); cb.push_back(ds->addColumn(b3, N3, "b3"));
QStringList ts; QStringList ts;
ts<<"bars 1"<<"bars 2"<<"bars 3"; ts<<"bars 1"<<"bars 2"<<"bars 3";
plot->getPlotter()->addVerticalBargraph(cb, cbp, ts); JKQTPBarVerticalGraph* gbar1;
JKQTPBarVerticalGraph* gbar2;
JKQTPBarVerticalGraph* gbar3;
double w=0.9;
double width=w/static_cast<double>(3);
double s=-1.0*w/2.0+width/2.0;
plot->getPlotter()->addGraph(gbar1=new JKQTPBarVerticalGraph(plot));
gbar1->setXColumn(cbp);
gbar1->setYColumn(cb[0]);
gbar1->setTitle(ts[0]);
gbar1->setShift(s);
gbar1->setWidth(width);
s=s+width;
plot->getPlotter()->addGraph(gbar2=new JKQTPBarVerticalGraph(plot));
gbar2->setXColumn(cbp);
gbar2->setYColumn(cb[1]);
gbar2->setTitle(ts[1]);
gbar2->setShift(s);
gbar2->setWidth(width);
s=s+width;
plot->getPlotter()->addGraph(gbar3=new JKQTPBarVerticalGraph(plot));
gbar3->setXColumn(cbp);
gbar3->setYColumn(cb[2]);
gbar3->setTitle(ts[2]);
gbar3->setShift(s);
gbar3->setWidth(width);
s=s+width;
JKQTPVerticalRange* r1=new JKQTPVerticalRange(plot->getPlotter()); JKQTPVerticalRange* r1=new JKQTPVerticalRange(plot->getPlotter());
r1->setRangeMin(5); r1->setRangeMin(5);

View File

@ -30,7 +30,7 @@ class TestWidgetGraphs : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit TestWidgetGraphs(QWidget *parent = 0); explicit TestWidgetGraphs(QWidget *parent = nullptr);
signals: signals:
@ -47,8 +47,8 @@ class TestWidgetGraphs : public QWidget
void setKeyPos2(JKQTPKeyPosition layout); void setKeyPos2(JKQTPKeyPosition layout);
protected: protected:
double x1[N1], x2[N2], x2r[N2]/*, x3[N3]*/; double x1[N1], x2[N2], x2r[N1]/*, x3[N3]*/;
double y11[N1], y12[N1], y13[N1], y21[N2], y21r[N2], y21re[N2], y22[N2], y23[N2], y24[N2]; double y11[N1], y12[N1], y13[N1], y21[N1], y21r[N1], y21re[N1], y22[N1], y23[N1], y24[N1];
double xbox[N3], ymed[N3], ymean[N3], ymin[N3], ymax[N3], yp25[N3], yp75[N3]; double xbox[N3], ymed[N3], ymean[N3], ymin[N3], ymax[N3], yp25[N3], yp75[N3];
double b1[N3], b2[N3], b3[N3]; double b1[N3], b2[N3], b3[N3];

View File

@ -17,7 +17,7 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
QVBoxLayout* layouti=new QVBoxLayout(this); QVBoxLayout* layouti=new QVBoxLayout();
QFormLayout* layWid=new QFormLayout; QFormLayout* layWid=new QFormLayout;
layouti->addLayout(layWid); layouti->addLayout(layWid);
setLayout(layouti); setLayout(layouti);

View File

@ -38,7 +38,11 @@ TestWidgetLogGraphs::TestWidgetLogGraphs(QWidget *parent) :
resize(1000, 800); resize(1000, 800);
plotLOG->getPlotter()->addGraph(cx2, cy23, "data, $f(x)=5^{x/5}$", JKQTPLines); JKQTPXYLineGraph* gLines;
plotLOG->getPlotter()->addGraph(gLines=new JKQTPXYLineGraph(plotLOG));
gLines->setXColumn(cx2);
gLines->setYColumn(cy23);
gLines->setTitle("data, $f(x)=5^{x/5}$");
plotLOG->setPlotUpdateEnabled(true); plotLOG->setPlotUpdateEnabled(true);

View File

@ -13,7 +13,7 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
QVBoxLayout* layoutPSP=new QVBoxLayout(this); QVBoxLayout* layoutPSP=new QVBoxLayout();
setLayout(layoutPSP); setLayout(layoutPSP);
resize(1000, 800); resize(1000, 800);

View File

@ -15,7 +15,7 @@ TestWidgetPeaksPlots::TestWidgetPeaksPlots(QWidget *parent) :
{ {
QVBoxLayout* layoutpeaks=new QVBoxLayout(this); QVBoxLayout* layoutpeaks=new QVBoxLayout();
setLayout(layoutpeaks); setLayout(layoutpeaks);
resize(1000, 800); resize(1000, 800);
plotPeaks=new JKQTPlotter(true, this); plotPeaks=new JKQTPlotter(true, this);

View File

@ -12,11 +12,10 @@
TestWidgetRGBImages::TestWidgetRGBImages(QWidget *parent) : TestWidgetRGBImages::TestWidgetRGBImages(QWidget *parent) :
QWidget(parent) QWidget(parent)
{ {
// plotter for images // plotter for images
QWidget* winrgb=new QWidget(this); QWidget* winrgb=new QWidget(this);
QVBoxLayout* layoutrgb=new QVBoxLayout(this); QVBoxLayout* layoutrgb=new QVBoxLayout();
QFormLayout* frm=new QFormLayout(nullptr); QFormLayout* frm=new QFormLayout();
winrgb->setLayout(layoutrgb); winrgb->setLayout(layoutrgb);
winrgb->resize(1000, 800); winrgb->resize(1000, 800);
plotImgRGB=new JKQTPlotter(true, winrgb); plotImgRGB=new JKQTPlotter(true, winrgb);

View File

@ -14,7 +14,7 @@
#include <cmath> #include <cmath>
template <class TGraph, JKQTPSingleColumnSymbolsGraph::DataDirection DataOrientation> template <class TGraph, JKQTPSingleColumnSymbolsGraph::DataDirection DataOrientation>
void showPlot() { JKQTPlotter* showPlot() {
// 1. create a plotter window and get a pointer to the internal datastore (for convenience) // 1. create a plotter window and get a pointer to the internal datastore (for convenience)
JKQTPlotter* plot=new JKQTPlotter(); JKQTPlotter* plot=new JKQTPlotter();
@ -157,6 +157,8 @@ void showPlot() {
// show plotter and make it a decent size // show plotter and make it a decent size
plot->show(); plot->show();
plot->resize(800,600); plot->resize(800,600);
return plot;
} }
int main(int argc, char* argv[]) int main(int argc, char* argv[])

View File

@ -30,12 +30,11 @@ Copyright (c) 2008-2019 Jan W. Krieger (<jan@jkrieger.de>)
int JKQTPAutoOutputTimer::global_indent=0; int JKQTPAutoOutputTimer::global_indent=0;
JKQTPAutoOutputTimer::JKQTPAutoOutputTimer(const QString& message) : JKQTPAutoOutputTimer::JKQTPAutoOutputTimer(const QString& _message) :
QElapsedTimer() QElapsedTimer(),message(_message),indent()
{ {
this->indent=QString(global_indent, QLatin1Char(' ')); this->indent=QString(global_indent, QLatin1Char(' '));
global_indent+=4; global_indent+=4;
this->message=message;
#if QT_VERSION >= 0x040800 #if QT_VERSION >= 0x040800
qDebug()<<this->indent<<"TIMER_START: "<<message; qDebug()<<this->indent<<"TIMER_START: "<<message;
#else #else

View File

@ -38,9 +38,6 @@ JKQTPEnhancedPainter::JKQTPEnhancedPainter():
initQEnhacedPainter(); initQEnhacedPainter();
} }
JKQTPEnhancedPainter::~JKQTPEnhancedPainter()
= default;
//void JKQTPEnhancedPainter::drawLines(const QLineF *lines, int lineCount) //void JKQTPEnhancedPainter::drawLines(const QLineF *lines, int lineCount)
//{ //{

View File

@ -35,7 +35,6 @@ class JKQTP_LIB_EXPORT JKQTPEnhancedPainter : public QPainter {
public: public:
JKQTPEnhancedPainter(QPaintDevice* device); JKQTPEnhancedPainter(QPaintDevice* device);
JKQTPEnhancedPainter(); JKQTPEnhancedPainter();
virtual ~JKQTPEnhancedPainter() ;
//void drawPath(const QPainterPath &path); //void drawPath(const QPainterPath &path);
@ -130,7 +129,7 @@ class JKQTP_LIB_EXPORT JKQTPEnhancedPainter : public QPainter {
// } // }
protected: protected:
virtual void initQEnhacedPainter(); void initQEnhacedPainter();
private: private:
}; };

View File

@ -28,7 +28,7 @@
#include "jkqtphighrestimer.h" // class's header file #include "jkqtphighrestimer.h" // class's header file
JKQTPHighResTimer::JKQTPHighResTimer() { JKQTPHighResTimer::JKQTPHighResTimer(): last(), freq(0) {
start(); start();
} }

View File

@ -235,6 +235,20 @@ inline bool jkqtp_approximatelyEqual(double a, double b, double epsilon=2.0*JKQT
return fabs(a - b) <= epsilon; return fabs(a - b) <= epsilon;
} }
/** \brief compare two floats \a a and \a b for uneuqality, where any difference smaller than \a epsilon is seen as equality
* \ingroup jkqtptools_math_basic */
inline bool jkqtp_approximatelyUnequal(float a, float b, float epsilon=2.0f*JKQTP_FLOAT_EPSILON)
{
return fabsf(a - b) > epsilon;
}
/** \brief compare two doubles \a a and \a b for uneuqality, where any difference smaller than \a epsilon is seen as equality
* \ingroup jkqtptools_math_basic */
inline bool jkqtp_approximatelyUnequal(double a, double b, double epsilon=2.0*JKQTP_DOUBLE_EPSILON)
{
return fabs(a - b) > epsilon;
}
/** \brief returns the given value \a v (i.e. identity function) /** \brief returns the given value \a v (i.e. identity function)
* \ingroup jkqtptools_math_basic */ * \ingroup jkqtptools_math_basic */
template<typename T> template<typename T>

View File

@ -405,7 +405,8 @@ inline void jkqtpstatCumSum(InputIt first, InputIt last, OutputIt output) {
if (JKQTPIsOKFloat(v)) { if (JKQTPIsOKFloat(v)) {
sum=sum+v; sum=sum+v;
} }
*++output=sum; *output=sum;
++output;
} }
} }
@ -430,7 +431,8 @@ inline size_t jkqtpstatFilterGoodFloat(InputIt first, InputIt last, OutputIt out
for (auto it=first; it!=last; ++it) { for (auto it=first; it!=last; ++it) {
const double v=jkqtp_todouble(*it); const double v=jkqtp_todouble(*it);
if (JKQTPIsOKFloat(v)) { if (JKQTPIsOKFloat(v)) {
*++output=v; *output=v;
++output;
NN++; NN++;
} }
} }
@ -913,7 +915,8 @@ inline void jkqtpstat5NumberStatisticsAndOutliersOfSortedVector(const TVector& d
if (maximum) *maximum=qmax; if (maximum) *maximum=qmax;
for (auto it=data.begin(); it!=data.end(); ++it) { for (auto it=data.begin(); it!=data.end(); ++it) {
if (*it<qmin || *it>qmax) { if (*it<qmin || *it>qmax) {
*++outliersout=*it; *outliersout=*it;
++outliersout;
} }
} }
if (median) { if (median) {

View File

@ -108,10 +108,12 @@ inline void jkqtpstatHistogram1DAutoranged(InputIt first, InputIt last, OutputIt
} }
double h=0; double h=0;
for (size_t i=0; i<histX.size(); i++) { for (size_t i=0; i<histX.size(); i++) {
*++histogramXOut=histX[i]+xoffset; *histogramXOut=histX[i]+xoffset;
if (cummulative) h+=(histY[i]/NNorm); if (cummulative) h+=(histY[i]/NNorm);
else h=histY[i]/NNorm; else h=histY[i]/NNorm;
*++histogramYOut=h; *histogramYOut=h;
++histogramXOut;
++histogramYOut;
} }
} }
@ -171,11 +173,12 @@ inline void jkqtpstatHistogram1DAutoranged(InputIt first, InputIt last, OutputIt
} }
double h=0; double h=0;
for (size_t i=0; i<histX.size(); i++) { for (size_t i=0; i<histX.size(); i++) {
*++histogramXOut=histX[i]+xoffset; *histogramXOut=histX[i]+xoffset;
if (cummulative) h+=(histY[i]/NNorm); if (cummulative) h+=(histY[i]/NNorm);
else h=histY[i]/NNorm; else h=histY[i]/NNorm;
*++histogramYOut=h; *histogramYOut=h;
} ++histogramXOut;
++histogramYOut; }
} }
@ -243,11 +246,12 @@ inline void jkqtpstatHistogram1D(InputIt first, InputIt last, BinsInputIt binsFi
if (binXMode==JKQTPStatHistogramBinXMode::XIsMid) xoffset=binw/2.0; if (binXMode==JKQTPStatHistogramBinXMode::XIsMid) xoffset=binw/2.0;
} }
*++histogramXOut=histX[i]+xoffset; *histogramXOut=histX[i]+xoffset;
if (cummulative) h+=(histY[i]/NNorm); if (cummulative) h+=(histY[i]/NNorm);
else h=histY[i]/NNorm; else h=histY[i]/NNorm;
*++histogramYOut=h; *histogramYOut=h;
} ++histogramXOut;
++histogramYOut; }
} }

View File

@ -253,10 +253,12 @@ inline void jkqtpstatKDE1DAutoranged(InputIt first, InputIt last, OutputIt KDEXO
// output the KDE // output the KDE
double h=0; double h=0;
for (size_t i=0; i<histX.size(); i++) { for (size_t i=0; i<histX.size(); i++) {
*++KDEXOut=histX[i]; *KDEXOut=histX[i];
if (cummulative) h+=histY[i]; if (cummulative) h+=histY[i];
else h=histY[i]; else h=histY[i];
*++KDEYOut=h; *KDEYOut=h;
++KDEXOut;
++KDEYOut;
} }
} }
@ -307,10 +309,12 @@ inline void jkqtpstatKDE1DAutoranged(InputIt first, InputIt last, OutputIt KDEXO
// output the KDE // output the KDE
double h=0; double h=0;
for (size_t i=0; i<histX.size(); i++) { for (size_t i=0; i<histX.size(); i++) {
*++KDEXOut=histX[i]; *KDEXOut=histX[i];
if (cummulative) h+=histY[i]; if (cummulative) h+=histY[i];
else h=histY[i]; else h=histY[i];
*++KDEYOut=h; *KDEYOut=h;
++KDEXOut;
++KDEYOut;
} }
} }
@ -360,10 +364,12 @@ inline void jkqtpstatKDE1D(InputIt first, InputIt last, BinsInputIt binsFirst, B
// output the KDE // output the KDE
double h=0; double h=0;
for (size_t i=0; i<histX.size(); i++) { for (size_t i=0; i<histX.size(); i++) {
*++KDEXOut=histX[i]; *KDEXOut=histX[i];
if (cummulative) h+=histY[i]; if (cummulative) h+=histY[i];
else h=histY[i]; else h=histY[i];
*++KDEYOut=h; *KDEYOut=h;
++KDEXOut;
++KDEYOut;
} }
} }
@ -409,10 +415,12 @@ inline void jkqtpstatKDE1D(InputIt first, InputIt last, double binXLeft, double
// output the KDE // output the KDE
double h=0; double h=0;
for (size_t i=0; i<histX.size(); i++) { for (size_t i=0; i<histX.size(); i++) {
*++KDEXOut=histX[i]; *KDEXOut=histX[i];
if (cummulative) h+=histY[i]; if (cummulative) h+=histY[i];
else h=histY[i]; else h=histY[i];
*++KDEYOut=h; *KDEYOut=h;
++KDEXOut;
++KDEYOut;
} }
} }

View File

@ -145,7 +145,8 @@ inline void jkqtpstatPolyFit(InputItX firstX, InputItX lastX, InputItY firstY, I
if (ok) { if (ok) {
auto itR=firstRes; auto itR=firstRes;
for (size_t p=0; p<P+1; p++) { for (size_t p=0; p<P+1; p++) {
*++itR=VTY[p]; *itR=VTY[p];
++itR;
} }
} else { } else {
throw std::runtime_error("jkqtplinalgLinSolve() didn't return a result!"); throw std::runtime_error("jkqtplinalgLinSolve() didn't return a result!");

View File

@ -272,6 +272,7 @@ QString jkqtp_QPenStyle2String(Qt::PenStyle style) {
case Qt::DotLine: return "dot"; case Qt::DotLine: return "dot";
case Qt::DashDotLine: return "dashdot"; case Qt::DashDotLine: return "dashdot";
case Qt::DashDotDotLine: return "dashdotdot"; case Qt::DashDotDotLine: return "dashdotdot";
case Qt::NoPen: return "none";
default: default:
case Qt::SolidLine: return "solid"; case Qt::SolidLine: return "solid";
} }
@ -284,6 +285,7 @@ Qt::PenStyle jkqtp_String2QPenStyle(const QString& style) {
if (s=="dashdot" || s=="-.") return Qt::DashDotLine; if (s=="dashdot" || s=="-.") return Qt::DashDotLine;
if (s=="dashdotdot" || s=="-..") return Qt::DashDotDotLine; if (s=="dashdotdot" || s=="-..") return Qt::DashDotDotLine;
if (s=="solid" || s=="-") return Qt::SolidLine; if (s=="solid" || s=="-") return Qt::SolidLine;
if (s=="none" || s=="" || s=="n") return Qt::NoPen;
return Qt::SolidLine; return Qt::SolidLine;
} }

View File

@ -297,7 +297,7 @@ void JKQTPContourPlot::calcContourLines(QList<QVector<QLineF> > &ContourLines)
#ifdef JKQTBP_AUTOTIMER #ifdef JKQTBP_AUTOTIMER
JKQTPAutoOutputTimer jkaat(QString("JKQTPContourPlot::calcContourLines()")); JKQTPAutoOutputTimer jkaat(QString("JKQTPContourPlot::calcContourLines()"));
#else #else
qDebug()<<"JKQTPContourPlot::calcContourLines()"; //qDebug()<<"JKQTPContourPlot::calcContourLines()";
#endif #endif
double scale=1; ///< scale of the contour levels; double scale=1; ///< scale of the contour levels;

View File

@ -217,7 +217,7 @@ class JKQTP_LIB_EXPORT JKQTPContourPlot: public JKQTPMathImage, public JKQTPGrap
* @param level contour plane * @param level contour plane
* @return above (1), on the plane (0), below (-1); * @return above (1), on the plane (0), below (-1);
*/ */
inline int compare2level(const QVector3D &vertex, double level) const ; inline int compare2level(const QVector3D &vertex, float level) const ;
/** \brief calcContourLines calculates the contour lines using the CONREC algorithm */ /** \brief calcContourLines calculates the contour lines using the CONREC algorithm */
void calcContourLines(QList<QVector<QLineF > > &ContourLines); void calcContourLines(QList<QVector<QLineF > > &ContourLines);
/** \brief For Caching: the contour lines as vector of single lines (one for each triangle). the list index refers to the contour level. /** \brief For Caching: the contour lines as vector of single lines (one for each triangle). the list index refers to the contour level.
@ -445,12 +445,14 @@ QPointF JKQTPContourPlot::interpolatePoint(const QVector3D &point1, const QVecto
} }
//////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////
int JKQTPContourPlot::compare2level(const QVector3D &vertex, double level) const { int JKQTPContourPlot::compare2level(const QVector3D &vertex, float level) const {
if (vertex.z() > level) if (vertex.z() > level) {
return 1; return 1;
}
if (vertex.z() < level) if (vertex.z() < level) {
return -1; return -1;
}
return 0; return 0;
} }

View File

@ -41,6 +41,7 @@ JKQTPSingleColumnSymbolsGraph::JKQTPSingleColumnSymbolsGraph(JKQTBasePlotter *pa
parentPlotStyle=-1; parentPlotStyle=-1;
dataDirection=DataDirection::Y; dataDirection=DataDirection::Y;
position=0; position=0;
width=1;
initSymbolStyle(parent, parentPlotStyle); initSymbolStyle(parent, parentPlotStyle);
} }
@ -56,8 +57,11 @@ JKQTPSingleColumnSymbolsGraph::JKQTPSingleColumnSymbolsGraph(JKQTPlotter *parent
bool JKQTPSingleColumnSymbolsGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero) bool JKQTPSingleColumnSymbolsGraph::getXMinMax(double &minx, double &maxx, double &smallestGreaterZero)
{ {
//std::cout<<"JKQTPSingleColumnSymbolsGraph::getXMinMax(minx="<<minx<<", maxx="<<maxx<<", smallestGreaterZero="<<smallestGreaterZero<<")\n";
if (dataDirection==DataDirection::X) { if (dataDirection==DataDirection::X) {
return getDataMinMax(dataColumn, minx, maxx, smallestGreaterZero); bool res= getDataMinMax(dataColumn, minx, maxx, smallestGreaterZero);
//std::cout<<"JKQTPSingleColumnSymbolsGraph::getXMinMax(minx="<<minx<<", maxx="<<maxx<<", smallestGreaterZero="<<smallestGreaterZero<<"): dataDirection==DataDirection::X -->"<<std::boolalpha<<res<<"\n";
return res;
} else { } else {
minx=position; minx=position;
maxx=position; maxx=position;
@ -65,6 +69,7 @@ bool JKQTPSingleColumnSymbolsGraph::getXMinMax(double &minx, double &maxx, doubl
minx=position-width/2; minx=position-width/2;
maxx=position+width/2; maxx=position+width/2;
} }
///std::cout<<"JKQTPSingleColumnSymbolsGraph::getXMinMax(minx="<<minx<<", maxx="<<maxx<<", smallestGreaterZero="<<smallestGreaterZero<<"): dataDirection!=DataDirection::X -->"<<std::boolalpha<<true<<"\n";
return true; return true;
//smallestGreaterZero=qMax(double(0.0), qMin(baseline, baseline+peakHeight)); //smallestGreaterZero=qMax(double(0.0), qMin(baseline, baseline+peakHeight));
} }
@ -72,8 +77,11 @@ bool JKQTPSingleColumnSymbolsGraph::getXMinMax(double &minx, double &maxx, doubl
bool JKQTPSingleColumnSymbolsGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero) bool JKQTPSingleColumnSymbolsGraph::getYMinMax(double &miny, double &maxy, double &smallestGreaterZero)
{ {
//std::cout<<"JKQTPSingleColumnSymbolsGraph::getYMinMax(miny="<<miny<<", maxy="<<maxy<<", smallestGreaterZero="<<smallestGreaterZero<<")\n";
if (dataDirection==DataDirection::Y) { if (dataDirection==DataDirection::Y) {
return getDataMinMax(dataColumn, miny, maxy, smallestGreaterZero); bool res= getDataMinMax(dataColumn, miny, maxy, smallestGreaterZero);
//std::cout<<"JKQTPSingleColumnSymbolsGraph::getYMinMax(miny="<<miny<<", maxy="<<maxy<<", smallestGreaterZero="<<smallestGreaterZero<<"): dataDirection!=DataDirection::Y -->"<<std::boolalpha<<res<<"\n";
return res;
} else { } else {
miny=position; miny=position;
maxy=position; maxy=position;
@ -81,6 +89,7 @@ bool JKQTPSingleColumnSymbolsGraph::getYMinMax(double &miny, double &maxy, doubl
miny=position-width/2; miny=position-width/2;
maxy=position+width/2; maxy=position+width/2;
} }
//std::cout<<"JKQTPSingleColumnSymbolsGraph::getYMinMax(miny="<<miny<<", maxy="<<maxy<<", smallestGreaterZero="<<smallestGreaterZero<<"): dataDirection!=DataDirection::Y -->"<<std::boolalpha<<true<<" position="<<position<<", width="<<width<<"\n";
return true; return true;
//smallestGreaterZero=qMax(double(0.0), qMin(baseline, baseline+peakHeight)); //smallestGreaterZero=qMax(double(0.0), qMin(baseline, baseline+peakHeight));
} }

View File

@ -1752,9 +1752,9 @@ inline JKQTPColumnContourPlot* jkqtpstatAddKDE2DContour(JKQTBasePlotter* plotter
*/ */
template <class InputItX, class InputItY> template <class InputItX, class InputItY>
inline JKQTPXFunctionLineGraph* jkqtpstatAddLinearRegression(JKQTBasePlotter* plotter, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false) { inline JKQTPXFunctionLineGraph* jkqtpstatAddLinearRegression(JKQTBasePlotter* plotter, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false) {
double cA; double cA=0;
if (coeffA) cA=*coeffA; if (coeffA) cA=*coeffA;
double cB; double cB=0;
if (coeffB) cB=*coeffB; if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided"); JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@ -1828,9 +1828,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph* jkqtpstatAddLinearRegression(JKQTPXYGr
*/ */
template <class InputItX, class InputItY> template <class InputItX, class InputItY>
inline JKQTPXFunctionLineGraph* jkqtpstatAddRobustIRLSLinearRegression(JKQTBasePlotter* plotter, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, double p=1.1, int iterations=100) { inline JKQTPXFunctionLineGraph* jkqtpstatAddRobustIRLSLinearRegression(JKQTBasePlotter* plotter, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, double p=1.1, int iterations=100) {
double cA; double cA=0;
if (coeffA) cA=*coeffA; if (coeffA) cA=*coeffA;
double cB; double cB=0;
if (coeffB) cB=*coeffB; if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided"); JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@ -1916,9 +1916,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph *jkqtpstatAddRobustIRLSLinearRegression
*/ */
template <class InputItX, class InputItY, class InputItW> template <class InputItX, class InputItY, class InputItW>
inline JKQTPXFunctionLineGraph* jkqtpstatAddLinearWeightedRegression(JKQTBasePlotter* plotter, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, InputItW firstW, InputItW lastW, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, std::function<double(double)> fWeightDataToWi=&jkqtp_identity<double>) { inline JKQTPXFunctionLineGraph* jkqtpstatAddLinearWeightedRegression(JKQTBasePlotter* plotter, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, InputItW firstW, InputItW lastW, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, std::function<double(double)> fWeightDataToWi=&jkqtp_identity<double>) {
double cA; double cA=0;
if (coeffA) cA=*coeffA; if (coeffA) cA=*coeffA;
double cB; double cB=0;
if (coeffB) cB=*coeffB; if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided"); JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@ -2002,9 +2002,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph* jkqtpstatAddLinearWeightedRegression(J
*/ */
template <class InputItX, class InputItY> template <class InputItX, class InputItY>
inline JKQTPXFunctionLineGraph* jkqtpstatAddRegression(JKQTBasePlotter* plotter, JKQTPStatRegressionModelType type, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false) { inline JKQTPXFunctionLineGraph* jkqtpstatAddRegression(JKQTBasePlotter* plotter, JKQTPStatRegressionModelType type, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false) {
double cA; double cA=0;
if (coeffA) cA=*coeffA; if (coeffA) cA=*coeffA;
double cB; double cB=0;
if (coeffB) cB=*coeffB; if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided"); JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@ -2078,9 +2078,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph* jkqtpstatAddRegression(JKQTPXYGraph *d
*/ */
template <class InputItX, class InputItY> template <class InputItX, class InputItY>
inline JKQTPXFunctionLineGraph* jkqtpstatAddRobustIRLSRegression(JKQTBasePlotter* plotter, JKQTPStatRegressionModelType type, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, double p=1.1, int iterations=100) { inline JKQTPXFunctionLineGraph* jkqtpstatAddRobustIRLSRegression(JKQTBasePlotter* plotter, JKQTPStatRegressionModelType type, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, double p=1.1, int iterations=100) {
double cA; double cA=0;
if (coeffA) cA=*coeffA; if (coeffA) cA=*coeffA;
double cB; double cB=0;
if (coeffB) cB=*coeffB; if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided"); JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");
@ -2168,9 +2168,9 @@ JKQTP_LIB_EXPORT JKQTPXFunctionLineGraph *jkqtpstatAddRobustIRLSRegression(JKQTP
*/ */
template <class InputItX, class InputItY, class InputItW> template <class InputItX, class InputItY, class InputItW>
inline JKQTPXFunctionLineGraph* jkqtpstatAddWeightedRegression(JKQTBasePlotter* plotter, JKQTPStatRegressionModelType type, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, InputItW firstW, InputItW lastW, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, std::function<double(double)> fWeightDataToWi=&jkqtp_identity<double>) { inline JKQTPXFunctionLineGraph* jkqtpstatAddWeightedRegression(JKQTBasePlotter* plotter, JKQTPStatRegressionModelType type, InputItX firstX, InputItX lastX, InputItY firstY, InputItY lastY, InputItW firstW, InputItW lastW, double* coeffA=nullptr, double* coeffB=nullptr, bool fixA=false, bool fixB=false, std::function<double(double)> fWeightDataToWi=&jkqtp_identity<double>) {
double cA; double cA=0;
if (coeffA) cA=*coeffA; if (coeffA) cA=*coeffA;
double cB; double cB=0;
if (coeffB) cB=*coeffB; if (coeffB) cB=*coeffB;
JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided"); JKQTPASSERT_M(!fixA || (fixA && coeffA!=nullptr), "if fixA=true, coeffA needs to be provided");

File diff suppressed because it is too large Load Diff

View File

@ -948,135 +948,6 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
} }
} }
/** \brief add a new graph, returns it's position in the graphs list.
*
* \param xColumn the column which contains the x-values of the datapoints
* \param yColumn the column which contains the y-values of the datapoints
* \param title a title for this specific graph which can be displayed in the key
* \param graphStyle the way how to plot the graph
*
* Both point to columns in the datastore explained in the JKQTBasePlotter class. The plotWidth, color, pen style ...
* will be extracted from the automatic plot style creation mechanism implemented in JKQTBasePlotter::getNextStyle().
* If you want to change them either use another overloaded version of addGraph(), or use getGraph() and setGraph():
* \code
* size_t i=addGraph(0,1,"graph1");
* JKQTPPlotElement gr=getGraph(i);
* gr.color=QColor("red");
* setGraph(i, gr);
* \endcode
*/
size_t addGraph(size_t xColumn, size_t yColumn, const QString& title, JKQTPGraphPlotstyle graphStyle=JKQTPLines);
/** \brief add a new graph, returns it's position in the graphs list.
*
* \param xColumn the column which contains the x-values of the datapoints
* \param yColumn the column which contains the y-values of the datapoints
* \param title a title for this specific graph which can be displayed in the key
* \param graphStyle the way how to plot the graph
* \param symbol a symbol to use for the datapoints in some plot styles
* \param color the color of the graph
* \param width width (in pixel) of the graph
* \param penstyle the drawing style (solid, dashed ...) of the graph lines.
*
* Both point to columns in the datastore explained in the JKQTBasePlotter class.
* The symbolSize is set to 10 and no error information is expected.
*/
size_t addGraph(size_t xColumn, size_t yColumn, const QString& title, JKQTPGraphPlotstyle graphStyle, QColor color, JKQTPGraphSymbols symbol=JKQTPCross, Qt::PenStyle penstyle=Qt::SolidLine, double width=2);
/** \brief add a new graph with x-error information, returns it's position in the graphs list.
*
*
* \param xColumn the column which contains the x-values of the datapoints
* \param yColumn the column which contains the y-values of the datapoints
* \param xErrorColumn the column which contains the x-value errors of the datapoints
* \param title a title for this specific graph which can be displayed in the key
* \param graphStyle the way how to plot the graph
* \param errorStyle the drawing style (bars, lines ...) of the errors.
*
* Both point to columns in the datastore explained in the JKQTBasePlotter class.
* The symbolSize is set to 10 and no error information is expected.
*/
size_t addGraphWithXError(size_t xColumn, size_t yColumn, size_t xErrorColumn, const QString& title, JKQTPGraphPlotstyle graphStyle=JKQTPPoints, JKQTPErrorPlotstyle errorStyle=JKQTPErrorBars);
/** \brief add a new graph with x-error information, returns it's position in the graphs list.
*
*
* \param xColumn the column which contains the x-values of the datapoints
* \param yColumn the column which contains the y-values of the datapoints
* \param yErrorColumn the column which contains the y-value errors of the datapoints
* \param title a title for this specific graph which can be displayed in the key
* \param graphStyle the way how to plot the graph
* \param errorStyle the drawing style (bars, lines ...) of the errors.
*
* Both point to columns in the datastore explained in the JKQTBasePlotter class.
* The symbolSize is set to 10 and no error information is expected.
*/
size_t addGraphWithYError(size_t xColumn, size_t yColumn, size_t yErrorColumn, const QString& title, JKQTPGraphPlotstyle graphStyle=JKQTPPoints, JKQTPErrorPlotstyle errorStyle=JKQTPErrorBars);
/** \brief add a new graph with x-error information, returns it's position in the graphs list.
*
*
* \param xColumn the column which contains the x-values of the datapoints
* \param yColumn the column which contains the y-values of the datapoints
* \param xErrorColumn the column which contains the x-value errors of the datapoints
* \param yErrorColumn the column which contains the y-value errors of the datapoints
* \param title a title for this specific graph which can be displayed in the key
* \param graphStyle the way how to plot the graph
*
* Both point to columns in the datastore explained in the JKQTBasePlotter class.
* The symbolSize is set to 10 and no error information is expected. The errorStyle is set to JKQTPErrorBars
* for both directions.
*/
size_t addGraphWithXYError(size_t xColumn, size_t yColumn, size_t xErrorColumn, size_t yErrorColumn, const QString& title, JKQTPGraphPlotstyle graphStyle=JKQTPPoints);
/** \brief add a boxplot graph to the plot
*
* \param title title of the plot
* \param posColumn column containing the positions
* \param medianColumn column containing the median values
* \param minColumn column containing the minimum values
* \param maxColumn column containing the maximum values
* \param percentile25Column column containing the 25% percentiles
* \param percentile75Column column containing the 75% percentiles
* \param meanColumn column containing the mean value (this column is optional. If you don't want a mean symbol, set this to -1
*/
size_t addHorizontalBoxplot(QString title, int posColumn, int medianColumn, int minColumn, int maxColumn, int percentile25Column, int percentile75Column, int meanColumn=-1);
/** \brief add a boxplot graph to the plot
*
* \param title title of the plot
* \param posColumn column containing the positions
* \param medianColumn column containing the median values
* \param minColumn column containing the minimum values
* \param maxColumn column containing the maximum values
* \param percentile25Column column containing the 25% percentiles
* \param percentile75Column column containing the 75% percentiles
* \param meanColumn column containing the mean value (this column is optional. If you don't want a mean symbol, set this to -1
*/
size_t addVerticalBoxplot(QString title, int posColumn, int medianColumn, int minColumn, int maxColumn, int percentile25Column, int percentile75Column, int meanColumn=-1);
/** \brief add one bargraph for each of the given set of \f$ f(x) \f$ -values which all use one column of x-values
*
* \param xColumn column with the x-values, which are common to all bargraphs
* \param yColumns columns for the y-values
* \param titles titles of the plot
*
* Here is an example output:
* \image html plot_bargraphhorplot.png
*/
void addHorizontalBargraph(size_t xColumn, QVector<size_t> yColumns, QStringList titles);
/** \brief add a bargraph for the given set of \f$ f(x) \f$ -values for one column of x-values
*
* \param xColumns columns with the x-values
* \param yColumn column for the y-values, which are common to all bargraphs
* \param titles titles of the plot
*
* Here is an example output:
* \image html plot_bargraphhorplot.png
*/
void addVerticalBargraph(QVector<size_t> xColumns, size_t yColumn, QStringList titles);
/** \brief get the maximum and minimum x-value over all graphs in the plot /** \brief get the maximum and minimum x-value over all graphs in the plot
* \param[out] minx smallest x value * \param[out] minx smallest x value
* \param[out] maxx largest x value * \param[out] maxx largest x value
@ -1738,7 +1609,7 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
/*! \copydoc JKQTBasePlotterStyle::defaultTextColor */ /*! \copydoc JKQTBasePlotterStyle::defaultTextColor */
void setDefaultTextColor(QColor __value) ; void setDefaultTextColor(QColor __value) ;
/*! \copydoc JKQTBasePlotterStyle::defaultFontSize */ /*! \copydoc JKQTBasePlotterStyle::defaultFontSize */
void setDefaultTextSize(float __value) ; void setDefaultTextSize(double __value) ;
/*! \copydoc JKQTBasePlotterStyle::defaultFontName */ /*! \copydoc JKQTBasePlotterStyle::defaultFontName */
void setDefaultTextFontName(const QString& __value) ; void setDefaultTextFontName(const QString& __value) ;
/** \brief sets the current directory in which to open SaveAs ... dialogs */ /** \brief sets the current directory in which to open SaveAs ... dialogs */
@ -2001,9 +1872,9 @@ class JKQTP_LIB_EXPORT JKQTBasePlotter: public QObject {
/** \brief list that manages all the additional graphs for \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" mode */ /** \brief list that manages all the additional graphs for \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" mode */
QList<JKQTPGridPrintingItem> gridPrintingList; QList<JKQTPGridPrintingItem> gridPrintingList;
/** \brief this list contains all the rows of the current \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" and stores its heights */ /** \brief this list contains all the rows of the current \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" and stores its heights */
QList<int> gridPrintingRows; QList<size_t> gridPrintingRows;
/** \brief this list contains all the columns of the current \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" and stores its widths */ /** \brief this list contains all the columns of the current \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" and stores its widths */
QList<int> gridPrintingColumns; QList<size_t> gridPrintingColumns;
/** \brief size of all plots in \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" mode, filled by gridPrintingCalc() */ /** \brief size of all plots in \ref JKQTBASEPLOTTER_SYNCMULTIPLOT_GRIDPRINT "grid printing" mode, filled by gridPrintingCalc() */
QSizeF gridPrintingSize; QSizeF gridPrintingSize;

View File

@ -34,6 +34,7 @@ JKQTBasePlotterStyle::JKQTBasePlotterStyle():
graphFillColorDerivationMode(JKQTPFFCMLighterColor), graphFillColorDerivationMode(JKQTPFFCMLighterColor),
graphErrorColorDerivationMode(JKQTPFFCMDarkerColor), graphErrorColorDerivationMode(JKQTPFFCMDarkerColor),
graphErrorFillColorDerivationMode(JKQTPFFCMEvenLighterColor), graphErrorFillColorDerivationMode(JKQTPFFCMEvenLighterColor),
defaultGraphColors(), defaultGraphPenStyles(), defaultGraphSymbols(), defaultGraphFillStyles(),
keyStyle(*this), keyStyle(*this),
xAxisStyle(*this), xAxisStyle(*this),
yAxisStyle(*this), yAxisStyle(*this),

View File

@ -29,44 +29,40 @@
//#undef SHOW_JKQTPLOTTER_DEBUG //#undef SHOW_JKQTPLOTTER_DEBUG
//#define SHOW_JKQTPLOTTER_DEBUG //#define SHOW_JKQTPLOTTER_DEBUG
JKQTPCoordinateAxis::JKQTPCoordinateAxis(JKQTBasePlotter* parent): JKQTPCoordinateAxis::JKQTPCoordinateAxis(JKQTBasePlotter* _parent):
QObject(parent) QObject(_parent),
paramsChanged(true),
doUpdateScaling(true),
tickLabels(),
parent(_parent),
axismin(-10),
axismax(10),
axisabsoultemin(-DBL_MAX/100.),
axisabsoultemax(DBL_MAX/100.0),
axisStyle(),
axisMinWidth(-1),
width(20),
scale(0),
offset(0),
inverted(false),
tickStart(1),
autoAxisSpacing(true),
logAxis(false),
logAxisBase(10),
userTickSpacing(1),
userLogTickSpacing(10),
tickSpacing(0),
tickSpacingLog(10),
axisLabel(),
axisPrefix(),
scaleSign(1)
{ {
this->parent=parent;
axisPrefix="";
scaleSign=1;
doUpdateScaling=true;
axismin=-10;
axismax=10;
axisabsoultemin=-DBL_MAX/100.0;
axisabsoultemax=DBL_MAX/100.0;
axisMinWidth=-1;
width=20;
scale=0;
offset=0;
inverted=false;
tickSpacing=0;
tickSpacingLog=10;
tickStart=0;
autoAxisSpacing=true;
logAxis=false;
logAxisBase=10;
userTickSpacing=1;
userLogTickSpacing=10;
axisLabel="";
paramsChanged=true;
} }
JKQTPCoordinateAxis::~JKQTPCoordinateAxis() = default; JKQTPCoordinateAxis::~JKQTPCoordinateAxis() {
}
void JKQTPCoordinateAxis::setParent(JKQTBasePlotter* parent) { void JKQTPCoordinateAxis::setParent(JKQTBasePlotter* parent) {
this->parent=parent; this->parent=parent;
@ -1617,14 +1613,14 @@ void JKQTPVerticalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
JKQTPVerticalIndependentAxis::JKQTPVerticalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter* parent): JKQTPVerticalIndependentAxis::JKQTPVerticalIndependentAxis(double _axisOffset, double _axisWidth, double _otherAxisOffset, double _otherAxisWidth, JKQTBasePlotter* parent):
JKQTPVerticalAxis(parent) JKQTPVerticalAxis(parent),
axisOffset(_axisOffset),
axisWidth(_axisWidth),
otherAxisWidth(_otherAxisOffset),
otherAxisOffset(_otherAxisWidth),
otherAxisInverted(false)
{ {
this->axisOffset=axisOffset;
this->axisWidth=axisWidth;
this->otherAxisOffset=otherAxisOffset;
this->otherAxisWidth=otherAxisWidth;
this->otherAxisInverted=false;
if (parent) { if (parent) {
axisStyle=parent->getCurrentPlotterStyle().rightColorbarAxisStyle; axisStyle=parent->getCurrentPlotterStyle().rightColorbarAxisStyle;
} else { } else {
@ -1716,7 +1712,7 @@ QSizeF JKQTPHorizontalAxis::getSize1(JKQTPEnhancedPainter& painter) {
if (JKQTPCADrawModeHasTickLabels(axisStyle.drawMode1)) { if (JKQTPCADrawModeHasTickLabels(axisStyle.drawMode1)) {
ptwidth+=axisStyle.labelDistance; ptwidth+=axisStyle.labelDistance;
// find out size of axis label // find out size of axis label
labwidth+=parent->getTextSizeSize(getParent()->getCurrentPlotterStyle().defaultFontName, axisStyle.labelFontSize*parent->getFontSizeMultiplier(), axisLabel, painter).width(); labwidth+=parent->getTextSizeSize(getParent()->getCurrentPlotterStyle().defaultFontName, axisStyle.labelFontSize*parent->getFontSizeMultiplier(), axisLabel, painter).height();
} }
return QSizeF(getParentPlotWidth(), parent->pt2px(painter, ptwidth)+labwidth); return QSizeF(getParentPlotWidth(), parent->pt2px(painter, ptwidth)+labwidth);
@ -1735,7 +1731,7 @@ QSizeF JKQTPHorizontalAxis::getSize2(JKQTPEnhancedPainter& painter) {
if (JKQTPCADrawModeHasTickLabels(axisStyle.drawMode2)) { if (JKQTPCADrawModeHasTickLabels(axisStyle.drawMode2)) {
ptwidth+=axisStyle.labelDistance; ptwidth+=axisStyle.labelDistance;
// find out size of axis label // find out size of axis label
labwidth+=parent->getTextSizeSize(getParent()->getCurrentPlotterStyle().defaultFontName, axisStyle.labelFontSize*parent->getFontSizeMultiplier(), axisLabel, painter).width(); labwidth+=parent->getTextSizeSize(getParent()->getCurrentPlotterStyle().defaultFontName, axisStyle.labelFontSize*parent->getFontSizeMultiplier(), axisLabel, painter).height();
} }
return QSizeF(getParentPlotWidth(), parent->pt2px(painter, ptwidth)+labwidth); return QSizeF(getParentPlotWidth(), parent->pt2px(painter, ptwidth)+labwidth);
@ -2198,14 +2194,14 @@ void JKQTPHorizontalAxis::drawAxes(JKQTPEnhancedPainter& painter) {
JKQTPHorizontalIndependentAxis::JKQTPHorizontalIndependentAxis(double axisOffset, double axisWidth, double otherAxisOffset, double otherAxisWidth, JKQTBasePlotter* parent): JKQTPHorizontalIndependentAxis::JKQTPHorizontalIndependentAxis(double _axisOffset, double _axisWidth, double _otherAxisOffset, double _otherAxisWidth, JKQTBasePlotter* parent):
JKQTPHorizontalAxis(parent) JKQTPHorizontalAxis(parent),
axisOffset(_axisOffset),
axisWidth(_axisWidth),
otherAxisWidth(_otherAxisOffset),
otherAxisOffset(_otherAxisWidth),
otherAxisInverted(false)
{ {
this->axisOffset=axisOffset;
this->axisWidth=axisWidth;
this->otherAxisOffset=otherAxisOffset;
this->otherAxisWidth=otherAxisWidth;
this->otherAxisInverted=false;
if (parent) { if (parent) {
axisStyle=parent->getCurrentPlotterStyle().topColorbarAxisStyle; axisStyle=parent->getCurrentPlotterStyle().topColorbarAxisStyle;
} else { } else {

View File

@ -1579,6 +1579,7 @@ class JKQTP_LIB_EXPORT JKQTPColumn {
}; };
#pragma pack(push,1)
/** \brief iterator over the data in the column of a JKQTPDatastore /** \brief iterator over the data in the column of a JKQTPDatastore
* \ingroup jkqtpdatastorage * \ingroup jkqtpdatastorage
* *
@ -2245,7 +2246,7 @@ class JKQTP_LIB_EXPORT JKQTPDatastoreItem {
inline void erase(size_t row) { inline void erase(size_t row) {
JKQTPASSERT(isVector()); JKQTPASSERT(isVector());
datavec.erase(datavec.begin()+row, datavec.end()); datavec.erase(datavec.begin()+row, datavec.end());
rows=static_cast<int>(datavec.size()); rows=static_cast<size_t>(datavec.size());
data=datavec.data(); data=datavec.data();
} }
/** \brief if \c isValid() : erase all rows (and including) from \a row to \a rowEnd */ /** \brief if \c isValid() : erase all rows (and including) from \a row to \a rowEnd */
@ -2256,7 +2257,7 @@ class JKQTP_LIB_EXPORT JKQTPDatastoreItem {
JKQTPASSERT(isVector()); JKQTPASSERT(isVector());
if (rowEnd>=static_cast<size_t>(datavec.size())) datavec.erase(datavec.begin()+row, datavec.end()); if (rowEnd>=static_cast<size_t>(datavec.size())) datavec.erase(datavec.begin()+row, datavec.end());
else datavec.erase(datavec.begin()+row, datavec.begin()+rowEnd); else datavec.erase(datavec.begin()+row, datavec.begin()+rowEnd);
rows=static_cast<int>(datavec.size()); rows=static_cast<size_t>(datavec.size());
data=datavec.data(); data=datavec.data();
} }
} }
@ -2397,6 +2398,7 @@ class JKQTP_LIB_EXPORT JKQTPDatastoreItem {
return false; return false;
} }
}; };
#pragma pack(pop)
/** \brief QAbstractTableModel descendent that allows to view data in a JKQTPDatastore /** \brief QAbstractTableModel descendent that allows to view data in a JKQTPDatastore

View File

@ -43,25 +43,37 @@
**************************************************************************************************************************/ **************************************************************************************************************************/
JKQTPlotter::JKQTPlotter(bool datastore_internal, QWidget* parent, JKQTPDatastore* datast): JKQTPlotter::JKQTPlotter(bool datastore_internal, QWidget* parent, JKQTPDatastore* datast):
QWidget(parent, Qt::Widget), QWidget(parent, Qt::Widget),
plotterStyle(JKQTPGetSystemDefaultStyle()) currentMouseDragAction(),
doDrawing(false),
plotter(nullptr),
mouseDragingRectangle(false),
mouseDragRectXStart(0), mouseDragRectXStartPixel(0), mouseDragRectXEndPixel(0),
mouseDragRectYEndPixel(0), mouseDragRectXEnd(0), mouseDragRectYStart(0),
mouseDragRectYStartPixel(0), mouseDragRectYEnd(0),
mouseDragMarkers(),
image(), imageNoOverlays(), oldImage(),
menuSpecialContextMenu(nullptr),toolbar(nullptr), masterPlotterX(nullptr), masterPlotterY(nullptr),
mousePosX(0), mousePosY(0),
magnification(1),
minSize(),
contextMenu(nullptr),
contextMenuMode(JKQTPContextMenuModes::jkqtpcmmStandardContextMenu),
mouseContextX(0), mouseContextY(0), mouseLastClickX(0), mouseLastClickY(0),
contextSubMenus(),
plotterStyle(JKQTPGetSystemDefaultStyle()),
resizeTimer(), registeredOverrideMouseDragActionModes(),
actgrpMouseLeft(nullptr), actMouseLeftAsDefault(nullptr), actMouseLeftAsRuler(nullptr), actMouseLeftAsToolTip(nullptr), actMouseLeftAsZoomRect(nullptr), actMouseLeftAsPanView(nullptr)
{ {
initJKQTPlotterResources(); initJKQTPlotterResources();
menuSpecialContextMenu=nullptr;
mouseContextX=0;
mouseContextY=0;
setParent(parent); setParent(parent);
connect(&resizeTimer, SIGNAL(timeout()), this, SLOT(delayedResizeEvent())); connect(&resizeTimer, SIGNAL(timeout()), this, SLOT(delayedResizeEvent()));
doDrawing=false;
magnification=1;
plotter=new JKQTBasePlotter(datastore_internal, this, datast); plotter=new JKQTBasePlotter(datastore_internal, this, datast);
plotter->setEmittingSignalsEnabled(false); plotter->setEmittingSignalsEnabled(false);
fixBasePlotterSettings(); fixBasePlotterSettings();
mousePosX=0;
mousePosY=0;
connect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot())); connect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot()));
connect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays())); connect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays()));
connect(plotter, SIGNAL(beforePlotScalingRecalculate()), this, SLOT(intBeforePlotScalingRecalculate())); connect(plotter, SIGNAL(beforePlotScalingRecalculate()), this, SLOT(intBeforePlotScalingRecalculate()));
@ -70,10 +82,6 @@ JKQTPlotter::JKQTPlotter(bool datastore_internal, QWidget* parent, JKQTPDatastor
image=QImage(width(), height(), QImage::Format_ARGB32); image=QImage(width(), height(), QImage::Format_ARGB32);
oldImage=image; oldImage=image;
imageNoOverlays=image; imageNoOverlays=image;
mouseDragingRectangle=false;
// set default user-interactions:
contextMenuMode=JKQTPContextMenuModes::jkqtpcmmStandardContextMenu;
// enable mouse-tracking, so mouseMoved-Events can be caught // enable mouse-tracking, so mouseMoved-Events can be caught
setMouseTracking(true); setMouseTracking(true);
@ -334,17 +342,23 @@ JKQTPUserActionMarkerType JKQTPlotter::getUserActionMarkerType() const
void JKQTPlotter::registerMouseWheelAction(Qt::KeyboardModifiers modifier, JKQTPMouseWheelActions action) void JKQTPlotter::registerMouseWheelAction(Qt::KeyboardModifiers modifier, JKQTPMouseWheelActions action)
{ {
qDebug()<<"registerMouseWheelAction("<<modifier<<","<<action<<"): "<<plotterStyle.registeredMouseWheelActions;
plotterStyle.registeredMouseWheelActions[modifier]=action; plotterStyle.registeredMouseWheelActions[modifier]=action;
qDebug()<<"registerMouseWheelAction("<<modifier<<","<<action<<"): "<<plotterStyle.registeredMouseWheelActions;
} }
void JKQTPlotter::deregisterMouseWheelAction(Qt::KeyboardModifiers modifier) void JKQTPlotter::deregisterMouseWheelAction(Qt::KeyboardModifiers modifier)
{ {
qDebug()<<"deregisterMouseWheelAction("<<modifier<<"): "<<plotterStyle.registeredMouseWheelActions;
plotterStyle.registeredMouseWheelActions.remove(modifier); plotterStyle.registeredMouseWheelActions.remove(modifier);
qDebug()<<"deregisterMouseWheelAction("<<modifier<<"): "<<plotterStyle.registeredMouseWheelActions;
} }
void JKQTPlotter::clearAllMouseWheelActions() void JKQTPlotter::clearAllMouseWheelActions()
{ {
qDebug()<<"clearAllMouseWheelActions(): "<<plotterStyle.registeredMouseWheelActions;
plotterStyle.registeredMouseWheelActions.clear(); plotterStyle.registeredMouseWheelActions.clear();
qDebug()<<"clearAllMouseWheelActions(): "<<plotterStyle.registeredMouseWheelActions;
} }
@ -472,7 +486,7 @@ void JKQTPlotter::paintUserAction() {
painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, true); painter.setRenderHint(JKQTPEnhancedPainter::Antialiasing, true);
painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, true); painter.setRenderHint(JKQTPEnhancedPainter::TextAntialiasing, true);
painter.setPen(plotterStyle.userActionOverlayPen); painter.setPen(plotterStyle.userActionOverlayPen);
if ((mouseDragRectXEnd!=mouseDragRectXStart) && (mouseDragRectYEnd!=mouseDragRectYStart)) { if (jkqtp_approximatelyUnequal(mouseDragRectXEnd,mouseDragRectXStart) && jkqtp_approximatelyUnequal(mouseDragRectYEnd,mouseDragRectYStart)) {
double x1=plotter->x2p(mouseDragRectXStart)*magnification; double x1=plotter->x2p(mouseDragRectXStart)*magnification;
double y1=plotter->y2p(mouseDragRectYStart)*magnification; double y1=plotter->y2p(mouseDragRectYStart)*magnification;
double x2=plotter->x2p(mouseDragRectXEnd)*magnification; double x2=plotter->x2p(mouseDragRectXEnd)*magnification;
@ -708,10 +722,10 @@ void JKQTPlotter::mouseMoveEvent ( QMouseEvent * event ) {
if (currentMouseDragAction.mode==jkqtpmdaZoomByRectangle) { if (currentMouseDragAction.mode==jkqtpmdaZoomByRectangle) {
emit plotNewZoomRectangle(mouseDragRectXStart, mouseDragRectXEnd, mouseDragRectYStart, mouseDragRectYEnd, event->modifiers()); emit plotNewZoomRectangle(mouseDragRectXStart, mouseDragRectXEnd, mouseDragRectYStart, mouseDragRectYEnd, event->modifiers());
} }
if ((currentMouseDragAction.mode==jkqtpmdaScribbleForEvents) && ((mouseDragRectXStart!=mouseDragRectXEnd) || (mouseDragRectYStart!=mouseDragRectYEnd)) ) { if ((currentMouseDragAction.mode==jkqtpmdaScribbleForEvents) && (jkqtp_approximatelyUnequal(mouseDragRectXStart,mouseDragRectXEnd) || jkqtp_approximatelyUnequal(mouseDragRectYStart,mouseDragRectYEnd)) ) {
emit userScribbleClick(mouseDragRectXEnd, mouseDragRectYEnd, event->modifiers(), false, false); emit userScribbleClick(mouseDragRectXEnd, mouseDragRectYEnd, event->modifiers(), false, false);
} }
if ((currentMouseDragAction.mode==jkqtpmdaPanPlotOnMove) && ((mouseDragRectXStart!=mouseDragRectXEnd) || (mouseDragRectYStart!=mouseDragRectYEnd)) ) { if ((currentMouseDragAction.mode==jkqtpmdaPanPlotOnMove) && (jkqtp_approximatelyUnequal(mouseDragRectXStart,mouseDragRectXEnd) || jkqtp_approximatelyUnequal(mouseDragRectYStart,mouseDragRectYEnd)) ) {
QRectF zoomRect= QRectF(QPointF(plotter->x2p(getXAxis()->getMin()),plotter->y2p(getYAxis()->getMax())), QPointF(plotter->x2p(getXAxis()->getMax()),plotter->y2p(getYAxis()->getMin()))); QRectF zoomRect= QRectF(QPointF(plotter->x2p(getXAxis()->getMin()),plotter->y2p(getYAxis()->getMax())), QPointF(plotter->x2p(getXAxis()->getMax()),plotter->y2p(getYAxis()->getMin())));
if ( (mouseLastClickX/magnification<plotter->getInternalPlotBorderLeft()) || (mouseLastClickX/magnification>plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) ) { if ( (mouseLastClickX/magnification<plotter->getInternalPlotBorderLeft()) || (mouseLastClickX/magnification>plotter->getPlotWidth()+plotter->getInternalPlotBorderLeft()) ) {
zoomRect.translate(0, mouseDragRectYStartPixel-mouseDragRectYEndPixel); zoomRect.translate(0, mouseDragRectYStartPixel-mouseDragRectYEndPixel);
@ -797,7 +811,7 @@ void JKQTPlotter::mouseReleaseEvent ( QMouseEvent * event ){
double x2=mouseDragRectXEnd; double x2=mouseDragRectXEnd;
double y2=mouseDragRectYEnd; double y2=mouseDragRectYEnd;
if ((mouseDragRectXStart!=mouseDragRectXEnd) && (mouseDragRectYStart!=mouseDragRectYEnd)) { if (jkqtp_approximatelyUnequal(mouseDragRectXStart,mouseDragRectXEnd) && jkqtp_approximatelyUnequal(mouseDragRectYStart,mouseDragRectYEnd)) {
if (currentMouseDragAction.mode==jkqtpmdaZoomByRectangle) { if (currentMouseDragAction.mode==jkqtpmdaZoomByRectangle) {
double xmin=mouseDragRectXStart; double xmin=mouseDragRectXStart;
double xmax=mouseDragRectXEnd; double xmax=mouseDragRectXEnd;
@ -913,11 +927,15 @@ void JKQTPlotter::keyReleaseEvent(QKeyEvent *event) {
} }
void JKQTPlotter::wheelEvent ( QWheelEvent * event ) { void JKQTPlotter::wheelEvent ( QWheelEvent * event ) {
//qDebug()<<"wheelEvent()"; //qDebug()<<"wheelEvent("<<event->modifiers()<<"): plotterStyle.registeredMouseWheelActions="<<plotterStyle.registeredMouseWheelActions;
auto itAction=findMatchingMouseWheelAction(event->modifiers()); auto itAction=findMatchingMouseWheelAction(event->modifiers());
if (itAction!=plotterStyle.registeredMouseWheelActions.end()) { //qDebug()<<"wheelEvent("<<event->modifiers()<<"): plotterStyle.registeredMouseWheelActions="<<plotterStyle.registeredMouseWheelActions;
//qDebug()<<"wheelEvent("<<event->modifiers()<<"): itAction="<<itAction.key()<<","<<itAction.value()<<" !=end:"<<(itAction!=plotterStyle.registeredMouseWheelActions.end())<<" ==end:"<<(itAction==plotterStyle.registeredMouseWheelActions.end());
if (itAction!=plotterStyle.registeredMouseWheelActions.end()) {
if (itAction.value()==JKQTPMouseWheelActions::jkqtpmwaZoomByWheel) { if (itAction.value()==JKQTPMouseWheelActions::jkqtpmwaZoomByWheel) {
//qDebug()<<"wheelEvent():ZoomByWheel"; //if (act==JKQTPMouseWheelActions::jkqtpmwaZoomByWheel) {
//qDebug()<<"wheelEvent("<<event->modifiers()<<"):ZoomByWheel";
double factor=pow(2.0, 1.0*static_cast<double>(event->delta())/120.0)*2.0; double factor=pow(2.0, 1.0*static_cast<double>(event->delta())/120.0)*2.0;
double xmin=plotter->p2x(static_cast<double>(event->x())/magnification-static_cast<double>(plotter->getPlotWidth())/factor); double xmin=plotter->p2x(static_cast<double>(event->x())/magnification-static_cast<double>(plotter->getPlotWidth())/factor);
double xmax=plotter->p2x(static_cast<double>(event->x())/magnification+static_cast<double>(plotter->getPlotWidth())/factor); double xmax=plotter->p2x(static_cast<double>(event->x())/magnification+static_cast<double>(plotter->getPlotWidth())/factor);
@ -932,7 +950,8 @@ void JKQTPlotter::wheelEvent ( QWheelEvent * event ) {
} }
plotter->setXY(xmin, xmax, ymin, ymax); plotter->setXY(xmin, xmax, ymin, ymax);
} else if (itAction.value()==JKQTPMouseWheelActions::jkqtpmwaPanByWheel) { } else if (itAction.value()==JKQTPMouseWheelActions::jkqtpmwaPanByWheel) {
//qDebug()<<"wheelEvent():PanByWheel"; //} else if (act==JKQTPMouseWheelActions::jkqtpmwaPanByWheel) {
//qDebug()<<"wheelEvent("<<event->modifiers()<<"):PanByWheel";
QRectF zoomRect= QRectF(QPointF(plotter->x2p(getXAxis()->getMin()),plotter->y2p(getYAxis()->getMax())), QPointF(plotter->x2p(getXAxis()->getMax()),plotter->y2p(getYAxis()->getMin()))); QRectF zoomRect= QRectF(QPointF(plotter->x2p(getXAxis()->getMin()),plotter->y2p(getYAxis()->getMax())), QPointF(plotter->x2p(getXAxis()->getMax()),plotter->y2p(getYAxis()->getMin())));
QPointF d=QPointF(event->angleDelta().x()/120.0*zoomRect.width()/10.0, QPointF d=QPointF(event->angleDelta().x()/120.0*zoomRect.width()/10.0,
event->angleDelta().y()/120.0*zoomRect.height()/10.0); event->angleDelta().y()/120.0*zoomRect.height()/10.0);
@ -1131,7 +1150,7 @@ void JKQTPlotter::redrawPlot() {
if (!doDrawing) return; if (!doDrawing) return;
disconnect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot())); disconnect(plotter, SIGNAL(plotUpdated()), this, SLOT(redrawPlot()));
disconnect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays())); disconnect(plotter, SIGNAL(overlaysUpdated()), this, SLOT(redrawOverlays()));
plotter->setWidgetSize(width()/magnification, height()/magnification-getPlotYOffset()); plotter->setWidgetSize(jkqtp_roundTo<int>(width()/magnification), jkqtp_roundTo<int>(height()/magnification-getPlotYOffset()));
JKQTPEnhancedPainter painter(&image); JKQTPEnhancedPainter painter(&image);
if (painter.isActive()) { if (painter.isActive()) {
painter.scale(magnification, magnification); painter.scale(magnification, magnification);
@ -1167,7 +1186,7 @@ void JKQTPlotter::paintEvent(QPaintEvent *event){
p->drawRect(geometry()); p->drawRect(geometry());
p->restore(); p->restore();
if (plotterStyle.displayMousePosition ) { if (plotterStyle.displayMousePosition ) {
p->drawText(plotter->getInternalPlotBorderLeft(), getPlotYOffset()-1, plotterStyle.mousePositionTemplate.arg(mousePosX).arg(mousePosY)); p->drawText(QPointF(plotter->getInternalPlotBorderLeft(), getPlotYOffset()-1), plotterStyle.mousePositionTemplate.arg(mousePosX).arg(mousePosY));
} }
int plotImageWidth=width(); int plotImageWidth=width();
@ -1205,7 +1224,7 @@ void JKQTPlotter::resizeEvent(QResizeEvent *event) {
} }
//updateGeometry(); //updateGeometry();
//std::cout<<"resize DONE\n"; //qDebug()<<"resize DONE width()="<<width()<<" height()="<<height()<<" plotImageWidth="<<plotImageWidth<<" plotImageHeight="<<plotImageHeight<<" sizeChanged="<<sizeChanged<<"\n";
} }
void JKQTPlotter::delayedResizeEvent() void JKQTPlotter::delayedResizeEvent()
@ -1214,7 +1233,7 @@ void JKQTPlotter::delayedResizeEvent()
int plotImageHeight=height(); int plotImageHeight=height();
plotImageHeight=plotImageHeight-getPlotYOffset(); plotImageHeight=plotImageHeight-getPlotYOffset();
//std::cout<<"resize: "<<plotImageWidth<<" x "<<plotImageHeight<<std::endl; //qDebug()<<"resize: "<<plotImageWidth<<" x "<<plotImageHeight<<std::endl;
bool sizeChanged=false; bool sizeChanged=false;
if (plotImageWidth != image.width() || plotImageHeight != image.height()) { if (plotImageWidth != image.width() || plotImageHeight != image.height()) {
@ -1335,7 +1354,7 @@ bool JKQTPlotter::isPlotUpdateEnabled() const {
void JKQTPlotter::pzoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTBasePlotter* /*sender*/) { void JKQTPlotter::pzoomChangedLocally(double newxmin, double newxmax, double newymin, double newymax, JKQTBasePlotter* /*sender*/) {
emit zoomChangedLocally(newxmin, newxmax, newymin, newymax, this); emit zoomChangedLocally(newxmin, newxmax, newymin, newymax, this);
minSize=QSize(plotter->getInternalPlotBorderLeft()+plotter->getInternalPlotBorderRight()+10, plotter->getInternalPlotBorderTop()+plotter->getInternalPlotBorderBottom()+10); minSize=QSizeF(plotter->getInternalPlotBorderLeft()+plotter->getInternalPlotBorderRight()+10, plotter->getInternalPlotBorderTop()+plotter->getInternalPlotBorderBottom()+10).toSize();
} }
void JKQTPlotter::intBeforePlotScalingRecalculate() { void JKQTPlotter::intBeforePlotScalingRecalculate() {
@ -1650,25 +1669,46 @@ void JKQTPlotter::openStandardAndSpecialContextMenu(int x, int y)
JKQTPMouseDragActionsHashMapIterator JKQTPlotter::findMatchingMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, bool* found) const JKQTPMouseDragActionsHashMapIterator JKQTPlotter::findMatchingMouseDragAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers, bool* found) const
{ {
auto it=registeredOverrideMouseDragActionModes.find(qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(button, modifiers)); JKQTPMouseDragActionsHashMapIterator it=registeredOverrideMouseDragActionModes.begin();
if (it!=registeredOverrideMouseDragActionModes.end()) { while (it!=registeredOverrideMouseDragActionModes.end() ) {
if (found) *found=true; if (it.key()==qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(button, modifiers)) {
return it; if (found) *found=true;
return it;
}
++it;
} }
auto itt=plotterStyle.registeredMouseDragActionModes.find(qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(button, modifiers)); it=plotterStyle.registeredMouseDragActionModes.begin();
if (found) *found=(itt!=plotterStyle.registeredMouseDragActionModes.end()); while (it!=plotterStyle.registeredMouseDragActionModes.end() ) {
return itt; if (it.key()==qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(button, modifiers)) {
if (found) *found=true;
return it;
}
++it;
}
if (found) *found=false;
return plotterStyle.registeredMouseDragActionModes.end();
} }
JKQTPMouseDoubleClickActionsHashMapIterator JKQTPlotter::findMatchingMouseDoubleClickAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers) const JKQTPMouseDoubleClickActionsHashMapIterator JKQTPlotter::findMatchingMouseDoubleClickAction(Qt::MouseButton button, Qt::KeyboardModifiers modifiers) const
{ {
return plotterStyle.registeredMouseDoubleClickActions.find(qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(button, modifiers)); for (JKQTPMouseDoubleClickActionsHashMapIterator it=plotterStyle.registeredMouseDoubleClickActions.begin(); it!=plotterStyle.registeredMouseDoubleClickActions.end(); ++it) {
if (it.key()==qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(button, modifiers)) {
return it;
}
}
return plotterStyle.registeredMouseDoubleClickActions.end();
} }
JKQTPMouseWheelActionsHashMapIterator JKQTPlotter::findMatchingMouseWheelAction(Qt::KeyboardModifiers modifiers) const JKQTPMouseWheelActionsHashMapIterator JKQTPlotter::findMatchingMouseWheelAction(Qt::KeyboardModifiers modifiers) const
{ {
//qDebug()<<"findMatchingMouseWheelAction("<<modifiers<<"): "<<plotterStyle.registeredMouseWheelActions; for (JKQTPMouseWheelActionsHashMapIterator it=plotterStyle.registeredMouseWheelActions.begin(); it!=plotterStyle.registeredMouseWheelActions.end(); ++it) {
return plotterStyle.registeredMouseWheelActions.find(modifiers); if (it.key()==modifiers) {
return it;
}
}
return plotterStyle.registeredMouseWheelActions.end();
//return plotterStyle.registeredMouseWheelActions.find(modifiers);
} }
void JKQTPlotter::setPlotUpdateEnabled(bool enable) void JKQTPlotter::setPlotUpdateEnabled(bool enable)

View File

@ -1,5 +1,6 @@
#include "jkqtplotterstyle.h" #include "jkqtplotterstyle.h"
#include <QApplication> #include <QApplication>
#include <QDebug>
#include "jkqtcommon/jkqttools.h" #include "jkqtcommon/jkqttools.h"
#include "jkqtplotter/jkqtptools.h" #include "jkqtplotter/jkqtptools.h"
@ -21,13 +22,17 @@ JKQTPlotterStyle::JKQTPlotterStyle():
displayMousePosition(true), displayMousePosition(true),
toolbarEnabled(true), toolbarEnabled(true),
toolbarAlwaysOn(false), toolbarAlwaysOn(false),
usePaletteColors(true) usePaletteColors(true),
registeredMouseDragActionModes(),
registeredMouseWheelActions(),
registeredMouseDoubleClickActions()
{ {
// default user-actions: // default user-actions:
registeredMouseDragActionModes[qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(Qt::LeftButton, Qt::NoModifier)]=JKQTPMouseDragActions::jkqtpmdaZoomByRectangle; registeredMouseDragActionModes[qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(Qt::LeftButton, Qt::NoModifier)]=JKQTPMouseDragActions::jkqtpmdaZoomByRectangle;
registeredMouseDragActionModes[qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(Qt::LeftButton, Qt::ControlModifier)]=JKQTPMouseDragActions::jkqtpmdaPanPlotOnMove; registeredMouseDragActionModes[qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(Qt::LeftButton, Qt::ControlModifier)]=JKQTPMouseDragActions::jkqtpmdaPanPlotOnMove;
registeredMouseDoubleClickActions[qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(Qt::LeftButton, Qt::NoModifier)]=JKQTPMouseDoubleClickActions::jkqtpdcaClickMovesViewport; registeredMouseDoubleClickActions[qMakePair<Qt::MouseButton, Qt::KeyboardModifiers>(Qt::LeftButton, Qt::NoModifier)]=JKQTPMouseDoubleClickActions::jkqtpdcaClickMovesViewport;
registeredMouseWheelActions[Qt::NoModifier]=JKQTPMouseWheelActions::jkqtpmwaZoomByWheel; registeredMouseWheelActions[Qt::NoModifier]=JKQTPMouseWheelActions::jkqtpmwaZoomByWheel;
//qDebug()<<"JKQTPlotterStyle(): registeredMouseWheelActions="<<registeredMouseWheelActions;
} }
void JKQTPlotterStyle::loadSettings(const QSettings &settings, const QString &group, const JKQTPlotterStyle &defaultStyle) void JKQTPlotterStyle::loadSettings(const QSettings &settings, const QString &group, const JKQTPlotterStyle &defaultStyle)

View File

@ -430,11 +430,11 @@ JKQTP_LIB_EXPORT JKQTPKeyLayout String2JKQTPKeyLayout(const QString& pos);
* \ingroup jkqtpplottersupprt * \ingroup jkqtpplottersupprt
* \internal * \internal
*/ */
struct JKQTPGridPrintingItem { struct JKQTP_LIB_EXPORT JKQTPGridPrintingItem {
/** \brief logic x-position of a graph, relative to the current JKQtPlotter */ /** \brief logic x-position of a graph, relative to the current JKQtPlotter */
int x; size_t x;
/** \brief logic y-position of a graph, relative to the current JKQtPlotter */ /** \brief logic y-position of a graph, relative to the current JKQtPlotter */
int y; size_t y;
/** \brief JKQTBasePlotter */ /** \brief JKQTBasePlotter */
JKQTBasePlotter* plotter; JKQTBasePlotter* plotter;
}; };
@ -471,20 +471,6 @@ JKQTP_LIB_EXPORT QString JKQTPErrorPlotstyle2String(JKQTPErrorPlotstyle pos);
*/ */
JKQTP_LIB_EXPORT JKQTPErrorPlotstyle String2JKQTPErrorPlotstyle(const QString& pos); JKQTP_LIB_EXPORT JKQTPErrorPlotstyle String2JKQTPErrorPlotstyle(const QString& pos);
/** \brief plot styles for a graph
* \ingroup jkqtpplottersupprt
*/
enum JKQTPGraphPlotstyle {
JKQTPLines, /*!< \brief plot y=f(x), connect the datapoints by straight lines */
JKQTPFilledCurveX, /*!< \brief plot y=f(x), as filled curve (filled until the y=0/x-axis) */
JKQTPFilledCurveY, /*!< \brief plot x=f(y), as filled curve (filled until the x=0/y-axis) */
JKQTPPoints, /*!< \brief plot y=f(x), plot each datapoint with a symbol */
JKQTPLinesPoints, /*!< \brief plot y=f(x), plot each datapoint with a symbol and connect them by straight lines */
JKQTPImpulsesHorizontal, /*!< \brief plot y=f(x), plot each datapoint as a line from (x,0) to (x,f(x)) */
JKQTPImpulsesVertical, /*!< \brief plot x=f(y), plot each datapoint as a line from (0,f(x)) to (x,f(x)) */
JKQTPStepsX, /*!< \brief plot y=f(x), as a step curve */
JKQTPStepsY /*!< \brief plot x=f(y), as a step curve */
};