- more refactorings to modernize C++
- fixed JKQTPColumnMathImage with modifiers - improved documentation - make use of link_prl/create_prl in QMake projects (see http://doc.qt.io/qt-5/qmake-advanced-usage.html)
2
.gitignore
vendored
@ -90,3 +90,5 @@ moc_predefs.h
|
|||||||
/lib/jkqtplotter/*.TMP
|
/lib/jkqtplotter/*.TMP
|
||||||
/doc/doxygen_log.txt
|
/doc/doxygen_log.txt
|
||||||
/doc/*.tmp
|
/doc/*.tmp
|
||||||
|
/staticlib/debug/*.prl
|
||||||
|
/staticlib/release/*.prl
|
||||||
|
BIN
doc/images/JKQTPCALTdate.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
doc/images/JKQTPCALTdefault.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
doc/images/JKQTPCALTexponent.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
doc/images/JKQTPCALTtime.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
doc/images/JKQTPEnhancedTableView.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
doc/images/JKQTPEnhancedTableViewOptionsDialog.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
doc/images/JKQTPEnhancedTableViewPrint.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
doc/images/JKQTPEnhancedTableViewPrintMultipage.png
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
doc/images/JKQTPEnhancedTableViewPrintSinglepage.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
doc/images/JKQTPErrorBars.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
doc/images/JKQTPErrorBarsLines.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
doc/images/JKQTPErrorBarsPolygons.png
Normal file
After Width: | Height: | Size: 6.1 KiB |
BIN
doc/images/JKQTPErrorBoxes.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
doc/images/JKQTPErrorEllipses.png
Normal file
After Width: | Height: | Size: 4.7 KiB |
BIN
doc/images/JKQTPErrorLines.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
doc/images/JKQTPErrorPolygons.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
doc/images/JKQTPErrorSimpleBars.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
doc/images/JKQTPErrorSimpleBarsLines.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
doc/images/JKQTPErrorSimpleBarsPolygons.png
Normal file
After Width: | Height: | Size: 5.8 KiB |
BIN
doc/images/JKQTPKeyLayoutComboBox.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
doc/images/JKQTPMathImageBaseModifyAlpha.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
doc/images/JKQTPMathImageBaseModifyHue.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
doc/images/JKQTPMathImageBaseModifyLuminance.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
doc/images/JKQTPMathImageBaseModifyNone.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
doc/images/JKQTPMathImageBaseModifySaturation.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
doc/images/JKQTPMathImageBaseModifyValue.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
doc/images/JKQTPNoError.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
doc/images/JKQTPStepCenter.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
doc/images/JKQTPStepLeft.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
doc/images/JKQTPStepRight.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
doc/images/docu_logaxis_set_minorticks.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
doc/images/plot_bargraphhorploterr.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
doc/images/plot_bargraphverploterr.png
Normal file
After Width: | Height: | Size: 22 KiB |
@ -14,7 +14,7 @@ All test-projects are Qt-projects that use qmake to build. You can load them int
|
|||||||
| [![](../screenshots/jkqtplotter_simpletest_symbols_and_errors_small.png)](./simpletest_symbols_and_errors) | [Simple Line/Symbol Graph With Errorbars](./simpletest_symbols_and_errors) | `JKQTPXYLineErrorGraph` <br> C-style arrays of data |
|
| [![](../screenshots/jkqtplotter_simpletest_symbols_and_errors_small.png)](./simpletest_symbols_and_errors) | [Simple Line/Symbol Graph With Errorbars](./simpletest_symbols_and_errors) | `JKQTPXYLineErrorGraph` <br> C-style arrays of data |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_errorbarstyles_small.png)](./simpletest_errorbarstyles) | [Different Types of Error Indicators](./simpletest_errorbarstyles) | `JKQTPXYLineErrorGraph` <br> different styles of error indicators for x- and y-errors <br> C++-style QVector for data <br> styling error indicators <br> moving key and formatting plotter grid |
|
| [![](../screenshots/jkqtplotter_simpletest_errorbarstyles_small.png)](./simpletest_errorbarstyles) | [Different Types of Error Indicators](./simpletest_errorbarstyles) | `JKQTPXYLineErrorGraph` <br> different styles of error indicators for x- and y-errors <br> C++-style QVector for data <br> styling error indicators <br> moving key and formatting plotter grid |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_barchart_small.png)](./simpletest_barchart) | [Simple Bar Charts](./simpletest_barchart) | `JKQTPBarVerticalGraph` <br> C-style arrays of data |
|
| [![](../screenshots/jkqtplotter_simpletest_barchart_small.png)](./simpletest_barchart) | [Simple Bar Charts](./simpletest_barchart) | `JKQTPBarVerticalGraph` <br> C-style arrays of data |
|
||||||
| [![](../screenshots/JKQTPBarVerticalGraphStacked_small.png) <br> ![](../screenshots/JKQTPBarHorizontalGraphStacked_small.png)](./simpletest_stackedbars) | [Stacked Bar Charts](./simpletest_stackedbars) | `JKQTPBarVerticalStackableGraph`, `JKQTPBarHorizontalStackableGraph` <br> C++-style vectors of data |
|
| [![](../screenshots/JKQTPbarHorizontalGraphStacked_small.png) <br> ![](../screenshots/JKQTPbarVerticalGraphStacked_small.png)](./simpletest_stackedbars) | [Stacked Bar Charts](./simpletest_stackedbars) | `JKQTPBarVerticalStackableGraph`, `JKQTPBarHorizontalStackableGraph` <br> C++-style vectors of data |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_filledgraphs_small.png)](./simpletest_filledgraphs) | [Filled Curve Plots](./simpletest_filledgraphs) | `JKQTPBarVerticalGraph` <br> setting/altering data in `JKQTPDatstore` directly <br> transparent plots <br> calculating histograms |
|
| [![](../screenshots/jkqtplotter_simpletest_filledgraphs_small.png)](./simpletest_filledgraphs) | [Filled Curve Plots](./simpletest_filledgraphs) | `JKQTPBarVerticalGraph` <br> setting/altering data in `JKQTPDatstore` directly <br> transparent plots <br> calculating histograms |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_impulsesplot_small.png)](./simpletest_impulsesplot) | [Impulse Plots](./simpletest_impulsesplot) | `JKQTPImpulsesVerticalGraph` and `JKQTPImpulsesHorizontalGraph` <br> C++-style QVector as plot data |
|
| [![](../screenshots/jkqtplotter_simpletest_impulsesplot_small.png)](./simpletest_impulsesplot) | [Impulse Plots](./simpletest_impulsesplot) | `JKQTPImpulsesVerticalGraph` and `JKQTPImpulsesHorizontalGraph` <br> C++-style QVector as plot data |
|
||||||
| [![](../screenshots/jkqtplotter_simpletest_paramscatterplot_small.png)](./simpletest_paramscatterplot) | [Scatter Graph with Parametrized Symbols/Colors](./simpletest_paramscatterplot) | `JKQTPXYParametrizedScatterGraph` <br> C++-style QVector as plot data <br> modify scatter/points/line-graph properties by data |
|
| [![](../screenshots/jkqtplotter_simpletest_paramscatterplot_small.png)](./simpletest_paramscatterplot) | [Scatter Graph with Parametrized Symbols/Colors](./simpletest_paramscatterplot) | `JKQTPXYParametrizedScatterGraph` <br> C++-style QVector as plot data <br> modify scatter/points/line-graph properties by data |
|
||||||
|
@ -12,7 +12,7 @@ HEADERS += jkqtfastplotter_test_testmain.h
|
|||||||
|
|
||||||
RCC_DIR = .rccs
|
RCC_DIR = .rccs
|
||||||
|
|
||||||
CONFIG += qt windows
|
CONFIG += link_prl qt windows
|
||||||
|
|
||||||
QT += core gui opengl
|
QT += core gui opengl
|
||||||
|
|
||||||
|
@ -36,14 +36,14 @@ TestMain::TestMain(QWidget *parent) :
|
|||||||
gl->addWidget(pl1, 0, 0);
|
gl->addWidget(pl1, 0, 0);
|
||||||
JKQTFastPlotter* pl2=new JKQTFastPlotter(w);
|
JKQTFastPlotter* pl2=new JKQTFastPlotter(w);
|
||||||
pl2->setMaximumWidth(100);
|
pl2->setMaximumWidth(100);
|
||||||
pl2->set_synchronizeY(pl1);
|
pl2->setSynchronizeY(pl1);
|
||||||
pl2->set_yAxisLabelVisible(false);
|
pl2->setYAxisLabelVisible(false);
|
||||||
pl2->setPlotBorderLeft(10);
|
pl2->setPlotBorderLeft(10);
|
||||||
pl2->setPlotBorderRight(2);
|
pl2->setPlotBorderRight(2);
|
||||||
w->connect(pl1, SIGNAL(replotting()), pl2, SLOT(redrawPlot()));
|
w->connect(pl1, SIGNAL(replotting()), pl2, SLOT(redrawPlot()));
|
||||||
gl->addWidget(pl2, 0, 1);
|
gl->addWidget(pl2, 0, 1);
|
||||||
JKQTFastPlotter* pl3=new JKQTFastPlotter(w);
|
JKQTFastPlotter* pl3=new JKQTFastPlotter(w);
|
||||||
pl3->set_synchronizeX(pl1);
|
pl3->setSynchronizeX(pl1);
|
||||||
w->connect(pl1, SIGNAL(replotting()), pl3, SLOT(redrawPlot()));
|
w->connect(pl1, SIGNAL(replotting()), pl3, SLOT(redrawPlot()));
|
||||||
gl->addWidget(pl3, 1, 0);
|
gl->addWidget(pl3, 1, 0);
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ TestMain::TestMain(QWidget *parent) :
|
|||||||
col.setAlpha(127);
|
col.setAlpha(127);
|
||||||
JKQTFPimageOverlayPlot* p5o=new JKQTFPimageOverlayPlot(pl3, ovrl, IMAGE_N, IMAGE_N, 0, 10, 0, 10, col);
|
JKQTFPimageOverlayPlot* p5o=new JKQTFPimageOverlayPlot(pl3, ovrl, IMAGE_N, IMAGE_N, 0, 10, 0, 10, col);
|
||||||
JKQTFPXRangePlot* p6=new JKQTFPXRangePlot(pl1, 2.25, 7.75);
|
JKQTFPXRangePlot* p6=new JKQTFPXRangePlot(pl1, 2.25, 7.75);
|
||||||
p6->set_fillStyle(Qt::SolidPattern);
|
p6->setFillStyle(Qt::SolidPattern);
|
||||||
JKQTFPQScaleBarXPlot* sb=new JKQTFPQScaleBarXPlot(pl1, 1, QString("%1 mm"));
|
JKQTFPQScaleBarXPlot* sb=new JKQTFPQScaleBarXPlot(pl1, 1, QString("%1 mm"));
|
||||||
|
|
||||||
pl1->addPlot(p6);
|
pl1->addPlot(p6);
|
||||||
@ -100,14 +100,14 @@ TestMain::TestMain(QWidget *parent) :
|
|||||||
QComboBox* spin=new QComboBox(w);
|
QComboBox* spin=new QComboBox(w);
|
||||||
spin->addItems(JKQTFPimagePlot_getPalettes());
|
spin->addItems(JKQTFPimagePlot_getPalettes());
|
||||||
gl->addWidget(spin, 2,0);
|
gl->addWidget(spin, 2,0);
|
||||||
connect(spin, SIGNAL(currentIndexChanged(int)), p5, SLOT(set_palette(int)));
|
connect(spin, SIGNAL(currentIndexChanged(int)), p5, SLOT(setPalette(int)));
|
||||||
QComboBox* scale=new QComboBox(w);
|
QComboBox* scale=new QComboBox(w);
|
||||||
scale->addItem("TopLeft");
|
scale->addItem("TopLeft");
|
||||||
scale->addItem("TopRight");
|
scale->addItem("TopRight");
|
||||||
scale->addItem("BottomLeft");
|
scale->addItem("BottomLeft");
|
||||||
scale->addItem("BottomRight");
|
scale->addItem("BottomRight");
|
||||||
gl->addWidget(scale, 3,0);
|
gl->addWidget(scale, 3,0);
|
||||||
connect(scale, SIGNAL(currentIndexChanged(int)), sb, SLOT(set_position(int)));
|
connect(scale, SIGNAL(currentIndexChanged(int)), sb, SLOT(setPosition(int)));
|
||||||
|
|
||||||
t->addTab(w, tr("Basic Test"));
|
t->addTab(w, tr("Basic Test"));
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ TestMain::TestMain(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
prgb=new JKQTFPRGBImageOverlayPlot(p21);
|
prgb=new JKQTFPRGBImageOverlayPlot(p21);
|
||||||
prgb->set_image(imageRed, JKQTFP_double, imageGreen, JKQTFP_double, imageBlue, JKQTFP_double, IMAGE_N, IMAGE_N,0,10,0,10);
|
prgb->setImage(imageRed, JKQTFP_double, imageGreen, JKQTFP_double, imageBlue, JKQTFP_double, IMAGE_N, IMAGE_N,0,10,0,10);
|
||||||
p21->addPlot(prgb);
|
p21->addPlot(prgb);
|
||||||
|
|
||||||
QCheckBox* c=new QCheckBox(tr("red channel"), w);
|
QCheckBox* c=new QCheckBox(tr("red channel"), w);
|
||||||
@ -167,24 +167,24 @@ TestMain::~TestMain() {
|
|||||||
|
|
||||||
void TestMain::enableRed(bool enabled) {
|
void TestMain::enableRed(bool enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
prgb->set_imageRed(imageRed, JKQTFP_double);
|
prgb->setImageRed(imageRed, JKQTFP_double);
|
||||||
} else {
|
} else {
|
||||||
prgb->set_imageRed(NULL, JKQTFP_double);
|
prgb->setImageRed(NULL, JKQTFP_double);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestMain::enableGreen(bool enabled) {
|
void TestMain::enableGreen(bool enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
prgb->set_imageGreen(imageGreen, JKQTFP_double);
|
prgb->setImageGreen(imageGreen, JKQTFP_double);
|
||||||
} else {
|
} else {
|
||||||
prgb->set_imageGreen(NULL, JKQTFP_double);
|
prgb->setImageGreen(NULL, JKQTFP_double);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestMain::enableBlue(bool enabled) {
|
void TestMain::enableBlue(bool enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
prgb->set_imageBlue(imageBlue, JKQTFP_double);
|
prgb->setImageBlue(imageBlue, JKQTFP_double);
|
||||||
} else {
|
} else {
|
||||||
prgb->set_imageBlue(NULL, JKQTFP_double);
|
prgb->setImageBlue(NULL, JKQTFP_double);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ TEMPLATE = app
|
|||||||
|
|
||||||
SOURCES += jkqtmathtext_simpletest.cpp
|
SOURCES += jkqtmathtext_simpletest.cpp
|
||||||
|
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ double draw(QPainter& painter, double X, double YY, JKQTMathText& mt, QString na
|
|||||||
ht.start();
|
ht.start();
|
||||||
QSizeF s=mt.getSize(painter);
|
QSizeF s=mt.getSize(painter);
|
||||||
Y=Y+mt.getAscent(painter);
|
Y=Y+mt.getAscent(painter);
|
||||||
std::cout<<" sizing in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<" sizing in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
QPen p=painter.pen();
|
QPen p=painter.pen();
|
||||||
p.setColor("lightcoral");
|
p.setColor("lightcoral");
|
||||||
p.setStyle(Qt::DashLine);
|
p.setStyle(Qt::DashLine);
|
||||||
@ -43,7 +43,7 @@ double draw(QPainter& painter, double X, double YY, JKQTMathText& mt, QString na
|
|||||||
p.setColor("black");
|
p.setColor("black");
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
mt.draw(painter, X, Y);
|
mt.draw(painter, X, Y);
|
||||||
std::cout<<" drawing in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<" drawing in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
p.setColor("blue");
|
p.setColor("blue");
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
|
|
||||||
@ -69,15 +69,15 @@ void timingTest(QPainter& painter, QString text, QString name, double fontSize)
|
|||||||
double t;
|
double t;
|
||||||
JKQTMathText mt;
|
JKQTMathText mt;
|
||||||
mt.setFontSize(fontSize);
|
mt.setFontSize(fontSize);
|
||||||
ht.start(); mt.parse(text); t=ht.get_time()/1000.0;
|
ht.start(); mt.parse(text); t=ht.getTime()/1000.0;
|
||||||
sum_parse+=t;
|
sum_parse+=t;
|
||||||
sqrsum_parse+=t*t;
|
sqrsum_parse+=t*t;
|
||||||
//std::cout<<t<<",\t";
|
//std::cout<<t<<",\t";
|
||||||
ht.start(); mt.getSize(painter); t=ht.get_time()/1000.0;
|
ht.start(); mt.getSize(painter); t=ht.getTime()/1000.0;
|
||||||
sum_size+=t;
|
sum_size+=t;
|
||||||
sqrsum_size+=t*t;
|
sqrsum_size+=t*t;
|
||||||
//std::cout<<t<<",\t";
|
//std::cout<<t<<",\t";
|
||||||
ht.start(); mt.draw(painter, 0,0); t=ht.get_time()/1000.0;
|
ht.start(); mt.draw(painter, 0,0); t=ht.getTime()/1000.0;
|
||||||
sum_draw+=t;
|
sum_draw+=t;
|
||||||
sqrsum_draw+=t*t;
|
sqrsum_draw+=t*t;
|
||||||
//std::cout<<t<<"\n";
|
//std::cout<<t<<"\n";
|
||||||
@ -137,24 +137,24 @@ int main(int argc, char* argv[])
|
|||||||
bool okh=true;
|
bool okh=true;
|
||||||
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
|
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
|
||||||
qDebug()<<"HTML1: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML1: --------------------------------------------- ok="<<okh;
|
qDebug()<<"HTML1: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML1: --------------------------------------------- ok="<<okh;
|
||||||
if (mt.get_error_list().size()>0) {
|
if (mt.getErrorList().size()>0) {
|
||||||
std::cout<<mt.get_error_list().join("\n").toStdString()<<std::endl<<std::endl;
|
std::cout<<mt.getErrorList().join("\n").toStdString()<<std::endl<<std::endl;
|
||||||
}
|
}
|
||||||
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse mathTest in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(10);
|
mt.setFontSize(10);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, symbol, 10pt");
|
Y+=draw(painter, X1, Y, mt, "math, symbol, 10pt");
|
||||||
mt.setFontSize(20);
|
mt.setFontSize(20);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, symbol, 20pt");
|
Y+=draw(painter, X1, Y, mt, "math, symbol, 20pt");
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(symbolTest);
|
mt.parse(symbolTest);
|
||||||
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse symbolTest in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
|
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
|
||||||
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
|
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
|
||||||
mt.setFontSize(12);
|
mt.setFontSize(12);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
|
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(text);
|
mt.parse(text);
|
||||||
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse text in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
|
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
|
||||||
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
|
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
|
||||||
mt.setFontSize(10);
|
mt.setFontSize(10);
|
||||||
@ -166,19 +166,19 @@ int main(int argc, char* argv[])
|
|||||||
mt.useXITS();
|
mt.useXITS();
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(mathTest);
|
mt.parse(mathTest);
|
||||||
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse mathTest in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(10);
|
mt.setFontSize(10);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, XITS, 10pt");
|
Y+=draw(painter, X1, Y, mt, "math, XITS, 10pt");
|
||||||
mt.setFontSize(20);
|
mt.setFontSize(20);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, XITS, 20pt");
|
Y+=draw(painter, X1, Y, mt, "math, XITS, 20pt");
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(symbolTest);
|
mt.parse(symbolTest);
|
||||||
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse symbolTest in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(12);
|
mt.setFontSize(12);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
|
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(text);
|
mt.parse(text);
|
||||||
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse text in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(10);
|
mt.setFontSize(10);
|
||||||
Y+=draw(painter, X1, Y, mt, "text, XITS, 10pt");
|
Y+=draw(painter, X1, Y, mt, "text, XITS, 10pt");
|
||||||
mt.setFontSize(16);
|
mt.setFontSize(16);
|
||||||
@ -190,19 +190,19 @@ int main(int argc, char* argv[])
|
|||||||
mt.useAnyUnicode("Arial", "Times New Roman");
|
mt.useAnyUnicode("Arial", "Times New Roman");
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(mathTest);
|
mt.parse(mathTest);
|
||||||
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse mathTest in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(10);
|
mt.setFontSize(10);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 10pt");
|
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 10pt");
|
||||||
mt.setFontSize(20);
|
mt.setFontSize(20);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 20pt");
|
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 20pt");
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(symbolTest);
|
mt.parse(symbolTest);
|
||||||
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse symbolTest in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(12);
|
mt.setFontSize(12);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 12pt");
|
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 12pt");
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(text);
|
mt.parse(text);
|
||||||
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse text in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(10);
|
mt.setFontSize(10);
|
||||||
Y+=draw(painter, X1, Y, mt, "text, Arial Unicode, 10pt");
|
Y+=draw(painter, X1, Y, mt, "text, Arial Unicode, 10pt");
|
||||||
mt.setFontSize(16);
|
mt.setFontSize(16);
|
||||||
@ -212,19 +212,19 @@ int main(int argc, char* argv[])
|
|||||||
mt.useSTIX();
|
mt.useSTIX();
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(mathTest);
|
mt.parse(mathTest);
|
||||||
std::cout<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse mathTest in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(10);
|
mt.setFontSize(10);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, STIX, 10pt");
|
Y+=draw(painter, X1, Y, mt, "math, STIX, 10pt");
|
||||||
mt.setFontSize(20);
|
mt.setFontSize(20);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, STIX, 20pt");
|
Y+=draw(painter, X1, Y, mt, "math, STIX, 20pt");
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(symbolTest);
|
mt.parse(symbolTest);
|
||||||
std::cout<<"parse symbolTest in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse symbolTest in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(12);
|
mt.setFontSize(12);
|
||||||
Y+=draw(painter, X1, Y, mt, "math, STIX, 12pt");
|
Y+=draw(painter, X1, Y, mt, "math, STIX, 12pt");
|
||||||
ht.start();
|
ht.start();
|
||||||
mt.parse(text);
|
mt.parse(text);
|
||||||
std::cout<<"parse text in "<<ht.get_time()/1000.0<<" ms\n";
|
std::cout<<"parse text in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
mt.setFontSize(10);
|
mt.setFontSize(10);
|
||||||
Y+=draw(painter, X1, Y, mt, "text, STIX, 10pt");
|
Y+=draw(painter, X1, Y, mt, "text, STIX, 10pt");
|
||||||
mt.setFontSize(16);
|
mt.setFontSize(16);
|
||||||
|
@ -8,7 +8,7 @@ SOURCES += jkqtmathtext_test.cpp \
|
|||||||
|
|
||||||
RCC_DIR = rccs
|
RCC_DIR = rccs
|
||||||
|
|
||||||
CONFIG += qt windows
|
CONFIG += link_prl link_prl qt windows
|
||||||
|
|
||||||
|
|
||||||
TARGET = jkqtmathtext_test
|
TARGET = jkqtmathtext_test
|
||||||
|
@ -156,7 +156,7 @@ double TestForm::draw(QPainter& painter, double X, double YY, JKQTMathText& mt,
|
|||||||
ht.start();
|
ht.start();
|
||||||
QSizeF s=mt.getSize(painter);
|
QSizeF s=mt.getSize(painter);
|
||||||
Y=Y+mt.getAscent(painter);
|
Y=Y+mt.getAscent(painter);
|
||||||
durationSizingMS=ht.get_time()/1000.0;
|
durationSizingMS=ht.getTime()/1000.0;
|
||||||
qDebug()<<" sizing in "<<durationSizingMS<<" ms\n";
|
qDebug()<<" sizing in "<<durationSizingMS<<" ms\n";
|
||||||
QPen p=painter.pen();
|
QPen p=painter.pen();
|
||||||
p.setColor("lightcoral");
|
p.setColor("lightcoral");
|
||||||
@ -174,7 +174,7 @@ double TestForm::draw(QPainter& painter, double X, double YY, JKQTMathText& mt,
|
|||||||
p.setColor("black");
|
p.setColor("black");
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
mt.draw(painter, X, Y, ui->chkBoxes->isChecked());
|
mt.draw(painter, X, Y, ui->chkBoxes->isChecked());
|
||||||
durationTimingMS=ht.get_time()/1000.0;
|
durationTimingMS=ht.getTime()/1000.0;
|
||||||
qDebug()<<" drawing in "<<durationTimingMS<<" ms";
|
qDebug()<<" drawing in "<<durationTimingMS<<" ms";
|
||||||
p.setColor("blue");
|
p.setColor("blue");
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
@ -211,13 +211,13 @@ QTreeWidgetItem *TestForm::createTree(JKQTMathText::MTnode *node, QTreeWidgetIte
|
|||||||
else ti=new QTreeWidgetItem(ui->tree);
|
else ti=new QTreeWidgetItem(ui->tree);
|
||||||
|
|
||||||
if (decoN) {
|
if (decoN) {
|
||||||
name=QString("MTdecoratedNode: mode='%1'").arg(JKQTMathText::decorationToString(decoN->get_decoration()));
|
name=QString("MTdecoratedNode: mode='%1'").arg(JKQTMathText::decorationToString(decoN->getDecoration()));
|
||||||
if (decoN->get_child()) ti->addChild(createTree(decoN->get_child(), ti));
|
if (decoN->getChild()) ti->addChild(createTree(decoN->getChild(), ti));
|
||||||
} else if (matrixN) {
|
} else if (matrixN) {
|
||||||
int l=matrixN->getLines();
|
int l=matrixN->getLines();
|
||||||
int c=matrixN->get_columns();
|
int c=matrixN->getColumns();
|
||||||
name=QString("MTmatrixNode: l*c=%1*%2").arg(l).arg(c);
|
name=QString("MTmatrixNode: l*c=%1*%2").arg(l).arg(c);
|
||||||
QVector<QVector<JKQTMathText::MTnode*> > children=matrixN->get_children();
|
QVector<QVector<JKQTMathText::MTnode*> > children=matrixN->getChildren();
|
||||||
for (int y=0; y<l; y++) {
|
for (int y=0; y<l; y++) {
|
||||||
for (int x=0; x<c; x++) {
|
for (int x=0; x<c; x++) {
|
||||||
if (children[y].at(x)!=nullptr) {
|
if (children[y].at(x)!=nullptr) {
|
||||||
@ -228,36 +228,36 @@ QTreeWidgetItem *TestForm::createTree(JKQTMathText::MTnode *node, QTreeWidgetIte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (fracN) {
|
} else if (fracN) {
|
||||||
name=QString("MTfracNode: mode='%1'").arg(JKQTMathText::fracModeToString(fracN->get_mode()));
|
name=QString("MTfracNode: mode='%1'").arg(JKQTMathText::fracModeToString(fracN->getMode()));
|
||||||
if (fracN->get_child1()) ti->addChild(createTree(fracN->get_child1(), ti));
|
if (fracN->getChild1()) ti->addChild(createTree(fracN->getChild1(), ti));
|
||||||
if (fracN->get_child2()) ti->addChild(createTree(fracN->get_child2(), ti));
|
if (fracN->getChild2()) ti->addChild(createTree(fracN->getChild2(), ti));
|
||||||
} else if (sqrtN) {
|
} else if (sqrtN) {
|
||||||
name=QString("MTsqrtNode: deg=%1").arg(sqrtN->get_degree());
|
name=QString("MTsqrtNode: deg=%1").arg(sqrtN->getDegree());
|
||||||
if (sqrtN->get_child()) ti->addChild(createTree(sqrtN->get_child(), ti));
|
if (sqrtN->getChild()) ti->addChild(createTree(sqrtN->getChild(), ti));
|
||||||
} else if (braceN) {
|
} else if (braceN) {
|
||||||
name=QString("MTbraceNode: l='%1', r='%2', showR=%3").arg(braceN->get_openbrace()).arg(braceN->get_closebrace()).arg(braceN->getShowRightBrace());
|
name=QString("MTbraceNode: l='%1', r='%2', showR=%3").arg(braceN->getOpenbrace()).arg(braceN->getClosebrace()).arg(braceN->getShowRightBrace());
|
||||||
if (braceN->get_child()) ti->addChild(createTree(braceN->get_child(), ti));
|
if (braceN->getChild()) ti->addChild(createTree(braceN->getChild(), ti));
|
||||||
} else if (superN) {
|
} else if (superN) {
|
||||||
name=QString("MTsuperscriptNode");
|
name=QString("MTsuperscriptNode");
|
||||||
if (superN->get_child()) ti->addChild(createTree(superN->get_child(), ti));
|
if (superN->getChild()) ti->addChild(createTree(superN->getChild(), ti));
|
||||||
} else if (subN) {
|
} else if (subN) {
|
||||||
name=QString("MTsubscriptNode");
|
name=QString("MTsubscriptNode");
|
||||||
if (subN->get_child()) ti->addChild(createTree(subN->get_child(), ti));
|
if (subN->getChild()) ti->addChild(createTree(subN->getChild(), ti));
|
||||||
} else if (inst1N) {
|
} else if (inst1N) {
|
||||||
name=QString("MTinstruction1Node: \'%1\'").arg(inst1N->get_name());
|
name=QString("MTinstruction1Node: \'%1\'").arg(inst1N->getName());
|
||||||
if (inst1N->get_child()) ti->addChild(createTree(inst1N->get_child(), ti));
|
if (inst1N->getChild()) ti->addChild(createTree(inst1N->getChild(), ti));
|
||||||
} else if (lstN) {
|
} else if (lstN) {
|
||||||
name=QString("MTlistNode");
|
name=QString("MTlistNode");
|
||||||
QList<JKQTMathText::MTnode*> list=lstN->get_nodes();
|
QList<JKQTMathText::MTnode*> list=lstN->getNodes();
|
||||||
for (int i=0; i<list.size(); i++) {
|
for (int i=0; i<list.size(); i++) {
|
||||||
ti->addChild(createTree(list[i], ti));
|
ti->addChild(createTree(list[i], ti));
|
||||||
}
|
}
|
||||||
} else if (symN) {
|
} else if (symN) {
|
||||||
name=QString("MTsymbolNode: \'%1\'").arg(symN->get_symbolName());
|
name=QString("MTsymbolNode: \'%1\'").arg(symN->getSymbolName());
|
||||||
} else if (spN) {
|
} else if (spN) {
|
||||||
name=QString("MTwhitespaceNode :\'%1\'").arg(txtN->get_text());
|
name=QString("MTwhitespaceNode :\'%1\'").arg(txtN->getText());
|
||||||
} else if (txtN) {
|
} else if (txtN) {
|
||||||
name=QString("MTtextNode: \'%1\'").arg(txtN->get_text());
|
name=QString("MTtextNode: \'%1\'").arg(txtN->getText());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
name=QString("unknown");
|
name=QString("unknown");
|
||||||
@ -341,16 +341,16 @@ void TestForm::updateMath()
|
|||||||
ht.start();
|
ht.start();
|
||||||
double durationParse=0;
|
double durationParse=0;
|
||||||
if (mt.parse(mathTest)) {
|
if (mt.parse(mathTest)) {
|
||||||
durationParse=ht.get_time()/1000.0;
|
durationParse=ht.getTime()/1000.0;
|
||||||
ui->tree->addTopLevelItem(createTree(mt.get_parsedNode()));
|
ui->tree->addTopLevelItem(createTree(mt.getParsedNode()));
|
||||||
} else {
|
} else {
|
||||||
durationParse=ht.get_time()/1000.0;
|
durationParse=ht.getTime()/1000.0;
|
||||||
}
|
}
|
||||||
ui->labParsingTimes->setText(QString(" %1ms").arg(durationParse, 0, 'f', 3));
|
ui->labParsingTimes->setText(QString(" %1ms").arg(durationParse, 0, 'f', 3));
|
||||||
ui->tree->expandAll();
|
ui->tree->expandAll();
|
||||||
bool okh=true;
|
bool okh=true;
|
||||||
ui->textBrowser->clear();
|
ui->textBrowser->clear();
|
||||||
qDebug()<<"parse mathTest in "<<ht.get_time()/1000.0<<" ms\n";
|
qDebug()<<"parse mathTest in "<<ht.getTime()/1000.0<<" ms\n";
|
||||||
|
|
||||||
QStringList sl=ui->edtSizes->text().split(",");
|
QStringList sl=ui->edtSizes->text().split(",");
|
||||||
ui->labRenderTimes->setText("");
|
ui->labRenderTimes->setText("");
|
||||||
@ -364,8 +364,8 @@ void TestForm::updateMath()
|
|||||||
Y+=draw(painter, X1, Y, mt, QString("%1, %2, %3pt").arg(ui->cmbTestset->currentText()).arg(ui->cmbFont->currentText()).arg(size), durationSizingMS, durationTimingMS);
|
Y+=draw(painter, X1, Y, mt, QString("%1, %2, %3pt").arg(ui->cmbTestset->currentText()).arg(ui->cmbFont->currentText()).arg(size), durationSizingMS, durationTimingMS);
|
||||||
|
|
||||||
if (i==0) {
|
if (i==0) {
|
||||||
if (mt.get_error_list().size()>0) {
|
if (mt.getErrorList().size()>0) {
|
||||||
ui->labError->setText("<span color=\"red\">"+mt.get_error_list().join("<br>")+"</span>");
|
ui->labError->setText("<span color=\"red\">"+mt.getErrorList().join("<br>")+"</span>");
|
||||||
} else {
|
} else {
|
||||||
ui->labError->setText("<span color=\"green\">OK</span>");
|
ui->labError->setText("<span color=\"green\">OK</span>");
|
||||||
}
|
}
|
||||||
@ -374,8 +374,8 @@ void TestForm::updateMath()
|
|||||||
ui->labRenderTimes->setText(ui->labRenderTimes->text()+QString(" %1pt: %2ms/%3ms").arg(size).arg(durationSizingMS, 0, 'F', 1).arg(durationTimingMS, 0, 'F', 1));
|
ui->labRenderTimes->setText(ui->labRenderTimes->text()+QString(" %1pt: %2ms/%3ms").arg(size).arg(durationSizingMS, 0, 'F', 1).arg(durationTimingMS, 0, 'F', 1));
|
||||||
ui->textBrowser->textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
|
ui->textBrowser->textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
|
||||||
qDebug()<<"HTML: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML: --------------------------------------------- ok="<<okh;
|
qDebug()<<"HTML: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML: --------------------------------------------- ok="<<okh;
|
||||||
if (mt.get_error_list().size()>0) {
|
if (mt.getErrorList().size()>0) {
|
||||||
qDebug()<<mt.get_error_list().join("\n")<<"\n";
|
qDebug()<<mt.getErrorList().join("\n")<<"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
plotBarchart->getPlotter()->setPlotLabel(tr("\\textbf{bar charts}"));
|
plotBarchart->getPlotter()->setPlotLabel(tr("\\textbf{bar charts}"));
|
||||||
plotBarchart->setObjectName("plotBarchart");
|
plotBarchart->setObjectName("plotBarchart");
|
||||||
plotBarchart->getPlotter()->setUserSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plot_peaks/");
|
plotBarchart->getPlotter()->setUserSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plot_peaks/");
|
||||||
plotBarchart->getPlotter()->getXAxis()->set_labelType(JKQTPCALTdate);
|
plotBarchart->getPlotter()->getXAxis()->setLabelType(JKQTPCALTdate);
|
||||||
plotBarchart->getPlotter()->getXAxis()->set_tickDateFormat("dd. MMM yyyy");
|
plotBarchart->getPlotter()->getXAxis()->setTickDateFormat("dd. MMM yyyy");
|
||||||
|
|
||||||
barchartLayout->addWidget(plotBarchart);
|
barchartLayout->addWidget(plotBarchart);
|
||||||
|
|
||||||
@ -48,23 +48,23 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
size_t bcpye2=plotBarchart->getDatastore()->addCopiedColumn(dataBCYE2, "ye2");
|
size_t bcpye2=plotBarchart->getDatastore()->addCopiedColumn(dataBCYE2, "ye2");
|
||||||
|
|
||||||
JKQTPBarVerticalErrorGraph* plteBar1=new JKQTPBarVerticalErrorGraph(plotBarchart->getPlotter());
|
JKQTPBarVerticalErrorGraph* plteBar1=new JKQTPBarVerticalErrorGraph(plotBarchart->getPlotter());
|
||||||
plteBar1->set_title(tr("bars 1"));
|
plteBar1->setTitle(tr("bars 1"));
|
||||||
plteBar1->set_xColumn(bcpxd);
|
plteBar1->setXColumn(bcpxd);
|
||||||
plteBar1->set_yColumn(bcpy1);
|
plteBar1->setYColumn(bcpy1);
|
||||||
plteBar1->set_yErrorColumn(bcpye1);
|
plteBar1->setYErrorColumn(bcpye1);
|
||||||
plteBar1->set_width(0.45);
|
plteBar1->setWidth(0.45);
|
||||||
plteBar1->set_shift(-0.25);
|
plteBar1->setShift(-0.25);
|
||||||
plotBarchart->getPlotter()->addGraph(plteBar1);
|
plotBarchart->getPlotter()->addGraph(plteBar1);
|
||||||
|
|
||||||
JKQTPBarVerticalErrorGraph* plteBar2=new JKQTPBarVerticalErrorGraph(plotBarchart->getPlotter());
|
JKQTPBarVerticalErrorGraph* plteBar2=new JKQTPBarVerticalErrorGraph(plotBarchart->getPlotter());
|
||||||
plteBar2->set_xColumn(bcpxd);
|
plteBar2->setXColumn(bcpxd);
|
||||||
plteBar2->set_yColumn(bcpy2);
|
plteBar2->setYColumn(bcpy2);
|
||||||
plteBar2->set_yErrorColumn(bcpye2);
|
plteBar2->setYErrorColumn(bcpye2);
|
||||||
plteBar2->set_title(tr("bars 2"));
|
plteBar2->setTitle(tr("bars 2"));
|
||||||
plteBar2->set_width(0.45);
|
plteBar2->setWidth(0.45);
|
||||||
plteBar2->set_shift(0.25);
|
plteBar2->setShift(0.25);
|
||||||
plteBar2->set_baseline(0.5);
|
plteBar2->setBaseline(0.5);
|
||||||
plteBar2->set_yErrorSymmetric(false);
|
plteBar2->setYErrorSymmetric(false);
|
||||||
plotBarchart->getPlotter()->addGraph(plteBar2);
|
plotBarchart->getPlotter()->addGraph(plteBar2);
|
||||||
|
|
||||||
plteBar2->autoscaleBarWidthAndShift();
|
plteBar2->autoscaleBarWidthAndShift();
|
||||||
@ -83,22 +83,22 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
barchartLayout->addWidget(plotBarchart2);
|
barchartLayout->addWidget(plotBarchart2);
|
||||||
|
|
||||||
JKQTPBarHorizontalErrorGraph* plteBar3=new JKQTPBarHorizontalErrorGraph(plotBarchart2->getPlotter());
|
JKQTPBarHorizontalErrorGraph* plteBar3=new JKQTPBarHorizontalErrorGraph(plotBarchart2->getPlotter());
|
||||||
plteBar3->set_title(tr("bars 1"));
|
plteBar3->setTitle(tr("bars 1"));
|
||||||
plteBar3->set_yColumn(bcpx);
|
plteBar3->setYColumn(bcpx);
|
||||||
plteBar3->set_xColumn(bcpy1);
|
plteBar3->setXColumn(bcpy1);
|
||||||
plteBar3->set_xErrorColumn(bcpye1);
|
plteBar3->setXErrorColumn(bcpye1);
|
||||||
plteBar3->set_width(0.45);
|
plteBar3->setWidth(0.45);
|
||||||
plteBar3->set_shift(-0.25);
|
plteBar3->setShift(-0.25);
|
||||||
plotBarchart2->getPlotter()->addGraph(plteBar3);
|
plotBarchart2->getPlotter()->addGraph(plteBar3);
|
||||||
|
|
||||||
JKQTPBarHorizontalErrorGraph* plteBar4=new JKQTPBarHorizontalErrorGraph(plotBarchart2->getPlotter());
|
JKQTPBarHorizontalErrorGraph* plteBar4=new JKQTPBarHorizontalErrorGraph(plotBarchart2->getPlotter());
|
||||||
plteBar4->set_yColumn(bcpx);
|
plteBar4->setYColumn(bcpx);
|
||||||
plteBar4->set_xColumn(bcpy2);
|
plteBar4->setXColumn(bcpy2);
|
||||||
plteBar4->set_xErrorColumn(bcpye2);
|
plteBar4->setXErrorColumn(bcpye2);
|
||||||
plteBar4->set_title(tr("bars 2"));
|
plteBar4->setTitle(tr("bars 2"));
|
||||||
plteBar4->set_width(0.45);
|
plteBar4->setWidth(0.45);
|
||||||
plteBar4->set_shift(0.25);
|
plteBar4->setShift(0.25);
|
||||||
plteBar4->set_xErrorSymmetric(false);
|
plteBar4->setXErrorSymmetric(false);
|
||||||
plotBarchart2->getPlotter()->addGraph(plteBar4);
|
plotBarchart2->getPlotter()->addGraph(plteBar4);
|
||||||
|
|
||||||
plteBar4->autoscaleBarWidthAndShift(0.9, 1);
|
plteBar4->autoscaleBarWidthAndShift(0.9, 1);
|
||||||
@ -134,22 +134,22 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
|
|||||||
|
|
||||||
void TestWidgetBarcharts::setBarchartLogLog(bool checked)
|
void TestWidgetBarcharts::setBarchartLogLog(bool checked)
|
||||||
{
|
{
|
||||||
plotBarchart->getXAxis()->set_logAxis(checked);
|
plotBarchart->getXAxis()->setLogAxis(checked);
|
||||||
plotBarchart->getYAxis()->set_logAxis(checked);
|
plotBarchart->getYAxis()->setLogAxis(checked);
|
||||||
plotBarchart->zoomToFit();
|
plotBarchart->zoomToFit();
|
||||||
plotBarchart2->getXAxis()->set_logAxis(checked);
|
plotBarchart2->getXAxis()->setLogAxis(checked);
|
||||||
plotBarchart2->getYAxis()->set_logAxis(checked);
|
plotBarchart2->getYAxis()->setLogAxis(checked);
|
||||||
plotBarchart2->zoomToFit();
|
plotBarchart2->zoomToFit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetBarcharts::setBarchartAngele(int angle)
|
void TestWidgetBarcharts::setBarchartAngele(int angle)
|
||||||
{
|
{
|
||||||
plotBarchart->getXAxis()->set_tickLabelAngle(angle);
|
plotBarchart->getXAxis()->setTickLabelAngle(angle);
|
||||||
plotBarchart->getXAxis()->set_drawMode2(JKQTPCADMcomplete);
|
plotBarchart->getXAxis()->setDrawMode2(JKQTPCADMcomplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetBarcharts::setBarchartAngele2(int angle)
|
void TestWidgetBarcharts::setBarchartAngele2(int angle)
|
||||||
{
|
{
|
||||||
plotBarchart->getYAxis()->set_tickLabelAngle(angle);
|
plotBarchart->getYAxis()->setTickLabelAngle(angle);
|
||||||
plotBarchart->getYAxis()->set_drawMode2(JKQTPCADMcomplete);
|
plotBarchart->getYAxis()->setDrawMode2(JKQTPCADMcomplete);
|
||||||
}
|
}
|
||||||
|
@ -63,29 +63,29 @@ TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
|
|||||||
// size_t colContour=plotContour->getDatastore()->addCopiedImageAsColumnTranspose(histAlex.data(), histAlexNx, histAlexNy, tr("2Dhist"));
|
// size_t colContour=plotContour->getDatastore()->addCopiedImageAsColumnTranspose(histAlex.data(), histAlexNx, histAlexNy, tr("2Dhist"));
|
||||||
|
|
||||||
JKQTPColumnMathImage* densityplot=new JKQTPColumnMathImage(plotDensity->getPlotter());
|
JKQTPColumnMathImage* densityplot=new JKQTPColumnMathImage(plotDensity->getPlotter());
|
||||||
densityplot->set_x(-0.1);
|
densityplot->setX(-0.1);
|
||||||
densityplot->set_y(-0.1);
|
densityplot->setY(-0.1);
|
||||||
densityplot->set_width(1.1);
|
densityplot->setWidth(1.1);
|
||||||
densityplot->set_height(1.1);
|
densityplot->setHeight(1.1);
|
||||||
densityplot->set_Nx(histAlexNx);
|
densityplot->setNx(histAlexNx);
|
||||||
densityplot->set_Ny(histAlexNy);
|
densityplot->setNy(histAlexNy);
|
||||||
densityplot->set_palette(JKQTPMathImageINVERTED_OCEAN);
|
densityplot->setPalette(JKQTPMathImageINVERTED_OCEAN);
|
||||||
densityplot->set_imageColumn(colHist2D);
|
densityplot->setImageColumn(colHist2D);
|
||||||
densityplot->set_infColor(Qt::transparent);
|
densityplot->setInfColor(Qt::transparent);
|
||||||
densityplot->set_nanColor(Qt::transparent);
|
densityplot->setNanColor(Qt::transparent);
|
||||||
densityplot->set_title("density plot");
|
densityplot->setTitle("density plot");
|
||||||
plotDensity->addGraph(densityplot);
|
plotDensity->addGraph(densityplot);
|
||||||
|
|
||||||
densityplot=new JKQTPColumnMathImage(plotContour->getPlotter());
|
densityplot=new JKQTPColumnMathImage(plotContour->getPlotter());
|
||||||
densityplot->set_x(-0.1);
|
densityplot->setX(-0.1);
|
||||||
densityplot->set_y(-0.1);
|
densityplot->setY(-0.1);
|
||||||
densityplot->set_width(1.1);
|
densityplot->setWidth(1.1);
|
||||||
densityplot->set_height(1.1);
|
densityplot->setHeight(1.1);
|
||||||
densityplot->set_Nx(histAlexNx);
|
densityplot->setNx(histAlexNx);
|
||||||
densityplot->set_Ny(histAlexNy);
|
densityplot->setNy(histAlexNy);
|
||||||
densityplot->set_palette(JKQTPMathImageINVERTED_OCEAN);
|
densityplot->setPalette(JKQTPMathImageINVERTED_OCEAN);
|
||||||
densityplot->set_imageColumn(colHist2D);
|
densityplot->setImageColumn(colHist2D);
|
||||||
densityplot->set_title("density plot");
|
densityplot->setTitle("density plot");
|
||||||
plotContour->addGraph(densityplot);
|
plotContour->addGraph(densityplot);
|
||||||
plotContour->setGrid(false);
|
plotContour->setGrid(false);
|
||||||
plotDensity->zoom(-0.1,1.1,-0.1,1.1);
|
plotDensity->zoom(-0.1,1.1,-0.1,1.1);
|
||||||
@ -94,16 +94,16 @@ TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
|
|||||||
// levels<<5<<10<<25; // levels<<5.1<<10.1;
|
// levels<<5<<10<<25; // levels<<5.1<<10.1;
|
||||||
levels<<4<<5<<9<<14;
|
levels<<4<<5<<9<<14;
|
||||||
JKQTPContour* cp=new JKQTPContour(plotContour->getPlotter());
|
JKQTPContour* cp=new JKQTPContour(plotContour->getPlotter());
|
||||||
cp->set_x(-0.1);
|
cp->setX(-0.1);
|
||||||
cp->set_y(-0.1);
|
cp->setY(-0.1);
|
||||||
cp->set_width(1.1);
|
cp->setWidth(1.1);
|
||||||
cp->set_height(1.1);
|
cp->setHeight(1.1);
|
||||||
cp->set_Nx(histAlexNx);
|
cp->setNx(histAlexNx);
|
||||||
cp->set_Ny(histAlexNy);
|
cp->setNy(histAlexNy);
|
||||||
cp->set_imageColumn(colHist2D);
|
cp->setImageColumn(colHist2D);
|
||||||
// cp->set_palette(JKQTPMathImageINVERTED_OCEAN);
|
// cp->setPalette(JKQTPMathImageINVERTED_OCEAN);
|
||||||
cp->set_contourLevels(levels);
|
cp->setContourLevels(levels);
|
||||||
cp->set_title("contour plot");
|
cp->setTitle("contour plot");
|
||||||
plotContour->addGraph(cp);
|
plotContour->addGraph(cp);
|
||||||
plotContour->zoom(-0.1,1.1,-0.1,1.1);
|
plotContour->zoom(-0.1,1.1,-0.1,1.1);
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ TestWidgetEmptyPlot::TestWidgetEmptyPlot(QWidget *parent) :
|
|||||||
xef[i]=i;
|
xef[i]=i;
|
||||||
efy[i]=double(i%5)*1e-308;
|
efy[i]=double(i%5)*1e-308;
|
||||||
}
|
}
|
||||||
efunc->set_xColumn(plotEmpty->getDatastore()->addCopiedColumn(xef, NEMPTY, "x"));
|
efunc->setXColumn(plotEmpty->getDatastore()->addCopiedColumn(xef, NEMPTY, "x"));
|
||||||
efunc->set_yColumn(plotEmpty->getDatastore()->addCopiedColumn(efy, NEMPTY, "y"));
|
efunc->setYColumn(plotEmpty->getDatastore()->addCopiedColumn(efy, NEMPTY, "y"));
|
||||||
plotEmpty->addGraph(efunc);
|
plotEmpty->addGraph(efunc);
|
||||||
plotEmpty->getYAxis()->set_logAxis(true);
|
plotEmpty->getYAxis()->setLogAxis(true);
|
||||||
plotEmpty->zoomToFit();
|
plotEmpty->zoomToFit();
|
||||||
plotEmpty->setY(0,0);
|
plotEmpty->setY(0,0);
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
|
|||||||
plotFuncPlt=new JKQTPlotter(true, this);
|
plotFuncPlt=new JKQTPlotter(true, this);
|
||||||
plotFuncLayout->addWidget(plotFuncPlt);
|
plotFuncLayout->addWidget(plotFuncPlt);
|
||||||
pfunc=new JKQTPXParsedFunctionLineGraph(plotFuncPlt->getPlotter());
|
pfunc=new JKQTPXParsedFunctionLineGraph(plotFuncPlt->getPlotter());
|
||||||
pfunc->set_function("x^2/10+sin(x*pi*10)");
|
pfunc->setFunction("x^2/10+sin(x*pi*10)");
|
||||||
pfunc->set_errorFunction("x^2/20");
|
pfunc->setErrorFunction("x^2/20");
|
||||||
pfunc->set_drawErrorPolygons(true);
|
pfunc->setDrawErrorPolygons(true);
|
||||||
pfunc->set_style(Qt::DashLine);
|
pfunc->setStyle(Qt::DashLine);
|
||||||
plotFuncPlt->addGraph(pfunc);
|
plotFuncPlt->addGraph(pfunc);
|
||||||
plotFuncPlt->redrawPlot();
|
plotFuncPlt->redrawPlot();
|
||||||
|
|
||||||
@ -38,17 +38,17 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
|
|||||||
plotFuncLayout->addWidget(chkPFuncDrawLine);
|
plotFuncLayout->addWidget(chkPFuncDrawLine);
|
||||||
connect(chkPFuncDrawLine, SIGNAL(toggled(bool)), this, SLOT(setPFuncStyle()));
|
connect(chkPFuncDrawLine, SIGNAL(toggled(bool)), this, SLOT(setPFuncStyle()));
|
||||||
QSpinBox* spinPFunc=new QSpinBox(this);
|
QSpinBox* spinPFunc=new QSpinBox(this);
|
||||||
spinPFunc->setValue(pfunc->get_minSamples());
|
spinPFunc->setValue(pfunc->getMinSamples());
|
||||||
plotFuncLayout->addWidget(new QLabel(tr("min samples:"), this));
|
plotFuncLayout->addWidget(new QLabel(tr("min samples:"), this));
|
||||||
plotFuncLayout->addWidget(spinPFunc);
|
plotFuncLayout->addWidget(spinPFunc);
|
||||||
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMinPoint(int)));
|
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMinPoint(int)));
|
||||||
spinPFunc=new QSpinBox(this);
|
spinPFunc=new QSpinBox(this);
|
||||||
spinPFunc->setValue(pfunc->get_maxRefinementDegree());
|
spinPFunc->setValue(pfunc->getMaxRefinementDegree());
|
||||||
plotFuncLayout->addWidget(new QLabel(tr("max refinement degree:"), this));
|
plotFuncLayout->addWidget(new QLabel(tr("max refinement degree:"), this));
|
||||||
plotFuncLayout->addWidget(spinPFunc);
|
plotFuncLayout->addWidget(spinPFunc);
|
||||||
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMaxRefine(int)));
|
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMaxRefine(int)));
|
||||||
QComboBox* edtPFunc=new QComboBox(this);
|
QComboBox* edtPFunc=new QComboBox(this);
|
||||||
edtPFunc->addItem(pfunc->get_function());
|
edtPFunc->addItem(pfunc->getFunction());
|
||||||
edtPFunc->addItem("x");
|
edtPFunc->addItem("x");
|
||||||
edtPFunc->addItem("x^2");
|
edtPFunc->addItem("x^2");
|
||||||
edtPFunc->addItem("x^2-x^3");
|
edtPFunc->addItem("x^2-x^3");
|
||||||
@ -58,7 +58,7 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
|
|||||||
plotFuncLayout->addWidget(edtPFunc);
|
plotFuncLayout->addWidget(edtPFunc);
|
||||||
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFunc(QString)));
|
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFunc(QString)));
|
||||||
edtPFunc=new QComboBox(this);
|
edtPFunc=new QComboBox(this);
|
||||||
edtPFunc->addItem(pfunc->get_errorFunction());
|
edtPFunc->addItem(pfunc->getErrorFunction());
|
||||||
edtPFunc->addItem("");
|
edtPFunc->addItem("");
|
||||||
edtPFunc->addItem("x");
|
edtPFunc->addItem("x");
|
||||||
edtPFunc->addItem("cos(x)");
|
edtPFunc->addItem("cos(x)");
|
||||||
@ -69,11 +69,11 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
|
|||||||
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFuncE(QString)));
|
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFuncE(QString)));
|
||||||
QCheckBox* chkFLogX=new QCheckBox(tr("x-axis: log-scale"));
|
QCheckBox* chkFLogX=new QCheckBox(tr("x-axis: log-scale"));
|
||||||
chkFLogX->setChecked(false);
|
chkFLogX->setChecked(false);
|
||||||
connect(chkFLogX, SIGNAL(toggled(bool)), plotFuncPlt->getXAxis(), SLOT(set_logAxis(bool)));
|
connect(chkFLogX, SIGNAL(toggled(bool)), plotFuncPlt->getXAxis(), SLOT(setLogAxis(bool)));
|
||||||
plotFuncLayout->addWidget(chkFLogX);
|
plotFuncLayout->addWidget(chkFLogX);
|
||||||
QCheckBox* chkFLogY=new QCheckBox(tr("y-axis: log-scale"));
|
QCheckBox* chkFLogY=new QCheckBox(tr("y-axis: log-scale"));
|
||||||
chkFLogY->setChecked(false);
|
chkFLogY->setChecked(false);
|
||||||
connect(chkFLogY, SIGNAL(toggled(bool)), plotFuncPlt->getYAxis(), SLOT(set_logAxis(bool)));
|
connect(chkFLogY, SIGNAL(toggled(bool)), plotFuncPlt->getYAxis(), SLOT(setLogAxis(bool)));
|
||||||
plotFuncLayout->addWidget(chkFLogY);
|
plotFuncLayout->addWidget(chkFLogY);
|
||||||
|
|
||||||
|
|
||||||
@ -82,35 +82,35 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
|
|||||||
|
|
||||||
void TestWidgetFunctionPlots::setPFuncStyle()
|
void TestWidgetFunctionPlots::setPFuncStyle()
|
||||||
{
|
{
|
||||||
pfunc->set_drawErrorLines(false);
|
pfunc->setDrawErrorLines(false);
|
||||||
pfunc->set_drawErrorPolygons(false);
|
pfunc->setDrawErrorPolygons(false);
|
||||||
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorLines) pfunc->set_drawErrorLines(true);
|
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorLines) pfunc->setDrawErrorLines(true);
|
||||||
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorPolygons) pfunc->set_drawErrorPolygons(true);
|
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorPolygons) pfunc->setDrawErrorPolygons(true);
|
||||||
pfunc->set_drawLine(chkPFuncDrawLine->isChecked());
|
pfunc->setDrawLine(chkPFuncDrawLine->isChecked());
|
||||||
pfunc->set_displaySamplePoints(chkPFuncDrawSamples->isChecked());
|
pfunc->setDisplaySamplePoints(chkPFuncDrawSamples->isChecked());
|
||||||
plotFuncPlt->redrawPlot();
|
plotFuncPlt->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetFunctionPlots::setPFuncMinPoint(int value)
|
void TestWidgetFunctionPlots::setPFuncMinPoint(int value)
|
||||||
{
|
{
|
||||||
pfunc->set_minSamples(value);
|
pfunc->setMinSamples(value);
|
||||||
plotFuncPlt->redrawPlot();
|
plotFuncPlt->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetFunctionPlots::setPFuncMaxRefine(int value)
|
void TestWidgetFunctionPlots::setPFuncMaxRefine(int value)
|
||||||
{
|
{
|
||||||
pfunc->set_maxRefinementDegree(value);
|
pfunc->setMaxRefinementDegree(value);
|
||||||
plotFuncPlt->redrawPlot();
|
plotFuncPlt->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetFunctionPlots::setPFunc(const QString &expression)
|
void TestWidgetFunctionPlots::setPFunc(const QString &expression)
|
||||||
{
|
{
|
||||||
pfunc->set_function(expression);
|
pfunc->setFunction(expression);
|
||||||
plotFuncPlt->redrawPlot();
|
plotFuncPlt->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetFunctionPlots::setPFuncE(const QString &expression)
|
void TestWidgetFunctionPlots::setPFuncE(const QString &expression)
|
||||||
{
|
{
|
||||||
pfunc->set_errorFunction(expression);
|
pfunc->setErrorFunction(expression);
|
||||||
plotFuncPlt->redrawPlot();
|
plotFuncPlt->redrawPlot();
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
|
|||||||
plotGeo->setXY(0,1,0,1);
|
plotGeo->setXY(0,1,0,1);
|
||||||
plotGeo->getPlotter()->getXAxis()->setAxisLabel("$x$ [mm]");
|
plotGeo->getPlotter()->getXAxis()->setAxisLabel("$x$ [mm]");
|
||||||
plotGeo->getPlotter()->getYAxis()->setAxisLabel("$y$ [mm]");
|
plotGeo->getPlotter()->getYAxis()->setAxisLabel("$y$ [mm]");
|
||||||
/*plotGeo->getPlotter()->getXAxis()->set_linkedAxis(plotGeo->getPlotter()->getYAxis());
|
/*plotGeo->getPlotter()->getXAxis()->setLinkedAxis(plotGeo->getPlotter()->getYAxis());
|
||||||
plotGeo->getPlotter()->getXAxis()->set_changeWidthToAspectRatio(true);*/
|
plotGeo->getPlotter()->getXAxis()->setChangeWidthToAspectRatio(true);*/
|
||||||
plotGeo->getPlotter()->setMaintainAspectRatio(true);
|
plotGeo->getPlotter()->setMaintainAspectRatio(true);
|
||||||
plotGeo->getPlotter()->setAspectRatio(1);
|
plotGeo->getPlotter()->setAspectRatio(1);
|
||||||
plotGeo->getPlotter()->setMaintainAxisAspectRatio(true);
|
plotGeo->getPlotter()->setMaintainAxisAspectRatio(true);
|
||||||
@ -36,16 +36,16 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
|
|||||||
//plotGeo->getPlotter()->addGraph(line2);
|
//plotGeo->getPlotter()->addGraph(line2);
|
||||||
|
|
||||||
JKQTPGeoRectangle* rect1=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,2, QColor("blue"),2, Qt::SolidLine, QColor("lightblue"));
|
JKQTPGeoRectangle* rect1=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,2, QColor("blue"),2, Qt::SolidLine, QColor("lightblue"));
|
||||||
rect1->set_angle(30);
|
rect1->setAngle(30);
|
||||||
//plotGeo->getPlotter()->addGraph(rect1);
|
//plotGeo->getPlotter()->addGraph(rect1);
|
||||||
JKQTPGeoRectangle* rect2=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,2, QColor("red"),2);
|
JKQTPGeoRectangle* rect2=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,2, QColor("red"),2);
|
||||||
rect2->set_angle(45);
|
rect2->setAngle(45);
|
||||||
//plotGeo->getPlotter()->addGraph(rect2);
|
//plotGeo->getPlotter()->addGraph(rect2);
|
||||||
JKQTPGeoRectangle* rect3=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,4, QColor("green"),2);
|
JKQTPGeoRectangle* rect3=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,4, QColor("green"),2);
|
||||||
rect3->set_angle(-30);
|
rect3->setAngle(-30);
|
||||||
//plotGeo->getPlotter()->addGraph(rect3);
|
//plotGeo->getPlotter()->addGraph(rect3);
|
||||||
JKQTPGeoEllipse* ell3=new JKQTPGeoEllipse(plotGeo->getPlotter(), 1,1,2,4, QColor("green"),2, Qt::SolidLine, QColor("lightgreen"), Qt::CrossPattern);
|
JKQTPGeoEllipse* ell3=new JKQTPGeoEllipse(plotGeo->getPlotter(), 1,1,2,4, QColor("green"),2, Qt::SolidLine, QColor("lightgreen"), Qt::CrossPattern);
|
||||||
ell3->set_angle(-30);
|
ell3->setAngle(-30);
|
||||||
//plotGeo->getPlotter()->addGraph(ell3);
|
//plotGeo->getPlotter()->addGraph(ell3);
|
||||||
|
|
||||||
QVector<QPointF> p;
|
QVector<QPointF> p;
|
||||||
@ -76,7 +76,7 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
|
|||||||
JKQTPGeoInfiniteLine* iline2=new JKQTPGeoInfiniteLine(plotGeo->getPlotter(), 0.5,1,0,1, QColor("red"), 3);
|
JKQTPGeoInfiniteLine* iline2=new JKQTPGeoInfiniteLine(plotGeo->getPlotter(), 0.5,1,0,1, QColor("red"), 3);
|
||||||
plotGeo->getPlotter()->addGraph(iline2);
|
plotGeo->getPlotter()->addGraph(iline2);
|
||||||
JKQTPGeoInfiniteLine* iline3=new JKQTPGeoInfiniteLine(plotGeo->getPlotter(), 0.5,1,-1,0.5, QColor("green"), 3);
|
JKQTPGeoInfiniteLine* iline3=new JKQTPGeoInfiniteLine(plotGeo->getPlotter(), 0.5,1,-1,0.5, QColor("green"), 3);
|
||||||
iline3->set_two_sided(true);
|
iline3->setTwoSided(true);
|
||||||
plotGeo->getPlotter()->addGraph(iline3);
|
plotGeo->getPlotter()->addGraph(iline3);
|
||||||
|
|
||||||
JKQTPGeoText* text=new JKQTPGeoText(plotGeo->getPlotter(), -1, -1, "Test $f(x)=\\sqrt{\\sin(x^2)}$ \\textbf{bold}", 12, QColor("red"));
|
JKQTPGeoText* text=new JKQTPGeoText(plotGeo->getPlotter(), -1, -1, "Test $f(x)=\\sqrt{\\sin(x^2)}$ \\textbf{bold}", 12, QColor("red"));
|
||||||
|
@ -107,7 +107,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
size_t id=plot->getPlotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPFilledCurveX);
|
size_t id=plot->getPlotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPFilledCurveX);
|
||||||
JKQTPFilledCurveXGraph* fcxgr=qobject_cast<JKQTPFilledCurveXGraph*>(plot->getPlotter()->getGraph(id));
|
JKQTPFilledCurveXGraph* fcxgr=qobject_cast<JKQTPFilledCurveXGraph*>(plot->getPlotter()->getGraph(id));
|
||||||
if (fcxgr) {
|
if (fcxgr) {
|
||||||
fcxgr->set_baseline(2);
|
fcxgr->setBaseline(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t yeb=plot->getPlotter()->addGraphWithXYError(cx2, cy21, cy22, cy22, "sine with errors", JKQTPFilledCurveX);
|
size_t yeb=plot->getPlotter()->addGraphWithXYError(cx2, cy21, cy22, cy22, "sine with errors", JKQTPFilledCurveX);
|
||||||
@ -117,13 +117,13 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
plteSymbols=plot->getPlotter()->getGraph(yeb);
|
plteSymbols=plot->getPlotter()->getGraph(yeb);
|
||||||
|
|
||||||
pltePlot2=new JKQTPXYLineErrorGraph(plotBot->getPlotter());
|
pltePlot2=new JKQTPXYLineErrorGraph(plotBot->getPlotter());
|
||||||
pltePlot2->set_xColumn(cx2r);
|
pltePlot2->setXColumn(cx2r);
|
||||||
pltePlot2->set_yColumn(cy21r);
|
pltePlot2->setYColumn(cy21r);
|
||||||
pltePlot2->set_title(tr("random numbers"));
|
pltePlot2->setTitle(tr("random numbers"));
|
||||||
pltePlot2->set_drawLine(true);
|
pltePlot2->setDrawLine(true);
|
||||||
pltePlot2->set_yErrorColumn(cy21re);
|
pltePlot2->setYErrorColumn(cy21re);
|
||||||
pltePlot2->set_yErrorStyle(JKQTPErrorBarsPolygons);
|
pltePlot2->setYErrorStyle(JKQTPErrorBarsPolygons);
|
||||||
pltePlot2->set_symbol(JKQTPFilledStar);
|
pltePlot2->setSymbol(JKQTPFilledStar);
|
||||||
plotBot->getPlotter()->addGraph(pltePlot2);
|
plotBot->getPlotter()->addGraph(pltePlot2);
|
||||||
plotBot->zoomToFit();
|
plotBot->zoomToFit();
|
||||||
|
|
||||||
@ -165,50 +165,50 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
plot->getPlotter()->addVerticalBargraph(cb, cbp, ts);
|
plot->getPlotter()->addVerticalBargraph(cb, cbp, ts);
|
||||||
|
|
||||||
JKQTPVerticalRange* r1=new JKQTPVerticalRange(plot->getPlotter());
|
JKQTPVerticalRange* r1=new JKQTPVerticalRange(plot->getPlotter());
|
||||||
r1->set_rangeMin(5);
|
r1->setRangeMin(5);
|
||||||
r1->set_rangeMax(10);
|
r1->setRangeMax(10);
|
||||||
r1->set_rangeCenter(7.5);
|
r1->setRangeCenter(7.5);
|
||||||
r1->set_title("vert. range");
|
r1->setTitle("vert. range");
|
||||||
plot->getPlotter()->addGraph(r1);
|
plot->getPlotter()->addGraph(r1);
|
||||||
|
|
||||||
JKQTPHorizontalRange* r2=new JKQTPHorizontalRange(plot->getPlotter());
|
JKQTPHorizontalRange* r2=new JKQTPHorizontalRange(plot->getPlotter());
|
||||||
r2->set_rangeMin(5);
|
r2->setRangeMin(5);
|
||||||
r2->set_rangeMax(10);
|
r2->setRangeMax(10);
|
||||||
r2->set_rangeCenter(7.5);
|
r2->setRangeCenter(7.5);
|
||||||
r2->set_title("hor. range");
|
r2->setTitle("hor. range");
|
||||||
plot->getPlotter()->addGraph(r2);
|
plot->getPlotter()->addGraph(r2);
|
||||||
|
|
||||||
JKQTPBoxplotVerticalGraph* box=new JKQTPBoxplotVerticalGraph(plotBot2->getPlotter());
|
JKQTPBoxplotVerticalGraph* box=new JKQTPBoxplotVerticalGraph(plotBot2->getPlotter());
|
||||||
box->set_posColumn(cbxbox);
|
box->setPosColumn(cbxbox);
|
||||||
box->set_medianColumn(cbmed);
|
box->setMedianColumn(cbmed);
|
||||||
box->set_meanColumn(cbmean);
|
box->setMeanColumn(cbmean);
|
||||||
box->set_minColumn(cbmin);
|
box->setMinColumn(cbmin);
|
||||||
box->set_maxColumn(cbmax);
|
box->setMaxColumn(cbmax);
|
||||||
box->set_percentile25Column(cbp25);
|
box->setPercentile25Column(cbp25);
|
||||||
box->set_percentile75Column(cbp75);
|
box->setPercentile75Column(cbp75);
|
||||||
box->set_title("Boxplot");
|
box->setTitle("Boxplot");
|
||||||
plotBot2->addGraph(box);
|
plotBot2->addGraph(box);
|
||||||
plotBot2->zoomToFit();
|
plotBot2->zoomToFit();
|
||||||
|
|
||||||
/*JKQTPYFunctionLineGraph* g=new JKQTPYFunctionLineGraph(&plot);
|
/*JKQTPYFunctionLineGraph* g=new JKQTPYFunctionLineGraph(&plot);
|
||||||
g->set_title("function 1");
|
g->setTitle("function 1");
|
||||||
g->setPlotFunction(f1);
|
g->setPlotFunction(f1);
|
||||||
g->set_errorFunction(f1e);
|
g->setErrorFunction(f1e);
|
||||||
g->set_drawErrorLines(true);
|
g->setDrawErrorLines(true);
|
||||||
g->set_drawErrorPolygons(false);
|
g->setDrawErrorPolygons(false);
|
||||||
g->set_color(QColor("red"));
|
g->setColor(QColor("red"));
|
||||||
plot->addGraph(g);*/
|
plot->addGraph(g);*/
|
||||||
|
|
||||||
/*JKQTPXFunctionLineGraph* g=new JKQTPXFunctionLineGraph(&plot);
|
/*JKQTPXFunctionLineGraph* g=new JKQTPXFunctionLineGraph(&plot);
|
||||||
g->set_title("function 2");
|
g->setTitle("function 2");
|
||||||
g->setPlotFunction(f2);
|
g->setPlotFunction(f2);
|
||||||
plot->addGraph(g);*/
|
plot->addGraph(g);*/
|
||||||
|
|
||||||
/*JKQTPStepVerticalGraph* g=new JKQTPStepVerticalGraph(&plot);
|
/*JKQTPStepVerticalGraph* g=new JKQTPStepVerticalGraph(&plot);
|
||||||
g->set_xColumn(cy11);
|
g->setXColumn(cy11);
|
||||||
g->set_yColumn(cx1);
|
g->setYColumn(cx1);
|
||||||
g->set_fillCurve(true);
|
g->setFillCurve(true);
|
||||||
g->set_valuesCentered(true);
|
g->setValuesCentered(true);
|
||||||
plot->addGraph(g);
|
plot->addGraph(g);
|
||||||
plot->addGraph(cy11, cx1, "$\\sin(x)$", JKQTPPoints);*/
|
plot->addGraph(cy11, cx1, "$\\sin(x)$", JKQTPPoints);*/
|
||||||
|
|
||||||
@ -218,16 +218,16 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
|
|
||||||
QCheckBox* chklogX=new QCheckBox("logarithmic X-axis", this);
|
QCheckBox* chklogX=new QCheckBox("logarithmic X-axis", this);
|
||||||
QCheckBox* chklogY=new QCheckBox("logarithmic Y-axis", this);
|
QCheckBox* chklogY=new QCheckBox("logarithmic Y-axis", this);
|
||||||
connect(chklogX, SIGNAL(toggled(bool)), plot->getPlotter()->getXAxis(), SLOT(set_logAxis(bool)));
|
connect(chklogX, SIGNAL(toggled(bool)), plot->getPlotter()->getXAxis(), SLOT(setLogAxis(bool)));
|
||||||
connect(chklogY, SIGNAL(toggled(bool)), plot->getPlotter()->getYAxis(), SLOT(set_logAxis(bool)));
|
connect(chklogY, SIGNAL(toggled(bool)), plot->getPlotter()->getYAxis(), SLOT(setLogAxis(bool)));
|
||||||
connect(chklogX, SIGNAL(toggled(bool)), plotBot2->getPlotter()->getXAxis(), SLOT(set_logAxis(bool)));
|
connect(chklogX, SIGNAL(toggled(bool)), plotBot2->getPlotter()->getXAxis(), SLOT(setLogAxis(bool)));
|
||||||
connect(chklogY, SIGNAL(toggled(bool)), plotBot2->getPlotter()->getYAxis(), SLOT(set_logAxis(bool)));
|
connect(chklogY, SIGNAL(toggled(bool)), plotBot2->getPlotter()->getYAxis(), SLOT(setLogAxis(bool)));
|
||||||
layout->addWidget(chklogX);
|
layout->addWidget(chklogX);
|
||||||
layout->addWidget(chklogY);
|
layout->addWidget(chklogY);
|
||||||
QCheckBox* chkInvertX=new QCheckBox("invert X-axis", this);
|
QCheckBox* chkInvertX=new QCheckBox("invert X-axis", this);
|
||||||
QCheckBox* chkInvertY=new QCheckBox("invert Y-axis", this);
|
QCheckBox* chkInvertY=new QCheckBox("invert Y-axis", this);
|
||||||
connect(chkInvertX, SIGNAL(toggled(bool)), plot->getPlotter()->getXAxis(), SLOT(set_inverted(bool)));
|
connect(chkInvertX, SIGNAL(toggled(bool)), plot->getPlotter()->getXAxis(), SLOT(setInverted(bool)));
|
||||||
connect(chkInvertY, SIGNAL(toggled(bool)), plot->getPlotter()->getYAxis(), SLOT(set_inverted(bool)));
|
connect(chkInvertY, SIGNAL(toggled(bool)), plot->getPlotter()->getYAxis(), SLOT(setInverted(bool)));
|
||||||
layout->addWidget(chkInvertX);
|
layout->addWidget(chkInvertX);
|
||||||
layout->addWidget(chkInvertY);
|
layout->addWidget(chkInvertY);
|
||||||
layout->addWidget(chkInvertX);
|
layout->addWidget(chkInvertX);
|
||||||
@ -285,12 +285,12 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetGraphs::moveovl() {
|
void TestWidgetGraphs::moveovl() {
|
||||||
ovl1->set_position(ovl1->get_position()+0.1);
|
ovl1->setPosition(ovl1->getPosition()+0.1);
|
||||||
if (ovl1->get_position()>30) ovl1->set_position(0);
|
if (ovl1->getPosition()>30) ovl1->setPosition(0);
|
||||||
ovlCnt++;
|
ovlCnt++;
|
||||||
if (ovlCnt>20) {
|
if (ovlCnt>20) {
|
||||||
double fps=double(ovlCnt)/(double(ovlTime.elapsed())/1000.0);
|
double fps=double(ovlCnt)/(double(ovlTime.elapsed())/1000.0);
|
||||||
ovl1->set_text(QString("%1 fps").arg(fps));
|
ovl1->setText(QString("%1 fps").arg(fps));
|
||||||
ovlCnt=0;
|
ovlCnt=0;
|
||||||
ovlTime.start();
|
ovlTime.start();
|
||||||
}
|
}
|
||||||
@ -307,10 +307,10 @@ void TestWidgetGraphs::setErrorStyle(int /*index*/)
|
|||||||
// JKQTPXGraphErrors* ex=dynamic_cast<JKQTPXGraphErrors*>(plteErrors);
|
// JKQTPXGraphErrors* ex=dynamic_cast<JKQTPXGraphErrors*>(plteErrors);
|
||||||
JKQTPYGraphErrors* ey=dynamic_cast<JKQTPYGraphErrors*>(plteErrors);
|
JKQTPYGraphErrors* ey=dynamic_cast<JKQTPYGraphErrors*>(plteErrors);
|
||||||
if (exy) {
|
if (exy) {
|
||||||
exy->set_yErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
|
exy->setYErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
|
||||||
}
|
}
|
||||||
if (ey) {
|
if (ey) {
|
||||||
ey->set_yErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
|
ey->setYErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
|
||||||
}
|
}
|
||||||
plot->redrawPlot();
|
plot->redrawPlot();
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ void TestWidgetGraphs::setESSymbol(int /*index*/)
|
|||||||
if (cmb) {
|
if (cmb) {
|
||||||
JKQTPXYLineGraph* exy=dynamic_cast<JKQTPXYLineGraph*>(plteSymbols);
|
JKQTPXYLineGraph* exy=dynamic_cast<JKQTPXYLineGraph*>(plteSymbols);
|
||||||
if (exy) {
|
if (exy) {
|
||||||
exy->set_symbol(String2JKQTPGraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
|
exy->setSymbol(String2JKQTPGraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
plot->redrawPlot();
|
plot->redrawPlot();
|
||||||
@ -332,9 +332,9 @@ void TestWidgetGraphs::setESSymbol(int /*index*/)
|
|||||||
|
|
||||||
void TestWidgetGraphs::setSortOrder2(int index)
|
void TestWidgetGraphs::setSortOrder2(int index)
|
||||||
{
|
{
|
||||||
if (index==0) pltePlot2->set_sortData(JKQTPXYGraph::Unsorted);
|
if (index==0) pltePlot2->setSortData(JKQTPXYGraph::Unsorted);
|
||||||
if (index==1) pltePlot2->set_sortData(JKQTPXYLineGraph::SortedX);
|
if (index==1) pltePlot2->setSortData(JKQTPXYLineGraph::SortedX);
|
||||||
if (index==2) pltePlot2->set_sortData(JKQTPXYLineGraph::SortedY);
|
if (index==2) pltePlot2->setSortData(JKQTPXYLineGraph::SortedY);
|
||||||
plotBot->redrawPlot();
|
plotBot->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
|
|||||||
plotImg->getPlotter()->setAspectRatio(3.0/2.0);
|
plotImg->getPlotter()->setAspectRatio(3.0/2.0);
|
||||||
plotImg->getPlotter()->setMaintainAxisAspectRatio(true);
|
plotImg->getPlotter()->setMaintainAxisAspectRatio(true);
|
||||||
plotImg->getPlotter()->setAxisAspectRatio(4.0);
|
plotImg->getPlotter()->setAxisAspectRatio(4.0);
|
||||||
/*plotImg->getPlotter()->getXAxis()->set_linkedAxis(plotImg->getPlotter()->getYAxis());
|
/*plotImg->getPlotter()->getXAxis()->setLinkedAxis(plotImg->getPlotter()->getYAxis());
|
||||||
plotImg->getPlotter()->getXAxis()->set_changeWidthToAspectRatio(true);
|
plotImg->getPlotter()->getXAxis()->setChangeWidthToAspectRatio(true);
|
||||||
plotImg->getPlotter()->getXAxis()->setAspectRatio(1.0);*/
|
plotImg->getPlotter()->getXAxis()->setAspectRatio(1.0);*/
|
||||||
|
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
|
|||||||
plotImg->setAbsoluteXY(0,30,0,20);
|
plotImg->setAbsoluteXY(0,30,0,20);
|
||||||
img1=QImage(":/lena.png");
|
img1=QImage(":/lena.png");
|
||||||
JKQTPImage* pimg1=new JKQTPImage(0,0,10,20, &img1, plotImg->getPlotter());
|
JKQTPImage* pimg1=new JKQTPImage(0,0,10,20, &img1, plotImg->getPlotter());
|
||||||
pimg1->set_title("LENA");
|
pimg1->setTitle("LENA");
|
||||||
plotImg->getPlotter()->addGraph(pimg1);
|
plotImg->getPlotter()->addGraph(pimg1);
|
||||||
double* img2=(double*)calloc(100*100,sizeof(double));
|
double* img2=(double*)calloc(100*100,sizeof(double));
|
||||||
int32_t* img2M=(int32_t*)calloc(100*100,sizeof(int32_t));
|
int32_t* img2M=(int32_t*)calloc(100*100,sizeof(int32_t));
|
||||||
@ -52,39 +52,39 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
pimg2=new JKQTPMathImage(10,0,10,10, JKQTPMathImageBase::DoubleArray, img2, 100, 100, JKQTPMathImageGRAY, plotImg->getPlotter());
|
pimg2=new JKQTPMathImage(10,0,10,10, JKQTPMathImageBase::DoubleArray, img2, 100, 100, JKQTPMathImageGRAY, plotImg->getPlotter());
|
||||||
pimg2->set_imageMin(-1);
|
pimg2->setImageMin(-1);
|
||||||
pimg2->set_imageMax(0.5);
|
pimg2->setImageMax(0.5);
|
||||||
pimg2->set_imageName("left image");
|
pimg2->setImageName("left image");
|
||||||
pimg2->set_title("left image");
|
pimg2->setTitle("left image");
|
||||||
pimg2->set_autoImageRange(false);
|
pimg2->setAutoImageRange(false);
|
||||||
pimg2->set_colorBarTopVisible(true);
|
pimg2->setColorBarTopVisible(true);
|
||||||
pimg2->set_colorBarRightVisible(false);
|
pimg2->setColorBarRightVisible(false);
|
||||||
plotImg->getPlotter()->addGraph(pimg2);
|
plotImg->getPlotter()->addGraph(pimg2);
|
||||||
pimg3=new JKQTPMathImage(20,0,10,10, JKQTPMathImageBase::DoubleArray, img2, 100, 100, JKQTPMathImageMATLAB, plotImg->getPlotter());
|
pimg3=new JKQTPMathImage(20,0,10,10, JKQTPMathImageBase::DoubleArray, img2, 100, 100, JKQTPMathImageMATLAB, plotImg->getPlotter());
|
||||||
pimg3->set_colorBarTopVisible(true);
|
pimg3->setColorBarTopVisible(true);
|
||||||
pimg3->set_colorBarRightVisible(true);
|
pimg3->setColorBarRightVisible(true);
|
||||||
pimg3->set_imageMax(0.5);
|
pimg3->setImageMax(0.5);
|
||||||
pimg3->set_rangeMaxFailAction(JKQTPMathImageGivenColor);
|
pimg3->setRangeMaxFailAction(JKQTPMathImageGivenColor);
|
||||||
pimg3->set_rangeMaxFailColor(QColor("salmon"));
|
pimg3->setRangeMaxFailColor(QColor("salmon"));
|
||||||
pimg3->set_imageMin(-0.3);
|
pimg3->setImageMin(-0.3);
|
||||||
pimg3->set_rangeMinFailAction(JKQTPMathImageTransparent);
|
pimg3->setRangeMinFailAction(JKQTPMathImageTransparent);
|
||||||
pimg3->set_autoImageRange(false);
|
pimg3->setAutoImageRange(false);
|
||||||
pimg3->set_imageName("I(x,y)=\\sin\\left(\\frac{2\\pi\\cdot\\sqrt{1+x^2+y^2}}{20}\\right)");
|
pimg3->setImageName("I(x,y)=\\sin\\left(\\frac{2\\pi\\cdot\\sqrt{1+x^2+y^2}}{20}\\right)");
|
||||||
pimg3->set_dataModifier(img2M, JKQTPMathImageBase::Int32Array);
|
pimg3->setDataModifier(img2M, JKQTPMathImageBase::Int32Array);
|
||||||
pimg3->set_modifierMode(JKQTPMathImageBase::ModifyNone);
|
pimg3->setModifierMode(JKQTPMathImageBase::ModifyNone);
|
||||||
pimg3->set_title("right image");
|
pimg3->setTitle("right image");
|
||||||
plotImg->getPlotter()->addGraph(pimg3);
|
plotImg->getPlotter()->addGraph(pimg3);
|
||||||
|
|
||||||
QColor ty=QColor("blue");
|
QColor ty=QColor("blue");
|
||||||
ty.setAlphaF(0.1);
|
ty.setAlphaF(0.1);
|
||||||
JKQTPOverlayImage* oimg1=new JKQTPOverlayImage(10,0,10,10, bimg2, 100, 100, QColor("blue"), plotImg->getPlotter());
|
JKQTPOverlayImage* oimg1=new JKQTPOverlayImage(10,0,10,10, bimg2, 100, 100, QColor("blue"), plotImg->getPlotter());
|
||||||
oimg1->set_title("overlay");
|
oimg1->setTitle("overlay");
|
||||||
oimg1->set_falseColor(ty);
|
oimg1->setFalseColor(ty);
|
||||||
plotImg->getPlotter()->addGraph(oimg1);
|
plotImg->getPlotter()->addGraph(oimg1);
|
||||||
|
|
||||||
JKQTPOverlayImageEnhanced* oimg2=new JKQTPOverlayImageEnhanced(10,0,10,10, bimg2, 100, 100, QColor("red"), plotImg->getPlotter());
|
JKQTPOverlayImageEnhanced* oimg2=new JKQTPOverlayImageEnhanced(10,0,10,10, bimg2, 100, 100, QColor("red"), plotImg->getPlotter());
|
||||||
oimg2->set_title("enhanced overlay");
|
oimg2->setTitle("enhanced overlay");
|
||||||
oimg2->set_drawAsRectangles(false);
|
oimg2->setDrawAsRectangles(false);
|
||||||
plotImg->getPlotter()->addGraph(oimg2);
|
plotImg->getPlotter()->addGraph(oimg2);
|
||||||
|
|
||||||
plotImg->setPlotUpdateEnabled(true);
|
plotImg->setPlotUpdateEnabled(true);
|
||||||
@ -116,18 +116,18 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
|
|||||||
|
|
||||||
void TestWidgetImages::setImgPalette(int index)
|
void TestWidgetImages::setImgPalette(int index)
|
||||||
{
|
{
|
||||||
pimg3->set_palette(index);
|
pimg3->setPalette(index);
|
||||||
plotImg->redrawPlot();
|
plotImg->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetImages::setImgPalette1(int index)
|
void TestWidgetImages::setImgPalette1(int index)
|
||||||
{
|
{
|
||||||
pimg2->set_palette(index);
|
pimg2->setPalette(index);
|
||||||
plotImg->redrawPlot();
|
plotImg->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetImages::setImgModifier(int index)
|
void TestWidgetImages::setImgModifier(int index)
|
||||||
{
|
{
|
||||||
pimg3->set_modifierMode(JKQTPMathImage::ModifierMode(index));
|
pimg3->setModifierMode(JKQTPMathImage::ModifierMode(index));
|
||||||
plotImg->redrawPlot();
|
plotImg->redrawPlot();
|
||||||
}
|
}
|
||||||
|
@ -47,64 +47,64 @@ TestWidgetLogGraphs::TestWidgetLogGraphs(QWidget *parent) :
|
|||||||
|
|
||||||
QCheckBox* chklogX=new QCheckBox("logarithmic X-axis", this);
|
QCheckBox* chklogX=new QCheckBox("logarithmic X-axis", this);
|
||||||
QCheckBox* chklogY=new QCheckBox("logarithmic Y-axis", this);
|
QCheckBox* chklogY=new QCheckBox("logarithmic Y-axis", this);
|
||||||
connect(chklogX, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(set_logAxis(bool)));
|
connect(chklogX, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(setLogAxis(bool)));
|
||||||
connect(chklogY, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(set_logAxis(bool)));
|
connect(chklogY, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(setLogAxis(bool)));
|
||||||
layWid->addWidget(chklogX);
|
layWid->addWidget(chklogX);
|
||||||
layWid->addWidget(chklogY);
|
layWid->addWidget(chklogY);
|
||||||
|
|
||||||
|
|
||||||
QCheckBox* chkXMinorTicks=new QCheckBox("minor X-tick labels", this);
|
QCheckBox* chkXMinorTicks=new QCheckBox("minor X-tick labels", this);
|
||||||
QCheckBox* chkYMinorTicks=new QCheckBox("minor Y-tick labels", this);
|
QCheckBox* chkYMinorTicks=new QCheckBox("minor Y-tick labels", this);
|
||||||
connect(chkXMinorTicks, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(set_minorTickLabelsEnabled(bool)));
|
connect(chkXMinorTicks, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(setMinorTickLabelsEnabled(bool)));
|
||||||
connect(chkYMinorTicks, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(set_minorTickLabelsEnabled(bool)));
|
connect(chkYMinorTicks, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(setMinorTickLabelsEnabled(bool)));
|
||||||
layWid->addWidget(chkXMinorTicks);
|
layWid->addWidget(chkXMinorTicks);
|
||||||
layWid->addWidget(chkYMinorTicks);
|
layWid->addWidget(chkYMinorTicks);
|
||||||
|
|
||||||
QCheckBox* chkFullNumberMinor=new QCheckBox("full minor numbers", this);
|
QCheckBox* chkFullNumberMinor=new QCheckBox("full minor numbers", this);
|
||||||
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(set_minorTickLabelFullNumber(bool)));
|
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(setMinorTickLabelFullNumber(bool)));
|
||||||
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(set_minorTickLabelFullNumber(bool)));
|
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(setMinorTickLabelFullNumber(bool)));
|
||||||
layWid->addWidget(chkFullNumberMinor);
|
layWid->addWidget(chkFullNumberMinor);
|
||||||
|
|
||||||
QComboBox* cmbTickMode=new QComboBox(this);
|
QComboBox* cmbTickMode=new QComboBox(this);
|
||||||
cmbTickMode->addItem("JKQTPLTMLinOrLog");
|
cmbTickMode->addItem("JKQTPLTMLinOrLog");
|
||||||
cmbTickMode->addItem("JKQTPLTMLin");
|
cmbTickMode->addItem("JKQTPLTMLin");
|
||||||
cmbTickMode->addItem("JKQTPLTMPower");
|
cmbTickMode->addItem("JKQTPLTMPower");
|
||||||
connect(cmbTickMode, SIGNAL(currentIndexChanged(int)), plotLOG->getPlotter()->getXAxis(), SLOT(set_tickMode(int)));
|
connect(cmbTickMode, SIGNAL(currentIndexChanged(int)), plotLOG->getPlotter()->getXAxis(), SLOT(setTickMode(int)));
|
||||||
layWid->addRow("X-Axis TickMode", cmbTickMode);
|
layWid->addRow("X-Axis TickMode", cmbTickMode);
|
||||||
|
|
||||||
cmbTickMode=new QComboBox(this);
|
cmbTickMode=new QComboBox(this);
|
||||||
cmbTickMode->addItem("JKQTPLTMLinOrLog");
|
cmbTickMode->addItem("JKQTPLTMLinOrLog");
|
||||||
cmbTickMode->addItem("JKQTPLTMLin");
|
cmbTickMode->addItem("JKQTPLTMLin");
|
||||||
cmbTickMode->addItem("JKQTPLTMPower");
|
cmbTickMode->addItem("JKQTPLTMPower");
|
||||||
connect(cmbTickMode, SIGNAL(currentIndexChanged(int)), plotLOG->getPlotter()->getYAxis(), SLOT(set_tickMode(int)));
|
connect(cmbTickMode, SIGNAL(currentIndexChanged(int)), plotLOG->getPlotter()->getYAxis(), SLOT(setTickMode(int)));
|
||||||
layWid->addRow("Y-Axis TickMode", cmbTickMode);
|
layWid->addRow("Y-Axis TickMode", cmbTickMode);
|
||||||
cmbTickMode->setCurrentIndex(0);
|
cmbTickMode->setCurrentIndex(0);
|
||||||
plotLOG->getPlotter()->getYAxis()->set_tickMode(JKQTPLTMLinOrPower);
|
plotLOG->getPlotter()->getYAxis()->setTickMode(JKQTPLTMLinOrPower);
|
||||||
plotLOG->getPlotter()->getYAxis()->set_minorTicks(1);
|
plotLOG->getPlotter()->getYAxis()->setMinorTicks(1);
|
||||||
|
|
||||||
plotLOG->getPlotter()->getYAxis()->set_drawMode2(JKQTPCADMcomplete);
|
plotLOG->getPlotter()->getYAxis()->setDrawMode2(JKQTPCADMcomplete);
|
||||||
plotLOG->getPlotter()->getXAxis()->set_drawMode2(JKQTPCADMcomplete);
|
plotLOG->getPlotter()->getXAxis()->setDrawMode2(JKQTPCADMcomplete);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QSpinBox* spinMinTicks=new QSpinBox(this);
|
QSpinBox* spinMinTicks=new QSpinBox(this);
|
||||||
spinMinTicks->setRange(0,999);
|
spinMinTicks->setRange(0,999);
|
||||||
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->getPlotter()->getXAxis(), SLOT(set_minorTicks(int)));
|
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->getPlotter()->getXAxis(), SLOT(setMinorTicks(int)));
|
||||||
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->getPlotter()->getYAxis(), SLOT(set_minorTicks(int)));
|
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->getPlotter()->getYAxis(), SLOT(setMinorTicks(int)));
|
||||||
layWid->addRow("X/Y-axis minor tick count", spinMinTicks);
|
layWid->addRow("X/Y-axis minor tick count", spinMinTicks);
|
||||||
spinMinTicks->setValue(1);
|
spinMinTicks->setValue(1);
|
||||||
|
|
||||||
QDoubleSpinBox* spinLOGAngle=new QDoubleSpinBox(this);
|
QDoubleSpinBox* spinLOGAngle=new QDoubleSpinBox(this);
|
||||||
spinLOGAngle->setRange(-90,90);
|
spinLOGAngle->setRange(-90,90);
|
||||||
spinLOGAngle->setSuffix(QLatin1String("°"));
|
spinLOGAngle->setSuffix(QLatin1String("°"));
|
||||||
connect(spinLOGAngle, SIGNAL(valueChanged(double)), plotLOG->getPlotter()->getXAxis(), SLOT(set_tickLabelAngle(double)));
|
connect(spinLOGAngle, SIGNAL(valueChanged(double)), plotLOG->getPlotter()->getXAxis(), SLOT(setTickLabelAngle(double)));
|
||||||
layWid->addRow("X-Axis tick label angle", spinLOGAngle);
|
layWid->addRow("X-Axis tick label angle", spinLOGAngle);
|
||||||
spinLOGAngle->setValue(0);
|
spinLOGAngle->setValue(0);
|
||||||
|
|
||||||
spinLOGAngle=new QDoubleSpinBox(this);
|
spinLOGAngle=new QDoubleSpinBox(this);
|
||||||
spinLOGAngle->setRange(-90,90);
|
spinLOGAngle->setRange(-90,90);
|
||||||
spinLOGAngle->setSuffix(QLatin1String("°"));
|
spinLOGAngle->setSuffix(QLatin1String("°"));
|
||||||
connect(spinLOGAngle, SIGNAL(valueChanged(double)), plotLOG->getPlotter()->getYAxis(), SLOT(set_tickLabelAngle(double)));
|
connect(spinLOGAngle, SIGNAL(valueChanged(double)), plotLOG->getPlotter()->getYAxis(), SLOT(setTickLabelAngle(double)));
|
||||||
layWid->addRow(tr("Y-axis label angle = "), spinLOGAngle);
|
layWid->addRow(tr("Y-axis label angle = "), spinLOGAngle);
|
||||||
spinLOGAngle->setValue(0);
|
spinLOGAngle->setValue(0);
|
||||||
|
|
||||||
|
@ -51,29 +51,29 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
|
|||||||
int pspsy=plotPSP->getDatastore()->addCopiedColumn(dataSy, "symbol");
|
int pspsy=plotPSP->getDatastore()->addCopiedColumn(dataSy, "symbol");
|
||||||
|
|
||||||
pltePSPCol=new JKQTPXYParametrizedErrorScatterGraph(plotPSP->getPlotter());
|
pltePSPCol=new JKQTPXYParametrizedErrorScatterGraph(plotPSP->getPlotter());
|
||||||
pltePSPCol->set_title(tr("changing color"));
|
pltePSPCol->setTitle(tr("changing color"));
|
||||||
pltePSPCol->set_xColumn(pspx);
|
pltePSPCol->setXColumn(pspx);
|
||||||
pltePSPCol->set_yColumn(pspy);
|
pltePSPCol->setYColumn(pspy);
|
||||||
pltePSPCol->set_colorColumn(pspc);
|
pltePSPCol->setColorColumn(pspc);
|
||||||
pltePSPCol->set_yErrorColumn(pspy1);
|
pltePSPCol->setYErrorColumn(pspy1);
|
||||||
pltePSPCol->set_yErrorColumnLower(pspy2);
|
pltePSPCol->setYErrorColumnLower(pspy2);
|
||||||
pltePSPCol->set_yErrorSymmetric(true);
|
pltePSPCol->setYErrorSymmetric(true);
|
||||||
pltePSPCol->set_drawLine(true);
|
pltePSPCol->setDrawLine(true);
|
||||||
plotPSP->getPlotter()->addGraph(pltePSPCol);
|
plotPSP->getPlotter()->addGraph(pltePSPCol);
|
||||||
|
|
||||||
pltePSPSize=new JKQTPXYParametrizedScatterGraph(plotPSP->getPlotter());
|
pltePSPSize=new JKQTPXYParametrizedScatterGraph(plotPSP->getPlotter());
|
||||||
pltePSPSize->set_xColumn(pspx);
|
pltePSPSize->setXColumn(pspx);
|
||||||
pltePSPSize->set_yColumn(pspy1);
|
pltePSPSize->setYColumn(pspy1);
|
||||||
pltePSPSize->set_sizeColumn(psps);
|
pltePSPSize->setSizeColumn(psps);
|
||||||
pltePSPSize->set_title(tr("changing size"));
|
pltePSPSize->setTitle(tr("changing size"));
|
||||||
plotPSP->getPlotter()->addGraph(pltePSPSize);
|
plotPSP->getPlotter()->addGraph(pltePSPSize);
|
||||||
|
|
||||||
|
|
||||||
pltePSPSymb=new JKQTPXYParametrizedScatterGraph(plotPSP->getPlotter());
|
pltePSPSymb=new JKQTPXYParametrizedScatterGraph(plotPSP->getPlotter());
|
||||||
pltePSPSymb->set_xColumn(pspx);
|
pltePSPSymb->setXColumn(pspx);
|
||||||
pltePSPSymb->set_yColumn(pspy3);
|
pltePSPSymb->setYColumn(pspy3);
|
||||||
pltePSPSymb->set_symbolColumn(pspsy);
|
pltePSPSymb->setSymbolColumn(pspsy);
|
||||||
pltePSPSymb->set_title(tr("changing symbol"));
|
pltePSPSymb->setTitle(tr("changing symbol"));
|
||||||
plotPSP->getPlotter()->addGraph(pltePSPSymb);
|
plotPSP->getPlotter()->addGraph(pltePSPSymb);
|
||||||
|
|
||||||
plotPSP->setPlotUpdateEnabled(true);
|
plotPSP->setPlotUpdateEnabled(true);
|
||||||
@ -95,6 +95,6 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
|
|||||||
|
|
||||||
void TestWidgetParamScatterPlots::setPSPSymmErrors(bool checked)
|
void TestWidgetParamScatterPlots::setPSPSymmErrors(bool checked)
|
||||||
{
|
{
|
||||||
pltePSPCol->set_yErrorSymmetric(checked);
|
pltePSPCol->setYErrorSymmetric(checked);
|
||||||
plotPSP->redrawPlot();
|
plotPSP->redrawPlot();
|
||||||
}
|
}
|
||||||
|
@ -45,10 +45,10 @@ TestWidgetPeaksPlots::TestWidgetPeaksPlots(QWidget *parent) :
|
|||||||
int phot2=plotPeaks->getDatastore()->addCopiedColumn(photons2, "photons 2");
|
int phot2=plotPeaks->getDatastore()->addCopiedColumn(photons2, "photons 2");
|
||||||
|
|
||||||
graphPeakStream1=new JKQTPPeakStreamGraph(phot1, 0.05, 1, QColor("darkgreen"), plotPeaks->getPlotter());
|
graphPeakStream1=new JKQTPPeakStreamGraph(phot1, 0.05, 1, QColor("darkgreen"), plotPeaks->getPlotter());
|
||||||
graphPeakStream1->set_title("channel 1");
|
graphPeakStream1->setTitle("channel 1");
|
||||||
plotPeaks->getPlotter()->addGraph(graphPeakStream1);
|
plotPeaks->getPlotter()->addGraph(graphPeakStream1);
|
||||||
graphPeakStream2=new JKQTPPeakStreamGraph(phot2, -0.05, -1, QColor("darkred"), plotPeaks->getPlotter());
|
graphPeakStream2=new JKQTPPeakStreamGraph(phot2, -0.05, -1, QColor("darkred"), plotPeaks->getPlotter());
|
||||||
graphPeakStream2->set_title("channel 2");
|
graphPeakStream2->setTitle("channel 2");
|
||||||
plotPeaks->getPlotter()->addGraph(graphPeakStream2);
|
plotPeaks->getPlotter()->addGraph(graphPeakStream2);
|
||||||
|
|
||||||
plotPeaks->setPlotUpdateEnabled(true);
|
plotPeaks->setPlotUpdateEnabled(true);
|
||||||
@ -63,14 +63,14 @@ TestWidgetPeaksPlots::TestWidgetPeaksPlots(QWidget *parent) :
|
|||||||
|
|
||||||
void TestWidgetPeaksPlots::setDrawBaseline(bool checked)
|
void TestWidgetPeaksPlots::setDrawBaseline(bool checked)
|
||||||
{
|
{
|
||||||
graphPeakStream1->set_drawBaseline(checked);
|
graphPeakStream1->setDrawBaseline(checked);
|
||||||
graphPeakStream2->set_drawBaseline(checked);
|
graphPeakStream2->setDrawBaseline(checked);
|
||||||
plotPeaks->redrawPlot();
|
plotPeaks->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetPeaksPlots::setYPeaks(bool checked)
|
void TestWidgetPeaksPlots::setYPeaks(bool checked)
|
||||||
{
|
{
|
||||||
graphPeakStream1->set_yPeaks(checked);
|
graphPeakStream1->setYPeaks(checked);
|
||||||
graphPeakStream2->set_yPeaks(checked);
|
graphPeakStream2->setYPeaks(checked);
|
||||||
plotPeaks->redrawPlot();
|
plotPeaks->redrawPlot();
|
||||||
}
|
}
|
||||||
|
@ -52,42 +52,42 @@ TestWidgetRGBImages::TestWidgetRGBImages(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
rgbimg=new JKQTPRGBMathImage(0,0,10,10, JKQTPMathImageBase::DoubleArray, rgb_rimg2, 100, 100, plotImgRGB->getPlotter());
|
rgbimg=new JKQTPRGBMathImage(0,0,10,10, JKQTPMathImageBase::DoubleArray, rgb_rimg2, 100, 100, plotImgRGB->getPlotter());
|
||||||
rgbimg->set_imageMin(-1);
|
rgbimg->setImageMin(-1);
|
||||||
rgbimg->set_imageMax(0.5);
|
rgbimg->setImageMax(0.5);
|
||||||
rgbimg->set_imageMinB(-1);
|
rgbimg->setImageMinB(-1);
|
||||||
rgbimg->set_imageMaxB(0.5);
|
rgbimg->setImageMaxB(0.5);
|
||||||
rgbimg->set_imageName("R image");
|
rgbimg->setImageName("R image");
|
||||||
rgbimg->set_imageNameG("G image");
|
rgbimg->setImageNameG("G image");
|
||||||
rgbimg->set_imageNameB("B image");
|
rgbimg->setImageNameB("B image");
|
||||||
rgbimg->set_data(rgb_rimg2, rgb_gimg2, rgb_bimg2, 100, 100, JKQTPMathImageBase::DoubleArray);
|
rgbimg->setData(rgb_rimg2, rgb_gimg2, rgb_bimg2, 100, 100, JKQTPMathImageBase::DoubleArray);
|
||||||
rgbimg->set_dataModifier(rgb_aimg2, JKQTPMathImageBase::DoubleArray);
|
rgbimg->setDataModifier(rgb_aimg2, JKQTPMathImageBase::DoubleArray);
|
||||||
rgbimg->set_modifierMode(JKQTPMathImageBase::ModifyNone);
|
rgbimg->setModifierMode(JKQTPMathImageBase::ModifyNone);
|
||||||
plotImgRGB->getPlotter()->addGraph(rgbimg);
|
plotImgRGB->getPlotter()->addGraph(rgbimg);
|
||||||
rgbimg->set_autoImageRange(false);
|
rgbimg->setAutoImageRange(false);
|
||||||
rgbimg->set_colorBarTopVisible(true);
|
rgbimg->setColorBarTopVisible(true);
|
||||||
rgbimg->set_colorBarRightVisible(true);
|
rgbimg->setColorBarRightVisible(true);
|
||||||
rgbimg->set_colorbarsSideBySide(chkColorbars->isChecked());
|
rgbimg->setColorbarsSideBySide(chkColorbars->isChecked());
|
||||||
rgbimg2=new JKQTPColumnRGBMathImage(10,0,10,10,100,100, plotImgRGB->getPlotter());
|
rgbimg2=new JKQTPColumnRGBMathImage(10,0,10,10,100,100, plotImgRGB->getPlotter());
|
||||||
rgbimg2->set_imageMin(-1);
|
rgbimg2->setImageMin(-1);
|
||||||
rgbimg2->set_imageMax(0.5);
|
rgbimg2->setImageMax(0.5);
|
||||||
rgbimg2->set_imageMinB(-1);
|
rgbimg2->setImageMinB(-1);
|
||||||
rgbimg2->set_imageMaxB(0.5);
|
rgbimg2->setImageMaxB(0.5);
|
||||||
rgbimg2->set_imageName("R image");
|
rgbimg2->setImageName("R image");
|
||||||
rgbimg2->set_imageNameG("G image");
|
rgbimg2->setImageNameG("G image");
|
||||||
rgbimg2->set_imageNameB("B image");
|
rgbimg2->setImageNameB("B image");
|
||||||
rgbimg2->set_Nx(100);
|
rgbimg2->setNx(100);
|
||||||
rgbimg2->set_Ny(100);
|
rgbimg2->setNy(100);
|
||||||
rgbimg2->set_imageRColumn(rgb_colr=plotImgRGB->getDatastore()->addCopiedColumn(rgb_bimg2, 100*100, "R"));
|
rgbimg2->setImageRColumn(rgb_colr=plotImgRGB->getDatastore()->addCopiedColumn(rgb_bimg2, 100*100, "R"));
|
||||||
rgbimg2->set_imageGColumn(rgb_colg=plotImgRGB->getDatastore()->addCopiedColumn(rgb_gimg2, 100*100, "G"));
|
rgbimg2->setImageGColumn(rgb_colg=plotImgRGB->getDatastore()->addCopiedColumn(rgb_gimg2, 100*100, "G"));
|
||||||
rgbimg2->set_imageBColumn(rgb_colb=plotImgRGB->getDatastore()->addCopiedColumn(rgb_rimg2, 100*100, "B"));
|
rgbimg2->setImageBColumn(rgb_colb=plotImgRGB->getDatastore()->addCopiedColumn(rgb_rimg2, 100*100, "B"));
|
||||||
rgbimg2->set_modifierColumn(rgb_cola=plotImgRGB->getDatastore()->addCopiedColumn(rgb_aimg2, 100*100, "alpha"));
|
rgbimg2->setModifierColumn(rgb_cola=plotImgRGB->getDatastore()->addCopiedColumn(rgb_aimg2, 100*100, "alpha"));
|
||||||
rgbimg2->set_modifierMode(JKQTPMathImageBase::ModifyNone);
|
rgbimg2->setModifierMode(JKQTPMathImageBase::ModifyNone);
|
||||||
//rgbimg2->set_data(rgb_rimg2, rgb_gimg2, rgb_bimg2, 100, 100, JKQTPMathImageBase::DoubleArray);
|
//rgbimg2->setData(rgb_rimg2, rgb_gimg2, rgb_bimg2, 100, 100, JKQTPMathImageBase::DoubleArray);
|
||||||
plotImgRGB->getPlotter()->addGraph(rgbimg2);
|
plotImgRGB->getPlotter()->addGraph(rgbimg2);
|
||||||
rgbimg2->set_autoImageRange(true);
|
rgbimg2->setAutoImageRange(true);
|
||||||
rgbimg2->set_colorBarTopVisible(true);
|
rgbimg2->setColorBarTopVisible(true);
|
||||||
rgbimg2->set_colorBarRightVisible(true);
|
rgbimg2->setColorBarRightVisible(true);
|
||||||
rgbimg2->set_colorbarsSideBySide(chkColorbars->isChecked());
|
rgbimg2->setColorbarsSideBySide(chkColorbars->isChecked());
|
||||||
plotImgRGB->setAbsoluteXY(0,20,0,10);
|
plotImgRGB->setAbsoluteXY(0,20,0,10);
|
||||||
plotImgRGB->setPlotUpdateEnabled(true);
|
plotImgRGB->setPlotUpdateEnabled(true);
|
||||||
//plotImgRGB->zoomToFit();
|
//plotImgRGB->zoomToFit();
|
||||||
@ -151,53 +151,53 @@ TestWidgetRGBImages::TestWidgetRGBImages(QWidget *parent) :
|
|||||||
|
|
||||||
void TestWidgetRGBImages::setRGBColorBars(bool checked)
|
void TestWidgetRGBImages::setRGBColorBars(bool checked)
|
||||||
{
|
{
|
||||||
rgbimg->set_colorbarsSideBySide(checked);
|
rgbimg->setColorbarsSideBySide(checked);
|
||||||
rgbimg2->set_colorbarsSideBySide(checked);
|
rgbimg2->setColorbarsSideBySide(checked);
|
||||||
plotImgRGB->redrawPlot();
|
plotImgRGB->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetRGBImages::setRGBMode1(int mode)
|
void TestWidgetRGBImages::setRGBMode1(int mode)
|
||||||
{
|
{
|
||||||
rgbimg->set_rgbMode((JKQTPRGBMathImageRGBMode)mode);
|
rgbimg->setRgbMode((JKQTPRGBMathImageRGBMode)mode);
|
||||||
plotImgRGB->redrawPlot();
|
plotImgRGB->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetRGBImages::setRGBMode2(int mode)
|
void TestWidgetRGBImages::setRGBMode2(int mode)
|
||||||
{
|
{
|
||||||
rgbimg2->set_rgbMode((JKQTPRGBMathImageRGBMode)mode);
|
rgbimg2->setRgbMode((JKQTPRGBMathImageRGBMode)mode);
|
||||||
plotImgRGB->redrawPlot();
|
plotImgRGB->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetRGBImages::updateRGBChannels()
|
void TestWidgetRGBImages::updateRGBChannels()
|
||||||
{
|
{
|
||||||
if (chkRGBUseR->isChecked()) {
|
if (chkRGBUseR->isChecked()) {
|
||||||
rgbimg->set_data(rgb_rimg2, 100, 100);
|
rgbimg->setData(rgb_rimg2, 100, 100);
|
||||||
rgbimg2->set_imageRColumn(rgb_colr);
|
rgbimg2->setImageRColumn(rgb_colr);
|
||||||
} else {
|
} else {
|
||||||
rgbimg->set_data(nullptr, 100, 100);
|
rgbimg->setData(nullptr, 100, 100);
|
||||||
rgbimg2->set_imageRColumn(-1);
|
rgbimg2->setImageRColumn(-1);
|
||||||
}
|
}
|
||||||
if (chkRGBUseG->isChecked()) {
|
if (chkRGBUseG->isChecked()) {
|
||||||
rgbimg->set_dataG(rgb_gimg2);
|
rgbimg->setDataG(rgb_gimg2);
|
||||||
rgbimg2->set_imageGColumn(rgb_colg);
|
rgbimg2->setImageGColumn(rgb_colg);
|
||||||
} else {
|
} else {
|
||||||
rgbimg->set_dataG(nullptr);
|
rgbimg->setDataG(nullptr);
|
||||||
rgbimg2->set_imageGColumn(-1);
|
rgbimg2->setImageGColumn(-1);
|
||||||
}
|
}
|
||||||
if (chkRGBUseB->isChecked()) {
|
if (chkRGBUseB->isChecked()) {
|
||||||
rgbimg->set_dataB(rgb_bimg2);
|
rgbimg->setDataB(rgb_bimg2);
|
||||||
rgbimg2->set_imageBColumn(rgb_colb);
|
rgbimg2->setImageBColumn(rgb_colb);
|
||||||
} else {
|
} else {
|
||||||
rgbimg->set_dataB(nullptr);
|
rgbimg->setDataB(nullptr);
|
||||||
rgbimg2->set_imageBColumn(-1);
|
rgbimg2->setImageBColumn(-1);
|
||||||
}
|
}
|
||||||
plotImgRGB->redrawPlot();
|
plotImgRGB->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWidgetRGBImages::setRGBModifier(int item)
|
void TestWidgetRGBImages::setRGBModifier(int item)
|
||||||
{
|
{
|
||||||
rgbimg->set_modifierMode(JKQTPMathImage::ModifierMode(item));
|
rgbimg->setModifierMode(JKQTPMathImage::ModifierMode(item));
|
||||||
rgbimg2->set_modifierMode(JKQTPMathImage::ModifierMode(item));
|
rgbimg2->setModifierMode(JKQTPMathImage::ModifierMode(item));
|
||||||
plotImgRGB->redrawPlot();
|
plotImgRGB->redrawPlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ win32-msvc*: DEFINES += _USE_MATH_DEFINES
|
|||||||
TARGET = jkqtplot_test
|
TARGET = jkqtplot_test
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -75,9 +75,9 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a graph in the plot, which plots the dataset X/Y:
|
// 4. create a graph in the plot, which plots the dataset X/Y:
|
||||||
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->setXColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->setYColumn(columnY);
|
||||||
graph1->set_title(QObject::tr("sine graph"));
|
graph1->setTitle(QObject::tr("sine graph"));
|
||||||
|
|
||||||
// 5. add the graph to the plot, so it is actually displayed
|
// 5. add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graph1);
|
plot.addGraph(graph1);
|
||||||
|
@ -36,9 +36,9 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a graph in the plot, which plots the dataset X/Y:
|
// 4. create a graph in the plot, which plots the dataset X/Y:
|
||||||
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->setXColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->setYColumn(columnY);
|
||||||
graph1->set_title(QObject::tr("sine graph"));
|
graph1->setTitle(QObject::tr("sine graph"));
|
||||||
|
|
||||||
// 5. add the graph to the plot, so it is actually displayed
|
// 5. add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graph1);
|
plot.addGraph(graph1);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest.cpp
|
SOURCES = jkqtplotter_simpletest.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -38,17 +38,17 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create graphs in the plot, which plots the dataset X/Y1, X/Y2 and X/Y3:
|
// 4. create graphs in the plot, which plots the dataset X/Y1, X/Y2 and X/Y3:
|
||||||
JKQTPBarVerticalGraph* graph1=new JKQTPBarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph1=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->setXColumn(columnX);
|
||||||
graph1->set_yColumn(columnY1);
|
graph1->setYColumn(columnY1);
|
||||||
graph1->set_title(QObject::tr("dataset 1"));
|
graph1->setTitle(QObject::tr("dataset 1"));
|
||||||
JKQTPBarVerticalGraph* graph2=new JKQTPBarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph2=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->setXColumn(columnX);
|
||||||
graph2->set_yColumn(columnY2);
|
graph2->setYColumn(columnY2);
|
||||||
graph2->set_title(QObject::tr("dataset 2"));
|
graph2->setTitle(QObject::tr("dataset 2"));
|
||||||
JKQTPBarVerticalGraph* graph3=new JKQTPBarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph3=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph3->set_xColumn(columnX);
|
graph3->setXColumn(columnX);
|
||||||
graph3->set_yColumn(columnY3);
|
graph3->setYColumn(columnY3);
|
||||||
graph3->set_title(QObject::tr("dataset 3"));
|
graph3->setTitle(QObject::tr("dataset 3"));
|
||||||
|
|
||||||
|
|
||||||
// 5. add the graphs to the plot, so it is actually displayed
|
// 5. add the graphs to the plot, so it is actually displayed
|
||||||
@ -67,8 +67,8 @@ int main(int argc, char* argv[])
|
|||||||
// we have to tell the x-Axis to use these special labels:
|
// we have to tell the x-Axis to use these special labels:
|
||||||
plot.getXAxis()->addAxisTickLabels(X, L, Ndata);
|
plot.getXAxis()->addAxisTickLabels(X, L, Ndata);
|
||||||
// also we can rotate the labels a bit (by 45 degree), so they fit better
|
// also we can rotate the labels a bit (by 45 degree), so they fit better
|
||||||
plot.getXAxis()->set_tickLabelAngle(45);
|
plot.getXAxis()->setTickLabelAngle(45);
|
||||||
plot.getXAxis()->set_tickLabelFontSize(12);
|
plot.getXAxis()->setTickLabelFontSize(12);
|
||||||
|
|
||||||
// 8. finally we move the plot key/legend to the outside, top-right
|
// 8. finally we move the plot key/legend to the outside, top-right
|
||||||
// and lay it out as a single row
|
// and lay it out as a single row
|
||||||
|
@ -42,17 +42,17 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create graphs in the plot, which plots the dataset X/Y1, X/Y2 and X/Y3:
|
// 4. create graphs in the plot, which plots the dataset X/Y1, X/Y2 and X/Y3:
|
||||||
JKQTPBarVerticalGraph* graph1=new JKQTPBarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph1=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->setXColumn(columnX);
|
||||||
graph1->set_yColumn(columnY1);
|
graph1->setYColumn(columnY1);
|
||||||
graph1->set_title(QObject::tr("dataset 1"));
|
graph1->setTitle(QObject::tr("dataset 1"));
|
||||||
JKQTPBarVerticalGraph* graph2=new JKQTPBarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph2=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->setXColumn(columnX);
|
||||||
graph2->set_yColumn(columnY2);
|
graph2->setYColumn(columnY2);
|
||||||
graph2->set_title(QObject::tr("dataset 2"));
|
graph2->setTitle(QObject::tr("dataset 2"));
|
||||||
JKQTPBarVerticalGraph* graph3=new JKQTPBarVerticalGraph(&plot);
|
JKQTPBarVerticalGraph* graph3=new JKQTPBarVerticalGraph(&plot);
|
||||||
graph3->set_xColumn(columnX);
|
graph3->setXColumn(columnX);
|
||||||
graph3->set_yColumn(columnY3);
|
graph3->setYColumn(columnY3);
|
||||||
graph3->set_title(QObject::tr("dataset 3"));
|
graph3->setTitle(QObject::tr("dataset 3"));
|
||||||
|
|
||||||
|
|
||||||
// 5. add the graphs to the plot, so it is actually displayed
|
// 5. add the graphs to the plot, so it is actually displayed
|
||||||
@ -71,8 +71,8 @@ int main(int argc, char* argv[])
|
|||||||
// we have to tell the x-Axis to use these special labels:
|
// we have to tell the x-Axis to use these special labels:
|
||||||
plot.getXAxis()->addAxisTickLabels(X, L, Ndata);
|
plot.getXAxis()->addAxisTickLabels(X, L, Ndata);
|
||||||
// also we can rotate the labels a bit (by 45 degree), so they fit better
|
// also we can rotate the labels a bit (by 45 degree), so they fit better
|
||||||
plot.getXAxis()->set_tickLabelAngle(45);
|
plot.getXAxis()->setTickLabelAngle(45);
|
||||||
plot.getXAxis()->set_tickLabelFontSize(12);
|
plot.getXAxis()->setTickLabelFontSize(12);
|
||||||
|
|
||||||
// 8. finally we move the plot key/legend to the outside, top-right
|
// 8. finally we move the plot key/legend to the outside, top-right
|
||||||
// and lay it out as a single row
|
// and lay it out as a single row
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_barchart.cpp
|
SOURCES = jkqtplotter_simpletest_barchart.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -32,25 +32,25 @@ After adding all necessary data to the JKQTDatastore:
|
|||||||
```.cpp
|
```.cpp
|
||||||
// 4. create a graph of vertical boxplots:
|
// 4. create a graph of vertical boxplots:
|
||||||
JKQTPBoxplotVerticalGraph* graph=new JKQTPBoxplotVerticalGraph(&plot);
|
JKQTPBoxplotVerticalGraph* graph=new JKQTPBoxplotVerticalGraph(&plot);
|
||||||
graph->set_posColumn(columnPOS);
|
graph->setPosColumn(columnPOS);
|
||||||
graph->set_minColumn(columnMIN);
|
graph->setMinColumn(columnMIN);
|
||||||
graph->set_percentile25Column(columnQ25);
|
graph->setPercentile25Column(columnQ25);
|
||||||
graph->set_medianColumn(columnMEDIAN);
|
graph->setMedianColumn(columnMEDIAN);
|
||||||
graph->set_meanColumn(columnMEAN);
|
graph->setMeanColumn(columnMEAN);
|
||||||
graph->set_percentile75Column(columnQ75);
|
graph->setPercentile75Column(columnQ75);
|
||||||
graph->set_maxColumn(columnMAX);
|
graph->setMaxColumn(columnMAX);
|
||||||
graph->set_title("vertical Boxplots");
|
graph->setTitle("vertical Boxplots");
|
||||||
```
|
```
|
||||||
|
|
||||||
You can further style the plot by e.g. setting:
|
You can further style the plot by e.g. setting:
|
||||||
|
|
||||||
```.cpp
|
```.cpp
|
||||||
// 4.1 make fill collor a lighter shade of the outline color
|
// 4.1 make fill collor a lighter shade of the outline color
|
||||||
graph->set_fillColor(graphh->get_color().lighter());
|
graph->setFillColor(graphh->getColor().lighter());
|
||||||
// 4.2 make whiskers dashed
|
// 4.2 make whiskers dashed
|
||||||
graph->set_whiskerStyle(Qt::DashLine);
|
graph->setWhiskerStyle(Qt::DashLine);
|
||||||
// 4.3 change mean symbol
|
// 4.3 change mean symbol
|
||||||
graph->set_meanSymbol(JKQTPstar);
|
graph->setMeanSymbol(JKQTPstar);
|
||||||
```
|
```
|
||||||
|
|
||||||
The result looks like this:
|
The result looks like this:
|
||||||
@ -75,14 +75,14 @@ In addition to the simple box plots, the image above also shows outliers as smal
|
|||||||
|
|
||||||
// 5. outliers need to be drawn separately
|
// 5. outliers need to be drawn separately
|
||||||
JKQTPXYLineGraph* graphOutliers=new JKQTPXYLineGraph(&plot);
|
JKQTPXYLineGraph* graphOutliers=new JKQTPXYLineGraph(&plot);
|
||||||
graphOutliers->set_xColumn(columnOUTLIERSX);
|
graphOutliers->setXColumn(columnOUTLIERSX);
|
||||||
graphOutliers->set_yColumn(columnOUTLIERSY);
|
graphOutliers->setYColumn(columnOUTLIERSY);
|
||||||
graphOutliers->set_title("outliers");
|
graphOutliers->setTitle("outliers");
|
||||||
// make the color a darker shade of the color of graph
|
// make the color a darker shade of the color of graph
|
||||||
graphOutliers->set_color(graph->get_color().darker());
|
graphOutliers->setColor(graph->getColor().darker());
|
||||||
graphOutliers->set_fillColor(QColor("white"));
|
graphOutliers->setFillColor(QColor("white"));
|
||||||
// draw outliers as small circles, without lines
|
// draw outliers as small circles, without lines
|
||||||
graphOutliers->set_symbol(JKQTPCircle);
|
graphOutliers->setSymbol(JKQTPCircle);
|
||||||
graphOutliers->set_drawLine(false);
|
graphOutliers->setDrawLine(false);
|
||||||
graphOutliers->set_symbolSize(7);
|
graphOutliers->setSymbolSize(7);
|
||||||
```
|
```
|
||||||
|
@ -48,44 +48,44 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a graph of vertical boxplots:
|
// 4. create a graph of vertical boxplots:
|
||||||
JKQTPBoxplotVerticalGraph* graph=new JKQTPBoxplotVerticalGraph(&plot);
|
JKQTPBoxplotVerticalGraph* graph=new JKQTPBoxplotVerticalGraph(&plot);
|
||||||
graph->set_posColumn(columnPOS);
|
graph->setPosColumn(columnPOS);
|
||||||
graph->set_minColumn(columnMIN);
|
graph->setMinColumn(columnMIN);
|
||||||
graph->set_percentile25Column(columnQ25);
|
graph->setPercentile25Column(columnQ25);
|
||||||
graph->set_medianColumn(columnMEDIAN);
|
graph->setMedianColumn(columnMEDIAN);
|
||||||
graph->set_meanColumn(columnMEAN);
|
graph->setMeanColumn(columnMEAN);
|
||||||
graph->set_percentile75Column(columnQ75);
|
graph->setPercentile75Column(columnQ75);
|
||||||
graph->set_maxColumn(columnMAX);
|
graph->setMaxColumn(columnMAX);
|
||||||
graph->set_title("vertical Boxplots");
|
graph->setTitle("vertical Boxplots");
|
||||||
|
|
||||||
// 5. outliers need to be drawn separately
|
// 5. outliers need to be drawn separately
|
||||||
JKQTPXYLineGraph* graphOutliers=new JKQTPXYLineGraph(&plot);
|
JKQTPXYLineGraph* graphOutliers=new JKQTPXYLineGraph(&plot);
|
||||||
graphOutliers->set_xColumn(columnOUTLIERSX);
|
graphOutliers->setXColumn(columnOUTLIERSX);
|
||||||
graphOutliers->set_yColumn(columnOUTLIERSY);
|
graphOutliers->setYColumn(columnOUTLIERSY);
|
||||||
graphOutliers->set_title("outliers");
|
graphOutliers->setTitle("outliers");
|
||||||
// make the color a darker shade of the color of graph
|
// make the color a darker shade of the color of graph
|
||||||
graphOutliers->set_color(graph->get_color().darker());
|
graphOutliers->setColor(graph->getColor().darker());
|
||||||
graphOutliers->set_fillColor(QColor("white"));
|
graphOutliers->setFillColor(QColor("white"));
|
||||||
// draw outliers as small circles, without lines
|
// draw outliers as small circles, without lines
|
||||||
graphOutliers->set_symbol(JKQTPCircle);
|
graphOutliers->setSymbol(JKQTPCircle);
|
||||||
graphOutliers->set_drawLine(false);
|
graphOutliers->setDrawLine(false);
|
||||||
graphOutliers->set_symbolSize(7);
|
graphOutliers->setSymbolSize(7);
|
||||||
|
|
||||||
// 6. create a graph of horizontal boxplots:
|
// 6. create a graph of horizontal boxplots:
|
||||||
JKQTPBoxplotHorizontalGraph* graphh=new JKQTPBoxplotHorizontalGraph(&plot);
|
JKQTPBoxplotHorizontalGraph* graphh=new JKQTPBoxplotHorizontalGraph(&plot);
|
||||||
graphh->set_posColumn(columnPOSY);
|
graphh->setPosColumn(columnPOSY);
|
||||||
graphh->set_minColumn(columnMIN);
|
graphh->setMinColumn(columnMIN);
|
||||||
graphh->set_percentile25Column(columnQ25);
|
graphh->setPercentile25Column(columnQ25);
|
||||||
graphh->set_medianColumn(columnMEDIAN);
|
graphh->setMedianColumn(columnMEDIAN);
|
||||||
graphh->set_meanColumn(columnMEAN);
|
graphh->setMeanColumn(columnMEAN);
|
||||||
graphh->set_percentile75Column(columnQ75);
|
graphh->setPercentile75Column(columnQ75);
|
||||||
graphh->set_maxColumn(columnMAX);
|
graphh->setMaxColumn(columnMAX);
|
||||||
graphh->set_title("horizontal Boxplots");
|
graphh->setTitle("horizontal Boxplots");
|
||||||
// 6.1 make fill collor a lighter shade of the outline color
|
// 6.1 make fill collor a lighter shade of the outline color
|
||||||
graphh->set_fillColor(graphh->get_color().lighter());
|
graphh->setFillColor(graphh->getColor().lighter());
|
||||||
// 6.2 make whiskers dashed
|
// 6.2 make whiskers dashed
|
||||||
graphh->set_whiskerStyle(Qt::DashLine);
|
graphh->setWhiskerStyle(Qt::DashLine);
|
||||||
// 6.3 change mean symbol
|
// 6.3 change mean symbol
|
||||||
graphh->set_meanSymbol(JKQTPstar);
|
graphh->setMeanSymbol(JKQTPstar);
|
||||||
|
|
||||||
|
|
||||||
// 7. add the graphs to the plot, so it is actually displayed
|
// 7. add the graphs to the plot, so it is actually displayed
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_boxplot.cpp
|
SOURCES = jkqtplotter_simpletest_boxplot.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -46,18 +46,18 @@ Then two graphs are added. One of type `JKQTPFilledVerticalRangeGraph` plots the
|
|||||||
|
|
||||||
// 4. copy data into datastore and immediately set the yColumn
|
// 4. copy data into datastore and immediately set the yColumn
|
||||||
size_t colDate=ds->addCopiedColumn(date, "date");
|
size_t colDate=ds->addCopiedColumn(date, "date");
|
||||||
graphTemperatureRange->set_xColumn(colDate);
|
graphTemperatureRange->setXColumn(colDate);
|
||||||
graphTemperatureRange->set_yColumn(ds->addCopiedColumn(temperature_min, "temperature_min"));
|
graphTemperatureRange->setYColumn(ds->addCopiedColumn(temperature_min, "temperature_min"));
|
||||||
graphTemperatureRange->set_yColumn2(ds->addCopiedColumn(temperature_max, "temperature_max"));
|
graphTemperatureRange->setYColumn2(ds->addCopiedColumn(temperature_max, "temperature_max"));
|
||||||
|
|
||||||
|
|
||||||
// 5. min/max range data
|
// 5. min/max range data
|
||||||
// graph fill color is a lighter shade of the average graph
|
// graph fill color is a lighter shade of the average graph
|
||||||
graphTemperatureRange->set_fillColor(graphTemperature->get_color().lighter());
|
graphTemperatureRange->setFillColor(graphTemperature->getColor().lighter());
|
||||||
// don't draw lines of the data
|
// don't draw lines of the data
|
||||||
graphTemperatureRange->set_drawLine(false);
|
graphTemperatureRange->setDrawLine(false);
|
||||||
// plot label in key
|
// plot label in key
|
||||||
graphTemperatureRange->set_title("Min/Max Temperature");
|
graphTemperatureRange->setTitle("Min/Max Temperature");
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graphTemperatureRange);
|
plot.addGraph(graphTemperatureRange);
|
||||||
```
|
```
|
||||||
@ -70,8 +70,8 @@ On top of that plot, a second plot is added, which draws the average temperature
|
|||||||
|
|
||||||
// 4. copy data into datastore and immediately set the yColumn
|
// 4. copy data into datastore and immediately set the yColumn
|
||||||
size_t colDate=ds->addCopiedColumn(date, "date");
|
size_t colDate=ds->addCopiedColumn(date, "date");
|
||||||
graphTemperature->set_xColumn(colDate);
|
graphTemperature->setXColumn(colDate);
|
||||||
graphTemperature->set_yColumn(ds->addCopiedColumn(temperature, "temperature"));
|
graphTemperature->setYColumn(ds->addCopiedColumn(temperature, "temperature"));
|
||||||
|
|
||||||
|
|
||||||
// 5. min/max range data
|
// 5. min/max range data
|
||||||
@ -79,13 +79,13 @@ On top of that plot, a second plot is added, which draws the average temperature
|
|||||||
|
|
||||||
// 6. average data
|
// 6. average data
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graphTemperature->set_symbol(JKQTPNoSymbol);
|
graphTemperature->setSymbol(JKQTPNoSymbol);
|
||||||
// set the line width
|
// set the line width
|
||||||
graphTemperature->setLineWidth(1);
|
graphTemperature->setLineWidth(1);
|
||||||
// draw small symbols
|
// draw small symbols
|
||||||
graphTemperature->set_symbolSize(6);
|
graphTemperature->setSymbolSize(6);
|
||||||
// graph title
|
// graph title
|
||||||
graphTemperature->set_title("Average Temperature");
|
graphTemperature->setTitle("Average Temperature");
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graphTemperature);
|
plot.addGraph(graphTemperature);
|
||||||
```
|
```
|
||||||
@ -96,10 +96,10 @@ Finally the x-axis is formatted to display dates (see [Qt-Documentation of `QDat
|
|||||||
// set the title above the plot, use LaTeX instructions to make text bold
|
// set the title above the plot, use LaTeX instructions to make text bold
|
||||||
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
|
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
|
||||||
// set x-axis date-time-axis
|
// set x-axis date-time-axis
|
||||||
plot.getXAxis()->set_labelType(JKQTPCALTdatetime);
|
plot.getXAxis()->setLabelType(JKQTPCALTdatetime);
|
||||||
plot.getXAxis()->setAxisLabel("Date");
|
plot.getXAxis()->setAxisLabel("Date");
|
||||||
// set format string for date axis (e.g. Jan '18), see Documentation of QDateTime::toString()
|
// set format string for date axis (e.g. Jan '18), see Documentation of QDateTime::toString()
|
||||||
plot.getXAxis()->set_tickDateTimeFormat("MMM ''yy");
|
plot.getXAxis()->setTickDateTimeFormat("MMM ''yy");
|
||||||
// set y-axis temperature axis
|
// set y-axis temperature axis
|
||||||
plot.getYAxis()->setAxisLabel("Average Daily Temperature [{\\degree}C]");
|
plot.getYAxis()->setAxisLabel("Average Daily Temperature [{\\degree}C]");
|
||||||
```
|
```
|
||||||
@ -155,11 +155,11 @@ Axis formating for this example is done like this:
|
|||||||
// set the title above the plot, use LaTeX instructions to make text bold
|
// set the title above the plot, use LaTeX instructions to make text bold
|
||||||
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");
|
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");
|
||||||
// set x-axis date-time-axis
|
// set x-axis date-time-axis
|
||||||
plot.getXAxis()->set_labelType(JKQTPCALTtime);
|
plot.getXAxis()->setLabelType(JKQTPCALTtime);
|
||||||
plot.getXAxis()->setAxisLabel("Time of Day");
|
plot.getXAxis()->setAxisLabel("Time of Day");
|
||||||
// set format string for time axis with 24-hour and minute only,
|
// set format string for time axis with 24-hour and minute only,
|
||||||
// see QDateTime::toString() documentation for details on format strings
|
// see QDateTime::toString() documentation for details on format strings
|
||||||
plot.getXAxis()->set_tickTimeFormat("HH:mm");
|
plot.getXAxis()->setTickTimeFormat("HH:mm");
|
||||||
// set y-axis temperature axis
|
// set y-axis temperature axis
|
||||||
plot.getYAxis()->setAxisLabel("Temperature [{\\degree}C]");
|
plot.getYAxis()->setAxisLabel("Temperature [{\\degree}C]");
|
||||||
```
|
```
|
||||||
|
@ -48,32 +48,32 @@ void drawWithDateAxis(JKQTPlotter& plot) {
|
|||||||
|
|
||||||
// 4. copy data into datastore and immediately set the yColumn
|
// 4. copy data into datastore and immediately set the yColumn
|
||||||
size_t colDate=ds->addCopiedColumn(date, "date");
|
size_t colDate=ds->addCopiedColumn(date, "date");
|
||||||
graphTemperature->set_xColumn(colDate);
|
graphTemperature->setXColumn(colDate);
|
||||||
graphTemperature->set_yColumn(ds->addCopiedColumn(temperature, "temperature"));
|
graphTemperature->setYColumn(ds->addCopiedColumn(temperature, "temperature"));
|
||||||
graphTemperatureRange->set_xColumn(colDate);
|
graphTemperatureRange->setXColumn(colDate);
|
||||||
graphTemperatureRange->set_yColumn(ds->addCopiedColumn(temperature_min, "temperature_min"));
|
graphTemperatureRange->setYColumn(ds->addCopiedColumn(temperature_min, "temperature_min"));
|
||||||
graphTemperatureRange->set_yColumn2(ds->addCopiedColumn(temperature_max, "temperature_max"));
|
graphTemperatureRange->setYColumn2(ds->addCopiedColumn(temperature_max, "temperature_max"));
|
||||||
|
|
||||||
|
|
||||||
// 5. min/max range data
|
// 5. min/max range data
|
||||||
// graph fill color is a lighter shade of the average graph
|
// graph fill color is a lighter shade of the average graph
|
||||||
graphTemperatureRange->set_fillColor(graphTemperature->get_color().lighter());
|
graphTemperatureRange->setFillColor(graphTemperature->getColor().lighter());
|
||||||
// don't draw lines of the data
|
// don't draw lines of the data
|
||||||
graphTemperatureRange->set_drawLine(false);
|
graphTemperatureRange->setDrawLine(false);
|
||||||
// plot label in key
|
// plot label in key
|
||||||
graphTemperatureRange->set_title("Min/Max Temperature");
|
graphTemperatureRange->setTitle("Min/Max Temperature");
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graphTemperatureRange);
|
plot.addGraph(graphTemperatureRange);
|
||||||
|
|
||||||
// 6. average data
|
// 6. average data
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graphTemperature->set_symbol(JKQTPNoSymbol);
|
graphTemperature->setSymbol(JKQTPNoSymbol);
|
||||||
// set the line width
|
// set the line width
|
||||||
graphTemperature->setLineWidth(1);
|
graphTemperature->setLineWidth(1);
|
||||||
// draw small symbols
|
// draw small symbols
|
||||||
graphTemperature->set_symbolSize(6);
|
graphTemperature->setSymbolSize(6);
|
||||||
// graph title
|
// graph title
|
||||||
graphTemperature->set_title("Average Temperature");
|
graphTemperature->setTitle("Average Temperature");
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graphTemperature);
|
plot.addGraph(graphTemperature);
|
||||||
|
|
||||||
@ -82,10 +82,10 @@ void drawWithDateAxis(JKQTPlotter& plot) {
|
|||||||
// set the title above the plot, use LaTeX instructions to make text bold
|
// set the title above the plot, use LaTeX instructions to make text bold
|
||||||
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
|
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
|
||||||
// set x-axis date-time-axis
|
// set x-axis date-time-axis
|
||||||
plot.getXAxis()->set_labelType(JKQTPCALTdatetime);
|
plot.getXAxis()->setLabelType(JKQTPCALTdatetime);
|
||||||
plot.getXAxis()->setAxisLabel("Date");
|
plot.getXAxis()->setAxisLabel("Date");
|
||||||
// set format string for date axis (e.g. Jan '18), see Documentation of QDateTime::toString()
|
// set format string for date axis (e.g. Jan '18), see Documentation of QDateTime::toString()
|
||||||
plot.getXAxis()->set_tickDateTimeFormat("MMM ''yy");
|
plot.getXAxis()->setTickDateTimeFormat("MMM ''yy");
|
||||||
// set y-axis temperature axis
|
// set y-axis temperature axis
|
||||||
plot.getYAxis()->setAxisLabel("Average Daily Temperature [{\\degree}C]");
|
plot.getYAxis()->setAxisLabel("Average Daily Temperature [{\\degree}C]");
|
||||||
|
|
||||||
@ -128,19 +128,19 @@ void drawWithTimeAxis(JKQTPlotter& plot) {
|
|||||||
|
|
||||||
// 4. copy data into datastore and immediately set the yColumn
|
// 4. copy data into datastore and immediately set the yColumn
|
||||||
size_t colDate=ds->addCopiedColumn(time, "time");
|
size_t colDate=ds->addCopiedColumn(time, "time");
|
||||||
graphTemperature->set_xColumn(colDate);
|
graphTemperature->setXColumn(colDate);
|
||||||
graphTemperature->set_yColumn(ds->addCopiedColumn(temperature, "temperature"));
|
graphTemperature->setYColumn(ds->addCopiedColumn(temperature, "temperature"));
|
||||||
|
|
||||||
|
|
||||||
// 6. average data
|
// 6. average data
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graphTemperature->set_symbol(JKQTPCross);
|
graphTemperature->setSymbol(JKQTPCross);
|
||||||
// set the line width
|
// set the line width
|
||||||
graphTemperature->setLineWidth(1);
|
graphTemperature->setLineWidth(1);
|
||||||
// draw small symbols
|
// draw small symbols
|
||||||
graphTemperature->set_symbolSize(6);
|
graphTemperature->setSymbolSize(6);
|
||||||
// graph title
|
// graph title
|
||||||
graphTemperature->set_title("Average Temperature");
|
graphTemperature->setTitle("Average Temperature");
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graphTemperature);
|
plot.addGraph(graphTemperature);
|
||||||
|
|
||||||
@ -149,11 +149,11 @@ void drawWithTimeAxis(JKQTPlotter& plot) {
|
|||||||
// set the title above the plot, use LaTeX instructions to make text bold
|
// set the title above the plot, use LaTeX instructions to make text bold
|
||||||
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");
|
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");
|
||||||
// set x-axis date-time-axis
|
// set x-axis date-time-axis
|
||||||
plot.getXAxis()->set_labelType(JKQTPCALTtime);
|
plot.getXAxis()->setLabelType(JKQTPCALTtime);
|
||||||
plot.getXAxis()->setAxisLabel("Time of Day");
|
plot.getXAxis()->setAxisLabel("Time of Day");
|
||||||
// set format string for time axis with 24-hour and minute only,
|
// set format string for time axis with 24-hour and minute only,
|
||||||
// see QDateTime::toString() documentation for details on format strings
|
// see QDateTime::toString() documentation for details on format strings
|
||||||
plot.getXAxis()->set_tickTimeFormat("HH:mm");
|
plot.getXAxis()->setTickTimeFormat("HH:mm");
|
||||||
// set y-axis temperature axis
|
// set y-axis temperature axis
|
||||||
plot.getYAxis()->setAxisLabel("Temperature [{\\degree}C]");
|
plot.getYAxis()->setAxisLabel("Temperature [{\\degree}C]");
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_dateaxes.cpp
|
SOURCES = jkqtplotter_simpletest_dateaxes.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -25,44 +25,44 @@ First some data is added to the internal datastore (mostly, like explained in se
|
|||||||
JKQTPXYLineErrorGraph* graph=new JKQTPXYLineErrorGraph(&plot);
|
JKQTPXYLineErrorGraph* graph=new JKQTPXYLineErrorGraph(&plot);
|
||||||
|
|
||||||
// copy data into datastore and immediately set the yColumn
|
// copy data into datastore and immediately set the yColumn
|
||||||
graph->set_xColumn(columnX);
|
graph->setXColumn(columnX);
|
||||||
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(errorID)));
|
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(errorID)));
|
||||||
graph->set_xErrorColumn(columnXError);
|
graph->setXErrorColumn(columnXError);
|
||||||
graph->set_yErrorColumn(columnYError);
|
graph->setYErrorColumn(columnYError);
|
||||||
|
|
||||||
// set error style, for the y-axis
|
// set error style, for the y-axis
|
||||||
graph->set_yErrorStyle(errorStyles[errorID]);
|
graph->setYErrorStyle(errorStyles[errorID]);
|
||||||
// no error indicators for the x-values
|
// no error indicators for the x-values
|
||||||
graph->set_xErrorStyle(JKQTPNoError);
|
graph->setXErrorStyle(JKQTPNoError);
|
||||||
// ... unless: for some error styles we want error in both directions
|
// ... unless: for some error styles we want error in both directions
|
||||||
if (showXandYError[errorID]) {
|
if (showXandYError[errorID]) {
|
||||||
graph->set_xErrorStyle(errorStyles[errorID]);
|
graph->setXErrorStyle(errorStyles[errorID]);
|
||||||
graph->set_drawLine(false);
|
graph->setDrawLine(false);
|
||||||
}
|
}
|
||||||
// make error indicator 30% transparent
|
// make error indicator 30% transparent
|
||||||
QColor c=graph->get_errorFillColor();
|
QColor c=graph->getErrorFillColor();
|
||||||
c.setAlphaF(0.3);
|
c.setAlphaF(0.3);
|
||||||
graph->set_errorFillColor(c);
|
graph->setErrorFillColor(c);
|
||||||
// set error indicator line width
|
// set error indicator line width
|
||||||
graph->set_errorWidth(1);
|
graph->setErrorWidth(1);
|
||||||
// set length of small bars at the end of error bars
|
// set length of small bars at the end of error bars
|
||||||
graph->set_errorbarSize(15);
|
graph->setErrorbarSize(15);
|
||||||
|
|
||||||
|
|
||||||
// set symbol (cross/X) + pen style (and color)dashed)
|
// set symbol (cross/X) + pen style (and color)dashed)
|
||||||
graph->set_symbol(JKQTPCross);
|
graph->setSymbol(JKQTPCross);
|
||||||
graph->set_style(Qt::DashLine);
|
graph->setStyle(Qt::DashLine);
|
||||||
// set symbol size
|
// set symbol size
|
||||||
graph->set_symbolSize(5);
|
graph->setSymbolSize(5);
|
||||||
// set width of symbol lines
|
// set width of symbol lines
|
||||||
graph->set_symbolWidth(1);
|
graph->setSymbolWidth(1);
|
||||||
// set width of graph line
|
// set width of graph line
|
||||||
graph->setLineWidth(1);
|
graph->setLineWidth(1);
|
||||||
|
|
||||||
// graph title is made from symbol+errorStylestyle, we use the LaTeX instruction \verb around the
|
// graph title is made from symbol+errorStylestyle, we use the LaTeX instruction \verb around the
|
||||||
// result of JKQTPErrorPlotstyle2String(), because it contains underscores that would otherwise
|
// result of JKQTPErrorPlotstyle2String(), because it contains underscores that would otherwise
|
||||||
// lead to lower-case letter, which we don't want
|
// lead to lower-case letter, which we don't want
|
||||||
graph->set_title("\\verb{"+JKQTPErrorPlotstyle2String(errorStyles[errorID])+"}");
|
graph->setTitle("\\verb{"+JKQTPErrorPlotstyle2String(errorStyles[errorID])+"}");
|
||||||
|
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graph);
|
plot.addGraph(graph);
|
||||||
@ -72,21 +72,21 @@ First some data is added to the internal datastore (mostly, like explained in se
|
|||||||
The error styles are set in these lines:
|
The error styles are set in these lines:
|
||||||
```.cpp
|
```.cpp
|
||||||
// set error style, for the y-axis
|
// set error style, for the y-axis
|
||||||
graph->set_yErrorStyle(errorStyles[errorID]);
|
graph->setYErrorStyle(errorStyles[errorID]);
|
||||||
// no error indicators for the x-values
|
// no error indicators for the x-values
|
||||||
graph->set_xErrorStyle(errorStyles[errorID]);
|
graph->setXErrorStyle(errorStyles[errorID]);
|
||||||
```
|
```
|
||||||
|
|
||||||
There are several variables that can be used to further style the error indicator, like:
|
There are several variables that can be used to further style the error indicator, like:
|
||||||
```.cpp
|
```.cpp
|
||||||
// make error indicator 30% transparent
|
// make error indicator 30% transparent
|
||||||
QColor c=graph->get_errorFillColor();
|
QColor c=graph->getErrorFillColor();
|
||||||
c.setAlphaF(0.3);
|
c.setAlphaF(0.3);
|
||||||
graph->set_errorFillColor(c);
|
graph->setErrorFillColor(c);
|
||||||
// set error indicator line width
|
// set error indicator line width
|
||||||
graph->set_errorWidth(1);
|
graph->setErrorWidth(1);
|
||||||
// set length of small bars at the end of error bars
|
// set length of small bars at the end of error bars
|
||||||
graph->set_errorbarSize(15);
|
graph->setErrorbarSize(15);
|
||||||
```
|
```
|
||||||
|
|
||||||
There are more properties that you can find in the documentation of the mix-in classes `JKQTPXYGraphErrors`, `JKQTPXGraphErrors`, `JKQTPYGraphErrors`, `JKQTPGraphErrors`.
|
There are more properties that you can find in the documentation of the mix-in classes `JKQTPXYGraphErrors`, `JKQTPXGraphErrors`, `JKQTPYGraphErrors`, `JKQTPGraphErrors`.
|
||||||
@ -96,10 +96,10 @@ In addition the plot key is moved outside the pot and the grid in the plot is sw
|
|||||||
// 6. change locaion of key (outside top-right)
|
// 6. change locaion of key (outside top-right)
|
||||||
plot.getPlotter()->setKeyPosition(JKQTPKeyOutsideRightTop);
|
plot.getPlotter()->setKeyPosition(JKQTPKeyOutsideRightTop);
|
||||||
// ... and switch off the grid
|
// ... and switch off the grid
|
||||||
plot.getXAxis()->set_drawGrid(false);
|
plot.getXAxis()->setDrawGrid(false);
|
||||||
plot.getXAxis()->set_drawMinorGrid(false);
|
plot.getXAxis()->setDrawMinorGrid(false);
|
||||||
plot.getYAxis()->set_drawGrid(false);
|
plot.getYAxis()->setDrawGrid(false);
|
||||||
plot.getYAxis()->set_drawMinorGrid(false);
|
plot.getYAxis()->setDrawMinorGrid(false);
|
||||||
```
|
```
|
||||||
|
|
||||||
The result looks like this:
|
The result looks like this:
|
||||||
|
@ -54,44 +54,44 @@ int main(int argc, char* argv[])
|
|||||||
JKQTPXYLineErrorGraph* graph=new JKQTPXYLineErrorGraph(&plot);
|
JKQTPXYLineErrorGraph* graph=new JKQTPXYLineErrorGraph(&plot);
|
||||||
|
|
||||||
// copy data into datastore and immediately set the yColumn
|
// copy data into datastore and immediately set the yColumn
|
||||||
graph->set_xColumn(columnX);
|
graph->setXColumn(columnX);
|
||||||
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(errorID)));
|
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(errorID)));
|
||||||
graph->set_xErrorColumn(columnXError);
|
graph->setXErrorColumn(columnXError);
|
||||||
graph->set_yErrorColumn(columnYError);
|
graph->setYErrorColumn(columnYError);
|
||||||
|
|
||||||
// set error style, for the y-axis
|
// set error style, for the y-axis
|
||||||
graph->set_yErrorStyle(errorStyles[errorID]);
|
graph->setYErrorStyle(errorStyles[errorID]);
|
||||||
// no error indicators for the x-values
|
// no error indicators for the x-values
|
||||||
graph->set_xErrorStyle(JKQTPNoError);
|
graph->setXErrorStyle(JKQTPNoError);
|
||||||
// ... unless: for some error styles we want error in both directions
|
// ... unless: for some error styles we want error in both directions
|
||||||
if (showXandYError[errorID]) {
|
if (showXandYError[errorID]) {
|
||||||
graph->set_xErrorStyle(errorStyles[errorID]);
|
graph->setXErrorStyle(errorStyles[errorID]);
|
||||||
graph->set_drawLine(false);
|
graph->setDrawLine(false);
|
||||||
}
|
}
|
||||||
// make error indicator 30% transparent
|
// make error indicator 30% transparent
|
||||||
QColor c=graph->get_errorFillColor();
|
QColor c=graph->getErrorFillColor();
|
||||||
c.setAlphaF(0.3);
|
c.setAlphaF(0.3);
|
||||||
graph->set_errorFillColor(c);
|
graph->setErrorFillColor(c);
|
||||||
// set error indicator line width
|
// set error indicator line width
|
||||||
graph->set_errorWidth(1);
|
graph->setErrorWidth(1);
|
||||||
// set length of small bars at the end of error bars
|
// set length of small bars at the end of error bars
|
||||||
graph->set_errorbarSize(15);
|
graph->setErrorbarSize(15);
|
||||||
|
|
||||||
|
|
||||||
// set symbol (cross/X) + pen style (and color)dashed)
|
// set symbol (cross/X) + pen style (and color)dashed)
|
||||||
graph->set_symbol(JKQTPCross);
|
graph->setSymbol(JKQTPCross);
|
||||||
graph->set_style(Qt::DashLine);
|
graph->setStyle(Qt::DashLine);
|
||||||
// set symbol size
|
// set symbol size
|
||||||
graph->set_symbolSize(5);
|
graph->setSymbolSize(5);
|
||||||
// set width of symbol lines
|
// set width of symbol lines
|
||||||
graph->set_symbolWidth(1);
|
graph->setSymbolWidth(1);
|
||||||
// set width of graph line
|
// set width of graph line
|
||||||
graph->setLineWidth(1);
|
graph->setLineWidth(1);
|
||||||
|
|
||||||
// graph title is made from symbol+errorStylestyle, we use the LaTeX instruction \verb around the
|
// graph title is made from symbol+errorStylestyle, we use the LaTeX instruction \verb around the
|
||||||
// result of JKQTPErrorPlotstyle2String(), because it contains underscores that would otherwise
|
// result of JKQTPErrorPlotstyle2String(), because it contains underscores that would otherwise
|
||||||
// lead to lower-case letter, which we don't want
|
// lead to lower-case letter, which we don't want
|
||||||
graph->set_title("\\verb{"+JKQTPErrorPlotstyle2String(errorStyles[errorID])+"}");
|
graph->setTitle("\\verb{"+JKQTPErrorPlotstyle2String(errorStyles[errorID])+"}");
|
||||||
|
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graph);
|
plot.addGraph(graph);
|
||||||
@ -103,10 +103,10 @@ int main(int argc, char* argv[])
|
|||||||
// 6. change locaion of key (outside top-right)
|
// 6. change locaion of key (outside top-right)
|
||||||
plot.getPlotter()->setKeyPosition(JKQTPKeyOutsideRightTop);
|
plot.getPlotter()->setKeyPosition(JKQTPKeyOutsideRightTop);
|
||||||
// ... and switch off the grid
|
// ... and switch off the grid
|
||||||
plot.getXAxis()->set_drawGrid(false);
|
plot.getXAxis()->setDrawGrid(false);
|
||||||
plot.getXAxis()->set_drawMinorGrid(false);
|
plot.getXAxis()->setDrawMinorGrid(false);
|
||||||
plot.getYAxis()->set_drawGrid(false);
|
plot.getYAxis()->setDrawGrid(false);
|
||||||
plot.getYAxis()->set_drawMinorGrid(false);
|
plot.getYAxis()->setDrawMinorGrid(false);
|
||||||
|
|
||||||
// 7. show plotter and make it a decent size
|
// 7. show plotter and make it a decent size
|
||||||
plot.show();
|
plot.show();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_errorbarstyles.cpp
|
SOURCES = jkqtplotter_simpletest_errorbarstyles.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -54,15 +54,15 @@ Finally three `JKQTPFilledCurveXGraph` objects are generated and added to the pl
|
|||||||
JKQTPFilledCurveXGraph* graphR=new JKQTPFilledCurveXGraph(&plot);
|
JKQTPFilledCurveXGraph* graphR=new JKQTPFilledCurveXGraph(&plot);
|
||||||
|
|
||||||
// set graph titles
|
// set graph titles
|
||||||
graphR->set_title("R-channel");
|
graphR->setTitle("R-channel");
|
||||||
|
|
||||||
// set graph colors (lines: non-transparent, fill: semi-transparent
|
// set graph colors (lines: non-transparent, fill: semi-transparent
|
||||||
QColor col;
|
QColor col;
|
||||||
col=QColor("red"); graphR->set_color(col);
|
col=QColor("red"); graphR->setColor(col);
|
||||||
col.setAlphaF(0.25); graphR->set_fillColor(col);
|
col.setAlphaF(0.25); graphR->setFillColor(col);
|
||||||
|
|
||||||
// set data
|
// set data
|
||||||
graphR->set_xColumn(columnX); graphR->set_yColumn(columnR);
|
graphR->setXColumn(columnX); graphR->setYColumn(columnR);
|
||||||
|
|
||||||
|
|
||||||
// add the graphs to the plot, so they are actually displayed
|
// add the graphs to the plot, so they are actually displayed
|
||||||
|
@ -58,26 +58,26 @@ int main(int argc, char* argv[])
|
|||||||
JKQTPFilledCurveXGraph* graphB=new JKQTPFilledCurveXGraph(&plot);
|
JKQTPFilledCurveXGraph* graphB=new JKQTPFilledCurveXGraph(&plot);
|
||||||
|
|
||||||
// set graph titles
|
// set graph titles
|
||||||
graphR->set_title("R-channel");
|
graphR->setTitle("R-channel");
|
||||||
graphG->set_title("G-channel");
|
graphG->setTitle("G-channel");
|
||||||
graphB->set_title("B-channel");
|
graphB->setTitle("B-channel");
|
||||||
|
|
||||||
// set graph colors (lines: non-transparent, fill: semi-transparent) and style
|
// set graph colors (lines: non-transparent, fill: semi-transparent) and style
|
||||||
QColor col;
|
QColor col;
|
||||||
col=QColor("red"); graphR->set_color(col);
|
col=QColor("red"); graphR->setColor(col);
|
||||||
col.setAlphaF(0.25); graphR->set_fillColor(col);
|
col.setAlphaF(0.25); graphR->setFillColor(col);
|
||||||
col=QColor("green"); graphG->set_color(col);
|
col=QColor("green"); graphG->setColor(col);
|
||||||
col.setAlphaF(0.25); graphG->set_fillColor(col);
|
col.setAlphaF(0.25); graphG->setFillColor(col);
|
||||||
col=QColor("blue"); graphB->set_color(col);
|
col=QColor("blue"); graphB->setColor(col);
|
||||||
col.setAlphaF(0.25); graphB->set_fillColor(col);
|
col.setAlphaF(0.25); graphB->setFillColor(col);
|
||||||
graphR->setLineWidth(1);
|
graphR->setLineWidth(1);
|
||||||
graphG->setLineWidth(1);
|
graphG->setLineWidth(1);
|
||||||
graphB->setLineWidth(1);
|
graphB->setLineWidth(1);
|
||||||
|
|
||||||
// set data
|
// set data
|
||||||
graphR->set_xColumn(columnX); graphR->set_yColumn(columnR);
|
graphR->setXColumn(columnX); graphR->setYColumn(columnR);
|
||||||
graphG->set_xColumn(columnX); graphG->set_yColumn(columnG);
|
graphG->setXColumn(columnX); graphG->setYColumn(columnG);
|
||||||
graphB->set_xColumn(columnX); graphB->set_yColumn(columnB);
|
graphB->setXColumn(columnX); graphB->setYColumn(columnB);
|
||||||
|
|
||||||
|
|
||||||
// add the graphs to the plot, so they are actually displayed
|
// add the graphs to the plot, so they are actually displayed
|
||||||
|
@ -4,7 +4,7 @@ SOURCES = jkqtplotter_simpletest_filledgraphs.cpp
|
|||||||
RESOURCES += jkqtplotter_simpletest_filledgraphs.qrc
|
RESOURCES += jkqtplotter_simpletest_filledgraphs.qrc
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -7,12 +7,12 @@ The first example shows how to plot a C++ inline function:
|
|||||||
```.cpp
|
```.cpp
|
||||||
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
|
||||||
func1->setPlotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
func1->setPlotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
||||||
func1->set_title("C++-inline function $0.2x^2-0.015x^3$");
|
func1->setTitle("C++-inline function $0.2x^2-0.015x^3$");
|
||||||
plot->addGraph(func1);
|
plot->addGraph(func1);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Simple C++ inline function with parameters
|
## Simple C++ inline function with parameters
|
||||||
In any such plot function, you can also use parameters, provided via the second parameter. Usually these are "internal parameters", defined by `func2->set_paramsV(p0, p1, ...)`:
|
In any such plot function, you can also use parameters, provided via the second parameter. Usually these are "internal parameters", defined by `func2->setParamsV(p0, p1, ...)`:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPXFunctionLineGraph* func2=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func2=new JKQTPXFunctionLineGraph(plot);
|
||||||
func2->setPlotFunction([](double x, void* params) {
|
func2->setPlotFunction([](double x, void* params) {
|
||||||
@ -20,12 +20,12 @@ In any such plot function, you can also use parameters, provided via the second
|
|||||||
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
||||||
});
|
});
|
||||||
// here we set the parameters p0, p1
|
// here we set the parameters p0, p1
|
||||||
func2->set_paramsV(5, 0.2);
|
func2->setParamsV(5, 0.2);
|
||||||
func2->set_title("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
func2->setTitle("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
||||||
plot->addGraph(func2);
|
plot->addGraph(func2);
|
||||||
```
|
```
|
||||||
|
|
||||||
... but generally any pointer can be used as parameter (the set by `set_parameter(static_cast<void*>(myDataObject))`):
|
... but generally any pointer can be used as parameter (the set by `setParameter(static_cast<void*>(myDataObject))`):
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPXFunctionLineGraph* func3=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func3=new JKQTPXFunctionLineGraph(plot);
|
||||||
func3->setPlotFunction([](double x, void* params) {
|
func3->setPlotFunction([](double x, void* params) {
|
||||||
@ -36,8 +36,8 @@ In any such plot function, you can also use parameters, provided via the second
|
|||||||
QMap<QString,double> params3;
|
QMap<QString,double> params3;
|
||||||
params3["amplitude"]=-3;
|
params3["amplitude"]=-3;
|
||||||
params3["frequency"]=0.3;
|
params3["frequency"]=0.3;
|
||||||
func3->set_params(¶ms3);
|
func3->setParams(¶ms3);
|
||||||
func3->set_title("C++-inline function with ext. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
func3->setTitle("C++-inline function with ext. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
||||||
plot->addGraph(func3);
|
plot->addGraph(func3);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ You can also use C++ functors (or function objects):
|
|||||||
|
|
||||||
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
|
||||||
func4->setPlotFunction(SincSqr(-8));
|
func4->setPlotFunction(SincSqr(-8));
|
||||||
func4->set_title("C++ functor $-8*\\sin^2(x)/x^2$");
|
func4->setTitle("C++ functor $-8*\\sin^2(x)/x^2$");
|
||||||
plot->addGraph(func4);
|
plot->addGraph(func4);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ You can also plot simple static C functions:
|
|||||||
|
|
||||||
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
|
||||||
func5->setPlotFunction(&sinc);
|
func5->setPlotFunction(&sinc);
|
||||||
func5->set_title("static C function $10*\\sin(x)/x$");
|
func5->setTitle("static C function $10*\\sin(x)/x$");
|
||||||
plot->addGraph(func5);
|
plot->addGraph(func5);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -83,8 +83,8 @@ Finally `JKQTPXFunctionLineGraph` provides a small set of special functions (pol
|
|||||||
JKQTPXFunctionLineGraph* func6=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func6=new JKQTPXFunctionLineGraph(plot);
|
||||||
func6->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
|
func6->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
|
||||||
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
|
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
|
||||||
func6->set_paramsV(-1,1.5);
|
func6->setParamsV(-1,1.5);
|
||||||
func6->set_title("special function: linear");
|
func6->setTitle("special function: linear");
|
||||||
plot->addGraph(func6);
|
plot->addGraph(func6);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -97,8 +97,8 @@ JKQTPXFunctionLineGraph* func7=new JKQTPXFunctionLineGraph(plot);
|
|||||||
QVector<double> params;
|
QVector<double> params;
|
||||||
params << /*p0=*/1 << /*p1=*/-1.5;
|
params << /*p0=*/1 << /*p1=*/-1.5;
|
||||||
size_t paramCol=plot->getDatastore()->addCopiedColumn(params);
|
size_t paramCol=plot->getDatastore()->addCopiedColumn(params);
|
||||||
func7->set_parameterColumn(paramCol);
|
func7->setParameterColumn(paramCol);
|
||||||
func7->set_title("special function: linear");
|
func7->setTitle("special function: linear");
|
||||||
plot->addGraph(func7);
|
plot->addGraph(func7);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ int main(int argc, char* argv[])
|
|||||||
// the function is defined as C++ inline function
|
// the function is defined as C++ inline function
|
||||||
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
|
||||||
func1->setPlotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
func1->setPlotFunction([](double x) { return 0.2*x*x-0.015*x*x*x; });
|
||||||
func1->set_title("C++-inline function $0.2x^2-0.015x^3$");
|
func1->setTitle("C++-inline function $0.2x^2-0.015x^3$");
|
||||||
plot->addGraph(func1);
|
plot->addGraph(func1);
|
||||||
|
|
||||||
// 3. now we add a JKQTPXFunctionLineGraph object, which will draw a simple function
|
// 3. now we add a JKQTPXFunctionLineGraph object, which will draw a simple function
|
||||||
@ -52,8 +52,8 @@ int main(int argc, char* argv[])
|
|||||||
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
return p->at(0)*sin(2.0*M_PI*x*p->at(1));
|
||||||
});
|
});
|
||||||
// here we set the parameters p0, p1
|
// here we set the parameters p0, p1
|
||||||
func2->set_paramsV(5, 0.2);
|
func2->setParamsV(5, 0.2);
|
||||||
func2->set_title("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
func2->setTitle("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
||||||
plot->addGraph(func2);
|
plot->addGraph(func2);
|
||||||
|
|
||||||
// 4. now we add a JKQTPXFunctionLineGraph object, which will draw a simple function
|
// 4. now we add a JKQTPXFunctionLineGraph object, which will draw a simple function
|
||||||
@ -68,29 +68,29 @@ int main(int argc, char* argv[])
|
|||||||
QMap<QString,double> params3;
|
QMap<QString,double> params3;
|
||||||
params3["amplitude"]=-3;
|
params3["amplitude"]=-3;
|
||||||
params3["frequency"]=0.3;
|
params3["frequency"]=0.3;
|
||||||
func3->set_params(¶ms3);
|
func3->setParams(¶ms3);
|
||||||
func3->set_title("C++-inline function with ext. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
func3->setTitle("C++-inline function with ext. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
|
||||||
plot->addGraph(func3);
|
plot->addGraph(func3);
|
||||||
|
|
||||||
// 5. of course the function may also be any C+ funtor object:
|
// 5. of course the function may also be any C+ funtor object:
|
||||||
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
|
||||||
func4->setPlotFunction(SincSqr(-8));
|
func4->setPlotFunction(SincSqr(-8));
|
||||||
func4->set_title("C++ functor $-8*\\sin^2(x)/x^2$");
|
func4->setTitle("C++ functor $-8*\\sin^2(x)/x^2$");
|
||||||
plot->addGraph(func4);
|
plot->addGraph(func4);
|
||||||
|
|
||||||
|
|
||||||
// 6. now we use a JKQTPXFunctionLineGraph to draw a static C function
|
// 6. now we use a JKQTPXFunctionLineGraph to draw a static C function
|
||||||
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
|
||||||
func5->setPlotFunction(&sinc);
|
func5->setPlotFunction(&sinc);
|
||||||
func5->set_title("static C function $10*\\sin(x)/x$");
|
func5->setTitle("static C function $10*\\sin(x)/x$");
|
||||||
plot->addGraph(func5);
|
plot->addGraph(func5);
|
||||||
|
|
||||||
// 7. finally JKQTPXFunctionLineGraph defines a small set of common functions
|
// 7. finally JKQTPXFunctionLineGraph defines a small set of common functions
|
||||||
JKQTPXFunctionLineGraph* func6=new JKQTPXFunctionLineGraph(plot);
|
JKQTPXFunctionLineGraph* func6=new JKQTPXFunctionLineGraph(plot);
|
||||||
func6->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
|
func6->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
|
||||||
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
|
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
|
||||||
func6->set_paramsV(-1,1.5);
|
func6->setParamsV(-1,1.5);
|
||||||
func6->set_title("special function: linear p_0=-1, p_1=1.5");
|
func6->setTitle("special function: linear p_0=-1, p_1=1.5");
|
||||||
plot->addGraph(func6);
|
plot->addGraph(func6);
|
||||||
|
|
||||||
// 7. finally JKQTPXFunctionLineGraph defines a small set of common functions
|
// 7. finally JKQTPXFunctionLineGraph defines a small set of common functions
|
||||||
@ -101,8 +101,8 @@ int main(int argc, char* argv[])
|
|||||||
QVector<double> params;
|
QVector<double> params;
|
||||||
params << /*p0=*/1 << /*p1=*/-1.5;
|
params << /*p0=*/1 << /*p1=*/-1.5;
|
||||||
size_t paramCol=plot->getDatastore()->addCopiedColumn(params);
|
size_t paramCol=plot->getDatastore()->addCopiedColumn(params);
|
||||||
func7->set_parameterColumn(paramCol);
|
func7->setParameterColumn(paramCol);
|
||||||
func7->set_title("special function: linear p_0=1, p_1=-1.5");
|
func7->setTitle("special function: linear p_0=1, p_1=-1.5");
|
||||||
plot->addGraph(func7);
|
plot->addGraph(func7);
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_functionplot.cpp
|
SOURCES = jkqtplotter_simpletest_functionplot.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
|
|
||||||
// a one-sided infinite line with slope dy/dx=0.25/0.2
|
// a one-sided infinite line with slope dy/dx=0.25/0.2
|
||||||
JKQTPGeoInfiniteLine* infLine=new JKQTPGeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
|
JKQTPGeoInfiniteLine* infLine=new JKQTPGeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
|
||||||
infLine->set_two_sided(false);
|
infLine->setTwoSided(false);
|
||||||
infLine->setAlpha(0.5);
|
infLine->setAlpha(0.5);
|
||||||
plot.addGraph(infLine);
|
plot.addGraph(infLine);
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ int main(int argc, char* argv[])
|
|||||||
plot.getPlotter()->setMaintainAxisAspectRatio(true);
|
plot.getPlotter()->setMaintainAxisAspectRatio(true);
|
||||||
plot.getPlotter()->setAxisAspectRatio(1);
|
plot.getPlotter()->setAxisAspectRatio(1);
|
||||||
// 2.3 set the asxpect ratio to 1
|
// 2.3 set the asxpect ratio to 1
|
||||||
plot.getXAxis()->set_drawGrid(false);
|
plot.getXAxis()->setDrawGrid(false);
|
||||||
plot.getYAxis()->set_drawGrid(false);
|
plot.getYAxis()->setDrawGrid(false);
|
||||||
|
|
||||||
|
|
||||||
// 3. add some geometric plots
|
// 3. add some geometric plots
|
||||||
@ -48,11 +48,11 @@ int main(int argc, char* argv[])
|
|||||||
p<<QPointF(1, 0.1)<<QPointF(1.3, 0.9)<<QPointF(1.6, 0.3)<<QPointF(1.9, 0.8);
|
p<<QPointF(1, 0.1)<<QPointF(1.3, 0.9)<<QPointF(1.6, 0.3)<<QPointF(1.9, 0.8);
|
||||||
plot.addGraph(new JKQTPGeoPolyLines(&plot, p, QColor("darkgreen"), 4, Qt::PenStyle::DashDotLine));
|
plot.addGraph(new JKQTPGeoPolyLines(&plot, p, QColor("darkgreen"), 4, Qt::PenStyle::DashDotLine));
|
||||||
JKQTPGeoInfiniteLine* infLine=new JKQTPGeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
|
JKQTPGeoInfiniteLine* infLine=new JKQTPGeoInfiniteLine(&plot, 1.7, 0.2, 0.2, 0.25, QColor("green"), 1.5, Qt::PenStyle::DashLine);
|
||||||
infLine->set_two_sided(false);
|
infLine->setTwoSided(false);
|
||||||
infLine->setAlpha(0.5);
|
infLine->setAlpha(0.5);
|
||||||
plot.addGraph(infLine);
|
plot.addGraph(infLine);
|
||||||
infLine=new JKQTPGeoInfiniteLine(&plot, 1.7, 0.2, 0.2, -0.15, QColor("blue"), 1.5, Qt::PenStyle::SolidLine);
|
infLine=new JKQTPGeoInfiniteLine(&plot, 1.7, 0.2, 0.2, -0.15, QColor("blue"), 1.5, Qt::PenStyle::SolidLine);
|
||||||
infLine->set_two_sided(true);
|
infLine->setTwoSided(true);
|
||||||
infLine->setAlpha(0.5);
|
infLine->setAlpha(0.5);
|
||||||
plot.addGraph(infLine);
|
plot.addGraph(infLine);
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_geometric.cpp
|
SOURCES = jkqtplotter_simpletest_geometric.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -60,26 +60,26 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
||||||
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
||||||
// the converted range of data is determined automatically because set_autoImageRange(true)
|
// the converted range of data is determined automatically because setAutoImageRange(true)
|
||||||
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
||||||
graph->set_title("");
|
graph->setTitle("");
|
||||||
// image column with the data
|
// image column with the data
|
||||||
graph->set_imageColumn(cAiryDisk);
|
graph->setImageColumn(cAiryDisk);
|
||||||
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
||||||
graph->set_Nx(NX);
|
graph->setNx(NX);
|
||||||
graph->set_Ny(NY);
|
graph->setNy(NY);
|
||||||
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
||||||
graph->set_x(-w/2.0);
|
graph->setX(-w/2.0);
|
||||||
graph->set_y(-h/2.0);
|
graph->setY(-h/2.0);
|
||||||
// width and height of the image in plot-axis-coordinates
|
// width and height of the image in plot-axis-coordinates
|
||||||
graph->set_width(w);
|
graph->setWidth(w);
|
||||||
graph->set_height(h);
|
graph->setHeight(h);
|
||||||
// color-map is "MATLAB"
|
// color-map is "MATLAB"
|
||||||
graph->set_palette(JKQTPMathImageMATLAB);
|
graph->setPalette(JKQTPMathImageMATLAB);
|
||||||
// get coordinate axis of color-bar and set its label
|
// get coordinate axis of color-bar and set its label
|
||||||
graph->get_colorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
graph->getColorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
||||||
// determine min/max of data automatically and use it to set the range of the color-scale
|
// determine min/max of data automatically and use it to set the range of the color-scale
|
||||||
graph->set_autoImageRange(true);
|
graph->setAutoImageRange(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -116,28 +116,28 @@ The result looks like this:
|
|||||||
There are several ways to modify the plot:
|
There are several ways to modify the plot:
|
||||||
1. You can set the color scale manually (here 0..2), by using
|
1. You can set the color scale manually (here 0..2), by using
|
||||||
```
|
```
|
||||||
graph->set_autoImageRange(false);
|
graph->setAutoImageRange(false);
|
||||||
graph->set_imageMin(0);
|
graph->setImageMin(0);
|
||||||
graph->set_imageMax(2);
|
graph->setImageMax(2);
|
||||||
```
|
```
|
||||||
instead of
|
instead of
|
||||||
```
|
```
|
||||||
graph->set_autoImageRange(true);
|
graph->setAutoImageRange(true);
|
||||||
```
|
```
|
||||||
from above. The result will look like this:<br>
|
from above. The result will look like this:<br>
|
||||||
![jkqtplotter_simpletest_imageplot__scale02](../../screenshots/jkqtplotter_simpletest_imageplot__scale02.png)<br>
|
![jkqtplotter_simpletest_imageplot__scale02](../../screenshots/jkqtplotter_simpletest_imageplot__scale02.png)<br>
|
||||||
Note how the color scale is not used completely, because data really only scales between 0 and 1.
|
Note how the color scale is not used completely, because data really only scales between 0 and 1.
|
||||||
2. If you set the color-range to 0.1 .. 0.8 with
|
2. If you set the color-range to 0.1 .. 0.8 with
|
||||||
```
|
```
|
||||||
graph->set_autoImageRange(false);
|
graph->setAutoImageRange(false);
|
||||||
graph->set_imageMin(0.1);
|
graph->setImageMin(0.1);
|
||||||
graph->set_imageMax(0.8);
|
graph->setImageMax(0.8);
|
||||||
```
|
```
|
||||||
Then there will be datapoints above or below the range of the colorscale. The default behaviour of the graph is to use the first color of the palette for every pixel with a value below the minimum (here 0.1) and the last color in the palette for every pixel with a value above the maximum.<br>
|
Then there will be datapoints above or below the range of the colorscale. The default behaviour of the graph is to use the first color of the palette for every pixel with a value below the minimum (here 0.1) and the last color in the palette for every pixel with a value above the maximum.<br>
|
||||||
![jkqtplotter_simpletest_imageplot__smallscalelimitcolor](../../screenshots/jkqtplotter_simpletest_imageplot__smallscalelimitcolor.png)<br>
|
![jkqtplotter_simpletest_imageplot__smallscalelimitcolor](../../screenshots/jkqtplotter_simpletest_imageplot__smallscalelimitcolor.png)<br>
|
||||||
You can change this behaviour by `set_rangeMinFailAction(),set_rangeMaxFailAction()` with one of these parameters:
|
You can change this behaviour by `setRangeMinFailAction(),setRangeMaxFailAction()` with one of these parameters:
|
||||||
- `JKQTPMathImageLastPaletteColor`: the default behaviour explained above
|
- `JKQTPMathImageLastPaletteColor`: the default behaviour explained above
|
||||||
- `JKQTPMathImageGivenColor`: use a color set by `set_rangeMinFailColor(),set_rangeMaxFailColor()` (here e.g. black for min and grey for max)<br>
|
- `JKQTPMathImageGivenColor`: use a color set by `setRangeMinFailColor(),setRangeMaxFailColor()` (here e.g. black for min and grey for max)<br>
|
||||||
![jkqtplotter_simpletest_imageplot__smallscalecolor](../../screenshots/jkqtplotter_simpletest_imageplot__smallscalecolor.png)
|
![jkqtplotter_simpletest_imageplot__smallscalecolor](../../screenshots/jkqtplotter_simpletest_imageplot__smallscalecolor.png)
|
||||||
- `JKQTPMathImageTransparent`: draw pixels transparent<br>
|
- `JKQTPMathImageTransparent`: draw pixels transparent<br>
|
||||||
![jkqtplotter_simpletest_imageplot__smallscaletransparent](../../screenshots/jkqtplotter_simpletest_imageplot__smallscaletransparent.png)
|
![jkqtplotter_simpletest_imageplot__smallscaletransparent](../../screenshots/jkqtplotter_simpletest_imageplot__smallscaletransparent.png)
|
||||||
|
@ -61,30 +61,30 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
||||||
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
||||||
// the converted range of data is determined automatically because set_autoImageRange(true)
|
// the converted range of data is determined automatically because setAutoImageRange(true)
|
||||||
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
||||||
graph->set_title("");
|
graph->setTitle("");
|
||||||
// image column with the data
|
// image column with the data
|
||||||
graph->set_imageColumn(cAiryDisk);
|
graph->setImageColumn(cAiryDisk);
|
||||||
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
||||||
graph->set_Nx(NX);
|
graph->setNx(NX);
|
||||||
graph->set_Ny(NY);
|
graph->setNy(NY);
|
||||||
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
||||||
graph->set_x(-w/2.0);
|
graph->setX(-w/2.0);
|
||||||
graph->set_y(-h/2.0);
|
graph->setY(-h/2.0);
|
||||||
// width and height of the image in plot-axis-coordinates
|
// width and height of the image in plot-axis-coordinates
|
||||||
graph->set_width(w);
|
graph->setWidth(w);
|
||||||
graph->set_height(h);
|
graph->setHeight(h);
|
||||||
// color-map is "MATLAB"
|
// color-map is "MATLAB"
|
||||||
graph->set_palette(JKQTPMathImageMATLAB);
|
graph->setPalette(JKQTPMathImageMATLAB);
|
||||||
// get coordinate axis of color-bar and set its label
|
// get coordinate axis of color-bar and set its label
|
||||||
graph->get_colorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
graph->getColorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
||||||
// determine min/max of data automatically and use it to set the range of the color-scale
|
// determine min/max of data automatically and use it to set the range of the color-scale
|
||||||
graph->set_autoImageRange(true);
|
graph->setAutoImageRange(true);
|
||||||
// you can set the color-scale range manually by using:
|
// you can set the color-scale range manually by using:
|
||||||
// graph->set_autoImageRange(false);
|
// graph->setAutoImageRange(false);
|
||||||
// graph->set_imageMin(0);
|
// graph->setImageMin(0);
|
||||||
// graph->set_imageMax(10);
|
// graph->setImageMax(10);
|
||||||
|
|
||||||
|
|
||||||
// 5. add the graphs to the plot, so it is actually displayed
|
// 5. add the graphs to the plot, so it is actually displayed
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_imageplot.cpp
|
SOURCES = jkqtplotter_simpletest_imageplot.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -54,29 +54,29 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
||||||
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
||||||
// the converted range of data is determined automatically because set_autoImageRange(true)
|
// the converted range of data is determined automatically because setAutoImageRange(true)
|
||||||
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
||||||
graph->set_title("");
|
graph->setTitle("");
|
||||||
// image column with the data
|
// image column with the data
|
||||||
graph->set_imageColumn(cImage);
|
graph->setImageColumn(cImage);
|
||||||
// now set the modifier image:
|
// now set the modifier image:
|
||||||
graph->set_modifierColumn(cModifier);
|
graph->setModifierColumn(cModifier);
|
||||||
graph->set_autoModifierRange(true);
|
graph->setAutoModifierRange(true);
|
||||||
// ... and specify which image property is modified (here the saturation, but ModifyAlpha for the transparency and ModifyValue from the HSV color-model are also possible):
|
// ... and specify which image property is modified (here the saturation, but ModifyAlpha for the transparency and ModifyValue from the HSV color-model are also possible):
|
||||||
graph->set_modifierMode(JKQTPMathImageBase::ModifySaturation);
|
graph->setModifierMode(JKQTPMathImageBase::ModifySaturation);
|
||||||
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
||||||
graph->set_Nx(NX);
|
graph->setNx(NX);
|
||||||
graph->set_Ny(NY);
|
graph->setNy(NY);
|
||||||
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
||||||
graph->set_x(-NX/2.0);
|
graph->setX(-NX/2.0);
|
||||||
graph->set_y(-NX/2.0);
|
graph->setY(-NX/2.0);
|
||||||
// width and height of the image in plot-axis-coordinates
|
// width and height of the image in plot-axis-coordinates
|
||||||
graph->set_width(NX);
|
graph->setWidth(NX);
|
||||||
graph->set_height(NY);
|
graph->setHeight(NY);
|
||||||
// color-map is "MATLAB"
|
// color-map is "MATLAB"
|
||||||
graph->set_palette(JKQTPMathImageMATLAB);
|
graph->setPalette(JKQTPMathImageMATLAB);
|
||||||
// determine min/max of data automatically and use it to set the range of the color-scale
|
// determine min/max of data automatically and use it to set the range of the color-scale
|
||||||
graph->set_autoImageRange(true);
|
graph->setAutoImageRange(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -115,6 +115,16 @@ Combined the two form this plot:<br>
|
|||||||
![jkqtplotter_simpletest_imageplot_modifier](../../screenshots/jkqtplotter_simpletest_imageplot_modifier.png)
|
![jkqtplotter_simpletest_imageplot_modifier](../../screenshots/jkqtplotter_simpletest_imageplot_modifier.png)
|
||||||
|
|
||||||
|
|
||||||
|
There are several modification modes available (see also documentation of JKQTPMathImageBase::ModifierMode):
|
||||||
|
- no modification `JKQTPMathImageBase::ModifierMode::ModifyNone`: <br>![](../../doc/images/JKQTPMathImageBaseModifyNone.png)
|
||||||
|
- modify the VALUE-channel from the HSV color space `JKQTPMathImageBase::ModifierMode::ModifyValue`: <br>![](../../doc/images/JKQTPMathImageBaseModifyValue.png)
|
||||||
|
- modify the SATURATION-channel from the HSV color space `JKQTPMathImageBase::ModifierMode::ModifySaturation`: <br>![](../../doc/images/JKQTPMathImageBaseModifySaturation.png)
|
||||||
|
- modify the ALPHA/TRANSPARENCY-channel from the RGBA color space `JKQTPMathImageBase::ModifierMode::ModifyAlpha`: <br>![](../../doc/images/JKQTPMathImageBaseModifyAlpha.png)
|
||||||
|
- modify the LUMINANCE-channel from the HSL color space `JKQTPMathImageBase::ModifierMode::ModifyLuminance`: <br>![](../../doc/images/JKQTPMathImageBaseModifyLuminance.png)
|
||||||
|
- modify the VALUE-channel from the HSV color space `JKQTPMathImageBase::ModifierMode::ModifyHue`: <br>![](../../doc/images/JKQTPMathImageBaseModifyHue.png)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
See [`test/simpletest_imageplot`](../simpletest_imageplot) for a detailed description of the other possibilities that the class JKQTPColumnMathImage (and also JKQTPMathImage) offer with respect to determining how an image is plotted. You can combine all options there with the modifier feature described here.
|
See [`test/simpletest_imageplot`](../simpletest_imageplot) for a detailed description of the other possibilities that the class JKQTPColumnMathImage (and also JKQTPMathImage) offer with respect to determining how an image is plotted. You can combine all options there with the modifier feature described here.
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,29 +55,29 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
||||||
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
||||||
// the converted range of data is determined automatically because set_autoImageRange(true)
|
// the converted range of data is determined automatically because setAutoImageRange(true)
|
||||||
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
||||||
graph->set_title("");
|
graph->setTitle("");
|
||||||
// image column with the data
|
// image column with the data
|
||||||
graph->set_imageColumn(cImage);
|
graph->setImageColumn(cImage);
|
||||||
// now set the modifier image:
|
// now set the modifier image:
|
||||||
graph->set_modifierColumn(cModifier);
|
graph->setModifierColumn(cModifier);
|
||||||
graph->set_autoModifierRange(true);
|
graph->setAutoModifierRange(true);
|
||||||
// ... and specify which image property is modified (here the saturation, but ModifyAlpha for the transparency and ModifyValue from the HSV color-model are also possible):
|
// ... and specify which image property is modified (here the saturation, but ModifyAlpha for the transparency and ModifyValue from the HSV color-model are also possible):
|
||||||
graph->set_modifierMode(JKQTPMathImageBase::ModifySaturation);
|
graph->setModifierMode(JKQTPMathImageBase::ModifySaturation);
|
||||||
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
||||||
graph->set_Nx(NX);
|
graph->setNx(NX);
|
||||||
graph->set_Ny(NY);
|
graph->setNy(NY);
|
||||||
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
||||||
graph->set_x(-NX/2.0);
|
graph->setX(-NX/2.0);
|
||||||
graph->set_y(-NX/2.0);
|
graph->setY(-NX/2.0);
|
||||||
// width and height of the image in plot-axis-coordinates
|
// width and height of the image in plot-axis-coordinates
|
||||||
graph->set_width(NX);
|
graph->setWidth(NX);
|
||||||
graph->set_height(NY);
|
graph->setHeight(NY);
|
||||||
// color-map is "MATLAB"
|
// color-map is "MATLAB"
|
||||||
graph->set_palette(JKQTPMathImageMATLAB);
|
graph->setPalette(JKQTPMathImageMATLAB);
|
||||||
// determine min/max of data automatically and use it to set the range of the color-scale
|
// determine min/max of data automatically and use it to set the range of the color-scale
|
||||||
graph->set_autoImageRange(true);
|
graph->setAutoImageRange(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// show plotter and make it a decent size
|
// show plotter and make it a decent size
|
||||||
plot.show();
|
plot.show();
|
||||||
plot.resize(500,500);
|
plot.resize(600,600);
|
||||||
plot.setWindowTitle("JKQTPColumnMathImage");
|
plot.setWindowTitle("JKQTPColumnMathImage");
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_imageplot_modifier.cpp
|
SOURCES = jkqtplotter_simpletest_imageplot_modifier.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Example (JKQTPlotter): Simple math image plot without use of central JKQTdatastore {#JKQTPlotterImagePlotNoDatastore}
|
# Example (JKQTPlotter): Simple math image plot without use of central JKQTdatastore {#JKQTPlotterImagePlotNoDatastore}
|
||||||
This project (see `./examples/simpletest_imageplot_nodatastore/`) simply creates a JKQTPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is stored as a simple C-array in row-major ordering and then given to a JKQTPMathImage to visualize it. The data is stored as a pointer directly in the JKQTPMathImage object. There is also a variant JKQTPColumnMathImage of JKQTPMathImage, which references a column in the internal JKQTdatastore and uses the data there for plotting. In both cases data has to be organized as a row-major matrix of values. JKQTPMathImage supports different dataytpes ([u]nit8/16/32/64,float,double see `JKQTPMathImageBase::DataType`) that can be configured e.g. by `set_data()`.
|
This project (see `./examples/simpletest_imageplot_nodatastore/`) simply creates a JKQTPlotter widget (as a new window) and adds a color-coded image plot of a mathematical function (here the Airy disk). The image is stored as a simple C-array in row-major ordering and then given to a JKQTPMathImage to visualize it. The data is stored as a pointer directly in the JKQTPMathImage object. There is also a variant JKQTPColumnMathImage of JKQTPMathImage, which references a column in the internal JKQTdatastore and uses the data there for plotting. In both cases data has to be organized as a row-major matrix of values. JKQTPMathImage supports different dataytpes ([u]nit8/16/32/64,float,double see `JKQTPMathImageBase::DataType`) that can be configured e.g. by `setData()`.
|
||||||
|
|
||||||
The source code of the main application is (see [`jkqtplotter_simpletest_imageplot_nodatastore.cpp`](../simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.cpp):
|
The source code of the main application is (see [`jkqtplotter_simpletest_imageplot_nodatastore.cpp`](../simpletest_imageplot_nodatastore/jkqtplotter_simpletest_imageplot_nodatastore.cpp):
|
||||||
```.cpp
|
```.cpp
|
||||||
@ -52,27 +52,27 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 3. create a graph (JKQTPMathImage) with referencing the data created above as data
|
// 3. create a graph (JKQTPMathImage) with referencing the data created above as data
|
||||||
// The data is color-coded with the color-palette JKQTPMathImageBLUEYELLOW
|
// The data is color-coded with the color-palette JKQTPMathImageBLUEYELLOW
|
||||||
// the converted range of data is determined automatically because set_autoImageRange(true)
|
// the converted range of data is determined automatically because setAutoImageRange(true)
|
||||||
JKQTPMathImage* graph=new JKQTPMathImage(&plot);
|
JKQTPMathImage* graph=new JKQTPMathImage(&plot);
|
||||||
graph->set_title("");
|
graph->setTitle("");
|
||||||
// set array as datasource, with correct size NX*NY and datatype JKQTPMathImageBase::DataType::DoubleArray
|
// set array as datasource, with correct size NX*NY and datatype JKQTPMathImageBase::DataType::DoubleArray
|
||||||
graph->set_data(airydisk, NX, NY, JKQTPMathImageBase::DataType::DoubleArray);
|
graph->setData(airydisk, NX, NY, JKQTPMathImageBase::DataType::DoubleArray);
|
||||||
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
||||||
graph->set_x(-w/2.0);
|
graph->setX(-w/2.0);
|
||||||
graph->set_y(-h/2.0);
|
graph->setY(-h/2.0);
|
||||||
// width and height of the image in plot-axis-coordinates
|
// width and height of the image in plot-axis-coordinates
|
||||||
graph->set_width(w);
|
graph->setWidth(w);
|
||||||
graph->set_height(h);
|
graph->setHeight(h);
|
||||||
// color-map is "BLUEYELLOW"
|
// color-map is "BLUEYELLOW"
|
||||||
graph->set_palette(JKQTPMathImageBLUEYELLOW);
|
graph->setPalette(JKQTPMathImageBLUEYELLOW);
|
||||||
// get coordinate axis of color-bar and set its label
|
// get coordinate axis of color-bar and set its label
|
||||||
graph->get_colorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
graph->getColorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
||||||
// determine min/max of data automatically and use it to set the range of the color-scale
|
// determine min/max of data automatically and use it to set the range of the color-scale
|
||||||
graph->set_autoImageRange(true);
|
graph->setAutoImageRange(true);
|
||||||
// you can set the color-scale range manually by using:
|
// you can set the color-scale range manually by using:
|
||||||
// graph->set_autoImageRange(false);
|
// graph->setAutoImageRange(false);
|
||||||
// graph->set_imageMin(0);
|
// graph->setImageMin(0);
|
||||||
// graph->set_imageMax(10);
|
// graph->setImageMax(10);
|
||||||
|
|
||||||
|
|
||||||
// 4. add the graphs to the plot, so it is actually displayed
|
// 4. add the graphs to the plot, so it is actually displayed
|
||||||
|
@ -53,27 +53,27 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 3. create a graph (JKQTPMathImage) with referencing the data created above as data
|
// 3. create a graph (JKQTPMathImage) with referencing the data created above as data
|
||||||
// The data is color-coded with the color-palette JKQTPMathImageBLUEYELLOW
|
// The data is color-coded with the color-palette JKQTPMathImageBLUEYELLOW
|
||||||
// the converted range of data is determined automatically because set_autoImageRange(true)
|
// the converted range of data is determined automatically because setAutoImageRange(true)
|
||||||
JKQTPMathImage* graph=new JKQTPMathImage(&plot);
|
JKQTPMathImage* graph=new JKQTPMathImage(&plot);
|
||||||
graph->set_title("");
|
graph->setTitle("");
|
||||||
// set array as datasource, with correct size NX*NY and datatype JKQTPMathImageBase::DataType::DoubleArray
|
// set array as datasource, with correct size NX*NY and datatype JKQTPMathImageBase::DataType::DoubleArray
|
||||||
graph->set_data(airydisk, NX, NY, JKQTPMathImageBase::DataType::DoubleArray);
|
graph->setData(airydisk, NX, NY, JKQTPMathImageBase::DataType::DoubleArray);
|
||||||
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
||||||
graph->set_x(-w/2.0);
|
graph->setX(-w/2.0);
|
||||||
graph->set_y(-h/2.0);
|
graph->setY(-h/2.0);
|
||||||
// width and height of the image in plot-axis-coordinates
|
// width and height of the image in plot-axis-coordinates
|
||||||
graph->set_width(w);
|
graph->setWidth(w);
|
||||||
graph->set_height(h);
|
graph->setHeight(h);
|
||||||
// color-map is "BLUEYELLOW"
|
// color-map is "BLUEYELLOW"
|
||||||
graph->set_palette(JKQTPMathImageBLUEYELLOW);
|
graph->setPalette(JKQTPMathImageBLUEYELLOW);
|
||||||
// get coordinate axis of color-bar and set its label
|
// get coordinate axis of color-bar and set its label
|
||||||
graph->get_colorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
graph->getColorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
||||||
// determine min/max of data automatically and use it to set the range of the color-scale
|
// determine min/max of data automatically and use it to set the range of the color-scale
|
||||||
graph->set_autoImageRange(true);
|
graph->setAutoImageRange(true);
|
||||||
// you can set the color-scale range manually by using:
|
// you can set the color-scale range manually by using:
|
||||||
// graph->set_autoImageRange(false);
|
// graph->setAutoImageRange(false);
|
||||||
// graph->set_imageMin(0);
|
// graph->setImageMin(0);
|
||||||
// graph->set_imageMax(10);
|
// graph->setImageMax(10);
|
||||||
|
|
||||||
|
|
||||||
// 4. add the graphs to the plot, so it is actually displayed
|
// 4. add the graphs to the plot, so it is actually displayed
|
||||||
|
@ -7,7 +7,7 @@ TARGET = jkqtplotter_simpletest_imageplot_nodatastore
|
|||||||
SOURCES = jkqtplotter_simpletest_imageplot_nodatastore.cpp
|
SOURCES = jkqtplotter_simpletest_imageplot_nodatastore.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -65,30 +65,30 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
||||||
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
||||||
// the converted range of data is determined automatically because set_autoImageRange(true)
|
// the converted range of data is determined automatically because setAutoImageRange(true)
|
||||||
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
||||||
graph->set_title("");
|
graph->setTitle("");
|
||||||
// image column with the data
|
// image column with the data
|
||||||
graph->set_imageColumn(cAiryDisk);
|
graph->setImageColumn(cAiryDisk);
|
||||||
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
||||||
graph->set_Nx(airydisk.cols);
|
graph->setNx(airydisk.cols);
|
||||||
graph->set_Ny(airydisk.rows);
|
graph->setNy(airydisk.rows);
|
||||||
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
||||||
graph->set_x(-w/2.0);
|
graph->setX(-w/2.0);
|
||||||
graph->set_y(-h/2.0);
|
graph->setY(-h/2.0);
|
||||||
// width and height of the image in plot-axis-coordinates
|
// width and height of the image in plot-axis-coordinates
|
||||||
graph->set_width(w);
|
graph->setWidth(w);
|
||||||
graph->set_height(h);
|
graph->setHeight(h);
|
||||||
// color-map is "MATLAB"
|
// color-map is "MATLAB"
|
||||||
graph->set_palette(JKQTPMathImageMATLAB);
|
graph->setPalette(JKQTPMathImageMATLAB);
|
||||||
// get coordinate axis of color-bar and set its label
|
// get coordinate axis of color-bar and set its label
|
||||||
graph->get_colorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
graph->getColorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
||||||
// determine min/max of data automatically and use it to set the range of the color-scale
|
// determine min/max of data automatically and use it to set the range of the color-scale
|
||||||
graph->set_autoImageRange(true);
|
graph->setAutoImageRange(true);
|
||||||
// you can set the color-scale range manually by using:
|
// you can set the color-scale range manually by using:
|
||||||
// graph->set_autoImageRange(false);
|
// graph->setAutoImageRange(false);
|
||||||
// graph->set_imageMin(0);
|
// graph->setImageMin(0);
|
||||||
// graph->set_imageMax(10);
|
// graph->setImageMax(10);
|
||||||
|
|
||||||
|
|
||||||
// 5. add the graphs to the plot, so it is actually displayed
|
// 5. add the graphs to the plot, so it is actually displayed
|
||||||
|
@ -64,30 +64,30 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
|
||||||
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
// The data is color-coded with the color-palette JKQTPMathImageMATLAB
|
||||||
// the converted range of data is determined automatically because set_autoImageRange(true)
|
// the converted range of data is determined automatically because setAutoImageRange(true)
|
||||||
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
JKQTPColumnMathImage* graph=new JKQTPColumnMathImage(&plot);
|
||||||
graph->set_title("");
|
graph->setTitle("");
|
||||||
// image column with the data
|
// image column with the data
|
||||||
graph->set_imageColumn(cAiryDisk);
|
graph->setImageColumn(cAiryDisk);
|
||||||
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
// set size of the data (the datastore does not contain this info, as it only manages 1D columns of data and this is used to assume a row-major ordering
|
||||||
graph->set_Nx(airydisk.cols);
|
graph->setNx(airydisk.cols);
|
||||||
graph->set_Ny(airydisk.rows);
|
graph->setNy(airydisk.rows);
|
||||||
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
|
||||||
graph->set_x(-w/2.0);
|
graph->setX(-w/2.0);
|
||||||
graph->set_y(-h/2.0);
|
graph->setY(-h/2.0);
|
||||||
// width and height of the image in plot-axis-coordinates
|
// width and height of the image in plot-axis-coordinates
|
||||||
graph->set_width(w);
|
graph->setWidth(w);
|
||||||
graph->set_height(h);
|
graph->setHeight(h);
|
||||||
// color-map is "MATLAB"
|
// color-map is "MATLAB"
|
||||||
graph->set_palette(JKQTPMathImageMATLAB);
|
graph->setPalette(JKQTPMathImageMATLAB);
|
||||||
// get coordinate axis of color-bar and set its label
|
// get coordinate axis of color-bar and set its label
|
||||||
graph->get_colorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
graph->getColorBarRightAxis()->setAxisLabel("light intensity [A.U.]");
|
||||||
// determine min/max of data automatically and use it to set the range of the color-scale
|
// determine min/max of data automatically and use it to set the range of the color-scale
|
||||||
graph->set_autoImageRange(true);
|
graph->setAutoImageRange(true);
|
||||||
// you can set the color-scale range manually by using:
|
// you can set the color-scale range manually by using:
|
||||||
// graph->set_autoImageRange(false);
|
// graph->setAutoImageRange(false);
|
||||||
// graph->set_imageMin(0);
|
// graph->setImageMin(0);
|
||||||
// graph->set_imageMax(10);
|
// graph->setImageMax(10);
|
||||||
|
|
||||||
|
|
||||||
// 5. add the graphs to the plot, so it is actually displayed
|
// 5. add the graphs to the plot, so it is actually displayed
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_imageplot_opencv.cpp
|
SOURCES = jkqtplotter_simpletest_imageplot_opencv.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@ First data for a curve is calculated and stored in `QVector<double>`:
|
|||||||
Now an impulse graph object is generated and added to the plot:
|
Now an impulse graph object is generated and added to the plot:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPImpulsesVerticalGraph* graph=new JKQTPImpulsesVerticalGraph(&plot);
|
JKQTPImpulsesVerticalGraph* graph=new JKQTPImpulsesVerticalGraph(&plot);
|
||||||
graph->set_xColumn(columnX);
|
graph->setXColumn(columnX);
|
||||||
graph->set_yColumn(columnY);
|
graph->setYColumn(columnY);
|
||||||
graph->setLineWidth(2);
|
graph->setLineWidth(2);
|
||||||
graph->set_color(QColor("red"));
|
graph->setColor(QColor("red"));
|
||||||
graph->set_title(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
|
graph->setTitle(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
|
||||||
|
|
||||||
plot.addGraph(graph);
|
plot.addGraph(graph);
|
||||||
```
|
```
|
||||||
@ -39,11 +39,11 @@ The result looks like this:
|
|||||||
There is an alternative class `JKQTPImpulsesHorizontalGraph` which draws horizontal impulse plots:
|
There is an alternative class `JKQTPImpulsesHorizontalGraph` which draws horizontal impulse plots:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPImpulsesHorizontalGraph* graph=new JKQTPImpulsesHorizontalGraph(&plot);
|
JKQTPImpulsesHorizontalGraph* graph=new JKQTPImpulsesHorizontalGraph(&plot);
|
||||||
graph->set_yColumn(columnX);
|
graph->setYColumn(columnX);
|
||||||
graph->set_xColumn(columnY);
|
graph->setXColumn(columnY);
|
||||||
graph->setLineWidth(2);
|
graph->setLineWidth(2);
|
||||||
graph->set_color(QColor("blue"));
|
graph->setColor(QColor("blue"));
|
||||||
graph->set_title(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
|
graph->setTitle(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
|
||||||
```
|
```
|
||||||
|
|
||||||
This code snippet results in a plot like this:
|
This code snippet results in a plot like this:
|
||||||
|
@ -33,11 +33,11 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 4. create a vertical impulse graph in the plot, which plots the dataset X/Y:
|
// 4. create a vertical impulse graph in the plot, which plots the dataset X/Y:
|
||||||
JKQTPImpulsesVerticalGraph* graph=new JKQTPImpulsesVerticalGraph(&plot);
|
JKQTPImpulsesVerticalGraph* graph=new JKQTPImpulsesVerticalGraph(&plot);
|
||||||
graph->set_xColumn(columnX);
|
graph->setXColumn(columnX);
|
||||||
graph->set_yColumn(columnY);
|
graph->setYColumn(columnY);
|
||||||
graph->setLineWidth(2);
|
graph->setLineWidth(2);
|
||||||
graph->set_color(QColor("red"));
|
graph->setColor(QColor("red"));
|
||||||
graph->set_title(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
|
graph->setTitle(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
|
||||||
|
|
||||||
// 5. add the graph to the plot, so it is actually displayed
|
// 5. add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graph);
|
plot.addGraph(graph);
|
||||||
@ -47,8 +47,8 @@ int main(int argc, char* argv[])
|
|||||||
plot.getYAxis()->setAxisLabel(QObject::tr("y-axis"));
|
plot.getYAxis()->setAxisLabel(QObject::tr("y-axis"));
|
||||||
|
|
||||||
// 7. switch the grid off
|
// 7. switch the grid off
|
||||||
plot.getXAxis()->set_drawGrid(false);
|
plot.getXAxis()->setDrawGrid(false);
|
||||||
plot.getYAxis()->set_drawGrid(false);
|
plot.getYAxis()->setDrawGrid(false);
|
||||||
|
|
||||||
// 8. autoscale the plot so the graph is contained
|
// 8. autoscale the plot so the graph is contained
|
||||||
plot.zoomToFit();
|
plot.zoomToFit();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_impulsesplot.cpp
|
SOURCES = jkqtplotter_simpletest_impulsesplot.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Example (JKQTPlotter): Line Graph with Logarithmic y-axis {#JKQTPlotterLogAxes}
|
# Example (JKQTPlotter): Line Graph with Logarithmic y-axis {#JKQTPlotterLogAxes}
|
||||||
This project (see `./examples/simpletest_logaxes/`) simply creates a JKQTPlotter widget (as a new window) and several line-graphs of different resonance curves.
|
This project (see `./examples/simpletest_logaxes/`) simply creates a JKQTPlotter widget (as a new window) and several line-graphs of different resonance curves.
|
||||||
|
|
||||||
The source code of the main application can be found in [`jkqtplotter_simpletest_logaxes.cpp`](../simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp). Mainly several graphs are generated in a loop and then different line styles are applied to the graphs (set by ``graph->set_style()`). The colors are set automtically from an internal default palette. The main loop looks like this:
|
The source code of the main application can be found in [`jkqtplotter_simpletest_logaxes.cpp`](../simpletest_logaxes/jkqtplotter_simpletest_logaxes.cpp). Mainly several graphs are generated in a loop and then different line styles are applied to the graphs (set by ``graph->setStyle()`). The colors are set automtically from an internal default palette. The main loop looks like this:
|
||||||
|
|
||||||
```.cpp
|
```.cpp
|
||||||
QVector<Qt::PenStyle> pens {Qt::SolidLine, Qt::DashLine, Qt::DotLine, Qt::DashDotLine, Qt::DashDotDotLine };
|
QVector<Qt::PenStyle> pens {Qt::SolidLine, Qt::DashLine, Qt::DotLine, Qt::DashDotLine, Qt::DashDotDotLine };
|
||||||
@ -15,18 +15,18 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
JKQTPXYLineGraph* graph=new JKQTPXYLineGraph(&plot);
|
JKQTPXYLineGraph* graph=new JKQTPXYLineGraph(&plot);
|
||||||
|
|
||||||
// copy data into datastore and immediately set the yColumn
|
// copy data into datastore and immediately set the yColumn
|
||||||
graph->set_xColumn(columnX);
|
graph->setXColumn(columnX);
|
||||||
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
||||||
|
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graph->set_symbol(JKQTPNoSymbol);
|
graph->setSymbol(JKQTPNoSymbol);
|
||||||
// use one of different pens
|
// use one of different pens
|
||||||
graph->set_style(pens[id%pens.size()]);
|
graph->setStyle(pens[id%pens.size()]);
|
||||||
// set width of graph line
|
// set width of graph line
|
||||||
graph->setLineWidth(1.5);
|
graph->setLineWidth(1.5);
|
||||||
|
|
||||||
// graph title is made from symbol+penstyle
|
// graph title is made from symbol+penstyle
|
||||||
graph->set_title(QString("D=\\delta/\\omega_0=%1").arg(D[id]));
|
graph->setTitle(QString("D=\\delta/\\omega_0=%1").arg(D[id]));
|
||||||
|
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graph);
|
plot.addGraph(graph);
|
||||||
@ -53,28 +53,28 @@ The difference between not using and using `$...$` for the equation can be seen
|
|||||||
Finally the y-axis is switched to logarithmic scaling and the axis labels are set:
|
Finally the y-axis is switched to logarithmic scaling and the axis labels are set:
|
||||||
```.cpp
|
```.cpp
|
||||||
// 5. set y-axis to logarithmic (x-axis would be analogous, but using `plot.getXAxis()`)
|
// 5. set y-axis to logarithmic (x-axis would be analogous, but using `plot.getXAxis()`)
|
||||||
plot.getYAxis()->set_logAxis(true);
|
plot.getYAxis()->setLogAxis(true);
|
||||||
// now we set the number of label ticks to 9 (you give the count if minor between two majors,
|
// now we set the number of label ticks to 9 (you give the count if minor between two majors,
|
||||||
// so if you want ticks for 1,2,3,...,10,20,30,...,100... you need to use 9:
|
// so if you want ticks for 1,2,3,...,10,20,30,...,100... you need to use 9:
|
||||||
plot.getYAxis()->set_minorTicks(9);
|
plot.getYAxis()->setMinorTicks(9);
|
||||||
// the minor grid is not shown by default. You can switch it on:
|
// the minor grid is not shown by default. You can switch it on:
|
||||||
plot.getYAxis()->set_drawMinorGrid(true);
|
plot.getYAxis()->setDrawMinorGrid(true);
|
||||||
// usually axis ticks are shown as numbers 0.01, 0.1, 1, 10, ... You can also force the scientific
|
// usually axis ticks are shown as numbers 0.01, 0.1, 1, 10, ... You can also force the scientific
|
||||||
// power-of-10 notation, using:
|
// power-of-10 notation, using:
|
||||||
plot.getYAxis()->set_labelType(JKQTPCALTexponent);
|
plot.getYAxis()->setLabelType(JKQTPCALTexponent);
|
||||||
// the number of digits in JKQTPCALTexponent determines which labels are drawn in standard-notation,
|
// the number of digits in JKQTPCALTexponent determines which labels are drawn in standard-notation,
|
||||||
// as compared to power-notation (e.g. if set to 1, the labels 0.1=10^{-1}, 1, 10 are shown in
|
// as compared to power-notation (e.g. if set to 1, the labels 0.1=10^{-1}, 1, 10 are shown in
|
||||||
// standard notation, the rest in power-notation. This tweak improves readability)
|
// standard notation, the rest in power-notation. This tweak improves readability)
|
||||||
plot.getYAxis()->set_labelDigits(0);
|
plot.getYAxis()->setLabelDigits(0);
|
||||||
// minor tick labels are usually not displayed, but you can switch them on, using
|
// minor tick labels are usually not displayed, but you can switch them on, using
|
||||||
//plot.getYAxis()->set_minorTickLabelsEnabled(true);
|
//plot.getYAxis()->setMinorTickLabelsEnabled(true);
|
||||||
// the axis font sizes can be set with:
|
// the axis font sizes can be set with:
|
||||||
plot.getYAxis()->set_tickLabelFontSize(10); // axis tick labels
|
plot.getYAxis()->setTickLabelFontSize(10); // axis tick labels
|
||||||
plot.getYAxis()->set_minorTickLabelFontSize(7); // minor axis tick labels
|
plot.getYAxis()->setMinorTickLabelFontSize(7); // minor axis tick labels
|
||||||
plot.getYAxis()->set_labelFontSize(14); // axis label size
|
plot.getYAxis()->setLabelFontSize(14); // axis label size
|
||||||
plot.getXAxis()->set_tickLabelFontSize(10); // axis tick labels
|
plot.getXAxis()->setTickLabelFontSize(10); // axis tick labels
|
||||||
plot.getXAxis()->set_minorTickLabelFontSize(7); // minor axis tick labels
|
plot.getXAxis()->setMinorTickLabelFontSize(7); // minor axis tick labels
|
||||||
plot.getXAxis()->set_labelFontSize(14); // axis label size
|
plot.getXAxis()->setLabelFontSize(14); // axis label size
|
||||||
// ... and finally set axis labels (using LaTeX notation and $...$ to improve rendering)
|
// ... and finally set axis labels (using LaTeX notation and $...$ to improve rendering)
|
||||||
plot.getYAxis()->setAxisLabel("Amplitude $A/A_{stat}$");
|
plot.getYAxis()->setAxisLabel("Amplitude $A/A_{stat}$");
|
||||||
plot.getXAxis()->setAxisLabel("relative driving frequency $\\eta=\\omega/\\omega_0$");
|
plot.getXAxis()->setAxisLabel("relative driving frequency $\\eta=\\omega/\\omega_0$");
|
||||||
@ -94,13 +94,13 @@ Switching the minor grid off results in a plot like this:
|
|||||||
|
|
||||||
![jkqtplotter_simpletest_logaxes_nominorgrid](../../screenshots/jkqtplotter_simpletest_logaxes_nominorgrid.png)
|
![jkqtplotter_simpletest_logaxes_nominorgrid](../../screenshots/jkqtplotter_simpletest_logaxes_nominorgrid.png)
|
||||||
|
|
||||||
These examples show the results for different typical values for `set_minorTicks()`:
|
These examples show the results for different typical values for `setMinorTicks()`:
|
||||||
|
|
||||||
![logaxis_set_minorticks](../../screenshots/logaxis_set_minorticks.png)
|
![logaxis_setMinorticks](../../screenshots/logaxis_setMinorticks.png)
|
||||||
|
|
||||||
These examples show the results for different typical values for `set_labelType()`:
|
These examples show the results for different typical values for `setLabelType()`:
|
||||||
|
|
||||||
![logaxis_set_labelType](../../screenshots/logaxis_set_labelType.png)
|
![logaxis_setLabelType](../../screenshots/logaxis_setLabelType.png)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,18 +45,18 @@ int main(int argc, char* argv[])
|
|||||||
JKQTPXYLineGraph* graph=new JKQTPXYLineGraph(&plot);
|
JKQTPXYLineGraph* graph=new JKQTPXYLineGraph(&plot);
|
||||||
|
|
||||||
// copy data into datastore and immediately set the yColumn
|
// copy data into datastore and immediately set the yColumn
|
||||||
graph->set_xColumn(columnX);
|
graph->setXColumn(columnX);
|
||||||
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
|
||||||
|
|
||||||
// don't use symbols
|
// don't use symbols
|
||||||
graph->set_symbol(JKQTPNoSymbol);
|
graph->setSymbol(JKQTPNoSymbol);
|
||||||
// use one of different pens
|
// use one of different pens
|
||||||
graph->set_style(pens[id%pens.size()]);
|
graph->setStyle(pens[id%pens.size()]);
|
||||||
// set width of graph line
|
// set width of graph line
|
||||||
graph->setLineWidth(1.5);
|
graph->setLineWidth(1.5);
|
||||||
|
|
||||||
// graph title is made from symbol+penstyle
|
// graph title is made from symbol+penstyle
|
||||||
graph->set_title(QString("$D=\\delta/\\omega_0=%1$").arg(D[id]));
|
graph->setTitle(QString("$D=\\delta/\\omega_0=%1$").arg(D[id]));
|
||||||
|
|
||||||
// add the graph to the plot, so it is actually displayed
|
// add the graph to the plot, so it is actually displayed
|
||||||
plot.addGraph(graph);
|
plot.addGraph(graph);
|
||||||
@ -74,28 +74,28 @@ int main(int argc, char* argv[])
|
|||||||
plot.addGraph(new JKQTPGeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15));
|
plot.addGraph(new JKQTPGeoText(&plot, 1.25, 10, "$\\frac{A}{A_{stat}}=\\frac{1}{\\sqrt{\\left(1-\\eta^2\\right)^2+\\left(2{\\eta}D\\right)^2}}$", 15));
|
||||||
|
|
||||||
// 5. set y-axis to logarithmic (x-axis would be analogous, but using `plot.getXAxis()`)
|
// 5. set y-axis to logarithmic (x-axis would be analogous, but using `plot.getXAxis()`)
|
||||||
plot.getYAxis()->set_logAxis(true);
|
plot.getYAxis()->setLogAxis(true);
|
||||||
// now we set the number of label ticks to 9 (you give the count if minor between two majors,
|
// now we set the number of label ticks to 9 (you give the count if minor between two majors,
|
||||||
// so if you want ticks for 1,2,3,...,10,20,30,...,100... you need to use 9:
|
// so if you want ticks for 1,2,3,...,10,20,30,...,100... you need to use 9:
|
||||||
plot.getYAxis()->set_minorTicks(9);
|
plot.getYAxis()->setMinorTicks(9);
|
||||||
// the minor grid is not shown by default. You can switch it on:
|
// the minor grid is not shown by default. You can switch it on:
|
||||||
plot.getYAxis()->set_drawMinorGrid(true);
|
plot.getYAxis()->setDrawMinorGrid(true);
|
||||||
// usually axis ticks are shown as numbers 0.01, 0.1, 1, 10, ... You can also force the scientific
|
// usually axis ticks are shown as numbers 0.01, 0.1, 1, 10, ... You can also force the scientific
|
||||||
// power-of-10 notation, using:
|
// power-of-10 notation, using:
|
||||||
plot.getYAxis()->set_labelType(JKQTPCALTexponent);
|
plot.getYAxis()->setLabelType(JKQTPCALTexponent);
|
||||||
// the number of digits in JKQTPCALTexponent determines which labels are drawn in standard-notation,
|
// the number of digits in JKQTPCALTexponent determines which labels are drawn in standard-notation,
|
||||||
// as compared to power-notation (e.g. if set to 1, the labels 0.1=10^{-1}, 1, 10 are shown in
|
// as compared to power-notation (e.g. if set to 1, the labels 0.1=10^{-1}, 1, 10 are shown in
|
||||||
// standard notation, the rest in power-notation. This tweak improves readability)
|
// standard notation, the rest in power-notation. This tweak improves readability)
|
||||||
plot.getYAxis()->set_labelDigits(0);
|
plot.getYAxis()->setLabelDigits(0);
|
||||||
// minor tick labels are usually not displayed, but you can switch them on, using
|
// minor tick labels are usually not displayed, but you can switch them on, using
|
||||||
//plot.getYAxis()->set_minorTickLabelsEnabled(true);
|
//plot.getYAxis()->setMinorTickLabelsEnabled(true);
|
||||||
// the axis font sizes can be set with:
|
// the axis font sizes can be set with:
|
||||||
plot.getYAxis()->set_tickLabelFontSize(10); // axis tick labels
|
plot.getYAxis()->setTickLabelFontSize(10); // axis tick labels
|
||||||
plot.getYAxis()->set_minorTickLabelFontSize(7); // minor axis tick labels
|
plot.getYAxis()->setMinorTickLabelFontSize(7); // minor axis tick labels
|
||||||
plot.getYAxis()->set_labelFontSize(14); // axis label size
|
plot.getYAxis()->setLabelFontSize(14); // axis label size
|
||||||
plot.getXAxis()->set_tickLabelFontSize(10); // axis tick labels
|
plot.getXAxis()->setTickLabelFontSize(10); // axis tick labels
|
||||||
plot.getXAxis()->set_minorTickLabelFontSize(7); // minor axis tick labels
|
plot.getXAxis()->setMinorTickLabelFontSize(7); // minor axis tick labels
|
||||||
plot.getXAxis()->set_labelFontSize(14); // axis label size
|
plot.getXAxis()->setLabelFontSize(14); // axis label size
|
||||||
// ... and finally set axis labels (using LaTeX notation and $...$ to improve rendering)
|
// ... and finally set axis labels (using LaTeX notation and $...$ to improve rendering)
|
||||||
plot.getYAxis()->setAxisLabel("Amplitude $A/A_{stat}$");
|
plot.getYAxis()->setAxisLabel("Amplitude $A/A_{stat}$");
|
||||||
plot.getXAxis()->setAxisLabel("relative driving frequency $\\eta=\\omega/\\omega_0$");
|
plot.getXAxis()->setAxisLabel("relative driving frequency $\\eta=\\omega/\\omega_0$");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_logaxes.cpp
|
SOURCES = jkqtplotter_simpletest_logaxes.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -25,25 +25,25 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
Then simples graph just uses the columns X and Y to plot the curve:
|
Then simples graph just uses the columns X and Y to plot the curve:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->setXColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->setYColumn(columnY);
|
||||||
graph1->set_drawLine(true);
|
graph1->setDrawLine(true);
|
||||||
graph1->set_symbol(JKQTPNoSymbol);
|
graph1->setSymbol(JKQTPNoSymbol);
|
||||||
graph1->set_title("one-colored spiral");
|
graph1->setTitle("one-colored spiral");
|
||||||
plot.addGraph(graph1);
|
plot.addGraph(graph1);
|
||||||
```
|
```
|
||||||
|
|
||||||
If you use `JKQTPXYParametrizedScatterGraph` instead of `JKQTPXYLineGraph`, you can also modify the color of the line-segments, connecting the datapoints:
|
If you use `JKQTPXYParametrizedScatterGraph` instead of `JKQTPXYLineGraph`, you can also modify the color of the line-segments, connecting the datapoints:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot2);
|
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot2);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->setXColumn(columnX);
|
||||||
graph2->set_yColumn(columnY);
|
graph2->setYColumn(columnY);
|
||||||
graph2->set_colorColumn(columnR);
|
graph2->setColorColumn(columnR);
|
||||||
graph2->set_palette(JKQTPMathImageMATLAB);
|
graph2->setPalette(JKQTPMathImageMATLAB);
|
||||||
graph2->set_symbol(JKQTPNoSymbol);
|
graph2->setSymbol(JKQTPNoSymbol);
|
||||||
graph2->set_drawLine(true);
|
graph2->setDrawLine(true);
|
||||||
graph2->set_title("colored spiral");
|
graph2->setTitle("colored spiral");
|
||||||
graph2->get_colorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
|
graph2->getColorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
|
||||||
plot2.addGraph(graph2);
|
plot2.addGraph(graph2);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -43,24 +43,24 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
// 3.1 the basic graph
|
// 3.1 the basic graph
|
||||||
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->setXColumn(columnX);
|
||||||
graph1->set_yColumn(columnY);
|
graph1->setYColumn(columnY);
|
||||||
graph1->set_drawLine(true);
|
graph1->setDrawLine(true);
|
||||||
graph1->set_symbol(JKQTPNoSymbol);
|
graph1->setSymbol(JKQTPNoSymbol);
|
||||||
graph1->set_title("one-colored spiral");
|
graph1->setTitle("one-colored spiral");
|
||||||
plot.addGraph(graph1);
|
plot.addGraph(graph1);
|
||||||
|
|
||||||
// 3.2 for graph2 is the same as graph 1, but in addition, the color of the lines
|
// 3.2 for graph2 is the same as graph 1, but in addition, the color of the lines
|
||||||
// is set, based on the contents of column R, via the color-palette JKQTPMathImageMATLAB
|
// is set, based on the contents of column R, via the color-palette JKQTPMathImageMATLAB
|
||||||
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot2);
|
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot2);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->setXColumn(columnX);
|
||||||
graph2->set_yColumn(columnY);
|
graph2->setYColumn(columnY);
|
||||||
graph2->set_colorColumn(columnR);
|
graph2->setColorColumn(columnR);
|
||||||
graph2->set_palette(JKQTPMathImageMATLAB);
|
graph2->setPalette(JKQTPMathImageMATLAB);
|
||||||
graph2->set_symbol(JKQTPNoSymbol);
|
graph2->setSymbol(JKQTPNoSymbol);
|
||||||
graph2->set_drawLine(true);
|
graph2->setDrawLine(true);
|
||||||
graph2->set_title("colored spiral");
|
graph2->setTitle("colored spiral");
|
||||||
graph2->get_colorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
|
graph2->getColorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
|
||||||
plot2.addGraph(graph2);
|
plot2.addGraph(graph2);
|
||||||
|
|
||||||
|
|
||||||
@ -71,15 +71,15 @@ int main(int argc, char* argv[])
|
|||||||
plot.getPlotter()->setAspectRatio(1);
|
plot.getPlotter()->setAspectRatio(1);
|
||||||
plot.getXAxis()->setAxisLabel("x-axis");
|
plot.getXAxis()->setAxisLabel("x-axis");
|
||||||
plot.getYAxis()->setAxisLabel("y-axis");
|
plot.getYAxis()->setAxisLabel("y-axis");
|
||||||
plot.getXAxis()->set_drawGrid(false);
|
plot.getXAxis()->setDrawGrid(false);
|
||||||
plot.getYAxis()->set_drawGrid(false);
|
plot.getYAxis()->setDrawGrid(false);
|
||||||
plot.setXY(-15,15,-15,15);
|
plot.setXY(-15,15,-15,15);
|
||||||
plot2.getPlotter()->setMaintainAspectRatio(true);
|
plot2.getPlotter()->setMaintainAspectRatio(true);
|
||||||
plot2.getPlotter()->setAspectRatio(1);
|
plot2.getPlotter()->setAspectRatio(1);
|
||||||
plot2.getXAxis()->setAxisLabel("x-axis");
|
plot2.getXAxis()->setAxisLabel("x-axis");
|
||||||
plot2.getYAxis()->setAxisLabel("y-axis");
|
plot2.getYAxis()->setAxisLabel("y-axis");
|
||||||
plot2.getXAxis()->set_drawGrid(false);
|
plot2.getXAxis()->setDrawGrid(false);
|
||||||
plot2.getYAxis()->set_drawGrid(false);
|
plot2.getYAxis()->setDrawGrid(false);
|
||||||
plot2.setXY(-15,15,-15,15);
|
plot2.setXY(-15,15,-15,15);
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
SOURCES = jkqtplotter_simpletest_parametriccurve.cpp
|
SOURCES = jkqtplotter_simpletest_parametriccurve.cpp
|
||||||
|
|
||||||
# configure Qt
|
# configure Qt
|
||||||
CONFIG += qt
|
CONFIG += link_prl qt
|
||||||
QT += core gui xml svg
|
QT += core gui xml svg
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
|
||||||
|
|
||||||
|
@ -11,39 +11,39 @@ The source code of the main application can be found in [`jkqtplotter_simpletes
|
|||||||
|
|
||||||
Then several plots are added that modify different properties.
|
Then several plots are added that modify different properties.
|
||||||
|
|
||||||
The simplest case is to modify the symbol type. Simply set the property `symbolColumn` with `graph1->set_symbolColumn(columnP)` to a data column. The values in the data column will be cast to an integer and then will be translated to `JKQTPGraphSymbols`. If the numbers are larger than the available symbol types in `JKQTPGraphSymbols`, the graph will cycle through the available symbols (via a modulo-operation with the max. symbol count!).
|
The simplest case is to modify the symbol type. Simply set the property `symbolColumn` with `graph1->setSymbolColumn(columnP)` to a data column. The values in the data column will be cast to an integer and then will be translated to `JKQTPGraphSymbols`. If the numbers are larger than the available symbol types in `JKQTPGraphSymbols`, the graph will cycle through the available symbols (via a modulo-operation with the max. symbol count!).
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->setXColumn(columnX);
|
||||||
graph1->set_yColumn(columnY1);
|
graph1->setYColumn(columnY1);
|
||||||
graph1->set_symbolColumn(columnP);
|
graph1->setSymbolColumn(columnP);
|
||||||
graph1->set_drawLine(true);
|
graph1->setDrawLine(true);
|
||||||
graph1->set_color(QColor("blueviolet"));
|
graph1->setColor(QColor("blueviolet"));
|
||||||
graph1->set_title("1: symbol type");
|
graph1->setTitle("1: symbol type");
|
||||||
plot.addGraph(graph1);
|
plot.addGraph(graph1);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
The next two code snippets show how to modify the size of the symbols and the line width of the lines, connecting the symbols (ensure to set `graph6->set_drawLine(true)`, because otherwise no line will be drawn). The principle is the same as above, but here you need to set the properties `sizeColumn` for the symbol size and `linewidthColumn` for the line width. All values in the line width or symbol size columns are interpreted as sizes in dtp points (pt)!
|
The next two code snippets show how to modify the size of the symbols and the line width of the lines, connecting the symbols (ensure to set `graph6->setDrawLine(true)`, because otherwise no line will be drawn). The principle is the same as above, but here you need to set the properties `sizeColumn` for the symbol size and `linewidthColumn` for the line width. All values in the line width or symbol size columns are interpreted as sizes in dtp points (pt)!
|
||||||
```.cpp
|
```.cpp
|
||||||
// symbol size
|
// symbol size
|
||||||
JKQTPXYParametrizedScatterGraph* graph3=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph3=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph3->set_xColumn(columnX);
|
graph3->setXColumn(columnX);
|
||||||
graph3->set_yColumn(columnY3);
|
graph3->setYColumn(columnY3);
|
||||||
graph3->set_sizeColumn(columnS);
|
graph3->setSizeColumn(columnS);
|
||||||
graph3->set_symbol(JKQTPFilledCircle);
|
graph3->setSymbol(JKQTPFilledCircle);
|
||||||
graph3->set_drawLine(true);
|
graph3->setDrawLine(true);
|
||||||
graph3->set_title("3: symbol size");
|
graph3->setTitle("3: symbol size");
|
||||||
plot.addGraph(graph3);
|
plot.addGraph(graph3);
|
||||||
|
|
||||||
// line width
|
// line width
|
||||||
JKQTPXYParametrizedScatterGraph* graph6=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph6=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph6->set_xColumn(columnX);
|
graph6->setXColumn(columnX);
|
||||||
graph6->set_yColumn(columnY6);
|
graph6->setYColumn(columnY6);
|
||||||
graph6->setLinewidthColumn(columnLW);
|
graph6->setLinewidthColumn(columnLW);
|
||||||
graph6->set_drawLine(true);
|
graph6->setDrawLine(true);
|
||||||
graph6->set_symbol(JKQTPNoSymbol);
|
graph6->setSymbol(JKQTPNoSymbol);
|
||||||
graph6->set_title("6: line width");
|
graph6->setTitle("6: line width");
|
||||||
plot.addGraph(graph6);
|
plot.addGraph(graph6);
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -60,46 +60,46 @@ Finally you can set the color of each symbol, based on data in the column `color
|
|||||||
```.cpp
|
```.cpp
|
||||||
Basically the data points in a RGB(A)-column will be interpreted by castig them to [`QRgb`](http://doc.qt.io/qt-5/qcolor.html#QRgb-typedef).
|
Basically the data points in a RGB(A)-column will be interpreted by castig them to [`QRgb`](http://doc.qt.io/qt-5/qcolor.html#QRgb-typedef).
|
||||||
|
|
||||||
Now you can add the graph. In order to interpret the color column as RGB(A)-values, ensure to set `graph4->set_colorColumnContainsRGB(true)`:
|
Now you can add the graph. In order to interpret the color column as RGB(A)-values, ensure to set `graph4->setColorColumnContainsRGB(true)`:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPXYParametrizedScatterGraph* graph4=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph4=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph4->set_xColumn(columnX);
|
graph4->setXColumn(columnX);
|
||||||
graph4->set_yColumn(columnY4);
|
graph4->setYColumn(columnY4);
|
||||||
graph4->set_colorColumn(columnRGB);
|
graph4->setColorColumn(columnRGB);
|
||||||
graph4->set_colorColumnContainsRGB(true);
|
graph4->setColorColumnContainsRGB(true);
|
||||||
graph4->set_drawLine(true);
|
graph4->setDrawLine(true);
|
||||||
graph4->set_symbol(JKQTPFilledDownTriangle);
|
graph4->setSymbol(JKQTPFilledDownTriangle);
|
||||||
graph4->set_title("4: RGB-color");
|
graph4->setTitle("4: RGB-color");
|
||||||
plot.addGraph(graph4);
|
plot.addGraph(graph4);
|
||||||
```
|
```
|
||||||
|
|
||||||
The second variant for setting the color of each datapoint is by mapping the values in the column to a color palette (`JKQTPMathImageRYGB` in this example). For this you simply need to define the color coumn and the palette to use. By default, the color palette spans the full range of values in `colorColumn`:
|
The second variant for setting the color of each datapoint is by mapping the values in the column to a color palette (`JKQTPMathImageRYGB` in this example). For this you simply need to define the color coumn and the palette to use. By default, the color palette spans the full range of values in `colorColumn`:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->setXColumn(columnX);
|
||||||
graph2->set_yColumn(columnY2);
|
graph2->setYColumn(columnY2);
|
||||||
graph2->set_colorColumn(columnC);
|
graph2->setColorColumn(columnC);
|
||||||
graph2->set_palette(JKQTPMathImageRYGB);
|
graph2->setPalette(JKQTPMathImageRYGB);
|
||||||
graph2->set_symbol(JKQTPFilledRect);
|
graph2->setSymbol(JKQTPFilledRect);
|
||||||
graph2->set_drawLine(true);
|
graph2->setDrawLine(true);
|
||||||
graph2->set_title("2: color");
|
graph2->setTitle("2: color");
|
||||||
graph2->get_colorBarRightAxis()->setAxisLabel("color scale for graph2");
|
graph2->getColorBarRightAxis()->setAxisLabel("color scale for graph2");
|
||||||
plot.addGraph(graph2);
|
plot.addGraph(graph2);
|
||||||
```
|
```
|
||||||
Note: If you want to set the range manually, use `ste_imageMin()` and `set_imageMax()` after setting `set_autoImageRange(false)`.
|
Note: If you want to set the range manually, use `ste_imageMin()` and `setImageMax()` after setting `setAutoImageRange(false)`.
|
||||||
|
|
||||||
|
|
||||||
Note also that it is possible to combine any of parametrizations above in a single graph, by setting two or more columns:
|
Note also that it is possible to combine any of parametrizations above in a single graph, by setting two or more columns:
|
||||||
```.cpp
|
```.cpp
|
||||||
JKQTPXYParametrizedScatterGraph* graph5=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph5=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph5->set_xColumn(columnX);
|
graph5->setXColumn(columnX);
|
||||||
graph5->set_yColumn(columnY5);
|
graph5->setYColumn(columnY5);
|
||||||
graph5->set_colorColumn(columnC);
|
graph5->setColorColumn(columnC);
|
||||||
graph5->set_sizeColumn(columnS);
|
graph5->setSizeColumn(columnS);
|
||||||
graph5->set_palette(JKQTPMathImageBLUEYELLOW);
|
graph5->setPalette(JKQTPMathImageBLUEYELLOW);
|
||||||
graph5->set_drawLine(true);
|
graph5->setDrawLine(true);
|
||||||
graph5->set_title("5: color+size");
|
graph5->setTitle("5: color+size");
|
||||||
graph5->get_colorBarRightAxis()->setAxisLabel("color scale for graph5");
|
graph5->getColorBarRightAxis()->setAxisLabel("color scale for graph5");
|
||||||
plot.addGraph(graph5);
|
plot.addGraph(graph5);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -60,50 +60,50 @@ int main(int argc, char* argv[])
|
|||||||
// 3.1 for graph1, we use dataset X/Y1
|
// 3.1 for graph1, we use dataset X/Y1
|
||||||
// and the symbol type is choose according to the contents of column P:
|
// and the symbol type is choose according to the contents of column P:
|
||||||
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph1->set_xColumn(columnX);
|
graph1->setXColumn(columnX);
|
||||||
graph1->set_yColumn(columnY1);
|
graph1->setYColumn(columnY1);
|
||||||
graph1->set_symbolColumn(columnP);
|
graph1->setSymbolColumn(columnP);
|
||||||
graph1->set_drawLine(true);
|
graph1->setDrawLine(true);
|
||||||
graph1->set_color(QColor("blueviolet"));
|
graph1->setColor(QColor("blueviolet"));
|
||||||
graph1->set_title("1: symbol type");
|
graph1->setTitle("1: symbol type");
|
||||||
plot.addGraph(graph1);
|
plot.addGraph(graph1);
|
||||||
|
|
||||||
// 3.2 for graph2, we use dataset X/Y2
|
// 3.2 for graph2, we use dataset X/Y2
|
||||||
// and the symbol color is choose according to the contents of column C
|
// and the symbol color is choose according to the contents of column C
|
||||||
// and the actual colors are chose from palette JKQTPMathImageRYGB:
|
// and the actual colors are chose from palette JKQTPMathImageRYGB:
|
||||||
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph2->set_xColumn(columnX);
|
graph2->setXColumn(columnX);
|
||||||
graph2->set_yColumn(columnY2);
|
graph2->setYColumn(columnY2);
|
||||||
graph2->set_colorColumn(columnC);
|
graph2->setColorColumn(columnC);
|
||||||
graph2->set_palette(JKQTPMathImageRYGB);
|
graph2->setPalette(JKQTPMathImageRYGB);
|
||||||
graph2->set_symbol(JKQTPFilledRect);
|
graph2->setSymbol(JKQTPFilledRect);
|
||||||
graph2->set_drawLine(true);
|
graph2->setDrawLine(true);
|
||||||
graph2->set_title("2: color");
|
graph2->setTitle("2: color");
|
||||||
graph2->get_colorBarRightAxis()->setAxisLabel("color scale for graph2");
|
graph2->getColorBarRightAxis()->setAxisLabel("color scale for graph2");
|
||||||
plot.addGraph(graph2);
|
plot.addGraph(graph2);
|
||||||
|
|
||||||
// 3.3 for graph3, we use dataset X/Y3
|
// 3.3 for graph3, we use dataset X/Y3
|
||||||
// and the symbol size is choose according to the contents of column S:
|
// and the symbol size is choose according to the contents of column S:
|
||||||
JKQTPXYParametrizedScatterGraph* graph3=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph3=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph3->set_xColumn(columnX);
|
graph3->setXColumn(columnX);
|
||||||
graph3->set_yColumn(columnY3);
|
graph3->setYColumn(columnY3);
|
||||||
graph3->set_sizeColumn(columnS);
|
graph3->setSizeColumn(columnS);
|
||||||
graph3->set_symbol(JKQTPFilledCircle);
|
graph3->setSymbol(JKQTPFilledCircle);
|
||||||
graph3->set_drawLine(true);
|
graph3->setDrawLine(true);
|
||||||
graph3->set_title("3: symbol size");
|
graph3->setTitle("3: symbol size");
|
||||||
plot.addGraph(graph3);
|
plot.addGraph(graph3);
|
||||||
|
|
||||||
// 3.4 for graph4, we use X/Y4
|
// 3.4 for graph4, we use X/Y4
|
||||||
// and the symbol color is choose according to the contents of column RGB,
|
// and the symbol color is choose according to the contents of column RGB,
|
||||||
// which directly contains the RGB values, as set with qRgb():
|
// which directly contains the RGB values, as set with qRgb():
|
||||||
JKQTPXYParametrizedScatterGraph* graph4=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph4=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph4->set_xColumn(columnX);
|
graph4->setXColumn(columnX);
|
||||||
graph4->set_yColumn(columnY4);
|
graph4->setYColumn(columnY4);
|
||||||
graph4->set_colorColumn(columnRGB);
|
graph4->setColorColumn(columnRGB);
|
||||||
graph4->set_colorColumnContainsRGB(true);
|
graph4->setColorColumnContainsRGB(true);
|
||||||
graph4->set_drawLine(true);
|
graph4->setDrawLine(true);
|
||||||
graph4->set_symbol(JKQTPFilledDownTriangle);
|
graph4->setSymbol(JKQTPFilledDownTriangle);
|
||||||
graph4->set_title("4: RGB-color");
|
graph4->setTitle("4: RGB-color");
|
||||||
plot.addGraph(graph4);
|
plot.addGraph(graph4);
|
||||||
|
|
||||||
// 3.5 for graph2, we use dataset X/Y5
|
// 3.5 for graph2, we use dataset X/Y5
|
||||||
@ -111,40 +111,40 @@ int main(int argc, char* argv[])
|
|||||||
// of columns C and S respectively.
|
// of columns C and S respectively.
|
||||||
// The actual colors are chose from palette JKQTPMathImageBLUEYELLOW:
|
// The actual colors are chose from palette JKQTPMathImageBLUEYELLOW:
|
||||||
JKQTPXYParametrizedScatterGraph* graph5=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph5=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph5->set_xColumn(columnX);
|
graph5->setXColumn(columnX);
|
||||||
graph5->set_yColumn(columnY5);
|
graph5->setYColumn(columnY5);
|
||||||
graph5->set_colorColumn(columnC);
|
graph5->setColorColumn(columnC);
|
||||||
graph5->set_sizeColumn(columnS);
|
graph5->setSizeColumn(columnS);
|
||||||
graph5->set_palette(JKQTPMathImageBLUEYELLOW);
|
graph5->setPalette(JKQTPMathImageBLUEYELLOW);
|
||||||
graph5->set_drawLine(true);
|
graph5->setDrawLine(true);
|
||||||
graph5->set_title("5: color+size");
|
graph5->setTitle("5: color+size");
|
||||||
graph5->get_colorBarRightAxis()->setAxisLabel("color scale for graph5");
|
graph5->getColorBarRightAxis()->setAxisLabel("color scale for graph5");
|
||||||
plot.addGraph(graph5);
|
plot.addGraph(graph5);
|
||||||
|
|
||||||
// 3.6 for graph2, we use dataset X/Y6
|
// 3.6 for graph2, we use dataset X/Y6
|
||||||
// and the line width is set by column LW:
|
// and the line width is set by column LW:
|
||||||
JKQTPXYParametrizedScatterGraph* graph6=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph6=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph6->set_xColumn(columnX);
|
graph6->setXColumn(columnX);
|
||||||
graph6->set_yColumn(columnY6);
|
graph6->setYColumn(columnY6);
|
||||||
graph6->setLinewidthColumn(columnLW);
|
graph6->setLinewidthColumn(columnLW);
|
||||||
graph6->set_drawLine(true);
|
graph6->setDrawLine(true);
|
||||||
graph6->set_symbol(JKQTPNoSymbol);
|
graph6->setSymbol(JKQTPNoSymbol);
|
||||||
graph6->set_title("6: line width");
|
graph6->setTitle("6: line width");
|
||||||
plot.addGraph(graph6);
|
plot.addGraph(graph6);
|
||||||
|
|
||||||
// 3.7 for graph2, we use dataset X/Y7
|
// 3.7 for graph2, we use dataset X/Y7
|
||||||
// and the line width is set by column LW and the color from palette JKQTPMathImageBLUEYELLOW via column C:
|
// and the line width is set by column LW and the color from palette JKQTPMathImageBLUEYELLOW via column C:
|
||||||
JKQTPXYParametrizedScatterGraph* graph7=new JKQTPXYParametrizedScatterGraph(&plot);
|
JKQTPXYParametrizedScatterGraph* graph7=new JKQTPXYParametrizedScatterGraph(&plot);
|
||||||
graph7->set_xColumn(columnX);
|
graph7->setXColumn(columnX);
|
||||||
graph7->set_yColumn(columnY7);
|
graph7->setYColumn(columnY7);
|
||||||
graph7->setLinewidthColumn(columnLW);
|
graph7->setLinewidthColumn(columnLW);
|
||||||
graph7->set_drawLine(true);
|
graph7->setDrawLine(true);
|
||||||
graph7->set_colorColumn(columnC);
|
graph7->setColorColumn(columnC);
|
||||||
graph7->set_palette(JKQTPMathImageBLUEYELLOW);
|
graph7->setPalette(JKQTPMathImageBLUEYELLOW);
|
||||||
graph7->set_symbol(JKQTPNoSymbol);
|
graph7->setSymbol(JKQTPNoSymbol);
|
||||||
graph7->set_colorBarRightVisible(false);
|
graph7->setColorBarRightVisible(false);
|
||||||
graph7->set_colorBarTopVisible(false);
|
graph7->setColorBarTopVisible(false);
|
||||||
graph7->set_title("7: color+line width");
|
graph7->setTitle("7: color+line width");
|
||||||
plot.addGraph(graph7);
|
plot.addGraph(graph7);
|
||||||
|
|
||||||
// 4. autoscale the plot so the graph is contained and format the coordinate system and key
|
// 4. autoscale the plot so the graph is contained and format the coordinate system and key
|
||||||
@ -152,8 +152,8 @@ int main(int argc, char* argv[])
|
|||||||
plot.getPlotter()->setKeyLayout(JKQTPKeyLayoutOneRow);
|
plot.getPlotter()->setKeyLayout(JKQTPKeyLayoutOneRow);
|
||||||
plot.getXAxis()->setAxisLabel("x-axis");
|
plot.getXAxis()->setAxisLabel("x-axis");
|
||||||
plot.getYAxis()->setAxisLabel("y-axis");
|
plot.getYAxis()->setAxisLabel("y-axis");
|
||||||
plot.getXAxis()->set_drawGrid(false);
|
plot.getXAxis()->setDrawGrid(false);
|
||||||
plot.getYAxis()->set_drawGrid(false);
|
plot.getYAxis()->setDrawGrid(false);
|
||||||
plot.zoomToFit();
|
plot.zoomToFit();
|
||||||
|
|
||||||
// 5. show plotter and make it a decent size
|
// 5. show plotter and make it a decent size
|
||||||
|